This is an automated email from the ASF dual-hosted git repository. henrib pushed a commit to branch JEXL-367 in repository https://gitbox.apache.org/repos/asf/commons-jexl.git
commit 0f33df921d4b227c2fed02cde7e71cd59ea6f51b Author: henrib <hen...@apache.org> AuthorDate: Tue May 3 18:38:00 2022 +0200 JEXL-367: add fat-arrow to syntax --- src/main/java/org/apache/commons/jexl3/parser/Parser.jjt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/jexl3/parser/Parser.jjt b/src/main/java/org/apache/commons/jexl3/parser/Parser.jjt index c3fd7fad..94efc9d1 100644 --- a/src/main/java/org/apache/commons/jexl3/parser/Parser.jjt +++ b/src/main/java/org/apache/commons/jexl3/parser/Parser.jjt @@ -127,6 +127,7 @@ 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(); } @@ -134,7 +135,7 @@ TOKEN_MGR_DECLS : { | < FALSE : "false" > { popDot(); } | < RETURN : "return" > { popDot(); } | < FUNCTION : "function" > { popDot(); } - | < LAMBDA : "->" > + | < LAMBDA : "->" | "=>" > { popDot(); } | < BREAK : "break" > { popDot(); } | < CONTINUE : "continue" > { popDot(); } | < PRAGMA : "#pragma" > { popDot(); } @@ -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 :