lava-oushudb-dt-sql-parser/lib/core/parse/generic/genericSyntaxParser.js

3348 lines
244 KiB
JavaScript
Raw Normal View History

2019-12-31 18:47:24 +08:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Licensed to Cloudera, Inc. under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. Cloudera, Inc. licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/* parser generated by jison 0.4.18 */
/*
Returns a Parser object of the following structure:
Parser: {
yy: {}
}
Parser.prototype: {
yy: {},
trace: function(),
symbols_: {associative list: name ==> number},
terminals_: {associative list: number ==> name},
productions_: [...],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
table: [...],
defaultActions: {...},
parseError: function(str, hash),
parse: function(input),
lexer: {
EOF: 1,
parseError: function(str, hash),
setInput: function(input),
input: function(),
unput: function(str),
more: function(),
less: function(n),
pastInput: function(),
upcomingInput: function(),
showPosition: function(),
test_match: function(regex_match_array, rule_index),
next: function(),
lex: function(),
begin: function(condition),
popState: function(),
_currentRules: function(),
topState: function(),
pushState: function(condition),
options: {
ranges: boolean (optional: true ==> token location info will include a .range[] member)
flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
},
performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
rules: [...],
conditions: {associative list: name ==> set},
}
}
token location info (@$, _$, etc.): {
first_line: n,
last_line: n,
first_column: n,
last_column: n,
range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
}
the parseError function receives a 'hash' object with these members for lexer and parser errors: {
text: (matched text)
token: (the produced terminal token, if any)
line: (yylineno)
}
while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
loc: (yylloc)
expected: (string describing the set of expected tokens)
recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
}
*/
const sqlParseSupport_1 = require("./sqlParseSupport");
var genericSyntaxParser = (function () {
var o = function (k, v, o, l) { for (o = o || {}, l = k.length; l--; o[k[l]] = v)
; return o; }, $V0 = [13, 20, 40, 152, 158, 167, 177, 181, 323, 333, 495, 509], $V1 = [2, 276], $V2 = [177, 181], $V3 = [2, 277], $V4 = [1, 28], $V5 = [1, 40], $V6 = [1, 36], $V7 = [1, 37], $V8 = [1, 38], $V9 = [1, 39], $Va = [1, 32], $Vb = [1, 33], $Vc = [1, 31], $Vd = [1, 29], $Ve = [73, 177, 181], $Vf = [2, 560], $Vg = [1, 46], $Vh = [1, 57], $Vi = [1, 55], $Vj = [1, 56], $Vk = [1, 52], $Vl = [1, 53], $Vm = [1, 65], $Vn = [2, 593], $Vo = [1, 67], $Vp = [1, 68], $Vq = [1, 79], $Vr = [1, 80], $Vs = [73, 177, 181, 262], $Vt = [193, 194], $Vu = [13, 28, 50, 53, 54, 69, 71, 73, 77, 87, 99, 100, 101, 104, 105, 112, 117, 121, 132, 134, 142, 157, 177, 181, 186, 187, 188, 191, 192, 193, 194, 200, 201, 202, 204, 205, 206, 207, 210, 212, 215, 216, 218, 219, 220, 223, 225, 226, 227, 228, 231, 232, 233, 234, 235, 236, 237, 240, 241, 242, 243, 246, 247, 248, 250, 252, 253, 256, 258, 259, 260, 262, 267, 269, 270, 283, 382], $Vv = [13, 105, 142, 186, 187, 188, 204], $Vw = [1, 147], $Vx = [1, 148], $Vy = [1, 111], $Vz = [1, 106], $VA = [1, 117], $VB = [1, 120], $VC = [1, 122], $VD = [1, 123], $VE = [1, 107], $VF = [1, 104], $VG = [1, 109], $VH = [1, 145], $VI = [1, 108], $VJ = [1, 133], $VK = [1, 151], $VL = [1, 112], $VM = [1, 134], $VN = [1, 141], $VO = [1, 110], $VP = [1, 150], $VQ = [1, 121], $VR = [1, 152], $VS = [1, 153], $VT = [1, 154], $VU = [1, 155], $VV = [1, 142], $VW = [1, 149], $VX = [1, 144], $VY = [1, 146], $VZ = [1, 156], $V_ = [1, 157], $V$ = [1, 158], $V01 = [53, 54, 71, 73, 87, 88, 99, 104, 105, 142, 158, 186, 187, 188, 190, 191, 192, 193, 197, 199, 203, 204, 208, 209, 211, 221, 222, 230, 238, 239, 254, 255, 257, 261, 263, 264, 265, 266, 268, 323], $V11 = [71, 77, 323], $V21 = [105, 142, 177, 181, 186, 187, 188], $V31 = [2, 433], $V41 = [1, 164], $V51 = [105, 142, 186, 187, 188, 204], $V61 = [105, 142, 177, 181, 186, 187, 188, 204, 230], $V71 = [2, 430], $V81 = [1, 169], $V91 = [73, 77, 177, 181, 225, 262], $Va1 = [2, 969], $Vb1 = [1, 223], $Vc1 = [1, 224], $Vd1 = [1, 212], $Ve1 = [1, 209], $Vf1 = [1, 210], $Vg1 = [1, 211], $Vh1 = [1, 218], $Vi1 = [1, 217], $Vj1 = [1, 208], $Vk1 = [1, 216], $Vl1 = [1, 219], $Vm1 = [1, 214], $Vn1 = [1, 213], $Vo1 = [1, 207], $Vp1 = [1, 215], $Vq1 = [1, 226], $Vr1 = [1, 225], $Vs1 = [28, 53, 54, 69, 73, 77, 87, 100, 101, 105, 121, 134, 142, 177, 181, 186, 187, 188, 191, 192, 194, 200, 201, 202, 204, 205, 212, 216, 219, 220, 225, 226, 227, 228, 231, 232, 234, 235, 236, 237, 241, 242, 243, 246, 247, 248, 250, 252, 258, 262, 269, 270, 382], $Vt1 = [1, 232], $Vu1 = [1, 238], $Vv1 = [1, 240], $Vw1 = [28, 53, 54, 69, 71, 73, 77, 87, 100, 101, 105, 121, 134, 142, 177, 181, 186, 187, 188, 191, 192, 194, 200, 201, 202, 204, 205, 212, 216, 219, 220, 225, 226, 227, 228, 231, 232, 234, 235, 236, 237, 241, 242, 243, 246, 247, 248, 250, 252, 258, 262, 269, 270, 382], $Vx1 = [1, 245], $Vy1 = [28, 50, 53, 54, 69, 71, 73, 77, 87, 100, 101, 105, 121, 134, 142, 177, 181, 186, 187, 188, 191, 192, 193, 194, 200, 201, 202, 204, 205, 212, 216, 219, 220, 225, 226, 227, 228, 231, 232, 234, 235, 236, 237, 241, 242, 243, 246, 247, 248, 250, 252, 258, 262, 269, 270, 382], $Vz1 = [28, 53, 54, 69, 73, 77, 87, 100, 101, 105, 121, 134, 142, 177, 181, 186, 187, 188, 191, 192, 194, 200, 201, 202, 204, 205, 212, 216, 219, 220, 225, 226, 227, 228, 231, 232, 234, 235, 236, 237, 241, 242, 243, 244, 246, 247, 248, 250, 252, 258, 262, 269, 270, 382], $VA1 = [28, 53, 54, 73, 77, 105, 117, 132, 142, 157, 177, 181, 186, 187, 188, 204, 212, 226, 227, 228, 232, 235, 236, 237, 240, 242, 243, 247, 252, 262, 270], $VB1 = [28, 50, 73, 77, 87, 88, 101, 177, 181, 212, 225, 226, 227, 228, 232, 235, 236, 237, 240, 242, 243, 247, 252, 262, 270], $VC1 = [177, 181, 270], $VD1 = [77, 177, 181, 225, 270], $VE1 = [50, 73, 77, 194], $VF1 = [73, 177, 181, 227, 228, 237, 242, 262], $VG1 = [2, 617], $VH1 = [1, 293], $VI1 = [88, 217, 222, 261], $VJ1 = [73, 77, 177, 181, 212, 225, 226, 227, 228, 232, 235, 236, 237, 240, 242, 243, 247, 252, 262, 270], $VK1 = [28, 53, 54, 73, 77, 87, 105, 121, 142, 177, 181, 186, 187, 188, 200, 202, 204, 205
var parser = { trace: function trace() { },
yy: {},
symbols_: { "error": 2, "DataDefinition": 3, "AlterStatement": 4, "CreateStatement": 5, "DropStatement": 6, "SetSpecification": 7, "UseStatement": 8, "DataDefinition_EDIT": 9, "AlterStatement_EDIT": 10, "CreateStatement_EDIT": 11, "DropStatement_EDIT": 12, "SET": 13, "CURSOR": 14, "UseStatement_EDIT": 15, "AlterTable": 16, "AlterView": 17, "AlterTable_EDIT": 18, "AlterView_EDIT": 19, "ALTER": 20, "AlterTableLeftSide": 21, "PartitionSpec": 22, "AlterTableLeftSide_EDIT": 23, "TABLE": 24, "SchemaQualifiedTableIdentifier": 25, "SchemaQualifiedTableIdentifier_EDIT": 26, "AlterViewLeftSide": 27, "AS": 28, "QuerySpecification": 29, "AlterViewLeftSide_EDIT": 30, "QuerySpecification_EDIT": 31, "VIEW": 32, "DatabaseDefinition": 33, "TableDefinition": 34, "ViewDefinition": 35, "RoleDefinition": 36, "DatabaseDefinition_EDIT": 37, "TableDefinition_EDIT": 38, "ViewDefinition_EDIT": 39, "CREATE": 40, "DatabaseOrSchema": 41, "OptionalIfNotExists": 42, "RegularIdentifier": 43, "DatabaseDefinitionOptionals": 44, "OptionalIfNotExists_EDIT": 45, "OptionalComment": 46, "DatabaseDefinitionOptionals_EDIT": 47, "OptionalComment_INVALID": 48, "Comment": 49, "COMMENT": 50, "QuotedValue": 51, "Comment_INVALID": 52, "SINGLE_QUOTE": 53, "DOUBLE_QUOTE": 54, "VALUE": 55, "TableDefinitionRightPart": 56, "TableDefinitionRightPart_EDIT": 57, "TableIdentifierAndOptionalColumnSpecification": 58, "OptionalPartitionedBy": 59, "OptionalAsSelectStatement": 60, "TableIdentifierAndOptionalColumnSpecification_EDIT": 61, "PartitionedBy_EDIT": 62, "OptionalAsSelectStatement_EDIT": 63, "SchemaQualifiedIdentifier": 64, "OptionalColumnSpecificationsOrLike": 65, "OptionalColumnSpecificationsOrLike_EDIT": 66, "SchemaQualifiedIdentifier_EDIT": 67, "ParenthesizedColumnSpecificationList": 68, "LIKE": 69, "ParenthesizedColumnSpecificationList_EDIT": 70, "(": 71, "ColumnSpecificationList": 72, ")": 73, "ColumnSpecificationList_EDIT": 74, "RightParenthesisOrError": 75, "ColumnSpecification": 76, ",": 77, "ColumnSpecification_EDIT": 78, "ColumnIdentifier": 79, "ColumnDataType": 80, "OptionalColumnOptions": 81, "ColumnDataType_EDIT": 82, "ColumnOptions_EDIT": 83, "ColumnOptions": 84, "ColumnOption": 85, "ColumnOption_EDIT": 86, "NOT": 87, "NULL": 88, "PrimitiveType": 89, "ArrayType": 90, "MapType": 91, "StructType": 92, "ArrayType_INVALID": 93, "MapType_INVALID": 94, "StructType_INVALID": 95, "ArrayType_EDIT": 96, "MapType_EDIT": 97, "StructType_EDIT": 98, "ARRAY": 99, "<": 100, ">": 101, "AnyCursor": 102, "GreaterThanOrError": 103, "MAP": 104, "STRUCT": 105, "StructDefinitionList": 106, "StructDefinitionList_EDIT": 107, "StructDefinition": 108, "StructDefinition_EDIT": 109, "Commas": 110, "RegularOrBacktickedIdentifier": 111, ":": 112, "ColumnDataTypeList": 113, "ColumnDataTypeList_EDIT": 114, "ColumnDataTypeListInner_EDIT": 115, "PartitionedBy": 116, "PARTITION": 117, "BY": 118, "RangeClause": 119, "RangeClause_EDIT": 120, "RANGE": 121, "ParenthesizedColumnList": 122, "ParenthesizedPartitionValuesList": 123, "ParenthesizedColumnList_EDIT": 124, "ParenthesizedPartitionValuesList_EDIT": 125, "PartitionValueList": 126, "PartitionValueList_EDIT": 127, "PartitionValue": 128, "PartitionValue_EDIT": 129, "ValueExpression": 130, "LessThanOrEqualTo": 131, "VALUES": 132, "ValueExpression_EDIT": 133, "COMPARISON_OPERATOR": 134, "CommitLocations": 135, "OptionalParenthesizedViewColumnList": 136, "ParenthesizedViewColumnList_EDIT": 137, "ParenthesizedViewColumnList": 138, "ViewColumnList": 139, "ViewColumnList_EDIT": 140, "ColumnReference": 141, "ROLE": 142, "DropDatabaseStatement": 143, "DropRoleStatement": 144, "DropTableStatement": 145, "DropViewStatement": 146, "TruncateTableStatement": 147, "DropDatabaseStatement_EDIT": 148, "DropTableStatement_EDIT": 149, "DropViewStatement_EDIT": 150, "TruncateTableStatement_EDIT": 151, "DROP": 152, "OptionalIfExists": 153, "OptionalCascade": 154, "OptionalIfExists_EDIT": 155, "OptionalPurge": 156, "PURGE": 157, "TRUNCATE": 158, "OptionalPartitionSpec": 159, "DataManipulation": 160, "InsertStatement": 161, "UpdateStatement": 162, "InsertVa
terminals_: { 2: "error", 13: "SET", 14: "CURSOR", 20: "ALTER", 24: "TABLE", 28: "AS", 32: "VIEW", 40: "CREATE", 50: "COMMENT", 53: "SINGLE_QUOTE", 54: "DOUBLE_QUOTE", 55: "VALUE", 69: "LIKE", 71: "(", 73: ")", 77: ",", 87: "NOT", 88: "NULL", 99: "ARRAY", 100: "<", 101: ">", 104: "MAP", 105: "STRUCT", 112: ":", 117: "PARTITION", 118: "BY", 121: "RANGE", 132: "VALUES", 134: "COMPARISON_OPERATOR", 142: "ROLE", 152: "DROP", 157: "PURGE", 158: "TRUNCATE", 167: "INSERT", 168: "INTO", 172: "RowValuesList", 177: "EOF", 181: ";", 184: "SetSpecification_EDIT", 186: "OPTION", 187: "REGULAR_IDENTIFIER", 188: "VARIABLE_REFERENCE", 190: "!", 191: "*", 192: "-", 193: ".", 194: "=", 195: "[", 196: "]", 197: "~", 198: "ALL", 199: "ANALYTIC", 200: "AND", 201: "ARITHMETIC_OPERATOR", 202: "ASC", 203: "AVG", 204: "BACKTICK", 205: "BETWEEN", 206: "BIGINT", 207: "BOOLEAN", 208: "CASE", 209: "CAST", 210: "CHAR", 211: "COUNT", 212: "CROSS", 213: "CURRENT", 214: "DATABASE", 215: "DECIMAL", 216: "DESC", 217: "DISTINCT", 218: "DOUBLE", 219: "ELSE", 220: "END", 221: "EXISTS", 222: "FALSE", 223: "FLOAT", 224: "FOLLOWING", 225: "FROM", 226: "FULL", 227: "GROUP", 228: "HAVING", 229: "HDFS_START_QUOTE", 230: "IF", 231: "IN", 232: "INNER", 233: "INT", 234: "IS", 235: "JOIN", 236: "LEFT", 237: "LIMIT", 238: "MAX", 239: "MIN", 240: "ON", 241: "OR", 242: "ORDER", 243: "OUTER", 244: "OVER", 245: "PRECEDING", 246: "REGEXP", 247: "RIGHT", 248: "RLIKE", 249: "ROW", 250: "ROWS", 251: "SCHEMA", 252: "SEMI", 253: "SMALLINT", 254: "STDDEV_POP", 255: "STDDEV_SAMP", 256: "STRING", 257: "SUM", 258: "THEN", 259: "TIMESTAMP", 260: "TINYINT", 261: "TRUE", 262: "UNION", 263: "UNSIGNED_INTEGER", 264: "UNSIGNED_INTEGER_E", 265: "VAR_POP", 266: "VAR_SAMP", 267: "VARCHAR", 268: "VARIANCE", 269: "WHEN", 270: "WHERE", 271: "PARTIAL_CURSOR", 275: "PARTIAL_VALUE", 283: "CASCADE", 323: "SELECT", 333: "WITH", 382: "BETWEEN_AND", 401: "+", 482: "UNBOUNDED", 487: "HDFS_PATH", 488: "HDFS_END_QUOTE", 495: "UPDATE", 509: "USE" },
productions_: [0, [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 1], [4, 1], [4, 1], [10, 1], [10, 1], [10, 2], [16, 2], [18, 1], [18, 2], [18, 2], [18, 3], [21, 3], [23, 3], [23, 3], [17, 3], [19, 1], [19, 2], [19, 3], [19, 3], [19, 3], [27, 3], [30, 3], [30, 3], [5, 1], [5, 1], [5, 1], [5, 1], [11, 1], [11, 1], [11, 1], [11, 2], [33, 3], [33, 5], [37, 4], [37, 3], [37, 5], [37, 4], [37, 6], [44, 1], [47, 1], [46, 0], [46, 1], [49, 2], [48, 1], [52, 2], [52, 2], [52, 3], [52, 3], [34, 4], [38, 4], [38, 4], [38, 3], [56, 3], [57, 3], [57, 3], [57, 3], [57, 3], [58, 2], [61, 2], [61, 2], [65, 0], [65, 1], [65, 2], [66, 1], [66, 2], [66, 2], [68, 3], [70, 3], [72, 1], [72, 3], [74, 1], [74, 3], [74, 3], [74, 5], [74, 2], [74, 4], [74, 4], [74, 6], [76, 3], [78, 3], [78, 3], [78, 3], [81, 0], [81, 1], [84, 1], [84, 2], [83, 1], [83, 2], [83, 2], [83, 3], [85, 2], [85, 1], [85, 1], [86, 2], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [82, 1], [82, 1], [82, 1], [90, 4], [93, 3], [96, 4], [96, 4], [91, 6], [94, 3], [97, 6], [97, 4], [97, 6], [97, 5], [92, 4], [95, 3], [98, 4], [106, 1], [106, 3], [107, 1], [107, 2], [107, 3], [107, 3], [107, 5], [108, 4], [109, 5], [109, 4], [109, 4], [109, 4], [109, 3], [109, 3], [113, 1], [113, 3], [114, 1], [114, 2], [114, 3], [114, 3], [114, 5], [115, 2], [115, 2], [115, 1], [115, 1], [103, 1], [103, 1], [59, 0], [59, 1], [116, 3], [62, 2], [62, 3], [62, 3], [119, 3], [120, 2], [120, 2], [120, 3], [120, 3], [120, 3], [123, 3], [125, 3], [125, 3], [126, 1], [126, 3], [127, 1], [127, 3], [127, 5], [127, 3], [127, 5], [128, 6], [128, 4], [128, 4], [129, 2], [129, 2], [129, 3], [129, 4], [129, 4], [129, 5], [129, 6], [129, 6], [129, 3], [129, 4], [129, 4], [131, 1], [131, 1], [60, 0], [60, 3], [63, 3], [63, 3], [135, 0], [35, 8], [39, 4], [39, 9], [39, 3], [39, 6], [39, 7], [39, 8], [39, 8], [39, 8], [136, 0], [136, 1], [138, 3], [137, 3], [139, 2], [139, 4], [140, 3], [140, 5], [140, 5], [140, 7], [36, 3], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [12, 1], [12, 1], [12, 1], [12, 1], [12, 2], [143, 5], [148, 3], [148, 3], [148, 4], [148, 5], [148, 5], [148, 6], [144, 3], [145, 5], [149, 3], [149, 4], [149, 5], [149, 5], [149, 6], [156, 0], [156, 1], [146, 4], [150, 4], [150, 5], [150, 3], [150, 4], [150, 4], [147, 4], [151, 2], [151, 4], [151, 3], [151, 4], [151, 5], [151, 5], [151, 5], [160, 1], [160, 1], [161, 1], [164, 1], [164, 1], [163, 6], [165, 2], [165, 4], [165, 4], [165, 5], [165, 6], [170, 1], [170, 3], [171, 3], [169, 0], [169, 1], [174, 3], [178, 3], [178, 3], [175, 0], [176, 0], [176, 1], [176, 4], [179, 1], [179, 4], [179, 4], [179, 7], [180, 1], [180, 1], [180, 1], [182, 1], [182, 2], [182, 1], [182, 1], [182, 1], [182, 1], [185, 1], [185, 1], [185, 1], [43, 1], [43, 1], [43, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [189, 1], [110, 1], [110, 2], [102, 1], [102, 1], [272, 1], [272, 1], [41, 1], [41, 1], [273, 3], [273, 2], [274, 2], [276, 3], [276, 2], [277, 2], [51, 1], [51, 1], [278, 1], [278, 1], [279, 0], [2
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
/* this == yyval */
var $0 = $$.length - 1;
switch (yystate) {
case 9:
parser.suggestSetOptions();
break;
case 15:
parser.suggestKeywords(['TABLE', 'VIEW']);
break;
case 21:
case 30:
case 243:
case 247:
case 249:
case 1134:
parser.addTablePrimary($$[$0]);
break;
case 22:
case 238:
if (parser.yy.result.suggestTables) {
parser.yy.result.suggestTables.onlyTables = true;
}
break;
case 23:
parser.suggestTables({ onlyTables: true });
parser.suggestDatabases({ appendDot: true });
break;
case 26:
case 590:
parser.suggestKeywords(['AS']);
break;
case 28:
case 194:
case 203:
case 288:
case 591:
case 952:
parser.suggestKeywords(['SELECT']);
break;
case 31:
case 248:
if (parser.yy.result.suggestTables) {
parser.yy.result.suggestTables.onlyViews = true;
}
break;
case 32:
parser.suggestTables({ onlyViews: true });
parser.suggestDatabases({ appendDot: true });
break;
case 40:
case 226:
parser.suggestKeywords(['DATABASE', 'ROLE', 'SCHEMA', 'TABLE', 'VIEW']);
break;
case 42:
parser.addNewDatabaseLocation(_$[$0 - 1], [{ name: $$[$0 - 1] }]);
break;
case 43:
case 60:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['IF NOT EXISTS']);
}
break;
case 45:
if (!$$[$0 - 2]) {
parser.suggestKeywords(['IF NOT EXISTS']);
}
parser.addNewDatabaseLocation(_$[$0], [{ name: $$[$0] }]);
break;
case 46:
parser.addNewDatabaseLocation(_$[$0], [{ name: $$[$0] }]);
break;
case 47:
parser.addNewDatabaseLocation(_$[$0 - 2], [{ name: $$[$0 - 2] }]);
break;
case 48:
if (!$$[$0]) {
parser.suggestKeywords(['COMMENT']);
}
break;
case 66:
var keywords = [];
if (!$$[$0 - 2] && !$$[$0 - 1]) {
keywords.push({ value: 'LIKE', weight: 1 });
}
else {
if (!$$[$0 - 1]) {
keywords.push({ value: 'PARTITIONED BY', weight: 12 });
}
keywords.push({ value: 'AS', weight: 1 });
}
if (keywords.length > 0) {
parser.suggestKeywords(keywords);
}
break;
case 67:
parser.addNewTableLocation(_$[$0 - 1], $$[$0 - 1], $$[$0]);
this.$ = $$[$0];
break;
case 72:
this.$ = [];
break;
case 74:
case 482:
case 1131:
case 1151:
parser.suggestTables();
parser.suggestDatabases({ appendDot: true });
break;
case 76:
case 212:
case 214:
case 415:
case 418:
case 504:
case 547:
case 688:
case 867:
case 949:
case 1001:
this.$ = $$[$0 - 1];
break;
case 78:
case 583:
this.$ = [$$[$0]];
break;
case 79:
this.$ = $$[$0 - 2].concat($$[$0]);
break;
case 84:
case 86:
parser.checkForKeywords($$[$0 - 1]);
break;
case 85:
case 87:
parser.checkForKeywords($$[$0 - 3]);
break;
case 88:
this.$ = $$[$0 - 2];
this.$.type = $$[$0 - 1];
var keywords = [];
if (!$$[$0]['comment']) {
keywords.push('COMMENT');
}
if (keywords.length > 0) {
this.$.suggestKeywords = keywords;
}
break;
case 89:
case 116:
case 122:
case 123:
case 136:
case 139:
case 148:
case 150:
parser.suggestKeywords(parser.getColumnDataTypeKeywords());
break;
case 92:
this.$ = {};
break;
case 94:
this.$ = {};
this.$[$$[$0]] = true;
break;
case 95:
$$[$0 - 1][$$[$0]] = true;
break;
case 100:
case 101:
this.$ = 'null';
break;
case 102:
this.$ = 'comment';
break;
case 103:
parser.suggestKeywords(['NULL']);
break;
case 121:
parser.suggestKeywords(parser.getTypeKeywords());
break;
case 135:
case 138:
parser.suggestKeywords(['COMMENT']);
break;
case 157:
case 1027:
parser.suggestKeywords(['BY']);
break;
case 158:
parser.suggestKeywords(['RANGE']);
break;
case 167:
case 172:
case 173:
parser.suggestKeywords(['PARTITION']);
break;
case 179:
parser.suggestKeywords(['VALUE', 'VALUES']);
break;
case 180:
if ($$[$0].endsWithLessThanOrEqual) {
parser.suggestKeywords(['VALUES']);
}
break;
case 181:
case 184:
case 187:
parser.suggestKeywords(['<', '<=']);
break;
case 182:
case 447:
case 450:
parser.suggestKeywords(['VALUES']);
break;
case 185:
case 188:
parser.suggestFunctions();
break;
case 196:
parser.commitLocations();
break;
case 198:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['IF NOT EXISTS']);
}
parser.suggestDatabases({ appendDot: true });
break;
case 199:
if (!$$[$0 - 6]) {
parser.suggestKeywords(['IF NOT EXISTS']);
}
break;
case 202:
var keywords = [{ value: 'AS', weight: 1 }];
if (!$$[$0 - 1]) {
keywords.push({ value: 'COMMENT', weight: 3 });
}
parser.suggestKeywords(keywords);
break;
case 209:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['COMMENT']);
}
break;
case 213:
case 215:
this.$ = $$[$0 - 3];
break;
case 230:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['IF EXISTS']);
}
parser.suggestDatabases();
break;
case 231:
parser.suggestKeywords(['CASCADE']);
break;
case 233:
if (!$$[$0 - 3]) {
parser.suggestKeywords(['IF EXISTS']);
}
break;
case 235:
case 254:
parser.addTablePrimary($$[$0 - 1]);
break;
case 237:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['IF EXISTS']);
}
parser.suggestTables({ onlyTables: true });
parser.suggestDatabases({
appendDot: true
});
break;
case 240:
parser.addTablePrimary($$[$0 - 2]);
if (!$$[$0 - 1]) {
parser.suggestKeywords(['PURGE']);
}
break;
case 244:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['IF EXISTS']);
}
parser.suggestTables({ onlyViews: true });
parser.suggestDatabases({ appendDot: true });
break;
case 245:
parser.addTablePrimary($$[$0]);
if (!$$[$0 - 2]) {
parser.suggestKeywords(['IF EXISTS']);
}
break;
case 250:
parser.suggestKeywords(['TABLE']);
break;
case 251:
parser.suggestTables();
parser.suggestDatabases({ appendDot: true });
if (!$$[$0 - 1]) {
parser.suggestKeywords(['IF EXISTS']);
}
break;
case 255:
parser.addTablePrimary($$[$0 - 1]);
if (!$$[$0 - 2]) {
parser.suggestKeywords(['IF EXISTS']);
}
break;
case 262:
$$[$0 - 2].owner = 'insert';
parser.addTablePrimary($$[$0 - 2]);
break;
case 263:
parser.suggestKeywords(['INTO']);
break;
case 264:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['TABLE']);
}
parser.suggestTables();
parser.suggestDatabases({ appendDot: true });
break;
case 266:
$$[$0 - 1].owner = 'insert';
parser.addTablePrimary($$[$0 - 1]);
parser.suggestKeywords(['VALUES']);
break;
case 274:
case 275:
return parser.yy.result;
break;
case 276:
parser.prepareNewStatement();
break;
case 278:
case 280:
case 282:
parser.addStatementLocation(_$[$0]);
break;
case 281:
case 283:
parser.addStatementLocation(_$[$0 - 3]);
break;
case 287:
parser.suggestDdlAndDmlKeywords();
break;
case 416:
case 419:
case 505:
this.$ = '';
break;
case 431:
case 434:
parser.yy.correlatedSubQuery = false;
break;
case 432:
case 436:
parser.suggestKeywords(['EXISTS']);
break;
case 435:
parser.suggestKeywords(['NOT EXISTS']);
break;
case 446:
case 448:
case 449:
case 451:
parser.suggestKeywords(['<', '<=', '<>', '=', '>', '>=']);
break;
case 472:
case 475:
case 476:
case 501:
case 502:
case 523:
case 526:
case 637:
case 1145:
parser.suggestColumns();
break;
case 480:
case 506:
parser.addTableLocation(_$[$0], [{ name: $$[$0] }]);
this.$ = { identifierChain: [{ name: $$[$0] }] };
break;
case 481:
case 507:
parser.addDatabaseLocation(_$[$0 - 2], [{ name: $$[$0 - 2] }]);
parser.addTableLocation(_$[$0], [{ name: $$[$0 - 2] }, { name: $$[$0] }]);
this.$ = { identifierChain: [{ name: $$[$0 - 2] }, { name: $$[$0] }] };
break;
case 483:
case 488:
parser.suggestDatabases();
this.$ = { identifierChain: [{ name: $$[$0 - 2] }] };
break;
case 484:
case 509:
parser.suggestTablesOrColumns($$[$0 - 2]);
break;
case 485:
this.$ = [{ name: $$[$0] }];
break;
case 486:
this.$ = [{ name: $$[$0 - 2] }, { name: $$[$0 - 1] }];
break;
case 487:
parser.suggestDatabases({ appendDot: true });
break;
case 491:
case 1154:
parser.suggestDatabases();
break;
case 500:
case 642:
case 643:
case 649:
case 650:
case 945:
case 1028:
parser.valueExpressionSuggest();
break;
case 508:
parser.suggestTables();
parser.suggestDatabases({ prependDot: true });
break;
case 511:
this.$ = { identifierChain: $$[$0 - 1].identifierChain, alias: $$[$0] };
break;
case 514:
parser.yy.locations[parser.yy.locations.length - 1].type = 'column';
break;
case 515:
case 822:
parser.addAsteriskLocation(_$[$0], $$[$0 - 2].concat({ asterisk: true }));
break;
case 517:
this.$ = [$$[$0].identifier];
parser.yy.firstChainLocation = parser.addUnknownLocation($$[$0].location, [$$[$0].identifier]);
break;
case 518:
if (parser.yy.firstChainLocation) {
parser.yy.firstChainLocation.firstInChain = true;
delete parser.yy.firstChainLocation;
}
$$[$0 - 2].push($$[$0].identifier);
parser.addUnknownLocation($$[$0].location, $$[$0 - 2].concat());
break;
case 519:
parser.suggestColumns({
identifierChain: $$[$0 - 2]
});
this.$ = { suggestKeywords: [{ value: '*', weight: 10000 }] };
break;
case 520:
parser.suggestColumns({
identifierChain: $$[$0 - 4]
});
this.$ = { suggestKeywords: [{ value: '*', weight: 10000 }] };
break;
case 521:
this.$ = [$$[$0].identifier];
break;
case 522:
$$[$0 - 2].push($$[$0].identifier);
break;
case 524:
parser.suggestColumns({ identifierChain: $$[$0 - 2] });
break;
case 525:
parser.suggestColumns({ identifierChain: $$[$0 - 4] });
break;
case 527:
this.$ = { identifier: { name: $$[$0] }, location: _$[$0] };
break;
case 549:
case 869:
this.$ = $$[$0 - 2];
break;
case 552:
parser.addCommonTableExpressions($$[$0 - 3]);
break;
case 553:
case 554:
case 586:
parser.addCommonTableExpressions($$[$0 - 2]);
break;
case 558:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 1], _$[$0 - 1], $$[$0 - 2], _$[$0 - 2]), _$[$0]);
this.$ = { selectList: $$[$0] };
break;
case 559:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 2], _$[$0 - 2], $$[$0 - 3], _$[$0 - 3]), _$[$0 - 1]);
this.$ = { selectList: $$[$0 - 1], tableExpression: $$[$0] };
break;
case 570:
parser.suggestKeywords(['ALL', 'DISTINCT', 'SELECT']);
break;
case 571:
parser.suggestKeywords(['ALL', 'DISTINCT']);
break;
case 573:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 1], _$[$0 - 1], $$[$0 - 2], _$[$0 - 2]), _$[$0]);
if ($$[$0].cursorAtStart) {
var keywords = parser.getSelectListKeywords();
if (!$$[$0 - 1]) {
keywords.push({ value: 'ALL', weight: 2 });
keywords.push({ value: 'DISTINCT', weight: 2 });
}
parser.suggestKeywords(keywords);
}
else {
parser.checkForSelectListKeywords($$[$01]);
}
if ($$[$0].suggestFunctions) {
parser.suggestFunctions();
}
if ($$[$0].suggestColumns) {
parser.suggestColumns({ identifierChain: [], source: 'select' });
}
if ($$[$0].suggestTables) {
parser.suggestTables({ prependQuestionMark: true, prependFrom: true });
}
if ($$[$0].suggestDatabases) {
parser.suggestDatabases({ prependQuestionMark: true, prependFrom: true, appendDot: true });
}
if ($$[$0].suggestAggregateFunctions && (!$$[$0 - 1] || $$[$0 - 1] === 'ALL')) {
parser.suggestAggregateFunctions();
parser.suggestAnalyticFunctions();
}
break;
case 574:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 1], _$[$0 - 1], $$[$0 - 2], _$[$0 - 2]), _$[$0], true);
var keywords = parser.getSelectListKeywords();
if (!$$[$0 - 1] || $$[$0 - 1] === 'ALL') {
parser.suggestAggregateFunctions();
parser.suggestAnalyticFunctions();
}
if (!$$[$0 - 1]) {
keywords.push({ value: 'ALL', weight: 2 });
keywords.push({ value: 'DISTINCT', weight: 2 });
}
parser.suggestKeywords(keywords);
parser.suggestFunctions();
parser.suggestColumns({ identifierChain: [], source: 'select' });
parser.suggestTables({ prependQuestionMark: true, prependFrom: true });
parser.suggestDatabases({ prependQuestionMark: true, prependFrom: true, appendDot: true });
break;
case 575:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 2], _$[$0 - 2], $$[$0 - 3], _$[$0 - 3]), _$[$0 - 1]);
break;
case 576:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 2], _$[$0 - 2], $$[$0 - 3], _$[$0 - 3]), _$[$0 - 1]);
parser.selectListNoTableSuggest($$[$0 - 1], $$[$0 - 2]);
if (parser.yy.result.suggestColumns) {
parser.yy.result.suggestColumns.source = 'select';
}
break;
case 577:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 2], _$[$0 - 2], $$[$0 - 3], _$[$0 - 3]), _$[$0 - 1], true);
var keywords = parser.getSelectListKeywords();
if (!$$[$0 - 2] || $$[$0 - 2] === 'ALL') {
parser.suggestAggregateFunctions();
parser.suggestAnalyticFunctions();
}
if (!$$[$0 - 2]) {
keywords.push({ value: 'ALL', weight: 2 });
keywords.push({ value: 'DISTINCT', weight: 2 });
}
parser.suggestKeywords(keywords);
parser.suggestFunctions();
parser.suggestColumns({ identifierChain: [], source: 'select' });
parser.suggestTables({ prependQuestionMark: true, prependFrom: true });
parser.suggestDatabases({ prependQuestionMark: true, prependFrom: true, appendDot: true });
break;
case 578:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 3], _$[$0 - 3], $$[$0 - 4], _$[$0 - 4]), _$[$0 - 2]);
parser.checkForSelectListKeywords($$[$0 - 2]);
break;
case 579:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 4], _$[$0 - 4], $$[$0 - 5], _$[$0 - 5]), _$[$0 - 3]);
parser.checkForSelectListKeywords($$[$0 - 3]);
break;
case 580:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 2], _$[$0 - 2], $$[$0 - 3], _$[$0 - 3]), _$[$0 - 1]);
parser.checkForSelectListKeywords($$[$0 - 1]);
var keywords = ['FROM'];
if (parser.yy.result.suggestKeywords) {
keywords = parser.yy.result.suggestKeywords.concat(keywords);
}
parser.suggestKeywords(keywords);
parser.suggestTables({ prependFrom: true });
parser.suggestDatabases({ prependFrom: true, appendDot: true });
break;
case 581:
case 619:
case 640:
case 653:
case 657:
case 681:
case 706:
case 707:
case 788:
case 790:
case 854:
case 864:
case 871:
case 883:
case 1026:
case 1150:
case 1188:
case 1189:
this.$ = $$[$0];
break;
case 584:
this.$ = $$[$0 - 2].concat([$$[$0]]);
break;
case 588:
parser.addCommonTableExpressions($$[$0 - 4]);
break;
case 589:
parser.addCteAliasLocation(_$[$0 - 4], $$[$0 - 4]);
$$[$0 - 1].alias = $$[$0 - 4];
this.$ = $$[$0 - 1];
break;
case 596:
case 597:
parser.addClauseLocation('whereClause', _$[$0 - 1], $$[$0].whereClauseLocation);
parser.addClauseLocation('limitClause', $$[$0].limitClausePreceding || _$[$0 - 1], $$[$0].limitClauseLocation);
break;
case 598:
var keywords = [];
parser.addClauseLocation('whereClause', _$[$0 - 3], $$[$0 - 1].whereClauseLocation);
parser.addClauseLocation('limitClause', $$[$0 - 2].limitClausePreceding || _$[$0 - 3], $$[$0 - 2].limitClauseLocation);
if ($$[$0 - 3]) {
if (typeof $$[$0 - 3].tableReferenceList.hasJoinCondition !== 'undefined' && !$$[$0 - 3].tableReferenceList.hasJoinCondition) {
keywords.push({ value: 'ON', weight: 3 });
}
if ($$[$0 - 3].suggestKeywords) {
keywords = parser.createWeightedKeywords($$[$0 - 3].suggestKeywords, 3);
}
if ($$[$0 - 3].tableReferenceList.suggestJoinConditions) {
parser.suggestJoinConditions($$[$0 - 3].tableReferenceList.suggestJoinConditions);
}
if ($$[$0 - 3].tableReferenceList.suggestJoins) {
parser.suggestJoins($$[$0 - 3].tableReferenceList.suggestJoins);
}
if ($$[$0 - 3].tableReferenceList.suggestKeywords) {
keywords = keywords.concat(parser.createWeightedKeywords($$[$0 - 3].tableReferenceList.suggestKeywords, 3));
}
// Lower the weights for 'TABLESAMPLE'
keywords.forEach(function (keyword) {
if (keyword.value === 'TABLESAMPLE') {
keyword.weight = 1.1;
}
});
if ($$[$0 - 3].tableReferenceList.types) {
var veKeywords = parser.getValueExpressionKeywords($$[$0 - 3].tableReferenceList);
keywords = keywords.concat(veKeywords.suggestKeywords);
if (veKeywords.suggestColRefKeywords) {
parser.suggestColRefKeywords(veKeywords.suggestColRefKeywords);
parser.addColRefIfExists($$[$0 - 3].tableReferenceList);
}
}
}
if ($$[$0 - 1].empty && $$[$0] && $$[$0].joinType.toUpperCase() === 'JOIN') {
keywords = keywords.concat(['FULL', 'FULL OUTER', 'INNER', 'LEFT', 'LEFT OUTER', 'RIGHT', 'RIGHT OUTER']);
parser.suggestKeywords(keywords);
return;
}
if ($$[$0 - 1].suggestKeywords) {
keywords = keywords.concat(parser.createWeightedKeywords($$[$0 - 1].suggestKeywords, 2));
}
if ($$[$0 - 1].suggestFilters) {
parser.suggestFilters($$[$0 - 1].suggestFilters);
}
if ($$[$0 - 1].suggestGroupBys) {
parser.suggestGroupBys($$[$0 - 1].suggestGroupBys);
}
if ($$[$0 - 1].suggestOrderBys) {
parser.suggestOrderBys($$[$0 - 1].suggestOrderBys);
}
if ($$[$0 - 1].empty) {
keywords.push({ value: 'UNION', weight: 2.11 });
}
keywords = keywords.concat([
{ value: 'FULL JOIN', weight: 1 },
{ value: 'FULL OUTER JOIN', weight: 1 },
{ value: 'INNER JOIN', weight: 1 },
{ value: 'JOIN', weight: 1 },
{ value: 'LEFT JOIN', weight: 1 },
{ value: 'LEFT OUTER JOIN', weight: 1 },
{ value: 'RIGHT JOIN', weight: 1 },
{ value: 'RIGHT OUTER JOIN', weight: 1 }
]);
parser.suggestKeywords(keywords);
break;
case 599:
// A couple of things are going on here:
// - If there are no SelectConditions (WHERE, GROUP BY, etc.) we should suggest complete join options
// - If there's an OptionalJoin at the end, i.e. 'SELECT * FROM foo | JOIN ...' we should suggest
// different join types
// - The FromClause could end with a valueExpression, in which case we should suggest keywords like '='
// or 'AND' based on type
if (!$$[$0 - 1]) {
parser.addClauseLocation('whereClause', _$[$0 - 2]);
parser.addClauseLocation('limitClause', _$[$0 - 2]);
return;
}
parser.addClauseLocation('whereClause', _$[$0 - 2], $$[$0 - 1].whereClauseLocation);
parser.addClauseLocation('limitClause', $$[$0 - 1].limitClausePreceding || _$[$0 - 2], $$[$0 - 1].limitClauseLocation);
var keywords = [];
if ($$[$0 - 1].suggestColRefKeywords) {
parser.suggestColRefKeywords($$[$0 - 1].suggestColRefKeywords);
parser.addColRefIfExists($$[$0 - 1]);
}
if ($$[$0 - 1].suggestKeywords && $$[$0 - 1].suggestKeywords.length) {
keywords = keywords.concat(parser.createWeightedKeywords($$[$0 - 1].suggestKeywords, 2));
}
if ($$[$0 - 1].cursorAtEnd) {
keywords.push({ value: 'UNION', weight: 2.11 });
}
parser.suggestKeywords(keywords);
break;
case 603:
this.$ = { tableReferenceList: $$[$0] };
break;
case 604:
case 876:
parser.suggestTables();
parser.suggestDatabases({ appendDot: true });
break;
case 606:
var keywords = parser.getKeywordsForOptionalsLR([$$[$0 - 4], $$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0]], [{ value: 'WHERE', weight: 7 }, { value: 'GROUP BY', weight: 6 }, { value: 'HAVING', weight: 5 }, { value: 'ORDER BY', weight: 4 }, { value: 'LIMIT', weight: 3 }], [true, true, true, true, true]);
if (keywords.length > 0) {
this.$ = { suggestKeywords: keywords, empty: !$$[$0 - 4] && !$$[$0 - 3] && !$$[$0 - 2] && !$$[$0 - 1] && !$$[$0] };
}
else {
this.$ = {};
}
this.$.whereClauseLocation = $$[$0 - 4] ? _$[$0 - 4] : undefined;
this.$.limitClausePreceding = parser.firstDefined($$[$0 - 1], _$[$0 - 1], $$[$0 - 2], _$[$0 - 2], $$[$0 - 3], _$[$0 - 3], $$[$0 - 4], _$[$0 - 4]);
this.$.limitClauseLocation = $$[$0] ? _$[$0] : undefined;
if (!$$[$0 - 4] && !$$[$0 - 3] && !$$[$0 - 2] && !$$[$0 - 1] && !$$[$0]) {
this.$.suggestFilters = { prefix: 'WHERE', tablePrimaries: parser.yy.latestTablePrimaries.concat() };
}
if (!$$[$0 - 3] && !$$[$0 - 2] && !$$[$0 - 1] && !$$[$0]) {
this.$.suggestGroupBys = { prefix: 'GROUP BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() };
}
if (!$$[$0 - 1] && !$$[$0]) {
this.$.suggestOrderBys = { prefix: 'ORDER BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() };
}
break;
case 607:
if (parser.yy.result.suggestColumns) {
parser.yy.result.suggestColumns.source = 'where';
}
break;
case 608:
if (parser.yy.result.suggestColumns) {
parser.yy.result.suggestColumns.source = 'group by';
}
break;
case 610:
if (parser.yy.result.suggestColumns) {
parser.yy.result.suggestColumns.source = 'order by';
}
break;
case 612:
var keywords = parser.getKeywordsForOptionalsLR([$$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0]], [{ value: 'GROUP BY', weight: 8 }, { value: 'HAVING', weight: 7 }, { value: 'ORDER BY', weight: 5 }, { value: 'LIMIT', weight: 3 }], [true, true, true, true]);
if ($$[$0 - 5].suggestKeywords) {
keywords = keywords.concat(parser.createWeightedKeywords($$[$0 - 5].suggestKeywords, 1));
}
this.$ = parser.getValueExpressionKeywords($$[$0 - 5], keywords);
this.$.cursorAtEnd = !$$[$0 - 3] && !$$[$0 - 2] && !$$[$0 - 1] && !$$[$0];
if ($$[$0 - 5].columnReference) {
this.$.columnReference = $$[$0 - 5].columnReference;
}
if (!$$[$0 - 3]) {
parser.suggestGroupBys({ prefix: 'GROUP BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
}
if (!$$[$0 - 3] && !$$[$0 - 2] && !$$[$0 - 1]) {
parser.suggestOrderBys({ prefix: 'ORDER BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
}
this.$.whereClauseLocation = $$[$0 - 5] ? _$[$0 - 5] : undefined;
this.$.limitClausePreceding = parser.firstDefined($$[$0 - 1], _$[$0 - 1], $$[$0 - 2], _$[$0 - 2], $$[$0 - 3], _$[$0 - 3], $$[$0 - 5], _$[$0 - 5]);
this.$.limitClauseLocation = $$[$0] ? _$[$0] : undefined;
break;
case 613:
var keywords = parser.getKeywordsForOptionalsLR([$$[$0 - 2], $$[$0 - 1], $$[$0]], [{ value: 'HAVING', weight: 7 }, { value: 'ORDER BY', weight: 5 }, { value: 'LIMIT', weight: 3 }], [true, true, true]);
if ($$[$0 - 4].suggestKeywords) {
keywords = keywords.concat(parser.createWeightedKeywords($$[$0 - 4].suggestKeywords, 8));
}
if ($$[$0 - 4].valueExpression) {
this.$ = parser.getValueExpressionKeywords($$[$0 - 4].valueExpression, keywords);
if ($$[$0 - 4].valueExpression.columnReference) {
this.$.columnReference = $$[$0 - 4].valueExpression.columnReference;
}
}
else {
this.$ = { suggestKeywords: keywords };
}
this.$.cursorAtEnd = !$$[$0 - 2] && !$$[$0 - 1] && !$$[$0];
if (!$$[$0 - 2] && !$$[$0 - 1]) {
parser.suggestOrderBys({ prefix: 'ORDER BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
}
this.$.whereClauseLocation = $$[$0 - 5] ? _$[$0 - 5] : undefined;
this.$.limitClausePreceding = parser.firstDefined($$[$0 - 1], _$[$0 - 1], $$[$0 - 2], _$[$0 - 2], $$[$0 - 4], _$[$0 - 4]);
this.$.limitClauseLocation = $$[$0] ? _$[$0] : undefined;
break;
case 614:
var keywords = parser.getKeywordsForOptionalsLR([$$[$0 - 1], $$[$0]], [{ value: 'ORDER BY', weight: 5 }, { value: 'LIMIT', weight: 3 }], [true, true]);
this.$ = { suggestKeywords: keywords, cursorAtEnd: !$$[$0 - 1] && !$$[$0] };
if (!$$[$0 - 1]) {
parser.suggestOrderBys({ prefix: 'ORDER BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
}
this.$.whereClauseLocation = $$[$0 - 5] ? _$[$0 - 5] : undefined;
this.$.limitClausePreceding = parser.firstDefined($$[$0 - 1], _$[$0 - 1], $$[$0 - 3], _$[$0 - 3]);
this.$.limitClauseLocation = $$[$0] ? _$[$0] : undefined;
break;
case 615:
var keywords = parser.getKeywordsForOptionalsLR([$$[$0]], [{ value: 'LIMIT', weight: 3 }], [true]);
if ($$[$0 - 2].suggestKeywords) {
keywords = keywords.concat(parser.createWeightedKeywords($$[$0 - 2].suggestKeywords, 4));
}
this.$ = { suggestKeywords: keywords, cursorAtEnd: !$$[$0] };
this.$.whereClauseLocation = $$[$0 - 5] ? _$[$0 - 5] : undefined;
this.$.limitClausePreceding = parser.firstDefined($$[$0 - 2], _$[$0 - 2]);
this.$.limitClauseLocation = $$[$0] ? _$[$0] : undefined;
break;
case 616:
this.$ = { suggestKeywords: [], cursorAtEnd: true };
this.$.whereClauseLocation = $$[$0 - 5] ? _$[$0 - 5] : undefined;
this.$.limitClausePreceding = parser.firstDefined($$[$0 - 2], _$[$0 - 2], $$[$0 - 3], _$[$0 - 3], $$[$0 - 4], _$[$0 - 4], $$[$0 - 5], _$[$0 - 5]);
this.$.limitClauseLocation = _$[$0 - 1];
break;
case 620:
if ($$[$0].suggestFilters) {
parser.suggestFilters({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
}
break;
case 621:
parser.suggestFunctions();
parser.suggestColumns();
parser.suggestKeywords(['EXISTS', 'NOT EXISTS']);
parser.suggestFilters({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
break;
case 624:
this.$ = { valueExpression: $$[$0] };
break;
case 625:
case 664:
parser.suggestSelectListAliases();
break;
case 626:
parser.valueExpressionSuggest();
parser.suggestSelectListAliases();
parser.suggestGroupBys({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
break;
case 627:
parser.suggestKeywords(['BY']);
parser.suggestGroupBys({ prefix: 'BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
break;
case 654:
if ($$[$0].emptyOrderBy) {
parser.suggestOrderBys({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
}
break;
case 655:
parser.suggestKeywords(['BY']);
parser.suggestOrderBys({ prefix: 'BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
break;
case 659:
this.$ = { emptyOrderBy: false };
parser.valueExpressionSuggest();
parser.suggestAnalyticFunctions();
parser.suggestSelectListAliases();
break;
case 660:
case 661:
case 662:
this.$ = { emptyOrderBy: false };
break;
case 663:
this.$ = parser.mergeSuggestKeywords($$[$0]);
break;
case 665:
this.$ = { emptyOrderBy: true };
parser.valueExpressionSuggest();
parser.suggestAnalyticFunctions();
parser.suggestSelectListAliases();
break;
case 666:
this.$ = { suggestKeywords: ['ASC', 'DESC'] };
break;
case 679:
case 680:
// verifyType($$[$0], 'BOOLEAN');
this.$ = { types: ['BOOLEAN'] };
break;
case 682:
// verifyType($$[$0], 'NUMBER');
this.$ = $$[$0];
$$[$0].types = ['NUMBER'];
break;
case 683:
case 684:
case 685:
case 686:
case 693:
case 694:
case 695:
case 696:
case 697:
case 698:
case 704:
case 705:
case 726:
case 784:
case 785:
case 843:
this.$ = { types: ['BOOLEAN'] };
break;
case 687:
this.$ = { types: ['BOOLEAN'] };
// clear correlated flag after completed sub-query (set by lexer)
parser.yy.correlatedSubQuery = false;
break;
case 689:
case 690:
case 691:
case 692:
parser.addColRefToVariableIfExists($$[$0 - 2], $$[$0]);
this.$ = { types: ['BOOLEAN'] };
break;
case 699:
case 700:
// verifyType($$[$0-2], 'BOOLEAN');
// verifyType($$[$0], 'BOOLEAN');
this.$ = { types: ['BOOLEAN'] };
break;
case 701:
case 702:
case 703:
// verifyType($$[$0-2], 'NUMBER');
// verifyType($$[$0], 'NUMBER');
this.$ = { types: ['NUMBER'] };
break;
case 709:
parser.suggestKeywords(['BETWEEN', 'EXISTS', 'IN', 'LIKE', 'REGEXP', 'RLIKE']);
this.$ = { types: ['BOOLEAN'] };
break;
case 710:
case 712:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 711:
parser.suggestFunctions();
parser.suggestColumns();
parser.suggestKeywords(['EXISTS']);
this.$ = { types: ['BOOLEAN'] };
break;
case 713:
parser.suggestFunctions({ types: ['BOOLEAN'] });
parser.suggestColumns({ types: ['BOOLEAN'] });
this.$ = { types: ['BOOLEAN'] };
break;
case 714:
this.$ = { types: ['T'], suggestFilters: $$[$0].suggestFilters };
break;
case 715:
parser.suggestFunctions();
parser.suggestColumns();
this.$ = { types: ['T'] };
break;
case 716:
if (!$$[$0].typeSet) {
parser.applyTypeToSuggestions('NUMBER');
}
this.$ = { types: ['NUMBER'], suggestFilters: $$[$0].suggestFilters };
break;
case 717:
parser.suggestFunctions({ types: ['NUMBER'] });
parser.suggestColumns({ types: ['NUMBER'] });
this.$ = { types: ['NUMBER'] };
break;
case 718:
parser.suggestKeywords(['FALSE', 'NOT NULL', 'NOT TRUE', 'NOT FALSE', 'NULL', 'TRUE']);
this.$ = { types: ['BOOLEAN'] };
break;
case 719:
parser.suggestKeywords(['FALSE', 'NULL', 'TRUE']);
this.$ = { types: ['BOOLEAN'] };
break;
case 720:
this.$ = { types: ['BOOLEAN'] };
break;
case 721:
case 722:
case 723:
parser.suggestKeywords(['NOT']);
this.$ = { types: ['BOOLEAN'] };
break;
case 724:
parser.valueExpressionSuggest($$[$0 - 5], $$[$0 - 3] ? 'IS NOT DISTINCT FROM' : 'IS DISTINCT FROM');
this.$ = { types: ['BOOLEAN'] };
break;
case 725:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 727:
this.$ = $$[$0 - 1];
break;
case 728:
parser.valueExpressionSuggest();
this.$ = { types: ['T'], typeSet: true };
break;
case 729:
parser.valueExpressionSuggest($$[$0], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0].types);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 730:
case 731:
case 732:
parser.valueExpressionSuggest($$[$0], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0].types);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 733:
case 734:
case 735:
case 736:
if (!$$[$0 - 2].typeSet) {
parser.applyTypeToSuggestions($$[$0].types);
parser.addColRefIfExists($$[$0]);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 737:
case 739:
parser.valueExpressionSuggest($$[$0 - 2], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 2].types);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 738:
parser.valueExpressionSuggest($$[$0 - 2], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 2].types);
this.$ = { types: ['BOOLEAN'], typeSet: true, endsWithLessThanOrEqual: true };
break;
case 740:
parser.valueExpressionSuggest($$[$0 - 2], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 2].types);
this.$ = { types: ['BOOLEAN'], typeSet: true, endsWithLessThanOrEqual: $$[$0 - 1] === '<=' };
break;
case 741:
case 742:
case 743:
case 744:
if (!$$[$0].typeSet) {
parser.applyTypeToSuggestions($$[$0 - 2].types);
parser.addColRefIfExists($$[$0 - 2]);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 745:
if ($$[$0].inValueEdit) {
parser.valueExpressionSuggest($$[$0 - 3], $$[$0 - 2] + ' ' + $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 3].types);
}
if ($$[$0].cursorAtStart) {
parser.suggestKeywords(['SELECT']);
}
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 746:
if ($$[$0].inValueEdit) {
parser.valueExpressionSuggest($$[$0 - 2], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 2].types);
}
if ($$[$0].cursorAtStart) {
parser.suggestKeywords(['SELECT']);
}
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 747:
case 748:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 5].suggestFilters };
break;
case 749:
case 750:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 4].suggestFilters };
break;
case 751:
if ($$[$0 - 2].types[0] === $$[$0].types[0] && !$$[$0 - 5].typeSet) {
parser.applyTypeToSuggestions($$[$0 - 2].types);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 5].suggestFilters };
break;
case 752:
if ($$[$0 - 5].types[0] === $$[$0].types[0] && !$$[$0 - 2].typeSet) {
parser.applyTypeToSuggestions($$[$0 - 5].types);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 753:
if ($$[$0 - 5].types[0] === $$[$0 - 2].types[0] && !$$[$0].typeSet) {
parser.applyTypeToSuggestions($$[$0 - 5].types);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 754:
parser.valueExpressionSuggest($$[$0 - 5], $$[$0 - 1]);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 755:
case 761:
parser.suggestValueExpressionKeywords($$[$0 - 1], ['AND']);
this.$ = { types: ['BOOLEAN'] };
break;
case 756:
parser.valueExpressionSuggest($$[$0 - 3], $$[$0 - 2] + ' ' + $$[$0 - 1]);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 757:
if ($$[$0 - 4].types[0] === $$[$0 - 2].types[0] && !$$[$0 - 4].typeSet) {
parser.applyTypeToSuggestions($$[$0 - 4].types);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 4].suggestFilters };
break;
case 758:
if ($$[$0 - 4].types[0] === $$[$0 - 2].types[0] && !$$[$0 - 2].typeSet) {
parser.applyTypeToSuggestions($$[$0 - 4].types);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 759:
if ($$[$0 - 4].types[0] === $$[$0 - 2].types[0] && !$$[$0].typeSet) {
parser.applyTypeToSuggestions($$[$0 - 4].types);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 760:
parser.valueExpressionSuggest($$[$0 - 4], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 4].types);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 762:
parser.valueExpressionSuggest($$[$0 - 2], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 2].types);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 763:
case 765:
case 767:
case 769:
parser.valueExpressionSuggest(undefined, $$[$0 - 1]);
this.$ = { types: ['BOOLEAN'], typeSet: true, suggestFilters: true };
break;
case 764:
case 768:
parser.addColRefIfExists($$[$0]);
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 766:
case 770:
parser.addColRefIfExists($$[$0 - 2]);
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 771:
case 772:
parser.valueExpressionSuggest(undefined, $$[$0 - 1]);
parser.applyTypeToSuggestions(['NUMBER']);
this.$ = { types: ['NUMBER'], typeSet: true };
break;
case 773:
case 774:
case 775:
if (!$$[$0 - 2].typeSet) {
parser.applyTypeToSuggestions(['NUMBER']);
parser.addColRefIfExists($$[$0]);
}
this.$ = { types: ['NUMBER'], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 776:
case 777:
case 778:
parser.valueExpressionSuggest(undefined, $$[$0 - 1]);
parser.applyTypeToSuggestions(['NUMBER']);
this.$ = { types: ['NUMBER'], typeSet: true };
break;
case 779:
case 780:
case 781:
if (!$$[$0].typeSet) {
parser.applyTypeToSuggestions(['NUMBER']);
parser.addColRefIfExists($$[$0 - 2]);
}
this.$ = { types: ['NUMBER'], suggestFilters: $$[$0].suggestFilters };
break;
case 782:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 1].suggestFilters };
break;
case 783:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 786:
parser.valueExpressionSuggest(undefined, $$[$0]);
parser.applyTypeToSuggestions(['STRING']);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 787:
parser.valueExpressionSuggest(undefined, $$[$0 - 1] + ' ' + $$[$0]);
parser.applyTypeToSuggestions(['STRING']);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 789:
parser.valueExpressionSuggest();
parser.suggestKeywords(['WHEN']);
this.$ = { types: ['T'], typeSet: true };
break;
case 791:
parser.suggestValueExpressionKeywords($$[$0 - 2], ['WHEN']);
this.$ = { types: ['T'], typeSet: true };
break;
case 792:
this.$ = $$[$0];
this.$.suggestFilters = $$[$0 - 1].suggestFilters;
break;
case 793:
this.$ = { types: ['T'], suggestFilters: $$[$0 - 1].suggestFilters };
break;
case 794:
case 1074:
case 1079:
case 1080:
this.$ = { types: ['T'] };
break;
case 795:
case 797:
$$[$0].position = 1;
break;
case 796:
$$[$0].position = $$[$0 - 2].position + 1;
this.$ = $$[$0];
break;
case 798:
$$[$0 - 2].position += 1;
break;
case 799:
$$[$0 - 2].position = 1;
break;
case 800:
$$[$0 - 4].position += 1;
break;
case 801:
parser.valueExpressionSuggest();
$$[$0 - 2].position += 1;
break;
case 802:
parser.valueExpressionSuggest();
$$[$0 - 4].position += 1;
break;
case 803:
parser.suggestValueExpressionKeywords($$[$0 - 3]);
break;
case 804:
case 805:
parser.valueExpressionSuggest();
this.$ = { cursorAtStart: true, position: 1 };
break;
case 806:
case 807:
parser.valueExpressionSuggest();
this.$ = { position: 2 };
break;
case 811:
this.$ = { types: ['COLREF'], columnReference: $$[$0].chain };
break;
case 812:
// We need to handle arbitrary UDFs here instead of inside UserDefinedFunction or there will be a conflict
// with columnReference for functions like: db.udf(foo)
var fn = $$[$0 - 1].chain[$$[$0 - 1].chain.length - 1].name.toLowerCase();
$$[$0 - 1].lastLoc.type = 'function';
$$[$0 - 1].lastLoc.function = fn;
$$[$0 - 1].lastLoc.location = {
first_line: $$[$0 - 1].lastLoc.location.first_line,
last_line: $$[$0 - 1].lastLoc.location.last_line,
first_column: $$[$0 - 1].lastLoc.location.first_column,
last_column: $$[$0 - 1].lastLoc.location.last_column - 1
};
if ($$[$0 - 1].lastLoc !== $$[$0 - 1].firstLoc) {
$$[$0 - 1].firstLoc.type = 'database';
}
else {
delete $$[$0 - 1].lastLoc.identifierChain;
}
if ($$[$0].expression) {
this.$ = { function: fn, expression: $$[$0].expression, types: parser.findReturnTypes(fn) };
}
else {
this.$ = { function: fn, types: parser.findReturnTypes(fn) };
}
break;
case 813:
parser.addFunctionLocation(_$[$0 - 1], $$[$0 - 1]);
if ($$[$0].expression) {
this.$ = { function: $$[$0 - 1], expression: $$[$0].expression, types: parser.findReturnTypes($$[$0 - 1]) };
}
else {
this.$ = { function: $$[$0 - 1], types: parser.findReturnTypes($$[$0 - 1]) };
}
break;
case 815:
this.$ = { types: ['NULL'] };
break;
case 817:
if ($$[$0].suggestKeywords) {
this.$ = { types: ['COLREF'], columnReference: $$[$0], suggestKeywords: $$[$0].suggestKeywords };
}
else {
this.$ = { types: ['COLREF'], columnReference: $$[$0] };
}
break;
case 818:
var fn = $$[$0 - 1].chain[$$[$0 - 1].chain.length - 1].name.toLowerCase();
$$[$0 - 1].lastLoc.type = 'function';
$$[$0 - 1].lastLoc.function = fn;
$$[$0 - 1].lastLoc.location = {
first_line: $$[$0 - 1].lastLoc.location.first_line,
last_line: $$[$0 - 1].lastLoc.location.last_line,
first_column: $$[$0 - 1].lastLoc.location.first_column,
last_column: $$[$0 - 1].lastLoc.location.last_column - 1
};
if ($$[$0 - 1].lastLoc !== $$[$0 - 1].firstLoc) {
$$[$0 - 1].firstLoc.type = 'database';
}
else {
delete $$[$0 - 1].lastLoc.identifierChain;
}
if ($$[$0].position) {
parser.applyArgumentTypesToSuggestions(fn, $$[$0].position);
}
this.$ = { types: parser.findReturnTypes(fn) };
break;
case 819:
case 991:
case 992:
parser.addFunctionLocation(_$[$0 - 1], $$[$0 - 1]);
if ($$[$0].position) {
parser.applyArgumentTypesToSuggestions($$[$0 - 1], $$[$0].position);
}
this.$ = { types: parser.findReturnTypes($$[$0 - 1]) };
break;
case 821:
var lastLoc = parser.yy.locations[parser.yy.locations.length - 1];
if (lastLoc.type !== 'variable') {
lastLoc.type = 'column';
}
// used for function references with db prefix
var firstLoc = parser.yy.locations[parser.yy.locations.length - $$[$0].length];
this.$ = { chain: $$[$0], firstLoc: firstLoc, lastLoc: lastLoc };
break;
case 828:
parser.suggestValues($$[$0]);
break;
case 829:
this.$ = { types: ['NUMBER'] };
break;
case 835:
case 837:
this.$ = $$[$0 - 1] + $$[$0];
break;
case 836:
this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0];
break;
case 841:
case 842:
if (/\$\{[^}]*\}/.test($$[$0])) {
parser.addVariableLocation(_$[$0], $$[$0]);
this.$ = { types: ['STRING'], columnReference: [{ name: $$[$0] }] };
}
else {
this.$ = { types: ['STRING'] };
}
break;
case 844:
this.$ = { partialQuote: '\'', missingEndQuote: parser.yy.missingEndQuote };
break;
case 845:
this.$ = { partialQuote: '"', missingEndQuote: parser.yy.missingEndQuote };
break;
case 850:
if ($$[$0]) {
parser.addColumnAliasLocation($$[$0].location, $$[$0].alias, _$[$0 - 1]);
this.$ = { valueExpression: $$[$0 - 1], alias: $$[$0].alias };
if (!parser.yy.selectListAliases) {
parser.yy.selectListAliases = [];
}
parser.yy.selectListAliases.push({ name: $$[$0].alias, types: $$[$0 - 1].types || ['T'] });
}
else {
this.$ = { valueExpression: $$[$0 - 1] };
}
break;
case 851:
parser.addAsteriskLocation(_$[$0], [{ asterisk: true }]);
this.$ = { asterisk: true };
break;
case 852:
if ($$[$0]) {
parser.addColumnAliasLocation($$[$0].location, $$[$0].alias, _$[$0 - 1]);
}
break;
case 853:
parser.suggestFunctions();
parser.suggestColumns();
parser.addColumnAliasLocation(_$[$0], $$[$0], _$[$0 - 2]);
this.$ = { suggestAggregateFunctions: true };
break;
case 855:
this.$ = [$$[$0]];
break;
case 856:
$$[$0 - 2].push($$[$0]);
break;
case 858:
case 859:
this.$ = { cursorAtStart: true, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
break;
case 861:
parser.checkForSelectListKeywords($$[$0 - 2]);
break;
case 862:
parser.checkForSelectListKeywords($$[$0 - 3]);
break;
case 863:
this.$ = { suggestKeywords: parser.getSelectListKeywords(), suggestTables: true, suggestDatabases: true, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
break;
case 865:
case 866:
case 868:
this.$ = { suggestKeywords: parser.getSelectListKeywords(), suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true, };
break;
case 879:
this.$ = $$[$0];
if (parser.yy.latestTablePrimaries.length > 0) {
var idx = parser.yy.latestTablePrimaries.length - 1;
var tables = [];
do {
var tablePrimary = parser.yy.latestTablePrimaries[idx];
if (!tablePrimary.subQueryAlias) {
tables.unshift(tablePrimary.alias ? { identifierChain: tablePrimary.identifierChain, alias: tablePrimary.alias } : { identifierChain: tablePrimary.identifierChain });
}
idx--;
} while (idx >= 0 && tablePrimary.join && !tablePrimary.subQueryAlias);
if (tables.length > 0) {
this.$.suggestJoins = {
prependJoin: true,
tables: tables
};
}
}
break;
case 886:
if ($$[$0] && $$[$0].valueExpression) {
this.$ = $$[$0].valueExpression;
}
else {
this.$ = {};
}
this.$.joinType = $$[$0 - 2];
if ($$[$0].noJoinCondition) {
this.$.suggestJoinConditions = { prependOn: true, tablePrimaries: parser.yy.latestTablePrimaries.concat() };
}
if ($$[$0].suggestKeywords) {
this.$.suggestKeywords = $$[$0].suggestKeywords;
}
if (parser.yy.latestTablePrimaries.length > 0) {
parser.yy.latestTablePrimaries[parser.yy.latestTablePrimaries.length - 1].join = true;
}
break;
case 887:
if ($$[$0] && $$[$0].valueExpression) {
this.$ = $$[$0].valueExpression;
}
else {
this.$ = {};
}
this.$.joinType = $$[$0 - 3];
if ($$[$0].noJoinCondition) {
this.$.suggestJoinConditions = { prependOn: true, tablePrimaries: parser.yy.latestTablePrimaries.concat() };
}
if ($$[$0].suggestKeywords) {
this.$.suggestKeywords = $$[$0].suggestKeywords;
}
if (parser.yy.latestTablePrimaries.length > 0) {
parser.yy.latestTablePrimaries[parser.yy.latestTablePrimaries.length - 1].join = true;
}
break;
case 888:
this.$ = { joinType: $$[$0] };
break;
case 889:
this.$ = { joinType: $$[$0 - 1] };
break;
case 890:
if ($$[$0 - 2].suggestKeywords) {
parser.suggestKeywords($$[$0 - 2].suggestKeywords);
}
break;
case 891:
if ($$[$0].suggestKeywords) {
parser.suggestKeywords($$[$0].suggestKeywords);
}
break;
case 894:
if (parser.yy.latestTablePrimaries.length > 0) {
var idx = parser.yy.latestTablePrimaries.length - 1;
var tables = [];
do {
var tablePrimary = parser.yy.latestTablePrimaries[idx];
if (!tablePrimary.subQueryAlias) {
tables.unshift(tablePrimary.alias ? { identifierChain: tablePrimary.identifierChain, alias: tablePrimary.alias } : { identifierChain: tablePrimary.identifierChain });
}
idx--;
} while (idx >= 0 && tablePrimary.join && !tablePrimary.subQueryAlias);
if (tables.length > 0) {
parser.suggestJoins({
prependJoin: false,
joinType: $$[$0 - 2],
tables: tables
});
}
}
parser.suggestTables();
parser.suggestDatabases({
appendDot: true
});
break;
case 899:
this.$ = 'CROSS JOIN';
break;
case 900:
this.$ = 'FULL JOIN';
break;
case 901:
this.$ = 'FULL OUTER JOIN';
break;
case 902:
this.$ = 'INNER JOIN';
break;
case 903:
this.$ = 'JOIN';
break;
case 904:
this.$ = 'LEFT INNER JOIN';
break;
case 905:
this.$ = 'LEFT JOIN';
break;
case 906:
this.$ = 'LEFT OUTER JOIN';
break;
case 907:
this.$ = 'LEFT SEMI JOIN';
break;
case 908:
this.$ = 'OUTER JOIN';
break;
case 909:
case 911:
this.$ = 'RIGHT OUTER JOIN';
break;
case 910:
this.$ = 'RIGHT JOIN';
break;
case 912:
this.$ = 'RIGHT SEMI JOIN';
break;
case 913:
this.$ = 'SEMI JOIN';
break;
case 914:
case 916:
case 917:
case 919:
case 920:
case 921:
case 922:
case 924:
case 925:
case 926:
case 927:
this.$ = { suggestKeywords: ['JOIN'] };
break;
case 915:
case 918:
case 923:
this.$ = { suggestKeywords: ['OUTER'] };
break;
case 928:
this.$ = { noJoinCondition: true, suggestKeywords: ['ON'] };
break;
case 929:
this.$ = { valueExpression: $$[$0] };
break;
case 933:
parser.valueExpressionSuggest();
parser.suggestJoinConditions({ prependOn: false });
break;
case 934:
this.$ = {
primary: $$[$0 - 1]
};
if ($$[$0 - 1].identifierChain) {
if ($$[$0]) {
$$[$0 - 1].alias = $$[$0].alias;
parser.addTableAliasLocation($$[$0].location, $$[$0].alias, $$[$0 - 1].identifierChain);
}
parser.addTablePrimary($$[$0 - 1]);
}
var keywords = [];
if (!$$[$0]) {
keywords = ['AS'];
}
else if ($$[$0].suggestKeywords) {
keywords = $$[$0].suggestKeywords;
}
if (keywords.length > 0) {
this.$.suggestKeywords = keywords;
}
break;
case 935:
this.$ = {
primary: $$[$0 - 1]
};
if ($$[$0]) {
this.$.primary.alias = $$[$0].alias;
parser.addTablePrimary({ subQueryAlias: $$[$0].alias });
parser.addSubqueryAliasLocation($$[$0].location, $$[$0].alias, $$[$0 - 1].identifierChain);
}
var keywords = [];
if (!$$[$0]) {
keywords = ['AS'];
}
if (keywords.length > 0) {
this.$.suggestKeywords = keywords;
}
break;
case 936:
if ($$[$0]) {
parser.addTableAliasLocation($$[$0].location, $$[$0].alias, $$[$0 - 1].identifierChain);
}
break;
case 937:
if ($$[$0]) {
parser.addTablePrimary({ subQueryAlias: $$[$0].alias });
parser.addSubqueryAliasLocation($$[$0].location, $$[$0].alias);
}
break;
case 947:
parser.pushQueryState();
break;
case 948:
parser.popQueryState();
break;
case 950:
if ($$[$0 - 1]) {
$$[$0 - 2].alias = $$[$0 - 1].alias;
parser.addTablePrimary({ subQueryAlias: $$[$0 - 1].alias });
parser.addSubqueryAliasLocation($$[$0 - 1].location, $$[$0 - 1].alias, $$[$0 - 2].identifierChain);
}
this.$ = $$[$0 - 2];
break;
case 953:
var subQuery = parser.getSubQuery($$[$0]);
subQuery.columns.forEach(function (column) {
parser.expandIdentifierChain({ wrapper: column });
delete column.linked;
});
parser.popQueryState(subQuery);
this.$ = subQuery;
break;
case 970:
case 971:
case 972:
case 973:
this.$ = { alias: $$[$0], location: _$[$0] };
break;
case 979:
if (!$$[$0]) {
$$[$0 - 1].suggestKeywords = ['OVER'];
}
break;
case 986:
parser.suggestKeywords(['OVER']);
break;
case 989:
case 990:
parser.addFunctionLocation(_$[$0 - 1], $$[$0 - 1]);
if ($$[$0].expression) {
this.$ = { function: $$[$0 - 1], expression: $$[$0].expression, types: parser.findReturnTypes($$[$0 - 1]) };
}
else {
this.$ = { function: $$[$0 - 1], types: parser.findReturnTypes($$[$0 - 1]) };
}
break;
case 998:
this.$ = { expression: $$[$0 - 1] };
break;
case 999:
parser.valueExpressionSuggest();
this.$ = { position: 1 };
break;
case 1000:
parser.suggestValueExpressionKeywords($$[$0 - 1]);
break;
case 1008:
case 1086:
case 1107:
this.$ = { types: parser.findReturnTypes($$[$0 - 2]) };
break;
case 1009:
this.$ = { function: $$[$0 - 3], expression: $$[$0 - 2], types: parser.findReturnTypes($$[$0 - 3]) };
break;
case 1010:
parser.valueExpressionSuggest();
parser.applyArgumentTypesToSuggestions($$[$0 - 3], 1);
this.$ = { types: parser.findReturnTypes($$[$0 - 3]) };
break;
case 1011:
parser.suggestValueExpressionKeywords($$[$0 - 2]);
this.$ = { types: parser.findReturnTypes($$[$0 - 4]) };
break;
case 1012:
parser.applyArgumentTypesToSuggestions($$[$0 - 3], $$[$0 - 1].position);
this.$ = { types: parser.findReturnTypes($$[$0 - 3]) };
break;
case 1020:
case 1021:
if (parser.yy.result.suggestFunctions) {
parser.suggestAggregateFunctions();
}
break;
case 1022:
if (!$$[$0 - 2] && !$$[$0 - 1]) {
parser.suggestKeywords([{ value: 'PARTITION BY', weight: 2 }, { value: 'ORDER BY', weight: 1 }]);
}
else if (!$$[$0 - 2]) {
parser.suggestKeywords(['PARTITION BY']);
}
break;
case 1023:
if (!$$[$0 - 1]) {
parser.suggestValueExpressionKeywords($$[$0 - 3], [{ value: 'ORDER BY', weight: 2 }]);
}
else {
parser.suggestValueExpressionKeywords($$[$0 - 3]);
}
break;
case 1032:
// Only allowed in last order by
delete parser.yy.result.suggestAnalyticFunctions;
break;
case 1033:
var keywords = [];
if ($$[$0 - 2].suggestKeywords) {
keywords = parser.createWeightedKeywords($$[$0 - 2].suggestKeywords, 2);
}
if (!$$[$0]) {
keywords = keywords.concat([{ value: 'RANGE BETWEEN', weight: 1 }, { value: 'ROWS BETWEEN', weight: 1 }]);
}
parser.suggestKeywords(keywords);
break;
case 1039:
parser.suggestKeywords(['BETWEEN']);
break;
case 1040:
if (!$$[$0 - 2] && !$$[$0 - 1]) {
parser.suggestKeywords(['CURRENT ROW', 'UNBOUNDED PRECEDING']);
}
else if (!$$[$0 - 1]) {
parser.suggestKeywords(['AND']);
}
break;
case 1045:
lexer.popState();
break;
case 1046:
lexer.begin('hdfs');
break;
case 1048:
parser.suggestHdfs({ path: $$[$0 - 3] });
break;
case 1049:
parser.suggestHdfs({ path: $$[$0 - 2] });
break;
case 1050:
parser.suggestHdfs({ path: $$[$0 - 1] });
break;
case 1051:
parser.suggestHdfs({ path: '' });
break;
case 1052:
parser.suggestHdfs({ path: '' });
break;
case 1058:
parser.suggestKeywords(['PRECEDING']);
break;
case 1059:
case 1064:
parser.suggestKeywords(['ROW']);
break;
case 1063:
parser.suggestKeywords(['CURRENT ROW', 'UNBOUNDED FOLLOWING']);
break;
case 1065:
parser.suggestKeywords(['FOLLOWING']);
break;
case 1071:
parser.valueExpressionSuggest();
parser.suggestAggregateFunctions();
parser.suggestSelectListAliases(true);
break;
case 1072:
parser.suggestAggregateFunctions();
parser.suggestSelectListAliases(true);
break;
case 1073:
case 1078:
this.$ = { types: [$$[$0 - 1].toUpperCase()] };
break;
case 1075:
parser.valueExpressionSuggest();
this.$ = { types: [$$[$0 - 1].toUpperCase()] };
break;
case 1076:
case 1077:
parser.valueExpressionSuggest();
this.$ = { types: ['T'] };
break;
case 1081:
parser.suggestValueExpressionKeywords($$[$0 - 3], [{ value: 'AS', weight: 2 }]);
this.$ = { types: [$$[$0 - 1].toUpperCase()] };
break;
case 1082:
parser.suggestValueExpressionKeywords($$[$0 - 2], [{ value: 'AS', weight: 2 }]);
this.$ = { types: ['T'] };
break;
case 1083:
case 1084:
parser.suggestKeywords(parser.getTypeKeywords());
this.$ = { types: ['T'] };
break;
case 1085:
case 1091:
this.$ = { types: parser.findReturnTypes($$[$0 - 3]) };
break;
case 1087:
case 1092:
case 1106:
this.$ = { types: parser.findReturnTypes($$[$0 - 4]) };
break;
case 1088:
parser.valueExpressionSuggest();
var keywords = parser.getSelectListKeywords();
if (!$$[$0 - 2]) {
keywords.push('DISTINCT');
if (parser.yy.result.suggestKeywords) {
keywords = parser.yy.result.suggestKeywords.concat(keywords);
}
}
parser.suggestKeywords(keywords);
this.$ = { types: parser.findReturnTypes($$[$0 - 4]) };
break;
case 1089:
case 1094:
case 1109:
parser.suggestValueExpressionKeywords($$[$0 - 2]);
this.$ = { types: parser.findReturnTypes($$[$0 - 5]) };
break;
case 1090:
if ($$[$0 - 1].cursorAtStart) {
var keywords = parser.getSelectListKeywords();
if (!$$[$0 - 2]) {
keywords.push('DISTINCT');
}
parser.suggestKeywords(keywords);
}
this.$ = { types: parser.findReturnTypes($$[$0 - 4]) };
break;
case 1093:
parser.valueExpressionSuggest();
var keywords = parser.getSelectListKeywords(true);
if (!$$[$0 - 2]) {
if ($$[$0 - 4].toLowerCase() === 'group_concat') {
keywords.push('ALL');
}
else {
keywords.push('DISTINCT');
}
}
if (parser.yy.result.suggestKeywords) {
keywords = parser.yy.result.suggestKeywords.concat(keywords);
}
parser.suggestKeywords(keywords);
parser.applyArgumentTypesToSuggestions($$[$0 - 4], 1);
this.$ = { types: parser.findReturnTypes($$[$0 - 4]) };
break;
case 1095:
if ($$[$0 - 1].cursorAtStart) {
var keywords = parser.getSelectListKeywords(true);
if (!$$[$0 - 2]) {
if ($$[$0 - 4].toLowerCase() === 'group_concat') {
keywords.push('ALL');
}
else {
keywords.push('DISTINCT');
}
}
if (parser.yy.result.suggestKeywords) {
keywords = parser.yy.result.suggestKeywords.concat(keywords);
}
parser.suggestKeywords(keywords);
}
if (parser.yy.result.suggestFunctions && !parser.yy.result.suggestFunctions.types) {
parser.applyArgumentTypesToSuggestions($$[$0 - 4], $$[$0 - 1].position);
}
this.$ = { types: parser.findReturnTypes($$[$0 - 4]) };
break;
case 1108:
parser.valueExpressionSuggest();
parser.applyArgumentTypesToSuggestions($$[$0 - 4], 1);
var keywords = parser.getSelectListKeywords(true);
if (!$$[$0 - 2]) {
keywords.push('DISTINCT');
}
if (parser.yy.result.suggestKeywords) {
keywords = parser.yy.result.suggestKeywords.concat(keywords);
}
parser.suggestKeywords(keywords);
this.$ = { types: parser.findReturnTypes($$[$0 - 4]) };
break;
case 1110:
if (parser.yy.result.suggestFunctions && !parser.yy.result.suggestFunctions.types) {
parser.applyArgumentTypesToSuggestions($$[$0 - 4], 1);
}
this.$ = { types: parser.findReturnTypes($$[$0 - 4]) };
break;
case 1127:
parser.suggestKeywords(['WHERE']);
break;
case 1128:
parser.suggestKeywords(['SET']);
break;
case 1144:
parser.suggestKeywords(['=']);
break;
case 1153:
if (!parser.yy.cursorFound) {
parser.yy.result.useDatabase = $$[$0];
}
break;
case 1156:
this.$ = { inValueEdit: true };
break;
case 1157:
this.$ = { inValueEdit: true, cursorAtStart: true };
break;
case 1158:
case 1159:
case 1160:
this.$ = { suggestKeywords: ['NOT'] };
break;
case 1164:
case 1165:
case 1166:
parser.suggestFunctions({ types: ['STRING'] });
parser.suggestColumns({ types: ['STRING'] });
this.$ = { types: ['BOOLEAN'] };
break;
case 1167:
case 1169:
this.$ = parser.findCaseType($$[$0 - 1]);
break;
case 1168:
case 1171:
$$[$0 - 3].caseTypes.push($$[$0 - 1]);
this.$ = parser.findCaseType($$[$0 - 3]);
break;
case 1170:
parser.suggestValueExpressionKeywords($$[$0 - 1], ['END']);
$$[$0 - 3].caseTypes.push($$[$0 - 1]);
this.$ = parser.findCaseType($$[$0 - 3]);
break;
case 1172:
this.$ = parser.findCaseType($$[$0 - 2]);
break;
case 1173:
if ($$[$0].toLowerCase() !== 'end') {
parser.suggestValueExpressionKeywords($$[$0 - 3], [{ value: 'END', weight: 3 }, { value: 'ELSE', weight: 2 }, { value: 'WHEN', weight: 1 }]);
}
else {
parser.suggestValueExpressionKeywords($$[$0 - 3], [{ value: 'ELSE', weight: 2 }, { value: 'WHEN', weight: 1 }]);
}
this.$ = parser.findCaseType($$[$0 - 3]);
break;
case 1174:
if ($$[$0].toLowerCase() !== 'end') {
parser.suggestValueExpressionKeywords($$[$0 - 2], [{ value: 'END', weight: 3 }, { value: 'ELSE', weight: 2 }, { value: 'WHEN', weight: 1 }]);
}
else {
parser.suggestValueExpressionKeywords($$[$0 - 2], [{ value: 'ELSE', weight: 2 }, { value: 'WHEN', weight: 1 }]);
}
this.$ = parser.findCaseType($$[$0 - 2]);
break;
case 1175:
$$[$0 - 3].caseTypes.push($$[$0 - 1]);
this.$ = parser.findCaseType($$[$0 - 3]);
this.$.suggestFilters = $$[$0 - 1].suggestFilters;
break;
case 1176:
parser.valueExpressionSuggest();
this.$ = parser.findCaseType($$[$0 - 3]);
break;
case 1177:
parser.valueExpressionSuggest();
this.$ = { types: ['T'], typeSet: true };
break;
case 1178:
parser.valueExpressionSuggest();
parser.suggestKeywords(['WHEN']);
this.$ = $$[$0 - 1];
break;
case 1179:
parser.valueExpressionSuggest();
parser.suggestKeywords(['WHEN']);
this.$ = { types: ['T'] };
break;
case 1182:
this.$ = { caseTypes: [$$[$0]], lastType: $$[$0] };
break;
case 1183:
$$[$0 - 1].caseTypes.push($$[$0]);
this.$ = { caseTypes: $$[$0 - 1].caseTypes, lastType: $$[$0] };
break;
case 1187:
parser.suggestValueExpressionKeywords($$[$0 - 2], ['WHEN']);
break;
case 1190:
this.$ = { caseTypes: [{ types: ['T'] }], suggestFilters: $$[$0].suggestFilters };
break;
case 1191:
this.$ = { caseTypes: [{ types: ['T'] }], suggestFilters: $$[$0 - 1].suggestFilters };
break;
case 1192:
this.$ = { caseTypes: [$$[$0]], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 1193:
case 1194:
this.$ = { caseTypes: [$$[$0]], suggestFilters: $$[$0].suggestFilters };
break;
case 1195:
parser.suggestKeywords(['WHEN']);
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
case 1196:
parser.suggestKeywords(['WHEN']);
this.$ = { caseTypes: [$$[$0]] };
break;
case 1197:
parser.valueExpressionSuggest();
parser.suggestKeywords(['WHEN']);
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
case 1198:
parser.valueExpressionSuggest();
parser.suggestKeywords(['WHEN']);
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
case 1199:
case 1201:
parser.valueExpressionSuggest();
this.$ = { caseTypes: [{ types: ['T'] }], suggestFilters: true };
break;
case 1200:
parser.valueExpressionSuggest();
parser.suggestKeywords(['THEN']);
this.$ = { caseTypes: [{ types: ['T'] }], suggestFilters: true };
break;
case 1202:
parser.valueExpressionSuggest();
this.$ = { caseTypes: [$$[$0]], suggestFilters: true };
break;
case 1203:
parser.suggestValueExpressionKeywords($$[$0 - 1], ['THEN']);
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
case 1204:
parser.suggestValueExpressionKeywords($$[$0 - 2], ['THEN']);
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
case 1205:
case 1206:
case 1207:
case 1208:
parser.valueExpressionSuggest();
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
}
},
table: [o($V0, $V1, { 174: 1, 175: 2 }), { 1: [3] }, o($V2, $V3, { 176: 3, 180: 4, 3: 5, 160: 6, 29: 7, 4: 8, 5: 9, 6: 10, 7: 11, 8: 12, 161: 13, 162: 14, 318: 15, 183: 16, 16: 17, 17: 18, 33: 19, 34: 20, 35: 21, 36: 22, 143: 23, 144: 24, 145: 25, 146: 26, 147: 27, 163: 30, 21: 34, 27: 35, 13: $V4, 20: $V5, 40: $V6, 152: $V7, 158: $V8, 167: $V9, 323: $Va, 333: $Vb, 495: $Vc, 509: $Vd }), { 177: [1, 41], 181: [1, 42] }, o($V2, [2, 278]), o($V2, [2, 284]), o($V2, [2, 285]), o($V2, [2, 286]), o($V2, [2, 1]), o($V2, [2, 2]), o($V2, [2, 3]), o($V2, [2, 4]), o($V2, [2, 5]), o($V2, [2, 257]), o($V2, [2, 258]), o($Ve, $Vf, { 319: 43, 327: 44, 329: 45, 262: $Vg }), { 71: [1, 48], 318: 47, 323: $Va }, o($V2, [2, 11]), o($V2, [2, 12]), o($V2, [2, 33]), o($V2, [2, 34]), o($V2, [2, 35]), o($V2, [2, 36]), o($V2, [2, 217]), o($V2, [2, 218]), o($V2, [2, 219]), o($V2, [2, 220]), o($V2, [2, 221]), { 43: 51, 105: $Vh, 142: $Vi, 185: 54, 186: $Vj, 187: $Vk, 188: $Vl, 198: [1, 50], 493: 49 }, { 43: 58, 105: $Vh, 142: $Vi, 185: 54, 186: $Vj, 187: $Vk, 188: $Vl }, o($V2, [2, 259]), { 43: 64, 105: $Vh, 111: 63, 142: $Vi, 185: 54, 186: $Vj, 187: $Vk, 188: $Vl, 204: $Vm, 306: 62, 308: 61, 496: 59, 502: 60 }, o([53, 54, 71, 87, 88, 99, 104, 105, 142, 158, 186, 187, 188, 190, 191, 192, 193, 197, 199, 203, 204, 208, 209, 211, 221, 222, 230, 238, 239, 254, 255, 257, 261, 263, 264, 265, 266, 268], $Vn, { 324: 66, 198: $Vo, 217: $Vp }), { 43: 64, 105: $Vh, 111: 71, 142: $Vi, 185: 54, 186: $Vj, 187: $Vk, 188: $Vl, 204: $Vm, 334: 69, 336: 70 }, { 22: 72, 117: [1, 73] }, { 28: [1, 74] }, { 24: [1, 76], 32: [1, 77], 41: 75, 142: [1, 78], 214: $Vq, 251: $Vr }, { 24: [1, 83], 32: [1, 84], 41: 81, 142: [1, 82], 214: $Vq, 251: $Vr }, { 24: [1, 85] }, { 168: [1, 86] }, { 24: [1, 87], 32: [1, 88] }, { 1: [2, 273] }, o($V0, $V1, { 175: 89 }), o($Ve, [2, 547]), o($Ve, [2, 561], { 329: 90, 262: $Vg }), o($Vs, [2, 563]), o([198, 217, 323], $V1, { 175: 91 }), o($Ve, $Vf, { 327: 44, 329: 45, 319: 92, 262: $Vg }), { 29: 93, 183: 16, 318: 15, 323: $Va, 333: $Vb }, { 193: [1, 95], 194: [1, 94] }, o($V2, [2, 1112]), o($Vt, [2, 1113]), o($Vu, [2, 296]), o($Vu, [2, 297]), o($Vu, [2, 298]), o($Vu, [2, 293]), o($Vu, [2, 294]), o($Vu, [2, 295]), o($V2, [2, 1153]), { 13: [1, 96] }, { 13: [2, 1132] }, { 13: [2, 1134] }, { 13: [2, 510], 43: 64, 105: $Vh, 111: 97, 142: $Vi, 185: 54, 186: $Vj, 187: $Vk, 188: $Vl, 204: $Vm }, o($Vv, [2, 506], { 193: [1, 98] }), o($Vu, [2, 503]), { 55: [1, 99], 204: [1, 100] }, { 43: 64, 53: $Vw, 54: $Vx, 71: $Vy, 79: 129, 87: $Vz, 88: $VA, 99: $VB, 104: $VC, 105: $Vh, 111: 140, 130: 103, 142: $Vi, 158: $VD, 185: 54, 186: $Vj, 187: $Vk, 188: $Vl, 190: $VE, 191: $VF, 192: $VG, 193: $VH, 197: $VI, 199: $VJ, 203: $VK, 204: $Vm, 208: $VL, 209: $VM, 211: $VN, 221: $VO, 222: $VP, 230: $VQ, 238: $VR, 239: $VS, 254: $VT, 255: $VU, 257: $VV, 261: $VW, 263: $VX, 264: $VY, 265: $VZ, 266: $V_, 268: $V$, 273: 137, 276: 138, 290: 113, 310: 119, 325: 101, 377: 127, 378: 105, 392: 114, 394: 115, 395: 116, 402: 118, 404: 128, 406: 135, 407: 136, 408: 139, 409: 102, 450: 124, 452: 125, 454: 126, 462: 130, 463: 131, 464: 132, 491: 143 }, o($V01, [2, 594]), o($V01, [2, 595]), o([71, 323], [2, 581], { 77: [1, 159] }), o($V11, [2, 583]), { 28: [1, 160] }, o($V2, [2, 16]), { 71: [1, 161] }, { 29: 162, 183: 16, 318: 15, 323: $Va, 333: $Vb }, o($V21, $V31, { 42: 163, 230: $V41 }), o($V51, $V31, { 42: 165, 230: $V41 }), o($V51, $V31, { 42: 166, 230: $V41 }), { 43: 167, 105: $Vh, 142: $Vi, 185: 54, 186: $Vj, 187: $Vk, 188: $Vl }, o($V61, [2, 413]), o($V61, [2, 414]), o($V51, $V71, { 153: 168, 230: $V81 }), { 43: 170, 105: $Vh, 142: $Vi, 185: 54, 186: $Vj, 187: $Vk, 188: $Vl }, o($V51, $V71, { 153: 171, 230: $V81 }), o($V51, $V71, { 153: 172, 230: $V81 }), o($V51, $V71, { 153: 173, 230: $V81 }), o($V51, [2, 271], { 169: 174, 24: [1, 175] }), { 25: 176, 43: 64, 105: $Vh, 111: 177, 142: $Vi, 185: 54, 186: $Vj, 187: $Vk, 188: $Vl, 204: $Vm }, { 25: 178, 43: 64, 105: $Vh, 111: 177, 142: $Vi, 185: 54, 186: $Vj, 187: $Vk, 188: $Vl, 204: $Vm }, o($V2, $V3, { 180: 4, 3: 5, 160
defaultActions: { 41: [2, 273], 60: [2, 1132], 61: [2, 1134], 97: [2, 511], 120: [2, 993], 121: [2, 994], 122: [2, 995], 123: [2, 996], 151: [2, 1096], 152: [2, 1097], 153: [2, 1098], 154: [2, 1099], 155: [2, 1100], 156: [2, 1101], 157: [2, 1102], 158: [2, 1103], 176: [2, 21], 178: [2, 30], 198: [2, 1146], 341: [2, 1008], 417: [2, 953], 418: [2, 955], 419: [2, 957], 420: [2, 959], 421: [2, 961], 422: [2, 963], 423: [2, 965], 424: [2, 967], 432: [2, 1009], 554: [2, 1031], 555: [2, 1036], 629: [2, 470], 656: [2, 1037], 660: [2, 1038], 675: [2, 1061], 676: [2, 1062] },
parseError: function parseError(str, hash) {
if (hash.recoverable) {
this.trace(str);
}
else {
var error = new Error(str);
error.hash = hash;
throw error;
}
},
parse: function parse(input) {
var self = this, stack = [0], tstack = [], // token stack
vstack = [null], // semantic value stack
lstack = [], // location stack
table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
var args = lstack.slice.call(arguments, 1);
//this.reductionCount = this.shiftCount = 0;
var lexer = Object.create(this.lexer);
var sharedState = { yy: {} };
// copy state
for (var k in this.yy) {
if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
sharedState.yy[k] = this.yy[k];
}
}
lexer.setInput(input, sharedState.yy);
sharedState.yy.lexer = lexer;
sharedState.yy.parser = this;
if (typeof lexer.yylloc == 'undefined') {
lexer.yylloc = {};
}
var yyloc = lexer.yylloc;
lstack.push(yyloc);
var ranges = lexer.options && lexer.options.ranges;
if (typeof sharedState.yy.parseError === 'function') {
this.parseError = sharedState.yy.parseError;
}
else {
this.parseError = Object.getPrototypeOf(this).parseError;
}
function popStack(n) {
stack.length = stack.length - 2 * n;
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
_token_stack: var lex = function () {
var token;
token = lexer.lex() || EOF;
// if token isn't its numeric value, convert
if (typeof token !== 'number') {
token = self.symbols_[token] || token;
}
return token;
};
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
while (true) {
// retreive state number from top of stack
state = stack[stack.length - 1];
// use default actions if available
if (this.defaultActions[state]) {
action = this.defaultActions[state];
}
else {
if (symbol === null || typeof symbol == 'undefined') {
symbol = lex();
}
// read action for current state and first input
action = table[state] && table[state][symbol];
}
_handle_error:
// handle parse error
if (typeof action === 'undefined' || !action.length || !action[0]) {
var error_rule_depth;
var errStr = '';
// Return the rule stack depth where the nearest error rule can be found.
// Return FALSE when no error recovery rule was found.
function locateNearestErrorRecoveryRule(state) {
var stack_probe = stack.length - 1;
var depth = 0;
// try to recover from error
for (;;) {
// check for error recovery rule in this state
if ((TERROR.toString()) in table[state]) {
return depth;
}
if (state === 0 || stack_probe < 2) {
return false; // No suitable error recovery rule available.
}
stack_probe -= 2; // popStack(1): [symbol, action]
state = stack[stack_probe];
++depth;
}
}
if (!recovering) {
// first see if there's any chance at hitting an error recovery rule:
error_rule_depth = locateNearestErrorRecoveryRule(state);
// Report error
expected = [];
for (p in table[state]) {
if (this.terminals_[p] && p > TERROR) {
expected.push("'" + this.terminals_[p] + "'");
}
}
if (lexer.showPosition) {
errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'";
}
else {
errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " +
(symbol == EOF ? "end of input" :
("'" + (this.terminals_[symbol] || symbol) + "'"));
}
this.parseError(errStr, {
text: lexer.match,
token: this.terminals_[symbol] || symbol,
line: lexer.yylineno,
loc: lexer.yylloc, ruleId: stack.slice(stack.length - 2, stack.length).join(''),
expected: expected,
recoverable: (error_rule_depth !== false)
});
}
else if (preErrorSymbol !== EOF) {
error_rule_depth = locateNearestErrorRecoveryRule(state);
}
// just recovered from another error
if (recovering == 3) {
if (symbol === EOF || preErrorSymbol === EOF) {
throw new Error(errStr || 'Parsing halted while starting to recover from another error.');
}
// discard current lookahead and grab another
yyleng = lexer.yyleng;
yytext = lexer.yytext;
yylineno = lexer.yylineno;
yyloc = lexer.yylloc;
symbol = lex();
}
// try to recover from error
if (error_rule_depth === false) {
throw new Error(errStr || 'Parsing halted. No suitable error recovery rule available.');
}
popStack(error_rule_depth);
preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token
symbol = TERROR; // insert generic error symbol as new lookahead
state = stack[stack.length - 1];
action = table[state] && table[state][TERROR];
recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
}
// this shouldn't happen, unless resolve defaults are off
if (action[0] instanceof Array && action.length > 1) {
throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
}
switch (action[0]) {
case 1: // shift
//this.shiftCount++;
stack.push(symbol);
vstack.push(lexer.yytext);
lstack.push(lexer.yylloc);
stack.push(action[1]); // push state
symbol = null;
if (!preErrorSymbol) { // normal execution/no error
yyleng = lexer.yyleng;
yytext = lexer.yytext;
yylineno = lexer.yylineno;
yyloc = lexer.yylloc;
if (recovering > 0) {
recovering--;
}
}
else {
// error just occurred, resume old lookahead f/ before error
symbol = preErrorSymbol;
preErrorSymbol = null;
}
break;
case 2:
// reduce
//this.reductionCount++;
len = this.productions_[action[1]][1];
// perform semantic action
yyval.$ = vstack[vstack.length - len]; // default to $$ = $1
// default location, uses first token for firsts, last for lasts
yyval._$ = {
first_line: lstack[lstack.length - (len || 1)].first_line,
last_line: lstack[lstack.length - 1].last_line,
first_column: lstack[lstack.length - (len || 1)].first_column,
last_column: lstack[lstack.length - 1].last_column
};
if (ranges) {
yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
}
r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args));
if (typeof r !== 'undefined') {
return r;
}
// pop off stack
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
vstack.push(yyval.$);
lstack.push(yyval._$);
// goto new state = table[STATE][NONTERMINAL]
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
// accept
return true;
}
}
return true;
} };
sqlParseSupport_1.default.initSyntaxParser(parser); /* generated by jison-lex 0.3.4 */
var lexer = (function () {
var lexer = ({
EOF: 1,
parseError: function parseError(str, hash) {
if (this.yy.parser) {
this.yy.parser.parseError(str, hash);
}
else {
throw new Error(str);
}
},
// resets the lexer, sets new input
setInput: function (input, yy) {
this.yy = yy || this.yy || {};
this._input = input;
this._more = this._backtrack = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = '';
this.conditionStack = ['INITIAL'];
this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
};
if (this.options.ranges) {
this.yylloc.range = [0, 0];
}
this.offset = 0;
return this;
},
// consumes and returns one char from the input
input: function () {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.offset++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno++;
this.yylloc.last_line++;
}
else {
this.yylloc.last_column++;
}
if (this.options.ranges) {
this.yylloc.range[1]++;
}
this._input = this._input.slice(1);
return ch;
},
// unshifts one char (or a string) into the input
unput: function (ch) {
var len = ch.length;
var lines = ch.split(/(?:\r\n?|\n)/g);
this._input = ch + this._input;
this.yytext = this.yytext.substr(0, this.yytext.length - len);
//this.yyleng -= len;
this.offset -= len;
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1);
this.matched = this.matched.substr(0, this.matched.length - 1);
if (lines.length - 1) {
this.yylineno -= lines.length - 1;
}
var r = this.yylloc.range;
this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: lines ?
(lines.length === oldLines.length ? this.yylloc.first_column : 0)
+ oldLines[oldLines.length - lines.length].length - lines[0].length :
this.yylloc.first_column - len
};
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
this.yyleng = this.yytext.length;
return this;
},
// When called from action, caches matched text and appends it on next action
more: function () {
this._more = true;
return this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject: function () {
if (this.options.backtrack_lexer) {
this._backtrack = true;
}
else {
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
return this;
},
// retain first n characters of the match
less: function (n) {
this.unput(this.match.slice(n));
},
// displays already matched input, i.e. for error messages
pastInput: function () {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput: function () {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20 - next.length);
}
return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition: function () {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match: function (match, indexed_rule) {
var token, lines, backup;
if (this.options.backtrack_lexer) {
// save context
backup = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
};
if (this.options.ranges) {
backup.yylloc.range = this.yylloc.range.slice(0);
}
}
lines = match[0].match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno += lines.length;
}
this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ?
lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
this.yylloc.last_column + match[0].length
};
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
if (this.options.ranges) {
this.yylloc.range = [this.offset, this.offset += this.yyleng];
}
this._more = false;
this._backtrack = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
if (this.done && this._input) {
this.done = false;
}
if (token) {
return token;
}
else if (this._backtrack) {
// recover context
for (var k in backup) {
this[k] = backup[k];
}
return false; // rule action called reject() implying the next rule should be tested instead.
}
return false;
},
// return next match in input
next: function () {
if (this.done) {
return this.EOF;
}
if (!this._input) {
this.done = true;
}
var token, match, tempMatch, index;
if (!this._more) {
this.yytext = '';
this.match = '';
}
var rules = this._currentRules();
for (var i = 0; i < rules.length; i++) {
tempMatch = this._input.match(this.rules[rules[i]]);
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
index = i;
if (this.options.backtrack_lexer) {
token = this.test_match(tempMatch, rules[i]);
if (token !== false) {
return token;
}
else if (this._backtrack) {
match = false;
continue; // rule action called reject() implying a rule MISmatch.
}
else {
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
return false;
}
}
else if (!this.options.flex) {
break;
}
}
}
if (match) {
token = this.test_match(match, rules[index]);
if (token !== false) {
return token;
}
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
return false;
}
if (this._input === "") {
return this.EOF;
}
else {
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
},
// return next match that has a token
lex: function lex() {
var r = this.next();
if (r) {
return r;
}
else {
return this.lex();
}
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin: function begin(condition) {
this.conditionStack.push(condition);
},
// pop the previously active lexer condition state off the condition stack
popState: function popState() {
var n = this.conditionStack.length - 1;
if (n > 0) {
return this.conditionStack.pop();
}
else {
return this.conditionStack[0];
}
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules: function _currentRules() {
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
}
else {
return this.conditions["INITIAL"].rules;
}
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState: function topState(n) {
n = this.conditionStack.length - 1 - Math.abs(n || 0);
if (n >= 0) {
return this.conditionStack[n];
}
else {
return "INITIAL";
}
},
// alias for begin(condition)
pushState: function pushState(condition) {
this.begin(condition);
},
// return the number of states currently on the stack
stateStackSize: function stateStackSize() {
return this.conditionStack.length;
},
options: { "case-insensitive": true, "flex": true },
performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
var YYSTATE = YY_START;
switch ($avoiding_name_collisions) {
case 0: /* skip whitespace */
break;
case 1: /* skip comments */
break;
case 2: /* skip comments */
break;
case 3:
parser.yy.partialCursor = false;
parser.yy.cursorFound = yy_.yylloc;
return 14;
break;
case 4:
parser.yy.partialCursor = true;
parser.yy.cursorFound = yy_.yylloc;
return 271;
break;
case 5:
this.popState();
return 382;
break;
case 6:
return 198;
break;
case 7:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('ALTER', yy_.yylloc, yy.lexer.upcomingInput());
return 20;
break;
case 8:
return 200;
break;
case 9:
return 28;
break;
case 10:
return 202;
break;
case 11:
this.begin('between');
return 205;
break;
case 12:
return 206;
break;
case 13:
return 207;
break;
case 14:
return 118;
break;
case 15:
return 283;
break;
case 16:
return 208;
break;
case 17:
return 210;
break;
case 18:
return 50;
break;
case 19:
parser.determineCase(yy_.yytext);
return 40;
break;
case 20:
return 212;
break;
case 21:
return 213;
break;
case 22:
return 214;
break;
case 23:
return 215;
break;
case 24:
return 216;
break;
case 25:
return 217;
break;
case 26:
return 201;
break;
case 27:
return 218;
break;
case 28:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('DROP', yy_.yylloc, yy.lexer.upcomingInput());
return 152;
break;
case 29:
return 219;
break;
case 30:
return 220;
break;
case 31:
parser.yy.correlatedSubQuery = true;
return 221;
break;
case 32:
return 222;
break;
case 33:
return 223;
break;
case 34:
return 224;
break;
case 35:
parser.determineCase(yy_.yytext);
return 225;
break;
case 36:
return 226;
break;
case 37:
return 227;
break;
case 38:
return 228;
break;
case 39:
return 230;
break;
case 40:
return 231;
break;
case 41:
return 232;
break;
case 42:
return 167;
break;
case 43:
return 233;
break;
case 44:
return 168;
break;
case 45:
return 234;
break;
case 46:
return 235;
break;
case 47:
return 236;
break;
case 48:
return 69;
break;
case 49:
return 237;
break;
case 50:
return 87;
break;
case 51:
return 88;
break;
case 52:
return 240;
break;
case 53:
return 186;
break;
case 54:
return 241;
break;
case 55:
return 242;
break;
case 56:
return 243;
break;
case 57:
return 117;
break;
case 58:
return 245;
break;
case 59:
return 157;
break;
case 60:
return 121;
break;
case 61:
return 246;
break;
case 62:
return 247;
break;
case 63:
return 248;
break;
case 64:
return 249;
break;
case 65:
return 142;
break;
case 66:
return 250;
break;
case 67:
return 251;
break;
case 68:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('SELECT', yy_.yylloc);
return 323;
break;
case 69:
return 252;
break;
case 70:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('SET', yy_.yylloc);
return 13;
break;
case 71:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('SHOW', yy_.yylloc);
return 'SHOW';
break;
case 72:
return 253;
break;
case 73:
return 256;
break;
case 74:
return 24;
break;
case 75:
return 258;
break;
case 76:
return 259;
break;
case 77:
return 260;
break;
case 78:
return 'TO';
break;
case 79:
return 261;
break;
case 80:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('TRUNCATE', yy_.yylloc, yy.lexer.upcomingInput());
return 158;
break;
case 81:
return 482;
break;
case 82:
return 262;
break;
case 83:
parser.determineCase(yy_.yytext);
return 495;
break;
case 84:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('USE', yy_.yylloc);
return 509;
break;
case 85:
return 132;
break;
case 86:
return 267;
break;
case 87:
return 32;
break;
case 88:
return 269;
break;
case 89:
return 270;
break;
case 90:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('WITH', yy_.yylloc);
return 333;
break;
case 91:
return 244;
break;
case 92:
return 142;
break;
case 93:
yy.lexer.unput('(');
yy_.yytext = 'avg';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 203;
break;
case 94:
yy.lexer.unput('(');
yy_.yytext = 'cast';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 209;
break;
case 95:
yy.lexer.unput('(');
yy_.yytext = 'count';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 211;
break;
case 96:
yy.lexer.unput('(');
yy_.yytext = 'max';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 238;
break;
case 97:
yy.lexer.unput('(');
yy_.yytext = 'min';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 239;
break;
case 98:
yy.lexer.unput('(');
yy_.yytext = 'stddev_pop';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 254;
break;
case 99:
yy.lexer.unput('(');
yy_.yytext = 'stddev_samp';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 255;
break;
case 100:
yy.lexer.unput('(');
yy_.yytext = 'sum';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 257;
break;
case 101:
yy.lexer.unput('(');
yy_.yytext = 'var_pop';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 265;
break;
case 102:
yy.lexer.unput('(');
yy_.yytext = 'var_samp';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 266;
break;
case 103:
yy.lexer.unput('(');
yy_.yytext = 'variance';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 268;
break;
case 104:
yy.lexer.unput('(');
yy_.yytext = 'cume_dist';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 199;
break;
case 105:
yy.lexer.unput('(');
yy_.yytext = 'dense_rank';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 199;
break;
case 106:
yy.lexer.unput('(');
yy_.yytext = 'first_value';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 199;
break;
case 107:
yy.lexer.unput('(');
yy_.yytext = 'lag';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 199;
break;
case 108:
yy.lexer.unput('(');
yy_.yytext = 'last_value';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 199;
break;
case 109:
yy.lexer.unput('(');
yy_.yytext = 'lead';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 199;
break;
case 110:
yy.lexer.unput('(');
yy_.yytext = 'rank';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 199;
break;
case 111:
yy.lexer.unput('(');
yy_.yytext = 'row_number';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 199;
break;
case 112:
return 263;
break;
case 113:
return 263;
break;
case 114:
return 264;
break;
case 115:
return 187;
break;
case 116:
parser.yy.cursorFound = true;
return 14;
break;
case 117:
parser.yy.cursorFound = true;
return 271;
break;
case 118:
return 229;
break;
case 119:
parser.addFileLocation(yy_.yylloc, yy_.yytext);
return 487;
break;
case 120:
this.popState();
return 488;
break;
case 121:
return 177;
break;
case 122:
return 200;
break;
case 123:
return 241;
break;
case 124:
return 194;
break;
case 125:
return 100;
break;
case 126:
return 101;
break;
case 127:
return 134;
break;
case 128:
return 134;
break;
case 129:
return 134;
break;
case 130:
return 134;
break;
case 131:
return 134;
break;
case 132:
return 192;
break;
case 133:
return 191;
break;
case 134:
return 201;
break;
case 135:
return 201;
break;
case 136:
return 201;
break;
case 137:
return 201;
break;
case 138:
return 201;
break;
case 139:
return 201;
break;
case 140:
return 77;
break;
case 141:
return 193;
break;
case 142:
return 112;
break;
case 143:
return 181;
break;
case 144:
return 197;
break;
case 145:
return 190;
break;
case 146:
return 71;
break;
case 147:
return 73;
break;
case 148:
return 195;
break;
case 149:
return 196;
break;
case 150:
return 188;
break;
case 151:
this.begin('backtickedValue');
return 204;
break;
case 152:
if (parser.handleQuotedValueWithCursor(this, yy_.yytext, yy_.yylloc, '`')) {
return 275;
}
return 55;
break;
case 153:
this.popState();
return 204;
break;
case 154:
this.begin('singleQuotedValue');
return 53;
break;
case 155:
if (parser.handleQuotedValueWithCursor(this, yy_.yytext, yy_.yylloc, '\'')) {
return 275;
}
return 55;
break;
case 156:
this.popState();
return 53;
break;
case 157:
this.begin('doubleQuotedValue');
return 54;
break;
case 158:
if (parser.handleQuotedValueWithCursor(this, yy_.yytext, yy_.yylloc, '"')) {
return 275;
}
return 55;
break;
case 159:
this.popState();
return 54;
break;
case 160:
return 177;
break;
case 161: /* To prevent console logging of unknown chars */
break;
case 162:
break;
case 163:
break;
case 164:
break;
case 165:
break;
case 166:
break;
case 167:
console.log(yy_.yytext);
break;
}
},
rules: [/^(?:\s)/i, /^(?:--.*)/i, /^(?:[\/][*][^*]*[*]+([^\/*][^*]*[*]+)*[\/])/i, /^(?:\u2020)/i, /^(?:\u2021)/i, /^(?:AND)/i, /^(?:ALL)/i, /^(?:ALTER)/i, /^(?:AND)/i, /^(?:AS)/i, /^(?:ASC)/i, /^(?:BETWEEN)/i, /^(?:BIGINT)/i, /^(?:BOOLEAN)/i, /^(?:BY)/i, /^(?:CASCADE)/i, /^(?:CASE)/i, /^(?:CHAR)/i, /^(?:COMMENT)/i, /^(?:CREATE)/i, /^(?:CROSS)/i, /^(?:CURRENT)/i, /^(?:DATABASE)/i, /^(?:DECIMAL)/i, /^(?:DESC)/i, /^(?:DISTINCT)/i, /^(?:DIV)/i, /^(?:DOUBLE)/i, /^(?:DROP)/i, /^(?:ELSE)/i, /^(?:END)/i, /^(?:EXISTS)/i, /^(?:FALSE)/i, /^(?:FLOAT)/i, /^(?:FOLLOWING)/i, /^(?:FROM)/i, /^(?:FULL)/i, /^(?:GROUP)/i, /^(?:HAVING)/i, /^(?:IF)/i, /^(?:IN)/i, /^(?:INNER)/i, /^(?:INSERT)/i, /^(?:INT)/i, /^(?:INTO)/i, /^(?:IS)/i, /^(?:JOIN)/i, /^(?:LEFT)/i, /^(?:LIKE)/i, /^(?:LIMIT)/i, /^(?:NOT)/i, /^(?:NULL)/i, /^(?:ON)/i, /^(?:OPTION)/i, /^(?:OR)/i, /^(?:ORDER)/i, /^(?:OUTER)/i, /^(?:PARTITION)/i, /^(?:PRECEDING)/i, /^(?:PURGE)/i, /^(?:RANGE)/i, /^(?:REGEXP)/i, /^(?:RIGHT)/i, /^(?:RLIKE)/i, /^(?:ROW)/i, /^(?:ROLE)/i, /^(?:ROWS)/i, /^(?:SCHEMA)/i, /^(?:SELECT)/i, /^(?:SEMI)/i, /^(?:SET)/i, /^(?:SHOW)/i, /^(?:SMALLINT)/i, /^(?:STRING)/i, /^(?:TABLE)/i, /^(?:THEN)/i, /^(?:TIMESTAMP)/i, /^(?:TINYINT)/i, /^(?:TO)/i, /^(?:TRUE)/i, /^(?:TRUNCATE)/i, /^(?:UNBOUNDED)/i, /^(?:UNION)/i, /^(?:UPDATE)/i, /^(?:USE)/i, /^(?:VALUES)/i, /^(?:VARCHAR)/i, /^(?:VIEW)/i, /^(?:WHEN)/i, /^(?:WHERE)/i, /^(?:WITH)/i, /^(?:OVER)/i, /^(?:ROLE)/i, /^(?:AVG\s*\()/i, /^(?:CAST\s*\()/i, /^(?:COUNT\s*\()/i, /^(?:MAX\s*\()/i, /^(?:MIN\s*\()/i, /^(?:STDDEV_POP\s*\()/i, /^(?:STDDEV_SAMP\s*\()/i, /^(?:SUM\s*\()/i, /^(?:VAR_POP\s*\()/i, /^(?:VAR_SAMP\s*\()/i, /^(?:VARIANCE\s*\()/i, /^(?:CUME_DIST\s*\()/i, /^(?:DENSE_RANK\s*\()/i, /^(?:FIRST_VALUE\s*\()/i, /^(?:LAG\s*\()/i, /^(?:LAST_VALUE\s*\()/i, /^(?:LEAD\s*\()/i, /^(?:RANK\s*\()/i, /^(?:ROW_NUMBER\s*\()/i, /^(?:[0-9]+)/i, /^(?:[0-9]+(?:[YSL]|BD)?)/i, /^(?:[0-9]+E)/i, /^(?:[A-Za-z0-9_]+)/i, /^(?:\u2020)/i, /^(?:\u2021)/i, /^(?:\s+['"])/i, /^(?:[^'"\u2020\u2021]+)/i, /^(?:['"])/i, /^(?:$)/i, /^(?:&&)/i, /^(?:\|\|)/i, /^(?:=)/i, /^(?:<)/i, /^(?:>)/i, /^(?:!=)/i, /^(?:<=)/i, /^(?:>=)/i, /^(?:<>)/i, /^(?:<=>)/i, /^(?:-)/i, /^(?:\*)/i, /^(?:\+)/i, /^(?:\/)/i, /^(?:%)/i, /^(?:\|)/i, /^(?:\^)/i, /^(?:&)/i, /^(?:,)/i, /^(?:\.)/i, /^(?::)/i, /^(?:;)/i, /^(?:~)/i, /^(?:!)/i, /^(?:\()/i, /^(?:\))/i, /^(?:\[)/i, /^(?:\])/i, /^(?:\$\{[^}]*\})/i, /^(?:`)/i, /^(?:[^`]+)/i, /^(?:`)/i, /^(?:')/i, /^(?:(?:\\\\|\\[']|[^'])+)/i, /^(?:')/i, /^(?:")/i, /^(?:(?:\\\\|\\["]|[^"])+)/i, /^(?:")/i, /^(?:$)/i, /^(?:.)/i, /^(?:.)/i, /^(?:.)/i, /^(?:.)/i, /^(?:.)/i, /^(?:.)/i, /^(?:.)/i],
conditions: { "hdfs": { "rules": [116, 117, 118, 119, 120, 121, 163], "inclusive": false }, "doubleQuotedValue": { "rules": [158, 159, 166], "inclusive": false }, "singleQuotedValue": { "rules": [155, 156, 165], "inclusive": false }, "backtickedValue": { "rules": [152, 153, 164], "inclusive": false }, "between": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 154, 157, 160, 161, 162, 167], "inclusive": true }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 154, 157, 160, 161, 167], "inclusive": true } }
});
return lexer;
})();
parser.lexer = lexer;
function Parser() {
this.yy = {};
}
Parser.prototype = parser;
parser.Parser = Parser;
return new Parser;
})();
exports.default = genericSyntaxParser;