# Generated from Jertl.g4 by ANTLR 4.11.1
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO

def serializedATN():
    return [
        4,1,20,128,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,
        6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,
        2,14,7,14,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,2,5,2,40,8,2,10,2,12,
        2,43,9,2,1,2,1,2,1,3,5,3,48,8,3,10,3,12,3,51,9,3,1,3,1,3,5,3,55,
        8,3,10,3,12,3,58,9,3,1,3,1,3,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,6,
        1,6,1,6,1,6,3,6,74,8,6,1,7,1,7,1,7,1,7,5,7,80,8,7,10,7,12,7,83,9,
        7,1,7,1,7,3,7,87,8,7,1,7,1,7,1,7,1,7,3,7,93,8,7,1,8,1,8,1,8,1,8,
        1,9,1,9,1,9,1,10,1,10,1,10,1,10,5,10,106,8,10,10,10,12,10,109,9,
        10,1,10,1,10,1,10,1,10,3,10,115,8,10,1,11,1,11,3,11,119,8,11,1,12,
        1,12,1,12,1,13,1,13,1,14,1,14,1,14,0,0,15,0,2,4,6,8,10,12,14,16,
        18,20,22,24,26,28,0,1,2,0,10,13,17,18,124,0,30,1,0,0,0,2,33,1,0,
        0,0,4,41,1,0,0,0,6,49,1,0,0,0,8,61,1,0,0,0,10,65,1,0,0,0,12,73,1,
        0,0,0,14,92,1,0,0,0,16,94,1,0,0,0,18,98,1,0,0,0,20,114,1,0,0,0,22,
        118,1,0,0,0,24,120,1,0,0,0,26,123,1,0,0,0,28,125,1,0,0,0,30,31,3,
        12,6,0,31,32,5,0,0,1,32,1,1,0,0,0,33,34,3,12,6,0,34,35,5,9,0,0,35,
        36,3,12,6,0,36,37,5,0,0,1,37,3,1,0,0,0,38,40,3,8,4,0,39,38,1,0,0,
        0,40,43,1,0,0,0,41,39,1,0,0,0,41,42,1,0,0,0,42,44,1,0,0,0,43,41,
        1,0,0,0,44,45,5,0,0,1,45,5,1,0,0,0,46,48,3,8,4,0,47,46,1,0,0,0,48,
        51,1,0,0,0,49,47,1,0,0,0,49,50,1,0,0,0,50,52,1,0,0,0,51,49,1,0,0,
        0,52,56,5,9,0,0,53,55,3,10,5,0,54,53,1,0,0,0,55,58,1,0,0,0,56,54,
        1,0,0,0,56,57,1,0,0,0,57,59,1,0,0,0,58,56,1,0,0,0,59,60,5,0,0,1,
        60,7,1,0,0,0,61,62,3,28,14,0,62,63,5,14,0,0,63,64,3,12,6,0,64,9,
        1,0,0,0,65,66,3,28,14,0,66,67,5,15,0,0,67,68,3,12,6,0,68,11,1,0,
        0,0,69,74,3,14,7,0,70,74,3,20,10,0,71,74,3,26,13,0,72,74,3,28,14,
        0,73,69,1,0,0,0,73,70,1,0,0,0,73,71,1,0,0,0,73,72,1,0,0,0,74,13,
        1,0,0,0,75,76,5,1,0,0,76,81,3,16,8,0,77,78,5,2,0,0,78,80,3,16,8,
        0,79,77,1,0,0,0,80,83,1,0,0,0,81,79,1,0,0,0,81,82,1,0,0,0,82,86,
        1,0,0,0,83,81,1,0,0,0,84,85,5,2,0,0,85,87,3,18,9,0,86,84,1,0,0,0,
        86,87,1,0,0,0,87,88,1,0,0,0,88,89,5,3,0,0,89,93,1,0,0,0,90,91,5,
        1,0,0,91,93,5,3,0,0,92,75,1,0,0,0,92,90,1,0,0,0,93,15,1,0,0,0,94,
        95,5,13,0,0,95,96,5,4,0,0,96,97,3,12,6,0,97,17,1,0,0,0,98,99,5,5,
        0,0,99,100,3,28,14,0,100,19,1,0,0,0,101,102,5,6,0,0,102,107,3,22,
        11,0,103,104,5,2,0,0,104,106,3,22,11,0,105,103,1,0,0,0,106,109,1,
        0,0,0,107,105,1,0,0,0,107,108,1,0,0,0,108,110,1,0,0,0,109,107,1,
        0,0,0,110,111,5,7,0,0,111,115,1,0,0,0,112,113,5,6,0,0,113,115,5,
        7,0,0,114,101,1,0,0,0,114,112,1,0,0,0,115,21,1,0,0,0,116,119,3,12,
        6,0,117,119,3,24,12,0,118,116,1,0,0,0,118,117,1,0,0,0,119,23,1,0,
        0,0,120,121,5,8,0,0,121,122,3,28,14,0,122,25,1,0,0,0,123,124,7,0,
        0,0,124,27,1,0,0,0,125,126,5,16,0,0,126,29,1,0,0,0,10,41,49,56,73,
        81,86,92,107,114,118
    ]

