cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1404300 [1/2] - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/access/trans/ main/java/org/apache/cayenne/exp/ main/java/org/apache/cayenne/exp/parser/ main/jjtree/org/apache/cayenne/exp/parse...
Date Wed, 31 Oct 2012 19:02:02 GMT
Author: aadamchik
Date: Wed Oct 31 19:02:01 2012
New Revision: 1404300

URL: http://svn.apache.org/viewvc?rev=1404300&view=rev
Log:
CAY-1726 Expression parser support for bit operators

patch by Vital Zanko + cleanup by Andrus

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseLeftShift.java
      - copied, changed from r1403029, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseOr.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseRightShift.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/Expression.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/ExpressionFactory.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseAnd.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseNot.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseOr.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseXor.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParser.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParserConstants.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParserTokenManager.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParserTreeConstants.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ParseException.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/Token.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/TokenMgrError.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/jjtree/org/apache/cayenne/exp/parser/ExpressionParser.jjt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/exp/ExpressionTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java?rev=1404300&r1=1404299&r2=1404300&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/QualifierTranslator.java Wed Oct 31 19:02:01 2012
@@ -308,6 +308,12 @@ public class QualifierTranslator extends
                 case Expression.BITWISE_XOR:
                     out.append(" ").append(operandForBitwiseXor()).append(" ");
                     break;
