You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ad...@apache.org on 2011/08/01 20:57:09 UTC

svn commit: r1152892 [1/2] - in /lucene/dev/trunk/modules/queryparser/src: java/org/apache/lucene/queryparser/flexible/core/messages/ java/org/apache/lucene/queryparser/flexible/standard/builders/ java/org/apache/lucene/queryparser/flexible/standard/no...

Author: adrianocrestani
Date: Mon Aug  1 18:57:05 2011
New Revision: 1152892

URL: http://svn.apache.org/viewvc?rev=1152892&view=rev
Log:
-committing patch from LUCENE-3343 and LUCENE-3338 to trunk
-fixed javadoc reference to QueryNode in StandardSyntaxParser.jj

Added:
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/OpenRangeQueryNodeProcessor.java
Modified:
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/messages/QueryParserMessages.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/NumericRangeQueryNodeBuilder.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/TermRangeQueryNodeBuilder.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/JavaCharStream.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserConstants.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/LowercaseExpandedTermsQueryNodeProcessor.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericRangeQueryNodeProcessor.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/ParametricRangeQueryNodeProcessor.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/StandardQueryNodeProcessorPipeline.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/CharStream.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/ParseException.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/Token.java
    lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/TokenMgrError.java
    lucene/dev/trunk/modules/queryparser/src/resources/org/apache/lucene/queryparser/flexible/core/messages/QueryParserMessages.properties
    lucene/dev/trunk/modules/queryparser/src/test/org/apache/lucene/queryparser/classic/TestQueryParser.java
    lucene/dev/trunk/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestNumericQueryParser.java
    lucene/dev/trunk/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/messages/QueryParserMessages.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/messages/QueryParserMessages.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/messages/QueryParserMessages.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/messages/QueryParserMessages.java Mon Aug  1 18:57:05 2011
@@ -54,5 +54,6 @@ public class QueryParserMessages extends
   public static String COULD_NOT_PARSE_NUMBER;
   public static String NUMBER_CLASS_NOT_SUPPORTED_BY_NUMERIC_RANGE_QUERY;
   public static String UNSUPPORTED_NUMERIC_DATA_TYPE;
+  public static String NUMERIC_CANNOT_BE_EMPTY;
 
 }

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/NumericRangeQueryNodeBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/NumericRangeQueryNodeBuilder.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/NumericRangeQueryNodeBuilder.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/NumericRangeQueryNodeBuilder.java Mon Aug  1 18:57:05 2011
@@ -50,19 +50,8 @@ public class NumericRangeQueryNodeBuilde
     NumericQueryNode lowerNumericNode = numericRangeNode.getLowerBound();
     NumericQueryNode upperNumericNode = numericRangeNode.getUpperBound();
     
-    Number lowerNumber, upperNumber;
-    
-    if (lowerNumericNode != null) {
-      lowerNumber = lowerNumericNode.getValue();
-    } else {
-      lowerNumber = null;
-    }
-    
-    if (upperNumericNode != null) {
-      upperNumber = upperNumericNode.getValue();
-    } else {
-      upperNumber = null;
-    }
+    Number lowerNumber = lowerNumericNode.getValue();
+    Number upperNumber = upperNumericNode.getValue();
     
     NumericConfig numericConfig = numericRangeNode.getNumericConfig();
     NumericField.DataType numberType = numericConfig.getType();

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/TermRangeQueryNodeBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/TermRangeQueryNodeBuilder.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/TermRangeQueryNodeBuilder.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/TermRangeQueryNodeBuilder.java Mon Aug  1 18:57:05 2011
@@ -42,9 +42,18 @@ public class TermRangeQueryNodeBuilder i
     FieldQueryNode lower = rangeNode.getLowerBound();
     
     String field = StringUtils.toString(rangeNode.getField());
+    String lowerText = lower.getTextAsString();
+    String upperText = upper.getTextAsString();
     
-    TermRangeQuery rangeQuery = TermRangeQuery.newStringRange(field, lower
-        .getTextAsString(), upper.getTextAsString(), rangeNode
+    if (lowerText.length() == 0) {
+      lowerText = null;
+    }
+    
+    if (upperText.length() == 0) {
+      upperText = null;
+    }
+    
+    TermRangeQuery rangeQuery = TermRangeQuery.newStringRange(field, lowerText, upperText, rangeNode
         .isLowerInclusive(), rangeNode.isUpperInclusive());
     
     MultiTermQuery.RewriteMethod method = (MultiTermQuery.RewriteMethod) queryNode

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/AbstractRangeQueryNode.java Mon Aug  1 18:57:05 2011
@@ -204,4 +204,18 @@ public abstract class AbstractRangeQuery
     
   }
   
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("<").append(getClass().getCanonicalName());
+    sb.append(" lowerInclusive=").append(isLowerInclusive());
+    sb.append(" upperInclusive=").append(isUpperInclusive());
+    sb.append(">\n\t");
+    sb.append(getUpperBound()).append("\n\t");
+    sb.append(getLowerBound()).append("\n");
+    sb.append("</").append(getClass().getCanonicalName()).append(">\n");
+
+    return sb.toString();
+
+  }
+  
 }

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/JavaCharStream.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/JavaCharStream.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/JavaCharStream.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/JavaCharStream.java Mon Aug  1 18:57:05 2011
@@ -347,7 +347,7 @@ public class JavaCharStream
 
   @Deprecated
   /**
-   * @deprecated (gen)
+   * @deprecated
    * @see #getEndColumn
    */
   public int getColumn() {
@@ -356,7 +356,7 @@ public class JavaCharStream
 
   @Deprecated
   /**
-   * @deprecated (gen)
+   * @deprecated
    * @see #getEndLine
    */
   public int getLine() {
@@ -613,4 +613,4 @@ public class JavaCharStream
   }
 
 }
-/* JavaCC - OriginalChecksum=f19c73b8f7faf94cc4a581e7b2933cc6 (do not edit this line) */
+/* JavaCC - OriginalChecksum=7eecaeeaea1254b3e35fe8890a0127ce (do not edit this line) */

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java Mon Aug  1 18:57:05 2011
@@ -4,8 +4,8 @@ package org.apache.lucene.queryparser.fl
  
  import org.apache.lucene.messages.Message;
  import org.apache.lucene.messages.MessageImpl;
- import org.apache.lucene.queryparser.flexible.core.QueryNodeParseException;
- import org.apache.lucene.queryparser.flexible.core.messages.QueryParserMessages;
+ import org.apache.lucene.queryparser.flexible.core.*;
+ import org.apache.lucene.queryparser.flexible.core.messages.*;
 
 /**
  * This exception is thrown when parse errors are encountered.
@@ -56,7 +56,7 @@ public class ParseException extends Quer
   /** Constructor with message. */
   public ParseException(Message message) {
      super(message);
-                         }
+   }
 
   /**
    * This variable determines which constructor was used to create
@@ -193,4 +193,4 @@ public class ParseException extends Quer
    }
 
 }
-/* JavaCC - OriginalChecksum=38bce846fe6c8482993969f741c0323e (do not edit this line) */
+/* JavaCC - OriginalChecksum=0f25f4245374bbf9920c9a82efecadd2 (do not edit this line) */

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java Mon Aug  1 18:57:05 2011
@@ -19,14 +19,10 @@ package org.apache.lucene.queryparser.fl
  */
 
 import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Vector;
 
 import org.apache.lucene.messages.Message;
 import org.apache.lucene.messages.MessageImpl;
-import org.apache.lucene.queryparser.flexible.core.QueryNodeError;
-import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
 import org.apache.lucene.queryparser.flexible.core.QueryNodeParseException;
 import org.apache.lucene.queryparser.flexible.core.messages.QueryParserMessages;
 import org.apache.lucene.queryparser.flexible.core.nodes.AndQueryNode;
@@ -36,15 +32,12 @@ import org.apache.lucene.queryparser.fle
 import org.apache.lucene.queryparser.flexible.core.nodes.FuzzyQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.GroupQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.OpaqueQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.ParametricRangeQueryNode;
 import org.apache.lucene.queryparser.flexible.standard.nodes.RegexpQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.SlopQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ProximityQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl;
 import org.apache.lucene.queryparser.flexible.core.nodes.QuotedFieldQueryNode;
 import org.apache.lucene.queryparser.flexible.core.parser.SyntaxParser;
 
