svn commit: r949604 - /ofbiz/trunk/framework/sql/src/org/ofbiz/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: r949604 - /ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj

doogie-3
Author: doogie
Date: Sun May 30 22:06:36 2010
New Revision: 949604

URL: http://svn.apache.org/viewvc?rev=949604&view=rev
Log:
Fix operator parsing; only the last character was being parsed as the
operator.

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

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj?rev=949604&r1=949603&r2=949604&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj Sun May 30 22:06:36 2010
@@ -672,6 +672,14 @@ private String SQuoted():
     { return sb.toString(); }
 }
 
+private String Text():
+{
+    StringBuilder sb = new StringBuilder();
+}
+{
+    ( <TEXT> { sb.append(getToken(0).image); } )+
+    { return sb.toString(); }
+}
 private List<String> FieldList():
 {
     List<String> list = FastList.newInstance();
@@ -826,21 +834,24 @@ private Condition BooleanExpression():
 
 private String ComparisonOperator():
 {
-    StringBuilder sb;
+    StringBuilder sb = new StringBuilder();
+    String s;
 }
 {
-    (<TEXT>)+ { sb = new StringBuilder(); sb.append(getToken(0).image); }
+    s=Text() { sb.append(s); }
     (
         <EQUALS> { sb.append(getToken(0).image); }
-        ((<TEXT>)+ { sb.append(getToken(0).image); })?
+        (s=Text() { sb.append(s); })?
     )* { return sb.toString(); }
 |    <NAME> { return getToken(0).image; }
 |    <EQUALS> { return getToken(0).image.toLowerCase(); }
 }
 
 private String MathOperator():
-{}
 {
-    ( <TEXT> )+ { return getToken(0).image.toLowerCase(); }
+    String s;
+}
+{
+    s=Text() { return s.toLowerCase(); }
 |    <NAME> { return getToken(0).image.toLowerCase(); }
 }