# pylint: skip-file
# Generated from Xkye.g4 by ANTLR 4.9
# 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\31")
        buf.write("\u00b2\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\5\2(\n\2\3\2\3\2\7\2,\n\2\f\2\16\2/\13\2\5\2\61\n")
        buf.write("\2\3\2\3\2\7\2\65\n\2\f\2\16\28\13\2\3\2\3\2\6\2<\n\2")
        buf.write("\r\2\16\2=\3\2\7\2A\n\2\f\2\16\2D\13\2\7\2F\n\2\f\2\16")
        buf.write("\2I\13\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3")
        buf.write("\4\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6")
        buf.write("\5\6d\n\6\3\6\3\6\3\7\3\7\5\7j\n\7\3\7\3\7\3\b\7\bo\n")
        buf.write("\b\f\b\16\br\13\b\3\b\6\bu\n\b\r\b\16\bv\3\t\3\t\3\t\3")
        buf.write("\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\5\t\u0084\n\t\3\n\6\n\u0087")
        buf.write("\n\n\r\n\16\n\u0088\3\13\6\13\u008c\n\13\r\13\16\13\u008d")
        buf.write("\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\16\3\16")
        buf.write("\3\16\3\17\3\17\3\20\3\20\3\20\3\21\3\21\3\22\3\22\3\22")
        buf.write("\5\22\u00a8\n\22\3\23\3\23\3\23\3\23\3\23\3\23\5\23\u00b0")
        buf.write("\n\23\3\23\2\2\24\2\4\6\b\n\f\16\20\22\24\26\30\32\34")
        buf.write('\36 "$\2\4\5\2\4\5\17\17\22\25\4\2\22\22\24\24\2\u00b0')
        buf.write("\2\60\3\2\2\2\4L\3\2\2\2\6R\3\2\2\2\bX\3\2\2\2\nc\3\2")
        buf.write("\2\2\fi\3\2\2\2\16t\3\2\2\2\20\u0083\3\2\2\2\22\u0086")
        buf.write("\3\2\2\2\24\u008b\3\2\2\2\26\u008f\3\2\2\2\30\u0098\3")
        buf.write("\2\2\2\32\u009a\3\2\2\2\34\u009d\3\2\2\2\36\u009f\3\2")
        buf.write('\2\2 \u00a2\3\2\2\2"\u00a4\3\2\2\2$\u00a9\3\2\2\2&(\5')
        buf.write("\4\3\2'&\3\2\2\2'(\3\2\2\2()\3\2\2\2)-\5\16\b\2*,\5")
        buf.write('"\22\2+*\3\2\2\2,/\3\2\2\2-+\3\2\2\2-.\3\2\2\2.\61\3')
        buf.write("\2\2\2/-\3\2\2\2\60'\3\2\2\2\60\61\3\2\2\2\61G\3\2\2")
        buf.write('\2\62\66\5\f\7\2\63\65\5"\22\2\64\63\3\2\2\2\658\3\2')
        buf.write("\2\2\66\64\3\2\2\2\66\67\3\2\2\2\67F\3\2\2\28\66\3\2\2")
        buf.write("\29;\5\f\7\2:<\5\n\6\2;:\3\2\2\2<=\3\2\2\2=;\3\2\2\2=")
        buf.write('>\3\2\2\2>B\3\2\2\2?A\5"\22\2@?\3\2\2\2AD\3\2\2\2B@\3')
        buf.write("\2\2\2BC\3\2\2\2CF\3\2\2\2DB\3\2\2\2E\62\3\2\2\2E9\3\2")
        buf.write("\2\2FI\3\2\2\2GE\3\2\2\2GH\3\2\2\2HJ\3\2\2\2IG\3\2\2\2")
        buf.write("JK\7\2\2\3K\3\3\2\2\2LM\7\13\2\2MN\7\13\2\2NO\7\3\2\2")
        buf.write("OP\7\f\2\2PQ\7\f\2\2Q\5\3\2\2\2RS\7\13\2\2ST\7\13\2\2")
        buf.write("TU\5\30\r\2UV\7\f\2\2VW\7\f\2\2W\7\3\2\2\2XY\7\13\2\2")
        buf.write("YZ\7\13\2\2Z[\5\30\r\2[\\\7\f\2\2\\]\7\13\2\2]^\5 \21")
        buf.write("\2^_\7\f\2\2_`\7\f\2\2`\t\3\2\2\2ad\5\6\4\2bd\5\b\5\2")
        buf.write("ca\3\2\2\2cb\3\2\2\2de\3\2\2\2ef\5\22\n\2f\13\3\2\2\2")
        buf.write("gj\5\6\4\2hj\5\b\5\2ig\3\2\2\2ih\3\2\2\2jk\3\2\2\2kl\5")
        buf.write("\24\13\2l\r\3\2\2\2mo\5\26\f\2nm\3\2\2\2or\3\2\2\2pn\3")
        buf.write("\2\2\2pq\3\2\2\2qs\3\2\2\2rp\3\2\2\2su\5\24\13\2tp\3\2")
        buf.write("\2\2uv\3\2\2\2vt\3\2\2\2vw\3\2\2\2w\17\3\2\2\2xy\7\13")
        buf.write("\2\2yz\5\30\r\2z{\7\f\2\2{\u0084\3\2\2\2|}\7\13\2\2}~")
        buf.write("\5\30\r\2~\177\7\f\2\2\177\u0080\7\13\2\2\u0080\u0081")
        buf.write("\5 \21\2\u0081\u0082\7\f\2\2\u0082\u0084\3\2\2\2\u0083")
        buf.write("x\3\2\2\2\u0083|\3\2\2\2\u0084\21\3\2\2\2\u0085\u0087")
        buf.write("\5\20\t\2\u0086\u0085\3\2\2\2\u0087\u0088\3\2\2\2\u0088")
        buf.write("\u0086\3\2\2\2\u0088\u0089\3\2\2\2\u0089\23\3\2\2\2\u008a")
        buf.write("\u008c\5\36\20\2\u008b\u008a\3\2\2\2\u008c\u008d\3\2\2")
        buf.write("\2\u008d\u008b\3\2\2\2\u008d\u008e\3\2\2\2\u008e\25\3")
        buf.write("\2\2\2\u008f\u0090\7\13\2\2\u0090\u0091\7\13\2\2\u0091")
        buf.write("\u0092\5\30\r\2\u0092\u0093\7\f\2\2\u0093\u0094\7\f\2")
        buf.write("\2\u0094\u0095\7\r\2\2\u0095\u0096\5 \21\2\u0096\u0097")
        buf.write("\7\16\2\2\u0097\27\3\2\2\2\u0098\u0099\7\26\2\2\u0099")
        buf.write("\31\3\2\2\2\u009a\u009b\7\t\2\2\u009b\u009c\5\30\r\2\u009c")
        buf.write("\33\3\2\2\2\u009d\u009e\t\2\2\2\u009e\35\3\2\2\2\u009f")
        buf.write("\u00a0\5\32\16\2\u00a0\u00a1\5\34\17\2\u00a1\37\3\2\2")
        buf.write("\2\u00a2\u00a3\t\3\2\2\u00a3!\3\2\2\2\u00a4\u00a5\7\7")
        buf.write("\2\2\u00a5\u00a7\5\30\r\2\u00a6\u00a8\5$\23\2\u00a7\u00a6")
        buf.write("\3\2\2\2\u00a7\u00a8\3\2\2\2\u00a8#\3\2\2\2\u00a9\u00aa")
        buf.write("\7\b\2\2\u00aa\u00af\5\30\r\2\u00ab\u00ac\7\r\2\2\u00ac")
        buf.write("\u00ad\5 \21\2\u00ad\u00ae\7\16\2\2\u00ae\u00b0\3\2\2")
        buf.write("\2\u00af\u00ab\3\2\2\2\u00af\u00b0\3\2\2\2\u00b0%\3\2")
        buf.write("\2\2\23'-\60\66=BEGcipv\u0083\u0088\u008d\u00a7\u00af")
        return buf.getvalue()


