EmbASP-Java
ASPGrammarParser.java
1 package it.unical.mat.parsers.asp.asp_parser_base;
2 
3 // Generated from ASPGrammar.g4 by ANTLR 4.7
4 import org.antlr.v4.runtime.atn.*;
5 import org.antlr.v4.runtime.dfa.DFA;
6 import org.antlr.v4.runtime.*;
7 import org.antlr.v4.runtime.misc.*;
8 import org.antlr.v4.runtime.tree.*;
9 import java.util.List;
10 import java.util.Iterator;
11 import java.util.ArrayList;
12 
13 @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
14 public class ASPGrammarParser extends Parser {
15  static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); }
16 
17  protected static final DFA[] _decisionToDFA;
18  protected static final PredictionContextCache _sharedContextCache =
19  new PredictionContextCache();
20  public static final int
21  T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, IDENTIFIER=6, INTEGER=7, STRING=8,
22  WHITESPACE=9;
23  public static final int
24  RULE_output = 0, RULE_predicate_atom = 1, RULE_term = 2;
25  public static final String[] ruleNames = {
26  "output", "predicate_atom", "term"
27  };
28 
29  private static final String[] _LITERAL_NAMES = {
30  null, "'('", "','", "')'", "'['", "']'"
31  };
32  private static final String[] _SYMBOLIC_NAMES = {
33  null, null, null, null, null, null, "IDENTIFIER", "INTEGER", "STRING",
34  "WHITESPACE"
35  };
36  public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
37 
41  @Deprecated
42  public static final String[] tokenNames;
43  static {
44  tokenNames = new String[_SYMBOLIC_NAMES.length];
45  for (int i = 0; i < tokenNames.length; i++) {
46  tokenNames[i] = VOCABULARY.getLiteralName(i);
47  if (tokenNames[i] == null) {
48  tokenNames[i] = VOCABULARY.getSymbolicName(i);
49  }
50 
51  if (tokenNames[i] == null) {
52  tokenNames[i] = "<INVALID>";
53  }
54  }
55  }
56 
57  @Override
58  @Deprecated
59  public String[] getTokenNames() {
60  return tokenNames;
61  }
62 
63  @Override
64 
65  public Vocabulary getVocabulary() {
66  return VOCABULARY;
67  }
68 
69  @Override
70  public String getGrammarFileName() { return "ASPGrammar.g4"; }
71 
72  @Override
73  public String[] getRuleNames() { return ruleNames; }
74 
75  @Override
76  public String getSerializedATN() { return _serializedATN; }
77 
78  @Override
79  public ATN getATN() { return _ATN; }
80 
81  public ASPGrammarParser(TokenStream input) {
82  super(input);
83  _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
84  }
85  public static class OutputContext extends ParserRuleContext {
86  public List<Predicate_atomContext> predicate_atom() {
87  return getRuleContexts(Predicate_atomContext.class);
88  }
89  public Predicate_atomContext predicate_atom(int i) {
90  return getRuleContext(Predicate_atomContext.class,i);
91  }
92  public OutputContext(ParserRuleContext parent, int invokingState) {
93  super(parent, invokingState);
94  }
95  @Override public int getRuleIndex() { return RULE_output; }
96  @Override
97  public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
98  if ( visitor instanceof ASPGrammarVisitor ) return ((ASPGrammarVisitor<? extends T>)visitor).visitOutput(this);
99  else return visitor.visitChildren(this);
100  }
101  }
102 
103  public final OutputContext output() throws RecognitionException {
104  OutputContext _localctx = new OutputContext(_ctx, getState());
105  enterRule(_localctx, 0, RULE_output);
106  int _la;
107  try {
108  enterOuterAlt(_localctx, 1);
109  {
110  setState(9);
111  _errHandler.sync(this);
112  _la = _input.LA(1);
113  while (_la==IDENTIFIER) {
114  {
115  {
116  setState(6);
117  predicate_atom();
118  }
119  }
120  setState(11);
121  _errHandler.sync(this);
122  _la = _input.LA(1);
123  }
124  }
125  }
126  catch (RecognitionException re) {
127  _localctx.exception = re;
128  _errHandler.reportError(this, re);
129  _errHandler.recover(this, re);
130  }
131  finally {
132  exitRule();
133  }
134  return _localctx;
135  }
136 
137  public static class Predicate_atomContext extends ParserRuleContext {
138  public TerminalNode IDENTIFIER() { return getToken(ASPGrammarParser.IDENTIFIER, 0); }
139  public List<TermContext> term() {
140  return getRuleContexts(TermContext.class);
141  }
142  public TermContext term(int i) {
143  return getRuleContext(TermContext.class,i);
144  }
145  public Predicate_atomContext(ParserRuleContext parent, int invokingState) {
146  super(parent, invokingState);
147  }
148  @Override public int getRuleIndex() { return RULE_predicate_atom; }
149  @Override
150  public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
151  if ( visitor instanceof ASPGrammarVisitor ) return ((ASPGrammarVisitor<? extends T>)visitor).visitPredicate_atom(this);
152  else return visitor.visitChildren(this);
153  }
154  }
155 
156  public final Predicate_atomContext predicate_atom() throws RecognitionException {
157  Predicate_atomContext _localctx = new Predicate_atomContext(_ctx, getState());
158  enterRule(_localctx, 2, RULE_predicate_atom);
159  int _la;
160  try {
161  enterOuterAlt(_localctx, 1);
162  {
163  setState(12);
164  match(IDENTIFIER);
165  setState(24);
166  _errHandler.sync(this);
167  _la = _input.LA(1);
168  if (_la==T__0) {
169  {
170  setState(13);
171  match(T__0);
172  setState(14);
173  term();
174  setState(19);
175  _errHandler.sync(this);
176  _la = _input.LA(1);
177  while (_la==T__1) {
178  {
179  {
180  setState(15);
181  match(T__1);
182  setState(16);
183  term();
184  }
185  }
186  setState(21);
187  _errHandler.sync(this);
188  _la = _input.LA(1);
189  }
190  setState(22);
191  match(T__2);
192  }
193  }
194 
195  }
196  }
197  catch (RecognitionException re) {
198  _localctx.exception = re;
199  _errHandler.reportError(this, re);
200  _errHandler.recover(this, re);
201  }
202  finally {
203  exitRule();
204  }
205  return _localctx;
206  }
207 
208  public static class TermContext extends ParserRuleContext {
209  public TerminalNode IDENTIFIER() { return getToken(ASPGrammarParser.IDENTIFIER, 0); }
210  public TerminalNode INTEGER() { return getToken(ASPGrammarParser.INTEGER, 0); }
211  public Predicate_atomContext predicate_atom() {
212  return getRuleContext(Predicate_atomContext.class,0);
213  }
214  public List<TermContext> term() {
215  return getRuleContexts(TermContext.class);
216  }
217  public TermContext term(int i) {
218  return getRuleContext(TermContext.class,i);
219  }
220  public TerminalNode STRING() { return getToken(ASPGrammarParser.STRING, 0); }
221  public TermContext(ParserRuleContext parent, int invokingState) {
222  super(parent, invokingState);
223  }
224  @Override public int getRuleIndex() { return RULE_term; }
225  @Override
226  public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
227  if ( visitor instanceof ASPGrammarVisitor ) return ((ASPGrammarVisitor<? extends T>)visitor).visitTerm(this);
228  else return visitor.visitChildren(this);
229  }
230  }
231 
232  public final TermContext term() throws RecognitionException {
233  TermContext _localctx = new TermContext(_ctx, getState());
234  enterRule(_localctx, 4, RULE_term);
235  int _la;
236  try {
237  setState(42);
238  _errHandler.sync(this);
239  switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) {
240  case 1:
241  enterOuterAlt(_localctx, 1);
242  {
243  setState(26);
244  match(IDENTIFIER);
245  }
246  break;
247  case 2:
248  enterOuterAlt(_localctx, 2);
249  {
250  setState(27);
251  match(INTEGER);
252  }
253  break;
254  case 3:
255  enterOuterAlt(_localctx, 3);
256  {
257  setState(28);
258  predicate_atom();
259  }
260  break;
261  case 4:
262  enterOuterAlt(_localctx, 4);
263  {
264  setState(29);
265  match(T__3);
266  setState(38);
267  _errHandler.sync(this);
268  _la = _input.LA(1);
269  if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__3) | (1L << IDENTIFIER) | (1L << INTEGER) | (1L << STRING))) != 0)) {
270  {
271  setState(30);
272  term();
273  setState(35);
274  _errHandler.sync(this);
275  _la = _input.LA(1);
276  while (_la==T__1) {
277  {
278  {
279  setState(31);
280  match(T__1);
281  setState(32);
282  term();
283  }
284  }
285  setState(37);
286  _errHandler.sync(this);
287  _la = _input.LA(1);
288  }
289  }
290  }
291 
292  setState(40);
293  match(T__4);
294  }
295  break;
296  case 5:
297  enterOuterAlt(_localctx, 5);
298  {
299  setState(41);
300  match(STRING);
301  }
302  break;
303  }
304  }
305  catch (RecognitionException re) {
306  _localctx.exception = re;
307  _errHandler.reportError(this, re);
308  _errHandler.recover(this, re);
309  }
310  finally {
311  exitRule();
312  }
313  return _localctx;
314  }
315 
316  public static final String _serializedATN =
317  "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\13/\4\2\t\2\4\3\t"+
318  "\3\4\4\t\4\3\2\7\2\n\n\2\f\2\16\2\r\13\2\3\3\3\3\3\3\3\3\3\3\7\3\24\n"+
319  "\3\f\3\16\3\27\13\3\3\3\3\3\5\3\33\n\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\7\4"+
320  "$\n\4\f\4\16\4\'\13\4\5\4)\n\4\3\4\3\4\5\4-\n\4\3\4\2\2\5\2\4\6\2\2\2"+
321  "\64\2\13\3\2\2\2\4\16\3\2\2\2\6,\3\2\2\2\b\n\5\4\3\2\t\b\3\2\2\2\n\r\3"+
322  "\2\2\2\13\t\3\2\2\2\13\f\3\2\2\2\f\3\3\2\2\2\r\13\3\2\2\2\16\32\7\b\2"+
323  "\2\17\20\7\3\2\2\20\25\5\6\4\2\21\22\7\4\2\2\22\24\5\6\4\2\23\21\3\2\2"+
324  "\2\24\27\3\2\2\2\25\23\3\2\2\2\25\26\3\2\2\2\26\30\3\2\2\2\27\25\3\2\2"+
325  "\2\30\31\7\5\2\2\31\33\3\2\2\2\32\17\3\2\2\2\32\33\3\2\2\2\33\5\3\2\2"+
326  "\2\34-\7\b\2\2\35-\7\t\2\2\36-\5\4\3\2\37(\7\6\2\2 %\5\6\4\2!\"\7\4\2"+
327  "\2\"$\5\6\4\2#!\3\2\2\2$\'\3\2\2\2%#\3\2\2\2%&\3\2\2\2&)\3\2\2\2\'%\3"+
328  "\2\2\2( \3\2\2\2()\3\2\2\2)*\3\2\2\2*-\7\7\2\2+-\7\n\2\2,\34\3\2\2\2,"+
329  "\35\3\2\2\2,\36\3\2\2\2,\37\3\2\2\2,+\3\2\2\2-\7\3\2\2\2\b\13\25\32%("+
330  ",";
331  public static final ATN _ATN =
332  new ATNDeserializer().deserialize(_serializedATN.toCharArray());
333  static {
334  _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
335  for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
336  _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
337  }
338  }
339 }
it.unical.mat.parsers.asp.asp_parser_base.ASPGrammarParser
Definition: ASPGrammarParser.java:14
it.unical.mat.parsers.asp.asp_parser_base.ASPGrammarParser.tokenNames
static final String[] tokenNames
Definition: ASPGrammarParser.java:42