| 1 |
|
| 2 |
|
| 3 |
from antlr4 import * |
| 4 |
from io import StringIO |
| 5 |
from typing import TextIO |
| 6 |
import sys |
| 7 |
|
| 8 |
def serializedATN(): |
| 9 |
with StringIO() as buf: |
| 10 |
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\f") |
| 11 |
buf.write("\u0081\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7") |
| 12 |
buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16") |
| 13 |
buf.write("\t\16\4\17\t\17\4\20\t\20\3\2\3\2\3\2\3\3\3\3\5\3&\n\3") |
| 14 |
buf.write("\3\3\7\3)\n\3\f\3\16\3,\13\3\3\4\3\4\5\4\60\n\4\3\5\3") |
| 15 |
buf.write("\5\3\5\3\5\3\5\3\5\5\58\n\5\3\6\3\6\5\6<\n\6\3\6\3\6\5") |
| 16 |
buf.write("\6@\n\6\3\6\3\6\3\7\3\7\5\7F\n\7\3\7\3\7\5\7J\n\7\3\7") |
| 17 |
buf.write("\3\7\6\7N\n\7\r\7\16\7O\3\b\3\b\5\bT\n\b\3\b\7\bW\n\b") |
| 18 |
buf.write("\f\b\16\bZ\13\b\3\t\3\t\5\t^\n\t\3\t\3\t\3\t\5\tc\n\t") |
| 19 |
buf.write("\3\t\3\t\3\n\3\n\5\ni\n\n\3\n\3\n\5\nm\n\n\3\n\3\n\3\13") |
| 20 |
buf.write("\3\13\3\f\3\f\3\r\3\r\3\16\3\16\3\17\3\17\5\17{\n\17\3") |
| 21 |
buf.write("\20\3\20\5\20\177\n\20\3\20\2\2\21\2\4\6\b\n\f\16\20\22") |
| 22 |
buf.write("\24\26\30\32\34\36\2\3\3\2\b\t\2\u0086\2 \3\2\2\2\4#\3") |
| 23 |
buf.write("\2\2\2\6/\3\2\2\2\b\67\3\2\2\2\n9\3\2\2\2\fC\3\2\2\2\16") |
| 24 |
buf.write("Q\3\2\2\2\20[\3\2\2\2\22f\3\2\2\2\24p\3\2\2\2\26r\3\2") |
| 25 |
buf.write("\2\2\30t\3\2\2\2\32v\3\2\2\2\34x\3\2\2\2\36|\3\2\2\2 ") |
| 26 |
buf.write("!\5\4\3\2!\"\7\2\2\3\"\3\3\2\2\2#*\5\6\4\2$&\5\30\r\2") |
| 27 |
buf.write("%$\3\2\2\2%&\3\2\2\2&\'\3\2\2\2\')\5\6\4\2(%\3\2\2\2)") |
| 28 |
buf.write(",\3\2\2\2*(\3\2\2\2*+\3\2\2\2+\5\3\2\2\2,*\3\2\2\2-\60") |
| 29 |
buf.write("\5\24\13\2.\60\5\b\5\2/-\3\2\2\2/.\3\2\2\2\60\7\3\2\2") |
| 30 |
buf.write("\2\618\5\34\17\2\628\5\32\16\2\638\5\36\20\2\648\5\n\6") |
| 31 |
buf.write("\2\658\5\20\t\2\668\5\22\n\2\67\61\3\2\2\2\67\62\3\2\2") |
| 32 |
buf.write("\2\67\63\3\2\2\2\67\64\3\2\2\2\67\65\3\2\2\2\67\66\3\2") |
| 33 |
buf.write("\2\28\t\3\2\2\29;\7\3\2\2:<\7\f\2\2;:\3\2\2\2;<\3\2\2") |
| 34 |
buf.write("\2<=\3\2\2\2=?\5\f\7\2>@\7\f\2\2?>\3\2\2\2?@\3\2\2\2@") |
| 35 |
buf.write("A\3\2\2\2AB\7\6\2\2B\13\3\2\2\2CM\5\16\b\2DF\7\f\2\2E") |
| 36 |
buf.write("D\3\2\2\2EF\3\2\2\2FG\3\2\2\2GI\5\26\f\2HJ\7\f\2\2IH\3") |
| 37 |
buf.write("\2\2\2IJ\3\2\2\2JK\3\2\2\2KL\5\16\b\2LN\3\2\2\2ME\3\2") |
| 38 |
buf.write("\2\2NO\3\2\2\2OM\3\2\2\2OP\3\2\2\2P\r\3\2\2\2QX\5\b\5") |
| 39 |
buf.write("\2RT\5\30\r\2SR\3\2\2\2ST\3\2\2\2TU\3\2\2\2UW\5\b\5\2") |
| 40 |
buf.write("VS\3\2\2\2WZ\3\2\2\2XV\3\2\2\2XY\3\2\2\2Y\17\3\2\2\2Z") |
| 41 |
buf.write("X\3\2\2\2[]\7\4\2\2\\^\t\2\2\2]\\\3\2\2\2]^\3\2\2\2^_") |
| 42 |
buf.write("\3\2\2\2_`\7\f\2\2`b\5\4\3\2ac\7\f\2\2ba\3\2\2\2bc\3\2") |
| 43 |
buf.write("\2\2cd\3\2\2\2de\7\6\2\2e\21\3\2\2\2fh\7\5\2\2gi\5\30") |
| 44 |
buf.write("\r\2hg\3\2\2\2hi\3\2\2\2ij\3\2\2\2jl\5\4\3\2km\5\30\r") |
| 45 |
buf.write("\2lk\3\2\2\2lm\3\2\2\2mn\3\2\2\2no\7\6\2\2o\23\3\2\2\2") |
| 46 |
buf.write("pq\7\b\2\2q\25\3\2\2\2rs\7\b\2\2s\27\3\2\2\2tu\7\f\2\2") |
| 47 |
buf.write("u\31\3\2\2\2vw\7\7\2\2w\33\3\2\2\2xz\7\t\2\2y{\7\13\2") |
| 48 |
buf.write("\2zy\3\2\2\2z{\3\2\2\2{\35\3\2\2\2|~\7\n\2\2}\177\7\13") |
| 49 |
buf.write("\2\2~}\3\2\2\2~\177\3\2\2\2\177\37\3\2\2\2\23%*/\67;?") |
| 50 |
buf.write("EIOSX]bhlz~") |
| 51 |
return buf.getvalue() |
| 52 |
|
| 53 |
|
| 54 |
class TacticNotationsParser ( Parser ): |
| 55 |
|
| 56 |
grammarFileName = "TacticNotations.g" |
| 57 |
|
| 58 |
atn = ATNDeserializer().deserialize(serializedATN()) |
| 59 |
|
| 60 |
decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] |
| 61 |
|
| 62 |
sharedContextCache = PredictionContextCache() |
| 63 |
|
| 64 |
literalNames = [ "<INVALID>", "'{|'", "<INVALID>", "'{'", "'}'", "<INVALID>", |
| 65 |
"'|'" ] |
| 66 |
|
| 67 |
symbolicNames = [ "<INVALID>", "LALT", "LGROUP", "LBRACE", "RBRACE", |
| 68 |
"ESCAPED", "PIPE", "ATOM", "ID", "SUB", "WHITESPACE" ] |
| 69 |
|
| 70 |
RULE_top = 0 |
| 71 |
RULE_blocks = 1 |
| 72 |
RULE_block = 2 |
| 73 |
RULE_nopipeblock = 3 |
| 74 |
RULE_alternative = 4 |
| 75 |
RULE_altblocks = 5 |
| 76 |
RULE_altblock = 6 |
| 77 |
RULE_repeat = 7 |
| 78 |
RULE_curlies = 8 |
| 79 |
RULE_pipe = 9 |
| 80 |
RULE_altsep = 10 |
| 81 |
RULE_whitespace = 11 |
| 82 |
RULE_escaped = 12 |
| 83 |
RULE_atomic = 13 |
| 84 |
RULE_hole = 14 |
| 85 |
|
| 86 |
ruleNames = [ "top", "blocks", "block", "nopipeblock", "alternative", |
| 87 |
"altblocks", "altblock", "repeat", "curlies", "pipe", |
| 88 |
"altsep", "whitespace", "escaped", "atomic", "hole" ] |
| 89 |
|
| 90 |
EOF = Token.EOF |
| 91 |
LALT=1 |
| 92 |
LGROUP=2 |
| 93 |
LBRACE=3 |
| 94 |
RBRACE=4 |
| 95 |
ESCAPED=5 |
| 96 |
PIPE=6 |
| 97 |
ATOM=7 |
| 98 |
ID=8 |
| 99 |
SUB=9 |
| 100 |
WHITESPACE=10 |
| 101 |
|
| 102 |
def __init__(self, input:TokenStream, output:TextIO = sys.stdout): |
| 103 |
super().__init__(input, output) |
| 104 |
self.checkVersion("4.7.2") |
| 105 |
self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache) |
| 106 |
self._predicates = None |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
class TopContext(ParserRuleContext): |
| 111 |
|
| 112 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 113 |
super().__init__(parent, invokingState) |
| 114 |
self.parser = parser |
| 115 |
|
| 116 |
def blocks(self): |
| 117 |
return self.getTypedRuleContext(TacticNotationsParser.BlocksContext,0) |
| 118 |
|
| 119 |
|
| 120 |
def EOF(self): |
| 121 |
return self.getToken(TacticNotationsParser.EOF, 0) |
| 122 |
|
| 123 |
def getRuleIndex(self): |
| 124 |
return TacticNotationsParser.RULE_top |
| 125 |
|
| 126 |
def accept(self, visitor:ParseTreeVisitor): |
| 127 |
if hasattr( visitor, "visitTop" ): |
| 128 |
return visitor.visitTop(self) |
| 129 |
else: |
| 130 |
return visitor.visitChildren(self) |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
def top(self): |
| 136 |
|
| 137 |
localctx = TacticNotationsParser.TopContext(self, self._ctx, self.state) |
| 138 |
self.enterRule(localctx, 0, self.RULE_top) |
| 139 |
try: |
| 140 |
self.enterOuterAlt(localctx, 1) |
| 141 |
self.state = 30 |
| 142 |
self.blocks() |
| 143 |
self.state = 31 |
| 144 |
self.match(TacticNotationsParser.EOF) |
| 145 |
except RecognitionException as re: |
| 146 |
localctx.exception = re |
| 147 |
self._errHandler.reportError(self, re) |
| 148 |
self._errHandler.recover(self, re) |
| 149 |
finally: |
| 150 |
self.exitRule() |
| 151 |
return localctx |
| 152 |
|
| 153 |
class BlocksContext(ParserRuleContext): |
| 154 |
|
| 155 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 156 |
super().__init__(parent, invokingState) |
| 157 |
self.parser = parser |
| 158 |
|
| 159 |
def block(self, i:int=None): |
| 160 |
if i is None: |
| 161 |
return self.getTypedRuleContexts(TacticNotationsParser.BlockContext) |
| 162 |
else: |
| 163 |
return self.getTypedRuleContext(TacticNotationsParser.BlockContext,i) |
| 164 |
|
| 165 |
|
| 166 |
def whitespace(self, i:int=None): |
| 167 |
if i is None: |
| 168 |
return self.getTypedRuleContexts(TacticNotationsParser.WhitespaceContext) |
| 169 |
else: |
| 170 |
return self.getTypedRuleContext(TacticNotationsParser.WhitespaceContext,i) |
| 171 |
|
| 172 |
|
| 173 |
def getRuleIndex(self): |
| 174 |
return TacticNotationsParser.RULE_blocks |
| 175 |
|
| 176 |
def accept(self, visitor:ParseTreeVisitor): |
| 177 |
if hasattr( visitor, "visitBlocks" ): |
| 178 |
return visitor.visitBlocks(self) |
| 179 |
else: |
| 180 |
return visitor.visitChildren(self) |
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
def blocks(self): |
| 186 |
|
| 187 |
localctx = TacticNotationsParser.BlocksContext(self, self._ctx, self.state) |
| 188 |
self.enterRule(localctx, 2, self.RULE_blocks) |
| 189 |
self._la = 0 |
| 190 |
try: |
| 191 |
self.enterOuterAlt(localctx, 1) |
| 192 |
self.state = 33 |
| 193 |
self.block() |
| 194 |
self.state = 40 |
| 195 |
self._errHandler.sync(self) |
| 196 |
_alt = self._interp.adaptivePredict(self._input,1,self._ctx) |
| 197 |
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: |
| 198 |
if _alt==1: |
| 199 |
self.state = 35 |
| 200 |
self._errHandler.sync(self) |
| 201 |
_la = self._input.LA(1) |
| 202 |
if _la==TacticNotationsParser.WHITESPACE: |
| 203 |
self.state = 34 |
| 204 |
self.whitespace() |
| 205 |
|
| 206 |
|
| 207 |
self.state = 37 |
| 208 |
self.block() |
| 209 |
self.state = 42 |
| 210 |
self._errHandler.sync(self) |
| 211 |
_alt = self._interp.adaptivePredict(self._input,1,self._ctx) |
| 212 |
|
| 213 |
except RecognitionException as re: |
| 214 |
localctx.exception = re |
| 215 |
self._errHandler.reportError(self, re) |
| 216 |
self._errHandler.recover(self, re) |
| 217 |
finally: |
| 218 |
self.exitRule() |
| 219 |
return localctx |
| 220 |
|
| 221 |
class BlockContext(ParserRuleContext): |
| 222 |
|
| 223 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 224 |
super().__init__(parent, invokingState) |
| 225 |
self.parser = parser |
| 226 |
|
| 227 |
def pipe(self): |
| 228 |
return self.getTypedRuleContext(TacticNotationsParser.PipeContext,0) |
| 229 |
|
| 230 |
|
| 231 |
def nopipeblock(self): |
| 232 |
return self.getTypedRuleContext(TacticNotationsParser.NopipeblockContext,0) |
| 233 |
|
| 234 |
|
| 235 |
def getRuleIndex(self): |
| 236 |
return TacticNotationsParser.RULE_block |
| 237 |
|
| 238 |
def accept(self, visitor:ParseTreeVisitor): |
| 239 |
if hasattr( visitor, "visitBlock" ): |
| 240 |
return visitor.visitBlock(self) |
| 241 |
else: |
| 242 |
return visitor.visitChildren(self) |
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
def block(self): |
| 248 |
|
| 249 |
localctx = TacticNotationsParser.BlockContext(self, self._ctx, self.state) |
| 250 |
self.enterRule(localctx, 4, self.RULE_block) |
| 251 |
try: |
| 252 |
self.state = 45 |
| 253 |
self._errHandler.sync(self) |
| 254 |
token = self._input.LA(1) |
| 255 |
if token in [TacticNotationsParser.PIPE]: |
| 256 |
self.enterOuterAlt(localctx, 1) |
| 257 |
self.state = 43 |
| 258 |
self.pipe() |
| 259 |
pass |
| 260 |
elif token in [TacticNotationsParser.LALT, TacticNotationsParser.LGROUP, TacticNotationsParser.LBRACE, TacticNotationsParser.ESCAPED, TacticNotationsParser.ATOM, TacticNotationsParser.ID]: |
| 261 |
self.enterOuterAlt(localctx, 2) |
| 262 |
self.state = 44 |
| 263 |
self.nopipeblock() |
| 264 |
pass |
| 265 |
else: |
| 266 |
raise NoViableAltException(self) |
| 267 |
|
| 268 |
except RecognitionException as re: |
| 269 |
localctx.exception = re |
| 270 |
self._errHandler.reportError(self, re) |
| 271 |
self._errHandler.recover(self, re) |
| 272 |
finally: |
| 273 |
self.exitRule() |
| 274 |
return localctx |
| 275 |
|
| 276 |
class NopipeblockContext(ParserRuleContext): |
| 277 |
|
| 278 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 279 |
super().__init__(parent, invokingState) |
| 280 |
self.parser = parser |
| 281 |
|
| 282 |
def atomic(self): |
| 283 |
return self.getTypedRuleContext(TacticNotationsParser.AtomicContext,0) |
| 284 |
|
| 285 |
|
| 286 |
def escaped(self): |
| 287 |
return self.getTypedRuleContext(TacticNotationsParser.EscapedContext,0) |
| 288 |
|
| 289 |
|
| 290 |
def hole(self): |
| 291 |
return self.getTypedRuleContext(TacticNotationsParser.HoleContext,0) |
| 292 |
|
| 293 |
|
| 294 |
def alternative(self): |
| 295 |
return self.getTypedRuleContext(TacticNotationsParser.AlternativeContext,0) |
| 296 |
|
| 297 |
|
| 298 |
def repeat(self): |
| 299 |
return self.getTypedRuleContext(TacticNotationsParser.RepeatContext,0) |
| 300 |
|
| 301 |
|
| 302 |
def curlies(self): |
| 303 |
return self.getTypedRuleContext(TacticNotationsParser.CurliesContext,0) |
| 304 |
|
| 305 |
|
| 306 |
def getRuleIndex(self): |
| 307 |
return TacticNotationsParser.RULE_nopipeblock |
| 308 |
|
| 309 |
def accept(self, visitor:ParseTreeVisitor): |
| 310 |
if hasattr( visitor, "visitNopipeblock" ): |
| 311 |
return visitor.visitNopipeblock(self) |
| 312 |
else: |
| 313 |
return visitor.visitChildren(self) |
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
def nopipeblock(self): |
| 319 |
|
| 320 |
localctx = TacticNotationsParser.NopipeblockContext(self, self._ctx, self.state) |
| 321 |
self.enterRule(localctx, 6, self.RULE_nopipeblock) |
| 322 |
try: |
| 323 |
self.state = 53 |
| 324 |
self._errHandler.sync(self) |
| 325 |
token = self._input.LA(1) |
| 326 |
if token in [TacticNotationsParser.ATOM]: |
| 327 |
self.enterOuterAlt(localctx, 1) |
| 328 |
self.state = 47 |
| 329 |
self.atomic() |
| 330 |
pass |
| 331 |
elif token in [TacticNotationsParser.ESCAPED]: |
| 332 |
self.enterOuterAlt(localctx, 2) |
| 333 |
self.state = 48 |
| 334 |
self.escaped() |
| 335 |
pass |
| 336 |
elif token in [TacticNotationsParser.ID]: |
| 337 |
self.enterOuterAlt(localctx, 3) |
| 338 |
self.state = 49 |
| 339 |
self.hole() |
| 340 |
pass |
| 341 |
elif token in [TacticNotationsParser.LALT]: |
| 342 |
self.enterOuterAlt(localctx, 4) |
| 343 |
self.state = 50 |
| 344 |
self.alternative() |
| 345 |
pass |
| 346 |
elif token in [TacticNotationsParser.LGROUP]: |
| 347 |
self.enterOuterAlt(localctx, 5) |
| 348 |
self.state = 51 |
| 349 |
self.repeat() |
| 350 |
pass |
| 351 |
elif token in [TacticNotationsParser.LBRACE]: |
| 352 |
self.enterOuterAlt(localctx, 6) |
| 353 |
self.state = 52 |
| 354 |
self.curlies() |
| 355 |
pass |
| 356 |
else: |
| 357 |
raise NoViableAltException(self) |
| 358 |
|
| 359 |
except RecognitionException as re: |
| 360 |
localctx.exception = re |
| 361 |
self._errHandler.reportError(self, re) |
| 362 |
self._errHandler.recover(self, re) |
| 363 |
finally: |
| 364 |
self.exitRule() |
| 365 |
return localctx |
| 366 |
|
| 367 |
class AlternativeContext(ParserRuleContext): |
| 368 |
|
| 369 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 370 |
super().__init__(parent, invokingState) |
| 371 |
self.parser = parser |
| 372 |
|
| 373 |
def LALT(self): |
| 374 |
return self.getToken(TacticNotationsParser.LALT, 0) |
| 375 |
|
| 376 |
def altblocks(self): |
| 377 |
return self.getTypedRuleContext(TacticNotationsParser.AltblocksContext,0) |
| 378 |
|
| 379 |
|
| 380 |
def RBRACE(self): |
| 381 |
return self.getToken(TacticNotationsParser.RBRACE, 0) |
| 382 |
|
| 383 |
def WHITESPACE(self, i:int=None): |
| 384 |
if i is None: |
| 385 |
return self.getTokens(TacticNotationsParser.WHITESPACE) |
| 386 |
else: |
| 387 |
return self.getToken(TacticNotationsParser.WHITESPACE, i) |
| 388 |
|
| 389 |
def getRuleIndex(self): |
| 390 |
return TacticNotationsParser.RULE_alternative |
| 391 |
|
| 392 |
def accept(self, visitor:ParseTreeVisitor): |
| 393 |
if hasattr( visitor, "visitAlternative" ): |
| 394 |
return visitor.visitAlternative(self) |
| 395 |
else: |
| 396 |
return visitor.visitChildren(self) |
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
def alternative(self): |
| 402 |
|
| 403 |
localctx = TacticNotationsParser.AlternativeContext(self, self._ctx, self.state) |
| 404 |
self.enterRule(localctx, 8, self.RULE_alternative) |
| 405 |
self._la = 0 |
| 406 |
try: |
| 407 |
self.enterOuterAlt(localctx, 1) |
| 408 |
self.state = 55 |
| 409 |
self.match(TacticNotationsParser.LALT) |
| 410 |
self.state = 57 |
| 411 |
self._errHandler.sync(self) |
| 412 |
_la = self._input.LA(1) |
| 413 |
if _la==TacticNotationsParser.WHITESPACE: |
| 414 |
self.state = 56 |
| 415 |
self.match(TacticNotationsParser.WHITESPACE) |
| 416 |
|
| 417 |
|
| 418 |
self.state = 59 |
| 419 |
self.altblocks() |
| 420 |
self.state = 61 |
| 421 |
self._errHandler.sync(self) |
| 422 |
_la = self._input.LA(1) |
| 423 |
if _la==TacticNotationsParser.WHITESPACE: |
| 424 |
self.state = 60 |
| 425 |
self.match(TacticNotationsParser.WHITESPACE) |
| 426 |
|
| 427 |
|
| 428 |
self.state = 63 |
| 429 |
self.match(TacticNotationsParser.RBRACE) |
| 430 |
except RecognitionException as re: |
| 431 |
localctx.exception = re |
| 432 |
self._errHandler.reportError(self, re) |
| 433 |
self._errHandler.recover(self, re) |
| 434 |
finally: |
| 435 |
self.exitRule() |
| 436 |
return localctx |
| 437 |
|
| 438 |
class AltblocksContext(ParserRuleContext): |
| 439 |
|
| 440 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 441 |
super().__init__(parent, invokingState) |
| 442 |
self.parser = parser |
| 443 |
|
| 444 |
def altblock(self, i:int=None): |
| 445 |
if i is None: |
| 446 |
return self.getTypedRuleContexts(TacticNotationsParser.AltblockContext) |
| 447 |
else: |
| 448 |
return self.getTypedRuleContext(TacticNotationsParser.AltblockContext,i) |
| 449 |
|
| 450 |
|
| 451 |
def altsep(self, i:int=None): |
| 452 |
if i is None: |
| 453 |
return self.getTypedRuleContexts(TacticNotationsParser.AltsepContext) |
| 454 |
else: |
| 455 |
return self.getTypedRuleContext(TacticNotationsParser.AltsepContext,i) |
| 456 |
|
| 457 |
|
| 458 |
def WHITESPACE(self, i:int=None): |
| 459 |
if i is None: |
| 460 |
return self.getTokens(TacticNotationsParser.WHITESPACE) |
| 461 |
else: |
| 462 |
return self.getToken(TacticNotationsParser.WHITESPACE, i) |
| 463 |
|
| 464 |
def getRuleIndex(self): |
| 465 |
return TacticNotationsParser.RULE_altblocks |
| 466 |
|
| 467 |
def accept(self, visitor:ParseTreeVisitor): |
| 468 |
if hasattr( visitor, "visitAltblocks" ): |
| 469 |
return visitor.visitAltblocks(self) |
| 470 |
else: |
| 471 |
return visitor.visitChildren(self) |
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
def altblocks(self): |
| 477 |
|
| 478 |
localctx = TacticNotationsParser.AltblocksContext(self, self._ctx, self.state) |
| 479 |
self.enterRule(localctx, 10, self.RULE_altblocks) |
| 480 |
self._la = 0 |
| 481 |
try: |
| 482 |
self.enterOuterAlt(localctx, 1) |
| 483 |
self.state = 65 |
| 484 |
self.altblock() |
| 485 |
self.state = 75 |
| 486 |
self._errHandler.sync(self) |
| 487 |
_alt = 1 |
| 488 |
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: |
| 489 |
if _alt == 1: |
| 490 |
self.state = 67 |
| 491 |
self._errHandler.sync(self) |
| 492 |
_la = self._input.LA(1) |
| 493 |
if _la==TacticNotationsParser.WHITESPACE: |
| 494 |
self.state = 66 |
| 495 |
self.match(TacticNotationsParser.WHITESPACE) |
| 496 |
|
| 497 |
|
| 498 |
self.state = 69 |
| 499 |
self.altsep() |
| 500 |
self.state = 71 |
| 501 |
self._errHandler.sync(self) |
| 502 |
_la = self._input.LA(1) |
| 503 |
if _la==TacticNotationsParser.WHITESPACE: |
| 504 |
self.state = 70 |
| 505 |
self.match(TacticNotationsParser.WHITESPACE) |
| 506 |
|
| 507 |
|
| 508 |
self.state = 73 |
| 509 |
self.altblock() |
| 510 |
|
| 511 |
else: |
| 512 |
raise NoViableAltException(self) |
| 513 |
self.state = 77 |
| 514 |
self._errHandler.sync(self) |
| 515 |
_alt = self._interp.adaptivePredict(self._input,8,self._ctx) |
| 516 |
|
| 517 |
except RecognitionException as re: |
| 518 |
localctx.exception = re |
| 519 |
self._errHandler.reportError(self, re) |
| 520 |
self._errHandler.recover(self, re) |
| 521 |
finally: |
| 522 |
self.exitRule() |
| 523 |
return localctx |
| 524 |
|
| 525 |
class AltblockContext(ParserRuleContext): |
| 526 |
|
| 527 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 528 |
super().__init__(parent, invokingState) |
| 529 |
self.parser = parser |
| 530 |
|
| 531 |
def nopipeblock(self, i:int=None): |
| 532 |
if i is None: |
| 533 |
return self.getTypedRuleContexts(TacticNotationsParser.NopipeblockContext) |
| 534 |
else: |
| 535 |
return self.getTypedRuleContext(TacticNotationsParser.NopipeblockContext,i) |
| 536 |
|
| 537 |
|
| 538 |
def whitespace(self, i:int=None): |
| 539 |
if i is None: |
| 540 |
return self.getTypedRuleContexts(TacticNotationsParser.WhitespaceContext) |
| 541 |
else: |
| 542 |
return self.getTypedRuleContext(TacticNotationsParser.WhitespaceContext,i) |
| 543 |
|
| 544 |
|
| 545 |
def getRuleIndex(self): |
| 546 |
return TacticNotationsParser.RULE_altblock |
| 547 |
|
| 548 |
def accept(self, visitor:ParseTreeVisitor): |
| 549 |
if hasattr( visitor, "visitAltblock" ): |
| 550 |
return visitor.visitAltblock(self) |
| 551 |
else: |
| 552 |
return visitor.visitChildren(self) |
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
def altblock(self): |
| 558 |
|
| 559 |
localctx = TacticNotationsParser.AltblockContext(self, self._ctx, self.state) |
| 560 |
self.enterRule(localctx, 12, self.RULE_altblock) |
| 561 |
self._la = 0 |
| 562 |
try: |
| 563 |
self.enterOuterAlt(localctx, 1) |
| 564 |
self.state = 79 |
| 565 |
self.nopipeblock() |
| 566 |
self.state = 86 |
| 567 |
self._errHandler.sync(self) |
| 568 |
_alt = self._interp.adaptivePredict(self._input,10,self._ctx) |
| 569 |
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: |
| 570 |
if _alt==1: |
| 571 |
self.state = 81 |
| 572 |
self._errHandler.sync(self) |
| 573 |
_la = self._input.LA(1) |
| 574 |
if _la==TacticNotationsParser.WHITESPACE: |
| 575 |
self.state = 80 |
| 576 |
self.whitespace() |
| 577 |
|
| 578 |
|
| 579 |
self.state = 83 |
| 580 |
self.nopipeblock() |
| 581 |
self.state = 88 |
| 582 |
self._errHandler.sync(self) |
| 583 |
_alt = self._interp.adaptivePredict(self._input,10,self._ctx) |
| 584 |
|
| 585 |
except RecognitionException as re: |
| 586 |
localctx.exception = re |
| 587 |
self._errHandler.reportError(self, re) |
| 588 |
self._errHandler.recover(self, re) |
| 589 |
finally: |
| 590 |
self.exitRule() |
| 591 |
return localctx |
| 592 |
|
| 593 |
class RepeatContext(ParserRuleContext): |
| 594 |
|
| 595 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 596 |
super().__init__(parent, invokingState) |
| 597 |
self.parser = parser |
| 598 |
|
| 599 |
def LGROUP(self): |
| 600 |
return self.getToken(TacticNotationsParser.LGROUP, 0) |
| 601 |
|
| 602 |
def WHITESPACE(self, i:int=None): |
| 603 |
if i is None: |
| 604 |
return self.getTokens(TacticNotationsParser.WHITESPACE) |
| 605 |
else: |
| 606 |
return self.getToken(TacticNotationsParser.WHITESPACE, i) |
| 607 |
|
| 608 |
def blocks(self): |
| 609 |
return self.getTypedRuleContext(TacticNotationsParser.BlocksContext,0) |
| 610 |
|
| 611 |
|
| 612 |
def RBRACE(self): |
| 613 |
return self.getToken(TacticNotationsParser.RBRACE, 0) |
| 614 |
|
| 615 |
def ATOM(self): |
| 616 |
return self.getToken(TacticNotationsParser.ATOM, 0) |
| 617 |
|
| 618 |
def PIPE(self): |
| 619 |
return self.getToken(TacticNotationsParser.PIPE, 0) |
| 620 |
|
| 621 |
def getRuleIndex(self): |
| 622 |
return TacticNotationsParser.RULE_repeat |
| 623 |
|
| 624 |
def accept(self, visitor:ParseTreeVisitor): |
| 625 |
if hasattr( visitor, "visitRepeat" ): |
| 626 |
return visitor.visitRepeat(self) |
| 627 |
else: |
| 628 |
return visitor.visitChildren(self) |
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
def repeat(self): |
| 634 |
|
| 635 |
localctx = TacticNotationsParser.RepeatContext(self, self._ctx, self.state) |
| 636 |
self.enterRule(localctx, 14, self.RULE_repeat) |
| 637 |
self._la = 0 |
| 638 |
try: |
| 639 |
self.enterOuterAlt(localctx, 1) |
| 640 |
self.state = 89 |
| 641 |
self.match(TacticNotationsParser.LGROUP) |
| 642 |
self.state = 91 |
| 643 |
self._errHandler.sync(self) |
| 644 |
_la = self._input.LA(1) |
| 645 |
if _la==TacticNotationsParser.PIPE or _la==TacticNotationsParser.ATOM: |
| 646 |
self.state = 90 |
| 647 |
_la = self._input.LA(1) |
| 648 |
if not(_la==TacticNotationsParser.PIPE or _la==TacticNotationsParser.ATOM): |
| 649 |
self._errHandler.recoverInline(self) |
| 650 |
else: |
| 651 |
self._errHandler.reportMatch(self) |
| 652 |
self.consume() |
| 653 |
|
| 654 |
|
| 655 |
self.state = 93 |
| 656 |
self.match(TacticNotationsParser.WHITESPACE) |
| 657 |
self.state = 94 |
| 658 |
self.blocks() |
| 659 |
self.state = 96 |
| 660 |
self._errHandler.sync(self) |
| 661 |
_la = self._input.LA(1) |
| 662 |
if _la==TacticNotationsParser.WHITESPACE: |
| 663 |
self.state = 95 |
| 664 |
self.match(TacticNotationsParser.WHITESPACE) |
| 665 |
|
| 666 |
|
| 667 |
self.state = 98 |
| 668 |
self.match(TacticNotationsParser.RBRACE) |
| 669 |
except RecognitionException as re: |
| 670 |
localctx.exception = re |
| 671 |
self._errHandler.reportError(self, re) |
| 672 |
self._errHandler.recover(self, re) |
| 673 |
finally: |
| 674 |
self.exitRule() |
| 675 |
return localctx |
| 676 |
|
| 677 |
class CurliesContext(ParserRuleContext): |
| 678 |
|
| 679 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 680 |
super().__init__(parent, invokingState) |
| 681 |
self.parser = parser |
| 682 |
|
| 683 |
def LBRACE(self): |
| 684 |
return self.getToken(TacticNotationsParser.LBRACE, 0) |
| 685 |
|
| 686 |
def blocks(self): |
| 687 |
return self.getTypedRuleContext(TacticNotationsParser.BlocksContext,0) |
| 688 |
|
| 689 |
|
| 690 |
def RBRACE(self): |
| 691 |
return self.getToken(TacticNotationsParser.RBRACE, 0) |
| 692 |
|
| 693 |
def whitespace(self, i:int=None): |
| 694 |
if i is None: |
| 695 |
return self.getTypedRuleContexts(TacticNotationsParser.WhitespaceContext) |
| 696 |
else: |
| 697 |
return self.getTypedRuleContext(TacticNotationsParser.WhitespaceContext,i) |
| 698 |
|
| 699 |
|
| 700 |
def getRuleIndex(self): |
| 701 |
return TacticNotationsParser.RULE_curlies |
| 702 |
|
| 703 |
def accept(self, visitor:ParseTreeVisitor): |
| 704 |
if hasattr( visitor, "visitCurlies" ): |
| 705 |
return visitor.visitCurlies(self) |
| 706 |
else: |
| 707 |
return visitor.visitChildren(self) |
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
def curlies(self): |
| 713 |
|
| 714 |
localctx = TacticNotationsParser.CurliesContext(self, self._ctx, self.state) |
| 715 |
self.enterRule(localctx, 16, self.RULE_curlies) |
| 716 |
self._la = 0 |
| 717 |
try: |
| 718 |
self.enterOuterAlt(localctx, 1) |
| 719 |
self.state = 100 |
| 720 |
self.match(TacticNotationsParser.LBRACE) |
| 721 |
self.state = 102 |
| 722 |
self._errHandler.sync(self) |
| 723 |
_la = self._input.LA(1) |
| 724 |
if _la==TacticNotationsParser.WHITESPACE: |
| 725 |
self.state = 101 |
| 726 |
self.whitespace() |
| 727 |
|
| 728 |
|
| 729 |
self.state = 104 |
| 730 |
self.blocks() |
| 731 |
self.state = 106 |
| 732 |
self._errHandler.sync(self) |
| 733 |
_la = self._input.LA(1) |
| 734 |
if _la==TacticNotationsParser.WHITESPACE: |
| 735 |
self.state = 105 |
| 736 |
self.whitespace() |
| 737 |
|
| 738 |
|
| 739 |
self.state = 108 |
| 740 |
self.match(TacticNotationsParser.RBRACE) |
| 741 |
except RecognitionException as re: |
| 742 |
localctx.exception = re |
| 743 |
self._errHandler.reportError(self, re) |
| 744 |
self._errHandler.recover(self, re) |
| 745 |
finally: |
| 746 |
self.exitRule() |
| 747 |
return localctx |
| 748 |
|
| 749 |
class PipeContext(ParserRuleContext): |
| 750 |
|
| 751 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 752 |
super().__init__(parent, invokingState) |
| 753 |
self.parser = parser |
| 754 |
|
| 755 |
def PIPE(self): |
| 756 |
return self.getToken(TacticNotationsParser.PIPE, 0) |
| 757 |
|
| 758 |
def getRuleIndex(self): |
| 759 |
return TacticNotationsParser.RULE_pipe |
| 760 |
|
| 761 |
def accept(self, visitor:ParseTreeVisitor): |
| 762 |
if hasattr( visitor, "visitPipe" ): |
| 763 |
return visitor.visitPipe(self) |
| 764 |
else: |
| 765 |
return visitor.visitChildren(self) |
| 766 |
|
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
def pipe(self): |
| 771 |
|
| 772 |
localctx = TacticNotationsParser.PipeContext(self, self._ctx, self.state) |
| 773 |
self.enterRule(localctx, 18, self.RULE_pipe) |
| 774 |
try: |
| 775 |
self.enterOuterAlt(localctx, 1) |
| 776 |
self.state = 110 |
| 777 |
self.match(TacticNotationsParser.PIPE) |
| 778 |
except RecognitionException as re: |
| 779 |
localctx.exception = re |
| 780 |
self._errHandler.reportError(self, re) |
| 781 |
self._errHandler.recover(self, re) |
| 782 |
finally: |
| 783 |
self.exitRule() |
| 784 |
return localctx |
| 785 |
|
| 786 |
class AltsepContext(ParserRuleContext): |
| 787 |
|
| 788 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 789 |
super().__init__(parent, invokingState) |
| 790 |
self.parser = parser |
| 791 |
|
| 792 |
def PIPE(self): |
| 793 |
return self.getToken(TacticNotationsParser.PIPE, 0) |
| 794 |
|
| 795 |
def getRuleIndex(self): |
| 796 |
return TacticNotationsParser.RULE_altsep |
| 797 |
|
| 798 |
def accept(self, visitor:ParseTreeVisitor): |
| 799 |
if hasattr( visitor, "visitAltsep" ): |
| 800 |
return visitor.visitAltsep(self) |
| 801 |
else: |
| 802 |
return visitor.visitChildren(self) |
| 803 |
|
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
def altsep(self): |
| 808 |
|
| 809 |
localctx = TacticNotationsParser.AltsepContext(self, self._ctx, self.state) |
| 810 |
self.enterRule(localctx, 20, self.RULE_altsep) |
| 811 |
try: |
| 812 |
self.enterOuterAlt(localctx, 1) |
| 813 |
self.state = 112 |
| 814 |
self.match(TacticNotationsParser.PIPE) |
| 815 |
except RecognitionException as re: |
| 816 |
localctx.exception = re |
| 817 |
self._errHandler.reportError(self, re) |
| 818 |
self._errHandler.recover(self, re) |
| 819 |
finally: |
| 820 |
self.exitRule() |
| 821 |
return localctx |
| 822 |
|
| 823 |
class WhitespaceContext(ParserRuleContext): |
| 824 |
|
| 825 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 826 |
super().__init__(parent, invokingState) |
| 827 |
self.parser = parser |
| 828 |
|
| 829 |
def WHITESPACE(self): |
| 830 |
return self.getToken(TacticNotationsParser.WHITESPACE, 0) |
| 831 |
|
| 832 |
def getRuleIndex(self): |
| 833 |
return TacticNotationsParser.RULE_whitespace |
| 834 |
|
| 835 |
def accept(self, visitor:ParseTreeVisitor): |
| 836 |
if hasattr( visitor, "visitWhitespace" ): |
| 837 |
return visitor.visitWhitespace(self) |
| 838 |
else: |
| 839 |
return visitor.visitChildren(self) |
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
def whitespace(self): |
| 845 |
|
| 846 |
localctx = TacticNotationsParser.WhitespaceContext(self, self._ctx, self.state) |
| 847 |
self.enterRule(localctx, 22, self.RULE_whitespace) |
| 848 |
try: |
| 849 |
self.enterOuterAlt(localctx, 1) |
| 850 |
self.state = 114 |
| 851 |
self.match(TacticNotationsParser.WHITESPACE) |
| 852 |
except RecognitionException as re: |
| 853 |
localctx.exception = re |
| 854 |
self._errHandler.reportError(self, re) |
| 855 |
self._errHandler.recover(self, re) |
| 856 |
finally: |
| 857 |
self.exitRule() |
| 858 |
return localctx |
| 859 |
|
| 860 |
class EscapedContext(ParserRuleContext): |
| 861 |
|
| 862 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 863 |
super().__init__(parent, invokingState) |
| 864 |
self.parser = parser |
| 865 |
|
| 866 |
def ESCAPED(self): |
| 867 |
return self.getToken(TacticNotationsParser.ESCAPED, 0) |
| 868 |
|
| 869 |
def getRuleIndex(self): |
| 870 |
return TacticNotationsParser.RULE_escaped |
| 871 |
|
| 872 |
def accept(self, visitor:ParseTreeVisitor): |
| 873 |
if hasattr( visitor, "visitEscaped" ): |
| 874 |
return visitor.visitEscaped(self) |
| 875 |
else: |
| 876 |
return visitor.visitChildren(self) |
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
def escaped(self): |
| 882 |
|
| 883 |
localctx = TacticNotationsParser.EscapedContext(self, self._ctx, self.state) |
| 884 |
self.enterRule(localctx, 24, self.RULE_escaped) |
| 885 |
try: |
| 886 |
self.enterOuterAlt(localctx, 1) |
| 887 |
self.state = 116 |
| 888 |
self.match(TacticNotationsParser.ESCAPED) |
| 889 |
except RecognitionException as re: |
| 890 |
localctx.exception = re |
| 891 |
self._errHandler.reportError(self, re) |
| 892 |
self._errHandler.recover(self, re) |
| 893 |
finally: |
| 894 |
self.exitRule() |
| 895 |
return localctx |
| 896 |
|
| 897 |
class AtomicContext(ParserRuleContext): |
| 898 |
|
| 899 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 900 |
super().__init__(parent, invokingState) |
| 901 |
self.parser = parser |
| 902 |
|
| 903 |
def ATOM(self): |
| 904 |
return self.getToken(TacticNotationsParser.ATOM, 0) |
| 905 |
|
| 906 |
def SUB(self): |
| 907 |
return self.getToken(TacticNotationsParser.SUB, 0) |
| 908 |
|
| 909 |
def getRuleIndex(self): |
| 910 |
return TacticNotationsParser.RULE_atomic |
| 911 |
|
| 912 |
def accept(self, visitor:ParseTreeVisitor): |
| 913 |
if hasattr( visitor, "visitAtomic" ): |
| 914 |
return visitor.visitAtomic(self) |
| 915 |
else: |
| 916 |
return visitor.visitChildren(self) |
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
def atomic(self): |
| 922 |
|
| 923 |
localctx = TacticNotationsParser.AtomicContext(self, self._ctx, self.state) |
| 924 |
self.enterRule(localctx, 26, self.RULE_atomic) |
| 925 |
self._la = 0 |
| 926 |
try: |
| 927 |
self.enterOuterAlt(localctx, 1) |
| 928 |
self.state = 118 |
| 929 |
self.match(TacticNotationsParser.ATOM) |
| 930 |
self.state = 120 |
| 931 |
self._errHandler.sync(self) |
| 932 |
_la = self._input.LA(1) |
| 933 |
if _la==TacticNotationsParser.SUB: |
| 934 |
self.state = 119 |
| 935 |
self.match(TacticNotationsParser.SUB) |
| 936 |
|
| 937 |
|
| 938 |
except RecognitionException as re: |
| 939 |
localctx.exception = re |
| 940 |
self._errHandler.reportError(self, re) |
| 941 |
self._errHandler.recover(self, re) |
| 942 |
finally: |
| 943 |
self.exitRule() |
| 944 |
return localctx |
| 945 |
|
| 946 |
class HoleContext(ParserRuleContext): |
| 947 |
|
| 948 |
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): |
| 949 |
super().__init__(parent, invokingState) |
| 950 |
self.parser = parser |
| 951 |
|
| 952 |
def ID(self): |
| 953 |
return self.getToken(TacticNotationsParser.ID, 0) |
| 954 |
|
| 955 |
def SUB(self): |
| 956 |
return self.getToken(TacticNotationsParser.SUB, 0) |
| 957 |
|
| 958 |
def getRuleIndex(self): |
| 959 |
return TacticNotationsParser.RULE_hole |
| 960 |
|
| 961 |
def accept(self, visitor:ParseTreeVisitor): |
| 962 |
if hasattr( visitor, "visitHole" ): |
| 963 |
return visitor.visitHole(self) |
| 964 |
else: |
| 965 |
return visitor.visitChildren(self) |
| 966 |
|
| 967 |
|
| 968 |
|
| 969 |
|
| 970 |
def hole(self): |
| 971 |
|
| 972 |
localctx = TacticNotationsParser.HoleContext(self, self._ctx, self.state) |
| 973 |
self.enterRule(localctx, 28, self.RULE_hole) |
| 974 |
self._la = 0 |
| 975 |
try: |
| 976 |
self.enterOuterAlt(localctx, 1) |
| 977 |
self.state = 122 |
| 978 |
self.match(TacticNotationsParser.ID) |
| 979 |
self.state = 124 |
| 980 |
self._errHandler.sync(self) |
| 981 |
_la = self._input.LA(1) |
| 982 |
if _la==TacticNotationsParser.SUB: |
| 983 |
self.state = 123 |
| 984 |
self.match(TacticNotationsParser.SUB) |
| 985 |
|
| 986 |
|
| 987 |
except RecognitionException as re: |
| 988 |
localctx.exception = re |
| 989 |
self._errHandler.reportError(self, re) |
| 990 |
self._errHandler.recover(self, re) |
| 991 |
finally: |
| 992 |
self.exitRule() |
| 993 |
return localctx |