Package org.camunda.bpm.impl.juel
Class Parser
java.lang.Object
org.camunda.bpm.impl.juel.Parser
Handcrafted top-down parser.
- Author:
- Christoph Beck
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classProvide limited support for syntax extensions.static enumstatic classParse exception type -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Builderprotected Map<Scanner.ExtensionToken,Parser.ExtensionHandler> protected final Scanner -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected AstNodeadd(boolean required) add := add (<PLUS> mul | <MINUS> mul)*protected AstNodeand(boolean required) and := eq (<AND> eq)*protected AstNodecmp(boolean required) cmp := add (<LT> add | <LE> add | <GE> add | <GT> add)*protected final Scanner.Tokenconsume current token (get next token).protected final Scanner.TokenconsumeToken(Scanner.Symbol expected) consume current token (get next token); throw exception if the current token doesn't match the expected symbol.protected AstBinarycreateAstBinary(AstNode left, AstNode right, AstBinary.Operator operator) protected AstBracketcreateAstBracket(AstNode base, AstNode property, boolean lvalue, boolean strict) protected AstChoicecreateAstChoice(AstNode question, AstNode yes, AstNode no) protected AstCompositecreateAstComposite(List<AstNode> nodes) protected AstDotcreateAstDot(AstNode base, String property, boolean lvalue) protected AstFunctioncreateAstFunction(String name, int index, AstParameters params) protected AstIdentifiercreateAstIdentifier(String name, int index) protected AstMethodcreateAstMethod(AstProperty property, AstParameters params) protected AstUnarycreateAstUnary(AstNode child, AstUnary.Operator operator) protected ScannercreateScanner(String expression) protected AstNodeeq(boolean required) eq := cmp (<EQ> cmp | <NE> cmp)*protected AstEvaleval()eval := dynamic | deferredprotected AstEvaleval(boolean required, boolean deferred) dynmamic := <START_EVAL_DYNAMIC> expr <END_EVAL> deferred := <START_EVAL_DEFERRED> expr <END_EVAL>protected AstNodeexpr(boolean required) expr := or (<QUESTION> expr <COLON> expr)?protected voidthrow exceptionprotected voidfail(Scanner.Symbol expected) throw exceptionprotected final AstFunctionfunction(String name, AstParameters params) protected Parser.ExtensionHandlergetExtensionHandler(Scanner.Token token) protected final List<FunctionNode>protected final List<IdentifierNode>protected final Scanner.TokengetToken()protected final AstIdentifieridentifier(String name) protected AstNodeliteral()literal := <TRUE> | <FALSE> | <STRING> | <INTEGER> | <FLOAT> | <NULL>protected final Scanner.Tokenlookahead(int index) get lookahead symbol.protected AstNodemul(boolean required) mul := unary (<MUL> unary | <DIV> unary | <MOD> unary)*protected AstNodenonliteral := <IDENTIFIER> | function | <LPAREN> expr <RPAREN> function := (<IDENTIFIER> <COLON>)? <IDENTIFIER> <LPAREN> list? <RPAREN>protected AstNodeor(boolean required) or := and (<OR> and)*protected AstParametersparams()params := <LPAREN> (expr (<COMMA> expr)*)? <RPAREN>protected NumberparseFloat(String string) Parse a floating point literal.protected NumberparseInteger(String string) Parse an integer literal.voidputExtensionHandler(Scanner.ExtensionToken token, Parser.ExtensionHandler extension) protected AstNodetext()text := <TEXT>tree()tree := text? ((dynamic text?)+ | (deferred text?)+)?protected AstNodeunary(boolean required) unary := <NOT> unary | <MINUS> unary | <EMPTY> unary | valueprotected AstNodevalue()value := (nonliteral | literal) (<DOT> <IDENTIFIER> | <LBRACK> expr <RBRACK>)*
-
Field Details
-
context
-
scanner
-
extensions
-
-
Constructor Details
-
Parser
-
-
Method Details
-
createScanner
-
putExtensionHandler
-
getExtensionHandler
-
parseInteger
Parse an integer literal.- Parameters:
string- string to parse- Returns:
Long.valueOf(string)- Throws:
Parser.ParseException
-
parseFloat
Parse a floating point literal.- Parameters:
string- string to parse- Returns:
Double.valueOf(string)- Throws:
Parser.ParseException
-
createAstBinary
-
createAstBracket
protected AstBracket createAstBracket(AstNode base, AstNode property, boolean lvalue, boolean strict) -
createAstChoice
-
createAstComposite
-
createAstDot
-
createAstFunction
-
createAstIdentifier
-
createAstMethod
-
createAstUnary
-
getFunctions
-
getIdentifiers
-
getToken
-
fail
throw exception- Throws:
Parser.ParseException
-
fail
throw exception- Throws:
Parser.ParseException
-
lookahead
protected final Scanner.Token lookahead(int index) throws Scanner.ScanException, Parser.ParseException get lookahead symbol. -
consumeToken
consume current token (get next token).- Returns:
- the consumed token (which was the current token when calling this method)
- Throws:
Scanner.ScanExceptionParser.ParseException
-
consumeToken
protected final Scanner.Token consumeToken(Scanner.Symbol expected) throws Scanner.ScanException, Parser.ParseException consume current token (get next token); throw exception if the current token doesn't match the expected symbol. -
tree
tree := text? ((dynamic text?)+ | (deferred text?)+)? -
text
text := <TEXT> -
eval
eval := dynamic | deferred -
eval
protected AstEval eval(boolean required, boolean deferred) throws Scanner.ScanException, Parser.ParseException dynmamic := <START_EVAL_DYNAMIC> expr <END_EVAL> deferred := <START_EVAL_DEFERRED> expr <END_EVAL> -
expr
expr := or (<QUESTION> expr <COLON> expr)? -
or
or := and (<OR> and)* -
and
and := eq (<AND> eq)* -
eq
eq := cmp (<EQ> cmp | <NE> cmp)* -
cmp
cmp := add (<LT> add | <LE> add | <GE> add | <GT> add)* -
add
add := add (<PLUS> mul | <MINUS> mul)* -
mul
mul := unary (<MUL> unary | <DIV> unary | <MOD> unary)* -
unary
unary := <NOT> unary | <MINUS> unary | <EMPTY> unary | value -
value
value := (nonliteral | literal) (<DOT> <IDENTIFIER> | <LBRACK> expr <RBRACK>)* -
nonliteral
nonliteral := <IDENTIFIER> | function | <LPAREN> expr <RPAREN> function := (<IDENTIFIER> <COLON>)? <IDENTIFIER> <LPAREN> list? <RPAREN> -
params
params := <LPAREN> (expr (<COMMA> expr)*)? <RPAREN> -
literal
literal := <TRUE> | <FALSE> | <STRING> | <INTEGER> | <FLOAT> | <NULL> -
function
-
identifier
-