class XkyeParser(Parser):

    grammarFileName = "Xkye.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [
        "<INVALID>",
        "'global'",
        "<INVALID>",
        "<INVALID>",
        "'_'",
        "'?'",
        "'\\'",
        "'@'",
        "'.'",
        "'['",
        "']'",
        "'('",
        "')'",
    ]

    symbolicNames = [
        "<INVALID>",
        "<INVALID>",
        "IP",
        "SUBNET",
        "UNDERSCORE",
        "QUESTIONMARK",
        "BACKSLASH",
        "AT",
        "DOT",
        "LBRACKET",
        "RBRACKET",
        "LPAREN",
        "RPAREN",
        "BOOLEAN",
        "TRUE",
        "FALSE",
        "OCTET",
        "INTEGER_FLOAT",
        "INTEGER_DIGITS",
        "STRING",
        "ENTITY",
        "LINE_COMMENT",
        "BLOCK_COMMENT",
        "WS",
    ]

    RULE_globe = 0
    RULE_clutchheader = 1
    RULE_clutchdefheader = 2
    RULE_clutchsetheader = 3
    RULE_subclutchset = 4
    RULE_pairgroupset = 5
    RULE_globalgroup = 6
    RULE_subclutch = 7
    RULE_subclutchgroup = 8
    RULE_pairgroup = 9
    RULE_clutchspan = 10
    RULE_entity = 11
    RULE_key = 12
    RULE_value = 13
    RULE_pair = 14
    RULE_number = 15
    RULE_outstring = 16
    RULE_outstringsubset = 17

    ruleNames = [
        "globe",
        "clutchheader",
        "clutchdefheader",
        "clutchsetheader",
        "subclutchset",
        "pairgroupset",
        "globalgroup",
        "subclutch",
        "subclutchgroup",
        "pairgroup",
        "clutchspan",
        "entity",
        "key",
        "value",
        "pair",
        "number",
        "outstring",
        "outstringsubset",
    ]

    EOF = Token.EOF
    T__0 = 1
    IP = 2
    SUBNET = 3
    UNDERSCORE = 4
    QUESTIONMARK = 5
    BACKSLASH = 6
    AT = 7
    DOT = 8
    LBRACKET = 9
    RBRACKET = 10
    LPAREN = 11
    RPAREN = 12
    BOOLEAN = 13
    TRUE = 14
    FALSE = 15
    OCTET = 16
    INTEGER_FLOAT = 17
    INTEGER_DIGITS = 18
    STRING = 19
    ENTITY = 20
    LINE_COMMENT = 21
    BLOCK_COMMENT = 22
    WS = 23

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

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

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

        def globalgroup(self):
            return self.getTypedRuleContext(XkyeParser.GlobalgroupContext, 0)

        def pairgroupset(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(XkyeParser.PairgroupsetContext)
            else:
                return self.getTypedRuleContext(XkyeParser.PairgroupsetContext, i)

        def clutchheader(self):
            return self.getTypedRuleContext(XkyeParser.ClutchheaderContext, 0)

        def outstring(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(XkyeParser.OutstringContext)
            else:
                return self.getTypedRuleContext(XkyeParser.OutstringContext, i)

        def subclutchset(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(XkyeParser.SubclutchsetContext)
            else:
                return self.getTypedRuleContext(XkyeParser.SubclutchsetContext, i)

        def getRuleIndex(self):
            return XkyeParser.RULE_globe

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

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

    def globe(self):

        localctx = XkyeParser.GlobeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_globe)
        self._la = 0  # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 46
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input, 2, self._ctx)
            if la_ == 1:
                self.state = 37
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input, 0, self._ctx)
                if la_ == 1:
                    self.state = 36
                    self.clutchheader()

                self.state = 39
                self.globalgroup()
                self.state = 43
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la == XkyeParser.QUESTIONMARK:
                    self.state = 40
                    self.outstring()
                    self.state = 45
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

            self.state = 69
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la == XkyeParser.LBRACKET:
                self.state = 67
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input, 6, self._ctx)
                if la_ == 1:
                    self.state = 48
                    self.pairgroupset()
                    self.state = 52
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la == XkyeParser.QUESTIONMARK:
                        self.state = 49
                        self.outstring()
                        self.state = 54
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)

                    pass

                elif la_ == 2:
                    self.state = 55
                    self.pairgroupset()
                    self.state = 57
                    self._errHandler.sync(self)
                    _alt = 1
                    while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER:
                        if _alt == 1:
                            self.state = 56
                            self.subclutchset()

                        else:
                            raise NoViableAltException(self)
                        self.state = 59
                        self._errHandler.sync(self)
                        _alt = self._interp.adaptivePredict(self._input, 4, self._ctx)

                    self.state = 64
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la == XkyeParser.QUESTIONMARK:
                        self.state = 61
                        self.outstring()
                        self.state = 66
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)

                    pass

                self.state = 71
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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

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

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

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

        def getRuleIndex(self):
            return XkyeParser.RULE_clutchheader

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

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

    def clutchheader(self):

        localctx = XkyeParser.ClutchheaderContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_clutchheader)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 74
            self.match(XkyeParser.LBRACKET)
            self.state = 75
            self.match(XkyeParser.LBRACKET)
            self.state = 76
            self.match(XkyeParser.T__0)
            self.state = 77
            self.match(XkyeParser.RBRACKET)
            self.state = 78
            self.match(XkyeParser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

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

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

        def entity(self):
            return self.getTypedRuleContext(XkyeParser.EntityContext, 0)

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

        def getRuleIndex(self):
            return XkyeParser.RULE_clutchdefheader

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

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

    def clutchdefheader(self):

        localctx = XkyeParser.ClutchdefheaderContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_clutchdefheader)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 80
            self.match(XkyeParser.LBRACKET)
            self.state = 81
            self.match(XkyeParser.LBRACKET)
            self.state = 82
            self.entity()
            self.state = 83
            self.match(XkyeParser.RBRACKET)
            self.state = 84
            self.match(XkyeParser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

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

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

        def entity(self):
            return self.getTypedRuleContext(XkyeParser.EntityContext, 0)

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

        def number(self):
            return self.getTypedRuleContext(XkyeParser.NumberContext, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_clutchsetheader

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

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

    def clutchsetheader(self):

        localctx = XkyeParser.ClutchsetheaderContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_clutchsetheader)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 86
            self.match(XkyeParser.LBRACKET)
            self.state = 87
            self.match(XkyeParser.LBRACKET)
            self.state = 88
            self.entity()
            self.state = 89
            self.match(XkyeParser.RBRACKET)
            self.state = 90
            self.match(XkyeParser.LBRACKET)
            self.state = 91
            self.number()
            self.state = 92
            self.match(XkyeParser.RBRACKET)
            self.state = 93
            self.match(XkyeParser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

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

        def subclutchgroup(self):
            return self.getTypedRuleContext(XkyeParser.SubclutchgroupContext, 0)

        def clutchdefheader(self):
            return self.getTypedRuleContext(XkyeParser.ClutchdefheaderContext, 0)

        def clutchsetheader(self):
            return self.getTypedRuleContext(XkyeParser.ClutchsetheaderContext, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_subclutchset

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

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

    def subclutchset(self):

        localctx = XkyeParser.SubclutchsetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_subclutchset)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 97
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input, 8, self._ctx)
            if la_ == 1:
                self.state = 95
                self.clutchdefheader()
                pass

            elif la_ == 2:
                self.state = 96
                self.clutchsetheader()
                pass

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

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

        def pairgroup(self):
            return self.getTypedRuleContext(XkyeParser.PairgroupContext, 0)

        def clutchdefheader(self):
            return self.getTypedRuleContext(XkyeParser.ClutchdefheaderContext, 0)

        def clutchsetheader(self):
            return self.getTypedRuleContext(XkyeParser.ClutchsetheaderContext, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_pairgroupset

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

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

    def pairgroupset(self):

        localctx = XkyeParser.PairgroupsetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_pairgroupset)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 103
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input, 9, self._ctx)
            if la_ == 1:
                self.state = 101
                self.clutchdefheader()
                pass

            elif la_ == 2:
                self.state = 102
                self.clutchsetheader()
                pass

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

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

        def pairgroup(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(XkyeParser.PairgroupContext)
            else:
                return self.getTypedRuleContext(XkyeParser.PairgroupContext, i)

        def clutchspan(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(XkyeParser.ClutchspanContext)
            else:
                return self.getTypedRuleContext(XkyeParser.ClutchspanContext, i)

        def getRuleIndex(self):
            return XkyeParser.RULE_globalgroup

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

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

    def globalgroup(self):

        localctx = XkyeParser.GlobalgroupContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_globalgroup)
        self._la = 0  # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 114
            self._errHandler.sync(self)
            _alt = 1
            while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 110
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la == XkyeParser.LBRACKET:
                        self.state = 107
                        self.clutchspan()
                        self.state = 112
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)

                    self.state = 113
                    self.pairgroup()

                else:
                    raise NoViableAltException(self)
                self.state = 116
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input, 11, self._ctx)

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

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

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

        def entity(self):
            return self.getTypedRuleContext(XkyeParser.EntityContext, 0)

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

        def number(self):
            return self.getTypedRuleContext(XkyeParser.NumberContext, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_subclutch

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

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

    def subclutch(self):

        localctx = XkyeParser.SubclutchContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_subclutch)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 129
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input, 12, self._ctx)
            if la_ == 1:
                self.state = 118
                self.match(XkyeParser.LBRACKET)
                self.state = 119
                self.entity()
                self.state = 120
                self.match(XkyeParser.RBRACKET)
                pass

            elif la_ == 2:
                self.state = 122
                self.match(XkyeParser.LBRACKET)
                self.state = 123
                self.entity()
                self.state = 124
                self.match(XkyeParser.RBRACKET)
                self.state = 125
                self.match(XkyeParser.LBRACKET)
                self.state = 126
                self.number()
                self.state = 127
                self.match(XkyeParser.RBRACKET)
                pass

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

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

        def subclutch(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(XkyeParser.SubclutchContext)
            else:
                return self.getTypedRuleContext(XkyeParser.SubclutchContext, i)

        def getRuleIndex(self):
            return XkyeParser.RULE_subclutchgroup

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

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

    def subclutchgroup(self):

        localctx = XkyeParser.SubclutchgroupContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_subclutchgroup)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 132
            self._errHandler.sync(self)
            _alt = 1
            while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 131
                    self.subclutch()

                else:
                    raise NoViableAltException(self)
                self.state = 134
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input, 13, self._ctx)

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

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

        def pair(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(XkyeParser.PairContext)
            else:
                return self.getTypedRuleContext(XkyeParser.PairContext, i)

        def getRuleIndex(self):
            return XkyeParser.RULE_pairgroup

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

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

    def pairgroup(self):

        localctx = XkyeParser.PairgroupContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_pairgroup)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 137
            self._errHandler.sync(self)
            _alt = 1
            while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 136
                    self.pair()

                else:
                    raise NoViableAltException(self)
                self.state = 139
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input, 14, self._ctx)

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

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

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

        def entity(self):
            return self.getTypedRuleContext(XkyeParser.EntityContext, 0)

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

        def LPAREN(self):
            return self.getToken(XkyeParser.LPAREN, 0)

        def number(self):
            return self.getTypedRuleContext(XkyeParser.NumberContext, 0)

        def RPAREN(self):
            return self.getToken(XkyeParser.RPAREN, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_clutchspan

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

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

    def clutchspan(self):

        localctx = XkyeParser.ClutchspanContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_clutchspan)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 141
            self.match(XkyeParser.LBRACKET)
            self.state = 142
            self.match(XkyeParser.LBRACKET)
            self.state = 143
            self.entity()
            self.state = 144
            self.match(XkyeParser.RBRACKET)
            self.state = 145
            self.match(XkyeParser.RBRACKET)
            self.state = 146
            self.match(XkyeParser.LPAREN)
            self.state = 147
            self.number()
            self.state = 148
            self.match(XkyeParser.RPAREN)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

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

        def ENTITY(self):
            return self.getToken(XkyeParser.ENTITY, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_entity

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

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

    def entity(self):

        localctx = XkyeParser.EntityContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_entity)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 150
            self.match(XkyeParser.ENTITY)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

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

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

        def entity(self):
            return self.getTypedRuleContext(XkyeParser.EntityContext, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_key

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

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

    def key(self):

        localctx = XkyeParser.KeyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_key)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 152
            self.match(XkyeParser.AT)
            self.state = 153
            self.entity()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

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

        def INTEGER_DIGITS(self):
            return self.getToken(XkyeParser.INTEGER_DIGITS, 0)

        def INTEGER_FLOAT(self):
            return self.getToken(XkyeParser.INTEGER_FLOAT, 0)

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

        def IP(self):
            return self.getToken(XkyeParser.IP, 0)

        def OCTET(self):
            return self.getToken(XkyeParser.OCTET, 0)

        def SUBNET(self):
            return self.getToken(XkyeParser.SUBNET, 0)

        def BOOLEAN(self):
            return self.getToken(XkyeParser.BOOLEAN, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_value

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

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

    def value(self):

        localctx = XkyeParser.ValueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_value)
        self._la = 0  # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 155
            _la = self._input.LA(1)
            if not (
                (
                    ((_la) & ~0x3F) == 0
                    and (
                        (1 << _la)
                        & (
                            (1 << XkyeParser.IP)
                            | (1 << XkyeParser.SUBNET)
                            | (1 << XkyeParser.BOOLEAN)
                            | (1 << XkyeParser.OCTET)
                            | (1 << XkyeParser.INTEGER_FLOAT)
                            | (1 << XkyeParser.INTEGER_DIGITS)
                            | (1 << XkyeParser.STRING)
                        )
                    )
                    != 0
                )
            ):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

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

        def key(self):
            return self.getTypedRuleContext(XkyeParser.KeyContext, 0)

        def value(self):
            return self.getTypedRuleContext(XkyeParser.ValueContext, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_pair

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

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

    def pair(self):

        localctx = XkyeParser.PairContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_pair)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 157
            self.key()
            self.state = 158
            self.value()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

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

        def INTEGER_DIGITS(self):
            return self.getToken(XkyeParser.INTEGER_DIGITS, 0)

        def OCTET(self):
            return self.getToken(XkyeParser.OCTET, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_number

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

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

    def number(self):

        localctx = XkyeParser.NumberContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_number)
        self._la = 0  # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 160
            _la = self._input.LA(1)
            if not (_la == XkyeParser.OCTET or _la == XkyeParser.INTEGER_DIGITS):
                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 OutstringContext(ParserRuleContext):
        def __init__(
            self, parser, parent: ParserRuleContext = None, invokingState: int = -1
        ):
            super().__init__(parent, invokingState)
            self.parser = parser

        def QUESTIONMARK(self):
            return self.getToken(XkyeParser.QUESTIONMARK, 0)

        def entity(self):
            return self.getTypedRuleContext(XkyeParser.EntityContext, 0)

        def outstringsubset(self):
            return self.getTypedRuleContext(XkyeParser.OutstringsubsetContext, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_outstring

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

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

    def outstring(self):

        localctx = XkyeParser.OutstringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_outstring)
        self._la = 0  # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 162
            self.match(XkyeParser.QUESTIONMARK)
            self.state = 163
            self.entity()
            self.state = 165
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la == XkyeParser.BACKSLASH:
                self.state = 164
                self.outstringsubset()

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

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

        def BACKSLASH(self):
            return self.getToken(XkyeParser.BACKSLASH, 0)

        def entity(self):
            return self.getTypedRuleContext(XkyeParser.EntityContext, 0)

        def LPAREN(self):
            return self.getToken(XkyeParser.LPAREN, 0)

        def number(self):
            return self.getTypedRuleContext(XkyeParser.NumberContext, 0)

        def RPAREN(self):
            return self.getToken(XkyeParser.RPAREN, 0)

        def getRuleIndex(self):
            return XkyeParser.RULE_outstringsubset

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

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

    def outstringsubset(self):

        localctx = XkyeParser.OutstringsubsetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_outstringsubset)
        self._la = 0  # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 167
            self.match(XkyeParser.BACKSLASH)
            self.state = 168
            self.entity()
            self.state = 173
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la == XkyeParser.LPAREN:
                self.state = 169
                self.match(XkyeParser.LPAREN)
                self.state = 170
                self.number()
                self.state = 171
                self.match(XkyeParser.RPAREN)

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