EmbASP-Python
SPDGrammarParser.py
1 # Generated from SPDGrammar.g4 by ANTLR 4.7
2 # encoding: utf-8
3 from __future__ import print_function
4 from antlr4 import *
5 from io import StringIO
6 import sys
7 
8 def serializedATN():
9  with StringIO() as buf:
10  buf.write(u"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3")
11  buf.write(u"\r9\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\3\2\3\2\3")
12  buf.write(u"\2\3\2\7\2\21\n\2\f\2\16\2\24\13\2\3\2\3\2\3\3\7\3\31")
13  buf.write(u"\n\3\f\3\16\3\34\13\3\3\4\3\4\3\4\3\4\7\4\"\n\4\f\4\16")
14  buf.write(u"\4%\13\4\3\4\3\4\3\4\3\4\5\4+\n\4\3\5\3\5\3\5\3\5\3\6")
15  buf.write(u"\3\6\3\6\3\6\3\6\3\6\5\6\67\n\6\3\6\2\2\7\2\4\6\b\n\2")
16  buf.write(u"\2\2<\2\f\3\2\2\2\4\32\3\2\2\2\6*\3\2\2\2\b,\3\2\2\2")
17  buf.write(u"\n\66\3\2\2\2\f\r\7\3\2\2\r\22\5\n\6\2\16\17\7\4\2\2")
18  buf.write(u"\17\21\5\n\6\2\20\16\3\2\2\2\21\24\3\2\2\2\22\20\3\2")
19  buf.write(u"\2\2\22\23\3\2\2\2\23\25\3\2\2\2\24\22\3\2\2\2\25\26")
20  buf.write(u"\7\5\2\2\26\3\3\2\2\2\27\31\5\n\6\2\30\27\3\2\2\2\31")
21  buf.write(u"\34\3\2\2\2\32\30\3\2\2\2\32\33\3\2\2\2\33\5\3\2\2\2")
22  buf.write(u"\34\32\3\2\2\2\35\36\7\6\2\2\36#\5\b\5\2\37 \7\4\2\2")
23  buf.write(u" \"\5\b\5\2!\37\3\2\2\2\"%\3\2\2\2#!\3\2\2\2#$\3\2\2")
24  buf.write(u"\2$&\3\2\2\2%#\3\2\2\2&\'\7\7\2\2\'+\3\2\2\2()\7\6\2")
25  buf.write(u"\2)+\7\7\2\2*\35\3\2\2\2*(\3\2\2\2+\7\3\2\2\2,-\7\f\2")
26  buf.write(u"\2-.\7\b\2\2./\5\n\6\2/\t\3\2\2\2\60\67\5\2\2\2\61\67")
27  buf.write(u"\7\n\2\2\62\67\7\13\2\2\63\67\7\t\2\2\64\67\5\6\4\2\65")
28  buf.write(u"\67\7\f\2\2\66\60\3\2\2\2\66\61\3\2\2\2\66\62\3\2\2\2")
29  buf.write(u"\66\63\3\2\2\2\66\64\3\2\2\2\66\65\3\2\2\2\67\13\3\2")
30  buf.write(u"\2\2\7\22\32#*\66")
31  return buf.getvalue()
32 
33 
34 class SPDGrammarParser ( Parser ):
35 
36  grammarFileName = "SPDGrammar.g4"
37 
38  atn = ATNDeserializer().deserialize(serializedATN())
39 
40  decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
41 
42  sharedContextCache = PredictionContextCache()
43 
44  literalNames = [ u"<INVALID>", u"'['", u"','", u"']'", u"'{'", u"'}'",
45  u"':'", u"'null'" ]
46 
47  symbolicNames = [ u"<INVALID>", u"<INVALID>", u"<INVALID>", u"<INVALID>",
48  u"<INVALID>", u"<INVALID>", u"<INVALID>", u"<INVALID>",
49  u"BOOLEAN", u"INTEGER", u"STRING", u"WHITE_SPACE" ]
50 
51  RULE_array = 0
52  RULE_json = 1
53  RULE_oBjEcT = 2
54  RULE_pair = 3
55  RULE_value = 4
56 
57  ruleNames = [ u"array", u"json", u"oBjEcT", u"pair", u"value" ]
58 
59  EOF = Token.EOF
60  T__0=1
61  T__1=2
62  T__2=3
63  T__3=4
64  T__4=5
65  T__5=6
66  T__6=7
67  BOOLEAN=8
68  INTEGER=9
69  STRING=10
70  WHITE_SPACE=11
71 
72  def __init__(self, input, output=sys.stdout):
73  super(SPDGrammarParser, self).__init__(input, output=output)
74  self.checkVersion("4.7")
75  self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
76  self._predicates = None
77 
78 
79 
80  class ArrayContext(ParserRuleContext):
81 
82  def __init__(self, parser, parent=None, invokingState=-1):
83  super(SPDGrammarParser.ArrayContext, self).__init__(parent, invokingState)
84  self.parser = parser
85 
86  def value(self, i=None):
87  if i is None:
88  return self.getTypedRuleContexts(SPDGrammarParser.ValueContext)
89  else:
90  return self.getTypedRuleContext(SPDGrammarParser.ValueContext,i)
91 
92 
93  def getRuleIndex(self):
94  return SPDGrammarParser.RULE_array
95 
96  def accept(self, visitor):
97  if hasattr(visitor, "visitArray"):
98  return visitor.visitArray(self)
99  else:
100  return visitor.visitChildren(self)
101 
102 
103 
104 
105  def array(self):
106 
107  localctx = SPDGrammarParser.ArrayContext(self, self._ctx, self.state)
108  self.enterRule(localctx, 0, self.RULE_array)
109  self._la = 0 # Token type
110  try:
111  self.enterOuterAlt(localctx, 1)
112  self.state = 10
113  self.match(SPDGrammarParser.T__0)
114  self.state = 11
115  self.value()
116  self.state = 16
117  self._errHandler.sync(self)
118  _la = self._input.LA(1)
119  while _la==SPDGrammarParser.T__1:
120  self.state = 12
121  self.match(SPDGrammarParser.T__1)
122  self.state = 13
123  self.value()
124  self.state = 18
125  self._errHandler.sync(self)
126  _la = self._input.LA(1)
127 
128  self.state = 19
129  self.match(SPDGrammarParser.T__2)
130  except RecognitionException as re:
131  localctx.exception = re
132  self._errHandler.reportError(self, re)
133  self._errHandler.recover(self, re)
134  finally:
135  self.exitRule()
136  return localctx
137 
138  class JsonContext(ParserRuleContext):
139 
140  def __init__(self, parser, parent=None, invokingState=-1):
141  super(SPDGrammarParser.JsonContext, self).__init__(parent, invokingState)
142  self.parser = parser
143 
144  def value(self, i=None):
145  if i is None:
146  return self.getTypedRuleContexts(SPDGrammarParser.ValueContext)
147  else:
148  return self.getTypedRuleContext(SPDGrammarParser.ValueContext,i)
149 
150 
151  def getRuleIndex(self):
152  return SPDGrammarParser.RULE_json
153 
154  def accept(self, visitor):
155  if hasattr(visitor, "visitJson"):
156  return visitor.visitJson(self)
157  else:
158  return visitor.visitChildren(self)
159 
160 
161 
162 
163  def json(self):
164 
165  localctx = SPDGrammarParser.JsonContext(self, self._ctx, self.state)
166  self.enterRule(localctx, 2, self.RULE_json)
167  self._la = 0 # Token type
168  try:
169  self.enterOuterAlt(localctx, 1)
170  self.state = 24
171  self._errHandler.sync(self)
172  _la = self._input.LA(1)
173  while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << SPDGrammarParser.T__0) | (1 << SPDGrammarParser.T__3) | (1 << SPDGrammarParser.T__6) | (1 << SPDGrammarParser.BOOLEAN) | (1 << SPDGrammarParser.INTEGER) | (1 << SPDGrammarParser.STRING))) != 0):
174  self.state = 21
175  self.value()
176  self.state = 26
177  self._errHandler.sync(self)
178  _la = self._input.LA(1)
179 
180  except RecognitionException as re:
181  localctx.exception = re
182  self._errHandler.reportError(self, re)
183  self._errHandler.recover(self, re)
184  finally:
185  self.exitRule()
186  return localctx
187 
188  class OBjEcTContext(ParserRuleContext):
189 
190  def __init__(self, parser, parent=None, invokingState=-1):
191  super(SPDGrammarParser.OBjEcTContext, self).__init__(parent, invokingState)
192  self.parser = parser
193 
194  def pair(self, i=None):
195  if i is None:
196  return self.getTypedRuleContexts(SPDGrammarParser.PairContext)
197  else:
198  return self.getTypedRuleContext(SPDGrammarParser.PairContext,i)
199 
200 
201  def getRuleIndex(self):
202  return SPDGrammarParser.RULE_oBjEcT
203 
204  def accept(self, visitor):
205  if hasattr(visitor, "visitOBjEcT"):
206  return visitor.visitOBjEcT(self)
207  else:
208  return visitor.visitChildren(self)
209 
210 
211 
212 
213  def oBjEcT(self):
214 
215  localctx = SPDGrammarParser.OBjEcTContext(self, self._ctx, self.state)
216  self.enterRule(localctx, 4, self.RULE_oBjEcT)
217  self._la = 0 # Token type
218  try:
219  self.state = 40
220  self._errHandler.sync(self)
221  la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
222  if la_ == 1:
223  self.enterOuterAlt(localctx, 1)
224  self.state = 27
225  self.match(SPDGrammarParser.T__3)
226  self.state = 28
227  self.pair()
228  self.state = 33
229  self._errHandler.sync(self)
230  _la = self._input.LA(1)
231  while _la==SPDGrammarParser.T__1:
232  self.state = 29
233  self.match(SPDGrammarParser.T__1)
234  self.state = 30
235  self.pair()
236  self.state = 35
237  self._errHandler.sync(self)
238  _la = self._input.LA(1)
239 
240  self.state = 36
241  self.match(SPDGrammarParser.T__4)
242  pass
243 
244  elif la_ == 2:
245  self.enterOuterAlt(localctx, 2)
246  self.state = 38
247  self.match(SPDGrammarParser.T__3)
248  self.state = 39
249  self.match(SPDGrammarParser.T__4)
250  pass
251 
252 
253  except RecognitionException as re:
254  localctx.exception = re
255  self._errHandler.reportError(self, re)
256  self._errHandler.recover(self, re)
257  finally:
258  self.exitRule()
259  return localctx
260 
261  class PairContext(ParserRuleContext):
262 
263  def __init__(self, parser, parent=None, invokingState=-1):
264  super(SPDGrammarParser.PairContext, self).__init__(parent, invokingState)
265  self.parser = parser
266 
267  def STRING(self):
268  return self.getToken(SPDGrammarParser.STRING, 0)
269 
270  def value(self):
271  return self.getTypedRuleContext(SPDGrammarParser.ValueContext,0)
272 
273 
274  def getRuleIndex(self):
275  return SPDGrammarParser.RULE_pair
276 
277  def accept(self, visitor):
278  if hasattr(visitor, "visitPair"):
279  return visitor.visitPair(self)
280  else:
281  return visitor.visitChildren(self)
282 
283 
284 
285 
286  def pair(self):
287 
288  localctx = SPDGrammarParser.PairContext(self, self._ctx, self.state)
289  self.enterRule(localctx, 6, self.RULE_pair)
290  try:
291  self.enterOuterAlt(localctx, 1)
292  self.state = 42
293  self.match(SPDGrammarParser.STRING)
294  self.state = 43
295  self.match(SPDGrammarParser.T__5)
296  self.state = 44
297  self.value()
298  except RecognitionException as re:
299  localctx.exception = re
300  self._errHandler.reportError(self, re)
301  self._errHandler.recover(self, re)
302  finally:
303  self.exitRule()
304  return localctx
305 
306  class ValueContext(ParserRuleContext):
307 
308  def __init__(self, parser, parent=None, invokingState=-1):
309  super(SPDGrammarParser.ValueContext, self).__init__(parent, invokingState)
310  self.parser = parser
311 
312 
313  def getRuleIndex(self):
314  return SPDGrammarParser.RULE_value
315 
316 
317  def copyFrom(self, ctx):
318  super(SPDGrammarParser.ValueContext, self).copyFrom(ctx)
319 
320 
321 
323 
324  def __init__(self, parser, ctx): # actually a SPDGrammarParser.ValueContext)
325  super(SPDGrammarParser.NullValueContext, self).__init__(parser)
326  self.copyFrom(ctx)
327 
328 
329  def accept(self, visitor):
330  if hasattr(visitor, "visitNullValue"):
331  return visitor.visitNullValue(self)
332  else:
333  return visitor.visitChildren(self)
334 
335 
337 
338  def __init__(self, parser, ctx): # actually a SPDGrammarParser.ValueContext)
339  super(SPDGrammarParser.ObjectValueContext, self).__init__(parser)
340  self.copyFrom(ctx)
341 
342  def oBjEcT(self):
343  return self.getTypedRuleContext(SPDGrammarParser.OBjEcTContext,0)
344 
345 
346  def accept(self, visitor):
347  if hasattr(visitor, "visitObjectValue"):
348  return visitor.visitObjectValue(self)
349  else:
350  return visitor.visitChildren(self)
351 
352 
354 
355  def __init__(self, parser, ctx): # actually a SPDGrammarParser.ValueContext)
356  super(SPDGrammarParser.BooleanValueContext, self).__init__(parser)
357  self.copyFrom(ctx)
358 
359  def BOOLEAN(self):
360  return self.getToken(SPDGrammarParser.BOOLEAN, 0)
361 
362  def accept(self, visitor):
363  if hasattr(visitor, "visitBooleanValue"):
364  return visitor.visitBooleanValue(self)
365  else:
366  return visitor.visitChildren(self)
367 
368 
370 
371  def __init__(self, parser, ctx): # actually a SPDGrammarParser.ValueContext)
372  super(SPDGrammarParser.IntegerValueContext, self).__init__(parser)
373  self.copyFrom(ctx)
374 
375  def INTEGER(self):
376  return self.getToken(SPDGrammarParser.INTEGER, 0)
377 
378  def accept(self, visitor):
379  if hasattr(visitor, "visitIntegerValue"):
380  return visitor.visitIntegerValue(self)
381  else:
382  return visitor.visitChildren(self)
383 
384 
386 
387  def __init__(self, parser, ctx): # actually a SPDGrammarParser.ValueContext)
388  super(SPDGrammarParser.StringValueContext, self).__init__(parser)
389  self.copyFrom(ctx)
390 
391  def STRING(self):
392  return self.getToken(SPDGrammarParser.STRING, 0)
393 
394  def accept(self, visitor):
395  if hasattr(visitor, "visitStringValue"):
396  return visitor.visitStringValue(self)
397  else:
398  return visitor.visitChildren(self)
399 
400 
402 
403  def __init__(self, parser, ctx): # actually a SPDGrammarParser.ValueContext)
404  super(SPDGrammarParser.ArrayValueContext, self).__init__(parser)
405  self.copyFrom(ctx)
406 
407  def array(self):
408  return self.getTypedRuleContext(SPDGrammarParser.ArrayContext,0)
409 
410 
411  def accept(self, visitor):
412  if hasattr(visitor, "visitArrayValue"):
413  return visitor.visitArrayValue(self)
414  else:
415  return visitor.visitChildren(self)
416 
417 
418 
419  def value(self):
420 
421  localctx = SPDGrammarParser.ValueContext(self, self._ctx, self.state)
422  self.enterRule(localctx, 8, self.RULE_value)
423  try:
424  self.state = 52
425  self._errHandler.sync(self)
426  token = self._input.LA(1)
427  if token in [SPDGrammarParser.T__0]:
428  localctx = SPDGrammarParser.ArrayValueContext(self, localctx)
429  self.enterOuterAlt(localctx, 1)
430  self.state = 46
431  self.array()
432  pass
433  elif token in [SPDGrammarParser.BOOLEAN]:
434  localctx = SPDGrammarParser.BooleanValueContext(self, localctx)
435  self.enterOuterAlt(localctx, 2)
436  self.state = 47
437  self.match(SPDGrammarParser.BOOLEAN)
438  pass
439  elif token in [SPDGrammarParser.INTEGER]:
440  localctx = SPDGrammarParser.IntegerValueContext(self, localctx)
441  self.enterOuterAlt(localctx, 3)
442  self.state = 48
443  self.match(SPDGrammarParser.INTEGER)
444  pass
445  elif token in [SPDGrammarParser.T__6]:
446  localctx = SPDGrammarParser.NullValueContext(self, localctx)
447  self.enterOuterAlt(localctx, 4)
448  self.state = 49
449  self.match(SPDGrammarParser.T__6)
450  pass
451  elif token in [SPDGrammarParser.T__3]:
452  localctx = SPDGrammarParser.ObjectValueContext(self, localctx)
453  self.enterOuterAlt(localctx, 5)
454  self.state = 50
455  self.oBjEcT()
456  pass
457  elif token in [SPDGrammarParser.STRING]:
458  localctx = SPDGrammarParser.StringValueContext(self, localctx)
459  self.enterOuterAlt(localctx, 6)
460  self.state = 51
461  self.match(SPDGrammarParser.STRING)
462  pass
463  else:
464  raise NoViableAltException(self)
465 
466  except RecognitionException as re:
467  localctx.exception = re
468  self._errHandler.reportError(self, re)
469  self._errHandler.recover(self, re)
470  finally:
471  self.exitRule()
472  return localctx
473 
474 
475 
476 
477 
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.PairContext.value
def value(self)
Definition: SPDGrammarParser.py:270
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser._predicates
_predicates
Definition: SPDGrammarParser.py:76
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.ArrayValueContext
Definition: SPDGrammarParser.py:401
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.OBjEcTContext.parser
parser
Definition: SPDGrammarParser.py:192
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.decisionsToDFA
list decisionsToDFA
Definition: SPDGrammarParser.py:40
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.JsonContext.parser
parser
Definition: SPDGrammarParser.py:142
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.ValueContext
Definition: SPDGrammarParser.py:306
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.atn
atn
Definition: SPDGrammarParser.py:38
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.NullValueContext
Definition: SPDGrammarParser.py:322
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.PairContext
Definition: SPDGrammarParser.py:261
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.ArrayContext.parser
parser
Definition: SPDGrammarParser.py:84
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.sharedContextCache
sharedContextCache
Definition: SPDGrammarParser.py:42
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.IntegerValueContext
Definition: SPDGrammarParser.py:369
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.OBjEcTContext
Definition: SPDGrammarParser.py:188
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.BooleanValueContext
Definition: SPDGrammarParser.py:353
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser._interp
_interp
Definition: SPDGrammarParser.py:75
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.OBjEcTContext.pair
def pair(self, i=None)
Definition: SPDGrammarParser.py:194
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.ValueContext.copyFrom
def copyFrom(self, ctx)
Definition: SPDGrammarParser.py:317
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.ArrayValueContext.array
def array(self)
Definition: SPDGrammarParser.py:407
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.StringValueContext
Definition: SPDGrammarParser.py:385
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.ArrayContext.value
def value(self, i=None)
Definition: SPDGrammarParser.py:86
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.ValueContext.parser
parser
Definition: SPDGrammarParser.py:310
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.ObjectValueContext
Definition: SPDGrammarParser.py:336
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.JsonContext
Definition: SPDGrammarParser.py:138
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.ArrayContext
Definition: SPDGrammarParser.py:80
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.PairContext.parser
parser
Definition: SPDGrammarParser.py:265
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser.JsonContext.value
def value(self, i=None)
Definition: SPDGrammarParser.py:144
parsers.pddl.solver_planning_domains.SPDGrammarParser.SPDGrammarParser
Definition: SPDGrammarParser.py:34