+                case Expression.BITWISE_LEFT_SHIFT:
+                	out.append(" ").append(operandForBitwiseLeftShift()).append(" ");
+                	break;
+                case Expression.BITWISE_RIGHT_SHIFT:
+                	out.append(" ").append(operandForBitwiseRightShift()).append("" );
+                	break;
             }
         }
         catch (IOException ioex) {
@@ -347,6 +353,20 @@ public class QualifierTranslator extends
     protected String operandForBitwiseXor() {
         return "^";
     }
+    
+    /**
+     * @since 3.2
+     */
+    protected String operandForBitwiseLeftShift() {
+        return "<<";
+    }
+    
+    /**
+     * @since 3.2
+     */
+    protected String operandForBitwiseRightShift() {
+        return ">>";
+    }
 
     public void startNode(Expression node, Expression parentNode) {
         int count = node.getOperandCount();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/Expression.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/Expression.java?rev=1404300&r1=1404299&r2=1404300&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/Expression.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/Expression.java Wed Oct 31 19:02:01 2012
@@ -138,6 +138,16 @@ public abstract class Expression impleme
      * @since 3.1
      */
     public static final int BITWISE_XOR = 42;
+    
+    /**
+     * @since 3.2
+     */
+    public static final int BITWISE_LEFT_SHIFT = 43;
+    
+    /**
+     * @since 3.2
+     */
+    public static final int BITWISE_RIGHT_SHIFT = 44;
 
     private static final int PARSE_BUFFER_MAX_SIZE = 4096;
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/ExpressionFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/ExpressionFactory.java?rev=1404300&r1=1404299&r2=1404300&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/ExpressionFactory.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/ExpressionFactory.java Wed Oct 31 19:02:01 2012
@@ -30,8 +30,10 @@ import org.apache.cayenne.exp.parser.AST
 import org.apache.cayenne.exp.parser.ASTAnd;
 import org.apache.cayenne.exp.parser.ASTBetween;
 import org.apache.cayenne.exp.parser.ASTBitwiseAnd;
+import org.apache.cayenne.exp.parser.ASTBitwiseLeftShift;
 import org.apache.cayenne.exp.parser.ASTBitwiseNot;
 import org.apache.cayenne.exp.parser.ASTBitwiseOr;
+import org.apache.cayenne.exp.parser.ASTBitwiseRightShift;
 import org.apache.cayenne.exp.parser.ASTBitwiseXor;
 import org.apache.cayenne.exp.parser.ASTDbPath;
 import org.apache.cayenne.exp.parser.ASTDivide;
@@ -93,7 +95,7 @@ public class ExpressionFactory {
                 Expression.NOT_BETWEEN, Expression.NOT_IN, Expression.NOT_LIKE,
                 Expression.NOT_LIKE_IGNORE_CASE, Expression.TRUE, Expression.FALSE,
                 Expression.BITWISE_NOT, Expression.BITWISE_AND, Expression.BITWISE_OR,
-                Expression.BITWISE_XOR
+                Expression.BITWISE_XOR, Expression.BITWISE_LEFT_SHIFT, Expression.BITWISE_RIGHT_SHIFT
         };
 
         int max = 0;
@@ -153,6 +155,8 @@ public class ExpressionFactory {
         typeLookup[Expression.BITWISE_OR] = ASTBitwiseOr.class;
         typeLookup[Expression.BITWISE_AND] = ASTBitwiseAnd.class;
         typeLookup[Expression.BITWISE_XOR] = ASTBitwiseXor.class;
+        typeLookup[Expression.BITWISE_LEFT_SHIFT] = ASTBitwiseLeftShift.class;
+        typeLookup[Expression.BITWISE_RIGHT_SHIFT] = ASTBitwiseRightShift.class;
     }
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseAnd.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseAnd.java?rev=1404300&r1=1404299&r2=1404300&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseAnd.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseAnd.java Wed Oct 31 19:02:01 2012
@@ -18,43 +18,57 @@
  ****************************************************************/
 package org.apache.cayenne.exp.parser;
 
+import java.util.Collection;
+import java.util.Iterator;
+
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.util.ConversionUtil;
 
 /**
+ * Bitwise conjunction (AND or '&') expression
+ * 
  * @since 3.1
  */
 public class ASTBitwiseAnd extends SimpleNode {
+	private static final long serialVersionUID = 1L;
 
-    ASTBitwiseAnd(int id) {
-        super(id);
-    }
-
-    public ASTBitwiseAnd() {
-
-        // TODO: parser support
-        super(-1);
-    }
-
-    public ASTBitwiseAnd(SimpleNode left, SimpleNode right) {
-        // TODO: parser support
-        super(-1);
-
-        jjtAddChild(left, 0);
-        jjtAddChild(right, 1);
+	ASTBitwiseAnd(int id) {
+		super(id);
+	}
+	
+	public ASTBitwiseAnd() {
+		super(ExpressionParserTreeConstants.JJTBITWISEAND);
+	}
+	
+	public ASTBitwiseAnd(Object[] nodes) {
+        super(ExpressionParserTreeConstants.JJTBITWISEAND);
+        int len = nodes.length;
+        for (int i = 0; i < len; i++) {
+            jjtAddChild(wrapChild(nodes[i]), i);
+        }
+        
         connectChildren();
+	}
+	
+    public ASTBitwiseAnd(Collection<Object> nodes) {
+        super(ExpressionParserTreeConstants.JJTBITWISEAND);
+        int len = nodes.size();
+        Iterator<Object> it = nodes.iterator();
+        for (int i = 0; i < len; i++) {
+            jjtAddChild(wrapChild(it.next()), i);
+        }
     }
-
-    @Override
-    protected Object evaluateNode(Object o) throws Exception {
+	
+	@Override
+	protected Object evaluateNode(Object o) throws Exception {
         int len = jjtGetNumChildren();
-        if (len != 2) {
-            return Boolean.FALSE;
+        if (len == 0) {
+            return null;
         }
 
-        long result = Long.MIN_VALUE;
+        Long result = null;
         for (int i = 0; i < len; i++) {
-            long value = ConversionUtil.toLong(evaluateChild(i, o), Long.MIN_VALUE);
+            Long value = ConversionUtil.toLong(evaluateChild(i, o), Long.MIN_VALUE);
 
             if (value == Long.MIN_VALUE) {
                 return null;
@@ -64,29 +78,33 @@ public class ASTBitwiseAnd extends Simpl
         }
 
         return result;
-    }
-
-    /**
-     * Creates a copy of this expression node, without copying children.
-     */
-    @Override
-    public Expression shallowCopy() {
-        return new ASTBitwiseAnd(id);
-    }
-
-    @Override
-    protected String getExpressionOperator(int index) {
-        return "|";
-    }
-
-    @Override
-    protected String getEJBQLExpressionOperator(int index) {
-        throw new UnsupportedOperationException("EJBQL 'bitwise and' is not supported");
-    }
+	}
 
+	@Override
+	protected String getExpressionOperator(int index) {
+		return "&";
+	}
+	
+	@Override
+	public int getType() {
+		return Expression.BITWISE_AND;
+	}
+	
+	@Override
+	protected String getEJBQLExpressionOperator(int index) {
+		throw new UnsupportedOperationException(
+				"EJBQL 'bitwise not' is not supported");
+	}
+	
+	@Override
+	public Expression shallowCopy() {
+		return new ASTBitwiseAnd(id);
+	}
+	
     @Override
-    public int getType() {
-        return Expression.BITWISE_AND;
+    public void jjtClose() {
+        super.jjtClose();
+        flattenTree();
     }
 
 }

Copied: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseLeftShift.java (from r1403029, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseOr.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseLeftShift.java?p2=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseLeftShift.java&p1=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseOr.java&r1=1403029&r2=1404300&rev=1404300&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseOr.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseLeftShift.java Wed Oct 31 19:02:01 2012
@@ -18,75 +18,94 @@
  ****************************************************************/
 package org.apache.cayenne.exp.parser;
 
+import java.util.Collection;
+import java.util.Iterator;
+
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.util.ConversionUtil;
 
 /**
- * @since 3.1
+ * Bitwise left shift '<<' operation.
+ * 
+ * @since 3.2
  */
-public class ASTBitwiseOr extends SimpleNode {
+public class ASTBitwiseLeftShift extends SimpleNode {
+    private static final long serialVersionUID = 1L;
 
-    ASTBitwiseOr(int id) {
+    ASTBitwiseLeftShift(int id) {
         super(id);
     }
 
-    public ASTBitwiseOr() {
-
-        // TODO: parser support
-        super(-1);
+    public ASTBitwiseLeftShift() {
+        super(ExpressionParserTreeConstants.JJTBITWISELEFTSHIFT);
     }
 
-    public ASTBitwiseOr(SimpleNode left, SimpleNode right) {
-        // TODO: parser support
-        super(-1);
+    public ASTBitwiseLeftShift(Object[] nodes) {
+        super(ExpressionParserTreeConstants.JJTBITWISELEFTSHIFT);
+        int len = nodes.length;
+        for (int i = 0; i < len; i++) {
+            jjtAddChild(wrapChild(nodes[i]), i);
+        }
 
-        jjtAddChild(left, 0);
-        jjtAddChild(right, 1);
         connectChildren();
     }
 
+    public ASTBitwiseLeftShift(Collection<Object> nodes) {
+        super(ExpressionParserTreeConstants.JJTBITWISELEFTSHIFT);
+        int len = nodes.size();
+        Iterator<Object> it = nodes.iterator();
+        for (int i = 0; i < len; i++) {
+            jjtAddChild(wrapChild(it.next()), i);
+        }
+    }
+
     @Override
     protected Object evaluateNode(Object o) throws Exception {
         int len = jjtGetNumChildren();
-        if (len != 2) {
-            return Boolean.FALSE;
+        if (len == 0) {
+            return null;
         }
 
-        long result = Long.MIN_VALUE;
+        Long result = null;
         for (int i = 0; i < len; i++) {
-            long value = ConversionUtil.toLong(evaluateChild(i, o), Long.MIN_VALUE);
+            Long value = ConversionUtil.toLong(evaluateChild(i, o),
+                    Long.MIN_VALUE);
 
             if (value == Long.MIN_VALUE) {
                 return null;
             }
 
-            result = (i == 0) ? value : result | value;
+            result = (i == 0) ? value : result << value;
         }
 
         return result;
     }
 
-    /**
-     * Creates a copy of this expression node, without copying children.
-     */
     @Override
-    public Expression shallowCopy() {
-        return new ASTBitwiseOr(id);
+    protected String getExpressionOperator(int index) {
+        return "<<";
     }
 
     @Override
-    protected String getExpressionOperator(int index) {
-        return "|";
+    public int getType() {
+        return Expression.BITWISE_LEFT_SHIFT;
     }
 
     @Override
     protected String getEJBQLExpressionOperator(int index) {
-        throw new UnsupportedOperationException("EJBQL 'bitwise or' is not supported");
+        throw new UnsupportedOperationException(
+                "EJBQL 'bitwise not' is not supported");
     }
 
     @Override
-    public int getType() {
-        return Expression.BITWISE_OR;
+    public Expression shallowCopy() {
+        return new ASTBitwiseLeftShift(id);
+    }
+
+    @Override
+    public void jjtClose() {
+        super.jjtClose();
+        flattenTree();
     }
 
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseNot.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseNot.java?rev=1404300&r1=1404299&r2=1404300&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseNot.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseNot.java Wed Oct 31 19:02:01 2012
@@ -22,64 +22,63 @@ import org.apache.cayenne.exp.Expression
 import org.apache.cayenne.util.ConversionUtil;
 
 /**
+ * Bitwise negation (NOT i.e. inventor or '~') operation .
+ * 
  * @since 3.1
  */
 public class ASTBitwiseNot extends SimpleNode {
+	private static final long serialVersionUID = 1L;
 
-    ASTBitwiseNot(int id) {
-        super(id);
-    }
-
-    public ASTBitwiseNot() {
-
-        // TODO: parser support
-        super(-1);
-    }
-
-    public ASTBitwiseNot(SimpleNode expression) {
-        // TODO: parser support
-        super(-1);
-
-        jjtAddChild(expression, 0);
+	ASTBitwiseNot(int id) {
+		super(id);
+	}
+
+	public ASTBitwiseNot() {
+		super(ExpressionParserTreeConstants.JJTBITWISENOT);
+	}
+
+	public ASTBitwiseNot(Object node) {
+        super(ExpressionParserTreeConstants.JJTBITWISENOT);
+        jjtAddChild(wrapChild(node), 0);
         connectChildren();
-    }
+	}
+
+	@Override
+	protected Object evaluateNode(Object o) throws Exception {
 
-    @Override
-    protected Object evaluateNode(Object o) throws Exception {
-        int len = jjtGetNumChildren();
-        if (len != 1) {
-            return Boolean.FALSE;
-        }
-
-        long value = ConversionUtil.toLong(evaluateChild(0, o), Long.MIN_VALUE);
-
-        if (value == Long.MIN_VALUE) {
-            return null;
-        }
-
-        return ~value;
-    }
-
-    /**
-     * Creates a copy of this expression node, without copying children.
-     */
-    @Override
-    public Expression shallowCopy() {
-        return new ASTBitwiseNot(id);
-    }
-
-    @Override
-    protected String getExpressionOperator(int index) {
-        return "~";
-    }
-
-    @Override
-    protected String getEJBQLExpressionOperator(int index) {
-        throw new UnsupportedOperationException("EJBQL 'bitwise not' is not supported");
-    }
-
-    @Override
-    public int getType() {
-        return Expression.BITWISE_NOT;
-    }
+		int len = jjtGetNumChildren();
+		if (len != 1) {
+			return Boolean.FALSE;
+		}
+
+		long value = ConversionUtil.toLong(evaluateChild(0, o), Long.MIN_VALUE);
+
+		if (value == Long.MIN_VALUE) {
+			return null;
+		}
+
+		return ~value;
+
+	}
+
+	@Override
+	protected String getExpressionOperator(int index) {
+		return "~";
+	}
+	
+	@Override
+	public int getType() {
+		return Expression.BITWISE_NOT;
+	}
+
+	@Override
+	protected String getEJBQLExpressionOperator(int index) {
+		throw new UnsupportedOperationException(
+				"EJBQL 'bitwise not' is not supported");
+	}
+
+	@Override
+	public Expression shallowCopy() {
+		return new ASTBitwiseNot(id);
+	}
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseOr.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseOr.java?rev=1404300&r1=1404299&r2=1404300&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseOr.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseOr.java Wed Oct 31 19:02:01 2012
@@ -18,43 +18,58 @@
  ****************************************************************/
 package org.apache.cayenne.exp.parser;
 
+import java.util.Collection;
+import java.util.Iterator;
+
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.util.ConversionUtil;
 
+
 /**
+ * Bitwise disjunction (OR or '|') expression.
+ * 
  * @since 3.1
  */
 public class ASTBitwiseOr extends SimpleNode {
+	private static final long serialVersionUID = 1L;
 
-    ASTBitwiseOr(int id) {
-        super(id);
-    }
-
-    public ASTBitwiseOr() {
-
-        // TODO: parser support
-        super(-1);
-    }
-
-    public ASTBitwiseOr(SimpleNode left, SimpleNode right) {
-        // TODO: parser support
-        super(-1);
-
-        jjtAddChild(left, 0);
-        jjtAddChild(right, 1);
+	ASTBitwiseOr(int id) {
+		super(id);
+	}
+	
+	public ASTBitwiseOr() {
+		super(ExpressionParserTreeConstants.JJTBITWISEOR);
+	}
+	
+	public ASTBitwiseOr(Object[] nodes) {
+        super(ExpressionParserTreeConstants.JJTBITWISEOR);
+        int len = nodes.length;
+        for (int i = 0; i < len; i++) {
+            jjtAddChild(wrapChild(nodes[i]), i);
+        }
+        
         connectChildren();
+	}
+	
+    public ASTBitwiseOr(Collection<Object> nodes) {
+        super(ExpressionParserTreeConstants.JJTBITWISEOR);
+        int len = nodes.size();
+        Iterator<Object> it = nodes.iterator();
+        for (int i = 0; i < len; i++) {
+            jjtAddChild(wrapChild(it.next()), i);
+        }
     }
-
-    @Override
-    protected Object evaluateNode(Object o) throws Exception {
+	
+	@Override
+	protected Object evaluateNode(Object o) throws Exception {
         int len = jjtGetNumChildren();
-        if (len != 2) {
-            return Boolean.FALSE;
+        if (len == 0) {
+            return null;
         }
 
-        long result = Long.MIN_VALUE;
+        Long result = null;
         for (int i = 0; i < len; i++) {
-            long value = ConversionUtil.toLong(evaluateChild(i, o), Long.MIN_VALUE);
+            Long value = ConversionUtil.toLong(evaluateChild(i, o), Long.MIN_VALUE);
 
             if (value == Long.MIN_VALUE) {
                 return null;
@@ -64,29 +79,33 @@ public class ASTBitwiseOr extends Simple
         }
 
         return result;
-    }
-
-    /**
-     * Creates a copy of this expression node, without copying children.
-     */
-    @Override
-    public Expression shallowCopy() {
-        return new ASTBitwiseOr(id);
-    }
-
-    @Override
-    protected String getExpressionOperator(int index) {
-        return "|";
-    }
-
-    @Override
-    protected String getEJBQLExpressionOperator(int index) {
-        throw new UnsupportedOperationException("EJBQL 'bitwise or' is not supported");
-    }
+	}
 
+	@Override
+	protected String getExpressionOperator(int index) {
+		return "|";
+	}
+	
+	@Override
+	public int getType() {
+		return Expression.BITWISE_OR;
+	}
+	
+	@Override
+	protected String getEJBQLExpressionOperator(int index) {
+		throw new UnsupportedOperationException(
+				"EJBQL 'bitwise not' is not supported");
+	}
+	
+	@Override
+	public Expression shallowCopy() {
+		return new ASTBitwiseOr(id);
+	}
+	
     @Override
-    public int getType() {
-        return Expression.BITWISE_OR;
+    public void jjtClose() {
+        super.jjtClose();
+        flattenTree();
     }
 
-}
+}
\ No newline at end of file

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseRightShift.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseRightShift.java?rev=1404300&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseRightShift.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseRightShift.java Wed Oct 31 19:02:01 2012
@@ -0,0 +1,110 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.exp.parser;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.cayenne.exp.Expression;
+import org.apache.cayenne.util.ConversionUtil;
+
+/**
+ * Bitwise right shift '>>' operation.
+ * 
+ * @since 3.2
+ */
+public class ASTBitwiseRightShift extends SimpleNode {
+	private static final long serialVersionUID = 1L;
+
+	ASTBitwiseRightShift(int id) {
+		super(id);
+	}
+
+	public ASTBitwiseRightShift() {
+		super(ExpressionParserTreeConstants.JJTBITWISERIGHTSHIFT);
+	}
+
+	public ASTBitwiseRightShift(Object[] nodes) {
+		super(ExpressionParserTreeConstants.JJTBITWISERIGHTSHIFT);
+		int len = nodes.length;
+		for (int i = 0; i < len; i++) {
+			jjtAddChild(wrapChild(nodes[i]), i);
+		}
+
+		connectChildren();
+	}
+
+	public ASTBitwiseRightShift(Collection<Object> nodes) {
+		super(ExpressionParserTreeConstants.JJTBITWISERIGHTSHIFT);
+		int len = nodes.size();
+		Iterator<Object> it = nodes.iterator();
+		for (int i = 0; i < len; i++) {
+			jjtAddChild(wrapChild(it.next()), i);
+		}
+	}
+
+	@Override
+	protected Object evaluateNode(Object o) throws Exception {
+		int len = jjtGetNumChildren();
+		if (len == 0) {
+			return null;
+		}
+
+		Long result = null;
+		for (int i = 0; i < len; i++) {
+			Long value = ConversionUtil.toLong(evaluateChild(i, o),
+					Long.MIN_VALUE);
+
+			if (value == Long.MIN_VALUE) {
+				return null;
+			}
+
+			result = (i == 0) ? value : result >> value;
+		}
+
+		return result;
+	}
+
+	@Override
+	protected String getExpressionOperator(int index) {
+		return ">>";
+	}
+	
+	@Override
+	public int getType() {
+		return Expression.BITWISE_RIGHT_SHIFT;
+	}
+	
+	@Override
+	protected String getEJBQLExpressionOperator(int index) {
+		throw new UnsupportedOperationException(
+				"EJBQL 'bitwise not' is not supported");
+	}
+
+	@Override
+	public Expression shallowCopy() {
+		return new ASTBitwiseRightShift(id);
+	}
+
+	@Override
+	public void jjtClose() {
+		super.jjtClose();
+		flattenTree();
+	}
+}

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseXor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseXor.java?rev=1404300&r1=1404299&r2=1404300&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseXor.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ASTBitwiseXor.java Wed Oct 31 19:02:01 2012
@@ -18,43 +18,57 @@
  ****************************************************************/
 package org.apache.cayenne.exp.parser;
 
+import java.util.Collection;
+import java.util.Iterator;
+
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.util.ConversionUtil;
 
 /**
+ * Bitwise exclusive disjunction (XOR or '^') operation.
+ * 
  * @since 3.1
  */
 public class ASTBitwiseXor extends SimpleNode {
+	private static final long serialVersionUID = 1L;
 
-    ASTBitwiseXor(int id) {
-        super(id);
-    }
-
-    public ASTBitwiseXor() {
-
-        // TODO: parser support
-        super(-1);
-    }
-
-    public ASTBitwiseXor(SimpleNode left, SimpleNode right) {
-        // TODO: parser support
-        super(-1);
-
-        jjtAddChild(left, 0);
-        jjtAddChild(right, 1);
+	ASTBitwiseXor(int id) {
+		super(id);
+	}
+	
+	public ASTBitwiseXor() {
+		super(ExpressionParserTreeConstants.JJTBITWISEXOR);
+	}
+	
+	public ASTBitwiseXor(Object[] nodes) {
+        super(ExpressionParserTreeConstants.JJTBITWISEXOR);
+        int len = nodes.length;
+        for (int i = 0; i < len; i++) {
+            jjtAddChild(wrapChild(nodes[i]), i);
+        }
+        
         connectChildren();
+	}
+	
+    public ASTBitwiseXor(Collection<Object> nodes) {
+        super(ExpressionParserTreeConstants.JJTBITWISEXOR);
+        int len = nodes.size();
+        Iterator<Object> it = nodes.iterator();
+        for (int i = 0; i < len; i++) {
+            jjtAddChild(wrapChild(it.next()), i);
+        }
     }
-
-    @Override
-    protected Object evaluateNode(Object o) throws Exception {
+	
+	@Override
+	protected Object evaluateNode(Object o) throws Exception {
         int len = jjtGetNumChildren();
-        if (len != 2) {
-            return Boolean.FALSE;
+        if (len == 0) {
+            return null;
         }
 
-        long result = Long.MIN_VALUE;
+        Long result = null;
         for (int i = 0; i < len; i++) {
-            long value = ConversionUtil.toLong(evaluateChild(i, o), Long.MIN_VALUE);
+            Long value = ConversionUtil.toLong(evaluateChild(i, o), Long.MIN_VALUE);
 
             if (value == Long.MIN_VALUE) {
                 return null;
@@ -64,29 +78,32 @@ public class ASTBitwiseXor extends Simpl
         }
 
         return result;
-    }
-
-    /**
-     * Creates a copy of this expression node, without copying children.
-     */
-    @Override
-    public Expression shallowCopy() {
-        return new ASTBitwiseXor(id);
-    }
-
-    @Override
-    protected String getExpressionOperator(int index) {
-        return "^";
-    }
-
-    @Override
-    protected String getEJBQLExpressionOperator(int index) {
-        throw new UnsupportedOperationException("EJBQL 'bitwise xor' is not supported");
-    }
+	}
 
+	@Override
+	protected String getExpressionOperator(int index) {
+		return "^";
+	}
+	
+	@Override
+	public int getType() {
+		return Expression.BITWISE_XOR;
+	}
+	
+	@Override
+	protected String getEJBQLExpressionOperator(int index) {
+		throw new UnsupportedOperationException(
+				"EJBQL 'bitwise not' is not supported");
+	}
+	
+	@Override
+	public Expression shallowCopy() {
+		return new ASTBitwiseXor(id);
+	}
+	
     @Override
-    public int getType() {
-        return Expression.BITWISE_XOR;
+    public void jjtClose() {
+        super.jjtClose();
+        flattenTree();
     }
-
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParser.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParser.java?rev=1404300&r1=1404299&r2=1404300&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParser.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParser.java Wed Oct 31 19:02:01 2012
@@ -171,12 +171,13 @@ public class ExpressionParser/*@bgen(jjt
       }
       break;
     case 16:
-    case 20:
-    case 21:
-    case 24:
     case 25:
     case 26:
-    case 27:
+    case 29:
+    case 30:
+    case 31:
+    case 32:
+    case 33:
     case NULL:
     case TRUE:
     case FALSE:
@@ -221,12 +222,13 @@ public class ExpressionParser/*@bgen(jjt
       }
       break;
     case 16:
-    case 20:
-    case 21:
-    case 24:
     case 25:
     case 26:
-    case 27:
+    case 29:
+    case 30:
+    case 31:
+    case 32:
+    case 33:
     case NULL:
     case PROPERTY_PATH:
     case SINGLE_QUOTED_STRING:
@@ -501,7 +503,7 @@ public class ExpressionParser/*@bgen(jjt
                   jjtree.openNodeScope(jjtn011);
           try {
             switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-            case 24:
+            case 30:
               namedParameter();
               break;
             case 16:
@@ -656,7 +658,7 @@ public class ExpressionParser/*@bgen(jjt
                   jjtree.openNodeScope(jjtn003);
       try {
         switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-        case 24:
+        case 30:
           namedParameter();
           break;
         case 16:
@@ -768,12 +770,13 @@ public class ExpressionParser/*@bgen(jjt
   final public void scalarConditionExpression() throws ParseException {
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case 16:
-    case 20:
-    case 21:
-    case 24:
     case 25:
     case 26:
-    case 27:
+    case 29:
+    case 30:
+    case 31:
+    case 32:
+    case 33:
     case PROPERTY_PATH:
     case INT_LITERAL:
     case FLOAT_LITERAL:
@@ -831,12 +834,13 @@ public class ExpressionParser/*@bgen(jjt
   final public void scalarExpression() throws ParseException {
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case 16:
-    case 20:
-    case 21:
-    case 24:
     case 25:
     case 26:
-    case 27:
+    case 29:
+    case 30:
+    case 31:
+    case 32:
+    case 33:
     case NULL:
     case PROPERTY_PATH:
     case SINGLE_QUOTED_STRING:
@@ -914,7 +918,7 @@ public class ExpressionParser/*@bgen(jjt
                                    }
       }
       break;
-    case 24:
+    case 30:
       namedParameter();
       break;
     case INT_LITERAL:
@@ -985,75 +989,275 @@ public class ExpressionParser/*@bgen(jjt
   }
 
   final public void scalarNumericExpression() throws ParseException {
-    multiplySubtractExp();
+    bitwiseOr();
+  }
+
+  final public void bitwiseOr() throws ParseException {
+    bitwiseXor();
     label_4:
     while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case 20:
-      case 21:
         ;
         break;
       default:
         jj_la1[17] = jj_gen;
         break label_4;
       }
+      jj_consume_token(20);
+              ASTBitwiseOr jjtn001 = new ASTBitwiseOr(JJTBITWISEOR);
+              boolean jjtc001 = true;
+              jjtree.openNodeScope(jjtn001);
+      try {
+        bitwiseXor();
+      } catch (Throwable jjte001) {
+              if (jjtc001) {
+                jjtree.clearNodeScope(jjtn001);
+                jjtc001 = false;
+              } else {
+                jjtree.popNode();
+              }
+              if (jjte001 instanceof RuntimeException) {
+                {if (true) throw (RuntimeException)jjte001;}
+              }
+              if (jjte001 instanceof ParseException) {
+                {if (true) throw (ParseException)jjte001;}
+              }
+              {if (true) throw (Error)jjte001;}
+      } finally {
+              if (jjtc001) {
+                jjtree.closeNodeScope(jjtn001,  2);
+              }
+      }
+    }
+  }
+
+  final public void bitwiseXor() throws ParseException {
+    bitwiseAnd();
+    label_5:
+    while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case 20:
-        jj_consume_token(20);
-                      ASTAdd jjtn001 = new ASTAdd(JJTADD);
-                      boolean jjtc001 = true;
-                      jjtree.openNodeScope(jjtn001);
+      case 21:
+        ;
+        break;
+      default:
+        jj_la1[18] = jj_gen;
+        break label_5;
+      }
+      jj_consume_token(21);
+              ASTBitwiseXor jjtn001 = new ASTBitwiseXor(JJTBITWISEXOR);
+              boolean jjtc001 = true;
+              jjtree.openNodeScope(jjtn001);
+      try {
+        bitwiseAnd();
+      } catch (Throwable jjte001) {
+              if (jjtc001) {
+                jjtree.clearNodeScope(jjtn001);
+                jjtc001 = false;
+              } else {
+                jjtree.popNode();
+              }
+              if (jjte001 instanceof RuntimeException) {
+                {if (true) throw (RuntimeException)jjte001;}
+              }
+              if (jjte001 instanceof ParseException) {
+                {if (true) throw (ParseException)jjte001;}
+              }
+              {if (true) throw (Error)jjte001;}
+      } finally {
+              if (jjtc001) {
+                jjtree.closeNodeScope(jjtn001,  2);
+              }
+      }
+    }
+  }
+
+  final public void bitwiseAnd() throws ParseException {
+    bitwiseShift();
+    label_6:
+    while (true) {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case 22:
+        ;
+        break;
+      default:
+        jj_la1[19] = jj_gen;
+        break label_6;
+      }
+      jj_consume_token(22);
+              ASTBitwiseAnd jjtn001 = new ASTBitwiseAnd(JJTBITWISEAND);
+              boolean jjtc001 = true;
+              jjtree.openNodeScope(jjtn001);
+      try {
+        bitwiseShift();
+      } catch (Throwable jjte001) {
+              if (jjtc001) {
+                jjtree.clearNodeScope(jjtn001);
+                jjtc001 = false;
+              } else {
+                jjtree.popNode();
+              }
+              if (jjte001 instanceof RuntimeException) {
+                {if (true) throw (RuntimeException)jjte001;}
+              }
+              if (jjte001 instanceof ParseException) {
+                {if (true) throw (ParseException)jjte001;}
+              }
+              {if (true) throw (Error)jjte001;}
+      } finally {
+              if (jjtc001) {
+                jjtree.closeNodeScope(jjtn001,  2);
+              }
+      }
+    }
+  }
+
+  final public void bitwiseShift() throws ParseException {
+    arithmeticExp();
+    label_7:
+    while (true) {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case 23:
+      case 24:
+        ;
+        break;
+      default:
+        jj_la1[20] = jj_gen;
+        break label_7;
+      }
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case 23:
+        jj_consume_token(23);
+               ASTBitwiseLeftShift jjtn001 = new ASTBitwiseLeftShift(JJTBITWISELEFTSHIFT);
+               boolean jjtc001 = true;
+               jjtree.openNodeScope(jjtn001);
+        try {
+          arithmeticExp();
+        } catch (Throwable jjte001) {
+               if (jjtc001) {
+                 jjtree.clearNodeScope(jjtn001);
+                 jjtc001 = false;
+               } else {
+                 jjtree.popNode();
+               }
+               if (jjte001 instanceof RuntimeException) {
+                 {if (true) throw (RuntimeException)jjte001;}
+               }
+               if (jjte001 instanceof ParseException) {
+                 {if (true) throw (ParseException)jjte001;}
+               }
+               {if (true) throw (Error)jjte001;}
+        } finally {
+               if (jjtc001) {
+                 jjtree.closeNodeScope(jjtn001,  2);
+               }
+        }
+        break;
+      case 24:
+        jj_consume_token(24);
+               ASTBitwiseRightShift jjtn002 = new ASTBitwiseRightShift(JJTBITWISERIGHTSHIFT);
+               boolean jjtc002 = true;
+               jjtree.openNodeScope(jjtn002);
+        try {
+          arithmeticExp();
+        } catch (Throwable jjte002) {
+               if (jjtc002) {
+                 jjtree.clearNodeScope(jjtn002);
+                 jjtc002 = false;
+               } else {
+                 jjtree.popNode();
+               }
+               if (jjte002 instanceof RuntimeException) {
+                 {if (true) throw (RuntimeException)jjte002;}
+               }
+               if (jjte002 instanceof ParseException) {
+                 {if (true) throw (ParseException)jjte002;}
+               }
+               {if (true) throw (Error)jjte002;}
+        } finally {
+               if (jjtc002) {
+                 jjtree.closeNodeScope(jjtn002,  2);
+               }
+        }
+        break;
+      default:
+        jj_la1[21] = jj_gen;
+        jj_consume_token(-1);
+        throw new ParseException();
+      }
+    }
+  }
+
+  final public void arithmeticExp() throws ParseException {
+    multiplySubtractExp();
+    label_8:
+    while (true) {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case 25:
+      case 26:
+        ;
+        break;
+      default:
+        jj_la1[22] = jj_gen;
+        break label_8;
+      }
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case 25:
+        jj_consume_token(25);
+              ASTAdd jjtn001 = new ASTAdd(JJTADD);
+              boolean jjtc001 = true;
+              jjtree.openNodeScope(jjtn001);
         try {
           multiplySubtractExp();
         } catch (Throwable jjte001) {
-                      if (jjtc001) {
-                        jjtree.clearNodeScope(jjtn001);
-                        jjtc001 = false;
-                      } else {
-                        jjtree.popNode();
-                      }
-                      if (jjte001 instanceof RuntimeException) {
-                        {if (true) throw (RuntimeException)jjte001;}
-                      }
-                      if (jjte001 instanceof ParseException) {
-                        {if (true) throw (ParseException)jjte001;}
-                      }
-                      {if (true) throw (Error)jjte001;}
+              if (jjtc001) {
+                jjtree.clearNodeScope(jjtn001);
+                jjtc001 = false;
+              } else {
+                jjtree.popNode();
+              }
+              if (jjte001 instanceof RuntimeException) {
+                {if (true) throw (RuntimeException)jjte001;}
+              }
+              if (jjte001 instanceof ParseException) {
+                {if (true) throw (ParseException)jjte001;}
+              }
+              {if (true) throw (Error)jjte001;}
         } finally {
-                      if (jjtc001) {
-                        jjtree.closeNodeScope(jjtn001,  2);
-                      }
+              if (jjtc001) {
+                jjtree.closeNodeScope(jjtn001,  2);
+              }
         }
         break;
-      case 21:
-        jj_consume_token(21);
-                      ASTSubtract jjtn002 = new ASTSubtract(JJTSUBTRACT);
-                      boolean jjtc002 = true;
-                      jjtree.openNodeScope(jjtn002);
+      case 26:
+        jj_consume_token(26);
+              ASTSubtract jjtn002 = new ASTSubtract(JJTSUBTRACT);
+              boolean jjtc002 = true;
+              jjtree.openNodeScope(jjtn002);
         try {
           multiplySubtractExp();
         } catch (Throwable jjte002) {
-                      if (jjtc002) {
-                        jjtree.clearNodeScope(jjtn002);
-                        jjtc002 = false;
-                      } else {
-                        jjtree.popNode();
-                      }
-                      if (jjte002 instanceof RuntimeException) {
-                        {if (true) throw (RuntimeException)jjte002;}
-                      }
-                      if (jjte002 instanceof ParseException) {
-                        {if (true) throw (ParseException)jjte002;}
-                      }
-                      {if (true) throw (Error)jjte002;}
+              if (jjtc002) {
+                jjtree.clearNodeScope(jjtn002);
+                jjtc002 = false;
+              } else {
+                jjtree.popNode();
+              }
+              if (jjte002 instanceof RuntimeException) {
+                {if (true) throw (RuntimeException)jjte002;}
+              }
+              if (jjte002 instanceof ParseException) {
+                {if (true) throw (ParseException)jjte002;}
+              }
+              {if (true) throw (Error)jjte002;}
         } finally {
-                      if (jjtc002) {
-                        jjtree.closeNodeScope(jjtn002,  2);
-                      }
+              if (jjtc002) {
+                jjtree.closeNodeScope(jjtn002,  2);
+              }
         }
         break;
       default:
-        jj_la1[18] = jj_gen;
+        jj_la1[23] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -1061,131 +1265,179 @@ public class ExpressionParser/*@bgen(jjt
   }
 
   final public void multiplySubtractExp() throws ParseException {
-    numericTerm();
-    label_5:
+    numericTermExt();
+    label_9:
     while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case 22:
-      case 23:
+      case 27:
+      case 28:
         ;
         break;
       default:
-        jj_la1[19] = jj_gen;
-        break label_5;
+        jj_la1[24] = jj_gen;
+        break label_9;
       }
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case 22:
-        jj_consume_token(22);
-                      ASTMultiply jjtn001 = new ASTMultiply(JJTMULTIPLY);
-                      boolean jjtc001 = true;
-                      jjtree.openNodeScope(jjtn001);
+      case 27:
+        jj_consume_token(27);
+              ASTMultiply jjtn001 = new ASTMultiply(JJTMULTIPLY);
+              boolean jjtc001 = true;
+              jjtree.openNodeScope(jjtn001);
         try {
-          numericTerm();
+          numericTermExt();
         } catch (Throwable jjte001) {
-                      if (jjtc001) {
-                        jjtree.clearNodeScope(jjtn001);
-                        jjtc001 = false;
-                      } else {
-                        jjtree.popNode();
-                      }
-                      if (jjte001 instanceof RuntimeException) {
-                        {if (true) throw (RuntimeException)jjte001;}
-                      }
-                      if (jjte001 instanceof ParseException) {
-                        {if (true) throw (ParseException)jjte001;}
-                      }
-                      {if (true) throw (Error)jjte001;}
+              if (jjtc001) {
+                jjtree.clearNodeScope(jjtn001);
+                jjtc001 = false;
+              } else {
+                jjtree.popNode();
+              }
+              if (jjte001 instanceof RuntimeException) {
+                {if (true) throw (RuntimeException)jjte001;}
+              }
+              if (jjte001 instanceof ParseException) {
+                {if (true) throw (ParseException)jjte001;}
+              }
+              {if (true) throw (Error)jjte001;}
         } finally {
-                      if (jjtc001) {
-                        jjtree.closeNodeScope(jjtn001,  2);
-                      }
+              if (jjtc001) {
+                jjtree.closeNodeScope(jjtn001,  2);
+              }
         }
         break;
-      case 23:
-        jj_consume_token(23);
-                      ASTDivide jjtn002 = new ASTDivide(JJTDIVIDE);
-                      boolean jjtc002 = true;
-                      jjtree.openNodeScope(jjtn002);
+      case 28:
+        jj_consume_token(28);
+              ASTDivide jjtn002 = new ASTDivide(JJTDIVIDE);
+              boolean jjtc002 = true;
+              jjtree.openNodeScope(jjtn002);
         try {
-          numericTerm();
+          numericTermExt();
         } catch (Throwable jjte002) {
-                      if (jjtc002) {
-                        jjtree.clearNodeScope(jjtn002);
-                        jjtc002 = false;
-                      } else {
-                        jjtree.popNode();
-                      }
-                      if (jjte002 instanceof RuntimeException) {
-                        {if (true) throw (RuntimeException)jjte002;}
-                      }
-                      if (jjte002 instanceof ParseException) {
-                        {if (true) throw (ParseException)jjte002;}
-                      }
-                      {if (true) throw (Error)jjte002;}
+              if (jjtc002) {
+                jjtree.clearNodeScope(jjtn002);
+                jjtc002 = false;
+              } else {
+                jjtree.popNode();
+              }
+              if (jjte002 instanceof RuntimeException) {
+                {if (true) throw (RuntimeException)jjte002;}
+              }
+              if (jjte002 instanceof ParseException) {
+                {if (true) throw (ParseException)jjte002;}
+              }
+              {if (true) throw (Error)jjte002;}
         } finally {
-                      if (jjtc002) {
-                        jjtree.closeNodeScope(jjtn002,  2);
-                      }
+              if (jjtc002) {
+                jjtree.closeNodeScope(jjtn002,  2);
+              }
         }
         break;
       default:
-        jj_la1[20] = jj_gen;
+        jj_la1[25] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
     }
   }
 
-  final public void numericTerm() throws ParseException {
+  final public void numericTermExt() throws ParseException {
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case 16:
-    case 20:
-    case 24:
     case 25:
     case 26:
-    case 27:
+    case 30:
+    case 31:
+    case 32:
+    case 33:
+    case PROPERTY_PATH:
+    case INT_LITERAL:
+    case FLOAT_LITERAL:
+      numericTerm();
+      break;
+    case 29:
+      jj_consume_token(29);
+              ASTBitwiseNot jjtn001 = new ASTBitwiseNot(JJTBITWISENOT);
+              boolean jjtc001 = true;
+              jjtree.openNodeScope(jjtn001);
+      try {
+        numericTerm();
+      } catch (Throwable jjte001) {
+              if (jjtc001) {
+                jjtree.clearNodeScope(jjtn001);
+                jjtc001 = false;
+              } else {
+                jjtree.popNode();
+              }
+              if (jjte001 instanceof RuntimeException) {
+                {if (true) throw (RuntimeException)jjte001;}
+              }
+              if (jjte001 instanceof ParseException) {
+                {if (true) throw (ParseException)jjte001;}
+              }
+              {if (true) throw (Error)jjte001;}
+      } finally {
+              if (jjtc001) {
+                jjtree.closeNodeScope(jjtn001,  1);
+              }
+      }
+      break;
+    default:
+      jj_la1[26] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+  }
+
+  final public void numericTerm() throws ParseException {
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case 16:
+    case 25:
+    case 30:
+    case 31:
+    case 32:
+    case 33:
     case PROPERTY_PATH:
     case INT_LITERAL:
     case FLOAT_LITERAL:
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case 20:
-        jj_consume_token(20);
+      case 25:
+        jj_consume_token(25);
         break;
       default:
-        jj_la1[21] = jj_gen;
+        jj_la1[27] = jj_gen;
         ;
       }
       numericPrimary();
       break;
-    case 21:
-      jj_consume_token(21);
-                       ASTNegate jjtn001 = new ASTNegate(JJTNEGATE);
-                       boolean jjtc001 = true;
-                       jjtree.openNodeScope(jjtn001);
+    case 26:
+      jj_consume_token(26);
+               ASTNegate jjtn001 = new ASTNegate(JJTNEGATE);
+               boolean jjtc001 = true;
+               jjtree.openNodeScope(jjtn001);
       try {
-        numericPrimary();
+        numericTerm();
       } catch (Throwable jjte001) {
-                       if (jjtc001) {
-                         jjtree.clearNodeScope(jjtn001);
-                         jjtc001 = false;
-                       } else {
-                         jjtree.popNode();
-                       }
-                       if (jjte001 instanceof RuntimeException) {
-                         {if (true) throw (RuntimeException)jjte001;}
-                       }
-                       if (jjte001 instanceof ParseException) {
-                         {if (true) throw (ParseException)jjte001;}
-                       }
-                       {if (true) throw (Error)jjte001;}
-      } finally {
-                       if (jjtc001) {
-                         jjtree.closeNodeScope(jjtn001,  1);
-                       }
+               if (jjtc001) {
+                 jjtree.clearNodeScope(jjtn001);
+                 jjtc001 = false;
+               } else {
+                 jjtree.popNode();
+               }
+               if (jjte001 instanceof RuntimeException) {
+                 {if (true) throw (RuntimeException)jjte001;}
+               }
+               if (jjte001 instanceof ParseException) {
+                 {if (true) throw (ParseException)jjte001;}
+               }
+               {if (true) throw (Error)jjte001;}
+      } finally {
+               if (jjtc001) {
+                 jjtree.closeNodeScope(jjtn001,  1);
+               }
       }
       break;
     default:
-      jj_la1[22] = jj_gen;
+      jj_la1[28] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -1198,13 +1450,13 @@ public class ExpressionParser/*@bgen(jjt
       orCondition();
       jj_consume_token(17);
       break;
-    case 25:
-    case 26:
-    case 27:
+    case 31:
+    case 32:
+    case 33:
     case PROPERTY_PATH:
       pathExpression();
       break;
-    case 24:
+    case 30:
       namedParameter();
       break;
     case INT_LITERAL:
@@ -1238,7 +1490,7 @@ public class ExpressionParser/*@bgen(jjt
       }
       break;
     default:
-      jj_la1[23] = jj_gen;
+      jj_la1[29] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -1246,7 +1498,7 @@ public class ExpressionParser/*@bgen(jjt
 
   final public void namedParameter() throws ParseException {
         Token t;
-    jj_consume_token(24);
+    jj_consume_token(30);
     t = jj_consume_token(PROPERTY_PATH);
                                   ASTNamedParameter jjtn001 = new ASTNamedParameter(JJTNAMEDPARAMETER);
                                   boolean jjtc001 = true;
@@ -1280,8 +1532,8 @@ public class ExpressionParser/*@bgen(jjt
                            }
       }
       break;
-    case 25:
-      jj_consume_token(25);
+    case 31:
+      jj_consume_token(31);
       t = jj_consume_token(PROPERTY_PATH);
                            ASTObjPath jjtn002 = new ASTObjPath(JJTOBJPATH);
                            boolean jjtc002 = true;
@@ -1296,8 +1548,8 @@ public class ExpressionParser/*@bgen(jjt
                            }
       }
       break;
-    case 26:
-      jj_consume_token(26);
+    case 32:
+      jj_consume_token(32);
       t = jj_consume_token(PROPERTY_PATH);
                            ASTDbPath jjtn003 = new ASTDbPath(JJTDBPATH);
                            boolean jjtc003 = true;
@@ -1312,8 +1564,8 @@ public class ExpressionParser/*@bgen(jjt
                            }
       }
       break;
-    case 27:
-      jj_consume_token(27);
+    case 33:
+      jj_consume_token(33);
       t = jj_consume_token(PROPERTY_PATH);
                            ASTScalar jjtn004 = new ASTScalar(JJTSCALAR);
                            boolean jjtc004 = true;
@@ -1329,7 +1581,7 @@ public class ExpressionParser/*@bgen(jjt
       }
       break;
     default:
-      jj_la1[24] = jj_gen;
+      jj_la1[30] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -1344,7 +1596,7 @@ public class ExpressionParser/*@bgen(jjt
   public Token jj_nt;
   private int jj_ntk;
   private int jj_gen;
-  final private int[] jj_la1 = new int[25];
+  final private int[] jj_la1 = new int[31];
   static private int[] jj_la1_0;
   static private int[] jj_la1_1;
   static {
@@ -1352,10 +1604,10 @@ public class ExpressionParser/*@bgen(jjt
       jj_la1_init_1();
    }
    private static void jj_la1_init_0() {
-      jj_la1_0 = new int[] {0x2,0x4,0x18,0xf310018,0x60,0x180,0x1010000,0x4fff8,0x4fff8,0xf310000,0x18,0x1010000,0x4e000,0x80000,0xf310000,0xf310000,0x1000000,0x300000,0x300000,0xc00000,0xc00000,0x100000,0xf310000,0xf010000,0xe000000,};
+      jj_la1_0 = new int[] {0x2,0x4,0x18,0xe6010018,0x60,0x180,0x40010000,0x4fff8,0x4fff8,0xe6010000,0x18,0x40010000,0x4e000,0x80000,0xe6010000,0xe6010000,0x40000000,0x100000,0x200000,0x400000,0x1800000,0x1800000,0x6000000,0x6000000,0x18000000,0x18000000,0xe6010000,0x2000000,0xc6010000,0xc0010000,0x80000000,};
    }
    private static void jj_la1_init_1() {
-      jj_la1_1 = new int[] {0x0,0x0,0x0,0x1c80f,0x0,0x0,0x0,0x0,0x0,0x1c80f,0x0,0x0,0x0,0x0,0x1c809,0x1c80f,0x1c806,0x0,0x0,0x0,0x0,0x0,0x18008,0x18008,0x8,};
+      jj_la1_1 = new int[] {0x0,0x0,0x0,0x7203c3,0x0,0x0,0x0,0x0,0x0,0x7203c3,0x0,0x0,0x0,0x0,0x720243,0x7203c3,0x720180,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x600203,0x0,0x600203,0x600203,0x203,};
    }
 
   /** Constructor with InputStream. */
@@ -1369,7 +1621,7 @@ public class ExpressionParser/*@bgen(jjt
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 25; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 31; i++) jj_la1[i] = -1;
   }
 
   /** Constructor. */
@@ -1379,22 +1631,18 @@ public class ExpressionParser/*@bgen(jjt
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 25; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 31; i++) jj_la1[i] = -1;
   }
 
- 
-
   /** Constructor with generated Token Manager. */
   public ExpressionParser(ExpressionParserTokenManager tm) {
     token_source = tm;
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 25; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 31; i++) jj_la1[i] = -1;
   }
 
- 
-
   private Token jj_consume_token(int kind) throws ParseException {
     Token oldToken;
     if ((oldToken = token).next != null) token = token.next;
@@ -1443,12 +1691,12 @@ public class ExpressionParser/*@bgen(jjt
   /** Generate ParseException. */
   public ParseException generateParseException() {
     jj_expentries.clear();
-    boolean[] la1tokens = new boolean[53];
+    boolean[] la1tokens = new boolean[59];
     if (jj_kind >= 0) {
       la1tokens[jj_kind] = true;
       jj_kind = -1;
     }
-    for (int i = 0; i < 25; i++) {
+    for (int i = 0; i < 31; i++) {
       if (jj_la1[i] == jj_gen) {
         for (int j = 0; j < 32; j++) {
           if ((jj_la1_0[i] & (1<<j)) != 0) {
@@ -1460,7 +1708,7 @@ public class ExpressionParser/*@bgen(jjt
         }
       }
     }
-    for (int i = 0; i < 53; i++) {
+    for (int i = 0; i < 59; i++) {
       if (la1tokens[i]) {
         jj_expentry = new int[1];
         jj_expentry[0] = i;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParserConstants.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParserConstants.java?rev=1404300&r1=1404299&r2=1404300&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParserConstants.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/parser/ExpressionParserConstants.java Wed Oct 31 19:02:01 2012
@@ -31,39 +31,39 @@ public interface ExpressionParserConstan
   /** End of File. */
   int EOF = 0;
   /** RegularExpression Id. */
-  int NULL = 32;
+  int NULL = 38;
   /** RegularExpression Id. */
-  int TRUE = 33;
+  int TRUE = 39;
   /** RegularExpression Id. */
-  int FALSE = 34;
+  int FALSE = 40;
   /** RegularExpression Id. */
-  int PROPERTY_PATH = 35;
+  int PROPERTY_PATH = 41;
   /** RegularExpression Id. */
-  int IDENTIFIER = 36;
+  int IDENTIFIER = 42;
   /** RegularExpression Id. */
-  int LETTER = 37;
+  int LETTER = 43;
   /** RegularExpression Id. */
-  int DIGIT = 38;
+  int DIGIT = 44;
   /** RegularExpression Id. */
-  int ESC = 41;
+  int ESC = 47;
   /** RegularExpression Id. */
-  int SINGLE_QUOTED_STRING = 43;
+  int SINGLE_QUOTED_STRING = 49;
   /** RegularExpression Id. */
-  int STRING_ESC = 44;
+  int STRING_ESC = 50;
   /** RegularExpression Id. */
-  int DOUBLE_QUOTED_STRING = 46;
+  int DOUBLE_QUOTED_STRING = 52;
   /** RegularExpression Id. */
-  int INT_LITERAL = 47;
+  int INT_LITERAL = 53;
   /** RegularExpression Id. */
-  int FLOAT_LITERAL = 48;
+  int FLOAT_LITERAL = 54;
   /** RegularExpression Id. */
-  int DEC_FLT = 49;
+  int DEC_FLT = 55;
   /** RegularExpression Id. */
-  int DEC_DIGITS = 50;
+  int DEC_DIGITS = 56;
   /** RegularExpression Id. */
-  int EXPONENT = 51;
+  int EXPONENT = 57;
   /** RegularExpression Id. */
-  int FLT_SUFF = 52;
+  int FLT_SUFF = 58;
 
   /** Lexical state. */
   int DEFAULT = 0;
@@ -94,10 +94,16 @@ public interface ExpressionParserConstan
     "\")\"",
     "\"between\"",
     "\",\"",
+    "\"|\"",
+    "\"^\"",
+    "\"&\"",
+    "\"<<\"",
+    "\">>\"",
     "\"+\"",
     "\"-\"",
     "\"*\"",
     "\"/\"",
+    "\"~\"",
     "\"$\"",
     "\"obj:\"",
     "\"db:\"",
@@ -116,10 +122,10 @@ public interface ExpressionParserConstan
     "\"\\\'\"",
     "\"\\\"\"",
     "<ESC>",
-    "<token of kind 42>",
+    "<token of kind 48>",
     "\"\\\'\"",
     "<STRING_ESC>",
-    "<token of kind 45>",
+    "<token of kind 51>",
     "\"\\\"\"",
     "<INT_LITERAL>",
     "<FLOAT_LITERAL>",



Mime
View raw message