com.jaeksoft.searchlib.query.parser.BooleanQueryParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opensearchserver Show documentation
Show all versions of opensearchserver Show documentation
OpenSearchServer is a powerful, enterprise-class, search engine program. Using the web user interface, the crawlers (web, file, database, ...) and the REST/RESTFul API you will be able to integrate quickly and easily advanced full-text search capabilities in your application. OpenSearchServer runs on Windows and Linux/Unix/BSD.
The newest version!
// Generated from com/jaeksoft/searchlib/query/parser/BooleanQuery.g4 by ANTLR 4.5
package com.jaeksoft.searchlib.query.parser;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class BooleanQueryParser extends Parser {
static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
AND=1, OR=2, NOT=3, STRING=4, QSTRING=5, FIELD=6, WS=7;
public static final int
RULE_expression = 0, RULE_term = 1;
public static final String[] ruleNames = {
"expression", "term"
};
private static final String[] _LITERAL_NAMES = {
};
private static final String[] _SYMBOLIC_NAMES = {
null, "AND", "OR", "NOT", "STRING", "QSTRING", "FIELD", "WS"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "BooleanQuery.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public BooleanQueryParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class ExpressionContext extends ParserRuleContext {
public List term() {
return getRuleContexts(TermContext.class);
}
public TermContext term(int i) {
return getRuleContext(TermContext.class,i);
}
public ExpressionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_expression; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof BooleanQueryListener ) ((BooleanQueryListener)listener).enterExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof BooleanQueryListener ) ((BooleanQueryListener)listener).exitExpression(this);
}
}
public final ExpressionContext expression() throws RecognitionException {
ExpressionContext _localctx = new ExpressionContext(_ctx, getState());
enterRule(_localctx, 0, RULE_expression);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(5);
_errHandler.sync(this);
_la = _input.LA(1);
do {
{
{
setState(4);
term();
}
}
setState(7);
_errHandler.sync(this);
_la = _input.LA(1);
} while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << AND) | (1L << OR) | (1L << NOT) | (1L << STRING) | (1L << QSTRING) | (1L << FIELD))) != 0) );
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class TermContext extends ParserRuleContext {
public List AND() { return getTokens(BooleanQueryParser.AND); }
public TerminalNode AND(int i) {
return getToken(BooleanQueryParser.AND, i);
}
public List OR() { return getTokens(BooleanQueryParser.OR); }
public TerminalNode OR(int i) {
return getToken(BooleanQueryParser.OR, i);
}
public List NOT() { return getTokens(BooleanQueryParser.NOT); }
public TerminalNode NOT(int i) {
return getToken(BooleanQueryParser.NOT, i);
}
public List STRING() { return getTokens(BooleanQueryParser.STRING); }
public TerminalNode STRING(int i) {
return getToken(BooleanQueryParser.STRING, i);
}
public List QSTRING() { return getTokens(BooleanQueryParser.QSTRING); }
public TerminalNode QSTRING(int i) {
return getToken(BooleanQueryParser.QSTRING, i);
}
public List FIELD() { return getTokens(BooleanQueryParser.FIELD); }
public TerminalNode FIELD(int i) {
return getToken(BooleanQueryParser.FIELD, i);
}
public TermContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_term; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof BooleanQueryListener ) ((BooleanQueryListener)listener).enterTerm(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof BooleanQueryListener ) ((BooleanQueryListener)listener).exitTerm(this);
}
}
public final TermContext term() throws RecognitionException {
TermContext _localctx = new TermContext(_ctx, getState());
enterRule(_localctx, 2, RULE_term);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(10);
_errHandler.sync(this);
_alt = 1;
do {
switch (_alt) {
case 1:
{
{
setState(9);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << AND) | (1L << OR) | (1L << NOT) | (1L << STRING) | (1L << QSTRING) | (1L << FIELD))) != 0)) ) {
_errHandler.recoverInline(this);
} else {
consume();
}
}
}
break;
default:
throw new NoViableAltException(this);
}
setState(12);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,1,_ctx);
} while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER );
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\t\21\4\2\t\2\4\3"+
"\t\3\3\2\6\2\b\n\2\r\2\16\2\t\3\3\6\3\r\n\3\r\3\16\3\16\3\3\2\2\4\2\4"+
"\2\3\3\2\3\b\20\2\7\3\2\2\2\4\f\3\2\2\2\6\b\5\4\3\2\7\6\3\2\2\2\b\t\3"+
"\2\2\2\t\7\3\2\2\2\t\n\3\2\2\2\n\3\3\2\2\2\13\r\t\2\2\2\f\13\3\2\2\2\r"+
"\16\3\2\2\2\16\f\3\2\2\2\16\17\3\2\2\2\17\5\3\2\2\2\4\t\16";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}