# Generated from tests/grammar/HedgehogTest.g4 by ANTLR 4.7
# 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\34")
        buf.write("\u00b1\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\3\2\7\2 \n\2\f\2\16\2#\13\2\3\2\3\2\3")
        buf.write("\3\3\3\3\3\3\3\3\3\3\3\5\3-\n\3\3\3\3\3\7\3\61\n\3\f\3")
        buf.write("\16\3\64\13\3\3\3\7\3\67\n\3\f\3\16\3:\13\3\3\3\3\3\3")
        buf.write("\4\5\4?\n\4\3\4\3\4\3\4\3\4\3\4\3\4\7\4G\n\4\f\4\16\4")
        buf.write("J\13\4\3\4\3\4\3\5\3\5\3\5\3\5\7\5R\n\5\f\5\16\5U\13\5")
        buf.write("\3\5\3\5\3\6\3\6\3\6\3\6\3\6\5\6^\n\6\3\6\3\6\3\6\3\6")
        buf.write("\3\6\3\6\5\6f\n\6\3\6\5\6i\n\6\3\7\3\7\3\7\3\7\3\7\3\7")
        buf.write("\5\7q\n\7\3\7\3\7\3\b\3\b\3\b\5\bx\n\b\3\b\3\b\5\b|\n")
        buf.write("\b\3\b\3\b\3\b\5\b\u0081\n\b\3\b\3\b\5\b\u0085\n\b\3\t")
        buf.write("\3\t\3\t\7\t\u008a\n\t\f\t\16\t\u008d\13\t\3\n\3\n\3\n")
        buf.write("\3\13\3\13\3\13\3\13\7\13\u0096\n\13\f\13\16\13\u0099")
        buf.write("\13\13\3\13\3\13\3\f\3\f\3\f\7\f\u00a0\n\f\f\f\16\f\u00a3")
        buf.write("\13\f\3\r\3\r\3\r\7\r\u00a8\n\r\f\r\16\r\u00ab\13\r\3")
        buf.write("\16\3\16\3\17\3\17\3\17\2\2\20\2\4\6\b\n\f\16\20\22\24")
        buf.write("\26\30\32\34\2\3\3\2\20\22\2\u00b8\2!\3\2\2\2\4&\3\2\2")
        buf.write("\2\6>\3\2\2\2\bM\3\2\2\2\nh\3\2\2\2\fj\3\2\2\2\16\u0084")
        buf.write("\3\2\2\2\20\u0086\3\2\2\2\22\u008e\3\2\2\2\24\u0091\3")
        buf.write("\2\2\2\26\u009c\3\2\2\2\30\u00a4\3\2\2\2\32\u00ac\3\2")
        buf.write("\2\2\34\u00ae\3\2\2\2\36 \5\4\3\2\37\36\3\2\2\2 #\3\2")
        buf.write("\2\2!\37\3\2\2\2!\"\3\2\2\2\"$\3\2\2\2#!\3\2\2\2$%\7\2")
        buf.write("\2\3%\3\3\2\2\2&\'\5\30\r\2\'(\5\32\16\2()\7\16\2\2)*")
        buf.write("\5\34\17\2*,\7\27\2\2+-\7\7\2\2,+\3\2\2\2,-\3\2\2\2-\62")
        buf.write("\3\2\2\2.\61\5\6\4\2/\61\5\b\5\2\60.\3\2\2\2\60/\3\2\2")
        buf.write("\2\61\64\3\2\2\2\62\60\3\2\2\2\62\63\3\2\2\2\638\3\2\2")
        buf.write("\2\64\62\3\2\2\2\65\67\5\f\7\2\66\65\3\2\2\2\67:\3\2\2")
        buf.write("\28\66\3\2\2\289\3\2\2\29;\3\2\2\2:8\3\2\2\2;<\7\30\2")
        buf.write("\2<\5\3\2\2\2=?\7\3\2\2>=\3\2\2\2>?\3\2\2\2?@\3\2\2\2")
        buf.write("@A\5\32\16\2AB\5\32\16\2BC\7\16\2\2CD\5\34\17\2DH\7\27")
        buf.write("\2\2EG\5\n\6\2FE\3\2\2\2GJ\3\2\2\2HF\3\2\2\2HI\3\2\2\2")
        buf.write("IK\3\2\2\2JH\3\2\2\2KL\7\30\2\2L\7\3\2\2\2MN\7\4\2\2N")
        buf.write("O\5\32\16\2OS\7\27\2\2PR\5\6\4\2QP\3\2\2\2RU\3\2\2\2S")
        buf.write("Q\3\2\2\2ST\3\2\2\2TV\3\2\2\2US\3\2\2\2VW\7\30\2\2W\t")
        buf.write("\3\2\2\2XY\7\5\2\2YZ\7\13\2\2Z]\7\b\2\2[\\\7\n\2\2\\^")
        buf.write("\7\b\2\2][\3\2\2\2]^\3\2\2\2^_\3\2\2\2_i\7\f\2\2`a\7\6")
        buf.write("\2\2ab\7\13\2\2be\7\b\2\2cd\7\n\2\2df\7\b\2\2ec\3\2\2")
        buf.write("\2ef\3\2\2\2fg\3\2\2\2gi\7\f\2\2hX\3\2\2\2h`\3\2\2\2i")
        buf.write("\13\3\2\2\2jk\t\2\2\2kl\5\30\r\2lm\7\23\2\2mn\5\16\b\2")
        buf.write("np\7\24\2\2oq\7\7\2\2po\3\2\2\2pq\3\2\2\2qr\3\2\2\2rs")
        buf.write("\7\f\2\2s\r\3\2\2\2tw\5\20\t\2uv\7\n\2\2vx\5\22\n\2wu")
        buf.write("\3\2\2\2wx\3\2\2\2x{\3\2\2\2yz\7\n\2\2z|\5\24\13\2{y\3")
        buf.write("\2\2\2{|\3\2\2\2|\u0085\3\2\2\2}\u0080\5\22\n\2~\177\7")
        buf.write("\n\2\2\177\u0081\5\24\13\2\u0080~\3\2\2\2\u0080\u0081")
        buf.write("\3\2\2\2\u0081\u0085\3\2\2\2\u0082\u0085\5\24\13\2\u0083")
        buf.write("\u0085\3\2\2\2\u0084t\3\2\2\2\u0084}\3\2\2\2\u0084\u0082")
        buf.write("\3\2\2\2\u0084\u0083\3\2\2\2\u0085\17\3\2\2\2\u0086\u008b")
        buf.write("\5\32\16\2\u0087\u0088\7\n\2\2\u0088\u008a\5\32\16\2\u0089")
        buf.write("\u0087\3\2\2\2\u008a\u008d\3\2\2\2\u008b\u0089\3\2\2\2")
        buf.write("\u008b\u008c\3\2\2\2\u008c\21\3\2\2\2\u008d\u008b\3\2")
        buf.write("\2\2\u008e\u008f\7\17\2\2\u008f\u0090\5\32\16\2\u0090")
        buf.write("\23\3\2\2\2\u0091\u0092\7\25\2\2\u0092\u0097\5\26\f\2")
        buf.write("\u0093\u0094\7\n\2\2\u0094\u0096\5\26\f\2\u0095\u0093")
        buf.write("\3\2\2\2\u0096\u0099\3\2\2\2\u0097\u0095\3\2\2\2\u0097")
        buf.write("\u0098\3\2\2\2\u0098\u009a\3\2\2\2\u0099\u0097\3\2\2\2")
        buf.write("\u009a\u009b\7\26\2\2\u009b\25\3\2\2\2\u009c\u00a1\5\32")
        buf.write("\16\2\u009d\u009e\7\r\2\2\u009e\u00a0\5\32\16\2\u009f")
        buf.write("\u009d\3\2\2\2\u00a0\u00a3\3\2\2\2\u00a1\u009f\3\2\2\2")
        buf.write("\u00a1\u00a2\3\2\2\2\u00a2\27\3\2\2\2\u00a3\u00a1\3\2")
        buf.write("\2\2\u00a4\u00a9\5\32\16\2\u00a5\u00a6\7\t\2\2\u00a6\u00a8")
        buf.write("\5\32\16\2\u00a7\u00a5\3\2\2\2\u00a8\u00ab\3\2\2\2\u00a9")
        buf.write("\u00a7\3\2\2\2\u00a9\u00aa\3\2\2\2\u00aa\31\3\2\2\2\u00ab")
        buf.write("\u00a9\3\2\2\2\u00ac\u00ad\7\31\2\2\u00ad\33\3\2\2\2\u00ae")
        buf.write("\u00af\7\32\2\2\u00af\35\3\2\2\2\26!,\60\628>HS]ehpw{")
        buf.write("\u0080\u0084\u008b\u0097\u00a1\u00a9")
        return buf.getvalue()


class HedgehogTestParser ( Parser ):

    grammarFileName = "HedgehogTest.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'repeated'", "'oneof'", "'Python'", "'TypeScript'", 
                     "<INVALID>", "<INVALID>", "'.'", "','", "':'", "';'", 
                     "'/'", "'='", "'*'", "'=>'", "'<='", "'<-'", "'('", 
                     "')'", "'['", "']'", "'{'", "'}'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "DOCSTRING", "STRING", "DOT", "COMMA", 
                      "COLON", "SEMI", "SLASH", "EQUALS", "STAR", "REQ", 
                      "REP", "UPD", "LPAREN", "RPAREN", "LBRACKET", "RBRACKET", 
                      "LBRACE", "RBRACE", "IDENTIFIER", "NUMBER", "COMMENT", 
                      "WS" ]

    RULE_expr = 0
    RULE_message = 1
    RULE_field = 2
    RULE_oneof = 3
    RULE_languageFieldSpec = 4
    RULE_messageClass = 5
    RULE_paramList = 6
    RULE_mandatoryParamList = 7
    RULE_repeatedParam = 8
    RULE_optionalParamList = 9
    RULE_optionalParam = 10
    RULE_qualifiedIdentifier = 11
    RULE_identifier = 12
    RULE_number = 13

    ruleNames =  [ "expr", "message", "field", "oneof", "languageFieldSpec", 
                   "messageClass", "paramList", "mandatoryParamList", "repeatedParam", 
                   "optionalParamList", "optionalParam", "qualifiedIdentifier", 
                   "identifier", "number" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    DOCSTRING=5
    STRING=6
    DOT=7
    COMMA=8
    COLON=9
    SEMI=10
    SLASH=11
    EQUALS=12
    STAR=13
    REQ=14
    REP=15
    UPD=16
    LPAREN=17
    RPAREN=18
    LBRACKET=19
    RBRACKET=20
    LBRACE=21
    RBRACE=22
    IDENTIFIER=23
    NUMBER=24
    COMMENT=25
    WS=26

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



    class ExprContext(ParserRuleContext):

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

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

        def message(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HedgehogTestParser.MessageContext)
            else:
                return self.getTypedRuleContext(HedgehogTestParser.MessageContext,i)


        def getRuleIndex(self):
            return HedgehogTestParser.RULE_expr

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




    def expr(self):

        localctx = HedgehogTestParser.ExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_expr)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 31
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HedgehogTestParser.IDENTIFIER:
                self.state = 28
                self.message()
                self.state = 33
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 34
            self.match(HedgehogTestParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class MessageContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.messageType = None # QualifiedIdentifierContext
            self.discriminator = None # IdentifierContext
            self.label = None # NumberContext

        def EQUALS(self):
            return self.getToken(HedgehogTestParser.EQUALS, 0)

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

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

        def qualifiedIdentifier(self):
            return self.getTypedRuleContext(HedgehogTestParser.QualifiedIdentifierContext,0)


        def identifier(self):
            return self.getTypedRuleContext(HedgehogTestParser.IdentifierContext,0)


        def number(self):
            return self.getTypedRuleContext(HedgehogTestParser.NumberContext,0)


        def DOCSTRING(self):
            return self.getToken(HedgehogTestParser.DOCSTRING, 0)

        def field(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HedgehogTestParser.FieldContext)
            else:
                return self.getTypedRuleContext(HedgehogTestParser.FieldContext,i)


        def oneof(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HedgehogTestParser.OneofContext)
            else:
                return self.getTypedRuleContext(HedgehogTestParser.OneofContext,i)


        def messageClass(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HedgehogTestParser.MessageClassContext)
            else:
                return self.getTypedRuleContext(HedgehogTestParser.MessageClassContext,i)


        def getRuleIndex(self):
            return HedgehogTestParser.RULE_message

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




    def message(self):

        localctx = HedgehogTestParser.MessageContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_message)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 36
            localctx.messageType = self.qualifiedIdentifier()
            self.state = 37
            localctx.discriminator = self.identifier()
            self.state = 38
            self.match(HedgehogTestParser.EQUALS)
            self.state = 39
            localctx.label = self.number()
            self.state = 40
            self.match(HedgehogTestParser.LBRACE)
            self.state = 42
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==HedgehogTestParser.DOCSTRING:
                self.state = 41
                self.match(HedgehogTestParser.DOCSTRING)


            self.state = 48
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << HedgehogTestParser.T__0) | (1 << HedgehogTestParser.T__1) | (1 << HedgehogTestParser.IDENTIFIER))) != 0):
                self.state = 46
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [HedgehogTestParser.T__0, HedgehogTestParser.IDENTIFIER]:
                    self.state = 44
                    self.field()
                    pass
                elif token in [HedgehogTestParser.T__1]:
                    self.state = 45
                    self.oneof()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 50
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 54
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << HedgehogTestParser.REQ) | (1 << HedgehogTestParser.REP) | (1 << HedgehogTestParser.UPD))) != 0):
                self.state = 51
                self.messageClass()
                self.state = 56
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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

    class FieldContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.rep = None # Token
            self.fieldType = None # IdentifierContext
            self.name = None # IdentifierContext
            self.label = None # NumberContext

        def EQUALS(self):
            return self.getToken(HedgehogTestParser.EQUALS, 0)

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

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

        def identifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HedgehogTestParser.IdentifierContext)
            else:
                return self.getTypedRuleContext(HedgehogTestParser.IdentifierContext,i)


        def number(self):
            return self.getTypedRuleContext(HedgehogTestParser.NumberContext,0)


        def languageFieldSpec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HedgehogTestParser.LanguageFieldSpecContext)
            else:
                return self.getTypedRuleContext(HedgehogTestParser.LanguageFieldSpecContext,i)


        def getRuleIndex(self):
            return HedgehogTestParser.RULE_field

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




    def field(self):

        localctx = HedgehogTestParser.FieldContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_field)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 60
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==HedgehogTestParser.T__0:
                self.state = 59
                localctx.rep = self.match(HedgehogTestParser.T__0)


            self.state = 62
            localctx.fieldType = self.identifier()
            self.state = 63
            localctx.name = self.identifier()
            self.state = 64
            self.match(HedgehogTestParser.EQUALS)
            self.state = 65
            localctx.label = self.number()
            self.state = 66
            self.match(HedgehogTestParser.LBRACE)
            self.state = 70
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HedgehogTestParser.T__2 or _la==HedgehogTestParser.T__3:
                self.state = 67
                self.languageFieldSpec()
                self.state = 72
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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

    class OneofContext(ParserRuleContext):

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

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

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

        def identifier(self):
            return self.getTypedRuleContext(HedgehogTestParser.IdentifierContext,0)


        def field(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HedgehogTestParser.FieldContext)
            else:
                return self.getTypedRuleContext(HedgehogTestParser.FieldContext,i)


        def getRuleIndex(self):
            return HedgehogTestParser.RULE_oneof

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




    def oneof(self):

        localctx = HedgehogTestParser.OneofContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_oneof)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 75
            self.match(HedgehogTestParser.T__1)
            self.state = 76
            localctx.name = self.identifier()
            self.state = 77
            self.match(HedgehogTestParser.LBRACE)
            self.state = 81
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HedgehogTestParser.T__0 or _la==HedgehogTestParser.IDENTIFIER:
                self.state = 78
                self.field()
                self.state = 83
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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

    class LanguageFieldSpecContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return HedgehogTestParser.RULE_languageFieldSpec

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class TypeScriptSpecContext(LanguageFieldSpecContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a HedgehogTestParser.LanguageFieldSpecContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def COLON(self):
            return self.getToken(HedgehogTestParser.COLON, 0)
        def STRING(self, i:int=None):
            if i is None:
                return self.getTokens(HedgehogTestParser.STRING)
            else:
                return self.getToken(HedgehogTestParser.STRING, i)
        def SEMI(self):
            return self.getToken(HedgehogTestParser.SEMI, 0)
        def COMMA(self):
            return self.getToken(HedgehogTestParser.COMMA, 0)

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


    class PythonSpecContext(LanguageFieldSpecContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a HedgehogTestParser.LanguageFieldSpecContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def COLON(self):
            return self.getToken(HedgehogTestParser.COLON, 0)
        def STRING(self, i:int=None):
            if i is None:
                return self.getTokens(HedgehogTestParser.STRING)
            else:
                return self.getToken(HedgehogTestParser.STRING, i)
        def SEMI(self):
            return self.getToken(HedgehogTestParser.SEMI, 0)
        def COMMA(self):
            return self.getToken(HedgehogTestParser.COMMA, 0)

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



    def languageFieldSpec(self):

        localctx = HedgehogTestParser.LanguageFieldSpecContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_languageFieldSpec)
        self._la = 0 # Token type
        try:
            self.state = 102
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [HedgehogTestParser.T__2]:
                localctx = HedgehogTestParser.PythonSpecContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 86
                self.match(HedgehogTestParser.T__2)
                self.state = 87
                self.match(HedgehogTestParser.COLON)
                self.state = 88
                self.match(HedgehogTestParser.STRING)
                self.state = 91
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==HedgehogTestParser.COMMA:
                    self.state = 89
                    self.match(HedgehogTestParser.COMMA)
                    self.state = 90
                    self.match(HedgehogTestParser.STRING)


                self.state = 93
                self.match(HedgehogTestParser.SEMI)
                pass
            elif token in [HedgehogTestParser.T__3]:
                localctx = HedgehogTestParser.TypeScriptSpecContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 94
                self.match(HedgehogTestParser.T__3)
                self.state = 95
                self.match(HedgehogTestParser.COLON)
                self.state = 96
                self.match(HedgehogTestParser.STRING)
                self.state = 99
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==HedgehogTestParser.COMMA:
                    self.state = 97
                    self.match(HedgehogTestParser.COMMA)
                    self.state = 98
                    self.match(HedgehogTestParser.STRING)


                self.state = 101
                self.match(HedgehogTestParser.SEMI)
                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 MessageClassContext(ParserRuleContext):

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

        def qualifiedIdentifier(self):
            return self.getTypedRuleContext(HedgehogTestParser.QualifiedIdentifierContext,0)


        def LPAREN(self):
            return self.getToken(HedgehogTestParser.LPAREN, 0)

        def paramList(self):
            return self.getTypedRuleContext(HedgehogTestParser.ParamListContext,0)


        def RPAREN(self):
            return self.getToken(HedgehogTestParser.RPAREN, 0)

        def SEMI(self):
            return self.getToken(HedgehogTestParser.SEMI, 0)

        def REQ(self):
            return self.getToken(HedgehogTestParser.REQ, 0)

        def REP(self):
            return self.getToken(HedgehogTestParser.REP, 0)

        def UPD(self):
            return self.getToken(HedgehogTestParser.UPD, 0)

        def DOCSTRING(self):
            return self.getToken(HedgehogTestParser.DOCSTRING, 0)

        def getRuleIndex(self):
            return HedgehogTestParser.RULE_messageClass

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




    def messageClass(self):

        localctx = HedgehogTestParser.MessageClassContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_messageClass)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 104
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << HedgehogTestParser.REQ) | (1 << HedgehogTestParser.REP) | (1 << HedgehogTestParser.UPD))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 105
            self.qualifiedIdentifier()
            self.state = 106
            self.match(HedgehogTestParser.LPAREN)
            self.state = 107
            self.paramList()
            self.state = 108
            self.match(HedgehogTestParser.RPAREN)
            self.state = 110
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==HedgehogTestParser.DOCSTRING:
                self.state = 109
                self.match(HedgehogTestParser.DOCSTRING)


            self.state = 112
            self.match(HedgehogTestParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ParamListContext(ParserRuleContext):

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

        def mandatoryParamList(self):
            return self.getTypedRuleContext(HedgehogTestParser.MandatoryParamListContext,0)


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

        def repeatedParam(self):
            return self.getTypedRuleContext(HedgehogTestParser.RepeatedParamContext,0)


        def optionalParamList(self):
            return self.getTypedRuleContext(HedgehogTestParser.OptionalParamListContext,0)


        def getRuleIndex(self):
            return HedgehogTestParser.RULE_paramList

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




    def paramList(self):

        localctx = HedgehogTestParser.ParamListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_paramList)
        self._la = 0 # Token type
        try:
            self.state = 130
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [HedgehogTestParser.IDENTIFIER]:
                self.enterOuterAlt(localctx, 1)
                self.state = 114
                self.mandatoryParamList()
                self.state = 117
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,12,self._ctx)
                if la_ == 1:
                    self.state = 115
                    self.match(HedgehogTestParser.COMMA)
                    self.state = 116
                    self.repeatedParam()


                self.state = 121
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==HedgehogTestParser.COMMA:
                    self.state = 119
                    self.match(HedgehogTestParser.COMMA)
                    self.state = 120
                    self.optionalParamList()


                pass
            elif token in [HedgehogTestParser.STAR]:
                self.enterOuterAlt(localctx, 2)
                self.state = 123
                self.repeatedParam()
                self.state = 126
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==HedgehogTestParser.COMMA:
                    self.state = 124
                    self.match(HedgehogTestParser.COMMA)
                    self.state = 125
                    self.optionalParamList()


                pass
            elif token in [HedgehogTestParser.LBRACKET]:
                self.enterOuterAlt(localctx, 3)
                self.state = 128
                self.optionalParamList()
                pass
            elif token in [HedgehogTestParser.RPAREN]:
                self.enterOuterAlt(localctx, 4)

                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 MandatoryParamListContext(ParserRuleContext):

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

        def identifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HedgehogTestParser.IdentifierContext)
            else:
                return self.getTypedRuleContext(HedgehogTestParser.IdentifierContext,i)


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

        def getRuleIndex(self):
            return HedgehogTestParser.RULE_mandatoryParamList

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




    def mandatoryParamList(self):

        localctx = HedgehogTestParser.MandatoryParamListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_mandatoryParamList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 132
            self.identifier()
            self.state = 137
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,16,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 133
                    self.match(HedgehogTestParser.COMMA)
                    self.state = 134
                    self.identifier() 
                self.state = 139
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,16,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 RepeatedParamContext(ParserRuleContext):

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

        def STAR(self):
            return self.getToken(HedgehogTestParser.STAR, 0)

        def identifier(self):
            return self.getTypedRuleContext(HedgehogTestParser.IdentifierContext,0)


        def getRuleIndex(self):
            return HedgehogTestParser.RULE_repeatedParam

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




    def repeatedParam(self):

        localctx = HedgehogTestParser.RepeatedParamContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_repeatedParam)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 140
            self.match(HedgehogTestParser.STAR)
            self.state = 141
            self.identifier()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class OptionalParamListContext(ParserRuleContext):

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

        def LBRACKET(self):
            return self.getToken(HedgehogTestParser.LBRACKET, 0)

        def optionalParam(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HedgehogTestParser.OptionalParamContext)
            else:
                return self.getTypedRuleContext(HedgehogTestParser.OptionalParamContext,i)


        def RBRACKET(self):
            return self.getToken(HedgehogTestParser.RBRACKET, 0)

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

        def getRuleIndex(self):
            return HedgehogTestParser.RULE_optionalParamList

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




    def optionalParamList(self):

        localctx = HedgehogTestParser.OptionalParamListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_optionalParamList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 143
            self.match(HedgehogTestParser.LBRACKET)
            self.state = 144
            self.optionalParam()
            self.state = 149
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HedgehogTestParser.COMMA:
                self.state = 145
                self.match(HedgehogTestParser.COMMA)
                self.state = 146
                self.optionalParam()
                self.state = 151
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 152
            self.match(HedgehogTestParser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class OptionalParamContext(ParserRuleContext):

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

        def identifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HedgehogTestParser.IdentifierContext)
            else:
                return self.getTypedRuleContext(HedgehogTestParser.IdentifierContext,i)


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

        def getRuleIndex(self):
            return HedgehogTestParser.RULE_optionalParam

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




    def optionalParam(self):

        localctx = HedgehogTestParser.OptionalParamContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_optionalParam)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 154
            self.identifier()
            self.state = 159
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HedgehogTestParser.SLASH:
                self.state = 155
                self.match(HedgehogTestParser.SLASH)
                self.state = 156
                self.identifier()
                self.state = 161
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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

    class QualifiedIdentifierContext(ParserRuleContext):

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

        def identifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HedgehogTestParser.IdentifierContext)
            else:
                return self.getTypedRuleContext(HedgehogTestParser.IdentifierContext,i)


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

        def getRuleIndex(self):
            return HedgehogTestParser.RULE_qualifiedIdentifier

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




    def qualifiedIdentifier(self):

        localctx = HedgehogTestParser.QualifiedIdentifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_qualifiedIdentifier)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 162
            self.identifier()
            self.state = 167
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HedgehogTestParser.DOT:
                self.state = 163
                self.match(HedgehogTestParser.DOT)
                self.state = 164
                self.identifier()
                self.state = 169
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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

    class IdentifierContext(ParserRuleContext):

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

        def IDENTIFIER(self):
            return self.getToken(HedgehogTestParser.IDENTIFIER, 0)

        def getRuleIndex(self):
            return HedgehogTestParser.RULE_identifier

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




    def identifier(self):

        localctx = HedgehogTestParser.IdentifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_identifier)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 170
            self.match(HedgehogTestParser.IDENTIFIER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class NumberContext(ParserRuleContext):

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

        def NUMBER(self):
            return self.getToken(HedgehogTestParser.NUMBER, 0)

        def getRuleIndex(self):
            return HedgehogTestParser.RULE_number

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




    def number(self):

        localctx = HedgehogTestParser.NumberContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_number)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 172
            self.match(HedgehogTestParser.NUMBER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx





