# Generated from d:\Stu\Semester 3\Principles of Programming Languages\Tut\Tut3\test\PC_code\initial\src\main\bkit\parser\BKIT.g4 by ANTLR 4.8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys


from lexererr import *



def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\32")
        buf.write("\u00a5\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7")
        buf.write("\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r")
        buf.write("\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23")
        buf.write("\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30")
        buf.write("\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\3\2\3\2\3\3\3")
        buf.write("\3\3\4\3\4\3\5\3\5\3\5\7\5C\n\5\f\5\16\5F\13\5\3\6\6\6")
        buf.write("I\n\6\r\6\16\6J\3\7\6\7N\n\7\r\7\16\7O\3\7\3\7\6\7T\n")
        buf.write("\7\r\7\16\7U\3\7\3\7\5\7Z\n\7\3\7\3\7\3\7\5\7_\n\7\5\7")
        buf.write("a\n\7\5\7c\n\7\3\7\6\7f\n\7\r\7\16\7g\3\b\3\b\3\b\3\b")
        buf.write("\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3")
        buf.write("\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16\3\17\3\17\3\20\3\20")
        buf.write("\3\21\3\21\3\22\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\26")
        buf.write("\3\26\3\27\3\27\3\27\3\27\3\30\6\30\u0098\n\30\r\30\16")
        buf.write("\30\u0099\3\30\3\30\3\31\3\31\3\32\3\32\3\33\3\33\3\34")
        buf.write("\3\34\2\2\35\3\2\5\2\7\2\t\3\13\4\r\5\17\6\21\7\23\b\25")
        buf.write("\t\27\n\31\13\33\f\35\r\37\16!\17#\20%\21\'\22)\23+\24")
        buf.write("-\25/\26\61\27\63\30\65\31\67\32\3\2\7\3\2c|\3\2\62;\4")
        buf.write("\2GGgg\4\2--//\5\2\13\f\17\17\"\"\2\u00ac\2\t\3\2\2\2")
        buf.write("\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2")
        buf.write("\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33")
        buf.write("\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2")
        buf.write("\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2")
        buf.write("\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2")
        buf.write("\2\67\3\2\2\2\39\3\2\2\2\5;\3\2\2\2\7=\3\2\2\2\t?\3\2")
        buf.write("\2\2\13H\3\2\2\2\rM\3\2\2\2\17i\3\2\2\2\21m\3\2\2\2\23")
        buf.write("s\3\2\2\2\25z\3\2\2\2\27|\3\2\2\2\31~\3\2\2\2\33\u0080")
        buf.write("\3\2\2\2\35\u0082\3\2\2\2\37\u0084\3\2\2\2!\u0086\3\2")
        buf.write("\2\2#\u0088\3\2\2\2%\u008a\3\2\2\2\'\u008c\3\2\2\2)\u008e")
        buf.write("\3\2\2\2+\u0090\3\2\2\2-\u0092\3\2\2\2/\u0097\3\2\2\2")
        buf.write("\61\u009d\3\2\2\2\63\u009f\3\2\2\2\65\u00a1\3\2\2\2\67")
        buf.write("\u00a3\3\2\2\29:\t\2\2\2:\4\3\2\2\2;<\t\3\2\2<\6\3\2\2")
        buf.write("\2=>\7\60\2\2>\b\3\2\2\2?D\5\3\2\2@C\5\3\2\2AC\5\5\3\2")
        buf.write("B@\3\2\2\2BA\3\2\2\2CF\3\2\2\2DB\3\2\2\2DE\3\2\2\2E\n")
        buf.write("\3\2\2\2FD\3\2\2\2GI\5\5\3\2HG\3\2\2\2IJ\3\2\2\2JH\3\2")
        buf.write("\2\2JK\3\2\2\2K\f\3\2\2\2LN\5\5\3\2ML\3\2\2\2NO\3\2\2")
        buf.write("\2OM\3\2\2\2OP\3\2\2\2Pb\3\2\2\2QS\5\7\4\2RT\5\5\3\2S")
        buf.write("R\3\2\2\2TU\3\2\2\2US\3\2\2\2UV\3\2\2\2VW\3\2\2\2WY\t")
        buf.write("\4\2\2XZ\t\5\2\2YX\3\2\2\2YZ\3\2\2\2Zc\3\2\2\2[a\5\7\4")
        buf.write("\2\\^\t\4\2\2]_\t\5\2\2^]\3\2\2\2^_\3\2\2\2_a\3\2\2\2")
        buf.write("`[\3\2\2\2`\\\3\2\2\2ac\3\2\2\2bQ\3\2\2\2b`\3\2\2\2ce")
        buf.write("\3\2\2\2df\5\5\3\2ed\3\2\2\2fg\3\2\2\2ge\3\2\2\2gh\3\2")
        buf.write("\2\2h\16\3\2\2\2ij\7k\2\2jk\7p\2\2kl\7v\2\2l\20\3\2\2")
        buf.write("\2mn\7h\2\2no\7n\2\2op\7q\2\2pq\7c\2\2qr\7v\2\2r\22\3")
        buf.write("\2\2\2st\7t\2\2tu\7g\2\2uv\7v\2\2vw\7w\2\2wx\7t\2\2xy")
        buf.write("\7p\2\2y\24\3\2\2\2z{\7}\2\2{\26\3\2\2\2|}\7\177\2\2}")
        buf.write("\30\3\2\2\2~\177\7=\2\2\177\32\3\2\2\2\u0080\u0081\7.")
        buf.write("\2\2\u0081\34\3\2\2\2\u0082\u0083\7?\2\2\u0083\36\3\2")
        buf.write("\2\2\u0084\u0085\7*\2\2\u0085 \3\2\2\2\u0086\u0087\7+")
        buf.write("\2\2\u0087\"\3\2\2\2\u0088\u0089\7-\2\2\u0089$\3\2\2\2")
        buf.write("\u008a\u008b\7/\2\2\u008b&\3\2\2\2\u008c\u008d\7,\2\2")
        buf.write("\u008d(\3\2\2\2\u008e\u008f\7\61\2\2\u008f*\3\2\2\2\u0090")
        buf.write("\u0091\7<\2\2\u0091,\3\2\2\2\u0092\u0093\7X\2\2\u0093")
        buf.write("\u0094\7c\2\2\u0094\u0095\7t\2\2\u0095.\3\2\2\2\u0096")
        buf.write("\u0098\t\6\2\2\u0097\u0096\3\2\2\2\u0098\u0099\3\2\2\2")
        buf.write("\u0099\u0097\3\2\2\2\u0099\u009a\3\2\2\2\u009a\u009b\3")
        buf.write("\2\2\2\u009b\u009c\b\30\2\2\u009c\60\3\2\2\2\u009d\u009e")
        buf.write("\13\2\2\2\u009e\62\3\2\2\2\u009f\u00a0\13\2\2\2\u00a0")
        buf.write("\64\3\2\2\2\u00a1\u00a2\13\2\2\2\u00a2\66\3\2\2\2\u00a3")
        buf.write("\u00a4\13\2\2\2\u00a48\3\2\2\2\16\2BDJOUY^`bg\u0099\3")
        buf.write("\b\2\2")
        return buf.getvalue()


