You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2022/05/03 16:38:07 UTC

[commons-jexl] branch JEXL-367 created (now 0f33df92)

This is an automated email from the ASF dual-hosted git repository.

henrib pushed a change to branch JEXL-367
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git


      at 0f33df92 JEXL-367: add fat-arrow to syntax

This branch includes the following new commits:

     new 0f33df92 JEXL-367: add fat-arrow to syntax

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[commons-jexl] 01/01: JEXL-367: add fat-arrow to syntax

Posted by he...@apache.org.
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 <he...@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 :