# Generated from PartiQLParser.g4 by ANTLR 4.13.0
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO

def serializedATN():
    return [
        4,1,310,1826,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,
        7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,
        13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,
        20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,
        26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,
        33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,
        39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,
        46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,
        52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,
        59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2,65,7,
        65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71,7,71,2,
        72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2,77,7,77,2,78,7,
        78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2,84,7,84,2,
        85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2,91,7,
        91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97,7,97,2,
        98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103,7,103,
        2,104,7,104,2,105,7,105,2,106,7,106,2,107,7,107,2,108,7,108,2,109,
        7,109,2,110,7,110,2,111,7,111,2,112,7,112,2,113,7,113,2,114,7,114,
        2,115,7,115,2,116,7,116,2,117,7,117,2,118,7,118,2,119,7,119,2,120,
        7,120,2,121,7,121,2,122,7,122,2,123,7,123,2,124,7,124,2,125,7,125,
        2,126,7,126,2,127,7,127,2,128,7,128,2,129,7,129,2,130,7,130,2,131,
        7,131,2,132,7,132,2,133,7,133,2,134,7,134,2,135,7,135,2,136,7,136,
        2,137,7,137,2,138,7,138,2,139,7,139,1,0,1,0,1,0,1,0,1,0,5,0,286,
        8,0,10,0,12,0,289,9,0,1,0,1,0,3,0,293,8,0,3,0,295,8,0,1,0,1,0,1,
        0,1,1,1,1,3,1,302,8,1,1,1,1,1,3,1,306,8,1,1,1,1,1,3,1,310,8,1,1,
        1,1,1,3,1,314,8,1,3,1,316,8,1,1,2,1,2,1,2,1,3,1,3,1,3,1,4,1,4,1,
        4,1,5,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,8,1,8,1,8,5,8,339,8,8,10,
        8,12,8,342,9,8,3,8,344,8,8,1,9,1,9,1,9,5,9,349,8,9,10,9,12,9,352,
        9,9,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,3,
        14,366,8,14,1,15,1,15,1,15,1,15,1,15,1,15,1,15,3,15,375,8,15,1,15,
        1,15,1,15,1,15,1,15,1,15,1,15,1,15,5,15,385,8,15,10,15,12,15,388,
        9,15,1,15,1,15,3,15,392,8,15,1,16,1,16,1,16,1,16,1,16,1,16,1,16,
        1,16,1,16,3,16,403,8,16,1,17,1,17,1,17,5,17,408,8,17,10,17,12,17,
        411,9,17,1,18,1,18,1,18,5,18,416,8,18,10,18,12,18,419,9,18,1,19,
        1,19,3,19,423,8,19,1,19,1,19,1,20,1,20,1,20,3,20,430,8,20,1,21,1,
        21,4,21,434,8,21,11,21,12,21,435,1,21,3,21,439,8,21,1,21,3,21,442,
        8,21,1,21,1,21,3,21,446,8,21,1,21,4,21,449,8,21,11,21,12,21,450,
        1,21,3,21,454,8,21,1,21,1,21,1,21,3,21,459,8,21,1,22,1,22,1,22,1,
        22,1,22,1,22,3,22,467,8,22,1,23,1,23,5,23,471,8,23,10,23,12,23,474,
        9,23,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,3,24,486,
        8,24,1,25,1,25,1,25,1,25,3,25,492,8,25,1,25,1,25,1,26,1,26,1,26,
        1,26,3,26,500,8,26,1,26,1,26,1,27,1,27,1,27,1,28,1,28,1,28,1,28,
        1,28,1,28,1,28,3,28,514,8,28,1,28,3,28,517,8,28,1,28,3,28,520,8,
        28,1,29,1,29,1,29,1,29,3,29,526,8,29,1,29,1,29,3,29,530,8,29,1,29,
        1,29,1,29,1,29,3,29,536,8,29,1,29,1,29,3,29,540,8,29,3,29,542,8,
        29,1,30,1,30,1,30,1,30,5,30,548,8,30,10,30,12,30,551,9,30,1,30,1,
        30,1,31,1,31,1,31,3,31,558,8,31,1,31,1,31,1,32,1,32,1,32,1,32,1,
        32,1,32,1,32,3,32,569,8,32,1,32,3,32,572,8,32,1,33,1,33,1,33,1,33,
        1,33,1,33,1,33,1,34,1,34,1,34,1,34,5,34,585,8,34,10,34,12,34,588,
        9,34,1,34,1,34,1,34,1,34,1,34,3,34,595,8,34,1,35,1,35,1,36,1,36,
        1,36,1,36,1,36,1,36,1,36,1,36,3,36,607,8,36,1,37,1,37,1,37,3,37,
        612,8,37,1,38,1,38,1,38,3,38,617,8,38,1,39,1,39,1,39,1,40,1,40,1,
        40,1,40,5,40,626,8,40,10,40,12,40,629,9,40,1,41,1,41,1,41,1,41,1,
        42,1,42,1,42,3,42,638,8,42,1,42,3,42,641,8,42,1,43,1,43,1,43,1,43,
        5,43,647,8,43,10,43,12,43,650,9,43,1,44,1,44,1,44,1,44,1,44,1,44,
        3,44,658,8,44,1,45,1,45,1,45,3,45,663,8,45,1,45,3,45,666,8,45,1,
        45,3,45,669,8,45,1,45,1,45,1,45,1,45,3,45,675,8,45,1,46,1,46,1,46,
        1,47,1,47,3,47,682,8,47,1,47,1,47,1,47,3,47,687,8,47,1,47,1,47,1,
        47,3,47,692,8,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,3,47,701,8,47,
        1,48,1,48,1,48,5,48,706,8,48,10,48,12,48,709,9,48,1,49,1,49,3,49,
        713,8,49,1,49,3,49,716,8,49,1,50,1,50,1,51,1,51,1,51,1,51,5,51,724,
        8,51,10,51,12,51,727,9,51,1,52,1,52,1,52,1,52,1,53,1,53,1,53,1,53,
        1,53,5,53,738,8,53,10,53,12,53,741,9,53,1,54,1,54,3,54,745,8,54,
        1,54,1,54,3,54,749,8,54,1,55,1,55,3,55,753,8,55,1,55,1,55,1,55,1,
        55,5,55,759,8,55,10,55,12,55,762,9,55,1,55,3,55,765,8,55,1,56,1,
        56,1,56,1,56,1,57,1,57,1,57,3,57,774,8,57,1,58,1,58,1,58,3,58,779,
        8,58,1,58,3,58,782,8,58,1,58,1,58,1,59,1,59,1,59,1,59,1,59,5,59,
        791,8,59,10,59,12,59,794,9,59,1,60,1,60,1,60,1,60,1,60,5,60,801,
        8,60,10,60,12,60,804,9,60,1,61,1,61,1,61,1,62,1,62,1,62,1,62,5,62,
        813,8,62,10,62,12,62,816,9,62,1,63,1,63,4,63,820,8,63,11,63,12,63,
        821,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,
        1,64,3,64,837,8,64,1,65,1,65,1,65,1,66,1,66,1,66,1,67,1,67,1,67,
        1,68,1,68,1,68,1,69,3,69,852,8,69,1,69,1,69,1,70,3,70,857,8,70,1,
        70,1,70,1,70,5,70,862,8,70,10,70,12,70,865,9,70,1,71,3,71,868,8,
        71,1,71,3,71,871,8,71,1,71,5,71,874,8,71,10,71,12,71,877,9,71,1,
        72,1,72,1,72,3,72,882,8,72,1,73,1,73,1,73,1,73,3,73,888,8,73,1,73,
        1,73,1,73,3,73,893,8,73,3,73,895,8,73,1,74,1,74,1,74,1,75,1,75,1,
        76,1,76,3,76,904,8,76,1,76,1,76,3,76,908,8,76,1,76,3,76,911,8,76,
        1,76,1,76,1,77,1,77,3,77,917,8,77,1,77,1,77,3,77,921,8,77,3,77,923,
        8,77,1,78,1,78,3,78,927,8,78,1,78,3,78,930,8,78,1,78,4,78,933,8,
        78,11,78,12,78,934,1,78,3,78,938,8,78,1,78,1,78,3,78,942,8,78,1,
        78,1,78,3,78,946,8,78,1,78,3,78,949,8,78,1,78,4,78,952,8,78,11,78,
        12,78,953,1,78,3,78,957,8,78,1,78,1,78,3,78,961,8,78,3,78,963,8,
        78,1,79,1,79,1,79,1,79,1,79,3,79,970,8,79,1,79,3,79,973,8,79,1,80,
        1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,
        1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80,
        1,80,1,80,1,80,1,80,1,80,1,80,1,80,3,80,1009,8,80,1,81,1,81,3,81,
        1013,8,81,1,81,1,81,3,81,1017,8,81,1,81,3,81,1020,8,81,1,81,1,81,
        1,82,1,82,1,82,1,82,1,82,1,82,5,82,1030,8,82,10,82,12,82,1033,9,
        82,1,83,1,83,1,83,1,83,1,83,1,83,5,83,1041,8,83,10,83,12,83,1044,
        9,83,1,84,1,84,1,84,3,84,1049,8,84,1,85,1,85,1,85,1,85,1,85,1,85,
        3,85,1057,8,85,1,86,1,86,1,86,1,86,1,86,1,86,3,86,1065,8,86,1,86,
        1,86,3,86,1069,8,86,3,86,1071,8,86,1,87,1,87,1,87,1,87,1,87,1,87,
        3,87,1079,8,87,1,87,1,87,3,87,1083,8,87,1,87,1,87,1,87,1,87,1,87,
        1,87,1,87,1,87,3,87,1093,8,87,1,87,1,87,1,87,1,87,5,87,1099,8,87,
        10,87,12,87,1102,9,87,1,88,1,88,3,88,1106,8,88,1,89,1,89,1,89,1,
        89,1,89,3,89,1113,8,89,1,89,3,89,1116,8,89,1,89,3,89,1119,8,89,1,
        89,1,89,3,89,1123,8,89,1,89,3,89,1126,8,89,1,89,3,89,1129,8,89,3,
        89,1131,8,89,1,90,1,90,1,90,3,90,1136,8,90,1,90,3,90,1139,8,90,1,
        90,3,90,1142,8,90,1,91,1,91,1,91,1,91,1,91,3,91,1149,8,91,1,92,1,
        92,1,92,1,93,1,93,1,93,3,93,1157,8,93,1,93,1,93,3,93,1161,8,93,1,
        93,1,93,3,93,1165,8,93,1,93,3,93,1168,8,93,1,94,1,94,1,95,1,95,1,
        95,1,95,1,95,3,95,1177,8,95,1,95,1,95,3,95,1181,8,95,1,95,1,95,1,
        95,3,95,1186,8,95,1,95,1,95,3,95,1190,8,95,1,95,1,95,1,95,3,95,1195,
        8,95,1,95,1,95,3,95,1199,8,95,1,95,5,95,1202,8,95,10,95,12,95,1205,
        9,95,1,96,1,96,3,96,1209,8,96,1,96,1,96,3,96,1213,8,96,1,96,3,96,
        1216,8,96,1,96,3,96,1219,8,96,1,96,3,96,1222,8,96,1,96,3,96,1225,
        8,96,1,96,3,96,1228,8,96,1,96,3,96,1231,8,96,1,96,3,96,1234,8,96,
        1,97,1,97,1,97,1,97,1,97,1,97,5,97,1242,8,97,10,97,12,97,1245,9,
        97,1,98,1,98,1,98,1,98,1,98,1,98,5,98,1253,8,98,10,98,12,98,1256,
        9,98,1,99,1,99,1,99,3,99,1261,8,99,1,100,1,100,1,100,1,100,1,100,
        1,100,1,100,1,100,1,100,3,100,1272,8,100,1,100,1,100,1,100,3,100,
        1277,8,100,1,100,1,100,1,100,1,100,1,100,1,100,1,100,3,100,1286,
        8,100,1,100,1,100,1,100,1,100,3,100,1292,8,100,1,100,1,100,1,100,
        1,100,3,100,1298,8,100,1,100,1,100,3,100,1302,8,100,1,100,1,100,
        1,100,1,100,1,100,5,100,1309,8,100,10,100,12,100,1312,9,100,1,101,
        1,101,1,101,1,101,1,101,1,101,5,101,1320,8,101,10,101,12,101,1323,
        9,101,1,102,1,102,1,102,1,102,1,102,1,102,5,102,1331,8,102,10,102,
        12,102,1334,9,102,1,103,1,103,1,103,1,103,1,103,1,103,5,103,1342,
        8,103,10,103,12,103,1345,9,103,1,104,1,104,1,104,3,104,1350,8,104,
        1,105,1,105,1,105,1,105,1,105,1,105,1,105,1,105,1,105,1,105,1,105,
        1,105,1,105,1,105,1,105,1,105,1,105,1,105,1,105,1,105,1,105,3,105,
        1373,8,105,1,105,1,105,4,105,1377,8,105,11,105,12,105,1378,5,105,
        1381,8,105,10,105,12,105,1384,9,105,1,106,1,106,1,106,1,106,1,106,
        1,106,1,106,1,106,1,106,1,106,1,106,3,106,1397,8,106,1,107,1,107,
        1,107,1,107,1,107,1,107,1,107,1,108,1,108,1,108,1,108,1,108,5,108,
        1411,8,108,10,108,12,108,1414,9,108,1,108,1,108,1,109,1,109,3,109,
        1420,8,109,1,109,1,109,1,109,1,109,1,109,4,109,1427,8,109,11,109,
        12,109,1428,1,109,1,109,3,109,1433,8,109,1,109,1,109,1,110,1,110,
        1,110,1,110,5,110,1441,8,110,10,110,12,110,1444,9,110,1,111,1,111,
        1,111,1,111,5,111,1450,8,111,10,111,12,111,1453,9,111,1,111,1,111,
        1,112,1,112,1,112,1,112,4,112,1461,8,112,11,112,12,112,1462,1,112,
        1,112,1,113,1,113,1,113,1,113,1,113,5,113,1472,8,113,10,113,12,113,
        1475,9,113,3,113,1477,8,113,1,113,1,113,1,114,1,114,1,114,1,114,
        1,114,1,114,1,114,3,114,1488,8,114,3,114,1490,8,114,1,114,1,114,
        1,114,1,114,1,114,1,114,1,114,1,114,1,114,3,114,1501,8,114,3,114,
        1503,8,114,1,114,1,114,3,114,1507,8,114,1,115,1,115,1,115,1,115,
        1,115,1,115,1,115,1,115,1,115,1,115,1,115,1,115,1,115,1,115,3,115,
        1523,8,115,1,116,1,116,1,116,1,116,1,116,1,116,1,116,1,116,1,116,
        3,116,1534,8,116,1,116,1,116,1,116,1,116,1,116,1,116,1,116,1,116,
        1,116,1,116,1,116,3,116,1547,8,116,1,116,1,116,3,116,1551,8,116,
        1,117,1,117,1,117,1,117,1,117,1,117,1,117,3,117,1560,8,117,1,117,
        1,117,1,117,3,117,1565,8,117,1,118,1,118,1,118,1,118,1,118,1,118,
        1,118,3,118,1574,8,118,3,118,1576,8,118,1,118,1,118,1,118,1,119,
        1,119,1,119,1,119,1,119,1,119,1,119,1,120,1,120,1,120,1,120,1,120,
        1,120,1,120,1,121,1,121,1,121,1,121,1,121,1,121,1,121,1,122,1,122,
        1,122,1,122,1,122,1,122,1,122,1,123,1,123,1,123,3,123,1612,8,123,
        1,123,3,123,1615,8,123,1,123,3,123,1618,8,123,1,123,1,123,1,123,
        1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,125,1,125,
        1,125,1,125,1,125,5,125,1637,8,125,10,125,12,125,1640,9,125,3,125,
        1642,8,125,1,125,1,125,1,126,1,126,1,126,5,126,1649,8,126,10,126,
        12,126,1652,9,126,1,126,1,126,1,126,1,126,5,126,1658,8,126,10,126,
        12,126,1661,9,126,1,126,3,126,1664,8,126,1,127,1,127,1,127,1,127,
        1,127,1,127,1,127,1,127,1,127,1,127,1,127,3,127,1677,8,127,1,128,
        1,128,1,128,1,128,1,128,1,128,1,129,1,129,1,129,1,129,1,130,1,130,
        1,131,3,131,1692,8,131,1,131,1,131,3,131,1696,8,131,1,131,3,131,
        1699,8,131,1,132,1,132,1,133,1,133,3,133,1705,8,133,1,134,1,134,
        1,134,1,134,5,134,1711,8,134,10,134,12,134,1714,9,134,3,134,1716,
        8,134,1,134,1,134,1,135,1,135,1,135,1,135,5,135,1724,8,135,10,135,
        12,135,1727,9,135,3,135,1729,8,135,1,135,1,135,1,136,1,136,1,136,
        1,136,5,136,1737,8,136,10,136,12,136,1740,9,136,3,136,1742,8,136,
        1,136,1,136,1,137,1,137,1,137,1,137,1,138,1,138,1,138,1,138,1,138,
        1,138,1,138,1,138,1,138,1,138,1,138,1,138,1,138,1,138,3,138,1764,
        8,138,1,138,1,138,1,138,3,138,1769,8,138,1,138,1,138,1,138,1,138,
        1,138,3,138,1776,8,138,1,138,1,138,1,138,3,138,1781,8,138,1,138,
        3,138,1784,8,138,1,139,1,139,1,139,1,139,1,139,1,139,1,139,3,139,
        1793,8,139,1,139,1,139,1,139,1,139,1,139,3,139,1800,8,139,1,139,
        1,139,1,139,1,139,1,139,3,139,1807,8,139,1,139,3,139,1810,8,139,
        1,139,1,139,1,139,1,139,3,139,1816,8,139,1,139,1,139,1,139,3,139,
        1821,8,139,1,139,3,139,1824,8,139,1,139,0,11,164,166,174,190,194,
        196,200,202,204,206,210,140,0,2,4,6,8,10,12,14,16,18,20,22,24,26,
        28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,
        72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,
        112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,
        144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,
        176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,
        208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,
        240,242,244,246,248,250,252,254,256,258,260,262,264,266,268,270,
        272,274,276,278,0,21,1,0,303,304,2,0,4,4,247,247,1,0,248,249,2,0,
        4,4,67,67,2,0,11,11,62,62,2,0,90,90,123,123,2,0,4,4,8,8,2,0,271,
        271,277,277,2,0,281,284,286,287,2,0,279,279,285,285,1,0,271,272,
        2,0,273,274,277,277,1,0,266,267,7,0,8,8,15,15,44,44,75,75,131,132,
        189,189,196,196,1,0,230,231,1,0,86,87,8,0,19,19,28,29,44,44,82,82,
        129,129,145,145,187,187,213,213,9,0,8,8,26,27,53,53,113,114,141,
        141,170,170,188,188,236,236,251,268,3,0,26,27,91,91,220,220,2,0,
        55,56,144,144,1,0,201,202,1991,0,294,1,0,0,0,2,315,1,0,0,0,4,317,
        1,0,0,0,6,320,1,0,0,0,8,323,1,0,0,0,10,326,1,0,0,0,12,329,1,0,0,
        0,14,331,1,0,0,0,16,333,1,0,0,0,18,350,1,0,0,0,20,355,1,0,0,0,22,
        357,1,0,0,0,24,359,1,0,0,0,26,361,1,0,0,0,28,365,1,0,0,0,30,391,
        1,0,0,0,32,402,1,0,0,0,34,404,1,0,0,0,36,412,1,0,0,0,38,422,1,0,
        0,0,40,429,1,0,0,0,42,458,1,0,0,0,44,466,1,0,0,0,46,468,1,0,0,0,
        48,485,1,0,0,0,50,487,1,0,0,0,52,495,1,0,0,0,54,503,1,0,0,0,56,506,
        1,0,0,0,58,541,1,0,0,0,60,543,1,0,0,0,62,554,1,0,0,0,64,561,1,0,
        0,0,66,573,1,0,0,0,68,594,1,0,0,0,70,596,1,0,0,0,72,606,1,0,0,0,
        74,608,1,0,0,0,76,613,1,0,0,0,78,618,1,0,0,0,80,621,1,0,0,0,82,630,
        1,0,0,0,84,634,1,0,0,0,86,642,1,0,0,0,88,657,1,0,0,0,90,674,1,0,
        0,0,92,676,1,0,0,0,94,700,1,0,0,0,96,702,1,0,0,0,98,710,1,0,0,0,
        100,717,1,0,0,0,102,719,1,0,0,0,104,728,1,0,0,0,106,732,1,0,0,0,
        108,742,1,0,0,0,110,750,1,0,0,0,112,766,1,0,0,0,114,770,1,0,0,0,
        116,775,1,0,0,0,118,785,1,0,0,0,120,795,1,0,0,0,122,805,1,0,0,0,
        124,808,1,0,0,0,126,817,1,0,0,0,128,836,1,0,0,0,130,838,1,0,0,0,
        132,841,1,0,0,0,134,844,1,0,0,0,136,847,1,0,0,0,138,851,1,0,0,0,
        140,856,1,0,0,0,142,867,1,0,0,0,144,881,1,0,0,0,146,894,1,0,0,0,
        148,896,1,0,0,0,150,899,1,0,0,0,152,901,1,0,0,0,154,922,1,0,0,0,
        156,962,1,0,0,0,158,972,1,0,0,0,160,1008,1,0,0,0,162,1010,1,0,0,
        0,164,1023,1,0,0,0,166,1034,1,0,0,0,168,1048,1,0,0,0,170,1056,1,
        0,0,0,172,1070,1,0,0,0,174,1078,1,0,0,0,176,1105,1,0,0,0,178,1130,
        1,0,0,0,180,1132,1,0,0,0,182,1148,1,0,0,0,184,1150,1,0,0,0,186,1167,
        1,0,0,0,188,1169,1,0,0,0,190,1171,1,0,0,0,192,1233,1,0,0,0,194,1235,
        1,0,0,0,196,1246,1,0,0,0,198,1260,1,0,0,0,200,1262,1,0,0,0,202,1313,
        1,0,0,0,204,1324,1,0,0,0,206,1335,1,0,0,0,208,1349,1,0,0,0,210,1372,
        1,0,0,0,212,1396,1,0,0,0,214,1398,1,0,0,0,216,1405,1,0,0,0,218,1417,
        1,0,0,0,220,1436,1,0,0,0,222,1445,1,0,0,0,224,1456,1,0,0,0,226,1466,
        1,0,0,0,228,1506,1,0,0,0,230,1522,1,0,0,0,232,1550,1,0,0,0,234,1564,
        1,0,0,0,236,1566,1,0,0,0,238,1580,1,0,0,0,240,1587,1,0,0,0,242,1594,
        1,0,0,0,244,1601,1,0,0,0,246,1608,1,0,0,0,248,1622,1,0,0,0,250,1631,
        1,0,0,0,252,1663,1,0,0,0,254,1676,1,0,0,0,256,1678,1,0,0,0,258,1684,
        1,0,0,0,260,1688,1,0,0,0,262,1698,1,0,0,0,264,1700,1,0,0,0,266,1704,
        1,0,0,0,268,1706,1,0,0,0,270,1719,1,0,0,0,272,1732,1,0,0,0,274,1745,
        1,0,0,0,276,1783,1,0,0,0,278,1823,1,0,0,0,280,292,5,83,0,0,281,282,
        5,294,0,0,282,287,3,4,2,0,283,284,5,270,0,0,284,286,3,4,2,0,285,
        283,1,0,0,0,286,289,1,0,0,0,287,285,1,0,0,0,287,288,1,0,0,0,288,
        290,1,0,0,0,289,287,1,0,0,0,290,291,5,295,0,0,291,293,1,0,0,0,292,
        281,1,0,0,0,292,293,1,0,0,0,293,295,1,0,0,0,294,280,1,0,0,0,294,
        295,1,0,0,0,295,296,1,0,0,0,296,297,3,2,1,0,297,298,5,0,0,1,298,
        1,1,0,0,0,299,301,3,14,7,0,300,302,5,297,0,0,301,300,1,0,0,0,301,
        302,1,0,0,0,302,316,1,0,0,0,303,305,3,42,21,0,304,306,5,297,0,0,
        305,304,1,0,0,0,305,306,1,0,0,0,306,316,1,0,0,0,307,309,3,28,14,
        0,308,310,5,297,0,0,309,308,1,0,0,0,309,310,1,0,0,0,310,316,1,0,
        0,0,311,313,3,16,8,0,312,314,5,297,0,0,313,312,1,0,0,0,313,314,1,
        0,0,0,314,316,1,0,0,0,315,299,1,0,0,0,315,303,1,0,0,0,315,307,1,
        0,0,0,315,311,1,0,0,0,316,3,1,0,0,0,317,318,5,303,0,0,318,319,5,
        303,0,0,319,5,1,0,0,0,320,321,5,10,0,0,321,322,3,12,6,0,322,7,1,
        0,0,0,323,324,5,13,0,0,324,325,3,12,6,0,325,9,1,0,0,0,326,327,5,
        20,0,0,327,328,3,12,6,0,328,11,1,0,0,0,329,330,7,0,0,0,330,13,1,
        0,0,0,331,332,3,188,94,0,332,15,1,0,0,0,333,334,5,80,0,0,334,343,
        3,188,94,0,335,340,3,188,94,0,336,337,5,270,0,0,337,339,3,188,94,
        0,338,336,1,0,0,0,339,342,1,0,0,0,340,338,1,0,0,0,340,341,1,0,0,
        0,341,344,1,0,0,0,342,340,1,0,0,0,343,335,1,0,0,0,343,344,1,0,0,
        0,344,17,1,0,0,0,345,346,3,12,6,0,346,347,5,299,0,0,347,349,1,0,
        0,0,348,345,1,0,0,0,349,352,1,0,0,0,350,348,1,0,0,0,350,351,1,0,
        0,0,351,353,1,0,0,0,352,350,1,0,0,0,353,354,3,12,6,0,354,19,1,0,
        0,0,355,356,3,12,6,0,356,21,1,0,0,0,357,358,3,12,6,0,358,23,1,0,
        0,0,359,360,3,12,6,0,360,25,1,0,0,0,361,362,3,12,6,0,362,27,1,0,
        0,0,363,366,3,30,15,0,364,366,3,32,16,0,365,363,1,0,0,0,365,364,
        1,0,0,0,366,29,1,0,0,0,367,368,5,45,0,0,368,369,5,198,0,0,369,374,
        3,18,9,0,370,371,5,294,0,0,371,372,3,34,17,0,372,373,5,295,0,0,373,
        375,1,0,0,0,374,370,1,0,0,0,374,375,1,0,0,0,375,392,1,0,0,0,376,
        377,5,45,0,0,377,378,5,242,0,0,378,379,5,147,0,0,379,380,3,12,6,
        0,380,381,5,294,0,0,381,386,3,46,23,0,382,383,5,270,0,0,383,385,
        3,46,23,0,384,382,1,0,0,0,385,388,1,0,0,0,386,384,1,0,0,0,386,387,
        1,0,0,0,387,389,1,0,0,0,388,386,1,0,0,0,389,390,5,295,0,0,390,392,
        1,0,0,0,391,367,1,0,0,0,391,376,1,0,0,0,392,31,1,0,0,0,393,394,5,
        70,0,0,394,395,5,198,0,0,395,403,3,18,9,0,396,397,5,70,0,0,397,398,
        5,242,0,0,398,399,3,12,6,0,399,400,5,147,0,0,400,401,3,12,6,0,401,
        403,1,0,0,0,402,393,1,0,0,0,402,396,1,0,0,0,403,33,1,0,0,0,404,409,
        3,36,18,0,405,406,5,270,0,0,406,408,3,36,18,0,407,405,1,0,0,0,408,
        411,1,0,0,0,409,407,1,0,0,0,409,410,1,0,0,0,410,35,1,0,0,0,411,409,
        1,0,0,0,412,413,3,24,12,0,413,417,3,278,139,0,414,416,3,38,19,0,
        415,414,1,0,0,0,416,419,1,0,0,0,417,415,1,0,0,0,417,418,1,0,0,0,
        418,37,1,0,0,0,419,417,1,0,0,0,420,421,5,39,0,0,421,423,3,26,13,
        0,422,420,1,0,0,0,422,423,1,0,0,0,423,424,1,0,0,0,424,425,3,40,20,
        0,425,39,1,0,0,0,426,427,5,140,0,0,427,430,5,141,0,0,428,430,5,141,
        0,0,429,426,1,0,0,0,429,428,1,0,0,0,430,41,1,0,0,0,431,433,3,78,
        39,0,432,434,3,44,22,0,433,432,1,0,0,0,434,435,1,0,0,0,435,433,1,
        0,0,0,435,436,1,0,0,0,436,438,1,0,0,0,437,439,3,92,46,0,438,437,
        1,0,0,0,438,439,1,0,0,0,439,441,1,0,0,0,440,442,3,86,43,0,441,440,
        1,0,0,0,441,442,1,0,0,0,442,459,1,0,0,0,443,445,3,130,65,0,444,446,
        3,92,46,0,445,444,1,0,0,0,445,446,1,0,0,0,446,448,1,0,0,0,447,449,
        3,44,22,0,448,447,1,0,0,0,449,450,1,0,0,0,450,448,1,0,0,0,450,451,
        1,0,0,0,451,453,1,0,0,0,452,454,3,86,43,0,453,452,1,0,0,0,453,454,
        1,0,0,0,454,459,1,0,0,0,455,459,3,84,42,0,456,459,3,56,28,0,457,
        459,3,44,22,0,458,431,1,0,0,0,458,443,1,0,0,0,458,455,1,0,0,0,458,
        456,1,0,0,0,458,457,1,0,0,0,459,43,1,0,0,0,460,467,3,58,29,0,461,
        467,3,64,32,0,462,467,3,80,40,0,463,467,3,50,25,0,464,467,3,54,27,
        0,465,467,3,52,26,0,466,460,1,0,0,0,466,461,1,0,0,0,466,462,1,0,
        0,0,466,463,1,0,0,0,466,464,1,0,0,0,466,465,1,0,0,0,467,45,1,0,0,
        0,468,472,3,12,6,0,469,471,3,48,24,0,470,469,1,0,0,0,471,474,1,0,
        0,0,472,470,1,0,0,0,472,473,1,0,0,0,473,47,1,0,0,0,474,472,1,0,0,
        0,475,476,5,290,0,0,476,477,3,276,138,0,477,478,5,291,0,0,478,486,
        1,0,0,0,479,480,5,290,0,0,480,481,3,12,6,0,481,482,5,291,0,0,482,
        486,1,0,0,0,483,484,5,299,0,0,484,486,3,12,6,0,485,475,1,0,0,0,485,
        479,1,0,0,0,485,483,1,0,0,0,486,49,1,0,0,0,487,488,5,173,0,0,488,
        489,5,117,0,0,489,491,3,12,6,0,490,492,3,6,3,0,491,490,1,0,0,0,491,
        492,1,0,0,0,492,493,1,0,0,0,493,494,3,188,94,0,494,51,1,0,0,0,495,
        496,5,214,0,0,496,497,5,117,0,0,497,499,3,12,6,0,498,500,3,6,3,0,
        499,498,1,0,0,0,499,500,1,0,0,0,500,501,1,0,0,0,501,502,3,188,94,
        0,502,53,1,0,0,0,503,504,5,241,0,0,504,505,3,46,23,0,505,55,1,0,
        0,0,506,507,5,112,0,0,507,508,5,117,0,0,508,509,3,46,23,0,509,510,
        5,218,0,0,510,513,3,188,94,0,511,512,5,13,0,0,512,514,3,188,94,0,
        513,511,1,0,0,0,513,514,1,0,0,0,514,516,1,0,0,0,515,517,3,66,33,
        0,516,515,1,0,0,0,516,517,1,0,0,0,517,519,1,0,0,0,518,520,3,86,43,
        0,519,518,1,0,0,0,519,520,1,0,0,0,520,57,1,0,0,0,521,522,5,112,0,
        0,522,523,5,117,0,0,523,525,3,12,6,0,524,526,3,60,30,0,525,524,1,
        0,0,0,525,526,1,0,0,0,526,527,1,0,0,0,527,529,3,220,110,0,528,530,
        3,62,31,0,529,528,1,0,0,0,529,530,1,0,0,0,530,542,1,0,0,0,531,532,
        5,112,0,0,532,533,5,117,0,0,533,535,3,12,6,0,534,536,3,6,3,0,535,
        534,1,0,0,0,535,536,1,0,0,0,536,537,1,0,0,0,537,539,3,188,94,0,538,
        540,3,62,31,0,539,538,1,0,0,0,539,540,1,0,0,0,540,542,1,0,0,0,541,
        521,1,0,0,0,541,531,1,0,0,0,542,59,1,0,0,0,543,544,5,294,0,0,544,
        549,3,24,12,0,545,546,5,270,0,0,546,548,3,24,12,0,547,545,1,0,0,
        0,548,551,1,0,0,0,549,547,1,0,0,0,549,550,1,0,0,0,550,552,1,0,0,
        0,551,549,1,0,0,0,552,553,5,295,0,0,553,61,1,0,0,0,554,555,5,147,
        0,0,555,557,5,244,0,0,556,558,3,68,34,0,557,556,1,0,0,0,557,558,
        1,0,0,0,558,559,1,0,0,0,559,560,3,72,36,0,560,63,1,0,0,0,561,562,
        5,112,0,0,562,563,5,117,0,0,563,564,3,46,23,0,564,565,5,218,0,0,
        565,568,3,188,94,0,566,567,5,13,0,0,567,569,3,188,94,0,568,566,1,
        0,0,0,568,569,1,0,0,0,569,571,1,0,0,0,570,572,3,66,33,0,571,570,
        1,0,0,0,571,572,1,0,0,0,572,65,1,0,0,0,573,574,5,147,0,0,574,575,
        5,244,0,0,575,576,5,225,0,0,576,577,3,188,94,0,577,578,5,245,0,0,
        578,579,5,250,0,0,579,67,1,0,0,0,580,581,5,294,0,0,581,586,3,12,
        6,0,582,583,5,270,0,0,583,585,3,12,6,0,584,582,1,0,0,0,585,588,1,
        0,0,0,586,584,1,0,0,0,586,587,1,0,0,0,587,589,1,0,0,0,588,586,1,
        0,0,0,589,590,5,295,0,0,590,595,1,0,0,0,591,592,5,147,0,0,592,593,
        5,39,0,0,593,595,3,70,35,0,594,580,1,0,0,0,594,591,1,0,0,0,595,69,
        1,0,0,0,596,597,3,12,6,0,597,71,1,0,0,0,598,599,5,245,0,0,599,607,
        5,250,0,0,600,601,5,245,0,0,601,602,5,173,0,0,602,607,3,74,37,0,
        603,604,5,245,0,0,604,605,5,212,0,0,605,607,3,76,38,0,606,598,1,
        0,0,0,606,600,1,0,0,0,606,603,1,0,0,0,607,73,1,0,0,0,608,611,5,79,
        0,0,609,610,5,225,0,0,610,612,3,188,94,0,611,609,1,0,0,0,611,612,
        1,0,0,0,612,75,1,0,0,0,613,616,5,79,0,0,614,615,5,225,0,0,615,617,
        3,188,94,0,616,614,1,0,0,0,616,617,1,0,0,0,617,77,1,0,0,0,618,619,
        5,212,0,0,619,620,3,178,89,0,620,79,1,0,0,0,621,622,5,185,0,0,622,
        627,3,82,41,0,623,624,5,270,0,0,624,626,3,82,41,0,625,623,1,0,0,
        0,626,629,1,0,0,0,627,625,1,0,0,0,627,628,1,0,0,0,628,81,1,0,0,0,
        629,627,1,0,0,0,630,631,3,46,23,0,631,632,5,283,0,0,632,633,3,188,
        94,0,633,83,1,0,0,0,634,635,5,61,0,0,635,637,3,90,45,0,636,638,3,
        92,46,0,637,636,1,0,0,0,637,638,1,0,0,0,638,640,1,0,0,0,639,641,
        3,86,43,0,640,639,1,0,0,0,640,641,1,0,0,0,641,85,1,0,0,0,642,643,
        5,246,0,0,643,648,3,88,44,0,644,645,5,270,0,0,645,647,3,88,44,0,
        646,644,1,0,0,0,647,650,1,0,0,0,648,646,1,0,0,0,648,649,1,0,0,0,
        649,87,1,0,0,0,650,648,1,0,0,0,651,652,7,1,0,0,652,653,7,2,0,0,653,
        658,5,277,0,0,654,655,7,1,0,0,655,656,7,2,0,0,656,658,3,188,94,0,
        657,651,1,0,0,0,657,654,1,0,0,0,658,89,1,0,0,0,659,660,5,95,0,0,
        660,662,3,46,23,0,661,663,3,6,3,0,662,661,1,0,0,0,662,663,1,0,0,
        0,663,665,1,0,0,0,664,666,3,8,4,0,665,664,1,0,0,0,665,666,1,0,0,
        0,666,668,1,0,0,0,667,669,3,10,5,0,668,667,1,0,0,0,668,669,1,0,0,
        0,669,675,1,0,0,0,670,671,5,95,0,0,671,672,3,46,23,0,672,673,3,12,
        6,0,673,675,1,0,0,0,674,659,1,0,0,0,674,670,1,0,0,0,675,91,1,0,0,
        0,676,677,5,225,0,0,677,678,3,188,94,0,678,93,1,0,0,0,679,681,5,
        182,0,0,680,682,3,100,50,0,681,680,1,0,0,0,681,682,1,0,0,0,682,683,
        1,0,0,0,683,701,5,277,0,0,684,686,5,182,0,0,685,687,3,100,50,0,686,
        685,1,0,0,0,686,687,1,0,0,0,687,688,1,0,0,0,688,701,3,96,48,0,689,
        691,5,182,0,0,690,692,3,100,50,0,691,690,1,0,0,0,691,692,1,0,0,0,
        692,693,1,0,0,0,693,694,5,218,0,0,694,701,3,188,94,0,695,696,5,237,
        0,0,696,697,3,188,94,0,697,698,5,13,0,0,698,699,3,188,94,0,699,701,
        1,0,0,0,700,679,1,0,0,0,700,684,1,0,0,0,700,689,1,0,0,0,700,695,
        1,0,0,0,701,95,1,0,0,0,702,707,3,98,49,0,703,704,5,270,0,0,704,706,
        3,98,49,0,705,703,1,0,0,0,706,709,1,0,0,0,707,705,1,0,0,0,707,708,
        1,0,0,0,708,97,1,0,0,0,709,707,1,0,0,0,710,715,3,188,94,0,711,713,
        5,10,0,0,712,711,1,0,0,0,712,713,1,0,0,0,713,714,1,0,0,0,714,716,
        3,12,6,0,715,712,1,0,0,0,715,716,1,0,0,0,716,99,1,0,0,0,717,718,
        7,3,0,0,718,101,1,0,0,0,719,720,5,243,0,0,720,725,3,104,52,0,721,
        722,5,270,0,0,722,724,3,104,52,0,723,721,1,0,0,0,724,727,1,0,0,0,
        725,723,1,0,0,0,725,726,1,0,0,0,726,103,1,0,0,0,727,725,1,0,0,0,
        728,729,3,188,94,0,729,730,5,10,0,0,730,731,3,12,6,0,731,105,1,0,
        0,0,732,733,5,152,0,0,733,734,5,20,0,0,734,739,3,108,54,0,735,736,
        5,270,0,0,736,738,3,108,54,0,737,735,1,0,0,0,738,741,1,0,0,0,739,
        737,1,0,0,0,739,740,1,0,0,0,740,107,1,0,0,0,741,739,1,0,0,0,742,
        744,3,188,94,0,743,745,7,4,0,0,744,743,1,0,0,0,744,745,1,0,0,0,745,
        748,1,0,0,0,746,747,5,142,0,0,747,749,7,5,0,0,748,746,1,0,0,0,748,
        749,1,0,0,0,749,109,1,0,0,0,750,752,5,102,0,0,751,753,5,158,0,0,
        752,751,1,0,0,0,752,753,1,0,0,0,753,754,1,0,0,0,754,755,5,20,0,0,
        755,760,3,114,57,0,756,757,5,270,0,0,757,759,3,114,57,0,758,756,
        1,0,0,0,759,762,1,0,0,0,760,758,1,0,0,0,760,761,1,0,0,0,761,764,
        1,0,0,0,762,760,1,0,0,0,763,765,3,112,56,0,764,763,1,0,0,0,764,765,
        1,0,0,0,765,111,1,0,0,0,766,767,5,102,0,0,767,768,5,10,0,0,768,769,
        3,12,6,0,769,113,1,0,0,0,770,773,3,192,96,0,771,772,5,10,0,0,772,
        774,3,12,6,0,773,771,1,0,0,0,773,774,1,0,0,0,774,115,1,0,0,0,775,
        776,5,232,0,0,776,778,5,294,0,0,777,779,3,118,59,0,778,777,1,0,0,
        0,778,779,1,0,0,0,779,781,1,0,0,0,780,782,3,120,60,0,781,780,1,0,
        0,0,781,782,1,0,0,0,782,783,1,0,0,0,783,784,5,295,0,0,784,117,1,
        0,0,0,785,786,5,233,0,0,786,787,5,20,0,0,787,792,3,188,94,0,788,
        789,5,270,0,0,789,791,3,188,94,0,790,788,1,0,0,0,791,794,1,0,0,0,
        792,790,1,0,0,0,792,793,1,0,0,0,793,119,1,0,0,0,794,792,1,0,0,0,
        795,796,5,152,0,0,796,797,5,20,0,0,797,802,3,108,54,0,798,799,5,
        270,0,0,799,801,3,108,54,0,800,798,1,0,0,0,801,804,1,0,0,0,802,800,
        1,0,0,0,802,803,1,0,0,0,803,121,1,0,0,0,804,802,1,0,0,0,805,806,
        5,103,0,0,806,807,3,192,96,0,807,123,1,0,0,0,808,809,5,78,0,0,809,
        814,3,126,63,0,810,811,5,270,0,0,811,813,3,126,63,0,812,810,1,0,
        0,0,813,816,1,0,0,0,814,812,1,0,0,0,814,815,1,0,0,0,815,125,1,0,
        0,0,816,814,1,0,0,0,817,819,3,12,6,0,818,820,3,128,64,0,819,818,
        1,0,0,0,820,821,1,0,0,0,821,819,1,0,0,0,821,822,1,0,0,0,822,127,
        1,0,0,0,823,824,5,299,0,0,824,837,3,12,6,0,825,826,5,290,0,0,826,
        827,5,300,0,0,827,837,5,291,0,0,828,829,5,290,0,0,829,830,5,301,
        0,0,830,837,5,291,0,0,831,832,5,290,0,0,832,833,5,277,0,0,833,837,
        5,291,0,0,834,835,5,299,0,0,835,837,5,277,0,0,836,823,1,0,0,0,836,
        825,1,0,0,0,836,828,1,0,0,0,836,831,1,0,0,0,836,834,1,0,0,0,837,
        129,1,0,0,0,838,839,5,95,0,0,839,840,3,174,87,0,840,131,1,0,0,0,
        841,842,5,225,0,0,842,843,3,192,96,0,843,133,1,0,0,0,844,845,5,240,
        0,0,845,846,3,192,96,0,846,135,1,0,0,0,847,848,5,239,0,0,848,849,
        3,192,96,0,849,137,1,0,0,0,850,852,3,146,73,0,851,850,1,0,0,0,851,
        852,1,0,0,0,852,853,1,0,0,0,853,854,3,142,71,0,854,139,1,0,0,0,855,
        857,3,146,73,0,856,855,1,0,0,0,856,857,1,0,0,0,857,858,1,0,0,0,858,
        863,3,142,71,0,859,860,5,270,0,0,860,862,3,142,71,0,861,859,1,0,
        0,0,862,865,1,0,0,0,863,861,1,0,0,0,863,864,1,0,0,0,864,141,1,0,
        0,0,865,863,1,0,0,0,866,868,3,150,75,0,867,866,1,0,0,0,867,868,1,
        0,0,0,868,870,1,0,0,0,869,871,3,148,74,0,870,869,1,0,0,0,870,871,
        1,0,0,0,871,875,1,0,0,0,872,874,3,144,72,0,873,872,1,0,0,0,874,877,
        1,0,0,0,875,873,1,0,0,0,875,876,1,0,0,0,876,143,1,0,0,0,877,875,
        1,0,0,0,878,882,3,152,76,0,879,882,3,154,77,0,880,882,3,156,78,0,
        881,878,1,0,0,0,881,879,1,0,0,0,881,880,1,0,0,0,882,145,1,0,0,0,
        883,884,7,6,0,0,884,895,5,186,0,0,885,887,5,8,0,0,886,888,5,301,
        0,0,887,886,1,0,0,0,887,888,1,0,0,0,888,895,1,0,0,0,889,890,5,186,
        0,0,890,892,5,301,0,0,891,893,5,102,0,0,892,891,1,0,0,0,892,893,
        1,0,0,0,893,895,1,0,0,0,894,883,1,0,0,0,894,885,1,0,0,0,894,889,
        1,0,0,0,895,147,1,0,0,0,896,897,3,12,6,0,897,898,5,283,0,0,898,149,
        1,0,0,0,899,900,5,303,0,0,900,151,1,0,0,0,901,903,5,294,0,0,902,
        904,3,12,6,0,903,902,1,0,0,0,903,904,1,0,0,0,904,907,1,0,0,0,905,
        906,5,296,0,0,906,908,3,164,82,0,907,905,1,0,0,0,907,908,1,0,0,0,
        908,910,1,0,0,0,909,911,3,92,46,0,910,909,1,0,0,0,910,911,1,0,0,
        0,911,912,1,0,0,0,912,913,5,295,0,0,913,153,1,0,0,0,914,916,3,160,
        80,0,915,917,3,158,79,0,916,915,1,0,0,0,916,917,1,0,0,0,917,923,
        1,0,0,0,918,920,3,172,86,0,919,921,3,158,79,0,920,919,1,0,0,0,920,
        921,1,0,0,0,921,923,1,0,0,0,922,914,1,0,0,0,922,918,1,0,0,0,923,
        155,1,0,0,0,924,926,5,294,0,0,925,927,3,150,75,0,926,925,1,0,0,0,
        926,927,1,0,0,0,927,929,1,0,0,0,928,930,3,148,74,0,929,928,1,0,0,
        0,929,930,1,0,0,0,930,932,1,0,0,0,931,933,3,144,72,0,932,931,1,0,
        0,0,933,934,1,0,0,0,934,932,1,0,0,0,934,935,1,0,0,0,935,937,1,0,
        0,0,936,938,3,92,46,0,937,936,1,0,0,0,937,938,1,0,0,0,938,939,1,
        0,0,0,939,941,5,295,0,0,940,942,3,158,79,0,941,940,1,0,0,0,941,942,
        1,0,0,0,942,963,1,0,0,0,943,945,5,290,0,0,944,946,3,150,75,0,945,
        944,1,0,0,0,945,946,1,0,0,0,946,948,1,0,0,0,947,949,3,148,74,0,948,
        947,1,0,0,0,948,949,1,0,0,0,949,951,1,0,0,0,950,952,3,144,72,0,951,
        950,1,0,0,0,952,953,1,0,0,0,953,951,1,0,0,0,953,954,1,0,0,0,954,
        956,1,0,0,0,955,957,3,92,46,0,956,955,1,0,0,0,956,957,1,0,0,0,957,
        958,1,0,0,0,958,960,5,291,0,0,959,961,3,158,79,0,960,959,1,0,0,0,
        960,961,1,0,0,0,961,963,1,0,0,0,962,924,1,0,0,0,962,943,1,0,0,0,
        963,157,1,0,0,0,964,973,7,7,0,0,965,966,5,292,0,0,966,967,5,301,
        0,0,967,969,5,270,0,0,968,970,5,301,0,0,969,968,1,0,0,0,969,970,
        1,0,0,0,970,971,1,0,0,0,971,973,5,293,0,0,972,964,1,0,0,0,972,965,
        1,0,0,0,973,159,1,0,0,0,974,975,5,272,0,0,975,976,3,162,81,0,976,
        977,5,272,0,0,977,978,5,287,0,0,978,1009,1,0,0,0,979,980,5,276,0,
        0,980,981,3,162,81,0,981,982,5,276,0,0,982,1009,1,0,0,0,983,984,
        5,286,0,0,984,985,5,272,0,0,985,986,3,162,81,0,986,987,5,272,0,0,
        987,1009,1,0,0,0,988,989,5,276,0,0,989,990,3,162,81,0,990,991,5,
        276,0,0,991,992,5,287,0,0,992,1009,1,0,0,0,993,994,5,286,0,0,994,
        995,5,276,0,0,995,996,3,162,81,0,996,997,5,276,0,0,997,1009,1,0,
        0,0,998,999,5,286,0,0,999,1000,5,272,0,0,1000,1001,3,162,81,0,1001,
        1002,5,272,0,0,1002,1003,5,287,0,0,1003,1009,1,0,0,0,1004,1005,5,
        272,0,0,1005,1006,3,162,81,0,1006,1007,5,272,0,0,1007,1009,1,0,0,
        0,1008,974,1,0,0,0,1008,979,1,0,0,0,1008,983,1,0,0,0,1008,988,1,
        0,0,0,1008,993,1,0,0,0,1008,998,1,0,0,0,1008,1004,1,0,0,0,1009,161,
        1,0,0,0,1010,1012,5,290,0,0,1011,1013,3,12,6,0,1012,1011,1,0,0,0,
        1012,1013,1,0,0,0,1013,1016,1,0,0,0,1014,1015,5,296,0,0,1015,1017,
        3,164,82,0,1016,1014,1,0,0,0,1016,1017,1,0,0,0,1017,1019,1,0,0,0,
        1018,1020,3,92,46,0,1019,1018,1,0,0,0,1019,1020,1,0,0,0,1020,1021,
        1,0,0,0,1021,1022,5,291,0,0,1022,163,1,0,0,0,1023,1024,6,82,-1,0,
        1024,1025,3,166,83,0,1025,1031,1,0,0,0,1026,1027,10,2,0,0,1027,1028,
        5,278,0,0,1028,1030,3,166,83,0,1029,1026,1,0,0,0,1030,1033,1,0,0,
        0,1031,1029,1,0,0,0,1031,1032,1,0,0,0,1032,165,1,0,0,0,1033,1031,
        1,0,0,0,1034,1035,6,83,-1,0,1035,1036,3,168,84,0,1036,1042,1,0,0,
        0,1037,1038,10,2,0,0,1038,1039,5,279,0,0,1039,1041,3,168,84,0,1040,
        1037,1,0,0,0,1041,1044,1,0,0,0,1042,1040,1,0,0,0,1042,1043,1,0,0,
        0,1043,167,1,0,0,0,1044,1042,1,0,0,0,1045,1046,5,280,0,0,1046,1049,
        3,170,85,0,1047,1049,3,170,85,0,1048,1045,1,0,0,0,1048,1047,1,0,
        0,0,1049,169,1,0,0,0,1050,1057,3,12,6,0,1051,1057,5,274,0,0,1052,
        1053,5,294,0,0,1053,1054,3,164,82,0,1054,1055,5,295,0,0,1055,1057,
        1,0,0,0,1056,1050,1,0,0,0,1056,1051,1,0,0,0,1056,1052,1,0,0,0,1057,
        171,1,0,0,0,1058,1071,5,276,0,0,1059,1060,5,276,0,0,1060,1071,5,
        287,0,0,1061,1062,5,286,0,0,1062,1071,5,276,0,0,1063,1065,5,286,
        0,0,1064,1063,1,0,0,0,1064,1065,1,0,0,0,1065,1066,1,0,0,0,1066,1068,
        5,272,0,0,1067,1069,5,287,0,0,1068,1067,1,0,0,0,1068,1069,1,0,0,
        0,1069,1071,1,0,0,0,1070,1058,1,0,0,0,1070,1059,1,0,0,0,1070,1061,
        1,0,0,0,1070,1064,1,0,0,0,1071,173,1,0,0,0,1072,1073,6,87,-1,0,1073,
        1079,3,176,88,0,1074,1075,5,294,0,0,1075,1076,3,174,87,0,1076,1077,
        5,295,0,0,1077,1079,1,0,0,0,1078,1072,1,0,0,0,1078,1074,1,0,0,0,
        1079,1100,1,0,0,0,1080,1082,10,5,0,0,1081,1083,3,186,93,0,1082,1081,
        1,0,0,0,1082,1083,1,0,0,0,1083,1084,1,0,0,0,1084,1085,5,46,0,0,1085,
        1086,5,120,0,0,1086,1099,3,182,91,0,1087,1088,10,4,0,0,1088,1089,
        5,270,0,0,1089,1099,3,182,91,0,1090,1092,10,3,0,0,1091,1093,3,186,
        93,0,1092,1091,1,0,0,0,1092,1093,1,0,0,0,1093,1094,1,0,0,0,1094,
        1095,5,120,0,0,1095,1096,3,182,91,0,1096,1097,3,184,92,0,1097,1099,
        1,0,0,0,1098,1080,1,0,0,0,1098,1087,1,0,0,0,1098,1090,1,0,0,0,1099,
        1102,1,0,0,0,1100,1098,1,0,0,0,1100,1101,1,0,0,0,1101,175,1,0,0,
        0,1102,1100,1,0,0,0,1103,1106,3,178,89,0,1104,1106,3,180,90,0,1105,
        1103,1,0,0,0,1105,1104,1,0,0,0,1106,177,1,0,0,0,1107,1108,3,192,
        96,0,1108,1109,3,12,6,0,1109,1131,1,0,0,0,1110,1112,3,192,96,0,1111,
        1113,3,6,3,0,1112,1111,1,0,0,0,1112,1113,1,0,0,0,1113,1115,1,0,0,
        0,1114,1116,3,8,4,0,1115,1114,1,0,0,0,1115,1116,1,0,0,0,1116,1118,
        1,0,0,0,1117,1119,3,10,5,0,1118,1117,1,0,0,0,1118,1119,1,0,0,0,1119,
        1131,1,0,0,0,1120,1122,3,258,129,0,1121,1123,3,6,3,0,1122,1121,1,
        0,0,0,1122,1123,1,0,0,0,1123,1125,1,0,0,0,1124,1126,3,8,4,0,1125,
        1124,1,0,0,0,1125,1126,1,0,0,0,1126,1128,1,0,0,0,1127,1129,3,10,
        5,0,1128,1127,1,0,0,0,1128,1129,1,0,0,0,1129,1131,1,0,0,0,1130,1107,
        1,0,0,0,1130,1110,1,0,0,0,1130,1120,1,0,0,0,1131,179,1,0,0,0,1132,
        1133,5,238,0,0,1133,1135,3,188,94,0,1134,1136,3,6,3,0,1135,1134,
        1,0,0,0,1135,1136,1,0,0,0,1136,1138,1,0,0,0,1137,1139,3,8,4,0,1138,
        1137,1,0,0,0,1138,1139,1,0,0,0,1139,1141,1,0,0,0,1140,1142,3,10,
        5,0,1141,1140,1,0,0,0,1141,1142,1,0,0,0,1142,181,1,0,0,0,1143,1149,
        3,176,88,0,1144,1145,5,294,0,0,1145,1146,3,174,87,0,1146,1147,5,
        295,0,0,1147,1149,1,0,0,0,1148,1143,1,0,0,0,1148,1144,1,0,0,0,1149,
        183,1,0,0,0,1150,1151,5,147,0,0,1151,1152,3,188,94,0,1152,185,1,
        0,0,0,1153,1168,5,109,0,0,1154,1156,5,125,0,0,1155,1157,5,153,0,
        0,1156,1155,1,0,0,0,1156,1157,1,0,0,0,1157,1168,1,0,0,0,1158,1160,
        5,176,0,0,1159,1161,5,153,0,0,1160,1159,1,0,0,0,1160,1161,1,0,0,
        0,1161,1168,1,0,0,0,1162,1164,5,96,0,0,1163,1165,5,153,0,0,1164,
        1163,1,0,0,0,1164,1165,1,0,0,0,1165,1168,1,0,0,0,1166,1168,5,153,
        0,0,1167,1153,1,0,0,0,1167,1154,1,0,0,0,1167,1158,1,0,0,0,1167,1162,
        1,0,0,0,1167,1166,1,0,0,0,1168,187,1,0,0,0,1169,1170,3,190,95,0,
        1170,189,1,0,0,0,1171,1172,6,95,-1,0,1172,1173,3,192,96,0,1173,1203,
        1,0,0,0,1174,1176,10,4,0,0,1175,1177,5,153,0,0,1176,1175,1,0,0,0,
        1176,1177,1,0,0,0,1177,1178,1,0,0,0,1178,1180,5,76,0,0,1179,1181,
        7,3,0,0,1180,1179,1,0,0,0,1180,1181,1,0,0,0,1181,1182,1,0,0,0,1182,
        1202,3,192,96,0,1183,1185,10,3,0,0,1184,1186,5,153,0,0,1185,1184,
        1,0,0,0,1185,1186,1,0,0,0,1186,1187,1,0,0,0,1187,1189,5,209,0,0,
        1188,1190,7,3,0,0,1189,1188,1,0,0,0,1189,1190,1,0,0,0,1190,1191,
        1,0,0,0,1191,1202,3,192,96,0,1192,1194,10,2,0,0,1193,1195,5,153,
        0,0,1194,1193,1,0,0,0,1194,1195,1,0,0,0,1195,1196,1,0,0,0,1196,1198,
        5,115,0,0,1197,1199,7,3,0,0,1198,1197,1,0,0,0,1198,1199,1,0,0,0,
        1199,1200,1,0,0,0,1200,1202,3,192,96,0,1201,1174,1,0,0,0,1201,1183,
        1,0,0,0,1201,1192,1,0,0,0,1202,1205,1,0,0,0,1203,1201,1,0,0,0,1203,
        1204,1,0,0,0,1204,191,1,0,0,0,1205,1203,1,0,0,0,1206,1208,3,94,47,
        0,1207,1209,3,124,62,0,1208,1207,1,0,0,0,1208,1209,1,0,0,0,1209,
        1210,1,0,0,0,1210,1212,3,130,65,0,1211,1213,3,102,51,0,1212,1211,
        1,0,0,0,1212,1213,1,0,0,0,1213,1215,1,0,0,0,1214,1216,3,132,66,0,
        1215,1214,1,0,0,0,1215,1216,1,0,0,0,1216,1218,1,0,0,0,1217,1219,
        3,110,55,0,1218,1217,1,0,0,0,1218,1219,1,0,0,0,1219,1221,1,0,0,0,
        1220,1222,3,122,61,0,1221,1220,1,0,0,0,1221,1222,1,0,0,0,1222,1224,
        1,0,0,0,1223,1225,3,106,53,0,1224,1223,1,0,0,0,1224,1225,1,0,0,0,
        1225,1227,1,0,0,0,1226,1228,3,136,68,0,1227,1226,1,0,0,0,1227,1228,
        1,0,0,0,1228,1230,1,0,0,0,1229,1231,3,134,67,0,1230,1229,1,0,0,0,
        1230,1231,1,0,0,0,1231,1234,1,0,0,0,1232,1234,3,194,97,0,1233,1206,
        1,0,0,0,1233,1232,1,0,0,0,1234,193,1,0,0,0,1235,1236,6,97,-1,0,1236,
        1237,3,196,98,0,1237,1243,1,0,0,0,1238,1239,10,2,0,0,1239,1240,5,
        151,0,0,1240,1242,3,196,98,0,1241,1238,1,0,0,0,1242,1245,1,0,0,0,
        1243,1241,1,0,0,0,1243,1244,1,0,0,0,1244,195,1,0,0,0,1245,1243,1,
        0,0,0,1246,1247,6,98,-1,0,1247,1248,3,198,99,0,1248,1254,1,0,0,0,
        1249,1250,10,2,0,0,1250,1251,5,7,0,0,1251,1253,3,198,99,0,1252,1249,
        1,0,0,0,1253,1256,1,0,0,0,1254,1252,1,0,0,0,1254,1255,1,0,0,0,1255,
        197,1,0,0,0,1256,1254,1,0,0,0,1257,1258,5,140,0,0,1258,1261,3,198,
        99,0,1259,1261,3,200,100,0,1260,1257,1,0,0,0,1260,1259,1,0,0,0,1261,
        199,1,0,0,0,1262,1263,6,100,-1,0,1263,1264,3,202,101,0,1264,1310,
        1,0,0,0,1265,1266,10,7,0,0,1266,1267,7,8,0,0,1267,1309,3,202,101,
        0,1268,1269,10,6,0,0,1269,1271,5,118,0,0,1270,1272,5,140,0,0,1271,
        1270,1,0,0,0,1271,1272,1,0,0,0,1272,1273,1,0,0,0,1273,1309,3,278,
        139,0,1274,1276,10,5,0,0,1275,1277,5,140,0,0,1276,1275,1,0,0,0,1276,
        1277,1,0,0,0,1277,1278,1,0,0,0,1278,1279,5,106,0,0,1279,1280,5,294,
        0,0,1280,1281,3,188,94,0,1281,1282,5,295,0,0,1282,1309,1,0,0,0,1283,
        1285,10,4,0,0,1284,1286,5,140,0,0,1285,1284,1,0,0,0,1285,1286,1,
        0,0,0,1286,1287,1,0,0,0,1287,1288,5,106,0,0,1288,1309,3,202,101,
        0,1289,1291,10,3,0,0,1290,1292,5,140,0,0,1291,1290,1,0,0,0,1291,
        1292,1,0,0,0,1292,1293,1,0,0,0,1293,1294,5,127,0,0,1294,1297,3,202,
        101,0,1295,1296,5,74,0,0,1296,1298,3,188,94,0,1297,1295,1,0,0,0,
        1297,1298,1,0,0,0,1298,1309,1,0,0,0,1299,1301,10,2,0,0,1300,1302,
        5,140,0,0,1301,1300,1,0,0,0,1301,1302,1,0,0,0,1302,1303,1,0,0,0,
        1303,1304,5,17,0,0,1304,1305,3,202,101,0,1305,1306,5,7,0,0,1306,
        1307,3,202,101,0,1307,1309,1,0,0,0,1308,1265,1,0,0,0,1308,1268,1,
        0,0,0,1308,1274,1,0,0,0,1308,1283,1,0,0,0,1308,1289,1,0,0,0,1308,
        1299,1,0,0,0,1309,1312,1,0,0,0,1310,1308,1,0,0,0,1310,1311,1,0,0,
        0,1311,201,1,0,0,0,1312,1310,1,0,0,0,1313,1314,6,101,-1,0,1314,1315,
        3,204,102,0,1315,1321,1,0,0,0,1316,1317,10,2,0,0,1317,1318,7,9,0,
        0,1318,1320,3,204,102,0,1319,1316,1,0,0,0,1320,1323,1,0,0,0,1321,
        1319,1,0,0,0,1321,1322,1,0,0,0,1322,203,1,0,0,0,1323,1321,1,0,0,
        0,1324,1325,6,102,-1,0,1325,1326,3,206,103,0,1326,1332,1,0,0,0,1327,
        1328,10,2,0,0,1328,1329,7,10,0,0,1329,1331,3,206,103,0,1330,1327,
        1,0,0,0,1331,1334,1,0,0,0,1332,1330,1,0,0,0,1332,1333,1,0,0,0,1333,
        205,1,0,0,0,1334,1332,1,0,0,0,1335,1336,6,103,-1,0,1336,1337,3,208,
        104,0,1337,1343,1,0,0,0,1338,1339,10,2,0,0,1339,1340,7,11,0,0,1340,
        1342,3,208,104,0,1341,1338,1,0,0,0,1342,1345,1,0,0,0,1343,1341,1,
        0,0,0,1343,1344,1,0,0,0,1344,207,1,0,0,0,1345,1343,1,0,0,0,1346,
        1347,7,10,0,0,1347,1350,3,208,104,0,1348,1350,3,210,105,0,1349,1346,
        1,0,0,0,1349,1348,1,0,0,0,1350,209,1,0,0,0,1351,1352,6,105,-1,0,
        1352,1373,3,212,106,0,1353,1373,3,238,119,0,1354,1373,3,226,113,
        0,1355,1373,3,228,114,0,1356,1373,3,230,115,0,1357,1373,3,232,116,
        0,1358,1373,3,242,121,0,1359,1373,3,240,120,0,1360,1373,3,244,122,
        0,1361,1373,3,216,108,0,1362,1373,3,248,124,0,1363,1373,3,234,117,
        0,1364,1373,3,246,123,0,1365,1373,3,250,125,0,1366,1373,3,214,107,
        0,1367,1373,3,256,128,0,1368,1373,3,218,109,0,1369,1373,3,224,112,
        0,1370,1373,3,220,110,0,1371,1373,3,236,118,0,1372,1351,1,0,0,0,
        1372,1353,1,0,0,0,1372,1354,1,0,0,0,1372,1355,1,0,0,0,1372,1356,
        1,0,0,0,1372,1357,1,0,0,0,1372,1358,1,0,0,0,1372,1359,1,0,0,0,1372,
        1360,1,0,0,0,1372,1361,1,0,0,0,1372,1362,1,0,0,0,1372,1363,1,0,0,
        0,1372,1364,1,0,0,0,1372,1365,1,0,0,0,1372,1366,1,0,0,0,1372,1367,
        1,0,0,0,1372,1368,1,0,0,0,1372,1369,1,0,0,0,1372,1370,1,0,0,0,1372,
        1371,1,0,0,0,1373,1382,1,0,0,0,1374,1376,10,6,0,0,1375,1377,3,254,
        127,0,1376,1375,1,0,0,0,1377,1378,1,0,0,0,1378,1376,1,0,0,0,1378,
        1379,1,0,0,0,1379,1381,1,0,0,0,1380,1374,1,0,0,0,1381,1384,1,0,0,
        0,1382,1380,1,0,0,0,1382,1383,1,0,0,0,1383,211,1,0,0,0,1384,1382,
        1,0,0,0,1385,1386,5,294,0,0,1386,1387,3,188,94,0,1387,1388,5,295,
        0,0,1388,1397,1,0,0,0,1389,1397,5,51,0,0,1390,1397,5,48,0,0,1391,
        1397,3,260,130,0,1392,1397,3,262,131,0,1393,1397,3,276,138,0,1394,
        1397,3,266,133,0,1395,1397,3,272,136,0,1396,1385,1,0,0,0,1396,1389,
        1,0,0,0,1396,1390,1,0,0,0,1396,1391,1,0,0,0,1396,1392,1,0,0,0,1396,
        1393,1,0,0,0,1396,1394,1,0,0,0,1396,1395,1,0,0,0,1397,213,1,0,0,
        0,1398,1399,5,143,0,0,1399,1400,5,294,0,0,1400,1401,3,188,94,0,1401,
        1402,5,270,0,0,1402,1403,3,188,94,0,1403,1404,5,295,0,0,1404,215,
        1,0,0,0,1405,1406,5,32,0,0,1406,1407,5,294,0,0,1407,1412,3,188,94,
        0,1408,1409,5,270,0,0,1409,1411,3,188,94,0,1410,1408,1,0,0,0,1411,
        1414,1,0,0,0,1412,1410,1,0,0,0,1412,1413,1,0,0,0,1413,1415,1,0,0,
        0,1414,1412,1,0,0,0,1415,1416,5,295,0,0,1416,217,1,0,0,0,1417,1419,
        5,23,0,0,1418,1420,3,188,94,0,1419,1418,1,0,0,0,1419,1420,1,0,0,
        0,1420,1426,1,0,0,0,1421,1422,5,223,0,0,1422,1423,3,188,94,0,1423,
        1424,5,200,0,0,1424,1425,3,188,94,0,1425,1427,1,0,0,0,1426,1421,
        1,0,0,0,1427,1428,1,0,0,0,1428,1426,1,0,0,0,1428,1429,1,0,0,0,1429,
        1432,1,0,0,0,1430,1431,5,71,0,0,1431,1433,3,188,94,0,1432,1430,1,
        0,0,0,1432,1433,1,0,0,0,1433,1434,1,0,0,0,1434,1435,5,72,0,0,1435,
        219,1,0,0,0,1436,1437,5,219,0,0,1437,1442,3,222,111,0,1438,1439,
        5,270,0,0,1439,1441,3,222,111,0,1440,1438,1,0,0,0,1441,1444,1,0,
        0,0,1442,1440,1,0,0,0,1442,1443,1,0,0,0,1443,221,1,0,0,0,1444,1442,
        1,0,0,0,1445,1446,5,294,0,0,1446,1451,3,188,94,0,1447,1448,5,270,
        0,0,1448,1450,3,188,94,0,1449,1447,1,0,0,0,1450,1453,1,0,0,0,1451,
        1449,1,0,0,0,1451,1452,1,0,0,0,1452,1454,1,0,0,0,1453,1451,1,0,0,
        0,1454,1455,5,295,0,0,1455,223,1,0,0,0,1456,1457,5,294,0,0,1457,
        1460,3,188,94,0,1458,1459,5,270,0,0,1459,1461,3,188,94,0,1460,1458,
        1,0,0,0,1461,1462,1,0,0,0,1462,1460,1,0,0,0,1462,1463,1,0,0,0,1463,
        1464,1,0,0,0,1464,1465,5,295,0,0,1465,225,1,0,0,0,1466,1467,7,12,
        0,0,1467,1476,5,294,0,0,1468,1473,3,188,94,0,1469,1470,5,270,0,0,
        1470,1472,3,188,94,0,1471,1469,1,0,0,0,1472,1475,1,0,0,0,1473,1471,
        1,0,0,0,1473,1474,1,0,0,0,1474,1477,1,0,0,0,1475,1473,1,0,0,0,1476,
        1468,1,0,0,0,1476,1477,1,0,0,0,1477,1478,1,0,0,0,1478,1479,5,295,
        0,0,1479,227,1,0,0,0,1480,1481,5,195,0,0,1481,1482,5,294,0,0,1482,
        1489,3,188,94,0,1483,1484,5,270,0,0,1484,1487,3,188,94,0,1485,1486,
        5,270,0,0,1486,1488,3,188,94,0,1487,1485,1,0,0,0,1487,1488,1,0,0,
        0,1488,1490,1,0,0,0,1489,1483,1,0,0,0,1489,1490,1,0,0,0,1490,1491,
        1,0,0,0,1491,1492,5,295,0,0,1492,1507,1,0,0,0,1493,1494,5,195,0,
        0,1494,1495,5,294,0,0,1495,1502,3,188,94,0,1496,1497,5,95,0,0,1497,
        1500,3,188,94,0,1498,1499,5,92,0,0,1499,1501,3,188,94,0,1500,1498,
        1,0,0,0,1500,1501,1,0,0,0,1501,1503,1,0,0,0,1502,1496,1,0,0,0,1502,
        1503,1,0,0,0,1503,1504,1,0,0,0,1504,1505,5,295,0,0,1505,1507,1,0,
        0,0,1506,1480,1,0,0,0,1506,1493,1,0,0,0,1507,229,1,0,0,0,1508,1509,
        5,160,0,0,1509,1510,5,294,0,0,1510,1511,3,188,94,0,1511,1512,5,270,
        0,0,1512,1513,3,188,94,0,1513,1514,5,295,0,0,1514,1523,1,0,0,0,1515,
        1516,5,160,0,0,1516,1517,5,294,0,0,1517,1518,3,188,94,0,1518,1519,
        5,106,0,0,1519,1520,3,188,94,0,1520,1521,5,295,0,0,1521,1523,1,0,
        0,0,1522,1508,1,0,0,0,1522,1515,1,0,0,0,1523,231,1,0,0,0,1524,1525,
        5,156,0,0,1525,1526,5,294,0,0,1526,1527,3,188,94,0,1527,1528,5,270,
        0,0,1528,1529,3,188,94,0,1529,1530,5,270,0,0,1530,1533,3,188,94,
        0,1531,1532,5,270,0,0,1532,1534,3,188,94,0,1533,1531,1,0,0,0,1533,
        1534,1,0,0,0,1534,1535,1,0,0,0,1535,1536,5,295,0,0,1536,1551,1,0,
        0,0,1537,1538,5,156,0,0,1538,1539,5,294,0,0,1539,1540,3,188,94,0,
        1540,1541,5,159,0,0,1541,1542,3,188,94,0,1542,1543,5,95,0,0,1543,
        1546,3,188,94,0,1544,1545,5,92,0,0,1545,1547,3,188,94,0,1546,1544,
        1,0,0,0,1546,1547,1,0,0,0,1547,1548,1,0,0,0,1548,1549,5,295,0,0,
        1549,1551,1,0,0,0,1550,1524,1,0,0,0,1550,1537,1,0,0,0,1551,233,1,
        0,0,0,1552,1553,5,44,0,0,1553,1554,5,294,0,0,1554,1555,5,277,0,0,
        1555,1565,5,295,0,0,1556,1557,7,13,0,0,1557,1559,5,294,0,0,1558,
        1560,3,100,50,0,1559,1558,1,0,0,0,1559,1560,1,0,0,0,1560,1561,1,
        0,0,0,1561,1562,3,188,94,0,1562,1563,5,295,0,0,1563,1565,1,0,0,0,
        1564,1552,1,0,0,0,1564,1556,1,0,0,0,1565,235,1,0,0,0,1566,1567,7,
        14,0,0,1567,1568,5,294,0,0,1568,1575,3,188,94,0,1569,1570,5,270,
        0,0,1570,1573,3,188,94,0,1571,1572,5,270,0,0,1572,1574,3,188,94,
        0,1573,1571,1,0,0,0,1573,1574,1,0,0,0,1574,1576,1,0,0,0,1575,1569,
        1,0,0,0,1575,1576,1,0,0,0,1576,1577,1,0,0,0,1577,1578,5,295,0,0,
        1578,1579,3,116,58,0,1579,237,1,0,0,0,1580,1581,5,24,0,0,1581,1582,
        5,294,0,0,1582,1583,3,188,94,0,1583,1584,5,10,0,0,1584,1585,3,278,
        139,0,1585,1586,5,295,0,0,1586,239,1,0,0,0,1587,1588,5,235,0,0,1588,
        1589,5,294,0,0,1589,1590,3,188,94,0,1590,1591,5,10,0,0,1591,1592,
        3,278,139,0,1592,1593,5,295,0,0,1593,241,1,0,0,0,1594,1595,5,234,
        0,0,1595,1596,5,294,0,0,1596,1597,3,188,94,0,1597,1598,5,10,0,0,
        1598,1599,3,278,139,0,1599,1600,5,295,0,0,1600,243,1,0,0,0,1601,
        1602,5,85,0,0,1602,1603,5,294,0,0,1603,1604,5,303,0,0,1604,1605,
        5,95,0,0,1605,1606,3,188,94,0,1606,1607,5,295,0,0,1607,245,1,0,0,
        0,1608,1609,5,207,0,0,1609,1617,5,294,0,0,1610,1612,5,303,0,0,1611,
        1610,1,0,0,0,1611,1612,1,0,0,0,1612,1614,1,0,0,0,1613,1615,3,188,
        94,0,1614,1613,1,0,0,0,1614,1615,1,0,0,0,1615,1616,1,0,0,0,1616,
        1618,5,95,0,0,1617,1611,1,0,0,0,1617,1618,1,0,0,0,1618,1619,1,0,
        0,0,1619,1620,3,188,94,0,1620,1621,5,295,0,0,1621,247,1,0,0,0,1622,
        1623,7,15,0,0,1623,1624,5,294,0,0,1624,1625,5,303,0,0,1625,1626,
        5,270,0,0,1626,1627,3,188,94,0,1627,1628,5,270,0,0,1628,1629,3,188,
        94,0,1629,1630,5,295,0,0,1630,249,1,0,0,0,1631,1632,3,252,126,0,
        1632,1641,5,294,0,0,1633,1638,3,188,94,0,1634,1635,5,270,0,0,1635,
        1637,3,188,94,0,1636,1634,1,0,0,0,1637,1640,1,0,0,0,1638,1636,1,
        0,0,0,1638,1639,1,0,0,0,1639,1642,1,0,0,0,1640,1638,1,0,0,0,1641,
        1633,1,0,0,0,1641,1642,1,0,0,0,1642,1643,1,0,0,0,1643,1644,5,295,
        0,0,1644,251,1,0,0,0,1645,1646,3,12,6,0,1646,1647,5,299,0,0,1647,
        1649,1,0,0,0,1648,1645,1,0,0,0,1649,1652,1,0,0,0,1650,1648,1,0,0,
        0,1650,1651,1,0,0,0,1651,1653,1,0,0,0,1652,1650,1,0,0,0,1653,1664,
        7,16,0,0,1654,1655,3,12,6,0,1655,1656,5,299,0,0,1656,1658,1,0,0,
        0,1657,1654,1,0,0,0,1658,1661,1,0,0,0,1659,1657,1,0,0,0,1659,1660,
        1,0,0,0,1660,1662,1,0,0,0,1661,1659,1,0,0,0,1662,1664,3,12,6,0,1663,
        1650,1,0,0,0,1663,1659,1,0,0,0,1664,253,1,0,0,0,1665,1666,5,290,
        0,0,1666,1667,3,188,94,0,1667,1668,5,291,0,0,1668,1677,1,0,0,0,1669,
        1670,5,290,0,0,1670,1671,5,277,0,0,1671,1677,5,291,0,0,1672,1673,
        5,299,0,0,1673,1677,3,12,6,0,1674,1675,5,299,0,0,1675,1677,5,277,
        0,0,1676,1665,1,0,0,0,1676,1669,1,0,0,0,1676,1672,1,0,0,0,1676,1674,
        1,0,0,0,1677,255,1,0,0,0,1678,1679,5,294,0,0,1679,1680,3,210,105,
        0,1680,1681,5,130,0,0,1681,1682,3,140,70,0,1682,1683,5,295,0,0,1683,
        257,1,0,0,0,1684,1685,3,210,105,0,1685,1686,5,130,0,0,1686,1687,
        3,138,69,0,1687,259,1,0,0,0,1688,1689,5,298,0,0,1689,261,1,0,0,0,
        1690,1692,5,275,0,0,1691,1690,1,0,0,0,1691,1692,1,0,0,0,1692,1693,
        1,0,0,0,1693,1699,7,0,0,0,1694,1696,5,275,0,0,1695,1694,1,0,0,0,
        1695,1696,1,0,0,0,1696,1697,1,0,0,0,1697,1699,3,264,132,0,1698,1691,
        1,0,0,0,1698,1695,1,0,0,0,1699,263,1,0,0,0,1700,1701,5,79,0,0,1701,
        265,1,0,0,0,1702,1705,3,268,134,0,1703,1705,3,270,135,0,1704,1702,
        1,0,0,0,1704,1703,1,0,0,0,1705,267,1,0,0,0,1706,1715,5,290,0,0,1707,
        1712,3,188,94,0,1708,1709,5,270,0,0,1709,1711,3,188,94,0,1710,1708,
        1,0,0,0,1711,1714,1,0,0,0,1712,1710,1,0,0,0,1712,1713,1,0,0,0,1713,
        1716,1,0,0,0,1714,1712,1,0,0,0,1715,1707,1,0,0,0,1715,1716,1,0,0,
        0,1716,1717,1,0,0,0,1717,1718,5,291,0,0,1718,269,1,0,0,0,1719,1728,
        5,288,0,0,1720,1725,3,188,94,0,1721,1722,5,270,0,0,1722,1724,3,188,
        94,0,1723,1721,1,0,0,0,1724,1727,1,0,0,0,1725,1723,1,0,0,0,1725,
        1726,1,0,0,0,1726,1729,1,0,0,0,1727,1725,1,0,0,0,1728,1720,1,0,0,
        0,1728,1729,1,0,0,0,1729,1730,1,0,0,0,1730,1731,5,289,0,0,1731,271,
        1,0,0,0,1732,1741,5,292,0,0,1733,1738,3,274,137,0,1734,1735,5,270,
        0,0,1735,1737,3,274,137,0,1736,1734,1,0,0,0,1737,1740,1,0,0,0,1738,
        1736,1,0,0,0,1738,1739,1,0,0,0,1739,1742,1,0,0,0,1740,1738,1,0,0,
        0,1741,1733,1,0,0,0,1741,1742,1,0,0,0,1742,1743,1,0,0,0,1743,1744,
        5,293,0,0,1744,273,1,0,0,0,1745,1746,3,188,94,0,1746,1747,5,296,
        0,0,1747,1748,3,188,94,0,1748,275,1,0,0,0,1749,1784,5,141,0,0,1750,
        1784,5,236,0,0,1751,1784,5,208,0,0,1752,1784,5,88,0,0,1753,1784,
        5,300,0,0,1754,1784,5,301,0,0,1755,1784,5,302,0,0,1756,1784,5,309,
        0,0,1757,1758,5,53,0,0,1758,1784,5,300,0,0,1759,1763,5,201,0,0,1760,
        1761,5,294,0,0,1761,1762,5,301,0,0,1762,1764,5,295,0,0,1763,1760,
        1,0,0,0,1763,1764,1,0,0,0,1764,1768,1,0,0,0,1765,1766,5,226,0,0,
        1766,1767,5,201,0,0,1767,1769,5,229,0,0,1768,1765,1,0,0,0,1768,1769,
        1,0,0,0,1769,1770,1,0,0,0,1770,1784,5,300,0,0,1771,1775,5,202,0,
        0,1772,1773,5,294,0,0,1773,1774,5,301,0,0,1774,1776,5,295,0,0,1775,
        1772,1,0,0,0,1775,1776,1,0,0,0,1776,1780,1,0,0,0,1777,1778,5,226,
        0,0,1778,1779,5,201,0,0,1779,1781,5,229,0,0,1780,1777,1,0,0,0,1780,
        1781,1,0,0,0,1781,1782,1,0,0,0,1782,1784,5,300,0,0,1783,1749,1,0,
        0,0,1783,1750,1,0,0,0,1783,1751,1,0,0,0,1783,1752,1,0,0,0,1783,1753,
        1,0,0,0,1783,1754,1,0,0,0,1783,1755,1,0,0,0,1783,1756,1,0,0,0,1783,
        1757,1,0,0,0,1783,1759,1,0,0,0,1783,1771,1,0,0,0,1784,277,1,0,0,
        0,1785,1824,7,17,0,0,1786,1787,5,69,0,0,1787,1824,5,161,0,0,1788,
        1792,7,18,0,0,1789,1790,5,294,0,0,1790,1791,5,301,0,0,1791,1793,
        5,295,0,0,1792,1789,1,0,0,0,1792,1793,1,0,0,0,1793,1824,1,0,0,0,
        1794,1795,5,27,0,0,1795,1799,5,221,0,0,1796,1797,5,294,0,0,1797,
        1798,5,301,0,0,1798,1800,5,295,0,0,1799,1796,1,0,0,0,1799,1800,1,
        0,0,0,1800,1824,1,0,0,0,1801,1809,7,19,0,0,1802,1803,5,294,0,0,1803,
        1806,5,301,0,0,1804,1805,5,270,0,0,1805,1807,5,301,0,0,1806,1804,
        1,0,0,0,1806,1807,1,0,0,0,1807,1808,1,0,0,0,1808,1810,5,295,0,0,
        1809,1802,1,0,0,0,1809,1810,1,0,0,0,1810,1824,1,0,0,0,1811,1815,
        7,20,0,0,1812,1813,5,294,0,0,1813,1814,5,301,0,0,1814,1816,5,295,
        0,0,1815,1812,1,0,0,0,1815,1816,1,0,0,0,1816,1820,1,0,0,0,1817,1818,
        5,226,0,0,1818,1819,5,201,0,0,1819,1821,5,229,0,0,1820,1817,1,0,
        0,0,1820,1821,1,0,0,0,1821,1824,1,0,0,0,1822,1824,3,12,6,0,1823,
        1785,1,0,0,0,1823,1786,1,0,0,0,1823,1788,1,0,0,0,1823,1794,1,0,0,
        0,1823,1801,1,0,0,0,1823,1811,1,0,0,0,1823,1822,1,0,0,0,1824,279,
        1,0,0,0,230,287,292,294,301,305,309,313,315,340,343,350,365,374,
        386,391,402,409,417,422,429,435,438,441,445,450,453,458,466,472,
        485,491,499,513,516,519,525,529,535,539,541,549,557,568,571,586,
        594,606,611,616,627,637,640,648,657,662,665,668,674,681,686,691,
        700,707,712,715,725,739,744,748,752,760,764,773,778,781,792,802,
        814,821,836,851,856,863,867,870,875,881,887,892,894,903,907,910,
        916,920,922,926,929,934,937,941,945,948,953,956,960,962,969,972,
        1008,1012,1016,1019,1031,1042,1048,1056,1064,1068,1070,1078,1082,
        1092,1098,1100,1105,1112,1115,1118,1122,1125,1128,1130,1135,1138,
        1141,1148,1156,1160,1164,1167,1176,1180,1185,1189,1194,1198,1201,
        1203,1208,1212,1215,1218,1221,1224,1227,1230,1233,1243,1254,1260,
        1271,1276,1285,1291,1297,1301,1308,1310,1321,1332,1343,1349,1372,
        1378,1382,1396,1412,1419,1428,1432,1442,1451,1462,1473,1476,1487,
        1489,1500,1502,1506,1522,1533,1546,1550,1559,1564,1573,1575,1611,
        1614,1617,1638,1641,1650,1659,1663,1676,1691,1695,1698,1704,1712,
        1715,1725,1728,1738,1741,1763,1768,1775,1780,1783,1792,1799,1806,
        1809,1815,1820,1823
    ]