class JertlParser ( Parser ):

    grammarFileName = "Jertl.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'{'", "','", "'}'", "':'", "'**'", "'['", 
                     "']'", "'*'", "'-->'", "'null'", "'true'", "'false'", 
                     "<INVALID>", "'~'", "':='" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "IMPLIES", "NULL", "TRUE", "FALSE", "STRING", 
                      "MATCHES", "ASSIGNED", "IDENTIFIER", "INTEGER", "FLOAT", 
                      "WS", "LINE_COMMENT" ]

    RULE_toplevel_structure = 0
    RULE_transform = 1
    RULE_collation = 2
    RULE_rule_ = 3
    RULE_matcher = 4
    RULE_setter = 5
    RULE_structure = 6
    RULE_obj = 7
    RULE_key_value = 8
    RULE_kwargs = 9
    RULE_array = 10
    RULE_element = 11
    RULE_varargs = 12
    RULE_atom = 13
    RULE_variable = 14

    ruleNames =  [ "toplevel_structure", "transform", "collation", "rule_", 
                   "matcher", "setter", "structure", "obj", "key_value", 
                   "kwargs", "array", "element", "varargs", "atom", "variable" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    T__5=6
    T__6=7
    T__7=8
    IMPLIES=9
    NULL=10
    TRUE=11
    FALSE=12
    STRING=13
    MATCHES=14
    ASSIGNED=15
    IDENTIFIER=16
    INTEGER=17
    FLOAT=18
    WS=19
    LINE_COMMENT=20

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




    class Toplevel_structureContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def structure(self):
            return self.getTypedRuleContext(JertlParser.StructureContext,0)


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

        def getRuleIndex(self):
            return JertlParser.RULE_toplevel_structure

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterToplevel_structure" ):
                listener.enterToplevel_structure(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitToplevel_structure" ):
                listener.exitToplevel_structure(self)




    def toplevel_structure(self):

        localctx = JertlParser.Toplevel_structureContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_toplevel_structure)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 30
            self.structure()
            self.state = 31
            self.match(JertlParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TransformContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def structure(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(JertlParser.StructureContext)
            else:
                return self.getTypedRuleContext(JertlParser.StructureContext,i)


        def IMPLIES(self):
            return self.getToken(JertlParser.IMPLIES, 0)

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

        def getRuleIndex(self):
            return JertlParser.RULE_transform

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTransform" ):
                listener.enterTransform(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTransform" ):
                listener.exitTransform(self)




    def transform(self):

        localctx = JertlParser.TransformContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_transform)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 33
            self.structure()
            self.state = 34
            self.match(JertlParser.IMPLIES)
            self.state = 35
            self.structure()
            self.state = 36
            self.match(JertlParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CollationContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def matcher(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(JertlParser.MatcherContext)
            else:
                return self.getTypedRuleContext(JertlParser.MatcherContext,i)


        def getRuleIndex(self):
            return JertlParser.RULE_collation

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCollation" ):
                listener.enterCollation(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCollation" ):
                listener.exitCollation(self)




    def collation(self):

        localctx = JertlParser.CollationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_collation)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 41
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==16:
                self.state = 38
                self.matcher()
                self.state = 43
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class Rule_Context(ParserRuleContext):
        __slots__ = 'parser'

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

        def IMPLIES(self):
            return self.getToken(JertlParser.IMPLIES, 0)

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

        def matcher(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(JertlParser.MatcherContext)
            else:
                return self.getTypedRuleContext(JertlParser.MatcherContext,i)


        def setter(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(JertlParser.SetterContext)
            else:
                return self.getTypedRuleContext(JertlParser.SetterContext,i)


        def getRuleIndex(self):
            return JertlParser.RULE_rule_

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterRule_" ):
                listener.enterRule_(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitRule_" ):
                listener.exitRule_(self)




    def rule_(self):

        localctx = JertlParser.Rule_Context(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_rule_)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 49
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==16:
                self.state = 46
                self.matcher()
                self.state = 51
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 52
            self.match(JertlParser.IMPLIES)
            self.state = 56
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==16:
                self.state = 53
                self.setter()
                self.state = 58
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class MatcherContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def variable(self):
            return self.getTypedRuleContext(JertlParser.VariableContext,0)


        def MATCHES(self):
            return self.getToken(JertlParser.MATCHES, 0)

        def structure(self):
            return self.getTypedRuleContext(JertlParser.StructureContext,0)


        def getRuleIndex(self):
            return JertlParser.RULE_matcher

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterMatcher" ):
                listener.enterMatcher(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitMatcher" ):
                listener.exitMatcher(self)




    def matcher(self):

        localctx = JertlParser.MatcherContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_matcher)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 61
            self.variable()
            self.state = 62
            self.match(JertlParser.MATCHES)
            self.state = 63
            self.structure()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SetterContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def variable(self):
            return self.getTypedRuleContext(JertlParser.VariableContext,0)


        def ASSIGNED(self):
            return self.getToken(JertlParser.ASSIGNED, 0)

        def structure(self):
            return self.getTypedRuleContext(JertlParser.StructureContext,0)


        def getRuleIndex(self):
            return JertlParser.RULE_setter

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSetter" ):
                listener.enterSetter(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSetter" ):
                listener.exitSetter(self)




    def setter(self):

        localctx = JertlParser.SetterContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_setter)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 65
            self.variable()
            self.state = 66
            self.match(JertlParser.ASSIGNED)
            self.state = 67
            self.structure()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class StructureContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def obj(self):
            return self.getTypedRuleContext(JertlParser.ObjContext,0)


        def array(self):
            return self.getTypedRuleContext(JertlParser.ArrayContext,0)


        def atom(self):
            return self.getTypedRuleContext(JertlParser.AtomContext,0)


        def variable(self):
            return self.getTypedRuleContext(JertlParser.VariableContext,0)


        def getRuleIndex(self):
            return JertlParser.RULE_structure

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStructure" ):
                listener.enterStructure(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStructure" ):
                listener.exitStructure(self)




    def structure(self):

        localctx = JertlParser.StructureContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_structure)
        try:
            self.state = 73
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [1]:
                self.enterOuterAlt(localctx, 1)
                self.state = 69
                self.obj()
                pass
            elif token in [6]:
                self.enterOuterAlt(localctx, 2)
                self.state = 70
                self.array()
                pass
            elif token in [10, 11, 12, 13, 17, 18]:
                self.enterOuterAlt(localctx, 3)
                self.state = 71
                self.atom()
                pass
            elif token in [16]:
                self.enterOuterAlt(localctx, 4)
                self.state = 72
                self.variable()
                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 ObjContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self._key_value = None # Key_valueContext
            self.key_values = list() # of Key_valueContexts

        def key_value(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(JertlParser.Key_valueContext)
            else:
                return self.getTypedRuleContext(JertlParser.Key_valueContext,i)


        def kwargs(self):
            return self.getTypedRuleContext(JertlParser.KwargsContext,0)


        def getRuleIndex(self):
            return JertlParser.RULE_obj

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterObj" ):
                listener.enterObj(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitObj" ):
                listener.exitObj(self)




    def obj(self):

        localctx = JertlParser.ObjContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_obj)
        self._la = 0 # Token type
        try:
            self.state = 92
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,6,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 75
                self.match(JertlParser.T__0)
                self.state = 76
                localctx._key_value = self.key_value()
                localctx.key_values.append(localctx._key_value)
                self.state = 81
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,4,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 77
                        self.match(JertlParser.T__1)
                        self.state = 78
                        localctx._key_value = self.key_value()
                        localctx.key_values.append(localctx._key_value) 
                    self.state = 83
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,4,self._ctx)

                self.state = 86
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==2:
                    self.state = 84
                    self.match(JertlParser.T__1)
                    self.state = 85
                    self.kwargs()


                self.state = 88
                self.match(JertlParser.T__2)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 90
                self.match(JertlParser.T__0)
                self.state = 91
                self.match(JertlParser.T__2)
                pass


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


    class Key_valueContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def STRING(self):
            return self.getToken(JertlParser.STRING, 0)

        def structure(self):
            return self.getTypedRuleContext(JertlParser.StructureContext,0)


        def getRuleIndex(self):
            return JertlParser.RULE_key_value

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterKey_value" ):
                listener.enterKey_value(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitKey_value" ):
                listener.exitKey_value(self)




    def key_value(self):

        localctx = JertlParser.Key_valueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_key_value)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 94
            self.match(JertlParser.STRING)
            self.state = 95
            self.match(JertlParser.T__3)
            self.state = 96
            self.structure()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class KwargsContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def variable(self):
            return self.getTypedRuleContext(JertlParser.VariableContext,0)


        def getRuleIndex(self):
            return JertlParser.RULE_kwargs

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterKwargs" ):
                listener.enterKwargs(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitKwargs" ):
                listener.exitKwargs(self)




    def kwargs(self):

        localctx = JertlParser.KwargsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_kwargs)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 98
            self.match(JertlParser.T__4)
            self.state = 99
            self.variable()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArrayContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self._element = None # ElementContext
            self.elements = list() # of ElementContexts

        def element(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(JertlParser.ElementContext)
            else:
                return self.getTypedRuleContext(JertlParser.ElementContext,i)


        def getRuleIndex(self):
            return JertlParser.RULE_array

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArray" ):
                listener.enterArray(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArray" ):
                listener.exitArray(self)




    def array(self):

        localctx = JertlParser.ArrayContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_array)
        self._la = 0 # Token type
        try:
            self.state = 114
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,8,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 101
                self.match(JertlParser.T__5)
                self.state = 102
                localctx._element = self.element()
                localctx.elements.append(localctx._element)
                self.state = 107
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==2:
                    self.state = 103
                    self.match(JertlParser.T__1)
                    self.state = 104
                    localctx._element = self.element()
                    localctx.elements.append(localctx._element)
                    self.state = 109
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 110
                self.match(JertlParser.T__6)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 112
                self.match(JertlParser.T__5)
                self.state = 113
                self.match(JertlParser.T__6)
                pass


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


    class ElementContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def structure(self):
            return self.getTypedRuleContext(JertlParser.StructureContext,0)


        def varargs(self):
            return self.getTypedRuleContext(JertlParser.VarargsContext,0)


        def getRuleIndex(self):
            return JertlParser.RULE_element

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterElement" ):
                listener.enterElement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitElement" ):
                listener.exitElement(self)




    def element(self):

        localctx = JertlParser.ElementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_element)
        try:
            self.state = 118
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [1, 6, 10, 11, 12, 13, 16, 17, 18]:
                self.enterOuterAlt(localctx, 1)
                self.state = 116
                self.structure()
                pass
            elif token in [8]:
                self.enterOuterAlt(localctx, 2)
                self.state = 117
                self.varargs()
                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 VarargsContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def variable(self):
            return self.getTypedRuleContext(JertlParser.VariableContext,0)


        def getRuleIndex(self):
            return JertlParser.RULE_varargs

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterVarargs" ):
                listener.enterVarargs(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitVarargs" ):
                listener.exitVarargs(self)




    def varargs(self):

        localctx = JertlParser.VarargsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_varargs)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 120
            self.match(JertlParser.T__7)
            self.state = 121
            self.variable()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AtomContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def NULL(self):
            return self.getToken(JertlParser.NULL, 0)

        def TRUE(self):
            return self.getToken(JertlParser.TRUE, 0)

        def FALSE(self):
            return self.getToken(JertlParser.FALSE, 0)

        def INTEGER(self):
            return self.getToken(JertlParser.INTEGER, 0)

        def FLOAT(self):
            return self.getToken(JertlParser.FLOAT, 0)

        def STRING(self):
            return self.getToken(JertlParser.STRING, 0)

        def getRuleIndex(self):
            return JertlParser.RULE_atom

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAtom" ):
                listener.enterAtom(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAtom" ):
                listener.exitAtom(self)




    def atom(self):

        localctx = JertlParser.AtomContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_atom)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 123
            _la = self._input.LA(1)
            if not(((_la) & ~0x3f) == 0 and ((1 << _la) & 408576) != 0):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class VariableContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def getRuleIndex(self):
            return JertlParser.RULE_variable

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterVariable" ):
                listener.enterVariable(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitVariable" ):
                listener.exitVariable(self)




    def variable(self):

        localctx = JertlParser.VariableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_variable)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 125
            self.match(JertlParser.IDENTIFIER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx





