# Generated from grammar.g4 by ANTLR 4.8
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO


def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\25")
        buf.write("\u00b9\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("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
        buf.write("\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36")
        buf.write("\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\5\2F\n\2\3\3\3\3")
        buf.write("\3\3\3\4\6\4L\n\4\r\4\16\4M\3\5\5\5Q\n\5\3\6\3\6\3\6\3")
        buf.write("\6\3\6\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\t\5\t`\n\t\3\n\3")
        buf.write("\n\5\nd\n\n\3\13\7\13g\n\13\f\13\16\13j\13\13\3\f\3\f")
        buf.write("\3\f\3\r\7\rp\n\r\f\r\16\rs\13\r\3\16\3\16\3\16\3\17\3")
        buf.write("\17\5\17z\n\17\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\21")
        buf.write("\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23\3\24\3\24")
        buf.write("\3\25\6\25\u0090\n\25\r\25\16\25\u0091\3\26\3\26\3\26")
        buf.write("\5\26\u0097\n\26\3\27\6\27\u009a\n\27\r\27\16\27\u009b")
        buf.write("\3\30\3\30\5\30\u00a0\n\30\3\31\6\31\u00a3\n\31\r\31\16")
        buf.write("\31\u00a4\3\32\3\32\3\33\6\33\u00aa\n\33\r\33\16\33\u00ab")
        buf.write("\3\34\3\34\3\34\3\35\3\35\3\35\3\35\3\36\3\36\5\36\u00b7")
        buf.write("\n\36\3\36\2\2\37\2\4\6\b\n\f\16\20\22\24\26\30\32\34")
        buf.write("\36 \"$&(*,.\60\62\64\668:\2\4\4\2\6\6\21\21\6\2\3\6\t")
        buf.write("\t\16\17\21\21\2\u00ab\2<\3\2\2\2\4G\3\2\2\2\6K\3\2\2")
        buf.write("\2\bP\3\2\2\2\nR\3\2\2\2\fW\3\2\2\2\16Z\3\2\2\2\20_\3")
        buf.write("\2\2\2\22c\3\2\2\2\24h\3\2\2\2\26k\3\2\2\2\30q\3\2\2\2")
        buf.write("\32t\3\2\2\2\34w\3\2\2\2\36{\3\2\2\2 \177\3\2\2\2\"\u0083")
        buf.write("\3\2\2\2$\u0087\3\2\2\2&\u008c\3\2\2\2(\u008f\3\2\2\2")
        buf.write("*\u0096\3\2\2\2,\u0099\3\2\2\2.\u009f\3\2\2\2\60\u00a2")
        buf.write("\3\2\2\2\62\u00a6\3\2\2\2\64\u00a9\3\2\2\2\66\u00ad\3")
        buf.write("\2\2\28\u00b0\3\2\2\2:\u00b6\3\2\2\2<=\5\20\t\2=>\7\3")
        buf.write("\2\2>?\7\7\2\2?@\5\b\5\2@A\5:\36\2AB\7\7\2\2BC\5(\25\2")
        buf.write("CE\5\6\4\2DF\7\7\2\2ED\3\2\2\2EF\3\2\2\2F\3\3\2\2\2GH")
        buf.write("\7\7\2\2HI\5(\25\2I\5\3\2\2\2JL\5\4\3\2KJ\3\2\2\2LM\3")
        buf.write("\2\2\2MK\3\2\2\2MN\3\2\2\2N\7\3\2\2\2OQ\5\n\6\2PO\3\2")
        buf.write("\2\2PQ\3\2\2\2Q\t\3\2\2\2RS\7\n\2\2ST\5\f\7\2TU\7\13\2")
        buf.write("\2UV\7\7\2\2V\13\3\2\2\2WX\5\16\b\2XY\5\30\r\2Y\r\3\2")
        buf.write("\2\2Z[\7\4\2\2[\\\7\f\2\2\\]\5\64\33\2]\17\3\2\2\2^`\5")
        buf.write("\34\17\2_^\3\2\2\2_`\3\2\2\2`\21\3\2\2\2ad\5\36\20\2b")
        buf.write("d\5 \21\2ca\3\2\2\2cb\3\2\2\2d\23\3\2\2\2eg\5\26\f\2f")
        buf.write("e\3\2\2\2gj\3\2\2\2hf\3\2\2\2hi\3\2\2\2i\25\3\2\2\2jh")
        buf.write("\3\2\2\2kl\7\16\2\2lm\7\6\2\2m\27\3\2\2\2np\5\32\16\2")
        buf.write("on\3\2\2\2ps\3\2\2\2qo\3\2\2\2qr\3\2\2\2r\31\3\2\2\2s")
        buf.write("q\3\2\2\2tu\7\20\2\2uv\5\16\b\2v\33\3\2\2\2wy\7\r\2\2")
        buf.write("xz\7\7\2\2yx\3\2\2\2yz\3\2\2\2z\35\3\2\2\2{|\7\22\2\2")
        buf.write("|}\5,\27\2}~\7\22\2\2~\37\3\2\2\2\177\u0080\7\23\2\2\u0080")
        buf.write("\u0081\5,\27\2\u0081\u0082\7\23\2\2\u0082!\3\2\2\2\u0083")
        buf.write("\u0084\7\n\2\2\u0084\u0085\5\22\n\2\u0085\u0086\7\13\2")
        buf.write("\2\u0086#\3\2\2\2\u0087\u0088\7\5\2\2\u0088\u0089\7\17")
        buf.write("\2\2\u0089\u008a\5\"\22\2\u008a\u008b\5\60\31\2\u008b")
        buf.write("%\3\2\2\2\u008c\u008d\t\2\2\2\u008d\'\3\2\2\2\u008e\u0090")
        buf.write("\5&\24\2\u008f\u008e\3\2\2\2\u0090\u0091\3\2\2\2\u0091")
        buf.write("\u008f\3\2\2\2\u0091\u0092\3\2\2\2\u0092)\3\2\2\2\u0093")
        buf.write("\u0097\7\25\2\2\u0094\u0097\5\62\32\2\u0095\u0097\7\f")
        buf.write("\2\2\u0096\u0093\3\2\2\2\u0096\u0094\3\2\2\2\u0096\u0095")
        buf.write("\3\2\2\2\u0097+\3\2\2\2\u0098\u009a\5*\26\2\u0099\u0098")
        buf.write("\3\2\2\2\u009a\u009b\3\2\2\2\u009b\u0099\3\2\2\2\u009b")
        buf.write("\u009c\3\2\2\2\u009c-\3\2\2\2\u009d\u00a0\5*\26\2\u009e")
        buf.write("\u00a0\7\13\2\2\u009f\u009d\3\2\2\2\u009f\u009e\3\2\2")
        buf.write("\2\u00a0/\3\2\2\2\u00a1\u00a3\5.\30\2\u00a2\u00a1\3\2")
        buf.write("\2\2\u00a3\u00a4\3\2\2\2\u00a4\u00a2\3\2\2\2\u00a4\u00a5")
        buf.write("\3\2\2\2\u00a5\61\3\2\2\2\u00a6\u00a7\t\3\2\2\u00a7\63")
        buf.write("\3\2\2\2\u00a8\u00aa\5\62\32\2\u00a9\u00a8\3\2\2\2\u00aa")
        buf.write("\u00ab\3\2\2\2\u00ab\u00a9\3\2\2\2\u00ab\u00ac\3\2\2\2")
        buf.write("\u00ac\65\3\2\2\2\u00ad\u00ae\7\6\2\2\u00ae\u00af\5\24")
        buf.write("\13\2\u00af\67\3\2\2\2\u00b0\u00b1\5\66\34\2\u00b1\u00b2")
        buf.write("\7\17\2\2\u00b2\u00b3\5\60\31\2\u00b39\3\2\2\2\u00b4\u00b7")
        buf.write("\5$\23\2\u00b5\u00b7\58\35\2\u00b6\u00b4\3\2\2\2\u00b6")
        buf.write("\u00b5\3\2\2\2\u00b7;\3\2\2\2\21EMP_chqy\u0091\u0096\u009b")
        buf.write("\u009f\u00a4\u00ab\u00b6")
        return buf.getvalue()


class apt_sourceParser ( Parser ):

    grammarFileName = "grammar.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "'cdrom:'", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'['", "']'", "'='", "'#'", "'+'", "':'", "','", "'-'", 
                     "'''", "'\"'" ]

    symbolicNames = [ "<INVALID>", "TypeR", "OptionName", "CdromSchema", 
                      "Word", "WSS", "WS", "PunctuationAllowedInOptionValue", 
                      "OptionsStart", "OptionsEnd", "OptionNameValueSeparator", 
                      "CommentMarker", "Plus", "Colon", "OptionsSeparator", 
                      "Dash", "SingleTick", "DoubleTick", "WordChar", "NonWhitespaceNonOptionValueNonSquareRightBracketNonEq" ]

    RULE_record = 0
    RULE_component = 1
    RULE_componentsR = 2
    RULE_optionsOpt = 3
    RULE_optionsR = 4
    RULE_optionsList = 5
    RULE_optionR = 6
    RULE_commenterROpt = 7
    RULE_tickEnclosedString = 8
    RULE_rest_words_with_delF = 9
    RULE_rest_word_with_delF = 10
    RULE_rest_options_with_delF = 11
    RULE_rest_option_with_delF = 12
    RULE_commenterR = 13
    RULE_singleTickEnclosedString = 14
    RULE_doubleTickEnclosedString = 15
    RULE_enclosedString = 16
    RULE_cdromURI = 17
    RULE_wordWithDashSegment = 18
    RULE_wordWithDash = 19
    RULE_nonSquareBracketStringSegment = 20
    RULE_nonSquareBracketString = 21
    RULE_nonSpaceStringSegment = 22
    RULE_nonSpaceString = 23
    RULE_optionValueSegment = 24
    RULE_optionValue = 25
    RULE_uriSchema = 26
    RULE_genericURI = 27
    RULE_uriR = 28

    ruleNames =  [ "record", "component", "componentsR", "optionsOpt", "optionsR", 
                   "optionsList", "optionR", "commenterROpt", "tickEnclosedString", 
                   "rest_words_with_delF", "rest_word_with_delF", "rest_options_with_delF", 
                   "rest_option_with_delF", "commenterR", "singleTickEnclosedString", 
                   "doubleTickEnclosedString", "enclosedString", "cdromURI", 
                   "wordWithDashSegment", "wordWithDash", "nonSquareBracketStringSegment", 
                   "nonSquareBracketString", "nonSpaceStringSegment", "nonSpaceString", 
                   "optionValueSegment", "optionValue", "uriSchema", "genericURI", 
                   "uriR" ]

    EOF = Token.EOF
    TypeR=1
    OptionName=2
    CdromSchema=3
    Word=4
    WSS=5
    WS=6
    PunctuationAllowedInOptionValue=7
    OptionsStart=8
    OptionsEnd=9
    OptionNameValueSeparator=10
    CommentMarker=11
    Plus=12
    Colon=13
    OptionsSeparator=14
    Dash=15
    SingleTick=16
    DoubleTick=17
    WordChar=18
    NonWhitespaceNonOptionValueNonSquareRightBracketNonEq=19

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




    class RecordContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.commented = None # CommenterROptContext
            self.rType = None # Token
            self.options = None # OptionsOptContext
            self.uri = None # UriRContext
            self.distribution = None # WordWithDashContext
            self.components = None # ComponentsRContext

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

        def commenterROpt(self):
            return self.getTypedRuleContext(apt_sourceParser.CommenterROptContext,0)


        def TypeR(self):
            return self.getToken(apt_sourceParser.TypeR, 0)

        def optionsOpt(self):
            return self.getTypedRuleContext(apt_sourceParser.OptionsOptContext,0)


        def uriR(self):
            return self.getTypedRuleContext(apt_sourceParser.UriRContext,0)


        def wordWithDash(self):
            return self.getTypedRuleContext(apt_sourceParser.WordWithDashContext,0)


        def componentsR(self):
            return self.getTypedRuleContext(apt_sourceParser.ComponentsRContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_record

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

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




    def record(self):

        localctx = apt_sourceParser.RecordContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_record)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 58
            localctx.commented = self.commenterROpt()
            self.state = 59
            localctx.rType = self.match(apt_sourceParser.TypeR)
            self.state = 60
            self.match(apt_sourceParser.WSS)
            self.state = 61
            localctx.options = self.optionsOpt()
            self.state = 62
            localctx.uri = self.uriR()
            self.state = 63
            self.match(apt_sourceParser.WSS)
            self.state = 64
            localctx.distribution = self.wordWithDash()
            self.state = 65
            localctx.components = self.componentsR()
            self.state = 67
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==apt_sourceParser.WSS:
                self.state = 66
                self.match(apt_sourceParser.WSS)


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


    class ComponentContext(ParserRuleContext):

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

        def WSS(self):
            return self.getToken(apt_sourceParser.WSS, 0)

        def wordWithDash(self):
            return self.getTypedRuleContext(apt_sourceParser.WordWithDashContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_component

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

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




    def component(self):

        localctx = apt_sourceParser.ComponentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_component)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 69
            self.match(apt_sourceParser.WSS)
            self.state = 70
            localctx.cId = self.wordWithDash()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ComponentsRContext(ParserRuleContext):

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

        def component(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(apt_sourceParser.ComponentContext)
            else:
                return self.getTypedRuleContext(apt_sourceParser.ComponentContext,i)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_componentsR

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

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




    def componentsR(self):

        localctx = apt_sourceParser.ComponentsRContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_componentsR)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 73 
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 72
                    self.component()

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

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

        def optionsR(self):
            return self.getTypedRuleContext(apt_sourceParser.OptionsRContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_optionsOpt

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

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




    def optionsOpt(self):

        localctx = apt_sourceParser.OptionsOptContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_optionsOpt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 78
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==apt_sourceParser.OptionsStart:
                self.state = 77
                self.optionsR()


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


    class OptionsRContext(ParserRuleContext):

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

        def OptionsStart(self):
            return self.getToken(apt_sourceParser.OptionsStart, 0)

        def OptionsEnd(self):
            return self.getToken(apt_sourceParser.OptionsEnd, 0)

        def WSS(self):
            return self.getToken(apt_sourceParser.WSS, 0)

        def optionsList(self):
            return self.getTypedRuleContext(apt_sourceParser.OptionsListContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_optionsR

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

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




    def optionsR(self):

        localctx = apt_sourceParser.OptionsRContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_optionsR)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 80
            self.match(apt_sourceParser.OptionsStart)
            self.state = 81
            localctx.pairs = self.optionsList()
            self.state = 82
            self.match(apt_sourceParser.OptionsEnd)
            self.state = 83
            self.match(apt_sourceParser.WSS)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class OptionsListContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.first_option = None # OptionRContext
            self.rest_options_with_del = None # Rest_options_with_delFContext

        def optionR(self):
            return self.getTypedRuleContext(apt_sourceParser.OptionRContext,0)


        def rest_options_with_delF(self):
            return self.getTypedRuleContext(apt_sourceParser.Rest_options_with_delFContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_optionsList

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

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




    def optionsList(self):

        localctx = apt_sourceParser.OptionsListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_optionsList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 85
            localctx.first_option = self.optionR()
            self.state = 86
            localctx.rest_options_with_del = self.rest_options_with_delF()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class OptionRContext(ParserRuleContext):

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

        def OptionNameValueSeparator(self):
            return self.getToken(apt_sourceParser.OptionNameValueSeparator, 0)

        def OptionName(self):
            return self.getToken(apt_sourceParser.OptionName, 0)

        def optionValue(self):
            return self.getTypedRuleContext(apt_sourceParser.OptionValueContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_optionR

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

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




    def optionR(self):

        localctx = apt_sourceParser.OptionRContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_optionR)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 88
            localctx.key = self.match(apt_sourceParser.OptionName)
            self.state = 89
            self.match(apt_sourceParser.OptionNameValueSeparator)
            self.state = 90
            localctx.value = self.optionValue()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CommenterROptContext(ParserRuleContext):

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

        def commenterR(self):
            return self.getTypedRuleContext(apt_sourceParser.CommenterRContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_commenterROpt

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

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




    def commenterROpt(self):

        localctx = apt_sourceParser.CommenterROptContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_commenterROpt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 93
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==apt_sourceParser.CommentMarker:
                self.state = 92
                self.commenterR()


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


    class TickEnclosedStringContext(ParserRuleContext):

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

        def singleTickEnclosedString(self):
            return self.getTypedRuleContext(apt_sourceParser.SingleTickEnclosedStringContext,0)


        def doubleTickEnclosedString(self):
            return self.getTypedRuleContext(apt_sourceParser.DoubleTickEnclosedStringContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_tickEnclosedString

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

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




    def tickEnclosedString(self):

        localctx = apt_sourceParser.TickEnclosedStringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_tickEnclosedString)
        try:
            self.state = 97
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [apt_sourceParser.SingleTick]:
                self.enterOuterAlt(localctx, 1)
                self.state = 95
                self.singleTickEnclosedString()
                pass
            elif token in [apt_sourceParser.DoubleTick]:
                self.enterOuterAlt(localctx, 2)
                self.state = 96
                self.doubleTickEnclosedString()
                pass
            else:
                raise NoViableAltException(self)

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


    class Rest_words_with_delFContext(ParserRuleContext):

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

        def rest_word_with_delF(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(apt_sourceParser.Rest_word_with_delFContext)
            else:
                return self.getTypedRuleContext(apt_sourceParser.Rest_word_with_delFContext,i)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_rest_words_with_delF

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

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




    def rest_words_with_delF(self):

        localctx = apt_sourceParser.Rest_words_with_delFContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_rest_words_with_delF)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 102
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==apt_sourceParser.Plus:
                self.state = 99
                self.rest_word_with_delF()
                self.state = 104
                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 Rest_word_with_delFContext(ParserRuleContext):

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

        def Plus(self):
            return self.getToken(apt_sourceParser.Plus, 0)

        def Word(self):
            return self.getToken(apt_sourceParser.Word, 0)

        def getRuleIndex(self):
            return apt_sourceParser.RULE_rest_word_with_delF

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

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




    def rest_word_with_delF(self):

        localctx = apt_sourceParser.Rest_word_with_delFContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_rest_word_with_delF)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 105
            self.match(apt_sourceParser.Plus)
            self.state = 106
            localctx.rest_word = self.match(apt_sourceParser.Word)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Rest_options_with_delFContext(ParserRuleContext):

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

        def rest_option_with_delF(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(apt_sourceParser.Rest_option_with_delFContext)
            else:
                return self.getTypedRuleContext(apt_sourceParser.Rest_option_with_delFContext,i)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_rest_options_with_delF

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

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




    def rest_options_with_delF(self):

        localctx = apt_sourceParser.Rest_options_with_delFContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_rest_options_with_delF)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 111
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==apt_sourceParser.OptionsSeparator:
                self.state = 108
                self.rest_option_with_delF()
                self.state = 113
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class Rest_option_with_delFContext(ParserRuleContext):

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

        def OptionsSeparator(self):
            return self.getToken(apt_sourceParser.OptionsSeparator, 0)

        def optionR(self):
            return self.getTypedRuleContext(apt_sourceParser.OptionRContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_rest_option_with_delF

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

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




    def rest_option_with_delF(self):

        localctx = apt_sourceParser.Rest_option_with_delFContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_rest_option_with_delF)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 114
            self.match(apt_sourceParser.OptionsSeparator)
            self.state = 115
            localctx.rest_option = self.optionR()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CommenterRContext(ParserRuleContext):

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

        def CommentMarker(self):
            return self.getToken(apt_sourceParser.CommentMarker, 0)

        def WSS(self):
            return self.getToken(apt_sourceParser.WSS, 0)

        def getRuleIndex(self):
            return apt_sourceParser.RULE_commenterR

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

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




    def commenterR(self):

        localctx = apt_sourceParser.CommenterRContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_commenterR)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 117
            self.match(apt_sourceParser.CommentMarker)
            self.state = 119
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==apt_sourceParser.WSS:
                self.state = 118
                self.match(apt_sourceParser.WSS)


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


    class SingleTickEnclosedStringContext(ParserRuleContext):

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

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

        def nonSquareBracketString(self):
            return self.getTypedRuleContext(apt_sourceParser.NonSquareBracketStringContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_singleTickEnclosedString

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

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




    def singleTickEnclosedString(self):

        localctx = apt_sourceParser.SingleTickEnclosedStringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_singleTickEnclosedString)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 121
            self.match(apt_sourceParser.SingleTick)
            self.state = 122
            self.nonSquareBracketString()
            self.state = 123
            self.match(apt_sourceParser.SingleTick)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DoubleTickEnclosedStringContext(ParserRuleContext):

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

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

        def nonSquareBracketString(self):
            return self.getTypedRuleContext(apt_sourceParser.NonSquareBracketStringContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_doubleTickEnclosedString

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

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




    def doubleTickEnclosedString(self):

        localctx = apt_sourceParser.DoubleTickEnclosedStringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_doubleTickEnclosedString)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 125
            self.match(apt_sourceParser.DoubleTick)
            self.state = 126
            self.nonSquareBracketString()
            self.state = 127
            self.match(apt_sourceParser.DoubleTick)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class EnclosedStringContext(ParserRuleContext):

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

        def OptionsStart(self):
            return self.getToken(apt_sourceParser.OptionsStart, 0)

        def tickEnclosedString(self):
            return self.getTypedRuleContext(apt_sourceParser.TickEnclosedStringContext,0)


        def OptionsEnd(self):
            return self.getToken(apt_sourceParser.OptionsEnd, 0)

        def getRuleIndex(self):
            return apt_sourceParser.RULE_enclosedString

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

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




    def enclosedString(self):

        localctx = apt_sourceParser.EnclosedStringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_enclosedString)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 129
            self.match(apt_sourceParser.OptionsStart)
            self.state = 130
            self.tickEnclosedString()
            self.state = 131
            self.match(apt_sourceParser.OptionsEnd)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CdromURIContext(ParserRuleContext):

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

        def CdromSchema(self):
            return self.getToken(apt_sourceParser.CdromSchema, 0)

        def Colon(self):
            return self.getToken(apt_sourceParser.Colon, 0)

        def enclosedString(self):
            return self.getTypedRuleContext(apt_sourceParser.EnclosedStringContext,0)


        def nonSpaceString(self):
            return self.getTypedRuleContext(apt_sourceParser.NonSpaceStringContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_cdromURI

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

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




    def cdromURI(self):

        localctx = apt_sourceParser.CdromURIContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_cdromURI)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 133
            self.match(apt_sourceParser.CdromSchema)
            self.state = 134
            self.match(apt_sourceParser.Colon)
            self.state = 135
            self.enclosedString()
            self.state = 136
            self.nonSpaceString()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class WordWithDashSegmentContext(ParserRuleContext):

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

        def Word(self):
            return self.getToken(apt_sourceParser.Word, 0)

        def Dash(self):
            return self.getToken(apt_sourceParser.Dash, 0)

        def getRuleIndex(self):
            return apt_sourceParser.RULE_wordWithDashSegment

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

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




    def wordWithDashSegment(self):

        localctx = apt_sourceParser.WordWithDashSegmentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_wordWithDashSegment)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 138
            _la = self._input.LA(1)
            if not(_la==apt_sourceParser.Word or _la==apt_sourceParser.Dash):
                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 WordWithDashContext(ParserRuleContext):

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

        def wordWithDashSegment(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(apt_sourceParser.WordWithDashSegmentContext)
            else:
                return self.getTypedRuleContext(apt_sourceParser.WordWithDashSegmentContext,i)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_wordWithDash

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

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




    def wordWithDash(self):

        localctx = apt_sourceParser.WordWithDashContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_wordWithDash)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 141 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 140
                self.wordWithDashSegment()
                self.state = 143 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==apt_sourceParser.Word or _la==apt_sourceParser.Dash):
                    break

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


    class NonSquareBracketStringSegmentContext(ParserRuleContext):

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

        def NonWhitespaceNonOptionValueNonSquareRightBracketNonEq(self):
            return self.getToken(apt_sourceParser.NonWhitespaceNonOptionValueNonSquareRightBracketNonEq, 0)

        def optionValueSegment(self):
            return self.getTypedRuleContext(apt_sourceParser.OptionValueSegmentContext,0)


        def OptionNameValueSeparator(self):
            return self.getToken(apt_sourceParser.OptionNameValueSeparator, 0)

        def getRuleIndex(self):
            return apt_sourceParser.RULE_nonSquareBracketStringSegment

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

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




    def nonSquareBracketStringSegment(self):

        localctx = apt_sourceParser.NonSquareBracketStringSegmentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_nonSquareBracketStringSegment)
        try:
            self.state = 148
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [apt_sourceParser.NonWhitespaceNonOptionValueNonSquareRightBracketNonEq]:
                self.enterOuterAlt(localctx, 1)
                self.state = 145
                self.match(apt_sourceParser.NonWhitespaceNonOptionValueNonSquareRightBracketNonEq)
                pass
            elif token in [apt_sourceParser.TypeR, apt_sourceParser.OptionName, apt_sourceParser.CdromSchema, apt_sourceParser.Word, apt_sourceParser.PunctuationAllowedInOptionValue, apt_sourceParser.Plus, apt_sourceParser.Colon, apt_sourceParser.Dash]:
                self.enterOuterAlt(localctx, 2)
                self.state = 146
                self.optionValueSegment()
                pass
            elif token in [apt_sourceParser.OptionNameValueSeparator]:
                self.enterOuterAlt(localctx, 3)
                self.state = 147
                self.match(apt_sourceParser.OptionNameValueSeparator)
                pass
            else:
                raise NoViableAltException(self)

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


    class NonSquareBracketStringContext(ParserRuleContext):

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

        def nonSquareBracketStringSegment(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(apt_sourceParser.NonSquareBracketStringSegmentContext)
            else:
                return self.getTypedRuleContext(apt_sourceParser.NonSquareBracketStringSegmentContext,i)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_nonSquareBracketString

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

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




    def nonSquareBracketString(self):

        localctx = apt_sourceParser.NonSquareBracketStringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_nonSquareBracketString)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 151 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 150
                self.nonSquareBracketStringSegment()
                self.state = 153 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << apt_sourceParser.TypeR) | (1 << apt_sourceParser.OptionName) | (1 << apt_sourceParser.CdromSchema) | (1 << apt_sourceParser.Word) | (1 << apt_sourceParser.PunctuationAllowedInOptionValue) | (1 << apt_sourceParser.OptionNameValueSeparator) | (1 << apt_sourceParser.Plus) | (1 << apt_sourceParser.Colon) | (1 << apt_sourceParser.Dash) | (1 << apt_sourceParser.NonWhitespaceNonOptionValueNonSquareRightBracketNonEq))) != 0)):
                    break

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


    class NonSpaceStringSegmentContext(ParserRuleContext):

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

        def nonSquareBracketStringSegment(self):
            return self.getTypedRuleContext(apt_sourceParser.NonSquareBracketStringSegmentContext,0)


        def OptionsEnd(self):
            return self.getToken(apt_sourceParser.OptionsEnd, 0)

        def getRuleIndex(self):
            return apt_sourceParser.RULE_nonSpaceStringSegment

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

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




    def nonSpaceStringSegment(self):

        localctx = apt_sourceParser.NonSpaceStringSegmentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_nonSpaceStringSegment)
        try:
            self.state = 157
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [apt_sourceParser.TypeR, apt_sourceParser.OptionName, apt_sourceParser.CdromSchema, apt_sourceParser.Word, apt_sourceParser.PunctuationAllowedInOptionValue, apt_sourceParser.OptionNameValueSeparator, apt_sourceParser.Plus, apt_sourceParser.Colon, apt_sourceParser.Dash, apt_sourceParser.NonWhitespaceNonOptionValueNonSquareRightBracketNonEq]:
                self.enterOuterAlt(localctx, 1)
                self.state = 155
                self.nonSquareBracketStringSegment()
                pass
            elif token in [apt_sourceParser.OptionsEnd]:
                self.enterOuterAlt(localctx, 2)
                self.state = 156
                self.match(apt_sourceParser.OptionsEnd)
                pass
            else:
                raise NoViableAltException(self)

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


    class NonSpaceStringContext(ParserRuleContext):

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

        def nonSpaceStringSegment(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(apt_sourceParser.NonSpaceStringSegmentContext)
            else:
                return self.getTypedRuleContext(apt_sourceParser.NonSpaceStringSegmentContext,i)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_nonSpaceString

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

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




    def nonSpaceString(self):

        localctx = apt_sourceParser.NonSpaceStringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_nonSpaceString)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 160 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 159
                self.nonSpaceStringSegment()
                self.state = 162 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << apt_sourceParser.TypeR) | (1 << apt_sourceParser.OptionName) | (1 << apt_sourceParser.CdromSchema) | (1 << apt_sourceParser.Word) | (1 << apt_sourceParser.PunctuationAllowedInOptionValue) | (1 << apt_sourceParser.OptionsEnd) | (1 << apt_sourceParser.OptionNameValueSeparator) | (1 << apt_sourceParser.Plus) | (1 << apt_sourceParser.Colon) | (1 << apt_sourceParser.Dash) | (1 << apt_sourceParser.NonWhitespaceNonOptionValueNonSquareRightBracketNonEq))) != 0)):
                    break

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


    class OptionValueSegmentContext(ParserRuleContext):

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

        def Word(self):
            return self.getToken(apt_sourceParser.Word, 0)

        def PunctuationAllowedInOptionValue(self):
            return self.getToken(apt_sourceParser.PunctuationAllowedInOptionValue, 0)

        def Dash(self):
            return self.getToken(apt_sourceParser.Dash, 0)

        def OptionName(self):
            return self.getToken(apt_sourceParser.OptionName, 0)

        def CdromSchema(self):
            return self.getToken(apt_sourceParser.CdromSchema, 0)

        def TypeR(self):
            return self.getToken(apt_sourceParser.TypeR, 0)

        def Plus(self):
            return self.getToken(apt_sourceParser.Plus, 0)

        def Colon(self):
            return self.getToken(apt_sourceParser.Colon, 0)

        def getRuleIndex(self):
            return apt_sourceParser.RULE_optionValueSegment

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

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




    def optionValueSegment(self):

        localctx = apt_sourceParser.OptionValueSegmentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_optionValueSegment)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 164
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << apt_sourceParser.TypeR) | (1 << apt_sourceParser.OptionName) | (1 << apt_sourceParser.CdromSchema) | (1 << apt_sourceParser.Word) | (1 << apt_sourceParser.PunctuationAllowedInOptionValue) | (1 << apt_sourceParser.Plus) | (1 << apt_sourceParser.Colon) | (1 << apt_sourceParser.Dash))) != 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 OptionValueContext(ParserRuleContext):

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

        def optionValueSegment(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(apt_sourceParser.OptionValueSegmentContext)
            else:
                return self.getTypedRuleContext(apt_sourceParser.OptionValueSegmentContext,i)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_optionValue

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

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




    def optionValue(self):

        localctx = apt_sourceParser.OptionValueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_optionValue)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 167 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 166
                self.optionValueSegment()
                self.state = 169 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << apt_sourceParser.TypeR) | (1 << apt_sourceParser.OptionName) | (1 << apt_sourceParser.CdromSchema) | (1 << apt_sourceParser.Word) | (1 << apt_sourceParser.PunctuationAllowedInOptionValue) | (1 << apt_sourceParser.Plus) | (1 << apt_sourceParser.Colon) | (1 << apt_sourceParser.Dash))) != 0)):
                    break

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


    class UriSchemaContext(ParserRuleContext):

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

        def Word(self):
            return self.getToken(apt_sourceParser.Word, 0)

        def rest_words_with_delF(self):
            return self.getTypedRuleContext(apt_sourceParser.Rest_words_with_delFContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_uriSchema

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

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




    def uriSchema(self):

        localctx = apt_sourceParser.UriSchemaContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_uriSchema)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 171
            localctx.first_word = self.match(apt_sourceParser.Word)
            self.state = 172
            localctx.rest_words_with_del = self.rest_words_with_delF()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GenericURIContext(ParserRuleContext):

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

        def uriSchema(self):
            return self.getTypedRuleContext(apt_sourceParser.UriSchemaContext,0)


        def Colon(self):
            return self.getToken(apt_sourceParser.Colon, 0)

        def nonSpaceString(self):
            return self.getTypedRuleContext(apt_sourceParser.NonSpaceStringContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_genericURI

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

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




    def genericURI(self):

        localctx = apt_sourceParser.GenericURIContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_genericURI)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 174
            self.uriSchema()
            self.state = 175
            self.match(apt_sourceParser.Colon)
            self.state = 176
            self.nonSpaceString()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class UriRContext(ParserRuleContext):

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

        def cdromURI(self):
            return self.getTypedRuleContext(apt_sourceParser.CdromURIContext,0)


        def genericURI(self):
            return self.getTypedRuleContext(apt_sourceParser.GenericURIContext,0)


        def getRuleIndex(self):
            return apt_sourceParser.RULE_uriR

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

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




    def uriR(self):

        localctx = apt_sourceParser.UriRContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_uriR)
        try:
            self.state = 180
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [apt_sourceParser.CdromSchema]:
                self.enterOuterAlt(localctx, 1)
                self.state = 178
                self.cdromURI()
                pass
            elif token in [apt_sourceParser.Word]:
                self.enterOuterAlt(localctx, 2)
                self.state = 179
                self.genericURI()
                pass
            else:
                raise NoViableAltException(self)

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





