1 package it.unical.mat.parsers.asp.dlv2;
3 import org.antlr.v4.runtime.atn.*;
4 import org.antlr.v4.runtime.dfa.DFA;
5 import org.antlr.v4.runtime.*;
6 import org.antlr.v4.runtime.misc.*;
7 import org.antlr.v4.runtime.tree.*;
9 import java.util.Iterator;
10 import java.util.ArrayList;
12 @SuppressWarnings({
"all",
"warnings",
"unchecked",
"unused",
"cast"})
14 static { RuntimeMetaData.checkVersion(
"4.7", RuntimeMetaData.VERSION); }
16 protected static final DFA[] _decisionToDFA;
17 protected static final PredictionContextCache _sharedContextCache =
18 new PredictionContextCache();
19 public static final int
20 START=1, COST_LABEL=2, ANY=3, IGNORE=4, AT=5, INTEGER=6, NEW_LINE=7, BLANK_SPACE=8,
21 COMMA=9, INTEGER_CONSTANT=10, IDENTIFIER=11, MODEL_END=12, STRING_CONSTANT=13,
22 TERMS_BEGIN=14, TERMS_END=15, WHITE_SPACE=16;
23 public static final int
24 RULE_answer_set = 0, RULE_cost = 1, RULE_level = 2, RULE_model = 3, RULE_output = 4,
25 RULE_predicate_atom = 5, RULE_term = 6;
26 public static final String[] ruleNames = {
27 "answer_set",
"cost",
"level",
"model",
"output",
"predicate_atom",
"term"
30 private static final String[] _LITERAL_NAMES = {
31 null,
"'{'",
null,
null,
null,
"'@'",
null,
null,
null,
"','",
null,
null,
32 "'}'",
null,
"'('",
"')'"
34 private static final String[] _SYMBOLIC_NAMES = {
35 null,
"START",
"COST_LABEL",
"ANY",
"IGNORE",
"AT",
"INTEGER",
"NEW_LINE",
36 "BLANK_SPACE",
"COMMA",
"INTEGER_CONSTANT",
"IDENTIFIER",
"MODEL_END",
37 "STRING_CONSTANT",
"TERMS_BEGIN",
"TERMS_END",
"WHITE_SPACE"
39 public static final Vocabulary VOCABULARY =
new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
47 tokenNames =
new String[_SYMBOLIC_NAMES.length];
48 for (
int i = 0; i < tokenNames.length; i++) {
49 tokenNames[i] = VOCABULARY.getLiteralName(i);
50 if (tokenNames[i] ==
null) {
51 tokenNames[i] = VOCABULARY.getSymbolicName(i);
54 if (tokenNames[i] ==
null) {
55 tokenNames[i] =
"<INVALID>";
62 public String[] getTokenNames() {
68 public Vocabulary getVocabulary() {
73 public String getGrammarFileName() {
return "DLV2Parser.g4"; }
76 public String[] getRuleNames() {
return ruleNames; }
79 public String getSerializedATN() {
return _serializedATN; }
82 public ATN getATN() {
return _ATN; }
84 public DLV2Parser(TokenStream input) {
86 _interp =
new ParserATNSimulator(
this,_ATN,_decisionToDFA,_sharedContextCache);
88 public static class Answer_setContext
extends ParserRuleContext {
89 public TerminalNode START() {
return getToken(DLV2Parser.START, 0); }
90 public ModelContext model() {
91 return getRuleContext(ModelContext.class,0);
93 public CostContext cost() {
94 return getRuleContext(CostContext.class,0);
96 public Answer_setContext(ParserRuleContext parent,
int invokingState) {
97 super(parent, invokingState);
99 @Override
public int getRuleIndex() {
return RULE_answer_set; }
101 public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
102 if ( visitor instanceof DLV2ParserVisitor )
return ((DLV2ParserVisitor<? extends T>)visitor).visitAnswer_set(
this);
103 else return visitor.visitChildren(
this);
107 public final Answer_setContext answer_set() throws RecognitionException {
108 Answer_setContext _localctx =
new Answer_setContext(_ctx, getState());
109 enterRule(_localctx, 0, RULE_answer_set);
112 enterOuterAlt(_localctx, 1);
119 _errHandler.sync(
this);
121 if (_la==COST_LABEL) {
130 catch (RecognitionException re) {
131 _localctx.exception = re;
132 _errHandler.reportError(
this, re);
133 _errHandler.recover(
this, re);
141 public static class CostContext
extends ParserRuleContext {
142 public TerminalNode COST_LABEL() {
return getToken(DLV2Parser.COST_LABEL, 0); }
143 public TerminalNode NEW_LINE() {
return getToken(DLV2Parser.NEW_LINE, 0); }
144 public List<LevelContext> level() {
145 return getRuleContexts(LevelContext.class);
147 public LevelContext level(
int i) {
148 return getRuleContext(LevelContext.class,i);
150 public CostContext(ParserRuleContext parent,
int invokingState) {
151 super(parent, invokingState);
153 @Override
public int getRuleIndex() {
return RULE_cost; }
155 public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
156 if ( visitor instanceof DLV2ParserVisitor )
return ((DLV2ParserVisitor<? extends T>)visitor).visitCost(
this);
157 else return visitor.visitChildren(
this);
161 public final CostContext cost() throws RecognitionException {
162 CostContext _localctx =
new CostContext(_ctx, getState());
163 enterRule(_localctx, 2, RULE_cost);
166 enterOuterAlt(_localctx, 1);
171 _errHandler.sync(
this);
173 while (_la==INTEGER) {
181 _errHandler.sync(
this);
188 catch (RecognitionException re) {
189 _localctx.exception = re;
190 _errHandler.reportError(
this, re);
191 _errHandler.recover(
this, re);
199 public static class LevelContext
extends ParserRuleContext {
200 public List<TerminalNode> INTEGER() {
return getTokens(DLV2Parser.INTEGER); }
201 public TerminalNode INTEGER(
int i) {
202 return getToken(DLV2Parser.INTEGER, i);
204 public TerminalNode AT() {
return getToken(DLV2Parser.AT, 0); }
205 public LevelContext(ParserRuleContext parent,
int invokingState) {
206 super(parent, invokingState);
208 @Override
public int getRuleIndex() {
return RULE_level; }
210 public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
211 if ( visitor instanceof DLV2ParserVisitor )
return ((DLV2ParserVisitor<? extends T>)visitor).visitLevel(
this);
212 else return visitor.visitChildren(
this);
216 public final LevelContext level() throws RecognitionException {
217 LevelContext _localctx =
new LevelContext(_ctx, getState());
218 enterRule(_localctx, 4, RULE_level);
220 enterOuterAlt(_localctx, 1);
230 catch (RecognitionException re) {
231 _localctx.exception = re;
232 _errHandler.reportError(
this, re);
233 _errHandler.recover(
this, re);
241 public static class ModelContext
extends ParserRuleContext {
242 public TerminalNode MODEL_END() {
return getToken(DLV2Parser.MODEL_END, 0); }
243 public List<Predicate_atomContext> predicate_atom() {
244 return getRuleContexts(Predicate_atomContext.class);
246 public Predicate_atomContext predicate_atom(
int i) {
247 return getRuleContext(Predicate_atomContext.class,i);
249 public List<TerminalNode> COMMA() {
return getTokens(DLV2Parser.COMMA); }
250 public TerminalNode COMMA(
int i) {
251 return getToken(DLV2Parser.COMMA, i);
253 public ModelContext(ParserRuleContext parent,
int invokingState) {
254 super(parent, invokingState);
256 @Override
public int getRuleIndex() {
return RULE_model; }
258 public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
259 if ( visitor instanceof DLV2ParserVisitor )
return ((DLV2ParserVisitor<? extends T>)visitor).visitModel(
this);
260 else return visitor.visitChildren(
this);
264 public final ModelContext model() throws RecognitionException {
265 ModelContext _localctx =
new ModelContext(_ctx, getState());
266 enterRule(_localctx, 6, RULE_model);
269 enterOuterAlt(_localctx, 1);
272 _errHandler.sync(
this);
274 if (_la==IDENTIFIER) {
279 _errHandler.sync(
this);
291 _errHandler.sync(
this);
301 catch (RecognitionException re) {
302 _localctx.exception = re;
303 _errHandler.reportError(
this, re);
304 _errHandler.recover(
this, re);
312 public static class OutputContext
extends ParserRuleContext {
313 public List<Answer_setContext> answer_set() {
314 return getRuleContexts(Answer_setContext.class);
316 public Answer_setContext answer_set(
int i) {
317 return getRuleContext(Answer_setContext.class,i);
319 public OutputContext(ParserRuleContext parent,
int invokingState) {
320 super(parent, invokingState);
322 @Override
public int getRuleIndex() {
return RULE_output; }
324 public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
325 if ( visitor instanceof DLV2ParserVisitor )
return ((DLV2ParserVisitor<? extends T>)visitor).visitOutput(
this);
326 else return visitor.visitChildren(
this);
330 public final OutputContext output() throws RecognitionException {
331 OutputContext _localctx =
new OutputContext(_ctx, getState());
332 enterRule(_localctx, 8, RULE_output);
335 enterOuterAlt(_localctx, 1);
338 _errHandler.sync(
this);
348 _errHandler.sync(
this);
353 catch (RecognitionException re) {
354 _localctx.exception = re;
355 _errHandler.reportError(
this, re);
356 _errHandler.recover(
this, re);
364 public static class Predicate_atomContext
extends ParserRuleContext {
365 public TerminalNode IDENTIFIER() {
return getToken(DLV2Parser.IDENTIFIER, 0); }
366 public TerminalNode TERMS_BEGIN() {
return getToken(DLV2Parser.TERMS_BEGIN, 0); }
367 public List<TermContext> term() {
368 return getRuleContexts(TermContext.class);
370 public TermContext term(
int i) {
371 return getRuleContext(TermContext.class,i);
373 public TerminalNode TERMS_END() {
return getToken(DLV2Parser.TERMS_END, 0); }
374 public List<TerminalNode> COMMA() {
return getTokens(DLV2Parser.COMMA); }
375 public TerminalNode COMMA(
int i) {
376 return getToken(DLV2Parser.COMMA, i);
378 public Predicate_atomContext(ParserRuleContext parent,
int invokingState) {
379 super(parent, invokingState);
381 @Override
public int getRuleIndex() {
return RULE_predicate_atom; }
383 public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
384 if ( visitor instanceof DLV2ParserVisitor )
return ((DLV2ParserVisitor<? extends T>)visitor).visitPredicate_atom(
this);
385 else return visitor.visitChildren(
this);
389 public final Predicate_atomContext predicate_atom() throws RecognitionException {
390 Predicate_atomContext _localctx =
new Predicate_atomContext(_ctx, getState());
391 enterRule(_localctx, 10, RULE_predicate_atom);
394 enterOuterAlt(_localctx, 1);
399 _errHandler.sync(
this);
401 if (_la==TERMS_BEGIN) {
408 _errHandler.sync(
this);
420 _errHandler.sync(
this);
430 catch (RecognitionException re) {
431 _localctx.exception = re;
432 _errHandler.reportError(
this, re);
433 _errHandler.recover(
this, re);
441 public static class TermContext
extends ParserRuleContext {
442 public TerminalNode IDENTIFIER() {
return getToken(DLV2Parser.IDENTIFIER, 0); }
443 public TerminalNode INTEGER_CONSTANT() {
return getToken(DLV2Parser.INTEGER_CONSTANT, 0); }
444 public Predicate_atomContext predicate_atom() {
445 return getRuleContext(Predicate_atomContext.class,0);
447 public TerminalNode STRING_CONSTANT() {
return getToken(DLV2Parser.STRING_CONSTANT, 0); }
448 public TermContext(ParserRuleContext parent,
int invokingState) {
449 super(parent, invokingState);
451 @Override
public int getRuleIndex() {
return RULE_term; }
453 public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
454 if ( visitor instanceof DLV2ParserVisitor )
return ((DLV2ParserVisitor<? extends T>)visitor).visitTerm(
this);
455 else return visitor.visitChildren(
this);
459 public final TermContext term() throws RecognitionException {
460 TermContext _localctx =
new TermContext(_ctx, getState());
461 enterRule(_localctx, 12, RULE_term);
464 _errHandler.sync(
this);
465 switch ( getInterpreter().adaptivePredict(_input,7,_ctx) ) {
467 enterOuterAlt(_localctx, 1);
474 enterOuterAlt(_localctx, 2);
477 match(INTEGER_CONSTANT);
481 enterOuterAlt(_localctx, 3);
488 enterOuterAlt(_localctx, 4);
491 match(STRING_CONSTANT);
496 catch (RecognitionException re) {
497 _localctx.exception = re;
498 _errHandler.reportError(
this, re);
499 _errHandler.recover(
this, re);
507 public static final String _serializedATN =
508 "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\22I\4\2\t\2\4\3\t"+
509 "\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\3\2\3\2\3\2\5\2\24\n\2\3\3"+
510 "\3\3\7\3\30\n\3\f\3\16\3\33\13\3\3\3\3\3\3\4\3\4\3\4\3\4\3\5\3\5\3\5\7"+
511 "\5&\n\5\f\5\16\5)\13\5\5\5+\n\5\3\5\3\5\3\6\7\6\60\n\6\f\6\16\6\63\13"+
512 "\6\3\7\3\7\3\7\3\7\3\7\7\7:\n\7\f\7\16\7=\13\7\3\7\3\7\5\7A\n\7\3\b\3"+
513 "\b\3\b\3\b\5\bG\n\b\3\b\2\2\t\2\4\6\b\n\f\16\2\2\2K\2\20\3\2\2\2\4\25"+
514 "\3\2\2\2\6\36\3\2\2\2\b*\3\2\2\2\n\61\3\2\2\2\f\64\3\2\2\2\16F\3\2\2\2"+
515 "\20\21\7\3\2\2\21\23\5\b\5\2\22\24\5\4\3\2\23\22\3\2\2\2\23\24\3\2\2\2"+
516 "\24\3\3\2\2\2\25\31\7\4\2\2\26\30\5\6\4\2\27\26\3\2\2\2\30\33\3\2\2\2"+
517 "\31\27\3\2\2\2\31\32\3\2\2\2\32\34\3\2\2\2\33\31\3\2\2\2\34\35\7\t\2\2"+
518 "\35\5\3\2\2\2\36\37\7\b\2\2\37 \7\7\2\2 !\7\b\2\2!\7\3\2\2\2\"\'\5\f\7"+
519 "\2#$\7\13\2\2$&\5\f\7\2%#\3\2\2\2&)\3\2\2\2\'%\3\2\2\2\'(\3\2\2\2(+\3"+
520 "\2\2\2)\'\3\2\2\2*\"\3\2\2\2*+\3\2\2\2+,\3\2\2\2,-\7\16\2\2-\t\3\2\2\2"+
521 ".\60\5\2\2\2/.\3\2\2\2\60\63\3\2\2\2\61/\3\2\2\2\61\62\3\2\2\2\62\13\3"+
522 "\2\2\2\63\61\3\2\2\2\64@\7\r\2\2\65\66\7\20\2\2\66;\5\16\b\2\678\7\13"+
523 "\2\28:\5\16\b\29\67\3\2\2\2:=\3\2\2\2;9\3\2\2\2;<\3\2\2\2<>\3\2\2\2=;"+
524 "\3\2\2\2>?\7\21\2\2?A\3\2\2\2@\65\3\2\2\2@A\3\2\2\2A\r\3\2\2\2BG\7\r\2"+
525 "\2CG\7\f\2\2DG\5\f\7\2EG\7\17\2\2FB\3\2\2\2FC\3\2\2\2FD\3\2\2\2FE\3\2"+
526 "\2\2G\17\3\2\2\2\n\23\31\'*\61;@F";
527 public static final ATN _ATN =
528 new ATNDeserializer().deserialize(_serializedATN.toCharArray());
530 _decisionToDFA =
new DFA[_ATN.getNumberOfDecisions()];
531 for (
int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
532 _decisionToDFA[i] =
new DFA(_ATN.getDecisionState(i), i);