# Generated from IRC.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\35")
        buf.write("\u009f\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\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
        buf.write("\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\5\2\62\n")
        buf.write("\2\3\3\3\3\3\3\3\3\3\4\5\49\n\4\3\4\3\4\3\4\3\4\3\4\3")
        buf.write("\4\3\4\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\7\3\7")
        buf.write("\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\t\3")
        buf.write("\t\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")
        buf.write("\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3")
        buf.write("\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\16")
        buf.write("\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17")
        buf.write("\3\20\3\20\3\20\3\21\3\21\3\21\7\21\u0093\n\21\f\21\16")
        buf.write("\21\u0096\13\21\3\22\3\22\3\22\5\22\u009b\n\22\3\23\3")
        buf.write("\23\3\23\2\2\24\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36")
        buf.write(" \"$\2\4\4\2\17\17\32\32\3\2\32\35\2\u0099\2\61\3\2\2")
        buf.write("\2\4\63\3\2\2\2\68\3\2\2\2\bA\3\2\2\2\nF\3\2\2\2\fK\3")
        buf.write("\2\2\2\16P\3\2\2\2\20Y\3\2\2\2\22a\3\2\2\2\24h\3\2\2\2")
        buf.write("\26o\3\2\2\2\30x\3\2\2\2\32\u0080\3\2\2\2\34\u0088\3\2")
        buf.write("\2\2\36\u008c\3\2\2\2 \u008f\3\2\2\2\"\u0097\3\2\2\2$")
        buf.write("\u009c\3\2\2\2&\62\5\4\3\2\'\62\5\6\4\2(\62\5\b\5\2)\62")
        buf.write("\5\n\6\2*\62\5\f\7\2+\62\5\16\b\2,\62\5\20\t\2-\62\5\22")
        buf.write("\n\2.\62\5\24\13\2/\62\5\26\f\2\60\62\5\30\r\2\61&\3\2")
        buf.write("\2\2\61\'\3\2\2\2\61(\3\2\2\2\61)\3\2\2\2\61*\3\2\2\2")
        buf.write("\61+\3\2\2\2\61,\3\2\2\2\61-\3\2\2\2\61.\3\2\2\2\61/\3")
        buf.write("\2\2\2\61\60\3\2\2\2\62\3\3\2\2\2\63\64\7\3\2\2\64\65")
        buf.write("\7\27\2\2\65\66\7\31\2\2\66\5\3\2\2\2\679\7\26\2\28\67")
        buf.write("\3\2\2\289\3\2\2\29:\3\2\2\2:;\5 \21\2;<\7\27\2\2<=\5")
        buf.write("\32\16\2=>\7\4\2\2>?\5\36\20\2?@\7\27\2\2@\7\3\2\2\2A")
        buf.write("B\7\30\2\2BC\5\32\16\2CD\7\5\2\2DE\5\36\20\2E\t\3\2\2")
        buf.write("\2FG\7\30\2\2GH\5\32\16\2HI\7\6\2\2IJ\5\36\20\2J\13\3")
        buf.write("\2\2\2KL\7\30\2\2LM\7\31\2\2MN\7\7\2\2NO\7\27\2\2O\r\3")
        buf.write("\2\2\2PQ\7\30\2\2QR\5\34\17\2RS\7\b\2\2ST\7\34\2\2TU\7")
        buf.write("\t\2\2UV\5\36\20\2VW\7\27\2\2WX\7\34\2\2X\17\3\2\2\2Y")
        buf.write("Z\7\30\2\2Z[\5\34\17\2[\\\7\n\2\2\\]\7\34\2\2]^\7\13\2")
        buf.write("\2^_\5\36\20\2_`\7\27\2\2`\21\3\2\2\2ab\7\26\2\2bc\5 ")
        buf.write("\21\2cd\7\27\2\2de\7\31\2\2ef\7\f\2\2fg\5\36\20\2g\23")
        buf.write("\3\2\2\2hi\7\26\2\2ij\5 \21\2jk\7\27\2\2kl\7\31\2\2lm")
        buf.write("\7\r\2\2mn\5\36\20\2n\25\3\2\2\2op\7\30\2\2pq\7\31\2\2")
        buf.write("qr\7\16\2\2rs\5\36\20\2st\7\27\2\2tu\7\34\2\2uv\7\13\2")
        buf.write("\2vw\t\2\2\2w\27\3\2\2\2xy\7\26\2\2yz\5 \21\2z{\7\27\2")
        buf.write("\2{|\7\31\2\2|}\7\20\2\2}~\5\36\20\2~\177\7\27\2\2\177")
        buf.write("\31\3\2\2\2\u0080\u0081\7\34\2\2\u0081\u0082\7\21\2\2")
        buf.write("\u0082\u0083\7\34\2\2\u0083\u0084\7\26\2\2\u0084\u0085")
        buf.write("\7\34\2\2\u0085\u0086\7\22\2\2\u0086\u0087\7\31\2\2\u0087")
        buf.write("\33\3\2\2\2\u0088\u0089\7\34\2\2\u0089\u008a\7\22\2\2")
        buf.write("\u008a\u008b\7\31\2\2\u008b\35\3\2\2\2\u008c\u008d\7\25")
        buf.write("\2\2\u008d\u008e\7\34\2\2\u008e\37\3\2\2\2\u008f\u0094")
        buf.write("\5\"\22\2\u0090\u0091\7\23\2\2\u0091\u0093\5\"\22\2\u0092")
        buf.write("\u0090\3\2\2\2\u0093\u0096\3\2\2\2\u0094\u0092\3\2\2\2")
        buf.write("\u0094\u0095\3\2\2\2\u0095!\3\2\2\2\u0096\u0094\3\2\2")
        buf.write("\2\u0097\u0098\5$\23\2\u0098\u009a\7\24\2\2\u0099\u009b")
        buf.write("\5$\23\2\u009a\u0099\3\2\2\2\u009a\u009b\3\2\2\2\u009b")
        buf.write("#\3\2\2\2\u009c\u009d\t\3\2\2\u009d%\3\2\2\2\6\618\u0094")
        buf.write("\u009a")
        return buf.getvalue()


class IRCParser ( Parser ):

    grammarFileName = "IRC.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'PING'", "' PRIVMSG '", "' JOIN '", "' PART '", 
                     "' CAP * ACK'", "' 353 '", "' = '", "' 366 '", "' '", 
                     "' USERSTATE '", "' ROOMSTATE '", "' HOSTTARGET '", 
                     "'-'", "' NOTICE '", "'!'", "'.'", "';'", "'='", "'#'", 
                     "'@'", "' :'", "':'", "'tmi.twitch.tv'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "HASH", "AT", 
                      "SEP", "COL", "TMI", "NUMBER", "HEXNUM", "ALPHANUM", 
                      "SWORD" ]

    RULE_message = 0
    RULE_ping = 1
    RULE_privmsg = 2
    RULE_join = 3
    RULE_part = 4
    RULE_cap_ack = 5
    RULE_names_reply = 6
    RULE_names_reply_end = 7
    RULE_userstate = 8
    RULE_roomstate = 9
    RULE_hosttarget = 10
    RULE_notice = 11
    RULE_sender = 12
    RULE_sender_short = 13
    RULE_channel = 14
    RULE_key_value_list = 15
    RULE_key_value = 16
    RULE_word = 17

    ruleNames =  [ "message", "ping", "privmsg", "join", "part", "cap_ack", 
                   "names_reply", "names_reply_end", "userstate", "roomstate", 
                   "hosttarget", "notice", "sender", "sender_short", "channel", 
                   "key_value_list", "key_value", "word" ]

    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
    T__13=14
    T__14=15
    T__15=16
    T__16=17
    T__17=18
    HASH=19
    AT=20
    SEP=21
    COL=22
    TMI=23
    NUMBER=24
    HEXNUM=25
    ALPHANUM=26
    SWORD=27

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

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

        def ping(self):
            return self.getTypedRuleContext(IRCParser.PingContext,0)


        def privmsg(self):
            return self.getTypedRuleContext(IRCParser.PrivmsgContext,0)


        def join(self):
            return self.getTypedRuleContext(IRCParser.JoinContext,0)


        def part(self):
            return self.getTypedRuleContext(IRCParser.PartContext,0)


        def cap_ack(self):
            return self.getTypedRuleContext(IRCParser.Cap_ackContext,0)


        def names_reply(self):
            return self.getTypedRuleContext(IRCParser.Names_replyContext,0)


        def names_reply_end(self):
            return self.getTypedRuleContext(IRCParser.Names_reply_endContext,0)


        def userstate(self):
            return self.getTypedRuleContext(IRCParser.UserstateContext,0)


        def roomstate(self):
            return self.getTypedRuleContext(IRCParser.RoomstateContext,0)


        def hosttarget(self):
            return self.getTypedRuleContext(IRCParser.HosttargetContext,0)


        def notice(self):
            return self.getTypedRuleContext(IRCParser.NoticeContext,0)


        def getRuleIndex(self):
            return IRCParser.RULE_message

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

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

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




    def message(self):

        localctx = IRCParser.MessageContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_message)
        try:
            self.state = 47
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,0,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 36
                self.ping()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 37
                self.privmsg()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 38
                self.join()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 39
                self.part()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 40
                self.cap_ack()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 41
                self.names_reply()
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 42
                self.names_reply_end()
                pass

            elif la_ == 8:
                self.enterOuterAlt(localctx, 8)
                self.state = 43
                self.userstate()
                pass

            elif la_ == 9:
                self.enterOuterAlt(localctx, 9)
                self.state = 44
                self.roomstate()
                pass

            elif la_ == 10:
                self.enterOuterAlt(localctx, 10)
                self.state = 45
                self.hosttarget()
                pass

            elif la_ == 11:
                self.enterOuterAlt(localctx, 11)
                self.state = 46
                self.notice()
                pass


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

    class PingContext(ParserRuleContext):

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

        def SEP(self):
            return self.getToken(IRCParser.SEP, 0)

        def TMI(self):
            return self.getToken(IRCParser.TMI, 0)

        def getRuleIndex(self):
            return IRCParser.RULE_ping

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

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

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




    def ping(self):

        localctx = IRCParser.PingContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_ping)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 49
            self.match(IRCParser.T__0)
            self.state = 50
            self.match(IRCParser.SEP)
            self.state = 51
            self.match(IRCParser.TMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class PrivmsgContext(ParserRuleContext):

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

        def key_value_list(self):
            return self.getTypedRuleContext(IRCParser.Key_value_listContext,0)


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

        def sender(self):
            return self.getTypedRuleContext(IRCParser.SenderContext,0)


        def channel(self):
            return self.getTypedRuleContext(IRCParser.ChannelContext,0)


        def AT(self):
            return self.getToken(IRCParser.AT, 0)

        def getRuleIndex(self):
            return IRCParser.RULE_privmsg

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

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

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




    def privmsg(self):

        localctx = IRCParser.PrivmsgContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_privmsg)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 54
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==IRCParser.AT:
                self.state = 53
                self.match(IRCParser.AT)


            self.state = 56
            self.key_value_list()
            self.state = 57
            self.match(IRCParser.SEP)
            self.state = 58
            self.sender()
            self.state = 59
            self.match(IRCParser.T__1)
            self.state = 60
            self.channel()
            self.state = 61
            self.match(IRCParser.SEP)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class JoinContext(ParserRuleContext):

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

        def COL(self):
            return self.getToken(IRCParser.COL, 0)

        def sender(self):
            return self.getTypedRuleContext(IRCParser.SenderContext,0)


        def channel(self):
            return self.getTypedRuleContext(IRCParser.ChannelContext,0)


        def getRuleIndex(self):
            return IRCParser.RULE_join

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

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

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




    def join(self):

        localctx = IRCParser.JoinContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_join)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 63
            self.match(IRCParser.COL)
            self.state = 64
            self.sender()
            self.state = 65
            self.match(IRCParser.T__2)
            self.state = 66
            self.channel()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class PartContext(ParserRuleContext):

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

        def COL(self):
            return self.getToken(IRCParser.COL, 0)

        def sender(self):
            return self.getTypedRuleContext(IRCParser.SenderContext,0)


        def channel(self):
            return self.getTypedRuleContext(IRCParser.ChannelContext,0)


        def getRuleIndex(self):
            return IRCParser.RULE_part

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

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

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




    def part(self):

        localctx = IRCParser.PartContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_part)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 68
            self.match(IRCParser.COL)
            self.state = 69
            self.sender()
            self.state = 70
            self.match(IRCParser.T__3)
            self.state = 71
            self.channel()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class Cap_ackContext(ParserRuleContext):

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

        def COL(self):
            return self.getToken(IRCParser.COL, 0)

        def TMI(self):
            return self.getToken(IRCParser.TMI, 0)

        def SEP(self):
            return self.getToken(IRCParser.SEP, 0)

        def getRuleIndex(self):
            return IRCParser.RULE_cap_ack

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

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

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




    def cap_ack(self):

        localctx = IRCParser.Cap_ackContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_cap_ack)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 73
            self.match(IRCParser.COL)
            self.state = 74
            self.match(IRCParser.TMI)
            self.state = 75
            self.match(IRCParser.T__4)
            self.state = 76
            self.match(IRCParser.SEP)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class Names_replyContext(ParserRuleContext):

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

        def COL(self):
            return self.getToken(IRCParser.COL, 0)

        def sender_short(self):
            return self.getTypedRuleContext(IRCParser.Sender_shortContext,0)


        def channel(self):
            return self.getTypedRuleContext(IRCParser.ChannelContext,0)


        def SEP(self):
            return self.getToken(IRCParser.SEP, 0)

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

        def getRuleIndex(self):
            return IRCParser.RULE_names_reply

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

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

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




    def names_reply(self):

        localctx = IRCParser.Names_replyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_names_reply)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 78
            self.match(IRCParser.COL)
            self.state = 79
            self.sender_short()
            self.state = 80
            self.match(IRCParser.T__5)
            self.state = 81
            localctx.username = self.match(IRCParser.ALPHANUM)
            self.state = 82
            self.match(IRCParser.T__6)
            self.state = 83
            self.channel()
            self.state = 84
            self.match(IRCParser.SEP)
            self.state = 85
            self.match(IRCParser.ALPHANUM)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class Names_reply_endContext(ParserRuleContext):

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

        def COL(self):
            return self.getToken(IRCParser.COL, 0)

        def sender_short(self):
            return self.getTypedRuleContext(IRCParser.Sender_shortContext,0)


        def channel(self):
            return self.getTypedRuleContext(IRCParser.ChannelContext,0)


        def SEP(self):
            return self.getToken(IRCParser.SEP, 0)

        def ALPHANUM(self):
            return self.getToken(IRCParser.ALPHANUM, 0)

        def getRuleIndex(self):
            return IRCParser.RULE_names_reply_end

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

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

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




    def names_reply_end(self):

        localctx = IRCParser.Names_reply_endContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_names_reply_end)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 87
            self.match(IRCParser.COL)
            self.state = 88
            self.sender_short()
            self.state = 89
            self.match(IRCParser.T__7)
            self.state = 90
            localctx.username = self.match(IRCParser.ALPHANUM)
            self.state = 91
            self.match(IRCParser.T__8)
            self.state = 92
            self.channel()
            self.state = 93
            self.match(IRCParser.SEP)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class UserstateContext(ParserRuleContext):

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

        def AT(self):
            return self.getToken(IRCParser.AT, 0)

        def key_value_list(self):
            return self.getTypedRuleContext(IRCParser.Key_value_listContext,0)


        def SEP(self):
            return self.getToken(IRCParser.SEP, 0)

        def TMI(self):
            return self.getToken(IRCParser.TMI, 0)

        def channel(self):
            return self.getTypedRuleContext(IRCParser.ChannelContext,0)


        def getRuleIndex(self):
            return IRCParser.RULE_userstate

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

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

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




    def userstate(self):

        localctx = IRCParser.UserstateContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_userstate)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 95
            self.match(IRCParser.AT)
            self.state = 96
            self.key_value_list()
            self.state = 97
            self.match(IRCParser.SEP)
            self.state = 98
            self.match(IRCParser.TMI)
            self.state = 99
            self.match(IRCParser.T__9)
            self.state = 100
            self.channel()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class RoomstateContext(ParserRuleContext):

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

        def AT(self):
            return self.getToken(IRCParser.AT, 0)

        def key_value_list(self):
            return self.getTypedRuleContext(IRCParser.Key_value_listContext,0)


        def SEP(self):
            return self.getToken(IRCParser.SEP, 0)

        def TMI(self):
            return self.getToken(IRCParser.TMI, 0)

        def channel(self):
            return self.getTypedRuleContext(IRCParser.ChannelContext,0)


        def getRuleIndex(self):
            return IRCParser.RULE_roomstate

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

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

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




    def roomstate(self):

        localctx = IRCParser.RoomstateContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_roomstate)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 102
            self.match(IRCParser.AT)
            self.state = 103
            self.key_value_list()
            self.state = 104
            self.match(IRCParser.SEP)
            self.state = 105
            self.match(IRCParser.TMI)
            self.state = 106
            self.match(IRCParser.T__10)
            self.state = 107
            self.channel()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class HosttargetContext(ParserRuleContext):

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

        def COL(self):
            return self.getToken(IRCParser.COL, 0)

        def TMI(self):
            return self.getToken(IRCParser.TMI, 0)

        def channel(self):
            return self.getTypedRuleContext(IRCParser.ChannelContext,0)


        def SEP(self):
            return self.getToken(IRCParser.SEP, 0)

        def ALPHANUM(self):
            return self.getToken(IRCParser.ALPHANUM, 0)

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

        def getRuleIndex(self):
            return IRCParser.RULE_hosttarget

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

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

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




    def hosttarget(self):

        localctx = IRCParser.HosttargetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_hosttarget)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 109
            self.match(IRCParser.COL)
            self.state = 110
            self.match(IRCParser.TMI)
            self.state = 111
            self.match(IRCParser.T__11)
            self.state = 112
            self.channel()
            self.state = 113
            self.match(IRCParser.SEP)
            self.state = 114
            localctx.target = self.match(IRCParser.ALPHANUM)
            self.state = 115
            self.match(IRCParser.T__8)
            self.state = 116
            localctx.number = self._input.LT(1)
            _la = self._input.LA(1)
            if not(_la==IRCParser.T__12 or _la==IRCParser.NUMBER):
                localctx.number = self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class NoticeContext(ParserRuleContext):

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

        def AT(self):
            return self.getToken(IRCParser.AT, 0)

        def key_value_list(self):
            return self.getTypedRuleContext(IRCParser.Key_value_listContext,0)


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

        def TMI(self):
            return self.getToken(IRCParser.TMI, 0)

        def channel(self):
            return self.getTypedRuleContext(IRCParser.ChannelContext,0)


        def getRuleIndex(self):
            return IRCParser.RULE_notice

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

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

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




    def notice(self):

        localctx = IRCParser.NoticeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_notice)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 118
            self.match(IRCParser.AT)
            self.state = 119
            self.key_value_list()
            self.state = 120
            self.match(IRCParser.SEP)
            self.state = 121
            self.match(IRCParser.TMI)
            self.state = 122
            self.match(IRCParser.T__13)
            self.state = 123
            self.channel()
            self.state = 124
            self.match(IRCParser.SEP)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SenderContext(ParserRuleContext):

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

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

        def AT(self):
            return self.getToken(IRCParser.AT, 0)

        def TMI(self):
            return self.getToken(IRCParser.TMI, 0)

        def getRuleIndex(self):
            return IRCParser.RULE_sender

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

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

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




    def sender(self):

        localctx = IRCParser.SenderContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_sender)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 126
            localctx.username = self.match(IRCParser.ALPHANUM)
            self.state = 127
            self.match(IRCParser.T__14)
            self.state = 128
            self.match(IRCParser.ALPHANUM)
            self.state = 129
            self.match(IRCParser.AT)
            self.state = 130
            self.match(IRCParser.ALPHANUM)
            self.state = 131
            self.match(IRCParser.T__15)
            self.state = 132
            self.match(IRCParser.TMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class Sender_shortContext(ParserRuleContext):

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

        def TMI(self):
            return self.getToken(IRCParser.TMI, 0)

        def ALPHANUM(self):
            return self.getToken(IRCParser.ALPHANUM, 0)

        def getRuleIndex(self):
            return IRCParser.RULE_sender_short

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

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

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




    def sender_short(self):

        localctx = IRCParser.Sender_shortContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_sender_short)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 134
            localctx.username = self.match(IRCParser.ALPHANUM)
            self.state = 135
            self.match(IRCParser.T__15)
            self.state = 136
            self.match(IRCParser.TMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ChannelContext(ParserRuleContext):

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

        def HASH(self):
            return self.getToken(IRCParser.HASH, 0)

        def ALPHANUM(self):
            return self.getToken(IRCParser.ALPHANUM, 0)

        def getRuleIndex(self):
            return IRCParser.RULE_channel

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

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

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




    def channel(self):

        localctx = IRCParser.ChannelContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_channel)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 138
            self.match(IRCParser.HASH)
            self.state = 139
            localctx.name = self.match(IRCParser.ALPHANUM)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class Key_value_listContext(ParserRuleContext):

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

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


        def getRuleIndex(self):
            return IRCParser.RULE_key_value_list

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

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

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




    def key_value_list(self):

        localctx = IRCParser.Key_value_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_key_value_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 141
            self.key_value()
            self.state = 146
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==IRCParser.T__16:
                self.state = 142
                self.match(IRCParser.T__16)
                self.state = 143
                self.key_value()
                self.state = 148
                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 Key_valueContext(ParserRuleContext):

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

        def word(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(IRCParser.WordContext)
            else:
                return self.getTypedRuleContext(IRCParser.WordContext,i)


        def getRuleIndex(self):
            return IRCParser.RULE_key_value

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

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

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




    def key_value(self):

        localctx = IRCParser.Key_valueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_key_value)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 149
            localctx.key = self.word()
            self.state = 150
            self.match(IRCParser.T__17)
            self.state = 152
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << IRCParser.NUMBER) | (1 << IRCParser.HEXNUM) | (1 << IRCParser.ALPHANUM) | (1 << IRCParser.SWORD))) != 0):
                self.state = 151
                localctx.value = self.word()


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

    class WordContext(ParserRuleContext):

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

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

        def HEXNUM(self):
            return self.getToken(IRCParser.HEXNUM, 0)

        def ALPHANUM(self):
            return self.getToken(IRCParser.ALPHANUM, 0)

        def SWORD(self):
            return self.getToken(IRCParser.SWORD, 0)

        def getRuleIndex(self):
            return IRCParser.RULE_word

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

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

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




    def word(self):

        localctx = IRCParser.WordContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_word)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 154
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << IRCParser.NUMBER) | (1 << IRCParser.HEXNUM) | (1 << IRCParser.ALPHANUM) | (1 << IRCParser.SWORD))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx





