EmbASP-CSharp
ASPGrammarParser.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated>
3 // This code was generated by a tool.
4 // ANTLR Version: 4.7
5 //
6 // Changes to this file may cause incorrect behavior and will be lost if
7 // the code is regenerated.
8 // </auto-generated>
9 //------------------------------------------------------------------------------
10 
11 // Generated from ASPGrammar.g4 by ANTLR 4.7
12 
13 // Unreachable code detected
14 #pragma warning disable 0162
15 // The variable '...' is assigned but its value is never used
16 #pragma warning disable 0219
17 // Missing XML comment for publicly visible type or member '...'
18 #pragma warning disable 1591
19 // Ambiguous reference in cref attribute
20 #pragma warning disable 419
21 
22 using System;
23 using System.IO;
24 using System.Text;
25 using System.Diagnostics;
26 using System.Collections.Generic;
27 using Antlr4.Runtime;
28 using Antlr4.Runtime.Atn;
29 using Antlr4.Runtime.Misc;
30 using Antlr4.Runtime.Tree;
31 using DFA = Antlr4.Runtime.Dfa.DFA;
32 
33 [System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.7")]
34 [System.CLSCompliant(false)]
35 public partial class ASPGrammarParser : Parser {
36  protected static DFA[] decisionToDFA;
37  protected static PredictionContextCache sharedContextCache = new PredictionContextCache();
38  public const int
39  T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, IDENTIFIER=6, INTEGER=7, STRING=8,
40  WHITESPACE=9;
41  public const int
42  RULE_output = 0, RULE_predicate_atom = 1, RULE_term = 2;
43  public static readonly string[] ruleNames = {
44  "output", "predicate_atom", "term"
45  };
46 
47  private static readonly string[] _LiteralNames = {
48  null, "'('", "','", "')'", "'['", "']'"
49  };
50  private static readonly string[] _SymbolicNames = {
51  null, null, null, null, null, null, "IDENTIFIER", "INTEGER", "STRING",
52  "WHITESPACE"
53  };
54  public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames);
55 
56  [NotNull]
57  public override IVocabulary Vocabulary
58  {
59  get
60  {
61  return DefaultVocabulary;
62  }
63  }
64 
65  public override string GrammarFileName { get { return "ASPGrammar.g4"; } }
66 
67  public override string[] RuleNames { get { return ruleNames; } }
68 
69  public override string SerializedAtn { get { return new string(_serializedATN); } }
70 
71  static ASPGrammarParser() {
72  decisionToDFA = new DFA[_ATN.NumberOfDecisions];
73  for (int i = 0; i < _ATN.NumberOfDecisions; i++) {
74  decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i);
75  }
76  }
77 
78  public ASPGrammarParser(ITokenStream input) : this(input, Console.Out, Console.Error) { }
79 
80  public ASPGrammarParser(ITokenStream input, TextWriter output, TextWriter errorOutput)
81  : base(input, output, errorOutput)
82  {
83  Interpreter = new ParserATNSimulator(this, _ATN, decisionToDFA, sharedContextCache);
84  }
85  public partial class OutputContext : ParserRuleContext {
86  public Predicate_atomContext[] predicate_atom() {
87  return GetRuleContexts<Predicate_atomContext>();
88  }
89  public Predicate_atomContext predicate_atom(int i) {
90  return GetRuleContext<Predicate_atomContext>(i);
91  }
92  public OutputContext(ParserRuleContext parent, int invokingState)
93  : base(parent, invokingState)
94  {
95  }
96  public override int RuleIndex { get { return RULE_output; } }
97  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
99  if (typedVisitor != null) return typedVisitor.VisitOutput(this);
100  else return visitor.VisitChildren(this);
101  }
102  }
103 
104  [RuleVersion(0)]
105  public OutputContext output() {
106  OutputContext _localctx = new OutputContext(Context, State);
107  EnterRule(_localctx, 0, RULE_output);
108  int _la;
109  try {
110  EnterOuterAlt(_localctx, 1);
111  {
112  State = 9;
113  ErrorHandler.Sync(this);
114  _la = TokenStream.LA(1);
115  while (_la==IDENTIFIER) {
116  {
117  {
118  State = 6; predicate_atom();
119  }
120  }
121  State = 11;
122  ErrorHandler.Sync(this);
123  _la = TokenStream.LA(1);
124  }
125  }
126  }
127  catch (RecognitionException re) {
128  _localctx.exception = re;
129  ErrorHandler.ReportError(this, re);
130  ErrorHandler.Recover(this, re);
131  }
132  finally {
133  ExitRule();
134  }
135  return _localctx;
136  }
137 
138  public partial class Predicate_atomContext : ParserRuleContext {
139  public ITerminalNode IDENTIFIER() { return GetToken(ASPGrammarParser.IDENTIFIER, 0); }
140  public TermContext[] term() {
141  return GetRuleContexts<TermContext>();
142  }
143  public TermContext term(int i) {
144  return GetRuleContext<TermContext>(i);
145  }
146  public Predicate_atomContext(ParserRuleContext parent, int invokingState)
147  : base(parent, invokingState)
148  {
149  }
150  public override int RuleIndex { get { return RULE_predicate_atom; } }
151  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
153  if (typedVisitor != null) return typedVisitor.VisitPredicate_atom(this);
154  else return visitor.VisitChildren(this);
155  }
156  }
157 
158  [RuleVersion(0)]
159  public Predicate_atomContext predicate_atom() {
160  Predicate_atomContext _localctx = new Predicate_atomContext(Context, State);
161  EnterRule(_localctx, 2, RULE_predicate_atom);
162  int _la;
163  try {
164  EnterOuterAlt(_localctx, 1);
165  {
166  State = 12; Match(IDENTIFIER);
167  State = 24;
168  ErrorHandler.Sync(this);
169  _la = TokenStream.LA(1);
170  if (_la==T__0) {
171  {
172  State = 13; Match(T__0);
173  State = 14; term();
174  State = 19;
175  ErrorHandler.Sync(this);
176  _la = TokenStream.LA(1);
177  while (_la==T__1) {
178  {
179  {
180  State = 15; Match(T__1);
181  State = 16; term();
182  }
183  }
184  State = 21;
185  ErrorHandler.Sync(this);
186  _la = TokenStream.LA(1);
187  }
188  State = 22; Match(T__2);
189  }
190  }
191 
192  }
193  }
194  catch (RecognitionException re) {
195  _localctx.exception = re;
196  ErrorHandler.ReportError(this, re);
197  ErrorHandler.Recover(this, re);
198  }
199  finally {
200  ExitRule();
201  }
202  return _localctx;
203  }
204 
205  public partial class TermContext : ParserRuleContext {
206  public ITerminalNode IDENTIFIER() { return GetToken(ASPGrammarParser.IDENTIFIER, 0); }
207  public ITerminalNode INTEGER() { return GetToken(ASPGrammarParser.INTEGER, 0); }
208  public Predicate_atomContext predicate_atom() {
209  return GetRuleContext<Predicate_atomContext>(0);
210  }
211  public TermContext[] term() {
212  return GetRuleContexts<TermContext>();
213  }
214  public TermContext term(int i) {
215  return GetRuleContext<TermContext>(i);
216  }
217  public ITerminalNode STRING() { return GetToken(ASPGrammarParser.STRING, 0); }
218  public TermContext(ParserRuleContext parent, int invokingState)
219  : base(parent, invokingState)
220  {
221  }
222  public override int RuleIndex { get { return RULE_term; } }
223  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
225  if (typedVisitor != null) return typedVisitor.VisitTerm(this);
226  else return visitor.VisitChildren(this);
227  }
228  }
229 
230  [RuleVersion(0)]
231  public TermContext term() {
232  TermContext _localctx = new TermContext(Context, State);
233  EnterRule(_localctx, 4, RULE_term);
234  int _la;
235  try {
236  State = 42;
237  ErrorHandler.Sync(this);
238  switch ( Interpreter.AdaptivePredict(TokenStream,5,Context) ) {
239  case 1:
240  EnterOuterAlt(_localctx, 1);
241  {
242  State = 26; Match(IDENTIFIER);
243  }
244  break;
245  case 2:
246  EnterOuterAlt(_localctx, 2);
247  {
248  State = 27; Match(INTEGER);
249  }
250  break;
251  case 3:
252  EnterOuterAlt(_localctx, 3);
253  {
254  State = 28; predicate_atom();
255  }
256  break;
257  case 4:
258  EnterOuterAlt(_localctx, 4);
259  {
260  State = 29; Match(T__3);
261  State = 38;
262  ErrorHandler.Sync(this);
263  _la = TokenStream.LA(1);
264  if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__3) | (1L << IDENTIFIER) | (1L << INTEGER) | (1L << STRING))) != 0)) {
265  {
266  State = 30; term();
267  State = 35;
268  ErrorHandler.Sync(this);
269  _la = TokenStream.LA(1);
270  while (_la==T__1) {
271  {
272  {
273  State = 31; Match(T__1);
274  State = 32; term();
275  }
276  }
277  State = 37;
278  ErrorHandler.Sync(this);
279  _la = TokenStream.LA(1);
280  }
281  }
282  }
283 
284  State = 40; Match(T__4);
285  }
286  break;
287  case 5:
288  EnterOuterAlt(_localctx, 5);
289  {
290  State = 41; Match(STRING);
291  }
292  break;
293  }
294  }
295  catch (RecognitionException re) {
296  _localctx.exception = re;
297  ErrorHandler.ReportError(this, re);
298  ErrorHandler.Recover(this, re);
299  }
300  finally {
301  ExitRule();
302  }
303  return _localctx;
304  }
305 
306  private static char[] _serializedATN = {
307  '\x3', '\x608B', '\xA72A', '\x8133', '\xB9ED', '\x417C', '\x3BE7', '\x7786',
308  '\x5964', '\x3', '\v', '/', '\x4', '\x2', '\t', '\x2', '\x4', '\x3', '\t',
309  '\x3', '\x4', '\x4', '\t', '\x4', '\x3', '\x2', '\a', '\x2', '\n', '\n',
310  '\x2', '\f', '\x2', '\xE', '\x2', '\r', '\v', '\x2', '\x3', '\x3', '\x3',
311  '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\a', '\x3', '\x14',
312  '\n', '\x3', '\f', '\x3', '\xE', '\x3', '\x17', '\v', '\x3', '\x3', '\x3',
313  '\x3', '\x3', '\x5', '\x3', '\x1B', '\n', '\x3', '\x3', '\x4', '\x3',
314  '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', '\x3',
315  '\x4', '\a', '\x4', '$', '\n', '\x4', '\f', '\x4', '\xE', '\x4', '\'',
316  '\v', '\x4', '\x5', '\x4', ')', '\n', '\x4', '\x3', '\x4', '\x3', '\x4',
317  '\x5', '\x4', '-', '\n', '\x4', '\x3', '\x4', '\x2', '\x2', '\x5', '\x2',
318  '\x4', '\x6', '\x2', '\x2', '\x2', '\x34', '\x2', '\v', '\x3', '\x2',
319  '\x2', '\x2', '\x4', '\xE', '\x3', '\x2', '\x2', '\x2', '\x6', ',', '\x3',
320  '\x2', '\x2', '\x2', '\b', '\n', '\x5', '\x4', '\x3', '\x2', '\t', '\b',
321  '\x3', '\x2', '\x2', '\x2', '\n', '\r', '\x3', '\x2', '\x2', '\x2', '\v',
322  '\t', '\x3', '\x2', '\x2', '\x2', '\v', '\f', '\x3', '\x2', '\x2', '\x2',
323  '\f', '\x3', '\x3', '\x2', '\x2', '\x2', '\r', '\v', '\x3', '\x2', '\x2',
324  '\x2', '\xE', '\x1A', '\a', '\b', '\x2', '\x2', '\xF', '\x10', '\a', '\x3',
325  '\x2', '\x2', '\x10', '\x15', '\x5', '\x6', '\x4', '\x2', '\x11', '\x12',
326  '\a', '\x4', '\x2', '\x2', '\x12', '\x14', '\x5', '\x6', '\x4', '\x2',
327  '\x13', '\x11', '\x3', '\x2', '\x2', '\x2', '\x14', '\x17', '\x3', '\x2',
328  '\x2', '\x2', '\x15', '\x13', '\x3', '\x2', '\x2', '\x2', '\x15', '\x16',
329  '\x3', '\x2', '\x2', '\x2', '\x16', '\x18', '\x3', '\x2', '\x2', '\x2',
330  '\x17', '\x15', '\x3', '\x2', '\x2', '\x2', '\x18', '\x19', '\a', '\x5',
331  '\x2', '\x2', '\x19', '\x1B', '\x3', '\x2', '\x2', '\x2', '\x1A', '\xF',
332  '\x3', '\x2', '\x2', '\x2', '\x1A', '\x1B', '\x3', '\x2', '\x2', '\x2',
333  '\x1B', '\x5', '\x3', '\x2', '\x2', '\x2', '\x1C', '-', '\a', '\b', '\x2',
334  '\x2', '\x1D', '-', '\a', '\t', '\x2', '\x2', '\x1E', '-', '\x5', '\x4',
335  '\x3', '\x2', '\x1F', '(', '\a', '\x6', '\x2', '\x2', ' ', '%', '\x5',
336  '\x6', '\x4', '\x2', '!', '\"', '\a', '\x4', '\x2', '\x2', '\"', '$',
337  '\x5', '\x6', '\x4', '\x2', '#', '!', '\x3', '\x2', '\x2', '\x2', '$',
338  '\'', '\x3', '\x2', '\x2', '\x2', '%', '#', '\x3', '\x2', '\x2', '\x2',
339  '%', '&', '\x3', '\x2', '\x2', '\x2', '&', ')', '\x3', '\x2', '\x2', '\x2',
340  '\'', '%', '\x3', '\x2', '\x2', '\x2', '(', ' ', '\x3', '\x2', '\x2',
341  '\x2', '(', ')', '\x3', '\x2', '\x2', '\x2', ')', '*', '\x3', '\x2', '\x2',
342  '\x2', '*', '-', '\a', '\a', '\x2', '\x2', '+', '-', '\a', '\n', '\x2',
343  '\x2', ',', '\x1C', '\x3', '\x2', '\x2', '\x2', ',', '\x1D', '\x3', '\x2',
344  '\x2', '\x2', ',', '\x1E', '\x3', '\x2', '\x2', '\x2', ',', '\x1F', '\x3',
345  '\x2', '\x2', '\x2', ',', '+', '\x3', '\x2', '\x2', '\x2', '-', '\a',
346  '\x3', '\x2', '\x2', '\x2', '\b', '\v', '\x15', '\x1A', '%', '(', ',',
347  };
348 
349  public static readonly ATN _ATN =
350  new ATNDeserializer().Deserialize(_serializedATN);
351 
352 
353 }
IASPGrammarVisitor.VisitOutput
Result VisitOutput([NotNull] ASPGrammarParser.OutputContext context)
Visit a parse tree produced by ASPGrammarParser.output.
IASPGrammarVisitor.VisitPredicate_atom
Result VisitPredicate_atom([NotNull] ASPGrammarParser.Predicate_atomContext context)
Visit a parse tree produced by ASPGrammarParser.predicate_atom.
IASPGrammarVisitor
This interface defines a complete generic visitor for a parse tree produced by ASPGrammarParser.
Definition: ASPGrammarVisitor.cs:33
base
Definition: Callback.cs:1
IASPGrammarVisitor.VisitTerm
Result VisitTerm([NotNull] ASPGrammarParser.TermContext context)
Visit a parse tree produced by ASPGrammarParser.term.