# Generated from Glycan.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\23")
        buf.write("\u00d1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\3\2\3\2\3\2\3\2")
        buf.write("\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3")
        buf.write("\2\3\2\3\2\3\2\3\2\5\2!\n\2\3\3\3\3\3\3\3\3\3\3\3\3\3")
        buf.write("\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3")
        buf.write("\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3")
        buf.write("\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3L\n\3\3\4\3\4\3\4\3")
        buf.write("\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\5\4Y\n\4\3\5\6\5\\\n\5")
        buf.write("\r\5\16\5]\3\5\3\5\3\5\7\5c\n\5\f\5\16\5f\13\5\3\5\6\5")
        buf.write("i\n\5\r\5\16\5j\3\5\3\5\7\5o\n\5\f\5\16\5r\13\5\3\5\6")
        buf.write("\5u\n\5\r\5\16\5v\3\5\3\5\7\5{\n\5\f\5\16\5~\13\5\3\5")
        buf.write("\6\5\u0081\n\5\r\5\16\5\u0082\3\5\7\5\u0086\n\5\f\5\16")
        buf.write("\5\u0089\13\5\3\5\6\5\u008c\n\5\r\5\16\5\u008d\3\5\6\5")
        buf.write("\u0091\n\5\r\5\16\5\u0092\3\5\3\5\3\5\7\5\u0098\n\5\f")
        buf.write("\5\16\5\u009b\13\5\3\5\6\5\u009e\n\5\r\5\16\5\u009f\3")
        buf.write("\5\6\5\u00a3\n\5\r\5\16\5\u00a4\3\5\3\5\7\5\u00a9\n\5")
        buf.write("\f\5\16\5\u00ac\13\5\3\5\6\5\u00af\n\5\r\5\16\5\u00b0")
        buf.write("\3\5\6\5\u00b4\n\5\r\5\16\5\u00b5\3\5\3\5\7\5\u00ba\n")
        buf.write("\5\f\5\16\5\u00bd\13\5\3\5\6\5\u00c0\n\5\r\5\16\5\u00c1")
        buf.write("\3\5\6\5\u00c5\n\5\r\5\16\5\u00c6\3\5\7\5\u00ca\n\5\f")
        buf.write("\5\16\5\u00cd\13\5\5\5\u00cf\n\5\3\5\2\2\6\2\4\6\b\2\2")
        buf.write("\2\u00f2\2 \3\2\2\2\4K\3\2\2\2\6X\3\2\2\2\b\u00ce\3\2")
        buf.write("\2\2\n\13\7\3\2\2\13\f\5\4\3\2\f\r\5\6\4\2\r\16\7\4\2")
        buf.write("\2\16\17\7\17\2\2\17\20\7\5\2\2\20!\3\2\2\2\21\22\7\3")
        buf.write("\2\2\22\23\5\4\3\2\23\24\5\6\4\2\24\25\7\5\2\2\25!\3\2")
        buf.write("\2\2\26\27\7\3\2\2\27\30\5\6\4\2\30\31\7\4\2\2\31\32\7")
        buf.write("\17\2\2\32\33\7\5\2\2\33!\3\2\2\2\34\35\7\3\2\2\35\36")
        buf.write("\5\6\4\2\36\37\7\5\2\2\37!\3\2\2\2 \n\3\2\2\2 \21\3\2")
        buf.write("\2\2 \26\3\2\2\2 \34\3\2\2\2!\3\3\2\2\2\"#\5\6\4\2#$\7")
        buf.write("\16\2\2$L\3\2\2\2%&\5\6\4\2&\'\7\16\2\2\'(\5\4\3\2(L\3")
        buf.write("\2\2\2)*\7\6\2\2*+\5\4\3\2+,\7\7\2\2,L\3\2\2\2-.\5\6\4")
        buf.write("\2./\7\16\2\2/\60\7\6\2\2\60\61\5\4\3\2\61\62\7\7\2\2")
        buf.write("\62\63\5\4\3\2\63L\3\2\2\2\64\65\5\6\4\2\65\66\7\16\2")
        buf.write("\2\66\67\7\6\2\2\678\5\4\3\289\7\7\2\29:\7\6\2\2:;\5\4")
        buf.write("\3\2;<\7\7\2\2<=\5\4\3\2=L\3\2\2\2>?\5\6\4\2?@\7\16\2")
        buf.write("\2@A\7\6\2\2AB\5\4\3\2BC\7\7\2\2CD\7\6\2\2DE\5\4\3\2E")
        buf.write("F\7\7\2\2FG\7\6\2\2GH\5\4\3\2HI\7\7\2\2IJ\5\4\3\2JL\3")
        buf.write("\2\2\2K\"\3\2\2\2K%\3\2\2\2K)\3\2\2\2K-\3\2\2\2K\64\3")
        buf.write("\2\2\2K>\3\2\2\2L\5\3\2\2\2MN\5\b\5\2NO\7\21\2\2OP\7\17")
        buf.write("\2\2PY\3\2\2\2QR\5\b\5\2RS\7\17\2\2SY\3\2\2\2TU\5\b\5")
        buf.write("\2UV\7\21\2\2VY\3\2\2\2WY\5\b\5\2XM\3\2\2\2XQ\3\2\2\2")
        buf.write("XT\3\2\2\2XW\3\2\2\2Y\7\3\2\2\2Z\\\7\b\2\2[Z\3\2\2\2\\")
        buf.write("]\3\2\2\2][\3\2\2\2]^\3\2\2\2^_\3\2\2\2_`\7\21\2\2`d\7")
        buf.write("\17\2\2ac\7\t\2\2ba\3\2\2\2cf\3\2\2\2db\3\2\2\2de\3\2")
        buf.write("\2\2e\u00cf\3\2\2\2fd\3\2\2\2gi\7\b\2\2hg\3\2\2\2ij\3")
        buf.write("\2\2\2jh\3\2\2\2jk\3\2\2\2kl\3\2\2\2lp\7\17\2\2mo\7\t")
        buf.write("\2\2nm\3\2\2\2or\3\2\2\2pn\3\2\2\2pq\3\2\2\2q\u00cf\3")
        buf.write("\2\2\2rp\3\2\2\2su\7\b\2\2ts\3\2\2\2uv\3\2\2\2vt\3\2\2")
        buf.write("\2vw\3\2\2\2wx\3\2\2\2x|\7\21\2\2y{\7\t\2\2zy\3\2\2\2")
        buf.write("{~\3\2\2\2|z\3\2\2\2|}\3\2\2\2}\u00cf\3\2\2\2~|\3\2\2")
        buf.write("\2\177\u0081\7\b\2\2\u0080\177\3\2\2\2\u0081\u0082\3\2")
        buf.write("\2\2\u0082\u0080\3\2\2\2\u0082\u0083\3\2\2\2\u0083\u0087")
        buf.write("\3\2\2\2\u0084\u0086\7\t\2\2\u0085\u0084\3\2\2\2\u0086")
        buf.write("\u0089\3\2\2\2\u0087\u0085\3\2\2\2\u0087\u0088\3\2\2\2")
        buf.write("\u0088\u00cf\3\2\2\2\u0089\u0087\3\2\2\2\u008a\u008c\7")
        buf.write("\t\2\2\u008b\u008a\3\2\2\2\u008c\u008d\3\2\2\2\u008d\u008b")
        buf.write("\3\2\2\2\u008d\u008e\3\2\2\2\u008e\u0090\3\2\2\2\u008f")
        buf.write("\u0091\7\b\2\2\u0090\u008f\3\2\2\2\u0091\u0092\3\2\2\2")
        buf.write("\u0092\u0090\3\2\2\2\u0092\u0093\3\2\2\2\u0093\u0094\3")
        buf.write("\2\2\2\u0094\u0095\7\21\2\2\u0095\u0099\7\17\2\2\u0096")
        buf.write("\u0098\7\t\2\2\u0097\u0096\3\2\2\2\u0098\u009b\3\2\2\2")
        buf.write("\u0099\u0097\3\2\2\2\u0099\u009a\3\2\2\2\u009a\u00cf\3")
        buf.write("\2\2\2\u009b\u0099\3\2\2\2\u009c\u009e\7\t\2\2\u009d\u009c")
        buf.write("\3\2\2\2\u009e\u009f\3\2\2\2\u009f\u009d\3\2\2\2\u009f")
        buf.write("\u00a0\3\2\2\2\u00a0\u00a2\3\2\2\2\u00a1\u00a3\7\b\2\2")
        buf.write("\u00a2\u00a1\3\2\2\2\u00a3\u00a4\3\2\2\2\u00a4\u00a2\3")
        buf.write("\2\2\2\u00a4\u00a5\3\2\2\2\u00a5\u00a6\3\2\2\2\u00a6\u00aa")
        buf.write("\7\17\2\2\u00a7\u00a9\7\t\2\2\u00a8\u00a7\3\2\2\2\u00a9")
        buf.write("\u00ac\3\2\2\2\u00aa\u00a8\3\2\2\2\u00aa\u00ab\3\2\2\2")
        buf.write("\u00ab\u00cf\3\2\2\2\u00ac\u00aa\3\2\2\2\u00ad\u00af\7")
        buf.write("\t\2\2\u00ae\u00ad\3\2\2\2\u00af\u00b0\3\2\2\2\u00b0\u00ae")
        buf.write("\3\2\2\2\u00b0\u00b1\3\2\2\2\u00b1\u00b3\3\2\2\2\u00b2")
        buf.write("\u00b4\7\b\2\2\u00b3\u00b2\3\2\2\2\u00b4\u00b5\3\2\2\2")
        buf.write("\u00b5\u00b3\3\2\2\2\u00b5\u00b6\3\2\2\2\u00b6\u00b7\3")
        buf.write("\2\2\2\u00b7\u00bb\7\21\2\2\u00b8\u00ba\7\t\2\2\u00b9")
        buf.write("\u00b8\3\2\2\2\u00ba\u00bd\3\2\2\2\u00bb\u00b9\3\2\2\2")
        buf.write("\u00bb\u00bc\3\2\2\2\u00bc\u00cf\3\2\2\2\u00bd\u00bb\3")
        buf.write("\2\2\2\u00be\u00c0\7\t\2\2\u00bf\u00be\3\2\2\2\u00c0\u00c1")
        buf.write("\3\2\2\2\u00c1\u00bf\3\2\2\2\u00c1\u00c2\3\2\2\2\u00c2")
        buf.write("\u00c4\3\2\2\2\u00c3\u00c5\7\b\2\2\u00c4\u00c3\3\2\2\2")
        buf.write("\u00c5\u00c6\3\2\2\2\u00c6\u00c4\3\2\2\2\u00c6\u00c7\3")
        buf.write("\2\2\2\u00c7\u00cb\3\2\2\2\u00c8\u00ca\7\t\2\2\u00c9\u00c8")
        buf.write("\3\2\2\2\u00ca\u00cd\3\2\2\2\u00cb\u00c9\3\2\2\2\u00cb")
        buf.write("\u00cc\3\2\2\2\u00cc\u00cf\3\2\2\2\u00cd\u00cb\3\2\2\2")
        buf.write("\u00ce[\3\2\2\2\u00ceh\3\2\2\2\u00cet\3\2\2\2\u00ce\u0080")
        buf.write("\3\2\2\2\u00ce\u008b\3\2\2\2\u00ce\u009d\3\2\2\2\u00ce")
        buf.write("\u00ae\3\2\2\2\u00ce\u00bf\3\2\2\2\u00cf\t\3\2\2\2\32")
        buf.write(" KX]djpv|\u0082\u0087\u008d\u0092\u0099\u009f\u00a4\u00aa")
        buf.write("\u00b0\u00b5\u00bb\u00c1\u00c6\u00cb\u00ce")
        return buf.getvalue()


class GlycanParser ( Parser ):

    grammarFileName = "Glycan.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'{'", "' '", "'}'", "'['", "']'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "SAC", "MOD", "FG", "BRIDGE", 
                      "CARB", "COUNT", "CON", "TYPE", "CT", "RING", "NUM", 
                      "DIGIT" ]

    RULE_start = 0
    RULE_branch = 1
    RULE_glycan = 2
    RULE_deriv = 3

    ruleNames =  [ "start", "branch", "glycan", "deriv" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    SAC=6
    MOD=7
    FG=8
    BRIDGE=9
    CARB=10
    COUNT=11
    CON=12
    TYPE=13
    CT=14
    RING=15
    NUM=16
    DIGIT=17

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

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

        def branch(self):
            return self.getTypedRuleContext(GlycanParser.BranchContext,0)


        def glycan(self):
            return self.getTypedRuleContext(GlycanParser.GlycanContext,0)


        def TYPE(self):
            return self.getToken(GlycanParser.TYPE, 0)

        def getRuleIndex(self):
            return GlycanParser.RULE_start

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

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




    def start(self):

        localctx = GlycanParser.StartContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_start)
        try:
            self.state = 30
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,0,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 8
                self.match(GlycanParser.T__0)
                self.state = 9
                self.branch()
                self.state = 10
                self.glycan()
                self.state = 11
                self.match(GlycanParser.T__1)
                self.state = 12
                self.match(GlycanParser.TYPE)
                self.state = 13
                self.match(GlycanParser.T__2)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 15
                self.match(GlycanParser.T__0)
                self.state = 16
                self.branch()
                self.state = 17
                self.glycan()
                self.state = 18
                self.match(GlycanParser.T__2)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 20
                self.match(GlycanParser.T__0)
                self.state = 21
                self.glycan()
                self.state = 22
                self.match(GlycanParser.T__1)
                self.state = 23
                self.match(GlycanParser.TYPE)
                self.state = 24
                self.match(GlycanParser.T__2)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 26
                self.match(GlycanParser.T__0)
                self.state = 27
                self.glycan()
                self.state = 28
                self.match(GlycanParser.T__2)
                pass


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


    class BranchContext(ParserRuleContext):

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

        def glycan(self):
            return self.getTypedRuleContext(GlycanParser.GlycanContext,0)


        def CON(self):
            return self.getToken(GlycanParser.CON, 0)

        def branch(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(GlycanParser.BranchContext)
            else:
                return self.getTypedRuleContext(GlycanParser.BranchContext,i)


        def getRuleIndex(self):
            return GlycanParser.RULE_branch

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

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




    def branch(self):

        localctx = GlycanParser.BranchContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_branch)
        try:
            self.state = 73
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 32
                self.glycan()
                self.state = 33
                self.match(GlycanParser.CON)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 35
                self.glycan()
                self.state = 36
                self.match(GlycanParser.CON)
                self.state = 37
                self.branch()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 39
                self.match(GlycanParser.T__3)
                self.state = 40
                self.branch()
                self.state = 41
                self.match(GlycanParser.T__4)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 43
                self.glycan()
                self.state = 44
                self.match(GlycanParser.CON)
                self.state = 45
                self.match(GlycanParser.T__3)
                self.state = 46
                self.branch()
                self.state = 47
                self.match(GlycanParser.T__4)
                self.state = 48
                self.branch()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 50
                self.glycan()
                self.state = 51
                self.match(GlycanParser.CON)
                self.state = 52
                self.match(GlycanParser.T__3)
                self.state = 53
                self.branch()
                self.state = 54
                self.match(GlycanParser.T__4)
                self.state = 55
                self.match(GlycanParser.T__3)
                self.state = 56
                self.branch()
                self.state = 57
                self.match(GlycanParser.T__4)
                self.state = 58
                self.branch()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 60
                self.glycan()
                self.state = 61
                self.match(GlycanParser.CON)
                self.state = 62
                self.match(GlycanParser.T__3)
                self.state = 63
                self.branch()
                self.state = 64
                self.match(GlycanParser.T__4)
                self.state = 65
                self.match(GlycanParser.T__3)
                self.state = 66
                self.branch()
                self.state = 67
                self.match(GlycanParser.T__4)
                self.state = 68
                self.match(GlycanParser.T__3)
                self.state = 69
                self.branch()
                self.state = 70
                self.match(GlycanParser.T__4)
                self.state = 71
                self.branch()
                pass


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


    class GlycanContext(ParserRuleContext):

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

        def deriv(self):
            return self.getTypedRuleContext(GlycanParser.DerivContext,0)


        def RING(self):
            return self.getToken(GlycanParser.RING, 0)

        def TYPE(self):
            return self.getToken(GlycanParser.TYPE, 0)

        def getRuleIndex(self):
            return GlycanParser.RULE_glycan

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

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




    def glycan(self):

        localctx = GlycanParser.GlycanContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_glycan)
        try:
            self.state = 86
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,2,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 75
                self.deriv()
                self.state = 76
                self.match(GlycanParser.RING)
                self.state = 77
                self.match(GlycanParser.TYPE)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 79
                self.deriv()
                self.state = 80
                self.match(GlycanParser.TYPE)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 82
                self.deriv()
                self.state = 83
                self.match(GlycanParser.RING)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 85
                self.deriv()
                pass


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


    class DerivContext(ParserRuleContext):

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

        def RING(self):
            return self.getToken(GlycanParser.RING, 0)

        def TYPE(self):
            return self.getToken(GlycanParser.TYPE, 0)

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

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

        def getRuleIndex(self):
            return GlycanParser.RULE_deriv

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

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




    def deriv(self):

        localctx = GlycanParser.DerivContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_deriv)
        self._la = 0 # Token type
        try:
            self.state = 204
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,23,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 89 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 88
                    self.match(GlycanParser.SAC)
                    self.state = 91 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.SAC):
                        break

                self.state = 93
                self.match(GlycanParser.RING)
                self.state = 94
                self.match(GlycanParser.TYPE)
                self.state = 98
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlycanParser.MOD:
                    self.state = 95
                    self.match(GlycanParser.MOD)
                    self.state = 100
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 102 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 101
                    self.match(GlycanParser.SAC)
                    self.state = 104 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.SAC):
                        break

                self.state = 106
                self.match(GlycanParser.TYPE)
                self.state = 110
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlycanParser.MOD:
                    self.state = 107
                    self.match(GlycanParser.MOD)
                    self.state = 112
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 114 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 113
                    self.match(GlycanParser.SAC)
                    self.state = 116 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.SAC):
                        break

                self.state = 118
                self.match(GlycanParser.RING)
                self.state = 122
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlycanParser.MOD:
                    self.state = 119
                    self.match(GlycanParser.MOD)
                    self.state = 124
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 126 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 125
                    self.match(GlycanParser.SAC)
                    self.state = 128 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.SAC):
                        break

                self.state = 133
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlycanParser.MOD:
                    self.state = 130
                    self.match(GlycanParser.MOD)
                    self.state = 135
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 137 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 136
                    self.match(GlycanParser.MOD)
                    self.state = 139 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.MOD):
                        break

                self.state = 142 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 141
                    self.match(GlycanParser.SAC)
                    self.state = 144 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.SAC):
                        break

                self.state = 146
                self.match(GlycanParser.RING)
                self.state = 147
                self.match(GlycanParser.TYPE)
                self.state = 151
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlycanParser.MOD:
                    self.state = 148
                    self.match(GlycanParser.MOD)
                    self.state = 153
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 155 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 154
                    self.match(GlycanParser.MOD)
                    self.state = 157 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.MOD):
                        break

                self.state = 160 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 159
                    self.match(GlycanParser.SAC)
                    self.state = 162 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.SAC):
                        break

                self.state = 164
                self.match(GlycanParser.TYPE)
                self.state = 168
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlycanParser.MOD:
                    self.state = 165
                    self.match(GlycanParser.MOD)
                    self.state = 170
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 172 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 171
                    self.match(GlycanParser.MOD)
                    self.state = 174 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.MOD):
                        break

                self.state = 177 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 176
                    self.match(GlycanParser.SAC)
                    self.state = 179 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.SAC):
                        break

                self.state = 181
                self.match(GlycanParser.RING)
                self.state = 185
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlycanParser.MOD:
                    self.state = 182
                    self.match(GlycanParser.MOD)
                    self.state = 187
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass

            elif la_ == 8:
                self.enterOuterAlt(localctx, 8)
                self.state = 189 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 188
                    self.match(GlycanParser.MOD)
                    self.state = 191 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.MOD):
                        break

                self.state = 194 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 193
                    self.match(GlycanParser.SAC)
                    self.state = 196 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==GlycanParser.SAC):
                        break

                self.state = 201
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==GlycanParser.MOD:
                    self.state = 198
                    self.match(GlycanParser.MOD)
                    self.state = 203
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass


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





