<gh_stars>1-10
# Generated from .\DOT.g4 by ANTLR 4.9.3
# 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\35")
        buf.write("\u00a7\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
        buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
        buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
        buf.write("\4\24\t\24\3\2\5\2*\n\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\5")
        buf.write("\2\63\n\2\3\2\5\2\66\n\2\3\3\3\3\5\3:\n\3\3\3\3\3\5\3")
        buf.write(">\n\3\3\4\3\4\5\4B\n\4\3\4\5\4E\n\4\3\5\3\5\3\5\3\5\3")
        buf.write("\5\5\5L\n\5\3\6\3\6\3\6\3\7\3\7\5\7S\n\7\3\7\3\7\5\7W")
        buf.write("\n\7\3\b\3\b\3\b\3\b\5\b]\n\b\3\t\3\t\5\ta\n\t\3\t\5\t")
        buf.write("d\n\t\3\n\3\n\3\n\3\n\5\nj\n\n\3\n\5\nm\n\n\3\13\3\13")
        buf.write("\5\13q\n\13\3\13\3\13\3\13\3\f\3\f\3\f\5\fy\n\f\3\f\5")
        buf.write("\f|\n\f\3\r\3\r\5\r\u0080\n\r\3\16\3\16\5\16\u0084\n\16")
        buf.write("\3\17\3\17\3\17\3\17\5\17\u008a\n\17\3\20\3\20\5\20\u008e")
        buf.write("\n\20\5\20\u0090\n\20\3\20\3\20\3\20\3\20\3\21\3\21\3")
        buf.write("\21\3\21\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23")
        buf.write("\3\23\3\23\3\24\3\24\3\24\2\2\25\2\4\6\b\n\f\16\20\22")
        buf.write("\24\26\30\32\34\36 \"$&\2\6\3\2\t\n\3\2\13\r\3\2\20\21")
        buf.write("\3\2\30\32\2\u00ad\2)\3\2\2\2\4=\3\2\2\2\6?\3\2\2\2\b")
        buf.write("K\3\2\2\2\nM\3\2\2\2\fP\3\2\2\2\16X\3\2\2\2\20^\3\2\2")
        buf.write("\2\22e\3\2\2\2\24p\3\2\2\2\26u\3\2\2\2\30}\3\2\2\2\32")
        buf.write("\u0081\3\2\2\2\34\u0085\3\2\2\2\36\u008f\3\2\2\2 \u0095")
        buf.write("\3\2\2\2\"\u0099\3\2\2\2$\u009d\3\2\2\2&\u00a4\3\2\2\2")
        buf.write("(*\7\3\2\2)(\3\2\2\2)*\3\2\2\2*+\3\2\2\2+,\7\4\2\2,-\5")
        buf.write("&\24\2-.\7\5\2\2./\5\4\3\2/\65\7\6\2\2\60\62\7\7\2\2\61")
        buf.write("\63\5\6\4\2\62\61\3\2\2\2\62\63\3\2\2\2\63\64\3\2\2\2")
        buf.write("\64\66\7\b\2\2\65\60\3\2\2\2\65\66\3\2\2\2\66\3\3\2\2")
        buf.write("\2\679\5\b\5\28:\7\t\2\298\3\2\2\29:\3\2\2\2:;\3\2\2\2")
        buf.write(";<\5\4\3\2<>\3\2\2\2=\67\3\2\2\2=>\3\2\2\2>\5\3\2\2\2")
        buf.write("?A\5\"\22\2@B\t\2\2\2A@\3\2\2\2AB\3\2\2\2BD\3\2\2\2CE")
        buf.write("\5\6\4\2DC\3\2\2\2DE\3\2\2\2E\7\3\2\2\2FL\5\30\r\2GL\5")
        buf.write("\24\13\2HL\5\n\6\2IL\5 \21\2JL\5\36\20\2KF\3\2\2\2KG\3")
        buf.write("\2\2\2KH\3\2\2\2KI\3\2\2\2KJ\3\2\2\2L\t\3\2\2\2MN\t\3")
        buf.write("\2\2NO\5\f\7\2O\13\3\2\2\2PR\7\16\2\2QS\5\20\t\2RQ\3\2")
        buf.write("\2\2RS\3\2\2\2ST\3\2\2\2TV\7\17\2\2UW\5\f\7\2VU\3\2\2")
        buf.write("\2VW\3\2\2\2W\r\3\2\2\2XY\7\16\2\2YZ\5\22\n\2Z\\\7\17")
        buf.write("\2\2[]\5\f\7\2\\[\3\2\2\2\\]\3\2\2\2]\17\3\2\2\2^`\5 ")
        buf.write("\21\2_a\t\2\2\2`_\3\2\2\2`a\3\2\2\2ac\3\2\2\2bd\5\20\t")
        buf.write("\2cb\3\2\2\2cd\3\2\2\2d\21\3\2\2\2ef\t\4\2\2fg\7\22\2")
        buf.write("\2gi\5&\24\2hj\t\2\2\2ih\3\2\2\2ij\3\2\2\2jl\3\2\2\2k")
        buf.write("m\5\20\t\2lk\3\2\2\2lm\3\2\2\2m\23\3\2\2\2nq\5\32\16\2")
        buf.write("oq\5\36\20\2pn\3\2\2\2po\3\2\2\2qr\3\2\2\2rs\5\26\f\2")
        buf.write("st\5\16\b\2t\25\3\2\2\2ux\7\23\2\2vy\5\32\16\2wy\5\36")
        buf.write("\20\2xv\3\2\2\2xw\3\2\2\2y{\3\2\2\2z|\5\26\f\2{z\3\2\2")
        buf.write("\2{|\3\2\2\2|\27\3\2\2\2}\177\5\32\16\2~\u0080\5\f\7\2")
        buf.write("\177~\3\2\2\2\177\u0080\3\2\2\2\u0080\31\3\2\2\2\u0081")
        buf.write("\u0083\5&\24\2\u0082\u0084\5\34\17\2\u0083\u0082\3\2\2")
        buf.write("\2\u0083\u0084\3\2\2\2\u0084\33\3\2\2\2\u0085\u0086\7")
        buf.write("\24\2\2\u0086\u0089\5&\24\2\u0087\u0088\7\24\2\2\u0088")
        buf.write("\u008a\5&\24\2\u0089\u0087\3\2\2\2\u0089\u008a\3\2\2\2")
        buf.write("\u008a\35\3\2\2\2\u008b\u008d\7\25\2\2\u008c\u008e\5&")
        buf.write("\24\2\u008d\u008c\3\2\2\2\u008d\u008e\3\2\2\2\u008e\u0090")
        buf.write("\3\2\2\2\u008f\u008b\3\2\2\2\u008f\u0090\3\2\2\2\u0090")
        buf.write("\u0091\3\2\2\2\u0091\u0092\7\5\2\2\u0092\u0093\5\4\3\2")
        buf.write("\u0093\u0094\7\6\2\2\u0094\37\3\2\2\2\u0095\u0096\5&\24")
        buf.write("\2\u0096\u0097\7\22\2\2\u0097\u0098\5&\24\2\u0098!\3\2")
        buf.write("\2\2\u0099\u009a\5$\23\2\u009a\u009b\7\26\2\2\u009b\u009c")
        buf.write("\5$\23\2\u009c#\3\2\2\2\u009d\u009e\7\33\2\2\u009e\u009f")
        buf.write("\5&\24\2\u009f\u00a0\7\27\2\2\u00a0\u00a1\5&\24\2\u00a1")
        buf.write("\u00a2\7\23\2\2\u00a2\u00a3\5&\24\2\u00a3%\3\2\2\2\u00a4")
        buf.write("\u00a5\t\5\2\2\u00a5\'\3\2\2\2\31)\62\659=ADKRV\\`cil")
        buf.write("px{\177\u0083\u0089\u008d\u008f")
        return buf.getvalue()


class DOTParser ( Parser ):

    grammarFileName = "DOT.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'strict'", "'digraph'", "'{'", "'}'", 
                     "'/*'", "'*/'", "';'", "','", "'graph'", "'node'", 
                     "'edge'", "'['", "']'", "'label'", "'\"label\"'", "'='", 
                     "'->'", "':'", "'subgraph'", "'/'", "'-'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "Quote", "Variable", "Number", 
                      "Direction", "WS", "LINE_COMMENT" ]

    RULE_graph = 0
    RULE_stmt_list = 1
    RULE_independence_list = 2
    RULE_stmt = 3
    RULE_attr_stmt = 4
    RULE_attr_list = 5
    RULE_attr_label = 6
    RULE_a_list = 7
    RULE_a_label = 8
    RULE_edge_stmt = 9
    RULE_edgeRHS = 10
    RULE_node_stmt = 11
    RULE_node_id = 12
    RULE_port = 13
    RULE_subgraph_stmt = 14
    RULE_assignment = 15
    RULE_independence = 16
    RULE_independence_edge = 17
    RULE_identifier = 18

    ruleNames =  [ "graph", "stmt_list", "independence_list", "stmt", "attr_stmt", 
                   "attr_list", "attr_label", "a_list", "a_label", "edge_stmt", 
                   "edgeRHS", "node_stmt", "node_id", "port", "subgraph_stmt", 
                   "assignment", "independence", "independence_edge", "identifier" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    T__5=6
    T__6=7
    T__7=8
    T__8=9
    T__9=10
    T__10=11
    T__11=12
    T__12=13
    T__13=14
    T__14=15
    T__15=16
    T__16=17
    T__17=18
    T__18=19
    T__19=20
    T__20=21
    Quote=22
    Variable=23
    Number=24
    Direction=25
    WS=26
    LINE_COMMENT=27

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




    class GraphContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def identifier(self):
            return self.getTypedRuleContext(DOTParser.IdentifierContext,0)


        def stmt_list(self):
            return self.getTypedRuleContext(DOTParser.Stmt_listContext,0)


        def independence_list(self):
            return self.getTypedRuleContext(DOTParser.Independence_listContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_graph

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

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




    def graph(self):

        localctx = DOTParser.GraphContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_graph)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 39
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__0:
                self.state = 38
                self.match(DOTParser.T__0)


            self.state = 41
            self.match(DOTParser.T__1)
            self.state = 42
            self.identifier()
            self.state = 43
            self.match(DOTParser.T__2)
            self.state = 44
            self.stmt_list()
            self.state = 45
            self.match(DOTParser.T__3)
            self.state = 51
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__4:
                self.state = 46
                self.match(DOTParser.T__4)
                self.state = 48
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==DOTParser.Direction:
                    self.state = 47
                    self.independence_list()


                self.state = 50
                self.match(DOTParser.T__5)


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


    class Stmt_listContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def stmt(self):
            return self.getTypedRuleContext(DOTParser.StmtContext,0)


        def stmt_list(self):
            return self.getTypedRuleContext(DOTParser.Stmt_listContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_stmt_list

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

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




    def stmt_list(self):

        localctx = DOTParser.Stmt_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_stmt_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 59
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << DOTParser.T__2) | (1 << DOTParser.T__8) | (1 << DOTParser.T__9) | (1 << DOTParser.T__10) | (1 << DOTParser.T__18) | (1 << DOTParser.Quote) | (1 << DOTParser.Variable) | (1 << DOTParser.Number))) != 0):
                self.state = 53
                self.stmt()
                self.state = 55
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==DOTParser.T__6:
                    self.state = 54
                    self.match(DOTParser.T__6)


                self.state = 57
                self.stmt_list()


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


    class Independence_listContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def independence(self):
            return self.getTypedRuleContext(DOTParser.IndependenceContext,0)


        def independence_list(self):
            return self.getTypedRuleContext(DOTParser.Independence_listContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_independence_list

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

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




    def independence_list(self):

        localctx = DOTParser.Independence_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_independence_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 61
            self.independence()
            self.state = 63
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__6 or _la==DOTParser.T__7:
                self.state = 62
                _la = self._input.LA(1)
                if not(_la==DOTParser.T__6 or _la==DOTParser.T__7):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()


            self.state = 66
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.Direction:
                self.state = 65
                self.independence_list()


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


    class StmtContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def node_stmt(self):
            return self.getTypedRuleContext(DOTParser.Node_stmtContext,0)


        def edge_stmt(self):
            return self.getTypedRuleContext(DOTParser.Edge_stmtContext,0)


        def attr_stmt(self):
            return self.getTypedRuleContext(DOTParser.Attr_stmtContext,0)


        def assignment(self):
            return self.getTypedRuleContext(DOTParser.AssignmentContext,0)


        def subgraph_stmt(self):
            return self.getTypedRuleContext(DOTParser.Subgraph_stmtContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_stmt

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

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




    def stmt(self):

        localctx = DOTParser.StmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_stmt)
        try:
            self.state = 73
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,7,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 68
                self.node_stmt()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 69
                self.edge_stmt()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 70
                self.attr_stmt()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 71
                self.assignment()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 72
                self.subgraph_stmt()
                pass


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


    class Attr_stmtContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def attr_list(self):
            return self.getTypedRuleContext(DOTParser.Attr_listContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_attr_stmt

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

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




    def attr_stmt(self):

        localctx = DOTParser.Attr_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_attr_stmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 75
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << DOTParser.T__8) | (1 << DOTParser.T__9) | (1 << DOTParser.T__10))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 76
            self.attr_list()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Attr_listContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def a_list(self):
            return self.getTypedRuleContext(DOTParser.A_listContext,0)


        def attr_list(self):
            return self.getTypedRuleContext(DOTParser.Attr_listContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_attr_list

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

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




    def attr_list(self):

        localctx = DOTParser.Attr_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_attr_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 78
            self.match(DOTParser.T__11)
            self.state = 80
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << DOTParser.Quote) | (1 << DOTParser.Variable) | (1 << DOTParser.Number))) != 0):
                self.state = 79
                self.a_list()


            self.state = 82
            self.match(DOTParser.T__12)
            self.state = 84
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__11:
                self.state = 83
                self.attr_list()


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


    class Attr_labelContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def a_label(self):
            return self.getTypedRuleContext(DOTParser.A_labelContext,0)


        def attr_list(self):
            return self.getTypedRuleContext(DOTParser.Attr_listContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_attr_label

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

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




    def attr_label(self):

        localctx = DOTParser.Attr_labelContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_attr_label)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 86
            self.match(DOTParser.T__11)
            self.state = 87
            self.a_label()
            self.state = 88
            self.match(DOTParser.T__12)
            self.state = 90
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__11:
                self.state = 89
                self.attr_list()


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


    class A_listContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def assignment(self):
            return self.getTypedRuleContext(DOTParser.AssignmentContext,0)


        def a_list(self):
            return self.getTypedRuleContext(DOTParser.A_listContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_a_list

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

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




    def a_list(self):

        localctx = DOTParser.A_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_a_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 92
            self.assignment()
            self.state = 94
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__6 or _la==DOTParser.T__7:
                self.state = 93
                _la = self._input.LA(1)
                if not(_la==DOTParser.T__6 or _la==DOTParser.T__7):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()


            self.state = 97
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << DOTParser.Quote) | (1 << DOTParser.Variable) | (1 << DOTParser.Number))) != 0):
                self.state = 96
                self.a_list()


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


    class A_labelContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def identifier(self):
            return self.getTypedRuleContext(DOTParser.IdentifierContext,0)


        def a_list(self):
            return self.getTypedRuleContext(DOTParser.A_listContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_a_label

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

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




    def a_label(self):

        localctx = DOTParser.A_labelContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_a_label)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 99
            _la = self._input.LA(1)
            if not(_la==DOTParser.T__13 or _la==DOTParser.T__14):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 100
            self.match(DOTParser.T__15)
            self.state = 101
            self.identifier()
            self.state = 103
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__6 or _la==DOTParser.T__7:
                self.state = 102
                _la = self._input.LA(1)
                if not(_la==DOTParser.T__6 or _la==DOTParser.T__7):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()


            self.state = 106
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << DOTParser.Quote) | (1 << DOTParser.Variable) | (1 << DOTParser.Number))) != 0):
                self.state = 105
                self.a_list()


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


    class Edge_stmtContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def edgeRHS(self):
            return self.getTypedRuleContext(DOTParser.EdgeRHSContext,0)


        def attr_label(self):
            return self.getTypedRuleContext(DOTParser.Attr_labelContext,0)


        def node_id(self):
            return self.getTypedRuleContext(DOTParser.Node_idContext,0)


        def subgraph_stmt(self):
            return self.getTypedRuleContext(DOTParser.Subgraph_stmtContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_edge_stmt

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

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




    def edge_stmt(self):

        localctx = DOTParser.Edge_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_edge_stmt)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 110
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [DOTParser.Quote, DOTParser.Variable, DOTParser.Number]:
                self.state = 108
                self.node_id()
                pass
            elif token in [DOTParser.T__2, DOTParser.T__18]:
                self.state = 109
                self.subgraph_stmt()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 112
            self.edgeRHS()
            self.state = 113
            self.attr_label()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class EdgeRHSContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def node_id(self):
            return self.getTypedRuleContext(DOTParser.Node_idContext,0)


        def subgraph_stmt(self):
            return self.getTypedRuleContext(DOTParser.Subgraph_stmtContext,0)


        def edgeRHS(self):
            return self.getTypedRuleContext(DOTParser.EdgeRHSContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_edgeRHS

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

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




    def edgeRHS(self):

        localctx = DOTParser.EdgeRHSContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_edgeRHS)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 115
            self.match(DOTParser.T__16)
            self.state = 118
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [DOTParser.Quote, DOTParser.Variable, DOTParser.Number]:
                self.state = 116
                self.node_id()
                pass
            elif token in [DOTParser.T__2, DOTParser.T__18]:
                self.state = 117
                self.subgraph_stmt()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 121
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__16:
                self.state = 120
                self.edgeRHS()


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


    class Node_stmtContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def node_id(self):
            return self.getTypedRuleContext(DOTParser.Node_idContext,0)


        def attr_list(self):
            return self.getTypedRuleContext(DOTParser.Attr_listContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_node_stmt

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

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




    def node_stmt(self):

        localctx = DOTParser.Node_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_node_stmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 123
            self.node_id()
            self.state = 125
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__11:
                self.state = 124
                self.attr_list()


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


    class Node_idContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def identifier(self):
            return self.getTypedRuleContext(DOTParser.IdentifierContext,0)


        def port(self):
            return self.getTypedRuleContext(DOTParser.PortContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_node_id

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

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




    def node_id(self):

        localctx = DOTParser.Node_idContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_node_id)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 127
            self.identifier()
            self.state = 129
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__17:
                self.state = 128
                self.port()


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


    class PortContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def identifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(DOTParser.IdentifierContext)
            else:
                return self.getTypedRuleContext(DOTParser.IdentifierContext,i)


        def getRuleIndex(self):
            return DOTParser.RULE_port

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

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




    def port(self):

        localctx = DOTParser.PortContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_port)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 131
            self.match(DOTParser.T__17)
            self.state = 132
            self.identifier()
            self.state = 135
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__17:
                self.state = 133
                self.match(DOTParser.T__17)
                self.state = 134
                self.identifier()


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


    class Subgraph_stmtContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def stmt_list(self):
            return self.getTypedRuleContext(DOTParser.Stmt_listContext,0)


        def identifier(self):
            return self.getTypedRuleContext(DOTParser.IdentifierContext,0)


        def getRuleIndex(self):
            return DOTParser.RULE_subgraph_stmt

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

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




    def subgraph_stmt(self):

        localctx = DOTParser.Subgraph_stmtContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_subgraph_stmt)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 141
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==DOTParser.T__18:
                self.state = 137
                self.match(DOTParser.T__18)
                self.state = 139
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << DOTParser.Quote) | (1 << DOTParser.Variable) | (1 << DOTParser.Number))) != 0):
                    self.state = 138
                    self.identifier()




            self.state = 143
            self.match(DOTParser.T__2)
            self.state = 144
            self.stmt_list()
            self.state = 145
            self.match(DOTParser.T__3)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AssignmentContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def identifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(DOTParser.IdentifierContext)
            else:
                return self.getTypedRuleContext(DOTParser.IdentifierContext,i)


        def getRuleIndex(self):
            return DOTParser.RULE_assignment

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

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




    def assignment(self):

        localctx = DOTParser.AssignmentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_assignment)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 147
            self.identifier()
            self.state = 148
            self.match(DOTParser.T__15)
            self.state = 149
            self.identifier()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IndependenceContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def independence_edge(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(DOTParser.Independence_edgeContext)
            else:
                return self.getTypedRuleContext(DOTParser.Independence_edgeContext,i)


        def getRuleIndex(self):
            return DOTParser.RULE_independence

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

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




    def independence(self):

        localctx = DOTParser.IndependenceContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_independence)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 151
            self.independence_edge()
            self.state = 152
            self.match(DOTParser.T__19)
            self.state = 153
            self.independence_edge()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Independence_edgeContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def Direction(self):
            return self.getToken(DOTParser.Direction, 0)

        def identifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(DOTParser.IdentifierContext)
            else:
                return self.getTypedRuleContext(DOTParser.IdentifierContext,i)


        def getRuleIndex(self):
            return DOTParser.RULE_independence_edge

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

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




    def independence_edge(self):

        localctx = DOTParser.Independence_edgeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_independence_edge)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 155
            self.match(DOTParser.Direction)
            self.state = 156
            self.identifier()
            self.state = 157
            self.match(DOTParser.T__20)
            self.state = 158
            self.identifier()
            self.state = 159
            self.match(DOTParser.T__16)
            self.state = 160
            self.identifier()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IdentifierContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def Variable(self):
            return self.getToken(DOTParser.Variable, 0)

        def Quote(self):
            return self.getToken(DOTParser.Quote, 0)

        def Number(self):
            return self.getToken(DOTParser.Number, 0)

        def getRuleIndex(self):
            return DOTParser.RULE_identifier

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

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




    def identifier(self):

        localctx = DOTParser.IdentifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_identifier)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 162
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << DOTParser.Quote) | (1 << DOTParser.Variable) | (1 << DOTParser.Number))) != 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





