# Generated from CypherParser.g4 by ANTLR 4.9.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():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3)")
        buf.write("\u0111\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
        buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
        buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
        buf.write("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
        buf.write("\t\31\3\2\3\2\3\2\7\2\66\n\2\f\2\16\29\13\2\3\2\5\2<\n")
        buf.write("\2\3\2\3\2\3\3\6\3A\n\3\r\3\16\3B\3\3\3\3\5\3G\n\3\3\4")
        buf.write("\3\4\3\4\3\4\5\4M\n\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4")
        buf.write("\6\4W\n\4\r\4\16\4X\3\4\3\4\5\4]\n\4\3\5\3\5\5\5a\n\5")
        buf.write("\3\5\3\5\3\5\5\5f\n\5\3\5\3\5\5\5j\n\5\3\6\3\6\3\6\3\6")
        buf.write("\5\6p\n\6\3\6\3\6\3\7\3\7\3\b\3\b\3\b\5\by\n\b\3\b\5\b")
        buf.write("|\n\b\3\t\3\t\3\t\3\n\3\n\3\n\5\n\u0084\n\n\3\n\3\n\3")
        buf.write("\n\5\n\u0089\n\n\3\n\3\n\3\n\5\n\u008e\n\n\3\n\5\n\u0091")
        buf.write("\n\n\3\n\7\n\u0094\n\n\f\n\16\n\u0097\13\n\3\13\3\13\5")
        buf.write("\13\u009b\n\13\3\13\3\13\6\13\u009f\n\13\r\13\16\13\u00a0")
        buf.write("\3\13\5\13\u00a4\n\13\3\13\3\13\3\13\3\13\3\13\3\13\7")
        buf.write("\13\u00ac\n\13\f\13\16\13\u00af\13\13\3\13\5\13\u00b2")
        buf.write("\n\13\3\13\3\13\5\13\u00b6\n\13\3\f\3\f\3\r\3\r\3\r\3")
        buf.write("\r\7\r\u00be\n\r\f\r\16\r\u00c1\13\r\3\r\3\r\3\16\3\16")
        buf.write("\5\16\u00c7\n\16\3\16\3\16\3\16\3\16\3\16\5\16\u00ce\n")
        buf.write("\16\3\16\5\16\u00d1\n\16\3\16\3\16\3\16\3\16\3\16\3\16")
        buf.write("\3\16\3\16\3\16\5\16\u00dc\n\16\3\16\5\16\u00df\n\16\5")
        buf.write("\16\u00e1\n\16\3\16\3\16\5\16\u00e5\n\16\3\17\3\17\3\20")
        buf.write("\3\20\5\20\u00eb\n\20\3\20\3\20\3\20\3\21\3\21\3\22\3")
        buf.write("\22\3\23\3\23\3\24\3\24\3\25\3\25\3\25\3\25\3\26\3\26")
        buf.write("\3\26\3\26\3\27\3\27\3\27\3\27\3\27\5\27\u0105\n\27\3")
        buf.write("\30\6\30\u0108\n\30\r\30\16\30\u0109\3\31\6\31\u010d\n")
        buf.write("\31\r\31\16\31\u010e\3\31\2\2\32\2\4\6\b\n\f\16\20\22")
        buf.write("\24\26\30\32\34\36 \"$&(*,.\60\2\7\3\2\17\20\3\2\35\"")
        buf.write("\3\2\n\13\4\2$$&&\3\2#&\2\u011e\2\62\3\2\2\2\4@\3\2\2")
        buf.write("\2\6\\\3\2\2\2\b^\3\2\2\2\nk\3\2\2\2\fs\3\2\2\2\16u\3")
        buf.write("\2\2\2\20}\3\2\2\2\22\u0080\3\2\2\2\24\u00b5\3\2\2\2\26")
        buf.write("\u00b7\3\2\2\2\30\u00b9\3\2\2\2\32\u00e4\3\2\2\2\34\u00e6")
        buf.write("\3\2\2\2\36\u00ea\3\2\2\2 \u00ef\3\2\2\2\"\u00f1\3\2\2")
        buf.write("\2$\u00f3\3\2\2\2&\u00f5\3\2\2\2(\u00f7\3\2\2\2*\u00fb")
        buf.write("\3\2\2\2,\u0104\3\2\2\2.\u0107\3\2\2\2\60\u010c\3\2\2")
        buf.write("\2\62\67\5\4\3\2\63\64\7\7\2\2\64\66\5\4\3\2\65\63\3\2")
        buf.write("\2\2\669\3\2\2\2\67\65\3\2\2\2\678\3\2\2\28;\3\2\2\29")
        buf.write("\67\3\2\2\2:<\5\20\t\2;:\3\2\2\2;<\3\2\2\2<=\3\2\2\2=")
        buf.write(">\7\2\2\3>\3\3\2\2\2?A\5\6\4\2@?\3\2\2\2AB\3\2\2\2B@\3")
        buf.write("\2\2\2BC\3\2\2\2CD\3\2\2\2DF\5\b\5\2EG\5\16\b\2FE\3\2")
        buf.write("\2\2FG\3\2\2\2G\5\3\2\2\2HI\7\4\2\2IL\5\22\n\2JK\7\5\2")
        buf.write("\2KM\5\36\20\2LJ\3\2\2\2LM\3\2\2\2M]\3\2\2\2NO\7\4\2\2")
        buf.write("OP\5\22\n\2PQ\7\5\2\2QR\7\23\2\2RV\5\36\20\2ST\5$\23\2")
        buf.write("TU\5\36\20\2UW\3\2\2\2VS\3\2\2\2WX\3\2\2\2XV\3\2\2\2X")
        buf.write("Y\3\2\2\2YZ\3\2\2\2Z[\7\24\2\2[]\3\2\2\2\\H\3\2\2\2\\")
        buf.write("N\3\2\2\2]\7\3\2\2\2^`\7\6\2\2_a\7\16\2\2`_\3\2\2\2`a")
        buf.write("\3\2\2\2ae\3\2\2\2bf\5\n\6\2cf\5(\25\2df\5&\24\2eb\3\2")
        buf.write("\2\2ec\3\2\2\2ed\3\2\2\2fi\3\2\2\2gh\7\t\2\2hj\5 \21\2")
        buf.write("ig\3\2\2\2ij\3\2\2\2j\t\3\2\2\2kl\5\f\7\2lo\7\23\2\2m")
        buf.write("p\5(\25\2np\5&\24\2om\3\2\2\2on\3\2\2\2pq\3\2\2\2qr\7")
        buf.write("\24\2\2r\13\3\2\2\2st\t\2\2\2t\r\3\2\2\2ux\7\f\2\2vy\5")
        buf.write("(\25\2wy\5&\24\2xv\3\2\2\2xw\3\2\2\2y{\3\2\2\2z|\7\21")
        buf.write("\2\2{z\3\2\2\2{|\3\2\2\2|\17\3\2\2\2}~\7\r\2\2~\177\7")
        buf.write("$\2\2\177\21\3\2\2\2\u0080\u0095\5\24\13\2\u0081\u0083")
        buf.write("\7\30\2\2\u0082\u0084\5\32\16\2\u0083\u0082\3\2\2\2\u0083")
        buf.write("\u0084\3\2\2\2\u0084\u0085\3\2\2\2\u0085\u0091\7\31\2")
        buf.write("\2\u0086\u0088\7\31\2\2\u0087\u0089\5\32\16\2\u0088\u0087")
        buf.write("\3\2\2\2\u0088\u0089\3\2\2\2\u0089\u008a\3\2\2\2\u008a")
        buf.write("\u0091\7\31\2\2\u008b\u008d\7\31\2\2\u008c\u008e\5\32")
        buf.write("\16\2\u008d\u008c\3\2\2\2\u008d\u008e\3\2\2\2\u008e\u008f")
        buf.write("\3\2\2\2\u008f\u0091\7\27\2\2\u0090\u0081\3\2\2\2\u0090")
        buf.write("\u0086\3\2\2\2\u0090\u008b\3\2\2\2\u0091\u0092\3\2\2\2")
        buf.write("\u0092\u0094\5\24\13\2\u0093\u0090\3\2\2\2\u0094\u0097")
        buf.write("\3\2\2\2\u0095\u0093\3\2\2\2\u0095\u0096\3\2\2\2\u0096")
        buf.write("\23\3\2\2\2\u0097\u0095\3\2\2\2\u0098\u009a\7\23\2\2\u0099")
        buf.write("\u009b\5&\24\2\u009a\u0099\3\2\2\2\u009a\u009b\3\2\2\2")
        buf.write("\u009b\u009e\3\2\2\2\u009c\u009d\7\26\2\2\u009d\u009f")
        buf.write("\5\26\f\2\u009e\u009c\3\2\2\2\u009f\u00a0\3\2\2\2\u00a0")
        buf.write("\u009e\3\2\2\2\u00a0\u00a1\3\2\2\2\u00a1\u00a3\3\2\2\2")
        buf.write("\u00a2\u00a4\5\30\r\2\u00a3\u00a2\3\2\2\2\u00a3\u00a4")
        buf.write("\3\2\2\2\u00a4\u00a5\3\2\2\2\u00a5\u00a6\7\24\2\2\u00a6")
        buf.write("\u00b6\3\2\2\2\u00a7\u00a8\7\23\2\2\u00a8\u00ad\5&\24")
        buf.write("\2\u00a9\u00aa\7\26\2\2\u00aa\u00ac\5\26\f\2\u00ab\u00a9")
        buf.write("\3\2\2\2\u00ac\u00af\3\2\2\2\u00ad\u00ab\3\2\2\2\u00ad")
        buf.write("\u00ae\3\2\2\2\u00ae\u00b1\3\2\2\2\u00af\u00ad\3\2\2\2")
        buf.write("\u00b0\u00b2\5\30\r\2\u00b1\u00b0\3\2\2\2\u00b1\u00b2")
        buf.write("\3\2\2\2\u00b2\u00b3\3\2\2\2\u00b3\u00b4\7\24\2\2\u00b4")
        buf.write("\u00b6\3\2\2\2\u00b5\u0098\3\2\2\2\u00b5\u00a7\3\2\2\2")
        buf.write("\u00b6\25\3\2\2\2\u00b7\u00b8\5.\30\2\u00b8\27\3\2\2\2")
        buf.write("\u00b9\u00ba\7\25\2\2\u00ba\u00bf\5*\26\2\u00bb\u00bc")
        buf.write("\7(\2\2\u00bc\u00be\5*\26\2\u00bd\u00bb\3\2\2\2\u00be")
        buf.write("\u00c1\3\2\2\2\u00bf\u00bd\3\2\2\2\u00bf\u00c0\3\2\2\2")
        buf.write("\u00c0\u00c2\3\2\2\2\u00c1\u00bf\3\2\2\2\u00c2\u00c3\7")
        buf.write("\32\2\2\u00c3\31\3\2\2\2\u00c4\u00c6\7\33\2\2\u00c5\u00c7")
        buf.write("\5&\24\2\u00c6\u00c5\3\2\2\2\u00c6\u00c7\3\2\2\2\u00c7")
        buf.write("\u00c8\3\2\2\2\u00c8\u00c9\7\26\2\2\u00c9\u00cd\5\34\17")
        buf.write("\2\u00ca\u00cb\7\'\2\2\u00cb\u00cc\7\26\2\2\u00cc\u00ce")
        buf.write("\5\34\17\2\u00cd\u00ca\3\2\2\2\u00cd\u00ce\3\2\2\2\u00ce")
        buf.write("\u00d0\3\2\2\2\u00cf\u00d1\5\30\r\2\u00d0\u00cf\3\2\2")
        buf.write("\2\u00d0\u00d1\3\2\2\2\u00d1\u00d2\3\2\2\2\u00d2\u00d3")
        buf.write("\7\34\2\2\u00d3\u00e5\3\2\2\2\u00d4\u00d5\7\33\2\2\u00d5")
        buf.write("\u00e0\5&\24\2\u00d6\u00d7\7\26\2\2\u00d7\u00db\5\34\17")
        buf.write("\2\u00d8\u00d9\7\'\2\2\u00d9\u00da\7\26\2\2\u00da\u00dc")
        buf.write("\5\34\17\2\u00db\u00d8\3\2\2\2\u00db\u00dc\3\2\2\2\u00dc")
        buf.write("\u00de\3\2\2\2\u00dd\u00df\5\30\r\2\u00de\u00dd\3\2\2")
        buf.write("\2\u00de\u00df\3\2\2\2\u00df\u00e1\3\2\2\2\u00e0\u00d6")
        buf.write("\3\2\2\2\u00e0\u00e1\3\2\2\2\u00e1\u00e2\3\2\2\2\u00e2")
        buf.write("\u00e3\7\34\2\2\u00e3\u00e5\3\2\2\2\u00e4\u00c4\3\2\2")
        buf.write("\2\u00e4\u00d4\3\2\2\2\u00e5\33\3\2\2\2\u00e6\u00e7\5")
        buf.write(".\30\2\u00e7\35\3\2\2\2\u00e8\u00eb\5(\25\2\u00e9\u00eb")
        buf.write("\5&\24\2\u00ea\u00e8\3\2\2\2\u00ea\u00e9\3\2\2\2\u00eb")
        buf.write("\u00ec\3\2\2\2\u00ec\u00ed\5\"\22\2\u00ed\u00ee\5,\27")
        buf.write("\2\u00ee\37\3\2\2\2\u00ef\u00f0\5&\24\2\u00f0!\3\2\2\2")
        buf.write("\u00f1\u00f2\t\3\2\2\u00f2#\3\2\2\2\u00f3\u00f4\t\4\2")
        buf.write("\2\u00f4%\3\2\2\2\u00f5\u00f6\5.\30\2\u00f6\'\3\2\2\2")
        buf.write("\u00f7\u00f8\5&\24\2\u00f8\u00f9\7#\2\2\u00f9\u00fa\5")
        buf.write("&\24\2\u00fa)\3\2\2\2\u00fb\u00fc\5&\24\2\u00fc\u00fd")
        buf.write("\7\26\2\2\u00fd\u00fe\5,\27\2\u00fe+\3\2\2\2\u00ff\u0105")
        buf.write("\5\60\31\2\u0100\u0101\7\22\2\2\u0101\u0102\5\60\31\2")
        buf.write("\u0102\u0103\7\22\2\2\u0103\u0105\3\2\2\2\u0104\u00ff")
        buf.write("\3\2\2\2\u0104\u0100\3\2\2\2\u0105-\3\2\2\2\u0106\u0108")
        buf.write("\t\5\2\2\u0107\u0106\3\2\2\2\u0108\u0109\3\2\2\2\u0109")
        buf.write("\u0107\3\2\2\2\u0109\u010a\3\2\2\2\u010a/\3\2\2\2\u010b")
        buf.write("\u010d\t\6\2\2\u010c\u010b\3\2\2\2\u010d\u010e\3\2\2\2")
        buf.write("\u010e\u010c\3\2\2\2\u010e\u010f\3\2\2\2\u010f\61\3\2")
        buf.write("\2\2&\67;BFLX\\`eiox{\u0083\u0088\u008d\u0090\u0095\u009a")
        buf.write("\u00a0\u00a3\u00ad\u00b1\u00b5\u00bf\u00c6\u00cd\u00d0")
        buf.write("\u00db\u00de\u00e0\u00e4\u00ea\u0104\u0109\u010e")
        return buf.getvalue()


class CypherParser ( Parser ):

    grammarFileName = "CypherParser.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'CALL'", "'MATCH'", "'WHERE'", "'RETURN'", 
                     "'UNION'", "'WITH'", "'AS'", "'AND'", "'OR'", "'ORDER BY'", 
                     "'LIMIT'", "'DISTINCT'", "'count'", "'isEmpty'", "'DESC'", 
                     "<INVALID>", "'('", "')'", "'{'", "':'", "'->'", "'<-'", 
                     "'-'", "'}'", "'['", "']'", "'='", "'<>'", "'>='", 
                     "'>'", "'<='", "'<'", "'.'", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "'|'", "','" ]

    symbolicNames = [ "<INVALID>", "Call", "Match", "Where", "Return", "Union", 
                      "With", "As", "And", "Or", "OrderBy", "Limit", "Distinct", 
                      "CountFunction", "IsEmptyFunction", "Desc", "SEP", 
                      "LP", "RP", "LB", "COL", "TORIGHT", "TOLEFT", "UND", 
                      "RB", "LSB", "RSB", "EQ", "NEQ", "GTE", "GT", "LTE", 
                      "LT", "DOT", "INTEGER", "STRING_SYMBOL", "STRING_LITERAL", 
                      "OR", "COMMA", "WS" ]

    RULE_root = 0
    RULE_queryBlock = 1
    RULE_matchClause = 2
    RULE_returnClause = 3
    RULE_specialQuery = 4
    RULE_queryFunction = 5
    RULE_orderByClause = 6
    RULE_limitClause = 7
    RULE_path = 8
    RULE_node = 9
    RULE_nodeLabel = 10
    RULE_propertyConstraint = 11
    RULE_relationship = 12
    RULE_relationshipLabel = 13
    RULE_constraint = 14
    RULE_alias = 15
    RULE_symbolOP = 16
    RULE_logicOP = 17
    RULE_variable = 18
    RULE_variableAttribute = 19
    RULE_nodeOrRelationshipProperty = 20
    RULE_value = 21
    RULE_varString = 22
    RULE_string = 23

    ruleNames =  [ "root", "queryBlock", "matchClause", "returnClause", 
                   "specialQuery", "queryFunction", "orderByClause", "limitClause", 
                   "path", "node", "nodeLabel", "propertyConstraint", "relationship", 
                   "relationshipLabel", "constraint", "alias", "symbolOP", 
                   "logicOP", "variable", "variableAttribute", "nodeOrRelationshipProperty", 
                   "value", "varString", "string" ]

    EOF = Token.EOF
    Call=1
    Match=2
    Where=3
    Return=4
    Union=5
    With=6
    As=7
    And=8
    Or=9
    OrderBy=10
    Limit=11
    Distinct=12
    CountFunction=13
    IsEmptyFunction=14
    Desc=15
    SEP=16
    LP=17
    RP=18
    LB=19
    COL=20
    TORIGHT=21
    TOLEFT=22
    UND=23
    RB=24
    LSB=25
    RSB=26
    EQ=27
    NEQ=28
    GTE=29
    GT=30
    LTE=31
    LT=32
    DOT=33
    INTEGER=34
    STRING_SYMBOL=35
    STRING_LITERAL=36
    OR=37
    COMMA=38
    WS=39

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




    class RootContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def queryBlock(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(CypherParser.QueryBlockContext)
            else:
                return self.getTypedRuleContext(CypherParser.QueryBlockContext,i)


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

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

        def limitClause(self):
            return self.getTypedRuleContext(CypherParser.LimitClauseContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_root

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

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




    def root(self):

        localctx = CypherParser.RootContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_root)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 48
            self.queryBlock()
            self.state = 53
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==CypherParser.Union:
                self.state = 49
                self.match(CypherParser.Union)
                self.state = 50
                self.queryBlock()
                self.state = 55
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 57
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==CypherParser.Limit:
                self.state = 56
                self.limitClause()


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


    class QueryBlockContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def returnClause(self):
            return self.getTypedRuleContext(CypherParser.ReturnClauseContext,0)


        def matchClause(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(CypherParser.MatchClauseContext)
            else:
                return self.getTypedRuleContext(CypherParser.MatchClauseContext,i)


        def orderByClause(self):
            return self.getTypedRuleContext(CypherParser.OrderByClauseContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_queryBlock

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

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




    def queryBlock(self):

        localctx = CypherParser.QueryBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_queryBlock)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 62 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 61
                self.matchClause()
                self.state = 64 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==CypherParser.Match):
                    break

            self.state = 66
            self.returnClause()
            self.state = 68
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==CypherParser.OrderBy:
                self.state = 67
                self.orderByClause()


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


    class MatchClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def Match(self):
            return self.getToken(CypherParser.Match, 0)

        def path(self):
            return self.getTypedRuleContext(CypherParser.PathContext,0)


        def Where(self):
            return self.getToken(CypherParser.Where, 0)

        def constraint(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(CypherParser.ConstraintContext)
            else:
                return self.getTypedRuleContext(CypherParser.ConstraintContext,i)


        def LP(self):
            return self.getToken(CypherParser.LP, 0)

        def RP(self):
            return self.getToken(CypherParser.RP, 0)

        def logicOP(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(CypherParser.LogicOPContext)
            else:
                return self.getTypedRuleContext(CypherParser.LogicOPContext,i)


        def getRuleIndex(self):
            return CypherParser.RULE_matchClause

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

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




    def matchClause(self):

        localctx = CypherParser.MatchClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_matchClause)
        self._la = 0 # Token type
        try:
            self.state = 90
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,6,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 70
                self.match(CypherParser.Match)
                self.state = 71
                self.path()
                self.state = 74
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==CypherParser.Where:
                    self.state = 72
                    self.match(CypherParser.Where)
                    self.state = 73
                    self.constraint()


                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 76
                self.match(CypherParser.Match)
                self.state = 77
                self.path()

                self.state = 78
                self.match(CypherParser.Where)
                self.state = 79
                self.match(CypherParser.LP)
                self.state = 80
                self.constraint()
                self.state = 84 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 81
                    self.logicOP()
                    self.state = 82
                    self.constraint()
                    self.state = 86 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==CypherParser.And or _la==CypherParser.Or):
                        break

                self.state = 88
                self.match(CypherParser.RP)
                pass


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


    class ReturnClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def Return(self):
            return self.getToken(CypherParser.Return, 0)

        def specialQuery(self):
            return self.getTypedRuleContext(CypherParser.SpecialQueryContext,0)


        def variableAttribute(self):
            return self.getTypedRuleContext(CypherParser.VariableAttributeContext,0)


        def variable(self):
            return self.getTypedRuleContext(CypherParser.VariableContext,0)


        def Distinct(self):
            return self.getToken(CypherParser.Distinct, 0)

        def As(self):
            return self.getToken(CypherParser.As, 0)

        def alias(self):
            return self.getTypedRuleContext(CypherParser.AliasContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_returnClause

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

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




    def returnClause(self):

        localctx = CypherParser.ReturnClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_returnClause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 92
            self.match(CypherParser.Return)
            self.state = 94
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==CypherParser.Distinct:
                self.state = 93
                self.match(CypherParser.Distinct)


            self.state = 99
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,8,self._ctx)
            if la_ == 1:
                self.state = 96
                self.specialQuery()
                pass

            elif la_ == 2:
                self.state = 97
                self.variableAttribute()
                pass

            elif la_ == 3:
                self.state = 98
                self.variable()
                pass


            self.state = 103
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==CypherParser.As:
                self.state = 101
                self.match(CypherParser.As)
                self.state = 102
                self.alias()


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


    class SpecialQueryContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def queryFunction(self):
            return self.getTypedRuleContext(CypherParser.QueryFunctionContext,0)


        def LP(self):
            return self.getToken(CypherParser.LP, 0)

        def RP(self):
            return self.getToken(CypherParser.RP, 0)

        def variableAttribute(self):
            return self.getTypedRuleContext(CypherParser.VariableAttributeContext,0)


        def variable(self):
            return self.getTypedRuleContext(CypherParser.VariableContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_specialQuery

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

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




    def specialQuery(self):

        localctx = CypherParser.SpecialQueryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_specialQuery)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 105
            self.queryFunction()
            self.state = 106
            self.match(CypherParser.LP)
            self.state = 109
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,10,self._ctx)
            if la_ == 1:
                self.state = 107
                self.variableAttribute()
                pass

            elif la_ == 2:
                self.state = 108
                self.variable()
                pass


            self.state = 111
            self.match(CypherParser.RP)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QueryFunctionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def CountFunction(self):
            return self.getToken(CypherParser.CountFunction, 0)

        def IsEmptyFunction(self):
            return self.getToken(CypherParser.IsEmptyFunction, 0)

        def getRuleIndex(self):
            return CypherParser.RULE_queryFunction

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

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




    def queryFunction(self):

        localctx = CypherParser.QueryFunctionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_queryFunction)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 113
            _la = self._input.LA(1)
            if not(_la==CypherParser.CountFunction or _la==CypherParser.IsEmptyFunction):
                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 OrderByClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def OrderBy(self):
            return self.getToken(CypherParser.OrderBy, 0)

        def variableAttribute(self):
            return self.getTypedRuleContext(CypherParser.VariableAttributeContext,0)


        def variable(self):
            return self.getTypedRuleContext(CypherParser.VariableContext,0)


        def Desc(self):
            return self.getToken(CypherParser.Desc, 0)

        def getRuleIndex(self):
            return CypherParser.RULE_orderByClause

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

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




    def orderByClause(self):

        localctx = CypherParser.OrderByClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_orderByClause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 115
            self.match(CypherParser.OrderBy)
            self.state = 118
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,11,self._ctx)
            if la_ == 1:
                self.state = 116
                self.variableAttribute()
                pass

            elif la_ == 2:
                self.state = 117
                self.variable()
                pass


            self.state = 121
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==CypherParser.Desc:
                self.state = 120
                self.match(CypherParser.Desc)


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


    class LimitClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def Limit(self):
            return self.getToken(CypherParser.Limit, 0)

        def INTEGER(self):
            return self.getToken(CypherParser.INTEGER, 0)

        def getRuleIndex(self):
            return CypherParser.RULE_limitClause

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

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




    def limitClause(self):

        localctx = CypherParser.LimitClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_limitClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 123
            self.match(CypherParser.Limit)
            self.state = 124
            self.match(CypherParser.INTEGER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class PathContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def node(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(CypherParser.NodeContext)
            else:
                return self.getTypedRuleContext(CypherParser.NodeContext,i)


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

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

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

        def relationship(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(CypherParser.RelationshipContext)
            else:
                return self.getTypedRuleContext(CypherParser.RelationshipContext,i)


        def getRuleIndex(self):
            return CypherParser.RULE_path

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

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




    def path(self):

        localctx = CypherParser.PathContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_path)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 126
            self.node()
            self.state = 147
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==CypherParser.TOLEFT or _la==CypherParser.UND:
                self.state = 142
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,16,self._ctx)
                if la_ == 1:
                    self.state = 127
                    self.match(CypherParser.TOLEFT)
                    self.state = 129
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==CypherParser.LSB:
                        self.state = 128
                        self.relationship()


                    self.state = 131
                    self.match(CypherParser.UND)
                    pass

                elif la_ == 2:
                    self.state = 132
                    self.match(CypherParser.UND)
                    self.state = 134
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==CypherParser.LSB:
                        self.state = 133
                        self.relationship()


                    self.state = 136
                    self.match(CypherParser.UND)
                    pass

                elif la_ == 3:
                    self.state = 137
                    self.match(CypherParser.UND)
                    self.state = 139
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==CypherParser.LSB:
                        self.state = 138
                        self.relationship()


                    self.state = 141
                    self.match(CypherParser.TORIGHT)
                    pass


                self.state = 144
                self.node()
                self.state = 149
                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 NodeContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def LP(self):
            return self.getToken(CypherParser.LP, 0)

        def RP(self):
            return self.getToken(CypherParser.RP, 0)

        def variable(self):
            return self.getTypedRuleContext(CypherParser.VariableContext,0)


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

        def nodeLabel(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(CypherParser.NodeLabelContext)
            else:
                return self.getTypedRuleContext(CypherParser.NodeLabelContext,i)


        def propertyConstraint(self):
            return self.getTypedRuleContext(CypherParser.PropertyConstraintContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_node

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

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




    def node(self):

        localctx = CypherParser.NodeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_node)
        self._la = 0 # Token type
        try:
            self.state = 179
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,23,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 150
                self.match(CypherParser.LP)
                self.state = 152
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==CypherParser.INTEGER or _la==CypherParser.STRING_LITERAL:
                    self.state = 151
                    self.variable()


                self.state = 156 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 154
                    self.match(CypherParser.COL)
                    self.state = 155
                    self.nodeLabel()
                    self.state = 158 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==CypherParser.COL):
                        break

                self.state = 161
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==CypherParser.LB:
                    self.state = 160
                    self.propertyConstraint()


                self.state = 163
                self.match(CypherParser.RP)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 165
                self.match(CypherParser.LP)
                self.state = 166
                self.variable()
                self.state = 171
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==CypherParser.COL:
                    self.state = 167
                    self.match(CypherParser.COL)
                    self.state = 168
                    self.nodeLabel()
                    self.state = 173
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 175
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==CypherParser.LB:
                    self.state = 174
                    self.propertyConstraint()


                self.state = 177
                self.match(CypherParser.RP)
                pass


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


    class NodeLabelContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def varString(self):
            return self.getTypedRuleContext(CypherParser.VarStringContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_nodeLabel

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

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




    def nodeLabel(self):

        localctx = CypherParser.NodeLabelContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_nodeLabel)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 181
            self.varString()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class PropertyConstraintContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def LB(self):
            return self.getToken(CypherParser.LB, 0)

        def nodeOrRelationshipProperty(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(CypherParser.NodeOrRelationshipPropertyContext)
            else:
                return self.getTypedRuleContext(CypherParser.NodeOrRelationshipPropertyContext,i)


        def RB(self):
            return self.getToken(CypherParser.RB, 0)

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

        def getRuleIndex(self):
            return CypherParser.RULE_propertyConstraint

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

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




    def propertyConstraint(self):

        localctx = CypherParser.PropertyConstraintContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_propertyConstraint)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 183
            self.match(CypherParser.LB)
            self.state = 184
            self.nodeOrRelationshipProperty()
            self.state = 189
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==CypherParser.COMMA:
                self.state = 185
                self.match(CypherParser.COMMA)
                self.state = 186
                self.nodeOrRelationshipProperty()
                self.state = 191
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 192
            self.match(CypherParser.RB)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class RelationshipContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def LSB(self):
            return self.getToken(CypherParser.LSB, 0)

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

        def relationshipLabel(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(CypherParser.RelationshipLabelContext)
            else:
                return self.getTypedRuleContext(CypherParser.RelationshipLabelContext,i)


        def RSB(self):
            return self.getToken(CypherParser.RSB, 0)

        def variable(self):
            return self.getTypedRuleContext(CypherParser.VariableContext,0)


        def OR(self):
            return self.getToken(CypherParser.OR, 0)

        def propertyConstraint(self):
            return self.getTypedRuleContext(CypherParser.PropertyConstraintContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_relationship

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

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




    def relationship(self):

        localctx = CypherParser.RelationshipContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_relationship)
        self._la = 0 # Token type
        try:
            self.state = 226
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,31,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 194
                self.match(CypherParser.LSB)
                self.state = 196
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==CypherParser.INTEGER or _la==CypherParser.STRING_LITERAL:
                    self.state = 195
                    self.variable()


                self.state = 198
                self.match(CypherParser.COL)
                self.state = 199
                self.relationshipLabel()
                self.state = 203
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==CypherParser.OR:
                    self.state = 200
                    self.match(CypherParser.OR)
                    self.state = 201
                    self.match(CypherParser.COL)
                    self.state = 202
                    self.relationshipLabel()


                self.state = 206
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==CypherParser.LB:
                    self.state = 205
                    self.propertyConstraint()


                self.state = 208
                self.match(CypherParser.RSB)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 210
                self.match(CypherParser.LSB)
                self.state = 211
                self.variable()
                self.state = 222
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==CypherParser.COL:
                    self.state = 212
                    self.match(CypherParser.COL)
                    self.state = 213
                    self.relationshipLabel()
                    self.state = 217
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==CypherParser.OR:
                        self.state = 214
                        self.match(CypherParser.OR)
                        self.state = 215
                        self.match(CypherParser.COL)
                        self.state = 216
                        self.relationshipLabel()


                    self.state = 220
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==CypherParser.LB:
                        self.state = 219
                        self.propertyConstraint()




                self.state = 224
                self.match(CypherParser.RSB)
                pass


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


    class RelationshipLabelContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def varString(self):
            return self.getTypedRuleContext(CypherParser.VarStringContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_relationshipLabel

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

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




    def relationshipLabel(self):

        localctx = CypherParser.RelationshipLabelContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_relationshipLabel)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 228
            self.varString()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ConstraintContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def symbolOP(self):
            return self.getTypedRuleContext(CypherParser.SymbolOPContext,0)


        def value(self):
            return self.getTypedRuleContext(CypherParser.ValueContext,0)


        def variableAttribute(self):
            return self.getTypedRuleContext(CypherParser.VariableAttributeContext,0)


        def variable(self):
            return self.getTypedRuleContext(CypherParser.VariableContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_constraint

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

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




    def constraint(self):

        localctx = CypherParser.ConstraintContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_constraint)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 232
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,32,self._ctx)
            if la_ == 1:
                self.state = 230
                self.variableAttribute()
                pass

            elif la_ == 2:
                self.state = 231
                self.variable()
                pass


            self.state = 234
            self.symbolOP()
            self.state = 235
            self.value()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AliasContext(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.getTypedRuleContext(CypherParser.VariableContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_alias

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

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




    def alias(self):

        localctx = CypherParser.AliasContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_alias)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 237
            self.variable()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SymbolOPContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def EQ(self):
            return self.getToken(CypherParser.EQ, 0)

        def NEQ(self):
            return self.getToken(CypherParser.NEQ, 0)

        def GTE(self):
            return self.getToken(CypherParser.GTE, 0)

        def GT(self):
            return self.getToken(CypherParser.GT, 0)

        def LTE(self):
            return self.getToken(CypherParser.LTE, 0)

        def LT(self):
            return self.getToken(CypherParser.LT, 0)

        def getRuleIndex(self):
            return CypherParser.RULE_symbolOP

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

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




    def symbolOP(self):

        localctx = CypherParser.SymbolOPContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_symbolOP)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 239
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CypherParser.EQ) | (1 << CypherParser.NEQ) | (1 << CypherParser.GTE) | (1 << CypherParser.GT) | (1 << CypherParser.LTE) | (1 << CypherParser.LT))) != 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 LogicOPContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def And(self):
            return self.getToken(CypherParser.And, 0)

        def Or(self):
            return self.getToken(CypherParser.Or, 0)

        def getRuleIndex(self):
            return CypherParser.RULE_logicOP

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

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




    def logicOP(self):

        localctx = CypherParser.LogicOPContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_logicOP)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 241
            _la = self._input.LA(1)
            if not(_la==CypherParser.And or _la==CypherParser.Or):
                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 VariableContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def varString(self):
            return self.getTypedRuleContext(CypherParser.VarStringContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_variable

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

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




    def variable(self):

        localctx = CypherParser.VariableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_variable)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 243
            self.varString()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class VariableAttributeContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def variable(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(CypherParser.VariableContext)
            else:
                return self.getTypedRuleContext(CypherParser.VariableContext,i)


        def DOT(self):
            return self.getToken(CypherParser.DOT, 0)

        def getRuleIndex(self):
            return CypherParser.RULE_variableAttribute

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

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




    def variableAttribute(self):

        localctx = CypherParser.VariableAttributeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_variableAttribute)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 245
            self.variable()
            self.state = 246
            self.match(CypherParser.DOT)
            self.state = 247
            self.variable()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NodeOrRelationshipPropertyContext(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.getTypedRuleContext(CypherParser.VariableContext,0)


        def COL(self):
            return self.getToken(CypherParser.COL, 0)

        def value(self):
            return self.getTypedRuleContext(CypherParser.ValueContext,0)


        def getRuleIndex(self):
            return CypherParser.RULE_nodeOrRelationshipProperty

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

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




    def nodeOrRelationshipProperty(self):

        localctx = CypherParser.NodeOrRelationshipPropertyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_nodeOrRelationshipProperty)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 249
            self.variable()
            self.state = 250
            self.match(CypherParser.COL)
            self.state = 251
            self.value()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValueContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def string(self):
            return self.getTypedRuleContext(CypherParser.StringContext,0)


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

        def getRuleIndex(self):
            return CypherParser.RULE_value

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

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




    def value(self):

        localctx = CypherParser.ValueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_value)
        try:
            self.state = 258
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [CypherParser.DOT, CypherParser.INTEGER, CypherParser.STRING_SYMBOL, CypherParser.STRING_LITERAL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 253
                self.string()
                pass
            elif token in [CypherParser.SEP]:
                self.enterOuterAlt(localctx, 2)
                self.state = 254
                self.match(CypherParser.SEP)
                self.state = 255
                self.string()
                self.state = 256
                self.match(CypherParser.SEP)
                pass
            else:
                raise NoViableAltException(self)

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


    class VarStringContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

        def getRuleIndex(self):
            return CypherParser.RULE_varString

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

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




    def varString(self):

        localctx = CypherParser.VarStringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_varString)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 261 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 260
                _la = self._input.LA(1)
                if not(_la==CypherParser.INTEGER or _la==CypherParser.STRING_LITERAL):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 263 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==CypherParser.INTEGER or _la==CypherParser.STRING_LITERAL):
                    break

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


    class StringContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

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

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

        def getRuleIndex(self):
            return CypherParser.RULE_string

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

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




    def string(self):

        localctx = CypherParser.StringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_string)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 266 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 265
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CypherParser.DOT) | (1 << CypherParser.INTEGER) | (1 << CypherParser.STRING_SYMBOL) | (1 << CypherParser.STRING_LITERAL))) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 268 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CypherParser.DOT) | (1 << CypherParser.INTEGER) | (1 << CypherParser.STRING_SYMBOL) | (1 << CypherParser.STRING_LITERAL))) != 0)):
                    break

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





