# Generated from /home/factory/.cache/bazel/_bazel_factory/9557ad0d5eff83fe4540f03ccc7a1f9a/sandbox/linux-sandbox/11/execroot/vaticle_typeql/bazel-out/k8-fastbuild/bin/grammar/python/TypeQLPython.g4 by ANTLR 4.8
# 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\3b")
        buf.write("\u0276\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\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36")
        buf.write("\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t")
        buf.write("&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4,\t,\4-\t-\4.\t.\4")
        buf.write("/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t\64")
        buf.write("\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t")
        buf.write(";\4<\t<\4=\t=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\t")
        buf.write("D\4E\tE\4F\tF\4G\tG\4H\tH\4I\tI\4J\tJ\3\2\3\2\3\2\3\3")
        buf.write("\6\3\u0099\n\3\r\3\16\3\u009a\3\3\3\3\3\4\3\4\3\4\3\5")
        buf.write("\3\5\3\5\3\6\3\6\3\6\3\7\3\7\3\7\3\b\3\b\3\b\3\t\3\t\3")
        buf.write("\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\5\n\u00ba\n\n\3")
        buf.write("\13\3\13\3\13\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\r\3\r")
        buf.write("\5\r\u00c9\n\r\3\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17")
        buf.write("\3\17\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\22\3\22\3\22")
        buf.write("\3\23\3\23\3\23\3\23\3\24\3\24\3\24\5\24\u00e5\n\24\3")
        buf.write("\24\3\24\3\24\5\24\u00ea\n\24\3\24\3\24\3\24\5\24\u00ef")
        buf.write("\n\24\3\24\3\24\3\24\5\24\u00f4\n\24\3\25\3\25\3\25\3")
        buf.write("\25\7\25\u00fa\n\25\f\25\16\25\u00fd\13\25\3\26\3\26\3")
        buf.write("\26\3\26\7\26\u0103\n\26\f\26\16\26\u0106\13\26\3\27\3")
        buf.write("\27\5\27\u010a\n\27\3\30\3\30\3\30\3\31\3\31\3\31\3\32")
        buf.write("\3\32\5\32\u0114\n\32\3\32\3\32\3\33\3\33\3\34\3\34\3")
        buf.write("\34\3\34\3\35\3\35\3\35\6\35\u0121\n\35\r\35\16\35\u0122")
        buf.write("\3\36\3\36\5\36\u0127\n\36\3\37\3\37\3\37\6\37\u012c\n")
        buf.write("\37\r\37\16\37\u012d\3 \3 \3 \3 \5 \u0134\n \3!\3!\3!")
        buf.write("\3!\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\6\"\u0142\n\"\r\"")
        buf.write("\16\"\u0143\3#\3#\3#\3#\3#\3$\3$\3$\3$\5$\u014f\n$\3%")
        buf.write("\3%\3%\3%\3&\3&\3&\3&\7&\u0159\n&\f&\16&\u015c\13&\3\'")
        buf.write("\3\'\3\'\3\'\3\'\3\'\3\'\5\'\u0165\n\'\3\'\3\'\3\'\3\'")
        buf.write("\3\'\3\'\5\'\u016d\n\'\3\'\3\'\3\'\3\'\5\'\u0173\n\'\3")
        buf.write("\'\3\'\3\'\3\'\3\'\3\'\5\'\u017b\n\'\3(\5(\u017e\n(\3")
        buf.write("(\5(\u0181\n(\3)\3)\3)\3)\3)\5)\u0188\n)\3*\3*\3*\6*\u018d")
        buf.write("\n*\r*\16*\u018e\3+\3+\3+\5+\u0194\n+\3,\3,\3,\3,\3,\5")
        buf.write(",\u019b\n,\3,\3,\3,\3,\3,\5,\u01a2\n,\3,\3,\5,\u01a6\n")
        buf.write(",\3-\5-\u01a9\n-\3-\3-\3-\3-\3-\5-\u01b0\n-\3-\5-\u01b3")
        buf.write("\n-\3-\3-\5-\u01b7\n-\5-\u01b9\n-\3.\5.\u01bc\n.\3.\3")
        buf.write(".\3.\3.\3.\5.\u01c3\n.\3.\5.\u01c6\n.\3.\3.\5.\u01ca\n")
        buf.write(".\5.\u01cc\n.\3/\3/\3/\3/\7/\u01d2\n/\f/\16/\u01d5\13")
        buf.write("/\3/\3/\3\60\3\60\3\60\3\60\3\60\5\60\u01de\n\60\3\61")
        buf.write("\3\61\3\62\3\62\3\62\7\62\u01e5\n\62\f\62\16\62\u01e8")
        buf.write("\13\62\3\63\3\63\3\63\3\63\3\63\5\63\u01ef\n\63\3\63\3")
        buf.write("\63\5\63\u01f3\n\63\3\64\3\64\3\64\3\64\3\64\3\64\3\64")
        buf.write("\5\64\u01fc\n\64\3\65\3\65\3\66\3\66\3\67\3\67\3\67\5")
        buf.write("\67\u0205\n\67\38\38\38\38\38\38\38\38\38\38\38\38\78")
        buf.write("\u0213\n8\f8\168\u0216\138\39\39\39\39\39\39\39\39\59")
        buf.write("\u0220\n9\3:\3:\3:\5:\u0225\n:\3:\3:\3;\3;\3<\3<\3<\7")
        buf.write("<\u022e\n<\f<\16<\u0231\13<\3=\3=\3=\3=\3=\3=\3=\3=\3")
        buf.write("=\3=\3=\3=\3=\3=\3=\5=\u0242\n=\3>\3>\3>\5>\u0247\n>\3")
        buf.write("?\3?\5?\u024b\n?\3@\3@\5@\u024f\n@\3A\3A\5A\u0253\nA\3")
        buf.write("B\3B\3C\3C\3C\5C\u025a\nC\3D\3D\3E\3E\3F\3F\3F\3F\3F\3")
        buf.write("F\5F\u0266\nF\3G\5G\u0269\nG\3G\3G\3H\5H\u026e\nH\3H\3")
        buf.write("H\3I\3I\3J\3J\3J\2\3nK\2\4\6\b\n\f\16\20\22\24\26\30\32")
        buf.write("\34\36 \"$&(*,.\60\62\64\668:<>@BDFHJLNPRTVXZ\\^`bdfh")
        buf.write("jlnprtvxz|~\u0080\u0082\u0084\u0086\u0088\u008a\u008c")
        buf.write("\u008e\u0090\u0092\2\f\4\2YY\\\\\3\2EK\4\2\62\67::\3\2")
        buf.write("89\4\2=>@@\3\2;<\4\2CCFG\3\2\17\23\3\2LP\7\2\t\t\24\27")
        buf.write("..99CK\2\u0289\2\u0094\3\2\2\2\4\u0098\3\2\2\2\6\u009e")
        buf.write("\3\2\2\2\b\u00a1\3\2\2\2\n\u00a4\3\2\2\2\f\u00a7\3\2\2")
        buf.write("\2\16\u00aa\3\2\2\2\20\u00ad\3\2\2\2\22\u00b9\3\2\2\2")
        buf.write("\24\u00bb\3\2\2\2\26\u00be\3\2\2\2\30\u00c8\3\2\2\2\32")
        buf.write("\u00ca\3\2\2\2\34\u00ce\3\2\2\2\36\u00d3\3\2\2\2 \u00d7")
        buf.write("\3\2\2\2\"\u00da\3\2\2\2$\u00dd\3\2\2\2&\u00e4\3\2\2\2")
        buf.write("(\u00f5\3\2\2\2*\u00fe\3\2\2\2,\u0107\3\2\2\2.\u010b\3")
        buf.write("\2\2\2\60\u010e\3\2\2\2\62\u0111\3\2\2\2\64\u0117\3\2")
        buf.write("\2\2\66\u0119\3\2\2\28\u0120\3\2\2\2:\u0126\3\2\2\2<\u012b")
        buf.write("\3\2\2\2>\u0133\3\2\2\2@\u0135\3\2\2\2B\u0139\3\2\2\2")
        buf.write("D\u0145\3\2\2\2F\u014e\3\2\2\2H\u0150\3\2\2\2J\u0154\3")
        buf.write("\2\2\2L\u017a\3\2\2\2N\u017d\3\2\2\2P\u0187\3\2\2\2R\u018c")
        buf.write("\3\2\2\2T\u0193\3\2\2\2V\u01a5\3\2\2\2X\u01b8\3\2\2\2")
        buf.write("Z\u01cb\3\2\2\2\\\u01cd\3\2\2\2^\u01dd\3\2\2\2`\u01df")
        buf.write("\3\2\2\2b\u01e1\3\2\2\2d\u01f2\3\2\2\2f\u01fb\3\2\2\2")
        buf.write("h\u01fd\3\2\2\2j\u01ff\3\2\2\2l\u0204\3\2\2\2n\u0206\3")
        buf.write("\2\2\2p\u021f\3\2\2\2r\u0221\3\2\2\2t\u0228\3\2\2\2v\u022a")
        buf.write("\3\2\2\2x\u0241\3\2\2\2z\u0246\3\2\2\2|\u024a\3\2\2\2")
        buf.write("~\u024e\3\2\2\2\u0080\u0252\3\2\2\2\u0082\u0254\3\2\2")
        buf.write("\2\u0084\u0259\3\2\2\2\u0086\u025b\3\2\2\2\u0088\u025d")
        buf.write("\3\2\2\2\u008a\u0265\3\2\2\2\u008c\u0268\3\2\2\2\u008e")
        buf.write("\u026d\3\2\2\2\u0090\u0271\3\2\2\2\u0092\u0273\3\2\2\2")
        buf.write("\u0094\u0095\5\22\n\2\u0095\u0096\7\2\2\3\u0096\3\3\2")
        buf.write("\2\2\u0097\u0099\5\22\n\2\u0098\u0097\3\2\2\2\u0099\u009a")
        buf.write("\3\2\2\2\u009a\u0098\3\2\2\2\u009a\u009b\3\2\2\2\u009b")
        buf.write("\u009c\3\2\2\2\u009c\u009d\7\2\2\3\u009d\5\3\2\2\2\u009e")
        buf.write("\u009f\5> \2\u009f\u00a0\7\2\2\3\u00a0\7\3\2\2\2\u00a1")
        buf.write("\u00a2\5<\37\2\u00a2\u00a3\7\2\2\3\u00a3\t\3\2\2\2\u00a4")
        buf.write("\u00a5\58\35\2\u00a5\u00a6\7\2\2\3\u00a6\13\3\2\2\2\u00a7")
        buf.write("\u00a8\5F$\2\u00a8\u00a9\7\2\2\3\u00a9\r\3\2\2\2\u00aa")
        buf.write("\u00ab\5\u0084C\2\u00ab\u00ac\7\2\2\3\u00ac\17\3\2\2\2")
        buf.write("\u00ad\u00ae\5x=\2\u00ae\u00af\7\2\2\3\u00af\21\3\2\2")
        buf.write("\2\u00b0\u00ba\5\24\13\2\u00b1\u00ba\5\26\f\2\u00b2\u00ba")
        buf.write("\5\30\r\2\u00b3\u00ba\5\32\16\2\u00b4\u00ba\5\34\17\2")
        buf.write("\u00b5\u00ba\5\36\20\2\u00b6\u00ba\5 \21\2\u00b7\u00ba")
        buf.write("\5\"\22\2\u00b8\u00ba\5$\23\2\u00b9\u00b0\3\2\2\2\u00b9")
        buf.write("\u00b1\3\2\2\2\u00b9\u00b2\3\2\2\2\u00b9\u00b3\3\2\2\2")
        buf.write("\u00b9\u00b4\3\2\2\2\u00b9\u00b5\3\2\2\2\u00b9\u00b6\3")
        buf.write("\2\2\2\u00b9\u00b7\3\2\2\2\u00b9\u00b8\3\2\2\2\u00ba\23")
        buf.write("\3\2\2\2\u00bb\u00bc\7\n\2\2\u00bc\u00bd\58\35\2\u00bd")
        buf.write("\25\3\2\2\2\u00be\u00bf\7\13\2\2\u00bf\u00c0\58\35\2\u00c0")
        buf.write("\27\3\2\2\2\u00c1\u00c2\7\b\2\2\u00c2\u00c3\5<\37\2\u00c3")
        buf.write("\u00c4\7\f\2\2\u00c4\u00c5\5R*\2\u00c5\u00c9\3\2\2\2\u00c6")
        buf.write("\u00c7\7\f\2\2\u00c7\u00c9\5R*\2\u00c8\u00c1\3\2\2\2\u00c8")
        buf.write("\u00c6\3\2\2\2\u00c9\31\3\2\2\2\u00ca\u00cb\5\34\17\2")
        buf.write("\u00cb\u00cc\7\f\2\2\u00cc\u00cd\5R*\2\u00cd\33\3\2\2")
        buf.write("\2\u00ce\u00cf\7\b\2\2\u00cf\u00d0\5<\37\2\u00d0\u00d1")
        buf.write("\7\r\2\2\u00d1\u00d2\5R*\2\u00d2\35\3\2\2\2\u00d3\u00d4")
        buf.write("\7\b\2\2\u00d4\u00d5\5<\37\2\u00d5\u00d6\5&\24\2\u00d6")
        buf.write("\37\3\2\2\2\u00d7\u00d8\5\36\20\2\u00d8\u00d9\5\62\32")
        buf.write("\2\u00d9!\3\2\2\2\u00da\u00db\5\36\20\2\u00db\u00dc\5")
        buf.write("\66\34\2\u00dc#\3\2\2\2\u00dd\u00de\5\36\20\2\u00de\u00df")
        buf.write("\5\66\34\2\u00df\u00e0\5\62\32\2\u00e0%\3\2\2\2\u00e1")
        buf.write("\u00e2\5(\25\2\u00e2\u00e3\7\3\2\2\u00e3\u00e5\3\2\2\2")
        buf.write("\u00e4\u00e1\3\2\2\2\u00e4\u00e5\3\2\2\2\u00e5\u00e9\3")
        buf.write("\2\2\2\u00e6\u00e7\5*\26\2\u00e7\u00e8\7\3\2\2\u00e8\u00ea")
        buf.write("\3\2\2\2\u00e9\u00e6\3\2\2\2\u00e9\u00ea\3\2\2\2\u00ea")
        buf.write("\u00ee\3\2\2\2\u00eb\u00ec\5.\30\2\u00ec\u00ed\7\3\2\2")
        buf.write("\u00ed\u00ef\3\2\2\2\u00ee\u00eb\3\2\2\2\u00ee\u00ef\3")
        buf.write("\2\2\2\u00ef\u00f3\3\2\2\2\u00f0\u00f1\5\60\31\2\u00f1")
        buf.write("\u00f2\7\3\2\2\u00f2\u00f4\3\2\2\2\u00f3\u00f0\3\2\2\2")
        buf.write("\u00f3\u00f4\3\2\2\2\u00f4\'\3\2\2\2\u00f5\u00f6\7\t\2")
        buf.write("\2\u00f6\u00fb\t\2\2\2\u00f7\u00f8\7\4\2\2\u00f8\u00fa")
        buf.write("\t\2\2\2\u00f9\u00f7\3\2\2\2\u00fa\u00fd\3\2\2\2\u00fb")
        buf.write("\u00f9\3\2\2\2\u00fb\u00fc\3\2\2\2\u00fc)\3\2\2\2\u00fd")
        buf.write("\u00fb\3\2\2\2\u00fe\u00ff\7\27\2\2\u00ff\u0104\5,\27")
        buf.write("\2\u0100\u0101\7\4\2\2\u0101\u0103\5,\27\2\u0102\u0100")
        buf.write("\3\2\2\2\u0103\u0106\3\2\2\2\u0104\u0102\3\2\2\2\u0104")
        buf.write("\u0105\3\2\2\2\u0105+\3\2\2\2\u0106\u0104\3\2\2\2\u0107")
        buf.write("\u0109\t\2\2\2\u0108\u010a\7\30\2\2\u0109\u0108\3\2\2")
        buf.write("\2\u0109\u010a\3\2\2\2\u010a-\3\2\2\2\u010b\u010c\7\25")
        buf.write("\2\2\u010c\u010d\7U\2\2\u010d/\3\2\2\2\u010e\u010f\7\26")
        buf.write("\2\2\u010f\u0110\7U\2\2\u0110\61\3\2\2\2\u0111\u0113\5")
        buf.write("\64\33\2\u0112\u0114\t\2\2\2\u0113\u0112\3\2\2\2\u0113")
        buf.write("\u0114\3\2\2\2\u0114\u0115\3\2\2\2\u0115\u0116\7\3\2\2")
        buf.write("\u0116\63\3\2\2\2\u0117\u0118\t\3\2\2\u0118\65\3\2\2\2")
        buf.write("\u0119\u011a\7D\2\2\u011a\u011b\t\2\2\2\u011b\u011c\7")
        buf.write("\3\2\2\u011c\67\3\2\2\2\u011d\u011e\5:\36\2\u011e\u011f")
        buf.write("\7\3\2\2\u011f\u0121\3\2\2\2\u0120\u011d\3\2\2\2\u0121")
        buf.write("\u0122\3\2\2\2\u0122\u0120\3\2\2\2\u0122\u0123\3\2\2\2")
        buf.write("\u01239\3\2\2\2\u0124\u0127\5J&\2\u0125\u0127\5x=\2\u0126")
        buf.write("\u0124\3\2\2\2\u0126\u0125\3\2\2\2\u0127;\3\2\2\2\u0128")
        buf.write("\u0129\5> \2\u0129\u012a\7\3\2\2\u012a\u012c\3\2\2\2\u012b")
        buf.write("\u0128\3\2\2\2\u012c\u012d\3\2\2\2\u012d\u012b\3\2\2\2")
        buf.write("\u012d\u012e\3\2\2\2\u012e=\3\2\2\2\u012f\u0134\5F$\2")
        buf.write("\u0130\u0134\5@!\2\u0131\u0134\5B\"\2\u0132\u0134\5D#")
        buf.write("\2\u0133\u012f\3\2\2\2\u0133\u0130\3\2\2\2\u0133\u0131")
        buf.write("\3\2\2\2\u0133\u0132\3\2\2\2\u0134?\3\2\2\2\u0135\u0136")
        buf.write("\7\5\2\2\u0136\u0137\5<\37\2\u0137\u0138\7\6\2\2\u0138")
        buf.write("A\3\2\2\2\u0139\u013a\7\5\2\2\u013a\u013b\5<\37\2\u013b")
        buf.write("\u0141\7\6\2\2\u013c\u013d\7\60\2\2\u013d\u013e\7\5\2")
        buf.write("\2\u013e\u013f\5<\37\2\u013f\u0140\7\6\2\2\u0140\u0142")
        buf.write("\3\2\2\2\u0141\u013c\3\2\2\2\u0142\u0143\3\2\2\2\u0143")
        buf.write("\u0141\3\2\2\2\u0143\u0144\3\2\2\2\u0144C\3\2\2\2\u0145")
        buf.write("\u0146\7\61\2\2\u0146\u0147\7\5\2\2\u0147\u0148\5<\37")
        buf.write("\2\u0148\u0149\7\6\2\2\u0149E\3\2\2\2\u014a\u014f\5H%")
        buf.write("\2\u014b\u014f\5J&\2\u014c\u014f\5T+\2\u014d\u014f\5P")
        buf.write(")\2\u014e\u014a\3\2\2\2\u014e\u014b\3\2\2\2\u014e\u014c")
        buf.write("\3\2\2\2\u014e\u014d\3\2\2\2\u014fG\3\2\2\2\u0150\u0151")
        buf.write("\7Y\2\2\u0151\u0152\7/\2\2\u0152\u0153\7Y\2\2\u0153I\3")
        buf.write("\2\2\2\u0154\u0155\5z>\2\u0155\u015a\5L\'\2\u0156\u0157")
        buf.write("\7\4\2\2\u0157\u0159\5L\'\2\u0158\u0156\3\2\2\2\u0159")
        buf.write("\u015c\3\2\2\2\u015a\u0158\3\2\2\2\u015a\u015b\3\2\2\2")
        buf.write("\u015bK\3\2\2\2\u015c\u015a\3\2\2\2\u015d\u017b\7\34\2")
        buf.write("\2\u015e\u015f\7\35\2\2\u015f\u017b\5z>\2\u0160\u0161")
        buf.write("\7 \2\2\u0161\u0164\5~@\2\u0162\u0163\7\"\2\2\u0163\u0165")
        buf.write("\5~@\2\u0164\u0162\3\2\2\2\u0164\u0165\3\2\2\2\u0165\u0166")
        buf.write("\3\2\2\2\u0166\u0167\5N(\2\u0167\u017b\3\2\2\2\u0168\u0169")
        buf.write("\7$\2\2\u0169\u016c\5~@\2\u016a\u016b\7\"\2\2\u016b\u016d")
        buf.write("\5~@\2\u016c\u016a\3\2\2\2\u016c\u016d\3\2\2\2\u016d\u017b")
        buf.write("\3\2\2\2\u016e\u016f\7#\2\2\u016f\u0172\5|?\2\u0170\u0171")
        buf.write("\7\"\2\2\u0171\u0173\5~@\2\u0172\u0170\3\2\2\2\u0172\u0173")
        buf.write("\3\2\2\2\u0173\u017b\3\2\2\2\u0174\u0175\7.\2\2\u0175")
        buf.write("\u017b\5\u0088E\2\u0176\u0177\7!\2\2\u0177\u017b\7T\2")
        buf.write("\2\u0178\u0179\7\33\2\2\u0179\u017b\5\u0080A\2\u017a\u015d")
        buf.write("\3\2\2\2\u017a\u015e\3\2\2\2\u017a\u0160\3\2\2\2\u017a")
        buf.write("\u0168\3\2\2\2\u017a\u016e\3\2\2\2\u017a\u0174\3\2\2\2")
        buf.write("\u017a\u0176\3\2\2\2\u017a\u0178\3\2\2\2\u017bM\3\2\2")
        buf.write("\2\u017c\u017e\7\'\2\2\u017d\u017c\3\2\2\2\u017d\u017e")
        buf.write("\3\2\2\2\u017e\u0180\3\2\2\2\u017f\u0181\7(\2\2\u0180")
        buf.write("\u017f\3\2\2\2\u0180\u0181\3\2\2\2\u0181O\3\2\2\2\u0182")
        buf.write("\u0183\7\\\2\2\u0183\u0184\7:\2\2\u0184\u0188\5n8\2\u0185")
        buf.write("\u0186\7\\\2\2\u0186\u0188\5f\64\2\u0187\u0182\3\2\2\2")
        buf.write("\u0187\u0185\3\2\2\2\u0188Q\3\2\2\2\u0189\u018a\5T+\2")
        buf.write("\u018a\u018b\7\3\2\2\u018b\u018d\3\2\2\2\u018c\u0189\3")
        buf.write("\2\2\2\u018d\u018e\3\2\2\2\u018e\u018c\3\2\2\2\u018e\u018f")
        buf.write("\3\2\2\2\u018fS\3\2\2\2\u0190\u0194\5V,\2\u0191\u0194")
        buf.write("\5X-\2\u0192\u0194\5Z.\2\u0193\u0190\3\2\2\2\u0193\u0191")
        buf.write("\3\2\2\2\u0193\u0192\3\2\2\2\u0194U\3\2\2\2\u0195\u0196")
        buf.write("\7Y\2\2\u0196\u0197\7*\2\2\u0197\u019a\5~@\2\u0198\u0199")
        buf.write("\7\4\2\2\u0199\u019b\5b\62\2\u019a\u0198\3\2\2\2\u019a")
        buf.write("\u019b\3\2\2\2\u019b\u01a6\3\2\2\2\u019c\u019d\7Y\2\2")
        buf.write("\u019d\u019e\7)\2\2\u019e\u01a1\7]\2\2\u019f\u01a0\7\4")
        buf.write("\2\2\u01a0\u01a2\5b\62\2\u01a1\u019f\3\2\2\2\u01a1\u01a2")
        buf.write("\3\2\2\2\u01a2\u01a6\3\2\2\2\u01a3\u01a4\7Y\2\2\u01a4")
        buf.write("\u01a6\5b\62\2\u01a5\u0195\3\2\2\2\u01a5\u019c\3\2\2\2")
        buf.write("\u01a5\u01a3\3\2\2\2\u01a6W\3\2\2\2\u01a7\u01a9\7Y\2\2")
        buf.write("\u01a8\u01a7\3\2\2\2\u01a8\u01a9\3\2\2\2\u01a9\u01aa\3")
        buf.write("\2\2\2\u01aa\u01ab\5\\/\2\u01ab\u01ac\7*\2\2\u01ac\u01af")
        buf.write("\5~@\2\u01ad\u01ae\7\4\2\2\u01ae\u01b0\5b\62\2\u01af\u01ad")
        buf.write("\3\2\2\2\u01af\u01b0\3\2\2\2\u01b0\u01b9\3\2\2\2\u01b1")
        buf.write("\u01b3\7Y\2\2\u01b2\u01b1\3\2\2\2\u01b2\u01b3\3\2\2\2")
        buf.write("\u01b3\u01b4\3\2\2\2\u01b4\u01b6\5\\/\2\u01b5\u01b7\5")
        buf.write("b\62\2\u01b6\u01b5\3\2\2\2\u01b6\u01b7\3\2\2\2\u01b7\u01b9")
        buf.write("\3\2\2\2\u01b8\u01a8\3\2\2\2\u01b8\u01b2\3\2\2\2\u01b9")
        buf.write("Y\3\2\2\2\u01ba\u01bc\7Y\2\2\u01bb\u01ba\3\2\2\2\u01bb")
        buf.write("\u01bc\3\2\2\2\u01bc\u01bd\3\2\2\2\u01bd\u01be\5f\64\2")
        buf.write("\u01be\u01bf\7*\2\2\u01bf\u01c2\5~@\2\u01c0\u01c1\7\4")
        buf.write("\2\2\u01c1\u01c3\5b\62\2\u01c2\u01c0\3\2\2\2\u01c2\u01c3")
        buf.write("\3\2\2\2\u01c3\u01cc\3\2\2\2\u01c4\u01c6\7Y\2\2\u01c5")
        buf.write("\u01c4\3\2\2\2\u01c5\u01c6\3\2\2\2\u01c6\u01c7\3\2\2\2")
        buf.write("\u01c7\u01c9\5f\64\2\u01c8\u01ca\5b\62\2\u01c9\u01c8\3")
        buf.write("\2\2\2\u01c9\u01ca\3\2\2\2\u01ca\u01cc\3\2\2\2\u01cb\u01bb")
        buf.write("\3\2\2\2\u01cb\u01c5\3\2\2\2\u01cc[\3\2\2\2\u01cd\u01ce")
        buf.write("\7A\2\2\u01ce\u01d3\5^\60\2\u01cf\u01d0\7\4\2\2\u01d0")
        buf.write("\u01d2\5^\60\2\u01d1\u01cf\3\2\2\2\u01d2\u01d5\3\2\2\2")
        buf.write("\u01d3\u01d1\3\2\2\2\u01d3\u01d4\3\2\2\2\u01d4\u01d6\3")
        buf.write("\2\2\2\u01d5\u01d3\3\2\2\2\u01d6\u01d7\7B\2\2\u01d7]\3")
        buf.write("\2\2\2\u01d8\u01d9\5~@\2\u01d9\u01da\7\7\2\2\u01da\u01db")
        buf.write("\5`\61\2\u01db\u01de\3\2\2\2\u01dc\u01de\5`\61\2\u01dd")
        buf.write("\u01d8\3\2\2\2\u01dd\u01dc\3\2\2\2\u01de_\3\2\2\2\u01df")
        buf.write("\u01e0\7Y\2\2\u01e0a\3\2\2\2\u01e1\u01e6\5d\63\2\u01e2")
        buf.write("\u01e3\7\4\2\2\u01e3\u01e5\5d\63\2\u01e4\u01e2\3\2\2\2")
        buf.write("\u01e5\u01e8\3\2\2\2\u01e6\u01e4\3\2\2\2\u01e6\u01e7\3")
        buf.write("\2\2\2\u01e7c\3\2\2\2\u01e8\u01e6\3\2\2\2\u01e9\u01ea")
        buf.write("\7-\2\2\u01ea\u01ee\5\u0084C\2\u01eb\u01ef\7Y\2\2\u01ec")
        buf.write("\u01ef\7\\\2\2\u01ed\u01ef\5f\64\2\u01ee\u01eb\3\2\2\2")
        buf.write("\u01ee\u01ec\3\2\2\2\u01ee\u01ed\3\2\2\2\u01ef\u01f3\3")
        buf.write("\2\2\2\u01f0\u01f1\7-\2\2\u01f1\u01f3\7Y\2\2\u01f2\u01e9")
        buf.write("\3\2\2\2\u01f2\u01f0\3\2\2\2\u01f3e\3\2\2\2\u01f4\u01fc")
        buf.write("\5\u008aF\2\u01f5\u01f6\5h\65\2\u01f6\u01f7\5l\67\2\u01f7")
        buf.write("\u01fc\3\2\2\2\u01f8\u01f9\5j\66\2\u01f9\u01fa\7T\2\2")
        buf.write("\u01fa\u01fc\3\2\2\2\u01fb\u01f4\3\2\2\2\u01fb\u01f5\3")
        buf.write("\2\2\2\u01fb\u01f8\3\2\2\2\u01fcg\3\2\2\2\u01fd\u01fe")
        buf.write("\t\4\2\2\u01fei\3\2\2\2\u01ff\u0200\t\5\2\2\u0200k\3\2")
        buf.write("\2\2\u0201\u0205\5\u008aF\2\u0202\u0205\7Y\2\2\u0203\u0205")
        buf.write("\7\\\2\2\u0204\u0201\3\2\2\2\u0204\u0202\3\2\2\2\u0204")
        buf.write("\u0203\3\2\2\2\u0205m\3\2\2\2\u0206\u0207\b8\1\2\u0207")
        buf.write("\u0208\5p9\2\u0208\u0214\3\2\2\2\u0209\u020a\f\6\2\2\u020a")
        buf.write("\u020b\7?\2\2\u020b\u0213\5n8\6\u020c\u020d\f\5\2\2\u020d")
        buf.write("\u020e\t\6\2\2\u020e\u0213\5n8\6\u020f\u0210\f\4\2\2\u0210")
        buf.write("\u0211\t\7\2\2\u0211\u0213\5n8\5\u0212\u0209\3\2\2\2\u0212")
        buf.write("\u020c\3\2\2\2\u0212\u020f\3\2\2\2\u0213\u0216\3\2\2\2")
        buf.write("\u0214\u0212\3\2\2\2\u0214\u0215\3\2\2\2\u0215o\3\2\2")
        buf.write("\2\u0216\u0214\3\2\2\2\u0217\u0220\7Y\2\2\u0218\u0220")
        buf.write("\7\\\2\2\u0219\u0220\5r:\2\u021a\u0220\5\u008aF\2\u021b")
        buf.write("\u021c\7A\2\2\u021c\u021d\5n8\2\u021d\u021e\7B\2\2\u021e")
        buf.write("\u0220\3\2\2\2\u021f\u0217\3\2\2\2\u021f\u0218\3\2\2\2")
        buf.write("\u021f\u0219\3\2\2\2\u021f\u021a\3\2\2\2\u021f\u021b\3")
        buf.write("\2\2\2\u0220q\3\2\2\2\u0221\u0222\5t;\2\u0222\u0224\7")
        buf.write("A\2\2\u0223\u0225\5v<\2\u0224\u0223\3\2\2\2\u0224\u0225")
        buf.write("\3\2\2\2\u0225\u0226\3\2\2\2\u0226\u0227\7B\2\2\u0227")
        buf.write("s\3\2\2\2\u0228\u0229\t\b\2\2\u0229u\3\2\2\2\u022a\u022f")
        buf.write("\5n8\2\u022b\u022c\7\4\2\2\u022c\u022e\5n8\2\u022d\u022b")
        buf.write("\3\2\2\2\u022e\u0231\3\2\2\2\u022f\u022d\3\2\2\2\u022f")
        buf.write("\u0230\3\2\2\2\u0230w\3\2\2\2\u0231\u022f\3\2\2\2\u0232")
        buf.write("\u0233\7\24\2\2\u0233\u0242\5\u0084C\2\u0234\u0235\7\24")
        buf.write("\2\2\u0235\u0236\5\u0084C\2\u0236\u0237\7\7\2\2\u0237")
        buf.write("\u0238\7%\2\2\u0238\u0239\7\5\2\2\u0239\u023a\5<\37\2")
        buf.write("\u023a\u023b\7\6\2\2\u023b\u023c\7&\2\2\u023c\u023d\7")
        buf.write("\5\2\2\u023d\u023e\5T+\2\u023e\u023f\7\3\2\2\u023f\u0240")
        buf.write("\7\6\2\2\u0240\u0242\3\2\2\2\u0241\u0232\3\2\2\2\u0241")
        buf.write("\u0234\3\2\2\2\u0242y\3\2\2\2\u0243\u0247\5|?\2\u0244")
        buf.write("\u0247\5~@\2\u0245\u0247\7Y\2\2\u0246\u0243\3\2\2\2\u0246")
        buf.write("\u0244\3\2\2\2\u0246\u0245\3\2\2\2\u0247{\3\2\2\2\u0248")
        buf.write("\u024b\5\u0082B\2\u0249\u024b\7Y\2\2\u024a\u0248\3\2\2")
        buf.write("\2\u024a\u0249\3\2\2\2\u024b}\3\2\2\2\u024c\u024f\5\u0084")
        buf.write("C\2\u024d\u024f\7Y\2\2\u024e\u024c\3\2\2\2\u024e\u024d")
        buf.write("\3\2\2\2\u024f\177\3\2\2\2\u0250\u0253\5\u0082B\2\u0251")
        buf.write("\u0253\5\u0084C\2\u0252\u0250\3\2\2\2\u0252\u0251\3\2")
        buf.write("\2\2\u0253\u0081\3\2\2\2\u0254\u0255\7_\2\2\u0255\u0083")
        buf.write("\3\2\2\2\u0256\u025a\7^\2\2\u0257\u025a\5\u0086D\2\u0258")
        buf.write("\u025a\5\u0092J\2\u0259\u0256\3\2\2\2\u0259\u0257\3\2")
        buf.write("\2\2\u0259\u0258\3\2\2\2\u025a\u0085\3\2\2\2\u025b\u025c")
        buf.write("\t\t\2\2\u025c\u0087\3\2\2\2\u025d\u025e\t\n\2\2\u025e")
        buf.write("\u0089\3\2\2\2\u025f\u0266\7T\2\2\u0260\u0266\7Q\2\2\u0261")
        buf.write("\u0266\7W\2\2\u0262\u0266\7X\2\2\u0263\u0266\5\u008cG")
        buf.write("\2\u0264\u0266\5\u008eH\2\u0265\u025f\3\2\2\2\u0265\u0260")
        buf.write("\3\2\2\2\u0265\u0261\3\2\2\2\u0265\u0262\3\2\2\2\u0265")
        buf.write("\u0263\3\2\2\2\u0265\u0264\3\2\2\2\u0266\u008b\3\2\2\2")
        buf.write("\u0267\u0269\5\u0090I\2\u0268\u0267\3\2\2\2\u0268\u0269")
        buf.write("\3\2\2\2\u0269\u026a\3\2\2\2\u026a\u026b\7U\2\2\u026b")
        buf.write("\u008d\3\2\2\2\u026c\u026e\5\u0090I\2\u026d\u026c\3\2")
        buf.write("\2\2\u026d\u026e\3\2\2\2\u026e\u026f\3\2\2\2\u026f\u0270")
        buf.write("\7V\2\2\u0270\u008f\3\2\2\2\u0271\u0272\t\7\2\2\u0272")
        buf.write("\u0091\3\2\2\2\u0273\u0274\t\13\2\2\u0274\u0093\3\2\2")
        buf.write("\2?\u009a\u00b9\u00c8\u00e4\u00e9\u00ee\u00f3\u00fb\u0104")
        buf.write("\u0109\u0113\u0122\u0126\u012d\u0133\u0143\u014e\u015a")
        buf.write("\u0164\u016c\u0172\u017a\u017d\u0180\u0187\u018e\u0193")
        buf.write("\u019a\u01a1\u01a5\u01a8\u01af\u01b2\u01b6\u01b8\u01bb")
        buf.write("\u01c2\u01c5\u01c9\u01cb\u01d3\u01dd\u01e6\u01ee\u01f2")
        buf.write("\u01fb\u0204\u0212\u0214\u021f\u0224\u022f\u0241\u0246")
        buf.write("\u024a\u024e\u0252\u0259\u0265\u0268\u026d")
        return buf.getvalue()


