# Generated from Hyaml.g4 by ANTLR 4.7.1
# 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\36")
        buf.write("\177\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4")
        buf.write("\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\3\2\3")
        buf.write("\2\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3%\n\3\3\3\3\3\3")
        buf.write("\3\3\3\5\3+\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3")
        buf.write("\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\7\3>\n\3\f\3\16\3A\13\3")
        buf.write("\3\4\3\4\6\4E\n\4\r\4\16\4F\3\5\3\5\3\5\5\5L\n\5\3\5\5")
        buf.write("\5O\n\5\3\6\3\6\3\6\7\6T\n\6\f\6\16\6W\13\6\3\7\3\7\5")
        buf.write("\7[\n\7\3\7\3\7\3\b\3\b\3\b\3\b\3\t\3\t\5\te\n\t\3\t\3")
        buf.write("\t\3\n\3\n\3\n\3\n\3\13\3\13\3\13\7\13p\n\13\f\13\16\13")
        buf.write("s\13\13\3\f\3\f\5\fw\n\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\2")
        buf.write("\3\4\16\2\4\6\b\n\f\16\20\22\24\26\30\2\3\3\2\34\35\2")
        buf.write("\u008a\2\32\3\2\2\2\4*\3\2\2\2\6D\3\2\2\2\bH\3\2\2\2\n")
        buf.write("P\3\2\2\2\fX\3\2\2\2\16^\3\2\2\2\20b\3\2\2\2\22h\3\2\2")
        buf.write("\2\24l\3\2\2\2\26t\3\2\2\2\30z\3\2\2\2\32\33\5\4\3\2\33")
        buf.write("\3\3\2\2\2\34\35\b\3\1\2\35+\5\30\r\2\36\37\7\20\2\2\37")
        buf.write("+\5\4\3\f +\5\20\t\2!+\5\26\f\2\"+\7\27\2\2#%\7\21\2\2")
        buf.write("$#\3\2\2\2$%\3\2\2\2%&\3\2\2\2&+\7\22\2\2\'+\7\32\2\2")
        buf.write("(+\7\f\2\2)+\7\r\2\2*\34\3\2\2\2*\36\3\2\2\2* \3\2\2\2")
        buf.write("*!\3\2\2\2*\"\3\2\2\2*$\3\2\2\2*\'\3\2\2\2*(\3\2\2\2*")
        buf.write(")\3\2\2\2+?\3\2\2\2,-\f\17\2\2-.\7\23\2\2.>\5\4\3\20/")
        buf.write("\60\f\16\2\2\60\61\7\21\2\2\61>\5\4\3\17\62\63\f\r\2\2")
        buf.write("\63\64\7\24\2\2\64>\5\4\3\16\65\66\f\13\2\2\66\67\7\16")
        buf.write("\2\2\67>\5\4\3\f89\f\n\2\29:\7\17\2\2:>\5\4\3\13;<\f\20")
        buf.write("\2\2<>\5\6\4\2=,\3\2\2\2=/\3\2\2\2=\62\3\2\2\2=\65\3\2")
        buf.write("\2\2=8\3\2\2\2=;\3\2\2\2>A\3\2\2\2?=\3\2\2\2?@\3\2\2\2")
        buf.write("@\5\3\2\2\2A?\3\2\2\2BE\5\b\5\2CE\5\16\b\2DB\3\2\2\2D")
        buf.write("C\3\2\2\2EF\3\2\2\2FD\3\2\2\2FG\3\2\2\2G\7\3\2\2\2HI\t")
        buf.write("\2\2\2IN\7\26\2\2JL\7\36\2\2KJ\3\2\2\2KL\3\2\2\2LM\3\2")
        buf.write("\2\2MO\5\f\7\2NK\3\2\2\2NO\3\2\2\2O\t\3\2\2\2PU\5\4\3")
        buf.write("\2QR\7\3\2\2RT\5\4\3\2SQ\3\2\2\2TW\3\2\2\2US\3\2\2\2U")
        buf.write("V\3\2\2\2V\13\3\2\2\2WU\3\2\2\2XZ\7\4\2\2Y[\5\n\6\2ZY")
        buf.write("\3\2\2\2Z[\3\2\2\2[\\\3\2\2\2\\]\7\5\2\2]\r\3\2\2\2^_")
        buf.write("\7\6\2\2_`\5\4\3\2`a\7\7\2\2a\17\3\2\2\2bd\7\6\2\2ce\5")
        buf.write("\n\6\2dc\3\2\2\2de\3\2\2\2ef\3\2\2\2fg\7\7\2\2g\21\3\2")
        buf.write("\2\2hi\7\26\2\2ij\7\b\2\2jk\5\4\3\2k\23\3\2\2\2lq\5\22")
        buf.write("\n\2mn\7\3\2\2np\5\22\n\2om\3\2\2\2ps\3\2\2\2qo\3\2\2")
        buf.write("\2qr\3\2\2\2r\25\3\2\2\2sq\3\2\2\2tv\7\t\2\2uw\5\24\13")
        buf.write("\2vu\3\2\2\2vw\3\2\2\2wx\3\2\2\2xy\7\n\2\2y\27\3\2\2\2")
        buf.write("z{\7\4\2\2{|\5\4\3\2|}\7\5\2\2}\31\3\2\2\2\17$*=?DFKN")
        buf.write("UZdqv")
        return buf.getvalue()


