Package org.camunda.bpm.engine.impl.juel
Class Parser
- java.lang.Object
-
- org.camunda.bpm.engine.impl.juel.Parser
-
public class Parser extends java.lang.ObjectHandcrafted top-down parser.- Author:
- Christoph Beck
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParser.ExtensionHandlerProvide limited support for syntax extensions.static classParser.ExtensionPointstatic classParser.ParseExceptionParse exception type
-
Field Summary
Fields Modifier and Type Field Description protected Buildercontextprotected java.util.Map<Scanner.ExtensionToken,Parser.ExtensionHandler>extensionsprotected Scannerscanner
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 Scanner.TokenconsumeToken()consume current token (get next token).protected 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(java.util.List<AstNode> nodes)protected AstDotcreateAstDot(AstNode base, java.lang.String property, boolean lvalue)protected AstFunctioncreateAstFunction(java.lang.String name, int index, AstParameters params)protected AstIdentifiercreateAstIdentifier(java.lang.String name, int index)protected AstMethodcreateAstMethod(AstProperty property, AstParameters params)protected AstUnarycreateAstUnary(AstNode child, AstUnary.Operator operator)protected ScannercreateScanner(java.lang.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 voidfail(java.lang.String expected)throw exceptionprotected voidfail(Scanner.Symbol expected)throw exceptionprotected AstFunctionfunction(java.lang.String name, AstParameters params)protected Parser.ExtensionHandlergetExtensionHandler(Scanner.Token token)protected java.util.List<FunctionNode>getFunctions()protected java.util.List<IdentifierNode>getIdentifiers()protected Scanner.TokengetToken()protected AstIdentifieridentifier(java.lang.String name)protected AstNodeliteral()literal := <TRUE> | <FALSE> | <STRING> | <INTEGER> | <FLOAT> | <NULL>protected Scanner.Tokenlookahead(int index)get lookahead symbol.protected AstNodemul(boolean required)mul := unary (<MUL> unary | <DIV> unary | <MOD> unary)*protected AstNodenonliteral()nonliteral := <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 java.lang.NumberparseFloat(java.lang.String string)Parse a floating point literal.protected java.lang.NumberparseInteger(java.lang.String string)Parse an integer literal.voidputExtensionHandler(Scanner.ExtensionToken token, Parser.ExtensionHandler extension)protected AstNodetext()text := <TEXT>Treetree()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 Detail
-
context
protected final Builder context
-
scanner
protected final Scanner scanner
-
extensions
protected java.util.Map<Scanner.ExtensionToken,Parser.ExtensionHandler> extensions
-
-
Constructor Detail
-
Parser
public Parser(Builder context, java.lang.String input)
-
-
Method Detail
-
createScanner
protected Scanner createScanner(java.lang.String expression)
-
putExtensionHandler
public void putExtensionHandler(Scanner.ExtensionToken token, Parser.ExtensionHandler extension)
-
getExtensionHandler
protected Parser.ExtensionHandler getExtensionHandler(Scanner.Token token)
-
parseInteger
protected java.lang.Number parseInteger(java.lang.String string) throws Parser.ParseExceptionParse an integer literal.- Parameters:
string- string to parse- Returns:
Long.valueOf(string)- Throws:
Parser.ParseException
-
parseFloat
protected java.lang.Number parseFloat(java.lang.String string) throws Parser.ParseExceptionParse a floating point literal.- Parameters:
string- string to parse- Returns:
Double.valueOf(string)- Throws:
Parser.ParseException
-
createAstBinary
protected AstBinary createAstBinary(AstNode left, AstNode right, AstBinary.Operator operator)
-
createAstBracket
protected AstBracket createAstBracket(AstNode base, AstNode property, boolean lvalue, boolean strict)
-
createAstComposite
protected AstComposite createAstComposite(java.util.List<AstNode> nodes)
-
createAstDot
protected AstDot createAstDot(AstNode base, java.lang.String property, boolean lvalue)
-
createAstFunction
protected AstFunction createAstFunction(java.lang.String name, int index, AstParameters params)
-
createAstIdentifier
protected AstIdentifier createAstIdentifier(java.lang.String name, int index)
-
createAstMethod
protected AstMethod createAstMethod(AstProperty property, AstParameters params)
-
createAstUnary
protected AstUnary createAstUnary(AstNode child, AstUnary.Operator operator)
-
getFunctions
protected final java.util.List<FunctionNode> getFunctions()
-
getIdentifiers
protected final java.util.List<IdentifierNode> getIdentifiers()
-
getToken
protected final Scanner.Token getToken()
-
fail
protected void fail(java.lang.String expected) throws Parser.ParseExceptionthrow exception- Throws:
Parser.ParseException
-
fail
protected void fail(Scanner.Symbol expected) throws Parser.ParseException
throw exception- Throws:
Parser.ParseException
-
lookahead
protected final Scanner.Token lookahead(int index) throws Scanner.ScanException, Parser.ParseException
get lookahead symbol.
-
consumeToken
protected final Scanner.Token consumeToken() throws Scanner.ScanException, Parser.ParseException
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
public Tree tree() throws Scanner.ScanException, Parser.ParseException
tree := text? ((dynamic text?)+ | (deferred text?)+)?
-
text
protected AstNode text() throws Scanner.ScanException, Parser.ParseException
text := <TEXT>
-
eval
protected AstEval eval() throws Scanner.ScanException, Parser.ParseException
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
protected AstNode expr(boolean required) throws Scanner.ScanException, Parser.ParseException
expr := or (<QUESTION> expr <COLON> expr)?
-
or
protected AstNode or(boolean required) throws Scanner.ScanException, Parser.ParseException
or := and (<OR> and)*
-
and
protected AstNode and(boolean required) throws Scanner.ScanException, Parser.ParseException
and := eq (<AND> eq)*
-
eq
protected AstNode eq(boolean required) throws Scanner.ScanException, Parser.ParseException
eq := cmp (<EQ> cmp | <NE> cmp)*
-
cmp
protected AstNode cmp(boolean required) throws Scanner.ScanException, Parser.ParseException
cmp := add (<LT> add | <LE> add | <GE> add | <GT> add)*
-
add
protected AstNode add(boolean required) throws Scanner.ScanException, Parser.ParseException
add := add (<PLUS> mul | <MINUS> mul)*
-
mul
protected AstNode mul(boolean required) throws Scanner.ScanException, Parser.ParseException
mul := unary (<MUL> unary | <DIV> unary | <MOD> unary)*
-
unary
protected AstNode unary(boolean required) throws Scanner.ScanException, Parser.ParseException
unary := <NOT> unary | <MINUS> unary | <EMPTY> unary | value
-
value
protected AstNode value() throws Scanner.ScanException, Parser.ParseException
value := (nonliteral | literal) (<DOT> <IDENTIFIER> | <LBRACK> expr <RBRACK>)*
-
nonliteral
protected AstNode nonliteral() throws Scanner.ScanException, Parser.ParseException
nonliteral := <IDENTIFIER> | function | <LPAREN> expr <RPAREN> function := (<IDENTIFIER> <COLON>)? <IDENTIFIER> <LPAREN> list? <RPAREN>
-
params
protected AstParameters params() throws Scanner.ScanException, Parser.ParseException
params := <LPAREN> (expr (<COMMA> expr)*)? <RPAREN>
-
literal
protected AstNode literal() throws Scanner.ScanException, Parser.ParseException
literal := <TRUE> | <FALSE> | <STRING> | <INTEGER> | <FLOAT> | <NULL>
-
function
protected final AstFunction function(java.lang.String name, AstParameters params)
-
identifier
protected final AstIdentifier identifier(java.lang.String name)
-
-