public class ExpressionParser
extends java.lang.Object
Constructor and Description |
---|
ExpressionParser()
Creates a new parser instance without custom functions and relations.
|
ExpressionParser(java.util.Set<java.lang.String> functionNames,
java.util.Set<java.lang.String> highPrecedenceRelationNames,
java.util.Set<java.lang.String> lowPrecedenceRelationNames)
Creates a new parser instance with custom functions and relations.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getErrorInfo()
Retrieves a string describing the syntax error that occurred during
expression parsing.
|
static boolean |
isIdentifierCharacter(char c)
Tests if a character is a valid identifier character.
|
ExpressionNode |
parseExpression(java.lang.String expr)
Parses an expression and returns its operator tree.
|
public ExpressionParser()
public ExpressionParser(java.util.Set<java.lang.String> functionNames, java.util.Set<java.lang.String> highPrecedenceRelationNames, java.util.Set<java.lang.String> lowPrecedenceRelationNames)
functionNames
- The set of names the parser recognizes as function
calls (e.g. ln, exp, ...)highPrecedenceRelationNames
- The set of names the parser recognizes
as high precedence relations. These relations have the same
precedence as the comparison relations (
>, <, >=, <=
)lowPrecedenceRelationNames
- The set of names the parser recognizes
as low precedence relations. These relations all have the same
precedence which is lower than the and
relation
(&)public ExpressionNode parseExpression(java.lang.String expr)
expr
- The expression to parse.null
if the expression could not be parsed.public java.lang.String getErrorInfo()
public static boolean isIdentifierCharacter(char c)
c
- Character to test.true
if the character is a letter, digit, or
underscore.