class HyamlParser ( Parser ):

    grammarFileName = "Hyaml.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "','", "'('", "')'", "'['", "']'", "':'", 
                     "'{'", "'}'", "<INVALID>", "'true'", "'false'", "'and'", 
                     "'or'", "'not'", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'?.'", "'.'", "'?'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "NEWLINE", "TRUE", "FALSE", "AND", "OR", 
                      "NOT", "SIGN", "NUMBER", "MULT_DIV_OP", "COMP_OP", 
                      "ID_SYMBOL", "ID", "VAR", "LETTER", "DIGIT", "STRING", 
                      "WS", "SAFE_ACCESS", "ACCESS", "PRED" ]

    RULE_prog = 0
    RULE_expr = 1
    RULE_callChain = 2
    RULE_attributeOrDispatch = 3
    RULE_exprList = 4
    RULE_args = 5
    RULE_subscription = 6
    RULE_listLiteral = 7
    RULE_keyValuePair = 8
    RULE_keyValuePairs = 9
    RULE_dictLiteral = 10
    RULE_parens = 11

    ruleNames =  [ "prog", "expr", "callChain", "attributeOrDispatch", "exprList", 
                   "args", "subscription", "listLiteral", "keyValuePair", 
                   "keyValuePairs", "dictLiteral", "parens" ]

    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
    NEWLINE=9
    TRUE=10
    FALSE=11
    AND=12
    OR=13
    NOT=14
    SIGN=15
    NUMBER=16
    MULT_DIV_OP=17
    COMP_OP=18
    ID_SYMBOL=19
    ID=20
    VAR=21
    LETTER=22
    DIGIT=23
    STRING=24
    WS=25
    SAFE_ACCESS=26
    ACCESS=27
    PRED=28

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



    class ProgContext(ParserRuleContext):

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

        def expr(self):
            return self.getTypedRuleContext(HyamlParser.ExprContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_prog

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

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




    def prog(self):

        localctx = HyamlParser.ProgContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_prog)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 24
            self.expr(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ExprContext(ParserRuleContext):

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

        def parens(self):
            return self.getTypedRuleContext(HyamlParser.ParensContext,0)


        def NOT(self):
            return self.getToken(HyamlParser.NOT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HyamlParser.ExprContext)
            else:
                return self.getTypedRuleContext(HyamlParser.ExprContext,i)


        def listLiteral(self):
            return self.getTypedRuleContext(HyamlParser.ListLiteralContext,0)


        def dictLiteral(self):
            return self.getTypedRuleContext(HyamlParser.DictLiteralContext,0)


        def VAR(self):
            return self.getToken(HyamlParser.VAR, 0)

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

        def SIGN(self):
            return self.getToken(HyamlParser.SIGN, 0)

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

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

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

        def MULT_DIV_OP(self):
            return self.getToken(HyamlParser.MULT_DIV_OP, 0)

        def COMP_OP(self):
            return self.getToken(HyamlParser.COMP_OP, 0)

        def AND(self):
            return self.getToken(HyamlParser.AND, 0)

        def OR(self):
            return self.getToken(HyamlParser.OR, 0)

        def callChain(self):
            return self.getTypedRuleContext(HyamlParser.CallChainContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_expr

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

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



    def expr(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = HyamlParser.ExprContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 2
        self.enterRecursionRule(localctx, 2, self.RULE_expr, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 40
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [HyamlParser.T__1]:
                self.state = 27
                self.parens()
                pass
            elif token in [HyamlParser.NOT]:
                self.state = 28
                self.match(HyamlParser.NOT)
                self.state = 29
                self.expr(10)
                pass
            elif token in [HyamlParser.T__3]:
                self.state = 30
                self.listLiteral()
                pass
            elif token in [HyamlParser.T__6]:
                self.state = 31
                self.dictLiteral()
                pass
            elif token in [HyamlParser.VAR]:
                self.state = 32
                self.match(HyamlParser.VAR)
                pass
            elif token in [HyamlParser.SIGN, HyamlParser.NUMBER]:
                self.state = 34
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==HyamlParser.SIGN:
                    self.state = 33
                    self.match(HyamlParser.SIGN)


                self.state = 36
                self.match(HyamlParser.NUMBER)
                pass
            elif token in [HyamlParser.STRING]:
                self.state = 37
                self.match(HyamlParser.STRING)
                pass
            elif token in [HyamlParser.TRUE]:
                self.state = 38
                self.match(HyamlParser.TRUE)
                pass
            elif token in [HyamlParser.FALSE]:
                self.state = 39
                self.match(HyamlParser.FALSE)
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 61
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,3,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 59
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,2,self._ctx)
                    if la_ == 1:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 42
                        if not self.precpred(self._ctx, 13):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 13)")
                        self.state = 43
                        self.match(HyamlParser.MULT_DIV_OP)
                        self.state = 44
                        self.expr(14)
                        pass

                    elif la_ == 2:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 45
                        if not self.precpred(self._ctx, 12):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 12)")
                        self.state = 46
                        self.match(HyamlParser.SIGN)
                        self.state = 47
                        self.expr(13)
                        pass

                    elif la_ == 3:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 48
                        if not self.precpred(self._ctx, 11):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 11)")
                        self.state = 49
                        self.match(HyamlParser.COMP_OP)
                        self.state = 50
                        self.expr(12)
                        pass

                    elif la_ == 4:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 51
                        if not self.precpred(self._ctx, 9):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 9)")
                        self.state = 52
                        self.match(HyamlParser.AND)
                        self.state = 53
                        self.expr(10)
                        pass

                    elif la_ == 5:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 54
                        if not self.precpred(self._ctx, 8):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 8)")
                        self.state = 55
                        self.match(HyamlParser.OR)
                        self.state = 56
                        self.expr(9)
                        pass

                    elif la_ == 6:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 57
                        if not self.precpred(self._ctx, 14):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 14)")
                        self.state = 58
                        self.callChain()
                        pass

             
                self.state = 63
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,3,self._ctx)

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

    class CallChainContext(ParserRuleContext):

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

        def attributeOrDispatch(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HyamlParser.AttributeOrDispatchContext)
            else:
                return self.getTypedRuleContext(HyamlParser.AttributeOrDispatchContext,i)


        def subscription(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HyamlParser.SubscriptionContext)
            else:
                return self.getTypedRuleContext(HyamlParser.SubscriptionContext,i)


        def getRuleIndex(self):
            return HyamlParser.RULE_callChain

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

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




    def callChain(self):

        localctx = HyamlParser.CallChainContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_callChain)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 66 
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 66
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [HyamlParser.SAFE_ACCESS, HyamlParser.ACCESS]:
                        self.state = 64
                        self.attributeOrDispatch()
                        pass
                    elif token in [HyamlParser.T__3]:
                        self.state = 65
                        self.subscription()
                        pass
                    else:
                        raise NoViableAltException(self)


                else:
                    raise NoViableAltException(self)
                self.state = 68 
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,5,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 AttributeOrDispatchContext(ParserRuleContext):

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

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

        def SAFE_ACCESS(self):
            return self.getToken(HyamlParser.SAFE_ACCESS, 0)

        def ACCESS(self):
            return self.getToken(HyamlParser.ACCESS, 0)

        def args(self):
            return self.getTypedRuleContext(HyamlParser.ArgsContext,0)


        def PRED(self):
            return self.getToken(HyamlParser.PRED, 0)

        def getRuleIndex(self):
            return HyamlParser.RULE_attributeOrDispatch

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

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




    def attributeOrDispatch(self):

        localctx = HyamlParser.AttributeOrDispatchContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_attributeOrDispatch)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 70
            _la = self._input.LA(1)
            if not(_la==HyamlParser.SAFE_ACCESS or _la==HyamlParser.ACCESS):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 71
            self.match(HyamlParser.ID)
            self.state = 76
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,7,self._ctx)
            if la_ == 1:
                self.state = 73
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==HyamlParser.PRED:
                    self.state = 72
                    self.match(HyamlParser.PRED)


                self.state = 75
                self.args()


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

    class ExprListContext(ParserRuleContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HyamlParser.ExprContext)
            else:
                return self.getTypedRuleContext(HyamlParser.ExprContext,i)


        def getRuleIndex(self):
            return HyamlParser.RULE_exprList

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

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




    def exprList(self):

        localctx = HyamlParser.ExprListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_exprList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 78
            self.expr(0)
            self.state = 83
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HyamlParser.T__0:
                self.state = 79
                self.match(HyamlParser.T__0)
                self.state = 80
                self.expr(0)
                self.state = 85
                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 ArgsContext(ParserRuleContext):

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

        def exprList(self):
            return self.getTypedRuleContext(HyamlParser.ExprListContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_args

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

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




    def args(self):

        localctx = HyamlParser.ArgsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_args)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 86
            self.match(HyamlParser.T__1)
            self.state = 88
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << HyamlParser.T__1) | (1 << HyamlParser.T__3) | (1 << HyamlParser.T__6) | (1 << HyamlParser.TRUE) | (1 << HyamlParser.FALSE) | (1 << HyamlParser.NOT) | (1 << HyamlParser.SIGN) | (1 << HyamlParser.NUMBER) | (1 << HyamlParser.VAR) | (1 << HyamlParser.STRING))) != 0):
                self.state = 87
                self.exprList()


            self.state = 90
            self.match(HyamlParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SubscriptionContext(ParserRuleContext):

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

        def expr(self):
            return self.getTypedRuleContext(HyamlParser.ExprContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_subscription

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

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




    def subscription(self):

        localctx = HyamlParser.SubscriptionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_subscription)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 92
            self.match(HyamlParser.T__3)
            self.state = 93
            self.expr(0)
            self.state = 94
            self.match(HyamlParser.T__4)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ListLiteralContext(ParserRuleContext):

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

        def exprList(self):
            return self.getTypedRuleContext(HyamlParser.ExprListContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_listLiteral

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

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




    def listLiteral(self):

        localctx = HyamlParser.ListLiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_listLiteral)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 96
            self.match(HyamlParser.T__3)
            self.state = 98
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << HyamlParser.T__1) | (1 << HyamlParser.T__3) | (1 << HyamlParser.T__6) | (1 << HyamlParser.TRUE) | (1 << HyamlParser.FALSE) | (1 << HyamlParser.NOT) | (1 << HyamlParser.SIGN) | (1 << HyamlParser.NUMBER) | (1 << HyamlParser.VAR) | (1 << HyamlParser.STRING))) != 0):
                self.state = 97
                self.exprList()


            self.state = 100
            self.match(HyamlParser.T__4)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class KeyValuePairContext(ParserRuleContext):

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

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

        def expr(self):
            return self.getTypedRuleContext(HyamlParser.ExprContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_keyValuePair

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

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




    def keyValuePair(self):

        localctx = HyamlParser.KeyValuePairContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_keyValuePair)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 102
            self.match(HyamlParser.ID)
            self.state = 103
            self.match(HyamlParser.T__5)
            self.state = 104
            self.expr(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class KeyValuePairsContext(ParserRuleContext):

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

        def keyValuePair(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HyamlParser.KeyValuePairContext)
            else:
                return self.getTypedRuleContext(HyamlParser.KeyValuePairContext,i)


        def getRuleIndex(self):
            return HyamlParser.RULE_keyValuePairs

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

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




    def keyValuePairs(self):

        localctx = HyamlParser.KeyValuePairsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_keyValuePairs)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 106
            self.keyValuePair()
            self.state = 111
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HyamlParser.T__0:
                self.state = 107
                self.match(HyamlParser.T__0)
                self.state = 108
                self.keyValuePair()
                self.state = 113
                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 DictLiteralContext(ParserRuleContext):

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

        def keyValuePairs(self):
            return self.getTypedRuleContext(HyamlParser.KeyValuePairsContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_dictLiteral

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

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




    def dictLiteral(self):

        localctx = HyamlParser.DictLiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_dictLiteral)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 114
            self.match(HyamlParser.T__6)
            self.state = 116
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==HyamlParser.ID:
                self.state = 115
                self.keyValuePairs()


            self.state = 118
            self.match(HyamlParser.T__7)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ParensContext(ParserRuleContext):

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

        def expr(self):
            return self.getTypedRuleContext(HyamlParser.ExprContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_parens

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

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




    def parens(self):

        localctx = HyamlParser.ParensContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_parens)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 120
            self.match(HyamlParser.T__1)
            self.state = 121
            self.expr(0)
            self.state = 122
            self.match(HyamlParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[1] = self.expr_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

    def expr_sempred(self, localctx:ExprContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 13)
         

            if predIndex == 1:
                return self.precpred(self._ctx, 12)
         

            if predIndex == 2:
                return self.precpred(self._ctx, 11)
         

            if predIndex == 3:
                return self.precpred(self._ctx, 9)
         

            if predIndex == 4:
                return self.precpred(self._ctx, 8)
         

            if predIndex == 5:
                return self.precpred(self._ctx, 14)
         





# Generated from Hyaml.g4 by ANTLR 4.7.1
# 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\36")
        buf.write("\177\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4")
        buf.write("\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\3\2\3")
        buf.write("\2\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3%\n\3\3\3\3\3\3")
        buf.write("\3\3\3\5\3+\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3")
        buf.write("\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\7\3>\n\3\f\3\16\3A\13\3")
        buf.write("\3\4\3\4\6\4E\n\4\r\4\16\4F\3\5\3\5\3\5\5\5L\n\5\3\5\5")
        buf.write("\5O\n\5\3\6\3\6\3\6\7\6T\n\6\f\6\16\6W\13\6\3\7\3\7\5")
        buf.write("\7[\n\7\3\7\3\7\3\b\3\b\3\b\3\b\3\t\3\t\5\te\n\t\3\t\3")
        buf.write("\t\3\n\3\n\3\n\3\n\3\13\3\13\3\13\7\13p\n\13\f\13\16\13")
        buf.write("s\13\13\3\f\3\f\5\fw\n\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\2")
        buf.write("\3\4\16\2\4\6\b\n\f\16\20\22\24\26\30\2\3\3\2\34\35\2")
        buf.write("\u008a\2\32\3\2\2\2\4*\3\2\2\2\6D\3\2\2\2\bH\3\2\2\2\n")
        buf.write("P\3\2\2\2\fX\3\2\2\2\16^\3\2\2\2\20b\3\2\2\2\22h\3\2\2")
        buf.write("\2\24l\3\2\2\2\26t\3\2\2\2\30z\3\2\2\2\32\33\5\4\3\2\33")
        buf.write("\3\3\2\2\2\34\35\b\3\1\2\35+\5\30\r\2\36\37\7\20\2\2\37")
        buf.write("+\5\4\3\f +\5\20\t\2!+\5\26\f\2\"+\7\27\2\2#%\7\21\2\2")
        buf.write("$#\3\2\2\2$%\3\2\2\2%&\3\2\2\2&+\7\22\2\2\'+\7\32\2\2")
        buf.write("(+\7\f\2\2)+\7\r\2\2*\34\3\2\2\2*\36\3\2\2\2* \3\2\2\2")
        buf.write("*!\3\2\2\2*\"\3\2\2\2*$\3\2\2\2*\'\3\2\2\2*(\3\2\2\2*")
        buf.write(")\3\2\2\2+?\3\2\2\2,-\f\17\2\2-.\7\23\2\2.>\5\4\3\20/")
        buf.write("\60\f\16\2\2\60\61\7\21\2\2\61>\5\4\3\17\62\63\f\r\2\2")
        buf.write("\63\64\7\24\2\2\64>\5\4\3\16\65\66\f\13\2\2\66\67\7\16")
        buf.write("\2\2\67>\5\4\3\f89\f\n\2\29:\7\17\2\2:>\5\4\3\13;<\f\20")
        buf.write("\2\2<>\5\6\4\2=,\3\2\2\2=/\3\2\2\2=\62\3\2\2\2=\65\3\2")
        buf.write("\2\2=8\3\2\2\2=;\3\2\2\2>A\3\2\2\2?=\3\2\2\2?@\3\2\2\2")
        buf.write("@\5\3\2\2\2A?\3\2\2\2BE\5\b\5\2CE\5\16\b\2DB\3\2\2\2D")
        buf.write("C\3\2\2\2EF\3\2\2\2FD\3\2\2\2FG\3\2\2\2G\7\3\2\2\2HI\t")
        buf.write("\2\2\2IN\7\26\2\2JL\7\36\2\2KJ\3\2\2\2KL\3\2\2\2LM\3\2")
        buf.write("\2\2MO\5\f\7\2NK\3\2\2\2NO\3\2\2\2O\t\3\2\2\2PU\5\4\3")
        buf.write("\2QR\7\3\2\2RT\5\4\3\2SQ\3\2\2\2TW\3\2\2\2US\3\2\2\2U")
        buf.write("V\3\2\2\2V\13\3\2\2\2WU\3\2\2\2XZ\7\4\2\2Y[\5\n\6\2ZY")
        buf.write("\3\2\2\2Z[\3\2\2\2[\\\3\2\2\2\\]\7\5\2\2]\r\3\2\2\2^_")
        buf.write("\7\6\2\2_`\5\4\3\2`a\7\7\2\2a\17\3\2\2\2bd\7\6\2\2ce\5")
        buf.write("\n\6\2dc\3\2\2\2de\3\2\2\2ef\3\2\2\2fg\7\7\2\2g\21\3\2")
        buf.write("\2\2hi\7\26\2\2ij\7\b\2\2jk\5\4\3\2k\23\3\2\2\2lq\5\22")
        buf.write("\n\2mn\7\3\2\2np\5\22\n\2om\3\2\2\2ps\3\2\2\2qo\3\2\2")
        buf.write("\2qr\3\2\2\2r\25\3\2\2\2sq\3\2\2\2tv\7\t\2\2uw\5\24\13")
        buf.write("\2vu\3\2\2\2vw\3\2\2\2wx\3\2\2\2xy\7\n\2\2y\27\3\2\2\2")
        buf.write("z{\7\4\2\2{|\5\4\3\2|}\7\5\2\2}\31\3\2\2\2\17$*=?DFKN")
        buf.write("UZdqv")
        return buf.getvalue()


class HyamlParser ( Parser ):

    grammarFileName = "Hyaml.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "','", "'('", "')'", "'['", "']'", "':'", 
                     "'{'", "'}'", "<INVALID>", "'true'", "'false'", "'and'", 
                     "'or'", "'not'", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'?.'", "'.'", "'?'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "NEWLINE", "TRUE", "FALSE", "AND", "OR", 
                      "NOT", "SIGN", "NUMBER", "MULT_DIV_OP", "COMP_OP", 
                      "ID_SYMBOL", "ID", "VAR", "LETTER", "DIGIT", "STRING", 
                      "WS", "SAFE_ACCESS", "ACCESS", "PRED" ]

    RULE_prog = 0
    RULE_expr = 1
    RULE_callChain = 2
    RULE_attributeOrDispatch = 3
    RULE_exprList = 4
    RULE_args = 5
    RULE_subscription = 6
    RULE_listLiteral = 7
    RULE_keyValuePair = 8
    RULE_keyValuePairs = 9
    RULE_dictLiteral = 10
    RULE_parens = 11

    ruleNames =  [ "prog", "expr", "callChain", "attributeOrDispatch", "exprList", 
                   "args", "subscription", "listLiteral", "keyValuePair", 
                   "keyValuePairs", "dictLiteral", "parens" ]

    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
    NEWLINE=9
    TRUE=10
    FALSE=11
    AND=12
    OR=13
    NOT=14
    SIGN=15
    NUMBER=16
    MULT_DIV_OP=17
    COMP_OP=18
    ID_SYMBOL=19
    ID=20
    VAR=21
    LETTER=22
    DIGIT=23
    STRING=24
    WS=25
    SAFE_ACCESS=26
    ACCESS=27
    PRED=28

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



    class ProgContext(ParserRuleContext):

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

        def expr(self):
            return self.getTypedRuleContext(HyamlParser.ExprContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_prog

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

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




    def prog(self):

        localctx = HyamlParser.ProgContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_prog)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 24
            self.expr(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ExprContext(ParserRuleContext):

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

        def parens(self):
            return self.getTypedRuleContext(HyamlParser.ParensContext,0)


        def NOT(self):
            return self.getToken(HyamlParser.NOT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HyamlParser.ExprContext)
            else:
                return self.getTypedRuleContext(HyamlParser.ExprContext,i)


        def listLiteral(self):
            return self.getTypedRuleContext(HyamlParser.ListLiteralContext,0)


        def dictLiteral(self):
            return self.getTypedRuleContext(HyamlParser.DictLiteralContext,0)


        def VAR(self):
            return self.getToken(HyamlParser.VAR, 0)

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

        def SIGN(self):
            return self.getToken(HyamlParser.SIGN, 0)

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

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

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

        def MULT_DIV_OP(self):
            return self.getToken(HyamlParser.MULT_DIV_OP, 0)

        def COMP_OP(self):
            return self.getToken(HyamlParser.COMP_OP, 0)

        def AND(self):
            return self.getToken(HyamlParser.AND, 0)

        def OR(self):
            return self.getToken(HyamlParser.OR, 0)

        def callChain(self):
            return self.getTypedRuleContext(HyamlParser.CallChainContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_expr

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

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



    def expr(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = HyamlParser.ExprContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 2
        self.enterRecursionRule(localctx, 2, self.RULE_expr, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 40
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [HyamlParser.T__1]:
                self.state = 27
                self.parens()
                pass
            elif token in [HyamlParser.NOT]:
                self.state = 28
                self.match(HyamlParser.NOT)
                self.state = 29
                self.expr(10)
                pass
            elif token in [HyamlParser.T__3]:
                self.state = 30
                self.listLiteral()
                pass
            elif token in [HyamlParser.T__6]:
                self.state = 31
                self.dictLiteral()
                pass
            elif token in [HyamlParser.VAR]:
                self.state = 32
                self.match(HyamlParser.VAR)
                pass
            elif token in [HyamlParser.SIGN, HyamlParser.NUMBER]:
                self.state = 34
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==HyamlParser.SIGN:
                    self.state = 33
                    self.match(HyamlParser.SIGN)


                self.state = 36
                self.match(HyamlParser.NUMBER)
                pass
            elif token in [HyamlParser.STRING]:
                self.state = 37
                self.match(HyamlParser.STRING)
                pass
            elif token in [HyamlParser.TRUE]:
                self.state = 38
                self.match(HyamlParser.TRUE)
                pass
            elif token in [HyamlParser.FALSE]:
                self.state = 39
                self.match(HyamlParser.FALSE)
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 61
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,3,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 59
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,2,self._ctx)
                    if la_ == 1:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 42
                        if not self.precpred(self._ctx, 13):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 13)")
                        self.state = 43
                        self.match(HyamlParser.MULT_DIV_OP)
                        self.state = 44
                        self.expr(14)
                        pass

                    elif la_ == 2:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 45
                        if not self.precpred(self._ctx, 12):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 12)")
                        self.state = 46
                        self.match(HyamlParser.SIGN)
                        self.state = 47
                        self.expr(13)
                        pass

                    elif la_ == 3:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 48
                        if not self.precpred(self._ctx, 11):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 11)")
                        self.state = 49
                        self.match(HyamlParser.COMP_OP)
                        self.state = 50
                        self.expr(12)
                        pass

                    elif la_ == 4:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 51
                        if not self.precpred(self._ctx, 9):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 9)")
                        self.state = 52
                        self.match(HyamlParser.AND)
                        self.state = 53
                        self.expr(10)
                        pass

                    elif la_ == 5:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 54
                        if not self.precpred(self._ctx, 8):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 8)")
                        self.state = 55
                        self.match(HyamlParser.OR)
                        self.state = 56
                        self.expr(9)
                        pass

                    elif la_ == 6:
                        localctx = HyamlParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 57
                        if not self.precpred(self._ctx, 14):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 14)")
                        self.state = 58
                        self.callChain()
                        pass

             
                self.state = 63
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,3,self._ctx)

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

    class CallChainContext(ParserRuleContext):

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

        def attributeOrDispatch(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HyamlParser.AttributeOrDispatchContext)
            else:
                return self.getTypedRuleContext(HyamlParser.AttributeOrDispatchContext,i)


        def subscription(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HyamlParser.SubscriptionContext)
            else:
                return self.getTypedRuleContext(HyamlParser.SubscriptionContext,i)


        def getRuleIndex(self):
            return HyamlParser.RULE_callChain

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

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




    def callChain(self):

        localctx = HyamlParser.CallChainContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_callChain)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 66 
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 66
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [HyamlParser.SAFE_ACCESS, HyamlParser.ACCESS]:
                        self.state = 64
                        self.attributeOrDispatch()
                        pass
                    elif token in [HyamlParser.T__3]:
                        self.state = 65
                        self.subscription()
                        pass
                    else:
                        raise NoViableAltException(self)


                else:
                    raise NoViableAltException(self)
                self.state = 68 
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,5,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 AttributeOrDispatchContext(ParserRuleContext):

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

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

        def SAFE_ACCESS(self):
            return self.getToken(HyamlParser.SAFE_ACCESS, 0)

        def ACCESS(self):
            return self.getToken(HyamlParser.ACCESS, 0)

        def args(self):
            return self.getTypedRuleContext(HyamlParser.ArgsContext,0)


        def PRED(self):
            return self.getToken(HyamlParser.PRED, 0)

        def getRuleIndex(self):
            return HyamlParser.RULE_attributeOrDispatch

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

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




    def attributeOrDispatch(self):

        localctx = HyamlParser.AttributeOrDispatchContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_attributeOrDispatch)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 70
            _la = self._input.LA(1)
            if not(_la==HyamlParser.SAFE_ACCESS or _la==HyamlParser.ACCESS):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 71
            self.match(HyamlParser.ID)
            self.state = 76
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,7,self._ctx)
            if la_ == 1:
                self.state = 73
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==HyamlParser.PRED:
                    self.state = 72
                    self.match(HyamlParser.PRED)


                self.state = 75
                self.args()


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

    class ExprListContext(ParserRuleContext):

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HyamlParser.ExprContext)
            else:
                return self.getTypedRuleContext(HyamlParser.ExprContext,i)


        def getRuleIndex(self):
            return HyamlParser.RULE_exprList

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

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




    def exprList(self):

        localctx = HyamlParser.ExprListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_exprList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 78
            self.expr(0)
            self.state = 83
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HyamlParser.T__0:
                self.state = 79
                self.match(HyamlParser.T__0)
                self.state = 80
                self.expr(0)
                self.state = 85
                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 ArgsContext(ParserRuleContext):

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

        def exprList(self):
            return self.getTypedRuleContext(HyamlParser.ExprListContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_args

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

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




    def args(self):

        localctx = HyamlParser.ArgsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_args)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 86
            self.match(HyamlParser.T__1)
            self.state = 88
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << HyamlParser.T__1) | (1 << HyamlParser.T__3) | (1 << HyamlParser.T__6) | (1 << HyamlParser.TRUE) | (1 << HyamlParser.FALSE) | (1 << HyamlParser.NOT) | (1 << HyamlParser.SIGN) | (1 << HyamlParser.NUMBER) | (1 << HyamlParser.VAR) | (1 << HyamlParser.STRING))) != 0):
                self.state = 87
                self.exprList()


            self.state = 90
            self.match(HyamlParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SubscriptionContext(ParserRuleContext):

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

        def expr(self):
            return self.getTypedRuleContext(HyamlParser.ExprContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_subscription

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

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




    def subscription(self):

        localctx = HyamlParser.SubscriptionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_subscription)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 92
            self.match(HyamlParser.T__3)
            self.state = 93
            self.expr(0)
            self.state = 94
            self.match(HyamlParser.T__4)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ListLiteralContext(ParserRuleContext):

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

        def exprList(self):
            return self.getTypedRuleContext(HyamlParser.ExprListContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_listLiteral

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

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




    def listLiteral(self):

        localctx = HyamlParser.ListLiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_listLiteral)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 96
            self.match(HyamlParser.T__3)
            self.state = 98
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << HyamlParser.T__1) | (1 << HyamlParser.T__3) | (1 << HyamlParser.T__6) | (1 << HyamlParser.TRUE) | (1 << HyamlParser.FALSE) | (1 << HyamlParser.NOT) | (1 << HyamlParser.SIGN) | (1 << HyamlParser.NUMBER) | (1 << HyamlParser.VAR) | (1 << HyamlParser.STRING))) != 0):
                self.state = 97
                self.exprList()


            self.state = 100
            self.match(HyamlParser.T__4)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class KeyValuePairContext(ParserRuleContext):

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

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

        def expr(self):
            return self.getTypedRuleContext(HyamlParser.ExprContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_keyValuePair

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

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




    def keyValuePair(self):

        localctx = HyamlParser.KeyValuePairContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_keyValuePair)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 102
            self.match(HyamlParser.ID)
            self.state = 103
            self.match(HyamlParser.T__5)
            self.state = 104
            self.expr(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class KeyValuePairsContext(ParserRuleContext):

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

        def keyValuePair(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HyamlParser.KeyValuePairContext)
            else:
                return self.getTypedRuleContext(HyamlParser.KeyValuePairContext,i)


        def getRuleIndex(self):
            return HyamlParser.RULE_keyValuePairs

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

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




    def keyValuePairs(self):

        localctx = HyamlParser.KeyValuePairsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_keyValuePairs)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 106
            self.keyValuePair()
            self.state = 111
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HyamlParser.T__0:
                self.state = 107
                self.match(HyamlParser.T__0)
                self.state = 108
                self.keyValuePair()
                self.state = 113
                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 DictLiteralContext(ParserRuleContext):

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

        def keyValuePairs(self):
            return self.getTypedRuleContext(HyamlParser.KeyValuePairsContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_dictLiteral

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

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




    def dictLiteral(self):

        localctx = HyamlParser.DictLiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_dictLiteral)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 114
            self.match(HyamlParser.T__6)
            self.state = 116
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==HyamlParser.ID:
                self.state = 115
                self.keyValuePairs()


            self.state = 118
            self.match(HyamlParser.T__7)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ParensContext(ParserRuleContext):

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

        def expr(self):
            return self.getTypedRuleContext(HyamlParser.ExprContext,0)


        def getRuleIndex(self):
            return HyamlParser.RULE_parens

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

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




    def parens(self):

        localctx = HyamlParser.ParensContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_parens)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 120
            self.match(HyamlParser.T__1)
            self.state = 121
            self.expr(0)
            self.state = 122
            self.match(HyamlParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[1] = self.expr_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

    def expr_sempred(self, localctx:ExprContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 13)
         

            if predIndex == 1:
                return self.precpred(self._ctx, 12)
         

            if predIndex == 2:
                return self.precpred(self._ctx, 11)
         

            if predIndex == 3:
                return self.precpred(self._ctx, 9)
         

            if predIndex == 4:
                return self.precpred(self._ctx, 8)
         

            if predIndex == 5:
                return self.precpred(self._ctx, 14)
         





# Generated from Hyaml.g4 by ANTLR 4.7.1 # encoding: utf-8 #%\7\21\2\2") #\3\2\2\2$%\3\2\2\2%&\3\2\2\2&+\7\22\2\2\'+\7\32\2\2") # Token type # Token type # Token type # Token type # Token type # Token type # Token type