svn commit: r835934 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r835934 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj

doogie-3
Author: doogie
Date: Fri Nov 13 17:28:35 2009
New Revision: 835934

URL: http://svn.apache.org/viewvc?rev=835934&view=rev
Log:
Implement list values, and handle between(needed to be special cased).

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj?rev=835934&r1=835933&r2=835934&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/Parser.jj Fri Nov 13 17:28:35 2009
@@ -451,6 +451,25 @@
  }
 }
 
+private Object RightExpression(EntityComparisonOperator op):
+{
+ Object v;
+ List<Object> list;
+}
+{
+ LOOKAHEAD({ op == EntityOperator.BETWEEN }) { list = FastList.newInstance(); }
+ v=Expression() { list.add(v); }
+ <AND>
+ v=Expression() { list.add(v); }
+ { return list; }
+| v=Expression() { return v; }
+| <OPEN_PAREN> { list = FastList.newInstance(); }
+ v=Expression() { list.add(v); }
+ ( <COMMA> v=Expression() { list.add(v); } )*
+ <CLOSE_PAREN>
+ { return list; }
+}
+
 private EntityCondition BooleanExpression():
 {
  Object v1, v2;
@@ -458,7 +477,7 @@
  EntityCondition ec;
 }
 {
- v1=Expression() op=ComparisonOperator() v2=Expression()
+ v1=Expression() op=ComparisonOperator() v2=RightExpression(op)
  { return EntityCondition.makeCondition(v1, op, v2); }
 | <OPEN_PAREN> ec=AndExpression() <CLOSE_PAREN> { return ec; }
 }
@@ -467,4 +486,5 @@
 {}
 {
  ( <TEXT> )+ { return EntityOperator.lookupComparison(getToken(0).image); }
+| <NAME> { return EntityOperator.lookupComparison(getToken(0).image); }
 }