class PartiQLParser ( Parser ):

    grammarFileName = "PartiQLParser.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'ABSOLUTE'", "'ACTION'", "'ADD'", "'ALL'", 
                     "'ALLOCATE'", "'ALTER'", "'AND'", "'ANY'", "'ARE'", 
                     "'AS'", "'ASC'", "'ASSERTION'", "'AT'", "'AUTHORIZATION'", 
                     "'AVG'", "'BEGIN'", "'BETWEEN'", "'BIT'", "'BIT_LENGTH'", 
                     "'BY'", "'CASCADE'", "'CASCADED'", "'CASE'", "'CAST'", 
                     "'CATALOG'", "'CHAR'", "'CHARACTER'", "'CHARACTER_LENGTH'", 
                     "'CHAR_LENGTH'", "'CHECK'", "'CLOSE'", "'COALESCE'", 
                     "'COLLATE'", "'COLLATION'", "'COLUMN'", "'COMMIT'", 
                     "'CONNECT'", "'CONNECTION'", "'CONSTRAINT'", "'CONSTRAINTS'", 
                     "'CONTINUE'", "'CONVERT'", "'CORRESPONDING'", "'COUNT'", 
                     "'CREATE'", "'CROSS'", "'CURRENT'", "'CURRENT_DATE'", 
                     "'CURRENT_TIME'", "'CURRENT_TIMESTAMP'", "'CURRENT_USER'", 
                     "'CURSOR'", "'DATE'", "'DEALLOCATE'", "'DEC'", "'DECIMAL'", 
                     "'DECLARE'", "'DEFAULT'", "'DEFERRABLE'", "'DEFERRED'", 
                     "'DELETE'", "'DESC'", "'DESCRIBE'", "'DESCRIPTOR'", 
                     "'DIAGNOSTICS'", "'DISCONNECT'", "'DISTINCT'", "'DOMAIN'", 
                     "'DOUBLE'", "'DROP'", "'ELSE'", "'END'", "'END-EXEC'", 
                     "'ESCAPE'", "'EVERY'", "'EXCEPT'", "'EXCEPTION'", "'EXCLUDE'", 
                     "'EXCLUDED'", "'EXEC'", "'EXECUTE'", "'EXISTS'", "'EXPLAIN'", 
                     "'EXTERNAL'", "'EXTRACT'", "'DATE_ADD'", "'DATE_DIFF'", 
                     "'FALSE'", "'FETCH'", "'FIRST'", "'FLOAT'", "'FOR'", 
                     "'FOREIGN'", "'FOUND'", "'FROM'", "'FULL'", "'GET'", 
                     "'GLOBAL'", "'GO'", "'GOTO'", "'GRANT'", "'GROUP'", 
                     "'HAVING'", "'IDENTITY'", "'IMMEDIATE'", "'IN'", "'INDICATOR'", 
                     "'INITIALLY'", "'INNER'", "'INPUT'", "'INSENSITIVE'", 
                     "'INSERT'", "'INT'", "'INTEGER'", "'INTERSECT'", "'INTERVAL'", 
                     "'INTO'", "'IS'", "'ISOLATION'", "'JOIN'", "'KEY'", 
                     "'LANGUAGE'", "'LAST'", "'LATERAL'", "'LEFT'", "'LEVEL'", 
                     "'LIKE'", "'LOCAL'", "'LOWER'", "'MATCH'", "'MAX'", 
                     "'MIN'", "'MODULE'", "'NAMES'", "'NATIONAL'", "'NATURAL'", 
                     "'NCHAR'", "'NEXT'", "'NO'", "'NOT'", "'NULL'", "'NULLS'", 
                     "'NULLIF'", "'NUMERIC'", "'OCTET_LENGTH'", "'OF'", 
                     "'ON'", "'ONLY'", "'OPEN'", "'OPTION'", "'OR'", "'ORDER'", 
                     "'OUTER'", "'OUTPUT'", "'OVERLAPS'", "'OVERLAY'", "'PAD'", 
                     "'PARTIAL'", "'PLACING'", "'POSITION'", "'PRECISION'", 
                     "'PREPARE'", "'PRESERVE'", "'PRIMARY'", "'PRIOR'", 
                     "'PRIVILEGES'", "'PROCEDURE'", "'PUBLIC'", "'READ'", 
                     "'REAL'", "'REFERENCES'", "'RELATIVE'", "'REPLACE'", 
                     "'RESTRICT'", "'REVOKE'", "'RIGHT'", "'ROLLBACK'", 
                     "'ROWS'", "'SCHEMA'", "'SCROLL'", "'SECTION'", "'SELECT'", 
                     "'SESSION'", "'SESSION_USER'", "'SET'", "'SHORTEST'", 
                     "'SIZE'", "'SMALLINT'", "'SOME'", "'SPACE'", "'SQL'", 
                     "'SQLCODE'", "'SQLERROR'", "'SQLSTATE'", "'SUBSTRING'", 
                     "'SUM'", "'SYSTEM_USER'", "'TABLE'", "'TEMPORARY'", 
                     "'THEN'", "'TIME'", "'TIMESTAMP'", "'TO'", "'TRANSACTION'", 
                     "'TRANSLATE'", "'TRANSLATION'", "'TRIM'", "'TRUE'", 
                     "'UNION'", "'UNIQUE'", "'UNKNOWN'", "'UPDATE'", "'UPPER'", 
                     "'UPSERT'", "'USAGE'", "'USER'", "'USING'", "'VALUE'", 
                     "'VALUES'", "'VARCHAR'", "'VARYING'", "'VIEW'", "'WHEN'", 
                     "'WHENEVER'", "'WHERE'", "'WITH'", "'WORK'", "'WRITE'", 
                     "'ZONE'", "'LAG'", "'LEAD'", "'OVER'", "'PARTITION'", 
                     "'CAN_CAST'", "'CAN_LOSSLESS_CAST'", "'MISSING'", "'PIVOT'", 
                     "'UNPIVOT'", "'LIMIT'", "'OFFSET'", "'REMOVE'", "'INDEX'", 
                     "'LET'", "'CONFLICT'", "'DO'", "'RETURNING'", "'MODIFIED'", 
                     "'NEW'", "'OLD'", "'NOTHING'", "'TUPLE'", "'INTEGER2'", 
                     "'INT2'", "'INTEGER4'", "'INT4'", "'INTEGER8'", "'INT8'", 
                     "'BIGINT'", "'BOOL'", "'BOOLEAN'", "'STRING'", "'SYMBOL'", 
                     "'CLOB'", "'BLOB'", "'STRUCT'", "'LIST'", "'SEXP'", 
                     "'BAG'", "'^'", "','", "'+'", "'-'", "'/'", "'%'", 
                     "'@'", "'~'", "'*'", "'|'", "'&'", "'!'", "'<='", "'>='", 
                     "'='", "<INVALID>", "'||'", "'<'", "'>'", "'<<'", "'>>'", 
                     "'['", "']'", "'{'", "'}'", "'('", "')'", "':'", "';'", 
                     "'?'", "'.'" ]

    symbolicNames = [ "<INVALID>", "ABSOLUTE", "ACTION", "ADD", "ALL", "ALLOCATE", 
                      "ALTER", "AND", "ANY", "ARE", "AS", "ASC", "ASSERTION", 
                      "AT", "AUTHORIZATION", "AVG", "BEGIN", "BETWEEN", 
                      "BIT", "BIT_LENGTH", "BY", "CASCADE", "CASCADED", 
                      "CASE", "CAST", "CATALOG", "CHAR", "CHARACTER", "CHARACTER_LENGTH", 
                      "CHAR_LENGTH", "CHECK", "CLOSE", "COALESCE", "COLLATE", 
                      "COLLATION", "COLUMN", "COMMIT", "CONNECT", "CONNECTION", 
                      "CONSTRAINT", "CONSTRAINTS", "CONTINUE", "CONVERT", 
                      "CORRESPONDING", "COUNT", "CREATE", "CROSS", "CURRENT", 
                      "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", 
                      "CURRENT_USER", "CURSOR", "DATE", "DEALLOCATE", "DEC", 
                      "DECIMAL", "DECLARE", "DEFAULT", "DEFERRABLE", "DEFERRED", 
                      "DELETE", "DESC", "DESCRIBE", "DESCRIPTOR", "DIAGNOSTICS", 
                      "DISCONNECT", "DISTINCT", "DOMAIN", "DOUBLE", "DROP", 
                      "ELSE", "END", "END_EXEC", "ESCAPE", "EVERY", "EXCEPT", 
                      "EXCEPTION", "EXCLUDE", "EXCLUDED", "EXEC", "EXECUTE", 
                      "EXISTS", "EXPLAIN", "EXTERNAL", "EXTRACT", "DATE_ADD", 
                      "DATE_DIFF", "FALSE", "FETCH", "FIRST", "FLOAT", "FOR", 
                      "FOREIGN", "FOUND", "FROM", "FULL", "GET", "GLOBAL", 
                      "GO", "GOTO", "GRANT", "GROUP", "HAVING", "IDENTITY", 
                      "IMMEDIATE", "IN", "INDICATOR", "INITIALLY", "INNER", 
                      "INPUT", "INSENSITIVE", "INSERT", "INT", "INTEGER", 
                      "INTERSECT", "INTERVAL", "INTO", "IS", "ISOLATION", 
                      "JOIN", "KEY", "LANGUAGE", "LAST", "LATERAL", "LEFT", 
                      "LEVEL", "LIKE", "LOCAL", "LOWER", "MATCH", "MAX", 
                      "MIN", "MODULE", "NAMES", "NATIONAL", "NATURAL", "NCHAR", 
                      "NEXT", "NO", "NOT", "NULL", "NULLS", "NULLIF", "NUMERIC", 
                      "OCTET_LENGTH", "OF", "ON", "ONLY", "OPEN", "OPTION", 
                      "OR", "ORDER", "OUTER", "OUTPUT", "OVERLAPS", "OVERLAY", 
                      "PAD", "PARTIAL", "PLACING", "POSITION", "PRECISION", 
                      "PREPARE", "PRESERVE", "PRIMARY", "PRIOR", "PRIVILEGES", 
                      "PROCEDURE", "PUBLIC", "READ", "REAL", "REFERENCES", 
                      "RELATIVE", "REPLACE", "RESTRICT", "REVOKE", "RIGHT", 
                      "ROLLBACK", "ROWS", "SCHEMA", "SCROLL", "SECTION", 
                      "SELECT", "SESSION", "SESSION_USER", "SET", "SHORTEST", 
                      "SIZE", "SMALLINT", "SOME", "SPACE", "SQL", "SQLCODE", 
                      "SQLERROR", "SQLSTATE", "SUBSTRING", "SUM", "SYSTEM_USER", 
                      "TABLE", "TEMPORARY", "THEN", "TIME", "TIMESTAMP", 
                      "TO", "TRANSACTION", "TRANSLATE", "TRANSLATION", "TRIM", 
                      "TRUE", "UNION", "UNIQUE", "UNKNOWN", "UPDATE", "UPPER", 
                      "UPSERT", "USAGE", "USER", "USING", "VALUE", "VALUES", 
                      "VARCHAR", "VARYING", "VIEW", "WHEN", "WHENEVER", 
                      "WHERE", "WITH", "WORK", "WRITE", "ZONE", "LAG", "LEAD", 
                      "OVER", "PARTITION", "CAN_CAST", "CAN_LOSSLESS_CAST", 
                      "MISSING", "PIVOT", "UNPIVOT", "LIMIT", "OFFSET", 
                      "REMOVE", "INDEX", "LET", "CONFLICT", "DO", "RETURNING", 
                      "MODIFIED", "NEW", "OLD", "NOTHING", "TUPLE", "INTEGER2", 
                      "INT2", "INTEGER4", "INT4", "INTEGER8", "INT8", "BIGINT", 
                      "BOOL", "BOOLEAN", "STRING", "SYMBOL", "CLOB", "BLOB", 
                      "STRUCT", "LIST", "SEXP", "BAG", "CARET", "COMMA", 
                      "PLUS", "MINUS", "SLASH_FORWARD", "PERCENT", "AT_SIGN", 
                      "TILDE", "ASTERISK", "VERTBAR", "AMPERSAND", "BANG", 
                      "LT_EQ", "GT_EQ", "EQ", "NEQ", "CONCAT", "ANGLE_LEFT", 
                      "ANGLE_RIGHT", "ANGLE_DOUBLE_LEFT", "ANGLE_DOUBLE_RIGHT", 
                      "BRACKET_LEFT", "BRACKET_RIGHT", "BRACE_LEFT", "BRACE_RIGHT", 
                      "PAREN_LEFT", "PAREN_RIGHT", "COLON", "COLON_SEMI", 
                      "QUESTION_MARK", "PERIOD", "LITERAL_STRING", "LITERAL_INTEGER", 
                      "LITERAL_DECIMAL", "IDENTIFIER", "IDENTIFIER_QUOTED", 
                      "WS", "COMMENT_SINGLE", "COMMENT_BLOCK", "UNRECOGNIZED", 
                      "ION_CLOSURE", "BACKTICK" ]

    RULE_root = 0
    RULE_statement = 1
    RULE_explainOption = 2
    RULE_asIdent = 3
    RULE_atIdent = 4
    RULE_byIdent = 5
    RULE_symbolPrimitive = 6
    RULE_dql = 7
    RULE_execCommand = 8
    RULE_qualifiedName = 9
    RULE_tableName = 10
    RULE_tableConstraintName = 11
    RULE_columnName = 12
    RULE_columnConstraintName = 13
    RULE_ddl = 14
    RULE_createCommand = 15
    RULE_dropCommand = 16
    RULE_tableDef = 17
    RULE_tableDefPart = 18
    RULE_columnConstraint = 19
    RULE_columnConstraintDef = 20
    RULE_dml = 21
    RULE_dmlBaseCommand = 22
    RULE_pathSimple = 23
    RULE_pathSimpleSteps = 24
    RULE_replaceCommand = 25
    RULE_upsertCommand = 26
    RULE_removeCommand = 27
    RULE_insertCommandReturning = 28
    RULE_insertStatement = 29
    RULE_columnList = 30
    RULE_onConflict = 31
    RULE_insertStatementLegacy = 32
    RULE_onConflictLegacy = 33
    RULE_conflictTarget = 34
    RULE_constraintName = 35
    RULE_conflictAction = 36
    RULE_doReplace = 37
    RULE_doUpdate = 38
    RULE_updateClause = 39
    RULE_setCommand = 40
    RULE_setAssignment = 41
    RULE_deleteCommand = 42
    RULE_returningClause = 43
    RULE_returningColumn = 44
    RULE_fromClauseSimple = 45
    RULE_whereClause = 46
    RULE_selectClause = 47
    RULE_projectionItems = 48
    RULE_projectionItem = 49
    RULE_setQuantifierStrategy = 50
    RULE_letClause = 51
    RULE_letBinding = 52
    RULE_orderByClause = 53
    RULE_orderSortSpec = 54
    RULE_groupClause = 55
    RULE_groupAlias = 56
    RULE_groupKey = 57
    RULE_over = 58
    RULE_windowPartitionList = 59
    RULE_windowSortSpecList = 60
    RULE_havingClause = 61
    RULE_excludeClause = 62
    RULE_excludeExpr = 63
    RULE_excludeExprSteps = 64
    RULE_fromClause = 65
    RULE_whereClauseSelect = 66
    RULE_offsetByClause = 67
    RULE_limitClause = 68
    RULE_gpmlPattern = 69
    RULE_gpmlPatternList = 70
    RULE_matchPattern = 71
    RULE_graphPart = 72
    RULE_matchSelector = 73
    RULE_patternPathVariable = 74
    RULE_patternRestrictor = 75
    RULE_node = 76
    RULE_edge = 77
    RULE_pattern = 78
    RULE_patternQuantifier = 79
    RULE_edgeWSpec = 80
    RULE_edgeSpec = 81
    RULE_labelSpec = 82
    RULE_labelTerm = 83
    RULE_labelFactor = 84
    RULE_labelPrimary = 85
    RULE_edgeAbbrev = 86
    RULE_tableReference = 87
    RULE_tableNonJoin = 88
    RULE_tableBaseReference = 89
    RULE_tableUnpivot = 90
    RULE_joinRhs = 91
    RULE_joinSpec = 92
    RULE_joinType = 93
    RULE_expr = 94
    RULE_exprBagOp = 95
    RULE_exprSelect = 96
    RULE_exprOr = 97
    RULE_exprAnd = 98
    RULE_exprNot = 99
    RULE_exprPredicate = 100
    RULE_mathOp00 = 101
    RULE_mathOp01 = 102
    RULE_mathOp02 = 103
    RULE_valueExpr = 104
    RULE_exprPrimary = 105
    RULE_exprTerm = 106
    RULE_nullIf = 107
    RULE_coalesce = 108
    RULE_caseExpr = 109
    RULE_values = 110
    RULE_valueRow = 111
    RULE_valueList = 112
    RULE_sequenceConstructor = 113
    RULE_substring = 114
    RULE_position = 115
    RULE_overlay = 116
    RULE_aggregate = 117
    RULE_windowFunction = 118
    RULE_cast = 119
    RULE_canLosslessCast = 120
    RULE_canCast = 121
    RULE_extract = 122
    RULE_trimFunction = 123
    RULE_dateFunction = 124
    RULE_functionCall = 125
    RULE_functionName = 126
    RULE_pathStep = 127
    RULE_exprGraphMatchMany = 128
    RULE_exprGraphMatchOne = 129
    RULE_parameter = 130
    RULE_varRefExpr = 131
    RULE_nonReservedKeywords = 132
    RULE_collection = 133
    RULE_array = 134
    RULE_bag = 135
    RULE_tuple = 136
    RULE_pair = 137
    RULE_literal = 138
    RULE_type = 139

    ruleNames =  [ "root", "statement", "explainOption", "asIdent", "atIdent", 
                   "byIdent", "symbolPrimitive", "dql", "execCommand", "qualifiedName", 
                   "tableName", "tableConstraintName", "columnName", "columnConstraintName", 
                   "ddl", "createCommand", "dropCommand", "tableDef", "tableDefPart", 
                   "columnConstraint", "columnConstraintDef", "dml", "dmlBaseCommand", 
                   "pathSimple", "pathSimpleSteps", "replaceCommand", "upsertCommand", 
                   "removeCommand", "insertCommandReturning", "insertStatement", 
                   "columnList", "onConflict", "insertStatementLegacy", 
                   "onConflictLegacy", "conflictTarget", "constraintName", 
                   "conflictAction", "doReplace", "doUpdate", "updateClause", 
                   "setCommand", "setAssignment", "deleteCommand", "returningClause", 
                   "returningColumn", "fromClauseSimple", "whereClause", 
                   "selectClause", "projectionItems", "projectionItem", 
                   "setQuantifierStrategy", "letClause", "letBinding", "orderByClause", 
                   "orderSortSpec", "groupClause", "groupAlias", "groupKey", 
                   "over", "windowPartitionList", "windowSortSpecList", 
                   "havingClause", "excludeClause", "excludeExpr", "excludeExprSteps", 
                   "fromClause", "whereClauseSelect", "offsetByClause", 
                   "limitClause", "gpmlPattern", "gpmlPatternList", "matchPattern", 
                   "graphPart", "matchSelector", "patternPathVariable", 
                   "patternRestrictor", "node", "edge", "pattern", "patternQuantifier", 
                   "edgeWSpec", "edgeSpec", "labelSpec", "labelTerm", "labelFactor", 
                   "labelPrimary", "edgeAbbrev", "tableReference", "tableNonJoin", 
                   "tableBaseReference", "tableUnpivot", "joinRhs", "joinSpec", 
                   "joinType", "expr", "exprBagOp", "exprSelect", "exprOr", 
                   "exprAnd", "exprNot", "exprPredicate", "mathOp00", "mathOp01", 
                   "mathOp02", "valueExpr", "exprPrimary", "exprTerm", "nullIf", 
                   "coalesce", "caseExpr", "values", "valueRow", "valueList", 
                   "sequenceConstructor", "substring", "position", "overlay", 
                   "aggregate", "windowFunction", "cast", "canLosslessCast", 
                   "canCast", "extract", "trimFunction", "dateFunction", 
                   "functionCall", "functionName", "pathStep", "exprGraphMatchMany", 
                   "exprGraphMatchOne", "parameter", "varRefExpr", "nonReservedKeywords", 
                   "collection", "array", "bag", "tuple", "pair", "literal", 
                   "type" ]

    EOF = Token.EOF
    ABSOLUTE=1
    ACTION=2
    ADD=3
    ALL=4
    ALLOCATE=5
    ALTER=6
    AND=7
    ANY=8
    ARE=9
    AS=10
    ASC=11
    ASSERTION=12
    AT=13
    AUTHORIZATION=14
    AVG=15
    BEGIN=16
    BETWEEN=17
    BIT=18
    BIT_LENGTH=19
    BY=20
    CASCADE=21
    CASCADED=22
    CASE=23
    CAST=24
    CATALOG=25
    CHAR=26
    CHARACTER=27
    CHARACTER_LENGTH=28
    CHAR_LENGTH=29
    CHECK=30
    CLOSE=31
    COALESCE=32
    COLLATE=33
    COLLATION=34
    COLUMN=35
    COMMIT=36
    CONNECT=37
    CONNECTION=38
    CONSTRAINT=39
    CONSTRAINTS=40
    CONTINUE=41
    CONVERT=42
    CORRESPONDING=43
    COUNT=44
    CREATE=45
    CROSS=46
    CURRENT=47
    CURRENT_DATE=48
    CURRENT_TIME=49
    CURRENT_TIMESTAMP=50
    CURRENT_USER=51
    CURSOR=52
    DATE=53
    DEALLOCATE=54
    DEC=55
    DECIMAL=56
    DECLARE=57
    DEFAULT=58
    DEFERRABLE=59
    DEFERRED=60
    DELETE=61
    DESC=62
    DESCRIBE=63
    DESCRIPTOR=64
    DIAGNOSTICS=65
    DISCONNECT=66
    DISTINCT=67
    DOMAIN=68
    DOUBLE=69
    DROP=70
    ELSE=71
    END=72
    END_EXEC=73
    ESCAPE=74
    EVERY=75
    EXCEPT=76
    EXCEPTION=77
    EXCLUDE=78
    EXCLUDED=79
    EXEC=80
    EXECUTE=81
    EXISTS=82
    EXPLAIN=83
    EXTERNAL=84
    EXTRACT=85
    DATE_ADD=86
    DATE_DIFF=87
    FALSE=88
    FETCH=89
    FIRST=90
    FLOAT=91
    FOR=92
    FOREIGN=93
    FOUND=94
    FROM=95
    FULL=96
    GET=97
    GLOBAL=98
    GO=99
    GOTO=100
    GRANT=101
    GROUP=102
    HAVING=103
    IDENTITY=104
    IMMEDIATE=105
    IN=106
    INDICATOR=107
    INITIALLY=108
    INNER=109
    INPUT=110
    INSENSITIVE=111
    INSERT=112
    INT=113
    INTEGER=114
    INTERSECT=115
    INTERVAL=116
    INTO=117
    IS=118
    ISOLATION=119
    JOIN=120
    KEY=121
    LANGUAGE=122
    LAST=123
    LATERAL=124
    LEFT=125
    LEVEL=126
    LIKE=127
    LOCAL=128
    LOWER=129
    MATCH=130
    MAX=131
    MIN=132
    MODULE=133
    NAMES=134
    NATIONAL=135
    NATURAL=136
    NCHAR=137
    NEXT=138
    NO=139
    NOT=140
    NULL=141
    NULLS=142
    NULLIF=143
    NUMERIC=144
    OCTET_LENGTH=145
    OF=146
    ON=147
    ONLY=148
    OPEN=149
    OPTION=150
    OR=151
    ORDER=152
    OUTER=153
    OUTPUT=154
    OVERLAPS=155
    OVERLAY=156
    PAD=157
    PARTIAL=158
    PLACING=159
    POSITION=160
    PRECISION=161
    PREPARE=162
    PRESERVE=163
    PRIMARY=164
    PRIOR=165
    PRIVILEGES=166
    PROCEDURE=167
    PUBLIC=168
    READ=169
    REAL=170
    REFERENCES=171
    RELATIVE=172
    REPLACE=173
    RESTRICT=174
    REVOKE=175
    RIGHT=176
    ROLLBACK=177
    ROWS=178
    SCHEMA=179
    SCROLL=180
    SECTION=181
    SELECT=182
    SESSION=183
    SESSION_USER=184
    SET=185
    SHORTEST=186
    SIZE=187
    SMALLINT=188
    SOME=189
    SPACE=190
    SQL=191
    SQLCODE=192
    SQLERROR=193
    SQLSTATE=194
    SUBSTRING=195
    SUM=196
    SYSTEM_USER=197
    TABLE=198
    TEMPORARY=199
    THEN=200
    TIME=201
    TIMESTAMP=202
    TO=203
    TRANSACTION=204
    TRANSLATE=205
    TRANSLATION=206
    TRIM=207
    TRUE=208
    UNION=209
    UNIQUE=210
    UNKNOWN=211
    UPDATE=212
    UPPER=213
    UPSERT=214
    USAGE=215
    USER=216
    USING=217
    VALUE=218
    VALUES=219
    VARCHAR=220
    VARYING=221
    VIEW=222
    WHEN=223
    WHENEVER=224
    WHERE=225
    WITH=226
    WORK=227
    WRITE=228
    ZONE=229
    LAG=230
    LEAD=231
    OVER=232
    PARTITION=233
    CAN_CAST=234
    CAN_LOSSLESS_CAST=235
    MISSING=236
    PIVOT=237
    UNPIVOT=238
    LIMIT=239
    OFFSET=240
    REMOVE=241
    INDEX=242
    LET=243
    CONFLICT=244
    DO=245
    RETURNING=246
    MODIFIED=247
    NEW=248
    OLD=249
    NOTHING=250
    TUPLE=251
    INTEGER2=252
    INT2=253
    INTEGER4=254
    INT4=255
    INTEGER8=256
    INT8=257
    BIGINT=258
    BOOL=259
    BOOLEAN=260
    STRING=261
    SYMBOL=262
    CLOB=263
    BLOB=264
    STRUCT=265
    LIST=266
    SEXP=267
    BAG=268
    CARET=269
    COMMA=270
    PLUS=271
    MINUS=272
    SLASH_FORWARD=273
    PERCENT=274
    AT_SIGN=275
    TILDE=276
    ASTERISK=277
    VERTBAR=278
    AMPERSAND=279
    BANG=280
    LT_EQ=281
    GT_EQ=282
    EQ=283
    NEQ=284
    CONCAT=285
    ANGLE_LEFT=286
    ANGLE_RIGHT=287
    ANGLE_DOUBLE_LEFT=288
    ANGLE_DOUBLE_RIGHT=289
    BRACKET_LEFT=290
    BRACKET_RIGHT=291
    BRACE_LEFT=292
    BRACE_RIGHT=293
    PAREN_LEFT=294
    PAREN_RIGHT=295
    COLON=296
    COLON_SEMI=297
    QUESTION_MARK=298
    PERIOD=299
    LITERAL_STRING=300
    LITERAL_INTEGER=301
    LITERAL_DECIMAL=302
    IDENTIFIER=303
    IDENTIFIER_QUOTED=304
    WS=305
    COMMENT_SINGLE=306
    COMMENT_BLOCK=307
    UNRECOGNIZED=308
    ION_CLOSURE=309
    BACKTICK=310

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




    class RootContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def statement(self):
            return self.getTypedRuleContext(PartiQLParser.StatementContext,0)


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

        def EXPLAIN(self):
            return self.getToken(PartiQLParser.EXPLAIN, 0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def explainOption(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExplainOptionContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExplainOptionContext,i)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

        def getRuleIndex(self):
            return PartiQLParser.RULE_root

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

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

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




    def root(self):

        localctx = PartiQLParser.RootContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_root)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 294
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==83:
                self.state = 280
                self.match(PartiQLParser.EXPLAIN)
                self.state = 292
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
                if la_ == 1:
                    self.state = 281
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 282
                    self.explainOption()
                    self.state = 287
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la==270:
                        self.state = 283
                        self.match(PartiQLParser.COMMA)
                        self.state = 284
                        self.explainOption()
                        self.state = 289
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)

                    self.state = 290
                    self.match(PartiQLParser.PAREN_RIGHT)




            self.state = 296
            self.statement()
            self.state = 297
            self.match(PartiQLParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class StatementContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_statement

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class QueryExecContext(StatementContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.StatementContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def execCommand(self):
            return self.getTypedRuleContext(PartiQLParser.ExecCommandContext,0)

        def COLON_SEMI(self):
            return self.getToken(PartiQLParser.COLON_SEMI, 0)

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

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

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


    class QueryDdlContext(StatementContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.StatementContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def ddl(self):
            return self.getTypedRuleContext(PartiQLParser.DdlContext,0)

        def COLON_SEMI(self):
            return self.getToken(PartiQLParser.COLON_SEMI, 0)

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

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

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


    class QueryDqlContext(StatementContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.StatementContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def dql(self):
            return self.getTypedRuleContext(PartiQLParser.DqlContext,0)

        def COLON_SEMI(self):
            return self.getToken(PartiQLParser.COLON_SEMI, 0)

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

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

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


    class QueryDmlContext(StatementContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.StatementContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def dml(self):
            return self.getTypedRuleContext(PartiQLParser.DmlContext,0)

        def COLON_SEMI(self):
            return self.getToken(PartiQLParser.COLON_SEMI, 0)

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

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

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



    def statement(self):

        localctx = PartiQLParser.StatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_statement)
        self._la = 0 # Token type
        try:
            self.state = 315
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [8, 15, 19, 23, 24, 28, 29, 32, 44, 48, 51, 53, 75, 79, 82, 85, 86, 87, 88, 129, 131, 132, 140, 141, 143, 145, 156, 160, 182, 187, 189, 195, 196, 201, 202, 207, 208, 213, 219, 230, 231, 234, 235, 236, 237, 266, 267, 271, 272, 275, 288, 290, 292, 294, 298, 300, 301, 302, 303, 304, 309]:
                localctx = PartiQLParser.QueryDqlContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 299
                self.dql()
                self.state = 301
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==297:
                    self.state = 300
                    self.match(PartiQLParser.COLON_SEMI)


                pass
            elif token in [61, 95, 112, 173, 185, 212, 214, 241]:
                localctx = PartiQLParser.QueryDmlContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 303
                self.dml()
                self.state = 305
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==297:
                    self.state = 304
                    self.match(PartiQLParser.COLON_SEMI)


                pass
            elif token in [45, 70]:
                localctx = PartiQLParser.QueryDdlContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 307
                self.ddl()
                self.state = 309
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==297:
                    self.state = 308
                    self.match(PartiQLParser.COLON_SEMI)


                pass
            elif token in [80]:
                localctx = PartiQLParser.QueryExecContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 311
                self.execCommand()
                self.state = 313
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==297:
                    self.state = 312
                    self.match(PartiQLParser.COLON_SEMI)


                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 ExplainOptionContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def getRuleIndex(self):
            return PartiQLParser.RULE_explainOption

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

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

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




    def explainOption(self):

        localctx = PartiQLParser.ExplainOptionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_explainOption)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 317
            localctx.param = self.match(PartiQLParser.IDENTIFIER)
            self.state = 318
            localctx.value = self.match(PartiQLParser.IDENTIFIER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AsIdentContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_asIdent

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

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

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




    def asIdent(self):

        localctx = PartiQLParser.AsIdentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_asIdent)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 320
            self.match(PartiQLParser.AS)
            self.state = 321
            self.symbolPrimitive()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AtIdentContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def AT(self):
            return self.getToken(PartiQLParser.AT, 0)

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_atIdent

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

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

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




    def atIdent(self):

        localctx = PartiQLParser.AtIdentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_atIdent)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 323
            self.match(PartiQLParser.AT)
            self.state = 324
            self.symbolPrimitive()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ByIdentContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def BY(self):
            return self.getToken(PartiQLParser.BY, 0)

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_byIdent

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

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

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




    def byIdent(self):

        localctx = PartiQLParser.ByIdentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_byIdent)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 326
            self.match(PartiQLParser.BY)
            self.state = 327
            self.symbolPrimitive()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SymbolPrimitiveContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def IDENTIFIER(self):
            return self.getToken(PartiQLParser.IDENTIFIER, 0)

        def IDENTIFIER_QUOTED(self):
            return self.getToken(PartiQLParser.IDENTIFIER_QUOTED, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_symbolPrimitive

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

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

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




    def symbolPrimitive(self):

        localctx = PartiQLParser.SymbolPrimitiveContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_symbolPrimitive)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 329
            localctx.ident = self._input.LT(1)
            _la = self._input.LA(1)
            if not(_la==303 or _la==304):
                localctx.ident = 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 DqlContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_dql

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

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

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




    def dql(self):

        localctx = PartiQLParser.DqlContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_dql)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 331
            self.expr()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExecCommandContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.name = None # ExprContext
            self._expr = None # ExprContext
            self.args = list() # of ExprContexts

        def EXEC(self):
            return self.getToken(PartiQLParser.EXEC, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_execCommand

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

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

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




    def execCommand(self):

        localctx = PartiQLParser.ExecCommandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_execCommand)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 333
            self.match(PartiQLParser.EXEC)
            self.state = 334
            localctx.name = self.expr()
            self.state = 343
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 11558071357178112) != 0) or ((((_la - 75)) & ~0x3f) == 0 and ((1 << (_la - 75)) & 234187180623281297) != 0) or ((((_la - 140)) & ~0x3f) == 0 and ((1 << (_la - 140)) & 7026323504187375659) != 0) or ((((_la - 207)) & ~0x3f) == 0 and ((1 << (_la - 207)) & 1729382258948706371) != 0) or ((((_la - 271)) & ~0x3f) == 0 and ((1 << (_la - 271)) & 291666264083) != 0):
                self.state = 335
                localctx._expr = self.expr()
                localctx.args.append(localctx._expr)
                self.state = 340
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 336
                    self.match(PartiQLParser.COMMA)
                    self.state = 337
                    localctx._expr = self.expr()
                    localctx.args.append(localctx._expr)
                    self.state = 342
                    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 QualifiedNameContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self._symbolPrimitive = None # SymbolPrimitiveContext
            self.qualifier = list() # of SymbolPrimitiveContexts
            self.name = None # SymbolPrimitiveContext

        def symbolPrimitive(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.SymbolPrimitiveContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_qualifiedName

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

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

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




    def qualifiedName(self):

        localctx = PartiQLParser.QualifiedNameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_qualifiedName)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 350
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,10,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 345
                    localctx._symbolPrimitive = self.symbolPrimitive()
                    localctx.qualifier.append(localctx._symbolPrimitive)
                    self.state = 346
                    self.match(PartiQLParser.PERIOD) 
                self.state = 352
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,10,self._ctx)

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


    class TableNameContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_tableName

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

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

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




    def tableName(self):

        localctx = PartiQLParser.TableNameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_tableName)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 355
            self.symbolPrimitive()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TableConstraintNameContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_tableConstraintName

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

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

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




    def tableConstraintName(self):

        localctx = PartiQLParser.TableConstraintNameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_tableConstraintName)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 357
            self.symbolPrimitive()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ColumnNameContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_columnName

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

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

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




    def columnName(self):

        localctx = PartiQLParser.ColumnNameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_columnName)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 359
            self.symbolPrimitive()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ColumnConstraintNameContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_columnConstraintName

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

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

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




    def columnConstraintName(self):

        localctx = PartiQLParser.ColumnConstraintNameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_columnConstraintName)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 361
            self.symbolPrimitive()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DdlContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def createCommand(self):
            return self.getTypedRuleContext(PartiQLParser.CreateCommandContext,0)


        def dropCommand(self):
            return self.getTypedRuleContext(PartiQLParser.DropCommandContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_ddl

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

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

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




    def ddl(self):

        localctx = PartiQLParser.DdlContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_ddl)
        try:
            self.state = 365
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [45]:
                self.enterOuterAlt(localctx, 1)
                self.state = 363
                self.createCommand()
                pass
            elif token in [70]:
                self.enterOuterAlt(localctx, 2)
                self.state = 364
                self.dropCommand()
                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 CreateCommandContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_createCommand

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class CreateIndexContext(CreateCommandContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.CreateCommandContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def CREATE(self):
            return self.getToken(PartiQLParser.CREATE, 0)
        def INDEX(self):
            return self.getToken(PartiQLParser.INDEX, 0)
        def ON(self):
            return self.getToken(PartiQLParser.ON, 0)
        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def pathSimple(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.PathSimpleContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.PathSimpleContext,i)

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

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

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

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


    class CreateTableContext(CreateCommandContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.CreateCommandContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def CREATE(self):
            return self.getToken(PartiQLParser.CREATE, 0)
        def TABLE(self):
            return self.getToken(PartiQLParser.TABLE, 0)
        def qualifiedName(self):
            return self.getTypedRuleContext(PartiQLParser.QualifiedNameContext,0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def tableDef(self):
            return self.getTypedRuleContext(PartiQLParser.TableDefContext,0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

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

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



    def createCommand(self):

        localctx = PartiQLParser.CreateCommandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_createCommand)
        self._la = 0 # Token type
        try:
            self.state = 391
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,14,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.CreateTableContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 367
                self.match(PartiQLParser.CREATE)
                self.state = 368
                self.match(PartiQLParser.TABLE)
                self.state = 369
                self.qualifiedName()
                self.state = 374
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==294:
                    self.state = 370
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 371
                    self.tableDef()
                    self.state = 372
                    self.match(PartiQLParser.PAREN_RIGHT)


                pass

            elif la_ == 2:
                localctx = PartiQLParser.CreateIndexContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 376
                self.match(PartiQLParser.CREATE)
                self.state = 377
                self.match(PartiQLParser.INDEX)
                self.state = 378
                self.match(PartiQLParser.ON)
                self.state = 379
                self.symbolPrimitive()
                self.state = 380
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 381
                self.pathSimple()
                self.state = 386
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 382
                    self.match(PartiQLParser.COMMA)
                    self.state = 383
                    self.pathSimple()
                    self.state = 388
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 389
                self.match(PartiQLParser.PAREN_RIGHT)
                pass


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


    class DropCommandContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_dropCommand

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class DropTableContext(DropCommandContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.DropCommandContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def DROP(self):
            return self.getToken(PartiQLParser.DROP, 0)
        def TABLE(self):
            return self.getToken(PartiQLParser.TABLE, 0)
        def qualifiedName(self):
            return self.getTypedRuleContext(PartiQLParser.QualifiedNameContext,0)


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

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

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


    class DropIndexContext(DropCommandContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.DropCommandContext
            super().__init__(parser)
            self.target = None # SymbolPrimitiveContext
            self.on = None # SymbolPrimitiveContext
            self.copyFrom(ctx)

        def DROP(self):
            return self.getToken(PartiQLParser.DROP, 0)
        def INDEX(self):
            return self.getToken(PartiQLParser.INDEX, 0)
        def ON(self):
            return self.getToken(PartiQLParser.ON, 0)
        def symbolPrimitive(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.SymbolPrimitiveContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,i)


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

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

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



    def dropCommand(self):

        localctx = PartiQLParser.DropCommandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_dropCommand)
        try:
            self.state = 402
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,15,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.DropTableContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 393
                self.match(PartiQLParser.DROP)
                self.state = 394
                self.match(PartiQLParser.TABLE)
                self.state = 395
                self.qualifiedName()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.DropIndexContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 396
                self.match(PartiQLParser.DROP)
                self.state = 397
                self.match(PartiQLParser.INDEX)
                self.state = 398
                localctx.target = self.symbolPrimitive()
                self.state = 399
                self.match(PartiQLParser.ON)
                self.state = 400
                localctx.on = self.symbolPrimitive()
                pass


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


    class TableDefContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def tableDefPart(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.TableDefPartContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.TableDefPartContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_tableDef

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

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

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




    def tableDef(self):

        localctx = PartiQLParser.TableDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_tableDef)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 404
            self.tableDefPart()
            self.state = 409
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 405
                self.match(PartiQLParser.COMMA)
                self.state = 406
                self.tableDefPart()
                self.state = 411
                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 TableDefPartContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_tableDefPart

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class ColumnDeclarationContext(TableDefPartContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TableDefPartContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def columnName(self):
            return self.getTypedRuleContext(PartiQLParser.ColumnNameContext,0)

        def type_(self):
            return self.getTypedRuleContext(PartiQLParser.TypeContext,0)

        def columnConstraint(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ColumnConstraintContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ColumnConstraintContext,i)


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

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

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



    def tableDefPart(self):

        localctx = PartiQLParser.TableDefPartContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_tableDefPart)
        self._la = 0 # Token type
        try:
            localctx = PartiQLParser.ColumnDeclarationContext(self, localctx)
            self.enterOuterAlt(localctx, 1)
            self.state = 412
            self.columnName()
            self.state = 413
            self.type_()
            self.state = 417
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==39 or _la==140 or _la==141:
                self.state = 414
                self.columnConstraint()
                self.state = 419
                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 ColumnConstraintContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def columnConstraintDef(self):
            return self.getTypedRuleContext(PartiQLParser.ColumnConstraintDefContext,0)


        def CONSTRAINT(self):
            return self.getToken(PartiQLParser.CONSTRAINT, 0)

        def columnConstraintName(self):
            return self.getTypedRuleContext(PartiQLParser.ColumnConstraintNameContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_columnConstraint

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

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

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




    def columnConstraint(self):

        localctx = PartiQLParser.ColumnConstraintContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_columnConstraint)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 422
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==39:
                self.state = 420
                self.match(PartiQLParser.CONSTRAINT)
                self.state = 421
                self.columnConstraintName()


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


    class ColumnConstraintDefContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_columnConstraintDef

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class ColConstrNullContext(ColumnConstraintDefContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ColumnConstraintDefContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def NULL(self):
            return self.getToken(PartiQLParser.NULL, 0)

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

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

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


    class ColConstrNotNullContext(ColumnConstraintDefContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ColumnConstraintDefContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def NOT(self):
            return self.getToken(PartiQLParser.NOT, 0)
        def NULL(self):
            return self.getToken(PartiQLParser.NULL, 0)

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

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

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



    def columnConstraintDef(self):

        localctx = PartiQLParser.ColumnConstraintDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_columnConstraintDef)
        try:
            self.state = 429
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [140]:
                localctx = PartiQLParser.ColConstrNotNullContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 426
                self.match(PartiQLParser.NOT)
                self.state = 427
                self.match(PartiQLParser.NULL)
                pass
            elif token in [141]:
                localctx = PartiQLParser.ColConstrNullContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 428
                self.match(PartiQLParser.NULL)
                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 DmlContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_dml

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class DmlDeleteContext(DmlContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.DmlContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def deleteCommand(self):
            return self.getTypedRuleContext(PartiQLParser.DeleteCommandContext,0)


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

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

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


    class DmlInsertReturningContext(DmlContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.DmlContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def insertCommandReturning(self):
            return self.getTypedRuleContext(PartiQLParser.InsertCommandReturningContext,0)


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

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

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


    class DmlBaseWrapperContext(DmlContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.DmlContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def updateClause(self):
            return self.getTypedRuleContext(PartiQLParser.UpdateClauseContext,0)

        def dmlBaseCommand(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.DmlBaseCommandContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.DmlBaseCommandContext,i)

        def whereClause(self):
            return self.getTypedRuleContext(PartiQLParser.WhereClauseContext,0)

        def returningClause(self):
            return self.getTypedRuleContext(PartiQLParser.ReturningClauseContext,0)

        def fromClause(self):
            return self.getTypedRuleContext(PartiQLParser.FromClauseContext,0)


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

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

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


    class DmlBaseContext(DmlContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.DmlContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def dmlBaseCommand(self):
            return self.getTypedRuleContext(PartiQLParser.DmlBaseCommandContext,0)


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

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

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



    def dml(self):

        localctx = PartiQLParser.DmlContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_dml)
        self._la = 0 # Token type
        try:
            self.state = 458
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,26,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.DmlBaseWrapperContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 431
                self.updateClause()
                self.state = 433 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 432
                    self.dmlBaseCommand()
                    self.state = 435 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==112 or _la==173 or ((((_la - 185)) & ~0x3f) == 0 and ((1 << (_la - 185)) & 72057594574798849) != 0)):
                        break

                self.state = 438
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==225:
                    self.state = 437
                    self.whereClause()


                self.state = 441
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==246:
                    self.state = 440
                    self.returningClause()


                pass

            elif la_ == 2:
                localctx = PartiQLParser.DmlBaseWrapperContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 443
                self.fromClause()
                self.state = 445
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==225:
                    self.state = 444
                    self.whereClause()


                self.state = 448 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 447
                    self.dmlBaseCommand()
                    self.state = 450 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==112 or _la==173 or ((((_la - 185)) & ~0x3f) == 0 and ((1 << (_la - 185)) & 72057594574798849) != 0)):
                        break

                self.state = 453
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==246:
                    self.state = 452
                    self.returningClause()


                pass

            elif la_ == 3:
                localctx = PartiQLParser.DmlDeleteContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 455
                self.deleteCommand()
                pass

            elif la_ == 4:
                localctx = PartiQLParser.DmlInsertReturningContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 456
                self.insertCommandReturning()
                pass

            elif la_ == 5:
                localctx = PartiQLParser.DmlBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 457
                self.dmlBaseCommand()
                pass


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


    class DmlBaseCommandContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def insertStatement(self):
            return self.getTypedRuleContext(PartiQLParser.InsertStatementContext,0)


        def insertStatementLegacy(self):
            return self.getTypedRuleContext(PartiQLParser.InsertStatementLegacyContext,0)


        def setCommand(self):
            return self.getTypedRuleContext(PartiQLParser.SetCommandContext,0)


        def replaceCommand(self):
            return self.getTypedRuleContext(PartiQLParser.ReplaceCommandContext,0)


        def removeCommand(self):
            return self.getTypedRuleContext(PartiQLParser.RemoveCommandContext,0)


        def upsertCommand(self):
            return self.getTypedRuleContext(PartiQLParser.UpsertCommandContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_dmlBaseCommand

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

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

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




    def dmlBaseCommand(self):

        localctx = PartiQLParser.DmlBaseCommandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_dmlBaseCommand)
        try:
            self.state = 466
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,27,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 460
                self.insertStatement()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 461
                self.insertStatementLegacy()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 462
                self.setCommand()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 463
                self.replaceCommand()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 464
                self.removeCommand()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 465
                self.upsertCommand()
                pass


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


    class PathSimpleContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def pathSimpleSteps(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.PathSimpleStepsContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.PathSimpleStepsContext,i)


        def getRuleIndex(self):
            return PartiQLParser.RULE_pathSimple

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

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

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




    def pathSimple(self):

        localctx = PartiQLParser.PathSimpleContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_pathSimple)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 468
            self.symbolPrimitive()
            self.state = 472
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==290 or _la==299:
                self.state = 469
                self.pathSimpleSteps()
                self.state = 474
                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 PathSimpleStepsContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_pathSimpleSteps

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class PathSimpleLiteralContext(PathSimpleStepsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.PathSimpleStepsContext
            super().__init__(parser)
            self.key = None # LiteralContext
            self.copyFrom(ctx)

        def BRACKET_LEFT(self):
            return self.getToken(PartiQLParser.BRACKET_LEFT, 0)
        def BRACKET_RIGHT(self):
            return self.getToken(PartiQLParser.BRACKET_RIGHT, 0)
        def literal(self):
            return self.getTypedRuleContext(PartiQLParser.LiteralContext,0)


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

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

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


    class PathSimpleDotSymbolContext(PathSimpleStepsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.PathSimpleStepsContext
            super().__init__(parser)
            self.key = None # SymbolPrimitiveContext
            self.copyFrom(ctx)

        def PERIOD(self):
            return self.getToken(PartiQLParser.PERIOD, 0)
        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


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

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

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


    class PathSimpleSymbolContext(PathSimpleStepsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.PathSimpleStepsContext
            super().__init__(parser)
            self.key = None # SymbolPrimitiveContext
            self.copyFrom(ctx)

        def BRACKET_LEFT(self):
            return self.getToken(PartiQLParser.BRACKET_LEFT, 0)
        def BRACKET_RIGHT(self):
            return self.getToken(PartiQLParser.BRACKET_RIGHT, 0)
        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


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

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

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



    def pathSimpleSteps(self):

        localctx = PartiQLParser.PathSimpleStepsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_pathSimpleSteps)
        try:
            self.state = 485
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,29,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.PathSimpleLiteralContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 475
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 476
                localctx.key = self.literal()
                self.state = 477
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 2:
                localctx = PartiQLParser.PathSimpleSymbolContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 479
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 480
                localctx.key = self.symbolPrimitive()
                self.state = 481
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 3:
                localctx = PartiQLParser.PathSimpleDotSymbolContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 483
                self.match(PartiQLParser.PERIOD)
                self.state = 484
                localctx.key = self.symbolPrimitive()
                pass


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


    class ReplaceCommandContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def REPLACE(self):
            return self.getToken(PartiQLParser.REPLACE, 0)

        def INTO(self):
            return self.getToken(PartiQLParser.INTO, 0)

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def asIdent(self):
            return self.getTypedRuleContext(PartiQLParser.AsIdentContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_replaceCommand

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

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

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




    def replaceCommand(self):

        localctx = PartiQLParser.ReplaceCommandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_replaceCommand)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 487
            self.match(PartiQLParser.REPLACE)
            self.state = 488
            self.match(PartiQLParser.INTO)
            self.state = 489
            self.symbolPrimitive()
            self.state = 491
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==10:
                self.state = 490
                self.asIdent()


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


    class UpsertCommandContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def UPSERT(self):
            return self.getToken(PartiQLParser.UPSERT, 0)

        def INTO(self):
            return self.getToken(PartiQLParser.INTO, 0)

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def asIdent(self):
            return self.getTypedRuleContext(PartiQLParser.AsIdentContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_upsertCommand

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

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

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




    def upsertCommand(self):

        localctx = PartiQLParser.UpsertCommandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_upsertCommand)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 495
            self.match(PartiQLParser.UPSERT)
            self.state = 496
            self.match(PartiQLParser.INTO)
            self.state = 497
            self.symbolPrimitive()
            self.state = 499
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==10:
                self.state = 498
                self.asIdent()


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


    class RemoveCommandContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def REMOVE(self):
            return self.getToken(PartiQLParser.REMOVE, 0)

        def pathSimple(self):
            return self.getTypedRuleContext(PartiQLParser.PathSimpleContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_removeCommand

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

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

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




    def removeCommand(self):

        localctx = PartiQLParser.RemoveCommandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_removeCommand)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 503
            self.match(PartiQLParser.REMOVE)
            self.state = 504
            self.pathSimple()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class InsertCommandReturningContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def INTO(self):
            return self.getToken(PartiQLParser.INTO, 0)

        def pathSimple(self):
            return self.getTypedRuleContext(PartiQLParser.PathSimpleContext,0)


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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def AT(self):
            return self.getToken(PartiQLParser.AT, 0)

        def onConflictLegacy(self):
            return self.getTypedRuleContext(PartiQLParser.OnConflictLegacyContext,0)


        def returningClause(self):
            return self.getTypedRuleContext(PartiQLParser.ReturningClauseContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_insertCommandReturning

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

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

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




    def insertCommandReturning(self):

        localctx = PartiQLParser.InsertCommandReturningContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_insertCommandReturning)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 506
            self.match(PartiQLParser.INSERT)
            self.state = 507
            self.match(PartiQLParser.INTO)
            self.state = 508
            self.pathSimple()
            self.state = 509
            self.match(PartiQLParser.VALUE)
            self.state = 510
            localctx.value = self.expr()
            self.state = 513
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==13:
                self.state = 511
                self.match(PartiQLParser.AT)
                self.state = 512
                localctx.pos = self.expr()


            self.state = 516
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==147:
                self.state = 515
                self.onConflictLegacy()


            self.state = 519
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==246:
                self.state = 518
                self.returningClause()


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


    class InsertStatementContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def INTO(self):
            return self.getToken(PartiQLParser.INTO, 0)

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def values(self):
            return self.getTypedRuleContext(PartiQLParser.ValuesContext,0)


        def columnList(self):
            return self.getTypedRuleContext(PartiQLParser.ColumnListContext,0)


        def onConflict(self):
            return self.getTypedRuleContext(PartiQLParser.OnConflictContext,0)


        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def asIdent(self):
            return self.getTypedRuleContext(PartiQLParser.AsIdentContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_insertStatement

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

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

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




    def insertStatement(self):

        localctx = PartiQLParser.InsertStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_insertStatement)
        self._la = 0 # Token type
        try:
            self.state = 541
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,39,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 521
                self.match(PartiQLParser.INSERT)
                self.state = 522
                self.match(PartiQLParser.INTO)
                self.state = 523
                self.symbolPrimitive()
                self.state = 525
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==294:
                    self.state = 524
                    self.columnList()


                self.state = 527
                self.values()
                self.state = 529
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==147:
                    self.state = 528
                    self.onConflict()


                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 531
                self.match(PartiQLParser.INSERT)
                self.state = 532
                self.match(PartiQLParser.INTO)
                self.state = 533
                self.symbolPrimitive()
                self.state = 535
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==10:
                    self.state = 534
                    self.asIdent()


                self.state = 537
                localctx.value = self.expr()
                self.state = 539
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==147:
                    self.state = 538
                    self.onConflict()


                pass


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


    class ColumnListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def columnName(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ColumnNameContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ColumnNameContext,i)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

        def getRuleIndex(self):
            return PartiQLParser.RULE_columnList

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

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

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




    def columnList(self):

        localctx = PartiQLParser.ColumnListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_columnList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 543
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 544
            self.columnName()
            self.state = 549
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 545
                self.match(PartiQLParser.COMMA)
                self.state = 546
                self.columnName()
                self.state = 551
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 552
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class OnConflictContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def ON(self):
            return self.getToken(PartiQLParser.ON, 0)

        def CONFLICT(self):
            return self.getToken(PartiQLParser.CONFLICT, 0)

        def conflictAction(self):
            return self.getTypedRuleContext(PartiQLParser.ConflictActionContext,0)


        def conflictTarget(self):
            return self.getTypedRuleContext(PartiQLParser.ConflictTargetContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_onConflict

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

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

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




    def onConflict(self):

        localctx = PartiQLParser.OnConflictContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_onConflict)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 554
            self.match(PartiQLParser.ON)
            self.state = 555
            self.match(PartiQLParser.CONFLICT)
            self.state = 557
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==147 or _la==294:
                self.state = 556
                self.conflictTarget()


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


    class InsertStatementLegacyContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def INTO(self):
            return self.getToken(PartiQLParser.INTO, 0)

        def pathSimple(self):
            return self.getTypedRuleContext(PartiQLParser.PathSimpleContext,0)


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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def AT(self):
            return self.getToken(PartiQLParser.AT, 0)

        def onConflictLegacy(self):
            return self.getTypedRuleContext(PartiQLParser.OnConflictLegacyContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_insertStatementLegacy

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

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

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




    def insertStatementLegacy(self):

        localctx = PartiQLParser.InsertStatementLegacyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_insertStatementLegacy)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 561
            self.match(PartiQLParser.INSERT)
            self.state = 562
            self.match(PartiQLParser.INTO)
            self.state = 563
            self.pathSimple()
            self.state = 564
            self.match(PartiQLParser.VALUE)
            self.state = 565
            localctx.value = self.expr()
            self.state = 568
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==13:
                self.state = 566
                self.match(PartiQLParser.AT)
                self.state = 567
                localctx.pos = self.expr()


            self.state = 571
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==147:
                self.state = 570
                self.onConflictLegacy()


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


    class OnConflictLegacyContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def ON(self):
            return self.getToken(PartiQLParser.ON, 0)

        def CONFLICT(self):
            return self.getToken(PartiQLParser.CONFLICT, 0)

        def WHERE(self):
            return self.getToken(PartiQLParser.WHERE, 0)

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def DO(self):
            return self.getToken(PartiQLParser.DO, 0)

        def NOTHING(self):
            return self.getToken(PartiQLParser.NOTHING, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_onConflictLegacy

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

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

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




    def onConflictLegacy(self):

        localctx = PartiQLParser.OnConflictLegacyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_onConflictLegacy)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 573
            self.match(PartiQLParser.ON)
            self.state = 574
            self.match(PartiQLParser.CONFLICT)
            self.state = 575
            self.match(PartiQLParser.WHERE)
            self.state = 576
            self.expr()
            self.state = 577
            self.match(PartiQLParser.DO)
            self.state = 578
            self.match(PartiQLParser.NOTHING)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ConflictTargetContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def symbolPrimitive(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.SymbolPrimitiveContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,i)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

        def ON(self):
            return self.getToken(PartiQLParser.ON, 0)

        def CONSTRAINT(self):
            return self.getToken(PartiQLParser.CONSTRAINT, 0)

        def constraintName(self):
            return self.getTypedRuleContext(PartiQLParser.ConstraintNameContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_conflictTarget

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

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

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




    def conflictTarget(self):

        localctx = PartiQLParser.ConflictTargetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_conflictTarget)
        self._la = 0 # Token type
        try:
            self.state = 594
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [294]:
                self.enterOuterAlt(localctx, 1)
                self.state = 580
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 581
                self.symbolPrimitive()
                self.state = 586
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 582
                    self.match(PartiQLParser.COMMA)
                    self.state = 583
                    self.symbolPrimitive()
                    self.state = 588
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 589
                self.match(PartiQLParser.PAREN_RIGHT)
                pass
            elif token in [147]:
                self.enterOuterAlt(localctx, 2)
                self.state = 591
                self.match(PartiQLParser.ON)
                self.state = 592
                self.match(PartiQLParser.CONSTRAINT)
                self.state = 593
                self.constraintName()
                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 ConstraintNameContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_constraintName

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

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

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




    def constraintName(self):

        localctx = PartiQLParser.ConstraintNameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_constraintName)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 596
            self.symbolPrimitive()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ConflictActionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def DO(self):
            return self.getToken(PartiQLParser.DO, 0)

        def NOTHING(self):
            return self.getToken(PartiQLParser.NOTHING, 0)

        def REPLACE(self):
            return self.getToken(PartiQLParser.REPLACE, 0)

        def doReplace(self):
            return self.getTypedRuleContext(PartiQLParser.DoReplaceContext,0)


        def UPDATE(self):
            return self.getToken(PartiQLParser.UPDATE, 0)

        def doUpdate(self):
            return self.getTypedRuleContext(PartiQLParser.DoUpdateContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_conflictAction

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

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

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




    def conflictAction(self):

        localctx = PartiQLParser.ConflictActionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_conflictAction)
        try:
            self.state = 606
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,46,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 598
                self.match(PartiQLParser.DO)
                self.state = 599
                self.match(PartiQLParser.NOTHING)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 600
                self.match(PartiQLParser.DO)
                self.state = 601
                self.match(PartiQLParser.REPLACE)
                self.state = 602
                self.doReplace()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 603
                self.match(PartiQLParser.DO)
                self.state = 604
                self.match(PartiQLParser.UPDATE)
                self.state = 605
                self.doUpdate()
                pass


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


    class DoReplaceContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def EXCLUDED(self):
            return self.getToken(PartiQLParser.EXCLUDED, 0)

        def WHERE(self):
            return self.getToken(PartiQLParser.WHERE, 0)

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_doReplace

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

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

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




    def doReplace(self):

        localctx = PartiQLParser.DoReplaceContext(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_doReplace)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 608
            self.match(PartiQLParser.EXCLUDED)
            self.state = 611
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,47,self._ctx)
            if la_ == 1:
                self.state = 609
                self.match(PartiQLParser.WHERE)
                self.state = 610
                localctx.condition = self.expr()


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


    class DoUpdateContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def EXCLUDED(self):
            return self.getToken(PartiQLParser.EXCLUDED, 0)

        def WHERE(self):
            return self.getToken(PartiQLParser.WHERE, 0)

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_doUpdate

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

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

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




    def doUpdate(self):

        localctx = PartiQLParser.DoUpdateContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_doUpdate)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 613
            self.match(PartiQLParser.EXCLUDED)
            self.state = 616
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,48,self._ctx)
            if la_ == 1:
                self.state = 614
                self.match(PartiQLParser.WHERE)
                self.state = 615
                localctx.condition = self.expr()


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


    class UpdateClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def UPDATE(self):
            return self.getToken(PartiQLParser.UPDATE, 0)

        def tableBaseReference(self):
            return self.getTypedRuleContext(PartiQLParser.TableBaseReferenceContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_updateClause

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

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

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




    def updateClause(self):

        localctx = PartiQLParser.UpdateClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 78, self.RULE_updateClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 618
            self.match(PartiQLParser.UPDATE)
            self.state = 619
            self.tableBaseReference()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SetCommandContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def SET(self):
            return self.getToken(PartiQLParser.SET, 0)

        def setAssignment(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.SetAssignmentContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.SetAssignmentContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_setCommand

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

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

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




    def setCommand(self):

        localctx = PartiQLParser.SetCommandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 80, self.RULE_setCommand)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 621
            self.match(PartiQLParser.SET)
            self.state = 622
            self.setAssignment()
            self.state = 627
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 623
                self.match(PartiQLParser.COMMA)
                self.state = 624
                self.setAssignment()
                self.state = 629
                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 SetAssignmentContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def pathSimple(self):
            return self.getTypedRuleContext(PartiQLParser.PathSimpleContext,0)


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

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_setAssignment

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

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

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




    def setAssignment(self):

        localctx = PartiQLParser.SetAssignmentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 82, self.RULE_setAssignment)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 630
            self.pathSimple()
            self.state = 631
            self.match(PartiQLParser.EQ)
            self.state = 632
            self.expr()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DeleteCommandContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def fromClauseSimple(self):
            return self.getTypedRuleContext(PartiQLParser.FromClauseSimpleContext,0)


        def whereClause(self):
            return self.getTypedRuleContext(PartiQLParser.WhereClauseContext,0)


        def returningClause(self):
            return self.getTypedRuleContext(PartiQLParser.ReturningClauseContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_deleteCommand

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

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

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




    def deleteCommand(self):

        localctx = PartiQLParser.DeleteCommandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 84, self.RULE_deleteCommand)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 634
            self.match(PartiQLParser.DELETE)
            self.state = 635
            self.fromClauseSimple()
            self.state = 637
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==225:
                self.state = 636
                self.whereClause()


            self.state = 640
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==246:
                self.state = 639
                self.returningClause()


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


    class ReturningClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def RETURNING(self):
            return self.getToken(PartiQLParser.RETURNING, 0)

        def returningColumn(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ReturningColumnContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ReturningColumnContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_returningClause

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

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

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




    def returningClause(self):

        localctx = PartiQLParser.ReturningClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 86, self.RULE_returningClause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 642
            self.match(PartiQLParser.RETURNING)
            self.state = 643
            self.returningColumn()
            self.state = 648
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 644
                self.match(PartiQLParser.COMMA)
                self.state = 645
                self.returningColumn()
                self.state = 650
                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 ReturningColumnContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.status = None # Token
            self.age = None # Token
            self.col = None # ExprContext

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

        def MODIFIED(self):
            return self.getToken(PartiQLParser.MODIFIED, 0)

        def ALL(self):
            return self.getToken(PartiQLParser.ALL, 0)

        def OLD(self):
            return self.getToken(PartiQLParser.OLD, 0)

        def NEW(self):
            return self.getToken(PartiQLParser.NEW, 0)

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_returningColumn

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

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

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




    def returningColumn(self):

        localctx = PartiQLParser.ReturningColumnContext(self, self._ctx, self.state)
        self.enterRule(localctx, 88, self.RULE_returningColumn)
        self._la = 0 # Token type
        try:
            self.state = 657
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,53,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 651
                localctx.status = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==4 or _la==247):
                    localctx.status = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 652
                localctx.age = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==248 or _la==249):
                    localctx.age = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 653
                self.match(PartiQLParser.ASTERISK)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 654
                localctx.status = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==4 or _la==247):
                    localctx.status = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 655
                localctx.age = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==248 or _la==249):
                    localctx.age = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 656
                localctx.col = self.expr()
                pass


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


    class FromClauseSimpleContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_fromClauseSimple

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class FromClauseSimpleExplicitContext(FromClauseSimpleContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.FromClauseSimpleContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def FROM(self):
            return self.getToken(PartiQLParser.FROM, 0)
        def pathSimple(self):
            return self.getTypedRuleContext(PartiQLParser.PathSimpleContext,0)

        def asIdent(self):
            return self.getTypedRuleContext(PartiQLParser.AsIdentContext,0)

        def atIdent(self):
            return self.getTypedRuleContext(PartiQLParser.AtIdentContext,0)

        def byIdent(self):
            return self.getTypedRuleContext(PartiQLParser.ByIdentContext,0)


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

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

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


    class FromClauseSimpleImplicitContext(FromClauseSimpleContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.FromClauseSimpleContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def FROM(self):
            return self.getToken(PartiQLParser.FROM, 0)
        def pathSimple(self):
            return self.getTypedRuleContext(PartiQLParser.PathSimpleContext,0)

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


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

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

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



    def fromClauseSimple(self):

        localctx = PartiQLParser.FromClauseSimpleContext(self, self._ctx, self.state)
        self.enterRule(localctx, 90, self.RULE_fromClauseSimple)
        self._la = 0 # Token type
        try:
            self.state = 674
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,57,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.FromClauseSimpleExplicitContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 659
                self.match(PartiQLParser.FROM)
                self.state = 660
                self.pathSimple()
                self.state = 662
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==10:
                    self.state = 661
                    self.asIdent()


                self.state = 665
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==13:
                    self.state = 664
                    self.atIdent()


                self.state = 668
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==20:
                    self.state = 667
                    self.byIdent()


                pass

            elif la_ == 2:
                localctx = PartiQLParser.FromClauseSimpleImplicitContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 670
                self.match(PartiQLParser.FROM)
                self.state = 671
                self.pathSimple()
                self.state = 672
                self.symbolPrimitive()
                pass


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


    class WhereClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def WHERE(self):
            return self.getToken(PartiQLParser.WHERE, 0)

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_whereClause

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

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

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




    def whereClause(self):

        localctx = PartiQLParser.WhereClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 92, self.RULE_whereClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 676
            self.match(PartiQLParser.WHERE)
            self.state = 677
            localctx.arg = self.expr()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SelectClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_selectClause

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class SelectAllContext(SelectClauseContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.SelectClauseContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def SELECT(self):
            return self.getToken(PartiQLParser.SELECT, 0)
        def ASTERISK(self):
            return self.getToken(PartiQLParser.ASTERISK, 0)
        def setQuantifierStrategy(self):
            return self.getTypedRuleContext(PartiQLParser.SetQuantifierStrategyContext,0)


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

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

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


    class SelectValueContext(SelectClauseContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.SelectClauseContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def SELECT(self):
            return self.getToken(PartiQLParser.SELECT, 0)
        def VALUE(self):
            return self.getToken(PartiQLParser.VALUE, 0)
        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)

        def setQuantifierStrategy(self):
            return self.getTypedRuleContext(PartiQLParser.SetQuantifierStrategyContext,0)


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

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

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


    class SelectItemsContext(SelectClauseContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.SelectClauseContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def SELECT(self):
            return self.getToken(PartiQLParser.SELECT, 0)
        def projectionItems(self):
            return self.getTypedRuleContext(PartiQLParser.ProjectionItemsContext,0)

        def setQuantifierStrategy(self):
            return self.getTypedRuleContext(PartiQLParser.SetQuantifierStrategyContext,0)


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

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

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


    class SelectPivotContext(SelectClauseContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.SelectClauseContext
            super().__init__(parser)
            self.pivot = None # ExprContext
            self.at = None # ExprContext
            self.copyFrom(ctx)

        def PIVOT(self):
            return self.getToken(PartiQLParser.PIVOT, 0)
        def AT(self):
            return self.getToken(PartiQLParser.AT, 0)
        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


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

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

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



    def selectClause(self):

        localctx = PartiQLParser.SelectClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 94, self.RULE_selectClause)
        self._la = 0 # Token type
        try:
            self.state = 700
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,61,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.SelectAllContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 679
                self.match(PartiQLParser.SELECT)
                self.state = 681
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==4 or _la==67:
                    self.state = 680
                    self.setQuantifierStrategy()


                self.state = 683
                self.match(PartiQLParser.ASTERISK)
                pass

            elif la_ == 2:
                localctx = PartiQLParser.SelectItemsContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 684
                self.match(PartiQLParser.SELECT)
                self.state = 686
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==4 or _la==67:
                    self.state = 685
                    self.setQuantifierStrategy()


                self.state = 688
                self.projectionItems()
                pass

            elif la_ == 3:
                localctx = PartiQLParser.SelectValueContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 689
                self.match(PartiQLParser.SELECT)
                self.state = 691
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==4 or _la==67:
                    self.state = 690
                    self.setQuantifierStrategy()


                self.state = 693
                self.match(PartiQLParser.VALUE)
                self.state = 694
                self.expr()
                pass

            elif la_ == 4:
                localctx = PartiQLParser.SelectPivotContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 695
                self.match(PartiQLParser.PIVOT)
                self.state = 696
                localctx.pivot = self.expr()
                self.state = 697
                self.match(PartiQLParser.AT)
                self.state = 698
                localctx.at = self.expr()
                pass


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


    class ProjectionItemsContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def projectionItem(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ProjectionItemContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ProjectionItemContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_projectionItems

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

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

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




    def projectionItems(self):

        localctx = PartiQLParser.ProjectionItemsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 96, self.RULE_projectionItems)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 702
            self.projectionItem()
            self.state = 707
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 703
                self.match(PartiQLParser.COMMA)
                self.state = 704
                self.projectionItem()
                self.state = 709
                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 ProjectionItemContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_projectionItem

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

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

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




    def projectionItem(self):

        localctx = PartiQLParser.ProjectionItemContext(self, self._ctx, self.state)
        self.enterRule(localctx, 98, self.RULE_projectionItem)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 710
            self.expr()
            self.state = 715
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==10 or _la==303 or _la==304:
                self.state = 712
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==10:
                    self.state = 711
                    self.match(PartiQLParser.AS)


                self.state = 714
                self.symbolPrimitive()


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


    class SetQuantifierStrategyContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def DISTINCT(self):
            return self.getToken(PartiQLParser.DISTINCT, 0)

        def ALL(self):
            return self.getToken(PartiQLParser.ALL, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_setQuantifierStrategy

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

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

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




    def setQuantifierStrategy(self):

        localctx = PartiQLParser.SetQuantifierStrategyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 100, self.RULE_setQuantifierStrategy)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 717
            _la = self._input.LA(1)
            if not(_la==4 or _la==67):
                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 LetClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def LET(self):
            return self.getToken(PartiQLParser.LET, 0)

        def letBinding(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.LetBindingContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.LetBindingContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_letClause

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

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

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




    def letClause(self):

        localctx = PartiQLParser.LetClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 102, self.RULE_letClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 719
            self.match(PartiQLParser.LET)
            self.state = 720
            self.letBinding()
            self.state = 725
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,65,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 721
                    self.match(PartiQLParser.COMMA)
                    self.state = 722
                    self.letBinding() 
                self.state = 727
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,65,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 LetBindingContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_letBinding

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

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

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




    def letBinding(self):

        localctx = PartiQLParser.LetBindingContext(self, self._ctx, self.state)
        self.enterRule(localctx, 104, self.RULE_letBinding)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 728
            self.expr()
            self.state = 729
            self.match(PartiQLParser.AS)
            self.state = 730
            self.symbolPrimitive()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class OrderByClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def ORDER(self):
            return self.getToken(PartiQLParser.ORDER, 0)

        def BY(self):
            return self.getToken(PartiQLParser.BY, 0)

        def orderSortSpec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.OrderSortSpecContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.OrderSortSpecContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_orderByClause

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

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

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




    def orderByClause(self):

        localctx = PartiQLParser.OrderByClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 106, self.RULE_orderByClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 732
            self.match(PartiQLParser.ORDER)
            self.state = 733
            self.match(PartiQLParser.BY)
            self.state = 734
            self.orderSortSpec()
            self.state = 739
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,66,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 735
                    self.match(PartiQLParser.COMMA)
                    self.state = 736
                    self.orderSortSpec() 
                self.state = 741
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,66,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 OrderSortSpecContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def NULLS(self):
            return self.getToken(PartiQLParser.NULLS, 0)

        def ASC(self):
            return self.getToken(PartiQLParser.ASC, 0)

        def DESC(self):
            return self.getToken(PartiQLParser.DESC, 0)

        def FIRST(self):
            return self.getToken(PartiQLParser.FIRST, 0)

        def LAST(self):
            return self.getToken(PartiQLParser.LAST, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_orderSortSpec

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

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

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




    def orderSortSpec(self):

        localctx = PartiQLParser.OrderSortSpecContext(self, self._ctx, self.state)
        self.enterRule(localctx, 108, self.RULE_orderSortSpec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 742
            self.expr()
            self.state = 744
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,67,self._ctx)
            if la_ == 1:
                self.state = 743
                localctx.dir_ = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==11 or _la==62):
                    localctx.dir_ = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()


            self.state = 748
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,68,self._ctx)
            if la_ == 1:
                self.state = 746
                self.match(PartiQLParser.NULLS)
                self.state = 747
                localctx.nulls = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==90 or _la==123):
                    localctx.nulls = 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 GroupClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def BY(self):
            return self.getToken(PartiQLParser.BY, 0)

        def groupKey(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.GroupKeyContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.GroupKeyContext,i)


        def PARTIAL(self):
            return self.getToken(PartiQLParser.PARTIAL, 0)

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

        def groupAlias(self):
            return self.getTypedRuleContext(PartiQLParser.GroupAliasContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_groupClause

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

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

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




    def groupClause(self):

        localctx = PartiQLParser.GroupClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 110, self.RULE_groupClause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 750
            self.match(PartiQLParser.GROUP)
            self.state = 752
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==158:
                self.state = 751
                self.match(PartiQLParser.PARTIAL)


            self.state = 754
            self.match(PartiQLParser.BY)
            self.state = 755
            self.groupKey()
            self.state = 760
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,70,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 756
                    self.match(PartiQLParser.COMMA)
                    self.state = 757
                    self.groupKey() 
                self.state = 762
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,70,self._ctx)

            self.state = 764
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,71,self._ctx)
            if la_ == 1:
                self.state = 763
                self.groupAlias()


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


    class GroupAliasContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_groupAlias

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

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

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




    def groupAlias(self):

        localctx = PartiQLParser.GroupAliasContext(self, self._ctx, self.state)
        self.enterRule(localctx, 112, self.RULE_groupAlias)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 766
            self.match(PartiQLParser.GROUP)
            self.state = 767
            self.match(PartiQLParser.AS)
            self.state = 768
            self.symbolPrimitive()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GroupKeyContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def exprSelect(self):
            return self.getTypedRuleContext(PartiQLParser.ExprSelectContext,0)


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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_groupKey

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

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

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




    def groupKey(self):

        localctx = PartiQLParser.GroupKeyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 114, self.RULE_groupKey)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 770
            localctx.key = self.exprSelect()
            self.state = 773
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,72,self._ctx)
            if la_ == 1:
                self.state = 771
                self.match(PartiQLParser.AS)
                self.state = 772
                self.symbolPrimitive()


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


    class OverContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def OVER(self):
            return self.getToken(PartiQLParser.OVER, 0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def windowPartitionList(self):
            return self.getTypedRuleContext(PartiQLParser.WindowPartitionListContext,0)


        def windowSortSpecList(self):
            return self.getTypedRuleContext(PartiQLParser.WindowSortSpecListContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_over

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

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

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




    def over(self):

        localctx = PartiQLParser.OverContext(self, self._ctx, self.state)
        self.enterRule(localctx, 116, self.RULE_over)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 775
            self.match(PartiQLParser.OVER)
            self.state = 776
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 778
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==233:
                self.state = 777
                self.windowPartitionList()


            self.state = 781
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==152:
                self.state = 780
                self.windowSortSpecList()


            self.state = 783
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class WindowPartitionListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def PARTITION(self):
            return self.getToken(PartiQLParser.PARTITION, 0)

        def BY(self):
            return self.getToken(PartiQLParser.BY, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_windowPartitionList

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

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

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




    def windowPartitionList(self):

        localctx = PartiQLParser.WindowPartitionListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 118, self.RULE_windowPartitionList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 785
            self.match(PartiQLParser.PARTITION)
            self.state = 786
            self.match(PartiQLParser.BY)
            self.state = 787
            self.expr()
            self.state = 792
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 788
                self.match(PartiQLParser.COMMA)
                self.state = 789
                self.expr()
                self.state = 794
                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 WindowSortSpecListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def ORDER(self):
            return self.getToken(PartiQLParser.ORDER, 0)

        def BY(self):
            return self.getToken(PartiQLParser.BY, 0)

        def orderSortSpec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.OrderSortSpecContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.OrderSortSpecContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_windowSortSpecList

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

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

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




    def windowSortSpecList(self):

        localctx = PartiQLParser.WindowSortSpecListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 120, self.RULE_windowSortSpecList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 795
            self.match(PartiQLParser.ORDER)
            self.state = 796
            self.match(PartiQLParser.BY)
            self.state = 797
            self.orderSortSpec()
            self.state = 802
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 798
                self.match(PartiQLParser.COMMA)
                self.state = 799
                self.orderSortSpec()
                self.state = 804
                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 HavingClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def HAVING(self):
            return self.getToken(PartiQLParser.HAVING, 0)

        def exprSelect(self):
            return self.getTypedRuleContext(PartiQLParser.ExprSelectContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_havingClause

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

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

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




    def havingClause(self):

        localctx = PartiQLParser.HavingClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 122, self.RULE_havingClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 805
            self.match(PartiQLParser.HAVING)
            self.state = 806
            localctx.arg = self.exprSelect()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExcludeClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def EXCLUDE(self):
            return self.getToken(PartiQLParser.EXCLUDE, 0)

        def excludeExpr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExcludeExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExcludeExprContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_excludeClause

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

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

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




    def excludeClause(self):

        localctx = PartiQLParser.ExcludeClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 124, self.RULE_excludeClause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 808
            self.match(PartiQLParser.EXCLUDE)
            self.state = 809
            self.excludeExpr()
            self.state = 814
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 810
                self.match(PartiQLParser.COMMA)
                self.state = 811
                self.excludeExpr()
                self.state = 816
                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 ExcludeExprContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def excludeExprSteps(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExcludeExprStepsContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExcludeExprStepsContext,i)


        def getRuleIndex(self):
            return PartiQLParser.RULE_excludeExpr

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

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

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




    def excludeExpr(self):

        localctx = PartiQLParser.ExcludeExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 126, self.RULE_excludeExpr)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 817
            self.symbolPrimitive()
            self.state = 819 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 818
                self.excludeExprSteps()
                self.state = 821 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==290 or _la==299):
                    break

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


    class ExcludeExprStepsContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_excludeExprSteps

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class ExcludeExprTupleAttrContext(ExcludeExprStepsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExcludeExprStepsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PERIOD(self):
            return self.getToken(PartiQLParser.PERIOD, 0)
        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


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

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

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


    class ExcludeExprTupleWildcardContext(ExcludeExprStepsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExcludeExprStepsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PERIOD(self):
            return self.getToken(PartiQLParser.PERIOD, 0)
        def ASTERISK(self):
            return self.getToken(PartiQLParser.ASTERISK, 0)

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

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

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


    class ExcludeExprCollectionWildcardContext(ExcludeExprStepsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExcludeExprStepsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def BRACKET_LEFT(self):
            return self.getToken(PartiQLParser.BRACKET_LEFT, 0)
        def ASTERISK(self):
            return self.getToken(PartiQLParser.ASTERISK, 0)
        def BRACKET_RIGHT(self):
            return self.getToken(PartiQLParser.BRACKET_RIGHT, 0)

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

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

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


    class ExcludeExprCollectionAttrContext(ExcludeExprStepsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExcludeExprStepsContext
            super().__init__(parser)
            self.attr = None # Token
            self.copyFrom(ctx)

        def BRACKET_LEFT(self):
            return self.getToken(PartiQLParser.BRACKET_LEFT, 0)
        def BRACKET_RIGHT(self):
            return self.getToken(PartiQLParser.BRACKET_RIGHT, 0)
        def LITERAL_STRING(self):
            return self.getToken(PartiQLParser.LITERAL_STRING, 0)

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

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

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


    class ExcludeExprCollectionIndexContext(ExcludeExprStepsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExcludeExprStepsContext
            super().__init__(parser)
            self.index = None # Token
            self.copyFrom(ctx)

        def BRACKET_LEFT(self):
            return self.getToken(PartiQLParser.BRACKET_LEFT, 0)
        def BRACKET_RIGHT(self):
            return self.getToken(PartiQLParser.BRACKET_RIGHT, 0)
        def LITERAL_INTEGER(self):
            return self.getToken(PartiQLParser.LITERAL_INTEGER, 0)

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

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

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



    def excludeExprSteps(self):

        localctx = PartiQLParser.ExcludeExprStepsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 128, self.RULE_excludeExprSteps)
        try:
            self.state = 836
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,79,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.ExcludeExprTupleAttrContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 823
                self.match(PartiQLParser.PERIOD)
                self.state = 824
                self.symbolPrimitive()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.ExcludeExprCollectionAttrContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 825
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 826
                localctx.attr = self.match(PartiQLParser.LITERAL_STRING)
                self.state = 827
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 3:
                localctx = PartiQLParser.ExcludeExprCollectionIndexContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 828
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 829
                localctx.index = self.match(PartiQLParser.LITERAL_INTEGER)
                self.state = 830
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 4:
                localctx = PartiQLParser.ExcludeExprCollectionWildcardContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 831
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 832
                self.match(PartiQLParser.ASTERISK)
                self.state = 833
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 5:
                localctx = PartiQLParser.ExcludeExprTupleWildcardContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 834
                self.match(PartiQLParser.PERIOD)
                self.state = 835
                self.match(PartiQLParser.ASTERISK)
                pass


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


    class FromClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def FROM(self):
            return self.getToken(PartiQLParser.FROM, 0)

        def tableReference(self):
            return self.getTypedRuleContext(PartiQLParser.TableReferenceContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_fromClause

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

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

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




    def fromClause(self):

        localctx = PartiQLParser.FromClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 130, self.RULE_fromClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 838
            self.match(PartiQLParser.FROM)
            self.state = 839
            self.tableReference(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class WhereClauseSelectContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def WHERE(self):
            return self.getToken(PartiQLParser.WHERE, 0)

        def exprSelect(self):
            return self.getTypedRuleContext(PartiQLParser.ExprSelectContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_whereClauseSelect

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

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

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




    def whereClauseSelect(self):

        localctx = PartiQLParser.WhereClauseSelectContext(self, self._ctx, self.state)
        self.enterRule(localctx, 132, self.RULE_whereClauseSelect)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 841
            self.match(PartiQLParser.WHERE)
            self.state = 842
            localctx.arg = self.exprSelect()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class OffsetByClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def exprSelect(self):
            return self.getTypedRuleContext(PartiQLParser.ExprSelectContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_offsetByClause

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

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

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




    def offsetByClause(self):

        localctx = PartiQLParser.OffsetByClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 134, self.RULE_offsetByClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 844
            self.match(PartiQLParser.OFFSET)
            self.state = 845
            localctx.arg = self.exprSelect()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LimitClauseContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def exprSelect(self):
            return self.getTypedRuleContext(PartiQLParser.ExprSelectContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_limitClause

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

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

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




    def limitClause(self):

        localctx = PartiQLParser.LimitClauseContext(self, self._ctx, self.state)
        self.enterRule(localctx, 136, self.RULE_limitClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 847
            self.match(PartiQLParser.LIMIT)
            self.state = 848
            localctx.arg = self.exprSelect()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GpmlPatternContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def matchPattern(self):
            return self.getTypedRuleContext(PartiQLParser.MatchPatternContext,0)


        def matchSelector(self):
            return self.getTypedRuleContext(PartiQLParser.MatchSelectorContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_gpmlPattern

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

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

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




    def gpmlPattern(self):

        localctx = PartiQLParser.GpmlPatternContext(self, self._ctx, self.state)
        self.enterRule(localctx, 138, self.RULE_gpmlPattern)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 851
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,80,self._ctx)
            if la_ == 1:
                self.state = 850
                localctx.selector = self.matchSelector()


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


    class GpmlPatternListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def matchPattern(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.MatchPatternContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.MatchPatternContext,i)


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

        def matchSelector(self):
            return self.getTypedRuleContext(PartiQLParser.MatchSelectorContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_gpmlPatternList

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

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

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




    def gpmlPatternList(self):

        localctx = PartiQLParser.GpmlPatternListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 140, self.RULE_gpmlPatternList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 856
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==4 or _la==8 or _la==186:
                self.state = 855
                localctx.selector = self.matchSelector()


            self.state = 858
            self.matchPattern()
            self.state = 863
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 859
                self.match(PartiQLParser.COMMA)
                self.state = 860
                self.matchPattern()
                self.state = 865
                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 MatchPatternContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.restrictor = None # PatternRestrictorContext
            self.variable = None # PatternPathVariableContext

        def graphPart(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.GraphPartContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.GraphPartContext,i)


        def patternRestrictor(self):
            return self.getTypedRuleContext(PartiQLParser.PatternRestrictorContext,0)


        def patternPathVariable(self):
            return self.getTypedRuleContext(PartiQLParser.PatternPathVariableContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_matchPattern

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

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

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




    def matchPattern(self):

        localctx = PartiQLParser.MatchPatternContext(self, self._ctx, self.state)
        self.enterRule(localctx, 142, self.RULE_matchPattern)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 867
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,83,self._ctx)
            if la_ == 1:
                self.state = 866
                localctx.restrictor = self.patternRestrictor()


            self.state = 870
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,84,self._ctx)
            if la_ == 1:
                self.state = 869
                localctx.variable = self.patternPathVariable()


            self.state = 875
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,85,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 872
                    self.graphPart() 
                self.state = 877
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,85,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 GraphPartContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def node(self):
            return self.getTypedRuleContext(PartiQLParser.NodeContext,0)


        def edge(self):
            return self.getTypedRuleContext(PartiQLParser.EdgeContext,0)


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


        def getRuleIndex(self):
            return PartiQLParser.RULE_graphPart

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

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

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




    def graphPart(self):

        localctx = PartiQLParser.GraphPartContext(self, self._ctx, self.state)
        self.enterRule(localctx, 144, self.RULE_graphPart)
        try:
            self.state = 881
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,86,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 878
                self.node()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 879
                self.edge()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 880
                self.pattern()
                pass


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


    class MatchSelectorContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_matchSelector

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class SelectorAnyContext(MatchSelectorContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.MatchSelectorContext
            super().__init__(parser)
            self.k = None # Token
            self.copyFrom(ctx)

        def ANY(self):
            return self.getToken(PartiQLParser.ANY, 0)
        def LITERAL_INTEGER(self):
            return self.getToken(PartiQLParser.LITERAL_INTEGER, 0)

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

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

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


    class SelectorShortestContext(MatchSelectorContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.MatchSelectorContext
            super().__init__(parser)
            self.k = None # Token
            self.copyFrom(ctx)

        def SHORTEST(self):
            return self.getToken(PartiQLParser.SHORTEST, 0)
        def LITERAL_INTEGER(self):
            return self.getToken(PartiQLParser.LITERAL_INTEGER, 0)
        def GROUP(self):
            return self.getToken(PartiQLParser.GROUP, 0)

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

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

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


    class SelectorBasicContext(MatchSelectorContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.MatchSelectorContext
            super().__init__(parser)
            self.mod = None # Token
            self.copyFrom(ctx)

        def SHORTEST(self):
            return self.getToken(PartiQLParser.SHORTEST, 0)
        def ANY(self):
            return self.getToken(PartiQLParser.ANY, 0)
        def ALL(self):
            return self.getToken(PartiQLParser.ALL, 0)

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

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

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



    def matchSelector(self):

        localctx = PartiQLParser.MatchSelectorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 146, self.RULE_matchSelector)
        self._la = 0 # Token type
        try:
            self.state = 894
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,89,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.SelectorBasicContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 883
                localctx.mod = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==4 or _la==8):
                    localctx.mod = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 884
                self.match(PartiQLParser.SHORTEST)
                pass

            elif la_ == 2:
                localctx = PartiQLParser.SelectorAnyContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 885
                self.match(PartiQLParser.ANY)
                self.state = 887
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,87,self._ctx)
                if la_ == 1:
                    self.state = 886
                    localctx.k = self.match(PartiQLParser.LITERAL_INTEGER)


                pass

            elif la_ == 3:
                localctx = PartiQLParser.SelectorShortestContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 889
                self.match(PartiQLParser.SHORTEST)
                self.state = 890
                localctx.k = self.match(PartiQLParser.LITERAL_INTEGER)
                self.state = 892
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,88,self._ctx)
                if la_ == 1:
                    self.state = 891
                    self.match(PartiQLParser.GROUP)


                pass


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


    class PatternPathVariableContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_patternPathVariable

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

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

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




    def patternPathVariable(self):

        localctx = PartiQLParser.PatternPathVariableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 148, self.RULE_patternPathVariable)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 896
            self.symbolPrimitive()
            self.state = 897
            self.match(PartiQLParser.EQ)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class PatternRestrictorContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def IDENTIFIER(self):
            return self.getToken(PartiQLParser.IDENTIFIER, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_patternRestrictor

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

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

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




    def patternRestrictor(self):

        localctx = PartiQLParser.PatternRestrictorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 150, self.RULE_patternRestrictor)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 899
            localctx.restrictor = self.match(PartiQLParser.IDENTIFIER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NodeContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def COLON(self):
            return self.getToken(PartiQLParser.COLON, 0)

        def labelSpec(self):
            return self.getTypedRuleContext(PartiQLParser.LabelSpecContext,0)


        def whereClause(self):
            return self.getTypedRuleContext(PartiQLParser.WhereClauseContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_node

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

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

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




    def node(self):

        localctx = PartiQLParser.NodeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 152, self.RULE_node)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 901
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 903
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==303 or _la==304:
                self.state = 902
                self.symbolPrimitive()


            self.state = 907
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==296:
                self.state = 905
                self.match(PartiQLParser.COLON)
                self.state = 906
                self.labelSpec(0)


            self.state = 910
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==225:
                self.state = 909
                self.whereClause()


            self.state = 912
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class EdgeContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_edge

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class EdgeWithSpecContext(EdgeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.EdgeContext
            super().__init__(parser)
            self.quantifier = None # PatternQuantifierContext
            self.copyFrom(ctx)

        def edgeWSpec(self):
            return self.getTypedRuleContext(PartiQLParser.EdgeWSpecContext,0)

        def patternQuantifier(self):
            return self.getTypedRuleContext(PartiQLParser.PatternQuantifierContext,0)


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

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

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


    class EdgeAbbreviatedContext(EdgeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.EdgeContext
            super().__init__(parser)
            self.quantifier = None # PatternQuantifierContext
            self.copyFrom(ctx)

        def edgeAbbrev(self):
            return self.getTypedRuleContext(PartiQLParser.EdgeAbbrevContext,0)

        def patternQuantifier(self):
            return self.getTypedRuleContext(PartiQLParser.PatternQuantifierContext,0)


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

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

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



    def edge(self):

        localctx = PartiQLParser.EdgeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 154, self.RULE_edge)
        try:
            self.state = 922
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,95,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.EdgeWithSpecContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 914
                self.edgeWSpec()
                self.state = 916
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,93,self._ctx)
                if la_ == 1:
                    self.state = 915
                    localctx.quantifier = self.patternQuantifier()


                pass

            elif la_ == 2:
                localctx = PartiQLParser.EdgeAbbreviatedContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 918
                self.edgeAbbrev()
                self.state = 920
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,94,self._ctx)
                if la_ == 1:
                    self.state = 919
                    localctx.quantifier = self.patternQuantifier()


                pass


        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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.restrictor = None # PatternRestrictorContext
            self.variable = None # PatternPathVariableContext
            self.where = None # WhereClauseContext
            self.quantifier = None # PatternQuantifierContext

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def graphPart(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.GraphPartContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.GraphPartContext,i)


        def patternRestrictor(self):
            return self.getTypedRuleContext(PartiQLParser.PatternRestrictorContext,0)


        def patternPathVariable(self):
            return self.getTypedRuleContext(PartiQLParser.PatternPathVariableContext,0)


        def whereClause(self):
            return self.getTypedRuleContext(PartiQLParser.WhereClauseContext,0)


        def patternQuantifier(self):
            return self.getTypedRuleContext(PartiQLParser.PatternQuantifierContext,0)


        def BRACKET_LEFT(self):
            return self.getToken(PartiQLParser.BRACKET_LEFT, 0)

        def BRACKET_RIGHT(self):
            return self.getToken(PartiQLParser.BRACKET_RIGHT, 0)

        def getRuleIndex(self):
            return PartiQLParser.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 = PartiQLParser.PatternContext(self, self._ctx, self.state)
        self.enterRule(localctx, 156, self.RULE_pattern)
        self._la = 0 # Token type
        try:
            self.state = 962
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [294]:
                self.enterOuterAlt(localctx, 1)
                self.state = 924
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 926
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,96,self._ctx)
                if la_ == 1:
                    self.state = 925
                    localctx.restrictor = self.patternRestrictor()


                self.state = 929
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==303 or _la==304:
                    self.state = 928
                    localctx.variable = self.patternPathVariable()


                self.state = 932 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 931
                    self.graphPart()
                    self.state = 934 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (((((_la - 272)) & ~0x3f) == 0 and ((1 << (_la - 272)) & 4472849) != 0)):
                        break

                self.state = 937
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==225:
                    self.state = 936
                    localctx.where = self.whereClause()


                self.state = 939
                self.match(PartiQLParser.PAREN_RIGHT)
                self.state = 941
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,100,self._ctx)
                if la_ == 1:
                    self.state = 940
                    localctx.quantifier = self.patternQuantifier()


                pass
            elif token in [290]:
                self.enterOuterAlt(localctx, 2)
                self.state = 943
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 945
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,101,self._ctx)
                if la_ == 1:
                    self.state = 944
                    localctx.restrictor = self.patternRestrictor()


                self.state = 948
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==303 or _la==304:
                    self.state = 947
                    localctx.variable = self.patternPathVariable()


                self.state = 951 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 950
                    self.graphPart()
                    self.state = 953 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (((((_la - 272)) & ~0x3f) == 0 and ((1 << (_la - 272)) & 4472849) != 0)):
                        break

                self.state = 956
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==225:
                    self.state = 955
                    localctx.where = self.whereClause()


                self.state = 958
                self.match(PartiQLParser.BRACKET_RIGHT)
                self.state = 960
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,105,self._ctx)
                if la_ == 1:
                    self.state = 959
                    localctx.quantifier = self.patternQuantifier()


                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 PatternQuantifierContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.quant = None # Token
            self.lower = None # Token
            self.upper = None # Token

        def PLUS(self):
            return self.getToken(PartiQLParser.PLUS, 0)

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

        def BRACE_LEFT(self):
            return self.getToken(PartiQLParser.BRACE_LEFT, 0)

        def COMMA(self):
            return self.getToken(PartiQLParser.COMMA, 0)

        def BRACE_RIGHT(self):
            return self.getToken(PartiQLParser.BRACE_RIGHT, 0)

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

        def getRuleIndex(self):
            return PartiQLParser.RULE_patternQuantifier

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

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

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




    def patternQuantifier(self):

        localctx = PartiQLParser.PatternQuantifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 158, self.RULE_patternQuantifier)
        self._la = 0 # Token type
        try:
            self.state = 972
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [271, 277]:
                self.enterOuterAlt(localctx, 1)
                self.state = 964
                localctx.quant = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==271 or _la==277):
                    localctx.quant = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                pass
            elif token in [292]:
                self.enterOuterAlt(localctx, 2)
                self.state = 965
                self.match(PartiQLParser.BRACE_LEFT)
                self.state = 966
                localctx.lower = self.match(PartiQLParser.LITERAL_INTEGER)
                self.state = 967
                self.match(PartiQLParser.COMMA)
                self.state = 969
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==301:
                    self.state = 968
                    localctx.upper = self.match(PartiQLParser.LITERAL_INTEGER)


                self.state = 971
                self.match(PartiQLParser.BRACE_RIGHT)
                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 EdgeWSpecContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_edgeWSpec

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class EdgeSpecLeftContext(EdgeWSpecContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.EdgeWSpecContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def ANGLE_LEFT(self):
            return self.getToken(PartiQLParser.ANGLE_LEFT, 0)
        def MINUS(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.MINUS)
            else:
                return self.getToken(PartiQLParser.MINUS, i)
        def edgeSpec(self):
            return self.getTypedRuleContext(PartiQLParser.EdgeSpecContext,0)


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

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

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


    class EdgeSpecUndirectedLeftContext(EdgeWSpecContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.EdgeWSpecContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def ANGLE_LEFT(self):
            return self.getToken(PartiQLParser.ANGLE_LEFT, 0)
        def TILDE(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.TILDE)
            else:
                return self.getToken(PartiQLParser.TILDE, i)
        def edgeSpec(self):
            return self.getTypedRuleContext(PartiQLParser.EdgeSpecContext,0)


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

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

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


    class EdgeSpecBidirectionalContext(EdgeWSpecContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.EdgeWSpecContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def ANGLE_LEFT(self):
            return self.getToken(PartiQLParser.ANGLE_LEFT, 0)
        def MINUS(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.MINUS)
            else:
                return self.getToken(PartiQLParser.MINUS, i)
        def edgeSpec(self):
            return self.getTypedRuleContext(PartiQLParser.EdgeSpecContext,0)

        def ANGLE_RIGHT(self):
            return self.getToken(PartiQLParser.ANGLE_RIGHT, 0)

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

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

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


    class EdgeSpecRightContext(EdgeWSpecContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.EdgeWSpecContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def MINUS(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.MINUS)
            else:
                return self.getToken(PartiQLParser.MINUS, i)
        def edgeSpec(self):
            return self.getTypedRuleContext(PartiQLParser.EdgeSpecContext,0)

        def ANGLE_RIGHT(self):
            return self.getToken(PartiQLParser.ANGLE_RIGHT, 0)

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

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

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


    class EdgeSpecUndirectedBidirectionalContext(EdgeWSpecContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.EdgeWSpecContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def MINUS(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.MINUS)
            else:
                return self.getToken(PartiQLParser.MINUS, i)
        def edgeSpec(self):
            return self.getTypedRuleContext(PartiQLParser.EdgeSpecContext,0)


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

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

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


    class EdgeSpecUndirectedContext(EdgeWSpecContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.EdgeWSpecContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def TILDE(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.TILDE)
            else:
                return self.getToken(PartiQLParser.TILDE, i)
        def edgeSpec(self):
            return self.getTypedRuleContext(PartiQLParser.EdgeSpecContext,0)


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

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

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


    class EdgeSpecUndirectedRightContext(EdgeWSpecContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.EdgeWSpecContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def TILDE(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.TILDE)
            else:
                return self.getToken(PartiQLParser.TILDE, i)
        def edgeSpec(self):
            return self.getTypedRuleContext(PartiQLParser.EdgeSpecContext,0)

        def ANGLE_RIGHT(self):
            return self.getToken(PartiQLParser.ANGLE_RIGHT, 0)

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

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

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



    def edgeWSpec(self):

        localctx = PartiQLParser.EdgeWSpecContext(self, self._ctx, self.state)
        self.enterRule(localctx, 160, self.RULE_edgeWSpec)
        try:
            self.state = 1008
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,109,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.EdgeSpecRightContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 974
                self.match(PartiQLParser.MINUS)
                self.state = 975
                self.edgeSpec()
                self.state = 976
                self.match(PartiQLParser.MINUS)
                self.state = 977
                self.match(PartiQLParser.ANGLE_RIGHT)
                pass

            elif la_ == 2:
                localctx = PartiQLParser.EdgeSpecUndirectedContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 979
                self.match(PartiQLParser.TILDE)
                self.state = 980
                self.edgeSpec()
                self.state = 981
                self.match(PartiQLParser.TILDE)
                pass

            elif la_ == 3:
                localctx = PartiQLParser.EdgeSpecLeftContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 983
                self.match(PartiQLParser.ANGLE_LEFT)
                self.state = 984
                self.match(PartiQLParser.MINUS)
                self.state = 985
                self.edgeSpec()
                self.state = 986
                self.match(PartiQLParser.MINUS)
                pass

            elif la_ == 4:
                localctx = PartiQLParser.EdgeSpecUndirectedRightContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 988
                self.match(PartiQLParser.TILDE)
                self.state = 989
                self.edgeSpec()
                self.state = 990
                self.match(PartiQLParser.TILDE)
                self.state = 991
                self.match(PartiQLParser.ANGLE_RIGHT)
                pass

            elif la_ == 5:
                localctx = PartiQLParser.EdgeSpecUndirectedLeftContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 993
                self.match(PartiQLParser.ANGLE_LEFT)
                self.state = 994
                self.match(PartiQLParser.TILDE)
                self.state = 995
                self.edgeSpec()
                self.state = 996
                self.match(PartiQLParser.TILDE)
                pass

            elif la_ == 6:
                localctx = PartiQLParser.EdgeSpecBidirectionalContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 998
                self.match(PartiQLParser.ANGLE_LEFT)
                self.state = 999
                self.match(PartiQLParser.MINUS)
                self.state = 1000
                self.edgeSpec()
                self.state = 1001
                self.match(PartiQLParser.MINUS)
                self.state = 1002
                self.match(PartiQLParser.ANGLE_RIGHT)
                pass

            elif la_ == 7:
                localctx = PartiQLParser.EdgeSpecUndirectedBidirectionalContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 1004
                self.match(PartiQLParser.MINUS)
                self.state = 1005
                self.edgeSpec()
                self.state = 1006
                self.match(PartiQLParser.MINUS)
                pass


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


    class EdgeSpecContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def BRACKET_LEFT(self):
            return self.getToken(PartiQLParser.BRACKET_LEFT, 0)

        def BRACKET_RIGHT(self):
            return self.getToken(PartiQLParser.BRACKET_RIGHT, 0)

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def COLON(self):
            return self.getToken(PartiQLParser.COLON, 0)

        def labelSpec(self):
            return self.getTypedRuleContext(PartiQLParser.LabelSpecContext,0)


        def whereClause(self):
            return self.getTypedRuleContext(PartiQLParser.WhereClauseContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_edgeSpec

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

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

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




    def edgeSpec(self):

        localctx = PartiQLParser.EdgeSpecContext(self, self._ctx, self.state)
        self.enterRule(localctx, 162, self.RULE_edgeSpec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1010
            self.match(PartiQLParser.BRACKET_LEFT)
            self.state = 1012
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==303 or _la==304:
                self.state = 1011
                self.symbolPrimitive()


            self.state = 1016
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==296:
                self.state = 1014
                self.match(PartiQLParser.COLON)
                self.state = 1015
                self.labelSpec(0)


            self.state = 1019
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==225:
                self.state = 1018
                self.whereClause()


            self.state = 1021
            self.match(PartiQLParser.BRACKET_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LabelSpecContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_labelSpec

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class LabelSpecTermContext(LabelSpecContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LabelSpecContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def labelTerm(self):
            return self.getTypedRuleContext(PartiQLParser.LabelTermContext,0)


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

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

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


    class LabelSpecOrContext(LabelSpecContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LabelSpecContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def labelSpec(self):
            return self.getTypedRuleContext(PartiQLParser.LabelSpecContext,0)

        def VERTBAR(self):
            return self.getToken(PartiQLParser.VERTBAR, 0)
        def labelTerm(self):
            return self.getTypedRuleContext(PartiQLParser.LabelTermContext,0)


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

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

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



    def labelSpec(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = PartiQLParser.LabelSpecContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 164
        self.enterRecursionRule(localctx, 164, self.RULE_labelSpec, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = PartiQLParser.LabelSpecTermContext(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 1024
            self.labelTerm(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 1031
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,113,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = PartiQLParser.LabelSpecOrContext(self, PartiQLParser.LabelSpecContext(self, _parentctx, _parentState))
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_labelSpec)
                    self.state = 1026
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1027
                    self.match(PartiQLParser.VERTBAR)
                    self.state = 1028
                    self.labelTerm(0) 
                self.state = 1033
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,113,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 LabelTermContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_labelTerm

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class LabelTermFactorContext(LabelTermContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LabelTermContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def labelFactor(self):
            return self.getTypedRuleContext(PartiQLParser.LabelFactorContext,0)


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

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

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


    class LabelTermAndContext(LabelTermContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LabelTermContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def labelTerm(self):
            return self.getTypedRuleContext(PartiQLParser.LabelTermContext,0)

        def AMPERSAND(self):
            return self.getToken(PartiQLParser.AMPERSAND, 0)
        def labelFactor(self):
            return self.getTypedRuleContext(PartiQLParser.LabelFactorContext,0)


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

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

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



    def labelTerm(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = PartiQLParser.LabelTermContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 166
        self.enterRecursionRule(localctx, 166, self.RULE_labelTerm, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = PartiQLParser.LabelTermFactorContext(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 1035
            self.labelFactor()
            self._ctx.stop = self._input.LT(-1)
            self.state = 1042
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,114,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = PartiQLParser.LabelTermAndContext(self, PartiQLParser.LabelTermContext(self, _parentctx, _parentState))
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_labelTerm)
                    self.state = 1037
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1038
                    self.match(PartiQLParser.AMPERSAND)
                    self.state = 1039
                    self.labelFactor() 
                self.state = 1044
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,114,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 LabelFactorContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_labelFactor

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class LabelFactorPrimaryContext(LabelFactorContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LabelFactorContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def labelPrimary(self):
            return self.getTypedRuleContext(PartiQLParser.LabelPrimaryContext,0)


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

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

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


    class LabelFactorNotContext(LabelFactorContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LabelFactorContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def BANG(self):
            return self.getToken(PartiQLParser.BANG, 0)
        def labelPrimary(self):
            return self.getTypedRuleContext(PartiQLParser.LabelPrimaryContext,0)


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

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

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



    def labelFactor(self):

        localctx = PartiQLParser.LabelFactorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 168, self.RULE_labelFactor)
        try:
            self.state = 1048
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [280]:
                localctx = PartiQLParser.LabelFactorNotContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1045
                self.match(PartiQLParser.BANG)
                self.state = 1046
                self.labelPrimary()
                pass
            elif token in [274, 294, 303, 304]:
                localctx = PartiQLParser.LabelFactorPrimaryContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1047
                self.labelPrimary()
                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 LabelPrimaryContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_labelPrimary

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class LabelPrimaryParenContext(LabelPrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LabelPrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def labelSpec(self):
            return self.getTypedRuleContext(PartiQLParser.LabelSpecContext,0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

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

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


    class LabelPrimaryNameContext(LabelPrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LabelPrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


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

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

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


    class LabelPrimaryWildContext(LabelPrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LabelPrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PERCENT(self):
            return self.getToken(PartiQLParser.PERCENT, 0)

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

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

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



    def labelPrimary(self):

        localctx = PartiQLParser.LabelPrimaryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 170, self.RULE_labelPrimary)
        try:
            self.state = 1056
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [303, 304]:
                localctx = PartiQLParser.LabelPrimaryNameContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1050
                self.symbolPrimitive()
                pass
            elif token in [274]:
                localctx = PartiQLParser.LabelPrimaryWildContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1051
                self.match(PartiQLParser.PERCENT)
                pass
            elif token in [294]:
                localctx = PartiQLParser.LabelPrimaryParenContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1052
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1053
                self.labelSpec(0)
                self.state = 1054
                self.match(PartiQLParser.PAREN_RIGHT)
                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 EdgeAbbrevContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def TILDE(self):
            return self.getToken(PartiQLParser.TILDE, 0)

        def ANGLE_RIGHT(self):
            return self.getToken(PartiQLParser.ANGLE_RIGHT, 0)

        def ANGLE_LEFT(self):
            return self.getToken(PartiQLParser.ANGLE_LEFT, 0)

        def MINUS(self):
            return self.getToken(PartiQLParser.MINUS, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_edgeAbbrev

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

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

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




    def edgeAbbrev(self):

        localctx = PartiQLParser.EdgeAbbrevContext(self, self._ctx, self.state)
        self.enterRule(localctx, 172, self.RULE_edgeAbbrev)
        self._la = 0 # Token type
        try:
            self.state = 1070
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,119,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 1058
                self.match(PartiQLParser.TILDE)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 1059
                self.match(PartiQLParser.TILDE)
                self.state = 1060
                self.match(PartiQLParser.ANGLE_RIGHT)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 1061
                self.match(PartiQLParser.ANGLE_LEFT)
                self.state = 1062
                self.match(PartiQLParser.TILDE)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 1064
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==286:
                    self.state = 1063
                    self.match(PartiQLParser.ANGLE_LEFT)


                self.state = 1066
                self.match(PartiQLParser.MINUS)
                self.state = 1068
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,118,self._ctx)
                if la_ == 1:
                    self.state = 1067
                    self.match(PartiQLParser.ANGLE_RIGHT)


                pass


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


    class TableReferenceContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_tableReference

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class TableWrappedContext(TableReferenceContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TableReferenceContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def tableReference(self):
            return self.getTypedRuleContext(PartiQLParser.TableReferenceContext,0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

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

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


    class TableCrossJoinContext(TableReferenceContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TableReferenceContext
            super().__init__(parser)
            self.lhs = None # TableReferenceContext
            self.rhs = None # JoinRhsContext
            self.copyFrom(ctx)

        def CROSS(self):
            return self.getToken(PartiQLParser.CROSS, 0)
        def JOIN(self):
            return self.getToken(PartiQLParser.JOIN, 0)
        def tableReference(self):
            return self.getTypedRuleContext(PartiQLParser.TableReferenceContext,0)

        def joinRhs(self):
            return self.getTypedRuleContext(PartiQLParser.JoinRhsContext,0)

        def joinType(self):
            return self.getTypedRuleContext(PartiQLParser.JoinTypeContext,0)

        def COMMA(self):
            return self.getToken(PartiQLParser.COMMA, 0)

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

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

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


    class TableQualifiedJoinContext(TableReferenceContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TableReferenceContext
            super().__init__(parser)
            self.lhs = None # TableReferenceContext
            self.rhs = None # JoinRhsContext
            self.copyFrom(ctx)

        def JOIN(self):
            return self.getToken(PartiQLParser.JOIN, 0)
        def joinSpec(self):
            return self.getTypedRuleContext(PartiQLParser.JoinSpecContext,0)

        def tableReference(self):
            return self.getTypedRuleContext(PartiQLParser.TableReferenceContext,0)

        def joinRhs(self):
            return self.getTypedRuleContext(PartiQLParser.JoinRhsContext,0)

        def joinType(self):
            return self.getTypedRuleContext(PartiQLParser.JoinTypeContext,0)


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

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

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


    class TableRefBaseContext(TableReferenceContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TableReferenceContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def tableNonJoin(self):
            return self.getTypedRuleContext(PartiQLParser.TableNonJoinContext,0)


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

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

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



    def tableReference(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = PartiQLParser.TableReferenceContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 174
        self.enterRecursionRule(localctx, 174, self.RULE_tableReference, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1078
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,120,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.TableRefBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 1073
                self.tableNonJoin()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.TableWrappedContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1074
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1075
                self.tableReference(0)
                self.state = 1076
                self.match(PartiQLParser.PAREN_RIGHT)
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 1100
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,124,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 = 1098
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,123,self._ctx)
                    if la_ == 1:
                        localctx = PartiQLParser.TableCrossJoinContext(self, PartiQLParser.TableReferenceContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_tableReference)
                        self.state = 1080
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 1082
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if ((((_la - 96)) & ~0x3f) == 0 and ((1 << (_la - 96)) & 144115188612734977) != 0) or _la==176:
                            self.state = 1081
                            self.joinType()


                        self.state = 1084
                        self.match(PartiQLParser.CROSS)
                        self.state = 1085
                        self.match(PartiQLParser.JOIN)
                        self.state = 1086
                        localctx.rhs = self.joinRhs()
                        pass

                    elif la_ == 2:
                        localctx = PartiQLParser.TableCrossJoinContext(self, PartiQLParser.TableReferenceContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_tableReference)
                        self.state = 1087
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 1088
                        self.match(PartiQLParser.COMMA)
                        self.state = 1089
                        localctx.rhs = self.joinRhs()
                        pass

                    elif la_ == 3:
                        localctx = PartiQLParser.TableQualifiedJoinContext(self, PartiQLParser.TableReferenceContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_tableReference)
                        self.state = 1090
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 1092
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if ((((_la - 96)) & ~0x3f) == 0 and ((1 << (_la - 96)) & 144115188612734977) != 0) or _la==176:
                            self.state = 1091
                            self.joinType()


                        self.state = 1094
                        self.match(PartiQLParser.JOIN)
                        self.state = 1095
                        localctx.rhs = self.joinRhs()
                        self.state = 1096
                        self.joinSpec()
                        pass

             
                self.state = 1102
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,124,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 TableNonJoinContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def tableBaseReference(self):
            return self.getTypedRuleContext(PartiQLParser.TableBaseReferenceContext,0)


        def tableUnpivot(self):
            return self.getTypedRuleContext(PartiQLParser.TableUnpivotContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_tableNonJoin

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

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

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




    def tableNonJoin(self):

        localctx = PartiQLParser.TableNonJoinContext(self, self._ctx, self.state)
        self.enterRule(localctx, 176, self.RULE_tableNonJoin)
        try:
            self.state = 1105
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [8, 15, 19, 23, 24, 28, 29, 32, 44, 48, 51, 53, 75, 79, 82, 85, 86, 87, 88, 129, 131, 132, 140, 141, 143, 145, 156, 160, 182, 187, 189, 195, 196, 201, 202, 207, 208, 213, 219, 230, 231, 234, 235, 236, 237, 266, 267, 271, 272, 275, 288, 290, 292, 294, 298, 300, 301, 302, 303, 304, 309]:
                self.enterOuterAlt(localctx, 1)
                self.state = 1103
                self.tableBaseReference()
                pass
            elif token in [238]:
                self.enterOuterAlt(localctx, 2)
                self.state = 1104
                self.tableUnpivot()
                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 TableBaseReferenceContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_tableBaseReference

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class TableBaseRefSymbolContext(TableBaseReferenceContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TableBaseReferenceContext
            super().__init__(parser)
            self.source = None # ExprSelectContext
            self.copyFrom(ctx)

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)

        def exprSelect(self):
            return self.getTypedRuleContext(PartiQLParser.ExprSelectContext,0)


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

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

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


    class TableBaseRefClausesContext(TableBaseReferenceContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TableBaseReferenceContext
            super().__init__(parser)
            self.source = None # ExprSelectContext
            self.copyFrom(ctx)

        def exprSelect(self):
            return self.getTypedRuleContext(PartiQLParser.ExprSelectContext,0)

        def asIdent(self):
            return self.getTypedRuleContext(PartiQLParser.AsIdentContext,0)

        def atIdent(self):
            return self.getTypedRuleContext(PartiQLParser.AtIdentContext,0)

        def byIdent(self):
            return self.getTypedRuleContext(PartiQLParser.ByIdentContext,0)


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

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

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


    class TableBaseRefMatchContext(TableBaseReferenceContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TableBaseReferenceContext
            super().__init__(parser)
            self.source = None # ExprGraphMatchOneContext
            self.copyFrom(ctx)

        def exprGraphMatchOne(self):
            return self.getTypedRuleContext(PartiQLParser.ExprGraphMatchOneContext,0)

        def asIdent(self):
            return self.getTypedRuleContext(PartiQLParser.AsIdentContext,0)

        def atIdent(self):
            return self.getTypedRuleContext(PartiQLParser.AtIdentContext,0)

        def byIdent(self):
            return self.getTypedRuleContext(PartiQLParser.ByIdentContext,0)


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

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

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



    def tableBaseReference(self):

        localctx = PartiQLParser.TableBaseReferenceContext(self, self._ctx, self.state)
        self.enterRule(localctx, 178, self.RULE_tableBaseReference)
        try:
            self.state = 1130
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,132,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.TableBaseRefSymbolContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1107
                localctx.source = self.exprSelect()
                self.state = 1108
                self.symbolPrimitive()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.TableBaseRefClausesContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1110
                localctx.source = self.exprSelect()
                self.state = 1112
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,126,self._ctx)
                if la_ == 1:
                    self.state = 1111
                    self.asIdent()


                self.state = 1115
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,127,self._ctx)
                if la_ == 1:
                    self.state = 1114
                    self.atIdent()


                self.state = 1118
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,128,self._ctx)
                if la_ == 1:
                    self.state = 1117
                    self.byIdent()


                pass

            elif la_ == 3:
                localctx = PartiQLParser.TableBaseRefMatchContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1120
                localctx.source = self.exprGraphMatchOne()
                self.state = 1122
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,129,self._ctx)
                if la_ == 1:
                    self.state = 1121
                    self.asIdent()


                self.state = 1125
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,130,self._ctx)
                if la_ == 1:
                    self.state = 1124
                    self.atIdent()


                self.state = 1128
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,131,self._ctx)
                if la_ == 1:
                    self.state = 1127
                    self.byIdent()


                pass


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


    class TableUnpivotContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def UNPIVOT(self):
            return self.getToken(PartiQLParser.UNPIVOT, 0)

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def asIdent(self):
            return self.getTypedRuleContext(PartiQLParser.AsIdentContext,0)


        def atIdent(self):
            return self.getTypedRuleContext(PartiQLParser.AtIdentContext,0)


        def byIdent(self):
            return self.getTypedRuleContext(PartiQLParser.ByIdentContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_tableUnpivot

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

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

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




    def tableUnpivot(self):

        localctx = PartiQLParser.TableUnpivotContext(self, self._ctx, self.state)
        self.enterRule(localctx, 180, self.RULE_tableUnpivot)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1132
            self.match(PartiQLParser.UNPIVOT)
            self.state = 1133
            self.expr()
            self.state = 1135
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,133,self._ctx)
            if la_ == 1:
                self.state = 1134
                self.asIdent()


            self.state = 1138
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,134,self._ctx)
            if la_ == 1:
                self.state = 1137
                self.atIdent()


            self.state = 1141
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,135,self._ctx)
            if la_ == 1:
                self.state = 1140
                self.byIdent()


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


    class JoinRhsContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_joinRhs

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class JoinRhsBaseContext(JoinRhsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.JoinRhsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def tableNonJoin(self):
            return self.getTypedRuleContext(PartiQLParser.TableNonJoinContext,0)


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

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

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


    class JoinRhsTableJoinedContext(JoinRhsContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.JoinRhsContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def tableReference(self):
            return self.getTypedRuleContext(PartiQLParser.TableReferenceContext,0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

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

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



    def joinRhs(self):

        localctx = PartiQLParser.JoinRhsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 182, self.RULE_joinRhs)
        try:
            self.state = 1148
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,136,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.JoinRhsBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1143
                self.tableNonJoin()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.JoinRhsTableJoinedContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1144
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1145
                self.tableReference(0)
                self.state = 1146
                self.match(PartiQLParser.PAREN_RIGHT)
                pass


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


    class JoinSpecContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def ON(self):
            return self.getToken(PartiQLParser.ON, 0)

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_joinSpec

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

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

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




    def joinSpec(self):

        localctx = PartiQLParser.JoinSpecContext(self, self._ctx, self.state)
        self.enterRule(localctx, 184, self.RULE_joinSpec)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1150
            self.match(PartiQLParser.ON)
            self.state = 1151
            self.expr()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class JoinTypeContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def INNER(self):
            return self.getToken(PartiQLParser.INNER, 0)

        def LEFT(self):
            return self.getToken(PartiQLParser.LEFT, 0)

        def OUTER(self):
            return self.getToken(PartiQLParser.OUTER, 0)

        def RIGHT(self):
            return self.getToken(PartiQLParser.RIGHT, 0)

        def FULL(self):
            return self.getToken(PartiQLParser.FULL, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_joinType

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

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

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




    def joinType(self):

        localctx = PartiQLParser.JoinTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 186, self.RULE_joinType)
        self._la = 0 # Token type
        try:
            self.state = 1167
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [109]:
                self.enterOuterAlt(localctx, 1)
                self.state = 1153
                localctx.mod = self.match(PartiQLParser.INNER)
                pass
            elif token in [125]:
                self.enterOuterAlt(localctx, 2)
                self.state = 1154
                localctx.mod = self.match(PartiQLParser.LEFT)
                self.state = 1156
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==153:
                    self.state = 1155
                    self.match(PartiQLParser.OUTER)


                pass
            elif token in [176]:
                self.enterOuterAlt(localctx, 3)
                self.state = 1158
                localctx.mod = self.match(PartiQLParser.RIGHT)
                self.state = 1160
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==153:
                    self.state = 1159
                    self.match(PartiQLParser.OUTER)


                pass
            elif token in [96]:
                self.enterOuterAlt(localctx, 4)
                self.state = 1162
                localctx.mod = self.match(PartiQLParser.FULL)
                self.state = 1164
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==153:
                    self.state = 1163
                    self.match(PartiQLParser.OUTER)


                pass
            elif token in [153]:
                self.enterOuterAlt(localctx, 5)
                self.state = 1166
                localctx.mod = self.match(PartiQLParser.OUTER)
                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 ExprContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def exprBagOp(self):
            return self.getTypedRuleContext(PartiQLParser.ExprBagOpContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_expr

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

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

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




    def expr(self):

        localctx = PartiQLParser.ExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 188, self.RULE_expr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1169
            self.exprBagOp(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExprBagOpContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_exprBagOp

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class IntersectContext(ExprBagOpContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprBagOpContext
            super().__init__(parser)
            self.lhs = None # ExprBagOpContext
            self.rhs = None # ExprSelectContext
            self.copyFrom(ctx)

        def INTERSECT(self):
            return self.getToken(PartiQLParser.INTERSECT, 0)
        def exprBagOp(self):
            return self.getTypedRuleContext(PartiQLParser.ExprBagOpContext,0)

        def exprSelect(self):
            return self.getTypedRuleContext(PartiQLParser.ExprSelectContext,0)

        def OUTER(self):
            return self.getToken(PartiQLParser.OUTER, 0)
        def DISTINCT(self):
            return self.getToken(PartiQLParser.DISTINCT, 0)
        def ALL(self):
            return self.getToken(PartiQLParser.ALL, 0)

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

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

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


    class QueryBaseContext(ExprBagOpContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprBagOpContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def exprSelect(self):
            return self.getTypedRuleContext(PartiQLParser.ExprSelectContext,0)


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

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

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


    class ExceptContext(ExprBagOpContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprBagOpContext
            super().__init__(parser)
            self.lhs = None # ExprBagOpContext
            self.rhs = None # ExprSelectContext
            self.copyFrom(ctx)

        def EXCEPT(self):
            return self.getToken(PartiQLParser.EXCEPT, 0)
        def exprBagOp(self):
            return self.getTypedRuleContext(PartiQLParser.ExprBagOpContext,0)

        def exprSelect(self):
            return self.getTypedRuleContext(PartiQLParser.ExprSelectContext,0)

        def OUTER(self):
            return self.getToken(PartiQLParser.OUTER, 0)
        def DISTINCT(self):
            return self.getToken(PartiQLParser.DISTINCT, 0)
        def ALL(self):
            return self.getToken(PartiQLParser.ALL, 0)

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

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

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


    class UnionContext(ExprBagOpContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprBagOpContext
            super().__init__(parser)
            self.lhs = None # ExprBagOpContext
            self.rhs = None # ExprSelectContext
            self.copyFrom(ctx)

        def UNION(self):
            return self.getToken(PartiQLParser.UNION, 0)
        def exprBagOp(self):
            return self.getTypedRuleContext(PartiQLParser.ExprBagOpContext,0)

        def exprSelect(self):
            return self.getTypedRuleContext(PartiQLParser.ExprSelectContext,0)

        def OUTER(self):
            return self.getToken(PartiQLParser.OUTER, 0)
        def DISTINCT(self):
            return self.getToken(PartiQLParser.DISTINCT, 0)
        def ALL(self):
            return self.getToken(PartiQLParser.ALL, 0)

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

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

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



    def exprBagOp(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = PartiQLParser.ExprBagOpContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 190
        self.enterRecursionRule(localctx, 190, self.RULE_exprBagOp, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = PartiQLParser.QueryBaseContext(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 1172
            self.exprSelect()
            self._ctx.stop = self._input.LT(-1)
            self.state = 1203
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,148,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 = 1201
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,147,self._ctx)
                    if la_ == 1:
                        localctx = PartiQLParser.ExceptContext(self, PartiQLParser.ExprBagOpContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exprBagOp)
                        self.state = 1174
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 1176
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==153:
                            self.state = 1175
                            self.match(PartiQLParser.OUTER)


                        self.state = 1178
                        self.match(PartiQLParser.EXCEPT)
                        self.state = 1180
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==4 or _la==67:
                            self.state = 1179
                            _la = self._input.LA(1)
                            if not(_la==4 or _la==67):
                                self._errHandler.recoverInline(self)
                            else:
                                self._errHandler.reportMatch(self)
                                self.consume()


                        self.state = 1182
                        localctx.rhs = self.exprSelect()
                        pass

                    elif la_ == 2:
                        localctx = PartiQLParser.UnionContext(self, PartiQLParser.ExprBagOpContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exprBagOp)
                        self.state = 1183
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 1185
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==153:
                            self.state = 1184
                            self.match(PartiQLParser.OUTER)


                        self.state = 1187
                        self.match(PartiQLParser.UNION)
                        self.state = 1189
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==4 or _la==67:
                            self.state = 1188
                            _la = self._input.LA(1)
                            if not(_la==4 or _la==67):
                                self._errHandler.recoverInline(self)
                            else:
                                self._errHandler.reportMatch(self)
                                self.consume()


                        self.state = 1191
                        localctx.rhs = self.exprSelect()
                        pass

                    elif la_ == 3:
                        localctx = PartiQLParser.IntersectContext(self, PartiQLParser.ExprBagOpContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exprBagOp)
                        self.state = 1192
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 1194
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==153:
                            self.state = 1193
                            self.match(PartiQLParser.OUTER)


                        self.state = 1196
                        self.match(PartiQLParser.INTERSECT)
                        self.state = 1198
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==4 or _la==67:
                            self.state = 1197
                            _la = self._input.LA(1)
                            if not(_la==4 or _la==67):
                                self._errHandler.recoverInline(self)
                            else:
                                self._errHandler.reportMatch(self)
                                self.consume()


                        self.state = 1200
                        localctx.rhs = self.exprSelect()
                        pass

             
                self.state = 1205
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,148,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 ExprSelectContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_exprSelect

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class SfwBaseContext(ExprSelectContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprSelectContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def exprOr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprOrContext,0)


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

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

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


    class SfwQueryContext(ExprSelectContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprSelectContext
            super().__init__(parser)
            self.select = None # SelectClauseContext
            self.exclude = None # ExcludeClauseContext
            self.from_ = None # FromClauseContext
            self.let = None # LetClauseContext
            self.where = None # WhereClauseSelectContext
            self.group = None # GroupClauseContext
            self.having = None # HavingClauseContext
            self.order = None # OrderByClauseContext
            self.limit = None # LimitClauseContext
            self.offset = None # OffsetByClauseContext
            self.copyFrom(ctx)

        def selectClause(self):
            return self.getTypedRuleContext(PartiQLParser.SelectClauseContext,0)

        def fromClause(self):
            return self.getTypedRuleContext(PartiQLParser.FromClauseContext,0)

        def excludeClause(self):
            return self.getTypedRuleContext(PartiQLParser.ExcludeClauseContext,0)

        def letClause(self):
            return self.getTypedRuleContext(PartiQLParser.LetClauseContext,0)

        def whereClauseSelect(self):
            return self.getTypedRuleContext(PartiQLParser.WhereClauseSelectContext,0)

        def groupClause(self):
            return self.getTypedRuleContext(PartiQLParser.GroupClauseContext,0)

        def havingClause(self):
            return self.getTypedRuleContext(PartiQLParser.HavingClauseContext,0)

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

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

        def offsetByClause(self):
            return self.getTypedRuleContext(PartiQLParser.OffsetByClauseContext,0)


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

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

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



    def exprSelect(self):

        localctx = PartiQLParser.ExprSelectContext(self, self._ctx, self.state)
        self.enterRule(localctx, 192, self.RULE_exprSelect)
        self._la = 0 # Token type
        try:
            self.state = 1233
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [182, 237]:
                localctx = PartiQLParser.SfwQueryContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1206
                localctx.select = self.selectClause()
                self.state = 1208
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==78:
                    self.state = 1207
                    localctx.exclude = self.excludeClause()


                self.state = 1210
                localctx.from_ = self.fromClause()
                self.state = 1212
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,150,self._ctx)
                if la_ == 1:
                    self.state = 1211
                    localctx.let = self.letClause()


                self.state = 1215
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,151,self._ctx)
                if la_ == 1:
                    self.state = 1214
                    localctx.where = self.whereClauseSelect()


                self.state = 1218
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,152,self._ctx)
                if la_ == 1:
                    self.state = 1217
                    localctx.group = self.groupClause()


                self.state = 1221
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,153,self._ctx)
                if la_ == 1:
                    self.state = 1220
                    localctx.having = self.havingClause()


                self.state = 1224
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,154,self._ctx)
                if la_ == 1:
                    self.state = 1223
                    localctx.order = self.orderByClause()


                self.state = 1227
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,155,self._ctx)
                if la_ == 1:
                    self.state = 1226
                    localctx.limit = self.limitClause()


                self.state = 1230
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,156,self._ctx)
                if la_ == 1:
                    self.state = 1229
                    localctx.offset = self.offsetByClause()


                pass
            elif token in [8, 15, 19, 23, 24, 28, 29, 32, 44, 48, 51, 53, 75, 79, 82, 85, 86, 87, 88, 129, 131, 132, 140, 141, 143, 145, 156, 160, 187, 189, 195, 196, 201, 202, 207, 208, 213, 219, 230, 231, 234, 235, 236, 266, 267, 271, 272, 275, 288, 290, 292, 294, 298, 300, 301, 302, 303, 304, 309]:
                localctx = PartiQLParser.SfwBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1232
                self.exprOr(0)
                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 ExprOrContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_exprOr

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class OrContext(ExprOrContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprOrContext
            super().__init__(parser)
            self.lhs = None # ExprOrContext
            self.rhs = None # ExprAndContext
            self.copyFrom(ctx)

        def OR(self):
            return self.getToken(PartiQLParser.OR, 0)
        def exprOr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprOrContext,0)

        def exprAnd(self):
            return self.getTypedRuleContext(PartiQLParser.ExprAndContext,0)


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

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

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


    class ExprOrBaseContext(ExprOrContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprOrContext
            super().__init__(parser)
            self.parent_ = None # ExprAndContext
            self.copyFrom(ctx)

        def exprAnd(self):
            return self.getTypedRuleContext(PartiQLParser.ExprAndContext,0)


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

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

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



    def exprOr(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = PartiQLParser.ExprOrContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 194
        self.enterRecursionRule(localctx, 194, self.RULE_exprOr, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = PartiQLParser.ExprOrBaseContext(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 1236
            localctx.parent_ = self.exprAnd(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 1243
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,158,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = PartiQLParser.OrContext(self, PartiQLParser.ExprOrContext(self, _parentctx, _parentState))
                    localctx.lhs = _prevctx
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_exprOr)
                    self.state = 1238
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1239
                    self.match(PartiQLParser.OR)
                    self.state = 1240
                    localctx.rhs = self.exprAnd(0) 
                self.state = 1245
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,158,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 ExprAndContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_exprAnd

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class ExprAndBaseContext(ExprAndContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprAndContext
            super().__init__(parser)
            self.parent_ = None # ExprNotContext
            self.copyFrom(ctx)

        def exprNot(self):
            return self.getTypedRuleContext(PartiQLParser.ExprNotContext,0)


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

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

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


    class AndContext(ExprAndContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprAndContext
            super().__init__(parser)
            self.lhs = None # ExprAndContext
            self.op = None # Token
            self.rhs = None # ExprNotContext
            self.copyFrom(ctx)

        def exprAnd(self):
            return self.getTypedRuleContext(PartiQLParser.ExprAndContext,0)

        def AND(self):
            return self.getToken(PartiQLParser.AND, 0)
        def exprNot(self):
            return self.getTypedRuleContext(PartiQLParser.ExprNotContext,0)


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

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

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



    def exprAnd(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = PartiQLParser.ExprAndContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 196
        self.enterRecursionRule(localctx, 196, self.RULE_exprAnd, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = PartiQLParser.ExprAndBaseContext(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 1247
            localctx.parent_ = self.exprNot()
            self._ctx.stop = self._input.LT(-1)
            self.state = 1254
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,159,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = PartiQLParser.AndContext(self, PartiQLParser.ExprAndContext(self, _parentctx, _parentState))
                    localctx.lhs = _prevctx
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_exprAnd)
                    self.state = 1249
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1250
                    localctx.op = self.match(PartiQLParser.AND)
                    self.state = 1251
                    localctx.rhs = self.exprNot() 
                self.state = 1256
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,159,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 ExprNotContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_exprNot

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class NotContext(ExprNotContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprNotContext
            super().__init__(parser)
            self.op = None # Token
            self.rhs = None # ExprNotContext
            self.copyFrom(ctx)

        def NOT(self):
            return self.getToken(PartiQLParser.NOT, 0)
        def exprNot(self):
            return self.getTypedRuleContext(PartiQLParser.ExprNotContext,0)


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

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

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


    class ExprNotBaseContext(ExprNotContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprNotContext
            super().__init__(parser)
            self.parent_ = None # ExprPredicateContext
            self.copyFrom(ctx)

        def exprPredicate(self):
            return self.getTypedRuleContext(PartiQLParser.ExprPredicateContext,0)


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

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

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



    def exprNot(self):

        localctx = PartiQLParser.ExprNotContext(self, self._ctx, self.state)
        self.enterRule(localctx, 198, self.RULE_exprNot)
        try:
            self.state = 1260
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [140]:
                localctx = PartiQLParser.NotContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1257
                localctx.op = self.match(PartiQLParser.NOT)
                self.state = 1258
                localctx.rhs = self.exprNot()
                pass
            elif token in [8, 15, 19, 23, 24, 28, 29, 32, 44, 48, 51, 53, 75, 79, 82, 85, 86, 87, 88, 129, 131, 132, 141, 143, 145, 156, 160, 187, 189, 195, 196, 201, 202, 207, 208, 213, 219, 230, 231, 234, 235, 236, 266, 267, 271, 272, 275, 288, 290, 292, 294, 298, 300, 301, 302, 303, 304, 309]:
                localctx = PartiQLParser.ExprNotBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1259
                localctx.parent_ = self.exprPredicate(0)
                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 ExprPredicateContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_exprPredicate

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class PredicateInContext(ExprPredicateContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprPredicateContext
            super().__init__(parser)
            self.lhs = None # ExprPredicateContext
            self.rhs = None # MathOp00Context
            self.copyFrom(ctx)

        def IN(self):
            return self.getToken(PartiQLParser.IN, 0)
        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)
        def exprPredicate(self):
            return self.getTypedRuleContext(PartiQLParser.ExprPredicateContext,0)

        def NOT(self):
            return self.getToken(PartiQLParser.NOT, 0)
        def mathOp00(self):
            return self.getTypedRuleContext(PartiQLParser.MathOp00Context,0)


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

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

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


    class PredicateBetweenContext(ExprPredicateContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprPredicateContext
            super().__init__(parser)
            self.lhs = None # ExprPredicateContext
            self.lower = None # MathOp00Context
            self.upper = None # MathOp00Context
            self.copyFrom(ctx)

        def BETWEEN(self):
            return self.getToken(PartiQLParser.BETWEEN, 0)
        def AND(self):
            return self.getToken(PartiQLParser.AND, 0)
        def exprPredicate(self):
            return self.getTypedRuleContext(PartiQLParser.ExprPredicateContext,0)

        def mathOp00(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.MathOp00Context)
            else:
                return self.getTypedRuleContext(PartiQLParser.MathOp00Context,i)

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

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

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

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


    class PredicateBaseContext(ExprPredicateContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprPredicateContext
            super().__init__(parser)
            self.parent_ = None # MathOp00Context
            self.copyFrom(ctx)

        def mathOp00(self):
            return self.getTypedRuleContext(PartiQLParser.MathOp00Context,0)


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

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

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


    class PredicateComparisonContext(ExprPredicateContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprPredicateContext
            super().__init__(parser)
            self.lhs = None # ExprPredicateContext
            self.op = None # Token
            self.rhs = None # MathOp00Context
            self.copyFrom(ctx)

        def exprPredicate(self):
            return self.getTypedRuleContext(PartiQLParser.ExprPredicateContext,0)

        def mathOp00(self):
            return self.getTypedRuleContext(PartiQLParser.MathOp00Context,0)

        def LT_EQ(self):
            return self.getToken(PartiQLParser.LT_EQ, 0)
        def GT_EQ(self):
            return self.getToken(PartiQLParser.GT_EQ, 0)
        def ANGLE_LEFT(self):
            return self.getToken(PartiQLParser.ANGLE_LEFT, 0)
        def ANGLE_RIGHT(self):
            return self.getToken(PartiQLParser.ANGLE_RIGHT, 0)
        def NEQ(self):
            return self.getToken(PartiQLParser.NEQ, 0)
        def EQ(self):
            return self.getToken(PartiQLParser.EQ, 0)

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

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

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


    class PredicateIsContext(ExprPredicateContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprPredicateContext
            super().__init__(parser)
            self.lhs = None # ExprPredicateContext
            self.copyFrom(ctx)

        def IS(self):
            return self.getToken(PartiQLParser.IS, 0)
        def type_(self):
            return self.getTypedRuleContext(PartiQLParser.TypeContext,0)

        def exprPredicate(self):
            return self.getTypedRuleContext(PartiQLParser.ExprPredicateContext,0)

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

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

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

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


    class PredicateLikeContext(ExprPredicateContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprPredicateContext
            super().__init__(parser)
            self.lhs = None # ExprPredicateContext
            self.rhs = None # MathOp00Context
            self.escape = None # ExprContext
            self.copyFrom(ctx)

        def LIKE(self):
            return self.getToken(PartiQLParser.LIKE, 0)
        def exprPredicate(self):
            return self.getTypedRuleContext(PartiQLParser.ExprPredicateContext,0)

        def mathOp00(self):
            return self.getTypedRuleContext(PartiQLParser.MathOp00Context,0)

        def NOT(self):
            return self.getToken(PartiQLParser.NOT, 0)
        def ESCAPE(self):
            return self.getToken(PartiQLParser.ESCAPE, 0)
        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


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

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

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



    def exprPredicate(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = PartiQLParser.ExprPredicateContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 200
        self.enterRecursionRule(localctx, 200, self.RULE_exprPredicate, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = PartiQLParser.PredicateBaseContext(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 1263
            localctx.parent_ = self.mathOp00(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 1310
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,168,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 = 1308
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,167,self._ctx)
                    if la_ == 1:
                        localctx = PartiQLParser.PredicateComparisonContext(self, PartiQLParser.ExprPredicateContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exprPredicate)
                        self.state = 1265
                        if not self.precpred(self._ctx, 7):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 7)")
                        self.state = 1266
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(((((_la - 281)) & ~0x3f) == 0 and ((1 << (_la - 281)) & 111) != 0)):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 1267
                        localctx.rhs = self.mathOp00(0)
                        pass

                    elif la_ == 2:
                        localctx = PartiQLParser.PredicateIsContext(self, PartiQLParser.ExprPredicateContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exprPredicate)
                        self.state = 1268
                        if not self.precpred(self._ctx, 6):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
                        self.state = 1269
                        self.match(PartiQLParser.IS)
                        self.state = 1271
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==140:
                            self.state = 1270
                            self.match(PartiQLParser.NOT)


                        self.state = 1273
                        self.type_()
                        pass

                    elif la_ == 3:
                        localctx = PartiQLParser.PredicateInContext(self, PartiQLParser.ExprPredicateContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exprPredicate)
                        self.state = 1274
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 1276
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==140:
                            self.state = 1275
                            self.match(PartiQLParser.NOT)


                        self.state = 1278
                        self.match(PartiQLParser.IN)
                        self.state = 1279
                        self.match(PartiQLParser.PAREN_LEFT)
                        self.state = 1280
                        self.expr()
                        self.state = 1281
                        self.match(PartiQLParser.PAREN_RIGHT)
                        pass

                    elif la_ == 4:
                        localctx = PartiQLParser.PredicateInContext(self, PartiQLParser.ExprPredicateContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exprPredicate)
                        self.state = 1283
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 1285
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==140:
                            self.state = 1284
                            self.match(PartiQLParser.NOT)


                        self.state = 1287
                        self.match(PartiQLParser.IN)
                        self.state = 1288
                        localctx.rhs = self.mathOp00(0)
                        pass

                    elif la_ == 5:
                        localctx = PartiQLParser.PredicateLikeContext(self, PartiQLParser.ExprPredicateContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exprPredicate)
                        self.state = 1289
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 1291
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==140:
                            self.state = 1290
                            self.match(PartiQLParser.NOT)


                        self.state = 1293
                        self.match(PartiQLParser.LIKE)
                        self.state = 1294
                        localctx.rhs = self.mathOp00(0)
                        self.state = 1297
                        self._errHandler.sync(self)
                        la_ = self._interp.adaptivePredict(self._input,165,self._ctx)
                        if la_ == 1:
                            self.state = 1295
                            self.match(PartiQLParser.ESCAPE)
                            self.state = 1296
                            localctx.escape = self.expr()


                        pass

                    elif la_ == 6:
                        localctx = PartiQLParser.PredicateBetweenContext(self, PartiQLParser.ExprPredicateContext(self, _parentctx, _parentState))
                        localctx.lhs = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_exprPredicate)
                        self.state = 1299
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 1301
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==140:
                            self.state = 1300
                            self.match(PartiQLParser.NOT)


                        self.state = 1303
                        self.match(PartiQLParser.BETWEEN)
                        self.state = 1304
                        localctx.lower = self.mathOp00(0)
                        self.state = 1305
                        self.match(PartiQLParser.AND)
                        self.state = 1306
                        localctx.upper = self.mathOp00(0)
                        pass

             
                self.state = 1312
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,168,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 MathOp00Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.lhs = None # MathOp00Context
            self.parent_ = None # MathOp01Context
            self.op = None # Token
            self.rhs = None # MathOp01Context

        def mathOp01(self):
            return self.getTypedRuleContext(PartiQLParser.MathOp01Context,0)


        def mathOp00(self):
            return self.getTypedRuleContext(PartiQLParser.MathOp00Context,0)


        def AMPERSAND(self):
            return self.getToken(PartiQLParser.AMPERSAND, 0)

        def CONCAT(self):
            return self.getToken(PartiQLParser.CONCAT, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_mathOp00

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

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

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



    def mathOp00(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = PartiQLParser.MathOp00Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 202
        self.enterRecursionRule(localctx, 202, self.RULE_mathOp00, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1314
            localctx.parent_ = self.mathOp01(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 1321
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,169,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = PartiQLParser.MathOp00Context(self, _parentctx, _parentState)
                    localctx.lhs = _prevctx
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_mathOp00)
                    self.state = 1316
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1317
                    localctx.op = self._input.LT(1)
                    _la = self._input.LA(1)
                    if not(_la==279 or _la==285):
                        localctx.op = self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 1318
                    localctx.rhs = self.mathOp01(0) 
                self.state = 1323
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,169,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 MathOp01Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.lhs = None # MathOp01Context
            self.parent_ = None # MathOp02Context
            self.op = None # Token
            self.rhs = None # MathOp02Context

        def mathOp02(self):
            return self.getTypedRuleContext(PartiQLParser.MathOp02Context,0)


        def mathOp01(self):
            return self.getTypedRuleContext(PartiQLParser.MathOp01Context,0)


        def PLUS(self):
            return self.getToken(PartiQLParser.PLUS, 0)

        def MINUS(self):
            return self.getToken(PartiQLParser.MINUS, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_mathOp01

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

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

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



    def mathOp01(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = PartiQLParser.MathOp01Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 204
        self.enterRecursionRule(localctx, 204, self.RULE_mathOp01, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1325
            localctx.parent_ = self.mathOp02(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 1332
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,170,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = PartiQLParser.MathOp01Context(self, _parentctx, _parentState)
                    localctx.lhs = _prevctx
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_mathOp01)
                    self.state = 1327
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1328
                    localctx.op = self._input.LT(1)
                    _la = self._input.LA(1)
                    if not(_la==271 or _la==272):
                        localctx.op = self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 1329
                    localctx.rhs = self.mathOp02(0) 
                self.state = 1334
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,170,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 MathOp02Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.lhs = None # MathOp02Context
            self.parent_ = None # ValueExprContext
            self.op = None # Token
            self.rhs = None # ValueExprContext

        def valueExpr(self):
            return self.getTypedRuleContext(PartiQLParser.ValueExprContext,0)


        def mathOp02(self):
            return self.getTypedRuleContext(PartiQLParser.MathOp02Context,0)


        def PERCENT(self):
            return self.getToken(PartiQLParser.PERCENT, 0)

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

        def SLASH_FORWARD(self):
            return self.getToken(PartiQLParser.SLASH_FORWARD, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_mathOp02

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

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

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



    def mathOp02(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = PartiQLParser.MathOp02Context(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 206
        self.enterRecursionRule(localctx, 206, self.RULE_mathOp02, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1336
            localctx.parent_ = self.valueExpr()
            self._ctx.stop = self._input.LT(-1)
            self.state = 1343
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,171,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = PartiQLParser.MathOp02Context(self, _parentctx, _parentState)
                    localctx.lhs = _prevctx
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_mathOp02)
                    self.state = 1338
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1339
                    localctx.op = self._input.LT(1)
                    _la = self._input.LA(1)
                    if not(((((_la - 273)) & ~0x3f) == 0 and ((1 << (_la - 273)) & 19) != 0)):
                        localctx.op = self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 1340
                    localctx.rhs = self.valueExpr() 
                self.state = 1345
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,171,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 ValueExprContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.sign = None # Token
            self.rhs = None # ValueExprContext
            self.parent_ = None # ExprPrimaryContext

        def valueExpr(self):
            return self.getTypedRuleContext(PartiQLParser.ValueExprContext,0)


        def PLUS(self):
            return self.getToken(PartiQLParser.PLUS, 0)

        def MINUS(self):
            return self.getToken(PartiQLParser.MINUS, 0)

        def exprPrimary(self):
            return self.getTypedRuleContext(PartiQLParser.ExprPrimaryContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_valueExpr

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

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

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




    def valueExpr(self):

        localctx = PartiQLParser.ValueExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 208, self.RULE_valueExpr)
        self._la = 0 # Token type
        try:
            self.state = 1349
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [271, 272]:
                self.enterOuterAlt(localctx, 1)
                self.state = 1346
                localctx.sign = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==271 or _la==272):
                    localctx.sign = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 1347
                localctx.rhs = self.valueExpr()
                pass
            elif token in [8, 15, 19, 23, 24, 28, 29, 32, 44, 48, 51, 53, 75, 79, 82, 85, 86, 87, 88, 129, 131, 132, 141, 143, 145, 156, 160, 187, 189, 195, 196, 201, 202, 207, 208, 213, 219, 230, 231, 234, 235, 236, 266, 267, 275, 288, 290, 292, 294, 298, 300, 301, 302, 303, 304, 309]:
                self.enterOuterAlt(localctx, 2)
                self.state = 1348
                localctx.parent_ = self.exprPrimary(0)
                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 ExprPrimaryContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_exprPrimary

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class ExprPrimaryPathContext(ExprPrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprPrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def exprPrimary(self):
            return self.getTypedRuleContext(PartiQLParser.ExprPrimaryContext,0)

        def pathStep(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.PathStepContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.PathStepContext,i)


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

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

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


    class ExprPrimaryBaseContext(ExprPrimaryContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprPrimaryContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def exprTerm(self):
            return self.getTypedRuleContext(PartiQLParser.ExprTermContext,0)

        def cast(self):
            return self.getTypedRuleContext(PartiQLParser.CastContext,0)

        def sequenceConstructor(self):
            return self.getTypedRuleContext(PartiQLParser.SequenceConstructorContext,0)

        def substring(self):
            return self.getTypedRuleContext(PartiQLParser.SubstringContext,0)

        def position(self):
            return self.getTypedRuleContext(PartiQLParser.PositionContext,0)

        def overlay(self):
            return self.getTypedRuleContext(PartiQLParser.OverlayContext,0)

        def canCast(self):
            return self.getTypedRuleContext(PartiQLParser.CanCastContext,0)

        def canLosslessCast(self):
            return self.getTypedRuleContext(PartiQLParser.CanLosslessCastContext,0)

        def extract(self):
            return self.getTypedRuleContext(PartiQLParser.ExtractContext,0)

        def coalesce(self):
            return self.getTypedRuleContext(PartiQLParser.CoalesceContext,0)

        def dateFunction(self):
            return self.getTypedRuleContext(PartiQLParser.DateFunctionContext,0)

        def aggregate(self):
            return self.getTypedRuleContext(PartiQLParser.AggregateContext,0)

        def trimFunction(self):
            return self.getTypedRuleContext(PartiQLParser.TrimFunctionContext,0)

        def functionCall(self):
            return self.getTypedRuleContext(PartiQLParser.FunctionCallContext,0)

        def nullIf(self):
            return self.getTypedRuleContext(PartiQLParser.NullIfContext,0)

        def exprGraphMatchMany(self):
            return self.getTypedRuleContext(PartiQLParser.ExprGraphMatchManyContext,0)

        def caseExpr(self):
            return self.getTypedRuleContext(PartiQLParser.CaseExprContext,0)

        def valueList(self):
            return self.getTypedRuleContext(PartiQLParser.ValueListContext,0)

        def values(self):
            return self.getTypedRuleContext(PartiQLParser.ValuesContext,0)

        def windowFunction(self):
            return self.getTypedRuleContext(PartiQLParser.WindowFunctionContext,0)


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

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

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



    def exprPrimary(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = PartiQLParser.ExprPrimaryContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 210
        self.enterRecursionRule(localctx, 210, self.RULE_exprPrimary, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1372
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,173,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 1352
                self.exprTerm()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1353
                self.cast()
                pass

            elif la_ == 3:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1354
                self.sequenceConstructor()
                pass

            elif la_ == 4:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1355
                self.substring()
                pass

            elif la_ == 5:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1356
                self.position()
                pass

            elif la_ == 6:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1357
                self.overlay()
                pass

            elif la_ == 7:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1358
                self.canCast()
                pass

            elif la_ == 8:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1359
                self.canLosslessCast()
                pass

            elif la_ == 9:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1360
                self.extract()
                pass

            elif la_ == 10:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1361
                self.coalesce()
                pass

            elif la_ == 11:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1362
                self.dateFunction()
                pass

            elif la_ == 12:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1363
                self.aggregate()
                pass

            elif la_ == 13:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1364
                self.trimFunction()
                pass

            elif la_ == 14:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1365
                self.functionCall()
                pass

            elif la_ == 15:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1366
                self.nullIf()
                pass

            elif la_ == 16:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1367
                self.exprGraphMatchMany()
                pass

            elif la_ == 17:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1368
                self.caseExpr()
                pass

            elif la_ == 18:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1369
                self.valueList()
                pass

            elif la_ == 19:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1370
                self.values()
                pass

            elif la_ == 20:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1371
                self.windowFunction()
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 1382
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,175,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = PartiQLParser.ExprPrimaryPathContext(self, PartiQLParser.ExprPrimaryContext(self, _parentctx, _parentState))
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_exprPrimary)
                    self.state = 1374
                    if not self.precpred(self._ctx, 6):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
                    self.state = 1376 
                    self._errHandler.sync(self)
                    _alt = 1
                    while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                        if _alt == 1:
                            self.state = 1375
                            self.pathStep()

                        else:
                            raise NoViableAltException(self)
                        self.state = 1378 
                        self._errHandler.sync(self)
                        _alt = self._interp.adaptivePredict(self._input,174,self._ctx)
             
                self.state = 1384
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,175,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 ExprTermContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_exprTerm

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class ExprTermWrappedQueryContext(ExprTermContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprTermContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

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

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


    class ExprTermBaseContext(ExprTermContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprTermContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def parameter(self):
            return self.getTypedRuleContext(PartiQLParser.ParameterContext,0)

        def varRefExpr(self):
            return self.getTypedRuleContext(PartiQLParser.VarRefExprContext,0)

        def literal(self):
            return self.getTypedRuleContext(PartiQLParser.LiteralContext,0)

        def collection(self):
            return self.getTypedRuleContext(PartiQLParser.CollectionContext,0)

        def tuple_(self):
            return self.getTypedRuleContext(PartiQLParser.TupleContext,0)


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

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

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


    class ExprTermCurrentUserContext(ExprTermContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprTermContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def CURRENT_USER(self):
            return self.getToken(PartiQLParser.CURRENT_USER, 0)

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

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

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


    class ExprTermCurrentDateContext(ExprTermContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.ExprTermContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def CURRENT_DATE(self):
            return self.getToken(PartiQLParser.CURRENT_DATE, 0)

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

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

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



    def exprTerm(self):

        localctx = PartiQLParser.ExprTermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 212, self.RULE_exprTerm)
        try:
            self.state = 1396
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [294]:
                localctx = PartiQLParser.ExprTermWrappedQueryContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1385
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1386
                self.expr()
                self.state = 1387
                self.match(PartiQLParser.PAREN_RIGHT)
                pass
            elif token in [51]:
                localctx = PartiQLParser.ExprTermCurrentUserContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1389
                self.match(PartiQLParser.CURRENT_USER)
                pass
            elif token in [48]:
                localctx = PartiQLParser.ExprTermCurrentDateContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1390
                self.match(PartiQLParser.CURRENT_DATE)
                pass
            elif token in [298]:
                localctx = PartiQLParser.ExprTermBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 1391
                self.parameter()
                pass
            elif token in [79, 275, 303, 304]:
                localctx = PartiQLParser.ExprTermBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 1392
                self.varRefExpr()
                pass
            elif token in [53, 88, 141, 201, 202, 208, 236, 300, 301, 302, 309]:
                localctx = PartiQLParser.ExprTermBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 1393
                self.literal()
                pass
            elif token in [288, 290]:
                localctx = PartiQLParser.ExprTermBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 1394
                self.collection()
                pass
            elif token in [292]:
                localctx = PartiQLParser.ExprTermBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 8)
                self.state = 1395
                self.tuple_()
                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 NullIfContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def NULLIF(self):
            return self.getToken(PartiQLParser.NULLIF, 0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def COMMA(self):
            return self.getToken(PartiQLParser.COMMA, 0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_nullIf

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

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

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




    def nullIf(self):

        localctx = PartiQLParser.NullIfContext(self, self._ctx, self.state)
        self.enterRule(localctx, 214, self.RULE_nullIf)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1398
            self.match(PartiQLParser.NULLIF)
            self.state = 1399
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1400
            self.expr()
            self.state = 1401
            self.match(PartiQLParser.COMMA)
            self.state = 1402
            self.expr()
            self.state = 1403
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CoalesceContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def COALESCE(self):
            return self.getToken(PartiQLParser.COALESCE, 0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

        def getRuleIndex(self):
            return PartiQLParser.RULE_coalesce

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

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

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




    def coalesce(self):

        localctx = PartiQLParser.CoalesceContext(self, self._ctx, self.state)
        self.enterRule(localctx, 216, self.RULE_coalesce)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1405
            self.match(PartiQLParser.COALESCE)
            self.state = 1406
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1407
            self.expr()
            self.state = 1412
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 1408
                self.match(PartiQLParser.COMMA)
                self.state = 1409
                self.expr()
                self.state = 1414
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 1415
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CaseExprContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.case = None # ExprContext
            self._expr = None # ExprContext
            self.whens = list() # of ExprContexts
            self.thens = list() # of ExprContexts
            self.else_ = None # ExprContext

        def CASE(self):
            return self.getToken(PartiQLParser.CASE, 0)

        def END(self):
            return self.getToken(PartiQLParser.END, 0)

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

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

        def ELSE(self):
            return self.getToken(PartiQLParser.ELSE, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def getRuleIndex(self):
            return PartiQLParser.RULE_caseExpr

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

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

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




    def caseExpr(self):

        localctx = PartiQLParser.CaseExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 218, self.RULE_caseExpr)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1417
            self.match(PartiQLParser.CASE)
            self.state = 1419
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 11558071357178112) != 0) or ((((_la - 75)) & ~0x3f) == 0 and ((1 << (_la - 75)) & 234187180623281297) != 0) or ((((_la - 140)) & ~0x3f) == 0 and ((1 << (_la - 140)) & 7026323504187375659) != 0) or ((((_la - 207)) & ~0x3f) == 0 and ((1 << (_la - 207)) & 1729382258948706371) != 0) or ((((_la - 271)) & ~0x3f) == 0 and ((1 << (_la - 271)) & 291666264083) != 0):
                self.state = 1418
                localctx.case = self.expr()


            self.state = 1426 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 1421
                self.match(PartiQLParser.WHEN)
                self.state = 1422
                localctx._expr = self.expr()
                localctx.whens.append(localctx._expr)
                self.state = 1423
                self.match(PartiQLParser.THEN)
                self.state = 1424
                localctx._expr = self.expr()
                localctx.thens.append(localctx._expr)
                self.state = 1428 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==223):
                    break

            self.state = 1432
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==71:
                self.state = 1430
                self.match(PartiQLParser.ELSE)
                self.state = 1431
                localctx.else_ = self.expr()


            self.state = 1434
            self.match(PartiQLParser.END)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValuesContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def VALUES(self):
            return self.getToken(PartiQLParser.VALUES, 0)

        def valueRow(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ValueRowContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ValueRowContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_values

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

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

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




    def values(self):

        localctx = PartiQLParser.ValuesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 220, self.RULE_values)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1436
            self.match(PartiQLParser.VALUES)
            self.state = 1437
            self.valueRow()
            self.state = 1442
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,181,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 1438
                    self.match(PartiQLParser.COMMA)
                    self.state = 1439
                    self.valueRow() 
                self.state = 1444
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,181,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 ValueRowContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

        def getRuleIndex(self):
            return PartiQLParser.RULE_valueRow

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

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

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




    def valueRow(self):

        localctx = PartiQLParser.ValueRowContext(self, self._ctx, self.state)
        self.enterRule(localctx, 222, self.RULE_valueRow)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1445
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1446
            self.expr()
            self.state = 1451
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 1447
                self.match(PartiQLParser.COMMA)
                self.state = 1448
                self.expr()
                self.state = 1453
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 1454
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValueListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

        def getRuleIndex(self):
            return PartiQLParser.RULE_valueList

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

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

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




    def valueList(self):

        localctx = PartiQLParser.ValueListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 224, self.RULE_valueList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1456
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1457
            self.expr()
            self.state = 1460 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 1458
                self.match(PartiQLParser.COMMA)
                self.state = 1459
                self.expr()
                self.state = 1462 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==270):
                    break

            self.state = 1464
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SequenceConstructorContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def LIST(self):
            return self.getToken(PartiQLParser.LIST, 0)

        def SEXP(self):
            return self.getToken(PartiQLParser.SEXP, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_sequenceConstructor

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

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

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




    def sequenceConstructor(self):

        localctx = PartiQLParser.SequenceConstructorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 226, self.RULE_sequenceConstructor)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1466
            localctx.datatype = self._input.LT(1)
            _la = self._input.LA(1)
            if not(_la==266 or _la==267):
                localctx.datatype = self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 1467
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1476
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 11558071357178112) != 0) or ((((_la - 75)) & ~0x3f) == 0 and ((1 << (_la - 75)) & 234187180623281297) != 0) or ((((_la - 140)) & ~0x3f) == 0 and ((1 << (_la - 140)) & 7026323504187375659) != 0) or ((((_la - 207)) & ~0x3f) == 0 and ((1 << (_la - 207)) & 1729382258948706371) != 0) or ((((_la - 271)) & ~0x3f) == 0 and ((1 << (_la - 271)) & 291666264083) != 0):
                self.state = 1468
                self.expr()
                self.state = 1473
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 1469
                    self.match(PartiQLParser.COMMA)
                    self.state = 1470
                    self.expr()
                    self.state = 1475
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 1478
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SubstringContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def SUBSTRING(self):
            return self.getToken(PartiQLParser.SUBSTRING, 0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

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

        def FROM(self):
            return self.getToken(PartiQLParser.FROM, 0)

        def FOR(self):
            return self.getToken(PartiQLParser.FOR, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_substring

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

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

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




    def substring(self):

        localctx = PartiQLParser.SubstringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 228, self.RULE_substring)
        self._la = 0 # Token type
        try:
            self.state = 1506
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,190,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 1480
                self.match(PartiQLParser.SUBSTRING)
                self.state = 1481
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1482
                self.expr()
                self.state = 1489
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==270:
                    self.state = 1483
                    self.match(PartiQLParser.COMMA)
                    self.state = 1484
                    self.expr()
                    self.state = 1487
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==270:
                        self.state = 1485
                        self.match(PartiQLParser.COMMA)
                        self.state = 1486
                        self.expr()




                self.state = 1491
                self.match(PartiQLParser.PAREN_RIGHT)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 1493
                self.match(PartiQLParser.SUBSTRING)
                self.state = 1494
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1495
                self.expr()
                self.state = 1502
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==95:
                    self.state = 1496
                    self.match(PartiQLParser.FROM)
                    self.state = 1497
                    self.expr()
                    self.state = 1500
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==92:
                        self.state = 1498
                        self.match(PartiQLParser.FOR)
                        self.state = 1499
                        self.expr()




                self.state = 1504
                self.match(PartiQLParser.PAREN_RIGHT)
                pass


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


    class PositionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def POSITION(self):
            return self.getToken(PartiQLParser.POSITION, 0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def COMMA(self):
            return self.getToken(PartiQLParser.COMMA, 0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def IN(self):
            return self.getToken(PartiQLParser.IN, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_position

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

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

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




    def position(self):

        localctx = PartiQLParser.PositionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 230, self.RULE_position)
        try:
            self.state = 1522
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,191,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 1508
                self.match(PartiQLParser.POSITION)
                self.state = 1509
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1510
                self.expr()
                self.state = 1511
                self.match(PartiQLParser.COMMA)
                self.state = 1512
                self.expr()
                self.state = 1513
                self.match(PartiQLParser.PAREN_RIGHT)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 1515
                self.match(PartiQLParser.POSITION)
                self.state = 1516
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1517
                self.expr()
                self.state = 1518
                self.match(PartiQLParser.IN)
                self.state = 1519
                self.expr()
                self.state = 1520
                self.match(PartiQLParser.PAREN_RIGHT)
                pass


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


    class OverlayContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def OVERLAY(self):
            return self.getToken(PartiQLParser.OVERLAY, 0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


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

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def PLACING(self):
            return self.getToken(PartiQLParser.PLACING, 0)

        def FROM(self):
            return self.getToken(PartiQLParser.FROM, 0)

        def FOR(self):
            return self.getToken(PartiQLParser.FOR, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_overlay

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

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

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




    def overlay(self):

        localctx = PartiQLParser.OverlayContext(self, self._ctx, self.state)
        self.enterRule(localctx, 232, self.RULE_overlay)
        self._la = 0 # Token type
        try:
            self.state = 1550
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,194,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 1524
                self.match(PartiQLParser.OVERLAY)
                self.state = 1525
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1526
                self.expr()
                self.state = 1527
                self.match(PartiQLParser.COMMA)
                self.state = 1528
                self.expr()
                self.state = 1529
                self.match(PartiQLParser.COMMA)
                self.state = 1530
                self.expr()
                self.state = 1533
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==270:
                    self.state = 1531
                    self.match(PartiQLParser.COMMA)
                    self.state = 1532
                    self.expr()


                self.state = 1535
                self.match(PartiQLParser.PAREN_RIGHT)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 1537
                self.match(PartiQLParser.OVERLAY)
                self.state = 1538
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1539
                self.expr()
                self.state = 1540
                self.match(PartiQLParser.PLACING)
                self.state = 1541
                self.expr()
                self.state = 1542
                self.match(PartiQLParser.FROM)
                self.state = 1543
                self.expr()
                self.state = 1546
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==92:
                    self.state = 1544
                    self.match(PartiQLParser.FOR)
                    self.state = 1545
                    self.expr()


                self.state = 1548
                self.match(PartiQLParser.PAREN_RIGHT)
                pass


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


    class AggregateContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_aggregate

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class AggregateBaseContext(AggregateContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.AggregateContext
            super().__init__(parser)
            self.func = None # Token
            self.copyFrom(ctx)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)
        def COUNT(self):
            return self.getToken(PartiQLParser.COUNT, 0)
        def MAX(self):
            return self.getToken(PartiQLParser.MAX, 0)
        def MIN(self):
            return self.getToken(PartiQLParser.MIN, 0)
        def SUM(self):
            return self.getToken(PartiQLParser.SUM, 0)
        def AVG(self):
            return self.getToken(PartiQLParser.AVG, 0)
        def EVERY(self):
            return self.getToken(PartiQLParser.EVERY, 0)
        def ANY(self):
            return self.getToken(PartiQLParser.ANY, 0)
        def SOME(self):
            return self.getToken(PartiQLParser.SOME, 0)
        def setQuantifierStrategy(self):
            return self.getTypedRuleContext(PartiQLParser.SetQuantifierStrategyContext,0)


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

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

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


    class CountAllContext(AggregateContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.AggregateContext
            super().__init__(parser)
            self.func = None # Token
            self.copyFrom(ctx)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def ASTERISK(self):
            return self.getToken(PartiQLParser.ASTERISK, 0)
        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)
        def COUNT(self):
            return self.getToken(PartiQLParser.COUNT, 0)

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

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

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



    def aggregate(self):

        localctx = PartiQLParser.AggregateContext(self, self._ctx, self.state)
        self.enterRule(localctx, 234, self.RULE_aggregate)
        self._la = 0 # Token type
        try:
            self.state = 1564
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,196,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.CountAllContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1552
                localctx.func = self.match(PartiQLParser.COUNT)
                self.state = 1553
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1554
                self.match(PartiQLParser.ASTERISK)
                self.state = 1555
                self.match(PartiQLParser.PAREN_RIGHT)
                pass

            elif la_ == 2:
                localctx = PartiQLParser.AggregateBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1556
                localctx.func = self._input.LT(1)
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 17592186077440) != 0) or ((((_la - 75)) & ~0x3f) == 0 and ((1 << (_la - 75)) & 216172782113783809) != 0) or _la==189 or _la==196):
                    localctx.func = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 1557
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1559
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==4 or _la==67:
                    self.state = 1558
                    self.setQuantifierStrategy()


                self.state = 1561
                self.expr()
                self.state = 1562
                self.match(PartiQLParser.PAREN_RIGHT)
                pass


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


    class WindowFunctionContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_windowFunction

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class LagLeadFunctionContext(WindowFunctionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.WindowFunctionContext
            super().__init__(parser)
            self.func = None # Token
            self.copyFrom(ctx)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)
        def over(self):
            return self.getTypedRuleContext(PartiQLParser.OverContext,0)

        def LAG(self):
            return self.getToken(PartiQLParser.LAG, 0)
        def LEAD(self):
            return self.getToken(PartiQLParser.LEAD, 0)
        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.COMMA)
            else:
                return self.getToken(PartiQLParser.COMMA, i)

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

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

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



    def windowFunction(self):

        localctx = PartiQLParser.WindowFunctionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 236, self.RULE_windowFunction)
        self._la = 0 # Token type
        try:
            localctx = PartiQLParser.LagLeadFunctionContext(self, localctx)
            self.enterOuterAlt(localctx, 1)
            self.state = 1566
            localctx.func = self._input.LT(1)
            _la = self._input.LA(1)
            if not(_la==230 or _la==231):
                localctx.func = self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 1567
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1568
            self.expr()
            self.state = 1575
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==270:
                self.state = 1569
                self.match(PartiQLParser.COMMA)
                self.state = 1570
                self.expr()
                self.state = 1573
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==270:
                    self.state = 1571
                    self.match(PartiQLParser.COMMA)
                    self.state = 1572
                    self.expr()




            self.state = 1577
            self.match(PartiQLParser.PAREN_RIGHT)
            self.state = 1578
            self.over()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CastContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def CAST(self):
            return self.getToken(PartiQLParser.CAST, 0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


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

        def type_(self):
            return self.getTypedRuleContext(PartiQLParser.TypeContext,0)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_cast

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

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

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




    def cast(self):

        localctx = PartiQLParser.CastContext(self, self._ctx, self.state)
        self.enterRule(localctx, 238, self.RULE_cast)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1580
            self.match(PartiQLParser.CAST)
            self.state = 1581
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1582
            self.expr()
            self.state = 1583
            self.match(PartiQLParser.AS)
            self.state = 1584
            self.type_()
            self.state = 1585
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CanLosslessCastContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def CAN_LOSSLESS_CAST(self):
            return self.getToken(PartiQLParser.CAN_LOSSLESS_CAST, 0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


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

        def type_(self):
            return self.getTypedRuleContext(PartiQLParser.TypeContext,0)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_canLosslessCast

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

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

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




    def canLosslessCast(self):

        localctx = PartiQLParser.CanLosslessCastContext(self, self._ctx, self.state)
        self.enterRule(localctx, 240, self.RULE_canLosslessCast)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1587
            self.match(PartiQLParser.CAN_LOSSLESS_CAST)
            self.state = 1588
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1589
            self.expr()
            self.state = 1590
            self.match(PartiQLParser.AS)
            self.state = 1591
            self.type_()
            self.state = 1592
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CanCastContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def CAN_CAST(self):
            return self.getToken(PartiQLParser.CAN_CAST, 0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


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

        def type_(self):
            return self.getTypedRuleContext(PartiQLParser.TypeContext,0)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_canCast

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

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

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




    def canCast(self):

        localctx = PartiQLParser.CanCastContext(self, self._ctx, self.state)
        self.enterRule(localctx, 242, self.RULE_canCast)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1594
            self.match(PartiQLParser.CAN_CAST)
            self.state = 1595
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1596
            self.expr()
            self.state = 1597
            self.match(PartiQLParser.AS)
            self.state = 1598
            self.type_()
            self.state = 1599
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExtractContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def EXTRACT(self):
            return self.getToken(PartiQLParser.EXTRACT, 0)

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def IDENTIFIER(self):
            return self.getToken(PartiQLParser.IDENTIFIER, 0)

        def FROM(self):
            return self.getToken(PartiQLParser.FROM, 0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_extract

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

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

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




    def extract(self):

        localctx = PartiQLParser.ExtractContext(self, self._ctx, self.state)
        self.enterRule(localctx, 244, self.RULE_extract)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1601
            self.match(PartiQLParser.EXTRACT)
            self.state = 1602
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1603
            self.match(PartiQLParser.IDENTIFIER)
            self.state = 1604
            self.match(PartiQLParser.FROM)
            self.state = 1605
            localctx.rhs = self.expr()
            self.state = 1606
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TrimFunctionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.func = None # Token
            self.mod = None # Token
            self.sub = None # ExprContext
            self.target = None # ExprContext

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def TRIM(self):
            return self.getToken(PartiQLParser.TRIM, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def FROM(self):
            return self.getToken(PartiQLParser.FROM, 0)

        def IDENTIFIER(self):
            return self.getToken(PartiQLParser.IDENTIFIER, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_trimFunction

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

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

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




    def trimFunction(self):

        localctx = PartiQLParser.TrimFunctionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 246, self.RULE_trimFunction)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1608
            localctx.func = self.match(PartiQLParser.TRIM)
            self.state = 1609
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1617
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,201,self._ctx)
            if la_ == 1:
                self.state = 1611
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,199,self._ctx)
                if la_ == 1:
                    self.state = 1610
                    localctx.mod = self.match(PartiQLParser.IDENTIFIER)


                self.state = 1614
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & 11558071357178112) != 0) or ((((_la - 75)) & ~0x3f) == 0 and ((1 << (_la - 75)) & 234187180623281297) != 0) or ((((_la - 140)) & ~0x3f) == 0 and ((1 << (_la - 140)) & 7026323504187375659) != 0) or ((((_la - 207)) & ~0x3f) == 0 and ((1 << (_la - 207)) & 1729382258948706371) != 0) or ((((_la - 271)) & ~0x3f) == 0 and ((1 << (_la - 271)) & 291666264083) != 0):
                    self.state = 1613
                    localctx.sub = self.expr()


                self.state = 1616
                self.match(PartiQLParser.FROM)


            self.state = 1619
            localctx.target = self.expr()
            self.state = 1620
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DateFunctionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

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

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def IDENTIFIER(self):
            return self.getToken(PartiQLParser.IDENTIFIER, 0)

        def DATE_ADD(self):
            return self.getToken(PartiQLParser.DATE_ADD, 0)

        def DATE_DIFF(self):
            return self.getToken(PartiQLParser.DATE_DIFF, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_dateFunction

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

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

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




    def dateFunction(self):

        localctx = PartiQLParser.DateFunctionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 248, self.RULE_dateFunction)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1622
            localctx.func = self._input.LT(1)
            _la = self._input.LA(1)
            if not(_la==86 or _la==87):
                localctx.func = self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 1623
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1624
            localctx.dt = self.match(PartiQLParser.IDENTIFIER)
            self.state = 1625
            self.match(PartiQLParser.COMMA)
            self.state = 1626
            self.expr()
            self.state = 1627
            self.match(PartiQLParser.COMMA)
            self.state = 1628
            self.expr()
            self.state = 1629
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FunctionCallContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def functionName(self):
            return self.getTypedRuleContext(PartiQLParser.FunctionNameContext,0)


        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


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

        def getRuleIndex(self):
            return PartiQLParser.RULE_functionCall

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

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

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




    def functionCall(self):

        localctx = PartiQLParser.FunctionCallContext(self, self._ctx, self.state)
        self.enterRule(localctx, 250, self.RULE_functionCall)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1631
            self.functionName()
            self.state = 1632
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1641
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 11558071357178112) != 0) or ((((_la - 75)) & ~0x3f) == 0 and ((1 << (_la - 75)) & 234187180623281297) != 0) or ((((_la - 140)) & ~0x3f) == 0 and ((1 << (_la - 140)) & 7026323504187375659) != 0) or ((((_la - 207)) & ~0x3f) == 0 and ((1 << (_la - 207)) & 1729382258948706371) != 0) or ((((_la - 271)) & ~0x3f) == 0 and ((1 << (_la - 271)) & 291666264083) != 0):
                self.state = 1633
                self.expr()
                self.state = 1638
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 1634
                    self.match(PartiQLParser.COMMA)
                    self.state = 1635
                    self.expr()
                    self.state = 1640
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 1643
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FunctionNameContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_functionName

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class FunctionNameSymbolContext(FunctionNameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.FunctionNameContext
            super().__init__(parser)
            self._symbolPrimitive = None # SymbolPrimitiveContext
            self.qualifier = list() # of SymbolPrimitiveContexts
            self.name = None # SymbolPrimitiveContext
            self.copyFrom(ctx)

        def symbolPrimitive(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.SymbolPrimitiveContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,i)

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

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

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

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


    class FunctionNameReservedContext(FunctionNameContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.FunctionNameContext
            super().__init__(parser)
            self._symbolPrimitive = None # SymbolPrimitiveContext
            self.qualifier = list() # of SymbolPrimitiveContexts
            self.name = None # Token
            self.copyFrom(ctx)

        def CHAR_LENGTH(self):
            return self.getToken(PartiQLParser.CHAR_LENGTH, 0)
        def CHARACTER_LENGTH(self):
            return self.getToken(PartiQLParser.CHARACTER_LENGTH, 0)
        def OCTET_LENGTH(self):
            return self.getToken(PartiQLParser.OCTET_LENGTH, 0)
        def BIT_LENGTH(self):
            return self.getToken(PartiQLParser.BIT_LENGTH, 0)
        def UPPER(self):
            return self.getToken(PartiQLParser.UPPER, 0)
        def LOWER(self):
            return self.getToken(PartiQLParser.LOWER, 0)
        def SIZE(self):
            return self.getToken(PartiQLParser.SIZE, 0)
        def EXISTS(self):
            return self.getToken(PartiQLParser.EXISTS, 0)
        def COUNT(self):
            return self.getToken(PartiQLParser.COUNT, 0)
        def PERIOD(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.PERIOD)
            else:
                return self.getToken(PartiQLParser.PERIOD, i)
        def symbolPrimitive(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.SymbolPrimitiveContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,i)


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

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

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



    def functionName(self):

        localctx = PartiQLParser.FunctionNameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 252, self.RULE_functionName)
        self._la = 0 # Token type
        try:
            self.state = 1663
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,206,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.FunctionNameReservedContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1650
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==303 or _la==304:
                    self.state = 1645
                    localctx._symbolPrimitive = self.symbolPrimitive()
                    localctx.qualifier.append(localctx._symbolPrimitive)
                    self.state = 1646
                    self.match(PartiQLParser.PERIOD)
                    self.state = 1652
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 1653
                localctx.name = self._input.LT(1)
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 17592991875072) != 0) or ((((_la - 82)) & ~0x3f) == 0 and ((1 << (_la - 82)) & -9223231299366420479) != 0) or _la==187 or _la==213):
                    localctx.name = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.FunctionNameSymbolContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1659
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,205,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 1654
                        localctx._symbolPrimitive = self.symbolPrimitive()
                        localctx.qualifier.append(localctx._symbolPrimitive)
                        self.state = 1655
                        self.match(PartiQLParser.PERIOD) 
                    self.state = 1661
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,205,self._ctx)

                self.state = 1662
                localctx.name = self.symbolPrimitive()
                pass


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


    class PathStepContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_pathStep

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class PathStepDotAllContext(PathStepContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.PathStepContext
            super().__init__(parser)
            self.all_ = None # Token
            self.copyFrom(ctx)

        def PERIOD(self):
            return self.getToken(PartiQLParser.PERIOD, 0)
        def ASTERISK(self):
            return self.getToken(PartiQLParser.ASTERISK, 0)

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

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

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


    class PathStepIndexAllContext(PathStepContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.PathStepContext
            super().__init__(parser)
            self.all_ = None # Token
            self.copyFrom(ctx)

        def BRACKET_LEFT(self):
            return self.getToken(PartiQLParser.BRACKET_LEFT, 0)
        def BRACKET_RIGHT(self):
            return self.getToken(PartiQLParser.BRACKET_RIGHT, 0)
        def ASTERISK(self):
            return self.getToken(PartiQLParser.ASTERISK, 0)

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

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

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


    class PathStepIndexExprContext(PathStepContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.PathStepContext
            super().__init__(parser)
            self.key = None # ExprContext
            self.copyFrom(ctx)

        def BRACKET_LEFT(self):
            return self.getToken(PartiQLParser.BRACKET_LEFT, 0)
        def BRACKET_RIGHT(self):
            return self.getToken(PartiQLParser.BRACKET_RIGHT, 0)
        def expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


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

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

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


    class PathStepDotExprContext(PathStepContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.PathStepContext
            super().__init__(parser)
            self.key = None # SymbolPrimitiveContext
            self.copyFrom(ctx)

        def PERIOD(self):
            return self.getToken(PartiQLParser.PERIOD, 0)
        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


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

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

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



    def pathStep(self):

        localctx = PartiQLParser.PathStepContext(self, self._ctx, self.state)
        self.enterRule(localctx, 254, self.RULE_pathStep)
        try:
            self.state = 1676
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,207,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.PathStepIndexExprContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1665
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 1666
                localctx.key = self.expr()
                self.state = 1667
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 2:
                localctx = PartiQLParser.PathStepIndexAllContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1669
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 1670
                localctx.all_ = self.match(PartiQLParser.ASTERISK)
                self.state = 1671
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 3:
                localctx = PartiQLParser.PathStepDotExprContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1672
                self.match(PartiQLParser.PERIOD)
                self.state = 1673
                localctx.key = self.symbolPrimitive()
                pass

            elif la_ == 4:
                localctx = PartiQLParser.PathStepDotAllContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 1674
                self.match(PartiQLParser.PERIOD)
                self.state = 1675
                localctx.all_ = self.match(PartiQLParser.ASTERISK)
                pass


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


    class ExprGraphMatchManyContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)

        def exprPrimary(self):
            return self.getTypedRuleContext(PartiQLParser.ExprPrimaryContext,0)


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

        def gpmlPatternList(self):
            return self.getTypedRuleContext(PartiQLParser.GpmlPatternListContext,0)


        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_exprGraphMatchMany

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

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

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




    def exprGraphMatchMany(self):

        localctx = PartiQLParser.ExprGraphMatchManyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 256, self.RULE_exprGraphMatchMany)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1678
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1679
            self.exprPrimary(0)
            self.state = 1680
            self.match(PartiQLParser.MATCH)
            self.state = 1681
            self.gpmlPatternList()
            self.state = 1682
            self.match(PartiQLParser.PAREN_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExprGraphMatchOneContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def exprPrimary(self):
            return self.getTypedRuleContext(PartiQLParser.ExprPrimaryContext,0)


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

        def gpmlPattern(self):
            return self.getTypedRuleContext(PartiQLParser.GpmlPatternContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_exprGraphMatchOne

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

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

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




    def exprGraphMatchOne(self):

        localctx = PartiQLParser.ExprGraphMatchOneContext(self, self._ctx, self.state)
        self.enterRule(localctx, 258, self.RULE_exprGraphMatchOne)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1684
            self.exprPrimary(0)
            self.state = 1685
            self.match(PartiQLParser.MATCH)
            self.state = 1686
            self.gpmlPattern()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ParameterContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def QUESTION_MARK(self):
            return self.getToken(PartiQLParser.QUESTION_MARK, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_parameter

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

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

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




    def parameter(self):

        localctx = PartiQLParser.ParameterContext(self, self._ctx, self.state)
        self.enterRule(localctx, 260, self.RULE_parameter)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1688
            self.match(PartiQLParser.QUESTION_MARK)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class VarRefExprContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return PartiQLParser.RULE_varRefExpr

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class VariableKeywordContext(VarRefExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.VarRefExprContext
            super().__init__(parser)
            self.qualifier = None # Token
            self.key = None # NonReservedKeywordsContext
            self.copyFrom(ctx)

        def nonReservedKeywords(self):
            return self.getTypedRuleContext(PartiQLParser.NonReservedKeywordsContext,0)

        def AT_SIGN(self):
            return self.getToken(PartiQLParser.AT_SIGN, 0)

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

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

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


    class VariableIdentifierContext(VarRefExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.VarRefExprContext
            super().__init__(parser)
            self.qualifier = None # Token
            self.ident = None # Token
            self.copyFrom(ctx)

        def IDENTIFIER(self):
            return self.getToken(PartiQLParser.IDENTIFIER, 0)
        def IDENTIFIER_QUOTED(self):
            return self.getToken(PartiQLParser.IDENTIFIER_QUOTED, 0)
        def AT_SIGN(self):
            return self.getToken(PartiQLParser.AT_SIGN, 0)

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

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

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



    def varRefExpr(self):

        localctx = PartiQLParser.VarRefExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 262, self.RULE_varRefExpr)
        self._la = 0 # Token type
        try:
            self.state = 1698
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,210,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.VariableIdentifierContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1691
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==275:
                    self.state = 1690
                    localctx.qualifier = self.match(PartiQLParser.AT_SIGN)


                self.state = 1693
                localctx.ident = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==303 or _la==304):
                    localctx.ident = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.VariableKeywordContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1695
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==275:
                    self.state = 1694
                    localctx.qualifier = self.match(PartiQLParser.AT_SIGN)


                self.state = 1697
                localctx.key = self.nonReservedKeywords()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NonReservedKeywordsContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def EXCLUDED(self):
            return self.getToken(PartiQLParser.EXCLUDED, 0)

        def getRuleIndex(self):
            return PartiQLParser.RULE_nonReservedKeywords

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterNonReservedKeywords" ):
                listener.enterNonReservedKeywords(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitNonReservedKeywords" ):
                listener.exitNonReservedKeywords(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitNonReservedKeywords" ):
                return visitor.visitNonReservedKeywords(self)
            else:
                return visitor.visitChildren(self)




    def nonReservedKeywords(self):

        localctx = PartiQLParser.NonReservedKeywordsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 264, self.RULE_nonReservedKeywords)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1700
            self.match(PartiQLParser.EXCLUDED)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CollectionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def array(self):
            return self.getTypedRuleContext(PartiQLParser.ArrayContext,0)


        def bag(self):
            return self.getTypedRuleContext(PartiQLParser.BagContext,0)


        def getRuleIndex(self):
            return PartiQLParser.RULE_collection

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCollection" ):
                listener.enterCollection(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCollection" ):
                listener.exitCollection(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitCollection" ):
                return visitor.visitCollection(self)
            else:
                return visitor.visitChildren(self)




    def collection(self):

        localctx = PartiQLParser.CollectionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 266, self.RULE_collection)
        try:
            self.state = 1704
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [290]:
                self.enterOuterAlt(localctx, 1)
                self.state = 1702
                self.array()
                pass
            elif token in [288]:
                self.enterOuterAlt(localctx, 2)
                self.state = 1703
                self.bag()
                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 ArrayContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def BRACKET_LEFT(self):
            return self.getToken(PartiQLParser.BRACKET_LEFT, 0)

        def BRACKET_RIGHT(self):
            return self.getToken(PartiQLParser.BRACKET_RIGHT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.COMMA)
            else:
                return self.getToken(PartiQLParser.COMMA, i)

        def getRuleIndex(self):
            return PartiQLParser.RULE_array

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArray" ):
                listener.enterArray(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArray" ):
                listener.exitArray(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArray" ):
                return visitor.visitArray(self)
            else:
                return visitor.visitChildren(self)




    def array(self):

        localctx = PartiQLParser.ArrayContext(self, self._ctx, self.state)
        self.enterRule(localctx, 268, self.RULE_array)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1706
            self.match(PartiQLParser.BRACKET_LEFT)
            self.state = 1715
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 11558071357178112) != 0) or ((((_la - 75)) & ~0x3f) == 0 and ((1 << (_la - 75)) & 234187180623281297) != 0) or ((((_la - 140)) & ~0x3f) == 0 and ((1 << (_la - 140)) & 7026323504187375659) != 0) or ((((_la - 207)) & ~0x3f) == 0 and ((1 << (_la - 207)) & 1729382258948706371) != 0) or ((((_la - 271)) & ~0x3f) == 0 and ((1 << (_la - 271)) & 291666264083) != 0):
                self.state = 1707
                self.expr()
                self.state = 1712
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 1708
                    self.match(PartiQLParser.COMMA)
                    self.state = 1709
                    self.expr()
                    self.state = 1714
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 1717
            self.match(PartiQLParser.BRACKET_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BagContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ANGLE_DOUBLE_LEFT(self):
            return self.getToken(PartiQLParser.ANGLE_DOUBLE_LEFT, 0)

        def ANGLE_DOUBLE_RIGHT(self):
            return self.getToken(PartiQLParser.ANGLE_DOUBLE_RIGHT, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.COMMA)
            else:
                return self.getToken(PartiQLParser.COMMA, i)

        def getRuleIndex(self):
            return PartiQLParser.RULE_bag

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBag" ):
                listener.enterBag(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBag" ):
                listener.exitBag(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBag" ):
                return visitor.visitBag(self)
            else:
                return visitor.visitChildren(self)




    def bag(self):

        localctx = PartiQLParser.BagContext(self, self._ctx, self.state)
        self.enterRule(localctx, 270, self.RULE_bag)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1719
            self.match(PartiQLParser.ANGLE_DOUBLE_LEFT)
            self.state = 1728
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 11558071357178112) != 0) or ((((_la - 75)) & ~0x3f) == 0 and ((1 << (_la - 75)) & 234187180623281297) != 0) or ((((_la - 140)) & ~0x3f) == 0 and ((1 << (_la - 140)) & 7026323504187375659) != 0) or ((((_la - 207)) & ~0x3f) == 0 and ((1 << (_la - 207)) & 1729382258948706371) != 0) or ((((_la - 271)) & ~0x3f) == 0 and ((1 << (_la - 271)) & 291666264083) != 0):
                self.state = 1720
                self.expr()
                self.state = 1725
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 1721
                    self.match(PartiQLParser.COMMA)
                    self.state = 1722
                    self.expr()
                    self.state = 1727
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 1730
            self.match(PartiQLParser.ANGLE_DOUBLE_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TupleContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def BRACE_LEFT(self):
            return self.getToken(PartiQLParser.BRACE_LEFT, 0)

        def BRACE_RIGHT(self):
            return self.getToken(PartiQLParser.BRACE_RIGHT, 0)

        def pair(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.PairContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.PairContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.COMMA)
            else:
                return self.getToken(PartiQLParser.COMMA, i)

        def getRuleIndex(self):
            return PartiQLParser.RULE_tuple

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTuple" ):
                listener.enterTuple(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTuple" ):
                listener.exitTuple(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTuple" ):
                return visitor.visitTuple(self)
            else:
                return visitor.visitChildren(self)




    def tuple_(self):

        localctx = PartiQLParser.TupleContext(self, self._ctx, self.state)
        self.enterRule(localctx, 272, self.RULE_tuple)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1732
            self.match(PartiQLParser.BRACE_LEFT)
            self.state = 1741
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & 11558071357178112) != 0) or ((((_la - 75)) & ~0x3f) == 0 and ((1 << (_la - 75)) & 234187180623281297) != 0) or ((((_la - 140)) & ~0x3f) == 0 and ((1 << (_la - 140)) & 7026323504187375659) != 0) or ((((_la - 207)) & ~0x3f) == 0 and ((1 << (_la - 207)) & 1729382258948706371) != 0) or ((((_la - 271)) & ~0x3f) == 0 and ((1 << (_la - 271)) & 291666264083) != 0):
                self.state = 1733
                self.pair()
                self.state = 1738
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 1734
                    self.match(PartiQLParser.COMMA)
                    self.state = 1735
                    self.pair()
                    self.state = 1740
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 1743
            self.match(PartiQLParser.BRACE_RIGHT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class PairContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.lhs = None # ExprContext
            self.rhs = None # ExprContext

        def COLON(self):
            return self.getToken(PartiQLParser.COLON, 0)

        def expr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(PartiQLParser.ExprContext)
            else:
                return self.getTypedRuleContext(PartiQLParser.ExprContext,i)


        def getRuleIndex(self):
            return PartiQLParser.RULE_pair

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPair" ):
                listener.enterPair(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPair" ):
                listener.exitPair(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPair" ):
                return visitor.visitPair(self)
            else:
                return visitor.visitChildren(self)




    def pair(self):

        localctx = PartiQLParser.PairContext(self, self._ctx, self.state)
        self.enterRule(localctx, 274, self.RULE_pair)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1745
            localctx.lhs = self.expr()
            self.state = 1746
            self.match(PartiQLParser.COLON)
            self.state = 1747
            localctx.rhs = self.expr()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LiteralContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return PartiQLParser.RULE_literal

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class LiteralMissingContext(LiteralContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LiteralContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def MISSING(self):
            return self.getToken(PartiQLParser.MISSING, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralMissing" ):
                listener.enterLiteralMissing(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralMissing" ):
                listener.exitLiteralMissing(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralMissing" ):
                return visitor.visitLiteralMissing(self)
            else:
                return visitor.visitChildren(self)


    class LiteralTimestampContext(LiteralContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LiteralContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def TIMESTAMP(self):
            return self.getToken(PartiQLParser.TIMESTAMP, 0)
        def LITERAL_STRING(self):
            return self.getToken(PartiQLParser.LITERAL_STRING, 0)
        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def LITERAL_INTEGER(self):
            return self.getToken(PartiQLParser.LITERAL_INTEGER, 0)
        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)
        def WITH(self):
            return self.getToken(PartiQLParser.WITH, 0)
        def TIME(self):
            return self.getToken(PartiQLParser.TIME, 0)
        def ZONE(self):
            return self.getToken(PartiQLParser.ZONE, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralTimestamp" ):
                listener.enterLiteralTimestamp(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralTimestamp" ):
                listener.exitLiteralTimestamp(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralTimestamp" ):
                return visitor.visitLiteralTimestamp(self)
            else:
                return visitor.visitChildren(self)


    class LiteralIntegerContext(LiteralContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LiteralContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def LITERAL_INTEGER(self):
            return self.getToken(PartiQLParser.LITERAL_INTEGER, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralInteger" ):
                listener.enterLiteralInteger(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralInteger" ):
                listener.exitLiteralInteger(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralInteger" ):
                return visitor.visitLiteralInteger(self)
            else:
                return visitor.visitChildren(self)


    class LiteralDateContext(LiteralContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LiteralContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def DATE(self):
            return self.getToken(PartiQLParser.DATE, 0)
        def LITERAL_STRING(self):
            return self.getToken(PartiQLParser.LITERAL_STRING, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralDate" ):
                listener.enterLiteralDate(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralDate" ):
                listener.exitLiteralDate(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralDate" ):
                return visitor.visitLiteralDate(self)
            else:
                return visitor.visitChildren(self)


    class LiteralFalseContext(LiteralContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LiteralContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def FALSE(self):
            return self.getToken(PartiQLParser.FALSE, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralFalse" ):
                listener.enterLiteralFalse(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralFalse" ):
                listener.exitLiteralFalse(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralFalse" ):
                return visitor.visitLiteralFalse(self)
            else:
                return visitor.visitChildren(self)


    class LiteralStringContext(LiteralContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LiteralContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def LITERAL_STRING(self):
            return self.getToken(PartiQLParser.LITERAL_STRING, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralString" ):
                listener.enterLiteralString(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralString" ):
                listener.exitLiteralString(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralString" ):
                return visitor.visitLiteralString(self)
            else:
                return visitor.visitChildren(self)


    class LiteralDecimalContext(LiteralContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LiteralContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def LITERAL_DECIMAL(self):
            return self.getToken(PartiQLParser.LITERAL_DECIMAL, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralDecimal" ):
                listener.enterLiteralDecimal(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralDecimal" ):
                listener.exitLiteralDecimal(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralDecimal" ):
                return visitor.visitLiteralDecimal(self)
            else:
                return visitor.visitChildren(self)


    class LiteralNullContext(LiteralContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LiteralContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def NULL(self):
            return self.getToken(PartiQLParser.NULL, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralNull" ):
                listener.enterLiteralNull(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralNull" ):
                listener.exitLiteralNull(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralNull" ):
                return visitor.visitLiteralNull(self)
            else:
                return visitor.visitChildren(self)


    class LiteralIonContext(LiteralContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LiteralContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def ION_CLOSURE(self):
            return self.getToken(PartiQLParser.ION_CLOSURE, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralIon" ):
                listener.enterLiteralIon(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralIon" ):
                listener.exitLiteralIon(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralIon" ):
                return visitor.visitLiteralIon(self)
            else:
                return visitor.visitChildren(self)


    class LiteralTrueContext(LiteralContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LiteralContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def TRUE(self):
            return self.getToken(PartiQLParser.TRUE, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralTrue" ):
                listener.enterLiteralTrue(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralTrue" ):
                listener.exitLiteralTrue(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralTrue" ):
                return visitor.visitLiteralTrue(self)
            else:
                return visitor.visitChildren(self)


    class LiteralTimeContext(LiteralContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.LiteralContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def TIME(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.TIME)
            else:
                return self.getToken(PartiQLParser.TIME, i)
        def LITERAL_STRING(self):
            return self.getToken(PartiQLParser.LITERAL_STRING, 0)
        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def LITERAL_INTEGER(self):
            return self.getToken(PartiQLParser.LITERAL_INTEGER, 0)
        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)
        def WITH(self):
            return self.getToken(PartiQLParser.WITH, 0)
        def ZONE(self):
            return self.getToken(PartiQLParser.ZONE, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralTime" ):
                listener.enterLiteralTime(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralTime" ):
                listener.exitLiteralTime(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralTime" ):
                return visitor.visitLiteralTime(self)
            else:
                return visitor.visitChildren(self)



    def literal(self):

        localctx = PartiQLParser.LiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 276, self.RULE_literal)
        self._la = 0 # Token type
        try:
            self.state = 1783
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [141]:
                localctx = PartiQLParser.LiteralNullContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1749
                self.match(PartiQLParser.NULL)
                pass
            elif token in [236]:
                localctx = PartiQLParser.LiteralMissingContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1750
                self.match(PartiQLParser.MISSING)
                pass
            elif token in [208]:
                localctx = PartiQLParser.LiteralTrueContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1751
                self.match(PartiQLParser.TRUE)
                pass
            elif token in [88]:
                localctx = PartiQLParser.LiteralFalseContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 1752
                self.match(PartiQLParser.FALSE)
                pass
            elif token in [300]:
                localctx = PartiQLParser.LiteralStringContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 1753
                self.match(PartiQLParser.LITERAL_STRING)
                pass
            elif token in [301]:
                localctx = PartiQLParser.LiteralIntegerContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 1754
                self.match(PartiQLParser.LITERAL_INTEGER)
                pass
            elif token in [302]:
                localctx = PartiQLParser.LiteralDecimalContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 1755
                self.match(PartiQLParser.LITERAL_DECIMAL)
                pass
            elif token in [309]:
                localctx = PartiQLParser.LiteralIonContext(self, localctx)
                self.enterOuterAlt(localctx, 8)
                self.state = 1756
                self.match(PartiQLParser.ION_CLOSURE)
                pass
            elif token in [53]:
                localctx = PartiQLParser.LiteralDateContext(self, localctx)
                self.enterOuterAlt(localctx, 9)
                self.state = 1757
                self.match(PartiQLParser.DATE)
                self.state = 1758
                self.match(PartiQLParser.LITERAL_STRING)
                pass
            elif token in [201]:
                localctx = PartiQLParser.LiteralTimeContext(self, localctx)
                self.enterOuterAlt(localctx, 10)
                self.state = 1759
                self.match(PartiQLParser.TIME)
                self.state = 1763
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==294:
                    self.state = 1760
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1761
                    self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1762
                    self.match(PartiQLParser.PAREN_RIGHT)


                self.state = 1768
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==226:
                    self.state = 1765
                    self.match(PartiQLParser.WITH)
                    self.state = 1766
                    self.match(PartiQLParser.TIME)
                    self.state = 1767
                    self.match(PartiQLParser.ZONE)


                self.state = 1770
                self.match(PartiQLParser.LITERAL_STRING)
                pass
            elif token in [202]:
                localctx = PartiQLParser.LiteralTimestampContext(self, localctx)
                self.enterOuterAlt(localctx, 11)
                self.state = 1771
                self.match(PartiQLParser.TIMESTAMP)
                self.state = 1775
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==294:
                    self.state = 1772
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1773
                    self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1774
                    self.match(PartiQLParser.PAREN_RIGHT)


                self.state = 1780
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==226:
                    self.state = 1777
                    self.match(PartiQLParser.WITH)
                    self.state = 1778
                    self.match(PartiQLParser.TIME)
                    self.state = 1779
                    self.match(PartiQLParser.ZONE)


                self.state = 1782
                self.match(PartiQLParser.LITERAL_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 TypeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return PartiQLParser.RULE_type

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class TypeArgSingleContext(TypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TypeContext
            super().__init__(parser)
            self.datatype = None # Token
            self.arg0 = None # Token
            self.copyFrom(ctx)

        def CHARACTER(self):
            return self.getToken(PartiQLParser.CHARACTER, 0)
        def CHAR(self):
            return self.getToken(PartiQLParser.CHAR, 0)
        def FLOAT(self):
            return self.getToken(PartiQLParser.FLOAT, 0)
        def VARCHAR(self):
            return self.getToken(PartiQLParser.VARCHAR, 0)
        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)
        def LITERAL_INTEGER(self):
            return self.getToken(PartiQLParser.LITERAL_INTEGER, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTypeArgSingle" ):
                listener.enterTypeArgSingle(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTypeArgSingle" ):
                listener.exitTypeArgSingle(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeArgSingle" ):
                return visitor.visitTypeArgSingle(self)
            else:
                return visitor.visitChildren(self)


    class TypeAtomicContext(TypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TypeContext
            super().__init__(parser)
            self.datatype = None # Token
            self.copyFrom(ctx)

        def NULL(self):
            return self.getToken(PartiQLParser.NULL, 0)
        def BOOL(self):
            return self.getToken(PartiQLParser.BOOL, 0)
        def BOOLEAN(self):
            return self.getToken(PartiQLParser.BOOLEAN, 0)
        def SMALLINT(self):
            return self.getToken(PartiQLParser.SMALLINT, 0)
        def INTEGER2(self):
            return self.getToken(PartiQLParser.INTEGER2, 0)
        def INT2(self):
            return self.getToken(PartiQLParser.INT2, 0)
        def INTEGER(self):
            return self.getToken(PartiQLParser.INTEGER, 0)
        def INT(self):
            return self.getToken(PartiQLParser.INT, 0)
        def INTEGER4(self):
            return self.getToken(PartiQLParser.INTEGER4, 0)
        def INT4(self):
            return self.getToken(PartiQLParser.INT4, 0)
        def INTEGER8(self):
            return self.getToken(PartiQLParser.INTEGER8, 0)
        def INT8(self):
            return self.getToken(PartiQLParser.INT8, 0)
        def BIGINT(self):
            return self.getToken(PartiQLParser.BIGINT, 0)
        def REAL(self):
            return self.getToken(PartiQLParser.REAL, 0)
        def CHAR(self):
            return self.getToken(PartiQLParser.CHAR, 0)
        def CHARACTER(self):
            return self.getToken(PartiQLParser.CHARACTER, 0)
        def MISSING(self):
            return self.getToken(PartiQLParser.MISSING, 0)
        def STRING(self):
            return self.getToken(PartiQLParser.STRING, 0)
        def SYMBOL(self):
            return self.getToken(PartiQLParser.SYMBOL, 0)
        def BLOB(self):
            return self.getToken(PartiQLParser.BLOB, 0)
        def CLOB(self):
            return self.getToken(PartiQLParser.CLOB, 0)
        def DATE(self):
            return self.getToken(PartiQLParser.DATE, 0)
        def STRUCT(self):
            return self.getToken(PartiQLParser.STRUCT, 0)
        def TUPLE(self):
            return self.getToken(PartiQLParser.TUPLE, 0)
        def LIST(self):
            return self.getToken(PartiQLParser.LIST, 0)
        def SEXP(self):
            return self.getToken(PartiQLParser.SEXP, 0)
        def BAG(self):
            return self.getToken(PartiQLParser.BAG, 0)
        def ANY(self):
            return self.getToken(PartiQLParser.ANY, 0)
        def PRECISION(self):
            return self.getToken(PartiQLParser.PRECISION, 0)
        def DOUBLE(self):
            return self.getToken(PartiQLParser.DOUBLE, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTypeAtomic" ):
                listener.enterTypeAtomic(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTypeAtomic" ):
                listener.exitTypeAtomic(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeAtomic" ):
                return visitor.visitTypeAtomic(self)
            else:
                return visitor.visitChildren(self)


    class TypeArgDoubleContext(TypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TypeContext
            super().__init__(parser)
            self.datatype = None # Token
            self.arg0 = None # Token
            self.arg1 = None # Token
            self.copyFrom(ctx)

        def DECIMAL(self):
            return self.getToken(PartiQLParser.DECIMAL, 0)
        def DEC(self):
            return self.getToken(PartiQLParser.DEC, 0)
        def NUMERIC(self):
            return self.getToken(PartiQLParser.NUMERIC, 0)
        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)
        def LITERAL_INTEGER(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.LITERAL_INTEGER)
            else:
                return self.getToken(PartiQLParser.LITERAL_INTEGER, i)
        def COMMA(self):
            return self.getToken(PartiQLParser.COMMA, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTypeArgDouble" ):
                listener.enterTypeArgDouble(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTypeArgDouble" ):
                listener.exitTypeArgDouble(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeArgDouble" ):
                return visitor.visitTypeArgDouble(self)
            else:
                return visitor.visitChildren(self)


    class TypeTimeZoneContext(TypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TypeContext
            super().__init__(parser)
            self.datatype = None # Token
            self.precision = None # Token
            self.copyFrom(ctx)

        def TIME(self, i:int=None):
            if i is None:
                return self.getTokens(PartiQLParser.TIME)
            else:
                return self.getToken(PartiQLParser.TIME, i)
        def TIMESTAMP(self):
            return self.getToken(PartiQLParser.TIMESTAMP, 0)
        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)
        def WITH(self):
            return self.getToken(PartiQLParser.WITH, 0)
        def ZONE(self):
            return self.getToken(PartiQLParser.ZONE, 0)
        def LITERAL_INTEGER(self):
            return self.getToken(PartiQLParser.LITERAL_INTEGER, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTypeTimeZone" ):
                listener.enterTypeTimeZone(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTypeTimeZone" ):
                listener.exitTypeTimeZone(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeTimeZone" ):
                return visitor.visitTypeTimeZone(self)
            else:
                return visitor.visitChildren(self)


    class TypeCustomContext(TypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TypeContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def symbolPrimitive(self):
            return self.getTypedRuleContext(PartiQLParser.SymbolPrimitiveContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTypeCustom" ):
                listener.enterTypeCustom(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTypeCustom" ):
                listener.exitTypeCustom(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeCustom" ):
                return visitor.visitTypeCustom(self)
            else:
                return visitor.visitChildren(self)


    class TypeVarCharContext(TypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a PartiQLParser.TypeContext
            super().__init__(parser)
            self.arg0 = None # Token
            self.copyFrom(ctx)

        def CHARACTER(self):
            return self.getToken(PartiQLParser.CHARACTER, 0)
        def VARYING(self):
            return self.getToken(PartiQLParser.VARYING, 0)
        def PAREN_LEFT(self):
            return self.getToken(PartiQLParser.PAREN_LEFT, 0)
        def PAREN_RIGHT(self):
            return self.getToken(PartiQLParser.PAREN_RIGHT, 0)
        def LITERAL_INTEGER(self):
            return self.getToken(PartiQLParser.LITERAL_INTEGER, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTypeVarChar" ):
                listener.enterTypeVarChar(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTypeVarChar" ):
                listener.exitTypeVarChar(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeVarChar" ):
                return visitor.visitTypeVarChar(self)
            else:
                return visitor.visitChildren(self)



    def type_(self):

        localctx = PartiQLParser.TypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 278, self.RULE_type)
        self._la = 0 # Token type
        try:
            self.state = 1823
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,229,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.TypeAtomicContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1785
                localctx.datatype = self._input.LT(1)
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 9007199456067840) != 0) or ((((_la - 113)) & ~0x3f) == 0 and ((1 << (_la - 113)) & 144115188344291331) != 0) or ((((_la - 188)) & ~0x3f) == 0 and ((1 << (_la - 188)) & -9223090561878065151) != 0) or ((((_la - 252)) & ~0x3f) == 0 and ((1 << (_la - 252)) & 131071) != 0)):
                    localctx.datatype = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.TypeAtomicContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1786
                localctx.datatype = self.match(PartiQLParser.DOUBLE)
                self.state = 1787
                self.match(PartiQLParser.PRECISION)
                pass

            elif la_ == 3:
                localctx = PartiQLParser.TypeArgSingleContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1788
                localctx.datatype = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==26 or _la==27 or _la==91 or _la==220):
                    localctx.datatype = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 1792
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,223,self._ctx)
                if la_ == 1:
                    self.state = 1789
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1790
                    localctx.arg0 = self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1791
                    self.match(PartiQLParser.PAREN_RIGHT)


                pass

            elif la_ == 4:
                localctx = PartiQLParser.TypeVarCharContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 1794
                self.match(PartiQLParser.CHARACTER)
                self.state = 1795
                self.match(PartiQLParser.VARYING)
                self.state = 1799
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,224,self._ctx)
                if la_ == 1:
                    self.state = 1796
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1797
                    localctx.arg0 = self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1798
                    self.match(PartiQLParser.PAREN_RIGHT)


                pass

            elif la_ == 5:
                localctx = PartiQLParser.TypeArgDoubleContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 1801
                localctx.datatype = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==55 or _la==56 or _la==144):
                    localctx.datatype = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 1809
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,226,self._ctx)
                if la_ == 1:
                    self.state = 1802
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1803
                    localctx.arg0 = self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1806
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==270:
                        self.state = 1804
                        self.match(PartiQLParser.COMMA)
                        self.state = 1805
                        localctx.arg1 = self.match(PartiQLParser.LITERAL_INTEGER)


                    self.state = 1808
                    self.match(PartiQLParser.PAREN_RIGHT)


                pass

            elif la_ == 6:
                localctx = PartiQLParser.TypeTimeZoneContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 1811
                localctx.datatype = self._input.LT(1)
                _la = self._input.LA(1)
                if not(_la==201 or _la==202):
                    localctx.datatype = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 1815
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,227,self._ctx)
                if la_ == 1:
                    self.state = 1812
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1813
                    localctx.precision = self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1814
                    self.match(PartiQLParser.PAREN_RIGHT)


                self.state = 1820
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,228,self._ctx)
                if la_ == 1:
                    self.state = 1817
                    self.match(PartiQLParser.WITH)
                    self.state = 1818
                    self.match(PartiQLParser.TIME)
                    self.state = 1819
                    self.match(PartiQLParser.ZONE)


                pass

            elif la_ == 7:
                localctx = PartiQLParser.TypeCustomContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 1822
                self.symbolPrimitive()
                pass


        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[82] = self.labelSpec_sempred
        self._predicates[83] = self.labelTerm_sempred
        self._predicates[87] = self.tableReference_sempred
        self._predicates[95] = self.exprBagOp_sempred
        self._predicates[97] = self.exprOr_sempred
        self._predicates[98] = self.exprAnd_sempred
        self._predicates[100] = self.exprPredicate_sempred
        self._predicates[101] = self.mathOp00_sempred
        self._predicates[102] = self.mathOp01_sempred
        self._predicates[103] = self.mathOp02_sempred
        self._predicates[105] = self.exprPrimary_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 labelSpec_sempred(self, localctx:LabelSpecContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 2)
         

    def labelTerm_sempred(self, localctx:LabelTermContext, predIndex:int):
            if predIndex == 1:
                return self.precpred(self._ctx, 2)
         

    def tableReference_sempred(self, localctx:TableReferenceContext, predIndex:int):
            if predIndex == 2:
                return self.precpred(self._ctx, 5)
         

            if predIndex == 3:
                return self.precpred(self._ctx, 4)
         

            if predIndex == 4:
                return self.precpred(self._ctx, 3)
         

    def exprBagOp_sempred(self, localctx:ExprBagOpContext, predIndex:int):
            if predIndex == 5:
                return self.precpred(self._ctx, 4)
         

            if predIndex == 6:
                return self.precpred(self._ctx, 3)
         

            if predIndex == 7:
                return self.precpred(self._ctx, 2)
         

    def exprOr_sempred(self, localctx:ExprOrContext, predIndex:int):
            if predIndex == 8:
                return self.precpred(self._ctx, 2)
         

    def exprAnd_sempred(self, localctx:ExprAndContext, predIndex:int):
            if predIndex == 9:
                return self.precpred(self._ctx, 2)
         

    def exprPredicate_sempred(self, localctx:ExprPredicateContext, predIndex:int):
            if predIndex == 10:
                return self.precpred(self._ctx, 7)
         

            if predIndex == 11:
                return self.precpred(self._ctx, 6)
         

            if predIndex == 12:
                return self.precpred(self._ctx, 5)
         

            if predIndex == 13:
                return self.precpred(self._ctx, 4)
         

            if predIndex == 14:
                return self.precpred(self._ctx, 3)
         

            if predIndex == 15:
                return self.precpred(self._ctx, 2)
         

    def mathOp00_sempred(self, localctx:MathOp00Context, predIndex:int):
            if predIndex == 16:
                return self.precpred(self._ctx, 2)
         

    def mathOp01_sempred(self, localctx:MathOp01Context, predIndex:int):
            if predIndex == 17:
                return self.precpred(self._ctx, 2)
         

    def mathOp02_sempred(self, localctx:MathOp02Context, predIndex:int):
            if predIndex == 18:
                return self.precpred(self._ctx, 2)
         

    def exprPrimary_sempred(self, localctx:ExprPrimaryContext, predIndex:int):
            if predIndex == 19:
                return self.precpred(self._ctx, 6)
         