@@ -315,43 +308,168 @@ public class StandardSyntaxParser implem
 
   final public QueryNode Clause(CharSequence field) throws ParseException {
   QueryNode q;
-  Token fieldToken=null, boost=null;
+  Token fieldToken=null, boost=null, operator=null, term=null;
+  ParametricQueryNode qLower, qUpper;
+
   boolean group = false;
-    if (jj_2_1(2)) {
+    if (jj_2_2(3)) {
       fieldToken = jj_consume_token(TERM);
-      jj_consume_token(COLON);
-                               field=EscapeQuerySyntaxImpl.discardEscapeChar(fieldToken.image);
-    } else {
-      ;
-    }
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case QUOTED:
-    case TERM:
-    case REGEXPTERM:
-    case RANGEIN_START:
-    case RANGEEX_START:
-    case NUMBER:
-      q = Term(field);
-      break;
-    case LPAREN:
-      jj_consume_token(LPAREN);
-      q = Query(field);
-      jj_consume_token(RPAREN);
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case CARAT:
-        jj_consume_token(CARAT);
-        boost = jj_consume_token(NUMBER);
+      case OP_COLON:
+      case OP_EQUAL:
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case OP_COLON:
+          jj_consume_token(OP_COLON);
+          break;
+        case OP_EQUAL:
+          jj_consume_token(OP_EQUAL);
+          break;
+        default:
+          jj_la1[7] = jj_gen;
+          jj_consume_token(-1);
+          throw new ParseException();
+        }
+                                 field=EscapeQuerySyntaxImpl.discardEscapeChar(fieldToken.image);
+        q = Term(field);
+        break;
+      case OP_LESSTHAN:
+      case OP_LESSTHANEQ:
+      case OP_MORETHAN:
+      case OP_MORETHANEQ:
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case OP_LESSTHAN:
+          operator = jj_consume_token(OP_LESSTHAN);
+          break;
+        case OP_LESSTHANEQ:
+          operator = jj_consume_token(OP_LESSTHANEQ);
+          break;
+        case OP_MORETHAN:
+          operator = jj_consume_token(OP_MORETHAN);
+          break;
+        case OP_MORETHANEQ:
+          operator = jj_consume_token(OP_MORETHANEQ);
+          break;
+        default:
+          jj_la1[8] = jj_gen;
+          jj_consume_token(-1);
+          throw new ParseException();
+        }
+                                                                                                               field=EscapeQuerySyntaxImpl.discardEscapeChar(fieldToken.image);
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case TERM:
+          term = jj_consume_token(TERM);
+          break;
+        case QUOTED:
+          term = jj_consume_token(QUOTED);
+          break;
+        case NUMBER:
+          term = jj_consume_token(NUMBER);
+          break;
+        default:
+          jj_la1[9] = jj_gen;
+          jj_consume_token(-1);
+          throw new ParseException();
+        }
+        if (term.kind == QUOTED) {
+            term.image = term.image.substring(1, term.image.length()-1);
+        }
+        switch (operator.kind) {
+            case OP_LESSTHAN:
+                qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+                                         "*", term.beginColumn, term.endColumn);
+                qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LT,
+                                         EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+                break;
+            case OP_LESSTHANEQ:
+                qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+                                         "*", term.beginColumn, term.endColumn);
+                qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+                                         EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+                break;
+            case OP_MORETHAN:
+                qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GT,
+                                         EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+                qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+                                         "*", term.beginColumn, term.endColumn);
+                break;
+            case OP_MORETHANEQ:
+                qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+                                         EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+                qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+                                         "*", term.beginColumn, term.endColumn);
+                break;
+            default:
+                {if (true) throw new Error("Unhandled case: operator="+operator.toString());}
+        }
+        q = new ParametricRangeQueryNode(qLower, qUpper);
         break;
       default:
-        jj_la1[7] = jj_gen;
-        ;
+        jj_la1[10] = jj_gen;
+        jj_consume_token(-1);
+        throw new ParseException();
       }
+    } else {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case LPAREN:
+      case QUOTED:
+      case TERM:
+      case REGEXPTERM:
+      case RANGEIN_START:
+      case RANGEEX_START:
+      case NUMBER:
+        if (jj_2_1(2)) {
+          fieldToken = jj_consume_token(TERM);
+          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+          case OP_COLON:
+            jj_consume_token(OP_COLON);
+            break;
+          case OP_EQUAL:
+            jj_consume_token(OP_EQUAL);
+            break;
+          default:
+            jj_la1[11] = jj_gen;
+            jj_consume_token(-1);
+            throw new ParseException();
+          }
+                                 field=EscapeQuerySyntaxImpl.discardEscapeChar(fieldToken.image);
+        } else {
+          ;
+        }
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case QUOTED:
+        case TERM:
+        case REGEXPTERM:
+        case RANGEIN_START:
+        case RANGEEX_START:
+        case NUMBER:
+          q = Term(field);
+          break;
+        case LPAREN:
+          jj_consume_token(LPAREN);
+          q = Query(field);
+          jj_consume_token(RPAREN);
+          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+          case CARAT:
+            jj_consume_token(CARAT);
+            boost = jj_consume_token(NUMBER);
+            break;
+          default:
+            jj_la1[12] = jj_gen;
+            ;
+          }
                                                                  group=true;
-      break;
-    default:
-      jj_la1[8] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
+          break;
+        default:
+          jj_la1[13] = jj_gen;
+          jj_consume_token(-1);
+          throw new ParseException();
+        }
+        break;
+      default:
+        jj_la1[14] = jj_gen;
+        jj_consume_token(-1);
+        throw new ParseException();
+      }
     }
       if (boost != null) {
                   float f = (float)1.0;
@@ -376,6 +494,8 @@ public class StandardSyntaxParser implem
   Token term, boost=null, fuzzySlop=null, goop1, goop2;
   boolean fuzzy = false;
   boolean regexp = false;
+  boolean startInc=false;
+  boolean endInc=false;
   QueryNode q =null;
   ParametricQueryNode qLower, qUpper;
   float defaultMinSimilarity = org.apache.lucene.search.FuzzyQuery.defaultMinSimilarity;
@@ -396,7 +516,7 @@ public class StandardSyntaxParser implem
         term = jj_consume_token(NUMBER);
         break;
       default:
-        jj_la1[9] = jj_gen;
+        jj_la1[15] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -406,7 +526,7 @@ public class StandardSyntaxParser implem
                                 fuzzy=true;
         break;
       default:
-        jj_la1[10] = jj_gen;
+        jj_la1[16] = jj_gen;
         ;
       }
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -419,12 +539,12 @@ public class StandardSyntaxParser implem
                                                          fuzzy=true;
           break;
         default:
-          jj_la1[11] = jj_gen;
+          jj_la1[17] = jj_gen;
           ;
         }
         break;
       default:
-        jj_la1[12] = jj_gen;
+        jj_la1[18] = jj_gen;
         ;
       }
        if (fuzzy) {
@@ -443,115 +563,84 @@ public class StandardSyntaxParser implem
        }
       break;
     case RANGEIN_START:
-      jj_consume_token(RANGEIN_START);
+    case RANGEEX_START:
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case RANGEIN_GOOP:
-        goop1 = jj_consume_token(RANGEIN_GOOP);
+      case RANGEIN_START:
+        jj_consume_token(RANGEIN_START);
+                            startInc=true;
         break;
-      case RANGEIN_QUOTED:
-        goop1 = jj_consume_token(RANGEIN_QUOTED);
+      case RANGEEX_START:
+        jj_consume_token(RANGEEX_START);
         break;
       default:
-        jj_la1[13] = jj_gen;
+        jj_la1[19] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case RANGEIN_TO:
-        jj_consume_token(RANGEIN_TO);
-        break;
-      default:
-        jj_la1[14] = jj_gen;
-        ;
-      }
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case RANGEIN_GOOP:
-        goop2 = jj_consume_token(RANGEIN_GOOP);
+      case RANGE_GOOP:
+        goop1 = jj_consume_token(RANGE_GOOP);
         break;
-      case RANGEIN_QUOTED:
-        goop2 = jj_consume_token(RANGEIN_QUOTED);
+      case RANGE_QUOTED:
+        goop1 = jj_consume_token(RANGE_QUOTED);
         break;
       default:
-        jj_la1[15] = jj_gen;
+        jj_la1[20] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
-      jj_consume_token(RANGEIN_END);
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case CARAT:
-        jj_consume_token(CARAT);
-        boost = jj_consume_token(NUMBER);
+      case RANGE_TO:
+        jj_consume_token(RANGE_TO);
         break;
       default:
-        jj_la1[16] = jj_gen;
+        jj_la1[21] = jj_gen;
         ;
       }
-          if (goop1.kind == RANGEIN_QUOTED) {
-            goop1.image = goop1.image.substring(1, goop1.image.length()-1);
-          }
-          if (goop2.kind == RANGEIN_QUOTED) {
-            goop2.image = goop2.image.substring(1, goop2.image.length()-1);
-          }
-
-          qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
-                                               EscapeQuerySyntaxImpl.discardEscapeChar(goop1.image), goop1.beginColumn, goop1.endColumn);
-                  qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
-                                               EscapeQuerySyntaxImpl.discardEscapeChar(goop2.image), goop2.beginColumn, goop2.endColumn);
-          q = new ParametricRangeQueryNode(qLower, qUpper);
-      break;
-    case RANGEEX_START:
-      jj_consume_token(RANGEEX_START);
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case RANGEEX_GOOP:
-        goop1 = jj_consume_token(RANGEEX_GOOP);
+      case RANGE_GOOP:
+        goop2 = jj_consume_token(RANGE_GOOP);
         break;
