You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2012/08/31 00:43:59 UTC
svn commit: r1379200 [8/11] - in /lucene/dev/branches/lucene3312: ./
dev-tools/ dev-tools/eclipse/ dev-tools/idea/.idea/libraries/
dev-tools/maven/ dev-tools/maven/lucene/core/
dev-tools/maven/lucene/test-framework/ dev-tools/scripts/ lucene/
lucene/an...
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/build.xml?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/build.xml (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/build.xml Thu Aug 30 22:43:41 2012
@@ -39,15 +39,10 @@
</invoke-module-javadoc>
</target>
- <target name="javacc" depends="init,javacc-check,javacc-QueryParser,javacc-surround,javacc-flexible"/>
-
- <target name="javacc-QueryParser" depends="init,javacc-check" if="javacc.present">
+ <target name="javacc" depends="javacc-QueryParser,javacc-surround,javacc-flexible"/>
+
+ <target name="javacc-QueryParser" depends="resolve-javacc">
<sequential>
- <delete>
- <fileset dir="src/java/org/apache/lucene/queryparser/classic" includes="*.java">
- <containsregexp expression="Generated.*By.*JavaCC"/>
- </fileset>
- </delete>
<invoke-javacc target="src/java/org/apache/lucene/queryparser/classic/QueryParser.jj"
outputDir="src/java/org/apache/lucene/queryparser/classic"/>
@@ -64,23 +59,13 @@
</sequential>
</target>
- <target name="javacc-surround" depends="javacc-check" description="generate surround query parser from jj (requires javacc 4.1">
- <delete>
- <fileset dir="src/java/org/apache/lucene/queryparser/surround/parser" includes="*.java">
- <containsregexp expression="Generated.*By.*JavaCC"/>
- </fileset>
- </delete>
+ <target name="javacc-surround" depends="resolve-javacc" description="generate surround query parser">
<invoke-javacc target="src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.jj"
outputDir="src/java/org/apache/lucene/queryparser/surround/parser"
/>
</target>
- <target name="javacc-flexible" depends="javacc-check">
- <delete>
- <fileset dir="src/java/org/apache/lucene/queryparser/flexible/standard/parser" includes="*.java">
- <containsregexp expression="Generated.*By.*JavaCC"/>
- </fileset>
- </delete>
+ <target name="javacc-flexible" depends="resolve-javacc">
<invoke-javacc target="src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj"
outputDir="src/java/org/apache/lucene/queryparser/flexible/standard/parser"
/>
@@ -138,4 +123,33 @@ import org.apache.lucene.queryparser.fle
byline="true"/>
</target>
+ <target name="resolve-javacc" xmlns:ivy="antlib:org.apache.ivy.ant">
+ <!-- setup a "fake" JavaCC distribution folder in ${build.dir} to make JavaCC ANT task happy: -->
+ <ivy:retrieve organisation="net.java.dev.javacc" module="javacc" revision="5.0"
+ inline="true" conf="default" transitive="false" type="jar" sync="true"
+ pattern="${build.dir}/javacc/bin/lib/[artifact].[ext]"/>
+ </target>
+
+ <macrodef name="invoke-javacc">
+ <attribute name="target"/>
+ <attribute name="outputDir"/>
+ <sequential>
+ <mkdir dir="@{outputDir}"/>
+ <delete>
+ <fileset dir="@{outputDir}" includes="*.java">
+ <containsregexp expression="Generated.*By.*JavaCC"/>
+ </fileset>
+ </delete>
+ <javacc
+ target="@{target}"
+ outputDirectory="@{outputDir}"
+ javacchome="${build.dir}/javacc"
+ jdkversion="${javac.source}"
+ />
+ <fixcrlf srcdir="@{outputDir}" includes="*.java" encoding="UTF-8">
+ <containsregexp expression="Generated.*By.*JavaCC"/>
+ </fixcrlf>
+ </sequential>
+ </macrodef>
+
</project>
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/CharStream.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/CharStream.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/CharStream.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/CharStream.java Thu Aug 30 22:43:41 2012
@@ -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.cl
* 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) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/ParseException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/ParseException.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/ParseException.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/ParseException.java Thu Aug 30 22:43:41 2012
@@ -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;
@@ -14,24 +14,24 @@ package org.apache.lucene.queryparser.cl
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 Exce
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 Exce
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 Exce
* 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 Exce
}
}
-/* JavaCC - OriginalChecksum=f669ffb14d5be55de6298772ac9befeb (do not edit this line) */
+/* JavaCC - OriginalChecksum=b187d97d5bb75c3fc63d642c1c26ac6e (do not edit this line) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java Thu Aug 30 22:43:41 2012
@@ -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 QueryPa
static 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 QueryPa
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];
@@ -647,7 +655,7 @@ public class QueryParser extends QueryPa
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++) {
@@ -695,7 +703,7 @@ public class QueryParser extends QueryPa
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);
}
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.jj
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.jj?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.jj (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.jj Thu Aug 30 22:43:41 2012
@@ -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>
*
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java Thu Aug 30 22:43:41 2012
@@ -482,7 +482,9 @@ public abstract class QueryParserBase im
source = 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 im
source.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();
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/Token.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/Token.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/Token.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/Token.java Thu Aug 30 22:43:41 2012
@@ -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) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/TokenMgrError.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/TokenMgrError.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/TokenMgrError.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/TokenMgrError.java Thu Aug 30 22:43:41 2012
@@ -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.
- */
-
- /**
- * Lexical error occurred.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt was made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * 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;
- }
+ /**
+ * 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;
+
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occurred.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt was made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * 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();
- }
-
- /**
- * 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();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- /** No arg constructor. */
- public TokenMgrError() {
- }
-
- /** 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);
- }
+ }
+ 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) + "\"");
+ }
+
+ /**
+ * 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.
+ */
+
+ /** No arg constructor. */
+ public TokenMgrError() {
+ }
+
+ /** 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);
+ }
}
-/* JavaCC - OriginalChecksum=b55ad725f5fbc672fa115f498926930c (do not edit this line) */
+/* JavaCC - OriginalChecksum=f433e1a52b8eadbf12f3fbbbf87fd140 (do not edit this line) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/QueryNodeParseException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/QueryNodeParseException.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/QueryNodeParseException.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/QueryNodeParseException.java Thu Aug 30 22:43:41 2012
@@ -80,7 +80,7 @@ public class QueryNodeParseException ext
}
/**
- * For EndOfLine and EndOfFile ("<EOF>") parsing problems the last char in the
+ * For EndOfLine and EndOfFile ("<EOF>") parsing problems the last char in the
* string is returned For the case where the parser is not able to figure out
* the line and column number -1 will be returned
*
@@ -91,7 +91,7 @@ public class QueryNodeParseException ext
}
/**
- * For EndOfLine and EndOfFile ("<EOF>") parsing problems the last char in the
+ * For EndOfLine and EndOfFile ("<EOF>") parsing problems the last char in the
* string is returned For the case where the parser is not able to figure out
* the line and column number -1 will be returned
*
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/config/AbstractQueryConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/config/AbstractQueryConfig.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/config/AbstractQueryConfig.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/config/AbstractQueryConfig.java Thu Aug 30 22:43:41 2012
@@ -62,7 +62,7 @@ public abstract class AbstractQueryConfi
/**
* Returns true if there is a value set with the given key, otherwise false.
*
- * @param <T> @param <T> the value's type
+ * @param <T> the value's type
* @param key the key, cannot be <code>null</code>
* @return true if there is a value set with the given key, otherwise false
*/
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/QueryNodeImpl.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/QueryNodeImpl.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/QueryNodeImpl.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/QueryNodeImpl.java Thu Aug 30 22:43:41 2012
@@ -211,7 +211,7 @@ public abstract class QueryNodeImpl impl
/**
* Every implementation of this class should return pseudo xml like this:
*
- * For FieldQueryNode: <field start='1' end='2' field='subject' text='foo'/>
+ * For FieldQueryNode: <field start='1' end='2' field='subject' text='foo'/>
*
* @see org.apache.lucene.queryparser.flexible.core.nodes.QueryNode#toString()
*/
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/CharStream.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/CharStream.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/CharStream.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/CharStream.java Thu Aug 30 22:43:41 2012
@@ -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.fl
* 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) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java Thu Aug 30 22:43:41 2012
@@ -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;
@@ -19,16 +19,17 @@ package org.apache.lucene.queryparser.fl
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 Quer
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 Quer
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 Quer
* 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 Quer
}
}
-/* JavaCC - OriginalChecksum=7601d49d11bc059457ae5850628ebc8a (do not edit this line) */
+/* JavaCC - OriginalChecksum=4263a02db9988d7a863aa97ad2f6dc67 (do not edit this line) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java Thu Aug 30 22:43:41 2012
@@ -732,30 +732,6 @@ public class StandardSyntaxParser implem
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_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 implem
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_3_1() {
if (jj_scan_token(TERM)) return true;
Token xsp;
@@ -803,8 +769,13 @@ public class StandardSyntaxParser implem
return 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 implem
return 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 implem
return 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 implem
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];
@@ -1001,7 +1001,7 @@ public class StandardSyntaxParser implem
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++) {
@@ -1049,7 +1049,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] = (int[])jj_expentries.get(i);
+ exptokseq[i] = jj_expentries.get(i);
}
return new ParseException(token, exptokseq, tokenImage);
}
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/Token.java Thu Aug 30 22:43:41 2012
@@ -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) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/TokenMgrError.java Thu Aug 30 22:43:41 2012
@@ -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.
- */
-
- /**
- * Lexical error occurred.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt was made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * 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;
- }
+ /**
+ * 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;
+
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occurred.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt was made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * 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();
- }
-
- /**
- * 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();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- /** No arg constructor. */
- public TokenMgrError() {
- }
-
- /** 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);
- }
+ }
+ 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) + "\"");
+ }
+
+ /**
+ * 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.
+ */
+
+ /** No arg constructor. */
+ public TokenMgrError() {
+ }
+
+ /** 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);
+ }
}
-/* JavaCC - OriginalChecksum=1efb3d906925f2478637c66473b79bae (do not edit this line) */
+/* JavaCC - OriginalChecksum=be88283d82a985d82a34dda46bcf42d5 (do not edit this line) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/CharStream.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/CharStream.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/CharStream.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/CharStream.java Thu Aug 30 22:43:41 2012
@@ -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.su
* 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) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/ParseException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/ParseException.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/ParseException.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/ParseException.java Thu Aug 30 22:43:41 2012
@@ -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;
@@ -14,24 +14,24 @@ package org.apache.lucene.queryparser.su
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 Exce
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 Exce
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 Exce
* 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 Exce
}
}
-/* JavaCC - OriginalChecksum=10f9a58db50336511327c43cc760ac21 (do not edit this line) */
+/* JavaCC - OriginalChecksum=bd8163f41bf2fd1bb00f025fce3dcaaf (do not edit this line) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java Thu Aug 30 22:43:41 2012
@@ -52,7 +52,7 @@ public class QueryParser implements Quer
/* 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 Quer
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 Quer
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 Quer
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);
}
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/Token.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/Token.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/Token.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/Token.java Thu Aug 30 22:43:41 2012
@@ -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) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/TokenMgrError.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/TokenMgrError.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/TokenMgrError.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/TokenMgrError.java Thu Aug 30 22:43:41 2012
@@ -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.
- */
-
- /**
- * Lexical error occurred.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt was made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * 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;
- }
+ /**
+ * 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;
+
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occurred.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt was made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * 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();
- }
-
- /**
- * 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();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- /** No arg constructor. */
- public TokenMgrError() {
- }
-
- /** 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);
- }
+ }
+ 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) + "\"");
+ }
+
+ /**
+ * 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.
+ */
+
+ /** No arg constructor. */
+ public TokenMgrError() {
+ }
+
+ /** 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);
+ }
}
-/* JavaCC - OriginalChecksum=9cfe06f5ffcaac4b72c928c9ced2f5e7 (do not edit this line) */
+/* JavaCC - OriginalChecksum=8c69a370d9a9893140562c8bb911678c (do not edit this line) */
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/DistanceSubQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/DistanceSubQuery.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/DistanceSubQuery.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/DistanceSubQuery.java Thu Aug 30 22:43:41 2012
@@ -18,6 +18,10 @@ package org.apache.lucene.queryparser.su
import java.io.IOException;
+/**
+ * Interface for queries that can be nested as subqueries
+ * into a span near.
+ */
public interface DistanceSubQuery {
/** When distanceSubQueryNotAllowed() returns non null, the reason why the subquery
* is not allowed as a distance subquery is returned.
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/FieldsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/FieldsQuery.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/FieldsQuery.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/FieldsQuery.java Thu Aug 30 22:43:41 2012
@@ -22,6 +22,9 @@ import java.util.Iterator;
import org.apache.lucene.search.Query;
+/**
+ * Forms an OR query of the provided query across multiple fields.
+ */
public class FieldsQuery extends SrndQuery { /* mostly untested */
private SrndQuery q;
private List<String> fieldNames;
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/NotQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/NotQuery.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/NotQuery.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/NotQuery.java Thu Aug 30 22:43:41 2012
@@ -21,6 +21,9 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.BooleanClause;
+/**
+ * Factory for prohibited clauses
+ */
public class NotQuery extends ComposedQuery {
public NotQuery(List<SrndQuery> queries, String opName) { super(queries, true /* infix */, opName); }
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SimpleTerm.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SimpleTerm.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SimpleTerm.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SimpleTerm.java Thu Aug 30 22:43:41 2012
@@ -22,6 +22,9 @@ import org.apache.lucene.index.IndexRead
import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query;
+/**
+ * Base class for queries that expand to sets of simple terms.
+ */
public abstract class SimpleTerm
extends SrndQuery
implements DistanceSubQuery, Comparable<SimpleTerm>
@@ -67,6 +70,10 @@ public abstract class SimpleTerm
String fieldName,
MatchingTermVisitor mtv) throws IOException;
+ /**
+ * Callback to visit each matching term during "rewrite"
+ * in {@link #visitMatchingTerm(Term)}
+ */
public interface MatchingTermVisitor {
void visitMatchingTerm(Term t)throws IOException;
}
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndPrefixQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndPrefixQuery.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndPrefixQuery.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndPrefixQuery.java Thu Aug 30 22:43:41 2012
@@ -27,6 +27,9 @@ import org.apache.lucene.index.MultiFiel
import java.io.IOException;
+/**
+ * Query that matches String prefixes
+ */
public class SrndPrefixQuery extends SimpleTerm {
private final BytesRef prefixRef;
public SrndPrefixQuery(String prefix, boolean quoted, char truncator) {
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTermQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTermQuery.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTermQuery.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTermQuery.java Thu Aug 30 22:43:41 2012
@@ -26,6 +26,9 @@ import org.apache.lucene.index.MultiFiel
import org.apache.lucene.util.BytesRef;
+/**
+ * Simple single-term clause
+ */
public class SrndTermQuery extends SimpleTerm {
public SrndTermQuery(String termText, boolean quoted) {
super(quoted);
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CorePlusExtensionsParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CorePlusExtensionsParser.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CorePlusExtensionsParser.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CorePlusExtensionsParser.java Thu Aug 30 22:43:41 2012
@@ -22,7 +22,9 @@ import org.apache.lucene.queryparser.xml
*/
/**
- *
+ * Assembles a QueryBuilder which uses Query objects from
+ * Lucene's <code>sandbox</code> and <code>queries</code>
+ * modules in addition to core queries.
*/
public class CorePlusExtensionsParser extends CoreParser {
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/DOMUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/DOMUtils.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/DOMUtils.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/DOMUtils.java Thu Aug 30 22:43:41 2012
@@ -26,7 +26,7 @@ import java.io.Reader;
*/
/**
- *
+ * Helper methods for parsing XML
*/
public class DOMUtils {
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/ParserException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/ParserException.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/ParserException.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/ParserException.java Thu Aug 30 22:43:41 2012
@@ -20,7 +20,8 @@ package org.apache.lucene.queryparser.xm
*/
/**
- *
+ * Thrown when the xml queryparser encounters
+ * invalid syntax/configuration.
*/
public class ParserException extends Exception {
Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiPhraseQueryParsing.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiPhraseQueryParsing.java?rev=1379200&r1=1379199&r2=1379200&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiPhraseQueryParsing.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiPhraseQueryParsing.java Thu Aug 30 22:43:41 2012
@@ -81,8 +81,7 @@ public class TestMultiPhraseQueryParsing
}
@Override
- public void setReader(Reader reader) throws IOException {
- super.setReader(reader);
+ public void reset() throws IOException {
this.upto = 0;
this.lastPos = 0;
}