Implements an expression parser class.
Description
The ExpressionParser class allows you to implement an expression parser.
Properties
expression
Expression string.
public
expression(): string
- returns: string - expression string.
public
expression(value: string)
- value: string - expression string.
initialTokens
List of original expression tokens.
public
initialTokens(): ExpressionToken[]
- returns: ExpressionToken[] - list of expression tokens.
originalTokens
Gets the original tokens
public
originalTokens(): Token[]
- returns: Token[] - the token list
Sets the original tokens
public
originalTokens(value: Token[])
- value: Token[] - the token list
resultTokens
List of parsed expression tokens.
public
resultTokens(): ExpressionToken[]
- returns: ExpressionToken[] - list of expression tokens.
variableNames
List of found variable names.
public
variableNames(): string[]
- returns: string[] - list of found variable names.
Instance methods
clear
Clears parsing results.
public
clear(): void
parseString
Sets a new expression string and parses it into internal byte code.
public
parseString(expression: string): void
- expression: string - new expression string.
parseTokens
Parses a given token.
public
parseTokens(tokens: Token[]): void
- tokens: Token[] - token to be parsed.