public class Parser
extends java.lang.Object
implements java.io.Serializable
These unary functions are defined: abs, acos, asin, atan, ceil, cos, exp, floor, log, round, sin, sqrt, tan. Each requires one argument enclosed in parentheses.
There are also binary functions: atan2, min, max; and a ternary conditional function: if(test, then, else).
Whitespace outside identifiers is ignored.
Examples:
Constructor and Description |
---|
Parser() |
Modifier and Type | Method and Description |
---|---|
void |
allow(Variable optVariable)
Adjust the set of allowed variables: create it (if not yet
existent) and add optVariable (if it's nonnull).
|
static Expr |
parse(java.lang.String input)
Return the expression denoted by the input string.
|
Expr |
parseString(java.lang.String input)
Return the expression denoted by the input string.
|
public static Expr parse(java.lang.String input) throws SyntaxException
input
- the unparsed expressionSyntaxException
- if the input is unparsablepublic void allow(Variable optVariable)
optVariable
- the variable to be allowed, or nullpublic Expr parseString(java.lang.String input) throws SyntaxException
input
- the unparsed expressionSyntaxException
- if the input is unparsable