Class: ExprParser

ExprParser(tokenStream, symbols)

new ExprParser(tokenStream, symbols)

Parser for (constant) expressions
Parameters:
Name Type Description
tokenStream Parser.TokenStream The stream of tokens to parse
symbols array An array of pre-defined symbols
Source:

Methods

parseBinaryExpression() → {number}

Parse a binary expression A binary expression is either an unary expression or a binary expression followed by a binary operator and another binary expression. Precedence of operations is taken into account.
Source:
Returns:
The value of the expression
Type
number

parseBinaryOperator() → {Object|undefined}

Parse an optional binary operator
Source:
Returns:
The description of the binary operator, or undefined if no operator is present.
Type
Object | undefined

parseExpression() → {number}

Parse an expression An expression is a binary expression. This function is here to allow extension by other expression types. Use this function instead of the more specific functions if you want to parse general expressions.
Source:
Returns:
The value of the expression
Type
number

parsePostfixExpression() → {number}

Parse a postfix expression A postfix expression is a builtin function call or a primary expression.
Source:
Returns:
The value of the expression
Type
number

parsePrimaryExpression() → {number}

Parse a primary expression A primary expression is a number literal or a parenthesized expression.
Source:
Returns:
The value of the expression
Type
number

parseUnaryExpression() → {number}

Parse an unary expression An unary expression is either a unary operator followed by an unary expression or a postfix expression.
Source:
Returns:
The value of the expression
Type
number

parseUnaryOperator() → {function|undefined}

Parse an optional unary operator
Source:
Returns:
The function used to evaluate the operator, or undefined if no operator is present.
Type
function | undefined