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

class AriaMRParser ( Parser ):

    grammarFileName = "AriaMRParser.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "','", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "'ref_spec:'", 
                     "'ref_peak:'", "'id:'", "'d:'", "'u:'", "'u_viol:'", 
                     "'%_viol:'", "'viol:'", "'reliable:'", "'a_type:'", 
                     "'weight:'", "'+/-'", "'-'", "'p'", "'a'", "'c'" ]

    symbolicNames = [ "<INVALID>", "COMMA", "Integer", "Float", "Real", 
                      "SHARP_COMMENT", "EXCLM_COMMENT", "SMCLN_COMMENT", 
                      "RefSpec", "RefPeak", "Id", "D", "U", "UViol", "PViol", 
                      "Viol", "Reliable", "AType", "Weight", "PlusMinus", 
                      "Hyphen", "P_code", "A_code", "C_code", "Simple_name", 
                      "SPACE", "ENCLOSE_COMMENT", "SECTION_COMMENT", "LINE_COMMENT", 
                      "SPACE_RS", "RefSpecName", "RETURN_RS", "SPACE_V", 
                      "ViolFlag", "RETURN_V", "SPACE_R", "ReliableFlag", 
                      "RETURN_R", "SPACE_A", "ATypeFlag", "RETURN_A" ]

    RULE_aria_mr = 0
    RULE_distance_restraints = 1
    RULE_distance_restraint = 2
    RULE_contribution = 3
    RULE_atom_pair = 4
    RULE_atom_selection = 5
    RULE_old_distance_restraints = 6
    RULE_old_distance_restraint = 7
    RULE_p_row = 8
    RULE_a_row = 9
    RULE_c_row = 10
    RULE_number = 11
    RULE_number_c = 12

    ruleNames =  [ "aria_mr", "distance_restraints", "distance_restraint", 
                   "contribution", "atom_pair", "atom_selection", "old_distance_restraints", 
                   "old_distance_restraint", "p_row", "a_row", "c_row", 
                   "number", "number_c" ]

    EOF = Token.EOF
    COMMA=1
    Integer=2
    Float=3
    Real=4
    SHARP_COMMENT=5
    EXCLM_COMMENT=6
    SMCLN_COMMENT=7
    RefSpec=8
    RefPeak=9
    Id=10
    D=11
    U=12
    UViol=13
    PViol=14
    Viol=15
    Reliable=16
    AType=17
    Weight=18
    PlusMinus=19
    Hyphen=20
    P_code=21
    A_code=22
    C_code=23
    Simple_name=24
    SPACE=25
    ENCLOSE_COMMENT=26
    SECTION_COMMENT=27
    LINE_COMMENT=28
    SPACE_RS=29
    RefSpecName=30
    RETURN_RS=31
    SPACE_V=32
    ViolFlag=33
    RETURN_V=34
    SPACE_R=35
    ReliableFlag=36
    RETURN_R=37
    SPACE_A=38
    ATypeFlag=39
    RETURN_A=40

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




    class Aria_mrContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def distance_restraints(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AriaMRParser.Distance_restraintsContext)
            else:
                return self.getTypedRuleContext(AriaMRParser.Distance_restraintsContext,i)


        def old_distance_restraints(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AriaMRParser.Old_distance_restraintsContext)
            else:
                return self.getTypedRuleContext(AriaMRParser.Old_distance_restraintsContext,i)


        def getRuleIndex(self):
            return AriaMRParser.RULE_aria_mr

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

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




    def aria_mr(self):

        localctx = AriaMRParser.Aria_mrContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_aria_mr)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 30
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==8 or _la==21:
                self.state = 28
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [8]:
                    self.state = 26
                    self.distance_restraints()
                    pass
                elif token in [21]:
                    self.state = 27
                    self.old_distance_restraints()
                    pass
                else:
                    raise NoViableAltException(self)

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

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


    class Distance_restraintsContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def distance_restraint(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AriaMRParser.Distance_restraintContext)
            else:
                return self.getTypedRuleContext(AriaMRParser.Distance_restraintContext,i)


        def getRuleIndex(self):
            return AriaMRParser.RULE_distance_restraints

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

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




    def distance_restraints(self):

        localctx = AriaMRParser.Distance_restraintsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_distance_restraints)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 36 
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 35
                    self.distance_restraint()

                else:
                    raise NoViableAltException(self)
                self.state = 38 
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,2,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 Distance_restraintContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def RefSpec(self):
            return self.getToken(AriaMRParser.RefSpec, 0)

        def RefSpecName(self):
            return self.getToken(AriaMRParser.RefSpecName, 0)

        def RefPeak(self):
            return self.getToken(AriaMRParser.RefPeak, 0)

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

        def Id(self):
            return self.getToken(AriaMRParser.Id, 0)

        def D(self):
            return self.getToken(AriaMRParser.D, 0)

        def number(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AriaMRParser.NumberContext)
            else:
                return self.getTypedRuleContext(AriaMRParser.NumberContext,i)


        def U(self):
            return self.getToken(AriaMRParser.U, 0)

        def UViol(self):
            return self.getToken(AriaMRParser.UViol, 0)

        def PViol(self):
            return self.getToken(AriaMRParser.PViol, 0)

        def Viol(self):
            return self.getToken(AriaMRParser.Viol, 0)

        def ViolFlag(self):
            return self.getToken(AriaMRParser.ViolFlag, 0)

        def Reliable(self):
            return self.getToken(AriaMRParser.Reliable, 0)

        def ReliableFlag(self):
            return self.getToken(AriaMRParser.ReliableFlag, 0)

        def AType(self):
            return self.getToken(AriaMRParser.AType, 0)

        def ATypeFlag(self):
            return self.getToken(AriaMRParser.ATypeFlag, 0)

        def contribution(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AriaMRParser.ContributionContext)
            else:
                return self.getTypedRuleContext(AriaMRParser.ContributionContext,i)


        def getRuleIndex(self):
            return AriaMRParser.RULE_distance_restraint

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

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




    def distance_restraint(self):

        localctx = AriaMRParser.Distance_restraintContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_distance_restraint)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 40
            self.match(AriaMRParser.RefSpec)
            self.state = 41
            self.match(AriaMRParser.RefSpecName)
            self.state = 42
            self.match(AriaMRParser.RefPeak)
            self.state = 43
            self.match(AriaMRParser.Integer)
            self.state = 44
            self.match(AriaMRParser.Id)
            self.state = 45
            self.match(AriaMRParser.Integer)
            self.state = 46
            self.match(AriaMRParser.D)
            self.state = 47
            self.number()
            self.state = 48
            self.match(AriaMRParser.U)
            self.state = 49
            self.number()
            self.state = 50
            self.match(AriaMRParser.UViol)
            self.state = 51
            self.number()
            self.state = 52
            self.match(AriaMRParser.PViol)
            self.state = 53
            self.number()
            self.state = 54
            self.match(AriaMRParser.Viol)
            self.state = 55
            self.match(AriaMRParser.ViolFlag)
            self.state = 56
            self.match(AriaMRParser.Reliable)
            self.state = 57
            self.match(AriaMRParser.ReliableFlag)
            self.state = 58
            self.match(AriaMRParser.AType)
            self.state = 59
            self.match(AriaMRParser.ATypeFlag)
            self.state = 61 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 60
                self.contribution()
                self.state = 63 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==24):
                    break

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


    class ContributionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def atom_pair(self):
            return self.getTypedRuleContext(AriaMRParser.Atom_pairContext,0)


        def D(self):
            return self.getToken(AriaMRParser.D, 0)

        def number_c(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AriaMRParser.Number_cContext)
            else:
                return self.getTypedRuleContext(AriaMRParser.Number_cContext,i)


        def PlusMinus(self):
            return self.getToken(AriaMRParser.PlusMinus, 0)

        def Weight(self):
            return self.getToken(AriaMRParser.Weight, 0)

        def getRuleIndex(self):
            return AriaMRParser.RULE_contribution

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

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




    def contribution(self):

        localctx = AriaMRParser.ContributionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_contribution)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 65
            self.atom_pair()
            self.state = 73
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==11:
                self.state = 66
                self.match(AriaMRParser.D)
                self.state = 67
                self.number_c()
                self.state = 68
                self.match(AriaMRParser.PlusMinus)
                self.state = 69
                self.number_c()
                self.state = 70
                self.match(AriaMRParser.Weight)
                self.state = 71
                self.number_c()


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


    class Atom_pairContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def atom_selection(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AriaMRParser.Atom_selectionContext)
            else:
                return self.getTypedRuleContext(AriaMRParser.Atom_selectionContext,i)


        def Hyphen(self):
            return self.getToken(AriaMRParser.Hyphen, 0)

        def getRuleIndex(self):
            return AriaMRParser.RULE_atom_pair

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

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




    def atom_pair(self):

        localctx = AriaMRParser.Atom_pairContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_atom_pair)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 75
            self.atom_selection()
            self.state = 76
            self.match(AriaMRParser.Hyphen)
            self.state = 77
            self.atom_selection()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Atom_selectionContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def getRuleIndex(self):
            return AriaMRParser.RULE_atom_selection

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

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




    def atom_selection(self):

        localctx = AriaMRParser.Atom_selectionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_atom_selection)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 79
            self.match(AriaMRParser.Simple_name)
            self.state = 80
            self.match(AriaMRParser.Simple_name)
            self.state = 82
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
            if la_ == 1:
                self.state = 81
                self.match(AriaMRParser.Simple_name)


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


    class Old_distance_restraintsContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def old_distance_restraint(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AriaMRParser.Old_distance_restraintContext)
            else:
                return self.getTypedRuleContext(AriaMRParser.Old_distance_restraintContext,i)


        def getRuleIndex(self):
            return AriaMRParser.RULE_old_distance_restraints

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

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




    def old_distance_restraints(self):

        localctx = AriaMRParser.Old_distance_restraintsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_old_distance_restraints)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 85 
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 84
                    self.old_distance_restraint()

                else:
                    raise NoViableAltException(self)
                self.state = 87 
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,6,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 Old_distance_restraintContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def p_row(self):
            return self.getTypedRuleContext(AriaMRParser.P_rowContext,0)


        def a_row(self):
            return self.getTypedRuleContext(AriaMRParser.A_rowContext,0)


        def c_row(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(AriaMRParser.C_rowContext)
            else:
                return self.getTypedRuleContext(AriaMRParser.C_rowContext,i)


        def getRuleIndex(self):
            return AriaMRParser.RULE_old_distance_restraint

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

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




    def old_distance_restraint(self):

        localctx = AriaMRParser.Old_distance_restraintContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_old_distance_restraint)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 89
            self.p_row()
            self.state = 90
            self.a_row()
            self.state = 92 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 91
                self.c_row()
                self.state = 94 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==23):
                    break

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


    class P_rowContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def P_code(self):
            return self.getToken(AriaMRParser.P_code, 0)

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

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

        def Real(self):
            return self.getToken(AriaMRParser.Real, 0)

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

        def getRuleIndex(self):
            return AriaMRParser.RULE_p_row

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

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




    def p_row(self):

        localctx = AriaMRParser.P_rowContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_p_row)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 96
            self.match(AriaMRParser.P_code)
            self.state = 97
            self.match(AriaMRParser.Integer)
            self.state = 98
            self.match(AriaMRParser.Integer)
            self.state = 99
            self.match(AriaMRParser.Integer)
            self.state = 100
            self.match(AriaMRParser.Float)
            self.state = 101
            self.match(AriaMRParser.Real)
            self.state = 102
            self.match(AriaMRParser.Hyphen)
            self.state = 103
            self.match(AriaMRParser.Hyphen)
            self.state = 104
            self.match(AriaMRParser.Hyphen)
            self.state = 105
            self.match(AriaMRParser.Hyphen)
            self.state = 106
            self.match(AriaMRParser.Float)
            self.state = 107
            self.match(AriaMRParser.Float)
            self.state = 108
            self.match(AriaMRParser.Float)
            self.state = 109
            self.match(AriaMRParser.Hyphen)
            self.state = 110
            self.match(AriaMRParser.Float)
            self.state = 111
            self.match(AriaMRParser.Float)
            self.state = 112
            self.match(AriaMRParser.Float)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class A_rowContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def A_code(self):
            return self.getToken(AriaMRParser.A_code, 0)

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

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

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

        def getRuleIndex(self):
            return AriaMRParser.RULE_a_row

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

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




    def a_row(self):

        localctx = AriaMRParser.A_rowContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_a_row)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 114
            self.match(AriaMRParser.A_code)
            self.state = 115
            self.match(AriaMRParser.Integer)
            self.state = 116
            self.match(AriaMRParser.Float)
            self.state = 117
            self.match(AriaMRParser.Float)
            self.state = 118
            self.match(AriaMRParser.Float)
            self.state = 119
            self.match(AriaMRParser.Float)
            self.state = 120
            self.match(AriaMRParser.Real)
            self.state = 121
            self.match(AriaMRParser.Real)
            self.state = 122
            self.match(AriaMRParser.Real)
            self.state = 123
            self.match(AriaMRParser.Real)
            self.state = 124
            self.match(AriaMRParser.Integer)
            self.state = 125
            self.match(AriaMRParser.Integer)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class C_rowContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def C_code(self):
            return self.getToken(AriaMRParser.C_code, 0)

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

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

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

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

        def getRuleIndex(self):
            return AriaMRParser.RULE_c_row

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

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




    def c_row(self):

        localctx = AriaMRParser.C_rowContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_c_row)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 127
            self.match(AriaMRParser.C_code)
            self.state = 128
            self.match(AriaMRParser.Float)
            self.state = 129
            self.match(AriaMRParser.Float)
            self.state = 130
            self.match(AriaMRParser.Float)
            self.state = 131
            self.match(AriaMRParser.Float)
            self.state = 132
            self.match(AriaMRParser.Float)
            self.state = 133
            self.match(AriaMRParser.Float)
            self.state = 134
            self.match(AriaMRParser.Hyphen)
            self.state = 135
            self.match(AriaMRParser.Integer)
            self.state = 136
            self.match(AriaMRParser.Simple_name)
            self.state = 137
            self.match(AriaMRParser.Simple_name)
            self.state = 138
            self.match(AriaMRParser.Float)
            self.state = 139
            self.match(AriaMRParser.Float)
            self.state = 140
            self.match(AriaMRParser.Simple_name)
            self.state = 141
            self.match(AriaMRParser.Float)
            self.state = 142
            self.match(AriaMRParser.Float)
            self.state = 143
            self.match(AriaMRParser.Hyphen)
            self.state = 144
            self.match(AriaMRParser.Integer)
            self.state = 145
            self.match(AriaMRParser.Simple_name)
            self.state = 146
            self.match(AriaMRParser.Simple_name)
            self.state = 147
            self.match(AriaMRParser.Float)
            self.state = 148
            self.match(AriaMRParser.Float)
            self.state = 149
            self.match(AriaMRParser.Simple_name)
            self.state = 150
            self.match(AriaMRParser.Float)
            self.state = 151
            self.match(AriaMRParser.Float)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NumberContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def Float(self):
            return self.getToken(AriaMRParser.Float, 0)

        def Integer(self):
            return self.getToken(AriaMRParser.Integer, 0)

        def getRuleIndex(self):
            return AriaMRParser.RULE_number

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

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




    def number(self):

        localctx = AriaMRParser.NumberContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_number)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 153
            _la = self._input.LA(1)
            if not(_la==2 or _la==3):
                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 Number_cContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def Float(self):
            return self.getToken(AriaMRParser.Float, 0)

        def Integer(self):
            return self.getToken(AriaMRParser.Integer, 0)

        def getRuleIndex(self):
            return AriaMRParser.RULE_number_c

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

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




    def number_c(self):

        localctx = AriaMRParser.Number_cContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_number_c)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 155
            _la = self._input.LA(1)
            if not(_la==2 or _la==3):
                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





