3 from __future__
import print_function
5 from io
import StringIO
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")
36 grammarFileName =
"SPDGrammar.g4"
38 atn = ATNDeserializer().deserialize(serializedATN())
40 decisionsToDFA = [ DFA(ds, i)
for i, ds
in enumerate(atn.decisionToState) ]
42 sharedContextCache = PredictionContextCache()
44 literalNames = [
u"<INVALID>",
u"'['",
u"','",
u"']'",
u"'{'",
u"'}'",
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" ]
57 ruleNames = [
u"array",
u"json",
u"oBjEcT",
u"pair",
u"value" ]
72 def __init__(self, input, output=sys.stdout):
73 super(SPDGrammarParser, self).__init__(input, output=output)
74 self.checkVersion(
"4.7")
82 def __init__(self, parser, parent=None, invokingState=-1):
86 def value(self, i=None):
93 def getRuleIndex(self):
94 return SPDGrammarParser.RULE_array
96 def accept(self, visitor):
97 if hasattr(visitor,
"visitArray"):
98 return visitor.visitArray(self)
100 return visitor.visitChildren(self)
108 self.enterRule(localctx, 0, self.RULE_array)
111 self.enterOuterAlt(localctx, 1)
113 self.match(SPDGrammarParser.T__0)
117 self._errHandler.sync(self)
118 _la = self._input.LA(1)
119 while _la==SPDGrammarParser.T__1:
121 self.match(SPDGrammarParser.T__1)
125 self._errHandler.sync(self)
126 _la = self._input.LA(1)
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)
140 def __init__(self, parser, parent=None, invokingState=-1):
144 def value(self, i=None):
151 def getRuleIndex(self):
152 return SPDGrammarParser.RULE_json
154 def accept(self, visitor):
155 if hasattr(visitor,
"visitJson"):
156 return visitor.visitJson(self)
158 return visitor.visitChildren(self)
166 self.enterRule(localctx, 2, self.RULE_json)
169 self.enterOuterAlt(localctx, 1)
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):
177 self._errHandler.sync(self)
178 _la = self._input.LA(1)
180 except RecognitionException
as re:
181 localctx.exception = re
182 self._errHandler.reportError(self, re)
183 self._errHandler.recover(self, re)
190 def __init__(self, parser, parent=None, invokingState=-1):
194 def pair(self, i=None):
201 def getRuleIndex(self):
202 return SPDGrammarParser.RULE_oBjEcT
204 def accept(self, visitor):
205 if hasattr(visitor,
"visitOBjEcT"):
206 return visitor.visitOBjEcT(self)
208 return visitor.visitChildren(self)
216 self.enterRule(localctx, 4, self.RULE_oBjEcT)
220 self._errHandler.sync(self)
221 la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
223 self.enterOuterAlt(localctx, 1)
225 self.match(SPDGrammarParser.T__3)
229 self._errHandler.sync(self)
230 _la = self._input.LA(1)
231 while _la==SPDGrammarParser.T__1:
233 self.match(SPDGrammarParser.T__1)
237 self._errHandler.sync(self)
238 _la = self._input.LA(1)
241 self.match(SPDGrammarParser.T__4)
245 self.enterOuterAlt(localctx, 2)
247 self.match(SPDGrammarParser.T__3)
249 self.match(SPDGrammarParser.T__4)
253 except RecognitionException
as re:
254 localctx.exception = re
255 self._errHandler.reportError(self, re)
256 self._errHandler.recover(self, re)
263 def __init__(self, parser, parent=None, invokingState=-1):
268 return self.getToken(SPDGrammarParser.STRING, 0)
274 def getRuleIndex(self):
275 return SPDGrammarParser.RULE_pair
277 def accept(self, visitor):
278 if hasattr(visitor,
"visitPair"):
279 return visitor.visitPair(self)
281 return visitor.visitChildren(self)
289 self.enterRule(localctx, 6, self.RULE_pair)
291 self.enterOuterAlt(localctx, 1)
293 self.match(SPDGrammarParser.STRING)
295 self.match(SPDGrammarParser.T__5)
298 except RecognitionException
as re:
299 localctx.exception = re
300 self._errHandler.reportError(self, re)
301 self._errHandler.recover(self, re)
308 def __init__(self, parser, parent=None, invokingState=-1):
313 def getRuleIndex(self):
314 return SPDGrammarParser.RULE_value
317 def copyFrom(self, ctx):
324 def __init__(self, parser, ctx):
329 def accept(self, visitor):
330 if hasattr(visitor,
"visitNullValue"):
331 return visitor.visitNullValue(self)
333 return visitor.visitChildren(self)
338 def __init__(self, parser, ctx):
346 def accept(self, visitor):
347 if hasattr(visitor,
"visitObjectValue"):
348 return visitor.visitObjectValue(self)
350 return visitor.visitChildren(self)
355 def __init__(self, parser, ctx):
360 return self.getToken(SPDGrammarParser.BOOLEAN, 0)
362 def accept(self, visitor):
363 if hasattr(visitor,
"visitBooleanValue"):
364 return visitor.visitBooleanValue(self)
366 return visitor.visitChildren(self)
371 def __init__(self, parser, ctx):
376 return self.getToken(SPDGrammarParser.INTEGER, 0)
378 def accept(self, visitor):
379 if hasattr(visitor,
"visitIntegerValue"):
380 return visitor.visitIntegerValue(self)
382 return visitor.visitChildren(self)
387 def __init__(self, parser, ctx):
392 return self.getToken(SPDGrammarParser.STRING, 0)
394 def accept(self, visitor):
395 if hasattr(visitor,
"visitStringValue"):
396 return visitor.visitStringValue(self)
398 return visitor.visitChildren(self)
403 def __init__(self, parser, ctx):
411 def accept(self, visitor):
412 if hasattr(visitor,
"visitArrayValue"):
413 return visitor.visitArrayValue(self)
415 return visitor.visitChildren(self)
422 self.enterRule(localctx, 8, self.RULE_value)
425 self._errHandler.sync(self)
426 token = self._input.LA(1)
427 if token
in [SPDGrammarParser.T__0]:
429 self.enterOuterAlt(localctx, 1)
433 elif token
in [SPDGrammarParser.BOOLEAN]:
435 self.enterOuterAlt(localctx, 2)
437 self.match(SPDGrammarParser.BOOLEAN)
439 elif token
in [SPDGrammarParser.INTEGER]:
441 self.enterOuterAlt(localctx, 3)
443 self.match(SPDGrammarParser.INTEGER)
445 elif token
in [SPDGrammarParser.T__6]:
447 self.enterOuterAlt(localctx, 4)
449 self.match(SPDGrammarParser.T__6)
451 elif token
in [SPDGrammarParser.T__3]:
453 self.enterOuterAlt(localctx, 5)
457 elif token
in [SPDGrammarParser.STRING]:
459 self.enterOuterAlt(localctx, 6)
461 self.match(SPDGrammarParser.STRING)
464 raise NoViableAltException(self)
466 except RecognitionException
as re:
467 localctx.exception = re
468 self._errHandler.reportError(self, re)
469 self._errHandler.recover(self, re)