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/04/25 10:18:50 UTC

[commons-jexl] 05/13: JEXL-360: added operators, syntax, basic tests

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

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

commit 1c0ea015d658db440937a91dc42ccf1136e3b299
Author: henrib <he...@apache.org>
AuthorDate: Tue Feb 15 16:20:42 2022 +0100

    JEXL-360: added operators, syntax, basic tests
---
 src/main/java/org/apache/commons/jexl3/JexlOperator.java | 14 +++++++-------
 src/main/java/org/apache/commons/jexl3/parser/Parser.jjt |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/commons/jexl3/JexlOperator.java b/src/main/java/org/apache/commons/jexl3/JexlOperator.java
index 3a43d5b7..daa68f35 100644
--- a/src/main/java/org/apache/commons/jexl3/JexlOperator.java
+++ b/src/main/java/org/apache/commons/jexl3/JexlOperator.java
@@ -106,7 +106,7 @@ public enum JexlOperator {
 
     /**
      * Bit-pattern right-shift operator.
-     * <br><strong>Syntax:</strong> <code>x &gt;&gt; y</code>
+     * <br><strong>Syntax:</strong> <code>x >> y</code>
      * <br><strong>Method:</strong> <code>T rightShift(L x, R y);</code>.
      * @see JexlArithmetic#shiftRight(Object, Object)
      */
@@ -114,7 +114,7 @@ public enum JexlOperator {
 
     /**
      * Bit-pattern right-shift unsigned operator.
-     * <br><strong>Syntax:</strong> <code>x &gt;&gt;&gt; y</code>
+     * <br><strong>Syntax:</strong> <code>x >>> y</code>
      * <br><strong>Method:</strong> <code>T rightShiftUnsigned(L x, R y);</code>.
      * @see JexlArithmetic#shiftRightUnsigned(Object, Object)
      */
@@ -122,7 +122,7 @@ public enum JexlOperator {
 
     /**
      * Bit-pattern left-shift operator.
-     * <br><strong>Syntax:</strong> <code>x &lt;&lt; y</code>
+     * <br><strong>Syntax:</strong> <code>x << y</code>
      * <br><strong>Method:</strong> <code>T leftShift(L x, R y);</code>.
      * @see JexlArithmetic#shiftLeft(Object, Object)
      */
@@ -298,21 +298,21 @@ public enum JexlOperator {
 
     /**
      * Self-right-shift operator.
-     * <br><strong>Syntax:</strong> <code>x &gt;&gt;= y</code>
+     * <br><strong>Syntax:</strong> <code>x >>= y</code>
      * <br><strong>Method:</strong> <code>T selfShiftRight(L x, R y);</code>.
      */
-    SELF_SHIFTRIGHT(">>=", "selfShiftRight", SHIFTRIGHT),
+    SELF_SHIFTRIGHT(">>", "selfShiftRight", SHIFTRIGHT),
 
     /**
      * Self-right-shift unsigned operator.
-     * <br><strong>Syntax:</strong> <code>x &gt;&gt;&gt; y</code>
+     * <br><strong>Syntax:</strong> <code>x >>> y</code>
      * <br><strong>Method:</strong> <code>T selfShiftRightUnsigned(L x, R y);</code>.
      */
     SELF_SHIFTRIGHTU(">>>=", "selfShiftRightUnsigned", SHIFTRIGHTU),
 
     /**
      * Self-left-shift operator.
-     * <br><strong>Syntax:</strong> <code>x &lt;&lt; y</code>
+     * <br><strong>Syntax:</strong> <code>x << y</code>
      * <br><strong>Method:</strong> <code>T selfShiftLeft(L x, R y);</code>.
      */
     SELF_SHIFTLEFT("<<=", "selfShiftLeft", SHIFTLEFT),
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 58d46906..9ad94800 100644
--- a/src/main/java/org/apache/commons/jexl3/parser/Parser.jjt
+++ b/src/main/java/org/apache/commons/jexl3/parser/Parser.jjt
@@ -582,7 +582,7 @@ void EqualityExpression() #void : {}
 void RelationalExpression() #void : {}
 {
   AdditiveExpression()
-  ( LOOKAHEAD(2) (
+  (
     (<lt> |<LT>)  AdditiveExpression() #LTNode(2)
    |
     (<gt> | <GT>) ShiftExpression() #GTNode(2)
@@ -602,7 +602,7 @@ void RelationalExpression() #void : {}
     <eeq> ShiftExpression() #EWNode(2) // ends with
    |
     <ene> AdditiveExpression() #NEWNode(2) // not ends with
-  ) )?
+  )?
 }
 
 /***************************************