# Generated from TacticNotations.g by ANTLR 4.7.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys

def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\f")
        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")
        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")
        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")
        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")
        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")
        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")
        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")
        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")
        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")
        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")
        buf.write("\20\3\20\5\20\177\n\20\3\20\2\2\21\2\4\6\b\n\f\16\20\22")
        buf.write("\24\26\30\32\34\36\2\3\3\2\b\t\2\u0086\2 \3\2\2\2\4#\3")
        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")
        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")
        buf.write("\2\2\30t\3\2\2\2\32v\3\2\2\2\34x\3\2\2\2\36|\3\2\2\2 ")
        buf.write("!\5\4\3\2!\"\7\2\2\3\"\3\3\2\2\2#*\5\6\4\2$&\5\30\r\2")
        buf.write("%$\3\2\2\2%&\3\2\2\2&\'\3\2\2\2\')\5\6\4\2(%\3\2\2\2)")
        buf.write(",\3\2\2\2*(\3\2\2\2*+\3\2\2\2+\5\3\2\2\2,*\3\2\2\2-\60")
        buf.write("\5\24\13\2.\60\5\b\5\2/-\3\2\2\2/.\3\2\2\2\60\7\3\2\2")
        buf.write("\2\618\5\34\17\2\628\5\32\16\2\638\5\36\20\2\648\5\n\6")
        buf.write("\2\658\5\20\t\2\668\5\22\n\2\67\61\3\2\2\2\67\62\3\2\2")
        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")
        buf.write("\2\28\t\3\2\2\29;\7\3\2\2:<\7\f\2\2;:\3\2\2\2;<\3\2\2")
        buf.write("\2<=\3\2\2\2=?\5\f\7\2>@\7\f\2\2?>\3\2\2\2?@\3\2\2\2@")
        buf.write("A\3\2\2\2AB\7\6\2\2B\13\3\2\2\2CM\5\16\b\2DF\7\f\2\2E")
        buf.write("D\3\2\2\2EF\3\2\2\2FG\3\2\2\2GI\5\26\f\2HJ\7\f\2\2IH\3")
        buf.write("\2\2\2IJ\3\2\2\2JK\3\2\2\2KL\5\16\b\2LN\3\2\2\2ME\3\2")
        buf.write("\2\2NO\3\2\2\2OM\3\2\2\2OP\3\2\2\2P\r\3\2\2\2QX\5\b\5")
        buf.write("\2RT\5\30\r\2SR\3\2\2\2ST\3\2\2\2TU\3\2\2\2UW\5\b\5\2")
        buf.write("VS\3\2\2\2WZ\3\2\2\2XV\3\2\2\2XY\3\2\2\2Y\17\3\2\2\2Z")
        buf.write("X\3\2\2\2[]\7\4\2\2\\^\t\2\2\2]\\\3\2\2\2]^\3\2\2\2^_")
        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")
        buf.write("\2\2cd\3\2\2\2de\7\6\2\2e\21\3\2\2\2fh\7\5\2\2gi\5\30")
        buf.write("\r\2hg\3\2\2\2hi\3\2\2\2ij\3\2\2\2jl\5\4\3\2km\5\30\r")
        buf.write("\2lk\3\2\2\2lm\3\2\2\2mn\3\2\2\2no\7\6\2\2o\23\3\2\2\2")
        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")
        buf.write("u\31\3\2\2\2vw\7\7\2\2w\33\3\2\2\2xz\7\t\2\2y{\7\13\2")
        buf.write("\2zy\3\2\2\2z{\3\2\2\2{\35\3\2\2\2|~\7\n\2\2}\177\7\13")
        buf.write("\2\2~}\3\2\2\2~\177\3\2\2\2\177\37\3\2\2\2\23%*/\67;?")
        buf.write("EIOSX]bhlz~")
        return buf.getvalue()