-      case RANGEEX_QUOTED:
-        goop1 = jj_consume_token(RANGEEX_QUOTED);
+      case RANGE_QUOTED:
+        goop2 = jj_consume_token(RANGE_QUOTED);
         break;
       default:
-        jj_la1[17] = jj_gen;
+        jj_la1[22] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case RANGEEX_TO:
-        jj_consume_token(RANGEEX_TO);
+      case RANGEIN_END:
+        jj_consume_token(RANGEIN_END);
+                          endInc=true;
         break;
-      default:
-        jj_la1[18] = jj_gen;
-        ;
-      }
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case RANGEEX_GOOP:
-        goop2 = jj_consume_token(RANGEEX_GOOP);
-        break;
-      case RANGEEX_QUOTED:
-        goop2 = jj_consume_token(RANGEEX_QUOTED);
+      case RANGEEX_END:
+        jj_consume_token(RANGEEX_END);
         break;
       default:
-        jj_la1[19] = jj_gen;
+        jj_la1[23] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
-      jj_consume_token(RANGEEX_END);
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case CARAT:
         jj_consume_token(CARAT);
         boost = jj_consume_token(NUMBER);
         break;
       default:
-        jj_la1[20] = jj_gen;
+        jj_la1[24] = jj_gen;
         ;
       }
-          if (goop1.kind == RANGEEX_QUOTED) {
+          if (goop1.kind == RANGE_QUOTED) {
             goop1.image = goop1.image.substring(1, goop1.image.length()-1);
           }
-          if (goop2.kind == RANGEEX_QUOTED) {
+          if (goop2.kind == RANGE_QUOTED) {
             goop2.image = goop2.image.substring(1, goop2.image.length()-1);
           }
-          qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GT,
+
+          qLower = new ParametricQueryNode(field, startInc ? ParametricQueryNode.CompareOperator.GE : ParametricQueryNode.CompareOperator.GT,
                                                EscapeQuerySyntaxImpl.discardEscapeChar(goop1.image), goop1.beginColumn, goop1.endColumn);
-                  qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LT,
+                  qUpper = new ParametricQueryNode(field, endInc ? ParametricQueryNode.CompareOperator.LE : ParametricQueryNode.CompareOperator.LT,
                                                EscapeQuerySyntaxImpl.discardEscapeChar(goop2.image), goop2.beginColumn, goop2.endColumn);
           q = new ParametricRangeQueryNode(qLower, qUpper);
       break;
@@ -563,7 +652,7 @@ public class StandardSyntaxParser implem
         fuzzySlop = jj_consume_token(FUZZY_SLOP);
         break;
       default:
-        jj_la1[21] = jj_gen;
+        jj_la1[25] = jj_gen;
         ;
       }
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -572,7 +661,7 @@ public class StandardSyntaxParser implem
         boost = jj_consume_token(NUMBER);
         break;
       default:
-        jj_la1[22] = jj_gen;
+        jj_la1[26] = jj_gen;
         ;
       }
          int phraseSlop = 0;
@@ -590,7 +679,7 @@ public class StandardSyntaxParser implem
          }
       break;
     default:
-      jj_la1[23] = jj_gen;
+      jj_la1[27] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -619,9 +708,123 @@ public class StandardSyntaxParser implem
     finally { jj_save(0, xla); }
   }
 
+  private boolean jj_2_2(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_2(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(1, xla); }
+  }
+
+  private boolean jj_3R_4() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(15)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(16)) return true;
+    }
+    if (jj_3R_6()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_10() {
+    if (jj_scan_token(TERM)) return true;
+    return false;
+  }
+
+  private boolean jj_3_2() {
+    if (jj_scan_token(TERM)) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_4()) {
+    jj_scanpos = xsp;
+    if (jj_3R_5()) return true;
+    }
+    return false;
+  }
+
+  private boolean jj_3R_12() {
+    if (jj_scan_token(RANGEIN_START)) return true;
+    return false;
+  }
+
+  private boolean jj_3R_11() {
+    if (jj_scan_token(REGEXPTERM)) return true;
+    return false;
+  }
+
   private boolean jj_3_1() {
     if (jj_scan_token(TERM)) return true;
-    if (jj_scan_token(COLON)) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(15)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(16)) return true;
+    }
+    return false;
+  }
+
+  private boolean jj_3R_8() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_12()) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(27)) return true;
+    }
+    return false;
+  }
+
+  private boolean jj_3R_7() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_10()) {
+    jj_scanpos = xsp;
+    if (jj_3R_11()) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(28)) return true;
+    }
+    }
+    return false;
+  }
+
+  private boolean jj_3R_9() {
+    if (jj_scan_token(QUOTED)) return true;
+    return false;
+  }
+
+  private boolean jj_3R_6() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_7()) {
+    jj_scanpos = xsp;
+    if (jj_3R_8()) {
+    jj_scanpos = xsp;
+    if (jj_3R_9()) return true;
+    }
+    }
+    return false;
+  }
+
+  private boolean jj_3R_5() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(17)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(18)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(19)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(20)) return true;
+    }
+    }
+    }
+    xsp = jj_scanpos;
+    if (jj_scan_token(23)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(22)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(28)) return true;
+    }
+    }
     return false;
   }
 
@@ -636,15 +839,20 @@ public class StandardSyntaxParser implem
   private Token jj_scanpos, jj_lastpos;
   private int jj_la;
   private int jj_gen;
-  final private int[] jj_la1 = new int[24];
+  final private int[] jj_la1 = new int[28];
   static private int[] jj_la1_0;
+  static private int[] jj_la1_1;
   static {
       jj_la1_init_0();
+      jj_la1_init_1();
    }
    private static void jj_la1_init_0() {
-      jj_la1_0 = new int[] {0x300,0x300,0x1c00,0x1c00,0xf63c00,0x200,0x100,0x10000,0xf62000,0x940000,0x80000,0x80000,0x10000,0xc000000,0x1000000,0xc000000,0x10000,0xc0000000,0x10000000,0xc0000000,0x10000,0x80000,0x10000,0xf60000,};
+      jj_la1_0 = new int[] {0x300,0x300,0x1c00,0x1c00,0x1ec03c00,0x200,0x100,0x18000,0x1e0000,0x10c00000,0x1f8000,0x18000,0x200000,0x1ec02000,0x1ec02000,0x12800000,0x1000000,0x1000000,0x200000,0xc000000,0x0,0x20000000,0x0,0xc0000000,0x200000,0x1000000,0x200000,0x1ec00000,};
    }
-  final private JJCalls[] jj_2_rtns = new JJCalls[1];
+   private static void jj_la1_init_1() {
+      jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x3,0x0,0x0,0x0,0x0,0x0,};
+   }
+  final private JJCalls[] jj_2_rtns = new JJCalls[2];
   private boolean jj_rescan = false;
   private int jj_gc = 0;
 
@@ -659,7 +867,7 @@ public class StandardSyntaxParser implem
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 24; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -674,7 +882,7 @@ public class StandardSyntaxParser implem
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 24; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -685,7 +893,7 @@ public class StandardSyntaxParser implem
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 24; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -696,7 +904,7 @@ public class StandardSyntaxParser implem
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 24; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -706,7 +914,7 @@ public class StandardSyntaxParser implem
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 24; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -716,7 +924,7 @@ public class StandardSyntaxParser implem
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 24; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -794,7 +1002,7 @@ public class StandardSyntaxParser implem
       return (jj_ntk = jj_nt.kind);
   }
 
-  private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
+  private java.util.List jj_expentries = new java.util.ArrayList();
   private int[] jj_expentry;
   private int jj_kind = -1;
   private int[] jj_lasttokens = new int[100];
