Description
The ExpressionParser class allows you to implement an expression parser.
Properties
_expression
Expression string.
private
String _expression = ""
_initialTokens
List of original expression tokens.
public
List<ExpressionToken> _initialTokens = new ArrayList<>()
_originalTokens
G)riginal tokens
private
List<Token> _originalTokens = new ArrayList<>()
_currentTokenIndex
Current token index.
private
int _currentTokenIndex
_resultTokens
List of parsed expression tokens.
private
List<ExpressionTokenToken> _resultTokens = new ArrayList<>()
_variableNames
List of found variable names.
private
List_variableNames = new ArrayList<>()
Instance methods
getExpression
Gets an new expression string.
public
String getExpression()
- returns: String - expression string.
setExpression
Gets an new expression string.
public
void setExpression(String value) throws Exception
- value: String - expression string.
getOriginalTokens
Gets original tokens.
public
ListgetOriginalTokens()
- returns: String - expression string.
setOriginalTokens
Sets original tokens.
public
void setOriginalTokens(Listvalue) throws SyntaxException
- value: List
- list of tokens.
getInitialTokens
Gets initial tokens.
public
ListgetInitialTokens()
- returns: List
- list of tokens.
getResultTokens
Gets result tokens.
public
ListgetResultTokens()
- returns: List
- list of expression tokens.
getVariableNames
Gets variable names.
public
ListgetVariableNames()
- returns: List
- list of variable names.
clear
Clears parsing results.
public
void clear()
parseString
Sets a new expression string and parses it into internal byte code.
public
void parseString(String expression) throws Exception
- expression: String - new expression string.
parseTokens
Parses a given token.
public
void parseTokens(List<Token> tokens) throws SyntaxException
- tokens: Token[] - token to be parsed.