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

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

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_onConflict = 30
    RULE_insertStatementLegacy = 31
    RULE_onConflictLegacy = 32
    RULE_conflictTarget = 33
    RULE_constraintName = 34
    RULE_conflictAction = 35
    RULE_doReplace = 36
    RULE_doUpdate = 37
    RULE_updateClause = 38
    RULE_setCommand = 39
    RULE_setAssignment = 40
    RULE_deleteCommand = 41
    RULE_returningClause = 42
    RULE_returningColumn = 43
    RULE_fromClauseSimple = 44
    RULE_whereClause = 45
    RULE_selectClause = 46
    RULE_projectionItems = 47
    RULE_projectionItem = 48
    RULE_setQuantifierStrategy = 49
    RULE_letClause = 50
    RULE_letBinding = 51
    RULE_orderByClause = 52
    RULE_orderSortSpec = 53
    RULE_groupClause = 54
    RULE_groupAlias = 55
    RULE_groupKey = 56
    RULE_over = 57
    RULE_windowPartitionList = 58
    RULE_windowSortSpecList = 59
    RULE_havingClause = 60
    RULE_excludeClause = 61
    RULE_excludeExpr = 62
    RULE_excludeExprSteps = 63
    RULE_fromClause = 64
    RULE_whereClauseSelect = 65
    RULE_offsetByClause = 66
    RULE_limitClause = 67
    RULE_gpmlPattern = 68
    RULE_gpmlPatternList = 69
    RULE_matchPattern = 70
    RULE_graphPart = 71
    RULE_matchSelector = 72
    RULE_patternPathVariable = 73
    RULE_patternRestrictor = 74
    RULE_node = 75
    RULE_edge = 76
    RULE_pattern = 77
    RULE_patternQuantifier = 78
    RULE_edgeWSpec = 79
    RULE_edgeSpec = 80
    RULE_labelSpec = 81
    RULE_labelTerm = 82
    RULE_labelFactor = 83
    RULE_labelPrimary = 84
    RULE_edgeAbbrev = 85
    RULE_tableReference = 86
    RULE_tableNonJoin = 87
    RULE_tableBaseReference = 88
    RULE_tableUnpivot = 89
    RULE_joinRhs = 90
    RULE_joinSpec = 91
    RULE_joinType = 92
    RULE_expr = 93
    RULE_exprBagOp = 94
    RULE_exprSelect = 95
    RULE_exprOr = 96
    RULE_exprAnd = 97
    RULE_exprNot = 98
    RULE_exprPredicate = 99
    RULE_mathOp00 = 100
    RULE_mathOp01 = 101
    RULE_mathOp02 = 102
    RULE_valueExpr = 103
    RULE_exprPrimary = 104
    RULE_exprTerm = 105
    RULE_nullIf = 106
    RULE_coalesce = 107
    RULE_caseExpr = 108
    RULE_values = 109
    RULE_valueRow = 110
    RULE_valueList = 111
    RULE_sequenceConstructor = 112
    RULE_substring = 113
    RULE_position = 114
    RULE_overlay = 115
    RULE_aggregate = 116
    RULE_windowFunction = 117
    RULE_cast = 118
    RULE_canLosslessCast = 119
    RULE_canCast = 120
    RULE_extract = 121
    RULE_trimFunction = 122
    RULE_dateFunction = 123
    RULE_functionCall = 124
    RULE_functionName = 125
    RULE_pathStep = 126
    RULE_exprGraphMatchMany = 127
    RULE_exprGraphMatchOne = 128
    RULE_parameter = 129
    RULE_varRefExpr = 130
    RULE_nonReservedKeywords = 131
    RULE_collection = 132
    RULE_array = 133
    RULE_bag = 134
    RULE_tuple = 135
    RULE_pair = 136
    RULE_literal = 137
    RULE_type = 138

    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", 
                   "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.2")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None




    class RootContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def 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 = 292
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==83:
                self.state = 278
                self.match(PartiQLParser.EXPLAIN)
                self.state = 290
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
                if la_ == 1:
                    self.state = 279
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 280
                    self.explainOption()
                    self.state = 285
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while _la==270:
                        self.state = 281
                        self.match(PartiQLParser.COMMA)
                        self.state = 282
                        self.explainOption()
                        self.state = 287
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)

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




            self.state = 294
            self.statement()
            self.state = 295
            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 = 313
            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 = 297
                self.dql()
                self.state = 299
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==297:
                    self.state = 298
                    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 = 301
                self.dml()
                self.state = 303
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==297:
                    self.state = 302
                    self.match(PartiQLParser.COLON_SEMI)


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


                pass
            elif token in [80]:
                localctx = PartiQLParser.QueryExecContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 309
                self.execCommand()
                self.state = 311
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==297:
                    self.state = 310
                    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 = 315
            localctx.param = self.match(PartiQLParser.IDENTIFIER)
            self.state = 316
            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 = 318
            self.match(PartiQLParser.AS)
            self.state = 319
            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 = 321
            self.match(PartiQLParser.AT)
            self.state = 322
            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 = 324
            self.match(PartiQLParser.BY)
            self.state = 325
            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 = 327
            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 = 329
            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 = 331
            self.match(PartiQLParser.EXEC)
            self.state = 332
            localctx.name = self.expr()
            self.state = 341
            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 = 333
                localctx._expr = self.expr()
                localctx.args.append(localctx._expr)
                self.state = 338
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 334
                    self.match(PartiQLParser.COMMA)
                    self.state = 335
                    localctx._expr = self.expr()
                    localctx.args.append(localctx._expr)
                    self.state = 340
                    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 = 348
            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 = 343
                    localctx._symbolPrimitive = self.symbolPrimitive()
                    localctx.qualifier.append(localctx._symbolPrimitive)
                    self.state = 344
                    self.match(PartiQLParser.PERIOD) 
                self.state = 350
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,10,self._ctx)

            self.state = 351
            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 = 353
            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 = 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 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 = 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 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 = 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 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 = 363
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [45]:
                self.enterOuterAlt(localctx, 1)
                self.state = 361
                self.createCommand()
                pass
            elif token in [70]:
                self.enterOuterAlt(localctx, 2)
                self.state = 362
                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 = 389
            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 = 365
                self.match(PartiQLParser.CREATE)
                self.state = 366
                self.match(PartiQLParser.TABLE)
                self.state = 367
                self.qualifiedName()
                self.state = 372
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==294:
                    self.state = 368
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 369
                    self.tableDef()
                    self.state = 370
                    self.match(PartiQLParser.PAREN_RIGHT)


                pass

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

                self.state = 387
                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 = 400
            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 = 391
                self.match(PartiQLParser.DROP)
                self.state = 392
                self.match(PartiQLParser.TABLE)
                self.state = 393
                self.qualifiedName()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.DropIndexContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 394
                self.match(PartiQLParser.DROP)
                self.state = 395
                self.match(PartiQLParser.INDEX)
                self.state = 396
                localctx.target = self.symbolPrimitive()
                self.state = 397
                self.match(PartiQLParser.ON)
                self.state = 398
                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 = 402
            self.tableDefPart()
            self.state = 407
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 403
                self.match(PartiQLParser.COMMA)
                self.state = 404
                self.tableDefPart()
                self.state = 409
                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 = 410
            self.columnName()
            self.state = 411
            self.type_()
            self.state = 415
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==39 or _la==140 or _la==141:
                self.state = 412
                self.columnConstraint()
                self.state = 417
                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 = 420
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==39:
                self.state = 418
                self.match(PartiQLParser.CONSTRAINT)
                self.state = 419
                self.columnConstraintName()


            self.state = 422
            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 = 427
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [140]:
                localctx = PartiQLParser.ColConstrNotNullContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 424
                self.match(PartiQLParser.NOT)
                self.state = 425
                self.match(PartiQLParser.NULL)
                pass
            elif token in [141]:
                localctx = PartiQLParser.ColConstrNullContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 426
                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 = 456
            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 = 429
                self.updateClause()
                self.state = 431 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 430
                    self.dmlBaseCommand()
                    self.state = 433 
                    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 = 436
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==225:
                    self.state = 435
                    self.whereClause()


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


                pass

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


                self.state = 446 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 445
                    self.dmlBaseCommand()
                    self.state = 448 
                    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 = 451
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==246:
                    self.state = 450
                    self.returningClause()


                pass

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

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

            elif la_ == 5:
                localctx = PartiQLParser.DmlBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 455
                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 = 464
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,27,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 458
                self.insertStatement()
                pass

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

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

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

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

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 463
                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 = 466
            self.symbolPrimitive()
            self.state = 470
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==290 or _la==299:
                self.state = 467
                self.pathSimpleSteps()
                self.state = 472
                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 = 483
            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 = 473
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 474
                localctx.key = self.literal()
                self.state = 475
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

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

            elif la_ == 3:
                localctx = PartiQLParser.PathSimpleDotSymbolContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 481
                self.match(PartiQLParser.PERIOD)
                self.state = 482
                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 = 485
            self.match(PartiQLParser.REPLACE)
            self.state = 486
            self.match(PartiQLParser.INTO)
            self.state = 487
            self.symbolPrimitive()
            self.state = 489
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==10:
                self.state = 488
                self.asIdent()


            self.state = 491
            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 = 493
            self.match(PartiQLParser.UPSERT)
            self.state = 494
            self.match(PartiQLParser.INTO)
            self.state = 495
            self.symbolPrimitive()
            self.state = 497
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==10:
                self.state = 496
                self.asIdent()


            self.state = 499
            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 = 501
            self.match(PartiQLParser.REMOVE)
            self.state = 502
            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 = 504
            self.match(PartiQLParser.INSERT)
            self.state = 505
            self.match(PartiQLParser.INTO)
            self.state = 506
            self.pathSimple()
            self.state = 507
            self.match(PartiQLParser.VALUE)
            self.state = 508
            localctx.value = self.expr()
            self.state = 511
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==13:
                self.state = 509
                self.match(PartiQLParser.AT)
                self.state = 510
                localctx.pos = self.expr()


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


            self.state = 517
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==246:
                self.state = 516
                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 expr(self):
            return self.getTypedRuleContext(PartiQLParser.ExprContext,0)


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


        def onConflict(self):
            return self.getTypedRuleContext(PartiQLParser.OnConflictContext,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.enterOuterAlt(localctx, 1)
            self.state = 519
            self.match(PartiQLParser.INSERT)
            self.state = 520
            self.match(PartiQLParser.INTO)
            self.state = 521
            self.symbolPrimitive()
            self.state = 523
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==10:
                self.state = 522
                self.asIdent()


            self.state = 525
            localctx.value = self.expr()
            self.state = 527
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==147:
                self.state = 526
                self.onConflict()


        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, 60, self.RULE_onConflict)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 529
            self.match(PartiQLParser.ON)
            self.state = 530
            self.match(PartiQLParser.CONFLICT)
            self.state = 532
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==147 or _la==294:
                self.state = 531
                self.conflictTarget()


            self.state = 534
            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, 62, self.RULE_insertStatementLegacy)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 536
            self.match(PartiQLParser.INSERT)
            self.state = 537
            self.match(PartiQLParser.INTO)
            self.state = 538
            self.pathSimple()
            self.state = 539
            self.match(PartiQLParser.VALUE)
            self.state = 540
            localctx.value = self.expr()
            self.state = 543
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==13:
                self.state = 541
                self.match(PartiQLParser.AT)
                self.state = 542
                localctx.pos = self.expr()


            self.state = 546
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==147:
                self.state = 545
                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, 64, self.RULE_onConflictLegacy)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 548
            self.match(PartiQLParser.ON)
            self.state = 549
            self.match(PartiQLParser.CONFLICT)
            self.state = 550
            self.match(PartiQLParser.WHERE)
            self.state = 551
            self.expr()
            self.state = 552
            self.match(PartiQLParser.DO)
            self.state = 553
            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, 66, self.RULE_conflictTarget)
        self._la = 0 # Token type
        try:
            self.state = 569
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [294]:
                self.enterOuterAlt(localctx, 1)
                self.state = 555
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 556
                self.symbolPrimitive()
                self.state = 561
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 557
                    self.match(PartiQLParser.COMMA)
                    self.state = 558
                    self.symbolPrimitive()
                    self.state = 563
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 564
                self.match(PartiQLParser.PAREN_RIGHT)
                pass
            elif token in [147]:
                self.enterOuterAlt(localctx, 2)
                self.state = 566
                self.match(PartiQLParser.ON)
                self.state = 567
                self.match(PartiQLParser.CONSTRAINT)
                self.state = 568
                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, 68, self.RULE_constraintName)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 571
            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, 70, self.RULE_conflictAction)
        try:
            self.state = 581
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,42,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 573
                self.match(PartiQLParser.DO)
                self.state = 574
                self.match(PartiQLParser.NOTHING)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 575
                self.match(PartiQLParser.DO)
                self.state = 576
                self.match(PartiQLParser.REPLACE)
                self.state = 577
                self.doReplace()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 578
                self.match(PartiQLParser.DO)
                self.state = 579
                self.match(PartiQLParser.UPDATE)
                self.state = 580
                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, 72, self.RULE_doReplace)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 583
            self.match(PartiQLParser.EXCLUDED)
            self.state = 586
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,43,self._ctx)
            if la_ == 1:
                self.state = 584
                self.match(PartiQLParser.WHERE)
                self.state = 585
                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, 74, self.RULE_doUpdate)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 588
            self.match(PartiQLParser.EXCLUDED)
            self.state = 591
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,44,self._ctx)
            if la_ == 1:
                self.state = 589
                self.match(PartiQLParser.WHERE)
                self.state = 590
                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, 76, self.RULE_updateClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 593
            self.match(PartiQLParser.UPDATE)
            self.state = 594
            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, 78, self.RULE_setCommand)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 596
            self.match(PartiQLParser.SET)
            self.state = 597
            self.setAssignment()
            self.state = 602
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 598
                self.match(PartiQLParser.COMMA)
                self.state = 599
                self.setAssignment()
                self.state = 604
                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, 80, self.RULE_setAssignment)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 605
            self.pathSimple()
            self.state = 606
            self.match(PartiQLParser.EQ)
            self.state = 607
            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, 82, self.RULE_deleteCommand)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 609
            self.match(PartiQLParser.DELETE)
            self.state = 610
            self.fromClauseSimple()
            self.state = 612
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==225:
                self.state = 611
                self.whereClause()


            self.state = 615
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==246:
                self.state = 614
                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, 84, self.RULE_returningClause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 617
            self.match(PartiQLParser.RETURNING)
            self.state = 618
            self.returningColumn()
            self.state = 623
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 619
                self.match(PartiQLParser.COMMA)
                self.state = 620
                self.returningColumn()
                self.state = 625
                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, 86, self.RULE_returningColumn)
        self._la = 0 # Token type
        try:
            self.state = 632
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,49,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 626
                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 = 627
                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 = 628
                self.match(PartiQLParser.ASTERISK)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 629
                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 = 630
                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 = 631
                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, 88, self.RULE_fromClauseSimple)
        self._la = 0 # Token type
        try:
            self.state = 649
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,53,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.FromClauseSimpleExplicitContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 634
                self.match(PartiQLParser.FROM)
                self.state = 635
                self.pathSimple()
                self.state = 637
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==10:
                    self.state = 636
                    self.asIdent()


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


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


                pass

            elif la_ == 2:
                localctx = PartiQLParser.FromClauseSimpleImplicitContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 645
                self.match(PartiQLParser.FROM)
                self.state = 646
                self.pathSimple()
                self.state = 647
                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, 90, self.RULE_whereClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 651
            self.match(PartiQLParser.WHERE)
            self.state = 652
            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, 92, self.RULE_selectClause)
        self._la = 0 # Token type
        try:
            self.state = 675
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,57,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.SelectAllContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 654
                self.match(PartiQLParser.SELECT)
                self.state = 656
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==4 or _la==67:
                    self.state = 655
                    self.setQuantifierStrategy()


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

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


                self.state = 663
                self.projectionItems()
                pass

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


                self.state = 668
                self.match(PartiQLParser.VALUE)
                self.state = 669
                self.expr()
                pass

            elif la_ == 4:
                localctx = PartiQLParser.SelectPivotContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 670
                self.match(PartiQLParser.PIVOT)
                self.state = 671
                localctx.pivot = self.expr()
                self.state = 672
                self.match(PartiQLParser.AT)
                self.state = 673
                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, 94, self.RULE_projectionItems)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 677
            self.projectionItem()
            self.state = 682
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 678
                self.match(PartiQLParser.COMMA)
                self.state = 679
                self.projectionItem()
                self.state = 684
                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, 96, self.RULE_projectionItem)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 685
            self.expr()
            self.state = 690
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==10 or _la==303 or _la==304:
                self.state = 687
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==10:
                    self.state = 686
                    self.match(PartiQLParser.AS)


                self.state = 689
                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, 98, self.RULE_setQuantifierStrategy)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 692
            _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, 100, self.RULE_letClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 694
            self.match(PartiQLParser.LET)
            self.state = 695
            self.letBinding()
            self.state = 700
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,61,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 696
                    self.match(PartiQLParser.COMMA)
                    self.state = 697
                    self.letBinding() 
                self.state = 702
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,61,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, 102, self.RULE_letBinding)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 703
            self.expr()
            self.state = 704
            self.match(PartiQLParser.AS)
            self.state = 705
            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, 104, self.RULE_orderByClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 707
            self.match(PartiQLParser.ORDER)
            self.state = 708
            self.match(PartiQLParser.BY)
            self.state = 709
            self.orderSortSpec()
            self.state = 714
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,62,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 710
                    self.match(PartiQLParser.COMMA)
                    self.state = 711
                    self.orderSortSpec() 
                self.state = 716
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,62,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, 106, self.RULE_orderSortSpec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 717
            self.expr()
            self.state = 719
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,63,self._ctx)
            if la_ == 1:
                self.state = 718
                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 = 723
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,64,self._ctx)
            if la_ == 1:
                self.state = 721
                self.match(PartiQLParser.NULLS)
                self.state = 722
                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, 108, self.RULE_groupClause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 725
            self.match(PartiQLParser.GROUP)
            self.state = 727
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==158:
                self.state = 726
                self.match(PartiQLParser.PARTIAL)


            self.state = 729
            self.match(PartiQLParser.BY)
            self.state = 730
            self.groupKey()
            self.state = 735
            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 = 731
                    self.match(PartiQLParser.COMMA)
                    self.state = 732
                    self.groupKey() 
                self.state = 737
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,66,self._ctx)

            self.state = 739
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,67,self._ctx)
            if la_ == 1:
                self.state = 738
                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, 110, self.RULE_groupAlias)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 741
            self.match(PartiQLParser.GROUP)
            self.state = 742
            self.match(PartiQLParser.AS)
            self.state = 743
            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, 112, self.RULE_groupKey)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 745
            localctx.key = self.exprSelect()
            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.AS)
                self.state = 747
                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, 114, self.RULE_over)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 750
            self.match(PartiQLParser.OVER)
            self.state = 751
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 753
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==233:
                self.state = 752
                self.windowPartitionList()


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


            self.state = 758
            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, 116, self.RULE_windowPartitionList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 760
            self.match(PartiQLParser.PARTITION)
            self.state = 761
            self.match(PartiQLParser.BY)
            self.state = 762
            self.expr()
            self.state = 767
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 763
                self.match(PartiQLParser.COMMA)
                self.state = 764
                self.expr()
                self.state = 769
                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, 118, self.RULE_windowSortSpecList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 770
            self.match(PartiQLParser.ORDER)
            self.state = 771
            self.match(PartiQLParser.BY)
            self.state = 772
            self.orderSortSpec()
            self.state = 777
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 773
                self.match(PartiQLParser.COMMA)
                self.state = 774
                self.orderSortSpec()
                self.state = 779
                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, 120, self.RULE_havingClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 780
            self.match(PartiQLParser.HAVING)
            self.state = 781
            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, 122, self.RULE_excludeClause)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 783
            self.match(PartiQLParser.EXCLUDE)
            self.state = 784
            self.excludeExpr()
            self.state = 789
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 785
                self.match(PartiQLParser.COMMA)
                self.state = 786
                self.excludeExpr()
                self.state = 791
                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, 124, self.RULE_excludeExpr)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 792
            self.symbolPrimitive()
            self.state = 794 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 793
                self.excludeExprSteps()
                self.state = 796 
                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, 126, self.RULE_excludeExprSteps)
        try:
            self.state = 811
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,75,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.ExcludeExprTupleAttrContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 798
                self.match(PartiQLParser.PERIOD)
                self.state = 799
                self.symbolPrimitive()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.ExcludeExprCollectionAttrContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 800
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 801
                localctx.attr = self.match(PartiQLParser.LITERAL_STRING)
                self.state = 802
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 3:
                localctx = PartiQLParser.ExcludeExprCollectionIndexContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 803
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 804
                localctx.index = self.match(PartiQLParser.LITERAL_INTEGER)
                self.state = 805
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 4:
                localctx = PartiQLParser.ExcludeExprCollectionWildcardContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 806
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 807
                self.match(PartiQLParser.ASTERISK)
                self.state = 808
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 5:
                localctx = PartiQLParser.ExcludeExprTupleWildcardContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 809
                self.match(PartiQLParser.PERIOD)
                self.state = 810
                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, 128, self.RULE_fromClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 813
            self.match(PartiQLParser.FROM)
            self.state = 814
            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, 130, self.RULE_whereClauseSelect)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 816
            self.match(PartiQLParser.WHERE)
            self.state = 817
            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, 132, self.RULE_offsetByClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 819
            self.match(PartiQLParser.OFFSET)
            self.state = 820
            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, 134, self.RULE_limitClause)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 822
            self.match(PartiQLParser.LIMIT)
            self.state = 823
            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, 136, self.RULE_gpmlPattern)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 826
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,76,self._ctx)
            if la_ == 1:
                self.state = 825
                localctx.selector = self.matchSelector()


            self.state = 828
            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, 138, self.RULE_gpmlPatternList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 831
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==4 or _la==8 or _la==186:
                self.state = 830
                localctx.selector = self.matchSelector()


            self.state = 833
            self.matchPattern()
            self.state = 838
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 834
                self.match(PartiQLParser.COMMA)
                self.state = 835
                self.matchPattern()
                self.state = 840
                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, 140, self.RULE_matchPattern)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 842
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,79,self._ctx)
            if la_ == 1:
                self.state = 841
                localctx.restrictor = self.patternRestrictor()


            self.state = 845
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,80,self._ctx)
            if la_ == 1:
                self.state = 844
                localctx.variable = self.patternPathVariable()


            self.state = 850
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,81,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 847
                    self.graphPart() 
                self.state = 852
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,81,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, 142, self.RULE_graphPart)
        try:
            self.state = 856
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,82,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 853
                self.node()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 854
                self.edge()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 855
                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, 144, self.RULE_matchSelector)
        self._la = 0 # Token type
        try:
            self.state = 869
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,85,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.SelectorBasicContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 858
                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 = 859
                self.match(PartiQLParser.SHORTEST)
                pass

            elif la_ == 2:
                localctx = PartiQLParser.SelectorAnyContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 860
                self.match(PartiQLParser.ANY)
                self.state = 862
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,83,self._ctx)
                if la_ == 1:
                    self.state = 861
                    localctx.k = self.match(PartiQLParser.LITERAL_INTEGER)


                pass

            elif la_ == 3:
                localctx = PartiQLParser.SelectorShortestContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 864
                self.match(PartiQLParser.SHORTEST)
                self.state = 865
                localctx.k = self.match(PartiQLParser.LITERAL_INTEGER)
                self.state = 867
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,84,self._ctx)
                if la_ == 1:
                    self.state = 866
                    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, 146, self.RULE_patternPathVariable)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 871
            self.symbolPrimitive()
            self.state = 872
            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, 148, self.RULE_patternRestrictor)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 874
            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, 150, self.RULE_node)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 876
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 878
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==303 or _la==304:
                self.state = 877
                self.symbolPrimitive()


            self.state = 882
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==296:
                self.state = 880
                self.match(PartiQLParser.COLON)
                self.state = 881
                self.labelSpec(0)


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


            self.state = 887
            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, 152, self.RULE_edge)
        try:
            self.state = 897
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,91,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.EdgeWithSpecContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 889
                self.edgeWSpec()
                self.state = 891
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,89,self._ctx)
                if la_ == 1:
                    self.state = 890
                    localctx.quantifier = self.patternQuantifier()


                pass

            elif la_ == 2:
                localctx = PartiQLParser.EdgeAbbreviatedContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 893
                self.edgeAbbrev()
                self.state = 895
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,90,self._ctx)
                if la_ == 1:
                    self.state = 894
                    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, 154, self.RULE_pattern)
        self._la = 0 # Token type
        try:
            self.state = 937
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [294]:
                self.enterOuterAlt(localctx, 1)
                self.state = 899
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 901
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,92,self._ctx)
                if la_ == 1:
                    self.state = 900
                    localctx.restrictor = self.patternRestrictor()


                self.state = 904
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==303 or _la==304:
                    self.state = 903
                    localctx.variable = self.patternPathVariable()


                self.state = 907 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 906
                    self.graphPart()
                    self.state = 909 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (((((_la - 272)) & ~0x3f) == 0 and ((1 << (_la - 272)) & 4472849) != 0)):
                        break

                self.state = 912
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==225:
                    self.state = 911
                    localctx.where = self.whereClause()


                self.state = 914
                self.match(PartiQLParser.PAREN_RIGHT)
                self.state = 916
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,96,self._ctx)
                if la_ == 1:
                    self.state = 915
                    localctx.quantifier = self.patternQuantifier()


                pass
            elif token in [290]:
                self.enterOuterAlt(localctx, 2)
                self.state = 918
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 920
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,97,self._ctx)
                if la_ == 1:
                    self.state = 919
                    localctx.restrictor = self.patternRestrictor()


                self.state = 923
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==303 or _la==304:
                    self.state = 922
                    localctx.variable = self.patternPathVariable()


                self.state = 926 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 925
                    self.graphPart()
                    self.state = 928 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (((((_la - 272)) & ~0x3f) == 0 and ((1 << (_la - 272)) & 4472849) != 0)):
                        break

                self.state = 931
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==225:
                    self.state = 930
                    localctx.where = self.whereClause()


                self.state = 933
                self.match(PartiQLParser.BRACKET_RIGHT)
                self.state = 935
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,101,self._ctx)
                if la_ == 1:
                    self.state = 934
                    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, 156, self.RULE_patternQuantifier)
        self._la = 0 # Token type
        try:
            self.state = 947
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [271, 277]:
                self.enterOuterAlt(localctx, 1)
                self.state = 939
                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 = 940
                self.match(PartiQLParser.BRACE_LEFT)
                self.state = 941
                localctx.lower = self.match(PartiQLParser.LITERAL_INTEGER)
                self.state = 942
                self.match(PartiQLParser.COMMA)
                self.state = 944
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==301:
                    self.state = 943
                    localctx.upper = self.match(PartiQLParser.LITERAL_INTEGER)


                self.state = 946
                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, 158, self.RULE_edgeWSpec)
        try:
            self.state = 983
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,105,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.EdgeSpecRightContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 949
                self.match(PartiQLParser.MINUS)
                self.state = 950
                self.edgeSpec()
                self.state = 951
                self.match(PartiQLParser.MINUS)
                self.state = 952
                self.match(PartiQLParser.ANGLE_RIGHT)
                pass

            elif la_ == 2:
                localctx = PartiQLParser.EdgeSpecUndirectedContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 954
                self.match(PartiQLParser.TILDE)
                self.state = 955
                self.edgeSpec()
                self.state = 956
                self.match(PartiQLParser.TILDE)
                pass

            elif la_ == 3:
                localctx = PartiQLParser.EdgeSpecLeftContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 958
                self.match(PartiQLParser.ANGLE_LEFT)
                self.state = 959
                self.match(PartiQLParser.MINUS)
                self.state = 960
                self.edgeSpec()
                self.state = 961
                self.match(PartiQLParser.MINUS)
                pass

            elif la_ == 4:
                localctx = PartiQLParser.EdgeSpecUndirectedRightContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 963
                self.match(PartiQLParser.TILDE)
                self.state = 964
                self.edgeSpec()
                self.state = 965
                self.match(PartiQLParser.TILDE)
                self.state = 966
                self.match(PartiQLParser.ANGLE_RIGHT)
                pass

            elif la_ == 5:
                localctx = PartiQLParser.EdgeSpecUndirectedLeftContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 968
                self.match(PartiQLParser.ANGLE_LEFT)
                self.state = 969
                self.match(PartiQLParser.TILDE)
                self.state = 970
                self.edgeSpec()
                self.state = 971
                self.match(PartiQLParser.TILDE)
                pass

            elif la_ == 6:
                localctx = PartiQLParser.EdgeSpecBidirectionalContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 973
                self.match(PartiQLParser.ANGLE_LEFT)
                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_ == 7:
                localctx = PartiQLParser.EdgeSpecUndirectedBidirectionalContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 979
                self.match(PartiQLParser.MINUS)
                self.state = 980
                self.edgeSpec()
                self.state = 981
                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, 160, self.RULE_edgeSpec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 985
            self.match(PartiQLParser.BRACKET_LEFT)
            self.state = 987
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==303 or _la==304:
                self.state = 986
                self.symbolPrimitive()


            self.state = 991
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==296:
                self.state = 989
                self.match(PartiQLParser.COLON)
                self.state = 990
                self.labelSpec(0)


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


            self.state = 996
            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 = 162
        self.enterRecursionRule(localctx, 162, self.RULE_labelSpec, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = PartiQLParser.LabelSpecTermContext(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 999
            self.labelTerm(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 1006
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,109,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 = 1001
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1002
                    self.match(PartiQLParser.VERTBAR)
                    self.state = 1003
                    self.labelTerm(0) 
                self.state = 1008
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,109,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 = 164
        self.enterRecursionRule(localctx, 164, self.RULE_labelTerm, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = PartiQLParser.LabelTermFactorContext(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 1010
            self.labelFactor()
            self._ctx.stop = self._input.LT(-1)
            self.state = 1017
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,110,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 = 1012
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1013
                    self.match(PartiQLParser.AMPERSAND)
                    self.state = 1014
                    self.labelFactor() 
                self.state = 1019
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,110,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, 166, self.RULE_labelFactor)
        try:
            self.state = 1023
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [280]:
                localctx = PartiQLParser.LabelFactorNotContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1020
                self.match(PartiQLParser.BANG)
                self.state = 1021
                self.labelPrimary()
                pass
            elif token in [274, 294, 303, 304]:
                localctx = PartiQLParser.LabelFactorPrimaryContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1022
                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, 168, self.RULE_labelPrimary)
        try:
            self.state = 1031
            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 = 1025
                self.symbolPrimitive()
                pass
            elif token in [274]:
                localctx = PartiQLParser.LabelPrimaryWildContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1026
                self.match(PartiQLParser.PERCENT)
                pass
            elif token in [294]:
                localctx = PartiQLParser.LabelPrimaryParenContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1027
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1028
                self.labelSpec(0)
                self.state = 1029
                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, 170, self.RULE_edgeAbbrev)
        self._la = 0 # Token type
        try:
            self.state = 1045
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,115,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 1033
                self.match(PartiQLParser.TILDE)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 1034
                self.match(PartiQLParser.TILDE)
                self.state = 1035
                self.match(PartiQLParser.ANGLE_RIGHT)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 1036
                self.match(PartiQLParser.ANGLE_LEFT)
                self.state = 1037
                self.match(PartiQLParser.TILDE)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 1039
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==286:
                    self.state = 1038
                    self.match(PartiQLParser.ANGLE_LEFT)


                self.state = 1041
                self.match(PartiQLParser.MINUS)
                self.state = 1043
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,114,self._ctx)
                if la_ == 1:
                    self.state = 1042
                    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 = 172
        self.enterRecursionRule(localctx, 172, self.RULE_tableReference, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1053
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,116,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.TableRefBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 1048
                self.tableNonJoin()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.TableWrappedContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1049
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1050
                self.tableReference(0)
                self.state = 1051
                self.match(PartiQLParser.PAREN_RIGHT)
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 1075
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,120,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 = 1073
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,119,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 = 1055
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 1057
                        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 = 1056
                            self.joinType()


                        self.state = 1059
                        self.match(PartiQLParser.CROSS)
                        self.state = 1060
                        self.match(PartiQLParser.JOIN)
                        self.state = 1061
                        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 = 1062
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 1063
                        self.match(PartiQLParser.COMMA)
                        self.state = 1064
                        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 = 1065
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 1067
                        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 = 1066
                            self.joinType()


                        self.state = 1069
                        self.match(PartiQLParser.JOIN)
                        self.state = 1070
                        localctx.rhs = self.joinRhs()
                        self.state = 1071
                        self.joinSpec()
                        pass

             
                self.state = 1077
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,120,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, 174, self.RULE_tableNonJoin)
        try:
            self.state = 1080
            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 = 1078
                self.tableBaseReference()
                pass
            elif token in [238]:
                self.enterOuterAlt(localctx, 2)
                self.state = 1079
                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, 176, self.RULE_tableBaseReference)
        try:
            self.state = 1105
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,128,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.TableBaseRefSymbolContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1082
                localctx.source = self.exprSelect()
                self.state = 1083
                self.symbolPrimitive()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.TableBaseRefClausesContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1085
                localctx.source = self.exprSelect()
                self.state = 1087
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,122,self._ctx)
                if la_ == 1:
                    self.state = 1086
                    self.asIdent()


                self.state = 1090
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,123,self._ctx)
                if la_ == 1:
                    self.state = 1089
                    self.atIdent()


                self.state = 1093
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,124,self._ctx)
                if la_ == 1:
                    self.state = 1092
                    self.byIdent()


                pass

            elif la_ == 3:
                localctx = PartiQLParser.TableBaseRefMatchContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1095
                localctx.source = self.exprGraphMatchOne()
                self.state = 1097
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,125,self._ctx)
                if la_ == 1:
                    self.state = 1096
                    self.asIdent()


                self.state = 1100
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,126,self._ctx)
                if la_ == 1:
                    self.state = 1099
                    self.atIdent()


                self.state = 1103
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,127,self._ctx)
                if la_ == 1:
                    self.state = 1102
                    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, 178, self.RULE_tableUnpivot)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1107
            self.match(PartiQLParser.UNPIVOT)
            self.state = 1108
            self.expr()
            self.state = 1110
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,129,self._ctx)
            if la_ == 1:
                self.state = 1109
                self.asIdent()


            self.state = 1113
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,130,self._ctx)
            if la_ == 1:
                self.state = 1112
                self.atIdent()


            self.state = 1116
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,131,self._ctx)
            if la_ == 1:
                self.state = 1115
                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, 180, self.RULE_joinRhs)
        try:
            self.state = 1123
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,132,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.JoinRhsBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1118
                self.tableNonJoin()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.JoinRhsTableJoinedContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1119
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1120
                self.tableReference(0)
                self.state = 1121
                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, 182, self.RULE_joinSpec)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1125
            self.match(PartiQLParser.ON)
            self.state = 1126
            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, 184, self.RULE_joinType)
        self._la = 0 # Token type
        try:
            self.state = 1142
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [109]:
                self.enterOuterAlt(localctx, 1)
                self.state = 1128
                localctx.mod = self.match(PartiQLParser.INNER)
                pass
            elif token in [125]:
                self.enterOuterAlt(localctx, 2)
                self.state = 1129
                localctx.mod = self.match(PartiQLParser.LEFT)
                self.state = 1131
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==153:
                    self.state = 1130
                    self.match(PartiQLParser.OUTER)


                pass
            elif token in [176]:
                self.enterOuterAlt(localctx, 3)
                self.state = 1133
                localctx.mod = self.match(PartiQLParser.RIGHT)
                self.state = 1135
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==153:
                    self.state = 1134
                    self.match(PartiQLParser.OUTER)


                pass
            elif token in [96]:
                self.enterOuterAlt(localctx, 4)
                self.state = 1137
                localctx.mod = self.match(PartiQLParser.FULL)
                self.state = 1139
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==153:
                    self.state = 1138
                    self.match(PartiQLParser.OUTER)


                pass
            elif token in [153]:
                self.enterOuterAlt(localctx, 5)
                self.state = 1141
                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, 186, self.RULE_expr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1144
            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 = 188
        self.enterRecursionRule(localctx, 188, 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 = 1147
            self.exprSelect()
            self._ctx.stop = self._input.LT(-1)
            self.state = 1178
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,144,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 = 1176
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,143,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 = 1149
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 1151
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==153:
                            self.state = 1150
                            self.match(PartiQLParser.OUTER)


                        self.state = 1153
                        self.match(PartiQLParser.EXCEPT)
                        self.state = 1155
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==4 or _la==67:
                            self.state = 1154
                            _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 = 1157
                        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 = 1158
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 1160
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==153:
                            self.state = 1159
                            self.match(PartiQLParser.OUTER)


                        self.state = 1162
                        self.match(PartiQLParser.UNION)
                        self.state = 1164
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==4 or _la==67:
                            self.state = 1163
                            _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 = 1166
                        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 = 1167
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 1169
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==153:
                            self.state = 1168
                            self.match(PartiQLParser.OUTER)


                        self.state = 1171
                        self.match(PartiQLParser.INTERSECT)
                        self.state = 1173
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==4 or _la==67:
                            self.state = 1172
                            _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 = 1175
                        localctx.rhs = self.exprSelect()
                        pass

             
                self.state = 1180
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,144,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, 190, self.RULE_exprSelect)
        self._la = 0 # Token type
        try:
            self.state = 1208
            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 = 1181
                localctx.select = self.selectClause()
                self.state = 1183
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==78:
                    self.state = 1182
                    localctx.exclude = self.excludeClause()


                self.state = 1185
                localctx.from_ = self.fromClause()
                self.state = 1187
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,146,self._ctx)
                if la_ == 1:
                    self.state = 1186
                    localctx.let = self.letClause()


                self.state = 1190
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,147,self._ctx)
                if la_ == 1:
                    self.state = 1189
                    localctx.where = self.whereClauseSelect()


                self.state = 1193
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,148,self._ctx)
                if la_ == 1:
                    self.state = 1192
                    localctx.group = self.groupClause()


                self.state = 1196
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,149,self._ctx)
                if la_ == 1:
                    self.state = 1195
                    localctx.having = self.havingClause()


                self.state = 1199
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,150,self._ctx)
                if la_ == 1:
                    self.state = 1198
                    localctx.order = self.orderByClause()


                self.state = 1202
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,151,self._ctx)
                if la_ == 1:
                    self.state = 1201
                    localctx.limit = self.limitClause()


                self.state = 1205
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,152,self._ctx)
                if la_ == 1:
                    self.state = 1204
                    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 = 1207
                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 = 192
        self.enterRecursionRule(localctx, 192, self.RULE_exprOr, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = PartiQLParser.ExprOrBaseContext(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 1211
            localctx.parent_ = self.exprAnd(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 1218
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,154,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 = 1213
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1214
                    self.match(PartiQLParser.OR)
                    self.state = 1215
                    localctx.rhs = self.exprAnd(0) 
                self.state = 1220
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,154,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 = 194
        self.enterRecursionRule(localctx, 194, self.RULE_exprAnd, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = PartiQLParser.ExprAndBaseContext(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 1222
            localctx.parent_ = self.exprNot()
            self._ctx.stop = self._input.LT(-1)
            self.state = 1229
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,155,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 = 1224
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1225
                    localctx.op = self.match(PartiQLParser.AND)
                    self.state = 1226
                    localctx.rhs = self.exprNot() 
                self.state = 1231
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,155,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, 196, self.RULE_exprNot)
        try:
            self.state = 1235
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [140]:
                localctx = PartiQLParser.NotContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1232
                localctx.op = self.match(PartiQLParser.NOT)
                self.state = 1233
                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 = 1234
                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 = 198
        self.enterRecursionRule(localctx, 198, 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 = 1238
            localctx.parent_ = self.mathOp00(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 1285
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,164,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 = 1283
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,163,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 = 1240
                        if not self.precpred(self._ctx, 7):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 7)")
                        self.state = 1241
                        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 = 1242
                        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 = 1243
                        if not self.precpred(self._ctx, 6):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
                        self.state = 1244
                        self.match(PartiQLParser.IS)
                        self.state = 1246
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==140:
                            self.state = 1245
                            self.match(PartiQLParser.NOT)


                        self.state = 1248
                        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 = 1249
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 1251
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==140:
                            self.state = 1250
                            self.match(PartiQLParser.NOT)


                        self.state = 1253
                        self.match(PartiQLParser.IN)
                        self.state = 1254
                        self.match(PartiQLParser.PAREN_LEFT)
                        self.state = 1255
                        self.expr()
                        self.state = 1256
                        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 = 1258
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 1260
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==140:
                            self.state = 1259
                            self.match(PartiQLParser.NOT)


                        self.state = 1262
                        self.match(PartiQLParser.IN)
                        self.state = 1263
                        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 = 1264
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 1266
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==140:
                            self.state = 1265
                            self.match(PartiQLParser.NOT)


                        self.state = 1268
                        self.match(PartiQLParser.LIKE)
                        self.state = 1269
                        localctx.rhs = self.mathOp00(0)
                        self.state = 1272
                        self._errHandler.sync(self)
                        la_ = self._interp.adaptivePredict(self._input,161,self._ctx)
                        if la_ == 1:
                            self.state = 1270
                            self.match(PartiQLParser.ESCAPE)
                            self.state = 1271
                            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 = 1274
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        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.BETWEEN)
                        self.state = 1279
                        localctx.lower = self.mathOp00(0)
                        self.state = 1280
                        self.match(PartiQLParser.AND)
                        self.state = 1281
                        localctx.upper = self.mathOp00(0)
                        pass

             
                self.state = 1287
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,164,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 = 200
        self.enterRecursionRule(localctx, 200, self.RULE_mathOp00, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1289
            localctx.parent_ = self.mathOp01(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 1296
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,165,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 = 1291
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1292
                    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 = 1293
                    localctx.rhs = self.mathOp01(0) 
                self.state = 1298
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,165,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 = 202
        self.enterRecursionRule(localctx, 202, self.RULE_mathOp01, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1300
            localctx.parent_ = self.mathOp02(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 1307
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,166,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 = 1302
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1303
                    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 = 1304
                    localctx.rhs = self.mathOp02(0) 
                self.state = 1309
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,166,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 = 204
        self.enterRecursionRule(localctx, 204, self.RULE_mathOp02, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1311
            localctx.parent_ = self.valueExpr()
            self._ctx.stop = self._input.LT(-1)
            self.state = 1318
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,167,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 = 1313
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 1314
                    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 = 1315
                    localctx.rhs = self.valueExpr() 
                self.state = 1320
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,167,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, 206, self.RULE_valueExpr)
        self._la = 0 # Token type
        try:
            self.state = 1324
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [271, 272]:
                self.enterOuterAlt(localctx, 1)
                self.state = 1321
                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 = 1322
                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 = 1323
                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 = 208
        self.enterRecursionRule(localctx, 208, self.RULE_exprPrimary, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1347
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,169,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 1327
                self.exprTerm()
                pass

            elif la_ == 2:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1328
                self.cast()
                pass

            elif la_ == 3:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1329
                self.sequenceConstructor()
                pass

            elif la_ == 4:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1330
                self.substring()
                pass

            elif la_ == 5:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1331
                self.position()
                pass

            elif la_ == 6:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1332
                self.overlay()
                pass

            elif la_ == 7:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1333
                self.canCast()
                pass

            elif la_ == 8:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1334
                self.canLosslessCast()
                pass

            elif la_ == 9:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1335
                self.extract()
                pass

            elif la_ == 10:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1336
                self.coalesce()
                pass

            elif la_ == 11:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1337
                self.dateFunction()
                pass

            elif la_ == 12:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1338
                self.aggregate()
                pass

            elif la_ == 13:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1339
                self.trimFunction()
                pass

            elif la_ == 14:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1340
                self.functionCall()
                pass

            elif la_ == 15:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1341
                self.nullIf()
                pass

            elif la_ == 16:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1342
                self.exprGraphMatchMany()
                pass

            elif la_ == 17:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1343
                self.caseExpr()
                pass

            elif la_ == 18:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1344
                self.valueList()
                pass

            elif la_ == 19:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1345
                self.values()
                pass

            elif la_ == 20:
                localctx = PartiQLParser.ExprPrimaryBaseContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 1346
                self.windowFunction()
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 1357
            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.ExprPrimaryPathContext(self, PartiQLParser.ExprPrimaryContext(self, _parentctx, _parentState))
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_exprPrimary)
                    self.state = 1349
                    if not self.precpred(self._ctx, 6):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
                    self.state = 1351 
                    self._errHandler.sync(self)
                    _alt = 1
                    while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                        if _alt == 1:
                            self.state = 1350
                            self.pathStep()

                        else:
                            raise NoViableAltException(self)
                        self.state = 1353 
                        self._errHandler.sync(self)
                        _alt = self._interp.adaptivePredict(self._input,170,self._ctx)
             
                self.state = 1359
                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 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, 210, self.RULE_exprTerm)
        try:
            self.state = 1371
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [294]:
                localctx = PartiQLParser.ExprTermWrappedQueryContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1360
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1361
                self.expr()
                self.state = 1362
                self.match(PartiQLParser.PAREN_RIGHT)
                pass
            elif token in [51]:
                localctx = PartiQLParser.ExprTermCurrentUserContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1364
                self.match(PartiQLParser.CURRENT_USER)
                pass
            elif token in [48]:
                localctx = PartiQLParser.ExprTermCurrentDateContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1365
                self.match(PartiQLParser.CURRENT_DATE)
                pass
            elif token in [298]:
                localctx = PartiQLParser.ExprTermBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 1366
                self.parameter()
                pass
            elif token in [79, 275, 303, 304]:
                localctx = PartiQLParser.ExprTermBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 1367
                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 = 1368
                self.literal()
                pass
            elif token in [288, 290]:
                localctx = PartiQLParser.ExprTermBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 1369
                self.collection()
                pass
            elif token in [292]:
                localctx = PartiQLParser.ExprTermBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 8)
                self.state = 1370
                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, 212, self.RULE_nullIf)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1373
            self.match(PartiQLParser.NULLIF)
            self.state = 1374
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1375
            self.expr()
            self.state = 1376
            self.match(PartiQLParser.COMMA)
            self.state = 1377
            self.expr()
            self.state = 1378
            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, 214, self.RULE_coalesce)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1380
            self.match(PartiQLParser.COALESCE)
            self.state = 1381
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1382
            self.expr()
            self.state = 1387
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 1383
                self.match(PartiQLParser.COMMA)
                self.state = 1384
                self.expr()
                self.state = 1389
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 1390
            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, 216, self.RULE_caseExpr)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1392
            self.match(PartiQLParser.CASE)
            self.state = 1394
            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 = 1393
                localctx.case = self.expr()


            self.state = 1401 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 1396
                self.match(PartiQLParser.WHEN)
                self.state = 1397
                localctx._expr = self.expr()
                localctx.whens.append(localctx._expr)
                self.state = 1398
                self.match(PartiQLParser.THEN)
                self.state = 1399
                localctx._expr = self.expr()
                localctx.thens.append(localctx._expr)
                self.state = 1403 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==223):
                    break

            self.state = 1407
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==71:
                self.state = 1405
                self.match(PartiQLParser.ELSE)
                self.state = 1406
                localctx.else_ = self.expr()


            self.state = 1409
            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, 218, self.RULE_values)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1411
            self.match(PartiQLParser.VALUES)
            self.state = 1412
            self.valueRow()
            self.state = 1417
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,177,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 1413
                    self.match(PartiQLParser.COMMA)
                    self.state = 1414
                    self.valueRow() 
                self.state = 1419
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,177,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, 220, self.RULE_valueRow)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1420
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1421
            self.expr()
            self.state = 1426
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==270:
                self.state = 1422
                self.match(PartiQLParser.COMMA)
                self.state = 1423
                self.expr()
                self.state = 1428
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 1429
            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, 222, self.RULE_valueList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1431
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1432
            self.expr()
            self.state = 1435 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 1433
                self.match(PartiQLParser.COMMA)
                self.state = 1434
                self.expr()
                self.state = 1437 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==270):
                    break

            self.state = 1439
            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, 224, self.RULE_sequenceConstructor)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1441
            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 = 1442
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1451
            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 = 1443
                self.expr()
                self.state = 1448
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 1444
                    self.match(PartiQLParser.COMMA)
                    self.state = 1445
                    self.expr()
                    self.state = 1450
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 1453
            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, 226, self.RULE_substring)
        self._la = 0 # Token type
        try:
            self.state = 1481
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,186,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 1455
                self.match(PartiQLParser.SUBSTRING)
                self.state = 1456
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1457
                self.expr()
                self.state = 1464
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==270:
                    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 _la==270:
                        self.state = 1460
                        self.match(PartiQLParser.COMMA)
                        self.state = 1461
                        self.expr()




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

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 1468
                self.match(PartiQLParser.SUBSTRING)
                self.state = 1469
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1470
                self.expr()
                self.state = 1477
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==95:
                    self.state = 1471
                    self.match(PartiQLParser.FROM)
                    self.state = 1472
                    self.expr()
                    self.state = 1475
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==92:
                        self.state = 1473
                        self.match(PartiQLParser.FOR)
                        self.state = 1474
                        self.expr()




                self.state = 1479
                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, 228, self.RULE_position)
        try:
            self.state = 1497
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,187,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 1483
                self.match(PartiQLParser.POSITION)
                self.state = 1484
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1485
                self.expr()
                self.state = 1486
                self.match(PartiQLParser.COMMA)
                self.state = 1487
                self.expr()
                self.state = 1488
                self.match(PartiQLParser.PAREN_RIGHT)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 1490
                self.match(PartiQLParser.POSITION)
                self.state = 1491
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1492
                self.expr()
                self.state = 1493
                self.match(PartiQLParser.IN)
                self.state = 1494
                self.expr()
                self.state = 1495
                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, 230, self.RULE_overlay)
        self._la = 0 # Token type
        try:
            self.state = 1525
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,190,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 1499
                self.match(PartiQLParser.OVERLAY)
                self.state = 1500
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1501
                self.expr()
                self.state = 1502
                self.match(PartiQLParser.COMMA)
                self.state = 1503
                self.expr()
                self.state = 1504
                self.match(PartiQLParser.COMMA)
                self.state = 1505
                self.expr()
                self.state = 1508
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==270:
                    self.state = 1506
                    self.match(PartiQLParser.COMMA)
                    self.state = 1507
                    self.expr()


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

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 1512
                self.match(PartiQLParser.OVERLAY)
                self.state = 1513
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1514
                self.expr()
                self.state = 1515
                self.match(PartiQLParser.PLACING)
                self.state = 1516
                self.expr()
                self.state = 1517
                self.match(PartiQLParser.FROM)
                self.state = 1518
                self.expr()
                self.state = 1521
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==92:
                    self.state = 1519
                    self.match(PartiQLParser.FOR)
                    self.state = 1520
                    self.expr()


                self.state = 1523
                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, 232, self.RULE_aggregate)
        self._la = 0 # Token type
        try:
            self.state = 1539
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,192,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.CountAllContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1527
                localctx.func = self.match(PartiQLParser.COUNT)
                self.state = 1528
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1529
                self.match(PartiQLParser.ASTERISK)
                self.state = 1530
                self.match(PartiQLParser.PAREN_RIGHT)
                pass

            elif la_ == 2:
                localctx = PartiQLParser.AggregateBaseContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1531
                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 = 1532
                self.match(PartiQLParser.PAREN_LEFT)
                self.state = 1534
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==4 or _la==67:
                    self.state = 1533
                    self.setQuantifierStrategy()


                self.state = 1536
                self.expr()
                self.state = 1537
                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, 234, self.RULE_windowFunction)
        self._la = 0 # Token type
        try:
            localctx = PartiQLParser.LagLeadFunctionContext(self, localctx)
            self.enterOuterAlt(localctx, 1)
            self.state = 1541
            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 = 1542
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1543
            self.expr()
            self.state = 1550
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==270:
                self.state = 1544
                self.match(PartiQLParser.COMMA)
                self.state = 1545
                self.expr()
                self.state = 1548
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==270:
                    self.state = 1546
                    self.match(PartiQLParser.COMMA)
                    self.state = 1547
                    self.expr()




            self.state = 1552
            self.match(PartiQLParser.PAREN_RIGHT)
            self.state = 1553
            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, 236, self.RULE_cast)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1555
            self.match(PartiQLParser.CAST)
            self.state = 1556
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1557
            self.expr()
            self.state = 1558
            self.match(PartiQLParser.AS)
            self.state = 1559
            self.type_()
            self.state = 1560
            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, 238, self.RULE_canLosslessCast)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1562
            self.match(PartiQLParser.CAN_LOSSLESS_CAST)
            self.state = 1563
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1564
            self.expr()
            self.state = 1565
            self.match(PartiQLParser.AS)
            self.state = 1566
            self.type_()
            self.state = 1567
            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, 240, self.RULE_canCast)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1569
            self.match(PartiQLParser.CAN_CAST)
            self.state = 1570
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1571
            self.expr()
            self.state = 1572
            self.match(PartiQLParser.AS)
            self.state = 1573
            self.type_()
            self.state = 1574
            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, 242, self.RULE_extract)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1576
            self.match(PartiQLParser.EXTRACT)
            self.state = 1577
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1578
            self.match(PartiQLParser.IDENTIFIER)
            self.state = 1579
            self.match(PartiQLParser.FROM)
            self.state = 1580
            localctx.rhs = self.expr()
            self.state = 1581
            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, 244, self.RULE_trimFunction)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1583
            localctx.func = self.match(PartiQLParser.TRIM)
            self.state = 1584
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1592
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,197,self._ctx)
            if la_ == 1:
                self.state = 1586
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,195,self._ctx)
                if la_ == 1:
                    self.state = 1585
                    localctx.mod = self.match(PartiQLParser.IDENTIFIER)


                self.state = 1589
                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 = 1588
                    localctx.sub = self.expr()


                self.state = 1591
                self.match(PartiQLParser.FROM)


            self.state = 1594
            localctx.target = self.expr()
            self.state = 1595
            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, 246, self.RULE_dateFunction)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1597
            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 = 1598
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1599
            localctx.dt = self.match(PartiQLParser.IDENTIFIER)
            self.state = 1600
            self.match(PartiQLParser.COMMA)
            self.state = 1601
            self.expr()
            self.state = 1602
            self.match(PartiQLParser.COMMA)
            self.state = 1603
            self.expr()
            self.state = 1604
            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, 248, self.RULE_functionCall)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1606
            self.functionName()
            self.state = 1607
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1616
            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 = 1608
                self.expr()
                self.state = 1613
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 1609
                    self.match(PartiQLParser.COMMA)
                    self.state = 1610
                    self.expr()
                    self.state = 1615
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 1618
            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, 250, self.RULE_functionName)
        self._la = 0 # Token type
        try:
            self.state = 1638
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,202,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.FunctionNameReservedContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1625
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==303 or _la==304:
                    self.state = 1620
                    localctx._symbolPrimitive = self.symbolPrimitive()
                    localctx.qualifier.append(localctx._symbolPrimitive)
                    self.state = 1621
                    self.match(PartiQLParser.PERIOD)
                    self.state = 1627
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 1628
                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 = 1634
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,201,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 1629
                        localctx._symbolPrimitive = self.symbolPrimitive()
                        localctx.qualifier.append(localctx._symbolPrimitive)
                        self.state = 1630
                        self.match(PartiQLParser.PERIOD) 
                    self.state = 1636
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,201,self._ctx)

                self.state = 1637
                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, 252, self.RULE_pathStep)
        try:
            self.state = 1651
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,203,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.PathStepIndexExprContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1640
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 1641
                localctx.key = self.expr()
                self.state = 1642
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 2:
                localctx = PartiQLParser.PathStepIndexAllContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1644
                self.match(PartiQLParser.BRACKET_LEFT)
                self.state = 1645
                localctx.all_ = self.match(PartiQLParser.ASTERISK)
                self.state = 1646
                self.match(PartiQLParser.BRACKET_RIGHT)
                pass

            elif la_ == 3:
                localctx = PartiQLParser.PathStepDotExprContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1647
                self.match(PartiQLParser.PERIOD)
                self.state = 1648
                localctx.key = self.symbolPrimitive()
                pass

            elif la_ == 4:
                localctx = PartiQLParser.PathStepDotAllContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 1649
                self.match(PartiQLParser.PERIOD)
                self.state = 1650
                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, 254, self.RULE_exprGraphMatchMany)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1653
            self.match(PartiQLParser.PAREN_LEFT)
            self.state = 1654
            self.exprPrimary(0)
            self.state = 1655
            self.match(PartiQLParser.MATCH)
            self.state = 1656
            self.gpmlPatternList()
            self.state = 1657
            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, 256, self.RULE_exprGraphMatchOne)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1659
            self.exprPrimary(0)
            self.state = 1660
            self.match(PartiQLParser.MATCH)
            self.state = 1661
            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, 258, self.RULE_parameter)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1663
            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, 260, self.RULE_varRefExpr)
        self._la = 0 # Token type
        try:
            self.state = 1673
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,206,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.VariableIdentifierContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1666
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==275:
                    self.state = 1665
                    localctx.qualifier = self.match(PartiQLParser.AT_SIGN)


                self.state = 1668
                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 = 1670
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==275:
                    self.state = 1669
                    localctx.qualifier = self.match(PartiQLParser.AT_SIGN)


                self.state = 1672
                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, 262, self.RULE_nonReservedKeywords)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1675
            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, 264, self.RULE_collection)
        try:
            self.state = 1679
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [290]:
                self.enterOuterAlt(localctx, 1)
                self.state = 1677
                self.array()
                pass
            elif token in [288]:
                self.enterOuterAlt(localctx, 2)
                self.state = 1678
                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, 266, self.RULE_array)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1681
            self.match(PartiQLParser.BRACKET_LEFT)
            self.state = 1690
            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 = 1682
                self.expr()
                self.state = 1687
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 1683
                    self.match(PartiQLParser.COMMA)
                    self.state = 1684
                    self.expr()
                    self.state = 1689
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 1692
            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, 268, self.RULE_bag)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1694
            self.match(PartiQLParser.ANGLE_DOUBLE_LEFT)
            self.state = 1703
            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 = 1695
                self.expr()
                self.state = 1700
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 1696
                    self.match(PartiQLParser.COMMA)
                    self.state = 1697
                    self.expr()
                    self.state = 1702
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 1705
            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, 270, self.RULE_tuple)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1707
            self.match(PartiQLParser.BRACE_LEFT)
            self.state = 1716
            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 = 1708
                self.pair()
                self.state = 1713
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==270:
                    self.state = 1709
                    self.match(PartiQLParser.COMMA)
                    self.state = 1710
                    self.pair()
                    self.state = 1715
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)



            self.state = 1718
            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, 272, self.RULE_pair)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 1720
            localctx.lhs = self.expr()
            self.state = 1721
            self.match(PartiQLParser.COLON)
            self.state = 1722
            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, 274, self.RULE_literal)
        self._la = 0 # Token type
        try:
            self.state = 1758
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [141]:
                localctx = PartiQLParser.LiteralNullContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1724
                self.match(PartiQLParser.NULL)
                pass
            elif token in [236]:
                localctx = PartiQLParser.LiteralMissingContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 1725
                self.match(PartiQLParser.MISSING)
                pass
            elif token in [208]:
                localctx = PartiQLParser.LiteralTrueContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1726
                self.match(PartiQLParser.TRUE)
                pass
            elif token in [88]:
                localctx = PartiQLParser.LiteralFalseContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 1727
                self.match(PartiQLParser.FALSE)
                pass
            elif token in [300]:
                localctx = PartiQLParser.LiteralStringContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 1728
                self.match(PartiQLParser.LITERAL_STRING)
                pass
            elif token in [301]:
                localctx = PartiQLParser.LiteralIntegerContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 1729
                self.match(PartiQLParser.LITERAL_INTEGER)
                pass
            elif token in [302]:
                localctx = PartiQLParser.LiteralDecimalContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 1730
                self.match(PartiQLParser.LITERAL_DECIMAL)
                pass
            elif token in [309]:
                localctx = PartiQLParser.LiteralIonContext(self, localctx)
                self.enterOuterAlt(localctx, 8)
                self.state = 1731
                self.match(PartiQLParser.ION_CLOSURE)
                pass
            elif token in [53]:
                localctx = PartiQLParser.LiteralDateContext(self, localctx)
                self.enterOuterAlt(localctx, 9)
                self.state = 1732
                self.match(PartiQLParser.DATE)
                self.state = 1733
                self.match(PartiQLParser.LITERAL_STRING)
                pass
            elif token in [201]:
                localctx = PartiQLParser.LiteralTimeContext(self, localctx)
                self.enterOuterAlt(localctx, 10)
                self.state = 1734
                self.match(PartiQLParser.TIME)
                self.state = 1738
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==294:
                    self.state = 1735
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1736
                    self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1737
                    self.match(PartiQLParser.PAREN_RIGHT)


                self.state = 1743
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==226:
                    self.state = 1740
                    self.match(PartiQLParser.WITH)
                    self.state = 1741
                    self.match(PartiQLParser.TIME)
                    self.state = 1742
                    self.match(PartiQLParser.ZONE)


                self.state = 1745
                self.match(PartiQLParser.LITERAL_STRING)
                pass
            elif token in [202]:
                localctx = PartiQLParser.LiteralTimestampContext(self, localctx)
                self.enterOuterAlt(localctx, 11)
                self.state = 1746
                self.match(PartiQLParser.TIMESTAMP)
                self.state = 1750
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==294:
                    self.state = 1747
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1748
                    self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1749
                    self.match(PartiQLParser.PAREN_RIGHT)


                self.state = 1755
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==226:
                    self.state = 1752
                    self.match(PartiQLParser.WITH)
                    self.state = 1753
                    self.match(PartiQLParser.TIME)
                    self.state = 1754
                    self.match(PartiQLParser.ZONE)


                self.state = 1757
                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, 276, self.RULE_type)
        self._la = 0 # Token type
        try:
            self.state = 1798
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,225,self._ctx)
            if la_ == 1:
                localctx = PartiQLParser.TypeAtomicContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 1760
                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 = 1761
                localctx.datatype = self.match(PartiQLParser.DOUBLE)
                self.state = 1762
                self.match(PartiQLParser.PRECISION)
                pass

            elif la_ == 3:
                localctx = PartiQLParser.TypeArgSingleContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 1763
                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 = 1767
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,219,self._ctx)
                if la_ == 1:
                    self.state = 1764
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1765
                    localctx.arg0 = self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1766
                    self.match(PartiQLParser.PAREN_RIGHT)


                pass

            elif la_ == 4:
                localctx = PartiQLParser.TypeVarCharContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 1769
                self.match(PartiQLParser.CHARACTER)
                self.state = 1770
                self.match(PartiQLParser.VARYING)
                self.state = 1774
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,220,self._ctx)
                if la_ == 1:
                    self.state = 1771
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1772
                    localctx.arg0 = self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1773
                    self.match(PartiQLParser.PAREN_RIGHT)


                pass

            elif la_ == 5:
                localctx = PartiQLParser.TypeArgDoubleContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 1776
                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 = 1784
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,222,self._ctx)
                if la_ == 1:
                    self.state = 1777
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1778
                    localctx.arg0 = self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1781
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==270:
                        self.state = 1779
                        self.match(PartiQLParser.COMMA)
                        self.state = 1780
                        localctx.arg1 = self.match(PartiQLParser.LITERAL_INTEGER)


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


                pass

            elif la_ == 6:
                localctx = PartiQLParser.TypeTimeZoneContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 1786
                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 = 1790
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,223,self._ctx)
                if la_ == 1:
                    self.state = 1787
                    self.match(PartiQLParser.PAREN_LEFT)
                    self.state = 1788
                    localctx.precision = self.match(PartiQLParser.LITERAL_INTEGER)
                    self.state = 1789
                    self.match(PartiQLParser.PAREN_RIGHT)


                self.state = 1795
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,224,self._ctx)
                if la_ == 1:
                    self.state = 1792
                    self.match(PartiQLParser.WITH)
                    self.state = 1793
                    self.match(PartiQLParser.TIME)
                    self.state = 1794
                    self.match(PartiQLParser.ZONE)


                pass

            elif la_ == 7:
                localctx = PartiQLParser.TypeCustomContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 1797
                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[81] = self.labelSpec_sempred
        self._predicates[82] = self.labelTerm_sempred
        self._predicates[86] = self.tableReference_sempred
        self._predicates[94] = self.exprBagOp_sempred
        self._predicates[96] = self.exprOr_sempred
        self._predicates[97] = self.exprAnd_sempred
        self._predicates[99] = self.exprPredicate_sempred
        self._predicates[100] = self.mathOp00_sempred
        self._predicates[101] = self.mathOp01_sempred
        self._predicates[102] = self.mathOp02_sempred
        self._predicates[104] = 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)
         