class TypeQLPythonParser ( Parser ):

    grammarFileName = "TypeQLPython.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "';'", "','", "'{'", "'}'", "':'", "'match'", 
                     "'get'", "'define'", "'undefine'", "'insert'", "'delete'", 
                     "'compute'", "'thing'", "'entity'", "'attribute'", 
                     "'relation'", "'role'", "'rule'", "'offset'", "'limit'", 
                     "'sort'", "<INVALID>", "'asc'", "'desc'", "'type'", 
                     "'abstract'", "<INVALID>", "'sub'", "'sub!'", "'owns'", 
                     "'regex'", "'as'", "'plays'", "'relates'", "'when'", 
                     "'then'", "'@key'", "'@unique'", "'iid'", "<INVALID>", 
                     "'isa'", "'isa!'", "'has'", "'value'", "'is'", "'or'", 
                     "'not'", "'=='", "'!='", "'>'", "'>='", "'<'", "'<='", 
                     "'like'", "'contains'", "'='", "'+'", "'-'", "'/'", 
                     "'*'", "'^'", "'%'", "'('", "')'", "<INVALID>", "'group'", 
                     "'count'", "'max'", "'min'", "'mean'", "'median'", 
                     "'std'", "'sum'", "'long'", "'double'", "'string'", 
                     "'boolean'", "'datetime'", "<INVALID>", "'true'", "'false'", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "'$_'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "MATCH", "GET", "DEFINE", 
                      "UNDEFINE", "INSERT", "DELETE", "COMPUTE", "THING", 
                      "ENTITY", "ATTRIBUTE", "RELATION", "ROLE", "RULE", 
                      "OFFSET", "LIMIT", "SORT", "ORDER_", "ASC", "DESC", 
                      "TYPE", "ABSTRACT", "SUB_", "SUB", "SUBX", "OWNS", 
                      "REGEX", "AS", "PLAYS", "RELATES", "WHEN", "THEN", 
                      "ANNOTATION_KEY", "ANNOTATION_UNIQUE", "IID", "ISA_", 
                      "ISA", "ISAX", "HAS", "VALUE", "IS", "OR", "NOT", 
                      "EQ", "NEQ", "GT", "GTE", "LT", "LTE", "LIKE", "CONTAINS", 
                      "ASSIGN", "ADD", "SUBTRACT", "DIVIDE", "MULTIPLY", 
                      "POWER", "MODULO", "PAREN_OPEN", "PAREN_CLOSE", "EXPR_FUNC_NAME", 
                      "GROUP", "COUNT", "MAX", "MIN", "MEAN", "MEDIAN", 
                      "STD", "SUM", "LONG", "DOUBLE", "STRING", "BOOLEAN", 
                      "DATETIME", "BOOLEAN_", "TRUE", "FALSE", "STRING_", 
                      "LONG_", "DOUBLE_", "DATE_", "DATETIME_", "VAR_CONCEPT_", 
                      "VAR_CONCEPT_ANONYMOUS_", "VAR_CONCEPT_NAMED_", "VAR_VALUE_", 
                      "IID_", "LABEL_", "LABEL_SCOPED_", "COMMENT", "WS", 
                      "UNRECOGNISED" ]

    RULE_eof_query = 0
    RULE_eof_queries = 1
    RULE_eof_pattern = 2
    RULE_eof_patterns = 3
    RULE_eof_definables = 4
    RULE_eof_variable = 5
    RULE_eof_label = 6
    RULE_eof_schema_rule = 7
    RULE_query = 8
    RULE_query_define = 9
    RULE_query_undefine = 10
    RULE_query_insert = 11
    RULE_query_update = 12
    RULE_query_delete = 13
    RULE_query_match = 14
    RULE_query_match_aggregate = 15
    RULE_query_match_group = 16
    RULE_query_match_group_agg = 17
    RULE_modifiers = 18
    RULE_filter_ = 19
    RULE_sort = 20
    RULE_var_order = 21
    RULE_offset = 22
    RULE_limit = 23
    RULE_match_aggregate = 24
    RULE_aggregate_method = 25
    RULE_match_group = 26
    RULE_definables = 27
    RULE_definable = 28
    RULE_patterns = 29
    RULE_pattern = 30
    RULE_pattern_conjunction = 31
    RULE_pattern_disjunction = 32
    RULE_pattern_negation = 33
    RULE_pattern_variable = 34
    RULE_variable_concept = 35
    RULE_variable_type = 36
    RULE_type_constraint = 37
    RULE_annotations_owns = 38
    RULE_variable_value = 39
    RULE_variable_things = 40
    RULE_variable_thing_any = 41
    RULE_variable_thing = 42
    RULE_variable_relation = 43
    RULE_variable_attribute = 44
    RULE_relation = 45
    RULE_role_player = 46
    RULE_player = 47
    RULE_attributes = 48
    RULE_attribute = 49
    RULE_predicate = 50
    RULE_predicate_equality = 51
    RULE_predicate_substring = 52
    RULE_predicate_value = 53
    RULE_expression = 54
    RULE_expression_base = 55
    RULE_expression_function = 56
    RULE_expression_function_name = 57
    RULE_expression_arguments = 58
    RULE_schema_rule = 59
    RULE_type_any = 60
    RULE_type_scoped = 61
    RULE_type_ = 62
    RULE_label_any = 63
    RULE_label_scoped = 64
    RULE_label = 65
    RULE_type_native = 66
    RULE_value_type = 67
    RULE_value = 68
    RULE_signed_long = 69
    RULE_signed_double = 70
    RULE_sign = 71
    RULE_unreserved = 72

    ruleNames =  [ "eof_query", "eof_queries", "eof_pattern", "eof_patterns", 
                   "eof_definables", "eof_variable", "eof_label", "eof_schema_rule", 
                   "query", "query_define", "query_undefine", "query_insert", 
                   "query_update", "query_delete", "query_match", "query_match_aggregate", 
                   "query_match_group", "query_match_group_agg", "modifiers", 
                   "filter_", "sort", "var_order", "offset", "limit", "match_aggregate", 
                   "aggregate_method", "match_group", "definables", "definable", 
                   "patterns", "pattern", "pattern_conjunction", "pattern_disjunction", 
                   "pattern_negation", "pattern_variable", "variable_concept", 
                   "variable_type", "type_constraint", "annotations_owns", 
                   "variable_value", "variable_things", "variable_thing_any", 
                   "variable_thing", "variable_relation", "variable_attribute", 
                   "relation", "role_player", "player", "attributes", "attribute", 
                   "predicate", "predicate_equality", "predicate_substring", 
                   "predicate_value", "expression", "expression_base", "expression_function", 
                   "expression_function_name", "expression_arguments", "schema_rule", 
                   "type_any", "type_scoped", "type_", "label_any", "label_scoped", 
                   "label", "type_native", "value_type", "value", "signed_long", 
                   "signed_double", "sign", "unreserved" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    MATCH=6
    GET=7
    DEFINE=8
    UNDEFINE=9
    INSERT=10
    DELETE=11
    COMPUTE=12
    THING=13
    ENTITY=14
    ATTRIBUTE=15
    RELATION=16
    ROLE=17
    RULE=18
    OFFSET=19
    LIMIT=20
    SORT=21
    ORDER_=22
    ASC=23
    DESC=24
    TYPE=25
    ABSTRACT=26
    SUB_=27
    SUB=28
    SUBX=29
    OWNS=30
    REGEX=31
    AS=32
    PLAYS=33
    RELATES=34
    WHEN=35
    THEN=36
    ANNOTATION_KEY=37
    ANNOTATION_UNIQUE=38
    IID=39
    ISA_=40
    ISA=41
    ISAX=42
    HAS=43
    VALUE=44
    IS=45
    OR=46
    NOT=47
    EQ=48
    NEQ=49
    GT=50
    GTE=51
    LT=52
    LTE=53
    LIKE=54
    CONTAINS=55
    ASSIGN=56
    ADD=57
    SUBTRACT=58
    DIVIDE=59
    MULTIPLY=60
    POWER=61
    MODULO=62
    PAREN_OPEN=63
    PAREN_CLOSE=64
    EXPR_FUNC_NAME=65
    GROUP=66
    COUNT=67
    MAX=68
    MIN=69
    MEAN=70
    MEDIAN=71
    STD=72
    SUM=73
    LONG=74
    DOUBLE=75
    STRING=76
    BOOLEAN=77
    DATETIME=78
    BOOLEAN_=79
    TRUE=80
    FALSE=81
    STRING_=82
    LONG_=83
    DOUBLE_=84
    DATE_=85
    DATETIME_=86
    VAR_CONCEPT_=87
    VAR_CONCEPT_ANONYMOUS_=88
    VAR_CONCEPT_NAMED_=89
    VAR_VALUE_=90
    IID_=91
    LABEL_=92
    LABEL_SCOPED_=93
    COMMENT=94
    WS=95
    UNRECOGNISED=96

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




    class Eof_queryContext(ParserRuleContext):

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

        def query(self):
            return self.getTypedRuleContext(TypeQLPythonParser.QueryContext,0)


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

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_eof_query

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEof_query" ):
                return visitor.visitEof_query(self)
            else:
                return visitor.visitChildren(self)




    def eof_query(self):

        localctx = TypeQLPythonParser.Eof_queryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_eof_query)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 146
            self.query()
            self.state = 147
            self.match(TypeQLPythonParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Eof_queriesContext(ParserRuleContext):

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

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

        def query(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.QueryContext)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.QueryContext,i)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_eof_queries

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEof_queries" ):
                return visitor.visitEof_queries(self)
            else:
                return visitor.visitChildren(self)




    def eof_queries(self):

        localctx = TypeQLPythonParser.Eof_queriesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_eof_queries)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 150 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 149
                self.query()
                self.state = 152 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << TypeQLPythonParser.MATCH) | (1 << TypeQLPythonParser.DEFINE) | (1 << TypeQLPythonParser.UNDEFINE) | (1 << TypeQLPythonParser.INSERT))) != 0)):
                    break

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


    class Eof_patternContext(ParserRuleContext):

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

        def pattern(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PatternContext,0)


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

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_eof_pattern

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEof_pattern" ):
                return visitor.visitEof_pattern(self)
            else:
                return visitor.visitChildren(self)




    def eof_pattern(self):

        localctx = TypeQLPythonParser.Eof_patternContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_eof_pattern)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 156
            self.pattern()
            self.state = 157
            self.match(TypeQLPythonParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Eof_patternsContext(ParserRuleContext):

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

        def patterns(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PatternsContext,0)


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

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_eof_patterns

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEof_patterns" ):
                return visitor.visitEof_patterns(self)
            else:
                return visitor.visitChildren(self)




    def eof_patterns(self):

        localctx = TypeQLPythonParser.Eof_patternsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_eof_patterns)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 159
            self.patterns()
            self.state = 160
            self.match(TypeQLPythonParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Eof_definablesContext(ParserRuleContext):

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

        def definables(self):
            return self.getTypedRuleContext(TypeQLPythonParser.DefinablesContext,0)


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

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_eof_definables

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEof_definables" ):
                return visitor.visitEof_definables(self)
            else:
                return visitor.visitChildren(self)




    def eof_definables(self):

        localctx = TypeQLPythonParser.Eof_definablesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_eof_definables)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 162
            self.definables()
            self.state = 163
            self.match(TypeQLPythonParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Eof_variableContext(ParserRuleContext):

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

        def pattern_variable(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Pattern_variableContext,0)


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

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_eof_variable

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEof_variable" ):
                return visitor.visitEof_variable(self)
            else:
                return visitor.visitChildren(self)




    def eof_variable(self):

        localctx = TypeQLPythonParser.Eof_variableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_eof_variable)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 165
            self.pattern_variable()
            self.state = 166
            self.match(TypeQLPythonParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Eof_labelContext(ParserRuleContext):

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

        def label(self):
            return self.getTypedRuleContext(TypeQLPythonParser.LabelContext,0)


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

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_eof_label

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEof_label" ):
                return visitor.visitEof_label(self)
            else:
                return visitor.visitChildren(self)




    def eof_label(self):

        localctx = TypeQLPythonParser.Eof_labelContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_eof_label)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 168
            self.label()
            self.state = 169
            self.match(TypeQLPythonParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Eof_schema_ruleContext(ParserRuleContext):

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

        def schema_rule(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Schema_ruleContext,0)


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

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_eof_schema_rule

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEof_schema_rule" ):
                return visitor.visitEof_schema_rule(self)
            else:
                return visitor.visitChildren(self)




    def eof_schema_rule(self):

        localctx = TypeQLPythonParser.Eof_schema_ruleContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_eof_schema_rule)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 171
            self.schema_rule()
            self.state = 172
            self.match(TypeQLPythonParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QueryContext(ParserRuleContext):

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

        def query_define(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_defineContext,0)


        def query_undefine(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_undefineContext,0)


        def query_insert(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_insertContext,0)


        def query_update(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_updateContext,0)


        def query_delete(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_deleteContext,0)


        def query_match(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_matchContext,0)


        def query_match_aggregate(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_match_aggregateContext,0)


        def query_match_group(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_match_groupContext,0)


        def query_match_group_agg(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_match_group_aggContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_query

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQuery" ):
                return visitor.visitQuery(self)
            else:
                return visitor.visitChildren(self)




    def query(self):

        localctx = TypeQLPythonParser.QueryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_query)
        try:
            self.state = 183
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 174
                self.query_define()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 175
                self.query_undefine()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 176
                self.query_insert()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 177
                self.query_update()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 178
                self.query_delete()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 179
                self.query_match()
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 180
                self.query_match_aggregate()
                pass

            elif la_ == 8:
                self.enterOuterAlt(localctx, 8)
                self.state = 181
                self.query_match_group()
                pass

            elif la_ == 9:
                self.enterOuterAlt(localctx, 9)
                self.state = 182
                self.query_match_group_agg()
                pass


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


    class Query_defineContext(ParserRuleContext):

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

        def DEFINE(self):
            return self.getToken(TypeQLPythonParser.DEFINE, 0)

        def definables(self):
            return self.getTypedRuleContext(TypeQLPythonParser.DefinablesContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_query_define

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQuery_define" ):
                return visitor.visitQuery_define(self)
            else:
                return visitor.visitChildren(self)




    def query_define(self):

        localctx = TypeQLPythonParser.Query_defineContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_query_define)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 185
            self.match(TypeQLPythonParser.DEFINE)
            self.state = 186
            self.definables()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Query_undefineContext(ParserRuleContext):

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

        def UNDEFINE(self):
            return self.getToken(TypeQLPythonParser.UNDEFINE, 0)

        def definables(self):
            return self.getTypedRuleContext(TypeQLPythonParser.DefinablesContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_query_undefine

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQuery_undefine" ):
                return visitor.visitQuery_undefine(self)
            else:
                return visitor.visitChildren(self)




    def query_undefine(self):

        localctx = TypeQLPythonParser.Query_undefineContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_query_undefine)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 188
            self.match(TypeQLPythonParser.UNDEFINE)
            self.state = 189
            self.definables()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Query_insertContext(ParserRuleContext):

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

        def MATCH(self):
            return self.getToken(TypeQLPythonParser.MATCH, 0)

        def patterns(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PatternsContext,0)


        def INSERT(self):
            return self.getToken(TypeQLPythonParser.INSERT, 0)

        def variable_things(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_thingsContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_query_insert

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQuery_insert" ):
                return visitor.visitQuery_insert(self)
            else:
                return visitor.visitChildren(self)




    def query_insert(self):

        localctx = TypeQLPythonParser.Query_insertContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_query_insert)
        try:
            self.state = 198
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [TypeQLPythonParser.MATCH]:
                self.enterOuterAlt(localctx, 1)
                self.state = 191
                self.match(TypeQLPythonParser.MATCH)
                self.state = 192
                self.patterns()
                self.state = 193
                self.match(TypeQLPythonParser.INSERT)
                self.state = 194
                self.variable_things()
                pass
            elif token in [TypeQLPythonParser.INSERT]:
                self.enterOuterAlt(localctx, 2)
                self.state = 196
                self.match(TypeQLPythonParser.INSERT)
                self.state = 197
                self.variable_things()
                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 Query_updateContext(ParserRuleContext):

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

        def query_delete(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_deleteContext,0)


        def INSERT(self):
            return self.getToken(TypeQLPythonParser.INSERT, 0)

        def variable_things(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_thingsContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_query_update

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQuery_update" ):
                return visitor.visitQuery_update(self)
            else:
                return visitor.visitChildren(self)




    def query_update(self):

        localctx = TypeQLPythonParser.Query_updateContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_query_update)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 200
            self.query_delete()
            self.state = 201
            self.match(TypeQLPythonParser.INSERT)
            self.state = 202
            self.variable_things()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Query_deleteContext(ParserRuleContext):

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

        def MATCH(self):
            return self.getToken(TypeQLPythonParser.MATCH, 0)

        def patterns(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PatternsContext,0)


        def DELETE(self):
            return self.getToken(TypeQLPythonParser.DELETE, 0)

        def variable_things(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_thingsContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_query_delete

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQuery_delete" ):
                return visitor.visitQuery_delete(self)
            else:
                return visitor.visitChildren(self)




    def query_delete(self):

        localctx = TypeQLPythonParser.Query_deleteContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_query_delete)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 204
            self.match(TypeQLPythonParser.MATCH)
            self.state = 205
            self.patterns()
            self.state = 206
            self.match(TypeQLPythonParser.DELETE)
            self.state = 207
            self.variable_things()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Query_matchContext(ParserRuleContext):

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

        def MATCH(self):
            return self.getToken(TypeQLPythonParser.MATCH, 0)

        def patterns(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PatternsContext,0)


        def modifiers(self):
            return self.getTypedRuleContext(TypeQLPythonParser.ModifiersContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_query_match

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQuery_match" ):
                return visitor.visitQuery_match(self)
            else:
                return visitor.visitChildren(self)




    def query_match(self):

        localctx = TypeQLPythonParser.Query_matchContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_query_match)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 209
            self.match(TypeQLPythonParser.MATCH)
            self.state = 210
            self.patterns()

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


    class Query_match_aggregateContext(ParserRuleContext):

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

        def query_match(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_matchContext,0)


        def match_aggregate(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Match_aggregateContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_query_match_aggregate

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQuery_match_aggregate" ):
                return visitor.visitQuery_match_aggregate(self)
            else:
                return visitor.visitChildren(self)




    def query_match_aggregate(self):

        localctx = TypeQLPythonParser.Query_match_aggregateContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_query_match_aggregate)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 213
            self.query_match()
            self.state = 214
            self.match_aggregate()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Query_match_groupContext(ParserRuleContext):

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

        def query_match(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_matchContext,0)


        def match_group(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Match_groupContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_query_match_group

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQuery_match_group" ):
                return visitor.visitQuery_match_group(self)
            else:
                return visitor.visitChildren(self)




    def query_match_group(self):

        localctx = TypeQLPythonParser.Query_match_groupContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_query_match_group)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 216
            self.query_match()
            self.state = 217
            self.match_group()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Query_match_group_aggContext(ParserRuleContext):

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

        def query_match(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Query_matchContext,0)


        def match_group(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Match_groupContext,0)


        def match_aggregate(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Match_aggregateContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_query_match_group_agg

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQuery_match_group_agg" ):
                return visitor.visitQuery_match_group_agg(self)
            else:
                return visitor.visitChildren(self)




    def query_match_group_agg(self):

        localctx = TypeQLPythonParser.Query_match_group_aggContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_query_match_group_agg)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 219
            self.query_match()
            self.state = 220
            self.match_group()
            self.state = 221
            self.match_aggregate()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ModifiersContext(ParserRuleContext):

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

        def filter_(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Filter_Context,0)


        def sort(self):
            return self.getTypedRuleContext(TypeQLPythonParser.SortContext,0)


        def offset(self):
            return self.getTypedRuleContext(TypeQLPythonParser.OffsetContext,0)


        def limit(self):
            return self.getTypedRuleContext(TypeQLPythonParser.LimitContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_modifiers

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitModifiers" ):
                return visitor.visitModifiers(self)
            else:
                return visitor.visitChildren(self)




    def modifiers(self):

        localctx = TypeQLPythonParser.ModifiersContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_modifiers)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 226
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TypeQLPythonParser.GET:
                self.state = 223
                self.filter_()
                self.state = 224
                self.match(TypeQLPythonParser.T__0)


            self.state = 231
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TypeQLPythonParser.SORT:
                self.state = 228
                self.sort()
                self.state = 229
                self.match(TypeQLPythonParser.T__0)


            self.state = 236
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TypeQLPythonParser.OFFSET:
                self.state = 233
                self.offset()
                self.state = 234
                self.match(TypeQLPythonParser.T__0)


            self.state = 241
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TypeQLPythonParser.LIMIT:
                self.state = 238
                self.limit()
                self.state = 239
                self.match(TypeQLPythonParser.T__0)


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


    class Filter_Context(ParserRuleContext):

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

        def GET(self):
            return self.getToken(TypeQLPythonParser.GET, 0)

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

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

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_filter_

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitFilter_" ):
                return visitor.visitFilter_(self)
            else:
                return visitor.visitChildren(self)




    def filter_(self):

        localctx = TypeQLPythonParser.Filter_Context(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_filter_)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 243
            self.match(TypeQLPythonParser.GET)
            self.state = 244
            _la = self._input.LA(1)
            if not(_la==TypeQLPythonParser.VAR_CONCEPT_ or _la==TypeQLPythonParser.VAR_VALUE_):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 249
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==TypeQLPythonParser.T__1:
                self.state = 245
                self.match(TypeQLPythonParser.T__1)
                self.state = 246
                _la = self._input.LA(1)
                if not(_la==TypeQLPythonParser.VAR_CONCEPT_ or _la==TypeQLPythonParser.VAR_VALUE_):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 251
                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 SortContext(ParserRuleContext):

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

        def SORT(self):
            return self.getToken(TypeQLPythonParser.SORT, 0)

        def var_order(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.Var_orderContext)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.Var_orderContext,i)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_sort

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitSort" ):
                return visitor.visitSort(self)
            else:
                return visitor.visitChildren(self)




    def sort(self):

        localctx = TypeQLPythonParser.SortContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_sort)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 252
            self.match(TypeQLPythonParser.SORT)
            self.state = 253
            self.var_order()
            self.state = 258
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==TypeQLPythonParser.T__1:
                self.state = 254
                self.match(TypeQLPythonParser.T__1)
                self.state = 255
                self.var_order()
                self.state = 260
                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 Var_orderContext(ParserRuleContext):

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

        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def VAR_VALUE_(self):
            return self.getToken(TypeQLPythonParser.VAR_VALUE_, 0)

        def ORDER_(self):
            return self.getToken(TypeQLPythonParser.ORDER_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_var_order

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVar_order" ):
                return visitor.visitVar_order(self)
            else:
                return visitor.visitChildren(self)




    def var_order(self):

        localctx = TypeQLPythonParser.Var_orderContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_var_order)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 261
            _la = self._input.LA(1)
            if not(_la==TypeQLPythonParser.VAR_CONCEPT_ or _la==TypeQLPythonParser.VAR_VALUE_):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 263
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TypeQLPythonParser.ORDER_:
                self.state = 262
                self.match(TypeQLPythonParser.ORDER_)


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


    class OffsetContext(ParserRuleContext):

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

        def OFFSET(self):
            return self.getToken(TypeQLPythonParser.OFFSET, 0)

        def LONG_(self):
            return self.getToken(TypeQLPythonParser.LONG_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_offset

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOffset" ):
                return visitor.visitOffset(self)
            else:
                return visitor.visitChildren(self)




    def offset(self):

        localctx = TypeQLPythonParser.OffsetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_offset)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 265
            self.match(TypeQLPythonParser.OFFSET)
            self.state = 266
            self.match(TypeQLPythonParser.LONG_)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LimitContext(ParserRuleContext):

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

        def LIMIT(self):
            return self.getToken(TypeQLPythonParser.LIMIT, 0)

        def LONG_(self):
            return self.getToken(TypeQLPythonParser.LONG_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_limit

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLimit" ):
                return visitor.visitLimit(self)
            else:
                return visitor.visitChildren(self)




    def limit(self):

        localctx = TypeQLPythonParser.LimitContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_limit)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 268
            self.match(TypeQLPythonParser.LIMIT)
            self.state = 269
            self.match(TypeQLPythonParser.LONG_)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Match_aggregateContext(ParserRuleContext):

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

        def aggregate_method(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Aggregate_methodContext,0)


        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def VAR_VALUE_(self):
            return self.getToken(TypeQLPythonParser.VAR_VALUE_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_match_aggregate

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitMatch_aggregate" ):
                return visitor.visitMatch_aggregate(self)
            else:
                return visitor.visitChildren(self)




    def match_aggregate(self):

        localctx = TypeQLPythonParser.Match_aggregateContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_match_aggregate)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 271
            self.aggregate_method()
            self.state = 273
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TypeQLPythonParser.VAR_CONCEPT_ or _la==TypeQLPythonParser.VAR_VALUE_:
                self.state = 272
                _la = self._input.LA(1)
                if not(_la==TypeQLPythonParser.VAR_CONCEPT_ or _la==TypeQLPythonParser.VAR_VALUE_):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()


            self.state = 275
            self.match(TypeQLPythonParser.T__0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Aggregate_methodContext(ParserRuleContext):

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

        def COUNT(self):
            return self.getToken(TypeQLPythonParser.COUNT, 0)

        def MAX(self):
            return self.getToken(TypeQLPythonParser.MAX, 0)

        def MEAN(self):
            return self.getToken(TypeQLPythonParser.MEAN, 0)

        def MEDIAN(self):
            return self.getToken(TypeQLPythonParser.MEDIAN, 0)

        def MIN(self):
            return self.getToken(TypeQLPythonParser.MIN, 0)

        def STD(self):
            return self.getToken(TypeQLPythonParser.STD, 0)

        def SUM(self):
            return self.getToken(TypeQLPythonParser.SUM, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_aggregate_method

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAggregate_method" ):
                return visitor.visitAggregate_method(self)
            else:
                return visitor.visitChildren(self)




    def aggregate_method(self):

        localctx = TypeQLPythonParser.Aggregate_methodContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_aggregate_method)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 277
            _la = self._input.LA(1)
            if not(((((_la - 67)) & ~0x3f) == 0 and ((1 << (_la - 67)) & ((1 << (TypeQLPythonParser.COUNT - 67)) | (1 << (TypeQLPythonParser.MAX - 67)) | (1 << (TypeQLPythonParser.MIN - 67)) | (1 << (TypeQLPythonParser.MEAN - 67)) | (1 << (TypeQLPythonParser.MEDIAN - 67)) | (1 << (TypeQLPythonParser.STD - 67)) | (1 << (TypeQLPythonParser.SUM - 67)))) != 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 Match_groupContext(ParserRuleContext):

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

        def GROUP(self):
            return self.getToken(TypeQLPythonParser.GROUP, 0)

        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def VAR_VALUE_(self):
            return self.getToken(TypeQLPythonParser.VAR_VALUE_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_match_group

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitMatch_group" ):
                return visitor.visitMatch_group(self)
            else:
                return visitor.visitChildren(self)




    def match_group(self):

        localctx = TypeQLPythonParser.Match_groupContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_match_group)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 279
            self.match(TypeQLPythonParser.GROUP)
            self.state = 280
            _la = self._input.LA(1)
            if not(_la==TypeQLPythonParser.VAR_CONCEPT_ or _la==TypeQLPythonParser.VAR_VALUE_):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 281
            self.match(TypeQLPythonParser.T__0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DefinablesContext(ParserRuleContext):

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

        def definable(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.DefinableContext)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.DefinableContext,i)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_definables

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDefinables" ):
                return visitor.visitDefinables(self)
            else:
                return visitor.visitChildren(self)




    def definables(self):

        localctx = TypeQLPythonParser.DefinablesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_definables)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 286 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 283
                self.definable()
                self.state = 284
                self.match(TypeQLPythonParser.T__0)
                self.state = 288 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << TypeQLPythonParser.GET) | (1 << TypeQLPythonParser.THING) | (1 << TypeQLPythonParser.ENTITY) | (1 << TypeQLPythonParser.ATTRIBUTE) | (1 << TypeQLPythonParser.RELATION) | (1 << TypeQLPythonParser.ROLE) | (1 << TypeQLPythonParser.RULE) | (1 << TypeQLPythonParser.OFFSET) | (1 << TypeQLPythonParser.LIMIT) | (1 << TypeQLPythonParser.SORT) | (1 << TypeQLPythonParser.VALUE) | (1 << TypeQLPythonParser.CONTAINS))) != 0) or ((((_la - 65)) & ~0x3f) == 0 and ((1 << (_la - 65)) & ((1 << (TypeQLPythonParser.EXPR_FUNC_NAME - 65)) | (1 << (TypeQLPythonParser.GROUP - 65)) | (1 << (TypeQLPythonParser.COUNT - 65)) | (1 << (TypeQLPythonParser.MAX - 65)) | (1 << (TypeQLPythonParser.MIN - 65)) | (1 << (TypeQLPythonParser.MEAN - 65)) | (1 << (TypeQLPythonParser.MEDIAN - 65)) | (1 << (TypeQLPythonParser.STD - 65)) | (1 << (TypeQLPythonParser.SUM - 65)) | (1 << (TypeQLPythonParser.VAR_CONCEPT_ - 65)) | (1 << (TypeQLPythonParser.LABEL_ - 65)) | (1 << (TypeQLPythonParser.LABEL_SCOPED_ - 65)))) != 0)):
                    break

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


    class DefinableContext(ParserRuleContext):

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

        def variable_type(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_typeContext,0)


        def schema_rule(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Schema_ruleContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_definable

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDefinable" ):
                return visitor.visitDefinable(self)
            else:
                return visitor.visitChildren(self)




    def definable(self):

        localctx = TypeQLPythonParser.DefinableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_definable)
        try:
            self.state = 292
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,12,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 290
                self.variable_type()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 291
                self.schema_rule()
                pass


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


    class PatternsContext(ParserRuleContext):

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

        def pattern(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.PatternContext)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.PatternContext,i)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_patterns

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPatterns" ):
                return visitor.visitPatterns(self)
            else:
                return visitor.visitChildren(self)




    def patterns(self):

        localctx = TypeQLPythonParser.PatternsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_patterns)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 297 
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 294
                    self.pattern()
                    self.state = 295
                    self.match(TypeQLPythonParser.T__0)

                else:
                    raise NoViableAltException(self)
                self.state = 299 
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,13,self._ctx)

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


    class PatternContext(ParserRuleContext):

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

        def pattern_variable(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Pattern_variableContext,0)


        def pattern_conjunction(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Pattern_conjunctionContext,0)


        def pattern_disjunction(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Pattern_disjunctionContext,0)


        def pattern_negation(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Pattern_negationContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_pattern

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPattern" ):
                return visitor.visitPattern(self)
            else:
                return visitor.visitChildren(self)




    def pattern(self):

        localctx = TypeQLPythonParser.PatternContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_pattern)
        try:
            self.state = 305
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,14,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 301
                self.pattern_variable()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 302
                self.pattern_conjunction()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 303
                self.pattern_disjunction()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 304
                self.pattern_negation()
                pass


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


    class Pattern_conjunctionContext(ParserRuleContext):

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

        def patterns(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PatternsContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_pattern_conjunction

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPattern_conjunction" ):
                return visitor.visitPattern_conjunction(self)
            else:
                return visitor.visitChildren(self)




    def pattern_conjunction(self):

        localctx = TypeQLPythonParser.Pattern_conjunctionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_pattern_conjunction)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 307
            self.match(TypeQLPythonParser.T__2)
            self.state = 308
            self.patterns()
            self.state = 309
            self.match(TypeQLPythonParser.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 Pattern_disjunctionContext(ParserRuleContext):

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

        def patterns(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.PatternsContext)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.PatternsContext,i)


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

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_pattern_disjunction

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPattern_disjunction" ):
                return visitor.visitPattern_disjunction(self)
            else:
                return visitor.visitChildren(self)




    def pattern_disjunction(self):

        localctx = TypeQLPythonParser.Pattern_disjunctionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_pattern_disjunction)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 311
            self.match(TypeQLPythonParser.T__2)
            self.state = 312
            self.patterns()
            self.state = 313
            self.match(TypeQLPythonParser.T__3)
            self.state = 319 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 314
                self.match(TypeQLPythonParser.OR)
                self.state = 315
                self.match(TypeQLPythonParser.T__2)
                self.state = 316
                self.patterns()
                self.state = 317
                self.match(TypeQLPythonParser.T__3)
                self.state = 321 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==TypeQLPythonParser.OR):
                    break

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


    class Pattern_negationContext(ParserRuleContext):

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

        def NOT(self):
            return self.getToken(TypeQLPythonParser.NOT, 0)

        def patterns(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PatternsContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_pattern_negation

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPattern_negation" ):
                return visitor.visitPattern_negation(self)
            else:
                return visitor.visitChildren(self)




    def pattern_negation(self):

        localctx = TypeQLPythonParser.Pattern_negationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_pattern_negation)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 323
            self.match(TypeQLPythonParser.NOT)
            self.state = 324
            self.match(TypeQLPythonParser.T__2)
            self.state = 325
            self.patterns()
            self.state = 326
            self.match(TypeQLPythonParser.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 Pattern_variableContext(ParserRuleContext):

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

        def variable_concept(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_conceptContext,0)


        def variable_type(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_typeContext,0)


        def variable_thing_any(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_thing_anyContext,0)


        def variable_value(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_valueContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_pattern_variable

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPattern_variable" ):
                return visitor.visitPattern_variable(self)
            else:
                return visitor.visitChildren(self)




    def pattern_variable(self):

        localctx = TypeQLPythonParser.Pattern_variableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_pattern_variable)
        try:
            self.state = 332
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,16,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 328
                self.variable_concept()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 329
                self.variable_type()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 330
                self.variable_thing_any()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 331
                self.variable_value()
                pass


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


    class Variable_conceptContext(ParserRuleContext):

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

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

        def IS(self):
            return self.getToken(TypeQLPythonParser.IS, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_variable_concept

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVariable_concept" ):
                return visitor.visitVariable_concept(self)
            else:
                return visitor.visitChildren(self)




    def variable_concept(self):

        localctx = TypeQLPythonParser.Variable_conceptContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_variable_concept)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 334
            self.match(TypeQLPythonParser.VAR_CONCEPT_)
            self.state = 335
            self.match(TypeQLPythonParser.IS)
            self.state = 336
            self.match(TypeQLPythonParser.VAR_CONCEPT_)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Variable_typeContext(ParserRuleContext):

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

        def type_any(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Type_anyContext,0)


        def type_constraint(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.Type_constraintContext)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.Type_constraintContext,i)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_variable_type

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVariable_type" ):
                return visitor.visitVariable_type(self)
            else:
                return visitor.visitChildren(self)




    def variable_type(self):

        localctx = TypeQLPythonParser.Variable_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_variable_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 338
            self.type_any()
            self.state = 339
            self.type_constraint()
            self.state = 344
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==TypeQLPythonParser.T__1:
                self.state = 340
                self.match(TypeQLPythonParser.T__1)
                self.state = 341
                self.type_constraint()
                self.state = 346
                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 Type_constraintContext(ParserRuleContext):

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

        def ABSTRACT(self):
            return self.getToken(TypeQLPythonParser.ABSTRACT, 0)

        def SUB_(self):
            return self.getToken(TypeQLPythonParser.SUB_, 0)

        def type_any(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Type_anyContext,0)


        def OWNS(self):
            return self.getToken(TypeQLPythonParser.OWNS, 0)

        def type_(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.Type_Context)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.Type_Context,i)


        def annotations_owns(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Annotations_ownsContext,0)


        def AS(self):
            return self.getToken(TypeQLPythonParser.AS, 0)

        def RELATES(self):
            return self.getToken(TypeQLPythonParser.RELATES, 0)

        def PLAYS(self):
            return self.getToken(TypeQLPythonParser.PLAYS, 0)

        def type_scoped(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Type_scopedContext,0)


        def VALUE(self):
            return self.getToken(TypeQLPythonParser.VALUE, 0)

        def value_type(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Value_typeContext,0)


        def REGEX(self):
            return self.getToken(TypeQLPythonParser.REGEX, 0)

        def STRING_(self):
            return self.getToken(TypeQLPythonParser.STRING_, 0)

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

        def label_any(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Label_anyContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_type_constraint

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_constraint" ):
                return visitor.visitType_constraint(self)
            else:
                return visitor.visitChildren(self)




    def type_constraint(self):

        localctx = TypeQLPythonParser.Type_constraintContext(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_type_constraint)
        self._la = 0 # Token type
        try:
            self.state = 376
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [TypeQLPythonParser.ABSTRACT]:
                self.enterOuterAlt(localctx, 1)
                self.state = 347
                self.match(TypeQLPythonParser.ABSTRACT)
                pass
            elif token in [TypeQLPythonParser.SUB_]:
                self.enterOuterAlt(localctx, 2)
                self.state = 348
                self.match(TypeQLPythonParser.SUB_)
                self.state = 349
                self.type_any()
                pass
            elif token in [TypeQLPythonParser.OWNS]:
                self.enterOuterAlt(localctx, 3)
                self.state = 350
                self.match(TypeQLPythonParser.OWNS)
                self.state = 351
                self.type_()
                self.state = 354
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.AS:
                    self.state = 352
                    self.match(TypeQLPythonParser.AS)
                    self.state = 353
                    self.type_()


                self.state = 356
                self.annotations_owns()
                pass
            elif token in [TypeQLPythonParser.RELATES]:
                self.enterOuterAlt(localctx, 4)
                self.state = 358
                self.match(TypeQLPythonParser.RELATES)
                self.state = 359
                self.type_()
                self.state = 362
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.AS:
                    self.state = 360
                    self.match(TypeQLPythonParser.AS)
                    self.state = 361
                    self.type_()


                pass
            elif token in [TypeQLPythonParser.PLAYS]:
                self.enterOuterAlt(localctx, 5)
                self.state = 364
                self.match(TypeQLPythonParser.PLAYS)
                self.state = 365
                self.type_scoped()
                self.state = 368
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.AS:
                    self.state = 366
                    self.match(TypeQLPythonParser.AS)
                    self.state = 367
                    self.type_()


                pass
            elif token in [TypeQLPythonParser.VALUE]:
                self.enterOuterAlt(localctx, 6)
                self.state = 370
                self.match(TypeQLPythonParser.VALUE)
                self.state = 371
                self.value_type()
                pass
            elif token in [TypeQLPythonParser.REGEX]:
                self.enterOuterAlt(localctx, 7)
                self.state = 372
                self.match(TypeQLPythonParser.REGEX)
                self.state = 373
                self.match(TypeQLPythonParser.STRING_)
                pass
            elif token in [TypeQLPythonParser.TYPE]:
                self.enterOuterAlt(localctx, 8)
                self.state = 374
                self.match(TypeQLPythonParser.TYPE)
                self.state = 375
                self.label_any()
                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 Annotations_ownsContext(ParserRuleContext):

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

        def ANNOTATION_KEY(self):
            return self.getToken(TypeQLPythonParser.ANNOTATION_KEY, 0)

        def ANNOTATION_UNIQUE(self):
            return self.getToken(TypeQLPythonParser.ANNOTATION_UNIQUE, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_annotations_owns

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAnnotations_owns" ):
                return visitor.visitAnnotations_owns(self)
            else:
                return visitor.visitChildren(self)




    def annotations_owns(self):

        localctx = TypeQLPythonParser.Annotations_ownsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_annotations_owns)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 379
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TypeQLPythonParser.ANNOTATION_KEY:
                self.state = 378
                self.match(TypeQLPythonParser.ANNOTATION_KEY)


            self.state = 382
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TypeQLPythonParser.ANNOTATION_UNIQUE:
                self.state = 381
                self.match(TypeQLPythonParser.ANNOTATION_UNIQUE)


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


    class Variable_valueContext(ParserRuleContext):

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

        def VAR_VALUE_(self):
            return self.getToken(TypeQLPythonParser.VAR_VALUE_, 0)

        def ASSIGN(self):
            return self.getToken(TypeQLPythonParser.ASSIGN, 0)

        def expression(self):
            return self.getTypedRuleContext(TypeQLPythonParser.ExpressionContext,0)


        def predicate(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PredicateContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_variable_value

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVariable_value" ):
                return visitor.visitVariable_value(self)
            else:
                return visitor.visitChildren(self)




    def variable_value(self):

        localctx = TypeQLPythonParser.Variable_valueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 78, self.RULE_variable_value)
        try:
            self.state = 389
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,24,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 384
                self.match(TypeQLPythonParser.VAR_VALUE_)
                self.state = 385
                self.match(TypeQLPythonParser.ASSIGN)
                self.state = 386
                self.expression(0)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 387
                self.match(TypeQLPythonParser.VAR_VALUE_)
                self.state = 388
                self.predicate()
                pass


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


    class Variable_thingsContext(ParserRuleContext):

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

        def variable_thing_any(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.Variable_thing_anyContext)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.Variable_thing_anyContext,i)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_variable_things

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVariable_things" ):
                return visitor.visitVariable_things(self)
            else:
                return visitor.visitChildren(self)




    def variable_things(self):

        localctx = TypeQLPythonParser.Variable_thingsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 80, self.RULE_variable_things)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 394 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 391
                self.variable_thing_any()
                self.state = 392
                self.match(TypeQLPythonParser.T__0)
                self.state = 396 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (((((_la - 48)) & ~0x3f) == 0 and ((1 << (_la - 48)) & ((1 << (TypeQLPythonParser.EQ - 48)) | (1 << (TypeQLPythonParser.NEQ - 48)) | (1 << (TypeQLPythonParser.GT - 48)) | (1 << (TypeQLPythonParser.GTE - 48)) | (1 << (TypeQLPythonParser.LT - 48)) | (1 << (TypeQLPythonParser.LTE - 48)) | (1 << (TypeQLPythonParser.LIKE - 48)) | (1 << (TypeQLPythonParser.CONTAINS - 48)) | (1 << (TypeQLPythonParser.ASSIGN - 48)) | (1 << (TypeQLPythonParser.ADD - 48)) | (1 << (TypeQLPythonParser.SUBTRACT - 48)) | (1 << (TypeQLPythonParser.PAREN_OPEN - 48)) | (1 << (TypeQLPythonParser.BOOLEAN_ - 48)) | (1 << (TypeQLPythonParser.STRING_ - 48)) | (1 << (TypeQLPythonParser.LONG_ - 48)) | (1 << (TypeQLPythonParser.DOUBLE_ - 48)) | (1 << (TypeQLPythonParser.DATE_ - 48)) | (1 << (TypeQLPythonParser.DATETIME_ - 48)) | (1 << (TypeQLPythonParser.VAR_CONCEPT_ - 48)))) != 0)):
                    break

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


    class Variable_thing_anyContext(ParserRuleContext):

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

        def variable_thing(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_thingContext,0)


        def variable_relation(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_relationContext,0)


        def variable_attribute(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_attributeContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_variable_thing_any

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVariable_thing_any" ):
                return visitor.visitVariable_thing_any(self)
            else:
                return visitor.visitChildren(self)




    def variable_thing_any(self):

        localctx = TypeQLPythonParser.Variable_thing_anyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 82, self.RULE_variable_thing_any)
        try:
            self.state = 401
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,26,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 398
                self.variable_thing()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 399
                self.variable_relation()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 400
                self.variable_attribute()
                pass


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


    class Variable_thingContext(ParserRuleContext):

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

        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def ISA_(self):
            return self.getToken(TypeQLPythonParser.ISA_, 0)

        def type_(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Type_Context,0)


        def attributes(self):
            return self.getTypedRuleContext(TypeQLPythonParser.AttributesContext,0)


        def IID(self):
            return self.getToken(TypeQLPythonParser.IID, 0)

        def IID_(self):
            return self.getToken(TypeQLPythonParser.IID_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_variable_thing

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVariable_thing" ):
                return visitor.visitVariable_thing(self)
            else:
                return visitor.visitChildren(self)




    def variable_thing(self):

        localctx = TypeQLPythonParser.Variable_thingContext(self, self._ctx, self.state)
        self.enterRule(localctx, 84, self.RULE_variable_thing)
        self._la = 0 # Token type
        try:
            self.state = 419
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,29,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 403
                self.match(TypeQLPythonParser.VAR_CONCEPT_)
                self.state = 404
                self.match(TypeQLPythonParser.ISA_)
                self.state = 405
                self.type_()
                self.state = 408
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.T__1:
                    self.state = 406
                    self.match(TypeQLPythonParser.T__1)
                    self.state = 407
                    self.attributes()


                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 410
                self.match(TypeQLPythonParser.VAR_CONCEPT_)
                self.state = 411
                self.match(TypeQLPythonParser.IID)
                self.state = 412
                self.match(TypeQLPythonParser.IID_)
                self.state = 415
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.T__1:
                    self.state = 413
                    self.match(TypeQLPythonParser.T__1)
                    self.state = 414
                    self.attributes()


                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 417
                self.match(TypeQLPythonParser.VAR_CONCEPT_)
                self.state = 418
                self.attributes()
                pass


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


    class Variable_relationContext(ParserRuleContext):

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

        def relation(self):
            return self.getTypedRuleContext(TypeQLPythonParser.RelationContext,0)


        def ISA_(self):
            return self.getToken(TypeQLPythonParser.ISA_, 0)

        def type_(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Type_Context,0)


        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def attributes(self):
            return self.getTypedRuleContext(TypeQLPythonParser.AttributesContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_variable_relation

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVariable_relation" ):
                return visitor.visitVariable_relation(self)
            else:
                return visitor.visitChildren(self)




    def variable_relation(self):

        localctx = TypeQLPythonParser.Variable_relationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 86, self.RULE_variable_relation)
        self._la = 0 # Token type
        try:
            self.state = 438
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,34,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 422
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.VAR_CONCEPT_:
                    self.state = 421
                    self.match(TypeQLPythonParser.VAR_CONCEPT_)


                self.state = 424
                self.relation()
                self.state = 425
                self.match(TypeQLPythonParser.ISA_)
                self.state = 426
                self.type_()
                self.state = 429
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.T__1:
                    self.state = 427
                    self.match(TypeQLPythonParser.T__1)
                    self.state = 428
                    self.attributes()


                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 432
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.VAR_CONCEPT_:
                    self.state = 431
                    self.match(TypeQLPythonParser.VAR_CONCEPT_)


                self.state = 434
                self.relation()
                self.state = 436
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.HAS:
                    self.state = 435
                    self.attributes()


                pass


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


    class Variable_attributeContext(ParserRuleContext):

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

        def predicate(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PredicateContext,0)


        def ISA_(self):
            return self.getToken(TypeQLPythonParser.ISA_, 0)

        def type_(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Type_Context,0)


        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def attributes(self):
            return self.getTypedRuleContext(TypeQLPythonParser.AttributesContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_variable_attribute

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVariable_attribute" ):
                return visitor.visitVariable_attribute(self)
            else:
                return visitor.visitChildren(self)




    def variable_attribute(self):

        localctx = TypeQLPythonParser.Variable_attributeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 88, self.RULE_variable_attribute)
        self._la = 0 # Token type
        try:
            self.state = 457
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,39,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 441
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.VAR_CONCEPT_:
                    self.state = 440
                    self.match(TypeQLPythonParser.VAR_CONCEPT_)


                self.state = 443
                self.predicate()
                self.state = 444
                self.match(TypeQLPythonParser.ISA_)
                self.state = 445
                self.type_()
                self.state = 448
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.T__1:
                    self.state = 446
                    self.match(TypeQLPythonParser.T__1)
                    self.state = 447
                    self.attributes()


                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 451
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.VAR_CONCEPT_:
                    self.state = 450
                    self.match(TypeQLPythonParser.VAR_CONCEPT_)


                self.state = 453
                self.predicate()
                self.state = 455
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==TypeQLPythonParser.HAS:
                    self.state = 454
                    self.attributes()


                pass


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


    class RelationContext(ParserRuleContext):

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

        def PAREN_OPEN(self):
            return self.getToken(TypeQLPythonParser.PAREN_OPEN, 0)

        def role_player(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.Role_playerContext)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.Role_playerContext,i)


        def PAREN_CLOSE(self):
            return self.getToken(TypeQLPythonParser.PAREN_CLOSE, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_relation

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRelation" ):
                return visitor.visitRelation(self)
            else:
                return visitor.visitChildren(self)




    def relation(self):

        localctx = TypeQLPythonParser.RelationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 90, self.RULE_relation)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 459
            self.match(TypeQLPythonParser.PAREN_OPEN)
            self.state = 460
            self.role_player()
            self.state = 465
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==TypeQLPythonParser.T__1:
                self.state = 461
                self.match(TypeQLPythonParser.T__1)
                self.state = 462
                self.role_player()
                self.state = 467
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 468
            self.match(TypeQLPythonParser.PAREN_CLOSE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Role_playerContext(ParserRuleContext):

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

        def type_(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Type_Context,0)


        def player(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PlayerContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_role_player

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRole_player" ):
                return visitor.visitRole_player(self)
            else:
                return visitor.visitChildren(self)




    def role_player(self):

        localctx = TypeQLPythonParser.Role_playerContext(self, self._ctx, self.state)
        self.enterRule(localctx, 92, self.RULE_role_player)
        try:
            self.state = 475
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,41,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 470
                self.type_()
                self.state = 471
                self.match(TypeQLPythonParser.T__4)
                self.state = 472
                self.player()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 474
                self.player()
                pass


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


    class PlayerContext(ParserRuleContext):

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

        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_player

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPlayer" ):
                return visitor.visitPlayer(self)
            else:
                return visitor.visitChildren(self)




    def player(self):

        localctx = TypeQLPythonParser.PlayerContext(self, self._ctx, self.state)
        self.enterRule(localctx, 94, self.RULE_player)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 477
            self.match(TypeQLPythonParser.VAR_CONCEPT_)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AttributesContext(ParserRuleContext):

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

        def attribute(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.AttributeContext)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.AttributeContext,i)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_attributes

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAttributes" ):
                return visitor.visitAttributes(self)
            else:
                return visitor.visitChildren(self)




    def attributes(self):

        localctx = TypeQLPythonParser.AttributesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 96, self.RULE_attributes)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 479
            self.attribute()
            self.state = 484
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==TypeQLPythonParser.T__1:
                self.state = 480
                self.match(TypeQLPythonParser.T__1)
                self.state = 481
                self.attribute()
                self.state = 486
                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 AttributeContext(ParserRuleContext):

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

        def HAS(self):
            return self.getToken(TypeQLPythonParser.HAS, 0)

        def label(self):
            return self.getTypedRuleContext(TypeQLPythonParser.LabelContext,0)


        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def VAR_VALUE_(self):
            return self.getToken(TypeQLPythonParser.VAR_VALUE_, 0)

        def predicate(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PredicateContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_attribute

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAttribute" ):
                return visitor.visitAttribute(self)
            else:
                return visitor.visitChildren(self)




    def attribute(self):

        localctx = TypeQLPythonParser.AttributeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 98, self.RULE_attribute)
        try:
            self.state = 496
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,44,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 487
                self.match(TypeQLPythonParser.HAS)
                self.state = 488
                self.label()
                self.state = 492
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [TypeQLPythonParser.VAR_CONCEPT_]:
                    self.state = 489
                    self.match(TypeQLPythonParser.VAR_CONCEPT_)
                    pass
                elif token in [TypeQLPythonParser.VAR_VALUE_]:
                    self.state = 490
                    self.match(TypeQLPythonParser.VAR_VALUE_)
                    pass
                elif token in [TypeQLPythonParser.EQ, TypeQLPythonParser.NEQ, TypeQLPythonParser.GT, TypeQLPythonParser.GTE, TypeQLPythonParser.LT, TypeQLPythonParser.LTE, TypeQLPythonParser.LIKE, TypeQLPythonParser.CONTAINS, TypeQLPythonParser.ASSIGN, TypeQLPythonParser.ADD, TypeQLPythonParser.SUBTRACT, TypeQLPythonParser.BOOLEAN_, TypeQLPythonParser.STRING_, TypeQLPythonParser.LONG_, TypeQLPythonParser.DOUBLE_, TypeQLPythonParser.DATE_, TypeQLPythonParser.DATETIME_]:
                    self.state = 491
                    self.predicate()
                    pass
                else:
                    raise NoViableAltException(self)

                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 494
                self.match(TypeQLPythonParser.HAS)
                self.state = 495
                self.match(TypeQLPythonParser.VAR_CONCEPT_)
                pass


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


    class PredicateContext(ParserRuleContext):

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

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


        def predicate_equality(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Predicate_equalityContext,0)


        def predicate_value(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Predicate_valueContext,0)


        def predicate_substring(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Predicate_substringContext,0)


        def STRING_(self):
            return self.getToken(TypeQLPythonParser.STRING_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_predicate

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPredicate" ):
                return visitor.visitPredicate(self)
            else:
                return visitor.visitChildren(self)




    def predicate(self):

        localctx = TypeQLPythonParser.PredicateContext(self, self._ctx, self.state)
        self.enterRule(localctx, 100, self.RULE_predicate)
        try:
            self.state = 505
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [TypeQLPythonParser.ADD, TypeQLPythonParser.SUBTRACT, TypeQLPythonParser.BOOLEAN_, TypeQLPythonParser.STRING_, TypeQLPythonParser.LONG_, TypeQLPythonParser.DOUBLE_, TypeQLPythonParser.DATE_, TypeQLPythonParser.DATETIME_]:
                self.enterOuterAlt(localctx, 1)
                self.state = 498
                self.value()
                pass
            elif token in [TypeQLPythonParser.EQ, TypeQLPythonParser.NEQ, TypeQLPythonParser.GT, TypeQLPythonParser.GTE, TypeQLPythonParser.LT, TypeQLPythonParser.LTE, TypeQLPythonParser.ASSIGN]:
                self.enterOuterAlt(localctx, 2)
                self.state = 499
                self.predicate_equality()
                self.state = 500
                self.predicate_value()
                pass
            elif token in [TypeQLPythonParser.LIKE, TypeQLPythonParser.CONTAINS]:
                self.enterOuterAlt(localctx, 3)
                self.state = 502
                self.predicate_substring()
                self.state = 503
                self.match(TypeQLPythonParser.STRING_)
                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 Predicate_equalityContext(ParserRuleContext):

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

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

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

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

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

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

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

        def ASSIGN(self):
            return self.getToken(TypeQLPythonParser.ASSIGN, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_predicate_equality

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPredicate_equality" ):
                return visitor.visitPredicate_equality(self)
            else:
                return visitor.visitChildren(self)




    def predicate_equality(self):

        localctx = TypeQLPythonParser.Predicate_equalityContext(self, self._ctx, self.state)
        self.enterRule(localctx, 102, self.RULE_predicate_equality)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 507
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << TypeQLPythonParser.EQ) | (1 << TypeQLPythonParser.NEQ) | (1 << TypeQLPythonParser.GT) | (1 << TypeQLPythonParser.GTE) | (1 << TypeQLPythonParser.LT) | (1 << TypeQLPythonParser.LTE) | (1 << TypeQLPythonParser.ASSIGN))) != 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 Predicate_substringContext(ParserRuleContext):

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

        def CONTAINS(self):
            return self.getToken(TypeQLPythonParser.CONTAINS, 0)

        def LIKE(self):
            return self.getToken(TypeQLPythonParser.LIKE, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_predicate_substring

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPredicate_substring" ):
                return visitor.visitPredicate_substring(self)
            else:
                return visitor.visitChildren(self)




    def predicate_substring(self):

        localctx = TypeQLPythonParser.Predicate_substringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 104, self.RULE_predicate_substring)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 509
            _la = self._input.LA(1)
            if not(_la==TypeQLPythonParser.LIKE or _la==TypeQLPythonParser.CONTAINS):
                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 Predicate_valueContext(ParserRuleContext):

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

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


        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def VAR_VALUE_(self):
            return self.getToken(TypeQLPythonParser.VAR_VALUE_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_predicate_value

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPredicate_value" ):
                return visitor.visitPredicate_value(self)
            else:
                return visitor.visitChildren(self)




    def predicate_value(self):

        localctx = TypeQLPythonParser.Predicate_valueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 106, self.RULE_predicate_value)
        try:
            self.state = 514
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [TypeQLPythonParser.ADD, TypeQLPythonParser.SUBTRACT, TypeQLPythonParser.BOOLEAN_, TypeQLPythonParser.STRING_, TypeQLPythonParser.LONG_, TypeQLPythonParser.DOUBLE_, TypeQLPythonParser.DATE_, TypeQLPythonParser.DATETIME_]:
                self.enterOuterAlt(localctx, 1)
                self.state = 511
                self.value()
                pass
            elif token in [TypeQLPythonParser.VAR_CONCEPT_]:
                self.enterOuterAlt(localctx, 2)
                self.state = 512
                self.match(TypeQLPythonParser.VAR_CONCEPT_)
                pass
            elif token in [TypeQLPythonParser.VAR_VALUE_]:
                self.enterOuterAlt(localctx, 3)
                self.state = 513
                self.match(TypeQLPythonParser.VAR_VALUE_)
                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 ExpressionContext(ParserRuleContext):

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

        def expression_base(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Expression_baseContext,0)


        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.ExpressionContext,i)


        def POWER(self):
            return self.getToken(TypeQLPythonParser.POWER, 0)

        def MULTIPLY(self):
            return self.getToken(TypeQLPythonParser.MULTIPLY, 0)

        def DIVIDE(self):
            return self.getToken(TypeQLPythonParser.DIVIDE, 0)

        def MODULO(self):
            return self.getToken(TypeQLPythonParser.MODULO, 0)

        def ADD(self):
            return self.getToken(TypeQLPythonParser.ADD, 0)

        def SUBTRACT(self):
            return self.getToken(TypeQLPythonParser.SUBTRACT, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_expression

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpression" ):
                return visitor.visitExpression(self)
            else:
                return visitor.visitChildren(self)



    def expression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = TypeQLPythonParser.ExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 108
        self.enterRecursionRule(localctx, 108, self.RULE_expression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 517
            self.expression_base()
            self._ctx.stop = self._input.LT(-1)
            self.state = 530
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,48,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 528
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,47,self._ctx)
                    if la_ == 1:
                        localctx = TypeQLPythonParser.ExpressionContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 519
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 520
                        self.match(TypeQLPythonParser.POWER)
                        self.state = 521
                        self.expression(4)
                        pass

                    elif la_ == 2:
                        localctx = TypeQLPythonParser.ExpressionContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 522
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 523
                        _la = self._input.LA(1)
                        if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << TypeQLPythonParser.DIVIDE) | (1 << TypeQLPythonParser.MULTIPLY) | (1 << TypeQLPythonParser.MODULO))) != 0)):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 524
                        self.expression(4)
                        pass

                    elif la_ == 3:
                        localctx = TypeQLPythonParser.ExpressionContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 525
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 526
                        _la = self._input.LA(1)
                        if not(_la==TypeQLPythonParser.ADD or _la==TypeQLPythonParser.SUBTRACT):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 527
                        self.expression(3)
                        pass

             
                self.state = 532
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,48,self._ctx)

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


    class Expression_baseContext(ParserRuleContext):

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

        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def VAR_VALUE_(self):
            return self.getToken(TypeQLPythonParser.VAR_VALUE_, 0)

        def expression_function(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Expression_functionContext,0)


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


        def PAREN_OPEN(self):
            return self.getToken(TypeQLPythonParser.PAREN_OPEN, 0)

        def expression(self):
            return self.getTypedRuleContext(TypeQLPythonParser.ExpressionContext,0)


        def PAREN_CLOSE(self):
            return self.getToken(TypeQLPythonParser.PAREN_CLOSE, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_expression_base

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpression_base" ):
                return visitor.visitExpression_base(self)
            else:
                return visitor.visitChildren(self)




    def expression_base(self):

        localctx = TypeQLPythonParser.Expression_baseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 110, self.RULE_expression_base)
        try:
            self.state = 541
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [TypeQLPythonParser.VAR_CONCEPT_]:
                self.enterOuterAlt(localctx, 1)
                self.state = 533
                self.match(TypeQLPythonParser.VAR_CONCEPT_)
                pass
            elif token in [TypeQLPythonParser.VAR_VALUE_]:
                self.enterOuterAlt(localctx, 2)
                self.state = 534
                self.match(TypeQLPythonParser.VAR_VALUE_)
                pass
            elif token in [TypeQLPythonParser.EXPR_FUNC_NAME, TypeQLPythonParser.MAX, TypeQLPythonParser.MIN]:
                self.enterOuterAlt(localctx, 3)
                self.state = 535
                self.expression_function()
                pass
            elif token in [TypeQLPythonParser.ADD, TypeQLPythonParser.SUBTRACT, TypeQLPythonParser.BOOLEAN_, TypeQLPythonParser.STRING_, TypeQLPythonParser.LONG_, TypeQLPythonParser.DOUBLE_, TypeQLPythonParser.DATE_, TypeQLPythonParser.DATETIME_]:
                self.enterOuterAlt(localctx, 4)
                self.state = 536
                self.value()
                pass
            elif token in [TypeQLPythonParser.PAREN_OPEN]:
                self.enterOuterAlt(localctx, 5)
                self.state = 537
                self.match(TypeQLPythonParser.PAREN_OPEN)
                self.state = 538
                self.expression(0)
                self.state = 539
                self.match(TypeQLPythonParser.PAREN_CLOSE)
                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 Expression_functionContext(ParserRuleContext):

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

        def expression_function_name(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Expression_function_nameContext,0)


        def PAREN_OPEN(self):
            return self.getToken(TypeQLPythonParser.PAREN_OPEN, 0)

        def PAREN_CLOSE(self):
            return self.getToken(TypeQLPythonParser.PAREN_CLOSE, 0)

        def expression_arguments(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Expression_argumentsContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_expression_function

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpression_function" ):
                return visitor.visitExpression_function(self)
            else:
                return visitor.visitChildren(self)




    def expression_function(self):

        localctx = TypeQLPythonParser.Expression_functionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 112, self.RULE_expression_function)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 543
            self.expression_function_name()
            self.state = 544
            self.match(TypeQLPythonParser.PAREN_OPEN)
            self.state = 546
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if ((((_la - 57)) & ~0x3f) == 0 and ((1 << (_la - 57)) & ((1 << (TypeQLPythonParser.ADD - 57)) | (1 << (TypeQLPythonParser.SUBTRACT - 57)) | (1 << (TypeQLPythonParser.PAREN_OPEN - 57)) | (1 << (TypeQLPythonParser.EXPR_FUNC_NAME - 57)) | (1 << (TypeQLPythonParser.MAX - 57)) | (1 << (TypeQLPythonParser.MIN - 57)) | (1 << (TypeQLPythonParser.BOOLEAN_ - 57)) | (1 << (TypeQLPythonParser.STRING_ - 57)) | (1 << (TypeQLPythonParser.LONG_ - 57)) | (1 << (TypeQLPythonParser.DOUBLE_ - 57)) | (1 << (TypeQLPythonParser.DATE_ - 57)) | (1 << (TypeQLPythonParser.DATETIME_ - 57)) | (1 << (TypeQLPythonParser.VAR_CONCEPT_ - 57)) | (1 << (TypeQLPythonParser.VAR_VALUE_ - 57)))) != 0):
                self.state = 545
                self.expression_arguments()


            self.state = 548
            self.match(TypeQLPythonParser.PAREN_CLOSE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Expression_function_nameContext(ParserRuleContext):

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

        def EXPR_FUNC_NAME(self):
            return self.getToken(TypeQLPythonParser.EXPR_FUNC_NAME, 0)

        def MAX(self):
            return self.getToken(TypeQLPythonParser.MAX, 0)

        def MIN(self):
            return self.getToken(TypeQLPythonParser.MIN, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_expression_function_name

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpression_function_name" ):
                return visitor.visitExpression_function_name(self)
            else:
                return visitor.visitChildren(self)




    def expression_function_name(self):

        localctx = TypeQLPythonParser.Expression_function_nameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 114, self.RULE_expression_function_name)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 550
            _la = self._input.LA(1)
            if not(((((_la - 65)) & ~0x3f) == 0 and ((1 << (_la - 65)) & ((1 << (TypeQLPythonParser.EXPR_FUNC_NAME - 65)) | (1 << (TypeQLPythonParser.MAX - 65)) | (1 << (TypeQLPythonParser.MIN - 65)))) != 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 Expression_argumentsContext(ParserRuleContext):

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

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(TypeQLPythonParser.ExpressionContext)
            else:
                return self.getTypedRuleContext(TypeQLPythonParser.ExpressionContext,i)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_expression_arguments

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpression_arguments" ):
                return visitor.visitExpression_arguments(self)
            else:
                return visitor.visitChildren(self)




    def expression_arguments(self):

        localctx = TypeQLPythonParser.Expression_argumentsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 116, self.RULE_expression_arguments)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 552
            self.expression(0)
            self.state = 557
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==TypeQLPythonParser.T__1:
                self.state = 553
                self.match(TypeQLPythonParser.T__1)
                self.state = 554
                self.expression(0)
                self.state = 559
                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 Schema_ruleContext(ParserRuleContext):

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

        def RULE(self):
            return self.getToken(TypeQLPythonParser.RULE, 0)

        def label(self):
            return self.getTypedRuleContext(TypeQLPythonParser.LabelContext,0)


        def WHEN(self):
            return self.getToken(TypeQLPythonParser.WHEN, 0)

        def patterns(self):
            return self.getTypedRuleContext(TypeQLPythonParser.PatternsContext,0)


        def THEN(self):
            return self.getToken(TypeQLPythonParser.THEN, 0)

        def variable_thing_any(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Variable_thing_anyContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_schema_rule

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitSchema_rule" ):
                return visitor.visitSchema_rule(self)
            else:
                return visitor.visitChildren(self)




    def schema_rule(self):

        localctx = TypeQLPythonParser.Schema_ruleContext(self, self._ctx, self.state)
        self.enterRule(localctx, 118, self.RULE_schema_rule)
        try:
            self.state = 575
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,52,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 560
                self.match(TypeQLPythonParser.RULE)
                self.state = 561
                self.label()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 562
                self.match(TypeQLPythonParser.RULE)
                self.state = 563
                self.label()
                self.state = 564
                self.match(TypeQLPythonParser.T__4)
                self.state = 565
                self.match(TypeQLPythonParser.WHEN)
                self.state = 566
                self.match(TypeQLPythonParser.T__2)
                self.state = 567
                self.patterns()
                self.state = 568
                self.match(TypeQLPythonParser.T__3)
                self.state = 569
                self.match(TypeQLPythonParser.THEN)
                self.state = 570
                self.match(TypeQLPythonParser.T__2)
                self.state = 571
                self.variable_thing_any()
                self.state = 572
                self.match(TypeQLPythonParser.T__0)
                self.state = 573
                self.match(TypeQLPythonParser.T__3)
                pass


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


    class Type_anyContext(ParserRuleContext):

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

        def type_scoped(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Type_scopedContext,0)


        def type_(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Type_Context,0)


        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_type_any

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_any" ):
                return visitor.visitType_any(self)
            else:
                return visitor.visitChildren(self)




    def type_any(self):

        localctx = TypeQLPythonParser.Type_anyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 120, self.RULE_type_any)
        try:
            self.state = 580
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,53,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 577
                self.type_scoped()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 578
                self.type_()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 579
                self.match(TypeQLPythonParser.VAR_CONCEPT_)
                pass


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


    class Type_scopedContext(ParserRuleContext):

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

        def label_scoped(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Label_scopedContext,0)


        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_type_scoped

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_scoped" ):
                return visitor.visitType_scoped(self)
            else:
                return visitor.visitChildren(self)




    def type_scoped(self):

        localctx = TypeQLPythonParser.Type_scopedContext(self, self._ctx, self.state)
        self.enterRule(localctx, 122, self.RULE_type_scoped)
        try:
            self.state = 584
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [TypeQLPythonParser.LABEL_SCOPED_]:
                self.enterOuterAlt(localctx, 1)
                self.state = 582
                self.label_scoped()
                pass
            elif token in [TypeQLPythonParser.VAR_CONCEPT_]:
                self.enterOuterAlt(localctx, 2)
                self.state = 583
                self.match(TypeQLPythonParser.VAR_CONCEPT_)
                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 Type_Context(ParserRuleContext):

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

        def label(self):
            return self.getTypedRuleContext(TypeQLPythonParser.LabelContext,0)


        def VAR_CONCEPT_(self):
            return self.getToken(TypeQLPythonParser.VAR_CONCEPT_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_type_

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_" ):
                return visitor.visitType_(self)
            else:
                return visitor.visitChildren(self)




    def type_(self):

        localctx = TypeQLPythonParser.Type_Context(self, self._ctx, self.state)
        self.enterRule(localctx, 124, self.RULE_type_)
        try:
            self.state = 588
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [TypeQLPythonParser.GET, TypeQLPythonParser.THING, TypeQLPythonParser.ENTITY, TypeQLPythonParser.ATTRIBUTE, TypeQLPythonParser.RELATION, TypeQLPythonParser.ROLE, TypeQLPythonParser.RULE, TypeQLPythonParser.OFFSET, TypeQLPythonParser.LIMIT, TypeQLPythonParser.SORT, TypeQLPythonParser.VALUE, TypeQLPythonParser.CONTAINS, TypeQLPythonParser.EXPR_FUNC_NAME, TypeQLPythonParser.GROUP, TypeQLPythonParser.COUNT, TypeQLPythonParser.MAX, TypeQLPythonParser.MIN, TypeQLPythonParser.MEAN, TypeQLPythonParser.MEDIAN, TypeQLPythonParser.STD, TypeQLPythonParser.SUM, TypeQLPythonParser.LABEL_]:
                self.enterOuterAlt(localctx, 1)
                self.state = 586
                self.label()
                pass
            elif token in [TypeQLPythonParser.VAR_CONCEPT_]:
                self.enterOuterAlt(localctx, 2)
                self.state = 587
                self.match(TypeQLPythonParser.VAR_CONCEPT_)
                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 Label_anyContext(ParserRuleContext):

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

        def label_scoped(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Label_scopedContext,0)


        def label(self):
            return self.getTypedRuleContext(TypeQLPythonParser.LabelContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_label_any

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLabel_any" ):
                return visitor.visitLabel_any(self)
            else:
                return visitor.visitChildren(self)




    def label_any(self):

        localctx = TypeQLPythonParser.Label_anyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 126, self.RULE_label_any)
        try:
            self.state = 592
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [TypeQLPythonParser.LABEL_SCOPED_]:
                self.enterOuterAlt(localctx, 1)
                self.state = 590
                self.label_scoped()
                pass
            elif token in [TypeQLPythonParser.GET, TypeQLPythonParser.THING, TypeQLPythonParser.ENTITY, TypeQLPythonParser.ATTRIBUTE, TypeQLPythonParser.RELATION, TypeQLPythonParser.ROLE, TypeQLPythonParser.RULE, TypeQLPythonParser.OFFSET, TypeQLPythonParser.LIMIT, TypeQLPythonParser.SORT, TypeQLPythonParser.VALUE, TypeQLPythonParser.CONTAINS, TypeQLPythonParser.EXPR_FUNC_NAME, TypeQLPythonParser.GROUP, TypeQLPythonParser.COUNT, TypeQLPythonParser.MAX, TypeQLPythonParser.MIN, TypeQLPythonParser.MEAN, TypeQLPythonParser.MEDIAN, TypeQLPythonParser.STD, TypeQLPythonParser.SUM, TypeQLPythonParser.LABEL_]:
                self.enterOuterAlt(localctx, 2)
                self.state = 591
                self.label()
                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 Label_scopedContext(ParserRuleContext):

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

        def LABEL_SCOPED_(self):
            return self.getToken(TypeQLPythonParser.LABEL_SCOPED_, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_label_scoped

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLabel_scoped" ):
                return visitor.visitLabel_scoped(self)
            else:
                return visitor.visitChildren(self)




    def label_scoped(self):

        localctx = TypeQLPythonParser.Label_scopedContext(self, self._ctx, self.state)
        self.enterRule(localctx, 128, self.RULE_label_scoped)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 594
            self.match(TypeQLPythonParser.LABEL_SCOPED_)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LabelContext(ParserRuleContext):

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

        def LABEL_(self):
            return self.getToken(TypeQLPythonParser.LABEL_, 0)

        def type_native(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Type_nativeContext,0)


        def unreserved(self):
            return self.getTypedRuleContext(TypeQLPythonParser.UnreservedContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_label

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLabel" ):
                return visitor.visitLabel(self)
            else:
                return visitor.visitChildren(self)




    def label(self):

        localctx = TypeQLPythonParser.LabelContext(self, self._ctx, self.state)
        self.enterRule(localctx, 130, self.RULE_label)
        try:
            self.state = 599
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [TypeQLPythonParser.LABEL_]:
                self.enterOuterAlt(localctx, 1)
                self.state = 596
                self.match(TypeQLPythonParser.LABEL_)
                pass
            elif token in [TypeQLPythonParser.THING, TypeQLPythonParser.ENTITY, TypeQLPythonParser.ATTRIBUTE, TypeQLPythonParser.RELATION, TypeQLPythonParser.ROLE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 597
                self.type_native()
                pass
            elif token in [TypeQLPythonParser.GET, TypeQLPythonParser.RULE, TypeQLPythonParser.OFFSET, TypeQLPythonParser.LIMIT, TypeQLPythonParser.SORT, TypeQLPythonParser.VALUE, TypeQLPythonParser.CONTAINS, TypeQLPythonParser.EXPR_FUNC_NAME, TypeQLPythonParser.GROUP, TypeQLPythonParser.COUNT, TypeQLPythonParser.MAX, TypeQLPythonParser.MIN, TypeQLPythonParser.MEAN, TypeQLPythonParser.MEDIAN, TypeQLPythonParser.STD, TypeQLPythonParser.SUM]:
                self.enterOuterAlt(localctx, 3)
                self.state = 598
                self.unreserved()
                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 Type_nativeContext(ParserRuleContext):

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

        def THING(self):
            return self.getToken(TypeQLPythonParser.THING, 0)

        def ENTITY(self):
            return self.getToken(TypeQLPythonParser.ENTITY, 0)

        def ATTRIBUTE(self):
            return self.getToken(TypeQLPythonParser.ATTRIBUTE, 0)

        def RELATION(self):
            return self.getToken(TypeQLPythonParser.RELATION, 0)

        def ROLE(self):
            return self.getToken(TypeQLPythonParser.ROLE, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_type_native

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitType_native" ):
                return visitor.visitType_native(self)
            else:
                return visitor.visitChildren(self)




    def type_native(self):

        localctx = TypeQLPythonParser.Type_nativeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 132, self.RULE_type_native)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 601
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << TypeQLPythonParser.THING) | (1 << TypeQLPythonParser.ENTITY) | (1 << TypeQLPythonParser.ATTRIBUTE) | (1 << TypeQLPythonParser.RELATION) | (1 << TypeQLPythonParser.ROLE))) != 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 Value_typeContext(ParserRuleContext):

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

        def LONG(self):
            return self.getToken(TypeQLPythonParser.LONG, 0)

        def DOUBLE(self):
            return self.getToken(TypeQLPythonParser.DOUBLE, 0)

        def STRING(self):
            return self.getToken(TypeQLPythonParser.STRING, 0)

        def BOOLEAN(self):
            return self.getToken(TypeQLPythonParser.BOOLEAN, 0)

        def DATETIME(self):
            return self.getToken(TypeQLPythonParser.DATETIME, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_value_type

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitValue_type" ):
                return visitor.visitValue_type(self)
            else:
                return visitor.visitChildren(self)




    def value_type(self):

        localctx = TypeQLPythonParser.Value_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 134, self.RULE_value_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 603
            _la = self._input.LA(1)
            if not(((((_la - 74)) & ~0x3f) == 0 and ((1 << (_la - 74)) & ((1 << (TypeQLPythonParser.LONG - 74)) | (1 << (TypeQLPythonParser.DOUBLE - 74)) | (1 << (TypeQLPythonParser.STRING - 74)) | (1 << (TypeQLPythonParser.BOOLEAN - 74)) | (1 << (TypeQLPythonParser.DATETIME - 74)))) != 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 ValueContext(ParserRuleContext):

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

        def STRING_(self):
            return self.getToken(TypeQLPythonParser.STRING_, 0)

        def BOOLEAN_(self):
            return self.getToken(TypeQLPythonParser.BOOLEAN_, 0)

        def DATE_(self):
            return self.getToken(TypeQLPythonParser.DATE_, 0)

        def DATETIME_(self):
            return self.getToken(TypeQLPythonParser.DATETIME_, 0)

        def signed_long(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Signed_longContext,0)


        def signed_double(self):
            return self.getTypedRuleContext(TypeQLPythonParser.Signed_doubleContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.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 accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitValue" ):
                return visitor.visitValue(self)
            else:
                return visitor.visitChildren(self)




    def value(self):

        localctx = TypeQLPythonParser.ValueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 136, self.RULE_value)
        try:
            self.state = 611
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,58,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 605
                self.match(TypeQLPythonParser.STRING_)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 606
                self.match(TypeQLPythonParser.BOOLEAN_)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 607
                self.match(TypeQLPythonParser.DATE_)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 608
                self.match(TypeQLPythonParser.DATETIME_)
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 609
                self.signed_long()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 610
                self.signed_double()
                pass


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


    class Signed_longContext(ParserRuleContext):

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

        def LONG_(self):
            return self.getToken(TypeQLPythonParser.LONG_, 0)

        def sign(self):
            return self.getTypedRuleContext(TypeQLPythonParser.SignContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_signed_long

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitSigned_long" ):
                return visitor.visitSigned_long(self)
            else:
                return visitor.visitChildren(self)




    def signed_long(self):

        localctx = TypeQLPythonParser.Signed_longContext(self, self._ctx, self.state)
        self.enterRule(localctx, 138, self.RULE_signed_long)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 614
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TypeQLPythonParser.ADD or _la==TypeQLPythonParser.SUBTRACT:
                self.state = 613
                self.sign()


            self.state = 616
            self.match(TypeQLPythonParser.LONG_)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Signed_doubleContext(ParserRuleContext):

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

        def DOUBLE_(self):
            return self.getToken(TypeQLPythonParser.DOUBLE_, 0)

        def sign(self):
            return self.getTypedRuleContext(TypeQLPythonParser.SignContext,0)


        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_signed_double

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitSigned_double" ):
                return visitor.visitSigned_double(self)
            else:
                return visitor.visitChildren(self)




    def signed_double(self):

        localctx = TypeQLPythonParser.Signed_doubleContext(self, self._ctx, self.state)
        self.enterRule(localctx, 140, self.RULE_signed_double)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 619
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==TypeQLPythonParser.ADD or _la==TypeQLPythonParser.SUBTRACT:
                self.state = 618
                self.sign()


            self.state = 621
            self.match(TypeQLPythonParser.DOUBLE_)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SignContext(ParserRuleContext):

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

        def ADD(self):
            return self.getToken(TypeQLPythonParser.ADD, 0)

        def SUBTRACT(self):
            return self.getToken(TypeQLPythonParser.SUBTRACT, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_sign

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitSign" ):
                return visitor.visitSign(self)
            else:
                return visitor.visitChildren(self)




    def sign(self):

        localctx = TypeQLPythonParser.SignContext(self, self._ctx, self.state)
        self.enterRule(localctx, 142, self.RULE_sign)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 623
            _la = self._input.LA(1)
            if not(_la==TypeQLPythonParser.ADD or _la==TypeQLPythonParser.SUBTRACT):
                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 UnreservedContext(ParserRuleContext):

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

        def VALUE(self):
            return self.getToken(TypeQLPythonParser.VALUE, 0)

        def EXPR_FUNC_NAME(self):
            return self.getToken(TypeQLPythonParser.EXPR_FUNC_NAME, 0)

        def MIN(self):
            return self.getToken(TypeQLPythonParser.MIN, 0)

        def MAX(self):
            return self.getToken(TypeQLPythonParser.MAX, 0)

        def MEDIAN(self):
            return self.getToken(TypeQLPythonParser.MEDIAN, 0)

        def MEAN(self):
            return self.getToken(TypeQLPythonParser.MEAN, 0)

        def STD(self):
            return self.getToken(TypeQLPythonParser.STD, 0)

        def SUM(self):
            return self.getToken(TypeQLPythonParser.SUM, 0)

        def COUNT(self):
            return self.getToken(TypeQLPythonParser.COUNT, 0)

        def GET(self):
            return self.getToken(TypeQLPythonParser.GET, 0)

        def SORT(self):
            return self.getToken(TypeQLPythonParser.SORT, 0)

        def LIMIT(self):
            return self.getToken(TypeQLPythonParser.LIMIT, 0)

        def OFFSET(self):
            return self.getToken(TypeQLPythonParser.OFFSET, 0)

        def GROUP(self):
            return self.getToken(TypeQLPythonParser.GROUP, 0)

        def CONTAINS(self):
            return self.getToken(TypeQLPythonParser.CONTAINS, 0)

        def RULE(self):
            return self.getToken(TypeQLPythonParser.RULE, 0)

        def getRuleIndex(self):
            return TypeQLPythonParser.RULE_unreserved

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

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

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitUnreserved" ):
                return visitor.visitUnreserved(self)
            else:
                return visitor.visitChildren(self)




    def unreserved(self):

        localctx = TypeQLPythonParser.UnreservedContext(self, self._ctx, self.state)
        self.enterRule(localctx, 144, self.RULE_unreserved)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 625
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << TypeQLPythonParser.GET) | (1 << TypeQLPythonParser.RULE) | (1 << TypeQLPythonParser.OFFSET) | (1 << TypeQLPythonParser.LIMIT) | (1 << TypeQLPythonParser.SORT) | (1 << TypeQLPythonParser.VALUE) | (1 << TypeQLPythonParser.CONTAINS))) != 0) or ((((_la - 65)) & ~0x3f) == 0 and ((1 << (_la - 65)) & ((1 << (TypeQLPythonParser.EXPR_FUNC_NAME - 65)) | (1 << (TypeQLPythonParser.GROUP - 65)) | (1 << (TypeQLPythonParser.COUNT - 65)) | (1 << (TypeQLPythonParser.MAX - 65)) | (1 << (TypeQLPythonParser.MIN - 65)) | (1 << (TypeQLPythonParser.MEAN - 65)) | (1 << (TypeQLPythonParser.MEDIAN - 65)) | (1 << (TypeQLPythonParser.STD - 65)) | (1 << (TypeQLPythonParser.SUM - 65)))) != 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



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[54] = self.expression_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

    def expression_sempred(self, localctx:ExpressionContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 4)
         

            if predIndex == 1:
                return self.precpred(self._ctx, 3)
         

            if predIndex == 2:
                return self.precpred(self._ctx, 2)
         