class BKITLexer(Lexer):

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

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

    ID = 1
    INTLIT = 2
    FLOATLIT = 3
    INT = 4
    FLOAT = 5
    RETURN = 6
    LB = 7
    RB = 8
    SM = 9
    CM = 10
    EQ = 11
    LP = 12
    RP = 13
    ADD = 14
    SUB = 15
    MUL = 16
    DIV = 17
    COLON = 18
    VAR = 19
    WS = 20
    ERROR_CHAR = 21
    UNCLOSE_STRING = 22
    ILLEGAL_ESCAPE = 23
    UNTERMINATED_COMMENT = 24

    channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ]

    modeNames = [ "DEFAULT_MODE" ]

    literalNames = [ "<INVALID>",
            "'int'", "'float'", "'return'", "'{'", "'}'", "';'", "','", 
            "'='", "'('", "')'", "'+'", "'-'", "'*'", "'/'", "':'", "'Var'" ]

    symbolicNames = [ "<INVALID>",
            "ID", "INTLIT", "FLOATLIT", "INT", "FLOAT", "RETURN", "LB", 
            "RB", "SM", "CM", "EQ", "LP", "RP", "ADD", "SUB", "MUL", "DIV", 
            "COLON", "VAR", "WS", "ERROR_CHAR", "UNCLOSE_STRING", "ILLEGAL_ESCAPE", 
            "UNTERMINATED_COMMENT" ]

    ruleNames = [ "LETTER", "NUMBER", "DOT", "ID", "INTLIT", "FLOATLIT", 
                  "INT", "FLOAT", "RETURN", "LB", "RB", "SM", "CM", "EQ", 
                  "LP", "RP", "ADD", "SUB", "MUL", "DIV", "COLON", "VAR", 
                  "WS", "ERROR_CHAR", "UNCLOSE_STRING", "ILLEGAL_ESCAPE", 
                  "UNTERMINATED_COMMENT" ]

    grammarFileName = "BKIT.g4"

    def __init__(self, input=None, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.8")
        self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
        self._actions = None
        self._predicates = None


    def emit(self):
        tk = self.type
        result = super().emit()
        if tk == self.UNCLOSE_STRING:       
            raise UncloseString(result.text)
        elif tk == self.ILLEGAL_ESCAPE:
            raise IllegalEscape(result.text)
        elif tk == self.ERROR_CHAR:
            raise ErrorToken(result.text)
        elif tk == self.UNTERMINATED_COMMENT:
            raise UnterminatedComment()
        else:
            return result;


