Package com.github.basking2.sdsai.itrex
Class SimpleExpressionParser
java.lang.Object
com.github.basking2.sdsai.itrex.SimpleExpressionParser
A parser that is JSON-esque, but removes some commas and quotes to better suite the particulars of this language.
The JSON
[ "map", ["curry", "f"], ["list", 1, 2, 3]]
may be parsed to the same expression
[map [curry f] [list 1 2 3]]
String may still be used, but we allow for unquoted tokens.-
Field Summary
Modifier and TypeFieldDescriptionstatic final Pattern
static final Pattern
static final Pattern
static final Pattern
static final Pattern
static final Pattern
static final Pattern
static final Pattern
static final Pattern
static final Pattern
static final Pattern
static final Pattern
static final Pattern
-
Constructor Summary
ConstructorDescriptionSimpleExpressionParser
(String expression) Construct the parser, but do not parse. -
Method Summary
Modifier and TypeMethodDescriptionint
Return the position in the expression string where parsing left off.final Object
parse()
static Object
parseExpression
(String expression)
-
Field Details
-
SKIP_WS
-
COMMA
-
OPEN_BRACKET
-
CLOSE_BRACKET
-
BLOCK_COMMENT
-
FIRST_QUOTE
-
QUOTED_STRING
-
BOOLEAN
-
INTEGER
-
LONG
-
FLOAT
-
DOUBLE
-
WORD
-
-
Constructor Details
-
SimpleExpressionParser
Construct the parser, but do not parse.- Parameters:
expression
- An expression to parse.- See Also:
-
-
Method Details
-
parse
-
parseExpression
-
getPosition
public int getPosition()Return the position in the expression string where parsing left off.- Returns:
- the position in the expression string where parsing left off.
-