@@ -828,21 +1036,24 @@ public class StandardSyntaxParser implem
   /** Generate ParseException. */
   public ParseException generateParseException() {
     jj_expentries.clear();
-    boolean[] la1tokens = new boolean[32];
+    boolean[] la1tokens = new boolean[34];
     if (jj_kind >= 0) {
       la1tokens[jj_kind] = true;
       jj_kind = -1;
     }
-    for (int i = 0; i < 24; i++) {
+    for (int i = 0; i < 28; i++) {
       if (jj_la1[i] == jj_gen) {
         for (int j = 0; j < 32; j++) {
           if ((jj_la1_0[i] & (1<<j)) != 0) {
             la1tokens[j] = true;
           }
+          if ((jj_la1_1[i] & (1<<j)) != 0) {
+            la1tokens[32+j] = true;
+          }
         }
       }
     }
-    for (int i = 0; i < 32; i++) {
+    for (int i = 0; i < 34; i++) {
       if (la1tokens[i]) {
         jj_expentry = new int[1];
         jj_expentry[0] = i;
@@ -854,7 +1065,7 @@ public class StandardSyntaxParser implem
     jj_add_error_token(0, 0);
     int[][] exptokseq = new int[jj_expentries.size()][];
     for (int i = 0; i < jj_expentries.size(); i++) {
-      exptokseq[i] = jj_expentries.get(i);
+      exptokseq[i] = (int[])jj_expentries.get(i);
     }
     return new ParseException(token, exptokseq, tokenImage);
   }
@@ -869,7 +1080,7 @@ public class StandardSyntaxParser implem
 
   private void jj_rescan_token() {
     jj_rescan = true;
-    for (int i = 0; i < 1; i++) {
+    for (int i = 0; i < 2; i++) {
     try {
       JJCalls p = jj_2_rtns[i];
       do {
@@ -877,6 +1088,7 @@ public class StandardSyntaxParser implem
           jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
           switch (i) {
             case 0: jj_3_1(); break;
+            case 1: jj_3_2(); break;
           }
         }
         p = p.next;

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj Mon Aug  1 18:57:05 2011
@@ -31,14 +31,10 @@ package org.apache.lucene.queryparser.fl
  */
 
 import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Vector;
 
 import org.apache.lucene.messages.Message;
 import org.apache.lucene.messages.MessageImpl;
-import org.apache.lucene.queryparser.flexible.core.QueryNodeError;
-import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
 import org.apache.lucene.queryparser.flexible.core.QueryNodeParseException;
 import org.apache.lucene.queryparser.flexible.core.messages.QueryParserMessages;
 import org.apache.lucene.queryparser.flexible.core.nodes.AndQueryNode;
@@ -48,15 +44,12 @@ import org.apache.lucene.queryparser.fle
 import org.apache.lucene.queryparser.flexible.core.nodes.FuzzyQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.GroupQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.OpaqueQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.ParametricRangeQueryNode;
 import org.apache.lucene.queryparser.flexible.standard.nodes.RegexpQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.SlopQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ProximityQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl;
 import org.apache.lucene.queryparser.flexible.core.nodes.QuotedFieldQueryNode;
 import org.apache.lucene.queryparser.flexible.core.parser.SyntaxParser;
 
@@ -71,7 +64,7 @@ public class StandardSyntaxParser implem
    public StandardSyntaxParser() {
    	this(new StringReader(""));
   }
-     /** Parses a query string, returning a {@link org.apache.lucene.queryParser.core.nodes.QueryNode}.
+     /** Parses a query string, returning a {@link org.apache.lucene.queryparser.flexible.core.nodes.QueryNode}.
      *  @param query  the query string to be parsed.
      *  @throws ParseException if the parsing fails
      */
@@ -108,14 +101,14 @@ PARSER_END(StandardSyntaxParser)
 // every character that follows a backslash is considered as an escaped character
 | <#_ESCAPED_CHAR: "\\" ~[] >
 | <#_TERM_START_CHAR: ( ~[ " ", "\t", "\n", "\r", "\u3000", "+", "-", "!", "(", ")", ":", "^",
-                           "[", "]", "\"", "{", "}", "~", "\\" ]
+                           "<", ">", "=", "[", "]", "\"", "{", "}", "~", "\\" ]
                        | <_ESCAPED_CHAR> ) >
 | <#_TERM_CHAR: ( <_TERM_START_CHAR> | <_ESCAPED_CHAR> | "-" | "+" ) >
 | <#_WHITESPACE: ( " " | "\t" | "\n" | "\r" | "\u3000") >
 | <#_QUOTED_CHAR: ( ~[ "\"", "\\" ] | <_ESCAPED_CHAR> ) >
 }
 
-<DEFAULT, RangeIn, RangeEx> SKIP : {
+<DEFAULT, Range> SKIP : {
   < <_WHITESPACE>>
 }
 
@@ -127,32 +120,31 @@ PARSER_END(StandardSyntaxParser)
 | <MINUS:     "-" >
 | <LPAREN:    "(" >
 | <RPAREN:    ")" >
-| <COLON:     ":" >
+| <OP_COLON:  ":" >
+| <OP_EQUAL:  "=" >
+| <OP_LESSTHAN:   "<"  >
+| <OP_LESSTHANEQ: "<=" >
+| <OP_MORETHAN:   ">"  >
+| <OP_MORETHANEQ: ">=" >
 | <CARAT:     "^" > : Boost
 | <QUOTED:     "\"" (<_QUOTED_CHAR>)* "\"">
 | <TERM:      <_TERM_START_CHAR> (<_TERM_CHAR>)*  >
 | <FUZZY_SLOP:     "~" ( (<_NUM_CHAR>)+ ( "." (<_NUM_CHAR>)+ )? )? >
 | <REGEXPTERM: "/" (~[ "/" ] | "\\/" )* "/" >
-| <RANGEIN_START: "[" > : RangeIn
-| <RANGEEX_START: "{" > : RangeEx
+| <RANGEIN_START: "[" > : Range
+| <RANGEEX_START: "{" > : Range
 }
 
 <Boost> TOKEN : {
 <NUMBER:    (<_NUM_CHAR>)+ ( "." (<_NUM_CHAR>)+ )? > : DEFAULT
 }
 
-<RangeIn> TOKEN : {
-<RANGEIN_TO: "TO">
+<Range> TOKEN : {
+<RANGE_TO: "TO">
 | <RANGEIN_END: "]"> : DEFAULT
-| <RANGEIN_QUOTED: "\"" (~["\""] | "\\\"")+ "\"">
-| <RANGEIN_GOOP: (~[ " ", "]" ])+ >
-}
-
-<RangeEx> TOKEN : {
-<RANGEEX_TO: "TO">
 | <RANGEEX_END: "}"> : DEFAULT
-| <RANGEEX_QUOTED: "\"" (~["\""] | "\\\"")+ "\"">
-| <RANGEEX_GOOP: (~[ " ", "}" ])+ >
+| <RANGE_QUOTED: "\"" (~["\""] | "\\\"")+ "\"">
+| <RANGE_GOOP: (~[ " ", "]", "}" ])+ >
 }
 
 // *   Query  ::= ( Clause )*
@@ -335,22 +327,62 @@ QueryNode ModClause(CharSequence field) 
 
 QueryNode Clause(CharSequence field) : {
   QueryNode q;
-  Token fieldToken=null, boost=null;
+  Token fieldToken=null, boost=null, operator=null, term=null;
+  ParametricQueryNode qLower, qUpper;
+  
   boolean group = false;
 }
 {
-  [
+(
+  LOOKAHEAD(3)
+  fieldToken=<TERM> (
+    ( <OP_COLON> | <OP_EQUAL> ) {field=EscapeQuerySyntaxImpl.discardEscapeChar(fieldToken.image);} q=Term(field)
+  | ( operator=<OP_LESSTHAN> | operator=<OP_LESSTHANEQ> | operator=<OP_MORETHAN> | operator=<OP_MORETHANEQ> ) {field=EscapeQuerySyntaxImpl.discardEscapeChar(fieldToken.image);}( term=<TERM> | term=<QUOTED> | term=<NUMBER> )
+    {
+        if (term.kind == QUOTED) {
+            term.image = term.image.substring(1, term.image.length()-1);
+        }
+        switch (operator.kind) {
+            case OP_LESSTHAN:
+                qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+                                         "*", term.beginColumn, term.endColumn);
+                qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LT,
+                                         EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+                break;
+            case OP_LESSTHANEQ:
+                qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+                                         "*", term.beginColumn, term.endColumn);
+                qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+                                         EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+                break;
+            case OP_MORETHAN:
+                qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GT,
+                                         EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+                qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+                                         "*", term.beginColumn, term.endColumn);
+                break;
+            case OP_MORETHANEQ:
+                qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE,
+                                         EscapeQuerySyntaxImpl.discardEscapeChar(term.image), term.beginColumn, term.endColumn);
+                qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE,
+                                         "*", term.beginColumn, term.endColumn);
+                break;
+            default:
+                throw new Error("Unhandled case: operator="+operator.toString());
+        }
+        q = new ParametricRangeQueryNode(qLower, qUpper);
+    }
+  )
+| [
     LOOKAHEAD(2)
-    (
-    fieldToken=<TERM> <COLON> {field=EscapeQuerySyntaxImpl.discardEscapeChar(fieldToken.image);}    
-    )
+    fieldToken=<TERM>
+    ( <OP_COLON> | <OP_EQUAL> ) {field=EscapeQuerySyntaxImpl.discardEscapeChar(fieldToken.image);}
   ]
-
   (
    q=Term(field)
    | <LPAREN> q=Query(field) <RPAREN> (<CARAT> boost=<NUMBER>)? {group=true;}
-
   )
+)
     {
       if (boost != null) {
 		  float f = (float)1.0;
@@ -376,6 +408,8 @@ QueryNode Term(CharSequence field) : {
   Token term, boost=null, fuzzySlop=null, goop1, goop2;
   boolean fuzzy = false;
   boolean regexp = false;
+  boolean startInc=false;
+  boolean endInc=false;
   QueryNode q =null; 
   ParametricQueryNode qLower, qUpper;
   float defaultMinSimilarity = org.apache.lucene.search.FuzzyQuery.defaultMinSimilarity;
@@ -405,41 +439,26 @@ QueryNode Term(CharSequence field) : {
          q = new RegexpQueryNode(field, term.image, term.beginColumn, term.endColumn-1);
        }
      }
-     | ( <RANGEIN_START> ( goop1=<RANGEIN_GOOP>|goop1=<RANGEIN_QUOTED> )
-         [ <RANGEIN_TO> ] ( goop2=<RANGEIN_GOOP>|goop2=<RANGEIN_QUOTED> )
-         <RANGEIN_END> )
+     | ( ( <RANGEIN_START> {startInc=true;} | <RANGEEX_START> )
+         ( goop1=<RANGE_GOOP>|goop1=<RANGE_QUOTED> )
+         [ <RANGE_TO> ]
+         ( goop2=<RANGE_GOOP>|goop2=<RANGE_QUOTED> )
+         ( <RANGEIN_END> {endInc=true;} | <RANGEEX_END>))
        [ <CARAT> boost=<NUMBER> ]
         {
-          if (goop1.kind == RANGEIN_QUOTED) {
+          if (goop1.kind == RANGE_QUOTED) {
             goop1.image = goop1.image.substring(1, goop1.image.length()-1);
           }
-          if (goop2.kind == RANGEIN_QUOTED) {
+          if (goop2.kind == RANGE_QUOTED) {
             goop2.image = goop2.image.substring(1, goop2.image.length()-1);
           }
           
-          qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GE, 
+          qLower = new ParametricQueryNode(field, startInc ? ParametricQueryNode.CompareOperator.GE : ParametricQueryNode.CompareOperator.GT, 
 		                               EscapeQuerySyntaxImpl.discardEscapeChar(goop1.image), goop1.beginColumn, goop1.endColumn);
-		  qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LE, 
+		  qUpper = new ParametricQueryNode(field, endInc ? ParametricQueryNode.CompareOperator.LE : ParametricQueryNode.CompareOperator.LT, 
 		                               EscapeQuerySyntaxImpl.discardEscapeChar(goop2.image), goop2.beginColumn, goop2.endColumn);
           q = new ParametricRangeQueryNode(qLower, qUpper);
         }
-     | ( <RANGEEX_START> ( goop1=<RANGEEX_GOOP>|goop1=<RANGEEX_QUOTED> )
-         [ <RANGEEX_TO> ] ( goop2=<RANGEEX_GOOP>|goop2=<RANGEEX_QUOTED> )
-         <RANGEEX_END> )
-       [ <CARAT> boost=<NUMBER> ]
-        {
-          if (goop1.kind == RANGEEX_QUOTED) {
-            goop1.image = goop1.image.substring(1, goop1.image.length()-1);
-          }
-          if (goop2.kind == RANGEEX_QUOTED) {
-            goop2.image = goop2.image.substring(1, goop2.image.length()-1);
-          }
-          qLower = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.GT, 
-		                               EscapeQuerySyntaxImpl.discardEscapeChar(goop1.image), goop1.beginColumn, goop1.endColumn);
-		  qUpper = new ParametricQueryNode(field, ParametricQueryNode.CompareOperator.LT, 
-		                               EscapeQuerySyntaxImpl.discardEscapeChar(goop2.image), goop2.beginColumn, goop2.endColumn);
-          q = new ParametricRangeQueryNode(qLower, qUpper);		  
-        }
      | term=<QUOTED> {q = new QuotedFieldQueryNode(field, EscapeQuerySyntaxImpl.discardEscapeChar(term.image.substring(1, term.image.length()-1)), term.beginColumn + 1, term.endColumn - 1);}
        [ fuzzySlop=<FUZZY_SLOP> ]
        [ <CARAT> boost=<NUMBER> ]

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserConstants.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserConstants.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserConstants.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserConstants.java Mon Aug  1 18:57:05 2011
@@ -37,48 +37,50 @@ public interface StandardSyntaxParserCon
   /** RegularExpression Id. */
   int RPAREN = 14;
   /** RegularExpression Id. */
-  int COLON = 15;
+  int OP_COLON = 15;
   /** RegularExpression Id. */
-  int CARAT = 16;
+  int OP_EQUAL = 16;
   /** RegularExpression Id. */
-  int QUOTED = 17;
+  int OP_LESSTHAN = 17;
   /** RegularExpression Id. */
-  int TERM = 18;
+  int OP_LESSTHANEQ = 18;
   /** RegularExpression Id. */
-  int FUZZY_SLOP = 19;
+  int OP_MORETHAN = 19;
   /** RegularExpression Id. */
-  int REGEXPTERM = 20;
+  int OP_MORETHANEQ = 20;
   /** RegularExpression Id. */
-  int RANGEIN_START = 21;
+  int CARAT = 21;
   /** RegularExpression Id. */
-  int RANGEEX_START = 22;
+  int QUOTED = 22;
   /** RegularExpression Id. */
-  int NUMBER = 23;
+  int TERM = 23;
   /** RegularExpression Id. */
-  int RANGEIN_TO = 24;
+  int FUZZY_SLOP = 24;
   /** RegularExpression Id. */
-  int RANGEIN_END = 25;
+  int REGEXPTERM = 25;
   /** RegularExpression Id. */
-  int RANGEIN_QUOTED = 26;
+  int RANGEIN_START = 26;
   /** RegularExpression Id. */
-  int RANGEIN_GOOP = 27;
+  int RANGEEX_START = 27;
   /** RegularExpression Id. */
-  int RANGEEX_TO = 28;
+  int NUMBER = 28;
   /** RegularExpression Id. */
-  int RANGEEX_END = 29;
+  int RANGE_TO = 29;
   /** RegularExpression Id. */
-  int RANGEEX_QUOTED = 30;
+  int RANGEIN_END = 30;
   /** RegularExpression Id. */
-  int RANGEEX_GOOP = 31;
+  int RANGEEX_END = 31;
+  /** RegularExpression Id. */
+  int RANGE_QUOTED = 32;
+  /** RegularExpression Id. */
+  int RANGE_GOOP = 33;
 
   /** Lexical state. */
   int Boost = 0;
   /** Lexical state. */
-  int RangeEx = 1;
+  int Range = 1;
   /** Lexical state. */
-  int RangeIn = 2;
-  /** Lexical state. */
-  int DEFAULT = 3;
+  int DEFAULT = 2;
 
   /** Literal token values. */
   String[] tokenImage = {
@@ -98,6 +100,11 @@ public interface StandardSyntaxParserCon
     "\"(\"",
     "\")\"",
     "\":\"",
+    "\"=\"",
+    "\"<\"",
+    "\"<=\"",
+    "\">\"",
+    "\">=\"",
     "\"^\"",
     "<QUOTED>",
     "<TERM>",
@@ -108,12 +115,9 @@ public interface StandardSyntaxParserCon
     "<NUMBER>",
     "\"TO\"",
     "\"]\"",
-    "<RANGEIN_QUOTED>",
-    "<RANGEIN_GOOP>",
-    "\"TO\"",
     "\"}\"",
-    "<RANGEEX_QUOTED>",
-    "<RANGEEX_GOOP>",
+    "<RANGE_QUOTED>",
+    "<RANGE_GOOP>",
   };
 
 }

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParserTokenManager.java Mon Aug  1 18:57:05 2011
@@ -18,13 +18,9 @@ package org.apache.lucene.queryparser.fl
  */
 
 import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Vector;
 import org.apache.lucene.messages.Message;
 import org.apache.lucene.messages.MessageImpl;
-import org.apache.lucene.queryparser.flexible.core.QueryNodeError;
-import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
 import org.apache.lucene.queryparser.flexible.core.QueryNodeParseException;
 import org.apache.lucene.queryparser.flexible.core.messages.QueryParserMessages;
 import org.apache.lucene.queryparser.flexible.core.nodes.AndQueryNode;
@@ -34,15 +30,12 @@ import org.apache.lucene.queryparser.fle
 import org.apache.lucene.queryparser.flexible.core.nodes.FuzzyQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.GroupQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.OpaqueQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.ParametricRangeQueryNode;
 import org.apache.lucene.queryparser.flexible.standard.nodes.RegexpQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.SlopQueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.ProximityQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
-import org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl;
 import org.apache.lucene.queryparser.flexible.core.nodes.QuotedFieldQueryNode;
 import org.apache.lucene.queryparser.flexible.core.parser.SyntaxParser;
 
@@ -54,7 +47,7 @@ public class StandardSyntaxParserTokenMa
   public  java.io.PrintStream debugStream = System.out;
   /** Set debug output. */
   public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
-private final int jjStopStringLiteralDfa_3(int pos, long active0)
+private final int jjStopStringLiteralDfa_2(int pos, long active0)
 {
    switch (pos)
    {
@@ -62,9 +55,9 @@ private final int jjStopStringLiteralDfa
          return -1;
    }
 }
-private final int jjStartNfa_3(int pos, long active0)
+private final int jjStartNfa_2(int pos, long active0)
 {
-   return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1);
+   return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1);
 }
 private int jjStopAtPos(int pos, int kind)
 {
@@ -72,7 +65,7 @@ private int jjStopAtPos(int pos, int kin
    jjmatchedPos = pos;
    return pos + 1;
 }
-private int jjMoveStringLiteralDfa0_3()
+private int jjMoveStringLiteralDfa0_2()
 {
    switch(curChar)
    {
@@ -86,15 +79,43 @@ private int jjMoveStringLiteralDfa0_3()
          return jjStopAtPos(0, 12);
       case 58:
          return jjStopAtPos(0, 15);
+      case 60:
+         jjmatchedKind = 17;
+         return jjMoveStringLiteralDfa1_2(0x40000L);
+      case 61:
+         return jjStopAtPos(0, 16);
+      case 62:
+         jjmatchedKind = 19;
+         return jjMoveStringLiteralDfa1_2(0x100000L);
       case 91:
-         return jjStopAtPos(0, 21);
+         return jjStopAtPos(0, 26);
       case 94:
-         return jjStopAtPos(0, 16);
+         return jjStopAtPos(0, 21);
       case 123:
-         return jjStopAtPos(0, 22);
+         return jjStopAtPos(0, 27);
+      default :
+         return jjMoveNfa_2(0, 0);
+   }
+}
+private int jjMoveStringLiteralDfa1_2(long active0)
+{
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_2(0, active0);
+      return 1;
+   }
+   switch(curChar)
+   {
+      case 61:
+         if ((active0 & 0x40000L) != 0L)
+            return jjStopAtPos(1, 18);
+         else if ((active0 & 0x100000L) != 0L)
+            return jjStopAtPos(1, 20);
+         break;
       default :
-         return jjMoveNfa_3(0, 0);
+         break;
    }
+   return jjStartNfa_2(0, active0);
 }
 static final long[] jjbitVec0 = {
    0x1L, 0x0L, 0x0L, 0x0L
@@ -108,7 +129,7 @@ static final long[] jjbitVec3 = {
 static final long[] jjbitVec4 = {
    0xfffefffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
 };
-private int jjMoveNfa_3(int startState, int curPos)
+private int jjMoveNfa_2(int startState, int curPos)
 {
    int startsAt = 0;
    jjnewStateCnt = 33;
@@ -127,10 +148,10 @@ private int jjMoveNfa_3(int startState, 
             switch(jjstateSet[--i])
             {
                case 0:
-                  if ((0xfbffd4f8ffffd9ffL & l) != 0L)
+                  if ((0x8bffd4f8ffffd9ffL & l) != 0L)
                   {
-                     if (kind > 18)
-                        kind = 18;
+                     if (kind > 23)
+                        kind = 23;
                      jjCheckNAddTwoStates(20, 21);
                   }
                   else if ((0x100002600L & l) != 0L)
@@ -174,33 +195,33 @@ private int jjMoveNfa_3(int startState, 
                   jjCheckNAddStates(0, 2);
                   break;
                case 18:
-                  if (curChar == 34 && kind > 17)
-                     kind = 17;
+                  if (curChar == 34 && kind > 22)
+                     kind = 22;
                   break;
                case 19:
-                  if ((0xfbffd4f8ffffd9ffL & l) == 0L)
+                  if ((0x8bffd4f8ffffd9ffL & l) == 0L)
                      break;
-                  if (kind > 18)
-                     kind = 18;
+                  if (kind > 23)
+                     kind = 23;
                   jjCheckNAddTwoStates(20, 21);
                   break;
                case 20:
-                  if ((0xfbfffcf8ffffd9ffL & l) == 0L)
+                  if ((0x8bfffcf8ffffd9ffL & l) == 0L)
                      break;
-                  if (kind > 18)
-                     kind = 18;
+                  if (kind > 23)
+                     kind = 23;
                   jjCheckNAddTwoStates(20, 21);
                   break;
                case 22:
-                  if (kind > 18)
-                     kind = 18;
+                  if (kind > 23)
+                     kind = 23;
                   jjCheckNAddTwoStates(20, 21);
                   break;
                case 25:
                   if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  if (kind > 19)
-                     kind = 19;
+                  if (kind > 24)
+                     kind = 24;
                   jjAddStates(6, 7);
                   break;
                case 26:
@@ -210,8 +231,8 @@ private int jjMoveNfa_3(int startState, 
                case 27:
                   if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  if (kind > 19)
-                     kind = 19;
+                  if (kind > 24)
+                     kind = 24;
                   jjCheckNAdd(27);
                   break;
                case 28:
@@ -224,8 +245,8 @@ private int jjMoveNfa_3(int startState, 
                      jjCheckNAddStates(3, 5);
                   break;
                case 32:
-                  if (curChar == 47 && kind > 20)
-                     kind = 20;
+                  if (curChar == 47 && kind > 25)
+                     kind = 25;
                   break;
                default : break;
             }
@@ -241,14 +262,14 @@ private int jjMoveNfa_3(int startState, 
                case 0:
                   if ((0x97ffffff87ffffffL & l) != 0L)
                   {
-                     if (kind > 18)
-                        kind = 18;
+                     if (kind > 23)
+                        kind = 23;
                      jjCheckNAddTwoStates(20, 21);
                   }
                   else if (curChar == 126)
                   {
-                     if (kind > 19)
-                        kind = 19;
+                     if (kind > 24)
+                        kind = 24;
                      jjstateSet[jjnewStateCnt++] = 25;
                   }
                   else if (curChar == 92)
@@ -317,8 +338,8 @@ private int jjMoveNfa_3(int startState, 
                case 20:
                   if ((0x97ffffff87ffffffL & l) == 0L)
                      break;
-                  if (kind > 18)
-                     kind = 18;
+                  if (kind > 23)
+                     kind = 23;
                   jjCheckNAddTwoStates(20, 21);
                   break;
                case 21:
@@ -326,8 +347,8 @@ private int jjMoveNfa_3(int startState, 
                      jjCheckNAddTwoStates(22, 22);
                   break;
                case 22:
-                  if (kind > 18)
-                     kind = 18;
+                  if (kind > 23)
+                     kind = 23;
                   jjCheckNAddTwoStates(20, 21);
                   break;
                case 23:
@@ -337,8 +358,8 @@ private int jjMoveNfa_3(int startState, 
                case 24:
                   if (curChar != 126)
                      break;
-                  if (kind > 19)
-                     kind = 19;
+                  if (kind > 24)
+                     kind = 24;
                   jjstateSet[jjnewStateCnt++] = 25;
                   break;
                case 29:
@@ -371,8 +392,8 @@ private int jjMoveNfa_3(int startState, 
                   }
                   if (jjCanMove_2(hiByte, i1, i2, l1, l2))
                   {
-                     if (kind > 18)
-                        kind = 18;
+                     if (kind > 23)
+                        kind = 23;
                      jjCheckNAddTwoStates(20, 21);
                   }
                   break;
@@ -385,15 +406,15 @@ private int jjMoveNfa_3(int startState, 
                case 20:
                   if (!jjCanMove_2(hiByte, i1, i2, l1, l2))
                      break;
-                  if (kind > 18)
-                     kind = 18;
+                  if (kind > 23)
+                     kind = 23;
                   jjCheckNAddTwoStates(20, 21);
                   break;
                case 22:
                   if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
                      break;
-                  if (kind > 18)
-                     kind = 18;
+                  if (kind > 23)
+                     kind = 23;
                   jjCheckNAddTwoStates(20, 21);
                   break;
                case 29:
@@ -417,201 +438,6 @@ private int jjMoveNfa_3(int startState, 
       catch(java.io.IOException e) { return curPos; }
    }
 }
-private final int jjStopStringLiteralDfa_1(int pos, long active0)
-{
-   switch (pos)
-   {
-      case 0:
-         if ((active0 & 0x10000000L) != 0L)
-         {
-            jjmatchedKind = 31;
-            return 6;
-         }
-         return -1;
-      default :
-         return -1;
-   }
-}
-private final int jjStartNfa_1(int pos, long active0)
-{
-   return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1);
-}
-private int jjMoveStringLiteralDfa0_1()
-{
-   switch(curChar)
-   {
-      case 84:
-         return jjMoveStringLiteralDfa1_1(0x10000000L);
-      case 125:
-         return jjStopAtPos(0, 29);
-      default :
-         return jjMoveNfa_1(0, 0);
-   }
-}
-private int jjMoveStringLiteralDfa1_1(long active0)
-{
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) {
-      jjStopStringLiteralDfa_1(0, active0);
-      return 1;
-   }
-   switch(curChar)
-   {
-      case 79:
-         if ((active0 & 0x10000000L) != 0L)
-            return jjStartNfaWithStates_1(1, 28, 6);
-         break;
-      default :
-         break;
-   }
-   return jjStartNfa_1(0, active0);
-}
-private int jjStartNfaWithStates_1(int pos, int kind, int state)
-{
-   jjmatchedKind = kind;
-   jjmatchedPos = pos;
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) { return pos + 1; }
-   return jjMoveNfa_1(state, pos + 1);
-}
-private int jjMoveNfa_1(int startState, int curPos)
-{
-   int startsAt = 0;
-   jjnewStateCnt = 7;
-   int i = 1;
-   jjstateSet[0] = startState;
-   int kind = 0x7fffffff;
-   for (;;)
-   {
-      if (++jjround == 0x7fffffff)
-         ReInitRounds();
-      if (curChar < 64)
-      {
-         long l = 1L << curChar;
-         do
-         {
-            switch(jjstateSet[--i])
-            {
-               case 0:
-                  if ((0xfffffffeffffffffL & l) != 0L)
-                  {
-                     if (kind > 31)
-                        kind = 31;
-                     jjCheckNAdd(6);
-                  }
-                  if ((0x100002600L & l) != 0L)
-                  {
-                     if (kind > 7)
-                        kind = 7;
-                  }
-                  else if (curChar == 34)
-                     jjCheckNAddTwoStates(2, 4);
-                  break;
-               case 1:
-                  if (curChar == 34)
-                     jjCheckNAddTwoStates(2, 4);
-                  break;
-               case 2:
-                  if ((0xfffffffbffffffffL & l) != 0L)
-                     jjCheckNAddStates(8, 10);
-                  break;
-               case 3:
-                  if (curChar == 34)
-                     jjCheckNAddStates(8, 10);
-                  break;
-               case 5:
-                  if (curChar == 34 && kind > 30)
-                     kind = 30;
-                  break;
-               case 6:
-                  if ((0xfffffffeffffffffL & l) == 0L)
-                     break;
-                  if (kind > 31)
-                     kind = 31;
-                  jjCheckNAdd(6);
-                  break;
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      else if (curChar < 128)
-      {
-         long l = 1L << (curChar & 077);
-         do
-         {
-            switch(jjstateSet[--i])
-            {
-               case 0:
-               case 6:
-                  if ((0xdfffffffffffffffL & l) == 0L)
-                     break;
-                  if (kind > 31)
-                     kind = 31;
-                  jjCheckNAdd(6);
-                  break;
-               case 2:
-                  jjAddStates(8, 10);
-                  break;
-               case 4:
-                  if (curChar == 92)
-                     jjstateSet[jjnewStateCnt++] = 3;
-                  break;
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      else
-      {
-         int hiByte = (int)(curChar >> 8);
-         int i1 = hiByte >> 6;
-         long l1 = 1L << (hiByte & 077);
-         int i2 = (curChar & 0xff) >> 6;
-         long l2 = 1L << (curChar & 077);
-         do
-         {
-            switch(jjstateSet[--i])
-            {
-               case 0:
-                  if (jjCanMove_0(hiByte, i1, i2, l1, l2))
-                  {
-                     if (kind > 7)
-                        kind = 7;
-                  }
-                  if (jjCanMove_1(hiByte, i1, i2, l1, l2))
-                  {
-                     if (kind > 31)
-                        kind = 31;
-                     jjCheckNAdd(6);
-                  }
-                  break;
-               case 2:
-                  if (jjCanMove_1(hiByte, i1, i2, l1, l2))
-                     jjAddStates(8, 10);
-                  break;
-               case 6:
-                  if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
-                     break;
-                  if (kind > 31)
-                     kind = 31;
-                  jjCheckNAdd(6);
-                  break;
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      if (kind != 0x7fffffff)
-      {
-         jjmatchedKind = kind;
-         jjmatchedPos = curPos;
-         kind = 0x7fffffff;
-      }
-      ++curPos;
-      if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
-         return curPos;
-      try { curChar = input_stream.readChar(); }
-      catch(java.io.IOException e) { return curPos; }
-   }
-}
 private int jjMoveStringLiteralDfa0_0()
 {
    return jjMoveNfa_0(0, 0);
@@ -637,9 +463,9 @@ private int jjMoveNfa_0(int startState, 
                case 0:
                   if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  if (kind > 23)
-                     kind = 23;
-                  jjAddStates(11, 12);
+                  if (kind > 28)
+                     kind = 28;
+                  jjAddStates(8, 9);
                   break;
                case 1:
                   if (curChar == 46)
@@ -648,8 +474,8 @@ private int jjMoveNfa_0(int startState, 
                case 2:
                   if ((0x3ff000000000000L & l) == 0L)
                      break;
-                  if (kind > 23)
-                     kind = 23;
+                  if (kind > 28)
+                     kind = 28;
                   jjCheckNAdd(2);
                   break;
                default : break;
@@ -695,14 +521,14 @@ private int jjMoveNfa_0(int startState, 
       catch(java.io.IOException e) { return curPos; }
    }
 }
-private final int jjStopStringLiteralDfa_2(int pos, long active0)
+private final int jjStopStringLiteralDfa_1(int pos, long active0)
 {
    switch (pos)
    {
       case 0:
-         if ((active0 & 0x1000000L) != 0L)
+         if ((active0 & 0x20000000L) != 0L)
          {
-            jjmatchedKind = 27;
+            jjmatchedKind = 33;
             return 6;
          }
          return -1;
@@ -710,49 +536,51 @@ private final int jjStopStringLiteralDfa
          return -1;
    }
 }
-private final int jjStartNfa_2(int pos, long active0)
+private final int jjStartNfa_1(int pos, long active0)
 {
-   return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1);
+   return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1);
 }
-private int jjMoveStringLiteralDfa0_2()
+private int jjMoveStringLiteralDfa0_1()
 {
    switch(curChar)
    {
       case 84:
-         return jjMoveStringLiteralDfa1_2(0x1000000L);
+         return jjMoveStringLiteralDfa1_1(0x20000000L);
       case 93:
-         return jjStopAtPos(0, 25);
+         return jjStopAtPos(0, 30);
+      case 125:
+         return jjStopAtPos(0, 31);
       default :
-         return jjMoveNfa_2(0, 0);
+         return jjMoveNfa_1(0, 0);
    }
 }
-private int jjMoveStringLiteralDfa1_2(long active0)
+private int jjMoveStringLiteralDfa1_1(long active0)
 {
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) {
-      jjStopStringLiteralDfa_2(0, active0);
+      jjStopStringLiteralDfa_1(0, active0);
       return 1;
    }
    switch(curChar)
    {
       case 79:
-         if ((active0 & 0x1000000L) != 0L)
-            return jjStartNfaWithStates_2(1, 24, 6);
+         if ((active0 & 0x20000000L) != 0L)
+            return jjStartNfaWithStates_1(1, 29, 6);
          break;
       default :
          break;
    }
-   return jjStartNfa_2(0, active0);
+   return jjStartNfa_1(0, active0);
 }
-private int jjStartNfaWithStates_2(int pos, int kind, int state)
+private int jjStartNfaWithStates_1(int pos, int kind, int state)
 {
    jjmatchedKind = kind;
    jjmatchedPos = pos;
    try { curChar = input_stream.readChar(); }
    catch(java.io.IOException e) { return pos + 1; }
-   return jjMoveNfa_2(state, pos + 1);
+   return jjMoveNfa_1(state, pos + 1);
 }
-private int jjMoveNfa_2(int startState, int curPos)
+private int jjMoveNfa_1(int startState, int curPos)
 {
    int startsAt = 0;
    jjnewStateCnt = 7;
@@ -773,8 +601,8 @@ private int jjMoveNfa_2(int startState, 
                case 0:
                   if ((0xfffffffeffffffffL & l) != 0L)
                   {
-                     if (kind > 27)
-                        kind = 27;
+                     if (kind > 33)
+                        kind = 33;
                      jjCheckNAdd(6);
                   }
                   if ((0x100002600L & l) != 0L)
@@ -791,21 +619,21 @@ private int jjMoveNfa_2(int startState, 
                   break;
                case 2:
                   if ((0xfffffffbffffffffL & l) != 0L)
-                     jjCheckNAddStates(8, 10);
+                     jjCheckNAddStates(10, 12);
                   break;
                case 3:
                   if (curChar == 34)
-                     jjCheckNAddStates(8, 10);
+                     jjCheckNAddStates(10, 12);
                   break;
                case 5:
-                  if (curChar == 34 && kind > 26)
-                     kind = 26;
+                  if (curChar == 34 && kind > 32)
+                     kind = 32;
                   break;
                case 6:
                   if ((0xfffffffeffffffffL & l) == 0L)
                      break;
-                  if (kind > 27)
-                     kind = 27;
+                  if (kind > 33)
+                     kind = 33;
                   jjCheckNAdd(6);
                   break;
                default : break;
@@ -821,14 +649,14 @@ private int jjMoveNfa_2(int startState, 
             {
                case 0:
                case 6:
-                  if ((0xffffffffdfffffffL & l) == 0L)
+                  if ((0xdfffffffdfffffffL & l) == 0L)
                      break;
-                  if (kind > 27)
-                     kind = 27;
+                  if (kind > 33)
+                     kind = 33;
                   jjCheckNAdd(6);
                   break;
                case 2:
-                  jjAddStates(8, 10);
+                  jjAddStates(10, 12);
                   break;
                case 4:
                   if (curChar == 92)
@@ -857,20 +685,20 @@ private int jjMoveNfa_2(int startState, 
                   }
                   if (jjCanMove_1(hiByte, i1, i2, l1, l2))
                   {
-                     if (kind > 27)
-                        kind = 27;
+                     if (kind > 33)
+                        kind = 33;
                      jjCheckNAdd(6);
                   }
                   break;
                case 2:
                   if (jjCanMove_1(hiByte, i1, i2, l1, l2))
-                     jjAddStates(8, 10);
+                     jjAddStates(10, 12);
                   break;
                case 6:
                   if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
                      break;
-                  if (kind > 27)
-                     kind = 27;
+                  if (kind > 33)
+                     kind = 33;
                   jjCheckNAdd(6);
                   break;
                default : break;
@@ -891,7 +719,7 @@ private int jjMoveNfa_2(int startState, 
    }
 }
 static final int[] jjnextStates = {
-   15, 16, 18, 29, 31, 32, 25, 26, 2, 4, 5, 0, 1, 
+   15, 16, 18, 29, 31, 32, 25, 26, 0, 1, 2, 4, 5, 
 };
 private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
 {
@@ -933,24 +761,23 @@ private static final boolean jjCanMove_2
 /** Token literal values. */
 public static final String[] jjstrLiteralImages = {
 "", null, null, null, null, null, null, null, null, null, null, "\53", "\55", 
-"\50", "\51", "\72", "\136", null, null, null, null, "\133", "\173", null, 
-"\124\117", "\135", null, null, "\124\117", "\175", null, null, };
+"\50", "\51", "\72", "\75", "\74", "\74\75", "\76", "\76\75", "\136", null, null, 
+null, null, "\133", "\173", null, "\124\117", "\135", "\175", null, null, };
 
 /** Lexer state names. */
 public static final String[] lexStateNames = {
    "Boost",
-   "RangeEx",
-   "RangeIn",
+   "Range",
    "DEFAULT",
 };
 
 /** Lex State array. */
 public static final int[] jjnewLexState = {
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 2, 1, 3, -1, 
-   3, -1, -1, -1, 3, -1, -1, 
+   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 
+   -1, 1, 1, 2, -1, 2, 2, -1, -1, 
 };
 static final long[] jjtoToken = {
-   0xffffff01L, 
+   0x3ffffff01L, 
 };
 static final long[] jjtoSkip = {
    0x80L, 
@@ -998,7 +825,7 @@ public void ReInit(JavaCharStream stream
 /** Switch to specified lex state. */
 public void SwitchTo(int lexState)
 {
-   if (lexState >= 4 || lexState < 0)
+   if (lexState >= 3 || lexState < 0)
       throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
    else
       curLexState = lexState;
@@ -1028,8 +855,8 @@ protected Token jjFillToken()
    return t;
 }
 
-int curLexState = 3;
-int defaultLexState = 3;
+int curLexState = 2;
+int defaultLexState = 2;
 int jjnewStateCnt;
 int jjround;
 int jjmatchedPos;
@@ -1072,11 +899,6 @@ public Token getNextToken() 
        jjmatchedPos = 0;
        curPos = jjMoveStringLiteralDfa0_2();
        break;
-     case 3:
-       jjmatchedKind = 0x7fffffff;
-       jjmatchedPos = 0;
-       curPos = jjMoveStringLiteralDfa0_3();
-       break;
    }
      if (jjmatchedKind != 0x7fffffff)
      {

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java Mon Aug  1 18:57:05 2011
@@ -121,4 +121,4 @@ public class Token {
   }
 
 }
-/* JavaCC - OriginalChecksum=0aac6816ecd328eda2f38b9d09739ab6 (do not edit this line) */
+/* JavaCC - OriginalChecksum=e9c55091ec11152bcd3a300ddff5c73a (do not edit this line) */

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java Mon Aug  1 18:57:05 2011
@@ -138,4 +138,4 @@ public class TokenMgrError extends Error
       this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
    }
 }
-/* JavaCC - OriginalChecksum=a75b5b61664a73631a032a6e44f4b38a (do not edit this line) */
+/* JavaCC - OriginalChecksum=76b513fd9c50f65248056bbeeff49277 (do not edit this line) */

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/LowercaseExpandedTermsQueryNodeProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/LowercaseExpandedTermsQueryNodeProcessor.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/LowercaseExpandedTermsQueryNodeProcessor.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/LowercaseExpandedTermsQueryNodeProcessor.java Mon Aug  1 18:57:05 2011
@@ -67,7 +67,8 @@ public class LowercaseExpandedTermsQuery
         || node instanceof ParametricQueryNode || node instanceof RegexpQueryNode) {
 
       TextableQueryNode txtNode = (TextableQueryNode) node;
-      txtNode.setText(UnescapedCharSequence.toLowerCase(txtNode.getText()));
+      CharSequence text = txtNode.getText();
+      txtNode.setText(text != null ? UnescapedCharSequence.toLowerCase(text) : null);
     }
 
     return node;

Modified: lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java?rev=1152892&r1=1152891&r2=1152892&view=diff
==============================================================================
--- lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java (original)
+++ lucene/dev/trunk/modules/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/NumericQueryNodeProcessor.java Mon Aug  1 18:57:05 2011
@@ -29,6 +29,7 @@ import org.apache.lucene.queryparser.fle
 import org.apache.lucene.queryparser.flexible.core.messages.QueryParserMessages;
 import org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.ParametricQueryNode;
+import org.apache.lucene.queryparser.flexible.core.nodes.ParametricRangeQueryNode;
 import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
 import org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl;
 import org.apache.lucene.queryparser.flexible.standard.config.NumericConfig;
@@ -69,7 +70,7 @@ public class NumericQueryNodeProcessor e
   protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {
     
     if (node instanceof FieldQueryNode
-        && !(node instanceof ParametricQueryNode)) {
+        && !(node.getParent() instanceof ParametricRangeQueryNode)) {
       
       QueryConfigHandler config = getQueryConfigHandler();
       
@@ -85,30 +86,38 @@ public class NumericQueryNodeProcessor e
           if (numericConfig != null) {
             
             NumberFormat numberFormat = numericConfig.getNumberFormat();
-            Number number;
+            String text = fieldNode.getTextAsString();
+            Number number = null;
             
-            try {
-              number = numberFormat.parse(fieldNode.getTextAsString());
+            if (text.length() > 0) {
               
-            } catch (ParseException e) {
+              try {
+                number = numberFormat.parse(text);
+                
+              } catch (ParseException e) {
+                throw new QueryNodeParseException(new MessageImpl(
+                    QueryParserMessages.COULD_NOT_PARSE_NUMBER, fieldNode
+                        .getTextAsString(), numberFormat.getClass()
+                        .getCanonicalName()), e);
+              }
+              
+              switch (numericConfig.getType()) {
+                case LONG:
+                  number = number.longValue();
+                  break;
+                case INT:
+                  number = number.intValue();
+                  break;
+                case DOUBLE:
+                  number = number.doubleValue();
+                  break;
+                case FLOAT:
+                  number = number.floatValue();
+              }
+              
+            } else {
               throw new QueryNodeParseException(new MessageImpl(
-                  QueryParserMessages.COULD_NOT_PARSE_NUMBER, fieldNode
-                      .getTextAsString(), numberFormat.getClass()
-                      .getCanonicalName()), e);
-            }
-            
-            switch (numericConfig.getType()) {
-              case LONG:
-                number = number.longValue();
-                break;
-              case INT:
-                number = number.intValue();
-                break;
-              case DOUBLE:
-                number = number.doubleValue();
-                break;
-              case FLOAT:
-                number = number.floatValue();
+                  QueryParserMessages.NUMERIC_CANNOT_BE_EMPTY, fieldNode.getFieldAsString()));
             }
             
             NumericQueryNode lowerNode = new NumericQueryNode(fieldNode