Skip to content

Commit

Permalink
JEXL-367: add fat-arrow to syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
henrib committed May 6, 2022
1 parent 42eefe6 commit 207eb70
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/main/java/org/apache/commons/jexl3/parser/Parser.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,15 @@ TOKEN_MGR_DECLS : {
| < DO : "do" > { popDot(); }
| < NEW : "new" > { popDot(); }
| < VAR : "var" > { popDot(); }
| < LET : "let" > { popDot(); }
| < EMPTY : "empty" > { popDot(); } /* Revert state to default if was DOT_ID. */
| < SIZE : "size" > { popDot(); } /* Revert state to default if was DOT_ID. */
| < NULL : "null" > { popDot(); }
| < TRUE : "true" > { popDot(); }
| < FALSE : "false" > { popDot(); }
| < RETURN : "return" > { popDot(); }
| < FUNCTION : "function" > { popDot(); }
| < LAMBDA : "->" >
| < LAMBDA : "->" | "=>" > { popDot(); }
| < BREAK : "break" > { popDot(); }
| < CONTINUE : "continue" > { popDot(); }
| < PRAGMA : "#pragma" > { popDot(); }
Expand Down Expand Up @@ -421,22 +422,26 @@ void ForeachStatement() : {}

void ForEachVar() #Reference : {}
{
<VAR> DeclareVar()
<VAR> DeclareVar(false)
|
<LET> DeclareVar(true)
|
Identifier(true)
}

void Var() #void : {}
{
<VAR> DeclareVar() (LOOKAHEAD(1) <assign> Expression() #Assignment(2))?
<VAR> DeclareVar(false) (LOOKAHEAD(1) <assign> Expression() #Assignment(2))?
|
<LET> DeclareVar(true) (LOOKAHEAD(1) <assign> Expression() #Assignment(2))?
}

void DeclareVar() #Var :
void DeclareVar(boolean lexical) #Var :
{
Token t;
}
{
t=<IDENTIFIER> { declareVariable(jjtThis, t); }
t=<IDENTIFIER> { declareVariable(jjtThis, t, lexical); }
}

void Pragma() #void :
Expand Down

0 comments on commit 207eb70

Please sign in to comment.