# Generated from C:/Users/Emery/PycharmProjects/SpecularLang/ANTLR4\SpecLang.g4 by ANTLR 4.8
# 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():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3.")
        buf.write("\u00b0\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
        buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
        buf.write("\t\16\4\17\t\17\3\2\3\2\3\2\7\2\"\n\2\f\2\16\2%\13\2\3")
        buf.write("\2\6\2(\n\2\r\2\16\2)\3\3\3\3\3\3\3\3\5\3\60\n\3\3\3\5")
        buf.write("\3\63\n\3\3\4\3\4\3\4\5\48\n\4\3\5\3\5\3\5\3\5\7\5>\n")
        buf.write("\5\f\5\16\5A\13\5\3\5\3\5\3\6\5\6F\n\6\3\6\3\6\3\6\3\6")
        buf.write("\3\7\3\7\3\7\5\7O\n\7\3\7\3\7\3\7\5\7T\n\7\3\b\3\b\3\b")
        buf.write("\3\b\3\t\3\t\5\t\\\n\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\7\n")
        buf.write("e\n\n\f\n\16\nh\13\n\3\n\5\nk\n\n\3\13\3\13\3\13\3\13")
        buf.write("\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3")
        buf.write("\r\3\r\3\r\3\r\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\17")
        buf.write("\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17\7\17")
        buf.write("\u0093\n\17\f\17\16\17\u0096\13\17\3\17\3\17\5\17\u009a")
        buf.write("\n\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17")
        buf.write("\3\17\3\17\3\17\3\17\3\17\7\17\u00ab\n\17\f\17\16\17\u00ae")
        buf.write("\13\17\3\17\5?f\u0094\3\34\20\2\4\6\b\n\f\16\20\22\24")
        buf.write("\26\30\32\34\2\b\4\2##))\4\2\36\36\"\"\4\2#&)*\3\2\37")
        buf.write(" \3\2!\"\3\2\f\r\2\u00b7\2#\3\2\2\2\4/\3\2\2\2\6\67\3")
        buf.write("\2\2\2\b9\3\2\2\2\nE\3\2\2\2\fK\3\2\2\2\16U\3\2\2\2\20")
        buf.write("[\3\2\2\2\22]\3\2\2\2\24l\3\2\2\2\26s\3\2\2\2\30y\3\2")
        buf.write("\2\2\32\u0080\3\2\2\2\34\u0099\3\2\2\2\36\37\5\n\6\2\37")
        buf.write(" \7+\2\2 \"\3\2\2\2!\36\3\2\2\2\"%\3\2\2\2#!\3\2\2\2#")
        buf.write("$\3\2\2\2$\'\3\2\2\2%#\3\2\2\2&(\5\32\16\2\'&\3\2\2\2")
        buf.write("()\3\2\2\2)\'\3\2\2\2)*\3\2\2\2*\3\3\2\2\2+,\5\6\4\2,")
        buf.write("-\7+\2\2-\60\3\2\2\2.\60\5\20\t\2/+\3\2\2\2/.\3\2\2\2")
        buf.write("\60\62\3\2\2\2\61\63\5\4\3\2\62\61\3\2\2\2\62\63\3\2\2")
        buf.write("\2\63\5\3\2\2\2\648\5\f\7\2\658\5\n\6\2\668\5\b\5\2\67")
        buf.write("\64\3\2\2\2\67\65\3\2\2\2\67\66\3\2\2\28\7\3\2\2\29:\7")
        buf.write("\3\2\2:?\7#\2\2;<\7\4\2\2<>\7#\2\2=;\3\2\2\2>A\3\2\2\2")
        buf.write("?@\3\2\2\2?=\3\2\2\2@B\3\2\2\2A?\3\2\2\2BC\7\5\2\2C\t")
        buf.write("\3\2\2\2DF\7\33\2\2ED\3\2\2\2EF\3\2\2\2FG\3\2\2\2GH\7")
        buf.write(")\2\2HI\7\6\2\2IJ\5\34\17\2J\13\3\2\2\2KL\7\7\2\2LN\t")
        buf.write("\2\2\2MO\5\16\b\2NM\3\2\2\2NO\3\2\2\2OP\3\2\2\2PQ\7\b")
        buf.write("\2\2QS\7#\2\2RT\7\20\2\2SR\3\2\2\2ST\3\2\2\2T\r\3\2\2")
        buf.write("\2UV\7\t\2\2VW\7#\2\2WX\7\n\2\2X\17\3\2\2\2Y\\\5\22\n")
        buf.write("\2Z\\\5\30\r\2[Y\3\2\2\2[Z\3\2\2\2\\\21\3\2\2\2]^\7\27")
        buf.write("\2\2^_\5\34\17\2_`\7\13\2\2`a\7-\2\2ab\5\4\3\2bf\7.\2")
        buf.write("\2ce\5\24\13\2dc\3\2\2\2eh\3\2\2\2fg\3\2\2\2fd\3\2\2\2")
        buf.write("gj\3\2\2\2hf\3\2\2\2ik\5\26\f\2ji\3\2\2\2jk\3\2\2\2k\23")
        buf.write("\3\2\2\2lm\7\30\2\2mn\5\34\17\2no\7\13\2\2op\7-\2\2pq")
        buf.write("\5\4\3\2qr\7.\2\2r\25\3\2\2\2st\7\31\2\2tu\7\13\2\2uv")
        buf.write("\7-\2\2vw\5\4\3\2wx\7.\2\2x\27\3\2\2\2yz\7\21\2\2z{\5")
        buf.write("\34\17\2{|\7\13\2\2|}\7-\2\2}~\5\4\3\2~\177\7.\2\2\177")
        buf.write("\31\3\2\2\2\u0080\u0081\7\32\2\2\u0081\u0082\7#\2\2\u0082")
        buf.write("\u0083\7\13\2\2\u0083\u0084\7-\2\2\u0084\u0085\5\4\3\2")
        buf.write("\u0085\u0086\7.\2\2\u0086\33\3\2\2\2\u0087\u0088\b\17")
        buf.write("\1\2\u0088\u0089\t\3\2\2\u0089\u009a\5\34\17\13\u008a")
        buf.write("\u008b\7\t\2\2\u008b\u008c\5\34\17\2\u008c\u008d\7\n\2")
        buf.write("\2\u008d\u009a\3\2\2\2\u008e\u008f\7\16\2\2\u008f\u0094")
        buf.write("\7#\2\2\u0090\u0091\7\4\2\2\u0091\u0093\7#\2\2\u0092\u0090")
        buf.write("\3\2\2\2\u0093\u0096\3\2\2\2\u0094\u0095\3\2\2\2\u0094")
        buf.write("\u0092\3\2\2\2\u0095\u0097\3\2\2\2\u0096\u0094\3\2\2\2")
        buf.write("\u0097\u009a\7\17\2\2\u0098\u009a\t\4\2\2\u0099\u0087")
        buf.write("\3\2\2\2\u0099\u008a\3\2\2\2\u0099\u008e\3\2\2\2\u0099")
        buf.write("\u0098\3\2\2\2\u009a\u00ac\3\2\2\2\u009b\u009c\f\n\2\2")
        buf.write("\u009c\u009d\t\5\2\2\u009d\u00ab\5\34\17\13\u009e\u009f")
        buf.write("\f\t\2\2\u009f\u00a0\t\6\2\2\u00a0\u00ab\5\34\17\n\u00a1")
        buf.write("\u00a2\f\b\2\2\u00a2\u00a3\t\7\2\2\u00a3\u00ab\5\34\17")
        buf.write("\t\u00a4\u00a5\f\7\2\2\u00a5\u00a6\7\34\2\2\u00a6\u00ab")
        buf.write("\5\34\17\b\u00a7\u00a8\f\6\2\2\u00a8\u00a9\7\35\2\2\u00a9")
        buf.write("\u00ab\5\34\17\7\u00aa\u009b\3\2\2\2\u00aa\u009e\3\2\2")
        buf.write("\2\u00aa\u00a1\3\2\2\2\u00aa\u00a4\3\2\2\2\u00aa\u00a7")
        buf.write("\3\2\2\2\u00ab\u00ae\3\2\2\2\u00ac\u00aa\3\2\2\2\u00ac")
        buf.write("\u00ad\3\2\2\2\u00ad\35\3\2\2\2\u00ae\u00ac\3\2\2\2\22")
        buf.write("#)/\62\67?ENS[fj\u0094\u0099\u00aa\u00ac")
        return buf.getvalue()


class SpecLangParser ( Parser ):

    grammarFileName = "SpecLang.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'['", "','", "']'", "'='", "'@'", "':'", 
                     "'('", "')'", "';'", "'=='", "'!='", "'{'", "'}'", 
                     "'->'", "'while'", "'enter'", "'exits'", "'move'", 
                     "'to'", "'do'", "'if'", "'elif'", "'else'", "'scene'", 
                     "'global'", "'and'", "'or'", "'not'", "'*'", "'/'", 
                     "'+'", "'-'", "<INVALID>", "'True'", "'False'", "'None'", 
                     "'fadein'", "'fadeout'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "NEXT", "WHILE", "ENTER", 
                      "EXITS", "MOVE", "TO", "DO", "IF", "ELIF", "ELSE", 
                      "SCENE", "GLOBAL", "AND", "OR", "NOT", "MUL", "DIV", 
                      "ADD", "SUB", "STRING", "TRUE", "FALSE", "NONE", "FADEIN", 
                      "FADEOUT", "ID", "NUMBER", "NEWLINE", "WS", "INDENT", 
                      "DEDENT" ]

    RULE_program = 0
    RULE_block = 1
    RULE_simple_statement = 2
    RULE_stage_direction = 3
    RULE_assignment = 4
    RULE_dialog = 5
    RULE_emotion = 6
    RULE_complex_statement = 7
    RULE_ifstatement = 8
    RULE_else_if_statement = 9
    RULE_else_statement = 10
    RULE_whileLoop = 11
    RULE_scene_statement = 12
    RULE_expression = 13

    ruleNames =  [ "program", "block", "simple_statement", "stage_direction", 
                   "assignment", "dialog", "emotion", "complex_statement", 
                   "ifstatement", "else_if_statement", "else_statement", 
                   "whileLoop", "scene_statement", "expression" ]

    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
    T__8=9
    T__9=10
    T__10=11
    T__11=12
    T__12=13
    NEXT=14
    WHILE=15
    ENTER=16
    EXITS=17
    MOVE=18
    TO=19
    DO=20
    IF=21
    ELIF=22
    ELSE=23
    SCENE=24
    GLOBAL=25
    AND=26
    OR=27
    NOT=28
    MUL=29
    DIV=30
    ADD=31
    SUB=32
    STRING=33
    TRUE=34
    FALSE=35
    NONE=36
    FADEIN=37
    FADEOUT=38
    ID=39
    NUMBER=40
    NEWLINE=41
    WS=42
    INDENT=43
    DEDENT=44

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




    class ProgramContext(ParserRuleContext):

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

        def assignment(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SpecLangParser.AssignmentContext)
            else:
                return self.getTypedRuleContext(SpecLangParser.AssignmentContext,i)


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

        def scene_statement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SpecLangParser.Scene_statementContext)
            else:
                return self.getTypedRuleContext(SpecLangParser.Scene_statementContext,i)


        def getRuleIndex(self):
            return SpecLangParser.RULE_program

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

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

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




    def program(self):

        localctx = SpecLangParser.ProgramContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_program)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 33
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==SpecLangParser.GLOBAL or _la==SpecLangParser.ID:
                self.state = 28
                self.assignment()
                self.state = 29
                self.match(SpecLangParser.NEWLINE)
                self.state = 35
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 37 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 36
                self.scene_statement()
                self.state = 39 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==SpecLangParser.SCENE):
                    break

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


    class BlockContext(ParserRuleContext):

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

        def simple_statement(self):
            return self.getTypedRuleContext(SpecLangParser.Simple_statementContext,0)


        def NEWLINE(self):
            return self.getToken(SpecLangParser.NEWLINE, 0)

        def complex_statement(self):
            return self.getTypedRuleContext(SpecLangParser.Complex_statementContext,0)


        def block(self):
            return self.getTypedRuleContext(SpecLangParser.BlockContext,0)


        def getRuleIndex(self):
            return SpecLangParser.RULE_block

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

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

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




    def block(self):

        localctx = SpecLangParser.BlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_block)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 45
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SpecLangParser.T__0, SpecLangParser.T__4, SpecLangParser.GLOBAL, SpecLangParser.ID]:
                self.state = 41
                self.simple_statement()
                self.state = 42
                self.match(SpecLangParser.NEWLINE)
                pass
            elif token in [SpecLangParser.WHILE, SpecLangParser.IF]:
                self.state = 44
                self.complex_statement()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 48
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << SpecLangParser.T__0) | (1 << SpecLangParser.T__4) | (1 << SpecLangParser.WHILE) | (1 << SpecLangParser.IF) | (1 << SpecLangParser.GLOBAL) | (1 << SpecLangParser.ID))) != 0):
                self.state = 47
                self.block()


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


    class Simple_statementContext(ParserRuleContext):

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

        def dialog(self):
            return self.getTypedRuleContext(SpecLangParser.DialogContext,0)


        def assignment(self):
            return self.getTypedRuleContext(SpecLangParser.AssignmentContext,0)


        def stage_direction(self):
            return self.getTypedRuleContext(SpecLangParser.Stage_directionContext,0)


        def getRuleIndex(self):
            return SpecLangParser.RULE_simple_statement

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

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

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




    def simple_statement(self):

        localctx = SpecLangParser.Simple_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_simple_statement)
        try:
            self.state = 53
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SpecLangParser.T__4]:
                self.enterOuterAlt(localctx, 1)
                self.state = 50
                self.dialog()
                pass
            elif token in [SpecLangParser.GLOBAL, SpecLangParser.ID]:
                self.enterOuterAlt(localctx, 2)
                self.state = 51
                self.assignment()
                pass
            elif token in [SpecLangParser.T__0]:
                self.enterOuterAlt(localctx, 3)
                self.state = 52
                self.stage_direction()
                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 Stage_directionContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return SpecLangParser.RULE_stage_direction

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

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

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




    def stage_direction(self):

        localctx = SpecLangParser.Stage_directionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_stage_direction)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 55
            self.match(SpecLangParser.T__0)
            self.state = 56
            self.match(SpecLangParser.STRING)
            self.state = 61
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,5,self._ctx)
            while _alt!=1 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1+1:
                    self.state = 57
                    self.match(SpecLangParser.T__1)
                    self.state = 58
                    self.match(SpecLangParser.STRING) 
                self.state = 63
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,5,self._ctx)

            self.state = 64
            self.match(SpecLangParser.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 AssignmentContext(ParserRuleContext):

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

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

        def expression(self):
            return self.getTypedRuleContext(SpecLangParser.ExpressionContext,0)


        def GLOBAL(self):
            return self.getToken(SpecLangParser.GLOBAL, 0)

        def getRuleIndex(self):
            return SpecLangParser.RULE_assignment

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

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

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




    def assignment(self):

        localctx = SpecLangParser.AssignmentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_assignment)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 67
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==SpecLangParser.GLOBAL:
                self.state = 66
                self.match(SpecLangParser.GLOBAL)


            self.state = 69
            self.match(SpecLangParser.ID)
            self.state = 70
            self.match(SpecLangParser.T__3)
            self.state = 71
            self.expression(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DialogContext(ParserRuleContext):

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

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

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

        def emotion(self):
            return self.getTypedRuleContext(SpecLangParser.EmotionContext,0)


        def NEXT(self):
            return self.getToken(SpecLangParser.NEXT, 0)

        def getRuleIndex(self):
            return SpecLangParser.RULE_dialog

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

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

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




    def dialog(self):

        localctx = SpecLangParser.DialogContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_dialog)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 73
            self.match(SpecLangParser.T__4)
            self.state = 74
            _la = self._input.LA(1)
            if not(_la==SpecLangParser.STRING or _la==SpecLangParser.ID):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 76
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==SpecLangParser.T__6:
                self.state = 75
                self.emotion()


            self.state = 78
            self.match(SpecLangParser.T__5)
            self.state = 79
            self.match(SpecLangParser.STRING)
            self.state = 81
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==SpecLangParser.NEXT:
                self.state = 80
                self.match(SpecLangParser.NEXT)


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


    class EmotionContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return SpecLangParser.RULE_emotion

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

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

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




    def emotion(self):

        localctx = SpecLangParser.EmotionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_emotion)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 83
            self.match(SpecLangParser.T__6)
            self.state = 84
            self.match(SpecLangParser.STRING)
            self.state = 85
            self.match(SpecLangParser.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 Complex_statementContext(ParserRuleContext):

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

        def ifstatement(self):
            return self.getTypedRuleContext(SpecLangParser.IfstatementContext,0)


        def whileLoop(self):
            return self.getTypedRuleContext(SpecLangParser.WhileLoopContext,0)


        def getRuleIndex(self):
            return SpecLangParser.RULE_complex_statement

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

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

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




    def complex_statement(self):

        localctx = SpecLangParser.Complex_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_complex_statement)
        try:
            self.state = 89
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SpecLangParser.IF]:
                self.enterOuterAlt(localctx, 1)
                self.state = 87
                self.ifstatement()
                pass
            elif token in [SpecLangParser.WHILE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 88
                self.whileLoop()
                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 IfstatementContext(ParserRuleContext):

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

        def IF(self):
            return self.getToken(SpecLangParser.IF, 0)

        def expression(self):
            return self.getTypedRuleContext(SpecLangParser.ExpressionContext,0)


        def INDENT(self):
            return self.getToken(SpecLangParser.INDENT, 0)

        def block(self):
            return self.getTypedRuleContext(SpecLangParser.BlockContext,0)


        def DEDENT(self):
            return self.getToken(SpecLangParser.DEDENT, 0)

        def else_if_statement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SpecLangParser.Else_if_statementContext)
            else:
                return self.getTypedRuleContext(SpecLangParser.Else_if_statementContext,i)


        def else_statement(self):
            return self.getTypedRuleContext(SpecLangParser.Else_statementContext,0)


        def getRuleIndex(self):
            return SpecLangParser.RULE_ifstatement

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

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

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




    def ifstatement(self):

        localctx = SpecLangParser.IfstatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_ifstatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 91
            self.match(SpecLangParser.IF)
            self.state = 92
            self.expression(0)
            self.state = 93
            self.match(SpecLangParser.T__8)
            self.state = 94
            self.match(SpecLangParser.INDENT)
            self.state = 95
            self.block()
            self.state = 96
            self.match(SpecLangParser.DEDENT)
            self.state = 100
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,10,self._ctx)
            while _alt!=1 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1+1:
                    self.state = 97
                    self.else_if_statement() 
                self.state = 102
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,10,self._ctx)

            self.state = 104
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==SpecLangParser.ELSE:
                self.state = 103
                self.else_statement()


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


    class Else_if_statementContext(ParserRuleContext):

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

        def ELIF(self):
            return self.getToken(SpecLangParser.ELIF, 0)

        def expression(self):
            return self.getTypedRuleContext(SpecLangParser.ExpressionContext,0)


        def INDENT(self):
            return self.getToken(SpecLangParser.INDENT, 0)

        def block(self):
            return self.getTypedRuleContext(SpecLangParser.BlockContext,0)


        def DEDENT(self):
            return self.getToken(SpecLangParser.DEDENT, 0)

        def getRuleIndex(self):
            return SpecLangParser.RULE_else_if_statement

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

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

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




    def else_if_statement(self):

        localctx = SpecLangParser.Else_if_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_else_if_statement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 106
            self.match(SpecLangParser.ELIF)
            self.state = 107
            self.expression(0)
            self.state = 108
            self.match(SpecLangParser.T__8)
            self.state = 109
            self.match(SpecLangParser.INDENT)
            self.state = 110
            self.block()
            self.state = 111
            self.match(SpecLangParser.DEDENT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Else_statementContext(ParserRuleContext):

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

        def ELSE(self):
            return self.getToken(SpecLangParser.ELSE, 0)

        def INDENT(self):
            return self.getToken(SpecLangParser.INDENT, 0)

        def block(self):
            return self.getTypedRuleContext(SpecLangParser.BlockContext,0)


        def DEDENT(self):
            return self.getToken(SpecLangParser.DEDENT, 0)

        def getRuleIndex(self):
            return SpecLangParser.RULE_else_statement

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

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

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




    def else_statement(self):

        localctx = SpecLangParser.Else_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_else_statement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 113
            self.match(SpecLangParser.ELSE)
            self.state = 114
            self.match(SpecLangParser.T__8)
            self.state = 115
            self.match(SpecLangParser.INDENT)
            self.state = 116
            self.block()
            self.state = 117
            self.match(SpecLangParser.DEDENT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class WhileLoopContext(ParserRuleContext):

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

        def WHILE(self):
            return self.getToken(SpecLangParser.WHILE, 0)

        def expression(self):
            return self.getTypedRuleContext(SpecLangParser.ExpressionContext,0)


        def INDENT(self):
            return self.getToken(SpecLangParser.INDENT, 0)

        def block(self):
            return self.getTypedRuleContext(SpecLangParser.BlockContext,0)


        def DEDENT(self):
            return self.getToken(SpecLangParser.DEDENT, 0)

        def getRuleIndex(self):
            return SpecLangParser.RULE_whileLoop

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

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

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




    def whileLoop(self):

        localctx = SpecLangParser.WhileLoopContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_whileLoop)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 119
            self.match(SpecLangParser.WHILE)
            self.state = 120
            self.expression(0)
            self.state = 121
            self.match(SpecLangParser.T__8)
            self.state = 122
            self.match(SpecLangParser.INDENT)
            self.state = 123
            self.block()
            self.state = 124
            self.match(SpecLangParser.DEDENT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Scene_statementContext(ParserRuleContext):

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

        def SCENE(self):
            return self.getToken(SpecLangParser.SCENE, 0)

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

        def INDENT(self):
            return self.getToken(SpecLangParser.INDENT, 0)

        def block(self):
            return self.getTypedRuleContext(SpecLangParser.BlockContext,0)


        def DEDENT(self):
            return self.getToken(SpecLangParser.DEDENT, 0)

        def getRuleIndex(self):
            return SpecLangParser.RULE_scene_statement

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

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

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




    def scene_statement(self):

        localctx = SpecLangParser.Scene_statementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_scene_statement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 126
            self.match(SpecLangParser.SCENE)
            self.state = 127
            self.match(SpecLangParser.STRING)
            self.state = 128
            self.match(SpecLangParser.T__8)
            self.state = 129
            self.match(SpecLangParser.INDENT)
            self.state = 130
            self.block()
            self.state = 131
            self.match(SpecLangParser.DEDENT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExpressionContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return SpecLangParser.RULE_expression

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


    class AddContext(ExpressionContext):

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

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SpecLangParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(SpecLangParser.ExpressionContext,i)

        def ADD(self):
            return self.getToken(SpecLangParser.ADD, 0)
        def SUB(self):
            return self.getToken(SpecLangParser.SUB, 0)

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

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

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


    class EqualContext(ExpressionContext):

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

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SpecLangParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(SpecLangParser.ExpressionContext,i)


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

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

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


    class ParenContext(ExpressionContext):

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

        def expression(self):
            return self.getTypedRuleContext(SpecLangParser.ExpressionContext,0)


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

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

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


    class MultContext(ExpressionContext):

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

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SpecLangParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(SpecLangParser.ExpressionContext,i)

        def MUL(self):
            return self.getToken(SpecLangParser.MUL, 0)
        def DIV(self):
            return self.getToken(SpecLangParser.DIV, 0)

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

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

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


    class OrContext(ExpressionContext):

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

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SpecLangParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(SpecLangParser.ExpressionContext,i)

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

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

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

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


    class AndContext(ExpressionContext):

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

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SpecLangParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(SpecLangParser.ExpressionContext,i)

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

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

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

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


    class TermContext(ExpressionContext):

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

        def NONE(self):
            return self.getToken(SpecLangParser.NONE, 0)
        def TRUE(self):
            return self.getToken(SpecLangParser.TRUE, 0)
        def FALSE(self):
            return self.getToken(SpecLangParser.FALSE, 0)
        def ID(self):
            return self.getToken(SpecLangParser.ID, 0)
        def STRING(self):
            return self.getToken(SpecLangParser.STRING, 0)
        def NUMBER(self):
            return self.getToken(SpecLangParser.NUMBER, 0)

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

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

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


    class UnaryContext(ExpressionContext):

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

        def expression(self):
            return self.getTypedRuleContext(SpecLangParser.ExpressionContext,0)

        def NOT(self):
            return self.getToken(SpecLangParser.NOT, 0)
        def SUB(self):
            return self.getToken(SpecLangParser.SUB, 0)

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

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

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


    class ChoiceContext(ExpressionContext):

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

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

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

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

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



    def expression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = SpecLangParser.ExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 26
        self.enterRecursionRule(localctx, 26, self.RULE_expression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 151
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SpecLangParser.NOT, SpecLangParser.SUB]:
                localctx = SpecLangParser.UnaryContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 134
                _la = self._input.LA(1)
                if not(_la==SpecLangParser.NOT or _la==SpecLangParser.SUB):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 135
                self.expression(9)
                pass
            elif token in [SpecLangParser.T__6]:
                localctx = SpecLangParser.ParenContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 136
                self.match(SpecLangParser.T__6)
                self.state = 137
                self.expression(0)
                self.state = 138
                self.match(SpecLangParser.T__7)
                pass
            elif token in [SpecLangParser.T__11]:
                localctx = SpecLangParser.ChoiceContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 140
                self.match(SpecLangParser.T__11)
                self.state = 141
                self.match(SpecLangParser.STRING)
                self.state = 146
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,12,self._ctx)
                while _alt!=1 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1+1:
                        self.state = 142
                        self.match(SpecLangParser.T__1)
                        self.state = 143
                        self.match(SpecLangParser.STRING) 
                    self.state = 148
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,12,self._ctx)

                self.state = 149
                self.match(SpecLangParser.T__12)
                pass
            elif token in [SpecLangParser.STRING, SpecLangParser.TRUE, SpecLangParser.FALSE, SpecLangParser.NONE, SpecLangParser.ID, SpecLangParser.NUMBER]:
                localctx = SpecLangParser.TermContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 150
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << SpecLangParser.STRING) | (1 << SpecLangParser.TRUE) | (1 << SpecLangParser.FALSE) | (1 << SpecLangParser.NONE) | (1 << SpecLangParser.ID) | (1 << SpecLangParser.NUMBER))) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 170
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,15,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 = 168
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,14,self._ctx)
                    if la_ == 1:
                        localctx = SpecLangParser.MultContext(self, SpecLangParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 153
                        if not self.precpred(self._ctx, 8):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 8)")
                        self.state = 154
                        _la = self._input.LA(1)
                        if not(_la==SpecLangParser.MUL or _la==SpecLangParser.DIV):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 155
                        self.expression(9)
                        pass

                    elif la_ == 2:
                        localctx = SpecLangParser.AddContext(self, SpecLangParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 156
                        if not self.precpred(self._ctx, 7):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 7)")
                        self.state = 157
                        _la = self._input.LA(1)
                        if not(_la==SpecLangParser.ADD or _la==SpecLangParser.SUB):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 158
                        self.expression(8)
                        pass

                    elif la_ == 3:
                        localctx = SpecLangParser.EqualContext(self, SpecLangParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 159
                        if not self.precpred(self._ctx, 6):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
                        self.state = 160
                        _la = self._input.LA(1)
                        if not(_la==SpecLangParser.T__9 or _la==SpecLangParser.T__10):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 161
                        self.expression(7)
                        pass

                    elif la_ == 4:
                        localctx = SpecLangParser.AndContext(self, SpecLangParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 162
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 163
                        self.match(SpecLangParser.AND)
                        self.state = 164
                        self.expression(6)
                        pass

                    elif la_ == 5:
                        localctx = SpecLangParser.OrContext(self, SpecLangParser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 165
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 166
                        self.match(SpecLangParser.OR)
                        self.state = 167
                        self.expression(5)
                        pass

             
                self.state = 172
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,15,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



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[13] = self.expression_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 expression_sempred(self, localctx:ExpressionContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 8)
         

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

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

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

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




