EmbASP-CSharp
SPDGrammarParser.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 SPDGrammar.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 SPDGrammarParser : 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, T__5=6, T__6=7, BOOLEAN=8, INTEGER=9,
40  STRING=10, WHITE_SPACE=11;
41  public const int
42  RULE_array = 0, RULE_json = 1, RULE_oBjEcT = 2, RULE_pair = 3, RULE_value = 4;
43  public static readonly string[] ruleNames = {
44  "array", "json", "oBjEcT", "pair", "value"
45  };
46 
47  private static readonly string[] _LiteralNames = {
48  null, "'['", "','", "']'", "'{'", "'}'", "':'", "'null'"
49  };
50  private static readonly string[] _SymbolicNames = {
51  null, null, null, null, null, null, null, null, "BOOLEAN", "INTEGER",
52  "STRING", "WHITE_SPACE"
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 "SPDGrammar.g4"; } }
66 
67  public override string[] RuleNames { get { return ruleNames; } }
68 
69  public override string SerializedAtn { get { return new string(_serializedATN); } }
70 
71  static SPDGrammarParser() {
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 SPDGrammarParser(ITokenStream input) : this(input, Console.Out, Console.Error) { }
79 
80  public SPDGrammarParser(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 ArrayContext : ParserRuleContext {
86  public ValueContext[] value() {
87  return GetRuleContexts<ValueContext>();
88  }
89  public ValueContext value(int i) {
90  return GetRuleContext<ValueContext>(i);
91  }
92  public ArrayContext(ParserRuleContext parent, int invokingState)
93  : base(parent, invokingState)
94  {
95  }
96  public override int RuleIndex { get { return RULE_array; } }
97  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
99  if (typedVisitor != null) return typedVisitor.VisitArray(this);
100  else return visitor.VisitChildren(this);
101  }
102  }
103 
104  [RuleVersion(0)]
105  public ArrayContext array() {
106  ArrayContext _localctx = new ArrayContext(Context, State);
107  EnterRule(_localctx, 0, RULE_array);
108  int _la;
109  try {
110  EnterOuterAlt(_localctx, 1);
111  {
112  State = 10; Match(T__0);
113  State = 11; value();
114  State = 16;
115  ErrorHandler.Sync(this);
116  _la = TokenStream.LA(1);
117  while (_la==T__1) {
118  {
119  {
120  State = 12; Match(T__1);
121  State = 13; value();
122  }
123  }
124  State = 18;
125  ErrorHandler.Sync(this);
126  _la = TokenStream.LA(1);
127  }
128  State = 19; Match(T__2);
129  }
130  }
131  catch (RecognitionException re) {
132  _localctx.exception = re;
133  ErrorHandler.ReportError(this, re);
134  ErrorHandler.Recover(this, re);
135  }
136  finally {
137  ExitRule();
138  }
139  return _localctx;
140  }
141 
142  public partial class JsonContext : ParserRuleContext {
143  public ValueContext[] value() {
144  return GetRuleContexts<ValueContext>();
145  }
146  public ValueContext value(int i) {
147  return GetRuleContext<ValueContext>(i);
148  }
149  public JsonContext(ParserRuleContext parent, int invokingState)
150  : base(parent, invokingState)
151  {
152  }
153  public override int RuleIndex { get { return RULE_json; } }
154  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
156  if (typedVisitor != null) return typedVisitor.VisitJson(this);
157  else return visitor.VisitChildren(this);
158  }
159  }
160 
161  [RuleVersion(0)]
162  public JsonContext json() {
163  JsonContext _localctx = new JsonContext(Context, State);
164  EnterRule(_localctx, 2, RULE_json);
165  int _la;
166  try {
167  EnterOuterAlt(_localctx, 1);
168  {
169  State = 24;
170  ErrorHandler.Sync(this);
171  _la = TokenStream.LA(1);
172  while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__3) | (1L << T__6) | (1L << BOOLEAN) | (1L << INTEGER) | (1L << STRING))) != 0)) {
173  {
174  {
175  State = 21; value();
176  }
177  }
178  State = 26;
179  ErrorHandler.Sync(this);
180  _la = TokenStream.LA(1);
181  }
182  }
183  }
184  catch (RecognitionException re) {
185  _localctx.exception = re;
186  ErrorHandler.ReportError(this, re);
187  ErrorHandler.Recover(this, re);
188  }
189  finally {
190  ExitRule();
191  }
192  return _localctx;
193  }
194 
195  public partial class OBjEcTContext : ParserRuleContext {
196  public PairContext[] pair() {
197  return GetRuleContexts<PairContext>();
198  }
199  public PairContext pair(int i) {
200  return GetRuleContext<PairContext>(i);
201  }
202  public OBjEcTContext(ParserRuleContext parent, int invokingState)
203  : base(parent, invokingState)
204  {
205  }
206  public override int RuleIndex { get { return RULE_oBjEcT; } }
207  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
209  if (typedVisitor != null) return typedVisitor.VisitOBjEcT(this);
210  else return visitor.VisitChildren(this);
211  }
212  }
213 
214  [RuleVersion(0)]
215  public OBjEcTContext oBjEcT() {
216  OBjEcTContext _localctx = new OBjEcTContext(Context, State);
217  EnterRule(_localctx, 4, RULE_oBjEcT);
218  int _la;
219  try {
220  State = 40;
221  ErrorHandler.Sync(this);
222  switch ( Interpreter.AdaptivePredict(TokenStream,3,Context) ) {
223  case 1:
224  EnterOuterAlt(_localctx, 1);
225  {
226  State = 27; Match(T__3);
227  State = 28; pair();
228  State = 33;
229  ErrorHandler.Sync(this);
230  _la = TokenStream.LA(1);
231  while (_la==T__1) {
232  {
233  {
234  State = 29; Match(T__1);
235  State = 30; pair();
236  }
237  }
238  State = 35;
239  ErrorHandler.Sync(this);
240  _la = TokenStream.LA(1);
241  }
242  State = 36; Match(T__4);
243  }
244  break;
245  case 2:
246  EnterOuterAlt(_localctx, 2);
247  {
248  State = 38; Match(T__3);
249  State = 39; Match(T__4);
250  }
251  break;
252  }
253  }
254  catch (RecognitionException re) {
255  _localctx.exception = re;
256  ErrorHandler.ReportError(this, re);
257  ErrorHandler.Recover(this, re);
258  }
259  finally {
260  ExitRule();
261  }
262  return _localctx;
263  }
264 
265  public partial class PairContext : ParserRuleContext {
266  public ITerminalNode STRING() { return GetToken(SPDGrammarParser.STRING, 0); }
267  public ValueContext value() {
268  return GetRuleContext<ValueContext>(0);
269  }
270  public PairContext(ParserRuleContext parent, int invokingState)
271  : base(parent, invokingState)
272  {
273  }
274  public override int RuleIndex { get { return RULE_pair; } }
275  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
277  if (typedVisitor != null) return typedVisitor.VisitPair(this);
278  else return visitor.VisitChildren(this);
279  }
280  }
281 
282  [RuleVersion(0)]
283  public PairContext pair() {
284  PairContext _localctx = new PairContext(Context, State);
285  EnterRule(_localctx, 6, RULE_pair);
286  try {
287  EnterOuterAlt(_localctx, 1);
288  {
289  State = 42; Match(STRING);
290  State = 43; Match(T__5);
291  State = 44; value();
292  }
293  }
294  catch (RecognitionException re) {
295  _localctx.exception = re;
296  ErrorHandler.ReportError(this, re);
297  ErrorHandler.Recover(this, re);
298  }
299  finally {
300  ExitRule();
301  }
302  return _localctx;
303  }
304 
305  public partial class ValueContext : ParserRuleContext {
306  public ValueContext(ParserRuleContext parent, int invokingState)
307  : base(parent, invokingState)
308  {
309  }
310  public override int RuleIndex { get { return RULE_value; } }
311 
312  public ValueContext() { }
313  public virtual void CopyFrom(ValueContext context) {
314  base.CopyFrom(context);
315  }
316  }
317  public partial class NullValueContext : ValueContext {
318  public NullValueContext(ValueContext context) { CopyFrom(context); }
319  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
321  if (typedVisitor != null) return typedVisitor.VisitNullValue(this);
322  else return visitor.VisitChildren(this);
323  }
324  }
325  public partial class ObjectValueContext : ValueContext {
326  public OBjEcTContext oBjEcT() {
327  return GetRuleContext<OBjEcTContext>(0);
328  }
329  public ObjectValueContext(ValueContext context) { CopyFrom(context); }
330  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
332  if (typedVisitor != null) return typedVisitor.VisitObjectValue(this);
333  else return visitor.VisitChildren(this);
334  }
335  }
336  public partial class BooleanValueContext : ValueContext {
337  public ITerminalNode BOOLEAN() { return GetToken(SPDGrammarParser.BOOLEAN, 0); }
338  public BooleanValueContext(ValueContext context) { CopyFrom(context); }
339  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
341  if (typedVisitor != null) return typedVisitor.VisitBooleanValue(this);
342  else return visitor.VisitChildren(this);
343  }
344  }
345  public partial class IntegerValueContext : ValueContext {
346  public ITerminalNode INTEGER() { return GetToken(SPDGrammarParser.INTEGER, 0); }
347  public IntegerValueContext(ValueContext context) { CopyFrom(context); }
348  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
350  if (typedVisitor != null) return typedVisitor.VisitIntegerValue(this);
351  else return visitor.VisitChildren(this);
352  }
353  }
354  public partial class StringValueContext : ValueContext {
355  public ITerminalNode STRING() { return GetToken(SPDGrammarParser.STRING, 0); }
356  public StringValueContext(ValueContext context) { CopyFrom(context); }
357  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
359  if (typedVisitor != null) return typedVisitor.VisitStringValue(this);
360  else return visitor.VisitChildren(this);
361  }
362  }
363  public partial class ArrayValueContext : ValueContext {
364  public ArrayContext array() {
365  return GetRuleContext<ArrayContext>(0);
366  }
367  public ArrayValueContext(ValueContext context) { CopyFrom(context); }
368  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
370  if (typedVisitor != null) return typedVisitor.VisitArrayValue(this);
371  else return visitor.VisitChildren(this);
372  }
373  }
374 
375  [RuleVersion(0)]
376  public ValueContext value() {
377  ValueContext _localctx = new ValueContext(Context, State);
378  EnterRule(_localctx, 8, RULE_value);
379  try {
380  State = 52;
381  ErrorHandler.Sync(this);
382  switch (TokenStream.LA(1)) {
383  case T__0:
384  _localctx = new ArrayValueContext(_localctx);
385  EnterOuterAlt(_localctx, 1);
386  {
387  State = 46; array();
388  }
389  break;
390  case BOOLEAN:
391  _localctx = new BooleanValueContext(_localctx);
392  EnterOuterAlt(_localctx, 2);
393  {
394  State = 47; Match(BOOLEAN);
395  }
396  break;
397  case INTEGER:
398  _localctx = new IntegerValueContext(_localctx);
399  EnterOuterAlt(_localctx, 3);
400  {
401  State = 48; Match(INTEGER);
402  }
403  break;
404  case T__6:
405  _localctx = new NullValueContext(_localctx);
406  EnterOuterAlt(_localctx, 4);
407  {
408  State = 49; Match(T__6);
409  }
410  break;
411  case T__3:
412  _localctx = new ObjectValueContext(_localctx);
413  EnterOuterAlt(_localctx, 5);
414  {
415  State = 50; oBjEcT();
416  }
417  break;
418  case STRING:
419  _localctx = new StringValueContext(_localctx);
420  EnterOuterAlt(_localctx, 6);
421  {
422  State = 51; Match(STRING);
423  }
424  break;
425  default:
426  throw new NoViableAltException(this);
427  }
428  }
429  catch (RecognitionException re) {
430  _localctx.exception = re;
431  ErrorHandler.ReportError(this, re);
432  ErrorHandler.Recover(this, re);
433  }
434  finally {
435  ExitRule();
436  }
437  return _localctx;
438  }
439 
440  private static char[] _serializedATN = {
441  '\x3', '\x608B', '\xA72A', '\x8133', '\xB9ED', '\x417C', '\x3BE7', '\x7786',
442  '\x5964', '\x3', '\r', '\x39', '\x4', '\x2', '\t', '\x2', '\x4', '\x3',
443  '\t', '\x3', '\x4', '\x4', '\t', '\x4', '\x4', '\x5', '\t', '\x5', '\x4',
444  '\x6', '\t', '\x6', '\x3', '\x2', '\x3', '\x2', '\x3', '\x2', '\x3', '\x2',
445  '\a', '\x2', '\x11', '\n', '\x2', '\f', '\x2', '\xE', '\x2', '\x14', '\v',
446  '\x2', '\x3', '\x2', '\x3', '\x2', '\x3', '\x3', '\a', '\x3', '\x19',
447  '\n', '\x3', '\f', '\x3', '\xE', '\x3', '\x1C', '\v', '\x3', '\x3', '\x4',
448  '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', '\a', '\x4', '\"', '\n', '\x4',
449  '\f', '\x4', '\xE', '\x4', '%', '\v', '\x4', '\x3', '\x4', '\x3', '\x4',
450  '\x3', '\x4', '\x3', '\x4', '\x5', '\x4', '+', '\n', '\x4', '\x3', '\x5',
451  '\x3', '\x5', '\x3', '\x5', '\x3', '\x5', '\x3', '\x6', '\x3', '\x6',
452  '\x3', '\x6', '\x3', '\x6', '\x3', '\x6', '\x3', '\x6', '\x5', '\x6',
453  '\x37', '\n', '\x6', '\x3', '\x6', '\x2', '\x2', '\a', '\x2', '\x4', '\x6',
454  '\b', '\n', '\x2', '\x2', '\x2', '<', '\x2', '\f', '\x3', '\x2', '\x2',
455  '\x2', '\x4', '\x1A', '\x3', '\x2', '\x2', '\x2', '\x6', '*', '\x3', '\x2',
456  '\x2', '\x2', '\b', ',', '\x3', '\x2', '\x2', '\x2', '\n', '\x36', '\x3',
457  '\x2', '\x2', '\x2', '\f', '\r', '\a', '\x3', '\x2', '\x2', '\r', '\x12',
458  '\x5', '\n', '\x6', '\x2', '\xE', '\xF', '\a', '\x4', '\x2', '\x2', '\xF',
459  '\x11', '\x5', '\n', '\x6', '\x2', '\x10', '\xE', '\x3', '\x2', '\x2',
460  '\x2', '\x11', '\x14', '\x3', '\x2', '\x2', '\x2', '\x12', '\x10', '\x3',
461  '\x2', '\x2', '\x2', '\x12', '\x13', '\x3', '\x2', '\x2', '\x2', '\x13',
462  '\x15', '\x3', '\x2', '\x2', '\x2', '\x14', '\x12', '\x3', '\x2', '\x2',
463  '\x2', '\x15', '\x16', '\a', '\x5', '\x2', '\x2', '\x16', '\x3', '\x3',
464  '\x2', '\x2', '\x2', '\x17', '\x19', '\x5', '\n', '\x6', '\x2', '\x18',
465  '\x17', '\x3', '\x2', '\x2', '\x2', '\x19', '\x1C', '\x3', '\x2', '\x2',
466  '\x2', '\x1A', '\x18', '\x3', '\x2', '\x2', '\x2', '\x1A', '\x1B', '\x3',
467  '\x2', '\x2', '\x2', '\x1B', '\x5', '\x3', '\x2', '\x2', '\x2', '\x1C',
468  '\x1A', '\x3', '\x2', '\x2', '\x2', '\x1D', '\x1E', '\a', '\x6', '\x2',
469  '\x2', '\x1E', '#', '\x5', '\b', '\x5', '\x2', '\x1F', ' ', '\a', '\x4',
470  '\x2', '\x2', ' ', '\"', '\x5', '\b', '\x5', '\x2', '!', '\x1F', '\x3',
471  '\x2', '\x2', '\x2', '\"', '%', '\x3', '\x2', '\x2', '\x2', '#', '!',
472  '\x3', '\x2', '\x2', '\x2', '#', '$', '\x3', '\x2', '\x2', '\x2', '$',
473  '&', '\x3', '\x2', '\x2', '\x2', '%', '#', '\x3', '\x2', '\x2', '\x2',
474  '&', '\'', '\a', '\a', '\x2', '\x2', '\'', '+', '\x3', '\x2', '\x2', '\x2',
475  '(', ')', '\a', '\x6', '\x2', '\x2', ')', '+', '\a', '\a', '\x2', '\x2',
476  '*', '\x1D', '\x3', '\x2', '\x2', '\x2', '*', '(', '\x3', '\x2', '\x2',
477  '\x2', '+', '\a', '\x3', '\x2', '\x2', '\x2', ',', '-', '\a', '\f', '\x2',
478  '\x2', '-', '.', '\a', '\b', '\x2', '\x2', '.', '/', '\x5', '\n', '\x6',
479  '\x2', '/', '\t', '\x3', '\x2', '\x2', '\x2', '\x30', '\x37', '\x5', '\x2',
480  '\x2', '\x2', '\x31', '\x37', '\a', '\n', '\x2', '\x2', '\x32', '\x37',
481  '\a', '\v', '\x2', '\x2', '\x33', '\x37', '\a', '\t', '\x2', '\x2', '\x34',
482  '\x37', '\x5', '\x6', '\x4', '\x2', '\x35', '\x37', '\a', '\f', '\x2',
483  '\x2', '\x36', '\x30', '\x3', '\x2', '\x2', '\x2', '\x36', '\x31', '\x3',
484  '\x2', '\x2', '\x2', '\x36', '\x32', '\x3', '\x2', '\x2', '\x2', '\x36',
485  '\x33', '\x3', '\x2', '\x2', '\x2', '\x36', '\x34', '\x3', '\x2', '\x2',
486  '\x2', '\x36', '\x35', '\x3', '\x2', '\x2', '\x2', '\x37', '\v', '\x3',
487  '\x2', '\x2', '\x2', '\a', '\x12', '\x1A', '#', '*', '\x36',
488  };
489 
490  public static readonly ATN _ATN =
491  new ATNDeserializer().Deserialize(_serializedATN);
492 
493 
494 }
ISPDGrammarVisitor.VisitJson
Result VisitJson([NotNull] SPDGrammarParser.JsonContext context)
Visit a parse tree produced by SPDGrammarParser.json.
base
Definition: Callback.cs:1
ISPDGrammarVisitor.VisitStringValue
Result VisitStringValue([NotNull] SPDGrammarParser.StringValueContext context)
Visit a parse tree produced by the StringValue labeled alternative in SPDGrammarParser....
ISPDGrammarVisitor.VisitObjectValue
Result VisitObjectValue([NotNull] SPDGrammarParser.ObjectValueContext context)
Visit a parse tree produced by the ObjectValue labeled alternative in SPDGrammarParser....
ISPDGrammarVisitor.VisitArrayValue
Result VisitArrayValue([NotNull] SPDGrammarParser.ArrayValueContext context)
Visit a parse tree produced by the ArrayValue labeled alternative in SPDGrammarParser....
ISPDGrammarVisitor.VisitOBjEcT
Result VisitOBjEcT([NotNull] SPDGrammarParser.OBjEcTContext context)
Visit a parse tree produced by SPDGrammarParser.oBjEcT.
ISPDGrammarVisitor.VisitNullValue
Result VisitNullValue([NotNull] SPDGrammarParser.NullValueContext context)
Visit a parse tree produced by the NullValue labeled alternative in SPDGrammarParser....
ISPDGrammarVisitor.VisitPair
Result VisitPair([NotNull] SPDGrammarParser.PairContext context)
Visit a parse tree produced by SPDGrammarParser.pair.
ISPDGrammarVisitor
This interface defines a complete generic visitor for a parse tree produced by SPDGrammarParser.
Definition: SPDGrammarVisitor.cs:33
ISPDGrammarVisitor.VisitBooleanValue
Result VisitBooleanValue([NotNull] SPDGrammarParser.BooleanValueContext context)
Visit a parse tree produced by the BooleanValue labeled alternative in SPDGrammarParser....
ISPDGrammarVisitor.VisitIntegerValue
Result VisitIntegerValue([NotNull] SPDGrammarParser.IntegerValueContext context)
Visit a parse tree produced by the IntegerValue labeled alternative in SPDGrammarParser....
ISPDGrammarVisitor.VisitArray
Result VisitArray([NotNull] SPDGrammarParser.ArrayContext context)
Visit a parse tree produced by SPDGrammarParser.array.