From 30f3ef3c666cebde7ee53c195315d14830318b39 Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Thu, 6 Jul 2023 17:03:42 -0400 Subject: [PATCH 01/11] grammar changes for adding field:zl:ns and field:zl:tq syntax --- .../queryparser/parser/ZuliaSyntaxParser.jj | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.jj b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.jj index ea722a0d..e41ed6fe 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.jj +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.jj @@ -80,6 +80,9 @@ import org.apache.lucene.queryparser.flexible.standard.nodes.RegexpQueryNode; import org.apache.lucene.queryparser.charstream.CharStream; import org.apache.lucene.queryparser.charstream.FastCharStream; import org.apache.lucene.queryparser.flexible.standard.nodes.TermRangeQueryNode; +import io.zulia.server.search.queryparser.node.ZuliaNumericSetQueryNode; +import io.zulia.server.search.queryparser.node.ZuliaTermsInSetQueryNode; +import io.zulia.server.search.queryparser.node.ZuliaFieldableQueryNode; import static io.zulia.server.search.queryparser.parser.EscapeQuerySyntaxImpl.discardEscapeChar; @@ -137,7 +140,7 @@ PARSER_END(ZuliaSyntaxParser) | <#_QUOTED_CHAR: ( ~[ "\"", "\\" ] | <_ESCAPED_CHAR> ) > } - SKIP : { + SKIP : { < <_WHITESPACE> > } @@ -146,6 +149,7 @@ PARSER_END(ZuliaSyntaxParser) | | | : Function + | : Zulia | | | @@ -165,10 +169,15 @@ PARSER_END(ZuliaSyntaxParser) | : Range } - TOKEN : { + TOKEN : { : DEFAULT } + TOKEN : { + + | +} + TOKEN : { | @@ -327,7 +336,7 @@ private QueryNode Clause(CharSequence field) : { ( LOOKAHEAD(2) q = FieldRangeExpr(field) | (LOOKAHEAD(2) field = FieldName() ( | ))? - (LOOKAHEAD(2) q = Term(field) | q = GroupingExpr(field) | q = IntervalExpr(field)) + (LOOKAHEAD(2) q = Term(field) | q = GroupingExpr(field) | q = IntervalExpr(field) | q = ZuliaExpr(field)) ) { return q; @@ -368,6 +377,47 @@ private QueryNode GroupingExpr(CharSequence field) : { } +private ZuliaFieldableQueryNode ZuliaExpr(CharSequence field) : { + ZuliaFieldableQueryNode source; +} + { + LOOKAHEAD(2) source = NumericsSetQuery(field) { return source; } | + LOOKAHEAD(2) source = TermsInSetQuery(field) { return source; } + } + +private ZuliaNumericSetQueryNode NumericsSetQuery(CharSequence field) : { + CharSequence value; + ArrayList values = new ArrayList(); +} +{ + + (value = TermText() { values.add(value); })+ + { + return new ZuliaNumericSetQueryNode(field, values); + } +} + + +private ZuliaTermsInSetQueryNode TermsInSetQuery(CharSequence field) : { + CharSequence value; + ArrayList values = new ArrayList(); +} +{ + + (value = TermText() { values.add(value); })+ + { + return new ZuliaTermsInSetQueryNode(field, values); + } +} + +private CharSequence TermText() : { +} +{ + () { return token.image.substring(1, token.image.length() - 1); } + | ( | ) { return token.image; } +} + + /** * An interval expression (functions) node. */ From 2793f7c7e6e3fcb521312ec2a7a7cec095b5c342 Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Thu, 6 Jul 2023 17:05:00 -0400 Subject: [PATCH 02/11] generated code changes for adding: field:zl:ns and field:zl:tq syntax --- .../queryparser/parser/ParseException.java | 342 +- .../search/queryparser/parser/Token.java | 246 +- .../queryparser/parser/TokenMgrError.java | 256 +- .../queryparser/parser/ZuliaSyntaxParser.java | 5562 +++++++++-------- .../parser/ZuliaSyntaxParserConstants.java | 498 +- .../parser/ZuliaSyntaxParserTokenManager.java | 4778 +++++++------- 6 files changed, 6043 insertions(+), 5639 deletions(-) diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ParseException.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ParseException.java index af6e9140..c6899403 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ParseException.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ParseException.java @@ -18,177 +18,177 @@ */ public class ParseException extends QueryNodeParseException { - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; - - /** - * The end of line string for this machine. - */ - protected static String EOL = System.getProperty("line.separator", "\n"); - - /** - * 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. - */ - public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) { - super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal))); - this.currentToken = currentTokenVal; - this.expectedTokenSequences = expectedTokenSequencesVal; - this.tokenImage = tokenImageVal; - } - - /** - * The following constructors are for use by you for whatever - * purpose you can think of. Constructing the exception in this - * manner makes the exception behave in the normal way - i.e., as - * documented in the class "Throwable". The fields "errorToken", - * "expectedTokenSequences", and "tokenImage" do not contain - * relevant information. The JavaCC generated code does not use - * these constructors. - */ - - public ParseException() { - super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, "Error")); - } - - /** - * Constructor with message. - */ - public ParseException(Message message) { - super(message); - } - - /** - * This is the last token that has been consumed successfully. If - * this object has been created due to a parse error, the token - * followng this token will (therefore) be the first error token. - */ - public Token currentToken; - - /** - * Each entry in this array is an array of integers. Each array - * of integers represents a sequence of tokens (by their ordinal - * values) that is expected at this point of the parse. - */ - public int[][] expectedTokenSequences; - - /** - * This is a reference to the "tokenImage" array of the generated - * parser within which the parse error occurred. This array is - * defined in the generated ...Constants interface. - */ - public String[] tokenImage; - - /** - * 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) the correct error message - * gets displayed. - */ - private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { - - StringBuilder expected = new StringBuilder(); - int maxSize = 0; - for (int i = 0; i < expectedTokenSequences.length; i++) { - if (maxSize < expectedTokenSequences[i].length) { - maxSize = expectedTokenSequences[i].length; - } - for (int j = 0; j < expectedTokenSequences[i].length; j++) { - expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); - } - if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { - expected.append("..."); - } - expected.append(EOL).append(" "); - } - String retval = "Encountered \""; - Token tok = currentToken.next; - for (int i = 0; i < maxSize; i++) { - if (i != 0) - retval += " "; - if (tok.kind == 0) { - retval += tokenImage[0]; - break; - } - retval += " " + tokenImage[tok.kind]; - retval += " \""; - retval += add_escapes(tok.image); - retval += " \""; - tok = tok.next; - } - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - retval += "." + EOL; - - if (expectedTokenSequences.length == 0) { - // Nothing to add here - } - else { - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + EOL + " "; - } - else { - retval += "Was expecting one of:" + EOL + " "; - } - retval += expected.toString(); - } - - return retval; - } - - /** - * Used to convert raw characters to their escaped version - * when these raw version cannot be used as part of an ASCII - * string literal. - */ - static String add_escapes(String str) { - StringBuilder retval = new StringBuilder(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - 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(); - } + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * The end of line string for this machine. + */ + protected static String EOL = System.getProperty("line.separator", "\n"); + + /** + * 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. + */ + public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) { + super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal))); + this.currentToken = currentTokenVal; + this.expectedTokenSequences = expectedTokenSequencesVal; + this.tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, "Error")); + } + + /** + * Constructor with message. + */ + public ParseException(Message message) { + super(message); + } + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * 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) the correct error message + * gets displayed. + */ + private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { + + StringBuilder expected = new StringBuilder(); + int maxSize = 0; + for (int i = 0; i < expectedTokenSequences.length; i++) { + if (maxSize < expectedTokenSequences[i].length) { + maxSize = expectedTokenSequences[i].length; + } + for (int j = 0; j < expectedTokenSequences[i].length; j++) { + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); + } + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + expected.append("..."); + } + expected.append(EOL).append(" "); + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) + retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += " " + tokenImage[tok.kind]; + retval += " \""; + retval += add_escapes(tok.image); + retval += " \""; + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + EOL; + + if (expectedTokenSequences.length == 0) { + // Nothing to add here + } + else { + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + EOL + " "; + } + else { + retval += "Was expecting one of:" + EOL + " "; + } + retval += expected.toString(); + } + + return retval; + } + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + */ + static String add_escapes(String str) { + StringBuilder retval = new StringBuilder(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) { + 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(); + } } /* (filtered)*/ diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/Token.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/Token.java index 6ace842a..a01d2777 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/Token.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/Token.java @@ -8,129 +8,129 @@ public class Token implements java.io.Serializable { - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; - - /** - * An integer that describes the kind of this token. This numbering - * system is determined by JavaCCParser, and a table of these numbers is - * stored in the file ...Constants.java. - */ - public int kind; - - /** - * The line number of the first character of this Token. - */ - public int beginLine; - /** - * The column number of the first character of this Token. - */ - public int beginColumn; - /** - * The line number of the last character of this Token. - */ - public int endLine; - /** - * The column number of the last character of this Token. - */ - public int endColumn; - - /** - * The string image of the token. - */ - public String image; - - /** - * A reference to the next regular (non-special) token from the input - * stream. If this is the last token from the input stream, or if the - * token manager has not read tokens beyond this one, this field is - * set to null. This is true only if this token is also a regular - * token. Otherwise, see below for a description of the contents of - * this field. - */ - public Token next; - - /** - * This field is used to access special tokens that occur prior to this - * token, but after the immediately preceding regular (non-special) token. - * If there are no such special tokens, this field is set to null. - * When there are more than one such special token, this field refers - * to the last of these special tokens, which in turn refers to the next - * previous special token through its specialToken field, and so on - * until the first special token (whose specialToken field is null). - * The next fields of special tokens refer to other special tokens that - * immediately follow it (without an intervening regular token). If there - * is no such token, this field is null. - */ - public Token specialToken; - - /** - * An optional attribute value of the Token. - * Tokens which are not used as syntactic sugar will often contain - * meaningful values that will be used later on by the compiler or - * interpreter. This attribute value is often different from the image. - * Any subclass of Token that actually wants to return a non-null value can - * override this method as appropriate. - */ - public Object getValue() { - return null; - } - - /** - * No-argument constructor - */ - public Token() { - } - - /** - * Constructs a new token for the specified Image. - */ - public Token(int kind) { - this(kind, null); - } - - /** - * Constructs a new token for the specified Image and Kind. - */ - public Token(int kind, String image) { - this.kind = kind; - this.image = image; - } - - /** - * Returns the image. - */ - @Override - public String toString() { - return image; - } - - /** - * Returns a new Token object, by default. However, if you want, you - * can create and return subclass objects based on the value of ofKind. - * Simply add the cases to the switch for all those special cases. - * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simply add something like : - *

- * case MyParserConstants.ID : return new IDToken(ofKind, image); - *

- * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use sit in your lexical actions. - */ - public static Token newToken(int ofKind, String image) { - switch (ofKind) { - default: - return new Token(ofKind, image); - } - } - - public static Token newToken(int ofKind) { - return newToken(ofKind, null); - } + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** + * The line number of the first character of this Token. + */ + public int beginLine; + /** + * The column number of the first character of this Token. + */ + public int beginColumn; + /** + * The line number of the last character of this Token. + */ + public int endLine; + /** + * The column number of the last character of this Token. + */ + public int endColumn; + + /** + * The string image of the token. + */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** + * An optional attribute value of the Token. + * Tokens which are not used as syntactic sugar will often contain + * meaningful values that will be used later on by the compiler or + * interpreter. This attribute value is often different from the image. + * Any subclass of Token that actually wants to return a non-null value can + * override this method as appropriate. + */ + public Object getValue() { + return null; + } + + /** + * No-argument constructor + */ + public Token() { + } + + /** + * Constructs a new token for the specified Image. + */ + public Token(int kind) { + this(kind, null); + } + + /** + * Constructs a new token for the specified Image and Kind. + */ + public Token(int kind, String image) { + this.kind = kind; + this.image = image; + } + + /** + * Returns the image. + */ + @Override + public String toString() { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simply add something like : + *

+ * case MyParserConstants.ID : return new IDToken(ofKind, image); + *

+ * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use sit in your lexical actions. + */ + public static Token newToken(int ofKind, String image) { + switch (ofKind) { + default: + return new Token(ofKind, image); + } + } + + public static Token newToken(int ofKind) { + return newToken(ofKind, null); + } } /* (filtered)*/ diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/TokenMgrError.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/TokenMgrError.java index 7d96d29d..e1a3fa88 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/TokenMgrError.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/TokenMgrError.java @@ -7,146 +7,146 @@ */ public class TokenMgrError extends Error { - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ - /** - * Lexical error occurred. - */ - public static final int LEXICAL_ERROR = 0; + /** + * Lexical error occurred. + */ + public static final int LEXICAL_ERROR = 0; - /** - * An attempt was made to create a second instance of a static token manager. - */ - public static final int STATIC_LEXER_ERROR = 1; + /** + * An attempt was made to create a second instance of a static token manager. + */ + public static final int STATIC_LEXER_ERROR = 1; - /** - * Tried to change to an invalid lexical state. - */ - public static final int INVALID_LEXICAL_STATE = 2; + /** + * Tried to change to an invalid lexical state. + */ + public static final int INVALID_LEXICAL_STATE = 2; - /** - * Detected (and bailed out of) an infinite loop in the token manager. - */ - public static final int LOOP_DETECTED = 3; + /** + * Detected (and bailed out of) an infinite loop in the token manager. + */ + public 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; + /** + * 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) { - StringBuilder retval = new StringBuilder(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - 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(); - } + /** + * Replaces unprintable characters by their escaped (or unicode escaped) + * equivalents in the given string + */ + protected static final String addEscapes(String str) { + StringBuilder retval = new StringBuilder(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) { + 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 LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) { - char curChar1 = (char) curChar; - return ("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? - " " : - ("\"" + addEscapes(String.valueOf(curChar1)) + "\"") + " (" + 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 LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) { + char curChar1 = (char) curChar; + return ("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? + " " : + ("\"" + addEscapes(String.valueOf(curChar1)) + "\"") + " (" + 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. - */ - @Override - 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. + */ + @Override + 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, int curChar, int reason) { - this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); - } + /** + * Full Constructor. + */ + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) { + this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } } /* (filtered)*/ diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.java index cea7cd1f..27fd5a2a 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.java @@ -19,6 +19,9 @@ * limitations under the License. */ +import io.zulia.server.search.queryparser.node.ZuliaFieldableQueryNode; +import io.zulia.server.search.queryparser.node.ZuliaNumericSetQueryNode; +import io.zulia.server.search.queryparser.node.ZuliaTermsInSetQueryNode; import org.apache.lucene.queryparser.charstream.CharStream; import org.apache.lucene.queryparser.charstream.FastCharStream; import org.apache.lucene.queryparser.flexible.core.QueryNodeParseException; @@ -54,2689 +57,2880 @@ * Parser for the standard Lucene syntax */ public class ZuliaSyntaxParser implements SyntaxParser, ZuliaSyntaxParserConstants { - public ZuliaSyntaxParser() { - this(new FastCharStream(Reader.nullReader())); - } - - /** - * Parses a query string, returning a {@link org.apache.lucene.queryparser.flexible.core.nodes.QueryNode}. - * - * @param query the query string to be parsed. - * @throws ParseException if the parsing fails - */ - @Override - public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException { - ReInit(new FastCharStream(new StringReader(query.toString()))); - try { - return TopLevelQuery(field); - } - catch (ParseException tme) { - tme.setQuery(query); - throw tme; - } - catch (Error tme) { - Message message = new MessageImpl(QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, tme.getMessage()); - QueryNodeParseException e = new QueryNodeParseException(tme); - e.setQuery(query); - e.setNonLocalizedMessage(message); - throw e; - } - } - - public static float parseFloat(Token token) { - return Float.parseFloat(token.image); - } - - public static int parseInt(Token token) { - return Integer.parseInt(token.image); - } - - final public QueryNode TopLevelQuery(CharSequence field) throws ParseException { - QueryNode q; - q = Query(field); - jj_consume_token(0); - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode Query(CharSequence field) throws ParseException { - ArrayList clauses = new ArrayList<>(); - QueryNode node; - label_1: - while (true) { - node = DisjQuery(field); - clauses.add(node); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case NOT: - case FN_PREFIX: - case PLUS: - case MINUS: - case QUOTED: - case NUMBER: - case TERM: - case REGEXPTERM: - case RANGEIN_START: - case RANGEEX_START: - case LPAREN: { - ; - break; - } - default: - jj_la1[0] = jj_gen; - break label_1; - } - } - // Handle the case of a "pure" negation query which - // needs to be wrapped as a boolean query, otherwise - // the returned result drops the negation. - if (clauses.size() == 1) { - QueryNode first = clauses.get(0); - if (first instanceof ModifierQueryNode && ((ModifierQueryNode) first).getModifier() == ModifierQueryNode.Modifier.MOD_NOT) { - clauses.set(0, new BooleanQueryNode(Collections.singletonList(first))); - } - } - - { - if ("" != null) - return clauses.size() == 1 ? clauses.get(0) : new BooleanQueryNode(clauses); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode DisjQuery(CharSequence field) throws ParseException { - ArrayList clauses = new ArrayList<>(); - QueryNode node; - node = ConjQuery(field); - clauses.add(node); - label_2: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case OR: { - ; - break; - } - default: - jj_la1[1] = jj_gen; - break label_2; - } - jj_consume_token(OR); - node = ConjQuery(field); - clauses.add(node); - } - { - if ("" != null) - return clauses.size() == 1 ? clauses.get(0) : new OrQueryNode(clauses); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode ConjQuery(CharSequence field) throws ParseException { - ArrayList clauses = new ArrayList<>(); - QueryNode node; - node = ModClause(field); - clauses.add(node); - label_3: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case AND: { - ; - break; - } - default: - jj_la1[2] = jj_gen; - break label_3; - } - jj_consume_token(AND); - node = ModClause(field); - clauses.add(node); - } - { - if ("" != null) - return clauses.size() == 1 ? clauses.get(0) : new AndQueryNode(clauses); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode ModClause(CharSequence field) throws ParseException { - QueryNode q; - ModifierQueryNode.Modifier modifier = ModifierQueryNode.Modifier.MOD_NONE; - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case NOT: - case PLUS: - case MINUS: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case PLUS: { - jj_consume_token(PLUS); - modifier = ModifierQueryNode.Modifier.MOD_REQ; - break; - } - case NOT: - case MINUS: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case MINUS: { - jj_consume_token(MINUS); - break; - } - case NOT: { - jj_consume_token(NOT); - break; - } - default: - jj_la1[3] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - modifier = ModifierQueryNode.Modifier.MOD_NOT; - break; - } - default: - jj_la1[4] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - } - default: - jj_la1[5] = jj_gen; - ; - } - q = Clause(field); - if (modifier != ModifierQueryNode.Modifier.MOD_NONE) { - q = new ModifierQueryNode(q, modifier); - } - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode Clause(CharSequence field) throws ParseException { - QueryNode q; - if (jj_2_3(2)) { - q = FieldRangeExpr(field); - } - else { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: - case REGEXPTERM: - case RANGEIN_START: - case RANGEEX_START: - case LPAREN: { - if (jj_2_1(2)) { - field = FieldName(); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case OP_COLON: { - jj_consume_token(OP_COLON); - break; - } - case OP_EQUAL: { - jj_consume_token(OP_EQUAL); - break; - } - default: - jj_la1[6] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - else { - ; - } - if (jj_2_2(2)) { - q = Term(field); - } - else { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case LPAREN: { - q = GroupingExpr(field); - break; - } - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - q = IntervalExpr(field); - break; - } - default: - jj_la1[7] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - break; - } - default: - jj_la1[8] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private CharSequence FieldName() throws ParseException { - Token name; - name = jj_consume_token(TERM); - { - if ("" != null) - return discardEscapeChar(name.image); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode GroupingExpr(CharSequence field) throws ParseException { - QueryNode q; - Token boost, minShouldMatch = null; - jj_consume_token(LPAREN); - q = Query(field); - jj_consume_token(RPAREN); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case CARAT: { - q = Boost(q); - break; - } - default: - jj_la1[9] = jj_gen; - ; - } - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TILDE: - case 56: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TILDE: { - jj_consume_token(TILDE); - break; - } - case 56: { - jj_consume_token(56); - break; - } - default: - jj_la1[10] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - minShouldMatch = jj_consume_token(NUMBER); - break; - } - default: - jj_la1[11] = jj_gen; - ; - } - if (minShouldMatch != null) { - q = new MinShouldMatchNode(parseInt(minShouldMatch), new GroupQueryNode(q)); - } - else { - q = new GroupQueryNode(q); - } - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private IntervalQueryNode IntervalExpr(CharSequence field) throws ParseException { - IntervalFunction source; - source = IntervalFun(); - { - if ("" != null) - return new IntervalQueryNode(field == null ? null : field.toString(), source); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalFun() throws ParseException { - IntervalFunction source; - if (jj_2_4(2)) { - source = IntervalAtLeast(); - { - if ("" != null) - return source; - } - } - else if (jj_2_5(2)) { - source = IntervalMaxWidth(); - { - if ("" != null) - return source; - } - } - else if (jj_2_6(2)) { - source = IntervalMaxGaps(); - { - if ("" != null) - return source; - } - } - else if (jj_2_7(2)) { - source = IntervalOrdered(); - { - if ("" != null) - return source; - } - } - else if (jj_2_8(2)) { - source = IntervalUnordered(); - { - if ("" != null) - return source; - } - } - else if (jj_2_9(2)) { - source = IntervalUnorderedNoOverlaps(); - { - if ("" != null) - return source; - } - } - else if (jj_2_10(2)) { - source = IntervalOr(); - { - if ("" != null) - return source; - } - } - else if (jj_2_11(2)) { - source = IntervalWildcard(); - { - if ("" != null) - return source; - } - } - else if (jj_2_12(2)) { - source = IntervalAfter(); - { - if ("" != null) - return source; - } - } - else if (jj_2_13(2)) { - source = IntervalBefore(); - { - if ("" != null) - return source; - } - } - else if (jj_2_14(2)) { - source = IntervalPhrase(); - { - if ("" != null) - return source; - } - } - else if (jj_2_15(2)) { - source = IntervalContaining(); - { - if ("" != null) - return source; - } - } - else if (jj_2_16(2)) { - source = IntervalNotContaining(); - { - if ("" != null) - return source; - } - } - else if (jj_2_17(2)) { - source = IntervalContainedBy(); - { - if ("" != null) - return source; - } - } - else if (jj_2_18(2)) { - source = IntervalNotContainedBy(); - { - if ("" != null) - return source; - } - } - else if (jj_2_19(2)) { - source = IntervalWithin(); - { - if ("" != null) - return source; - } - } - else if (jj_2_20(2)) { - source = IntervalNotWithin(); - { - if ("" != null) - return source; - } - } - else if (jj_2_21(2)) { - source = IntervalOverlapping(); - { - if ("" != null) - return source; - } - } - else if (jj_2_22(2)) { - source = IntervalNonOverlapping(); - { - if ("" != null) - return source; - } - } - else if (jj_2_23(2)) { - source = IntervalExtend(); - { - if ("" != null) - return source; - } - } - else if (jj_2_24(2)) { - source = IntervalFuzzyTerm(); - { - if ("" != null) - return source; - } - } - else if (jj_2_25(2)) { - source = IntervalText(); - { - if ("" != null) - return source; - } - } - else { - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalAtLeast() throws ParseException { - IntervalFunction source; - ArrayList sources = new ArrayList(); - Token minShouldMatch; - jj_consume_token(FN_PREFIX); - jj_consume_token(ATLEAST); - jj_consume_token(LPAREN); - minShouldMatch = jj_consume_token(NUMBER); - label_4: - while (true) { - source = IntervalFun(); - sources.add(source); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[12] = jj_gen; - break label_4; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new AtLeast(parseInt(minShouldMatch), sources); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalMaxWidth() throws ParseException { - IntervalFunction source; - Token maxWidth; - jj_consume_token(FN_PREFIX); - jj_consume_token(MAXWIDTH); - jj_consume_token(LPAREN); - maxWidth = jj_consume_token(NUMBER); - source = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new MaxWidth(parseInt(maxWidth), source); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalMaxGaps() throws ParseException { - IntervalFunction source; - Token maxGaps; - jj_consume_token(FN_PREFIX); - jj_consume_token(MAXGAPS); - jj_consume_token(LPAREN); - maxGaps = jj_consume_token(NUMBER); - source = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new MaxGaps(parseInt(maxGaps), source); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalUnordered() throws ParseException { - IntervalFunction source; - ArrayList sources = new ArrayList(); - jj_consume_token(FN_PREFIX); - jj_consume_token(UNORDERED); - jj_consume_token(LPAREN); - label_5: - while (true) { - source = IntervalFun(); - sources.add(source); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[13] = jj_gen; - break label_5; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new Unordered(sources); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalUnorderedNoOverlaps() throws ParseException { - IntervalFunction a, b; - jj_consume_token(FN_PREFIX); - jj_consume_token(UNORDERED_NO_OVERLAPS); - jj_consume_token(LPAREN); - a = IntervalFun(); - b = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new UnorderedNoOverlaps(a, b); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalOrdered() throws ParseException { - IntervalFunction source; - ArrayList sources = new ArrayList(); - jj_consume_token(FN_PREFIX); - jj_consume_token(ORDERED); - jj_consume_token(LPAREN); - label_6: - while (true) { - source = IntervalFun(); - sources.add(source); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[14] = jj_gen; - break label_6; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new Ordered(sources); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalOr() throws ParseException { - IntervalFunction source; - ArrayList sources = new ArrayList(); - jj_consume_token(FN_PREFIX); - jj_consume_token(FN_OR); - jj_consume_token(LPAREN); - label_7: - while (true) { - source = IntervalFun(); - sources.add(source); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[15] = jj_gen; - break label_7; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new Or(sources); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalPhrase() throws ParseException { - IntervalFunction source; - ArrayList sources = new ArrayList(); - jj_consume_token(FN_PREFIX); - jj_consume_token(PHRASE); - jj_consume_token(LPAREN); - label_8: - while (true) { - source = IntervalFun(); - sources.add(source); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[16] = jj_gen; - break label_8; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new Phrase(sources); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalBefore() throws ParseException { - IntervalFunction source; - IntervalFunction reference; - jj_consume_token(FN_PREFIX); - jj_consume_token(BEFORE); - jj_consume_token(LPAREN); - source = IntervalFun(); - reference = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new Before(source, reference); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalAfter() throws ParseException { - IntervalFunction source; - IntervalFunction reference; - jj_consume_token(FN_PREFIX); - jj_consume_token(AFTER); - jj_consume_token(LPAREN); - source = IntervalFun(); - reference = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new After(source, reference); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalContaining() throws ParseException { - IntervalFunction big; - IntervalFunction small; - jj_consume_token(FN_PREFIX); - jj_consume_token(CONTAINING); - jj_consume_token(LPAREN); - big = IntervalFun(); - small = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new Containing(big, small); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalNotContaining() throws ParseException { - IntervalFunction minuend; - IntervalFunction subtrahend; - jj_consume_token(FN_PREFIX); - jj_consume_token(NOT_CONTAINING); - jj_consume_token(LPAREN); - minuend = IntervalFun(); - subtrahend = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new NotContaining(minuend, subtrahend); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalContainedBy() throws ParseException { - IntervalFunction big; - IntervalFunction small; - jj_consume_token(FN_PREFIX); - jj_consume_token(CONTAINED_BY); - jj_consume_token(LPAREN); - small = IntervalFun(); - big = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new ContainedBy(small, big); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalNotContainedBy() throws ParseException { - IntervalFunction big; - IntervalFunction small; - jj_consume_token(FN_PREFIX); - jj_consume_token(NOT_CONTAINED_BY); - jj_consume_token(LPAREN); - small = IntervalFun(); - big = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new NotContainedBy(small, big); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalWithin() throws ParseException { - IntervalFunction source, reference; - Token positions; - jj_consume_token(FN_PREFIX); - jj_consume_token(WITHIN); - jj_consume_token(LPAREN); - source = IntervalFun(); - positions = jj_consume_token(NUMBER); - reference = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new Within(source, parseInt(positions), reference); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalExtend() throws ParseException { - IntervalFunction source; - Token before, after; - jj_consume_token(FN_PREFIX); - jj_consume_token(EXTEND); - jj_consume_token(LPAREN); - source = IntervalFun(); - before = jj_consume_token(NUMBER); - after = jj_consume_token(NUMBER); - jj_consume_token(RPAREN); - { - if ("" != null) - return new Extend(source, parseInt(before), parseInt(after)); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalNotWithin() throws ParseException { - IntervalFunction minuend, subtrahend; - Token positions; - jj_consume_token(FN_PREFIX); - jj_consume_token(NOT_WITHIN); - jj_consume_token(LPAREN); - minuend = IntervalFun(); - positions = jj_consume_token(NUMBER); - subtrahend = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new NotWithin(minuend, parseInt(positions), subtrahend); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalOverlapping() throws ParseException { - IntervalFunction source, reference; - jj_consume_token(FN_PREFIX); - jj_consume_token(OVERLAPPING); - jj_consume_token(LPAREN); - source = IntervalFun(); - reference = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new Overlapping(source, reference); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalNonOverlapping() throws ParseException { - IntervalFunction minuend, subtrahend; - jj_consume_token(FN_PREFIX); - jj_consume_token(NON_OVERLAPPING); - jj_consume_token(LPAREN); - minuend = IntervalFun(); - subtrahend = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new NonOverlapping(minuend, subtrahend); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalWildcard() throws ParseException { - String wildcard; - Token maxExpansions = null; - jj_consume_token(FN_PREFIX); - jj_consume_token(WILDCARD); - jj_consume_token(LPAREN); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case NUMBER: - case TERM: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TERM: { - jj_consume_token(TERM); - break; - } - case NUMBER: { - jj_consume_token(NUMBER); - break; - } - default: - jj_la1[17] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - wildcard = token.image; - break; - } - case QUOTED: { - jj_consume_token(QUOTED); - wildcard = token.image.substring(1, token.image.length() - 1); - break; - } - default: - jj_la1[18] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case NUMBER: { - maxExpansions = jj_consume_token(NUMBER); - break; - } - default: - jj_la1[19] = jj_gen; - ; - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new Wildcard(wildcard, maxExpansions == null ? 0 : parseInt(maxExpansions)); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalFuzzyTerm() throws ParseException { - String term; - Token maxEdits = null; - Token maxExpansions = null; - jj_consume_token(FN_PREFIX); - jj_consume_token(FUZZYTERM); - jj_consume_token(LPAREN); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case NUMBER: - case TERM: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TERM: { - jj_consume_token(TERM); - break; - } - case NUMBER: { - jj_consume_token(NUMBER); - break; - } - default: - jj_la1[20] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - term = token.image; - break; - } - case QUOTED: { - jj_consume_token(QUOTED); - term = token.image.substring(1, token.image.length() - 1); - break; - } - default: - jj_la1[21] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - if (jj_2_26(2)) { - maxEdits = jj_consume_token(NUMBER); - } - else { - ; - } - if (jj_2_27(2)) { - maxExpansions = jj_consume_token(NUMBER); - } - else { - ; - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new FuzzyTerm(term, maxEdits == null ? null : parseInt(maxEdits), maxExpansions == null ? null : parseInt(maxExpansions)); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalText() throws ParseException { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case QUOTED: { - jj_consume_token(QUOTED); - { - if ("" != null) - return new AnalyzedText(token.image.substring(1, token.image.length() - 1)); - } - break; - } - case NUMBER: - case TERM: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TERM: { - jj_consume_token(TERM); - break; - } - case NUMBER: { - jj_consume_token(NUMBER); - break; - } - default: - jj_la1[22] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - { - if ("" != null) - return new AnalyzedText(token.image); - } - break; - } - default: - jj_la1[23] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode Boost(QueryNode node) throws ParseException { - Token boost; - jj_consume_token(CARAT); - boost = jj_consume_token(NUMBER); - { - if ("" != null) - return node == null ? node : new BoostQueryNode(node, parseFloat(boost)); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode FuzzyOp(CharSequence field, Token term, QueryNode node) throws ParseException { - Token similarity = null; - jj_consume_token(TILDE); - if (jj_2_28(2)) { - similarity = jj_consume_token(NUMBER); - } - else { - ; - } - float fms = org.apache.lucene.search.FuzzyQuery.defaultMaxEdits; - if (similarity != null) { - fms = parseFloat(similarity); - if (fms < 0.0f) { - { - if (true) - throw new ParseException(new MessageImpl(QueryParserMessages.INVALID_SYNTAX_FUZZY_LIMITS)); - } - } - else if (fms >= 1.0f && fms != (int) fms) { - { - if (true) - throw new ParseException(new MessageImpl(QueryParserMessages.INVALID_SYNTAX_FUZZY_EDITS)); - } - } - } - { - if ("" != null) - return new FuzzyQueryNode(field, discardEscapeChar(term.image), fms, term.beginColumn, term.endColumn); - } - throw new Error("Missing return statement in function"); - } - - final private TermRangeQueryNode FieldRangeExpr(CharSequence field) throws ParseException { - Token operator, term; - FieldQueryNode qLower, qUpper; - boolean lowerInclusive, upperInclusive; - field = FieldName(); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case OP_LESSTHAN: { - jj_consume_token(OP_LESSTHAN); - break; - } - case OP_LESSTHANEQ: { - jj_consume_token(OP_LESSTHANEQ); - break; - } - case OP_MORETHAN: { - jj_consume_token(OP_MORETHAN); - break; - } - case OP_MORETHANEQ: { - jj_consume_token(OP_MORETHANEQ); - break; - } - default: - jj_la1[24] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = token; - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TERM: { - jj_consume_token(TERM); - break; - } - case QUOTED: { - jj_consume_token(QUOTED); - break; - } - case NUMBER: { - jj_consume_token(NUMBER); - break; - } - default: - jj_la1[25] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - term = token; - if (term.kind == QUOTED) { - term.image = term.image.substring(1, term.image.length() - 1); - } - switch (operator.kind) { - case OP_LESSTHAN: - lowerInclusive = true; - upperInclusive = false; - qLower = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); - qUpper = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); - break; - case OP_LESSTHANEQ: - lowerInclusive = true; - upperInclusive = true; - qLower = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); - qUpper = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); - break; - case OP_MORETHAN: - lowerInclusive = false; - upperInclusive = true; - qLower = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); - qUpper = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); - break; - case OP_MORETHANEQ: - lowerInclusive = true; - upperInclusive = true; - qLower = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); - qUpper = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); - break; - default: { - if (true) - throw new Error("Unhandled case, operator=" + operator); - } - } - { - if ("" != null) - return new TermRangeQueryNode(qLower, qUpper, lowerInclusive, upperInclusive); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode Term(CharSequence field) throws ParseException { - QueryNode q; - Token term, fuzzySlop = null; - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case REGEXPTERM: { - term = jj_consume_token(REGEXPTERM); - String v = term.image.substring(1, term.image.length() - 1); - q = new RegexpQueryNode(field, v, 0, v.length()); - break; - } - case NUMBER: - case TERM: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TERM: { - term = jj_consume_token(TERM); - break; - } - case NUMBER: { - term = jj_consume_token(NUMBER); - break; - } - default: - jj_la1[26] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - q = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TILDE: { - q = FuzzyOp(field, term, q); - break; - } - default: - jj_la1[27] = jj_gen; - ; - } - break; - } - case RANGEIN_START: - case RANGEEX_START: { - q = TermRangeExpr(field); - break; - } - case QUOTED: { - q = QuotedTerm(field); - break; - } - default: - jj_la1[28] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case CARAT: { - q = Boost(q); - break; - } - default: - jj_la1[29] = jj_gen; - ; - } - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode QuotedTerm(CharSequence field) throws ParseException { - QueryNode q; - Token term, slop; - term = jj_consume_token(QUOTED); - String image = term.image.substring(1, term.image.length() - 1); - q = new QuotedFieldQueryNode(field, discardEscapeChar(image), term.beginColumn + 1, term.endColumn - 1); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TILDE: { - jj_consume_token(TILDE); - slop = jj_consume_token(NUMBER); - q = new SlopQueryNode(q, parseInt(slop)); - break; - } - default: - jj_la1[30] = jj_gen; - ; - } - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private TermRangeQueryNode TermRangeExpr(CharSequence field) throws ParseException { - Token left, right; - boolean leftInclusive = false; - boolean rightInclusive = false; - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case RANGEIN_START: { - jj_consume_token(RANGEIN_START); - leftInclusive = true; - break; - } - case RANGEEX_START: { - jj_consume_token(RANGEEX_START); - break; - } - default: - jj_la1[31] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case RANGE_GOOP: { - jj_consume_token(RANGE_GOOP); - break; - } - case RANGE_QUOTED: { - jj_consume_token(RANGE_QUOTED); - break; - } - case RANGE_TO: { - jj_consume_token(RANGE_TO); - break; - } - default: - jj_la1[32] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - left = token; - jj_consume_token(RANGE_TO); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case RANGE_GOOP: { - jj_consume_token(RANGE_GOOP); - break; - } - case RANGE_QUOTED: { - jj_consume_token(RANGE_QUOTED); - break; - } - case RANGE_TO: { - jj_consume_token(RANGE_TO); - break; - } - default: - jj_la1[33] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - right = token; - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case RANGEIN_END: { - jj_consume_token(RANGEIN_END); - rightInclusive = true; - break; - } - case RANGEEX_END: { - jj_consume_token(RANGEEX_END); - break; - } - default: - jj_la1[34] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - if (left.kind == RANGE_QUOTED) { - left.image = left.image.substring(1, left.image.length() - 1); - } - if (right.kind == RANGE_QUOTED) { - right.image = right.image.substring(1, right.image.length() - 1); - } - - FieldQueryNode qLower = new FieldQueryNode(field, discardEscapeChar(left.image), left.beginColumn, left.endColumn); - FieldQueryNode qUpper = new FieldQueryNode(field, discardEscapeChar(right.image), right.beginColumn, right.endColumn); - - { - if ("" != null) - return new TermRangeQueryNode(qLower, qUpper, leftInclusive, rightInclusive); - } - throw new Error("Missing return statement in function"); - } - - private boolean jj_2_1(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_1()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(0, xla); - } - } - - private boolean jj_2_2(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_2()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(1, xla); - } - } - - private boolean jj_2_3(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_3()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(2, xla); - } - } - - private boolean jj_2_4(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_4()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(3, xla); - } - } - - private boolean jj_2_5(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_5()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(4, xla); - } - } - - private boolean jj_2_6(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_6()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(5, xla); - } - } - - private boolean jj_2_7(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_7()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(6, xla); - } - } - - private boolean jj_2_8(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_8()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(7, xla); - } - } - - private boolean jj_2_9(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_9()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(8, xla); - } - } - - private boolean jj_2_10(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_10()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(9, xla); - } - } - - private boolean jj_2_11(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_11()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(10, xla); - } - } - - private boolean jj_2_12(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_12()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(11, xla); - } - } - - private boolean jj_2_13(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_13()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(12, xla); - } - } - - private boolean jj_2_14(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_14()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(13, xla); - } - } - - private boolean jj_2_15(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_15()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(14, xla); - } - } - - private boolean jj_2_16(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_16()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(15, xla); - } - } - - private boolean jj_2_17(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_17()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(16, xla); - } - } - - private boolean jj_2_18(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_18()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(17, xla); - } - } - - private boolean jj_2_19(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_19()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(18, xla); - } - } - - private boolean jj_2_20(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_20()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(19, xla); - } - } - - private boolean jj_2_21(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_21()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(20, xla); - } - } - - private boolean jj_2_22(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_22()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(21, xla); - } - } - - private boolean jj_2_23(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_23()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(22, xla); - } - } - - private boolean jj_2_24(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_24()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(23, xla); - } - } - - private boolean jj_2_25(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_25()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(24, xla); - } - } - - private boolean jj_2_26(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_26()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(25, xla); - } - } - - private boolean jj_2_27(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_27()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(26, xla); - } - } - - private boolean jj_2_28(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_28()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(27, xla); - } - } - - private boolean jj_3R_17() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(UNORDERED_NO_OVERLAPS)) - return true; - return false; - } - - private boolean jj_3R_25() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(CONTAINED_BY)) - return true; - return false; - } - - private boolean jj_3R_11() { - if (jj_3R_9()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(17)) { - jj_scanpos = xsp; - if (jj_scan_token(18)) { - jj_scanpos = xsp; - if (jj_scan_token(19)) { - jj_scanpos = xsp; - if (jj_scan_token(20)) - return true; - } - } - } - return false; - } - - private boolean jj_3R_19() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(WILDCARD)) - return true; - return false; - } - - private boolean jj_3R_47() { - if (jj_scan_token(TILDE)) - return true; - return false; - } - - private boolean jj_3R_16() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(UNORDERED)) - return true; - return false; - } - - private boolean jj_3R_24() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(NOT_CONTAINING)) - return true; - return false; - } - - private boolean jj_3R_43() { - if (jj_scan_token(QUOTED)) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_47()) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_30() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(NON_OVERLAPPING)) - return true; - return false; - } - - private boolean jj_3R_14() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(MAXGAPS)) - return true; - return false; - } - - private boolean jj_3_28() { - if (jj_scan_token(NUMBER)) - return true; - return false; - } - - private boolean jj_3R_23() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(CONTAINING)) - return true; - return false; - } - - private boolean jj_3R_9() { - if (jj_scan_token(TERM)) - return true; - return false; - } - - private boolean jj_3R_29() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(OVERLAPPING)) - return true; - return false; - } - - private boolean jj_3R_41() { - if (jj_3R_45()) - return true; - return false; - } - - private boolean jj_3R_37() { - if (jj_3R_43()) - return true; - return false; - } - - private boolean jj_3R_45() { - if (jj_scan_token(TILDE)) - return true; - return false; - } - - private boolean jj_3R_38() { - if (jj_3R_44()) - return true; - return false; - } - - private boolean jj_3R_36() { - if (jj_3R_42()) - return true; - return false; - } - - private boolean jj_3_2() { - if (jj_3R_10()) - return true; - return false; - } - - private boolean jj_3R_13() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(MAXWIDTH)) - return true; - return false; - } - - private boolean jj_3R_35() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(25)) { - jj_scanpos = xsp; - if (jj_scan_token(24)) - return true; - } - xsp = jj_scanpos; - if (jj_3R_41()) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_20() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(AFTER)) - return true; - return false; - } - - private boolean jj_3_1() { - if (jj_3R_9()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(15)) { - jj_scanpos = xsp; - if (jj_scan_token(16)) - return true; - } - return false; - } - - private boolean jj_3_3() { - if (jj_3R_11()) - return true; - return false; - } - - private boolean jj_3R_34() { - if (jj_scan_token(REGEXPTERM)) - return true; - return false; - } - - private boolean jj_3R_28() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(NOT_WITHIN)) - return true; - return false; - } - - private boolean jj_3R_21() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(BEFORE)) - return true; - return false; - } - - private boolean jj_3R_10() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_34()) { - jj_scanpos = xsp; - if (jj_3R_35()) { - jj_scanpos = xsp; - if (jj_3R_36()) { - jj_scanpos = xsp; - if (jj_3R_37()) - return true; - } - } - } - xsp = jj_scanpos; - if (jj_3R_38()) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_12() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(ATLEAST)) - return true; - return false; - } - - private boolean jj_3R_44() { - if (jj_scan_token(CARAT)) - return true; - return false; - } - - private boolean jj_3_25() { - if (jj_3R_33()) - return true; - return false; - } - - private boolean jj_3_24() { - if (jj_3R_32()) - return true; - return false; - } - - private boolean jj_3_23() { - if (jj_3R_31()) - return true; - return false; - } - - private boolean jj_3_22() { - if (jj_3R_30()) - return true; - return false; - } - - private boolean jj_3_21() { - if (jj_3R_29()) - return true; - return false; - } - - private boolean jj_3R_22() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(PHRASE)) - return true; - return false; - } - - private boolean jj_3_20() { - if (jj_3R_28()) - return true; - return false; - } - - private boolean jj_3R_31() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(EXTEND)) - return true; - return false; - } - - private boolean jj_3_19() { - if (jj_3R_27()) - return true; - return false; - } - - private boolean jj_3_18() { - if (jj_3R_26()) - return true; - return false; - } - - private boolean jj_3R_40() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(25)) { - jj_scanpos = xsp; - if (jj_scan_token(24)) - return true; - } - return false; - } - - private boolean jj_3_17() { - if (jj_3R_25()) - return true; - return false; - } - - private boolean jj_3R_39() { - if (jj_scan_token(QUOTED)) - return true; - return false; - } - - private boolean jj_3R_33() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_39()) { - jj_scanpos = xsp; - if (jj_3R_40()) - return true; - } - return false; - } - - private boolean jj_3_16() { - if (jj_3R_24()) - return true; - return false; - } - - private boolean jj_3_15() { - if (jj_3R_23()) - return true; - return false; - } - - private boolean jj_3_14() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3_13() { - if (jj_3R_21()) - return true; - return false; - } - - private boolean jj_3_12() { - if (jj_3R_20()) - return true; - return false; - } - - private boolean jj_3_11() { - if (jj_3R_19()) - return true; - return false; - } - - private boolean jj_3_10() { - if (jj_3R_18()) - return true; - return false; - } - - private boolean jj_3_9() { - if (jj_3R_17()) - return true; - return false; - } - - private boolean jj_3R_18() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(FN_OR)) - return true; - return false; - } - - private boolean jj_3_8() { - if (jj_3R_16()) - return true; - return false; - } - - private boolean jj_3_7() { - if (jj_3R_15()) - return true; - return false; - } - - private boolean jj_3_6() { - if (jj_3R_14()) - return true; - return false; - } - - private boolean jj_3_5() { - if (jj_3R_13()) - return true; - return false; - } - - private boolean jj_3_4() { - if (jj_3R_12()) - return true; - return false; - } - - private boolean jj_3_27() { - if (jj_scan_token(NUMBER)) - return true; - return false; - } - - private boolean jj_3R_27() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(WITHIN)) - return true; - return false; - } - - private boolean jj_3_26() { - if (jj_scan_token(NUMBER)) - return true; - return false; - } - - private boolean jj_3R_46() { - if (jj_scan_token(RANGEIN_START)) - return true; - return false; - } - - private boolean jj_3R_15() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(ORDERED)) - return true; - return false; - } - - private boolean jj_3R_32() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(FUZZYTERM)) - return true; - return false; - } - - private boolean jj_3R_42() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_46()) { - jj_scanpos = xsp; - if (jj_scan_token(28)) - return true; - } - xsp = jj_scanpos; - if (jj_scan_token(55)) { - jj_scanpos = xsp; - if (jj_scan_token(54)) { - jj_scanpos = xsp; - if (jj_scan_token(51)) - return true; - } - } - return false; - } - - private boolean jj_3R_26() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(NOT_CONTAINED_BY)) - return true; - return false; - } - - /** - * Generated Token Manager. - */ - public ZuliaSyntaxParserTokenManager token_source; - /** - * Current token. - */ - public Token token; - /** - * Next token. - */ - public Token jj_nt; - private int jj_ntk; - private Token jj_scanpos, jj_lastpos; - private int jj_la; - private int jj_gen; - final private int[] jj_la1 = new int[35]; - static private int[] jj_la1_0; - static private int[] jj_la1_1; - - static { - jj_la1_init_0(); - jj_la1_init_1(); - } - - private static void jj_la1_init_0() { - jj_la1_0 = new int[] { 0x3f803c00, 0x200, 0x100, 0x2400, 0x3400, 0x3400, 0x18000, 0x23800800, 0x3f800800, 0x200000, 0x400000, 0x400000, 0x3800800, - 0x3800800, 0x3800800, 0x3800800, 0x3800800, 0x3000000, 0x3800000, 0x1000000, 0x3000000, 0x3800000, 0x3000000, 0x3800000, 0x1e0000, 0x3800000, - 0x3000000, 0x400000, 0x1f800000, 0x200000, 0x400000, 0x18000000, 0x0, 0x0, 0x0, }; - } - - private static void jj_la1_init_1() { - jj_la1_1 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000000, 0x1000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc80000, 0xc80000, 0x300000, }; - } - - final private JJCalls[] jj_2_rtns = new JJCalls[28]; - private boolean jj_rescan = false; - private int jj_gc = 0; - - /** - * Constructor with user supplied CharStream. - */ - public ZuliaSyntaxParser(CharStream stream) { - token_source = new ZuliaSyntaxParserTokenManager(stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 35; i++) - jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) - jj_2_rtns[i] = new JJCalls(); - } - - /** - * Reinitialise. - */ - public void ReInit(CharStream stream) { - token_source.ReInit(stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 35; i++) - jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) - jj_2_rtns[i] = new JJCalls(); - } - - /** - * Constructor with generated Token Manager. - */ - public ZuliaSyntaxParser(ZuliaSyntaxParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 35; i++) - jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) - jj_2_rtns[i] = new JJCalls(); - } - - /** - * Reinitialise. - */ - public void ReInit(ZuliaSyntaxParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 35; i++) - jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) - jj_2_rtns[i] = new JJCalls(); - } - - private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) - token = token.next; - else - token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - if (++jj_gc > 100) { - jj_gc = 0; - for (int i = 0; i < jj_2_rtns.length; i++) { - JJCalls c = jj_2_rtns[i]; - while (c != null) { - if (c.gen < jj_gen) - c.first = null; - c = c.next; - } - } - } - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - @SuppressWarnings("serial") - static private final class LookaheadSuccess extends java.lang.Error { - } - - final private LookaheadSuccess jj_ls = new LookaheadSuccess(); - - private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } - else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } - else { - jj_scanpos = jj_scanpos.next; - } - if (jj_rescan) { - int i = 0; - Token tok = token; - while (tok != null && tok != jj_scanpos) { - i++; - tok = tok.next; - } - if (tok != null) - jj_add_error_token(kind, i); - } - if (jj_scanpos.kind != kind) - return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) - throw jj_ls; - return false; - } - - /** - * Get the next Token. - */ - final public Token getNextToken() { - if (token.next != null) - token = token.next; - else - token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; - } - - /** - * Get the specific Token. - */ - final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) - t = t.next; - else - t = t.next = token_source.getNextToken(); - } - return t; - } - - private int jj_ntk_f() { - if ((jj_nt = token.next) == null) - return (jj_ntk = (token.next = token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); - } - - private java.util.List jj_expentries = new java.util.ArrayList<>(); - private int[] jj_expentry; - private int jj_kind = -1; - private int[] jj_lasttokens = new int[100]; - private int jj_endpos; - - private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) { - return; - } - - if (pos == jj_endpos + 1) { - jj_lasttokens[jj_endpos++] = kind; - } - else if (jj_endpos != 0) { - jj_expentry = new int[jj_endpos]; - - for (int i = 0; i < jj_endpos; i++) { - jj_expentry[i] = jj_lasttokens[i]; - } - - for (int[] oldentry : jj_expentries) { - if (oldentry.length == jj_expentry.length) { - boolean isMatched = true; - - for (int i = 0; i < jj_expentry.length; i++) { - if (oldentry[i] != jj_expentry[i]) { - isMatched = false; - break; - } - - } - if (isMatched) { - jj_expentries.add(jj_expentry); - break; - } - } - } - - if (pos != 0) { - jj_lasttokens[(jj_endpos = pos) - 1] = kind; - } - } - } - - /** - * Generate ParseException. - */ - public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[57]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 35; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1 << j)) != 0) { - la1tokens[j] = true; - } - if ((jj_la1_1[i] & (1 << j)) != 0) { - la1tokens[32 + j] = true; - } - } - } - } - for (int i = 0; i < 57; i++) { - if (la1tokens[i]) { - jj_expentry = new int[1]; - jj_expentry[0] = i; - jj_expentries.add(jj_expentry); - } - } - jj_endpos = 0; - jj_rescan_token(); - jj_add_error_token(0, 0); - int[][] exptokseq = new int[jj_expentries.size()][]; - for (int i = 0; i < jj_expentries.size(); i++) { - exptokseq[i] = jj_expentries.get(i); - } - return new ParseException(token, exptokseq, tokenImage); - } - - private int trace_indent = 0; - private boolean trace_enabled; - - /** - * Trace enabled. - */ - final public boolean trace_enabled() { - return trace_enabled; - } - - /** - * Enable tracing. - */ - final public void enable_tracing() { - } - - /** - * Disable tracing. - */ - final public void disable_tracing() { - } - - private void jj_rescan_token() { - jj_rescan = true; - for (int i = 0; i < 28; i++) { - try { - JJCalls p = jj_2_rtns[i]; - - do { - if (p.gen > jj_gen) { - jj_la = p.arg; - jj_lastpos = jj_scanpos = p.first; - switch (i) { - case 0: - jj_3_1(); - break; - case 1: - jj_3_2(); - break; - case 2: - jj_3_3(); - break; - case 3: - jj_3_4(); - break; - case 4: - jj_3_5(); - break; - case 5: - jj_3_6(); - break; - case 6: - jj_3_7(); - break; - case 7: - jj_3_8(); - break; - case 8: - jj_3_9(); - break; - case 9: - jj_3_10(); - break; - case 10: - jj_3_11(); - break; - case 11: - jj_3_12(); - break; - case 12: - jj_3_13(); - break; - case 13: - jj_3_14(); - break; - case 14: - jj_3_15(); - break; - case 15: - jj_3_16(); - break; - case 16: - jj_3_17(); - break; - case 17: - jj_3_18(); - break; - case 18: - jj_3_19(); - break; - case 19: - jj_3_20(); - break; - case 20: - jj_3_21(); - break; - case 21: - jj_3_22(); - break; - case 22: - jj_3_23(); - break; - case 23: - jj_3_24(); - break; - case 24: - jj_3_25(); - break; - case 25: - jj_3_26(); - break; - case 26: - jj_3_27(); - break; - case 27: - jj_3_28(); - break; - } - } - p = p.next; - } - while (p != null); - - } - catch (LookaheadSuccess ls) { - } - } - jj_rescan = false; - } - - private void jj_save(int index, int xla) { - JJCalls p = jj_2_rtns[index]; - while (p.gen > jj_gen) { - if (p.next == null) { - p = p.next = new JJCalls(); - break; - } - p = p.next; - } - - p.gen = jj_gen + xla - jj_la; - p.first = token; - p.arg = xla; - } - - static final class JJCalls { - int gen; - Token first; - int arg; - JJCalls next; - } + public ZuliaSyntaxParser() { + this(new FastCharStream(Reader.nullReader())); + } + + /** + * Parses a query string, returning a {@link org.apache.lucene.queryparser.flexible.core.nodes.QueryNode}. + * + * @param query the query string to be parsed. + * @throws ParseException if the parsing fails + */ + @Override + public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException { + ReInit(new FastCharStream(new StringReader(query.toString()))); + try { + return TopLevelQuery(field); + } + catch (ParseException tme) { + tme.setQuery(query); + throw tme; + } + catch (Error tme) { + Message message = new MessageImpl(QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, tme.getMessage()); + QueryNodeParseException e = new QueryNodeParseException(tme); + e.setQuery(query); + e.setNonLocalizedMessage(message); + throw e; + } + } + + public static float parseFloat(Token token) { + return Float.parseFloat(token.image); + } + + public static int parseInt(Token token) { + return Integer.parseInt(token.image); + } + + final public QueryNode TopLevelQuery(CharSequence field) throws ParseException { + QueryNode q; + q = Query(field); + jj_consume_token(0); + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode Query(CharSequence field) throws ParseException { + ArrayList clauses = new ArrayList<>(); + QueryNode node; + label_1: + while (true) { + node = DisjQuery(field); + clauses.add(node); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case NOT: + case FN_PREFIX: + case ZL_PREFIX: + case PLUS: + case MINUS: + case QUOTED: + case NUMBER: + case TERM: + case REGEXPTERM: + case RANGEIN_START: + case RANGEEX_START: + case LPAREN: { + ; + break; + } + default: + jj_la1[0] = jj_gen; + break label_1; + } + } + // Handle the case of a "pure" negation query which + // needs to be wrapped as a boolean query, otherwise + // the returned result drops the negation. + if (clauses.size() == 1) { + QueryNode first = clauses.get(0); + if (first instanceof ModifierQueryNode && ((ModifierQueryNode) first).getModifier() == ModifierQueryNode.Modifier.MOD_NOT) { + clauses.set(0, new BooleanQueryNode(Collections.singletonList(first))); + } + } + + { + if ("" != null) + return clauses.size() == 1 ? clauses.get(0) : new BooleanQueryNode(clauses); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode DisjQuery(CharSequence field) throws ParseException { + ArrayList clauses = new ArrayList<>(); + QueryNode node; + node = ConjQuery(field); + clauses.add(node); + label_2: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case OR: { + ; + break; + } + default: + jj_la1[1] = jj_gen; + break label_2; + } + jj_consume_token(OR); + node = ConjQuery(field); + clauses.add(node); + } + { + if ("" != null) + return clauses.size() == 1 ? clauses.get(0) : new OrQueryNode(clauses); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode ConjQuery(CharSequence field) throws ParseException { + ArrayList clauses = new ArrayList<>(); + QueryNode node; + node = ModClause(field); + clauses.add(node); + label_3: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case AND: { + ; + break; + } + default: + jj_la1[2] = jj_gen; + break label_3; + } + jj_consume_token(AND); + node = ModClause(field); + clauses.add(node); + } + { + if ("" != null) + return clauses.size() == 1 ? clauses.get(0) : new AndQueryNode(clauses); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode ModClause(CharSequence field) throws ParseException { + QueryNode q; + ModifierQueryNode.Modifier modifier = ModifierQueryNode.Modifier.MOD_NONE; + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case NOT: + case PLUS: + case MINUS: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case PLUS: { + jj_consume_token(PLUS); + modifier = ModifierQueryNode.Modifier.MOD_REQ; + break; + } + case NOT: + case MINUS: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case MINUS: { + jj_consume_token(MINUS); + break; + } + case NOT: { + jj_consume_token(NOT); + break; + } + default: + jj_la1[3] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + modifier = ModifierQueryNode.Modifier.MOD_NOT; + break; + } + default: + jj_la1[4] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + } + default: + jj_la1[5] = jj_gen; + ; + } + q = Clause(field); + if (modifier != ModifierQueryNode.Modifier.MOD_NONE) { + q = new ModifierQueryNode(q, modifier); + } + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode Clause(CharSequence field) throws ParseException { + QueryNode q; + if (jj_2_3(2)) { + q = FieldRangeExpr(field); + } + else { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case ZL_PREFIX: + case QUOTED: + case NUMBER: + case TERM: + case REGEXPTERM: + case RANGEIN_START: + case RANGEEX_START: + case LPAREN: { + if (jj_2_1(2)) { + field = FieldName(); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case OP_COLON: { + jj_consume_token(OP_COLON); + break; + } + case OP_EQUAL: { + jj_consume_token(OP_EQUAL); + break; + } + default: + jj_la1[6] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + else { + ; + } + if (jj_2_2(2)) { + q = Term(field); + } + else { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case LPAREN: { + q = GroupingExpr(field); + break; + } + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + q = IntervalExpr(field); + break; + } + case ZL_PREFIX: { + q = ZuliaExpr(field); + break; + } + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + break; + } + default: + jj_la1[8] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private CharSequence FieldName() throws ParseException { + Token name; + name = jj_consume_token(TERM); + { + if ("" != null) + return discardEscapeChar(name.image); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode GroupingExpr(CharSequence field) throws ParseException { + QueryNode q; + Token boost, minShouldMatch = null; + jj_consume_token(LPAREN); + q = Query(field); + jj_consume_token(RPAREN); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case CARAT: { + q = Boost(q); + break; + } + default: + jj_la1[9] = jj_gen; + ; + } + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TILDE: + case 59: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TILDE: { + jj_consume_token(TILDE); + break; + } + case 59: { + jj_consume_token(59); + break; + } + default: + jj_la1[10] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + minShouldMatch = jj_consume_token(NUMBER); + break; + } + default: + jj_la1[11] = jj_gen; + ; + } + if (minShouldMatch != null) { + q = new MinShouldMatchNode(parseInt(minShouldMatch), new GroupQueryNode(q)); + } + else { + q = new GroupQueryNode(q); + } + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private ZuliaFieldableQueryNode ZuliaExpr(CharSequence field) throws ParseException { + ZuliaFieldableQueryNode source; + if (jj_2_4(2)) { + source = NumericsSetQuery(field); + { + if ("" != null) + return source; + } + } + else if (jj_2_5(2)) { + source = TermsInSetQuery(field); + { + if ("" != null) + return source; + } + } + else { + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final private ZuliaNumericSetQueryNode NumericsSetQuery(CharSequence field) throws ParseException { + CharSequence value; + ArrayList values = new ArrayList(); + jj_consume_token(ZL_PREFIX); + jj_consume_token(NUMERIC_SET); + jj_consume_token(LPAREN); + label_4: + while (true) { + value = TermText(); + values.add(value); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[12] = jj_gen; + break label_4; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new ZuliaNumericSetQueryNode(field, values); + } + throw new Error("Missing return statement in function"); + } + + final private ZuliaTermsInSetQueryNode TermsInSetQuery(CharSequence field) throws ParseException { + CharSequence value; + ArrayList values = new ArrayList(); + jj_consume_token(ZL_PREFIX); + jj_consume_token(TERM_SET); + jj_consume_token(LPAREN); + label_5: + while (true) { + value = TermText(); + values.add(value); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[13] = jj_gen; + break label_5; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new ZuliaTermsInSetQueryNode(field, values); + } + throw new Error("Missing return statement in function"); + } + + final private CharSequence TermText() throws ParseException { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case QUOTED: { + jj_consume_token(QUOTED); + { + if ("" != null) + return token.image.substring(1, token.image.length() - 1); + } + break; + } + case NUMBER: + case TERM: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + jj_consume_token(TERM); + break; + } + case NUMBER: { + jj_consume_token(NUMBER); + break; + } + default: + jj_la1[14] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + { + if ("" != null) + return token.image; + } + break; + } + default: + jj_la1[15] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalQueryNode IntervalExpr(CharSequence field) throws ParseException { + IntervalFunction source; + source = IntervalFun(); + { + if ("" != null) + return new IntervalQueryNode(field == null ? null : field.toString(), source); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalFun() throws ParseException { + IntervalFunction source; + if (jj_2_6(2)) { + source = IntervalAtLeast(); + { + if ("" != null) + return source; + } + } + else if (jj_2_7(2)) { + source = IntervalMaxWidth(); + { + if ("" != null) + return source; + } + } + else if (jj_2_8(2)) { + source = IntervalMaxGaps(); + { + if ("" != null) + return source; + } + } + else if (jj_2_9(2)) { + source = IntervalOrdered(); + { + if ("" != null) + return source; + } + } + else if (jj_2_10(2)) { + source = IntervalUnordered(); + { + if ("" != null) + return source; + } + } + else if (jj_2_11(2)) { + source = IntervalUnorderedNoOverlaps(); + { + if ("" != null) + return source; + } + } + else if (jj_2_12(2)) { + source = IntervalOr(); + { + if ("" != null) + return source; + } + } + else if (jj_2_13(2)) { + source = IntervalWildcard(); + { + if ("" != null) + return source; + } + } + else if (jj_2_14(2)) { + source = IntervalAfter(); + { + if ("" != null) + return source; + } + } + else if (jj_2_15(2)) { + source = IntervalBefore(); + { + if ("" != null) + return source; + } + } + else if (jj_2_16(2)) { + source = IntervalPhrase(); + { + if ("" != null) + return source; + } + } + else if (jj_2_17(2)) { + source = IntervalContaining(); + { + if ("" != null) + return source; + } + } + else if (jj_2_18(2)) { + source = IntervalNotContaining(); + { + if ("" != null) + return source; + } + } + else if (jj_2_19(2)) { + source = IntervalContainedBy(); + { + if ("" != null) + return source; + } + } + else if (jj_2_20(2)) { + source = IntervalNotContainedBy(); + { + if ("" != null) + return source; + } + } + else if (jj_2_21(2)) { + source = IntervalWithin(); + { + if ("" != null) + return source; + } + } + else if (jj_2_22(2)) { + source = IntervalNotWithin(); + { + if ("" != null) + return source; + } + } + else if (jj_2_23(2)) { + source = IntervalOverlapping(); + { + if ("" != null) + return source; + } + } + else if (jj_2_24(2)) { + source = IntervalNonOverlapping(); + { + if ("" != null) + return source; + } + } + else if (jj_2_25(2)) { + source = IntervalExtend(); + { + if ("" != null) + return source; + } + } + else if (jj_2_26(2)) { + source = IntervalFuzzyTerm(); + { + if ("" != null) + return source; + } + } + else if (jj_2_27(2)) { + source = IntervalText(); + { + if ("" != null) + return source; + } + } + else { + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalAtLeast() throws ParseException { + IntervalFunction source; + ArrayList sources = new ArrayList(); + Token minShouldMatch; + jj_consume_token(FN_PREFIX); + jj_consume_token(ATLEAST); + jj_consume_token(LPAREN); + minShouldMatch = jj_consume_token(NUMBER); + label_6: + while (true) { + source = IntervalFun(); + sources.add(source); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[16] = jj_gen; + break label_6; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new AtLeast(parseInt(minShouldMatch), sources); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalMaxWidth() throws ParseException { + IntervalFunction source; + Token maxWidth; + jj_consume_token(FN_PREFIX); + jj_consume_token(MAXWIDTH); + jj_consume_token(LPAREN); + maxWidth = jj_consume_token(NUMBER); + source = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new MaxWidth(parseInt(maxWidth), source); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalMaxGaps() throws ParseException { + IntervalFunction source; + Token maxGaps; + jj_consume_token(FN_PREFIX); + jj_consume_token(MAXGAPS); + jj_consume_token(LPAREN); + maxGaps = jj_consume_token(NUMBER); + source = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new MaxGaps(parseInt(maxGaps), source); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalUnordered() throws ParseException { + IntervalFunction source; + ArrayList sources = new ArrayList(); + jj_consume_token(FN_PREFIX); + jj_consume_token(UNORDERED); + jj_consume_token(LPAREN); + label_7: + while (true) { + source = IntervalFun(); + sources.add(source); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[17] = jj_gen; + break label_7; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new Unordered(sources); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalUnorderedNoOverlaps() throws ParseException { + IntervalFunction a, b; + jj_consume_token(FN_PREFIX); + jj_consume_token(UNORDERED_NO_OVERLAPS); + jj_consume_token(LPAREN); + a = IntervalFun(); + b = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new UnorderedNoOverlaps(a, b); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalOrdered() throws ParseException { + IntervalFunction source; + ArrayList sources = new ArrayList(); + jj_consume_token(FN_PREFIX); + jj_consume_token(ORDERED); + jj_consume_token(LPAREN); + label_8: + while (true) { + source = IntervalFun(); + sources.add(source); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[18] = jj_gen; + break label_8; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new Ordered(sources); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalOr() throws ParseException { + IntervalFunction source; + ArrayList sources = new ArrayList(); + jj_consume_token(FN_PREFIX); + jj_consume_token(FN_OR); + jj_consume_token(LPAREN); + label_9: + while (true) { + source = IntervalFun(); + sources.add(source); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[19] = jj_gen; + break label_9; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new Or(sources); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalPhrase() throws ParseException { + IntervalFunction source; + ArrayList sources = new ArrayList(); + jj_consume_token(FN_PREFIX); + jj_consume_token(PHRASE); + jj_consume_token(LPAREN); + label_10: + while (true) { + source = IntervalFun(); + sources.add(source); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[20] = jj_gen; + break label_10; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new Phrase(sources); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalBefore() throws ParseException { + IntervalFunction source; + IntervalFunction reference; + jj_consume_token(FN_PREFIX); + jj_consume_token(BEFORE); + jj_consume_token(LPAREN); + source = IntervalFun(); + reference = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new Before(source, reference); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalAfter() throws ParseException { + IntervalFunction source; + IntervalFunction reference; + jj_consume_token(FN_PREFIX); + jj_consume_token(AFTER); + jj_consume_token(LPAREN); + source = IntervalFun(); + reference = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new After(source, reference); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalContaining() throws ParseException { + IntervalFunction big; + IntervalFunction small; + jj_consume_token(FN_PREFIX); + jj_consume_token(CONTAINING); + jj_consume_token(LPAREN); + big = IntervalFun(); + small = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new Containing(big, small); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalNotContaining() throws ParseException { + IntervalFunction minuend; + IntervalFunction subtrahend; + jj_consume_token(FN_PREFIX); + jj_consume_token(NOT_CONTAINING); + jj_consume_token(LPAREN); + minuend = IntervalFun(); + subtrahend = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new NotContaining(minuend, subtrahend); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalContainedBy() throws ParseException { + IntervalFunction big; + IntervalFunction small; + jj_consume_token(FN_PREFIX); + jj_consume_token(CONTAINED_BY); + jj_consume_token(LPAREN); + small = IntervalFun(); + big = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new ContainedBy(small, big); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalNotContainedBy() throws ParseException { + IntervalFunction big; + IntervalFunction small; + jj_consume_token(FN_PREFIX); + jj_consume_token(NOT_CONTAINED_BY); + jj_consume_token(LPAREN); + small = IntervalFun(); + big = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new NotContainedBy(small, big); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalWithin() throws ParseException { + IntervalFunction source, reference; + Token positions; + jj_consume_token(FN_PREFIX); + jj_consume_token(WITHIN); + jj_consume_token(LPAREN); + source = IntervalFun(); + positions = jj_consume_token(NUMBER); + reference = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new Within(source, parseInt(positions), reference); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalExtend() throws ParseException { + IntervalFunction source; + Token before, after; + jj_consume_token(FN_PREFIX); + jj_consume_token(EXTEND); + jj_consume_token(LPAREN); + source = IntervalFun(); + before = jj_consume_token(NUMBER); + after = jj_consume_token(NUMBER); + jj_consume_token(RPAREN); + { + if ("" != null) + return new Extend(source, parseInt(before), parseInt(after)); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalNotWithin() throws ParseException { + IntervalFunction minuend, subtrahend; + Token positions; + jj_consume_token(FN_PREFIX); + jj_consume_token(NOT_WITHIN); + jj_consume_token(LPAREN); + minuend = IntervalFun(); + positions = jj_consume_token(NUMBER); + subtrahend = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new NotWithin(minuend, parseInt(positions), subtrahend); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalOverlapping() throws ParseException { + IntervalFunction source, reference; + jj_consume_token(FN_PREFIX); + jj_consume_token(OVERLAPPING); + jj_consume_token(LPAREN); + source = IntervalFun(); + reference = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new Overlapping(source, reference); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalNonOverlapping() throws ParseException { + IntervalFunction minuend, subtrahend; + jj_consume_token(FN_PREFIX); + jj_consume_token(NON_OVERLAPPING); + jj_consume_token(LPAREN); + minuend = IntervalFun(); + subtrahend = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new NonOverlapping(minuend, subtrahend); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalWildcard() throws ParseException { + String wildcard; + Token maxExpansions = null; + jj_consume_token(FN_PREFIX); + jj_consume_token(WILDCARD); + jj_consume_token(LPAREN); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case NUMBER: + case TERM: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + jj_consume_token(TERM); + break; + } + case NUMBER: { + jj_consume_token(NUMBER); + break; + } + default: + jj_la1[21] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + wildcard = token.image; + break; + } + case QUOTED: { + jj_consume_token(QUOTED); + wildcard = token.image.substring(1, token.image.length() - 1); + break; + } + default: + jj_la1[22] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case NUMBER: { + maxExpansions = jj_consume_token(NUMBER); + break; + } + default: + jj_la1[23] = jj_gen; + ; + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new Wildcard(wildcard, maxExpansions == null ? 0 : parseInt(maxExpansions)); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalFuzzyTerm() throws ParseException { + String term; + Token maxEdits = null; + Token maxExpansions = null; + jj_consume_token(FN_PREFIX); + jj_consume_token(FUZZYTERM); + jj_consume_token(LPAREN); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case NUMBER: + case TERM: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + jj_consume_token(TERM); + break; + } + case NUMBER: { + jj_consume_token(NUMBER); + break; + } + default: + jj_la1[24] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + term = token.image; + break; + } + case QUOTED: { + jj_consume_token(QUOTED); + term = token.image.substring(1, token.image.length() - 1); + break; + } + default: + jj_la1[25] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if (jj_2_28(2)) { + maxEdits = jj_consume_token(NUMBER); + } + else { + ; + } + if (jj_2_29(2)) { + maxExpansions = jj_consume_token(NUMBER); + } + else { + ; + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new FuzzyTerm(term, maxEdits == null ? null : parseInt(maxEdits), maxExpansions == null ? null : parseInt(maxExpansions)); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalText() throws ParseException { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case QUOTED: { + jj_consume_token(QUOTED); + { + if ("" != null) + return new AnalyzedText(token.image.substring(1, token.image.length() - 1)); + } + break; + } + case NUMBER: + case TERM: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + jj_consume_token(TERM); + break; + } + case NUMBER: { + jj_consume_token(NUMBER); + break; + } + default: + jj_la1[26] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + { + if ("" != null) + return new AnalyzedText(token.image); + } + break; + } + default: + jj_la1[27] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode Boost(QueryNode node) throws ParseException { + Token boost; + jj_consume_token(CARAT); + boost = jj_consume_token(NUMBER); + { + if ("" != null) + return node == null ? node : new BoostQueryNode(node, parseFloat(boost)); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode FuzzyOp(CharSequence field, Token term, QueryNode node) throws ParseException { + Token similarity = null; + jj_consume_token(TILDE); + if (jj_2_30(2)) { + similarity = jj_consume_token(NUMBER); + } + else { + ; + } + float fms = org.apache.lucene.search.FuzzyQuery.defaultMaxEdits; + if (similarity != null) { + fms = parseFloat(similarity); + if (fms < 0.0f) { + { + if (true) + throw new ParseException(new MessageImpl(QueryParserMessages.INVALID_SYNTAX_FUZZY_LIMITS)); + } + } + else if (fms >= 1.0f && fms != (int) fms) { + { + if (true) + throw new ParseException(new MessageImpl(QueryParserMessages.INVALID_SYNTAX_FUZZY_EDITS)); + } + } + } + { + if ("" != null) + return new FuzzyQueryNode(field, discardEscapeChar(term.image), fms, term.beginColumn, term.endColumn); + } + throw new Error("Missing return statement in function"); + } + + final private TermRangeQueryNode FieldRangeExpr(CharSequence field) throws ParseException { + Token operator, term; + FieldQueryNode qLower, qUpper; + boolean lowerInclusive, upperInclusive; + field = FieldName(); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case OP_LESSTHAN: { + jj_consume_token(OP_LESSTHAN); + break; + } + case OP_LESSTHANEQ: { + jj_consume_token(OP_LESSTHANEQ); + break; + } + case OP_MORETHAN: { + jj_consume_token(OP_MORETHAN); + break; + } + case OP_MORETHANEQ: { + jj_consume_token(OP_MORETHANEQ); + break; + } + default: + jj_la1[28] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + operator = token; + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + jj_consume_token(TERM); + break; + } + case QUOTED: { + jj_consume_token(QUOTED); + break; + } + case NUMBER: { + jj_consume_token(NUMBER); + break; + } + default: + jj_la1[29] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + term = token; + if (term.kind == QUOTED) { + term.image = term.image.substring(1, term.image.length() - 1); + } + switch (operator.kind) { + case OP_LESSTHAN: + lowerInclusive = true; + upperInclusive = false; + qLower = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); + qUpper = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); + break; + case OP_LESSTHANEQ: + lowerInclusive = true; + upperInclusive = true; + qLower = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); + qUpper = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); + break; + case OP_MORETHAN: + lowerInclusive = false; + upperInclusive = true; + qLower = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); + qUpper = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); + break; + case OP_MORETHANEQ: + lowerInclusive = true; + upperInclusive = true; + qLower = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); + qUpper = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); + break; + default: { + if (true) + throw new Error("Unhandled case, operator=" + operator); + } + } + { + if ("" != null) + return new TermRangeQueryNode(qLower, qUpper, lowerInclusive, upperInclusive); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode Term(CharSequence field) throws ParseException { + QueryNode q; + Token term, fuzzySlop = null; + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case REGEXPTERM: { + term = jj_consume_token(REGEXPTERM); + String v = term.image.substring(1, term.image.length() - 1); + q = new RegexpQueryNode(field, v, 0, v.length()); + break; + } + case NUMBER: + case TERM: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + term = jj_consume_token(TERM); + break; + } + case NUMBER: { + term = jj_consume_token(NUMBER); + break; + } + default: + jj_la1[30] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + q = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TILDE: { + q = FuzzyOp(field, term, q); + break; + } + default: + jj_la1[31] = jj_gen; + ; + } + break; + } + case RANGEIN_START: + case RANGEEX_START: { + q = TermRangeExpr(field); + break; + } + case QUOTED: { + q = QuotedTerm(field); + break; + } + default: + jj_la1[32] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case CARAT: { + q = Boost(q); + break; + } + default: + jj_la1[33] = jj_gen; + ; + } + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode QuotedTerm(CharSequence field) throws ParseException { + QueryNode q; + Token term, slop; + term = jj_consume_token(QUOTED); + String image = term.image.substring(1, term.image.length() - 1); + q = new QuotedFieldQueryNode(field, discardEscapeChar(image), term.beginColumn + 1, term.endColumn - 1); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TILDE: { + jj_consume_token(TILDE); + slop = jj_consume_token(NUMBER); + q = new SlopQueryNode(q, parseInt(slop)); + break; + } + default: + jj_la1[34] = jj_gen; + ; + } + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private TermRangeQueryNode TermRangeExpr(CharSequence field) throws ParseException { + Token left, right; + boolean leftInclusive = false; + boolean rightInclusive = false; + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case RANGEIN_START: { + jj_consume_token(RANGEIN_START); + leftInclusive = true; + break; + } + case RANGEEX_START: { + jj_consume_token(RANGEEX_START); + break; + } + default: + jj_la1[35] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case RANGE_GOOP: { + jj_consume_token(RANGE_GOOP); + break; + } + case RANGE_QUOTED: { + jj_consume_token(RANGE_QUOTED); + break; + } + case RANGE_TO: { + jj_consume_token(RANGE_TO); + break; + } + default: + jj_la1[36] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + left = token; + jj_consume_token(RANGE_TO); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case RANGE_GOOP: { + jj_consume_token(RANGE_GOOP); + break; + } + case RANGE_QUOTED: { + jj_consume_token(RANGE_QUOTED); + break; + } + case RANGE_TO: { + jj_consume_token(RANGE_TO); + break; + } + default: + jj_la1[37] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + right = token; + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case RANGEIN_END: { + jj_consume_token(RANGEIN_END); + rightInclusive = true; + break; + } + case RANGEEX_END: { + jj_consume_token(RANGEEX_END); + break; + } + default: + jj_la1[38] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if (left.kind == RANGE_QUOTED) { + left.image = left.image.substring(1, left.image.length() - 1); + } + if (right.kind == RANGE_QUOTED) { + right.image = right.image.substring(1, right.image.length() - 1); + } + + FieldQueryNode qLower = new FieldQueryNode(field, discardEscapeChar(left.image), left.beginColumn, left.endColumn); + FieldQueryNode qUpper = new FieldQueryNode(field, discardEscapeChar(right.image), right.beginColumn, right.endColumn); + + { + if ("" != null) + return new TermRangeQueryNode(qLower, qUpper, leftInclusive, rightInclusive); + } + throw new Error("Missing return statement in function"); + } + + private boolean jj_2_1(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_1()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(0, xla); + } + } + + private boolean jj_2_2(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_2()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(1, xla); + } + } + + private boolean jj_2_3(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_3()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(2, xla); + } + } + + private boolean jj_2_4(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_4()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(3, xla); + } + } + + private boolean jj_2_5(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_5()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(4, xla); + } + } + + private boolean jj_2_6(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_6()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(5, xla); + } + } + + private boolean jj_2_7(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_7()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(6, xla); + } + } + + private boolean jj_2_8(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_8()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(7, xla); + } + } + + private boolean jj_2_9(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_9()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(8, xla); + } + } + + private boolean jj_2_10(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_10()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(9, xla); + } + } + + private boolean jj_2_11(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_11()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(10, xla); + } + } + + private boolean jj_2_12(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_12()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(11, xla); + } + } + + private boolean jj_2_13(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_13()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(12, xla); + } + } + + private boolean jj_2_14(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_14()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(13, xla); + } + } + + private boolean jj_2_15(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_15()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(14, xla); + } + } + + private boolean jj_2_16(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_16()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(15, xla); + } + } + + private boolean jj_2_17(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_17()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(16, xla); + } + } + + private boolean jj_2_18(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_18()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(17, xla); + } + } + + private boolean jj_2_19(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_19()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(18, xla); + } + } + + private boolean jj_2_20(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_20()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(19, xla); + } + } + + private boolean jj_2_21(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_21()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(20, xla); + } + } + + private boolean jj_2_22(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_22()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(21, xla); + } + } + + private boolean jj_2_23(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_23()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(22, xla); + } + } + + private boolean jj_2_24(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_24()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(23, xla); + } + } + + private boolean jj_2_25(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_25()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(24, xla); + } + } + + private boolean jj_2_26(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_26()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(25, xla); + } + } + + private boolean jj_2_27(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_27()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(26, xla); + } + } + + private boolean jj_2_28(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_28()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(27, xla); + } + } + + private boolean jj_2_29(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_29()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(28, xla); + } + } + + private boolean jj_2_30(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_30()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(29, xla); + } + } + + private boolean jj_3R_32() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(NOT_WITHIN)) + return true; + return false; + } + + private boolean jj_3R_25() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(BEFORE)) + return true; + return false; + } + + private boolean jj_3R_16() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(ATLEAST)) + return true; + return false; + } + + private boolean jj_3R_12() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_38()) { + jj_scanpos = xsp; + if (jj_3R_39()) { + jj_scanpos = xsp; + if (jj_3R_40()) { + jj_scanpos = xsp; + if (jj_3R_41()) + return true; + } + } + } + xsp = jj_scanpos; + if (jj_3R_42()) + jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_48() { + if (jj_scan_token(CARAT)) + return true; + return false; + } + + private boolean jj_3_27() { + if (jj_3R_37()) + return true; + return false; + } + + private boolean jj_3_26() { + if (jj_3R_36()) + return true; + return false; + } + + private boolean jj_3_25() { + if (jj_3R_35()) + return true; + return false; + } + + private boolean jj_3_24() { + if (jj_3R_34()) + return true; + return false; + } + + private boolean jj_3_23() { + if (jj_3R_33()) + return true; + return false; + } + + private boolean jj_3R_26() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(PHRASE)) + return true; + return false; + } + + private boolean jj_3_22() { + if (jj_3R_32()) + return true; + return false; + } + + private boolean jj_3R_35() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(EXTEND)) + return true; + return false; + } + + private boolean jj_3_21() { + if (jj_3R_31()) + return true; + return false; + } + + private boolean jj_3_20() { + if (jj_3R_30()) + return true; + return false; + } + + private boolean jj_3R_44() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(26)) { + jj_scanpos = xsp; + if (jj_scan_token(25)) + return true; + } + return false; + } + + private boolean jj_3_19() { + if (jj_3R_29()) + return true; + return false; + } + + private boolean jj_3R_43() { + if (jj_scan_token(QUOTED)) + return true; + return false; + } + + private boolean jj_3R_37() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_43()) { + jj_scanpos = xsp; + if (jj_3R_44()) + return true; + } + return false; + } + + private boolean jj_3_18() { + if (jj_3R_28()) + return true; + return false; + } + + private boolean jj_3_17() { + if (jj_3R_27()) + return true; + return false; + } + + private boolean jj_3_16() { + if (jj_3R_26()) + return true; + return false; + } + + private boolean jj_3_15() { + if (jj_3R_25()) + return true; + return false; + } + + private boolean jj_3R_11() { + if (jj_scan_token(TERM)) + return true; + return false; + } + + private boolean jj_3_14() { + if (jj_3R_24()) + return true; + return false; + } + + private boolean jj_3_13() { + if (jj_3R_23()) + return true; + return false; + } + + private boolean jj_3_12() { + if (jj_3R_22()) + return true; + return false; + } + + private boolean jj_3_11() { + if (jj_3R_21()) + return true; + return false; + } + + private boolean jj_3R_22() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(FN_OR)) + return true; + return false; + } + + private boolean jj_3_10() { + if (jj_3R_20()) + return true; + return false; + } + + private boolean jj_3_9() { + if (jj_3R_19()) + return true; + return false; + } + + private boolean jj_3_8() { + if (jj_3R_18()) + return true; + return false; + } + + private boolean jj_3_7() { + if (jj_3R_17()) + return true; + return false; + } + + private boolean jj_3_6() { + if (jj_3R_16()) + return true; + return false; + } + + private boolean jj_3_29() { + if (jj_scan_token(NUMBER)) + return true; + return false; + } + + private boolean jj_3R_31() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(WITHIN)) + return true; + return false; + } + + private boolean jj_3_2() { + if (jj_3R_12()) + return true; + return false; + } + + private boolean jj_3_28() { + if (jj_scan_token(NUMBER)) + return true; + return false; + } + + private boolean jj_3_1() { + if (jj_3R_11()) + return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(16)) { + jj_scanpos = xsp; + if (jj_scan_token(17)) + return true; + } + return false; + } + + private boolean jj_3_3() { + if (jj_3R_13()) + return true; + return false; + } + + private boolean jj_3R_50() { + if (jj_scan_token(RANGEIN_START)) + return true; + return false; + } + + private boolean jj_3R_19() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(ORDERED)) + return true; + return false; + } + + private boolean jj_3R_36() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(FUZZYTERM)) + return true; + return false; + } + + private boolean jj_3R_46() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_50()) { + jj_scanpos = xsp; + if (jj_scan_token(29)) + return true; + } + xsp = jj_scanpos; + if (jj_scan_token(58)) { + jj_scanpos = xsp; + if (jj_scan_token(57)) { + jj_scanpos = xsp; + if (jj_scan_token(54)) + return true; + } + } + return false; + } + + private boolean jj_3R_30() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(NOT_CONTAINED_BY)) + return true; + return false; + } + + private boolean jj_3R_21() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(UNORDERED_NO_OVERLAPS)) + return true; + return false; + } + + private boolean jj_3R_29() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(CONTAINED_BY)) + return true; + return false; + } + + private boolean jj_3R_13() { + if (jj_3R_11()) + return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(18)) { + jj_scanpos = xsp; + if (jj_scan_token(19)) { + jj_scanpos = xsp; + if (jj_scan_token(20)) { + jj_scanpos = xsp; + if (jj_scan_token(21)) + return true; + } + } + } + return false; + } + + private boolean jj_3R_23() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(WILDCARD)) + return true; + return false; + } + + private boolean jj_3R_51() { + if (jj_scan_token(TILDE)) + return true; + return false; + } + + private boolean jj_3R_20() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(UNORDERED)) + return true; + return false; + } + + private boolean jj_3R_28() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(NOT_CONTAINING)) + return true; + return false; + } + + private boolean jj_3R_15() { + if (jj_scan_token(ZL_PREFIX)) + return true; + if (jj_scan_token(TERM_SET)) + return true; + return false; + } + + private boolean jj_3R_47() { + if (jj_scan_token(QUOTED)) + return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_51()) + jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_34() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(NON_OVERLAPPING)) + return true; + return false; + } + + private boolean jj_3R_18() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(MAXGAPS)) + return true; + return false; + } + + private boolean jj_3_30() { + if (jj_scan_token(NUMBER)) + return true; + return false; + } + + private boolean jj_3R_27() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(CONTAINING)) + return true; + return false; + } + + private boolean jj_3R_14() { + if (jj_scan_token(ZL_PREFIX)) + return true; + if (jj_scan_token(NUMERIC_SET)) + return true; + return false; + } + + private boolean jj_3R_33() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(OVERLAPPING)) + return true; + return false; + } + + private boolean jj_3R_45() { + if (jj_3R_49()) + return true; + return false; + } + + private boolean jj_3R_41() { + if (jj_3R_47()) + return true; + return false; + } + + private boolean jj_3R_49() { + if (jj_scan_token(TILDE)) + return true; + return false; + } + + private boolean jj_3R_42() { + if (jj_3R_48()) + return true; + return false; + } + + private boolean jj_3R_40() { + if (jj_3R_46()) + return true; + return false; + } + + private boolean jj_3_5() { + if (jj_3R_15()) + return true; + return false; + } + + private boolean jj_3R_17() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(MAXWIDTH)) + return true; + return false; + } + + private boolean jj_3_4() { + if (jj_3R_14()) + return true; + return false; + } + + private boolean jj_3R_39() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(26)) { + jj_scanpos = xsp; + if (jj_scan_token(25)) + return true; + } + xsp = jj_scanpos; + if (jj_3R_45()) + jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_24() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(AFTER)) + return true; + return false; + } + + private boolean jj_3R_38() { + if (jj_scan_token(REGEXPTERM)) + return true; + return false; + } + + /** + * Generated Token Manager. + */ + public ZuliaSyntaxParserTokenManager token_source; + /** + * Current token. + */ + public Token token; + /** + * Next token. + */ + public Token jj_nt; + private int jj_ntk; + private Token jj_scanpos, jj_lastpos; + private int jj_la; + private int jj_gen; + final private int[] jj_la1 = new int[39]; + static private int[] jj_la1_0; + static private int[] jj_la1_1; + + static { + jj_la1_init_0(); + jj_la1_init_1(); + } + + private static void jj_la1_init_0() { + jj_la1_0 = new int[] { 0x7f007c00, 0x200, 0x100, 0x4400, 0x6400, 0x6400, 0x30000, 0x47001800, 0x7f001800, 0x400000, 0x800000, 0x800000, 0x7000000, + 0x7000000, 0x6000000, 0x7000000, 0x7000800, 0x7000800, 0x7000800, 0x7000800, 0x7000800, 0x6000000, 0x7000000, 0x2000000, 0x6000000, 0x7000000, + 0x6000000, 0x7000000, 0x3c0000, 0x7000000, 0x6000000, 0x800000, 0x3f000000, 0x400000, 0x800000, 0x30000000, 0x0, 0x0, 0x0, }; + } + + private static void jj_la1_init_1() { + jj_la1_1 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8000000, 0x8000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6400000, 0x6400000, 0x1800000, }; + } + + final private JJCalls[] jj_2_rtns = new JJCalls[30]; + private boolean jj_rescan = false; + private int jj_gc = 0; + + /** + * Constructor with user supplied CharStream. + */ + public ZuliaSyntaxParser(CharStream stream) { + token_source = new ZuliaSyntaxParserTokenManager(stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 39; i++) + jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) + jj_2_rtns[i] = new JJCalls(); + } + + /** + * Reinitialise. + */ + public void ReInit(CharStream stream) { + token_source.ReInit(stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 39; i++) + jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) + jj_2_rtns[i] = new JJCalls(); + } + + /** + * Constructor with generated Token Manager. + */ + public ZuliaSyntaxParser(ZuliaSyntaxParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 39; i++) + jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) + jj_2_rtns[i] = new JJCalls(); + } + + /** + * Reinitialise. + */ + public void ReInit(ZuliaSyntaxParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 39; i++) + jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) + jj_2_rtns[i] = new JJCalls(); + } + + private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) + token = token.next; + else + token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + if (++jj_gc > 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) + c.first = null; + c = c.next; + } + } + } + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + @SuppressWarnings("serial") + static private final class LookaheadSuccess extends java.lang.Error { + } + + final private LookaheadSuccess jj_ls = new LookaheadSuccess(); + + private boolean jj_scan_token(int kind) { + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } + else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } + else { + jj_scanpos = jj_scanpos.next; + } + if (jj_rescan) { + int i = 0; + Token tok = token; + while (tok != null && tok != jj_scanpos) { + i++; + tok = tok.next; + } + if (tok != null) + jj_add_error_token(kind, i); + } + if (jj_scanpos.kind != kind) + return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) + throw jj_ls; + return false; + } + + /** + * Get the next Token. + */ + final public Token getNextToken() { + if (token.next != null) + token = token.next; + else + token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + + /** + * Get the specific Token. + */ + final public Token getToken(int index) { + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) + t = t.next; + else + t = t.next = token_source.getNextToken(); + } + return t; + } + + private int jj_ntk_f() { + if ((jj_nt = token.next) == null) + return (jj_ntk = (token.next = token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.List jj_expentries = new java.util.ArrayList<>(); + private int[] jj_expentry; + private int jj_kind = -1; + private int[] jj_lasttokens = new int[100]; + private int jj_endpos; + + private void jj_add_error_token(int kind, int pos) { + if (pos >= 100) { + return; + } + + if (pos == jj_endpos + 1) { + jj_lasttokens[jj_endpos++] = kind; + } + else if (jj_endpos != 0) { + jj_expentry = new int[jj_endpos]; + + for (int i = 0; i < jj_endpos; i++) { + jj_expentry[i] = jj_lasttokens[i]; + } + + for (int[] oldentry : jj_expentries) { + if (oldentry.length == jj_expentry.length) { + boolean isMatched = true; + + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + isMatched = false; + break; + } + + } + if (isMatched) { + jj_expentries.add(jj_expentry); + break; + } + } + } + + if (pos != 0) { + jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } + } + } + + /** + * Generate ParseException. + */ + public ParseException generateParseException() { + jj_expentries.clear(); + boolean[] la1tokens = new boolean[60]; + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 39; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1 << j)) != 0) { + la1tokens[j] = true; + } + if ((jj_la1_1[i] & (1 << j)) != 0) { + la1tokens[32 + j] = true; + } + } + } + } + for (int i = 0; i < 60; i++) { + if (la1tokens[i]) { + jj_expentry = new int[1]; + jj_expentry[0] = i; + jj_expentries.add(jj_expentry); + } + } + jj_endpos = 0; + jj_rescan_token(); + jj_add_error_token(0, 0); + int[][] exptokseq = new int[jj_expentries.size()][]; + for (int i = 0; i < jj_expentries.size(); i++) { + exptokseq[i] = jj_expentries.get(i); + } + return new ParseException(token, exptokseq, tokenImage); + } + + private int trace_indent = 0; + private boolean trace_enabled; + + /** + * Trace enabled. + */ + final public boolean trace_enabled() { + return trace_enabled; + } + + /** + * Enable tracing. + */ + final public void enable_tracing() { + } + + /** + * Disable tracing. + */ + final public void disable_tracing() { + } + + private void jj_rescan_token() { + jj_rescan = true; + for (int i = 0; i < 30; i++) { + try { + JJCalls p = jj_2_rtns[i]; + + do { + if (p.gen > jj_gen) { + jj_la = p.arg; + jj_lastpos = jj_scanpos = p.first; + switch (i) { + case 0: + jj_3_1(); + break; + case 1: + jj_3_2(); + break; + case 2: + jj_3_3(); + break; + case 3: + jj_3_4(); + break; + case 4: + jj_3_5(); + break; + case 5: + jj_3_6(); + break; + case 6: + jj_3_7(); + break; + case 7: + jj_3_8(); + break; + case 8: + jj_3_9(); + break; + case 9: + jj_3_10(); + break; + case 10: + jj_3_11(); + break; + case 11: + jj_3_12(); + break; + case 12: + jj_3_13(); + break; + case 13: + jj_3_14(); + break; + case 14: + jj_3_15(); + break; + case 15: + jj_3_16(); + break; + case 16: + jj_3_17(); + break; + case 17: + jj_3_18(); + break; + case 18: + jj_3_19(); + break; + case 19: + jj_3_20(); + break; + case 20: + jj_3_21(); + break; + case 21: + jj_3_22(); + break; + case 22: + jj_3_23(); + break; + case 23: + jj_3_24(); + break; + case 24: + jj_3_25(); + break; + case 25: + jj_3_26(); + break; + case 26: + jj_3_27(); + break; + case 27: + jj_3_28(); + break; + case 28: + jj_3_29(); + break; + case 29: + jj_3_30(); + break; + } + } + p = p.next; + } + while (p != null); + + } + catch (LookaheadSuccess ls) { + } + } + jj_rescan = false; + } + + private void jj_save(int index, int xla) { + JJCalls p = jj_2_rtns[index]; + while (p.gen > jj_gen) { + if (p.next == null) { + p = p.next = new JJCalls(); + break; + } + p = p.next; + } + + p.gen = jj_gen + xla - jj_la; + p.first = token; + p.arg = xla; + } + + static final class JJCalls { + int gen; + Token first; + int arg; + JJCalls next; + } } diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserConstants.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserConstants.java index 48470ec2..2aa7be38 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserConstants.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserConstants.java @@ -7,248 +7,264 @@ */ public interface ZuliaSyntaxParserConstants { - /** - * End of File. - */ - int EOF = 0; - /** - * RegularExpression Id. - */ - int _NUM_CHAR = 1; - /** - * RegularExpression Id. - */ - int _ESCAPED_CHAR = 2; - /** - * RegularExpression Id. - */ - int _TERM_START_CHAR = 3; - /** - * RegularExpression Id. - */ - int _TERM_CHAR = 4; - /** - * RegularExpression Id. - */ - int _WHITESPACE = 5; - /** - * RegularExpression Id. - */ - int _QUOTED_CHAR = 6; - /** - * RegularExpression Id. - */ - int AND = 8; - /** - * RegularExpression Id. - */ - int OR = 9; - /** - * RegularExpression Id. - */ - int NOT = 10; - /** - * RegularExpression Id. - */ - int FN_PREFIX = 11; - /** - * RegularExpression Id. - */ - int PLUS = 12; - /** - * RegularExpression Id. - */ - int MINUS = 13; - /** - * RegularExpression Id. - */ - int RPAREN = 14; - /** - * RegularExpression Id. - */ - int OP_COLON = 15; - /** - * RegularExpression Id. - */ - int OP_EQUAL = 16; - /** - * RegularExpression Id. - */ - int OP_LESSTHAN = 17; - /** - * RegularExpression Id. - */ - int OP_LESSTHANEQ = 18; - /** - * RegularExpression Id. - */ - int OP_MORETHAN = 19; - /** - * RegularExpression Id. - */ - int OP_MORETHANEQ = 20; - /** - * RegularExpression Id. - */ - int CARAT = 21; - /** - * RegularExpression Id. - */ - int TILDE = 22; - /** - * RegularExpression Id. - */ - int QUOTED = 23; - /** - * RegularExpression Id. - */ - int NUMBER = 24; - /** - * RegularExpression Id. - */ - int TERM = 25; - /** - * RegularExpression Id. - */ - int REGEXPTERM = 26; - /** - * RegularExpression Id. - */ - int RANGEIN_START = 27; - /** - * RegularExpression Id. - */ - int RANGEEX_START = 28; - /** - * RegularExpression Id. - */ - int LPAREN = 29; - /** - * RegularExpression Id. - */ - int ATLEAST = 30; - /** - * RegularExpression Id. - */ - int AFTER = 31; - /** - * RegularExpression Id. - */ - int BEFORE = 32; - /** - * RegularExpression Id. - */ - int CONTAINED_BY = 33; - /** - * RegularExpression Id. - */ - int CONTAINING = 34; - /** - * RegularExpression Id. - */ - int EXTEND = 35; - /** - * RegularExpression Id. - */ - int FN_OR = 36; - /** - * RegularExpression Id. - */ - int FUZZYTERM = 37; - /** - * RegularExpression Id. - */ - int MAXGAPS = 38; - /** - * RegularExpression Id. - */ - int MAXWIDTH = 39; - /** - * RegularExpression Id. - */ - int NON_OVERLAPPING = 40; - /** - * RegularExpression Id. - */ - int NOT_CONTAINED_BY = 41; - /** - * RegularExpression Id. - */ - int NOT_CONTAINING = 42; - /** - * RegularExpression Id. - */ - int NOT_WITHIN = 43; - /** - * RegularExpression Id. - */ - int ORDERED = 44; - /** - * RegularExpression Id. - */ - int OVERLAPPING = 45; - /** - * RegularExpression Id. - */ - int PHRASE = 46; - /** - * RegularExpression Id. - */ - int UNORDERED = 47; - /** - * RegularExpression Id. - */ - int UNORDERED_NO_OVERLAPS = 48; - /** - * RegularExpression Id. - */ - int WILDCARD = 49; - /** - * RegularExpression Id. - */ - int WITHIN = 50; - /** - * RegularExpression Id. - */ - int RANGE_TO = 51; - /** - * RegularExpression Id. - */ - int RANGEIN_END = 52; - /** - * RegularExpression Id. - */ - int RANGEEX_END = 53; - /** - * RegularExpression Id. - */ - int RANGE_QUOTED = 54; - /** - * RegularExpression Id. - */ - int RANGE_GOOP = 55; + /** + * End of File. + */ + int EOF = 0; + /** + * RegularExpression Id. + */ + int _NUM_CHAR = 1; + /** + * RegularExpression Id. + */ + int _ESCAPED_CHAR = 2; + /** + * RegularExpression Id. + */ + int _TERM_START_CHAR = 3; + /** + * RegularExpression Id. + */ + int _TERM_CHAR = 4; + /** + * RegularExpression Id. + */ + int _WHITESPACE = 5; + /** + * RegularExpression Id. + */ + int _QUOTED_CHAR = 6; + /** + * RegularExpression Id. + */ + int AND = 8; + /** + * RegularExpression Id. + */ + int OR = 9; + /** + * RegularExpression Id. + */ + int NOT = 10; + /** + * RegularExpression Id. + */ + int FN_PREFIX = 11; + /** + * RegularExpression Id. + */ + int ZL_PREFIX = 12; + /** + * RegularExpression Id. + */ + int PLUS = 13; + /** + * RegularExpression Id. + */ + int MINUS = 14; + /** + * RegularExpression Id. + */ + int RPAREN = 15; + /** + * RegularExpression Id. + */ + int OP_COLON = 16; + /** + * RegularExpression Id. + */ + int OP_EQUAL = 17; + /** + * RegularExpression Id. + */ + int OP_LESSTHAN = 18; + /** + * RegularExpression Id. + */ + int OP_LESSTHANEQ = 19; + /** + * RegularExpression Id. + */ + int OP_MORETHAN = 20; + /** + * RegularExpression Id. + */ + int OP_MORETHANEQ = 21; + /** + * RegularExpression Id. + */ + int CARAT = 22; + /** + * RegularExpression Id. + */ + int TILDE = 23; + /** + * RegularExpression Id. + */ + int QUOTED = 24; + /** + * RegularExpression Id. + */ + int NUMBER = 25; + /** + * RegularExpression Id. + */ + int TERM = 26; + /** + * RegularExpression Id. + */ + int REGEXPTERM = 27; + /** + * RegularExpression Id. + */ + int RANGEIN_START = 28; + /** + * RegularExpression Id. + */ + int RANGEEX_START = 29; + /** + * RegularExpression Id. + */ + int LPAREN = 30; + /** + * RegularExpression Id. + */ + int NUMERIC_SET = 31; + /** + * RegularExpression Id. + */ + int TERM_SET = 32; + /** + * RegularExpression Id. + */ + int ATLEAST = 33; + /** + * RegularExpression Id. + */ + int AFTER = 34; + /** + * RegularExpression Id. + */ + int BEFORE = 35; + /** + * RegularExpression Id. + */ + int CONTAINED_BY = 36; + /** + * RegularExpression Id. + */ + int CONTAINING = 37; + /** + * RegularExpression Id. + */ + int EXTEND = 38; + /** + * RegularExpression Id. + */ + int FN_OR = 39; + /** + * RegularExpression Id. + */ + int FUZZYTERM = 40; + /** + * RegularExpression Id. + */ + int MAXGAPS = 41; + /** + * RegularExpression Id. + */ + int MAXWIDTH = 42; + /** + * RegularExpression Id. + */ + int NON_OVERLAPPING = 43; + /** + * RegularExpression Id. + */ + int NOT_CONTAINED_BY = 44; + /** + * RegularExpression Id. + */ + int NOT_CONTAINING = 45; + /** + * RegularExpression Id. + */ + int NOT_WITHIN = 46; + /** + * RegularExpression Id. + */ + int ORDERED = 47; + /** + * RegularExpression Id. + */ + int OVERLAPPING = 48; + /** + * RegularExpression Id. + */ + int PHRASE = 49; + /** + * RegularExpression Id. + */ + int UNORDERED = 50; + /** + * RegularExpression Id. + */ + int UNORDERED_NO_OVERLAPS = 51; + /** + * RegularExpression Id. + */ + int WILDCARD = 52; + /** + * RegularExpression Id. + */ + int WITHIN = 53; + /** + * RegularExpression Id. + */ + int RANGE_TO = 54; + /** + * RegularExpression Id. + */ + int RANGEIN_END = 55; + /** + * RegularExpression Id. + */ + int RANGEEX_END = 56; + /** + * RegularExpression Id. + */ + int RANGE_QUOTED = 57; + /** + * RegularExpression Id. + */ + int RANGE_GOOP = 58; - /** - * Lexical state. - */ - int Function = 0; - /** - * Lexical state. - */ - int Range = 1; - /** - * Lexical state. - */ - int DEFAULT = 2; + /** + * Lexical state. + */ + int Zulia = 0; + /** + * Lexical state. + */ + int Function = 1; + /** + * Lexical state. + */ + int Range = 2; + /** + * Lexical state. + */ + int DEFAULT = 3; - /** - * Literal token values. - */ - String[] tokenImage = { "", "<_NUM_CHAR>", "<_ESCAPED_CHAR>", "<_TERM_START_CHAR>", "<_TERM_CHAR>", "<_WHITESPACE>", "<_QUOTED_CHAR>", - "", "", "", "", "\"fn:\"", "\"+\"", "\"-\"", "\")\"", "\":\"", "\"=\"", "\"<\"", "\"<=\"", "\">\"", "\">=\"", - "\"^\"", "\"~\"", "", "", "", "", "\"[\"", "\"{\"", "\"(\"", "", "\"after\"", "\"before\"", - "", "\"containing\"", "\"extend\"", "\"or\"", "", "", "", "", "", - "", "", "\"ordered\"", "\"overlapping\"", "\"phrase\"", "\"unordered\"", "", "\"wildcard\"", - "\"within\"", "\"TO\"", "\"]\"", "\"}\"", "", "", "\"@\"", }; + /** + * Literal token values. + */ + String[] tokenImage = { "", "<_NUM_CHAR>", "<_ESCAPED_CHAR>", "<_TERM_START_CHAR>", "<_TERM_CHAR>", "<_WHITESPACE>", "<_QUOTED_CHAR>", + "", "", "", "", "\"fn:\"", "\"zl:\"", "\"+\"", "\"-\"", "\")\"", "\":\"", "\"=\"", "\"<\"", "\"<=\"", "\">\"", + "\">=\"", "\"^\"", "\"~\"", "", "", "", "", "\"[\"", "\"{\"", "\"(\"", "", "", "", + "\"after\"", "\"before\"", "", "\"containing\"", "\"extend\"", "\"or\"", "", "", "", "", + "", "", "", "\"ordered\"", "\"overlapping\"", "\"phrase\"", "\"unordered\"", "", + "\"wildcard\"", "\"within\"", "\"TO\"", "\"]\"", "\"}\"", "", "", "\"@\"", }; } diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserTokenManager.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserTokenManager.java index cca91b23..582eb881 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserTokenManager.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserTokenManager.java @@ -1,8 +1,7 @@ /* ZuliaSyntaxParserTokenManager.java */ /* Generated By:JavaCC: Do not edit this line. ZuliaSyntaxParserTokenManager.java */ package io.zulia.server.search.queryparser.parser; - -import org.apache.lucene.queryparser.charstream.CharStream; + import org.apache.lucene.queryparser.charstream.CharStream; /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -23,2296 +22,2491 @@ /** * Token Manager. */ -@SuppressWarnings("ALL") public class ZuliaSyntaxParserTokenManager implements ZuliaSyntaxParserConstants { - /** Debug output. */ - // (debugStream omitted). - - /** - * Set debug output. - */ - // (setDebugStream omitted). - private final int jjStopStringLiteralDfa_2(int pos, long active0) { - switch (pos) { - case 0: - if ((active0 & 0x800L) != 0L) { - jjmatchedKind = 25; - return 32; - } - return -1; - case 1: - if ((active0 & 0x800L) != 0L) { - jjmatchedKind = 25; - jjmatchedPos = 1; - return 32; - } - return -1; - default: - return -1; - } - } - - private final int jjStartNfa_2(int pos, long active0) { - return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1); - } - - private int jjStopAtPos(int pos, int kind) { - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; - } - - private int jjMoveStringLiteralDfa0_2() { - switch (curChar) { - case 40: - return jjStopAtPos(0, 29); - case 41: - return jjStopAtPos(0, 14); - case 43: - return jjStopAtPos(0, 12); - case 45: - return jjStopAtPos(0, 13); - case 58: - return jjStopAtPos(0, 15); - case 60: - jjmatchedKind = 17; - return jjMoveStringLiteralDfa1_2(0x40000L); - case 61: - return jjStopAtPos(0, 16); - case 62: - jjmatchedKind = 19; - return jjMoveStringLiteralDfa1_2(0x100000L); - case 64: - return jjStopAtPos(0, 56); - case 91: - return jjStopAtPos(0, 27); - case 94: - return jjStopAtPos(0, 21); - case 102: - return jjMoveStringLiteralDfa1_2(0x800L); - case 123: - return jjStopAtPos(0, 28); - case 126: - return jjStopAtPos(0, 22); - default: - return jjMoveNfa_2(0, 0); - } - } - - private int jjMoveStringLiteralDfa1_2(long active0) { - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_2(0, active0); - return 1; - } - switch (curChar) { - case 61: - if ((active0 & 0x40000L) != 0L) - return jjStopAtPos(1, 18); - else if ((active0 & 0x100000L) != 0L) - return jjStopAtPos(1, 20); - break; - case 110: - return jjMoveStringLiteralDfa2_2(active0, 0x800L); - default: - break; - } - return jjStartNfa_2(0, active0); - } - - private int jjMoveStringLiteralDfa2_2(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_2(0, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_2(1, active0); - return 2; - } - switch (curChar) { - case 58: - if ((active0 & 0x800L) != 0L) - return jjStopAtPos(2, 11); - break; - default: - break; - } - return jjStartNfa_2(1, active0); - } - - static final long[] jjbitVec0 = { 0x1L, 0x0L, 0x0L, 0x0L }; - static final long[] jjbitVec1 = { 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; - static final long[] jjbitVec3 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; - static final long[] jjbitVec4 = { 0xfffefffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; - - private int jjMoveNfa_2(int startState, int curPos) { - int startsAt = 0; - jjnewStateCnt = 32; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (; ; ) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - do { - switch (jjstateSet[--i]) { - case 32: - case 23: - if ((0x8bff7cf8ffffd9ffL & l) == 0L) - break; - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 0: - if ((0x8bff54f8ffffd9ffL & l) != 0L) { - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - } - else if ((0x100002600L & l) != 0L) { - if (kind > 7) - kind = 7; - } - else if (curChar == 47) { - jjCheckNAddStates(0, 2); - } - else if (curChar == 34) { - jjCheckNAddStates(3, 5); - } - else if (curChar == 33) { - if (kind > 10) - kind = 10; - } - if ((0x3ff000000000000L & l) != 0L) { - if (kind > 24) - kind = 24; - { - jjCheckNAddTwoStates(19, 20); - } - } - else if (curChar == 38) - jjstateSet[jjnewStateCnt++] = 4; - break; - case 4: - if (curChar == 38 && kind > 8) - kind = 8; - break; - case 5: - if (curChar == 38) - jjstateSet[jjnewStateCnt++] = 4; - break; - case 13: - if (curChar == 33 && kind > 10) - kind = 10; - break; - case 14: - if (curChar == 34) { - jjCheckNAddStates(3, 5); - } - break; - case 15: - if ((0xfffffffbffffffffL & l) != 0L) { - jjCheckNAddStates(3, 5); - } - break; - case 17: { - jjCheckNAddStates(3, 5); - } - break; - case 18: - if (curChar == 34 && kind > 23) - kind = 23; - break; - case 19: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 24) - kind = 24; - { - jjCheckNAddTwoStates(19, 20); - } - break; - case 20: - if (curChar == 46) { - jjCheckNAdd(21); - } - break; - case 21: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 24) - kind = 24; - { - jjCheckNAdd(21); - } - break; - case 22: - if ((0x8bff54f8ffffd9ffL & l) == 0L) - break; - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 25: - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 27: - case 29: - if (curChar == 47) { - jjCheckNAddStates(0, 2); - } - break; - case 28: - if ((0xffff7fffffffffffL & l) != 0L) { - jjCheckNAddStates(0, 2); - } - break; - case 31: - if (curChar == 47 && kind > 26) - kind = 26; - break; - default: - break; - } - } - while (i != startsAt); - } - else if (curChar < 128) { - long l = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 32: - if ((0x97ffffff87fffffeL & l) != 0L) { - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - } - else if (curChar == 92) { - jjCheckNAddTwoStates(25, 25); - } - break; - case 0: - if ((0x97ffffff87fffffeL & l) != 0L) { - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - } - else if (curChar == 92) { - jjCheckNAdd(25); - } - if (curChar == 78) - jjstateSet[jjnewStateCnt++] = 11; - else if (curChar == 124) - jjstateSet[jjnewStateCnt++] = 8; - else if (curChar == 79) - jjstateSet[jjnewStateCnt++] = 6; - else if (curChar == 65) - jjstateSet[jjnewStateCnt++] = 2; - break; - case 1: - if (curChar == 68 && kind > 8) - kind = 8; - break; - case 2: - if (curChar == 78) - jjstateSet[jjnewStateCnt++] = 1; - break; - case 3: - if (curChar == 65) - jjstateSet[jjnewStateCnt++] = 2; - break; - case 6: - if (curChar == 82 && kind > 9) - kind = 9; - break; - case 7: - if (curChar == 79) - jjstateSet[jjnewStateCnt++] = 6; - break; - case 8: - if (curChar == 124 && kind > 9) - kind = 9; - break; - case 9: - if (curChar == 124) - jjstateSet[jjnewStateCnt++] = 8; - break; - case 10: - if (curChar == 84 && kind > 10) - kind = 10; - break; - case 11: - if (curChar == 79) - jjstateSet[jjnewStateCnt++] = 10; - break; - case 12: - if (curChar == 78) - jjstateSet[jjnewStateCnt++] = 11; - break; - case 15: - if ((0xffffffffefffffffL & l) != 0L) { - jjCheckNAddStates(3, 5); - } - break; - case 16: - if (curChar == 92) - jjstateSet[jjnewStateCnt++] = 17; - break; - case 17: { - jjCheckNAddStates(3, 5); - } - break; - case 22: - if ((0x97ffffff87fffffeL & l) == 0L) - break; - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 23: - if ((0x97ffffff87fffffeL & l) == 0L) - break; - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 24: - if (curChar == 92) { - jjCheckNAddTwoStates(25, 25); - } - break; - case 25: - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 26: - if (curChar == 92) { - jjCheckNAdd(25); - } - break; - case 28: { - jjAddStates(0, 2); - } - break; - case 30: - if (curChar == 92) - jjstateSet[jjnewStateCnt++] = 29; - break; - default: - break; - } - } - while (i != startsAt); - } - else { - int hiByte = (curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 32: - case 23: - if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) - break; - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 0: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { - if (kind > 7) - kind = 7; - } - if (jjCanMove_2(hiByte, i1, i2, l1, l2)) { - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - } - break; - case 15: - case 17: - if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { - jjCheckNAddStates(3, 5); - } - break; - case 22: - if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) - break; - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 25: - if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) - break; - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 28: - if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { - jjAddStates(0, 2); - } - break; - default: - if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) - break; - else - break; - } - } - while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 32 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private final int jjStopStringLiteralDfa_0(int pos, long active0) { - switch (pos) { - case 0: - if ((active0 & 0x800000000000L) != 0L) - return 19; - if ((active0 & 0x80000000L) != 0L) - return 79; - if ((active0 & 0x400000000L) != 0L) - return 63; - return -1; - case 1: - if ((active0 & 0x400000000L) != 0L) - return 62; - if ((active0 & 0x800000000000L) != 0L) - return 18; - return -1; - case 2: - if ((active0 & 0x800000000000L) != 0L) - return 17; - if ((active0 & 0x400000000L) != 0L) - return 61; - return -1; - case 3: - if ((active0 & 0x400000000L) != 0L) - return 60; - if ((active0 & 0x800000000000L) != 0L) - return 16; - return -1; - case 4: - if ((active0 & 0x800000000000L) != 0L) - return 15; - if ((active0 & 0x400000000L) != 0L) - return 59; - return -1; - case 5: - if ((active0 & 0x400000000L) != 0L) - return 58; - if ((active0 & 0x800000000000L) != 0L) - return 14; - return -1; - case 6: - if ((active0 & 0x800000000000L) != 0L) - return 13; - if ((active0 & 0x400000000L) != 0L) - return 57; - return -1; - case 7: - if ((active0 & 0x800000000000L) != 0L) - return 12; - return -1; - case 8: - if ((active0 & 0x800000000000L) != 0L) - return 11; - return -1; - default: - return -1; - } - } - - private final int jjStartNfa_0(int pos, long active0) { - return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); - } - - private int jjMoveStringLiteralDfa0_0() { - switch (curChar) { - case 40: - return jjStopAtPos(0, 29); - case 97: - return jjMoveStringLiteralDfa1_0(0x80000000L); - case 98: - return jjMoveStringLiteralDfa1_0(0x100000000L); - case 99: - return jjMoveStringLiteralDfa1_0(0x400000000L); - case 101: - return jjMoveStringLiteralDfa1_0(0x800000000L); - case 111: - return jjMoveStringLiteralDfa1_0(0x301000000000L); - case 112: - return jjMoveStringLiteralDfa1_0(0x400000000000L); - case 117: - return jjMoveStringLiteralDfa1_0(0x800000000000L); - case 119: - return jjMoveStringLiteralDfa1_0(0x6000000000000L); - default: - return jjMoveNfa_0(0, 0); - } - } - - private int jjMoveStringLiteralDfa1_0(long active0) { - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(0, active0); - return 1; - } - switch (curChar) { - case 101: - return jjMoveStringLiteralDfa2_0(active0, 0x100000000L); - case 102: - return jjMoveStringLiteralDfa2_0(active0, 0x80000000L); - case 104: - return jjMoveStringLiteralDfa2_0(active0, 0x400000000000L); - case 105: - return jjMoveStringLiteralDfa2_0(active0, 0x6000000000000L); - case 110: - return jjMoveStringLiteralDfa2_0(active0, 0x800000000000L); - case 111: - return jjMoveStringLiteralDfa2_0(active0, 0x400000000L); - case 114: - if ((active0 & 0x1000000000L) != 0L) { - jjmatchedKind = 36; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_0(active0, 0x100000000000L); - case 118: - return jjMoveStringLiteralDfa2_0(active0, 0x200000000000L); - case 120: - return jjMoveStringLiteralDfa2_0(active0, 0x800000000L); - default: - break; - } - return jjStartNfa_0(0, active0); - } - - private int jjMoveStringLiteralDfa2_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(0, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(1, active0); - return 2; - } - switch (curChar) { - case 100: - return jjMoveStringLiteralDfa3_0(active0, 0x100000000000L); - case 101: - return jjMoveStringLiteralDfa3_0(active0, 0x200000000000L); - case 102: - return jjMoveStringLiteralDfa3_0(active0, 0x100000000L); - case 108: - return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000L); - case 110: - return jjMoveStringLiteralDfa3_0(active0, 0x400000000L); - case 111: - return jjMoveStringLiteralDfa3_0(active0, 0x800000000000L); - case 114: - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L); - case 116: - return jjMoveStringLiteralDfa3_0(active0, 0x4000880000000L); - default: - break; - } - return jjStartNfa_0(1, active0); - } - - private int jjMoveStringLiteralDfa3_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(1, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(2, active0); - return 3; - } - switch (curChar) { - case 97: - return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L); - case 100: - return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000L); - case 101: - return jjMoveStringLiteralDfa4_0(active0, 0x100880000000L); - case 104: - return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L); - case 111: - return jjMoveStringLiteralDfa4_0(active0, 0x100000000L); - case 114: - return jjMoveStringLiteralDfa4_0(active0, 0xa00000000000L); - case 116: - return jjMoveStringLiteralDfa4_0(active0, 0x400000000L); - default: - break; - } - return jjStartNfa_0(2, active0); - } - - private int jjMoveStringLiteralDfa4_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(2, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(3, active0); - return 4; - } - switch (curChar) { - case 97: - return jjMoveStringLiteralDfa5_0(active0, 0x400000000L); - case 99: - return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000L); - case 100: - return jjMoveStringLiteralDfa5_0(active0, 0x800000000000L); - case 105: - return jjMoveStringLiteralDfa5_0(active0, 0x4000000000000L); - case 108: - return jjMoveStringLiteralDfa5_0(active0, 0x200000000000L); - case 110: - return jjMoveStringLiteralDfa5_0(active0, 0x800000000L); - case 114: - if ((active0 & 0x80000000L) != 0L) - return jjStopAtPos(4, 31); - return jjMoveStringLiteralDfa5_0(active0, 0x100100000000L); - case 115: - return jjMoveStringLiteralDfa5_0(active0, 0x400000000000L); - default: - break; - } - return jjStartNfa_0(3, active0); - } - - private int jjMoveStringLiteralDfa5_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(3, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(4, active0); - return 5; - } - switch (curChar) { - case 97: - return jjMoveStringLiteralDfa6_0(active0, 0x2200000000000L); - case 100: - if ((active0 & 0x800000000L) != 0L) - return jjStopAtPos(5, 35); - break; - case 101: - if ((active0 & 0x100000000L) != 0L) - return jjStopAtPos(5, 32); - else if ((active0 & 0x400000000000L) != 0L) - return jjStopAtPos(5, 46); - return jjMoveStringLiteralDfa6_0(active0, 0x900000000000L); - case 105: - return jjMoveStringLiteralDfa6_0(active0, 0x400000000L); - case 110: - if ((active0 & 0x4000000000000L) != 0L) - return jjStopAtPos(5, 50); - break; - default: - break; - } - return jjStartNfa_0(4, active0); - } - - private int jjMoveStringLiteralDfa6_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(4, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(5, active0); - return 6; - } - switch (curChar) { - case 100: - if ((active0 & 0x100000000000L) != 0L) - return jjStopAtPos(6, 44); - break; - case 110: - return jjMoveStringLiteralDfa7_0(active0, 0x400000000L); - case 112: - return jjMoveStringLiteralDfa7_0(active0, 0x200000000000L); - case 114: - return jjMoveStringLiteralDfa7_0(active0, 0x2800000000000L); - default: - break; - } - return jjStartNfa_0(5, active0); - } - - private int jjMoveStringLiteralDfa7_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(5, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(6, active0); - return 7; - } - switch (curChar) { - case 100: - if ((active0 & 0x2000000000000L) != 0L) - return jjStopAtPos(7, 49); - break; - case 101: - return jjMoveStringLiteralDfa8_0(active0, 0x800000000000L); - case 105: - return jjMoveStringLiteralDfa8_0(active0, 0x400000000L); - case 112: - return jjMoveStringLiteralDfa8_0(active0, 0x200000000000L); - default: - break; - } - return jjStartNfa_0(6, active0); - } - - private int jjMoveStringLiteralDfa8_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(6, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(7, active0); - return 8; - } - switch (curChar) { - case 100: - if ((active0 & 0x800000000000L) != 0L) - return jjStartNfaWithStates_0(8, 47, 11); - break; - case 105: - return jjMoveStringLiteralDfa9_0(active0, 0x200000000000L); - case 110: - return jjMoveStringLiteralDfa9_0(active0, 0x400000000L); - default: - break; - } - return jjStartNfa_0(7, active0); - } - - private int jjMoveStringLiteralDfa9_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(7, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(8, active0); - return 9; - } - switch (curChar) { - case 103: - if ((active0 & 0x400000000L) != 0L) - return jjStopAtPos(9, 34); - break; - case 110: - return jjMoveStringLiteralDfa10_0(active0, 0x200000000000L); - default: - break; - } - return jjStartNfa_0(8, active0); - } - - private int jjMoveStringLiteralDfa10_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(8, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(9, active0); - return 10; - } - switch (curChar) { - case 103: - if ((active0 & 0x200000000000L) != 0L) - return jjStopAtPos(10, 45); - break; - default: - break; - } - return jjStartNfa_0(9, active0); - } - - private int jjStartNfaWithStates_0(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_0(state, pos + 1); - } - - private int jjMoveNfa_0(int startState, int curPos) { - int startsAt = 0; - jjnewStateCnt = 199; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (; ; ) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - do { - switch (jjstateSet[--i]) { - case 0: - if ((0x100002600L & l) != 0L) - kind = 7; - break; - default: - break; - } - } - while (i != startsAt); - } - else if (curChar < 128) { - long l = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 18: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 34; - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 17; - break; - case 13: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 29; - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 12; - break; - case 60: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 68; - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 59; - break; - case 19: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 35; - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 18; - break; - case 57: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 65; - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 56; - break; - case 58: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 66; - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 57; - break; - case 59: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 67; - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 58; - break; - case 61: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 69; - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 60; - break; - case 14: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 30; - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 13; - break; - case 62: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 70; - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 61; - break; - case 15: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 31; - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 14; - break; - case 63: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 71; - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 62; - break; - case 16: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 32; - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 15; - break; - case 0: - if (curChar == 109) { - jjAddStates(6, 9); - } - else if (curChar == 110) { - jjAddStates(10, 17); - } - else if (curChar == 97) { - jjAddStates(18, 19); - } - else if (curChar == 99) { - jjAddStates(20, 21); - } - else if (curChar == 102) { - jjAddStates(22, 23); - } - else if (curChar == 117) { - jjAddStates(24, 25); - } - break; - case 11: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 27; - else if (curChar == 78) - jjstateSet[jjnewStateCnt++] = 10; - break; - case 17: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 33; - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 16; - break; - case 79: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 83; - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 78; - break; - case 12: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 28; - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 11; - break; - case 1: - if (curChar == 117) { - jjAddStates(24, 25); - } - break; - case 2: - if (curChar == 115 && kind > 48) - kind = 48; - break; - case 3: - case 20: - if (curChar == 112) { - jjCheckNAdd(2); - } - break; - case 4: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 3; - break; - case 5: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 4; - break; - case 6: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 5; - break; - case 7: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 6; - break; - case 8: - if (curChar == 118) - jjstateSet[jjnewStateCnt++] = 7; - break; - case 9: - if (curChar == 79) - jjstateSet[jjnewStateCnt++] = 8; - break; - case 10: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 21: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 20; - break; - case 22: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 21; - break; - case 23: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 22; - break; - case 24: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 23; - break; - case 25: - if (curChar == 118) - jjstateSet[jjnewStateCnt++] = 24; - break; - case 26: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 25; - break; - case 27: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 26; - break; - case 28: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 27; - break; - case 29: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 28; - break; - case 30: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 29; - break; - case 31: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 30; - break; - case 32: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 31; - break; - case 33: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 32; - break; - case 34: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 33; - break; - case 35: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 34; - break; - case 36: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 35; - break; - case 37: - if (curChar == 102) { - jjAddStates(22, 23); - } - break; - case 38: - if (curChar == 109 && kind > 37) - kind = 37; - break; - case 39: - case 46: - if (curChar == 114) { - jjCheckNAdd(38); - } - break; - case 40: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 39; - break; - case 41: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 40; - break; - case 42: - if (curChar == 121) - jjstateSet[jjnewStateCnt++] = 41; - break; - case 43: - if (curChar == 122) - jjstateSet[jjnewStateCnt++] = 42; - break; - case 44: - if (curChar == 122) - jjstateSet[jjnewStateCnt++] = 43; - break; - case 45: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 44; - break; - case 47: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 46; - break; - case 48: - if (curChar == 84) - jjstateSet[jjnewStateCnt++] = 47; - break; - case 49: - if (curChar == 121) - jjstateSet[jjnewStateCnt++] = 48; - break; - case 50: - if (curChar == 122) - jjstateSet[jjnewStateCnt++] = 49; - break; - case 51: - if (curChar == 122) - jjstateSet[jjnewStateCnt++] = 50; - break; - case 52: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 51; - break; - case 53: - if (curChar == 99) { - jjAddStates(20, 21); - } - break; - case 54: - if (curChar == 121 && kind > 33) - kind = 33; - break; - case 55: - if (curChar == 66) { - jjCheckNAdd(54); - } - break; - case 56: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 55; - break; - case 64: - if (curChar == 98) { - jjCheckNAdd(54); - } - break; - case 65: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 64; - break; - case 66: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 65; - break; - case 67: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 66; - break; - case 68: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 67; - break; - case 69: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 68; - break; - case 70: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 69; - break; - case 71: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 70; - break; - case 72: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 71; - break; - case 73: - if (curChar == 97) { - jjAddStates(18, 19); - } - break; - case 74: - if (curChar == 116 && kind > 30) - kind = 30; - break; - case 75: - case 80: - if (curChar == 115) { - jjCheckNAdd(74); - } - break; - case 76: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 75; - break; - case 77: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 76; - break; - case 78: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 77; - break; - case 81: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 80; - break; - case 82: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 81; - break; - case 83: - if (curChar == 76) - jjstateSet[jjnewStateCnt++] = 82; - break; - case 84: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 83; - break; - case 85: - if (curChar == 110) { - jjAddStates(10, 17); - } - break; - case 86: - if (curChar == 103 && kind > 40) - kind = 40; - break; - case 87: - case 99: - if (curChar == 110) { - jjCheckNAdd(86); - } - break; - case 88: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 87; - break; - case 89: - if (curChar == 112) - jjstateSet[jjnewStateCnt++] = 88; - break; - case 90: - if (curChar == 112) - jjstateSet[jjnewStateCnt++] = 89; - break; - case 91: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 90; - break; - case 92: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 91; - break; - case 93: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 92; - break; - case 94: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 93; - break; - case 95: - if (curChar == 118) - jjstateSet[jjnewStateCnt++] = 94; - break; - case 96: - if (curChar == 79) - jjstateSet[jjnewStateCnt++] = 95; - break; - case 97: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 96; - break; - case 98: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 97; - break; - case 100: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 99; - break; - case 101: - if (curChar == 112) - jjstateSet[jjnewStateCnt++] = 100; - break; - case 102: - if (curChar == 112) - jjstateSet[jjnewStateCnt++] = 101; - break; - case 103: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 102; - break; - case 104: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 103; - break; - case 105: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 104; - break; - case 106: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 105; - break; - case 107: - if (curChar == 118) - jjstateSet[jjnewStateCnt++] = 106; - break; - case 108: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 107; - break; - case 109: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 108; - break; - case 110: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 109; - break; - case 111: - if (curChar == 121 && kind > 41) - kind = 41; - break; - case 112: - if (curChar == 66) { - jjCheckNAdd(111); - } - break; - case 113: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 112; - break; - case 114: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 113; - break; - case 115: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 114; - break; - case 116: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 115; - break; - case 117: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 116; - break; - case 118: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 117; - break; - case 119: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 118; - break; - case 120: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 119; - break; - case 121: - if (curChar == 67) - jjstateSet[jjnewStateCnt++] = 120; - break; - case 122: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 121; - break; - case 123: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 122; - break; - case 124: - if (curChar == 98) { - jjCheckNAdd(111); - } - break; - case 125: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 124; - break; - case 126: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 125; - break; - case 127: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 126; - break; - case 128: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 127; - break; - case 129: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 128; - break; - case 130: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 129; - break; - case 131: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 130; - break; - case 132: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 131; - break; - case 133: - if (curChar == 99) - jjstateSet[jjnewStateCnt++] = 132; - break; - case 134: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 133; - break; - case 135: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 134; - break; - case 136: - if (curChar == 103 && kind > 42) - kind = 42; - break; - case 137: - case 148: - if (curChar == 110) { - jjCheckNAdd(136); - } - break; - case 138: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 137; - break; - case 139: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 138; - break; - case 140: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 139; - break; - case 141: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 140; - break; - case 142: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 141; - break; - case 143: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 142; - break; - case 144: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 143; - break; - case 145: - if (curChar == 67) - jjstateSet[jjnewStateCnt++] = 144; - break; - case 146: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 145; - break; - case 147: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 146; - break; - case 149: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 148; - break; - case 150: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 149; - break; - case 151: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 150; - break; - case 152: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 151; - break; - case 153: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 152; - break; - case 154: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 153; - break; - case 155: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 154; - break; - case 156: - if (curChar == 99) - jjstateSet[jjnewStateCnt++] = 155; - break; - case 157: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 156; - break; - case 158: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 157; - break; - case 159: - if (curChar == 110 && kind > 43) - kind = 43; - break; - case 160: - case 167: - if (curChar == 105) { - jjCheckNAdd(159); - } - break; - case 161: - if (curChar == 104) - jjstateSet[jjnewStateCnt++] = 160; - break; - case 162: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 161; - break; - case 163: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 162; - break; - case 164: - if (curChar == 87) - jjstateSet[jjnewStateCnt++] = 163; - break; - case 165: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 164; - break; - case 166: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 165; - break; - case 168: - if (curChar == 104) - jjstateSet[jjnewStateCnt++] = 167; - break; - case 169: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 168; - break; - case 170: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 169; - break; - case 171: - if (curChar == 119) - jjstateSet[jjnewStateCnt++] = 170; - break; - case 172: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 171; - break; - case 173: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 172; - break; - case 174: - if (curChar == 109) { - jjAddStates(6, 9); - } - break; - case 175: - if (curChar == 115 && kind > 38) - kind = 38; - break; - case 176: - case 181: - if (curChar == 112) { - jjCheckNAdd(175); - } - break; - case 177: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 176; - break; - case 178: - if (curChar == 103) - jjstateSet[jjnewStateCnt++] = 177; - break; - case 179: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 178; - break; - case 180: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 179; - break; - case 182: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 181; - break; - case 183: - if (curChar == 71) - jjstateSet[jjnewStateCnt++] = 182; - break; - case 184: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 183; - break; - case 185: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 184; - break; - case 186: - if (curChar == 104 && kind > 39) - kind = 39; - break; - case 187: - case 193: - if (curChar == 116) { - jjCheckNAdd(186); - } - break; - case 188: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 187; - break; - case 189: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 188; - break; - case 190: - if (curChar == 119) - jjstateSet[jjnewStateCnt++] = 189; - break; - case 191: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 190; - break; - case 192: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 191; - break; - case 194: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 193; - break; - case 195: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 194; - break; - case 196: - if (curChar == 87) - jjstateSet[jjnewStateCnt++] = 195; - break; - case 197: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 196; - break; - case 198: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 197; - break; - default: - break; - } - } - while (i != startsAt); - } - else { - int hiByte = (curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 0: - if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 7) - kind = 7; - break; - default: - if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) - break; - else - break; - } - } - while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 199 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private final int jjStopStringLiteralDfa_1(int pos, long active0) { - switch (pos) { - case 0: - if ((active0 & 0x8000000000000L) != 0L) { - jjmatchedKind = 55; - return 6; - } - return -1; - default: - return -1; - } - } - - private final int jjStartNfa_1(int pos, long active0) { - return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); - } - - private int jjMoveStringLiteralDfa0_1() { - switch (curChar) { - case 84: - return jjMoveStringLiteralDfa1_1(0x8000000000000L); - case 93: - return jjStopAtPos(0, 52); - case 125: - return jjStopAtPos(0, 53); - default: - return jjMoveNfa_1(0, 0); - } - } - - private int jjMoveStringLiteralDfa1_1(long active0) { - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_1(0, active0); - return 1; - } - switch (curChar) { - case 79: - if ((active0 & 0x8000000000000L) != 0L) - return jjStartNfaWithStates_1(1, 51, 6); - break; - default: - break; - } - return jjStartNfa_1(0, active0); - } - - private int jjStartNfaWithStates_1(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_1(state, pos + 1); - } - - private int jjMoveNfa_1(int startState, int curPos) { - int startsAt = 0; - jjnewStateCnt = 7; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (; ; ) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - do { - switch (jjstateSet[--i]) { - case 0: - if ((0xfffffffeffffffffL & l) != 0L) { - if (kind > 55) - kind = 55; - { - jjCheckNAdd(6); - } - } - if ((0x100002600L & l) != 0L) { - if (kind > 7) - kind = 7; - } - else if (curChar == 34) { - jjCheckNAddTwoStates(2, 4); - } - break; - case 1: - if (curChar == 34) { - jjCheckNAddTwoStates(2, 4); - } - break; - case 2: - if ((0xfffffffbffffffffL & l) != 0L) { - jjCheckNAddStates(26, 28); - } - break; - case 3: - if (curChar == 34) { - jjCheckNAddStates(26, 28); - } - break; - case 5: - if (curChar == 34 && kind > 54) - kind = 54; - break; - case 6: - if ((0xfffffffeffffffffL & l) == 0L) - break; - if (kind > 55) - kind = 55; - { - jjCheckNAdd(6); - } - break; - default: - break; - } - } - while (i != startsAt); - } - else if (curChar < 128) { - long l = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 0: - case 6: - if ((0xdfffffffdfffffffL & l) == 0L) - break; - if (kind > 55) - kind = 55; - { - jjCheckNAdd(6); - } - break; - case 2: { - jjAddStates(26, 28); - } - break; - case 4: - if (curChar == 92) - jjstateSet[jjnewStateCnt++] = 3; - break; - default: - break; - } - } - while (i != startsAt); - } - else { - int hiByte = (curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 0: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { - if (kind > 7) - kind = 7; - } - if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { - if (kind > 55) - kind = 55; - { - jjCheckNAdd(6); - } - } - break; - case 2: - if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { - jjAddStates(26, 28); - } - break; - case 6: - if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) - break; - if (kind > 55) - kind = 55; - { - jjCheckNAdd(6); - } - break; - default: - if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) - break; - else - break; - } - } - while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - /** - * Token literal values. - */ - public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, null, null, null, "\146\156\72", "\53", "\55", "\51", - "\72", "\75", "\74", "\74\75", "\76", "\76\75", "\136", "\176", null, null, null, null, "\133", "\173", "\50", null, "\141\146\164\145\162", - "\142\145\146\157\162\145", null, "\143\157\156\164\141\151\156\151\156\147", "\145\170\164\145\156\144", "\157\162", null, null, null, null, null, - null, null, "\157\162\144\145\162\145\144", "\157\166\145\162\154\141\160\160\151\156\147", "\160\150\162\141\163\145", - "\165\156\157\162\144\145\162\145\144", null, "\167\151\154\144\143\141\162\144", "\167\151\164\150\151\156", "\124\117", "\135", "\175", null, - null, "\100", }; - - protected Token jjFillToken() { - final Token t; - final String curTokenImage; - final int beginLine; - final int endLine; - final int beginColumn; - final int endColumn; - String im = jjstrLiteralImages[jjmatchedKind]; - curTokenImage = (im == null) ? input_stream.GetImage() : im; - beginLine = input_stream.getBeginLine(); - beginColumn = input_stream.getBeginColumn(); - endLine = input_stream.getEndLine(); - endColumn = input_stream.getEndColumn(); - t = Token.newToken(jjmatchedKind); - t.kind = jjmatchedKind; - t.image = curTokenImage; - - t.beginLine = beginLine; - t.endLine = endLine; - t.beginColumn = beginColumn; - t.endColumn = endColumn; - - return t; - } - - static final int[] jjnextStates = { 28, 30, 31, 15, 16, 18, 180, 185, 192, 198, 98, 110, 123, 135, 147, 158, 166, 173, 79, 84, 63, 72, 45, 52, 19, 36, 2, 4, - 5, }; - - private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 48: - return ((jjbitVec0[i2] & l2) != 0L); - default: - return false; - } - } - - private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 0: - return ((jjbitVec3[i2] & l2) != 0L); - default: - if ((jjbitVec1[i1] & l1) != 0L) - return true; - return false; - } - } - - private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 0: - return ((jjbitVec3[i2] & l2) != 0L); - case 48: - return ((jjbitVec1[i2] & l2) != 0L); - default: - if ((jjbitVec4[i1] & l1) != 0L) - return true; - return false; - } - } - - int curLexState = 2; - int defaultLexState = 2; - int jjnewStateCnt; - int jjround; - int jjmatchedPos; - int jjmatchedKind; - - /** - * Get the next Token. - */ - public Token getNextToken() { - Token matchedToken; - int curPos = 0; - - EOFLoop: - for (; ; ) { - try { - curChar = input_stream.BeginToken(); - } - catch (Exception e) { - jjmatchedKind = 0; - jjmatchedPos = -1; - matchedToken = jjFillToken(); - return matchedToken; - } - - switch (curLexState) { - case 0: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - break; - case 1: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_1(); - break; - case 2: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_2(); - break; - } - if (jjmatchedKind != 0x7fffffff) { - if (jjmatchedPos + 1 < curPos) - input_stream.backup(curPos - jjmatchedPos - 1); - if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { - matchedToken = jjFillToken(); - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - return matchedToken; - } - else { - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - continue EOFLoop; - } - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { - input_stream.readChar(); - input_stream.backup(1); - } - catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } - else - error_column++; - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } - } - - void SkipLexicalActions(Token matchedToken) { - switch (jjmatchedKind) { - default: - break; - } - } - - void MoreLexicalActions() { - jjimageLen += (lengthOfMatch = jjmatchedPos + 1); - switch (jjmatchedKind) { - default: - break; - } - } - - void TokenLexicalActions(Token matchedToken) { - switch (jjmatchedKind) { - default: - break; - } - } - - private void jjCheckNAdd(int state) { - if (jjrounds[state] != jjround) { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } - } - - private void jjAddStates(int start, int end) { - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } - while (start++ != end); - } - - private void jjCheckNAddTwoStates(int state1, int state2) { - jjCheckNAdd(state1); - jjCheckNAdd(state2); - } - - private void jjCheckNAddStates(int start, int end) { - do { - jjCheckNAdd(jjnextStates[start]); - } - while (start++ != end); - } - - /** - * Constructor. - */ - public ZuliaSyntaxParserTokenManager(CharStream stream) { - - input_stream = stream; - } - - /** - * Constructor. - */ - public ZuliaSyntaxParserTokenManager(CharStream stream, int lexState) { - ReInit(stream); - SwitchTo(lexState); - } - - /** - * Reinitialise parser. - */ - - public void ReInit(CharStream stream) { - - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); - } - - private void ReInitRounds() { - int i; - jjround = 0x80000001; - for (i = 199; i-- > 0; ) - jjrounds[i] = 0x80000000; - } - - /** - * Reinitialise parser. - */ - public void ReInit(CharStream stream, int lexState) { - ReInit(stream); - SwitchTo(lexState); - } - - /** - * Switch to specified lex state. - */ - public void SwitchTo(int lexState) { - if (lexState >= 3 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; - } - - /** - * Lexer state names. - */ - public static final String[] lexStateNames = { "Function", "Range", "DEFAULT", }; - - /** - * Lex State array. - */ - public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, - 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, -1, -1, -1, }; - static final long[] jjtoToken = { 0x1ffffffffffff01L, }; - static final long[] jjtoSkip = { 0x80L, }; - static final long[] jjtoSpecial = { 0x0L, }; - static final long[] jjtoMore = { 0x0L, }; - protected CharStream input_stream; - - private final int[] jjrounds = new int[199]; - private final int[] jjstateSet = new int[2 * 199]; - private final StringBuilder jjimage = new StringBuilder(); - private StringBuilder image = jjimage; - private int jjimageLen; - private int lengthOfMatch; - protected int curChar; + /** Debug output. */ + // (debugStream omitted). + + /** + * Set debug output. + */ + // (setDebugStream omitted). + private final int jjStopStringLiteralDfa_3(int pos, long active0) { + switch (pos) { + case 0: + if ((active0 & 0x1800L) != 0L) { + jjmatchedKind = 26; + return 32; + } + return -1; + case 1: + if ((active0 & 0x1800L) != 0L) { + jjmatchedKind = 26; + jjmatchedPos = 1; + return 32; + } + return -1; + default: + return -1; + } + } + + private final int jjStartNfa_3(int pos, long active0) { + return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1); + } + + private int jjStopAtPos(int pos, int kind) { + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; + } + + private int jjMoveStringLiteralDfa0_3() { + switch (curChar) { + case 40: + return jjStopAtPos(0, 30); + case 41: + return jjStopAtPos(0, 15); + case 43: + return jjStopAtPos(0, 13); + case 45: + return jjStopAtPos(0, 14); + case 58: + return jjStopAtPos(0, 16); + case 60: + jjmatchedKind = 18; + return jjMoveStringLiteralDfa1_3(0x80000L); + case 61: + return jjStopAtPos(0, 17); + case 62: + jjmatchedKind = 20; + return jjMoveStringLiteralDfa1_3(0x200000L); + case 64: + return jjStopAtPos(0, 59); + case 91: + return jjStopAtPos(0, 28); + case 94: + return jjStopAtPos(0, 22); + case 102: + return jjMoveStringLiteralDfa1_3(0x800L); + case 122: + return jjMoveStringLiteralDfa1_3(0x1000L); + case 123: + return jjStopAtPos(0, 29); + case 126: + return jjStopAtPos(0, 23); + default: + return jjMoveNfa_3(0, 0); + } + } + + private int jjMoveStringLiteralDfa1_3(long active0) { + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_3(0, active0); + return 1; + } + switch (curChar) { + case 61: + if ((active0 & 0x80000L) != 0L) + return jjStopAtPos(1, 19); + else if ((active0 & 0x200000L) != 0L) + return jjStopAtPos(1, 21); + break; + case 108: + return jjMoveStringLiteralDfa2_3(active0, 0x1000L); + case 110: + return jjMoveStringLiteralDfa2_3(active0, 0x800L); + default: + break; + } + return jjStartNfa_3(0, active0); + } + + private int jjMoveStringLiteralDfa2_3(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_3(0, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_3(1, active0); + return 2; + } + switch (curChar) { + case 58: + if ((active0 & 0x800L) != 0L) + return jjStopAtPos(2, 11); + else if ((active0 & 0x1000L) != 0L) + return jjStopAtPos(2, 12); + break; + default: + break; + } + return jjStartNfa_3(1, active0); + } + + static final long[] jjbitVec0 = { 0x1L, 0x0L, 0x0L, 0x0L }; + static final long[] jjbitVec1 = { 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; + static final long[] jjbitVec3 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; + static final long[] jjbitVec4 = { 0xfffefffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; + + private int jjMoveNfa_3(int startState, int curPos) { + int startsAt = 0; + jjnewStateCnt = 32; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (; ; ) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + do { + switch (jjstateSet[--i]) { + case 32: + case 23: + if ((0x8bff7cf8ffffd9ffL & l) == 0L) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 0: + if ((0x8bff54f8ffffd9ffL & l) != 0L) { + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + } + else if ((0x100002600L & l) != 0L) { + if (kind > 7) + kind = 7; + } + else if (curChar == 47) { + jjCheckNAddStates(0, 2); + } + else if (curChar == 34) { + jjCheckNAddStates(3, 5); + } + else if (curChar == 33) { + if (kind > 10) + kind = 10; + } + if ((0x3ff000000000000L & l) != 0L) { + if (kind > 25) + kind = 25; + { + jjCheckNAddTwoStates(19, 20); + } + } + else if (curChar == 38) + jjstateSet[jjnewStateCnt++] = 4; + break; + case 4: + if (curChar == 38 && kind > 8) + kind = 8; + break; + case 5: + if (curChar == 38) + jjstateSet[jjnewStateCnt++] = 4; + break; + case 13: + if (curChar == 33 && kind > 10) + kind = 10; + break; + case 14: + if (curChar == 34) { + jjCheckNAddStates(3, 5); + } + break; + case 15: + if ((0xfffffffbffffffffL & l) != 0L) { + jjCheckNAddStates(3, 5); + } + break; + case 17: { + jjCheckNAddStates(3, 5); + } + break; + case 18: + if (curChar == 34 && kind > 24) + kind = 24; + break; + case 19: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 25) + kind = 25; + { + jjCheckNAddTwoStates(19, 20); + } + break; + case 20: + if (curChar == 46) { + jjCheckNAdd(21); + } + break; + case 21: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 25) + kind = 25; + { + jjCheckNAdd(21); + } + break; + case 22: + if ((0x8bff54f8ffffd9ffL & l) == 0L) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 25: + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 27: + case 29: + if (curChar == 47) { + jjCheckNAddStates(0, 2); + } + break; + case 28: + if ((0xffff7fffffffffffL & l) != 0L) { + jjCheckNAddStates(0, 2); + } + break; + case 31: + if (curChar == 47 && kind > 27) + kind = 27; + break; + default: + break; + } + } + while (i != startsAt); + } + else if (curChar < 128) { + long l = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 32: + if ((0x97ffffff87fffffeL & l) != 0L) { + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + } + else if (curChar == 92) { + jjCheckNAddTwoStates(25, 25); + } + break; + case 0: + if ((0x97ffffff87fffffeL & l) != 0L) { + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + } + else if (curChar == 92) { + jjCheckNAdd(25); + } + if (curChar == 78) + jjstateSet[jjnewStateCnt++] = 11; + else if (curChar == 124) + jjstateSet[jjnewStateCnt++] = 8; + else if (curChar == 79) + jjstateSet[jjnewStateCnt++] = 6; + else if (curChar == 65) + jjstateSet[jjnewStateCnt++] = 2; + break; + case 1: + if (curChar == 68 && kind > 8) + kind = 8; + break; + case 2: + if (curChar == 78) + jjstateSet[jjnewStateCnt++] = 1; + break; + case 3: + if (curChar == 65) + jjstateSet[jjnewStateCnt++] = 2; + break; + case 6: + if (curChar == 82 && kind > 9) + kind = 9; + break; + case 7: + if (curChar == 79) + jjstateSet[jjnewStateCnt++] = 6; + break; + case 8: + if (curChar == 124 && kind > 9) + kind = 9; + break; + case 9: + if (curChar == 124) + jjstateSet[jjnewStateCnt++] = 8; + break; + case 10: + if (curChar == 84 && kind > 10) + kind = 10; + break; + case 11: + if (curChar == 79) + jjstateSet[jjnewStateCnt++] = 10; + break; + case 12: + if (curChar == 78) + jjstateSet[jjnewStateCnt++] = 11; + break; + case 15: + if ((0xffffffffefffffffL & l) != 0L) { + jjCheckNAddStates(3, 5); + } + break; + case 16: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 17; + break; + case 17: { + jjCheckNAddStates(3, 5); + } + break; + case 22: + if ((0x97ffffff87fffffeL & l) == 0L) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 23: + if ((0x97ffffff87fffffeL & l) == 0L) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 24: + if (curChar == 92) { + jjCheckNAddTwoStates(25, 25); + } + break; + case 25: + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 26: + if (curChar == 92) { + jjCheckNAdd(25); + } + break; + case 28: { + jjAddStates(0, 2); + } + break; + case 30: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 29; + break; + default: + break; + } + } + while (i != startsAt); + } + else { + int hiByte = (curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 32: + case 23: + if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 0: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { + if (kind > 7) + kind = 7; + } + if (jjCanMove_2(hiByte, i1, i2, l1, l2)) { + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + } + break; + case 15: + case 17: + if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { + jjCheckNAddStates(3, 5); + } + break; + case 22: + if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 25: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 28: + if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { + jjAddStates(0, 2); + } + break; + default: + if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) + break; + else + break; + } + } + while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 32 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private final int jjStopStringLiteralDfa_1(int pos, long active0) { + switch (pos) { + case 0: + if ((active0 & 0x4000000000000L) != 0L) + return 19; + if ((active0 & 0x400000000L) != 0L) + return 79; + if ((active0 & 0x2000000000L) != 0L) + return 63; + return -1; + case 1: + if ((active0 & 0x2000000000L) != 0L) + return 62; + if ((active0 & 0x4000000000000L) != 0L) + return 18; + return -1; + case 2: + if ((active0 & 0x4000000000000L) != 0L) + return 17; + if ((active0 & 0x2000000000L) != 0L) + return 61; + return -1; + case 3: + if ((active0 & 0x2000000000L) != 0L) + return 60; + if ((active0 & 0x4000000000000L) != 0L) + return 16; + return -1; + case 4: + if ((active0 & 0x4000000000000L) != 0L) + return 15; + if ((active0 & 0x2000000000L) != 0L) + return 59; + return -1; + case 5: + if ((active0 & 0x2000000000L) != 0L) + return 58; + if ((active0 & 0x4000000000000L) != 0L) + return 14; + return -1; + case 6: + if ((active0 & 0x4000000000000L) != 0L) + return 13; + if ((active0 & 0x2000000000L) != 0L) + return 57; + return -1; + case 7: + if ((active0 & 0x4000000000000L) != 0L) + return 12; + return -1; + case 8: + if ((active0 & 0x4000000000000L) != 0L) + return 11; + return -1; + default: + return -1; + } + } + + private final int jjStartNfa_1(int pos, long active0) { + return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); + } + + private int jjMoveStringLiteralDfa0_1() { + switch (curChar) { + case 40: + return jjStopAtPos(0, 30); + case 97: + return jjMoveStringLiteralDfa1_1(0x400000000L); + case 98: + return jjMoveStringLiteralDfa1_1(0x800000000L); + case 99: + return jjMoveStringLiteralDfa1_1(0x2000000000L); + case 101: + return jjMoveStringLiteralDfa1_1(0x4000000000L); + case 111: + return jjMoveStringLiteralDfa1_1(0x1808000000000L); + case 112: + return jjMoveStringLiteralDfa1_1(0x2000000000000L); + case 117: + return jjMoveStringLiteralDfa1_1(0x4000000000000L); + case 119: + return jjMoveStringLiteralDfa1_1(0x30000000000000L); + default: + return jjMoveNfa_1(0, 0); + } + } + + private int jjMoveStringLiteralDfa1_1(long active0) { + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(0, active0); + return 1; + } + switch (curChar) { + case 101: + return jjMoveStringLiteralDfa2_1(active0, 0x800000000L); + case 102: + return jjMoveStringLiteralDfa2_1(active0, 0x400000000L); + case 104: + return jjMoveStringLiteralDfa2_1(active0, 0x2000000000000L); + case 105: + return jjMoveStringLiteralDfa2_1(active0, 0x30000000000000L); + case 110: + return jjMoveStringLiteralDfa2_1(active0, 0x4000000000000L); + case 111: + return jjMoveStringLiteralDfa2_1(active0, 0x2000000000L); + case 114: + if ((active0 & 0x8000000000L) != 0L) { + jjmatchedKind = 39; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_1(active0, 0x800000000000L); + case 118: + return jjMoveStringLiteralDfa2_1(active0, 0x1000000000000L); + case 120: + return jjMoveStringLiteralDfa2_1(active0, 0x4000000000L); + default: + break; + } + return jjStartNfa_1(0, active0); + } + + private int jjMoveStringLiteralDfa2_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(0, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(1, active0); + return 2; + } + switch (curChar) { + case 100: + return jjMoveStringLiteralDfa3_1(active0, 0x800000000000L); + case 101: + return jjMoveStringLiteralDfa3_1(active0, 0x1000000000000L); + case 102: + return jjMoveStringLiteralDfa3_1(active0, 0x800000000L); + case 108: + return jjMoveStringLiteralDfa3_1(active0, 0x10000000000000L); + case 110: + return jjMoveStringLiteralDfa3_1(active0, 0x2000000000L); + case 111: + return jjMoveStringLiteralDfa3_1(active0, 0x4000000000000L); + case 114: + return jjMoveStringLiteralDfa3_1(active0, 0x2000000000000L); + case 116: + return jjMoveStringLiteralDfa3_1(active0, 0x20004400000000L); + default: + break; + } + return jjStartNfa_1(1, active0); + } + + private int jjMoveStringLiteralDfa3_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(1, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(2, active0); + return 3; + } + switch (curChar) { + case 97: + return jjMoveStringLiteralDfa4_1(active0, 0x2000000000000L); + case 100: + return jjMoveStringLiteralDfa4_1(active0, 0x10000000000000L); + case 101: + return jjMoveStringLiteralDfa4_1(active0, 0x804400000000L); + case 104: + return jjMoveStringLiteralDfa4_1(active0, 0x20000000000000L); + case 111: + return jjMoveStringLiteralDfa4_1(active0, 0x800000000L); + case 114: + return jjMoveStringLiteralDfa4_1(active0, 0x5000000000000L); + case 116: + return jjMoveStringLiteralDfa4_1(active0, 0x2000000000L); + default: + break; + } + return jjStartNfa_1(2, active0); + } + + private int jjMoveStringLiteralDfa4_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(2, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(3, active0); + return 4; + } + switch (curChar) { + case 97: + return jjMoveStringLiteralDfa5_1(active0, 0x2000000000L); + case 99: + return jjMoveStringLiteralDfa5_1(active0, 0x10000000000000L); + case 100: + return jjMoveStringLiteralDfa5_1(active0, 0x4000000000000L); + case 105: + return jjMoveStringLiteralDfa5_1(active0, 0x20000000000000L); + case 108: + return jjMoveStringLiteralDfa5_1(active0, 0x1000000000000L); + case 110: + return jjMoveStringLiteralDfa5_1(active0, 0x4000000000L); + case 114: + if ((active0 & 0x400000000L) != 0L) + return jjStopAtPos(4, 34); + return jjMoveStringLiteralDfa5_1(active0, 0x800800000000L); + case 115: + return jjMoveStringLiteralDfa5_1(active0, 0x2000000000000L); + default: + break; + } + return jjStartNfa_1(3, active0); + } + + private int jjMoveStringLiteralDfa5_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(3, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(4, active0); + return 5; + } + switch (curChar) { + case 97: + return jjMoveStringLiteralDfa6_1(active0, 0x11000000000000L); + case 100: + if ((active0 & 0x4000000000L) != 0L) + return jjStopAtPos(5, 38); + break; + case 101: + if ((active0 & 0x800000000L) != 0L) + return jjStopAtPos(5, 35); + else if ((active0 & 0x2000000000000L) != 0L) + return jjStopAtPos(5, 49); + return jjMoveStringLiteralDfa6_1(active0, 0x4800000000000L); + case 105: + return jjMoveStringLiteralDfa6_1(active0, 0x2000000000L); + case 110: + if ((active0 & 0x20000000000000L) != 0L) + return jjStopAtPos(5, 53); + break; + default: + break; + } + return jjStartNfa_1(4, active0); + } + + private int jjMoveStringLiteralDfa6_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(4, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(5, active0); + return 6; + } + switch (curChar) { + case 100: + if ((active0 & 0x800000000000L) != 0L) + return jjStopAtPos(6, 47); + break; + case 110: + return jjMoveStringLiteralDfa7_1(active0, 0x2000000000L); + case 112: + return jjMoveStringLiteralDfa7_1(active0, 0x1000000000000L); + case 114: + return jjMoveStringLiteralDfa7_1(active0, 0x14000000000000L); + default: + break; + } + return jjStartNfa_1(5, active0); + } + + private int jjMoveStringLiteralDfa7_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(5, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(6, active0); + return 7; + } + switch (curChar) { + case 100: + if ((active0 & 0x10000000000000L) != 0L) + return jjStopAtPos(7, 52); + break; + case 101: + return jjMoveStringLiteralDfa8_1(active0, 0x4000000000000L); + case 105: + return jjMoveStringLiteralDfa8_1(active0, 0x2000000000L); + case 112: + return jjMoveStringLiteralDfa8_1(active0, 0x1000000000000L); + default: + break; + } + return jjStartNfa_1(6, active0); + } + + private int jjMoveStringLiteralDfa8_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(6, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(7, active0); + return 8; + } + switch (curChar) { + case 100: + if ((active0 & 0x4000000000000L) != 0L) + return jjStartNfaWithStates_1(8, 50, 11); + break; + case 105: + return jjMoveStringLiteralDfa9_1(active0, 0x1000000000000L); + case 110: + return jjMoveStringLiteralDfa9_1(active0, 0x2000000000L); + default: + break; + } + return jjStartNfa_1(7, active0); + } + + private int jjMoveStringLiteralDfa9_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(7, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(8, active0); + return 9; + } + switch (curChar) { + case 103: + if ((active0 & 0x2000000000L) != 0L) + return jjStopAtPos(9, 37); + break; + case 110: + return jjMoveStringLiteralDfa10_1(active0, 0x1000000000000L); + default: + break; + } + return jjStartNfa_1(8, active0); + } + + private int jjMoveStringLiteralDfa10_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(8, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(9, active0); + return 10; + } + switch (curChar) { + case 103: + if ((active0 & 0x1000000000000L) != 0L) + return jjStopAtPos(10, 48); + break; + default: + break; + } + return jjStartNfa_1(9, active0); + } + + private int jjStartNfaWithStates_1(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_1(state, pos + 1); + } + + private int jjMoveNfa_1(int startState, int curPos) { + int startsAt = 0; + jjnewStateCnt = 199; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (; ; ) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + do { + switch (jjstateSet[--i]) { + case 0: + if ((0x100002600L & l) != 0L) + kind = 7; + break; + default: + break; + } + } + while (i != startsAt); + } + else if (curChar < 128) { + long l = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 18: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 34; + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 17; + break; + case 13: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 29; + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 12; + break; + case 60: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 68; + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 59; + break; + case 19: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 35; + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 18; + break; + case 57: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 65; + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 56; + break; + case 58: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 66; + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 57; + break; + case 59: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 67; + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 58; + break; + case 61: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 69; + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 60; + break; + case 14: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 30; + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 13; + break; + case 62: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 70; + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 61; + break; + case 15: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 31; + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 14; + break; + case 63: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 71; + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 62; + break; + case 16: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 32; + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 15; + break; + case 0: + if (curChar == 109) { + jjAddStates(6, 9); + } + else if (curChar == 110) { + jjAddStates(10, 17); + } + else if (curChar == 97) { + jjAddStates(18, 19); + } + else if (curChar == 99) { + jjAddStates(20, 21); + } + else if (curChar == 102) { + jjAddStates(22, 23); + } + else if (curChar == 117) { + jjAddStates(24, 25); + } + break; + case 11: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 27; + else if (curChar == 78) + jjstateSet[jjnewStateCnt++] = 10; + break; + case 17: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 33; + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 16; + break; + case 79: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 83; + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 78; + break; + case 12: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 28; + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 11; + break; + case 1: + if (curChar == 117) { + jjAddStates(24, 25); + } + break; + case 2: + if (curChar == 115 && kind > 51) + kind = 51; + break; + case 3: + case 20: + if (curChar == 112) { + jjCheckNAdd(2); + } + break; + case 4: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 3; + break; + case 5: + if (curChar == 108) + jjstateSet[jjnewStateCnt++] = 4; + break; + case 6: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 5; + break; + case 7: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 6; + break; + case 8: + if (curChar == 118) + jjstateSet[jjnewStateCnt++] = 7; + break; + case 9: + if (curChar == 79) + jjstateSet[jjnewStateCnt++] = 8; + break; + case 10: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 9; + break; + case 21: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 20; + break; + case 22: + if (curChar == 108) + jjstateSet[jjnewStateCnt++] = 21; + break; + case 23: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 22; + break; + case 24: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 23; + break; + case 25: + if (curChar == 118) + jjstateSet[jjnewStateCnt++] = 24; + break; + case 26: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 25; + break; + case 27: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 26; + break; + case 28: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 27; + break; + case 29: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 28; + break; + case 30: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 29; + break; + case 31: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 30; + break; + case 32: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 31; + break; + case 33: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 32; + break; + case 34: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 33; + break; + case 35: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 34; + break; + case 36: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 35; + break; + case 37: + if (curChar == 102) { + jjAddStates(22, 23); + } + break; + case 38: + if (curChar == 109 && kind > 40) + kind = 40; + break; + case 39: + case 46: + if (curChar == 114) { + jjCheckNAdd(38); + } + break; + case 40: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 39; + break; + case 41: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 40; + break; + case 42: + if (curChar == 121) + jjstateSet[jjnewStateCnt++] = 41; + break; + case 43: + if (curChar == 122) + jjstateSet[jjnewStateCnt++] = 42; + break; + case 44: + if (curChar == 122) + jjstateSet[jjnewStateCnt++] = 43; + break; + case 45: + if (curChar == 117) + jjstateSet[jjnewStateCnt++] = 44; + break; + case 47: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 46; + break; + case 48: + if (curChar == 84) + jjstateSet[jjnewStateCnt++] = 47; + break; + case 49: + if (curChar == 121) + jjstateSet[jjnewStateCnt++] = 48; + break; + case 50: + if (curChar == 122) + jjstateSet[jjnewStateCnt++] = 49; + break; + case 51: + if (curChar == 122) + jjstateSet[jjnewStateCnt++] = 50; + break; + case 52: + if (curChar == 117) + jjstateSet[jjnewStateCnt++] = 51; + break; + case 53: + if (curChar == 99) { + jjAddStates(20, 21); + } + break; + case 54: + if (curChar == 121 && kind > 36) + kind = 36; + break; + case 55: + if (curChar == 66) { + jjCheckNAdd(54); + } + break; + case 56: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 55; + break; + case 64: + if (curChar == 98) { + jjCheckNAdd(54); + } + break; + case 65: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 64; + break; + case 66: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 65; + break; + case 67: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 66; + break; + case 68: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 67; + break; + case 69: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 68; + break; + case 70: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 69; + break; + case 71: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 70; + break; + case 72: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 71; + break; + case 73: + if (curChar == 97) { + jjAddStates(18, 19); + } + break; + case 74: + if (curChar == 116 && kind > 33) + kind = 33; + break; + case 75: + case 80: + if (curChar == 115) { + jjCheckNAdd(74); + } + break; + case 76: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 75; + break; + case 77: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 76; + break; + case 78: + if (curChar == 108) + jjstateSet[jjnewStateCnt++] = 77; + break; + case 81: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 80; + break; + case 82: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 81; + break; + case 83: + if (curChar == 76) + jjstateSet[jjnewStateCnt++] = 82; + break; + case 84: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 83; + break; + case 85: + if (curChar == 110) { + jjAddStates(10, 17); + } + break; + case 86: + if (curChar == 103 && kind > 43) + kind = 43; + break; + case 87: + case 99: + if (curChar == 110) { + jjCheckNAdd(86); + } + break; + case 88: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 87; + break; + case 89: + if (curChar == 112) + jjstateSet[jjnewStateCnt++] = 88; + break; + case 90: + if (curChar == 112) + jjstateSet[jjnewStateCnt++] = 89; + break; + case 91: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 90; + break; + case 92: + if (curChar == 108) + jjstateSet[jjnewStateCnt++] = 91; + break; + case 93: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 92; + break; + case 94: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 93; + break; + case 95: + if (curChar == 118) + jjstateSet[jjnewStateCnt++] = 94; + break; + case 96: + if (curChar == 79) + jjstateSet[jjnewStateCnt++] = 95; + break; + case 97: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 96; + break; + case 98: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 97; + break; + case 100: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 99; + break; + case 101: + if (curChar == 112) + jjstateSet[jjnewStateCnt++] = 100; + break; + case 102: + if (curChar == 112) + jjstateSet[jjnewStateCnt++] = 101; + break; + case 103: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 102; + break; + case 104: + if (curChar == 108) + jjstateSet[jjnewStateCnt++] = 103; + break; + case 105: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 104; + break; + case 106: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 105; + break; + case 107: + if (curChar == 118) + jjstateSet[jjnewStateCnt++] = 106; + break; + case 108: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 107; + break; + case 109: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 108; + break; + case 110: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 109; + break; + case 111: + if (curChar == 121 && kind > 44) + kind = 44; + break; + case 112: + if (curChar == 66) { + jjCheckNAdd(111); + } + break; + case 113: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 112; + break; + case 114: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 113; + break; + case 115: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 114; + break; + case 116: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 115; + break; + case 117: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 116; + break; + case 118: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 117; + break; + case 119: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 118; + break; + case 120: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 119; + break; + case 121: + if (curChar == 67) + jjstateSet[jjnewStateCnt++] = 120; + break; + case 122: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 121; + break; + case 123: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 122; + break; + case 124: + if (curChar == 98) { + jjCheckNAdd(111); + } + break; + case 125: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 124; + break; + case 126: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 125; + break; + case 127: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 126; + break; + case 128: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 127; + break; + case 129: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 128; + break; + case 130: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 129; + break; + case 131: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 130; + break; + case 132: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 131; + break; + case 133: + if (curChar == 99) + jjstateSet[jjnewStateCnt++] = 132; + break; + case 134: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 133; + break; + case 135: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 134; + break; + case 136: + if (curChar == 103 && kind > 45) + kind = 45; + break; + case 137: + case 148: + if (curChar == 110) { + jjCheckNAdd(136); + } + break; + case 138: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 137; + break; + case 139: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 138; + break; + case 140: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 139; + break; + case 141: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 140; + break; + case 142: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 141; + break; + case 143: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 142; + break; + case 144: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 143; + break; + case 145: + if (curChar == 67) + jjstateSet[jjnewStateCnt++] = 144; + break; + case 146: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 145; + break; + case 147: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 146; + break; + case 149: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 148; + break; + case 150: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 149; + break; + case 151: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 150; + break; + case 152: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 151; + break; + case 153: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 152; + break; + case 154: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 153; + break; + case 155: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 154; + break; + case 156: + if (curChar == 99) + jjstateSet[jjnewStateCnt++] = 155; + break; + case 157: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 156; + break; + case 158: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 157; + break; + case 159: + if (curChar == 110 && kind > 46) + kind = 46; + break; + case 160: + case 167: + if (curChar == 105) { + jjCheckNAdd(159); + } + break; + case 161: + if (curChar == 104) + jjstateSet[jjnewStateCnt++] = 160; + break; + case 162: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 161; + break; + case 163: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 162; + break; + case 164: + if (curChar == 87) + jjstateSet[jjnewStateCnt++] = 163; + break; + case 165: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 164; + break; + case 166: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 165; + break; + case 168: + if (curChar == 104) + jjstateSet[jjnewStateCnt++] = 167; + break; + case 169: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 168; + break; + case 170: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 169; + break; + case 171: + if (curChar == 119) + jjstateSet[jjnewStateCnt++] = 170; + break; + case 172: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 171; + break; + case 173: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 172; + break; + case 174: + if (curChar == 109) { + jjAddStates(6, 9); + } + break; + case 175: + if (curChar == 115 && kind > 41) + kind = 41; + break; + case 176: + case 181: + if (curChar == 112) { + jjCheckNAdd(175); + } + break; + case 177: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 176; + break; + case 178: + if (curChar == 103) + jjstateSet[jjnewStateCnt++] = 177; + break; + case 179: + if (curChar == 120) + jjstateSet[jjnewStateCnt++] = 178; + break; + case 180: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 179; + break; + case 182: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 181; + break; + case 183: + if (curChar == 71) + jjstateSet[jjnewStateCnt++] = 182; + break; + case 184: + if (curChar == 120) + jjstateSet[jjnewStateCnt++] = 183; + break; + case 185: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 184; + break; + case 186: + if (curChar == 104 && kind > 42) + kind = 42; + break; + case 187: + case 193: + if (curChar == 116) { + jjCheckNAdd(186); + } + break; + case 188: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 187; + break; + case 189: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 188; + break; + case 190: + if (curChar == 119) + jjstateSet[jjnewStateCnt++] = 189; + break; + case 191: + if (curChar == 120) + jjstateSet[jjnewStateCnt++] = 190; + break; + case 192: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 191; + break; + case 194: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 193; + break; + case 195: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 194; + break; + case 196: + if (curChar == 87) + jjstateSet[jjnewStateCnt++] = 195; + break; + case 197: + if (curChar == 120) + jjstateSet[jjnewStateCnt++] = 196; + break; + case 198: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 197; + break; + default: + break; + } + } + while (i != startsAt); + } + else { + int hiByte = (curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 0: + if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 7) + kind = 7; + break; + default: + if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) + break; + else + break; + } + } + while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 199 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private final int jjStopStringLiteralDfa_0(int pos, long active0) { + switch (pos) { + default: + return -1; + } + } + + private final int jjStartNfa_0(int pos, long active0) { + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); + } + + private int jjMoveStringLiteralDfa0_0() { + switch (curChar) { + case 40: + return jjStopAtPos(0, 30); + default: + return jjMoveNfa_0(0, 0); + } + } + + private int jjMoveNfa_0(int startState, int curPos) { + int startsAt = 0; + jjnewStateCnt = 22; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (; ; ) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + do { + switch (jjstateSet[--i]) { + case 0: + if ((0x100002600L & l) != 0L) + kind = 7; + break; + default: + break; + } + } + while (i != startsAt); + } + else if (curChar < 128) { + long l = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 0: + if (curChar == 110) { + jjAddStates(26, 27); + } + else if (curChar == 116) { + jjAddStates(28, 29); + } + break; + case 1: + if (curChar == 116) { + jjAddStates(28, 29); + } + break; + case 2: + if (curChar == 113) + kind = 32; + break; + case 3: + if (curChar == 121) + kind = 32; + break; + case 4: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 3; + break; + case 5: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 4; + break; + case 6: + if (curChar == 117) + jjstateSet[jjnewStateCnt++] = 5; + break; + case 7: + if (curChar == 81) + jjstateSet[jjnewStateCnt++] = 6; + break; + case 8: + if (curChar == 109) + jjstateSet[jjnewStateCnt++] = 7; + break; + case 9: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 8; + break; + case 10: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 9; + break; + case 11: + if (curChar == 110) { + jjAddStates(26, 27); + } + break; + case 12: + if (curChar == 115) + kind = 31; + break; + case 13: + if (curChar == 116 && kind > 31) + kind = 31; + break; + case 14: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 13; + break; + case 15: + if (curChar == 83) + jjstateSet[jjnewStateCnt++] = 14; + break; + case 16: + if (curChar == 99) + jjstateSet[jjnewStateCnt++] = 15; + break; + case 17: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 16; + break; + case 18: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 17; + break; + case 19: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 18; + break; + case 20: + if (curChar == 109) + jjstateSet[jjnewStateCnt++] = 19; + break; + case 21: + if (curChar == 117) + jjstateSet[jjnewStateCnt++] = 20; + break; + default: + break; + } + } + while (i != startsAt); + } + else { + int hiByte = (curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 0: + if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 7) + kind = 7; + break; + default: + if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) + break; + else + break; + } + } + while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 22 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private final int jjStopStringLiteralDfa_2(int pos, long active0) { + switch (pos) { + case 0: + if ((active0 & 0x40000000000000L) != 0L) { + jjmatchedKind = 58; + return 6; + } + return -1; + default: + return -1; + } + } + + private final int jjStartNfa_2(int pos, long active0) { + return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1); + } + + private int jjMoveStringLiteralDfa0_2() { + switch (curChar) { + case 84: + return jjMoveStringLiteralDfa1_2(0x40000000000000L); + case 93: + return jjStopAtPos(0, 55); + case 125: + return jjStopAtPos(0, 56); + default: + return jjMoveNfa_2(0, 0); + } + } + + private int jjMoveStringLiteralDfa1_2(long active0) { + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_2(0, active0); + return 1; + } + switch (curChar) { + case 79: + if ((active0 & 0x40000000000000L) != 0L) + return jjStartNfaWithStates_2(1, 54, 6); + break; + default: + break; + } + return jjStartNfa_2(0, active0); + } + + private int jjStartNfaWithStates_2(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_2(state, pos + 1); + } + + private int jjMoveNfa_2(int startState, int curPos) { + int startsAt = 0; + jjnewStateCnt = 7; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (; ; ) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + do { + switch (jjstateSet[--i]) { + case 0: + if ((0xfffffffeffffffffL & l) != 0L) { + if (kind > 58) + kind = 58; + { + jjCheckNAdd(6); + } + } + if ((0x100002600L & l) != 0L) { + if (kind > 7) + kind = 7; + } + else if (curChar == 34) { + jjCheckNAddTwoStates(2, 4); + } + break; + case 1: + if (curChar == 34) { + jjCheckNAddTwoStates(2, 4); + } + break; + case 2: + if ((0xfffffffbffffffffL & l) != 0L) { + jjCheckNAddStates(30, 32); + } + break; + case 3: + if (curChar == 34) { + jjCheckNAddStates(30, 32); + } + break; + case 5: + if (curChar == 34 && kind > 57) + kind = 57; + break; + case 6: + if ((0xfffffffeffffffffL & l) == 0L) + break; + if (kind > 58) + kind = 58; + { + jjCheckNAdd(6); + } + break; + default: + break; + } + } + while (i != startsAt); + } + else if (curChar < 128) { + long l = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 0: + case 6: + if ((0xdfffffffdfffffffL & l) == 0L) + break; + if (kind > 58) + kind = 58; + { + jjCheckNAdd(6); + } + break; + case 2: { + jjAddStates(30, 32); + } + break; + case 4: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 3; + break; + default: + break; + } + } + while (i != startsAt); + } + else { + int hiByte = (curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 0: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { + if (kind > 7) + kind = 7; + } + if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { + if (kind > 58) + kind = 58; + { + jjCheckNAdd(6); + } + } + break; + case 2: + if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { + jjAddStates(30, 32); + } + break; + case 6: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 58) + kind = 58; + { + jjCheckNAdd(6); + } + break; + default: + if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) + break; + else + break; + } + } + while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + /** + * Token literal values. + */ + public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, null, null, null, "\146\156\72", "\172\154\72", "\53", + "\55", "\51", "\72", "\75", "\74", "\74\75", "\76", "\76\75", "\136", "\176", null, null, null, null, "\133", "\173", "\50", null, null, null, + "\141\146\164\145\162", "\142\145\146\157\162\145", null, "\143\157\156\164\141\151\156\151\156\147", "\145\170\164\145\156\144", "\157\162", null, + null, null, null, null, null, null, "\157\162\144\145\162\145\144", "\157\166\145\162\154\141\160\160\151\156\147", "\160\150\162\141\163\145", + "\165\156\157\162\144\145\162\145\144", null, "\167\151\154\144\143\141\162\144", "\167\151\164\150\151\156", "\124\117", "\135", "\175", null, null, + "\100", }; + + protected Token jjFillToken() { + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind); + t.kind = jjmatchedKind; + t.image = curTokenImage; + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; + } + + static final int[] jjnextStates = { 28, 30, 31, 15, 16, 18, 180, 185, 192, 198, 98, 110, 123, 135, 147, 158, 166, 173, 79, 84, 63, 72, 45, 52, 19, 36, 12, + 21, 2, 10, 2, 4, 5, }; + + private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { + switch (hiByte) { + case 48: + return ((jjbitVec0[i2] & l2) != 0L); + default: + return false; + } + } + + private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) { + switch (hiByte) { + case 0: + return ((jjbitVec3[i2] & l2) != 0L); + default: + if ((jjbitVec1[i1] & l1) != 0L) + return true; + return false; + } + } + + private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) { + switch (hiByte) { + case 0: + return ((jjbitVec3[i2] & l2) != 0L); + case 48: + return ((jjbitVec1[i2] & l2) != 0L); + default: + if ((jjbitVec4[i1] & l1) != 0L) + return true; + return false; + } + } + + int curLexState = 3; + int defaultLexState = 3; + int jjnewStateCnt; + int jjround; + int jjmatchedPos; + int jjmatchedKind; + + /** + * Get the next Token. + */ + public Token getNextToken() { + Token matchedToken; + int curPos = 0; + + EOFLoop: + for (; ; ) { + try { + curChar = input_stream.BeginToken(); + } + catch (Exception e) { + jjmatchedKind = 0; + jjmatchedPos = -1; + matchedToken = jjFillToken(); + return matchedToken; + } + + switch (curLexState) { + case 0: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + break; + case 1: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_1(); + break; + case 2: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_2(); + break; + case 3: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_3(); + break; + } + if (jjmatchedKind != 0x7fffffff) { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { + matchedToken = jjFillToken(); + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + return matchedToken; + } + else { + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { + input_stream.readChar(); + input_stream.backup(1); + } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } + } + + void SkipLexicalActions(Token matchedToken) { + switch (jjmatchedKind) { + default: + break; + } + } + + void MoreLexicalActions() { + jjimageLen += (lengthOfMatch = jjmatchedPos + 1); + switch (jjmatchedKind) { + default: + break; + } + } + + void TokenLexicalActions(Token matchedToken) { + switch (jjmatchedKind) { + default: + break; + } + } + + private void jjCheckNAdd(int state) { + if (jjrounds[state] != jjround) { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } + } + + private void jjAddStates(int start, int end) { + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } + while (start++ != end); + } + + private void jjCheckNAddTwoStates(int state1, int state2) { + jjCheckNAdd(state1); + jjCheckNAdd(state2); + } + + private void jjCheckNAddStates(int start, int end) { + do { + jjCheckNAdd(jjnextStates[start]); + } + while (start++ != end); + } + + /** + * Constructor. + */ + public ZuliaSyntaxParserTokenManager(CharStream stream) { + + input_stream = stream; + } + + /** + * Constructor. + */ + public ZuliaSyntaxParserTokenManager(CharStream stream, int lexState) { + ReInit(stream); + SwitchTo(lexState); + } + + /** + * Reinitialise parser. + */ + + public void ReInit(CharStream stream) { + + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); + } + + private void ReInitRounds() { + int i; + jjround = 0x80000001; + for (i = 199; i-- > 0; ) + jjrounds[i] = 0x80000000; + } + + /** + * Reinitialise parser. + */ + public void ReInit(CharStream stream, int lexState) { + ReInit(stream); + SwitchTo(lexState); + } + + /** + * Switch to specified lex state. + */ + public void SwitchTo(int lexState) { + if (lexState >= 4 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; + } + + /** + * Lexer state names. + */ + public static final String[] lexStateNames = { "Zulia", "Function", "Range", "DEFAULT", }; + + /** + * Lex State array. + */ + public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, + 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 3, -1, -1, -1, }; + static final long[] jjtoToken = { 0xfffffffffffff01L, }; + static final long[] jjtoSkip = { 0x80L, }; + static final long[] jjtoSpecial = { 0x0L, }; + static final long[] jjtoMore = { 0x0L, }; + protected CharStream input_stream; + + private final int[] jjrounds = new int[199]; + private final int[] jjstateSet = new int[2 * 199]; + private final StringBuilder jjimage = new StringBuilder(); + private StringBuilder image = jjimage; + private int jjimageLen; + private int lengthOfMatch; + protected int curChar; } From 80ef80a646953ca0e5c1f73cfb7dc1f87a90b9e7 Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Thu, 6 Jul 2023 17:06:01 -0400 Subject: [PATCH 03/11] refactor out term query and numeric set query code into SetQuery Helper implement new query syntax for field:zl:ns and field:zl:tq syntax in actual parser --- .../search/queryparser/SetQueryHelper.java | 110 ++++++++++++++++++ .../ZuliaFieldableQueryNodeBuilder.java | 23 ++++ .../builder/ZuliaQueryTreeBuilder.java | 2 + .../node/ZuliaFieldableQueryNode.java | 33 ++++++ .../node/ZuliaNumericSetQueryNode.java | 75 ++++++++++++ .../node/ZuliaTermsInSetQueryNode.java | 57 +++++++++ .../ZuliaFieldableQueryNodeProcessor.java | 43 +++++++ .../ZuliaQueryNodeProcessorPipeline.java | 2 + .../io/zulia/server/index/ZuliaIndex.java | 109 +++-------------- 9 files changed, 358 insertions(+), 96 deletions(-) create mode 100644 zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/SetQueryHelper.java create mode 100644 zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/builder/ZuliaFieldableQueryNodeBuilder.java create mode 100644 zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaFieldableQueryNode.java create mode 100644 zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaNumericSetQueryNode.java create mode 100644 zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaTermsInSetQueryNode.java create mode 100644 zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/processors/ZuliaFieldableQueryNodeProcessor.java diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/SetQueryHelper.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/SetQueryHelper.java new file mode 100644 index 00000000..383c6eff --- /dev/null +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/SetQueryHelper.java @@ -0,0 +1,110 @@ +package io.zulia.server.search.queryparser; + +import io.zulia.message.ZuliaIndex; +import io.zulia.server.config.IndexFieldInfo; +import io.zulia.server.field.FieldTypeUtil; +import org.apache.lucene.document.DoublePoint; +import org.apache.lucene.document.FloatPoint; +import org.apache.lucene.document.IntPoint; +import org.apache.lucene.document.LongPoint; +import org.apache.lucene.document.SortedNumericDocValuesField; +import org.apache.lucene.search.IndexOrDocValuesQuery; +import org.apache.lucene.search.MultiTermQuery; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.TermInSetQuery; +import org.apache.lucene.util.BytesRef; +import org.apache.lucene.util.NumericUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Supplier; + +public class SetQueryHelper { + + public static Query getNumericSetQuery(String field, IndexFieldInfo indexFieldInfo, Supplier> intSupplier, Supplier> longSupplier, + Supplier> floatSupplier, Supplier> doubleSupplier) { + ZuliaIndex.FieldConfig.FieldType fieldType = indexFieldInfo.getFieldType(); + String searchField = indexFieldInfo.getInternalFieldName(); + String sortField = indexFieldInfo.getInternalSortFieldName(); + + if (fieldType == null) { + throw new IllegalArgumentException("Field <" + field + "> is not indexed"); + } + else { + if (FieldTypeUtil.isNumericIntFieldType(fieldType)) { + List integerValueList = intSupplier.get(); + if (integerValueList.isEmpty()) { + throw new IllegalArgumentException("No integer values for integer field <" + field + "> for numeric set query"); + } + + Query pointQuery = IntPoint.newSetQuery(searchField, integerValueList); + if (sortField == null) { + return pointQuery; + } + long[] pointsArray = integerValueList.stream().mapToLong(Integer::intValue).toArray(); + return new IndexOrDocValuesQuery(pointQuery, SortedNumericDocValuesField.newSlowSetQuery(sortField, pointsArray)); + } + else if (FieldTypeUtil.isNumericLongFieldType(fieldType)) { + List longValueList = longSupplier.get(); + if (longValueList.isEmpty()) { + throw new IllegalArgumentException("No long values for long field <" + field + "> for numeric set query"); + } + + Query pointQuery = LongPoint.newSetQuery(searchField, longValueList); + if (sortField == null) { + return pointQuery; + } + long[] pointsArray = longValueList.stream().mapToLong(Long::longValue).toArray(); + return new IndexOrDocValuesQuery(pointQuery, SortedNumericDocValuesField.newSlowSetQuery(sortField, pointsArray)); + } + else if (FieldTypeUtil.isNumericFloatFieldType(fieldType)) { + List floatValueList = floatSupplier.get(); + if (floatValueList.isEmpty()) { + throw new IllegalArgumentException("No float values for float field <" + field + "> for numeric set query"); + } + + Query pointQuery = FloatPoint.newSetQuery(searchField, floatValueList); + if (sortField == null) { + return pointQuery; + } + long[] pointsArray = floatValueList.stream().mapToLong(NumericUtils::floatToSortableInt).toArray(); + return new IndexOrDocValuesQuery(pointQuery, SortedNumericDocValuesField.newSlowSetQuery(sortField, pointsArray)); + } + else if (FieldTypeUtil.isNumericDoubleFieldType(fieldType)) { + List doubleValueList = doubleSupplier.get(); + if (doubleValueList.isEmpty()) { + throw new IllegalArgumentException("No double values for double field <" + field + "> for numeric set query"); + } + + Query pointQuery = DoublePoint.newSetQuery(searchField, doubleValueList); + if (sortField == null) { + return pointQuery; + } + long[] pointsArray = doubleValueList.stream().mapToLong(NumericUtils::doubleToSortableLong).toArray(); + return new IndexOrDocValuesQuery(pointQuery, SortedNumericDocValuesField.newSlowSetQuery(sortField, pointsArray)); + } + } + throw new IllegalArgumentException("No field type of <" + fieldType + "> is not supported for numeric set queries"); + } + + public static Query getTermInSetQuery(List terms, String field, IndexFieldInfo indexFieldInfo) { + List termBytesRef = new ArrayList<>(); + for (String term : terms) { + termBytesRef.add(new BytesRef(term)); + } + + if (FieldTypeUtil.isStringFieldType(indexFieldInfo.getFieldType())) { + String sortField = indexFieldInfo.getInternalSortFieldName(); + + if (sortField != null) { + Query indexQuery = new TermInSetQuery(field, termBytesRef); + Query dvQuery = new TermInSetQuery(MultiTermQuery.DOC_VALUES_REWRITE, sortField, termBytesRef); + return new IndexOrDocValuesQuery(indexQuery, dvQuery); + } + + return new TermInSetQuery(field, termBytesRef); + } + throw new IllegalArgumentException( + "Field type of <" + indexFieldInfo.getFieldType() + "> is not supported for term queries. Only STRING is supported."); + } +} diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/builder/ZuliaFieldableQueryNodeBuilder.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/builder/ZuliaFieldableQueryNodeBuilder.java new file mode 100644 index 00000000..5e77694e --- /dev/null +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/builder/ZuliaFieldableQueryNodeBuilder.java @@ -0,0 +1,23 @@ +package io.zulia.server.search.queryparser.builder; + +import io.zulia.server.search.queryparser.node.ZuliaFieldableQueryNode; +import org.apache.lucene.queryparser.flexible.core.QueryNodeException; +import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode; +import org.apache.lucene.queryparser.flexible.standard.builders.StandardQueryBuilder; +import org.apache.lucene.search.Query; + +public class ZuliaFieldableQueryNodeBuilder implements StandardQueryBuilder { + + /** + * Constructs a {@link ZuliaFieldableQueryNodeBuilder} object. + */ + public ZuliaFieldableQueryNodeBuilder() { + // empty constructor + } + + @Override + public Query build(QueryNode queryNode) throws QueryNodeException { + ZuliaFieldableQueryNode fieldableQueryNode = (ZuliaFieldableQueryNode) queryNode; + return fieldableQueryNode.getQuery(); + } +} diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/builder/ZuliaQueryTreeBuilder.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/builder/ZuliaQueryTreeBuilder.java index 18e02b2f..c270a67e 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/builder/ZuliaQueryTreeBuilder.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/builder/ZuliaQueryTreeBuilder.java @@ -1,5 +1,6 @@ package io.zulia.server.search.queryparser.builder; +import io.zulia.server.search.queryparser.node.ZuliaFieldableQueryNode; import io.zulia.server.search.queryparser.node.ZuliaPointRangeQueryNode; import org.apache.lucene.queryparser.flexible.standard.builders.StandardQueryTreeBuilder; @@ -7,6 +8,7 @@ public class ZuliaQueryTreeBuilder extends StandardQueryTreeBuilder { public ZuliaQueryTreeBuilder() { setBuilder(ZuliaPointRangeQueryNode.class, new ZuliaPointRangeQueryNodeBuilder()); + setBuilder(ZuliaFieldableQueryNode.class, new ZuliaFieldableQueryNodeBuilder()); } } diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaFieldableQueryNode.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaFieldableQueryNode.java new file mode 100644 index 00000000..fc89f3aa --- /dev/null +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaFieldableQueryNode.java @@ -0,0 +1,33 @@ +package io.zulia.server.search.queryparser.node; + +import io.zulia.server.config.IndexFieldInfo; +import org.apache.lucene.queryparser.flexible.core.nodes.FieldableNode; +import org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl; +import org.apache.lucene.search.Query; + +import java.util.Objects; + +public abstract class ZuliaFieldableQueryNode extends QueryNodeImpl implements FieldableNode { + private CharSequence field; + private IndexFieldInfo indexFieldInfo; + + @Override + public CharSequence getField() { + return field; + } + + @Override + public void setField(CharSequence fieldName) { + this.field = Objects.requireNonNull(fieldName.toString()); + } + + public abstract Query getQuery(); + + public void setIndexFieldInfo(IndexFieldInfo indexFieldInfo) { + this.indexFieldInfo = indexFieldInfo; + } + + public IndexFieldInfo getIndexFieldInfo() { + return indexFieldInfo; + } +} diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaNumericSetQueryNode.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaNumericSetQueryNode.java new file mode 100644 index 00000000..fb3c2cdd --- /dev/null +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaNumericSetQueryNode.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.zulia.server.search.queryparser.node; + +import io.zulia.server.search.queryparser.SetQueryHelper; +import org.apache.lucene.queryparser.flexible.core.parser.EscapeQuerySyntax; +import org.apache.lucene.queryparser.flexible.standard.parser.EscapeQuerySyntaxImpl; +import org.apache.lucene.search.Query; + +import java.util.List; +import java.util.Locale; +import java.util.Objects; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +public class ZuliaNumericSetQueryNode extends ZuliaFieldableQueryNode { + private final List terms; + + public ZuliaNumericSetQueryNode(CharSequence field, List terms) { + setField(field); + this.terms = Objects.requireNonNull(terms); + } + + public Query getQuery() { + Objects.requireNonNull(getField(), "Field must not be null for numeric set queries"); + Objects.requireNonNull(getIndexFieldInfo(), "Field <" + getField() + "> must be indexed for numeric set queries"); + return SetQueryHelper.getNumericSetQuery(getField().toString(), getIndexFieldInfo(), intTerms(), longTerms(), floatTerms(), doubleTerms()); + } + + public Supplier> intTerms() { + return () -> terms.stream().map(Object::toString).map(Integer::parseInt).collect(Collectors.toList()); + } + + public Supplier> longTerms() { + return () -> terms.stream().map(Object::toString).map(Long::parseLong).collect(Collectors.toList()); + } + + public Supplier> floatTerms() { + return () -> terms.stream().map(Object::toString).map(Float::parseFloat).collect(Collectors.toList()); + } + + public Supplier> doubleTerms() { + return () -> terms.stream().map(Object::toString).map(Double::parseDouble).collect(Collectors.toList()); + } + + @Override + public String toQueryString(EscapeQuerySyntax escapeSyntaxParser) { + return String.format(Locale.ROOT, "%s:numericSet(%s)", getField(), terms); + } + + @Override + public String toString() { + return toQueryString(new EscapeQuerySyntaxImpl()); + } + + @Override + public ZuliaNumericSetQueryNode cloneTree() { + return new ZuliaNumericSetQueryNode(getField(), terms); + } + +} diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaTermsInSetQueryNode.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaTermsInSetQueryNode.java new file mode 100644 index 00000000..5204b67e --- /dev/null +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaTermsInSetQueryNode.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.zulia.server.search.queryparser.node; + +import io.zulia.server.search.queryparser.SetQueryHelper; +import org.apache.lucene.queryparser.flexible.core.parser.EscapeQuerySyntax; +import org.apache.lucene.queryparser.flexible.standard.parser.EscapeQuerySyntaxImpl; +import org.apache.lucene.search.Query; + +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +public class ZuliaTermsInSetQueryNode extends ZuliaFieldableQueryNode { + private final List terms; + + public ZuliaTermsInSetQueryNode(CharSequence field, List terms) { + setField(field); + this.terms = Objects.requireNonNull(terms); + } + + public Query getQuery() { + Objects.requireNonNull(getField(), "Field must not be null for term set queries."); + Objects.requireNonNull(getIndexFieldInfo(), "Field <" + getField() + "> must be indexed for term set queries"); + return SetQueryHelper.getTermInSetQuery(terms.stream().map(Object::toString).toList(), getField().toString(), getIndexFieldInfo()); + } + + @Override + public String toQueryString(EscapeQuerySyntax escapeSyntaxParser) { + return String.format(Locale.ROOT, "%s:termQuery(%s)", getField(), terms); + } + + @Override + public String toString() { + return toQueryString(new EscapeQuerySyntaxImpl()); + } + + @Override + public ZuliaTermsInSetQueryNode cloneTree() { + return new ZuliaTermsInSetQueryNode(getField(), terms); + } + +} diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/processors/ZuliaFieldableQueryNodeProcessor.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/processors/ZuliaFieldableQueryNodeProcessor.java new file mode 100644 index 00000000..51229108 --- /dev/null +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/processors/ZuliaFieldableQueryNodeProcessor.java @@ -0,0 +1,43 @@ +package io.zulia.server.search.queryparser.processors; + +import io.zulia.server.config.IndexFieldInfo; +import io.zulia.server.config.ServerIndexConfig; +import io.zulia.server.search.queryparser.node.ZuliaFieldableQueryNode; +import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode; +import org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl; + +import java.util.List; + +public class ZuliaFieldableQueryNodeProcessor extends QueryNodeProcessorImpl { + + /** + * Constructs a {@link ZuliaFieldableQueryNodeProcessor} object. + */ + public ZuliaFieldableQueryNodeProcessor() { + // empty constructor + } + + @Override + protected QueryNode postProcessNode(QueryNode node) { + + if (node instanceof ZuliaFieldableQueryNode zuliaFieldableQueryNode) { + String field = zuliaFieldableQueryNode.getField().toString(); + ServerIndexConfig indexConfig = getQueryConfigHandler().get(ZuliaQueryNodeProcessorPipeline.ZULIA_INDEX_CONFIG); + IndexFieldInfo indexFieldInfo = indexConfig.getIndexFieldInfo(field); + if (indexFieldInfo != null) { + zuliaFieldableQueryNode.setIndexFieldInfo(indexFieldInfo); + } + } + return node; + } + + @Override + protected QueryNode preProcessNode(QueryNode node) { + return node; + } + + @Override + protected List setChildrenOrder(List children) { + return children; + } +} diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/processors/ZuliaQueryNodeProcessorPipeline.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/processors/ZuliaQueryNodeProcessorPipeline.java index c798ed64..aa93ba39 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/processors/ZuliaQueryNodeProcessorPipeline.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/processors/ZuliaQueryNodeProcessorPipeline.java @@ -50,6 +50,8 @@ public ZuliaQueryNodeProcessorPipeline(QueryConfigHandler queryConfig) { add(new OpenRangeQueryNodeProcessor()); //zulia - add ZuliaPointQueryNodeProcessor comment PointRangeQueryNodeProcessor add(new ZuliaPointQueryNodeProcessor()); + add(new ZuliaFieldableQueryNodeProcessor()); + //add(new PointRangeQueryNodeProcessor()); //zulia - remove term range query parser, replaced by ZuliaDateRangeQueryNodeProcessor above //add(new TermRangeQueryNodeProcessor()); diff --git a/zulia-server/src/main/java/io/zulia/server/index/ZuliaIndex.java b/zulia-server/src/main/java/io/zulia/server/index/ZuliaIndex.java index 1e9ad584..38843a9f 100644 --- a/zulia-server/src/main/java/io/zulia/server/index/ZuliaIndex.java +++ b/zulia-server/src/main/java/io/zulia/server/index/ZuliaIndex.java @@ -1,5 +1,6 @@ package io.zulia.server.index; +import com.google.protobuf.ProtocolStringList; import io.zulia.ZuliaFieldConstants; import io.zulia.message.ZuliaBase; import io.zulia.message.ZuliaBase.AssociatedDocument; @@ -35,6 +36,7 @@ import io.zulia.server.filestorage.DocumentStorage; import io.zulia.server.search.QueryCacheKey; import io.zulia.server.search.ShardQuery; +import io.zulia.server.search.queryparser.SetQueryHelper; import io.zulia.server.search.queryparser.ZuliaFlexibleQueryParser; import io.zulia.server.util.DeletingFileVisitor; import io.zulia.util.ZuliaThreadFactory; @@ -42,11 +44,6 @@ import org.apache.commons.pool2.PooledObject; import org.apache.commons.pool2.impl.DefaultPooledObject; import org.apache.commons.pool2.impl.GenericObjectPool; -import org.apache.lucene.document.DoublePoint; -import org.apache.lucene.document.FloatPoint; -import org.apache.lucene.document.IntPoint; -import org.apache.lucene.document.LongPoint; -import org.apache.lucene.document.SortedNumericDocValuesField; import org.apache.lucene.expressions.Expression; import org.apache.lucene.expressions.SimpleBindings; import org.apache.lucene.expressions.js.JavascriptCompiler; @@ -60,15 +57,11 @@ import org.apache.lucene.search.ConstantScoreQuery; import org.apache.lucene.search.DoubleValuesSource; import org.apache.lucene.search.FieldDoc; -import org.apache.lucene.search.IndexOrDocValuesQuery; import org.apache.lucene.search.KnnFloatVectorQuery; import org.apache.lucene.search.MatchAllDocsQuery; -import org.apache.lucene.search.MultiTermQuery; import org.apache.lucene.search.Query; -import org.apache.lucene.search.TermInSetQuery; import org.apache.lucene.search.TermQuery; import org.apache.lucene.util.BytesRef; -import org.apache.lucene.util.NumericUtils; import org.bson.Document; import java.io.IOException; @@ -406,42 +399,30 @@ else if (query.getQfList().size() == 1) { } private Query getTermInSetQuery(ZuliaQuery.Query query, String field) { - - List termBytesRef = new ArrayList<>(); - for (String term : query.getTermList()) { - termBytesRef.add(new BytesRef(term)); - } - IndexFieldInfo indexFieldInfo = indexConfig.getIndexFieldInfo(field); if (indexFieldInfo == null) { throw new RuntimeException("Field <" + field + "> is not indexed"); } - String sortField = indexFieldInfo.getInternalSortFieldName(); + return SetQueryHelper.getTermInSetQuery(query.getTermList(), field, indexFieldInfo); + } - if (sortField != null) { - Query indexQuery = new TermInSetQuery(field, termBytesRef); - Query dvQuery = new TermInSetQuery(MultiTermQuery.DOC_VALUES_REWRITE, sortField, termBytesRef); - return new IndexOrDocValuesQuery(indexQuery, dvQuery); - } - return new TermInSetQuery(field, termBytesRef); - } public Query handleNumericSetQuery(ZuliaQuery.Query query) { - - if (query.getQfList().isEmpty()) { + ProtocolStringList qfList = query.getQfList(); + if (qfList.isEmpty()) { throw new IllegalArgumentException("Numeric set query must give at least one query field (qf)"); } - else if (query.getQfList().size() == 1) { - return getNumericSetQuery(query, query.getQfList().get(0)); + else if (qfList.size() == 1) { + return getNumericSetQuery(query.getNumericSet(), qfList.get(0)); } else { BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder(); booleanQueryBuilder.setMinimumNumberShouldMatch(query.getMm()); - for (String field : query.getQfList()) { - Query inSetQuery = getNumericSetQuery(query, field); + for (String field : qfList) { + Query inSetQuery = getNumericSetQuery(query.getNumericSet(), field); booleanQueryBuilder.add(inSetQuery, BooleanClause.Occur.SHOULD); } return booleanQueryBuilder.build(); @@ -449,74 +430,10 @@ else if (query.getQfList().size() == 1) { } - private Query getNumericSetQuery(ZuliaQuery.Query query, String field) { + private Query getNumericSetQuery(ZuliaQuery.NumericSet numericSet, String field) { IndexFieldInfo indexFieldInfo = indexConfig.getIndexFieldInfo(field); - - FieldConfig.FieldType fieldType = indexFieldInfo.getFieldType(); - String searchField = indexFieldInfo.getInternalFieldName(); - String sortField = indexFieldInfo.getInternalSortFieldName(); - - ZuliaQuery.NumericSet numericSet = query.getNumericSet(); - - if (fieldType == null) { - throw new IllegalArgumentException("Field <" + field + "> is not indexed"); - } - else { - if (FieldTypeUtil.isNumericIntFieldType(fieldType)) { - List integerValueList = numericSet.getIntegerValueList(); - if (integerValueList.isEmpty()) { - throw new IllegalArgumentException("No integer values for integer field <" + field + "> for numeric set query"); - } - - Query pointQuery = IntPoint.newSetQuery(searchField, integerValueList); - if (sortField == null) { - return pointQuery; - } - long[] pointsArray = integerValueList.stream().mapToLong(Integer::intValue).toArray(); - return new IndexOrDocValuesQuery(pointQuery, SortedNumericDocValuesField.newSlowSetQuery(sortField, pointsArray)); - } - else if (FieldTypeUtil.isNumericLongFieldType(fieldType)) { - List longValueList = numericSet.getLongValueList(); - if (longValueList.isEmpty()) { - throw new IllegalArgumentException("No long values for long field <" + field + "> for numeric set query"); - } - - Query pointQuery = LongPoint.newSetQuery(searchField, longValueList); - if (sortField == null) { - return pointQuery; - } - long[] pointsArray = longValueList.stream().mapToLong(Long::longValue).toArray(); - return new IndexOrDocValuesQuery(pointQuery, SortedNumericDocValuesField.newSlowSetQuery(sortField, pointsArray)); - } - else if (FieldTypeUtil.isNumericFloatFieldType(fieldType)) { - List floatValueList = numericSet.getFloatValueList(); - if (floatValueList.isEmpty()) { - throw new IllegalArgumentException("No float values for float field <" + field + "> for numeric set query"); - } - - Query pointQuery = FloatPoint.newSetQuery(searchField, floatValueList); - if (sortField == null) { - return pointQuery; - } - long[] pointsArray = floatValueList.stream().mapToLong(NumericUtils::floatToSortableInt).toArray(); - return new IndexOrDocValuesQuery(pointQuery, SortedNumericDocValuesField.newSlowSetQuery(sortField, pointsArray)); - } - else if (FieldTypeUtil.isNumericDoubleFieldType(fieldType)) { - List doubleValueList = numericSet.getDoubleValueList(); - if (doubleValueList.isEmpty()) { - throw new IllegalArgumentException("No double values for double field <" + field + "> for numeric set query"); - } - - Query pointQuery = DoublePoint.newSetQuery(searchField, doubleValueList); - if (sortField == null) { - return pointQuery; - } - long[] pointsArray = doubleValueList.stream().mapToLong(NumericUtils::doubleToSortableLong).toArray(); - return new IndexOrDocValuesQuery(pointQuery, SortedNumericDocValuesField.newSlowSetQuery(sortField, pointsArray)); - } - } - throw new IllegalArgumentException("No field type of <" + fieldType + "> is not supported for numeric set queries"); - + return SetQueryHelper.getNumericSetQuery(field, indexFieldInfo, numericSet::getIntegerValueList, numericSet::getLongValueList, + numericSet::getFloatValueList, numericSet::getDoubleValueList); } public Query handleVectorQuery(ZuliaQuery.Query query) throws Exception { From 3aa6051c9e06be65be36b8e033c063b29af635b4 Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Thu, 6 Jul 2023 20:03:26 -0400 Subject: [PATCH 04/11] upgrade flapdoodle to 4.7.0 from 3.5.2 --- zulia-server/build.gradle.kts | 2 +- .../server/test/mongo/MongoTestInstance.java | 26 +++++++------------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/zulia-server/build.gradle.kts b/zulia-server/build.gradle.kts index 09d90769..19785bfb 100644 --- a/zulia-server/build.gradle.kts +++ b/zulia-server/build.gradle.kts @@ -67,7 +67,7 @@ dependencies { testImplementation(platform("io.micronaut:micronaut-bom:$micronautVersion")) testImplementation("org.junit.jupiter:junit-jupiter-api") testImplementation("io.micronaut.test:micronaut-test-junit5") - testImplementation("de.flapdoodle.embed:de.flapdoodle.embed.mongo:3.5.2") + testImplementation("de.flapdoodle.embed:de.flapdoodle.embed.mongo:4.7.0") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") api("org.yaml:snakeyaml:$snakeYamlVersion") diff --git a/zulia-server/src/test/java/io/zulia/server/test/mongo/MongoTestInstance.java b/zulia-server/src/test/java/io/zulia/server/test/mongo/MongoTestInstance.java index ac82ece2..80f7172a 100644 --- a/zulia-server/src/test/java/io/zulia/server/test/mongo/MongoTestInstance.java +++ b/zulia-server/src/test/java/io/zulia/server/test/mongo/MongoTestInstance.java @@ -1,21 +1,21 @@ package io.zulia.server.test.mongo; -import de.flapdoodle.embed.mongo.MongodExecutable; -import de.flapdoodle.embed.mongo.MongodProcess; -import de.flapdoodle.embed.mongo.MongodStarter; -import de.flapdoodle.embed.mongo.config.MongodConfig; import de.flapdoodle.embed.mongo.config.Net; import de.flapdoodle.embed.mongo.distribution.Version; +import de.flapdoodle.embed.mongo.transitions.Mongod; +import de.flapdoodle.embed.mongo.transitions.RunningMongodProcess; import de.flapdoodle.embed.process.runtime.Network; +import de.flapdoodle.reverse.TransitionWalker; +import de.flapdoodle.reverse.transitions.Start; public class MongoTestInstance { private static final String LOCAL_INSTANCE_URL_HOST = "mongodb://127.0.0.1"; - private static MongodStarter mongodStarter = MongodStarter.getDefaultInstance(); private Integer port; private String testInstanceUrl; - private MongodProcess mongodProcess; + + private TransitionWalker.ReachedState running; public MongoTestInstance() { } @@ -25,22 +25,16 @@ public String getInstanceUrl() { } public void shutdown() { - if (mongodProcess != null) { - mongodProcess.stop(); + if (running != null) { + running.close(); } } public void start() { try { - - port = Network.freeServerPort(Network.getLocalHost()); - - MongodConfig mongodConfig = MongodConfig.builder().version(Version.Main.PRODUCTION).net(new Net(port, Network.localhostIsIPv6())).build(); - - MongodExecutable mongodExecutable = mongodStarter.prepare(mongodConfig); - mongodProcess = mongodExecutable.start(); - + port = Network.freeServerPort(de.flapdoodle.net.Net.getLocalHost()); + running = Mongod.builder().net(Start.to(Net.class).initializedWith(Net.defaults().withPort(port))).build().start(Version.Main.V6_0); testInstanceUrl = buildTestInstanceUrl(); } From ae81dc5c3d2cb2c015413d10f5a0cece7b54cf7f Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Sat, 8 Jul 2023 08:56:32 -0400 Subject: [PATCH 05/11] fix spacing in exception --- zulia-client/src/main/java/io/zulia/client/pool/ZuliaPool.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zulia-client/src/main/java/io/zulia/client/pool/ZuliaPool.java b/zulia-client/src/main/java/io/zulia/client/pool/ZuliaPool.java index c7d10492..8be2dae9 100644 --- a/zulia-client/src/main/java/io/zulia/client/pool/ZuliaPool.java +++ b/zulia-client/src/main/java/io/zulia/client/pool/ZuliaPool.java @@ -229,7 +229,7 @@ else if (command instanceof MultiIndexRoutableCommand) { throw new Exception(grpcCommand.getClass().getSimpleName() + ": " + errorMessage); } else { - throw new IllegalArgumentException(grpcCommand.getClass().getSimpleName() + ":" + errorMessage); + throw new IllegalArgumentException(grpcCommand.getClass().getSimpleName() + ": " + errorMessage); } } else { From 09397708f5f73c6e45cfb9f827fe31b90a6f8788 Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Sat, 8 Jul 2023 09:02:03 -0400 Subject: [PATCH 06/11] fix exception when field is not set in the directly query (set via default fields) --- .../search/queryparser/node/ZuliaFieldableQueryNode.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaFieldableQueryNode.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaFieldableQueryNode.java index fc89f3aa..fb1988cb 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaFieldableQueryNode.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/node/ZuliaFieldableQueryNode.java @@ -5,8 +5,6 @@ import org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl; import org.apache.lucene.search.Query; -import java.util.Objects; - public abstract class ZuliaFieldableQueryNode extends QueryNodeImpl implements FieldableNode { private CharSequence field; private IndexFieldInfo indexFieldInfo; @@ -18,7 +16,7 @@ public CharSequence getField() { @Override public void setField(CharSequence fieldName) { - this.field = Objects.requireNonNull(fieldName.toString()); + this.field = fieldName != null ? fieldName.toString() : null; } public abstract Query getQuery(); From ac72f23af48afb9687b07b07df1a1bff803bfdae Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Sat, 8 Jul 2023 09:02:24 -0400 Subject: [PATCH 07/11] formatting --- .../queryparser/parser/ParseException.java | 342 +- .../search/queryparser/parser/Token.java | 246 +- .../queryparser/parser/TokenMgrError.java | 256 +- .../queryparser/parser/ZuliaSyntaxParser.java | 5750 ++++++++--------- .../parser/ZuliaSyntaxParserConstants.java | 514 +- .../parser/ZuliaSyntaxParserTokenManager.java | 4973 +++++++------- 6 files changed, 6041 insertions(+), 6040 deletions(-) diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ParseException.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ParseException.java index c6899403..af6e9140 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ParseException.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ParseException.java @@ -18,177 +18,177 @@ */ public class ParseException extends QueryNodeParseException { - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; - - /** - * The end of line string for this machine. - */ - protected static String EOL = System.getProperty("line.separator", "\n"); - - /** - * 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. - */ - public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) { - super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal))); - this.currentToken = currentTokenVal; - this.expectedTokenSequences = expectedTokenSequencesVal; - this.tokenImage = tokenImageVal; - } - - /** - * The following constructors are for use by you for whatever - * purpose you can think of. Constructing the exception in this - * manner makes the exception behave in the normal way - i.e., as - * documented in the class "Throwable". The fields "errorToken", - * "expectedTokenSequences", and "tokenImage" do not contain - * relevant information. The JavaCC generated code does not use - * these constructors. - */ - - public ParseException() { - super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, "Error")); - } - - /** - * Constructor with message. - */ - public ParseException(Message message) { - super(message); - } - - /** - * This is the last token that has been consumed successfully. If - * this object has been created due to a parse error, the token - * followng this token will (therefore) be the first error token. - */ - public Token currentToken; - - /** - * Each entry in this array is an array of integers. Each array - * of integers represents a sequence of tokens (by their ordinal - * values) that is expected at this point of the parse. - */ - public int[][] expectedTokenSequences; - - /** - * This is a reference to the "tokenImage" array of the generated - * parser within which the parse error occurred. This array is - * defined in the generated ...Constants interface. - */ - public String[] tokenImage; - - /** - * 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) the correct error message - * gets displayed. - */ - private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { - - StringBuilder expected = new StringBuilder(); - int maxSize = 0; - for (int i = 0; i < expectedTokenSequences.length; i++) { - if (maxSize < expectedTokenSequences[i].length) { - maxSize = expectedTokenSequences[i].length; - } - for (int j = 0; j < expectedTokenSequences[i].length; j++) { - expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); - } - if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { - expected.append("..."); - } - expected.append(EOL).append(" "); - } - String retval = "Encountered \""; - Token tok = currentToken.next; - for (int i = 0; i < maxSize; i++) { - if (i != 0) - retval += " "; - if (tok.kind == 0) { - retval += tokenImage[0]; - break; - } - retval += " " + tokenImage[tok.kind]; - retval += " \""; - retval += add_escapes(tok.image); - retval += " \""; - tok = tok.next; - } - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - retval += "." + EOL; - - if (expectedTokenSequences.length == 0) { - // Nothing to add here - } - else { - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + EOL + " "; - } - else { - retval += "Was expecting one of:" + EOL + " "; - } - retval += expected.toString(); - } - - return retval; - } - - /** - * Used to convert raw characters to their escaped version - * when these raw version cannot be used as part of an ASCII - * string literal. - */ - static String add_escapes(String str) { - StringBuilder retval = new StringBuilder(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - 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(); - } + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * The end of line string for this machine. + */ + protected static String EOL = System.getProperty("line.separator", "\n"); + + /** + * 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. + */ + public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) { + super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal))); + this.currentToken = currentTokenVal; + this.expectedTokenSequences = expectedTokenSequencesVal; + this.tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, "Error")); + } + + /** + * Constructor with message. + */ + public ParseException(Message message) { + super(message); + } + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * 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) the correct error message + * gets displayed. + */ + private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { + + StringBuilder expected = new StringBuilder(); + int maxSize = 0; + for (int i = 0; i < expectedTokenSequences.length; i++) { + if (maxSize < expectedTokenSequences[i].length) { + maxSize = expectedTokenSequences[i].length; + } + for (int j = 0; j < expectedTokenSequences[i].length; j++) { + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); + } + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + expected.append("..."); + } + expected.append(EOL).append(" "); + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) + retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += " " + tokenImage[tok.kind]; + retval += " \""; + retval += add_escapes(tok.image); + retval += " \""; + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + EOL; + + if (expectedTokenSequences.length == 0) { + // Nothing to add here + } + else { + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + EOL + " "; + } + else { + retval += "Was expecting one of:" + EOL + " "; + } + retval += expected.toString(); + } + + return retval; + } + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + */ + static String add_escapes(String str) { + StringBuilder retval = new StringBuilder(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) { + 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(); + } } /* (filtered)*/ diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/Token.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/Token.java index a01d2777..6ace842a 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/Token.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/Token.java @@ -8,129 +8,129 @@ public class Token implements java.io.Serializable { - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; - - /** - * An integer that describes the kind of this token. This numbering - * system is determined by JavaCCParser, and a table of these numbers is - * stored in the file ...Constants.java. - */ - public int kind; - - /** - * The line number of the first character of this Token. - */ - public int beginLine; - /** - * The column number of the first character of this Token. - */ - public int beginColumn; - /** - * The line number of the last character of this Token. - */ - public int endLine; - /** - * The column number of the last character of this Token. - */ - public int endColumn; - - /** - * The string image of the token. - */ - public String image; - - /** - * A reference to the next regular (non-special) token from the input - * stream. If this is the last token from the input stream, or if the - * token manager has not read tokens beyond this one, this field is - * set to null. This is true only if this token is also a regular - * token. Otherwise, see below for a description of the contents of - * this field. - */ - public Token next; - - /** - * This field is used to access special tokens that occur prior to this - * token, but after the immediately preceding regular (non-special) token. - * If there are no such special tokens, this field is set to null. - * When there are more than one such special token, this field refers - * to the last of these special tokens, which in turn refers to the next - * previous special token through its specialToken field, and so on - * until the first special token (whose specialToken field is null). - * The next fields of special tokens refer to other special tokens that - * immediately follow it (without an intervening regular token). If there - * is no such token, this field is null. - */ - public Token specialToken; - - /** - * An optional attribute value of the Token. - * Tokens which are not used as syntactic sugar will often contain - * meaningful values that will be used later on by the compiler or - * interpreter. This attribute value is often different from the image. - * Any subclass of Token that actually wants to return a non-null value can - * override this method as appropriate. - */ - public Object getValue() { - return null; - } - - /** - * No-argument constructor - */ - public Token() { - } - - /** - * Constructs a new token for the specified Image. - */ - public Token(int kind) { - this(kind, null); - } - - /** - * Constructs a new token for the specified Image and Kind. - */ - public Token(int kind, String image) { - this.kind = kind; - this.image = image; - } - - /** - * Returns the image. - */ - @Override - public String toString() { - return image; - } - - /** - * Returns a new Token object, by default. However, if you want, you - * can create and return subclass objects based on the value of ofKind. - * Simply add the cases to the switch for all those special cases. - * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simply add something like : - *

- * case MyParserConstants.ID : return new IDToken(ofKind, image); - *

- * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use sit in your lexical actions. - */ - public static Token newToken(int ofKind, String image) { - switch (ofKind) { - default: - return new Token(ofKind, image); - } - } - - public static Token newToken(int ofKind) { - return newToken(ofKind, null); - } + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** + * The line number of the first character of this Token. + */ + public int beginLine; + /** + * The column number of the first character of this Token. + */ + public int beginColumn; + /** + * The line number of the last character of this Token. + */ + public int endLine; + /** + * The column number of the last character of this Token. + */ + public int endColumn; + + /** + * The string image of the token. + */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** + * An optional attribute value of the Token. + * Tokens which are not used as syntactic sugar will often contain + * meaningful values that will be used later on by the compiler or + * interpreter. This attribute value is often different from the image. + * Any subclass of Token that actually wants to return a non-null value can + * override this method as appropriate. + */ + public Object getValue() { + return null; + } + + /** + * No-argument constructor + */ + public Token() { + } + + /** + * Constructs a new token for the specified Image. + */ + public Token(int kind) { + this(kind, null); + } + + /** + * Constructs a new token for the specified Image and Kind. + */ + public Token(int kind, String image) { + this.kind = kind; + this.image = image; + } + + /** + * Returns the image. + */ + @Override + public String toString() { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simply add something like : + *

+ * case MyParserConstants.ID : return new IDToken(ofKind, image); + *

+ * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use sit in your lexical actions. + */ + public static Token newToken(int ofKind, String image) { + switch (ofKind) { + default: + return new Token(ofKind, image); + } + } + + public static Token newToken(int ofKind) { + return newToken(ofKind, null); + } } /* (filtered)*/ diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/TokenMgrError.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/TokenMgrError.java index e1a3fa88..7d96d29d 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/TokenMgrError.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/TokenMgrError.java @@ -7,146 +7,146 @@ */ public class TokenMgrError extends Error { - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ - /** - * Lexical error occurred. - */ - public static final int LEXICAL_ERROR = 0; + /** + * Lexical error occurred. + */ + public static final int LEXICAL_ERROR = 0; - /** - * An attempt was made to create a second instance of a static token manager. - */ - public static final int STATIC_LEXER_ERROR = 1; + /** + * An attempt was made to create a second instance of a static token manager. + */ + public static final int STATIC_LEXER_ERROR = 1; - /** - * Tried to change to an invalid lexical state. - */ - public static final int INVALID_LEXICAL_STATE = 2; + /** + * Tried to change to an invalid lexical state. + */ + public static final int INVALID_LEXICAL_STATE = 2; - /** - * Detected (and bailed out of) an infinite loop in the token manager. - */ - public static final int LOOP_DETECTED = 3; + /** + * Detected (and bailed out of) an infinite loop in the token manager. + */ + public 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; + /** + * 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) { - StringBuilder retval = new StringBuilder(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - 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(); - } + /** + * Replaces unprintable characters by their escaped (or unicode escaped) + * equivalents in the given string + */ + protected static final String addEscapes(String str) { + StringBuilder retval = new StringBuilder(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) { + 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 LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) { - char curChar1 = (char) curChar; - return ("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? - " " : - ("\"" + addEscapes(String.valueOf(curChar1)) + "\"") + " (" + 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 LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) { + char curChar1 = (char) curChar; + return ("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? + " " : + ("\"" + addEscapes(String.valueOf(curChar1)) + "\"") + " (" + 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. - */ - @Override - 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. + */ + @Override + 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, int curChar, int reason) { - this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); - } + /** + * Full Constructor. + */ + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) { + this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } } /* (filtered)*/ diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.java index 27fd5a2a..94f69e4c 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParser.java @@ -57,2880 +57,2880 @@ * Parser for the standard Lucene syntax */ public class ZuliaSyntaxParser implements SyntaxParser, ZuliaSyntaxParserConstants { - public ZuliaSyntaxParser() { - this(new FastCharStream(Reader.nullReader())); - } - - /** - * Parses a query string, returning a {@link org.apache.lucene.queryparser.flexible.core.nodes.QueryNode}. - * - * @param query the query string to be parsed. - * @throws ParseException if the parsing fails - */ - @Override - public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException { - ReInit(new FastCharStream(new StringReader(query.toString()))); - try { - return TopLevelQuery(field); - } - catch (ParseException tme) { - tme.setQuery(query); - throw tme; - } - catch (Error tme) { - Message message = new MessageImpl(QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, tme.getMessage()); - QueryNodeParseException e = new QueryNodeParseException(tme); - e.setQuery(query); - e.setNonLocalizedMessage(message); - throw e; - } - } - - public static float parseFloat(Token token) { - return Float.parseFloat(token.image); - } - - public static int parseInt(Token token) { - return Integer.parseInt(token.image); - } - - final public QueryNode TopLevelQuery(CharSequence field) throws ParseException { - QueryNode q; - q = Query(field); - jj_consume_token(0); - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode Query(CharSequence field) throws ParseException { - ArrayList clauses = new ArrayList<>(); - QueryNode node; - label_1: - while (true) { - node = DisjQuery(field); - clauses.add(node); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case NOT: - case FN_PREFIX: - case ZL_PREFIX: - case PLUS: - case MINUS: - case QUOTED: - case NUMBER: - case TERM: - case REGEXPTERM: - case RANGEIN_START: - case RANGEEX_START: - case LPAREN: { - ; - break; - } - default: - jj_la1[0] = jj_gen; - break label_1; - } - } - // Handle the case of a "pure" negation query which - // needs to be wrapped as a boolean query, otherwise - // the returned result drops the negation. - if (clauses.size() == 1) { - QueryNode first = clauses.get(0); - if (first instanceof ModifierQueryNode && ((ModifierQueryNode) first).getModifier() == ModifierQueryNode.Modifier.MOD_NOT) { - clauses.set(0, new BooleanQueryNode(Collections.singletonList(first))); - } - } - - { - if ("" != null) - return clauses.size() == 1 ? clauses.get(0) : new BooleanQueryNode(clauses); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode DisjQuery(CharSequence field) throws ParseException { - ArrayList clauses = new ArrayList<>(); - QueryNode node; - node = ConjQuery(field); - clauses.add(node); - label_2: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case OR: { - ; - break; - } - default: - jj_la1[1] = jj_gen; - break label_2; - } - jj_consume_token(OR); - node = ConjQuery(field); - clauses.add(node); - } - { - if ("" != null) - return clauses.size() == 1 ? clauses.get(0) : new OrQueryNode(clauses); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode ConjQuery(CharSequence field) throws ParseException { - ArrayList clauses = new ArrayList<>(); - QueryNode node; - node = ModClause(field); - clauses.add(node); - label_3: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case AND: { - ; - break; - } - default: - jj_la1[2] = jj_gen; - break label_3; - } - jj_consume_token(AND); - node = ModClause(field); - clauses.add(node); - } - { - if ("" != null) - return clauses.size() == 1 ? clauses.get(0) : new AndQueryNode(clauses); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode ModClause(CharSequence field) throws ParseException { - QueryNode q; - ModifierQueryNode.Modifier modifier = ModifierQueryNode.Modifier.MOD_NONE; - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case NOT: - case PLUS: - case MINUS: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case PLUS: { - jj_consume_token(PLUS); - modifier = ModifierQueryNode.Modifier.MOD_REQ; - break; - } - case NOT: - case MINUS: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case MINUS: { - jj_consume_token(MINUS); - break; - } - case NOT: { - jj_consume_token(NOT); - break; - } - default: - jj_la1[3] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - modifier = ModifierQueryNode.Modifier.MOD_NOT; - break; - } - default: - jj_la1[4] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - } - default: - jj_la1[5] = jj_gen; - ; - } - q = Clause(field); - if (modifier != ModifierQueryNode.Modifier.MOD_NONE) { - q = new ModifierQueryNode(q, modifier); - } - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode Clause(CharSequence field) throws ParseException { - QueryNode q; - if (jj_2_3(2)) { - q = FieldRangeExpr(field); - } - else { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case ZL_PREFIX: - case QUOTED: - case NUMBER: - case TERM: - case REGEXPTERM: - case RANGEIN_START: - case RANGEEX_START: - case LPAREN: { - if (jj_2_1(2)) { - field = FieldName(); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case OP_COLON: { - jj_consume_token(OP_COLON); - break; - } - case OP_EQUAL: { - jj_consume_token(OP_EQUAL); - break; - } - default: - jj_la1[6] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - else { - ; - } - if (jj_2_2(2)) { - q = Term(field); - } - else { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case LPAREN: { - q = GroupingExpr(field); - break; - } - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - q = IntervalExpr(field); - break; - } - case ZL_PREFIX: { - q = ZuliaExpr(field); - break; - } - default: - jj_la1[7] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - break; - } - default: - jj_la1[8] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private CharSequence FieldName() throws ParseException { - Token name; - name = jj_consume_token(TERM); - { - if ("" != null) - return discardEscapeChar(name.image); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode GroupingExpr(CharSequence field) throws ParseException { - QueryNode q; - Token boost, minShouldMatch = null; - jj_consume_token(LPAREN); - q = Query(field); - jj_consume_token(RPAREN); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case CARAT: { - q = Boost(q); - break; - } - default: - jj_la1[9] = jj_gen; - ; - } - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TILDE: - case 59: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TILDE: { - jj_consume_token(TILDE); - break; - } - case 59: { - jj_consume_token(59); - break; - } - default: - jj_la1[10] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - minShouldMatch = jj_consume_token(NUMBER); - break; - } - default: - jj_la1[11] = jj_gen; - ; - } - if (minShouldMatch != null) { - q = new MinShouldMatchNode(parseInt(minShouldMatch), new GroupQueryNode(q)); - } - else { - q = new GroupQueryNode(q); - } - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private ZuliaFieldableQueryNode ZuliaExpr(CharSequence field) throws ParseException { - ZuliaFieldableQueryNode source; - if (jj_2_4(2)) { - source = NumericsSetQuery(field); - { - if ("" != null) - return source; - } - } - else if (jj_2_5(2)) { - source = TermsInSetQuery(field); - { - if ("" != null) - return source; - } - } - else { - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final private ZuliaNumericSetQueryNode NumericsSetQuery(CharSequence field) throws ParseException { - CharSequence value; - ArrayList values = new ArrayList(); - jj_consume_token(ZL_PREFIX); - jj_consume_token(NUMERIC_SET); - jj_consume_token(LPAREN); - label_4: - while (true) { - value = TermText(); - values.add(value); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[12] = jj_gen; - break label_4; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new ZuliaNumericSetQueryNode(field, values); - } - throw new Error("Missing return statement in function"); - } - - final private ZuliaTermsInSetQueryNode TermsInSetQuery(CharSequence field) throws ParseException { - CharSequence value; - ArrayList values = new ArrayList(); - jj_consume_token(ZL_PREFIX); - jj_consume_token(TERM_SET); - jj_consume_token(LPAREN); - label_5: - while (true) { - value = TermText(); - values.add(value); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[13] = jj_gen; - break label_5; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new ZuliaTermsInSetQueryNode(field, values); - } - throw new Error("Missing return statement in function"); - } - - final private CharSequence TermText() throws ParseException { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case QUOTED: { - jj_consume_token(QUOTED); - { - if ("" != null) - return token.image.substring(1, token.image.length() - 1); - } - break; - } - case NUMBER: - case TERM: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TERM: { - jj_consume_token(TERM); - break; - } - case NUMBER: { - jj_consume_token(NUMBER); - break; - } - default: - jj_la1[14] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - { - if ("" != null) - return token.image; - } - break; - } - default: - jj_la1[15] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalQueryNode IntervalExpr(CharSequence field) throws ParseException { - IntervalFunction source; - source = IntervalFun(); - { - if ("" != null) - return new IntervalQueryNode(field == null ? null : field.toString(), source); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalFun() throws ParseException { - IntervalFunction source; - if (jj_2_6(2)) { - source = IntervalAtLeast(); - { - if ("" != null) - return source; - } - } - else if (jj_2_7(2)) { - source = IntervalMaxWidth(); - { - if ("" != null) - return source; - } - } - else if (jj_2_8(2)) { - source = IntervalMaxGaps(); - { - if ("" != null) - return source; - } - } - else if (jj_2_9(2)) { - source = IntervalOrdered(); - { - if ("" != null) - return source; - } - } - else if (jj_2_10(2)) { - source = IntervalUnordered(); - { - if ("" != null) - return source; - } - } - else if (jj_2_11(2)) { - source = IntervalUnorderedNoOverlaps(); - { - if ("" != null) - return source; - } - } - else if (jj_2_12(2)) { - source = IntervalOr(); - { - if ("" != null) - return source; - } - } - else if (jj_2_13(2)) { - source = IntervalWildcard(); - { - if ("" != null) - return source; - } - } - else if (jj_2_14(2)) { - source = IntervalAfter(); - { - if ("" != null) - return source; - } - } - else if (jj_2_15(2)) { - source = IntervalBefore(); - { - if ("" != null) - return source; - } - } - else if (jj_2_16(2)) { - source = IntervalPhrase(); - { - if ("" != null) - return source; - } - } - else if (jj_2_17(2)) { - source = IntervalContaining(); - { - if ("" != null) - return source; - } - } - else if (jj_2_18(2)) { - source = IntervalNotContaining(); - { - if ("" != null) - return source; - } - } - else if (jj_2_19(2)) { - source = IntervalContainedBy(); - { - if ("" != null) - return source; - } - } - else if (jj_2_20(2)) { - source = IntervalNotContainedBy(); - { - if ("" != null) - return source; - } - } - else if (jj_2_21(2)) { - source = IntervalWithin(); - { - if ("" != null) - return source; - } - } - else if (jj_2_22(2)) { - source = IntervalNotWithin(); - { - if ("" != null) - return source; - } - } - else if (jj_2_23(2)) { - source = IntervalOverlapping(); - { - if ("" != null) - return source; - } - } - else if (jj_2_24(2)) { - source = IntervalNonOverlapping(); - { - if ("" != null) - return source; - } - } - else if (jj_2_25(2)) { - source = IntervalExtend(); - { - if ("" != null) - return source; - } - } - else if (jj_2_26(2)) { - source = IntervalFuzzyTerm(); - { - if ("" != null) - return source; - } - } - else if (jj_2_27(2)) { - source = IntervalText(); - { - if ("" != null) - return source; - } - } - else { - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalAtLeast() throws ParseException { - IntervalFunction source; - ArrayList sources = new ArrayList(); - Token minShouldMatch; - jj_consume_token(FN_PREFIX); - jj_consume_token(ATLEAST); - jj_consume_token(LPAREN); - minShouldMatch = jj_consume_token(NUMBER); - label_6: - while (true) { - source = IntervalFun(); - sources.add(source); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[16] = jj_gen; - break label_6; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new AtLeast(parseInt(minShouldMatch), sources); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalMaxWidth() throws ParseException { - IntervalFunction source; - Token maxWidth; - jj_consume_token(FN_PREFIX); - jj_consume_token(MAXWIDTH); - jj_consume_token(LPAREN); - maxWidth = jj_consume_token(NUMBER); - source = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new MaxWidth(parseInt(maxWidth), source); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalMaxGaps() throws ParseException { - IntervalFunction source; - Token maxGaps; - jj_consume_token(FN_PREFIX); - jj_consume_token(MAXGAPS); - jj_consume_token(LPAREN); - maxGaps = jj_consume_token(NUMBER); - source = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new MaxGaps(parseInt(maxGaps), source); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalUnordered() throws ParseException { - IntervalFunction source; - ArrayList sources = new ArrayList(); - jj_consume_token(FN_PREFIX); - jj_consume_token(UNORDERED); - jj_consume_token(LPAREN); - label_7: - while (true) { - source = IntervalFun(); - sources.add(source); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[17] = jj_gen; - break label_7; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new Unordered(sources); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalUnorderedNoOverlaps() throws ParseException { - IntervalFunction a, b; - jj_consume_token(FN_PREFIX); - jj_consume_token(UNORDERED_NO_OVERLAPS); - jj_consume_token(LPAREN); - a = IntervalFun(); - b = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new UnorderedNoOverlaps(a, b); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalOrdered() throws ParseException { - IntervalFunction source; - ArrayList sources = new ArrayList(); - jj_consume_token(FN_PREFIX); - jj_consume_token(ORDERED); - jj_consume_token(LPAREN); - label_8: - while (true) { - source = IntervalFun(); - sources.add(source); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[18] = jj_gen; - break label_8; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new Ordered(sources); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalOr() throws ParseException { - IntervalFunction source; - ArrayList sources = new ArrayList(); - jj_consume_token(FN_PREFIX); - jj_consume_token(FN_OR); - jj_consume_token(LPAREN); - label_9: - while (true) { - source = IntervalFun(); - sources.add(source); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[19] = jj_gen; - break label_9; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new Or(sources); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalPhrase() throws ParseException { - IntervalFunction source; - ArrayList sources = new ArrayList(); - jj_consume_token(FN_PREFIX); - jj_consume_token(PHRASE); - jj_consume_token(LPAREN); - label_10: - while (true) { - source = IntervalFun(); - sources.add(source); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case FN_PREFIX: - case QUOTED: - case NUMBER: - case TERM: { - ; - break; - } - default: - jj_la1[20] = jj_gen; - break label_10; - } - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new Phrase(sources); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalBefore() throws ParseException { - IntervalFunction source; - IntervalFunction reference; - jj_consume_token(FN_PREFIX); - jj_consume_token(BEFORE); - jj_consume_token(LPAREN); - source = IntervalFun(); - reference = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new Before(source, reference); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalAfter() throws ParseException { - IntervalFunction source; - IntervalFunction reference; - jj_consume_token(FN_PREFIX); - jj_consume_token(AFTER); - jj_consume_token(LPAREN); - source = IntervalFun(); - reference = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new After(source, reference); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalContaining() throws ParseException { - IntervalFunction big; - IntervalFunction small; - jj_consume_token(FN_PREFIX); - jj_consume_token(CONTAINING); - jj_consume_token(LPAREN); - big = IntervalFun(); - small = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new Containing(big, small); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalNotContaining() throws ParseException { - IntervalFunction minuend; - IntervalFunction subtrahend; - jj_consume_token(FN_PREFIX); - jj_consume_token(NOT_CONTAINING); - jj_consume_token(LPAREN); - minuend = IntervalFun(); - subtrahend = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new NotContaining(minuend, subtrahend); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalContainedBy() throws ParseException { - IntervalFunction big; - IntervalFunction small; - jj_consume_token(FN_PREFIX); - jj_consume_token(CONTAINED_BY); - jj_consume_token(LPAREN); - small = IntervalFun(); - big = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new ContainedBy(small, big); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalNotContainedBy() throws ParseException { - IntervalFunction big; - IntervalFunction small; - jj_consume_token(FN_PREFIX); - jj_consume_token(NOT_CONTAINED_BY); - jj_consume_token(LPAREN); - small = IntervalFun(); - big = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new NotContainedBy(small, big); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalWithin() throws ParseException { - IntervalFunction source, reference; - Token positions; - jj_consume_token(FN_PREFIX); - jj_consume_token(WITHIN); - jj_consume_token(LPAREN); - source = IntervalFun(); - positions = jj_consume_token(NUMBER); - reference = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new Within(source, parseInt(positions), reference); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalExtend() throws ParseException { - IntervalFunction source; - Token before, after; - jj_consume_token(FN_PREFIX); - jj_consume_token(EXTEND); - jj_consume_token(LPAREN); - source = IntervalFun(); - before = jj_consume_token(NUMBER); - after = jj_consume_token(NUMBER); - jj_consume_token(RPAREN); - { - if ("" != null) - return new Extend(source, parseInt(before), parseInt(after)); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalNotWithin() throws ParseException { - IntervalFunction minuend, subtrahend; - Token positions; - jj_consume_token(FN_PREFIX); - jj_consume_token(NOT_WITHIN); - jj_consume_token(LPAREN); - minuend = IntervalFun(); - positions = jj_consume_token(NUMBER); - subtrahend = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new NotWithin(minuend, parseInt(positions), subtrahend); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalOverlapping() throws ParseException { - IntervalFunction source, reference; - jj_consume_token(FN_PREFIX); - jj_consume_token(OVERLAPPING); - jj_consume_token(LPAREN); - source = IntervalFun(); - reference = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new Overlapping(source, reference); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalNonOverlapping() throws ParseException { - IntervalFunction minuend, subtrahend; - jj_consume_token(FN_PREFIX); - jj_consume_token(NON_OVERLAPPING); - jj_consume_token(LPAREN); - minuend = IntervalFun(); - subtrahend = IntervalFun(); - jj_consume_token(RPAREN); - { - if ("" != null) - return new NonOverlapping(minuend, subtrahend); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalWildcard() throws ParseException { - String wildcard; - Token maxExpansions = null; - jj_consume_token(FN_PREFIX); - jj_consume_token(WILDCARD); - jj_consume_token(LPAREN); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case NUMBER: - case TERM: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TERM: { - jj_consume_token(TERM); - break; - } - case NUMBER: { - jj_consume_token(NUMBER); - break; - } - default: - jj_la1[21] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - wildcard = token.image; - break; - } - case QUOTED: { - jj_consume_token(QUOTED); - wildcard = token.image.substring(1, token.image.length() - 1); - break; - } - default: - jj_la1[22] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case NUMBER: { - maxExpansions = jj_consume_token(NUMBER); - break; - } - default: - jj_la1[23] = jj_gen; - ; - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new Wildcard(wildcard, maxExpansions == null ? 0 : parseInt(maxExpansions)); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalFuzzyTerm() throws ParseException { - String term; - Token maxEdits = null; - Token maxExpansions = null; - jj_consume_token(FN_PREFIX); - jj_consume_token(FUZZYTERM); - jj_consume_token(LPAREN); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case NUMBER: - case TERM: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TERM: { - jj_consume_token(TERM); - break; - } - case NUMBER: { - jj_consume_token(NUMBER); - break; - } - default: - jj_la1[24] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - term = token.image; - break; - } - case QUOTED: { - jj_consume_token(QUOTED); - term = token.image.substring(1, token.image.length() - 1); - break; - } - default: - jj_la1[25] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - if (jj_2_28(2)) { - maxEdits = jj_consume_token(NUMBER); - } - else { - ; - } - if (jj_2_29(2)) { - maxExpansions = jj_consume_token(NUMBER); - } - else { - ; - } - jj_consume_token(RPAREN); - { - if ("" != null) - return new FuzzyTerm(term, maxEdits == null ? null : parseInt(maxEdits), maxExpansions == null ? null : parseInt(maxExpansions)); - } - throw new Error("Missing return statement in function"); - } - - final private IntervalFunction IntervalText() throws ParseException { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case QUOTED: { - jj_consume_token(QUOTED); - { - if ("" != null) - return new AnalyzedText(token.image.substring(1, token.image.length() - 1)); - } - break; - } - case NUMBER: - case TERM: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TERM: { - jj_consume_token(TERM); - break; - } - case NUMBER: { - jj_consume_token(NUMBER); - break; - } - default: - jj_la1[26] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - { - if ("" != null) - return new AnalyzedText(token.image); - } - break; - } - default: - jj_la1[27] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode Boost(QueryNode node) throws ParseException { - Token boost; - jj_consume_token(CARAT); - boost = jj_consume_token(NUMBER); - { - if ("" != null) - return node == null ? node : new BoostQueryNode(node, parseFloat(boost)); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode FuzzyOp(CharSequence field, Token term, QueryNode node) throws ParseException { - Token similarity = null; - jj_consume_token(TILDE); - if (jj_2_30(2)) { - similarity = jj_consume_token(NUMBER); - } - else { - ; - } - float fms = org.apache.lucene.search.FuzzyQuery.defaultMaxEdits; - if (similarity != null) { - fms = parseFloat(similarity); - if (fms < 0.0f) { - { - if (true) - throw new ParseException(new MessageImpl(QueryParserMessages.INVALID_SYNTAX_FUZZY_LIMITS)); - } - } - else if (fms >= 1.0f && fms != (int) fms) { - { - if (true) - throw new ParseException(new MessageImpl(QueryParserMessages.INVALID_SYNTAX_FUZZY_EDITS)); - } - } - } - { - if ("" != null) - return new FuzzyQueryNode(field, discardEscapeChar(term.image), fms, term.beginColumn, term.endColumn); - } - throw new Error("Missing return statement in function"); - } - - final private TermRangeQueryNode FieldRangeExpr(CharSequence field) throws ParseException { - Token operator, term; - FieldQueryNode qLower, qUpper; - boolean lowerInclusive, upperInclusive; - field = FieldName(); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case OP_LESSTHAN: { - jj_consume_token(OP_LESSTHAN); - break; - } - case OP_LESSTHANEQ: { - jj_consume_token(OP_LESSTHANEQ); - break; - } - case OP_MORETHAN: { - jj_consume_token(OP_MORETHAN); - break; - } - case OP_MORETHANEQ: { - jj_consume_token(OP_MORETHANEQ); - break; - } - default: - jj_la1[28] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - operator = token; - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TERM: { - jj_consume_token(TERM); - break; - } - case QUOTED: { - jj_consume_token(QUOTED); - break; - } - case NUMBER: { - jj_consume_token(NUMBER); - break; - } - default: - jj_la1[29] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - term = token; - if (term.kind == QUOTED) { - term.image = term.image.substring(1, term.image.length() - 1); - } - switch (operator.kind) { - case OP_LESSTHAN: - lowerInclusive = true; - upperInclusive = false; - qLower = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); - qUpper = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); - break; - case OP_LESSTHANEQ: - lowerInclusive = true; - upperInclusive = true; - qLower = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); - qUpper = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); - break; - case OP_MORETHAN: - lowerInclusive = false; - upperInclusive = true; - qLower = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); - qUpper = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); - break; - case OP_MORETHANEQ: - lowerInclusive = true; - upperInclusive = true; - qLower = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); - qUpper = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); - break; - default: { - if (true) - throw new Error("Unhandled case, operator=" + operator); - } - } - { - if ("" != null) - return new TermRangeQueryNode(qLower, qUpper, lowerInclusive, upperInclusive); - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode Term(CharSequence field) throws ParseException { - QueryNode q; - Token term, fuzzySlop = null; - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case REGEXPTERM: { - term = jj_consume_token(REGEXPTERM); - String v = term.image.substring(1, term.image.length() - 1); - q = new RegexpQueryNode(field, v, 0, v.length()); - break; - } - case NUMBER: - case TERM: { - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TERM: { - term = jj_consume_token(TERM); - break; - } - case NUMBER: { - term = jj_consume_token(NUMBER); - break; - } - default: - jj_la1[30] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - q = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TILDE: { - q = FuzzyOp(field, term, q); - break; - } - default: - jj_la1[31] = jj_gen; - ; - } - break; - } - case RANGEIN_START: - case RANGEEX_START: { - q = TermRangeExpr(field); - break; - } - case QUOTED: { - q = QuotedTerm(field); - break; - } - default: - jj_la1[32] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case CARAT: { - q = Boost(q); - break; - } - default: - jj_la1[33] = jj_gen; - ; - } - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private QueryNode QuotedTerm(CharSequence field) throws ParseException { - QueryNode q; - Token term, slop; - term = jj_consume_token(QUOTED); - String image = term.image.substring(1, term.image.length() - 1); - q = new QuotedFieldQueryNode(field, discardEscapeChar(image), term.beginColumn + 1, term.endColumn - 1); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case TILDE: { - jj_consume_token(TILDE); - slop = jj_consume_token(NUMBER); - q = new SlopQueryNode(q, parseInt(slop)); - break; - } - default: - jj_la1[34] = jj_gen; - ; - } - { - if ("" != null) - return q; - } - throw new Error("Missing return statement in function"); - } - - final private TermRangeQueryNode TermRangeExpr(CharSequence field) throws ParseException { - Token left, right; - boolean leftInclusive = false; - boolean rightInclusive = false; - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case RANGEIN_START: { - jj_consume_token(RANGEIN_START); - leftInclusive = true; - break; - } - case RANGEEX_START: { - jj_consume_token(RANGEEX_START); - break; - } - default: - jj_la1[35] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case RANGE_GOOP: { - jj_consume_token(RANGE_GOOP); - break; - } - case RANGE_QUOTED: { - jj_consume_token(RANGE_QUOTED); - break; - } - case RANGE_TO: { - jj_consume_token(RANGE_TO); - break; - } - default: - jj_la1[36] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - left = token; - jj_consume_token(RANGE_TO); - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case RANGE_GOOP: { - jj_consume_token(RANGE_GOOP); - break; - } - case RANGE_QUOTED: { - jj_consume_token(RANGE_QUOTED); - break; - } - case RANGE_TO: { - jj_consume_token(RANGE_TO); - break; - } - default: - jj_la1[37] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - right = token; - switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { - case RANGEIN_END: { - jj_consume_token(RANGEIN_END); - rightInclusive = true; - break; - } - case RANGEEX_END: { - jj_consume_token(RANGEEX_END); - break; - } - default: - jj_la1[38] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - if (left.kind == RANGE_QUOTED) { - left.image = left.image.substring(1, left.image.length() - 1); - } - if (right.kind == RANGE_QUOTED) { - right.image = right.image.substring(1, right.image.length() - 1); - } - - FieldQueryNode qLower = new FieldQueryNode(field, discardEscapeChar(left.image), left.beginColumn, left.endColumn); - FieldQueryNode qUpper = new FieldQueryNode(field, discardEscapeChar(right.image), right.beginColumn, right.endColumn); - - { - if ("" != null) - return new TermRangeQueryNode(qLower, qUpper, leftInclusive, rightInclusive); - } - throw new Error("Missing return statement in function"); - } - - private boolean jj_2_1(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_1()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(0, xla); - } - } - - private boolean jj_2_2(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_2()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(1, xla); - } - } - - private boolean jj_2_3(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_3()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(2, xla); - } - } - - private boolean jj_2_4(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_4()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(3, xla); - } - } - - private boolean jj_2_5(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_5()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(4, xla); - } - } - - private boolean jj_2_6(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_6()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(5, xla); - } - } - - private boolean jj_2_7(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_7()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(6, xla); - } - } - - private boolean jj_2_8(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_8()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(7, xla); - } - } - - private boolean jj_2_9(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_9()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(8, xla); - } - } - - private boolean jj_2_10(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_10()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(9, xla); - } - } - - private boolean jj_2_11(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_11()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(10, xla); - } - } - - private boolean jj_2_12(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_12()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(11, xla); - } - } - - private boolean jj_2_13(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_13()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(12, xla); - } - } - - private boolean jj_2_14(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_14()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(13, xla); - } - } - - private boolean jj_2_15(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_15()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(14, xla); - } - } - - private boolean jj_2_16(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_16()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(15, xla); - } - } - - private boolean jj_2_17(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_17()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(16, xla); - } - } - - private boolean jj_2_18(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_18()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(17, xla); - } - } - - private boolean jj_2_19(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_19()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(18, xla); - } - } - - private boolean jj_2_20(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_20()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(19, xla); - } - } - - private boolean jj_2_21(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_21()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(20, xla); - } - } - - private boolean jj_2_22(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_22()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(21, xla); - } - } - - private boolean jj_2_23(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_23()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(22, xla); - } - } - - private boolean jj_2_24(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_24()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(23, xla); - } - } - - private boolean jj_2_25(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_25()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(24, xla); - } - } - - private boolean jj_2_26(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_26()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(25, xla); - } - } - - private boolean jj_2_27(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_27()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(26, xla); - } - } - - private boolean jj_2_28(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_28()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(27, xla); - } - } - - private boolean jj_2_29(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_29()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(28, xla); - } - } - - private boolean jj_2_30(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return (!jj_3_30()); - } - catch (LookaheadSuccess ls) { - return true; - } - finally { - jj_save(29, xla); - } - } - - private boolean jj_3R_32() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(NOT_WITHIN)) - return true; - return false; - } - - private boolean jj_3R_25() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(BEFORE)) - return true; - return false; - } - - private boolean jj_3R_16() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(ATLEAST)) - return true; - return false; - } - - private boolean jj_3R_12() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_38()) { - jj_scanpos = xsp; - if (jj_3R_39()) { - jj_scanpos = xsp; - if (jj_3R_40()) { - jj_scanpos = xsp; - if (jj_3R_41()) - return true; - } - } - } - xsp = jj_scanpos; - if (jj_3R_42()) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_48() { - if (jj_scan_token(CARAT)) - return true; - return false; - } - - private boolean jj_3_27() { - if (jj_3R_37()) - return true; - return false; - } - - private boolean jj_3_26() { - if (jj_3R_36()) - return true; - return false; - } - - private boolean jj_3_25() { - if (jj_3R_35()) - return true; - return false; - } - - private boolean jj_3_24() { - if (jj_3R_34()) - return true; - return false; - } - - private boolean jj_3_23() { - if (jj_3R_33()) - return true; - return false; - } - - private boolean jj_3R_26() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(PHRASE)) - return true; - return false; - } - - private boolean jj_3_22() { - if (jj_3R_32()) - return true; - return false; - } - - private boolean jj_3R_35() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(EXTEND)) - return true; - return false; - } - - private boolean jj_3_21() { - if (jj_3R_31()) - return true; - return false; - } - - private boolean jj_3_20() { - if (jj_3R_30()) - return true; - return false; - } - - private boolean jj_3R_44() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(26)) { - jj_scanpos = xsp; - if (jj_scan_token(25)) - return true; - } - return false; - } - - private boolean jj_3_19() { - if (jj_3R_29()) - return true; - return false; - } - - private boolean jj_3R_43() { - if (jj_scan_token(QUOTED)) - return true; - return false; - } - - private boolean jj_3R_37() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_43()) { - jj_scanpos = xsp; - if (jj_3R_44()) - return true; - } - return false; - } - - private boolean jj_3_18() { - if (jj_3R_28()) - return true; - return false; - } - - private boolean jj_3_17() { - if (jj_3R_27()) - return true; - return false; - } - - private boolean jj_3_16() { - if (jj_3R_26()) - return true; - return false; - } - - private boolean jj_3_15() { - if (jj_3R_25()) - return true; - return false; - } - - private boolean jj_3R_11() { - if (jj_scan_token(TERM)) - return true; - return false; - } - - private boolean jj_3_14() { - if (jj_3R_24()) - return true; - return false; - } - - private boolean jj_3_13() { - if (jj_3R_23()) - return true; - return false; - } - - private boolean jj_3_12() { - if (jj_3R_22()) - return true; - return false; - } - - private boolean jj_3_11() { - if (jj_3R_21()) - return true; - return false; - } - - private boolean jj_3R_22() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(FN_OR)) - return true; - return false; - } - - private boolean jj_3_10() { - if (jj_3R_20()) - return true; - return false; - } - - private boolean jj_3_9() { - if (jj_3R_19()) - return true; - return false; - } - - private boolean jj_3_8() { - if (jj_3R_18()) - return true; - return false; - } - - private boolean jj_3_7() { - if (jj_3R_17()) - return true; - return false; - } - - private boolean jj_3_6() { - if (jj_3R_16()) - return true; - return false; - } - - private boolean jj_3_29() { - if (jj_scan_token(NUMBER)) - return true; - return false; - } - - private boolean jj_3R_31() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(WITHIN)) - return true; - return false; - } - - private boolean jj_3_2() { - if (jj_3R_12()) - return true; - return false; - } - - private boolean jj_3_28() { - if (jj_scan_token(NUMBER)) - return true; - return false; - } - - private boolean jj_3_1() { - if (jj_3R_11()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(16)) { - jj_scanpos = xsp; - if (jj_scan_token(17)) - return true; - } - return false; - } - - private boolean jj_3_3() { - if (jj_3R_13()) - return true; - return false; - } - - private boolean jj_3R_50() { - if (jj_scan_token(RANGEIN_START)) - return true; - return false; - } - - private boolean jj_3R_19() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(ORDERED)) - return true; - return false; - } - - private boolean jj_3R_36() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(FUZZYTERM)) - return true; - return false; - } - - private boolean jj_3R_46() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_50()) { - jj_scanpos = xsp; - if (jj_scan_token(29)) - return true; - } - xsp = jj_scanpos; - if (jj_scan_token(58)) { - jj_scanpos = xsp; - if (jj_scan_token(57)) { - jj_scanpos = xsp; - if (jj_scan_token(54)) - return true; - } - } - return false; - } - - private boolean jj_3R_30() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(NOT_CONTAINED_BY)) - return true; - return false; - } - - private boolean jj_3R_21() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(UNORDERED_NO_OVERLAPS)) - return true; - return false; - } - - private boolean jj_3R_29() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(CONTAINED_BY)) - return true; - return false; - } - - private boolean jj_3R_13() { - if (jj_3R_11()) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(18)) { - jj_scanpos = xsp; - if (jj_scan_token(19)) { - jj_scanpos = xsp; - if (jj_scan_token(20)) { - jj_scanpos = xsp; - if (jj_scan_token(21)) - return true; - } - } - } - return false; - } - - private boolean jj_3R_23() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(WILDCARD)) - return true; - return false; - } - - private boolean jj_3R_51() { - if (jj_scan_token(TILDE)) - return true; - return false; - } - - private boolean jj_3R_20() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(UNORDERED)) - return true; - return false; - } - - private boolean jj_3R_28() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(NOT_CONTAINING)) - return true; - return false; - } - - private boolean jj_3R_15() { - if (jj_scan_token(ZL_PREFIX)) - return true; - if (jj_scan_token(TERM_SET)) - return true; - return false; - } - - private boolean jj_3R_47() { - if (jj_scan_token(QUOTED)) - return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_51()) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_34() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(NON_OVERLAPPING)) - return true; - return false; - } - - private boolean jj_3R_18() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(MAXGAPS)) - return true; - return false; - } - - private boolean jj_3_30() { - if (jj_scan_token(NUMBER)) - return true; - return false; - } - - private boolean jj_3R_27() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(CONTAINING)) - return true; - return false; - } - - private boolean jj_3R_14() { - if (jj_scan_token(ZL_PREFIX)) - return true; - if (jj_scan_token(NUMERIC_SET)) - return true; - return false; - } - - private boolean jj_3R_33() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(OVERLAPPING)) - return true; - return false; - } - - private boolean jj_3R_45() { - if (jj_3R_49()) - return true; - return false; - } - - private boolean jj_3R_41() { - if (jj_3R_47()) - return true; - return false; - } - - private boolean jj_3R_49() { - if (jj_scan_token(TILDE)) - return true; - return false; - } - - private boolean jj_3R_42() { - if (jj_3R_48()) - return true; - return false; - } - - private boolean jj_3R_40() { - if (jj_3R_46()) - return true; - return false; - } - - private boolean jj_3_5() { - if (jj_3R_15()) - return true; - return false; - } - - private boolean jj_3R_17() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(MAXWIDTH)) - return true; - return false; - } - - private boolean jj_3_4() { - if (jj_3R_14()) - return true; - return false; - } - - private boolean jj_3R_39() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(26)) { - jj_scanpos = xsp; - if (jj_scan_token(25)) - return true; - } - xsp = jj_scanpos; - if (jj_3R_45()) - jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_24() { - if (jj_scan_token(FN_PREFIX)) - return true; - if (jj_scan_token(AFTER)) - return true; - return false; - } - - private boolean jj_3R_38() { - if (jj_scan_token(REGEXPTERM)) - return true; - return false; - } - - /** - * Generated Token Manager. - */ - public ZuliaSyntaxParserTokenManager token_source; - /** - * Current token. - */ - public Token token; - /** - * Next token. - */ - public Token jj_nt; - private int jj_ntk; - private Token jj_scanpos, jj_lastpos; - private int jj_la; - private int jj_gen; - final private int[] jj_la1 = new int[39]; - static private int[] jj_la1_0; - static private int[] jj_la1_1; - - static { - jj_la1_init_0(); - jj_la1_init_1(); - } - - private static void jj_la1_init_0() { - jj_la1_0 = new int[] { 0x7f007c00, 0x200, 0x100, 0x4400, 0x6400, 0x6400, 0x30000, 0x47001800, 0x7f001800, 0x400000, 0x800000, 0x800000, 0x7000000, - 0x7000000, 0x6000000, 0x7000000, 0x7000800, 0x7000800, 0x7000800, 0x7000800, 0x7000800, 0x6000000, 0x7000000, 0x2000000, 0x6000000, 0x7000000, - 0x6000000, 0x7000000, 0x3c0000, 0x7000000, 0x6000000, 0x800000, 0x3f000000, 0x400000, 0x800000, 0x30000000, 0x0, 0x0, 0x0, }; - } - - private static void jj_la1_init_1() { - jj_la1_1 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8000000, 0x8000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6400000, 0x6400000, 0x1800000, }; - } - - final private JJCalls[] jj_2_rtns = new JJCalls[30]; - private boolean jj_rescan = false; - private int jj_gc = 0; - - /** - * Constructor with user supplied CharStream. - */ - public ZuliaSyntaxParser(CharStream stream) { - token_source = new ZuliaSyntaxParserTokenManager(stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 39; i++) - jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) - jj_2_rtns[i] = new JJCalls(); - } - - /** - * Reinitialise. - */ - public void ReInit(CharStream stream) { - token_source.ReInit(stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 39; i++) - jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) - jj_2_rtns[i] = new JJCalls(); - } - - /** - * Constructor with generated Token Manager. - */ - public ZuliaSyntaxParser(ZuliaSyntaxParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 39; i++) - jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) - jj_2_rtns[i] = new JJCalls(); - } - - /** - * Reinitialise. - */ - public void ReInit(ZuliaSyntaxParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 39; i++) - jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) - jj_2_rtns[i] = new JJCalls(); - } - - private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) - token = token.next; - else - token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - if (++jj_gc > 100) { - jj_gc = 0; - for (int i = 0; i < jj_2_rtns.length; i++) { - JJCalls c = jj_2_rtns[i]; - while (c != null) { - if (c.gen < jj_gen) - c.first = null; - c = c.next; - } - } - } - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - @SuppressWarnings("serial") - static private final class LookaheadSuccess extends java.lang.Error { - } - - final private LookaheadSuccess jj_ls = new LookaheadSuccess(); - - private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } - else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } - else { - jj_scanpos = jj_scanpos.next; - } - if (jj_rescan) { - int i = 0; - Token tok = token; - while (tok != null && tok != jj_scanpos) { - i++; - tok = tok.next; - } - if (tok != null) - jj_add_error_token(kind, i); - } - if (jj_scanpos.kind != kind) - return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) - throw jj_ls; - return false; - } - - /** - * Get the next Token. - */ - final public Token getNextToken() { - if (token.next != null) - token = token.next; - else - token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; - } - - /** - * Get the specific Token. - */ - final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) - t = t.next; - else - t = t.next = token_source.getNextToken(); - } - return t; - } - - private int jj_ntk_f() { - if ((jj_nt = token.next) == null) - return (jj_ntk = (token.next = token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); - } - - private java.util.List jj_expentries = new java.util.ArrayList<>(); - private int[] jj_expentry; - private int jj_kind = -1; - private int[] jj_lasttokens = new int[100]; - private int jj_endpos; - - private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) { - return; - } - - if (pos == jj_endpos + 1) { - jj_lasttokens[jj_endpos++] = kind; - } - else if (jj_endpos != 0) { - jj_expentry = new int[jj_endpos]; - - for (int i = 0; i < jj_endpos; i++) { - jj_expentry[i] = jj_lasttokens[i]; - } - - for (int[] oldentry : jj_expentries) { - if (oldentry.length == jj_expentry.length) { - boolean isMatched = true; - - for (int i = 0; i < jj_expentry.length; i++) { - if (oldentry[i] != jj_expentry[i]) { - isMatched = false; - break; - } - - } - if (isMatched) { - jj_expentries.add(jj_expentry); - break; - } - } - } - - if (pos != 0) { - jj_lasttokens[(jj_endpos = pos) - 1] = kind; - } - } - } - - /** - * Generate ParseException. - */ - public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[60]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 39; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1 << j)) != 0) { - la1tokens[j] = true; - } - if ((jj_la1_1[i] & (1 << j)) != 0) { - la1tokens[32 + j] = true; - } - } - } - } - for (int i = 0; i < 60; i++) { - if (la1tokens[i]) { - jj_expentry = new int[1]; - jj_expentry[0] = i; - jj_expentries.add(jj_expentry); - } - } - jj_endpos = 0; - jj_rescan_token(); - jj_add_error_token(0, 0); - int[][] exptokseq = new int[jj_expentries.size()][]; - for (int i = 0; i < jj_expentries.size(); i++) { - exptokseq[i] = jj_expentries.get(i); - } - return new ParseException(token, exptokseq, tokenImage); - } - - private int trace_indent = 0; - private boolean trace_enabled; - - /** - * Trace enabled. - */ - final public boolean trace_enabled() { - return trace_enabled; - } - - /** - * Enable tracing. - */ - final public void enable_tracing() { - } - - /** - * Disable tracing. - */ - final public void disable_tracing() { - } - - private void jj_rescan_token() { - jj_rescan = true; - for (int i = 0; i < 30; i++) { - try { - JJCalls p = jj_2_rtns[i]; - - do { - if (p.gen > jj_gen) { - jj_la = p.arg; - jj_lastpos = jj_scanpos = p.first; - switch (i) { - case 0: - jj_3_1(); - break; - case 1: - jj_3_2(); - break; - case 2: - jj_3_3(); - break; - case 3: - jj_3_4(); - break; - case 4: - jj_3_5(); - break; - case 5: - jj_3_6(); - break; - case 6: - jj_3_7(); - break; - case 7: - jj_3_8(); - break; - case 8: - jj_3_9(); - break; - case 9: - jj_3_10(); - break; - case 10: - jj_3_11(); - break; - case 11: - jj_3_12(); - break; - case 12: - jj_3_13(); - break; - case 13: - jj_3_14(); - break; - case 14: - jj_3_15(); - break; - case 15: - jj_3_16(); - break; - case 16: - jj_3_17(); - break; - case 17: - jj_3_18(); - break; - case 18: - jj_3_19(); - break; - case 19: - jj_3_20(); - break; - case 20: - jj_3_21(); - break; - case 21: - jj_3_22(); - break; - case 22: - jj_3_23(); - break; - case 23: - jj_3_24(); - break; - case 24: - jj_3_25(); - break; - case 25: - jj_3_26(); - break; - case 26: - jj_3_27(); - break; - case 27: - jj_3_28(); - break; - case 28: - jj_3_29(); - break; - case 29: - jj_3_30(); - break; - } - } - p = p.next; - } - while (p != null); - - } - catch (LookaheadSuccess ls) { - } - } - jj_rescan = false; - } - - private void jj_save(int index, int xla) { - JJCalls p = jj_2_rtns[index]; - while (p.gen > jj_gen) { - if (p.next == null) { - p = p.next = new JJCalls(); - break; - } - p = p.next; - } - - p.gen = jj_gen + xla - jj_la; - p.first = token; - p.arg = xla; - } - - static final class JJCalls { - int gen; - Token first; - int arg; - JJCalls next; - } + public ZuliaSyntaxParser() { + this(new FastCharStream(Reader.nullReader())); + } + + /** + * Parses a query string, returning a {@link org.apache.lucene.queryparser.flexible.core.nodes.QueryNode}. + * + * @param query the query string to be parsed. + * @throws ParseException if the parsing fails + */ + @Override + public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException { + ReInit(new FastCharStream(new StringReader(query.toString()))); + try { + return TopLevelQuery(field); + } + catch (ParseException tme) { + tme.setQuery(query); + throw tme; + } + catch (Error tme) { + Message message = new MessageImpl(QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, tme.getMessage()); + QueryNodeParseException e = new QueryNodeParseException(tme); + e.setQuery(query); + e.setNonLocalizedMessage(message); + throw e; + } + } + + public static float parseFloat(Token token) { + return Float.parseFloat(token.image); + } + + public static int parseInt(Token token) { + return Integer.parseInt(token.image); + } + + final public QueryNode TopLevelQuery(CharSequence field) throws ParseException { + QueryNode q; + q = Query(field); + jj_consume_token(0); + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode Query(CharSequence field) throws ParseException { + ArrayList clauses = new ArrayList<>(); + QueryNode node; + label_1: + while (true) { + node = DisjQuery(field); + clauses.add(node); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case NOT: + case FN_PREFIX: + case ZL_PREFIX: + case PLUS: + case MINUS: + case QUOTED: + case NUMBER: + case TERM: + case REGEXPTERM: + case RANGEIN_START: + case RANGEEX_START: + case LPAREN: { + ; + break; + } + default: + jj_la1[0] = jj_gen; + break label_1; + } + } + // Handle the case of a "pure" negation query which + // needs to be wrapped as a boolean query, otherwise + // the returned result drops the negation. + if (clauses.size() == 1) { + QueryNode first = clauses.get(0); + if (first instanceof ModifierQueryNode && ((ModifierQueryNode) first).getModifier() == ModifierQueryNode.Modifier.MOD_NOT) { + clauses.set(0, new BooleanQueryNode(Collections.singletonList(first))); + } + } + + { + if ("" != null) + return clauses.size() == 1 ? clauses.get(0) : new BooleanQueryNode(clauses); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode DisjQuery(CharSequence field) throws ParseException { + ArrayList clauses = new ArrayList<>(); + QueryNode node; + node = ConjQuery(field); + clauses.add(node); + label_2: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case OR: { + ; + break; + } + default: + jj_la1[1] = jj_gen; + break label_2; + } + jj_consume_token(OR); + node = ConjQuery(field); + clauses.add(node); + } + { + if ("" != null) + return clauses.size() == 1 ? clauses.get(0) : new OrQueryNode(clauses); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode ConjQuery(CharSequence field) throws ParseException { + ArrayList clauses = new ArrayList<>(); + QueryNode node; + node = ModClause(field); + clauses.add(node); + label_3: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case AND: { + ; + break; + } + default: + jj_la1[2] = jj_gen; + break label_3; + } + jj_consume_token(AND); + node = ModClause(field); + clauses.add(node); + } + { + if ("" != null) + return clauses.size() == 1 ? clauses.get(0) : new AndQueryNode(clauses); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode ModClause(CharSequence field) throws ParseException { + QueryNode q; + ModifierQueryNode.Modifier modifier = ModifierQueryNode.Modifier.MOD_NONE; + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case NOT: + case PLUS: + case MINUS: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case PLUS: { + jj_consume_token(PLUS); + modifier = ModifierQueryNode.Modifier.MOD_REQ; + break; + } + case NOT: + case MINUS: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case MINUS: { + jj_consume_token(MINUS); + break; + } + case NOT: { + jj_consume_token(NOT); + break; + } + default: + jj_la1[3] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + modifier = ModifierQueryNode.Modifier.MOD_NOT; + break; + } + default: + jj_la1[4] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + } + default: + jj_la1[5] = jj_gen; + ; + } + q = Clause(field); + if (modifier != ModifierQueryNode.Modifier.MOD_NONE) { + q = new ModifierQueryNode(q, modifier); + } + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode Clause(CharSequence field) throws ParseException { + QueryNode q; + if (jj_2_3(2)) { + q = FieldRangeExpr(field); + } + else { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case ZL_PREFIX: + case QUOTED: + case NUMBER: + case TERM: + case REGEXPTERM: + case RANGEIN_START: + case RANGEEX_START: + case LPAREN: { + if (jj_2_1(2)) { + field = FieldName(); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case OP_COLON: { + jj_consume_token(OP_COLON); + break; + } + case OP_EQUAL: { + jj_consume_token(OP_EQUAL); + break; + } + default: + jj_la1[6] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + else { + ; + } + if (jj_2_2(2)) { + q = Term(field); + } + else { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case LPAREN: { + q = GroupingExpr(field); + break; + } + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + q = IntervalExpr(field); + break; + } + case ZL_PREFIX: { + q = ZuliaExpr(field); + break; + } + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + break; + } + default: + jj_la1[8] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private CharSequence FieldName() throws ParseException { + Token name; + name = jj_consume_token(TERM); + { + if ("" != null) + return discardEscapeChar(name.image); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode GroupingExpr(CharSequence field) throws ParseException { + QueryNode q; + Token boost, minShouldMatch = null; + jj_consume_token(LPAREN); + q = Query(field); + jj_consume_token(RPAREN); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case CARAT: { + q = Boost(q); + break; + } + default: + jj_la1[9] = jj_gen; + ; + } + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TILDE: + case 59: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TILDE: { + jj_consume_token(TILDE); + break; + } + case 59: { + jj_consume_token(59); + break; + } + default: + jj_la1[10] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + minShouldMatch = jj_consume_token(NUMBER); + break; + } + default: + jj_la1[11] = jj_gen; + ; + } + if (minShouldMatch != null) { + q = new MinShouldMatchNode(parseInt(minShouldMatch), new GroupQueryNode(q)); + } + else { + q = new GroupQueryNode(q); + } + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private ZuliaFieldableQueryNode ZuliaExpr(CharSequence field) throws ParseException { + ZuliaFieldableQueryNode source; + if (jj_2_4(2)) { + source = NumericsSetQuery(field); + { + if ("" != null) + return source; + } + } + else if (jj_2_5(2)) { + source = TermsInSetQuery(field); + { + if ("" != null) + return source; + } + } + else { + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final private ZuliaNumericSetQueryNode NumericsSetQuery(CharSequence field) throws ParseException { + CharSequence value; + ArrayList values = new ArrayList(); + jj_consume_token(ZL_PREFIX); + jj_consume_token(NUMERIC_SET); + jj_consume_token(LPAREN); + label_4: + while (true) { + value = TermText(); + values.add(value); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[12] = jj_gen; + break label_4; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new ZuliaNumericSetQueryNode(field, values); + } + throw new Error("Missing return statement in function"); + } + + final private ZuliaTermsInSetQueryNode TermsInSetQuery(CharSequence field) throws ParseException { + CharSequence value; + ArrayList values = new ArrayList(); + jj_consume_token(ZL_PREFIX); + jj_consume_token(TERM_SET); + jj_consume_token(LPAREN); + label_5: + while (true) { + value = TermText(); + values.add(value); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[13] = jj_gen; + break label_5; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new ZuliaTermsInSetQueryNode(field, values); + } + throw new Error("Missing return statement in function"); + } + + final private CharSequence TermText() throws ParseException { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case QUOTED: { + jj_consume_token(QUOTED); + { + if ("" != null) + return token.image.substring(1, token.image.length() - 1); + } + break; + } + case NUMBER: + case TERM: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + jj_consume_token(TERM); + break; + } + case NUMBER: { + jj_consume_token(NUMBER); + break; + } + default: + jj_la1[14] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + { + if ("" != null) + return token.image; + } + break; + } + default: + jj_la1[15] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalQueryNode IntervalExpr(CharSequence field) throws ParseException { + IntervalFunction source; + source = IntervalFun(); + { + if ("" != null) + return new IntervalQueryNode(field == null ? null : field.toString(), source); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalFun() throws ParseException { + IntervalFunction source; + if (jj_2_6(2)) { + source = IntervalAtLeast(); + { + if ("" != null) + return source; + } + } + else if (jj_2_7(2)) { + source = IntervalMaxWidth(); + { + if ("" != null) + return source; + } + } + else if (jj_2_8(2)) { + source = IntervalMaxGaps(); + { + if ("" != null) + return source; + } + } + else if (jj_2_9(2)) { + source = IntervalOrdered(); + { + if ("" != null) + return source; + } + } + else if (jj_2_10(2)) { + source = IntervalUnordered(); + { + if ("" != null) + return source; + } + } + else if (jj_2_11(2)) { + source = IntervalUnorderedNoOverlaps(); + { + if ("" != null) + return source; + } + } + else if (jj_2_12(2)) { + source = IntervalOr(); + { + if ("" != null) + return source; + } + } + else if (jj_2_13(2)) { + source = IntervalWildcard(); + { + if ("" != null) + return source; + } + } + else if (jj_2_14(2)) { + source = IntervalAfter(); + { + if ("" != null) + return source; + } + } + else if (jj_2_15(2)) { + source = IntervalBefore(); + { + if ("" != null) + return source; + } + } + else if (jj_2_16(2)) { + source = IntervalPhrase(); + { + if ("" != null) + return source; + } + } + else if (jj_2_17(2)) { + source = IntervalContaining(); + { + if ("" != null) + return source; + } + } + else if (jj_2_18(2)) { + source = IntervalNotContaining(); + { + if ("" != null) + return source; + } + } + else if (jj_2_19(2)) { + source = IntervalContainedBy(); + { + if ("" != null) + return source; + } + } + else if (jj_2_20(2)) { + source = IntervalNotContainedBy(); + { + if ("" != null) + return source; + } + } + else if (jj_2_21(2)) { + source = IntervalWithin(); + { + if ("" != null) + return source; + } + } + else if (jj_2_22(2)) { + source = IntervalNotWithin(); + { + if ("" != null) + return source; + } + } + else if (jj_2_23(2)) { + source = IntervalOverlapping(); + { + if ("" != null) + return source; + } + } + else if (jj_2_24(2)) { + source = IntervalNonOverlapping(); + { + if ("" != null) + return source; + } + } + else if (jj_2_25(2)) { + source = IntervalExtend(); + { + if ("" != null) + return source; + } + } + else if (jj_2_26(2)) { + source = IntervalFuzzyTerm(); + { + if ("" != null) + return source; + } + } + else if (jj_2_27(2)) { + source = IntervalText(); + { + if ("" != null) + return source; + } + } + else { + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalAtLeast() throws ParseException { + IntervalFunction source; + ArrayList sources = new ArrayList(); + Token minShouldMatch; + jj_consume_token(FN_PREFIX); + jj_consume_token(ATLEAST); + jj_consume_token(LPAREN); + minShouldMatch = jj_consume_token(NUMBER); + label_6: + while (true) { + source = IntervalFun(); + sources.add(source); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[16] = jj_gen; + break label_6; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new AtLeast(parseInt(minShouldMatch), sources); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalMaxWidth() throws ParseException { + IntervalFunction source; + Token maxWidth; + jj_consume_token(FN_PREFIX); + jj_consume_token(MAXWIDTH); + jj_consume_token(LPAREN); + maxWidth = jj_consume_token(NUMBER); + source = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new MaxWidth(parseInt(maxWidth), source); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalMaxGaps() throws ParseException { + IntervalFunction source; + Token maxGaps; + jj_consume_token(FN_PREFIX); + jj_consume_token(MAXGAPS); + jj_consume_token(LPAREN); + maxGaps = jj_consume_token(NUMBER); + source = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new MaxGaps(parseInt(maxGaps), source); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalUnordered() throws ParseException { + IntervalFunction source; + ArrayList sources = new ArrayList(); + jj_consume_token(FN_PREFIX); + jj_consume_token(UNORDERED); + jj_consume_token(LPAREN); + label_7: + while (true) { + source = IntervalFun(); + sources.add(source); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[17] = jj_gen; + break label_7; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new Unordered(sources); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalUnorderedNoOverlaps() throws ParseException { + IntervalFunction a, b; + jj_consume_token(FN_PREFIX); + jj_consume_token(UNORDERED_NO_OVERLAPS); + jj_consume_token(LPAREN); + a = IntervalFun(); + b = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new UnorderedNoOverlaps(a, b); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalOrdered() throws ParseException { + IntervalFunction source; + ArrayList sources = new ArrayList(); + jj_consume_token(FN_PREFIX); + jj_consume_token(ORDERED); + jj_consume_token(LPAREN); + label_8: + while (true) { + source = IntervalFun(); + sources.add(source); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[18] = jj_gen; + break label_8; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new Ordered(sources); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalOr() throws ParseException { + IntervalFunction source; + ArrayList sources = new ArrayList(); + jj_consume_token(FN_PREFIX); + jj_consume_token(FN_OR); + jj_consume_token(LPAREN); + label_9: + while (true) { + source = IntervalFun(); + sources.add(source); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[19] = jj_gen; + break label_9; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new Or(sources); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalPhrase() throws ParseException { + IntervalFunction source; + ArrayList sources = new ArrayList(); + jj_consume_token(FN_PREFIX); + jj_consume_token(PHRASE); + jj_consume_token(LPAREN); + label_10: + while (true) { + source = IntervalFun(); + sources.add(source); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case FN_PREFIX: + case QUOTED: + case NUMBER: + case TERM: { + ; + break; + } + default: + jj_la1[20] = jj_gen; + break label_10; + } + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new Phrase(sources); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalBefore() throws ParseException { + IntervalFunction source; + IntervalFunction reference; + jj_consume_token(FN_PREFIX); + jj_consume_token(BEFORE); + jj_consume_token(LPAREN); + source = IntervalFun(); + reference = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new Before(source, reference); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalAfter() throws ParseException { + IntervalFunction source; + IntervalFunction reference; + jj_consume_token(FN_PREFIX); + jj_consume_token(AFTER); + jj_consume_token(LPAREN); + source = IntervalFun(); + reference = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new After(source, reference); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalContaining() throws ParseException { + IntervalFunction big; + IntervalFunction small; + jj_consume_token(FN_PREFIX); + jj_consume_token(CONTAINING); + jj_consume_token(LPAREN); + big = IntervalFun(); + small = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new Containing(big, small); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalNotContaining() throws ParseException { + IntervalFunction minuend; + IntervalFunction subtrahend; + jj_consume_token(FN_PREFIX); + jj_consume_token(NOT_CONTAINING); + jj_consume_token(LPAREN); + minuend = IntervalFun(); + subtrahend = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new NotContaining(minuend, subtrahend); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalContainedBy() throws ParseException { + IntervalFunction big; + IntervalFunction small; + jj_consume_token(FN_PREFIX); + jj_consume_token(CONTAINED_BY); + jj_consume_token(LPAREN); + small = IntervalFun(); + big = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new ContainedBy(small, big); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalNotContainedBy() throws ParseException { + IntervalFunction big; + IntervalFunction small; + jj_consume_token(FN_PREFIX); + jj_consume_token(NOT_CONTAINED_BY); + jj_consume_token(LPAREN); + small = IntervalFun(); + big = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new NotContainedBy(small, big); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalWithin() throws ParseException { + IntervalFunction source, reference; + Token positions; + jj_consume_token(FN_PREFIX); + jj_consume_token(WITHIN); + jj_consume_token(LPAREN); + source = IntervalFun(); + positions = jj_consume_token(NUMBER); + reference = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new Within(source, parseInt(positions), reference); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalExtend() throws ParseException { + IntervalFunction source; + Token before, after; + jj_consume_token(FN_PREFIX); + jj_consume_token(EXTEND); + jj_consume_token(LPAREN); + source = IntervalFun(); + before = jj_consume_token(NUMBER); + after = jj_consume_token(NUMBER); + jj_consume_token(RPAREN); + { + if ("" != null) + return new Extend(source, parseInt(before), parseInt(after)); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalNotWithin() throws ParseException { + IntervalFunction minuend, subtrahend; + Token positions; + jj_consume_token(FN_PREFIX); + jj_consume_token(NOT_WITHIN); + jj_consume_token(LPAREN); + minuend = IntervalFun(); + positions = jj_consume_token(NUMBER); + subtrahend = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new NotWithin(minuend, parseInt(positions), subtrahend); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalOverlapping() throws ParseException { + IntervalFunction source, reference; + jj_consume_token(FN_PREFIX); + jj_consume_token(OVERLAPPING); + jj_consume_token(LPAREN); + source = IntervalFun(); + reference = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new Overlapping(source, reference); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalNonOverlapping() throws ParseException { + IntervalFunction minuend, subtrahend; + jj_consume_token(FN_PREFIX); + jj_consume_token(NON_OVERLAPPING); + jj_consume_token(LPAREN); + minuend = IntervalFun(); + subtrahend = IntervalFun(); + jj_consume_token(RPAREN); + { + if ("" != null) + return new NonOverlapping(minuend, subtrahend); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalWildcard() throws ParseException { + String wildcard; + Token maxExpansions = null; + jj_consume_token(FN_PREFIX); + jj_consume_token(WILDCARD); + jj_consume_token(LPAREN); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case NUMBER: + case TERM: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + jj_consume_token(TERM); + break; + } + case NUMBER: { + jj_consume_token(NUMBER); + break; + } + default: + jj_la1[21] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + wildcard = token.image; + break; + } + case QUOTED: { + jj_consume_token(QUOTED); + wildcard = token.image.substring(1, token.image.length() - 1); + break; + } + default: + jj_la1[22] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case NUMBER: { + maxExpansions = jj_consume_token(NUMBER); + break; + } + default: + jj_la1[23] = jj_gen; + ; + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new Wildcard(wildcard, maxExpansions == null ? 0 : parseInt(maxExpansions)); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalFuzzyTerm() throws ParseException { + String term; + Token maxEdits = null; + Token maxExpansions = null; + jj_consume_token(FN_PREFIX); + jj_consume_token(FUZZYTERM); + jj_consume_token(LPAREN); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case NUMBER: + case TERM: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + jj_consume_token(TERM); + break; + } + case NUMBER: { + jj_consume_token(NUMBER); + break; + } + default: + jj_la1[24] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + term = token.image; + break; + } + case QUOTED: { + jj_consume_token(QUOTED); + term = token.image.substring(1, token.image.length() - 1); + break; + } + default: + jj_la1[25] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if (jj_2_28(2)) { + maxEdits = jj_consume_token(NUMBER); + } + else { + ; + } + if (jj_2_29(2)) { + maxExpansions = jj_consume_token(NUMBER); + } + else { + ; + } + jj_consume_token(RPAREN); + { + if ("" != null) + return new FuzzyTerm(term, maxEdits == null ? null : parseInt(maxEdits), maxExpansions == null ? null : parseInt(maxExpansions)); + } + throw new Error("Missing return statement in function"); + } + + final private IntervalFunction IntervalText() throws ParseException { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case QUOTED: { + jj_consume_token(QUOTED); + { + if ("" != null) + return new AnalyzedText(token.image.substring(1, token.image.length() - 1)); + } + break; + } + case NUMBER: + case TERM: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + jj_consume_token(TERM); + break; + } + case NUMBER: { + jj_consume_token(NUMBER); + break; + } + default: + jj_la1[26] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + { + if ("" != null) + return new AnalyzedText(token.image); + } + break; + } + default: + jj_la1[27] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode Boost(QueryNode node) throws ParseException { + Token boost; + jj_consume_token(CARAT); + boost = jj_consume_token(NUMBER); + { + if ("" != null) + return node == null ? node : new BoostQueryNode(node, parseFloat(boost)); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode FuzzyOp(CharSequence field, Token term, QueryNode node) throws ParseException { + Token similarity = null; + jj_consume_token(TILDE); + if (jj_2_30(2)) { + similarity = jj_consume_token(NUMBER); + } + else { + ; + } + float fms = org.apache.lucene.search.FuzzyQuery.defaultMaxEdits; + if (similarity != null) { + fms = parseFloat(similarity); + if (fms < 0.0f) { + { + if (true) + throw new ParseException(new MessageImpl(QueryParserMessages.INVALID_SYNTAX_FUZZY_LIMITS)); + } + } + else if (fms >= 1.0f && fms != (int) fms) { + { + if (true) + throw new ParseException(new MessageImpl(QueryParserMessages.INVALID_SYNTAX_FUZZY_EDITS)); + } + } + } + { + if ("" != null) + return new FuzzyQueryNode(field, discardEscapeChar(term.image), fms, term.beginColumn, term.endColumn); + } + throw new Error("Missing return statement in function"); + } + + final private TermRangeQueryNode FieldRangeExpr(CharSequence field) throws ParseException { + Token operator, term; + FieldQueryNode qLower, qUpper; + boolean lowerInclusive, upperInclusive; + field = FieldName(); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case OP_LESSTHAN: { + jj_consume_token(OP_LESSTHAN); + break; + } + case OP_LESSTHANEQ: { + jj_consume_token(OP_LESSTHANEQ); + break; + } + case OP_MORETHAN: { + jj_consume_token(OP_MORETHAN); + break; + } + case OP_MORETHANEQ: { + jj_consume_token(OP_MORETHANEQ); + break; + } + default: + jj_la1[28] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + operator = token; + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + jj_consume_token(TERM); + break; + } + case QUOTED: { + jj_consume_token(QUOTED); + break; + } + case NUMBER: { + jj_consume_token(NUMBER); + break; + } + default: + jj_la1[29] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + term = token; + if (term.kind == QUOTED) { + term.image = term.image.substring(1, term.image.length() - 1); + } + switch (operator.kind) { + case OP_LESSTHAN: + lowerInclusive = true; + upperInclusive = false; + qLower = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); + qUpper = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); + break; + case OP_LESSTHANEQ: + lowerInclusive = true; + upperInclusive = true; + qLower = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); + qUpper = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); + break; + case OP_MORETHAN: + lowerInclusive = false; + upperInclusive = true; + qLower = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); + qUpper = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); + break; + case OP_MORETHANEQ: + lowerInclusive = true; + upperInclusive = true; + qLower = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); + qUpper = new FieldQueryNode(field, "*", term.beginColumn, term.endColumn); + break; + default: { + if (true) + throw new Error("Unhandled case, operator=" + operator); + } + } + { + if ("" != null) + return new TermRangeQueryNode(qLower, qUpper, lowerInclusive, upperInclusive); + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode Term(CharSequence field) throws ParseException { + QueryNode q; + Token term, fuzzySlop = null; + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case REGEXPTERM: { + term = jj_consume_token(REGEXPTERM); + String v = term.image.substring(1, term.image.length() - 1); + q = new RegexpQueryNode(field, v, 0, v.length()); + break; + } + case NUMBER: + case TERM: { + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TERM: { + term = jj_consume_token(TERM); + break; + } + case NUMBER: { + term = jj_consume_token(NUMBER); + break; + } + default: + jj_la1[30] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + q = new FieldQueryNode(field, discardEscapeChar(term.image), term.beginColumn, term.endColumn); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TILDE: { + q = FuzzyOp(field, term, q); + break; + } + default: + jj_la1[31] = jj_gen; + ; + } + break; + } + case RANGEIN_START: + case RANGEEX_START: { + q = TermRangeExpr(field); + break; + } + case QUOTED: { + q = QuotedTerm(field); + break; + } + default: + jj_la1[32] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case CARAT: { + q = Boost(q); + break; + } + default: + jj_la1[33] = jj_gen; + ; + } + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private QueryNode QuotedTerm(CharSequence field) throws ParseException { + QueryNode q; + Token term, slop; + term = jj_consume_token(QUOTED); + String image = term.image.substring(1, term.image.length() - 1); + q = new QuotedFieldQueryNode(field, discardEscapeChar(image), term.beginColumn + 1, term.endColumn - 1); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case TILDE: { + jj_consume_token(TILDE); + slop = jj_consume_token(NUMBER); + q = new SlopQueryNode(q, parseInt(slop)); + break; + } + default: + jj_la1[34] = jj_gen; + ; + } + { + if ("" != null) + return q; + } + throw new Error("Missing return statement in function"); + } + + final private TermRangeQueryNode TermRangeExpr(CharSequence field) throws ParseException { + Token left, right; + boolean leftInclusive = false; + boolean rightInclusive = false; + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case RANGEIN_START: { + jj_consume_token(RANGEIN_START); + leftInclusive = true; + break; + } + case RANGEEX_START: { + jj_consume_token(RANGEEX_START); + break; + } + default: + jj_la1[35] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case RANGE_GOOP: { + jj_consume_token(RANGE_GOOP); + break; + } + case RANGE_QUOTED: { + jj_consume_token(RANGE_QUOTED); + break; + } + case RANGE_TO: { + jj_consume_token(RANGE_TO); + break; + } + default: + jj_la1[36] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + left = token; + jj_consume_token(RANGE_TO); + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case RANGE_GOOP: { + jj_consume_token(RANGE_GOOP); + break; + } + case RANGE_QUOTED: { + jj_consume_token(RANGE_QUOTED); + break; + } + case RANGE_TO: { + jj_consume_token(RANGE_TO); + break; + } + default: + jj_la1[37] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + right = token; + switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) { + case RANGEIN_END: { + jj_consume_token(RANGEIN_END); + rightInclusive = true; + break; + } + case RANGEEX_END: { + jj_consume_token(RANGEEX_END); + break; + } + default: + jj_la1[38] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if (left.kind == RANGE_QUOTED) { + left.image = left.image.substring(1, left.image.length() - 1); + } + if (right.kind == RANGE_QUOTED) { + right.image = right.image.substring(1, right.image.length() - 1); + } + + FieldQueryNode qLower = new FieldQueryNode(field, discardEscapeChar(left.image), left.beginColumn, left.endColumn); + FieldQueryNode qUpper = new FieldQueryNode(field, discardEscapeChar(right.image), right.beginColumn, right.endColumn); + + { + if ("" != null) + return new TermRangeQueryNode(qLower, qUpper, leftInclusive, rightInclusive); + } + throw new Error("Missing return statement in function"); + } + + private boolean jj_2_1(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_1()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(0, xla); + } + } + + private boolean jj_2_2(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_2()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(1, xla); + } + } + + private boolean jj_2_3(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_3()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(2, xla); + } + } + + private boolean jj_2_4(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_4()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(3, xla); + } + } + + private boolean jj_2_5(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_5()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(4, xla); + } + } + + private boolean jj_2_6(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_6()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(5, xla); + } + } + + private boolean jj_2_7(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_7()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(6, xla); + } + } + + private boolean jj_2_8(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_8()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(7, xla); + } + } + + private boolean jj_2_9(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_9()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(8, xla); + } + } + + private boolean jj_2_10(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_10()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(9, xla); + } + } + + private boolean jj_2_11(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_11()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(10, xla); + } + } + + private boolean jj_2_12(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_12()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(11, xla); + } + } + + private boolean jj_2_13(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_13()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(12, xla); + } + } + + private boolean jj_2_14(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_14()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(13, xla); + } + } + + private boolean jj_2_15(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_15()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(14, xla); + } + } + + private boolean jj_2_16(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_16()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(15, xla); + } + } + + private boolean jj_2_17(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_17()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(16, xla); + } + } + + private boolean jj_2_18(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_18()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(17, xla); + } + } + + private boolean jj_2_19(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_19()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(18, xla); + } + } + + private boolean jj_2_20(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_20()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(19, xla); + } + } + + private boolean jj_2_21(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_21()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(20, xla); + } + } + + private boolean jj_2_22(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_22()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(21, xla); + } + } + + private boolean jj_2_23(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_23()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(22, xla); + } + } + + private boolean jj_2_24(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_24()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(23, xla); + } + } + + private boolean jj_2_25(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_25()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(24, xla); + } + } + + private boolean jj_2_26(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_26()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(25, xla); + } + } + + private boolean jj_2_27(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_27()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(26, xla); + } + } + + private boolean jj_2_28(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_28()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(27, xla); + } + } + + private boolean jj_2_29(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_29()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(28, xla); + } + } + + private boolean jj_2_30(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return (!jj_3_30()); + } + catch (LookaheadSuccess ls) { + return true; + } + finally { + jj_save(29, xla); + } + } + + private boolean jj_3R_32() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(NOT_WITHIN)) + return true; + return false; + } + + private boolean jj_3R_25() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(BEFORE)) + return true; + return false; + } + + private boolean jj_3R_16() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(ATLEAST)) + return true; + return false; + } + + private boolean jj_3R_12() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_38()) { + jj_scanpos = xsp; + if (jj_3R_39()) { + jj_scanpos = xsp; + if (jj_3R_40()) { + jj_scanpos = xsp; + if (jj_3R_41()) + return true; + } + } + } + xsp = jj_scanpos; + if (jj_3R_42()) + jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_48() { + if (jj_scan_token(CARAT)) + return true; + return false; + } + + private boolean jj_3_27() { + if (jj_3R_37()) + return true; + return false; + } + + private boolean jj_3_26() { + if (jj_3R_36()) + return true; + return false; + } + + private boolean jj_3_25() { + if (jj_3R_35()) + return true; + return false; + } + + private boolean jj_3_24() { + if (jj_3R_34()) + return true; + return false; + } + + private boolean jj_3_23() { + if (jj_3R_33()) + return true; + return false; + } + + private boolean jj_3R_26() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(PHRASE)) + return true; + return false; + } + + private boolean jj_3_22() { + if (jj_3R_32()) + return true; + return false; + } + + private boolean jj_3R_35() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(EXTEND)) + return true; + return false; + } + + private boolean jj_3_21() { + if (jj_3R_31()) + return true; + return false; + } + + private boolean jj_3_20() { + if (jj_3R_30()) + return true; + return false; + } + + private boolean jj_3R_44() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(26)) { + jj_scanpos = xsp; + if (jj_scan_token(25)) + return true; + } + return false; + } + + private boolean jj_3_19() { + if (jj_3R_29()) + return true; + return false; + } + + private boolean jj_3R_43() { + if (jj_scan_token(QUOTED)) + return true; + return false; + } + + private boolean jj_3R_37() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_43()) { + jj_scanpos = xsp; + if (jj_3R_44()) + return true; + } + return false; + } + + private boolean jj_3_18() { + if (jj_3R_28()) + return true; + return false; + } + + private boolean jj_3_17() { + if (jj_3R_27()) + return true; + return false; + } + + private boolean jj_3_16() { + if (jj_3R_26()) + return true; + return false; + } + + private boolean jj_3_15() { + if (jj_3R_25()) + return true; + return false; + } + + private boolean jj_3R_11() { + if (jj_scan_token(TERM)) + return true; + return false; + } + + private boolean jj_3_14() { + if (jj_3R_24()) + return true; + return false; + } + + private boolean jj_3_13() { + if (jj_3R_23()) + return true; + return false; + } + + private boolean jj_3_12() { + if (jj_3R_22()) + return true; + return false; + } + + private boolean jj_3_11() { + if (jj_3R_21()) + return true; + return false; + } + + private boolean jj_3R_22() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(FN_OR)) + return true; + return false; + } + + private boolean jj_3_10() { + if (jj_3R_20()) + return true; + return false; + } + + private boolean jj_3_9() { + if (jj_3R_19()) + return true; + return false; + } + + private boolean jj_3_8() { + if (jj_3R_18()) + return true; + return false; + } + + private boolean jj_3_7() { + if (jj_3R_17()) + return true; + return false; + } + + private boolean jj_3_6() { + if (jj_3R_16()) + return true; + return false; + } + + private boolean jj_3_29() { + if (jj_scan_token(NUMBER)) + return true; + return false; + } + + private boolean jj_3R_31() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(WITHIN)) + return true; + return false; + } + + private boolean jj_3_2() { + if (jj_3R_12()) + return true; + return false; + } + + private boolean jj_3_28() { + if (jj_scan_token(NUMBER)) + return true; + return false; + } + + private boolean jj_3_1() { + if (jj_3R_11()) + return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(16)) { + jj_scanpos = xsp; + if (jj_scan_token(17)) + return true; + } + return false; + } + + private boolean jj_3_3() { + if (jj_3R_13()) + return true; + return false; + } + + private boolean jj_3R_50() { + if (jj_scan_token(RANGEIN_START)) + return true; + return false; + } + + private boolean jj_3R_19() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(ORDERED)) + return true; + return false; + } + + private boolean jj_3R_36() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(FUZZYTERM)) + return true; + return false; + } + + private boolean jj_3R_46() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_50()) { + jj_scanpos = xsp; + if (jj_scan_token(29)) + return true; + } + xsp = jj_scanpos; + if (jj_scan_token(58)) { + jj_scanpos = xsp; + if (jj_scan_token(57)) { + jj_scanpos = xsp; + if (jj_scan_token(54)) + return true; + } + } + return false; + } + + private boolean jj_3R_30() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(NOT_CONTAINED_BY)) + return true; + return false; + } + + private boolean jj_3R_21() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(UNORDERED_NO_OVERLAPS)) + return true; + return false; + } + + private boolean jj_3R_29() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(CONTAINED_BY)) + return true; + return false; + } + + private boolean jj_3R_13() { + if (jj_3R_11()) + return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(18)) { + jj_scanpos = xsp; + if (jj_scan_token(19)) { + jj_scanpos = xsp; + if (jj_scan_token(20)) { + jj_scanpos = xsp; + if (jj_scan_token(21)) + return true; + } + } + } + return false; + } + + private boolean jj_3R_23() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(WILDCARD)) + return true; + return false; + } + + private boolean jj_3R_51() { + if (jj_scan_token(TILDE)) + return true; + return false; + } + + private boolean jj_3R_20() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(UNORDERED)) + return true; + return false; + } + + private boolean jj_3R_28() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(NOT_CONTAINING)) + return true; + return false; + } + + private boolean jj_3R_15() { + if (jj_scan_token(ZL_PREFIX)) + return true; + if (jj_scan_token(TERM_SET)) + return true; + return false; + } + + private boolean jj_3R_47() { + if (jj_scan_token(QUOTED)) + return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_51()) + jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_34() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(NON_OVERLAPPING)) + return true; + return false; + } + + private boolean jj_3R_18() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(MAXGAPS)) + return true; + return false; + } + + private boolean jj_3_30() { + if (jj_scan_token(NUMBER)) + return true; + return false; + } + + private boolean jj_3R_27() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(CONTAINING)) + return true; + return false; + } + + private boolean jj_3R_14() { + if (jj_scan_token(ZL_PREFIX)) + return true; + if (jj_scan_token(NUMERIC_SET)) + return true; + return false; + } + + private boolean jj_3R_33() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(OVERLAPPING)) + return true; + return false; + } + + private boolean jj_3R_45() { + if (jj_3R_49()) + return true; + return false; + } + + private boolean jj_3R_41() { + if (jj_3R_47()) + return true; + return false; + } + + private boolean jj_3R_49() { + if (jj_scan_token(TILDE)) + return true; + return false; + } + + private boolean jj_3R_42() { + if (jj_3R_48()) + return true; + return false; + } + + private boolean jj_3R_40() { + if (jj_3R_46()) + return true; + return false; + } + + private boolean jj_3_5() { + if (jj_3R_15()) + return true; + return false; + } + + private boolean jj_3R_17() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(MAXWIDTH)) + return true; + return false; + } + + private boolean jj_3_4() { + if (jj_3R_14()) + return true; + return false; + } + + private boolean jj_3R_39() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(26)) { + jj_scanpos = xsp; + if (jj_scan_token(25)) + return true; + } + xsp = jj_scanpos; + if (jj_3R_45()) + jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_24() { + if (jj_scan_token(FN_PREFIX)) + return true; + if (jj_scan_token(AFTER)) + return true; + return false; + } + + private boolean jj_3R_38() { + if (jj_scan_token(REGEXPTERM)) + return true; + return false; + } + + /** + * Generated Token Manager. + */ + public ZuliaSyntaxParserTokenManager token_source; + /** + * Current token. + */ + public Token token; + /** + * Next token. + */ + public Token jj_nt; + private int jj_ntk; + private Token jj_scanpos, jj_lastpos; + private int jj_la; + private int jj_gen; + final private int[] jj_la1 = new int[39]; + static private int[] jj_la1_0; + static private int[] jj_la1_1; + + static { + jj_la1_init_0(); + jj_la1_init_1(); + } + + private static void jj_la1_init_0() { + jj_la1_0 = new int[] { 0x7f007c00, 0x200, 0x100, 0x4400, 0x6400, 0x6400, 0x30000, 0x47001800, 0x7f001800, 0x400000, 0x800000, 0x800000, 0x7000000, + 0x7000000, 0x6000000, 0x7000000, 0x7000800, 0x7000800, 0x7000800, 0x7000800, 0x7000800, 0x6000000, 0x7000000, 0x2000000, 0x6000000, 0x7000000, + 0x6000000, 0x7000000, 0x3c0000, 0x7000000, 0x6000000, 0x800000, 0x3f000000, 0x400000, 0x800000, 0x30000000, 0x0, 0x0, 0x0, }; + } + + private static void jj_la1_init_1() { + jj_la1_1 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8000000, 0x8000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6400000, 0x6400000, 0x1800000, }; + } + + final private JJCalls[] jj_2_rtns = new JJCalls[30]; + private boolean jj_rescan = false; + private int jj_gc = 0; + + /** + * Constructor with user supplied CharStream. + */ + public ZuliaSyntaxParser(CharStream stream) { + token_source = new ZuliaSyntaxParserTokenManager(stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 39; i++) + jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) + jj_2_rtns[i] = new JJCalls(); + } + + /** + * Reinitialise. + */ + public void ReInit(CharStream stream) { + token_source.ReInit(stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 39; i++) + jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) + jj_2_rtns[i] = new JJCalls(); + } + + /** + * Constructor with generated Token Manager. + */ + public ZuliaSyntaxParser(ZuliaSyntaxParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 39; i++) + jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) + jj_2_rtns[i] = new JJCalls(); + } + + /** + * Reinitialise. + */ + public void ReInit(ZuliaSyntaxParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 39; i++) + jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) + jj_2_rtns[i] = new JJCalls(); + } + + private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) + token = token.next; + else + token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + if (++jj_gc > 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) + c.first = null; + c = c.next; + } + } + } + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + @SuppressWarnings("serial") + static private final class LookaheadSuccess extends java.lang.Error { + } + + final private LookaheadSuccess jj_ls = new LookaheadSuccess(); + + private boolean jj_scan_token(int kind) { + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } + else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } + else { + jj_scanpos = jj_scanpos.next; + } + if (jj_rescan) { + int i = 0; + Token tok = token; + while (tok != null && tok != jj_scanpos) { + i++; + tok = tok.next; + } + if (tok != null) + jj_add_error_token(kind, i); + } + if (jj_scanpos.kind != kind) + return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) + throw jj_ls; + return false; + } + + /** + * Get the next Token. + */ + final public Token getNextToken() { + if (token.next != null) + token = token.next; + else + token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + + /** + * Get the specific Token. + */ + final public Token getToken(int index) { + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) + t = t.next; + else + t = t.next = token_source.getNextToken(); + } + return t; + } + + private int jj_ntk_f() { + if ((jj_nt = token.next) == null) + return (jj_ntk = (token.next = token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.List jj_expentries = new java.util.ArrayList<>(); + private int[] jj_expentry; + private int jj_kind = -1; + private int[] jj_lasttokens = new int[100]; + private int jj_endpos; + + private void jj_add_error_token(int kind, int pos) { + if (pos >= 100) { + return; + } + + if (pos == jj_endpos + 1) { + jj_lasttokens[jj_endpos++] = kind; + } + else if (jj_endpos != 0) { + jj_expentry = new int[jj_endpos]; + + for (int i = 0; i < jj_endpos; i++) { + jj_expentry[i] = jj_lasttokens[i]; + } + + for (int[] oldentry : jj_expentries) { + if (oldentry.length == jj_expentry.length) { + boolean isMatched = true; + + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + isMatched = false; + break; + } + + } + if (isMatched) { + jj_expentries.add(jj_expentry); + break; + } + } + } + + if (pos != 0) { + jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } + } + } + + /** + * Generate ParseException. + */ + public ParseException generateParseException() { + jj_expentries.clear(); + boolean[] la1tokens = new boolean[60]; + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 39; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1 << j)) != 0) { + la1tokens[j] = true; + } + if ((jj_la1_1[i] & (1 << j)) != 0) { + la1tokens[32 + j] = true; + } + } + } + } + for (int i = 0; i < 60; i++) { + if (la1tokens[i]) { + jj_expentry = new int[1]; + jj_expentry[0] = i; + jj_expentries.add(jj_expentry); + } + } + jj_endpos = 0; + jj_rescan_token(); + jj_add_error_token(0, 0); + int[][] exptokseq = new int[jj_expentries.size()][]; + for (int i = 0; i < jj_expentries.size(); i++) { + exptokseq[i] = jj_expentries.get(i); + } + return new ParseException(token, exptokseq, tokenImage); + } + + private int trace_indent = 0; + private boolean trace_enabled; + + /** + * Trace enabled. + */ + final public boolean trace_enabled() { + return trace_enabled; + } + + /** + * Enable tracing. + */ + final public void enable_tracing() { + } + + /** + * Disable tracing. + */ + final public void disable_tracing() { + } + + private void jj_rescan_token() { + jj_rescan = true; + for (int i = 0; i < 30; i++) { + try { + JJCalls p = jj_2_rtns[i]; + + do { + if (p.gen > jj_gen) { + jj_la = p.arg; + jj_lastpos = jj_scanpos = p.first; + switch (i) { + case 0: + jj_3_1(); + break; + case 1: + jj_3_2(); + break; + case 2: + jj_3_3(); + break; + case 3: + jj_3_4(); + break; + case 4: + jj_3_5(); + break; + case 5: + jj_3_6(); + break; + case 6: + jj_3_7(); + break; + case 7: + jj_3_8(); + break; + case 8: + jj_3_9(); + break; + case 9: + jj_3_10(); + break; + case 10: + jj_3_11(); + break; + case 11: + jj_3_12(); + break; + case 12: + jj_3_13(); + break; + case 13: + jj_3_14(); + break; + case 14: + jj_3_15(); + break; + case 15: + jj_3_16(); + break; + case 16: + jj_3_17(); + break; + case 17: + jj_3_18(); + break; + case 18: + jj_3_19(); + break; + case 19: + jj_3_20(); + break; + case 20: + jj_3_21(); + break; + case 21: + jj_3_22(); + break; + case 22: + jj_3_23(); + break; + case 23: + jj_3_24(); + break; + case 24: + jj_3_25(); + break; + case 25: + jj_3_26(); + break; + case 26: + jj_3_27(); + break; + case 27: + jj_3_28(); + break; + case 28: + jj_3_29(); + break; + case 29: + jj_3_30(); + break; + } + } + p = p.next; + } + while (p != null); + + } + catch (LookaheadSuccess ls) { + } + } + jj_rescan = false; + } + + private void jj_save(int index, int xla) { + JJCalls p = jj_2_rtns[index]; + while (p.gen > jj_gen) { + if (p.next == null) { + p = p.next = new JJCalls(); + break; + } + p = p.next; + } + + p.gen = jj_gen + xla - jj_la; + p.first = token; + p.arg = xla; + } + + static final class JJCalls { + int gen; + Token first; + int arg; + JJCalls next; + } } diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserConstants.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserConstants.java index 2aa7be38..12c6b6d1 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserConstants.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserConstants.java @@ -7,264 +7,264 @@ */ public interface ZuliaSyntaxParserConstants { - /** - * End of File. - */ - int EOF = 0; - /** - * RegularExpression Id. - */ - int _NUM_CHAR = 1; - /** - * RegularExpression Id. - */ - int _ESCAPED_CHAR = 2; - /** - * RegularExpression Id. - */ - int _TERM_START_CHAR = 3; - /** - * RegularExpression Id. - */ - int _TERM_CHAR = 4; - /** - * RegularExpression Id. - */ - int _WHITESPACE = 5; - /** - * RegularExpression Id. - */ - int _QUOTED_CHAR = 6; - /** - * RegularExpression Id. - */ - int AND = 8; - /** - * RegularExpression Id. - */ - int OR = 9; - /** - * RegularExpression Id. - */ - int NOT = 10; - /** - * RegularExpression Id. - */ - int FN_PREFIX = 11; - /** - * RegularExpression Id. - */ - int ZL_PREFIX = 12; - /** - * RegularExpression Id. - */ - int PLUS = 13; - /** - * RegularExpression Id. - */ - int MINUS = 14; - /** - * RegularExpression Id. - */ - int RPAREN = 15; - /** - * RegularExpression Id. - */ - int OP_COLON = 16; - /** - * RegularExpression Id. - */ - int OP_EQUAL = 17; - /** - * RegularExpression Id. - */ - int OP_LESSTHAN = 18; - /** - * RegularExpression Id. - */ - int OP_LESSTHANEQ = 19; - /** - * RegularExpression Id. - */ - int OP_MORETHAN = 20; - /** - * RegularExpression Id. - */ - int OP_MORETHANEQ = 21; - /** - * RegularExpression Id. - */ - int CARAT = 22; - /** - * RegularExpression Id. - */ - int TILDE = 23; - /** - * RegularExpression Id. - */ - int QUOTED = 24; - /** - * RegularExpression Id. - */ - int NUMBER = 25; - /** - * RegularExpression Id. - */ - int TERM = 26; - /** - * RegularExpression Id. - */ - int REGEXPTERM = 27; - /** - * RegularExpression Id. - */ - int RANGEIN_START = 28; - /** - * RegularExpression Id. - */ - int RANGEEX_START = 29; - /** - * RegularExpression Id. - */ - int LPAREN = 30; - /** - * RegularExpression Id. - */ - int NUMERIC_SET = 31; - /** - * RegularExpression Id. - */ - int TERM_SET = 32; - /** - * RegularExpression Id. - */ - int ATLEAST = 33; - /** - * RegularExpression Id. - */ - int AFTER = 34; - /** - * RegularExpression Id. - */ - int BEFORE = 35; - /** - * RegularExpression Id. - */ - int CONTAINED_BY = 36; - /** - * RegularExpression Id. - */ - int CONTAINING = 37; - /** - * RegularExpression Id. - */ - int EXTEND = 38; - /** - * RegularExpression Id. - */ - int FN_OR = 39; - /** - * RegularExpression Id. - */ - int FUZZYTERM = 40; - /** - * RegularExpression Id. - */ - int MAXGAPS = 41; - /** - * RegularExpression Id. - */ - int MAXWIDTH = 42; - /** - * RegularExpression Id. - */ - int NON_OVERLAPPING = 43; - /** - * RegularExpression Id. - */ - int NOT_CONTAINED_BY = 44; - /** - * RegularExpression Id. - */ - int NOT_CONTAINING = 45; - /** - * RegularExpression Id. - */ - int NOT_WITHIN = 46; - /** - * RegularExpression Id. - */ - int ORDERED = 47; - /** - * RegularExpression Id. - */ - int OVERLAPPING = 48; - /** - * RegularExpression Id. - */ - int PHRASE = 49; - /** - * RegularExpression Id. - */ - int UNORDERED = 50; - /** - * RegularExpression Id. - */ - int UNORDERED_NO_OVERLAPS = 51; - /** - * RegularExpression Id. - */ - int WILDCARD = 52; - /** - * RegularExpression Id. - */ - int WITHIN = 53; - /** - * RegularExpression Id. - */ - int RANGE_TO = 54; - /** - * RegularExpression Id. - */ - int RANGEIN_END = 55; - /** - * RegularExpression Id. - */ - int RANGEEX_END = 56; - /** - * RegularExpression Id. - */ - int RANGE_QUOTED = 57; - /** - * RegularExpression Id. - */ - int RANGE_GOOP = 58; + /** + * End of File. + */ + int EOF = 0; + /** + * RegularExpression Id. + */ + int _NUM_CHAR = 1; + /** + * RegularExpression Id. + */ + int _ESCAPED_CHAR = 2; + /** + * RegularExpression Id. + */ + int _TERM_START_CHAR = 3; + /** + * RegularExpression Id. + */ + int _TERM_CHAR = 4; + /** + * RegularExpression Id. + */ + int _WHITESPACE = 5; + /** + * RegularExpression Id. + */ + int _QUOTED_CHAR = 6; + /** + * RegularExpression Id. + */ + int AND = 8; + /** + * RegularExpression Id. + */ + int OR = 9; + /** + * RegularExpression Id. + */ + int NOT = 10; + /** + * RegularExpression Id. + */ + int FN_PREFIX = 11; + /** + * RegularExpression Id. + */ + int ZL_PREFIX = 12; + /** + * RegularExpression Id. + */ + int PLUS = 13; + /** + * RegularExpression Id. + */ + int MINUS = 14; + /** + * RegularExpression Id. + */ + int RPAREN = 15; + /** + * RegularExpression Id. + */ + int OP_COLON = 16; + /** + * RegularExpression Id. + */ + int OP_EQUAL = 17; + /** + * RegularExpression Id. + */ + int OP_LESSTHAN = 18; + /** + * RegularExpression Id. + */ + int OP_LESSTHANEQ = 19; + /** + * RegularExpression Id. + */ + int OP_MORETHAN = 20; + /** + * RegularExpression Id. + */ + int OP_MORETHANEQ = 21; + /** + * RegularExpression Id. + */ + int CARAT = 22; + /** + * RegularExpression Id. + */ + int TILDE = 23; + /** + * RegularExpression Id. + */ + int QUOTED = 24; + /** + * RegularExpression Id. + */ + int NUMBER = 25; + /** + * RegularExpression Id. + */ + int TERM = 26; + /** + * RegularExpression Id. + */ + int REGEXPTERM = 27; + /** + * RegularExpression Id. + */ + int RANGEIN_START = 28; + /** + * RegularExpression Id. + */ + int RANGEEX_START = 29; + /** + * RegularExpression Id. + */ + int LPAREN = 30; + /** + * RegularExpression Id. + */ + int NUMERIC_SET = 31; + /** + * RegularExpression Id. + */ + int TERM_SET = 32; + /** + * RegularExpression Id. + */ + int ATLEAST = 33; + /** + * RegularExpression Id. + */ + int AFTER = 34; + /** + * RegularExpression Id. + */ + int BEFORE = 35; + /** + * RegularExpression Id. + */ + int CONTAINED_BY = 36; + /** + * RegularExpression Id. + */ + int CONTAINING = 37; + /** + * RegularExpression Id. + */ + int EXTEND = 38; + /** + * RegularExpression Id. + */ + int FN_OR = 39; + /** + * RegularExpression Id. + */ + int FUZZYTERM = 40; + /** + * RegularExpression Id. + */ + int MAXGAPS = 41; + /** + * RegularExpression Id. + */ + int MAXWIDTH = 42; + /** + * RegularExpression Id. + */ + int NON_OVERLAPPING = 43; + /** + * RegularExpression Id. + */ + int NOT_CONTAINED_BY = 44; + /** + * RegularExpression Id. + */ + int NOT_CONTAINING = 45; + /** + * RegularExpression Id. + */ + int NOT_WITHIN = 46; + /** + * RegularExpression Id. + */ + int ORDERED = 47; + /** + * RegularExpression Id. + */ + int OVERLAPPING = 48; + /** + * RegularExpression Id. + */ + int PHRASE = 49; + /** + * RegularExpression Id. + */ + int UNORDERED = 50; + /** + * RegularExpression Id. + */ + int UNORDERED_NO_OVERLAPS = 51; + /** + * RegularExpression Id. + */ + int WILDCARD = 52; + /** + * RegularExpression Id. + */ + int WITHIN = 53; + /** + * RegularExpression Id. + */ + int RANGE_TO = 54; + /** + * RegularExpression Id. + */ + int RANGEIN_END = 55; + /** + * RegularExpression Id. + */ + int RANGEEX_END = 56; + /** + * RegularExpression Id. + */ + int RANGE_QUOTED = 57; + /** + * RegularExpression Id. + */ + int RANGE_GOOP = 58; - /** - * Lexical state. - */ - int Zulia = 0; - /** - * Lexical state. - */ - int Function = 1; - /** - * Lexical state. - */ - int Range = 2; - /** - * Lexical state. - */ - int DEFAULT = 3; + /** + * Lexical state. + */ + int Zulia = 0; + /** + * Lexical state. + */ + int Function = 1; + /** + * Lexical state. + */ + int Range = 2; + /** + * Lexical state. + */ + int DEFAULT = 3; - /** - * Literal token values. - */ - String[] tokenImage = { "", "<_NUM_CHAR>", "<_ESCAPED_CHAR>", "<_TERM_START_CHAR>", "<_TERM_CHAR>", "<_WHITESPACE>", "<_QUOTED_CHAR>", - "", "", "", "", "\"fn:\"", "\"zl:\"", "\"+\"", "\"-\"", "\")\"", "\":\"", "\"=\"", "\"<\"", "\"<=\"", "\">\"", - "\">=\"", "\"^\"", "\"~\"", "", "", "", "", "\"[\"", "\"{\"", "\"(\"", "", "", "", - "\"after\"", "\"before\"", "", "\"containing\"", "\"extend\"", "\"or\"", "", "", "", "", - "", "", "", "\"ordered\"", "\"overlapping\"", "\"phrase\"", "\"unordered\"", "", - "\"wildcard\"", "\"within\"", "\"TO\"", "\"]\"", "\"}\"", "", "", "\"@\"", }; + /** + * Literal token values. + */ + String[] tokenImage = { "", "<_NUM_CHAR>", "<_ESCAPED_CHAR>", "<_TERM_START_CHAR>", "<_TERM_CHAR>", "<_WHITESPACE>", "<_QUOTED_CHAR>", + "", "", "", "", "\"fn:\"", "\"zl:\"", "\"+\"", "\"-\"", "\")\"", "\":\"", "\"=\"", "\"<\"", "\"<=\"", "\">\"", + "\">=\"", "\"^\"", "\"~\"", "", "", "", "", "\"[\"", "\"{\"", "\"(\"", "", "", "", + "\"after\"", "\"before\"", "", "\"containing\"", "\"extend\"", "\"or\"", "", "", "", + "", "", "", "", "\"ordered\"", "\"overlapping\"", "\"phrase\"", "\"unordered\"", + "", "\"wildcard\"", "\"within\"", "\"TO\"", "\"]\"", "\"}\"", "", "", "\"@\"", }; } diff --git a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserTokenManager.java b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserTokenManager.java index 582eb881..ac3aa594 100644 --- a/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserTokenManager.java +++ b/zulia-query-parser/src/main/java/io/zulia/server/search/queryparser/parser/ZuliaSyntaxParserTokenManager.java @@ -1,7 +1,8 @@ /* ZuliaSyntaxParserTokenManager.java */ /* Generated By:JavaCC: Do not edit this line. ZuliaSyntaxParserTokenManager.java */ package io.zulia.server.search.queryparser.parser; - import org.apache.lucene.queryparser.charstream.CharStream; + +import org.apache.lucene.queryparser.charstream.CharStream; /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -24,2489 +25,2489 @@ */ public class ZuliaSyntaxParserTokenManager implements ZuliaSyntaxParserConstants { - /** Debug output. */ - // (debugStream omitted). - - /** - * Set debug output. - */ - // (setDebugStream omitted). - private final int jjStopStringLiteralDfa_3(int pos, long active0) { - switch (pos) { - case 0: - if ((active0 & 0x1800L) != 0L) { - jjmatchedKind = 26; - return 32; - } - return -1; - case 1: - if ((active0 & 0x1800L) != 0L) { - jjmatchedKind = 26; - jjmatchedPos = 1; - return 32; - } - return -1; - default: - return -1; - } - } - - private final int jjStartNfa_3(int pos, long active0) { - return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1); - } - - private int jjStopAtPos(int pos, int kind) { - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; - } - - private int jjMoveStringLiteralDfa0_3() { - switch (curChar) { - case 40: - return jjStopAtPos(0, 30); - case 41: - return jjStopAtPos(0, 15); - case 43: - return jjStopAtPos(0, 13); - case 45: - return jjStopAtPos(0, 14); - case 58: - return jjStopAtPos(0, 16); - case 60: - jjmatchedKind = 18; - return jjMoveStringLiteralDfa1_3(0x80000L); - case 61: - return jjStopAtPos(0, 17); - case 62: - jjmatchedKind = 20; - return jjMoveStringLiteralDfa1_3(0x200000L); - case 64: - return jjStopAtPos(0, 59); - case 91: - return jjStopAtPos(0, 28); - case 94: - return jjStopAtPos(0, 22); - case 102: - return jjMoveStringLiteralDfa1_3(0x800L); - case 122: - return jjMoveStringLiteralDfa1_3(0x1000L); - case 123: - return jjStopAtPos(0, 29); - case 126: - return jjStopAtPos(0, 23); - default: - return jjMoveNfa_3(0, 0); - } - } - - private int jjMoveStringLiteralDfa1_3(long active0) { - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_3(0, active0); - return 1; - } - switch (curChar) { - case 61: - if ((active0 & 0x80000L) != 0L) - return jjStopAtPos(1, 19); - else if ((active0 & 0x200000L) != 0L) - return jjStopAtPos(1, 21); - break; - case 108: - return jjMoveStringLiteralDfa2_3(active0, 0x1000L); - case 110: - return jjMoveStringLiteralDfa2_3(active0, 0x800L); - default: - break; - } - return jjStartNfa_3(0, active0); - } - - private int jjMoveStringLiteralDfa2_3(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_3(0, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_3(1, active0); - return 2; - } - switch (curChar) { - case 58: - if ((active0 & 0x800L) != 0L) - return jjStopAtPos(2, 11); - else if ((active0 & 0x1000L) != 0L) - return jjStopAtPos(2, 12); - break; - default: - break; - } - return jjStartNfa_3(1, active0); - } - - static final long[] jjbitVec0 = { 0x1L, 0x0L, 0x0L, 0x0L }; - static final long[] jjbitVec1 = { 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; - static final long[] jjbitVec3 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; - static final long[] jjbitVec4 = { 0xfffefffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; - - private int jjMoveNfa_3(int startState, int curPos) { - int startsAt = 0; - jjnewStateCnt = 32; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (; ; ) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - do { - switch (jjstateSet[--i]) { - case 32: - case 23: - if ((0x8bff7cf8ffffd9ffL & l) == 0L) - break; - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 0: - if ((0x8bff54f8ffffd9ffL & l) != 0L) { - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - } - else if ((0x100002600L & l) != 0L) { - if (kind > 7) - kind = 7; - } - else if (curChar == 47) { - jjCheckNAddStates(0, 2); - } - else if (curChar == 34) { - jjCheckNAddStates(3, 5); - } - else if (curChar == 33) { - if (kind > 10) - kind = 10; - } - if ((0x3ff000000000000L & l) != 0L) { - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(19, 20); - } - } - else if (curChar == 38) - jjstateSet[jjnewStateCnt++] = 4; - break; - case 4: - if (curChar == 38 && kind > 8) - kind = 8; - break; - case 5: - if (curChar == 38) - jjstateSet[jjnewStateCnt++] = 4; - break; - case 13: - if (curChar == 33 && kind > 10) - kind = 10; - break; - case 14: - if (curChar == 34) { - jjCheckNAddStates(3, 5); - } - break; - case 15: - if ((0xfffffffbffffffffL & l) != 0L) { - jjCheckNAddStates(3, 5); - } - break; - case 17: { - jjCheckNAddStates(3, 5); - } - break; - case 18: - if (curChar == 34 && kind > 24) - kind = 24; - break; - case 19: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 25) - kind = 25; - { - jjCheckNAddTwoStates(19, 20); - } - break; - case 20: - if (curChar == 46) { - jjCheckNAdd(21); - } - break; - case 21: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 25) - kind = 25; - { - jjCheckNAdd(21); - } - break; - case 22: - if ((0x8bff54f8ffffd9ffL & l) == 0L) - break; - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 25: - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 27: - case 29: - if (curChar == 47) { - jjCheckNAddStates(0, 2); - } - break; - case 28: - if ((0xffff7fffffffffffL & l) != 0L) { - jjCheckNAddStates(0, 2); - } - break; - case 31: - if (curChar == 47 && kind > 27) - kind = 27; - break; - default: - break; - } - } - while (i != startsAt); - } - else if (curChar < 128) { - long l = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 32: - if ((0x97ffffff87fffffeL & l) != 0L) { - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - } - else if (curChar == 92) { - jjCheckNAddTwoStates(25, 25); - } - break; - case 0: - if ((0x97ffffff87fffffeL & l) != 0L) { - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - } - else if (curChar == 92) { - jjCheckNAdd(25); - } - if (curChar == 78) - jjstateSet[jjnewStateCnt++] = 11; - else if (curChar == 124) - jjstateSet[jjnewStateCnt++] = 8; - else if (curChar == 79) - jjstateSet[jjnewStateCnt++] = 6; - else if (curChar == 65) - jjstateSet[jjnewStateCnt++] = 2; - break; - case 1: - if (curChar == 68 && kind > 8) - kind = 8; - break; - case 2: - if (curChar == 78) - jjstateSet[jjnewStateCnt++] = 1; - break; - case 3: - if (curChar == 65) - jjstateSet[jjnewStateCnt++] = 2; - break; - case 6: - if (curChar == 82 && kind > 9) - kind = 9; - break; - case 7: - if (curChar == 79) - jjstateSet[jjnewStateCnt++] = 6; - break; - case 8: - if (curChar == 124 && kind > 9) - kind = 9; - break; - case 9: - if (curChar == 124) - jjstateSet[jjnewStateCnt++] = 8; - break; - case 10: - if (curChar == 84 && kind > 10) - kind = 10; - break; - case 11: - if (curChar == 79) - jjstateSet[jjnewStateCnt++] = 10; - break; - case 12: - if (curChar == 78) - jjstateSet[jjnewStateCnt++] = 11; - break; - case 15: - if ((0xffffffffefffffffL & l) != 0L) { - jjCheckNAddStates(3, 5); - } - break; - case 16: - if (curChar == 92) - jjstateSet[jjnewStateCnt++] = 17; - break; - case 17: { - jjCheckNAddStates(3, 5); - } - break; - case 22: - if ((0x97ffffff87fffffeL & l) == 0L) - break; - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 23: - if ((0x97ffffff87fffffeL & l) == 0L) - break; - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 24: - if (curChar == 92) { - jjCheckNAddTwoStates(25, 25); - } - break; - case 25: - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 26: - if (curChar == 92) { - jjCheckNAdd(25); - } - break; - case 28: { - jjAddStates(0, 2); - } - break; - case 30: - if (curChar == 92) - jjstateSet[jjnewStateCnt++] = 29; - break; - default: - break; - } - } - while (i != startsAt); - } - else { - int hiByte = (curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 32: - case 23: - if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) - break; - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 0: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { - if (kind > 7) - kind = 7; - } - if (jjCanMove_2(hiByte, i1, i2, l1, l2)) { - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - } - break; - case 15: - case 17: - if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { - jjCheckNAddStates(3, 5); - } - break; - case 22: - if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) - break; - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 25: - if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) - break; - if (kind > 26) - kind = 26; - { - jjCheckNAddTwoStates(23, 24); - } - break; - case 28: - if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { - jjAddStates(0, 2); - } - break; - default: - if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) - break; - else - break; - } - } - while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 32 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private final int jjStopStringLiteralDfa_1(int pos, long active0) { - switch (pos) { - case 0: - if ((active0 & 0x4000000000000L) != 0L) - return 19; - if ((active0 & 0x400000000L) != 0L) - return 79; - if ((active0 & 0x2000000000L) != 0L) - return 63; - return -1; - case 1: - if ((active0 & 0x2000000000L) != 0L) - return 62; - if ((active0 & 0x4000000000000L) != 0L) - return 18; - return -1; - case 2: - if ((active0 & 0x4000000000000L) != 0L) - return 17; - if ((active0 & 0x2000000000L) != 0L) - return 61; - return -1; - case 3: - if ((active0 & 0x2000000000L) != 0L) - return 60; - if ((active0 & 0x4000000000000L) != 0L) - return 16; - return -1; - case 4: - if ((active0 & 0x4000000000000L) != 0L) - return 15; - if ((active0 & 0x2000000000L) != 0L) - return 59; - return -1; - case 5: - if ((active0 & 0x2000000000L) != 0L) - return 58; - if ((active0 & 0x4000000000000L) != 0L) - return 14; - return -1; - case 6: - if ((active0 & 0x4000000000000L) != 0L) - return 13; - if ((active0 & 0x2000000000L) != 0L) - return 57; - return -1; - case 7: - if ((active0 & 0x4000000000000L) != 0L) - return 12; - return -1; - case 8: - if ((active0 & 0x4000000000000L) != 0L) - return 11; - return -1; - default: - return -1; - } - } - - private final int jjStartNfa_1(int pos, long active0) { - return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); - } - - private int jjMoveStringLiteralDfa0_1() { - switch (curChar) { - case 40: - return jjStopAtPos(0, 30); - case 97: - return jjMoveStringLiteralDfa1_1(0x400000000L); - case 98: - return jjMoveStringLiteralDfa1_1(0x800000000L); - case 99: - return jjMoveStringLiteralDfa1_1(0x2000000000L); - case 101: - return jjMoveStringLiteralDfa1_1(0x4000000000L); - case 111: - return jjMoveStringLiteralDfa1_1(0x1808000000000L); - case 112: - return jjMoveStringLiteralDfa1_1(0x2000000000000L); - case 117: - return jjMoveStringLiteralDfa1_1(0x4000000000000L); - case 119: - return jjMoveStringLiteralDfa1_1(0x30000000000000L); - default: - return jjMoveNfa_1(0, 0); - } - } - - private int jjMoveStringLiteralDfa1_1(long active0) { - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_1(0, active0); - return 1; - } - switch (curChar) { - case 101: - return jjMoveStringLiteralDfa2_1(active0, 0x800000000L); - case 102: - return jjMoveStringLiteralDfa2_1(active0, 0x400000000L); - case 104: - return jjMoveStringLiteralDfa2_1(active0, 0x2000000000000L); - case 105: - return jjMoveStringLiteralDfa2_1(active0, 0x30000000000000L); - case 110: - return jjMoveStringLiteralDfa2_1(active0, 0x4000000000000L); - case 111: - return jjMoveStringLiteralDfa2_1(active0, 0x2000000000L); - case 114: - if ((active0 & 0x8000000000L) != 0L) { - jjmatchedKind = 39; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_1(active0, 0x800000000000L); - case 118: - return jjMoveStringLiteralDfa2_1(active0, 0x1000000000000L); - case 120: - return jjMoveStringLiteralDfa2_1(active0, 0x4000000000L); - default: - break; - } - return jjStartNfa_1(0, active0); - } - - private int jjMoveStringLiteralDfa2_1(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(0, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_1(1, active0); - return 2; - } - switch (curChar) { - case 100: - return jjMoveStringLiteralDfa3_1(active0, 0x800000000000L); - case 101: - return jjMoveStringLiteralDfa3_1(active0, 0x1000000000000L); - case 102: - return jjMoveStringLiteralDfa3_1(active0, 0x800000000L); - case 108: - return jjMoveStringLiteralDfa3_1(active0, 0x10000000000000L); - case 110: - return jjMoveStringLiteralDfa3_1(active0, 0x2000000000L); - case 111: - return jjMoveStringLiteralDfa3_1(active0, 0x4000000000000L); - case 114: - return jjMoveStringLiteralDfa3_1(active0, 0x2000000000000L); - case 116: - return jjMoveStringLiteralDfa3_1(active0, 0x20004400000000L); - default: - break; - } - return jjStartNfa_1(1, active0); - } - - private int jjMoveStringLiteralDfa3_1(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(1, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_1(2, active0); - return 3; - } - switch (curChar) { - case 97: - return jjMoveStringLiteralDfa4_1(active0, 0x2000000000000L); - case 100: - return jjMoveStringLiteralDfa4_1(active0, 0x10000000000000L); - case 101: - return jjMoveStringLiteralDfa4_1(active0, 0x804400000000L); - case 104: - return jjMoveStringLiteralDfa4_1(active0, 0x20000000000000L); - case 111: - return jjMoveStringLiteralDfa4_1(active0, 0x800000000L); - case 114: - return jjMoveStringLiteralDfa4_1(active0, 0x5000000000000L); - case 116: - return jjMoveStringLiteralDfa4_1(active0, 0x2000000000L); - default: - break; - } - return jjStartNfa_1(2, active0); - } - - private int jjMoveStringLiteralDfa4_1(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(2, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_1(3, active0); - return 4; - } - switch (curChar) { - case 97: - return jjMoveStringLiteralDfa5_1(active0, 0x2000000000L); - case 99: - return jjMoveStringLiteralDfa5_1(active0, 0x10000000000000L); - case 100: - return jjMoveStringLiteralDfa5_1(active0, 0x4000000000000L); - case 105: - return jjMoveStringLiteralDfa5_1(active0, 0x20000000000000L); - case 108: - return jjMoveStringLiteralDfa5_1(active0, 0x1000000000000L); - case 110: - return jjMoveStringLiteralDfa5_1(active0, 0x4000000000L); - case 114: - if ((active0 & 0x400000000L) != 0L) - return jjStopAtPos(4, 34); - return jjMoveStringLiteralDfa5_1(active0, 0x800800000000L); - case 115: - return jjMoveStringLiteralDfa5_1(active0, 0x2000000000000L); - default: - break; - } - return jjStartNfa_1(3, active0); - } - - private int jjMoveStringLiteralDfa5_1(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(3, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_1(4, active0); - return 5; - } - switch (curChar) { - case 97: - return jjMoveStringLiteralDfa6_1(active0, 0x11000000000000L); - case 100: - if ((active0 & 0x4000000000L) != 0L) - return jjStopAtPos(5, 38); - break; - case 101: - if ((active0 & 0x800000000L) != 0L) - return jjStopAtPos(5, 35); - else if ((active0 & 0x2000000000000L) != 0L) - return jjStopAtPos(5, 49); - return jjMoveStringLiteralDfa6_1(active0, 0x4800000000000L); - case 105: - return jjMoveStringLiteralDfa6_1(active0, 0x2000000000L); - case 110: - if ((active0 & 0x20000000000000L) != 0L) - return jjStopAtPos(5, 53); - break; - default: - break; - } - return jjStartNfa_1(4, active0); - } - - private int jjMoveStringLiteralDfa6_1(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(4, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_1(5, active0); - return 6; - } - switch (curChar) { - case 100: - if ((active0 & 0x800000000000L) != 0L) - return jjStopAtPos(6, 47); - break; - case 110: - return jjMoveStringLiteralDfa7_1(active0, 0x2000000000L); - case 112: - return jjMoveStringLiteralDfa7_1(active0, 0x1000000000000L); - case 114: - return jjMoveStringLiteralDfa7_1(active0, 0x14000000000000L); - default: - break; - } - return jjStartNfa_1(5, active0); - } - - private int jjMoveStringLiteralDfa7_1(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(5, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_1(6, active0); - return 7; - } - switch (curChar) { - case 100: - if ((active0 & 0x10000000000000L) != 0L) - return jjStopAtPos(7, 52); - break; - case 101: - return jjMoveStringLiteralDfa8_1(active0, 0x4000000000000L); - case 105: - return jjMoveStringLiteralDfa8_1(active0, 0x2000000000L); - case 112: - return jjMoveStringLiteralDfa8_1(active0, 0x1000000000000L); - default: - break; - } - return jjStartNfa_1(6, active0); - } - - private int jjMoveStringLiteralDfa8_1(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(6, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_1(7, active0); - return 8; - } - switch (curChar) { - case 100: - if ((active0 & 0x4000000000000L) != 0L) - return jjStartNfaWithStates_1(8, 50, 11); - break; - case 105: - return jjMoveStringLiteralDfa9_1(active0, 0x1000000000000L); - case 110: - return jjMoveStringLiteralDfa9_1(active0, 0x2000000000L); - default: - break; - } - return jjStartNfa_1(7, active0); - } - - private int jjMoveStringLiteralDfa9_1(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(7, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_1(8, active0); - return 9; - } - switch (curChar) { - case 103: - if ((active0 & 0x2000000000L) != 0L) - return jjStopAtPos(9, 37); - break; - case 110: - return jjMoveStringLiteralDfa10_1(active0, 0x1000000000000L); - default: - break; - } - return jjStartNfa_1(8, active0); - } - - private int jjMoveStringLiteralDfa10_1(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_1(8, old0); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_1(9, active0); - return 10; - } - switch (curChar) { - case 103: - if ((active0 & 0x1000000000000L) != 0L) - return jjStopAtPos(10, 48); - break; - default: - break; - } - return jjStartNfa_1(9, active0); - } - - private int jjStartNfaWithStates_1(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_1(state, pos + 1); - } - - private int jjMoveNfa_1(int startState, int curPos) { - int startsAt = 0; - jjnewStateCnt = 199; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (; ; ) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - do { - switch (jjstateSet[--i]) { - case 0: - if ((0x100002600L & l) != 0L) - kind = 7; - break; - default: - break; - } - } - while (i != startsAt); - } - else if (curChar < 128) { - long l = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 18: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 34; - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 17; - break; - case 13: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 29; - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 12; - break; - case 60: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 68; - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 59; - break; - case 19: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 35; - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 18; - break; - case 57: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 65; - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 56; - break; - case 58: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 66; - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 57; - break; - case 59: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 67; - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 58; - break; - case 61: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 69; - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 60; - break; - case 14: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 30; - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 13; - break; - case 62: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 70; - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 61; - break; - case 15: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 31; - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 14; - break; - case 63: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 71; - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 62; - break; - case 16: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 32; - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 15; - break; - case 0: - if (curChar == 109) { - jjAddStates(6, 9); - } - else if (curChar == 110) { - jjAddStates(10, 17); - } - else if (curChar == 97) { - jjAddStates(18, 19); - } - else if (curChar == 99) { - jjAddStates(20, 21); - } - else if (curChar == 102) { - jjAddStates(22, 23); - } - else if (curChar == 117) { - jjAddStates(24, 25); - } - break; - case 11: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 27; - else if (curChar == 78) - jjstateSet[jjnewStateCnt++] = 10; - break; - case 17: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 33; - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 16; - break; - case 79: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 83; - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 78; - break; - case 12: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 28; - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 11; - break; - case 1: - if (curChar == 117) { - jjAddStates(24, 25); - } - break; - case 2: - if (curChar == 115 && kind > 51) - kind = 51; - break; - case 3: - case 20: - if (curChar == 112) { - jjCheckNAdd(2); - } - break; - case 4: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 3; - break; - case 5: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 4; - break; - case 6: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 5; - break; - case 7: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 6; - break; - case 8: - if (curChar == 118) - jjstateSet[jjnewStateCnt++] = 7; - break; - case 9: - if (curChar == 79) - jjstateSet[jjnewStateCnt++] = 8; - break; - case 10: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 21: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 20; - break; - case 22: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 21; - break; - case 23: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 22; - break; - case 24: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 23; - break; - case 25: - if (curChar == 118) - jjstateSet[jjnewStateCnt++] = 24; - break; - case 26: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 25; - break; - case 27: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 26; - break; - case 28: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 27; - break; - case 29: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 28; - break; - case 30: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 29; - break; - case 31: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 30; - break; - case 32: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 31; - break; - case 33: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 32; - break; - case 34: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 33; - break; - case 35: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 34; - break; - case 36: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 35; - break; - case 37: - if (curChar == 102) { - jjAddStates(22, 23); - } - break; - case 38: - if (curChar == 109 && kind > 40) - kind = 40; - break; - case 39: - case 46: - if (curChar == 114) { - jjCheckNAdd(38); - } - break; - case 40: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 39; - break; - case 41: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 40; - break; - case 42: - if (curChar == 121) - jjstateSet[jjnewStateCnt++] = 41; - break; - case 43: - if (curChar == 122) - jjstateSet[jjnewStateCnt++] = 42; - break; - case 44: - if (curChar == 122) - jjstateSet[jjnewStateCnt++] = 43; - break; - case 45: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 44; - break; - case 47: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 46; - break; - case 48: - if (curChar == 84) - jjstateSet[jjnewStateCnt++] = 47; - break; - case 49: - if (curChar == 121) - jjstateSet[jjnewStateCnt++] = 48; - break; - case 50: - if (curChar == 122) - jjstateSet[jjnewStateCnt++] = 49; - break; - case 51: - if (curChar == 122) - jjstateSet[jjnewStateCnt++] = 50; - break; - case 52: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 51; - break; - case 53: - if (curChar == 99) { - jjAddStates(20, 21); - } - break; - case 54: - if (curChar == 121 && kind > 36) - kind = 36; - break; - case 55: - if (curChar == 66) { - jjCheckNAdd(54); - } - break; - case 56: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 55; - break; - case 64: - if (curChar == 98) { - jjCheckNAdd(54); - } - break; - case 65: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 64; - break; - case 66: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 65; - break; - case 67: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 66; - break; - case 68: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 67; - break; - case 69: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 68; - break; - case 70: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 69; - break; - case 71: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 70; - break; - case 72: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 71; - break; - case 73: - if (curChar == 97) { - jjAddStates(18, 19); - } - break; - case 74: - if (curChar == 116 && kind > 33) - kind = 33; - break; - case 75: - case 80: - if (curChar == 115) { - jjCheckNAdd(74); - } - break; - case 76: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 75; - break; - case 77: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 76; - break; - case 78: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 77; - break; - case 81: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 80; - break; - case 82: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 81; - break; - case 83: - if (curChar == 76) - jjstateSet[jjnewStateCnt++] = 82; - break; - case 84: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 83; - break; - case 85: - if (curChar == 110) { - jjAddStates(10, 17); - } - break; - case 86: - if (curChar == 103 && kind > 43) - kind = 43; - break; - case 87: - case 99: - if (curChar == 110) { - jjCheckNAdd(86); - } - break; - case 88: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 87; - break; - case 89: - if (curChar == 112) - jjstateSet[jjnewStateCnt++] = 88; - break; - case 90: - if (curChar == 112) - jjstateSet[jjnewStateCnt++] = 89; - break; - case 91: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 90; - break; - case 92: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 91; - break; - case 93: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 92; - break; - case 94: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 93; - break; - case 95: - if (curChar == 118) - jjstateSet[jjnewStateCnt++] = 94; - break; - case 96: - if (curChar == 79) - jjstateSet[jjnewStateCnt++] = 95; - break; - case 97: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 96; - break; - case 98: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 97; - break; - case 100: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 99; - break; - case 101: - if (curChar == 112) - jjstateSet[jjnewStateCnt++] = 100; - break; - case 102: - if (curChar == 112) - jjstateSet[jjnewStateCnt++] = 101; - break; - case 103: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 102; - break; - case 104: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 103; - break; - case 105: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 104; - break; - case 106: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 105; - break; - case 107: - if (curChar == 118) - jjstateSet[jjnewStateCnt++] = 106; - break; - case 108: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 107; - break; - case 109: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 108; - break; - case 110: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 109; - break; - case 111: - if (curChar == 121 && kind > 44) - kind = 44; - break; - case 112: - if (curChar == 66) { - jjCheckNAdd(111); - } - break; - case 113: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 112; - break; - case 114: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 113; - break; - case 115: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 114; - break; - case 116: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 115; - break; - case 117: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 116; - break; - case 118: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 117; - break; - case 119: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 118; - break; - case 120: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 119; - break; - case 121: - if (curChar == 67) - jjstateSet[jjnewStateCnt++] = 120; - break; - case 122: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 121; - break; - case 123: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 122; - break; - case 124: - if (curChar == 98) { - jjCheckNAdd(111); - } - break; - case 125: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 124; - break; - case 126: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 125; - break; - case 127: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 126; - break; - case 128: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 127; - break; - case 129: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 128; - break; - case 130: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 129; - break; - case 131: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 130; - break; - case 132: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 131; - break; - case 133: - if (curChar == 99) - jjstateSet[jjnewStateCnt++] = 132; - break; - case 134: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 133; - break; - case 135: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 134; - break; - case 136: - if (curChar == 103 && kind > 45) - kind = 45; - break; - case 137: - case 148: - if (curChar == 110) { - jjCheckNAdd(136); - } - break; - case 138: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 137; - break; - case 139: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 138; - break; - case 140: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 139; - break; - case 141: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 140; - break; - case 142: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 141; - break; - case 143: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 142; - break; - case 144: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 143; - break; - case 145: - if (curChar == 67) - jjstateSet[jjnewStateCnt++] = 144; - break; - case 146: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 145; - break; - case 147: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 146; - break; - case 149: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 148; - break; - case 150: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 149; - break; - case 151: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 150; - break; - case 152: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 151; - break; - case 153: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 152; - break; - case 154: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 153; - break; - case 155: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 154; - break; - case 156: - if (curChar == 99) - jjstateSet[jjnewStateCnt++] = 155; - break; - case 157: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 156; - break; - case 158: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 157; - break; - case 159: - if (curChar == 110 && kind > 46) - kind = 46; - break; - case 160: - case 167: - if (curChar == 105) { - jjCheckNAdd(159); - } - break; - case 161: - if (curChar == 104) - jjstateSet[jjnewStateCnt++] = 160; - break; - case 162: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 161; - break; - case 163: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 162; - break; - case 164: - if (curChar == 87) - jjstateSet[jjnewStateCnt++] = 163; - break; - case 165: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 164; - break; - case 166: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 165; - break; - case 168: - if (curChar == 104) - jjstateSet[jjnewStateCnt++] = 167; - break; - case 169: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 168; - break; - case 170: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 169; - break; - case 171: - if (curChar == 119) - jjstateSet[jjnewStateCnt++] = 170; - break; - case 172: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 171; - break; - case 173: - if (curChar == 111) - jjstateSet[jjnewStateCnt++] = 172; - break; - case 174: - if (curChar == 109) { - jjAddStates(6, 9); - } - break; - case 175: - if (curChar == 115 && kind > 41) - kind = 41; - break; - case 176: - case 181: - if (curChar == 112) { - jjCheckNAdd(175); - } - break; - case 177: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 176; - break; - case 178: - if (curChar == 103) - jjstateSet[jjnewStateCnt++] = 177; - break; - case 179: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 178; - break; - case 180: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 179; - break; - case 182: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 181; - break; - case 183: - if (curChar == 71) - jjstateSet[jjnewStateCnt++] = 182; - break; - case 184: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 183; - break; - case 185: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 184; - break; - case 186: - if (curChar == 104 && kind > 42) - kind = 42; - break; - case 187: - case 193: - if (curChar == 116) { - jjCheckNAdd(186); - } - break; - case 188: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 187; - break; - case 189: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 188; - break; - case 190: - if (curChar == 119) - jjstateSet[jjnewStateCnt++] = 189; - break; - case 191: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 190; - break; - case 192: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 191; - break; - case 194: - if (curChar == 100) - jjstateSet[jjnewStateCnt++] = 193; - break; - case 195: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 194; - break; - case 196: - if (curChar == 87) - jjstateSet[jjnewStateCnt++] = 195; - break; - case 197: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 196; - break; - case 198: - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 197; - break; - default: - break; - } - } - while (i != startsAt); - } - else { - int hiByte = (curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 0: - if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 7) - kind = 7; - break; - default: - if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) - break; - else - break; - } - } - while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 199 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private final int jjStopStringLiteralDfa_0(int pos, long active0) { - switch (pos) { - default: - return -1; - } - } - - private final int jjStartNfa_0(int pos, long active0) { - return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); - } - - private int jjMoveStringLiteralDfa0_0() { - switch (curChar) { - case 40: - return jjStopAtPos(0, 30); - default: - return jjMoveNfa_0(0, 0); - } - } - - private int jjMoveNfa_0(int startState, int curPos) { - int startsAt = 0; - jjnewStateCnt = 22; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (; ; ) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - do { - switch (jjstateSet[--i]) { - case 0: - if ((0x100002600L & l) != 0L) - kind = 7; - break; - default: - break; - } - } - while (i != startsAt); - } - else if (curChar < 128) { - long l = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 0: - if (curChar == 110) { - jjAddStates(26, 27); - } - else if (curChar == 116) { - jjAddStates(28, 29); - } - break; - case 1: - if (curChar == 116) { - jjAddStates(28, 29); - } - break; - case 2: - if (curChar == 113) - kind = 32; - break; - case 3: - if (curChar == 121) - kind = 32; - break; - case 4: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 3; - break; - case 5: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 4; - break; - case 6: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 5; - break; - case 7: - if (curChar == 81) - jjstateSet[jjnewStateCnt++] = 6; - break; - case 8: - if (curChar == 109) - jjstateSet[jjnewStateCnt++] = 7; - break; - case 9: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 8; - break; - case 10: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 11: - if (curChar == 110) { - jjAddStates(26, 27); - } - break; - case 12: - if (curChar == 115) - kind = 31; - break; - case 13: - if (curChar == 116 && kind > 31) - kind = 31; - break; - case 14: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 13; - break; - case 15: - if (curChar == 83) - jjstateSet[jjnewStateCnt++] = 14; - break; - case 16: - if (curChar == 99) - jjstateSet[jjnewStateCnt++] = 15; - break; - case 17: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 16; - break; - case 18: - if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 17; - break; - case 19: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 18; - break; - case 20: - if (curChar == 109) - jjstateSet[jjnewStateCnt++] = 19; - break; - case 21: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 20; - break; - default: - break; - } - } - while (i != startsAt); - } - else { - int hiByte = (curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 0: - if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 7) - kind = 7; - break; - default: - if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) - break; - else - break; - } - } - while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 22 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private final int jjStopStringLiteralDfa_2(int pos, long active0) { - switch (pos) { - case 0: - if ((active0 & 0x40000000000000L) != 0L) { - jjmatchedKind = 58; - return 6; - } - return -1; - default: - return -1; - } - } - - private final int jjStartNfa_2(int pos, long active0) { - return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1); - } - - private int jjMoveStringLiteralDfa0_2() { - switch (curChar) { - case 84: - return jjMoveStringLiteralDfa1_2(0x40000000000000L); - case 93: - return jjStopAtPos(0, 55); - case 125: - return jjStopAtPos(0, 56); - default: - return jjMoveNfa_2(0, 0); - } - } - - private int jjMoveStringLiteralDfa1_2(long active0) { - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_2(0, active0); - return 1; - } - switch (curChar) { - case 79: - if ((active0 & 0x40000000000000L) != 0L) - return jjStartNfaWithStates_2(1, 54, 6); - break; - default: - break; - } - return jjStartNfa_2(0, active0); - } - - private int jjStartNfaWithStates_2(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_2(state, pos + 1); - } - - private int jjMoveNfa_2(int startState, int curPos) { - int startsAt = 0; - jjnewStateCnt = 7; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (; ; ) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - do { - switch (jjstateSet[--i]) { - case 0: - if ((0xfffffffeffffffffL & l) != 0L) { - if (kind > 58) - kind = 58; - { - jjCheckNAdd(6); - } - } - if ((0x100002600L & l) != 0L) { - if (kind > 7) - kind = 7; - } - else if (curChar == 34) { - jjCheckNAddTwoStates(2, 4); - } - break; - case 1: - if (curChar == 34) { - jjCheckNAddTwoStates(2, 4); - } - break; - case 2: - if ((0xfffffffbffffffffL & l) != 0L) { - jjCheckNAddStates(30, 32); - } - break; - case 3: - if (curChar == 34) { - jjCheckNAddStates(30, 32); - } - break; - case 5: - if (curChar == 34 && kind > 57) - kind = 57; - break; - case 6: - if ((0xfffffffeffffffffL & l) == 0L) - break; - if (kind > 58) - kind = 58; - { - jjCheckNAdd(6); - } - break; - default: - break; - } - } - while (i != startsAt); - } - else if (curChar < 128) { - long l = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 0: - case 6: - if ((0xdfffffffdfffffffL & l) == 0L) - break; - if (kind > 58) - kind = 58; - { - jjCheckNAdd(6); - } - break; - case 2: { - jjAddStates(30, 32); - } - break; - case 4: - if (curChar == 92) - jjstateSet[jjnewStateCnt++] = 3; - break; - default: - break; - } - } - while (i != startsAt); - } - else { - int hiByte = (curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do { - switch (jjstateSet[--i]) { - case 0: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { - if (kind > 7) - kind = 7; - } - if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { - if (kind > 58) - kind = 58; - { - jjCheckNAdd(6); - } - } - break; - case 2: - if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { - jjAddStates(30, 32); - } - break; - case 6: - if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) - break; - if (kind > 58) - kind = 58; - { - jjCheckNAdd(6); - } - break; - default: - if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) - break; - else - break; - } - } - while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - /** - * Token literal values. - */ - public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, null, null, null, "\146\156\72", "\172\154\72", "\53", - "\55", "\51", "\72", "\75", "\74", "\74\75", "\76", "\76\75", "\136", "\176", null, null, null, null, "\133", "\173", "\50", null, null, null, - "\141\146\164\145\162", "\142\145\146\157\162\145", null, "\143\157\156\164\141\151\156\151\156\147", "\145\170\164\145\156\144", "\157\162", null, - null, null, null, null, null, null, "\157\162\144\145\162\145\144", "\157\166\145\162\154\141\160\160\151\156\147", "\160\150\162\141\163\145", - "\165\156\157\162\144\145\162\145\144", null, "\167\151\154\144\143\141\162\144", "\167\151\164\150\151\156", "\124\117", "\135", "\175", null, null, - "\100", }; - - protected Token jjFillToken() { - final Token t; - final String curTokenImage; - final int beginLine; - final int endLine; - final int beginColumn; - final int endColumn; - String im = jjstrLiteralImages[jjmatchedKind]; - curTokenImage = (im == null) ? input_stream.GetImage() : im; - beginLine = input_stream.getBeginLine(); - beginColumn = input_stream.getBeginColumn(); - endLine = input_stream.getEndLine(); - endColumn = input_stream.getEndColumn(); - t = Token.newToken(jjmatchedKind); - t.kind = jjmatchedKind; - t.image = curTokenImage; - - t.beginLine = beginLine; - t.endLine = endLine; - t.beginColumn = beginColumn; - t.endColumn = endColumn; - - return t; - } - - static final int[] jjnextStates = { 28, 30, 31, 15, 16, 18, 180, 185, 192, 198, 98, 110, 123, 135, 147, 158, 166, 173, 79, 84, 63, 72, 45, 52, 19, 36, 12, - 21, 2, 10, 2, 4, 5, }; - - private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 48: - return ((jjbitVec0[i2] & l2) != 0L); - default: - return false; - } - } - - private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 0: - return ((jjbitVec3[i2] & l2) != 0L); - default: - if ((jjbitVec1[i1] & l1) != 0L) - return true; - return false; - } - } - - private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 0: - return ((jjbitVec3[i2] & l2) != 0L); - case 48: - return ((jjbitVec1[i2] & l2) != 0L); - default: - if ((jjbitVec4[i1] & l1) != 0L) - return true; - return false; - } - } - - int curLexState = 3; - int defaultLexState = 3; - int jjnewStateCnt; - int jjround; - int jjmatchedPos; - int jjmatchedKind; - - /** - * Get the next Token. - */ - public Token getNextToken() { - Token matchedToken; - int curPos = 0; - - EOFLoop: - for (; ; ) { - try { - curChar = input_stream.BeginToken(); - } - catch (Exception e) { - jjmatchedKind = 0; - jjmatchedPos = -1; - matchedToken = jjFillToken(); - return matchedToken; - } - - switch (curLexState) { - case 0: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - break; - case 1: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_1(); - break; - case 2: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_2(); - break; - case 3: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_3(); - break; - } - if (jjmatchedKind != 0x7fffffff) { - if (jjmatchedPos + 1 < curPos) - input_stream.backup(curPos - jjmatchedPos - 1); - if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { - matchedToken = jjFillToken(); - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - return matchedToken; - } - else { - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - continue EOFLoop; - } - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { - input_stream.readChar(); - input_stream.backup(1); - } - catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } - else - error_column++; - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } - } - - void SkipLexicalActions(Token matchedToken) { - switch (jjmatchedKind) { - default: - break; - } - } - - void MoreLexicalActions() { - jjimageLen += (lengthOfMatch = jjmatchedPos + 1); - switch (jjmatchedKind) { - default: - break; - } - } - - void TokenLexicalActions(Token matchedToken) { - switch (jjmatchedKind) { - default: - break; - } - } - - private void jjCheckNAdd(int state) { - if (jjrounds[state] != jjround) { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } - } - - private void jjAddStates(int start, int end) { - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } - while (start++ != end); - } - - private void jjCheckNAddTwoStates(int state1, int state2) { - jjCheckNAdd(state1); - jjCheckNAdd(state2); - } - - private void jjCheckNAddStates(int start, int end) { - do { - jjCheckNAdd(jjnextStates[start]); - } - while (start++ != end); - } - - /** - * Constructor. - */ - public ZuliaSyntaxParserTokenManager(CharStream stream) { - - input_stream = stream; - } - - /** - * Constructor. - */ - public ZuliaSyntaxParserTokenManager(CharStream stream, int lexState) { - ReInit(stream); - SwitchTo(lexState); - } - - /** - * Reinitialise parser. - */ - - public void ReInit(CharStream stream) { - - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); - } - - private void ReInitRounds() { - int i; - jjround = 0x80000001; - for (i = 199; i-- > 0; ) - jjrounds[i] = 0x80000000; - } - - /** - * Reinitialise parser. - */ - public void ReInit(CharStream stream, int lexState) { - ReInit(stream); - SwitchTo(lexState); - } - - /** - * Switch to specified lex state. - */ - public void SwitchTo(int lexState) { - if (lexState >= 4 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; - } - - /** - * Lexer state names. - */ - public static final String[] lexStateNames = { "Zulia", "Function", "Range", "DEFAULT", }; - - /** - * Lex State array. - */ - public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, - 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 3, -1, -1, -1, }; - static final long[] jjtoToken = { 0xfffffffffffff01L, }; - static final long[] jjtoSkip = { 0x80L, }; - static final long[] jjtoSpecial = { 0x0L, }; - static final long[] jjtoMore = { 0x0L, }; - protected CharStream input_stream; - - private final int[] jjrounds = new int[199]; - private final int[] jjstateSet = new int[2 * 199]; - private final StringBuilder jjimage = new StringBuilder(); - private StringBuilder image = jjimage; - private int jjimageLen; - private int lengthOfMatch; - protected int curChar; + /** Debug output. */ + // (debugStream omitted). + + /** + * Set debug output. + */ + // (setDebugStream omitted). + private final int jjStopStringLiteralDfa_3(int pos, long active0) { + switch (pos) { + case 0: + if ((active0 & 0x1800L) != 0L) { + jjmatchedKind = 26; + return 32; + } + return -1; + case 1: + if ((active0 & 0x1800L) != 0L) { + jjmatchedKind = 26; + jjmatchedPos = 1; + return 32; + } + return -1; + default: + return -1; + } + } + + private final int jjStartNfa_3(int pos, long active0) { + return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1); + } + + private int jjStopAtPos(int pos, int kind) { + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; + } + + private int jjMoveStringLiteralDfa0_3() { + switch (curChar) { + case 40: + return jjStopAtPos(0, 30); + case 41: + return jjStopAtPos(0, 15); + case 43: + return jjStopAtPos(0, 13); + case 45: + return jjStopAtPos(0, 14); + case 58: + return jjStopAtPos(0, 16); + case 60: + jjmatchedKind = 18; + return jjMoveStringLiteralDfa1_3(0x80000L); + case 61: + return jjStopAtPos(0, 17); + case 62: + jjmatchedKind = 20; + return jjMoveStringLiteralDfa1_3(0x200000L); + case 64: + return jjStopAtPos(0, 59); + case 91: + return jjStopAtPos(0, 28); + case 94: + return jjStopAtPos(0, 22); + case 102: + return jjMoveStringLiteralDfa1_3(0x800L); + case 122: + return jjMoveStringLiteralDfa1_3(0x1000L); + case 123: + return jjStopAtPos(0, 29); + case 126: + return jjStopAtPos(0, 23); + default: + return jjMoveNfa_3(0, 0); + } + } + + private int jjMoveStringLiteralDfa1_3(long active0) { + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_3(0, active0); + return 1; + } + switch (curChar) { + case 61: + if ((active0 & 0x80000L) != 0L) + return jjStopAtPos(1, 19); + else if ((active0 & 0x200000L) != 0L) + return jjStopAtPos(1, 21); + break; + case 108: + return jjMoveStringLiteralDfa2_3(active0, 0x1000L); + case 110: + return jjMoveStringLiteralDfa2_3(active0, 0x800L); + default: + break; + } + return jjStartNfa_3(0, active0); + } + + private int jjMoveStringLiteralDfa2_3(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_3(0, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_3(1, active0); + return 2; + } + switch (curChar) { + case 58: + if ((active0 & 0x800L) != 0L) + return jjStopAtPos(2, 11); + else if ((active0 & 0x1000L) != 0L) + return jjStopAtPos(2, 12); + break; + default: + break; + } + return jjStartNfa_3(1, active0); + } + + static final long[] jjbitVec0 = { 0x1L, 0x0L, 0x0L, 0x0L }; + static final long[] jjbitVec1 = { 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; + static final long[] jjbitVec3 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; + static final long[] jjbitVec4 = { 0xfffefffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; + + private int jjMoveNfa_3(int startState, int curPos) { + int startsAt = 0; + jjnewStateCnt = 32; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (; ; ) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + do { + switch (jjstateSet[--i]) { + case 32: + case 23: + if ((0x8bff7cf8ffffd9ffL & l) == 0L) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 0: + if ((0x8bff54f8ffffd9ffL & l) != 0L) { + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + } + else if ((0x100002600L & l) != 0L) { + if (kind > 7) + kind = 7; + } + else if (curChar == 47) { + jjCheckNAddStates(0, 2); + } + else if (curChar == 34) { + jjCheckNAddStates(3, 5); + } + else if (curChar == 33) { + if (kind > 10) + kind = 10; + } + if ((0x3ff000000000000L & l) != 0L) { + if (kind > 25) + kind = 25; + { + jjCheckNAddTwoStates(19, 20); + } + } + else if (curChar == 38) + jjstateSet[jjnewStateCnt++] = 4; + break; + case 4: + if (curChar == 38 && kind > 8) + kind = 8; + break; + case 5: + if (curChar == 38) + jjstateSet[jjnewStateCnt++] = 4; + break; + case 13: + if (curChar == 33 && kind > 10) + kind = 10; + break; + case 14: + if (curChar == 34) { + jjCheckNAddStates(3, 5); + } + break; + case 15: + if ((0xfffffffbffffffffL & l) != 0L) { + jjCheckNAddStates(3, 5); + } + break; + case 17: { + jjCheckNAddStates(3, 5); + } + break; + case 18: + if (curChar == 34 && kind > 24) + kind = 24; + break; + case 19: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 25) + kind = 25; + { + jjCheckNAddTwoStates(19, 20); + } + break; + case 20: + if (curChar == 46) { + jjCheckNAdd(21); + } + break; + case 21: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 25) + kind = 25; + { + jjCheckNAdd(21); + } + break; + case 22: + if ((0x8bff54f8ffffd9ffL & l) == 0L) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 25: + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 27: + case 29: + if (curChar == 47) { + jjCheckNAddStates(0, 2); + } + break; + case 28: + if ((0xffff7fffffffffffL & l) != 0L) { + jjCheckNAddStates(0, 2); + } + break; + case 31: + if (curChar == 47 && kind > 27) + kind = 27; + break; + default: + break; + } + } + while (i != startsAt); + } + else if (curChar < 128) { + long l = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 32: + if ((0x97ffffff87fffffeL & l) != 0L) { + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + } + else if (curChar == 92) { + jjCheckNAddTwoStates(25, 25); + } + break; + case 0: + if ((0x97ffffff87fffffeL & l) != 0L) { + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + } + else if (curChar == 92) { + jjCheckNAdd(25); + } + if (curChar == 78) + jjstateSet[jjnewStateCnt++] = 11; + else if (curChar == 124) + jjstateSet[jjnewStateCnt++] = 8; + else if (curChar == 79) + jjstateSet[jjnewStateCnt++] = 6; + else if (curChar == 65) + jjstateSet[jjnewStateCnt++] = 2; + break; + case 1: + if (curChar == 68 && kind > 8) + kind = 8; + break; + case 2: + if (curChar == 78) + jjstateSet[jjnewStateCnt++] = 1; + break; + case 3: + if (curChar == 65) + jjstateSet[jjnewStateCnt++] = 2; + break; + case 6: + if (curChar == 82 && kind > 9) + kind = 9; + break; + case 7: + if (curChar == 79) + jjstateSet[jjnewStateCnt++] = 6; + break; + case 8: + if (curChar == 124 && kind > 9) + kind = 9; + break; + case 9: + if (curChar == 124) + jjstateSet[jjnewStateCnt++] = 8; + break; + case 10: + if (curChar == 84 && kind > 10) + kind = 10; + break; + case 11: + if (curChar == 79) + jjstateSet[jjnewStateCnt++] = 10; + break; + case 12: + if (curChar == 78) + jjstateSet[jjnewStateCnt++] = 11; + break; + case 15: + if ((0xffffffffefffffffL & l) != 0L) { + jjCheckNAddStates(3, 5); + } + break; + case 16: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 17; + break; + case 17: { + jjCheckNAddStates(3, 5); + } + break; + case 22: + if ((0x97ffffff87fffffeL & l) == 0L) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 23: + if ((0x97ffffff87fffffeL & l) == 0L) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 24: + if (curChar == 92) { + jjCheckNAddTwoStates(25, 25); + } + break; + case 25: + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 26: + if (curChar == 92) { + jjCheckNAdd(25); + } + break; + case 28: { + jjAddStates(0, 2); + } + break; + case 30: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 29; + break; + default: + break; + } + } + while (i != startsAt); + } + else { + int hiByte = (curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 32: + case 23: + if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 0: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { + if (kind > 7) + kind = 7; + } + if (jjCanMove_2(hiByte, i1, i2, l1, l2)) { + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + } + break; + case 15: + case 17: + if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { + jjCheckNAddStates(3, 5); + } + break; + case 22: + if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 25: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 26) + kind = 26; + { + jjCheckNAddTwoStates(23, 24); + } + break; + case 28: + if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { + jjAddStates(0, 2); + } + break; + default: + if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) + break; + else + break; + } + } + while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 32 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private final int jjStopStringLiteralDfa_1(int pos, long active0) { + switch (pos) { + case 0: + if ((active0 & 0x4000000000000L) != 0L) + return 19; + if ((active0 & 0x400000000L) != 0L) + return 79; + if ((active0 & 0x2000000000L) != 0L) + return 63; + return -1; + case 1: + if ((active0 & 0x2000000000L) != 0L) + return 62; + if ((active0 & 0x4000000000000L) != 0L) + return 18; + return -1; + case 2: + if ((active0 & 0x4000000000000L) != 0L) + return 17; + if ((active0 & 0x2000000000L) != 0L) + return 61; + return -1; + case 3: + if ((active0 & 0x2000000000L) != 0L) + return 60; + if ((active0 & 0x4000000000000L) != 0L) + return 16; + return -1; + case 4: + if ((active0 & 0x4000000000000L) != 0L) + return 15; + if ((active0 & 0x2000000000L) != 0L) + return 59; + return -1; + case 5: + if ((active0 & 0x2000000000L) != 0L) + return 58; + if ((active0 & 0x4000000000000L) != 0L) + return 14; + return -1; + case 6: + if ((active0 & 0x4000000000000L) != 0L) + return 13; + if ((active0 & 0x2000000000L) != 0L) + return 57; + return -1; + case 7: + if ((active0 & 0x4000000000000L) != 0L) + return 12; + return -1; + case 8: + if ((active0 & 0x4000000000000L) != 0L) + return 11; + return -1; + default: + return -1; + } + } + + private final int jjStartNfa_1(int pos, long active0) { + return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); + } + + private int jjMoveStringLiteralDfa0_1() { + switch (curChar) { + case 40: + return jjStopAtPos(0, 30); + case 97: + return jjMoveStringLiteralDfa1_1(0x400000000L); + case 98: + return jjMoveStringLiteralDfa1_1(0x800000000L); + case 99: + return jjMoveStringLiteralDfa1_1(0x2000000000L); + case 101: + return jjMoveStringLiteralDfa1_1(0x4000000000L); + case 111: + return jjMoveStringLiteralDfa1_1(0x1808000000000L); + case 112: + return jjMoveStringLiteralDfa1_1(0x2000000000000L); + case 117: + return jjMoveStringLiteralDfa1_1(0x4000000000000L); + case 119: + return jjMoveStringLiteralDfa1_1(0x30000000000000L); + default: + return jjMoveNfa_1(0, 0); + } + } + + private int jjMoveStringLiteralDfa1_1(long active0) { + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(0, active0); + return 1; + } + switch (curChar) { + case 101: + return jjMoveStringLiteralDfa2_1(active0, 0x800000000L); + case 102: + return jjMoveStringLiteralDfa2_1(active0, 0x400000000L); + case 104: + return jjMoveStringLiteralDfa2_1(active0, 0x2000000000000L); + case 105: + return jjMoveStringLiteralDfa2_1(active0, 0x30000000000000L); + case 110: + return jjMoveStringLiteralDfa2_1(active0, 0x4000000000000L); + case 111: + return jjMoveStringLiteralDfa2_1(active0, 0x2000000000L); + case 114: + if ((active0 & 0x8000000000L) != 0L) { + jjmatchedKind = 39; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_1(active0, 0x800000000000L); + case 118: + return jjMoveStringLiteralDfa2_1(active0, 0x1000000000000L); + case 120: + return jjMoveStringLiteralDfa2_1(active0, 0x4000000000L); + default: + break; + } + return jjStartNfa_1(0, active0); + } + + private int jjMoveStringLiteralDfa2_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(0, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(1, active0); + return 2; + } + switch (curChar) { + case 100: + return jjMoveStringLiteralDfa3_1(active0, 0x800000000000L); + case 101: + return jjMoveStringLiteralDfa3_1(active0, 0x1000000000000L); + case 102: + return jjMoveStringLiteralDfa3_1(active0, 0x800000000L); + case 108: + return jjMoveStringLiteralDfa3_1(active0, 0x10000000000000L); + case 110: + return jjMoveStringLiteralDfa3_1(active0, 0x2000000000L); + case 111: + return jjMoveStringLiteralDfa3_1(active0, 0x4000000000000L); + case 114: + return jjMoveStringLiteralDfa3_1(active0, 0x2000000000000L); + case 116: + return jjMoveStringLiteralDfa3_1(active0, 0x20004400000000L); + default: + break; + } + return jjStartNfa_1(1, active0); + } + + private int jjMoveStringLiteralDfa3_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(1, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(2, active0); + return 3; + } + switch (curChar) { + case 97: + return jjMoveStringLiteralDfa4_1(active0, 0x2000000000000L); + case 100: + return jjMoveStringLiteralDfa4_1(active0, 0x10000000000000L); + case 101: + return jjMoveStringLiteralDfa4_1(active0, 0x804400000000L); + case 104: + return jjMoveStringLiteralDfa4_1(active0, 0x20000000000000L); + case 111: + return jjMoveStringLiteralDfa4_1(active0, 0x800000000L); + case 114: + return jjMoveStringLiteralDfa4_1(active0, 0x5000000000000L); + case 116: + return jjMoveStringLiteralDfa4_1(active0, 0x2000000000L); + default: + break; + } + return jjStartNfa_1(2, active0); + } + + private int jjMoveStringLiteralDfa4_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(2, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(3, active0); + return 4; + } + switch (curChar) { + case 97: + return jjMoveStringLiteralDfa5_1(active0, 0x2000000000L); + case 99: + return jjMoveStringLiteralDfa5_1(active0, 0x10000000000000L); + case 100: + return jjMoveStringLiteralDfa5_1(active0, 0x4000000000000L); + case 105: + return jjMoveStringLiteralDfa5_1(active0, 0x20000000000000L); + case 108: + return jjMoveStringLiteralDfa5_1(active0, 0x1000000000000L); + case 110: + return jjMoveStringLiteralDfa5_1(active0, 0x4000000000L); + case 114: + if ((active0 & 0x400000000L) != 0L) + return jjStopAtPos(4, 34); + return jjMoveStringLiteralDfa5_1(active0, 0x800800000000L); + case 115: + return jjMoveStringLiteralDfa5_1(active0, 0x2000000000000L); + default: + break; + } + return jjStartNfa_1(3, active0); + } + + private int jjMoveStringLiteralDfa5_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(3, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(4, active0); + return 5; + } + switch (curChar) { + case 97: + return jjMoveStringLiteralDfa6_1(active0, 0x11000000000000L); + case 100: + if ((active0 & 0x4000000000L) != 0L) + return jjStopAtPos(5, 38); + break; + case 101: + if ((active0 & 0x800000000L) != 0L) + return jjStopAtPos(5, 35); + else if ((active0 & 0x2000000000000L) != 0L) + return jjStopAtPos(5, 49); + return jjMoveStringLiteralDfa6_1(active0, 0x4800000000000L); + case 105: + return jjMoveStringLiteralDfa6_1(active0, 0x2000000000L); + case 110: + if ((active0 & 0x20000000000000L) != 0L) + return jjStopAtPos(5, 53); + break; + default: + break; + } + return jjStartNfa_1(4, active0); + } + + private int jjMoveStringLiteralDfa6_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(4, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(5, active0); + return 6; + } + switch (curChar) { + case 100: + if ((active0 & 0x800000000000L) != 0L) + return jjStopAtPos(6, 47); + break; + case 110: + return jjMoveStringLiteralDfa7_1(active0, 0x2000000000L); + case 112: + return jjMoveStringLiteralDfa7_1(active0, 0x1000000000000L); + case 114: + return jjMoveStringLiteralDfa7_1(active0, 0x14000000000000L); + default: + break; + } + return jjStartNfa_1(5, active0); + } + + private int jjMoveStringLiteralDfa7_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(5, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(6, active0); + return 7; + } + switch (curChar) { + case 100: + if ((active0 & 0x10000000000000L) != 0L) + return jjStopAtPos(7, 52); + break; + case 101: + return jjMoveStringLiteralDfa8_1(active0, 0x4000000000000L); + case 105: + return jjMoveStringLiteralDfa8_1(active0, 0x2000000000L); + case 112: + return jjMoveStringLiteralDfa8_1(active0, 0x1000000000000L); + default: + break; + } + return jjStartNfa_1(6, active0); + } + + private int jjMoveStringLiteralDfa8_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(6, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(7, active0); + return 8; + } + switch (curChar) { + case 100: + if ((active0 & 0x4000000000000L) != 0L) + return jjStartNfaWithStates_1(8, 50, 11); + break; + case 105: + return jjMoveStringLiteralDfa9_1(active0, 0x1000000000000L); + case 110: + return jjMoveStringLiteralDfa9_1(active0, 0x2000000000L); + default: + break; + } + return jjStartNfa_1(7, active0); + } + + private int jjMoveStringLiteralDfa9_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(7, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(8, active0); + return 9; + } + switch (curChar) { + case 103: + if ((active0 & 0x2000000000L) != 0L) + return jjStopAtPos(9, 37); + break; + case 110: + return jjMoveStringLiteralDfa10_1(active0, 0x1000000000000L); + default: + break; + } + return jjStartNfa_1(8, active0); + } + + private int jjMoveStringLiteralDfa10_1(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(8, old0); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_1(9, active0); + return 10; + } + switch (curChar) { + case 103: + if ((active0 & 0x1000000000000L) != 0L) + return jjStopAtPos(10, 48); + break; + default: + break; + } + return jjStartNfa_1(9, active0); + } + + private int jjStartNfaWithStates_1(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_1(state, pos + 1); + } + + private int jjMoveNfa_1(int startState, int curPos) { + int startsAt = 0; + jjnewStateCnt = 199; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (; ; ) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + do { + switch (jjstateSet[--i]) { + case 0: + if ((0x100002600L & l) != 0L) + kind = 7; + break; + default: + break; + } + } + while (i != startsAt); + } + else if (curChar < 128) { + long l = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 18: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 34; + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 17; + break; + case 13: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 29; + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 12; + break; + case 60: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 68; + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 59; + break; + case 19: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 35; + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 18; + break; + case 57: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 65; + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 56; + break; + case 58: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 66; + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 57; + break; + case 59: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 67; + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 58; + break; + case 61: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 69; + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 60; + break; + case 14: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 30; + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 13; + break; + case 62: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 70; + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 61; + break; + case 15: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 31; + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 14; + break; + case 63: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 71; + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 62; + break; + case 16: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 32; + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 15; + break; + case 0: + if (curChar == 109) { + jjAddStates(6, 9); + } + else if (curChar == 110) { + jjAddStates(10, 17); + } + else if (curChar == 97) { + jjAddStates(18, 19); + } + else if (curChar == 99) { + jjAddStates(20, 21); + } + else if (curChar == 102) { + jjAddStates(22, 23); + } + else if (curChar == 117) { + jjAddStates(24, 25); + } + break; + case 11: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 27; + else if (curChar == 78) + jjstateSet[jjnewStateCnt++] = 10; + break; + case 17: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 33; + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 16; + break; + case 79: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 83; + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 78; + break; + case 12: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 28; + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 11; + break; + case 1: + if (curChar == 117) { + jjAddStates(24, 25); + } + break; + case 2: + if (curChar == 115 && kind > 51) + kind = 51; + break; + case 3: + case 20: + if (curChar == 112) { + jjCheckNAdd(2); + } + break; + case 4: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 3; + break; + case 5: + if (curChar == 108) + jjstateSet[jjnewStateCnt++] = 4; + break; + case 6: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 5; + break; + case 7: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 6; + break; + case 8: + if (curChar == 118) + jjstateSet[jjnewStateCnt++] = 7; + break; + case 9: + if (curChar == 79) + jjstateSet[jjnewStateCnt++] = 8; + break; + case 10: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 9; + break; + case 21: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 20; + break; + case 22: + if (curChar == 108) + jjstateSet[jjnewStateCnt++] = 21; + break; + case 23: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 22; + break; + case 24: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 23; + break; + case 25: + if (curChar == 118) + jjstateSet[jjnewStateCnt++] = 24; + break; + case 26: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 25; + break; + case 27: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 26; + break; + case 28: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 27; + break; + case 29: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 28; + break; + case 30: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 29; + break; + case 31: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 30; + break; + case 32: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 31; + break; + case 33: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 32; + break; + case 34: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 33; + break; + case 35: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 34; + break; + case 36: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 35; + break; + case 37: + if (curChar == 102) { + jjAddStates(22, 23); + } + break; + case 38: + if (curChar == 109 && kind > 40) + kind = 40; + break; + case 39: + case 46: + if (curChar == 114) { + jjCheckNAdd(38); + } + break; + case 40: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 39; + break; + case 41: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 40; + break; + case 42: + if (curChar == 121) + jjstateSet[jjnewStateCnt++] = 41; + break; + case 43: + if (curChar == 122) + jjstateSet[jjnewStateCnt++] = 42; + break; + case 44: + if (curChar == 122) + jjstateSet[jjnewStateCnt++] = 43; + break; + case 45: + if (curChar == 117) + jjstateSet[jjnewStateCnt++] = 44; + break; + case 47: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 46; + break; + case 48: + if (curChar == 84) + jjstateSet[jjnewStateCnt++] = 47; + break; + case 49: + if (curChar == 121) + jjstateSet[jjnewStateCnt++] = 48; + break; + case 50: + if (curChar == 122) + jjstateSet[jjnewStateCnt++] = 49; + break; + case 51: + if (curChar == 122) + jjstateSet[jjnewStateCnt++] = 50; + break; + case 52: + if (curChar == 117) + jjstateSet[jjnewStateCnt++] = 51; + break; + case 53: + if (curChar == 99) { + jjAddStates(20, 21); + } + break; + case 54: + if (curChar == 121 && kind > 36) + kind = 36; + break; + case 55: + if (curChar == 66) { + jjCheckNAdd(54); + } + break; + case 56: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 55; + break; + case 64: + if (curChar == 98) { + jjCheckNAdd(54); + } + break; + case 65: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 64; + break; + case 66: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 65; + break; + case 67: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 66; + break; + case 68: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 67; + break; + case 69: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 68; + break; + case 70: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 69; + break; + case 71: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 70; + break; + case 72: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 71; + break; + case 73: + if (curChar == 97) { + jjAddStates(18, 19); + } + break; + case 74: + if (curChar == 116 && kind > 33) + kind = 33; + break; + case 75: + case 80: + if (curChar == 115) { + jjCheckNAdd(74); + } + break; + case 76: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 75; + break; + case 77: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 76; + break; + case 78: + if (curChar == 108) + jjstateSet[jjnewStateCnt++] = 77; + break; + case 81: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 80; + break; + case 82: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 81; + break; + case 83: + if (curChar == 76) + jjstateSet[jjnewStateCnt++] = 82; + break; + case 84: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 83; + break; + case 85: + if (curChar == 110) { + jjAddStates(10, 17); + } + break; + case 86: + if (curChar == 103 && kind > 43) + kind = 43; + break; + case 87: + case 99: + if (curChar == 110) { + jjCheckNAdd(86); + } + break; + case 88: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 87; + break; + case 89: + if (curChar == 112) + jjstateSet[jjnewStateCnt++] = 88; + break; + case 90: + if (curChar == 112) + jjstateSet[jjnewStateCnt++] = 89; + break; + case 91: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 90; + break; + case 92: + if (curChar == 108) + jjstateSet[jjnewStateCnt++] = 91; + break; + case 93: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 92; + break; + case 94: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 93; + break; + case 95: + if (curChar == 118) + jjstateSet[jjnewStateCnt++] = 94; + break; + case 96: + if (curChar == 79) + jjstateSet[jjnewStateCnt++] = 95; + break; + case 97: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 96; + break; + case 98: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 97; + break; + case 100: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 99; + break; + case 101: + if (curChar == 112) + jjstateSet[jjnewStateCnt++] = 100; + break; + case 102: + if (curChar == 112) + jjstateSet[jjnewStateCnt++] = 101; + break; + case 103: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 102; + break; + case 104: + if (curChar == 108) + jjstateSet[jjnewStateCnt++] = 103; + break; + case 105: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 104; + break; + case 106: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 105; + break; + case 107: + if (curChar == 118) + jjstateSet[jjnewStateCnt++] = 106; + break; + case 108: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 107; + break; + case 109: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 108; + break; + case 110: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 109; + break; + case 111: + if (curChar == 121 && kind > 44) + kind = 44; + break; + case 112: + if (curChar == 66) { + jjCheckNAdd(111); + } + break; + case 113: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 112; + break; + case 114: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 113; + break; + case 115: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 114; + break; + case 116: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 115; + break; + case 117: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 116; + break; + case 118: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 117; + break; + case 119: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 118; + break; + case 120: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 119; + break; + case 121: + if (curChar == 67) + jjstateSet[jjnewStateCnt++] = 120; + break; + case 122: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 121; + break; + case 123: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 122; + break; + case 124: + if (curChar == 98) { + jjCheckNAdd(111); + } + break; + case 125: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 124; + break; + case 126: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 125; + break; + case 127: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 126; + break; + case 128: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 127; + break; + case 129: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 128; + break; + case 130: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 129; + break; + case 131: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 130; + break; + case 132: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 131; + break; + case 133: + if (curChar == 99) + jjstateSet[jjnewStateCnt++] = 132; + break; + case 134: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 133; + break; + case 135: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 134; + break; + case 136: + if (curChar == 103 && kind > 45) + kind = 45; + break; + case 137: + case 148: + if (curChar == 110) { + jjCheckNAdd(136); + } + break; + case 138: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 137; + break; + case 139: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 138; + break; + case 140: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 139; + break; + case 141: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 140; + break; + case 142: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 141; + break; + case 143: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 142; + break; + case 144: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 143; + break; + case 145: + if (curChar == 67) + jjstateSet[jjnewStateCnt++] = 144; + break; + case 146: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 145; + break; + case 147: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 146; + break; + case 149: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 148; + break; + case 150: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 149; + break; + case 151: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 150; + break; + case 152: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 151; + break; + case 153: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 152; + break; + case 154: + if (curChar == 110) + jjstateSet[jjnewStateCnt++] = 153; + break; + case 155: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 154; + break; + case 156: + if (curChar == 99) + jjstateSet[jjnewStateCnt++] = 155; + break; + case 157: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 156; + break; + case 158: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 157; + break; + case 159: + if (curChar == 110 && kind > 46) + kind = 46; + break; + case 160: + case 167: + if (curChar == 105) { + jjCheckNAdd(159); + } + break; + case 161: + if (curChar == 104) + jjstateSet[jjnewStateCnt++] = 160; + break; + case 162: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 161; + break; + case 163: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 162; + break; + case 164: + if (curChar == 87) + jjstateSet[jjnewStateCnt++] = 163; + break; + case 165: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 164; + break; + case 166: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 165; + break; + case 168: + if (curChar == 104) + jjstateSet[jjnewStateCnt++] = 167; + break; + case 169: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 168; + break; + case 170: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 169; + break; + case 171: + if (curChar == 119) + jjstateSet[jjnewStateCnt++] = 170; + break; + case 172: + if (curChar == 116) + jjstateSet[jjnewStateCnt++] = 171; + break; + case 173: + if (curChar == 111) + jjstateSet[jjnewStateCnt++] = 172; + break; + case 174: + if (curChar == 109) { + jjAddStates(6, 9); + } + break; + case 175: + if (curChar == 115 && kind > 41) + kind = 41; + break; + case 176: + case 181: + if (curChar == 112) { + jjCheckNAdd(175); + } + break; + case 177: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 176; + break; + case 178: + if (curChar == 103) + jjstateSet[jjnewStateCnt++] = 177; + break; + case 179: + if (curChar == 120) + jjstateSet[jjnewStateCnt++] = 178; + break; + case 180: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 179; + break; + case 182: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 181; + break; + case 183: + if (curChar == 71) + jjstateSet[jjnewStateCnt++] = 182; + break; + case 184: + if (curChar == 120) + jjstateSet[jjnewStateCnt++] = 183; + break; + case 185: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 184; + break; + case 186: + if (curChar == 104 && kind > 42) + kind = 42; + break; + case 187: + case 193: + if (curChar == 116) { + jjCheckNAdd(186); + } + break; + case 188: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 187; + break; + case 189: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 188; + break; + case 190: + if (curChar == 119) + jjstateSet[jjnewStateCnt++] = 189; + break; + case 191: + if (curChar == 120) + jjstateSet[jjnewStateCnt++] = 190; + break; + case 192: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 191; + break; + case 194: + if (curChar == 100) + jjstateSet[jjnewStateCnt++] = 193; + break; + case 195: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 194; + break; + case 196: + if (curChar == 87) + jjstateSet[jjnewStateCnt++] = 195; + break; + case 197: + if (curChar == 120) + jjstateSet[jjnewStateCnt++] = 196; + break; + case 198: + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 197; + break; + default: + break; + } + } + while (i != startsAt); + } + else { + int hiByte = (curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 0: + if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 7) + kind = 7; + break; + default: + if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) + break; + else + break; + } + } + while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 199 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private final int jjStopStringLiteralDfa_0(int pos, long active0) { + switch (pos) { + default: + return -1; + } + } + + private final int jjStartNfa_0(int pos, long active0) { + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); + } + + private int jjMoveStringLiteralDfa0_0() { + switch (curChar) { + case 40: + return jjStopAtPos(0, 30); + default: + return jjMoveNfa_0(0, 0); + } + } + + private int jjMoveNfa_0(int startState, int curPos) { + int startsAt = 0; + jjnewStateCnt = 22; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (; ; ) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + do { + switch (jjstateSet[--i]) { + case 0: + if ((0x100002600L & l) != 0L) + kind = 7; + break; + default: + break; + } + } + while (i != startsAt); + } + else if (curChar < 128) { + long l = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 0: + if (curChar == 110) { + jjAddStates(26, 27); + } + else if (curChar == 116) { + jjAddStates(28, 29); + } + break; + case 1: + if (curChar == 116) { + jjAddStates(28, 29); + } + break; + case 2: + if (curChar == 113) + kind = 32; + break; + case 3: + if (curChar == 121) + kind = 32; + break; + case 4: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 3; + break; + case 5: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 4; + break; + case 6: + if (curChar == 117) + jjstateSet[jjnewStateCnt++] = 5; + break; + case 7: + if (curChar == 81) + jjstateSet[jjnewStateCnt++] = 6; + break; + case 8: + if (curChar == 109) + jjstateSet[jjnewStateCnt++] = 7; + break; + case 9: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 8; + break; + case 10: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 9; + break; + case 11: + if (curChar == 110) { + jjAddStates(26, 27); + } + break; + case 12: + if (curChar == 115) + kind = 31; + break; + case 13: + if (curChar == 116 && kind > 31) + kind = 31; + break; + case 14: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 13; + break; + case 15: + if (curChar == 83) + jjstateSet[jjnewStateCnt++] = 14; + break; + case 16: + if (curChar == 99) + jjstateSet[jjnewStateCnt++] = 15; + break; + case 17: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 16; + break; + case 18: + if (curChar == 114) + jjstateSet[jjnewStateCnt++] = 17; + break; + case 19: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 18; + break; + case 20: + if (curChar == 109) + jjstateSet[jjnewStateCnt++] = 19; + break; + case 21: + if (curChar == 117) + jjstateSet[jjnewStateCnt++] = 20; + break; + default: + break; + } + } + while (i != startsAt); + } + else { + int hiByte = (curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 0: + if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 7) + kind = 7; + break; + default: + if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) + break; + else + break; + } + } + while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 22 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private final int jjStopStringLiteralDfa_2(int pos, long active0) { + switch (pos) { + case 0: + if ((active0 & 0x40000000000000L) != 0L) { + jjmatchedKind = 58; + return 6; + } + return -1; + default: + return -1; + } + } + + private final int jjStartNfa_2(int pos, long active0) { + return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1); + } + + private int jjMoveStringLiteralDfa0_2() { + switch (curChar) { + case 84: + return jjMoveStringLiteralDfa1_2(0x40000000000000L); + case 93: + return jjStopAtPos(0, 55); + case 125: + return jjStopAtPos(0, 56); + default: + return jjMoveNfa_2(0, 0); + } + } + + private int jjMoveStringLiteralDfa1_2(long active0) { + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_2(0, active0); + return 1; + } + switch (curChar) { + case 79: + if ((active0 & 0x40000000000000L) != 0L) + return jjStartNfaWithStates_2(1, 54, 6); + break; + default: + break; + } + return jjStartNfa_2(0, active0); + } + + private int jjStartNfaWithStates_2(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_2(state, pos + 1); + } + + private int jjMoveNfa_2(int startState, int curPos) { + int startsAt = 0; + jjnewStateCnt = 7; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (; ; ) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + do { + switch (jjstateSet[--i]) { + case 0: + if ((0xfffffffeffffffffL & l) != 0L) { + if (kind > 58) + kind = 58; + { + jjCheckNAdd(6); + } + } + if ((0x100002600L & l) != 0L) { + if (kind > 7) + kind = 7; + } + else if (curChar == 34) { + jjCheckNAddTwoStates(2, 4); + } + break; + case 1: + if (curChar == 34) { + jjCheckNAddTwoStates(2, 4); + } + break; + case 2: + if ((0xfffffffbffffffffL & l) != 0L) { + jjCheckNAddStates(30, 32); + } + break; + case 3: + if (curChar == 34) { + jjCheckNAddStates(30, 32); + } + break; + case 5: + if (curChar == 34 && kind > 57) + kind = 57; + break; + case 6: + if ((0xfffffffeffffffffL & l) == 0L) + break; + if (kind > 58) + kind = 58; + { + jjCheckNAdd(6); + } + break; + default: + break; + } + } + while (i != startsAt); + } + else if (curChar < 128) { + long l = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 0: + case 6: + if ((0xdfffffffdfffffffL & l) == 0L) + break; + if (kind > 58) + kind = 58; + { + jjCheckNAdd(6); + } + break; + case 2: { + jjAddStates(30, 32); + } + break; + case 4: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 3; + break; + default: + break; + } + } + while (i != startsAt); + } + else { + int hiByte = (curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do { + switch (jjstateSet[--i]) { + case 0: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { + if (kind > 7) + kind = 7; + } + if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { + if (kind > 58) + kind = 58; + { + jjCheckNAdd(6); + } + } + break; + case 2: + if (jjCanMove_1(hiByte, i1, i2, l1, l2)) { + jjAddStates(30, 32); + } + break; + case 6: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 58) + kind = 58; + { + jjCheckNAdd(6); + } + break; + default: + if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) + break; + else + break; + } + } + while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + /** + * Token literal values. + */ + public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, null, null, null, "\146\156\72", "\172\154\72", "\53", + "\55", "\51", "\72", "\75", "\74", "\74\75", "\76", "\76\75", "\136", "\176", null, null, null, null, "\133", "\173", "\50", null, null, null, + "\141\146\164\145\162", "\142\145\146\157\162\145", null, "\143\157\156\164\141\151\156\151\156\147", "\145\170\164\145\156\144", "\157\162", null, + null, null, null, null, null, null, "\157\162\144\145\162\145\144", "\157\166\145\162\154\141\160\160\151\156\147", "\160\150\162\141\163\145", + "\165\156\157\162\144\145\162\145\144", null, "\167\151\154\144\143\141\162\144", "\167\151\164\150\151\156", "\124\117", "\135", "\175", null, + null, "\100", }; + + protected Token jjFillToken() { + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind); + t.kind = jjmatchedKind; + t.image = curTokenImage; + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; + } + + static final int[] jjnextStates = { 28, 30, 31, 15, 16, 18, 180, 185, 192, 198, 98, 110, 123, 135, 147, 158, 166, 173, 79, 84, 63, 72, 45, 52, 19, 36, 12, + 21, 2, 10, 2, 4, 5, }; + + private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { + switch (hiByte) { + case 48: + return ((jjbitVec0[i2] & l2) != 0L); + default: + return false; + } + } + + private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) { + switch (hiByte) { + case 0: + return ((jjbitVec3[i2] & l2) != 0L); + default: + if ((jjbitVec1[i1] & l1) != 0L) + return true; + return false; + } + } + + private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) { + switch (hiByte) { + case 0: + return ((jjbitVec3[i2] & l2) != 0L); + case 48: + return ((jjbitVec1[i2] & l2) != 0L); + default: + if ((jjbitVec4[i1] & l1) != 0L) + return true; + return false; + } + } + + int curLexState = 3; + int defaultLexState = 3; + int jjnewStateCnt; + int jjround; + int jjmatchedPos; + int jjmatchedKind; + + /** + * Get the next Token. + */ + public Token getNextToken() { + Token matchedToken; + int curPos = 0; + + EOFLoop: + for (; ; ) { + try { + curChar = input_stream.BeginToken(); + } + catch (Exception e) { + jjmatchedKind = 0; + jjmatchedPos = -1; + matchedToken = jjFillToken(); + return matchedToken; + } + + switch (curLexState) { + case 0: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + break; + case 1: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_1(); + break; + case 2: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_2(); + break; + case 3: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_3(); + break; + } + if (jjmatchedKind != 0x7fffffff) { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { + matchedToken = jjFillToken(); + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + return matchedToken; + } + else { + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { + input_stream.readChar(); + input_stream.backup(1); + } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } + } + + void SkipLexicalActions(Token matchedToken) { + switch (jjmatchedKind) { + default: + break; + } + } + + void MoreLexicalActions() { + jjimageLen += (lengthOfMatch = jjmatchedPos + 1); + switch (jjmatchedKind) { + default: + break; + } + } + + void TokenLexicalActions(Token matchedToken) { + switch (jjmatchedKind) { + default: + break; + } + } + + private void jjCheckNAdd(int state) { + if (jjrounds[state] != jjround) { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } + } + + private void jjAddStates(int start, int end) { + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } + while (start++ != end); + } + + private void jjCheckNAddTwoStates(int state1, int state2) { + jjCheckNAdd(state1); + jjCheckNAdd(state2); + } + + private void jjCheckNAddStates(int start, int end) { + do { + jjCheckNAdd(jjnextStates[start]); + } + while (start++ != end); + } + + /** + * Constructor. + */ + public ZuliaSyntaxParserTokenManager(CharStream stream) { + + input_stream = stream; + } + + /** + * Constructor. + */ + public ZuliaSyntaxParserTokenManager(CharStream stream, int lexState) { + ReInit(stream); + SwitchTo(lexState); + } + + /** + * Reinitialise parser. + */ + + public void ReInit(CharStream stream) { + + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); + } + + private void ReInitRounds() { + int i; + jjround = 0x80000001; + for (i = 199; i-- > 0; ) + jjrounds[i] = 0x80000000; + } + + /** + * Reinitialise parser. + */ + public void ReInit(CharStream stream, int lexState) { + ReInit(stream); + SwitchTo(lexState); + } + + /** + * Switch to specified lex state. + */ + public void SwitchTo(int lexState) { + if (lexState >= 4 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; + } + + /** + * Lexer state names. + */ + public static final String[] lexStateNames = { "Zulia", "Function", "Range", "DEFAULT", }; + + /** + * Lex State array. + */ + public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, + 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 3, -1, -1, -1, }; + static final long[] jjtoToken = { 0xfffffffffffff01L, }; + static final long[] jjtoSkip = { 0x80L, }; + static final long[] jjtoSpecial = { 0x0L, }; + static final long[] jjtoMore = { 0x0L, }; + protected CharStream input_stream; + + private final int[] jjrounds = new int[199]; + private final int[] jjstateSet = new int[2 * 199]; + private final StringBuilder jjimage = new StringBuilder(); + private StringBuilder image = jjimage; + private int jjimageLen; + private int lengthOfMatch; + protected int curChar; } From 4299a8fb4c975b95ac3f6cfb1edbf35092000b64 Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Sat, 8 Jul 2023 09:08:11 -0400 Subject: [PATCH 08/11] numeric set syntax tests --- .../server/test/node/NumericSetTest.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/zulia-server/src/test/java/io/zulia/server/test/node/NumericSetTest.java b/zulia-server/src/test/java/io/zulia/server/test/node/NumericSetTest.java index 96552e09..bfa060da 100644 --- a/zulia-server/src/test/java/io/zulia/server/test/node/NumericSetTest.java +++ b/zulia-server/src/test/java/io/zulia/server/test/node/NumericSetTest.java @@ -2,6 +2,7 @@ import io.zulia.DefaultAnalyzers; import io.zulia.client.command.Store; +import io.zulia.client.command.builder.FilterQuery; import io.zulia.client.command.builder.NumericSetQuery; import io.zulia.client.command.builder.Search; import io.zulia.client.command.builder.Sort; @@ -75,6 +76,7 @@ private void indexRecord(int id, int i, long l, float f, double d) throws Except mongoDocument.put("floatField", f); mongoDocument.put("doubleField", d); + Store s = new Store(uniqueId, NUMERIC_SET_TEST); ResultDocBuilder resultDocumentBuilder = ResultDocBuilder.newBuilder().setDocument(mongoDocument); @@ -111,6 +113,60 @@ public void searchTest() throws Exception { Assertions.assertEquals("2", searchResult.getCompleteResults().get(1).getUniqueId()); Assertions.assertEquals("5", searchResult.getCompleteResults().get(2).getUniqueId()); + search = new Search(NUMERIC_SET_TEST); + search.addQuery(new FilterQuery("intField:zl:ns(1 2)")).addSort(new Sort("id")); + search.setAmount(10); + searchResult = zuliaWorkPool.search(search); + Assertions.assertEquals(3, searchResult.getTotalHits()); + + Assertions.assertEquals("1", searchResult.getCompleteResults().get(0).getUniqueId()); + Assertions.assertEquals("2", searchResult.getCompleteResults().get(1).getUniqueId()); + Assertions.assertEquals("5", searchResult.getCompleteResults().get(2).getUniqueId()); + + search = new Search(NUMERIC_SET_TEST); + search.addQuery(new FilterQuery("zl:ns(1 2)").addQueryField("intField")).addSort(new Sort("id")); + search.setAmount(10); + searchResult = zuliaWorkPool.search(search); + Assertions.assertEquals(3, searchResult.getTotalHits()); + + Assertions.assertEquals("1", searchResult.getCompleteResults().get(0).getUniqueId()); + Assertions.assertEquals("2", searchResult.getCompleteResults().get(1).getUniqueId()); + Assertions.assertEquals("5", searchResult.getCompleteResults().get(2).getUniqueId()); + + //IllegalArgumentException:Search: For input string: "abcd" + Assertions.assertThrows(Exception.class, () -> { + Search s = new Search(NUMERIC_SET_TEST); + s.addQuery(new FilterQuery("zl:ns(1 abcd)").addQueryField("intField")).addSort(new Sort("id")); + s.setAmount(10); + zuliaWorkPool.search(s); + }); + + //Exception:Search: Field must be indexed for numeric set queries + Assertions.assertThrows(Exception.class, () -> { + Search s = new Search(NUMERIC_SET_TEST); + s.addQuery(new FilterQuery("zl:ns(1 2)").addQueryField("title")).addSort(new Sort("id")); + s.setAmount(10); + zuliaWorkPool.search(s); + }); + + search = new Search(NUMERIC_SET_TEST); + search.addQuery(new FilterQuery("intField,longField:zl:ns(1 2 5)")).addSort(new Sort("id")); + search.setAmount(10); + searchResult = zuliaWorkPool.search(search); + Assertions.assertEquals(5, searchResult.getTotalHits()); + + search = new Search(NUMERIC_SET_TEST); + search.addQuery(new FilterQuery("intField,longField:zl:ns(1 2 5) -id:1")).addSort(new Sort("id")); + search.setAmount(10); + searchResult = zuliaWorkPool.search(search); + Assertions.assertEquals(4, searchResult.getTotalHits()); + + search = new Search(NUMERIC_SET_TEST); + search.addQuery(new FilterQuery("zl:ns(1 2 5)").addQueryFields("intField", "longField")).addSort(new Sort("id")); + search.setAmount(10); + searchResult = zuliaWorkPool.search(search); + Assertions.assertEquals(5, searchResult.getTotalHits()); + search = new Search(NUMERIC_SET_TEST); search.addQuery(new NumericSetQuery("longField").addValues(1L)); search.setAmount(10); @@ -123,12 +179,24 @@ public void searchTest() throws Exception { searchResult = zuliaWorkPool.search(search); Assertions.assertEquals(2, searchResult.getTotalHits()); + search = new Search(NUMERIC_SET_TEST); + search.addQuery(new FilterQuery("zl:ns(565.0 2000)").addQueryField("floatField")).addSort(new Sort("id")); + search.setAmount(10); + searchResult = zuliaWorkPool.search(search); + Assertions.assertEquals(2, searchResult.getTotalHits()); + search = new Search(NUMERIC_SET_TEST); search.addQuery(new NumericSetQuery("doubleField").addValues(2.01, 2.0)); search.setAmount(3); searchResult = zuliaWorkPool.search(search); Assertions.assertEquals(3, searchResult.getTotalHits()); + search = new Search(NUMERIC_SET_TEST); + search.addQuery(new FilterQuery("doubleField:zl:ns(2.01 2.0)")).addSort(new Sort("id")); + search.setAmount(10); + searchResult = zuliaWorkPool.search(search); + Assertions.assertEquals(3, searchResult.getTotalHits()); + } @Test From 38ef1449fef4797a2be929323e1914de1c76f96b Mon Sep 17 00:00:00 2001 From: Matthew Davis <matt.davis@ascend-tech.us> Date: Sat, 8 Jul 2023 11:08:53 -0400 Subject: [PATCH 09/11] add tests for querying fields with names zl and fl --- .../server/test/node/NumericSetTest.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/zulia-server/src/test/java/io/zulia/server/test/node/NumericSetTest.java b/zulia-server/src/test/java/io/zulia/server/test/node/NumericSetTest.java index bfa060da..ddb0bb10 100644 --- a/zulia-server/src/test/java/io/zulia/server/test/node/NumericSetTest.java +++ b/zulia-server/src/test/java/io/zulia/server/test/node/NumericSetTest.java @@ -45,6 +45,8 @@ public void createIndex() throws Exception { indexConfig.addFieldConfig(FieldConfigBuilder.createLong("longField").index()); indexConfig.addFieldConfig(FieldConfigBuilder.createFloat("floatField").index()); indexConfig.addFieldConfig(FieldConfigBuilder.createDouble("doubleField").index()); + indexConfig.addFieldConfig(FieldConfigBuilder.createString("fn").indexAs(DefaultAnalyzers.STANDARD)); + indexConfig.addFieldConfig(FieldConfigBuilder.createString("zl").indexAs(DefaultAnalyzers.STANDARD)); indexConfig.setIndexName(NUMERIC_SET_TEST); indexConfig.setNumberOfShards(1); indexConfig.setShardCommitInterval(20); //force some commits @@ -76,6 +78,13 @@ private void indexRecord(int id, int i, long l, float f, double d) throws Except mongoDocument.put("floatField", f); mongoDocument.put("doubleField", d); + if (id == 1) { + mongoDocument.put("fn", "ordered"); + } + + if (id == 2) { + mongoDocument.put("zl", "ns"); + } Store s = new Store(uniqueId, NUMERIC_SET_TEST); @@ -197,6 +206,28 @@ public void searchTest() throws Exception { searchResult = zuliaWorkPool.search(search); Assertions.assertEquals(3, searchResult.getTotalHits()); + // to query fn or zl, need to use multi-field syntax trick to query or use query fields + + search = new Search(NUMERIC_SET_TEST); + search.addQuery(new FilterQuery("ordered").addQueryFields("fn")); + searchResult = zuliaWorkPool.search(search); + Assertions.assertEquals(1, searchResult.getTotalHits()); + + search = new Search(NUMERIC_SET_TEST); + search.addQuery(new FilterQuery("fn,:ordered")); + searchResult = zuliaWorkPool.search(search); + Assertions.assertEquals(1, searchResult.getTotalHits()); + + search = new Search(NUMERIC_SET_TEST); + search.addQuery(new FilterQuery("ns").addQueryFields("zl")); + searchResult = zuliaWorkPool.search(search); + Assertions.assertEquals(1, searchResult.getTotalHits()); + + search = new Search(NUMERIC_SET_TEST); + search.addQuery(new FilterQuery("zl,:ns")); + searchResult = zuliaWorkPool.search(search); + Assertions.assertEquals(1, searchResult.getTotalHits()); + } @Test From 374ac016297e3318f609313988fa96c378fef18d Mon Sep 17 00:00:00 2001 From: Matthew Davis <matt.davis@ascend-tech.us> Date: Sat, 8 Jul 2023 11:19:33 -0400 Subject: [PATCH 10/11] add term query syntax test --- .../zulia/server/test/node/StartStopTest.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/zulia-server/src/test/java/io/zulia/server/test/node/StartStopTest.java b/zulia-server/src/test/java/io/zulia/server/test/node/StartStopTest.java index e409bc4c..45bacaec 100644 --- a/zulia-server/src/test/java/io/zulia/server/test/node/StartStopTest.java +++ b/zulia-server/src/test/java/io/zulia/server/test/node/StartStopTest.java @@ -348,24 +348,54 @@ public void termTestBuilder() throws Exception { searchResult = zuliaWorkPool.search(s); Assertions.assertEquals(4, searchResult.getTotalHits()); + s = new Search(FACET_TEST_INDEX); + s.addQuery(new FilterQuery("testBool:true AND id:zl:tq(1 2 3 4)")); + searchResult = zuliaWorkPool.search(s); + Assertions.assertEquals(4, searchResult.getTotalHits()); + s = new Search(FACET_TEST_INDEX); s.addQuery(new TermQuery("id").addTerm("1").addTerm("2").addTerm("3").addTerm("4")); s.addQuery(new FilterQuery("country:US")); searchResult = zuliaWorkPool.search(s); Assertions.assertEquals(2, searchResult.getTotalHits()); + s = new Search(FACET_TEST_INDEX); + s.addQuery(new FilterQuery("id:zl:tq(1 2 3 4) AND country:US")); + searchResult = zuliaWorkPool.search(s); + Assertions.assertEquals(2, searchResult.getTotalHits()); + s = new Search(FACET_TEST_INDEX); s.addQuery(new TermQuery("id").addTerm("1").addTerm("2").addTerm("3").addTerm("4").exclude()); s.addQuery(new FilterQuery("country:US")); searchResult = zuliaWorkPool.search(s); Assertions.assertEquals(28, searchResult.getTotalHits()); + s = new Search(FACET_TEST_INDEX); + s.addQuery(new FilterQuery("-id:zl:tq(1 2 3 4) AND country:US")); + searchResult = zuliaWorkPool.search(s); + Assertions.assertEquals(28, searchResult.getTotalHits()); + s = new Search(FACET_TEST_INDEX); s.addQuery(new TermQuery("id").addTerm("1").addTerm("2").addTerm("3").addTerm("4").exclude()); s.addQuery(new FilterQuery("country:US").exclude()); s.addQuery(new MatchAllQuery()); //need to use match all because all other queries are negated searchResult = zuliaWorkPool.search(s); Assertions.assertEquals(28, searchResult.getTotalHits()); + + s = new Search(FACET_TEST_INDEX); + s.addQuery(new FilterQuery("-id:zl:tq(1 2 3 4) AND -country:US")); + searchResult = zuliaWorkPool.search(s); + Assertions.assertEquals(28, searchResult.getTotalHits()); + + s = new Search(FACET_TEST_INDEX); + s.addQuery(new FilterQuery("title:zl:tq(facet)")); + searchResult = zuliaWorkPool.search(s); + Assertions.assertEquals(25, searchResult.getTotalHits()); + + s = new Search(FACET_TEST_INDEX); + s.addQuery(new FilterQuery("title:zl:tq(facet userguide)")); + searchResult = zuliaWorkPool.search(s); + Assertions.assertEquals(50, searchResult.getTotalHits()); } @Test From 66847e2170d50fdac1da9319f624f3e052082bbc Mon Sep 17 00:00:00 2001 From: Matthew Davis <matt.davis@ascend-tech.us> Date: Sat, 8 Jul 2023 11:32:09 -0400 Subject: [PATCH 11/11] add quoted example --- .../test/java/io/zulia/server/test/node/StartStopTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zulia-server/src/test/java/io/zulia/server/test/node/StartStopTest.java b/zulia-server/src/test/java/io/zulia/server/test/node/StartStopTest.java index 45bacaec..3ccad227 100644 --- a/zulia-server/src/test/java/io/zulia/server/test/node/StartStopTest.java +++ b/zulia-server/src/test/java/io/zulia/server/test/node/StartStopTest.java @@ -396,6 +396,11 @@ public void termTestBuilder() throws Exception { s.addQuery(new FilterQuery("title:zl:tq(facet userguide)")); searchResult = zuliaWorkPool.search(s); Assertions.assertEquals(50, searchResult.getTotalHits()); + + s = new Search(FACET_TEST_INDEX); + s.addQuery(new FilterQuery("issn:zl:tq(\"1234-1234\" \"3333-1234\" \"1234-5555\")")); + searchResult = zuliaWorkPool.search(s); + Assertions.assertEquals(30, searchResult.getTotalHits()); } @Test