net.evilengineers.templates4j.extension.antlr.xpath.AntlrXPathParser Maven / Gradle / Ivy
// Generated from net\evilengineers\templates4j\extension\antlr\xpath\AntlrXPath.g4 by ANTLR 4.2.2
package net.evilengineers.templates4j.extension.antlr.xpath;
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 AntlrXPathParser extends Parser {
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__11=1, T__10=2, T__9=3, T__8=4, T__7=5, T__6=6, T__5=7, T__4=8, T__3=9,
T__2=10, T__1=11, T__0=12, Name=13, Number=14, StringLiteral=15, Any=16,
Next=17, EOL=18;
public static final String[] tokenNames = {
"", "']'", "')'", "'['", "'::'", "'descendant-or-self'", "'*'",
"'('", "'parent'", "'descendant'", "'='", "'text'", "'child'", "Name",
"Number", "StringLiteral", "'//'", "'/'", "EOL"
};
public static final int
RULE_query = 0, RULE_queryStep = 1, RULE_axisSpecifier = 2, RULE_axisName = 3,
RULE_name = 4, RULE_condition = 5, RULE_operator = 6, RULE_function = 7,
RULE_arg = 8;
public static final String[] ruleNames = {
"query", "queryStep", "axisSpecifier", "axisName", "name", "condition",
"operator", "function", "arg"
};
@Override
public String getGrammarFileName() { return "AntlrXPath.g4"; }
@Override
public String[] getTokenNames() { return tokenNames; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public AntlrXPathParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class QueryContext extends ParserRuleContext {
public List queryStep() {
return getRuleContexts(QueryStepContext.class);
}
public QueryStepContext queryStep(int i) {
return getRuleContext(QueryStepContext.class,i);
}
public QueryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_query; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).enterQuery(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).exitQuery(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof AntlrXPathVisitor ) return ((AntlrXPathVisitor extends T>)visitor).visitQuery(this);
else return visitor.visitChildren(this);
}
}
public final QueryContext query() throws RecognitionException {
QueryContext _localctx = new QueryContext(_ctx, getState());
enterRule(_localctx, 0, RULE_query);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(19);
_errHandler.sync(this);
_alt = 1;
do {
switch (_alt) {
case 1:
{
{
setState(18); queryStep();
}
}
break;
default:
throw new NoViableAltException(this);
}
setState(21);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,0,_ctx);
} while ( _alt!=2 && _alt!=ATN.INVALID_ALT_NUMBER );
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class QueryStepContext extends ParserRuleContext {
public ConditionContext condition() {
return getRuleContext(ConditionContext.class,0);
}
public TerminalNode Any() { return getToken(AntlrXPathParser.Any, 0); }
public AxisSpecifierContext axisSpecifier() {
return getRuleContext(AxisSpecifierContext.class,0);
}
public TerminalNode Next() { return getToken(AntlrXPathParser.Next, 0); }
public NameContext name() {
return getRuleContext(NameContext.class,0);
}
public QueryStepContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_queryStep; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).enterQueryStep(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).exitQueryStep(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof AntlrXPathVisitor ) return ((AntlrXPathVisitor extends T>)visitor).visitQueryStep(this);
else return visitor.visitChildren(this);
}
}
public final QueryStepContext queryStep() throws RecognitionException {
QueryStepContext _localctx = new QueryStepContext(_ctx, getState());
enterRule(_localctx, 2, RULE_queryStep);
int _la;
try {
setState(55);
switch ( getInterpreter().adaptivePredict(_input,7,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(23); match(Any);
setState(24); name();
setState(29);
switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) {
case 1:
{
setState(25); match(3);
setState(26); condition();
setState(27); match(1);
}
break;
}
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(31); match(Next);
setState(33);
switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) {
case 1:
{
setState(32); axisSpecifier();
}
break;
}
setState(42);
switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) {
case 1:
{
setState(35); name();
setState(40);
switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) {
case 1:
{
setState(36); match(3);
setState(37); condition();
setState(38); match(1);
}
break;
}
}
break;
}
}
break;
case 3:
enterOuterAlt(_localctx, 3);
{
setState(44);
if (!(_input.index() == 0)) throw new FailedPredicateException(this, "_input.index() == 0");
setState(46);
_la = _input.LA(1);
if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 5) | (1L << 8) | (1L << 9) | (1L << 12))) != 0)) {
{
setState(45); axisSpecifier();
}
}
setState(48); name();
setState(53);
switch ( getInterpreter().adaptivePredict(_input,6,_ctx) ) {
case 1:
{
setState(49); match(3);
setState(50); condition();
setState(51); match(1);
}
break;
}
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class AxisSpecifierContext extends ParserRuleContext {
public AxisNameContext axisName() {
return getRuleContext(AxisNameContext.class,0);
}
public AxisSpecifierContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_axisSpecifier; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).enterAxisSpecifier(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).exitAxisSpecifier(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof AntlrXPathVisitor ) return ((AntlrXPathVisitor extends T>)visitor).visitAxisSpecifier(this);
else return visitor.visitChildren(this);
}
}
public final AxisSpecifierContext axisSpecifier() throws RecognitionException {
AxisSpecifierContext _localctx = new AxisSpecifierContext(_ctx, getState());
enterRule(_localctx, 4, RULE_axisSpecifier);
try {
enterOuterAlt(_localctx, 1);
{
setState(57); axisName();
setState(58); match(4);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class AxisNameContext extends ParserRuleContext {
public AxisNameContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_axisName; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).enterAxisName(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).exitAxisName(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof AntlrXPathVisitor ) return ((AntlrXPathVisitor extends T>)visitor).visitAxisName(this);
else return visitor.visitChildren(this);
}
}
public final AxisNameContext axisName() throws RecognitionException {
AxisNameContext _localctx = new AxisNameContext(_ctx, getState());
enterRule(_localctx, 6, RULE_axisName);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(60);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 5) | (1L << 8) | (1L << 9) | (1L << 12))) != 0)) ) {
_errHandler.recoverInline(this);
}
consume();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class NameContext extends ParserRuleContext {
public TerminalNode Name() { return getToken(AntlrXPathParser.Name, 0); }
public NameContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_name; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).enterName(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).exitName(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof AntlrXPathVisitor ) return ((AntlrXPathVisitor extends T>)visitor).visitName(this);
else return visitor.visitChildren(this);
}
}
public final NameContext name() throws RecognitionException {
NameContext _localctx = new NameContext(_ctx, getState());
enterRule(_localctx, 8, RULE_name);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(62);
_la = _input.LA(1);
if ( !(_la==6 || _la==Name) ) {
_errHandler.recoverInline(this);
}
consume();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ConditionContext extends ParserRuleContext {
public FunctionContext function() {
return getRuleContext(FunctionContext.class,0);
}
public ArgContext arg() {
return getRuleContext(ArgContext.class,0);
}
public OperatorContext operator() {
return getRuleContext(OperatorContext.class,0);
}
public TerminalNode StringLiteral() { return getToken(AntlrXPathParser.StringLiteral, 0); }
public ConditionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_condition; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).enterCondition(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).exitCondition(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof AntlrXPathVisitor ) return ((AntlrXPathVisitor extends T>)visitor).visitCondition(this);
else return visitor.visitChildren(this);
}
}
public final ConditionContext condition() throws RecognitionException {
ConditionContext _localctx = new ConditionContext(_ctx, getState());
enterRule(_localctx, 10, RULE_condition);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(64); function();
setState(65); match(7);
setState(67);
_la = _input.LA(1);
if (_la==Number) {
{
setState(66); arg();
}
}
setState(69); match(2);
setState(70); operator();
setState(71); match(StringLiteral);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class OperatorContext extends ParserRuleContext {
public OperatorContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_operator; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).enterOperator(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).exitOperator(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof AntlrXPathVisitor ) return ((AntlrXPathVisitor extends T>)visitor).visitOperator(this);
else return visitor.visitChildren(this);
}
}
public final OperatorContext operator() throws RecognitionException {
OperatorContext _localctx = new OperatorContext(_ctx, getState());
enterRule(_localctx, 12, RULE_operator);
try {
enterOuterAlt(_localctx, 1);
{
setState(73); match(10);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class FunctionContext extends ParserRuleContext {
public FunctionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_function; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).enterFunction(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).exitFunction(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof AntlrXPathVisitor ) return ((AntlrXPathVisitor extends T>)visitor).visitFunction(this);
else return visitor.visitChildren(this);
}
}
public final FunctionContext function() throws RecognitionException {
FunctionContext _localctx = new FunctionContext(_ctx, getState());
enterRule(_localctx, 14, RULE_function);
try {
enterOuterAlt(_localctx, 1);
{
setState(75); match(11);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ArgContext extends ParserRuleContext {
public TerminalNode Number() { return getToken(AntlrXPathParser.Number, 0); }
public ArgContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_arg; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).enterArg(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof AntlrXPathListener ) ((AntlrXPathListener)listener).exitArg(this);
}
@Override
public T accept(ParseTreeVisitor extends T> visitor) {
if ( visitor instanceof AntlrXPathVisitor ) return ((AntlrXPathVisitor extends T>)visitor).visitArg(this);
else return visitor.visitChildren(this);
}
}
public final ArgContext arg() throws RecognitionException {
ArgContext _localctx = new ArgContext(_ctx, getState());
enterRule(_localctx, 16, RULE_arg);
try {
enterOuterAlt(_localctx, 1);
{
setState(77); match(Number);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
case 1: return queryStep_sempred((QueryStepContext)_localctx, predIndex);
}
return true;
}
private boolean queryStep_sempred(QueryStepContext _localctx, int predIndex) {
switch (predIndex) {
case 0: return _input.index() == 0;
}
return true;
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\24R\4\2\t\2\4\3\t"+
"\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\3\2\6\2\26"+
"\n\2\r\2\16\2\27\3\3\3\3\3\3\3\3\3\3\3\3\5\3 \n\3\3\3\3\3\5\3$\n\3\3\3"+
"\3\3\3\3\3\3\3\3\5\3+\n\3\5\3-\n\3\3\3\3\3\5\3\61\n\3\3\3\3\3\3\3\3\3"+
"\3\3\5\38\n\3\5\3:\n\3\3\4\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3\7\3\7\5\7F\n"+
"\7\3\7\3\7\3\7\3\7\3\b\3\b\3\t\3\t\3\n\3\n\3\n\2\2\13\2\4\6\b\n\f\16\20"+
"\22\2\4\5\2\7\7\n\13\16\16\4\2\b\b\17\17R\2\25\3\2\2\2\49\3\2\2\2\6;\3"+
"\2\2\2\b>\3\2\2\2\n@\3\2\2\2\fB\3\2\2\2\16K\3\2\2\2\20M\3\2\2\2\22O\3"+
"\2\2\2\24\26\5\4\3\2\25\24\3\2\2\2\26\27\3\2\2\2\27\25\3\2\2\2\27\30\3"+
"\2\2\2\30\3\3\2\2\2\31\32\7\22\2\2\32\37\5\n\6\2\33\34\7\5\2\2\34\35\5"+
"\f\7\2\35\36\7\3\2\2\36 \3\2\2\2\37\33\3\2\2\2\37 \3\2\2\2 :\3\2\2\2!"+
"#\7\23\2\2\"$\5\6\4\2#\"\3\2\2\2#$\3\2\2\2$,\3\2\2\2%*\5\n\6\2&\'\7\5"+
"\2\2\'(\5\f\7\2()\7\3\2\2)+\3\2\2\2*&\3\2\2\2*+\3\2\2\2+-\3\2\2\2,%\3"+
"\2\2\2,-\3\2\2\2-:\3\2\2\2.\60\6\3\2\2/\61\5\6\4\2\60/\3\2\2\2\60\61\3"+
"\2\2\2\61\62\3\2\2\2\62\67\5\n\6\2\63\64\7\5\2\2\64\65\5\f\7\2\65\66\7"+
"\3\2\2\668\3\2\2\2\67\63\3\2\2\2\678\3\2\2\28:\3\2\2\29\31\3\2\2\29!\3"+
"\2\2\29.\3\2\2\2:\5\3\2\2\2;<\5\b\5\2<=\7\6\2\2=\7\3\2\2\2>?\t\2\2\2?"+
"\t\3\2\2\2@A\t\3\2\2A\13\3\2\2\2BC\5\20\t\2CE\7\t\2\2DF\5\22\n\2ED\3\2"+
"\2\2EF\3\2\2\2FG\3\2\2\2GH\7\4\2\2HI\5\16\b\2IJ\7\21\2\2J\r\3\2\2\2KL"+
"\7\f\2\2L\17\3\2\2\2MN\7\r\2\2N\21\3\2\2\2OP\7\20\2\2P\23\3\2\2\2\13\27"+
"\37#*,\60\679E";
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);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy