# Generated from WURCS.g4 by ANTLR 4.13.2
# 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():
    return [
        4,1,49,137,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,
        6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,1,0,1,0,1,0,1,0,1,
        0,5,0,30,8,0,10,0,12,0,33,9,0,1,0,1,0,1,0,1,0,3,0,39,8,0,1,1,1,1,
        1,1,5,1,44,8,1,10,1,12,1,47,9,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
        1,2,5,2,58,8,2,10,2,12,2,61,9,2,1,2,1,2,3,2,65,8,2,1,2,1,2,5,2,69,
        8,2,10,2,12,2,72,9,2,1,2,1,2,1,3,1,3,1,3,5,3,79,8,3,10,3,12,3,82,
        9,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,
        1,5,1,5,1,5,1,5,3,5,103,8,5,1,6,5,6,106,8,6,10,6,12,6,109,9,6,1,
        6,1,6,1,6,1,6,1,6,5,6,116,8,6,10,6,12,6,119,9,6,1,7,1,7,1,8,1,8,
        1,8,1,9,1,9,1,10,1,10,1,11,1,11,5,11,132,8,11,10,11,12,11,135,9,
        11,1,11,0,0,12,0,2,4,6,8,10,12,14,16,18,20,22,0,4,1,0,6,9,1,0,31,
        32,2,0,31,32,42,42,1,0,17,18,143,0,24,1,0,0,0,2,40,1,0,0,0,4,48,
        1,0,0,0,6,75,1,0,0,0,8,83,1,0,0,0,10,102,1,0,0,0,12,107,1,0,0,0,
        14,120,1,0,0,0,16,122,1,0,0,0,18,125,1,0,0,0,20,127,1,0,0,0,22,129,
        1,0,0,0,24,25,5,1,0,0,25,26,5,2,0,0,26,27,3,2,1,0,27,31,5,2,0,0,
        28,30,3,4,2,0,29,28,1,0,0,0,30,33,1,0,0,0,31,29,1,0,0,0,31,32,1,
        0,0,0,32,34,1,0,0,0,33,31,1,0,0,0,34,35,5,2,0,0,35,36,3,6,3,0,36,
        38,5,2,0,0,37,39,3,8,4,0,38,37,1,0,0,0,38,39,1,0,0,0,39,1,1,0,0,
        0,40,45,3,20,10,0,41,42,5,20,0,0,42,44,3,20,10,0,43,41,1,0,0,0,44,
        47,1,0,0,0,45,43,1,0,0,0,45,46,1,0,0,0,46,3,1,0,0,0,47,45,1,0,0,
        0,48,59,5,26,0,0,49,58,5,31,0,0,50,58,5,34,0,0,51,58,5,36,0,0,52,
        58,5,37,0,0,53,58,5,40,0,0,54,58,5,41,0,0,55,58,5,42,0,0,56,58,3,
        20,10,0,57,49,1,0,0,0,57,50,1,0,0,0,57,51,1,0,0,0,57,52,1,0,0,0,
        57,53,1,0,0,0,57,54,1,0,0,0,57,55,1,0,0,0,57,56,1,0,0,0,58,61,1,
        0,0,0,59,57,1,0,0,0,59,60,1,0,0,0,60,64,1,0,0,0,61,59,1,0,0,0,62,
        63,5,23,0,0,63,65,3,10,5,0,64,62,1,0,0,0,64,65,1,0,0,0,65,70,1,0,
        0,0,66,67,5,44,0,0,67,69,3,10,5,0,68,66,1,0,0,0,69,72,1,0,0,0,70,
        68,1,0,0,0,70,71,1,0,0,0,71,73,1,0,0,0,72,70,1,0,0,0,73,74,5,27,
        0,0,74,5,1,0,0,0,75,80,3,22,11,0,76,77,5,23,0,0,77,79,3,22,11,0,
        78,76,1,0,0,0,79,82,1,0,0,0,80,78,1,0,0,0,80,81,1,0,0,0,81,7,1,0,
        0,0,82,80,1,0,0,0,83,84,3,16,8,0,84,85,5,23,0,0,85,86,3,16,8,0,86,
        87,5,44,0,0,87,88,3,16,8,0,88,89,5,23,0,0,89,90,3,16,8,0,90,9,1,
        0,0,0,91,92,3,22,11,0,92,93,3,18,9,0,93,103,1,0,0,0,94,95,3,22,11,
        0,95,96,5,23,0,0,96,97,3,22,11,0,97,103,1,0,0,0,98,99,3,22,11,0,
        99,100,5,48,0,0,100,101,3,12,6,0,101,103,1,0,0,0,102,91,1,0,0,0,
        102,94,1,0,0,0,102,98,1,0,0,0,103,11,1,0,0,0,104,106,3,14,7,0,105,
        104,1,0,0,0,106,109,1,0,0,0,107,105,1,0,0,0,107,108,1,0,0,0,108,
        117,1,0,0,0,109,107,1,0,0,0,110,111,5,2,0,0,111,112,3,22,11,0,112,
        113,5,43,0,0,113,114,3,14,7,0,114,116,1,0,0,0,115,110,1,0,0,0,116,
        119,1,0,0,0,117,115,1,0,0,0,117,118,1,0,0,0,118,13,1,0,0,0,119,117,
        1,0,0,0,120,121,7,0,0,0,121,15,1,0,0,0,122,123,7,1,0,0,123,124,3,
        22,11,0,124,17,1,0,0,0,125,126,7,2,0,0,126,19,1,0,0,0,127,128,7,
        3,0,0,128,21,1,0,0,0,129,133,5,17,0,0,130,132,3,20,10,0,131,130,
        1,0,0,0,132,135,1,0,0,0,133,131,1,0,0,0,133,134,1,0,0,0,134,23,1,
        0,0,0,135,133,1,0,0,0,12,31,38,45,57,59,64,70,80,102,107,117,133
    ]

class WURCSParser ( Parser ):

    grammarFileName = "WURCS.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'WURCS=2.0'", "'/'", "'freeEnd'", "'redEnd'", 
                     "<INVALID>", "'C'", "'N'", "'O'", "<INVALID>", "'Anhydro'", 
                     "'0d'", "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "'0'", "'@'", "','", "';'", 
                     "'--'", "'-'", "'('", "')'", "'['", "']'", "'{'", "'}'", 
                     "'ai'", "'a'", "'b'", "'c'", "'d'", "'e'", "'h'", "'m'", 
                     "'t'", "'i'", "'u'", "'U'", "'x'", "'='", "'_'", "'$'", 
                     "'#'", "' '", "'*'", "'?'" ]

    symbolicNames = [ "<INVALID>", "WURCS_HEAD", "FSLASH", "FREEEND", "REDEND", 
                      "SAC", "CARBON", "NITROGEN", "OXYGEN", "FG", "ANHYDRO", 
                      "HEAD", "HEADD", "END", "COUNT", "TYPE", "RING", "DIGIT", 
                      "ZERO", "AT", "COMMA", "SEMICOLON", "DOUBLEDASH", 
                      "DASH", "LPAR", "RPAR", "LBRACE", "RBRACE", "LBRACK", 
                      "RBRACK", "AI", "A", "B", "C", "D", "E", "H", "M", 
                      "T", "I", "U", "UU", "X", "EQ", "UNDERSCORE", "DOLLAR", 
                      "HASH", "SPACE", "ASTERISK", "QMARK" ]

    RULE_start = 0
    RULE_whatever = 1
    RULE_mono = 2
    RULE_order = 3
    RULE_tree = 4
    RULE_specs = 5
    RULE_sidechain = 6
    RULE_organics = 7
    RULE_pos = 8
    RULE_orient = 9
    RULE_single_num = 10
    RULE_num = 11

    ruleNames =  [ "start", "whatever", "mono", "order", "tree", "specs", 
                   "sidechain", "organics", "pos", "orient", "single_num", 
                   "num" ]

    EOF = Token.EOF
    WURCS_HEAD=1
    FSLASH=2
    FREEEND=3
    REDEND=4
    SAC=5
    CARBON=6
    NITROGEN=7
    OXYGEN=8
    FG=9
    ANHYDRO=10
    HEAD=11
    HEADD=12
    END=13
    COUNT=14
    TYPE=15
    RING=16
    DIGIT=17
    ZERO=18
    AT=19
    COMMA=20
    SEMICOLON=21
    DOUBLEDASH=22
    DASH=23
    LPAR=24
    RPAR=25
    LBRACE=26
    RBRACE=27
    LBRACK=28
    RBRACK=29
    AI=30
    A=31
    B=32
    C=33
    D=34
    E=35
    H=36
    M=37
    T=38
    I=39
    U=40
    UU=41
    X=42
    EQ=43
    UNDERSCORE=44
    DOLLAR=45
    HASH=46
    SPACE=47
    ASTERISK=48
    QMARK=49

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




    class StartContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def WURCS_HEAD(self):
            return self.getToken(WURCSParser.WURCS_HEAD, 0)

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

        def whatever(self):
            return self.getTypedRuleContext(WURCSParser.WhateverContext,0)


        def order(self):
            return self.getTypedRuleContext(WURCSParser.OrderContext,0)


        def mono(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(WURCSParser.MonoContext)
            else:
                return self.getTypedRuleContext(WURCSParser.MonoContext,i)


        def tree(self):
            return self.getTypedRuleContext(WURCSParser.TreeContext,0)


        def getRuleIndex(self):
            return WURCSParser.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 = WURCSParser.StartContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_start)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 24
            self.match(WURCSParser.WURCS_HEAD)
            self.state = 25
            self.match(WURCSParser.FSLASH)
            self.state = 26
            self.whatever()
            self.state = 27
            self.match(WURCSParser.FSLASH)
            self.state = 31
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==26:
                self.state = 28
                self.mono()
                self.state = 33
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 34
            self.match(WURCSParser.FSLASH)
            self.state = 35
            self.order()
            self.state = 36
            self.match(WURCSParser.FSLASH)
            self.state = 38
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==31 or _la==32:
                self.state = 37
                self.tree()


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


    class WhateverContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def single_num(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(WURCSParser.Single_numContext)
            else:
                return self.getTypedRuleContext(WURCSParser.Single_numContext,i)


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

        def getRuleIndex(self):
            return WURCSParser.RULE_whatever

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

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




    def whatever(self):

        localctx = WURCSParser.WhateverContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_whatever)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 40
            self.single_num()
            self.state = 45
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==20:
                self.state = 41
                self.match(WURCSParser.COMMA)
                self.state = 42
                self.single_num()
                self.state = 47
                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 MonoContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def LBRACE(self):
            return self.getToken(WURCSParser.LBRACE, 0)

        def RBRACE(self):
            return self.getToken(WURCSParser.RBRACE, 0)

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

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

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

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

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

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

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

        def single_num(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(WURCSParser.Single_numContext)
            else:
                return self.getTypedRuleContext(WURCSParser.Single_numContext,i)


        def DASH(self):
            return self.getToken(WURCSParser.DASH, 0)

        def specs(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(WURCSParser.SpecsContext)
            else:
                return self.getTypedRuleContext(WURCSParser.SpecsContext,i)


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

        def getRuleIndex(self):
            return WURCSParser.RULE_mono

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

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




    def mono(self):

        localctx = WURCSParser.MonoContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_mono)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 48
            self.match(WURCSParser.LBRACE)
            self.state = 59
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & 7922067570688) != 0):
                self.state = 57
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [31]:
                    self.state = 49
                    self.match(WURCSParser.A)
                    pass
                elif token in [34]:
                    self.state = 50
                    self.match(WURCSParser.D)
                    pass
                elif token in [36]:
                    self.state = 51
                    self.match(WURCSParser.H)
                    pass
                elif token in [37]:
                    self.state = 52
                    self.match(WURCSParser.M)
                    pass
                elif token in [40]:
                    self.state = 53
                    self.match(WURCSParser.U)
                    pass
                elif token in [41]:
                    self.state = 54
                    self.match(WURCSParser.UU)
                    pass
                elif token in [42]:
                    self.state = 55
                    self.match(WURCSParser.X)
                    pass
                elif token in [17, 18]:
                    self.state = 56
                    self.single_num()
                    pass
                else:
                    raise NoViableAltException(self)

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

            self.state = 64
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==23:
                self.state = 62
                self.match(WURCSParser.DASH)
                self.state = 63
                self.specs()


            self.state = 70
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==44:
                self.state = 66
                self.match(WURCSParser.UNDERSCORE)
                self.state = 67
                self.specs()
                self.state = 72
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 73
            self.match(WURCSParser.RBRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class OrderContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def num(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(WURCSParser.NumContext)
            else:
                return self.getTypedRuleContext(WURCSParser.NumContext,i)


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

        def getRuleIndex(self):
            return WURCSParser.RULE_order

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

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




    def order(self):

        localctx = WURCSParser.OrderContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_order)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 75
            self.num()
            self.state = 80
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==23:
                self.state = 76
                self.match(WURCSParser.DASH)
                self.state = 77
                self.num()
                self.state = 82
                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 TreeContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def pos(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(WURCSParser.PosContext)
            else:
                return self.getTypedRuleContext(WURCSParser.PosContext,i)


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

        def UNDERSCORE(self):
            return self.getToken(WURCSParser.UNDERSCORE, 0)

        def getRuleIndex(self):
            return WURCSParser.RULE_tree

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

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




    def tree(self):

        localctx = WURCSParser.TreeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_tree)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 83
            self.pos()
            self.state = 84
            self.match(WURCSParser.DASH)
            self.state = 85
            self.pos()

            self.state = 86
            self.match(WURCSParser.UNDERSCORE)
            self.state = 87
            self.pos()
            self.state = 88
            self.match(WURCSParser.DASH)
            self.state = 89
            self.pos()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SpecsContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def num(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(WURCSParser.NumContext)
            else:
                return self.getTypedRuleContext(WURCSParser.NumContext,i)


        def orient(self):
            return self.getTypedRuleContext(WURCSParser.OrientContext,0)


        def DASH(self):
            return self.getToken(WURCSParser.DASH, 0)

        def ASTERISK(self):
            return self.getToken(WURCSParser.ASTERISK, 0)

        def sidechain(self):
            return self.getTypedRuleContext(WURCSParser.SidechainContext,0)


        def getRuleIndex(self):
            return WURCSParser.RULE_specs

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

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




    def specs(self):

        localctx = WURCSParser.SpecsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_specs)
        try:
            self.state = 102
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,8,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 91
                self.num()
                self.state = 92
                self.orient()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 94
                self.num()
                self.state = 95
                self.match(WURCSParser.DASH)
                self.state = 96
                self.num()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 98
                self.num()
                self.state = 99
                self.match(WURCSParser.ASTERISK)
                self.state = 100
                self.sidechain()
                pass


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


    class SidechainContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def organics(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(WURCSParser.OrganicsContext)
            else:
                return self.getTypedRuleContext(WURCSParser.OrganicsContext,i)


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

        def num(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(WURCSParser.NumContext)
            else:
                return self.getTypedRuleContext(WURCSParser.NumContext,i)


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

        def getRuleIndex(self):
            return WURCSParser.RULE_sidechain

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

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




    def sidechain(self):

        localctx = WURCSParser.SidechainContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_sidechain)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 107
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & 960) != 0):
                self.state = 104
                self.organics()
                self.state = 109
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 117
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==2:
                self.state = 110
                self.match(WURCSParser.FSLASH)
                self.state = 111
                self.num()
                self.state = 112
                self.match(WURCSParser.EQ)
                self.state = 113
                self.organics()
                self.state = 119
                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 OrganicsContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def NITROGEN(self):
            return self.getToken(WURCSParser.NITROGEN, 0)

        def CARBON(self):
            return self.getToken(WURCSParser.CARBON, 0)

        def OXYGEN(self):
            return self.getToken(WURCSParser.OXYGEN, 0)

        def FG(self):
            return self.getToken(WURCSParser.FG, 0)

        def getRuleIndex(self):
            return WURCSParser.RULE_organics

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

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




    def organics(self):

        localctx = WURCSParser.OrganicsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_organics)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 120
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 960) != 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 PosContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def num(self):
            return self.getTypedRuleContext(WURCSParser.NumContext,0)


        def A(self):
            return self.getToken(WURCSParser.A, 0)

        def B(self):
            return self.getToken(WURCSParser.B, 0)

        def getRuleIndex(self):
            return WURCSParser.RULE_pos

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

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




    def pos(self):

        localctx = WURCSParser.PosContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_pos)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 122
            _la = self._input.LA(1)
            if not(_la==31 or _la==32):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 123
            self.num()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class OrientContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def X(self):
            return self.getToken(WURCSParser.X, 0)

        def A(self):
            return self.getToken(WURCSParser.A, 0)

        def B(self):
            return self.getToken(WURCSParser.B, 0)

        def getRuleIndex(self):
            return WURCSParser.RULE_orient

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

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




    def orient(self):

        localctx = WURCSParser.OrientContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_orient)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 125
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 4404488962048) != 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 Single_numContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def ZERO(self):
            return self.getToken(WURCSParser.ZERO, 0)

        def DIGIT(self):
            return self.getToken(WURCSParser.DIGIT, 0)

        def getRuleIndex(self):
            return WURCSParser.RULE_single_num

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

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




    def single_num(self):

        localctx = WURCSParser.Single_numContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_single_num)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 127
            _la = self._input.LA(1)
            if not(_la==17 or _la==18):
                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 NumContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def DIGIT(self):
            return self.getToken(WURCSParser.DIGIT, 0)

        def single_num(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(WURCSParser.Single_numContext)
            else:
                return self.getTypedRuleContext(WURCSParser.Single_numContext,i)


        def getRuleIndex(self):
            return WURCSParser.RULE_num

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

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




    def num(self):

        localctx = WURCSParser.NumContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_num)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 129
            self.match(WURCSParser.DIGIT)
            self.state = 133
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==17 or _la==18:
                self.state = 130
                self.single_num()
                self.state = 135
                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