class TacticNotationsParser ( Parser ):

    grammarFileName = "TacticNotations.g"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'{|'", "<INVALID>", "'{'", "'}'", "<INVALID>",
                     "'|'" ]

    symbolicNames = [ "<INVALID>", "LALT", "LGROUP", "LBRACE", "RBRACE",
                      "ESCAPED", "PIPE", "ATOM", "ID", "SUB", "WHITESPACE" ]

    RULE_top = 0
    RULE_blocks = 1
    RULE_block = 2
    RULE_nopipeblock = 3
    RULE_alternative = 4
    RULE_altblocks = 5
    RULE_altblock = 6
    RULE_repeat = 7
    RULE_curlies = 8
    RULE_pipe = 9
    RULE_altsep = 10
    RULE_whitespace = 11
    RULE_escaped = 12
    RULE_atomic = 13
    RULE_hole = 14

    ruleNames =  [ "top", "blocks", "block", "nopipeblock", "alternative",
                   "altblocks", "altblock", "repeat", "curlies", "pipe",
                   "altsep", "whitespace", "escaped", "atomic", "hole" ]

    EOF = Token.EOF
    LALT=1
    LGROUP=2
    LBRACE=3
    RBRACE=4
    ESCAPED=5
    PIPE=6
    ATOM=7
    ID=8
    SUB=9
    WHITESPACE=10

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.7.2")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None



    class TopContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def blocks(self):
            return self.getTypedRuleContext(TacticNotationsParser.BlocksContext,0)


        def EOF(self):
            return self.getToken(TacticNotationsParser.EOF, 0)

        def getRuleIndex(self):
            return TacticNotationsParser.RULE_top

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTop" ):
                return visitor.visitTop(self)
            else:
                return visitor.visitChildren(self)




    def top(self):

        localctx = TacticNotationsParser.TopContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_top)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 30
            self.blocks()
            self.state = 31
            self.match(TacticNotationsParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class BlocksContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def block(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TacticNotationsParser.BlockContext)
            else:
                return self.getTypedRuleContext(TacticNotationsParser.BlockContext,i)


        def whitespace(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TacticNotationsParser.WhitespaceContext)
            else:
                return self.getTypedRuleContext(TacticNotationsParser.WhitespaceContext,i)


        def getRuleIndex(self):
            return TacticNotationsParser.RULE_blocks

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBlocks" ):
                return visitor.visitBlocks(self)
            else:
                return visitor.visitChildren(self)




    def blocks(self):

        localctx = TacticNotationsParser.BlocksContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_blocks)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 33
            self.block()
            self.state = 40
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,1,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 35
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==TacticNotationsParser.WHITESPACE:
                        self.state = 34
                        self.whitespace()


                    self.state = 37
                    self.block()
                self.state = 42
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,1,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class BlockContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def pipe(self):
            return self.getTypedRuleContext(TacticNotationsParser.PipeContext,0)


        def nopipeblock(self):
            return self.getTypedRuleContext(TacticNotationsParser.NopipeblockContext,0)


        def getRuleIndex(self):
            return TacticNotationsParser.RULE_block

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBlock" ):
                return visitor.visitBlock(self)
            else:
                return visitor.visitChildren(self)




    def block(self):

        localctx = TacticNotationsParser.BlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_block)
        try:
            self.state = 45
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [TacticNotationsParser.PIPE]:
                self.enterOuterAlt(localctx, 1)
                self.state = 43
                self.pipe()
                pass
            elif token in [TacticNotationsParser.LALT, TacticNotationsParser.LGROUP, TacticNotationsParser.LBRACE, TacticNotationsParser.ESCAPED, TacticNotationsParser.ATOM, TacticNotationsParser.ID]:
                self.enterOuterAlt(localctx, 2)
                self.state = 44
                self.nopipeblock()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class NopipeblockContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def atomic(self):
            return self.getTypedRuleContext(TacticNotationsParser.AtomicContext,0)


        def escaped(self):
            return self.getTypedRuleContext(TacticNotationsParser.EscapedContext,0)


        def hole(self):
            return self.getTypedRuleContext(TacticNotationsParser.HoleContext,0)


        def alternative(self):
            return self.getTypedRuleContext(TacticNotationsParser.AlternativeContext,0)


        def repeat(self):
            return self.getTypedRuleContext(TacticNotationsParser.RepeatContext,0)


        def curlies(self):
            return self.getTypedRuleContext(TacticNotationsParser.CurliesContext,0)


        def getRuleIndex(self):
            return TacticNotationsParser.RULE_nopipeblock

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitNopipeblock" ):
                return visitor.visitNopipeblock(self)
            else:
                return visitor.visitChildren(self)




    def nopipeblock(self):

        localctx = TacticNotationsParser.NopipeblockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_nopipeblock)
        try:
            self.state = 53
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [TacticNotationsParser.ATOM]:
                self.enterOuterAlt(localctx, 1)
                self.state = 47
                self.atomic()
                pass
            elif token in [TacticNotationsParser.ESCAPED]:
                self.enterOuterAlt(localctx, 2)
                self.state = 48
                self.escaped()
                pass
            elif token in [TacticNotationsParser.ID]:
                self.enterOuterAlt(localctx, 3)
                self.state = 49
                self.hole()
                pass
            elif token in [TacticNotationsParser.LALT]:
                self.enterOuterAlt(localctx, 4)
                self.state = 50
                self.alternative()
                pass
            elif token in [TacticNotationsParser.LGROUP]:
                self.enterOuterAlt(localctx, 5)
                self.state = 51
                self.repeat()
                pass
            elif token in [TacticNotationsParser.LBRACE]:
                self.enterOuterAlt(localctx, 6)
                self.state = 52
                self.curlies()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class AlternativeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LALT(self):
            return self.getToken(TacticNotationsParser.LALT, 0)

        def altblocks(self):
            return self.getTypedRuleContext(TacticNotationsParser.AltblocksContext,0)


        def RBRACE(self):
            return self.getToken(TacticNotationsParser.RBRACE, 0)

        def WHITESPACE(self, i:int=None):
            if i is None:
                return self.getTokens(TacticNotationsParser.WHITESPACE)
            else:
                return self.getToken(TacticNotationsParser.WHITESPACE, i)

        def getRuleIndex(self):
            return TacticNotationsParser.RULE_alternative

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAlternative" ):
                return visitor.visitAlternative(self)
            else:
                return visitor.visitChildren(self)




    def alternative(self):

        localctx = TacticNotationsParser.AlternativeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_alternative)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 55
            self.match(TacticNotationsParser.LALT)
            self.state = 57
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TacticNotationsParser.WHITESPACE:
                self.state = 56
                self.match(TacticNotationsParser.WHITESPACE)


            self.state = 59
            self.altblocks()
            self.state = 61
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TacticNotationsParser.WHITESPACE:
                self.state = 60
                self.match(TacticNotationsParser.WHITESPACE)


            self.state = 63
            self.match(TacticNotationsParser.RBRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class AltblocksContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def altblock(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TacticNotationsParser.AltblockContext)
            else:
                return self.getTypedRuleContext(TacticNotationsParser.AltblockContext,i)


        def altsep(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TacticNotationsParser.AltsepContext)
            else:
                return self.getTypedRuleContext(TacticNotationsParser.AltsepContext,i)


        def WHITESPACE(self, i:int=None):
            if i is None:
                return self.getTokens(TacticNotationsParser.WHITESPACE)
            else:
                return self.getToken(TacticNotationsParser.WHITESPACE, i)

        def getRuleIndex(self):
            return TacticNotationsParser.RULE_altblocks

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAltblocks" ):
                return visitor.visitAltblocks(self)
            else:
                return visitor.visitChildren(self)




    def altblocks(self):

        localctx = TacticNotationsParser.AltblocksContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_altblocks)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 65
            self.altblock()
            self.state = 75
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 67
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==TacticNotationsParser.WHITESPACE:
                        self.state = 66
                        self.match(TacticNotationsParser.WHITESPACE)


                    self.state = 69
                    self.altsep()
                    self.state = 71
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==TacticNotationsParser.WHITESPACE:
                        self.state = 70
                        self.match(TacticNotationsParser.WHITESPACE)


                    self.state = 73
                    self.altblock()

                else:
                    raise NoViableAltException(self)
                self.state = 77
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,8,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class AltblockContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def nopipeblock(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TacticNotationsParser.NopipeblockContext)
            else:
                return self.getTypedRuleContext(TacticNotationsParser.NopipeblockContext,i)


        def whitespace(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TacticNotationsParser.WhitespaceContext)
            else:
                return self.getTypedRuleContext(TacticNotationsParser.WhitespaceContext,i)


        def getRuleIndex(self):
            return TacticNotationsParser.RULE_altblock

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAltblock" ):
                return visitor.visitAltblock(self)
            else:
                return visitor.visitChildren(self)




    def altblock(self):

        localctx = TacticNotationsParser.AltblockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_altblock)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 79
            self.nopipeblock()
            self.state = 86
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,10,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 81
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==TacticNotationsParser.WHITESPACE:
                        self.state = 80
                        self.whitespace()


                    self.state = 83
                    self.nopipeblock()
                self.state = 88
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,10,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class RepeatContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LGROUP(self):
            return self.getToken(TacticNotationsParser.LGROUP, 0)

        def WHITESPACE(self, i:int=None):
            if i is None:
                return self.getTokens(TacticNotationsParser.WHITESPACE)
            else:
                return self.getToken(TacticNotationsParser.WHITESPACE, i)

        def blocks(self):
            return self.getTypedRuleContext(TacticNotationsParser.BlocksContext,0)


        def RBRACE(self):
            return self.getToken(TacticNotationsParser.RBRACE, 0)

        def ATOM(self):
            return self.getToken(TacticNotationsParser.ATOM, 0)

        def PIPE(self):
            return self.getToken(TacticNotationsParser.PIPE, 0)

        def getRuleIndex(self):
            return TacticNotationsParser.RULE_repeat

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRepeat" ):
                return visitor.visitRepeat(self)
            else:
                return visitor.visitChildren(self)




    def repeat(self):

        localctx = TacticNotationsParser.RepeatContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_repeat)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 89
            self.match(TacticNotationsParser.LGROUP)
            self.state = 91
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TacticNotationsParser.PIPE or _la==TacticNotationsParser.ATOM:
                self.state = 90
                _la = self._input.LA(1)
                if not(_la==TacticNotationsParser.PIPE or _la==TacticNotationsParser.ATOM):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()


            self.state = 93
            self.match(TacticNotationsParser.WHITESPACE)
            self.state = 94
            self.blocks()
            self.state = 96
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TacticNotationsParser.WHITESPACE:
                self.state = 95
                self.match(TacticNotationsParser.WHITESPACE)


            self.state = 98
            self.match(TacticNotationsParser.RBRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class CurliesContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LBRACE(self):
            return self.getToken(TacticNotationsParser.LBRACE, 0)

        def blocks(self):
            return self.getTypedRuleContext(TacticNotationsParser.BlocksContext,0)


        def RBRACE(self):
            return self.getToken(TacticNotationsParser.RBRACE, 0)

        def whitespace(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TacticNotationsParser.WhitespaceContext)
            else:
                return self.getTypedRuleContext(TacticNotationsParser.WhitespaceContext,i)


        def getRuleIndex(self):
            return TacticNotationsParser.RULE_curlies

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitCurlies" ):
                return visitor.visitCurlies(self)
            else:
                return visitor.visitChildren(self)




    def curlies(self):

        localctx = TacticNotationsParser.CurliesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_curlies)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 100
            self.match(TacticNotationsParser.LBRACE)
            self.state = 102
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TacticNotationsParser.WHITESPACE:
                self.state = 101
                self.whitespace()


            self.state = 104
            self.blocks()
            self.state = 106
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TacticNotationsParser.WHITESPACE:
                self.state = 105
                self.whitespace()


            self.state = 108
            self.match(TacticNotationsParser.RBRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class PipeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def PIPE(self):
            return self.getToken(TacticNotationsParser.PIPE, 0)

        def getRuleIndex(self):
            return TacticNotationsParser.RULE_pipe

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPipe" ):
                return visitor.visitPipe(self)
            else:
                return visitor.visitChildren(self)




    def pipe(self):

        localctx = TacticNotationsParser.PipeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_pipe)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 110
            self.match(TacticNotationsParser.PIPE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class AltsepContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def PIPE(self):
            return self.getToken(TacticNotationsParser.PIPE, 0)

        def getRuleIndex(self):
            return TacticNotationsParser.RULE_altsep

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAltsep" ):
                return visitor.visitAltsep(self)
            else:
                return visitor.visitChildren(self)




    def altsep(self):

        localctx = TacticNotationsParser.AltsepContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_altsep)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 112
            self.match(TacticNotationsParser.PIPE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class WhitespaceContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def WHITESPACE(self):
            return self.getToken(TacticNotationsParser.WHITESPACE, 0)

        def getRuleIndex(self):
            return TacticNotationsParser.RULE_whitespace

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitWhitespace" ):
                return visitor.visitWhitespace(self)
            else:
                return visitor.visitChildren(self)




    def whitespace(self):

        localctx = TacticNotationsParser.WhitespaceContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_whitespace)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 114
            self.match(TacticNotationsParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class EscapedContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ESCAPED(self):
            return self.getToken(TacticNotationsParser.ESCAPED, 0)

        def getRuleIndex(self):
            return TacticNotationsParser.RULE_escaped

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEscaped" ):
                return visitor.visitEscaped(self)
            else:
                return visitor.visitChildren(self)




    def escaped(self):

        localctx = TacticNotationsParser.EscapedContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_escaped)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 116
            self.match(TacticNotationsParser.ESCAPED)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class AtomicContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ATOM(self):
            return self.getToken(TacticNotationsParser.ATOM, 0)

        def SUB(self):
            return self.getToken(TacticNotationsParser.SUB, 0)

        def getRuleIndex(self):
            return TacticNotationsParser.RULE_atomic

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAtomic" ):
                return visitor.visitAtomic(self)
            else:
                return visitor.visitChildren(self)




    def atomic(self):

        localctx = TacticNotationsParser.AtomicContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_atomic)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 118
            self.match(TacticNotationsParser.ATOM)
            self.state = 120
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TacticNotationsParser.SUB:
                self.state = 119
                self.match(TacticNotationsParser.SUB)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class HoleContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(TacticNotationsParser.ID, 0)

        def SUB(self):
            return self.getToken(TacticNotationsParser.SUB, 0)

        def getRuleIndex(self):
            return TacticNotationsParser.RULE_hole

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitHole" ):
                return visitor.visitHole(self)
            else:
                return visitor.visitChildren(self)




    def hole(self):

        localctx = TacticNotationsParser.HoleContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_hole)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 122
            self.match(TacticNotationsParser.ID)
            self.state = 124
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TacticNotationsParser.SUB:
                self.state = 123
                self.match(TacticNotationsParser.SUB)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx
