Apache Solr open-source search software
fix broken javadocs (javacc bug) by regenerating with latest version, fix broken links in .javacc (reintroduced if you regenerate)
Robert Muir0d707bd8c732
diff --git a/lucene/common-build.xml b/lucene/common-build.xmlindex 83a018ca95c..6f638621c54 100644--- a/lucene/common-build.xml+++ b/lucene/common-build.xml@@ -400,17 +400,17 @@JavaCC not found.JavaCC Home: ${javacc.home}- Please download and install JavaCC 4.1 from:+ Please download and install JavaCC 5.0 from:<http://javacc.dev.java.net>Then, create a build.properties file either in your homedirectory, or within the Lucene directory and set the javacc.homeproperty to the path where JavaCC is installed. For example,- if you installed JavaCC in /usr/local/java/javacc-4.1, then set the+ if you installed JavaCC in /usr/local/java/javacc-5.0, then set thejavacc.home property to:- javacc.home=/usr/local/java/javacc-4.1+ javacc.home=/usr/local/java/javacc-5.0If you get an error like the one below, then you have not installedthings correctly. Please check all your paths and try again.diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/CharStream.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/CharStream.javaindex d5b80024580..2c5fcbabde5 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/CharStream.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/CharStream.java@@ -1,5 +1,5 @@-/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 4.1 */-/* JavaCCOptions:STATIC=false */+/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 5.0 */+/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */package org.apache.lucene.queryparser.classic;/**@@ -17,7 +17,8 @@ package org.apache.lucene.queryparser.classic;* operation.*/-public interface CharStream {+public+interface CharStream {/*** Returns the next character from the selected input. The method@@ -26,6 +27,7 @@ public interface CharStream {*/char readChar() throws java.io.IOException;+ @Deprecated/*** Returns the column position of the character last read.* @deprecated@@ -33,6 +35,7 @@ public interface CharStream {*/int getColumn();+ @Deprecated/*** Returns the line number of the character last read.* @deprecated@@ -109,4 +112,4 @@ public interface CharStream {void Done();}-/* JavaCC - OriginalChecksum=0790771f0d47abfd976f028fa2364b0f (do not edit this line) */+/* JavaCC - OriginalChecksum=30b94cad7b10d0d81e3a59a1083939d0 (do not edit this line) */diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/ParseException.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/ParseException.javaindex a452ac39b6a..7ba0d3c8ece 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/ParseException.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/ParseException.java@@ -1,4 +1,4 @@-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 4.1 */+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 *//* JavaCCOptions:KEEP_LINE_COL=null */package org.apache.lucene.queryparser.classic;@@ -13,25 +13,25 @@ package org.apache.lucene.queryparser.classic;*/public class ParseException extends Exception {+ /**+ * The version identifier for this Serializable class.+ * Increment only if the <i>serialized</i> form of the+ * class changes.+ */+ private static final long serialVersionUID = 1L;+/*** This constructor is used by the method "generateParseException"* in the generated parser. Calling this constructor generates* a new object of this type with the fields "currentToken",- * "expectedTokenSequences", and "tokenImage" set. The boolean- * flag "specialConstructor" is also set to true to indicate that- * this constructor was used to create this object.- * This constructor calls its super class with the empty string- * to force the "toString" method of parent class "Throwable" to- * print the error message in the form:- * ParseException: <result of getMessage>+ * "expectedTokenSequences", and "tokenImage" set.*/public ParseException(Token currentTokenVal,int[][] expectedTokenSequencesVal,String[] tokenImageVal){- super("");- specialConstructor = true;+ super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));currentToken = currentTokenVal;expectedTokenSequences = expectedTokenSequencesVal;tokenImage = tokenImageVal;@@ -49,33 +49,13 @@ public class ParseException extends Exception {public ParseException() {super();- specialConstructor = false;}/** Constructor with message. */public ParseException(String message) {super(message);- specialConstructor = false;- }-- /**- * Creates a new ParseException which is wrapping another Throwable with an- * additional message- *- * @param message Message for the Exception- * @param throwable Wrapped Throwable- */- public ParseException(String message, Throwable throwable) {- super(message, throwable);- specialConstructor = false;}- /**- * This variable determines which constructor was used to create- * this object and thereby affects the semantics of the- * "getMessage" method (see below).- */- protected boolean specialConstructor;/*** This is the last token that has been consumed successfully. If@@ -99,19 +79,16 @@ public class ParseException extends Exception {public String[] tokenImage;/**- * This method has the standard behavior when this object has been- * created using the standard constructors. Otherwise, it uses- * "currentToken" and "expectedTokenSequences" to generate a parse+ * It uses "currentToken" and "expectedTokenSequences" to generate a parse* error message and returns it. If this object has been created* due to a parse error, and you do not catch it (it gets thrown- * from the parser), then this method is called during the printing- * of the final stack trace, and hence the correct error message+ * from the parser) the correct error message* gets displayed.*/- public String getMessage() {- if (!specialConstructor) {- return super.getMessage();- }+ private static String initialise(Token currentToken,+ int[][] expectedTokenSequences,+ String[] tokenImage) {+ String eol = System.getProperty("line.separator", "\n");StringBuffer expected = new StringBuffer();int maxSize = 0;for (int i = 0; i < expectedTokenSequences.length; i++) {@@ -161,7 +138,7 @@ public class ParseException extends Exception {* when these raw version cannot be used as part of an ASCII* string literal.*/- protected String add_escapes(String str) {+ static String add_escapes(String str) {StringBuffer retval = new StringBuffer();char ch;for (int i = 0; i < str.length(); i++) {@@ -207,4 +184,4 @@ public class ParseException extends Exception {}}-/* JavaCC - OriginalChecksum=f669ffb14d5be55de6298772ac9befeb (do not edit this line) */+/* JavaCC - OriginalChecksum=b187d97d5bb75c3fc63d642c1c26ac6e (do not edit this line) */diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.javaindex 8180f153592..26bcfc546b9 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java@@ -44,8 +44,8 @@ import org.apache.lucene.util.Version;** <p>* Examples of appropriately formatted queries can be found in the <a- * href="{@docRoot}/org/apache/lucene/queryparser/classic/package-summary.html#package_description">- * query syntax documentation</a>+ * href="{@docRoot}/org/apache/lucene/queryparser/classic/package-summary.html#package_description">query syntax+ * documentation</a>.* </p>** <p>@@ -76,6 +76,14 @@ import org.apache.lucene.util.Version;* <p><b>NOTE</b>: there is a new QueryParser in contrib, which matches* the same syntax as this class, but is more modular,* enabling substantial customization to how a query is created.+ *+ * <a name="version"/>+ * <p><b>NOTE</b>: You must specify the required {@link Version}+ * compatibility when creating QueryParser:+ * <ul>+ * <li> As of 3.1, {@link #setAutoGeneratePhraseQueries} is false by+ * default.+ * </ul>*/public class QueryParser extends QueryParserBase implements QueryParserConstants {/** The default operator for parsing queries.@@ -84,7 +92,7 @@ public class QueryParser extends QueryParserBase implements QueryParserConstantsstatic public enum Operator { OR, AND }/** Create a query parser.- * @param matchVersion Lucene version to match.+ * @param matchVersion Lucene version to match. See <a href="#version">above</a>.* @param f the default field for query terms.* @param a used to find terms in the query text.*/@@ -632,7 +640,7 @@ public class QueryParser extends QueryParserBase implements QueryParserConstantsreturn (jj_ntk = jj_nt.kind);}- private java.util.List jj_expentries = new java.util.ArrayList();+ private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();private int[] jj_expentry;private int jj_kind = -1;private int[] jj_lasttokens = new int[100];@@ -647,7 +655,7 @@ public class QueryParser extends QueryParserBase implements QueryParserConstantsfor (int i = 0; i < jj_endpos; i++) {jj_expentry[i] = jj_lasttokens[i];}- jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) {+ jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {int[] oldentry = (int[])(it.next());if (oldentry.length == jj_expentry.length) {for (int i = 0; i < jj_expentry.length; i++) {@@ -695,7 +703,7 @@ public class QueryParser extends QueryParserBase implements QueryParserConstantsjj_add_error_token(0, 0);int[][] exptokseq = new int[jj_expentries.size()][];for (int i = 0; i < jj_expentries.size(); i++) {- exptokseq[i] = (int[])jj_expentries.get(i);+ exptokseq[i] = jj_expentries.get(i);}return new ParseException(token, exptokseq, tokenImage);}diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.jj b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.jjindex 6e214dde7e8..593262ba9e6 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.jj+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.jj@@ -68,7 +68,7 @@ import org.apache.lucene.util.Version;** <p>* Examples of appropriately formatted queries can be found in the <a- * href="../../../../../../queryparsersyntax.html">query syntax+ * href="{@docRoot}/org/apache/lucene/queryparser/classic/package-summary.html#package_description">query syntax* documentation</a>.* </p>*diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.javaindex 363de831074..79807cfa68b 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java@@ -482,7 +482,9 @@ public abstract class QueryParserBase implements CommonQueryParserConfigurationsource = analyzer.tokenStream(field, new StringReader(queryText));source.reset();} catch (IOException e) {- throw new ParseException("Unable to initialize TokenStream to analyze query text", e);+ ParseException p = new ParseException("Unable to initialize TokenStream to analyze query text");+ p.initCause(e);+ throw p;}CachingTokenFilter buffer = new CachingTokenFilter(source);TermToBytesRefAttribute termAtt = null;@@ -527,7 +529,9 @@ public abstract class QueryParserBase implements CommonQueryParserConfigurationsource.close();}catch (IOException e) {- throw new ParseException("Cannot close TokenStream analyzing query text", e);+ ParseException p = new ParseException("Cannot close TokenStream analyzing query text");+ p.initCause(e);+ throw p;}BytesRef bytes = termAtt == null ? null : termAtt.getBytesRef();diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/Token.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/Token.javaindex 2b47564fcc0..0e52ec21969 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/Token.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/Token.java@@ -1,12 +1,19 @@-/* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */-/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null */+/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */+/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */package org.apache.lucene.queryparser.classic;/*** Describes the input token stream.*/-public class Token {+public class Token implements java.io.Serializable {++ /**+ * The version identifier for this Serializable class.+ * Increment only if the <i>serialized</i> form of the+ * class changes.+ */+ private static final long serialVersionUID = 1L;/*** An integer that describes the kind of this token. This numbering@@ -75,7 +82,7 @@ public class Token {*/public Token(int kind){- this(kind, null);+ this(kind, null);}/**@@ -83,8 +90,8 @@ public class Token {*/public Token(int kind, String image){- this.kind = kind;- this.image = image;+ this.kind = kind;+ this.image = image;}/**@@ -92,7 +99,7 @@ public class Token {*/public String toString(){- return image;+ return image;}/**@@ -109,16 +116,16 @@ public class Token {*/public static Token newToken(int ofKind, String image){- switch(ofKind)- {- default : return new Token(ofKind, image);- }+ switch(ofKind)+ {+ default : return new Token(ofKind, image);+ }}public static Token newToken(int ofKind){- return newToken(ofKind, null);+ return newToken(ofKind, null);}}-/* JavaCC - OriginalChecksum=9f74ef8b727ef4e5dafb84a45b3584c9 (do not edit this line) */+/* JavaCC - OriginalChecksum=405bb5d2fcd84e94ac1c8f0b12c1f914 (do not edit this line) */diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/TokenMgrError.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/TokenMgrError.javaindex 7dad74792a0..51712a761fb 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/TokenMgrError.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/TokenMgrError.java@@ -1,141 +1,147 @@-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 4.1 */+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 *//* JavaCCOptions: */package org.apache.lucene.queryparser.classic;/** Token Manager Error. */-@SuppressWarnings("serial")public class TokenMgrError extends Error{- /*- * Ordinals for various reasons why an Error of this type can be thrown.- */+ /**+ * The version identifier for this Serializable class.+ * Increment only if the <i>serialized</i> form of the+ * class changes.+ */+ private static final long serialVersionUID = 1L;- /**- * Lexical error occurred.- */- static final int LEXICAL_ERROR = 0;+ /*+ * Ordinals for various reasons why an Error of this type can be thrown.+ */- /**- * An attempt was made to create a second instance of a static token manager.- */- static final int STATIC_LEXER_ERROR = 1;+ /**+ * Lexical error occurred.+ */+ static final int LEXICAL_ERROR = 0;- /**- * Tried to change to an invalid lexical state.- */- static final int INVALID_LEXICAL_STATE = 2;+ /**+ * An attempt was made to create a second instance of a static token manager.+ */+ static final int STATIC_LEXER_ERROR = 1;- /**- * Detected (and bailed out of) an infinite loop in the token manager.- */- static final int LOOP_DETECTED = 3;+ /**+ * Tried to change to an invalid lexical state.+ */+ static final int INVALID_LEXICAL_STATE = 2;- /**- * Indicates the reason why the exception is thrown. It will have- * one of the above 4 values.- */- int errorCode;+ /**+ * Detected (and bailed out of) an infinite loop in the token manager.+ */+ static final int LOOP_DETECTED = 3;- /**- * Replaces unprintable characters by their escaped (or unicode escaped)- * equivalents in the given string- */- protected static final String addEscapes(String str) {- StringBuffer retval = new StringBuffer();- char ch;- for (int i = 0; i < str.length(); i++) {- switch (str.charAt(i))- {- case 0 :- continue;- case '\b':- retval.append("\\b");- continue;- case '\t':- retval.append("\\t");- continue;- case '\n':- retval.append("\\n");- continue;- case '\f':- retval.append("\\f");- continue;- case '\r':- retval.append("\\r");- continue;- case '\"':- retval.append("\\\"");- continue;- case '\'':- retval.append("\\\'");- continue;- case '\\':- retval.append("\\\\");- continue;- default:- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {- String s = "0000" + Integer.toString(ch, 16);- retval.append("\\u" + s.substring(s.length() - 4, s.length()));- } else {- retval.append(ch);- }- continue;- }+ /**+ * Indicates the reason why the exception is thrown. It will have+ * one of the above 4 values.+ */+ int errorCode;++ /**+ * Replaces unprintable characters by their escaped (or unicode escaped)+ * equivalents in the given string+ */+ protected static final String addEscapes(String str) {+ StringBuffer retval = new StringBuffer();+ char ch;+ for (int i = 0; i < str.length(); i++) {+ switch (str.charAt(i))+ {+ case 0 :+ continue;+ case '\b':+ retval.append("\\b");+ continue;+ case '\t':+ retval.append("\\t");+ continue;+ case '\n':+ retval.append("\\n");+ continue;+ case '\f':+ retval.append("\\f");+ continue;+ case '\r':+ retval.append("\\r");+ continue;+ case '\"':+ retval.append("\\\"");+ continue;+ case '\'':+ retval.append("\\\'");+ continue;+ case '\\':+ retval.append("\\\\");+ continue;+ default:+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {+ String s = "0000" + Integer.toString(ch, 16);+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));+ } else {+ retval.append(ch);+ }+ continue;}- return retval.toString();- }+ }+ return retval.toString();+ }- /**- * Returns a detailed message for the Error when it is thrown by the- * token manager to indicate a lexical error.- * Parameters :- * EOFSeen : indicates if EOF caused the lexical error- * curLexState : lexical state in which this error occurred- * errorLine : line number when the error occurred- * errorColumn : column number when the error occurred- * errorAfter : prefix that was seen before this error occurred- * curchar : the offending character- * Note: You can customize the lexical error message by modifying this method.- */- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {- return("Lexical error at line " +- errorLine + ", column " +- errorColumn + ". Encountered: " +- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +- "after : \"" + addEscapes(errorAfter) + "\"");- }+ /**+ * Returns a detailed message for the Error when it is thrown by the+ * token manager to indicate a lexical error.+ * Parameters :+ * EOFSeen : indicates if EOF caused the lexical error+ * curLexState : lexical state in which this error occurred+ * errorLine : line number when the error occurred+ * errorColumn : column number when the error occurred+ * errorAfter : prefix that was seen before this error occurred+ * curchar : the offending character+ * Note: You can customize the lexical error message by modifying this method.+ */+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {+ return("Lexical error at line " ++ errorLine + ", column " ++ errorColumn + ". Encountered: " ++ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") ++ "after : \"" + addEscapes(errorAfter) + "\"");+ }- /**- * You can also modify the body of this method to customize your error messages.- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not- * of end-users concern, so you can return something like :- *- * "Internal Error : Please file a bug report .... "- *- * from this method for such cases in the release version of your parser.- */- public String getMessage() {- return super.getMessage();- }+ /**+ * You can also modify the body of this method to customize your error messages.+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not+ * of end-users concern, so you can return something like :+ *+ * "Internal Error : Please file a bug report .... "+ *+ * from this method for such cases in the release version of your parser.+ */+ public String getMessage() {+ return super.getMessage();+ }- /*- * Constructors of various flavors follow.- */+ /*+ * Constructors of various flavors follow.+ */- /** No arg constructor. */- public TokenMgrError() {- }+ /** No arg constructor. */+ public TokenMgrError() {+ }- /** Constructor with message and reason. */- public TokenMgrError(String message, int reason) {- super(message);- errorCode = reason;- }+ /** Constructor with message and reason. */+ public TokenMgrError(String message, int reason) {+ super(message);+ errorCode = reason;+ }- /** Full Constructor. */- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);- }+ /** Full Constructor. */+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);+ }}-/* JavaCC - OriginalChecksum=b55ad725f5fbc672fa115f498926930c (do not edit this line) */+/* JavaCC - OriginalChecksum=f433e1a52b8eadbf12f3fbbbf87fd140 (do not edit this line) */diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/CharStream.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/CharStream.javaindex 9447bdda6dc..15b8245acf3 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/CharStream.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/CharStream.java@@ -1,5 +1,5 @@-/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 4.1 */-/* JavaCCOptions:STATIC=false */+/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 5.0 */+/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */package org.apache.lucene.queryparser.flexible.standard.parser;/**@@ -17,7 +17,8 @@ package org.apache.lucene.queryparser.flexible.standard.parser;* operation.*/-public interface CharStream {+public+interface CharStream {/*** Returns the next character from the selected input. The method@@ -26,6 +27,7 @@ public interface CharStream {*/char readChar() throws java.io.IOException;+ @Deprecated/*** Returns the column position of the character last read.* @deprecated@@ -33,6 +35,7 @@ public interface CharStream {*/int getColumn();+ @Deprecated/*** Returns the line number of the character last read.* @deprecated@@ -109,4 +112,4 @@ public interface CharStream {void Done();}-/* JavaCC - OriginalChecksum=298ffb3c7c64c6de9b7812e011e58d99 (do not edit this line) */+/* JavaCC - OriginalChecksum=53b2ec7502d50e2290e86187a6c01270 (do not edit this line) */diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.javaindex 8b1badb939c..4d87b831d4f 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java@@ -1,4 +1,4 @@-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 4.1 */+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 *//* JavaCCOptions:KEEP_LINE_COL=null */package org.apache.lucene.queryparser.flexible.standard.parser;@@ -18,17 +18,18 @@ package org.apache.lucene.queryparser.flexible.standard.parser;*/public class ParseException extends QueryNodeParseException {+ /**+ * The version identifier for this Serializable class.+ * Increment only if the <i>serialized</i> form of the+ * class changes.+ */+ private static final long serialVersionUID = 1L;+/*** This constructor is used by the method "generateParseException"* in the generated parser. Calling this constructor generates* a new object of this type with the fields "currentToken",- * "expectedTokenSequences", and "tokenImage" set. The boolean- * flag "specialConstructor" is also set to true to indicate that- * this constructor was used to create this object.- * This constructor calls its super class with the empty string- * to force the "toString" method of parent class "Throwable" to- * print the error message in the form:- * ParseException: <result of getMessage>+ * "expectedTokenSequences", and "tokenImage" set.*/public ParseException(Token currentTokenVal,int[][] expectedTokenSequencesVal, String[] tokenImageVal) {@@ -58,12 +59,6 @@ public class ParseException extends QueryNodeParseException {super(message);}- /**- * This variable determines which constructor was used to create- * this object and thereby affects the semantics of the- * "getMessage" method (see below).- */- protected boolean specialConstructor;/*** This is the last token that has been consumed successfully. If@@ -87,17 +82,16 @@ public class ParseException extends QueryNodeParseException {public String[] tokenImage;/**- * This method has the standard behavior when this object has been- * created using the standard constructors. Otherwise, it uses- * "currentToken" and "expectedTokenSequences" to generate a parse+ * It uses "currentToken" and "expectedTokenSequences" to generate a parse* error message and returns it. If this object has been created* due to a parse error, and you do not catch it (it gets thrown- * from the parser), then this method is called during the printing- * of the final stack trace, and hence the correct error message+ * from the parser) the correct error message* gets displayed.*/- private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) {- String eol = System.getProperty("line.separator", "n");+ private static String initialise(Token currentToken,+ int[][] expectedTokenSequences,+ String[] tokenImage) {+ String eol = System.getProperty("line.separator", "\n");StringBuffer expected = new StringBuffer();int maxSize = 0;for (int i = 0; i < expectedTokenSequences.length; i++) {@@ -147,7 +141,7 @@ public class ParseException extends QueryNodeParseException {* when these raw version cannot be used as part of an ASCII* string literal.*/- static private String add_escapes(String str) {+ static String add_escapes(String str) {StringBuffer retval = new StringBuffer();char ch;for (int i = 0; i < str.length(); i++) {@@ -193,4 +187,4 @@ public class ParseException extends QueryNodeParseException {}}-/* JavaCC - OriginalChecksum=7601d49d11bc059457ae5850628ebc8a (do not edit this line) */+/* JavaCC - OriginalChecksum=4263a02db9988d7a863aa97ad2f6dc67 (do not edit this line) */diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.javaindex 21023e5b682..676d8a0141a 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java@@ -732,30 +732,6 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserCfinally { 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_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_3_2() {if (jj_scan_token(TERM)) return true;Token xsp;@@ -782,16 +758,6 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserCreturn 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_3_1() {if (jj_scan_token(TERM)) return true;Token xsp;@@ -803,8 +769,13 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserCreturn false;}- private boolean jj_3R_9() {- if (jj_scan_token(QUOTED)) return true;+ 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;}@@ -821,6 +792,11 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserCreturn false;}+ private boolean jj_3R_9() {+ if (jj_scan_token(QUOTED)) return true;+ return false;+ }+private boolean jj_3R_5() {Token xsp;xsp = jj_scanpos;@@ -845,6 +821,30 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserCreturn false;}+ 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_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;+ }+/** Generated Token Manager. */public StandardSyntaxParserTokenManager token_source;/** Current token. */@@ -986,7 +986,7 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserCreturn (jj_ntk = jj_nt.kind);}- private java.util.List jj_expentries = new java.util.ArrayList();+ private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();private int[] jj_expentry;private int jj_kind = -1;private int[] jj_lasttokens = new int[100];@@ -1001,7 +1001,7 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserCfor (int i = 0; i < jj_endpos; i++) {jj_expentry[i] = jj_lasttokens[i];}- jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) {+ jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {int[] oldentry = (int[])(it.next());if (oldentry.length == jj_expentry.length) {for (int i = 0; i < jj_expentry.length; i++) {@@ -1049,7 +1049,7 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserCjj_add_error_token(0, 0);int[][] exptokseq = new int[jj_expentries.size()][];for (int i = 0; i < jj_expentries.size(); i++) {- exptokseq[i] = (int[])jj_expentries.get(i);+ exptokseq[i] = jj_expentries.get(i);}return new ParseException(token, exptokseq, tokenImage);}diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.javaindex 95869f37545..95e66bbb28f 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java@@ -1,12 +1,19 @@-/* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */-/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null */+/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */+/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */package org.apache.lucene.queryparser.flexible.standard.parser;/*** Describes the input token stream.*/-public class Token {+public class Token implements java.io.Serializable {++ /**+ * The version identifier for this Serializable class.+ * Increment only if the <i>serialized</i> form of the+ * class changes.+ */+ private static final long serialVersionUID = 1L;/*** An integer that describes the kind of this token. This numbering@@ -75,7 +82,7 @@ public class Token {*/public Token(int kind){- this(kind, null);+ this(kind, null);}/**@@ -83,8 +90,8 @@ public class Token {*/public Token(int kind, String image){- this.kind = kind;- this.image = image;+ this.kind = kind;+ this.image = image;}/**@@ -92,7 +99,7 @@ public class Token {*/public String toString(){- return image;+ return image;}/**@@ -109,16 +116,16 @@ public class Token {*/public static Token newToken(int ofKind, String image){- switch(ofKind)- {- default : return new Token(ofKind, image);- }+ switch(ofKind)+ {+ default : return new Token(ofKind, image);+ }}public static Token newToken(int ofKind){- return newToken(ofKind, null);+ return newToken(ofKind, null);}}-/* JavaCC - OriginalChecksum=3b4fe6dcfcfa24a81f1c6ceffae5f73a (do not edit this line) */+/* JavaCC - OriginalChecksum=ea8b1e55950603be28e2f63dcd544ab4 (do not edit this line) */diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.javaindex 24647e18dd3..9207c0fa5b5 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java@@ -1,141 +1,147 @@-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 4.1 */+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 *//* JavaCCOptions: */package org.apache.lucene.queryparser.flexible.standard.parser;/** Token Manager Error. */-@SuppressWarnings("serial")public class TokenMgrError extends Error{- /*- * Ordinals for various reasons why an Error of this type can be thrown.- */+ /**+ * The version identifier for this Serializable class.+ * Increment only if the <i>serialized</i> form of the+ * class changes.+ */+ private static final long serialVersionUID = 1L;- /**- * Lexical error occurred.- */- static final int LEXICAL_ERROR = 0;+ /*+ * Ordinals for various reasons why an Error of this type can be thrown.+ */- /**- * An attempt was made to create a second instance of a static token manager.- */- static final int STATIC_LEXER_ERROR = 1;+ /**+ * Lexical error occurred.+ */+ static final int LEXICAL_ERROR = 0;- /**- * Tried to change to an invalid lexical state.- */- static final int INVALID_LEXICAL_STATE = 2;+ /**+ * An attempt was made to create a second instance of a static token manager.+ */+ static final int STATIC_LEXER_ERROR = 1;- /**- * Detected (and bailed out of) an infinite loop in the token manager.- */- static final int LOOP_DETECTED = 3;+ /**+ * Tried to change to an invalid lexical state.+ */+ static final int INVALID_LEXICAL_STATE = 2;- /**- * Indicates the reason why the exception is thrown. It will have- * one of the above 4 values.- */- int errorCode;+ /**+ * Detected (and bailed out of) an infinite loop in the token manager.+ */+ static final int LOOP_DETECTED = 3;- /**- * Replaces unprintable characters by their escaped (or unicode escaped)- * equivalents in the given string- */- protected static final String addEscapes(String str) {- StringBuffer retval = new StringBuffer();- char ch;- for (int i = 0; i < str.length(); i++) {- switch (str.charAt(i))- {- case 0 :- continue;- case '\b':- retval.append("\\b");- continue;- case '\t':- retval.append("\\t");- continue;- case '\n':- retval.append("\\n");- continue;- case '\f':- retval.append("\\f");- continue;- case '\r':- retval.append("\\r");- continue;- case '\"':- retval.append("\\\"");- continue;- case '\'':- retval.append("\\\'");- continue;- case '\\':- retval.append("\\\\");- continue;- default:- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {- String s = "0000" + Integer.toString(ch, 16);- retval.append("\\u" + s.substring(s.length() - 4, s.length()));- } else {- retval.append(ch);- }- continue;- }+ /**+ * Indicates the reason why the exception is thrown. It will have+ * one of the above 4 values.+ */+ int errorCode;++ /**+ * Replaces unprintable characters by their escaped (or unicode escaped)+ * equivalents in the given string+ */+ protected static final String addEscapes(String str) {+ StringBuffer retval = new StringBuffer();+ char ch;+ for (int i = 0; i < str.length(); i++) {+ switch (str.charAt(i))+ {+ case 0 :+ continue;+ case '\b':+ retval.append("\\b");+ continue;+ case '\t':+ retval.append("\\t");+ continue;+ case '\n':+ retval.append("\\n");+ continue;+ case '\f':+ retval.append("\\f");+ continue;+ case '\r':+ retval.append("\\r");+ continue;+ case '\"':+ retval.append("\\\"");+ continue;+ case '\'':+ retval.append("\\\'");+ continue;+ case '\\':+ retval.append("\\\\");+ continue;+ default:+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {+ String s = "0000" + Integer.toString(ch, 16);+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));+ } else {+ retval.append(ch);+ }+ continue;}- return retval.toString();- }+ }+ return retval.toString();+ }- /**- * Returns a detailed message for the Error when it is thrown by the- * token manager to indicate a lexical error.- * Parameters :- * EOFSeen : indicates if EOF caused the lexical error- * curLexState : lexical state in which this error occurred- * errorLine : line number when the error occurred- * errorColumn : column number when the error occurred- * errorAfter : prefix that was seen before this error occurred- * curchar : the offending character- * Note: You can customize the lexical error message by modifying this method.- */- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {- return("Lexical error at line " +- errorLine + ", column " +- errorColumn + ". Encountered: " +- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +- "after : \"" + addEscapes(errorAfter) + "\"");- }+ /**+ * Returns a detailed message for the Error when it is thrown by the+ * token manager to indicate a lexical error.+ * Parameters :+ * EOFSeen : indicates if EOF caused the lexical error+ * curLexState : lexical state in which this error occurred+ * errorLine : line number when the error occurred+ * errorColumn : column number when the error occurred+ * errorAfter : prefix that was seen before this error occurred+ * curchar : the offending character+ * Note: You can customize the lexical error message by modifying this method.+ */+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {+ return("Lexical error at line " ++ errorLine + ", column " ++ errorColumn + ". Encountered: " ++ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") ++ "after : \"" + addEscapes(errorAfter) + "\"");+ }- /**- * You can also modify the body of this method to customize your error messages.- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not- * of end-users concern, so you can return something like :- *- * "Internal Error : Please file a bug report .... "- *- * from this method for such cases in the release version of your parser.- */- public String getMessage() {- return super.getMessage();- }+ /**+ * You can also modify the body of this method to customize your error messages.+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not+ * of end-users concern, so you can return something like :+ *+ * "Internal Error : Please file a bug report .... "+ *+ * from this method for such cases in the release version of your parser.+ */+ public String getMessage() {+ return super.getMessage();+ }- /*- * Constructors of various flavors follow.- */+ /*+ * Constructors of various flavors follow.+ */- /** No arg constructor. */- public TokenMgrError() {- }+ /** No arg constructor. */+ public TokenMgrError() {+ }- /** Constructor with message and reason. */- public TokenMgrError(String message, int reason) {- super(message);- errorCode = reason;- }+ /** Constructor with message and reason. */+ public TokenMgrError(String message, int reason) {+ super(message);+ errorCode = reason;+ }- /** Full Constructor. */- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);- }+ /** Full Constructor. */+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);+ }}-/* JavaCC - OriginalChecksum=1efb3d906925f2478637c66473b79bae (do not edit this line) */+/* JavaCC - OriginalChecksum=be88283d82a985d82a34dda46bcf42d5 (do not edit this line) */diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/CharStream.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/CharStream.javaindex ede87387de8..31f3ad7950e 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/CharStream.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/CharStream.java@@ -1,5 +1,5 @@-/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 4.1 */-/* JavaCCOptions:STATIC=false */+/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 5.0 */+/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */package org.apache.lucene.queryparser.surround.parser;/**@@ -17,7 +17,8 @@ package org.apache.lucene.queryparser.surround.parser;* operation.*/-public interface CharStream {+public+interface CharStream {/*** Returns the next character from the selected input. The method@@ -26,6 +27,7 @@ public interface CharStream {*/char readChar() throws java.io.IOException;+ @Deprecated/*** Returns the column position of the character last read.* @deprecated@@ -33,6 +35,7 @@ public interface CharStream {*/int getColumn();+ @Deprecated/*** Returns the line number of the character last read.* @deprecated@@ -109,4 +112,4 @@ public interface CharStream {void Done();}-/* JavaCC - OriginalChecksum=def574f5a8956cf01b79ebe7bce95e74 (do not edit this line) */+/* JavaCC - OriginalChecksum=242ae59b965491e225a44534cbc73b42 (do not edit this line) */diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/ParseException.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/ParseException.javaindex 263a758ae9a..a163111401c 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/ParseException.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/ParseException.java@@ -1,4 +1,4 @@-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 4.1 */+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 *//* JavaCCOptions:KEEP_LINE_COL=null */package org.apache.lucene.queryparser.surround.parser;@@ -13,25 +13,25 @@ package org.apache.lucene.queryparser.surround.parser;*/public class ParseException extends Exception {+ /**+ * The version identifier for this Serializable class.+ * Increment only if the <i>serialized</i> form of the+ * class changes.+ */+ private static final long serialVersionUID = 1L;+/*** This constructor is used by the method "generateParseException"* in the generated parser. Calling this constructor generates* a new object of this type with the fields "currentToken",- * "expectedTokenSequences", and "tokenImage" set. The boolean- * flag "specialConstructor" is also set to true to indicate that- * this constructor was used to create this object.- * This constructor calls its super class with the empty string- * to force the "toString" method of parent class "Throwable" to- * print the error message in the form:- * ParseException: <result of getMessage>+ * "expectedTokenSequences", and "tokenImage" set.*/public ParseException(Token currentTokenVal,int[][] expectedTokenSequencesVal,String[] tokenImageVal){- super("");- specialConstructor = true;+ super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));currentToken = currentTokenVal;expectedTokenSequences = expectedTokenSequencesVal;tokenImage = tokenImageVal;@@ -49,21 +49,13 @@ public class ParseException extends Exception {public ParseException() {super();- specialConstructor = false;}/** Constructor with message. */public ParseException(String message) {super(message);- specialConstructor = false;}- /**- * This variable determines which constructor was used to create- * this object and thereby affects the semantics of the- * "getMessage" method (see below).- */- protected boolean specialConstructor;/*** This is the last token that has been consumed successfully. If@@ -87,19 +79,16 @@ public class ParseException extends Exception {public String[] tokenImage;/**- * This method has the standard behavior when this object has been- * created using the standard constructors. Otherwise, it uses- * "currentToken" and "expectedTokenSequences" to generate a parse+ * It uses "currentToken" and "expectedTokenSequences" to generate a parse* error message and returns it. If this object has been created* due to a parse error, and you do not catch it (it gets thrown- * from the parser), then this method is called during the printing- * of the final stack trace, and hence the correct error message+ * from the parser) the correct error message* gets displayed.*/- public String getMessage() {- if (!specialConstructor) {- return super.getMessage();- }+ private static String initialise(Token currentToken,+ int[][] expectedTokenSequences,+ String[] tokenImage) {+ String eol = System.getProperty("line.separator", "\n");StringBuffer expected = new StringBuffer();int maxSize = 0;for (int i = 0; i < expectedTokenSequences.length; i++) {@@ -149,7 +138,7 @@ public class ParseException extends Exception {* when these raw version cannot be used as part of an ASCII* string literal.*/- protected String add_escapes(String str) {+ static String add_escapes(String str) {StringBuffer retval = new StringBuffer();char ch;for (int i = 0; i < str.length(); i++) {@@ -195,4 +184,4 @@ public class ParseException extends Exception {}}-/* JavaCC - OriginalChecksum=10f9a58db50336511327c43cc760ac21 (do not edit this line) */+/* JavaCC - OriginalChecksum=bd8163f41bf2fd1bb00f025fce3dcaaf (do not edit this line) */diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.javaindex 071cc06629b..29ddce5174a 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java@@ -52,7 +52,7 @@ public class QueryParser implements QueryParserConstants {/* CHECKME: These should be the same as for the tokenizer. How? */final char truncator = '*';final char anyChar = '?';- final char quote = '\"';+ final char quote = '\u005c"';final char fieldOperator = ':';final char comma = ','; /* prefix list separator */final char carat = '^'; /* weight operator */@@ -644,7 +644,7 @@ public class QueryParser implements QueryParserConstants {return (jj_ntk = jj_nt.kind);}- private java.util.List jj_expentries = new java.util.ArrayList();+ private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();private int[] jj_expentry;private int jj_kind = -1;private int[] jj_lasttokens = new int[100];@@ -659,7 +659,7 @@ public class QueryParser implements QueryParserConstants {for (int i = 0; i < jj_endpos; i++) {jj_expentry[i] = jj_lasttokens[i];}- jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) {+ jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {int[] oldentry = (int[])(it.next());if (oldentry.length == jj_expentry.length) {for (int i = 0; i < jj_expentry.length; i++) {@@ -704,7 +704,7 @@ public class QueryParser implements QueryParserConstants {jj_add_error_token(0, 0);int[][] exptokseq = new int[jj_expentries.size()][];for (int i = 0; i < jj_expentries.size(); i++) {- exptokseq[i] = (int[])jj_expentries.get(i);+ exptokseq[i] = jj_expentries.get(i);}return new ParseException(token, exptokseq, tokenImage);}diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/Token.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/Token.javaindex 4b59fbd556d..d6736f8a01e 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/Token.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/Token.java@@ -1,12 +1,19 @@-/* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */-/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null */+/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */+/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */package org.apache.lucene.queryparser.surround.parser;/*** Describes the input token stream.*/-public class Token {+public class Token implements java.io.Serializable {++ /**+ * The version identifier for this Serializable class.+ * Increment only if the <i>serialized</i> form of the+ * class changes.+ */+ private static final long serialVersionUID = 1L;/*** An integer that describes the kind of this token. This numbering@@ -75,7 +82,7 @@ public class Token {*/public Token(int kind){- this(kind, null);+ this(kind, null);}/**@@ -83,8 +90,8 @@ public class Token {*/public Token(int kind, String image){- this.kind = kind;- this.image = image;+ this.kind = kind;+ this.image = image;}/**@@ -92,7 +99,7 @@ public class Token {*/public String toString(){- return image;+ return image;}/**@@ -109,16 +116,16 @@ public class Token {*/public static Token newToken(int ofKind, String image){- switch(ofKind)- {- default : return new Token(ofKind, image);- }+ switch(ofKind)+ {+ default : return new Token(ofKind, image);+ }}public static Token newToken(int ofKind){- return newToken(ofKind, null);+ return newToken(ofKind, null);}}-/* JavaCC - OriginalChecksum=072a7ad2709e5810f5c35fa113fa0c8b (do not edit this line) */+/* JavaCC - OriginalChecksum=f2df701e24da1cf2d025118ce6efdd2f (do not edit this line) */diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/TokenMgrError.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/TokenMgrError.javaindex d5490254b1d..c79fc217f53 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/TokenMgrError.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/TokenMgrError.java@@ -1,141 +1,147 @@-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 4.1 */+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 *//* JavaCCOptions: */package org.apache.lucene.queryparser.surround.parser;/** Token Manager Error. */-@SuppressWarnings("serial")public class TokenMgrError extends Error{- /*- * Ordinals for various reasons why an Error of this type can be thrown.- */+ /**+ * The version identifier for this Serializable class.+ * Increment only if the <i>serialized</i> form of the+ * class changes.+ */+ private static final long serialVersionUID = 1L;- /**- * Lexical error occurred.- */- static final int LEXICAL_ERROR = 0;+ /*+ * Ordinals for various reasons why an Error of this type can be thrown.+ */- /**- * An attempt was made to create a second instance of a static token manager.- */- static final int STATIC_LEXER_ERROR = 1;+ /**+ * Lexical error occurred.+ */+ static final int LEXICAL_ERROR = 0;- /**- * Tried to change to an invalid lexical state.- */- static final int INVALID_LEXICAL_STATE = 2;+ /**+ * An attempt was made to create a second instance of a static token manager.+ */+ static final int STATIC_LEXER_ERROR = 1;- /**- * Detected (and bailed out of) an infinite loop in the token manager.- */- static final int LOOP_DETECTED = 3;+ /**+ * Tried to change to an invalid lexical state.+ */+ static final int INVALID_LEXICAL_STATE = 2;- /**- * Indicates the reason why the exception is thrown. It will have- * one of the above 4 values.- */- int errorCode;+ /**+ * Detected (and bailed out of) an infinite loop in the token manager.+ */+ static final int LOOP_DETECTED = 3;- /**- * Replaces unprintable characters by their escaped (or unicode escaped)- * equivalents in the given string- */- protected static final String addEscapes(String str) {- StringBuffer retval = new StringBuffer();- char ch;- for (int i = 0; i < str.length(); i++) {- switch (str.charAt(i))- {- case 0 :- continue;- case '\b':- retval.append("\\b");- continue;- case '\t':- retval.append("\\t");- continue;- case '\n':- retval.append("\\n");- continue;- case '\f':- retval.append("\\f");- continue;- case '\r':- retval.append("\\r");- continue;- case '\"':- retval.append("\\\"");- continue;- case '\'':- retval.append("\\\'");- continue;- case '\\':- retval.append("\\\\");- continue;- default:- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {- String s = "0000" + Integer.toString(ch, 16);- retval.append("\\u" + s.substring(s.length() - 4, s.length()));- } else {- retval.append(ch);- }- continue;- }+ /**+ * Indicates the reason why the exception is thrown. It will have+ * one of the above 4 values.+ */+ int errorCode;++ /**+ * Replaces unprintable characters by their escaped (or unicode escaped)+ * equivalents in the given string+ */+ protected static final String addEscapes(String str) {+ StringBuffer retval = new StringBuffer();+ char ch;+ for (int i = 0; i < str.length(); i++) {+ switch (str.charAt(i))+ {+ case 0 :+ continue;+ case '\b':+ retval.append("\\b");+ continue;+ case '\t':+ retval.append("\\t");+ continue;+ case '\n':+ retval.append("\\n");+ continue;+ case '\f':+ retval.append("\\f");+ continue;+ case '\r':+ retval.append("\\r");+ continue;+ case '\"':+ retval.append("\\\"");+ continue;+ case '\'':+ retval.append("\\\'");+ continue;+ case '\\':+ retval.append("\\\\");+ continue;+ default:+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {+ String s = "0000" + Integer.toString(ch, 16);+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));+ } else {+ retval.append(ch);+ }+ continue;}- return retval.toString();- }+ }+ return retval.toString();+ }- /**- * Returns a detailed message for the Error when it is thrown by the- * token manager to indicate a lexical error.- * Parameters :- * EOFSeen : indicates if EOF caused the lexical error- * curLexState : lexical state in which this error occurred- * errorLine : line number when the error occurred- * errorColumn : column number when the error occurred- * errorAfter : prefix that was seen before this error occurred- * curchar : the offending character- * Note: You can customize the lexical error message by modifying this method.- */- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {- return("Lexical error at line " +- errorLine + ", column " +- errorColumn + ". Encountered: " +- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +- "after : \"" + addEscapes(errorAfter) + "\"");- }+ /**+ * Returns a detailed message for the Error when it is thrown by the+ * token manager to indicate a lexical error.+ * Parameters :+ * EOFSeen : indicates if EOF caused the lexical error+ * curLexState : lexical state in which this error occurred+ * errorLine : line number when the error occurred+ * errorColumn : column number when the error occurred+ * errorAfter : prefix that was seen before this error occurred+ * curchar : the offending character+ * Note: You can customize the lexical error message by modifying this method.+ */+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {+ return("Lexical error at line " ++ errorLine + ", column " ++ errorColumn + ". Encountered: " ++ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") ++ "after : \"" + addEscapes(errorAfter) + "\"");+ }- /**- * You can also modify the body of this method to customize your error messages.- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not- * of end-users concern, so you can return something like :- *- * "Internal Error : Please file a bug report .... "- *- * from this method for such cases in the release version of your parser.- */- public String getMessage() {- return super.getMessage();- }+ /**+ * You can also modify the body of this method to customize your error messages.+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not+ * of end-users concern, so you can return something like :+ *+ * "Internal Error : Please file a bug report .... "+ *+ * from this method for such cases in the release version of your parser.+ */+ public String getMessage() {+ return super.getMessage();+ }- /*- * Constructors of various flavors follow.- */+ /*+ * Constructors of various flavors follow.+ */- /** No arg constructor. */- public TokenMgrError() {- }+ /** No arg constructor. */+ public TokenMgrError() {+ }- /** Constructor with message and reason. */- public TokenMgrError(String message, int reason) {- super(message);- errorCode = reason;- }+ /** Constructor with message and reason. */+ public TokenMgrError(String message, int reason) {+ super(message);+ errorCode = reason;+ }- /** Full Constructor. */- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);- }+ /** Full Constructor. */+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);+ }}-/* JavaCC - OriginalChecksum=9cfe06f5ffcaac4b72c928c9ced2f5e7 (do not edit this line) */+/* JavaCC - OriginalChecksum=8c69a370d9a9893140562c8bb911678c (do not edit this line) */