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

3383 lines
438 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 genericAutocompleteParser = (function () {
var o = function (k, v, o, l) { for (o = o || {}, l = k.length; l--; o[k[l]] = v)
; return o; }, $V0 = [2, 13, 14, 20, 24, 28, 40, 53, 54, 69, 71, 73, 77, 87, 88, 99, 100, 101, 104, 105, 117, 118, 121, 132, 134, 142, 152, 157, 158, 163, 168, 170, 183, 185, 187, 188, 189, 190, 191, 192, 193, 194, 217, 218, 225, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 357, 500, 514], $V1 = [2, 360], $V2 = [163, 225], $V3 = [2, 260], $V4 = [1, 5], $V5 = [1, 93], $V6 = [1, 134], $V7 = [1, 162], $V8 = [1, 101], $V9 = [1, 27], $Va = [1, 166], $Vb = [1, 94], $Vc = [1, 47], $Vd = [1, 67], $Ve = [1, 10], $Vf = [1, 11], $Vg = [1, 13], $Vh = [1, 72], $Vi = [1, 73], $Vj = [1, 26], $Vk = [1, 16], $Vl = [1, 18], $Vm = [1, 69], $Vn = [1, 99], $Vo = [1, 80], $Vp = [1, 34], $Vq = [1, 83], $Vr = [1, 109], $Vs = [1, 38], $Vt = [1, 88], $Vu = [1, 171], $Vv = [1, 82], $Vw = [1, 175], $Vx = [1, 125], $Vy = [1, 159], $Vz = [1, 17], $VA = [1, 22], $VB = [1, 55], $VC = [1, 66], $VD = [1, 86], $VE = [1, 40], $VF = [1, 65], $VG = [1, 78], $VH = [1, 61], $VI = [1, 92], $VJ = [1, 172], $VK = [1, 63], $VL = [1, 75], $VM = [1, 85], $VN = [1, 113], $VO = [1, 9], $VP = [1, 12], $VQ = [1, 14], $VR = [1, 15], $VS = [1, 19], $VT = [1, 20], $VU = [1, 21], $VV = [1, 23], $VW = [1, 24], $VX = [1, 25], $VY = [1, 28], $VZ = [1, 29], $V_ = [1, 30], $V$ = [1, 31], $V01 = [1, 32], $V11 = [1, 33], $V21 = [1, 35], $V31 = [1, 36], $V41 = [1, 37], $V51 = [1, 39], $V61 = [1, 41], $V71 = [1, 42], $V81 = [1, 43], $V91 = [1, 44], $Va1 = [1, 45], $Vb1 = [1, 46], $Vc1 = [1, 48], $Vd1 = [1, 49], $Ve1 = [1, 50], $Vf1 = [1, 51], $Vg1 = [1, 52], $Vh1 = [1, 53], $Vi1 = [1, 54], $Vj1 = [1, 56], $Vk1 = [1, 57], $Vl1 = [1, 58], $Vm1 = [1, 59], $Vn1 = [1, 60], $Vo1 = [1, 62], $Vp1 = [1, 64], $Vq1 = [1, 68], $Vr1 = [1, 70], $Vs1 = [1, 71], $Vt1 = [1, 74], $Vu1 = [1, 76], $Vv1 = [1, 77], $Vw1 = [1, 79], $Vx1 = [1, 81], $Vy1 = [1, 84], $Vz1 = [1, 87], $VA1 = [1, 89], $VB1 = [1, 90], $VC1 = [1, 91], $VD1 = [1, 95], $VE1 = [1, 96], $VF1 = [1, 97], $VG1 = [1, 98], $VH1 = [1, 100], $VI1 = [1, 102], $VJ1 = [1, 103], $VK1 = [1, 104], $VL1 = [1, 105], $VM1 = [1, 106], $VN1 = [1, 107], $VO1 = [1, 108], $VP1 = [1, 110], $VQ1 = [1, 111], $VR1 = [1, 112], $VS1 = [1, 114], $VT1 = [1, 115], $VU1 = [1, 116], $VV1 = [1, 135], $VW1 = [1, 136], $VX1 = [1, 158], $VY1 = [1, 156], $VZ1 = [2, 458], $V_1 = [1, 192], $V$1 = [1, 190], $V02 = [1, 185], $V12 = [1, 191], $V22 = [1, 187], $V32 = [1, 188], $V42 = [1, 196], $V52 = [73, 163, 225], $V62 = [2, 633], $V72 = [1, 204], $V82 = [2, 484], $V92 = [1, 211], $Va2 = [2, 73, 163, 225], $Vb2 = [1, 214], $Vc2 = [1, 217], $Vd2 = [1, 231], $Ve2 = [2, 658], $Vf2 = [1, 233], $Vg2 = [1, 234], $Vh2 = [1, 242], $Vi2 = [1, 243], $Vj2 = [1, 244], $Vk2 = [1, 247], $Vl2 = [1, 254], $Vm2 = [2, 13, 20, 24, 28, 40, 53, 54, 69, 71, 73, 77, 87, 88, 99, 100, 101, 104, 105, 117, 118, 121, 132, 134, 142, 152, 157, 158, 163, 170, 183, 185, 187, 188, 189, 190, 191, 192, 193, 194, 217, 218, 225, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 357, 500, 514], $Vn2 = [183, 235], $Vo2 = [2, 13, 14, 28, 50, 53, 54, 69, 71, 73, 77, 87, 99, 100, 101, 104, 105, 112, 117, 121, 132, 134, 142, 157, 163, 175, 183, 187, 188, 189, 190, 191, 192, 193, 194, 225, 229, 230, 231, 233, 234, 235, 240, 241, 242, 244, 245, 246, 247, 250, 254, 255, 257, 258, 259, 262, 264, 265, 266, 269, 270, 271, 272, 275, 276, 277, 280, 281, 283, 285, 288, 290, 291, 292, 294, 299, 301, 302, 315, 390], $Vp2 = [2, 634], $Vq2 = [2, 73, 163, 225, 294], $Vr2 = [2, 646], $
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, "DatabaseDefinitionOptionals_EDIT": 46, "OptionalComment": 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, "SqlStatements": 160, "NonStartingToken": 161, "SqlStatement": 162, ";": 163, "New
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", 163: ";", 168: "SetSpecification_EDIT", 170: "SELECT", 175: "TableExpression_ERROR", 181: "Errors", 183: "=", 185: "ALL", 187: "FULL", 188: "LEFT", 189: "RIGHT", 190: "CROSS", 191: "JOIN", 192: "OUTER", 193: "INNER", 194: "SEMI", 217: "INSERT", 218: "INTO", 222: "RowValuesList", 225: "EOF", 229: "OPTION", 230: "REGULAR_IDENTIFIER", 231: "VARIABLE_REFERENCE", 232: "!", 233: "*", 234: "-", 235: ".", 236: "[", 237: "]", 238: "~", 239: "ANALYTIC", 240: "AND", 241: "ARITHMETIC_OPERATOR", 242: "ASC", 243: "AVG", 244: "BACKTICK", 245: "BETWEEN", 246: "BIGINT", 247: "BOOLEAN", 248: "CASE", 249: "CAST", 250: "CHAR", 251: "COUNT", 252: "CURRENT", 253: "DATABASE", 254: "DECIMAL", 255: "DESC", 256: "DISTINCT", 257: "DOUBLE", 258: "ELSE", 259: "END", 260: "EXISTS", 261: "FALSE", 262: "FLOAT", 263: "FOLLOWING", 264: "FROM", 265: "GROUP", 266: "HAVING", 267: "HDFS_START_QUOTE", 268: "IF", 269: "IN", 270: "INT", 271: "IS", 272: "LIMIT", 273: "MAX", 274: "MIN", 275: "ON", 276: "OR", 277: "ORDER", 278: "OVER", 279: "PRECEDING", 280: "REGEXP", 281: "RLIKE", 282: "ROW", 283: "ROWS", 284: "SCHEMA", 285: "SMALLINT", 286: "STDDEV_POP", 287: "STDDEV_SAMP", 288: "STRING", 289: "SUM", 290: "THEN", 291: "TIMESTAMP", 292: "TINYINT", 293: "TRUE", 294: "UNION", 295: "UNSIGNED_INTEGER", 296: "UNSIGNED_INTEGER_E", 297: "VAR_POP", 298: "VAR_SAMP", 299: "VARCHAR", 300: "VARIANCE", 301: "WHEN", 302: "WHERE", 303: "PARTIAL_CURSOR", 307: "PARTIAL_VALUE", 315: "CASCADE", 357: "WITH", 390: "BETWEEN_AND", 409: "+", 489: "UNBOUNDED", 494: "HDFS_PATH", 495: "HDFS_END_QUOTE", 500: "UPDATE", 514: "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], [37, 6], [44, 1], [46, 1], [47, 0], [47, 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, 2], [160, 0], [160, 1], [160, 4], [165, 2], [165, 1], [165, 2], [165, 1], [165, 1], [165, 1], [165, 1], [169, 4], [169, 4], [169, 3], [169, 4], [176, 4], [176, 4], [176, 3], [176, 3], [176, 4], [176, 4], [176, 4], [176, 5], [176, 6], [176, 4], [172, 1], [172, 3], [172, 5], [172, 3], [172, 5], [177, 3], [177, 5], [177, 7], [177, 3], [177, 5], [177, 7], [7, 4], [7, 4], [7, 2], [180, 1], [180, 3], [186, 3], [186, 3], [186, 3], [186, 2], [186, 3], [186, 3], [186, 2], [186, 3], [186, 3], [186, 3], [186, 3], [186, 2], [186, 3], [186, 3], [186, 3], [186, 3], [186, 2], [195, 7], [195, 7], [195, 7], [195, 7], [195, 6], [195, 6], [195, 6], [195, 6], [195, 6], [195, 6], [195, 6], [195, 6], [195, 6], [195, 6], [195, 5], [195, 5], [195, 5], [195, 5], [195, 5], [195, 6], [195, 6], [195, 6], [195, 6], [195, 6], [211, 1], [211, 1], [212, 1], [167, 1], [167, 1], [214, 6], [215, 2], [215, 4], [215, 4], [215, 5], [215, 6], [220, 1], [220, 3], [221, 3], [219, 0], [219, 1], [224, 3], [226, 3], [226, 3], [164, 0], [227, 1], [227, 4], [227, 4], [227, 7], [162, 1], [162, 1], [162, 1], [228, 1], [228, 1], [228, 1], [43, 1], [43, 1], [43, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161, 1], [161,
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 244:
case 248:
case 250:
case 1173:
parser.addTablePrimary($$[$0]);
break;
case 22:
case 239:
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 655:
parser.suggestKeywords(['AS']);
break;
case 28:
case 195:
case 204:
case 265:
case 656:
case 993:
parser.suggestKeywords(['SELECT']);
break;
case 31:
case 249:
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 227:
parser.suggestKeywords(['DATABASE', 'ROLE', 'SCHEMA', 'TABLE', 'VIEW']);
break;
case 42:
parser.addNewDatabaseLocation(_$[$0 - 1], [{ name: $$[$0 - 1] }]);
break;
case 43:
case 61:
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 49:
if (!$$[$0]) {
parser.suggestKeywords(['COMMENT']);
}
break;
case 67:
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 68:
parser.addNewTableLocation(_$[$0 - 1], $$[$0 - 1], $$[$0]);
this.$ = $$[$0];
break;
case 73:
this.$ = [];
break;
case 75:
case 557:
case 1170:
case 1190:
parser.suggestTables();
parser.suggestDatabases({ appendDot: true });
break;
case 77:
case 213:
case 215:
case 490:
case 493:
case 579:
case 622:
case 743:
case 922:
case 990:
case 1042:
this.$ = $$[$0 - 1];
break;
case 79:
case 648:
this.$ = [$$[$0]];
break;
case 80:
this.$ = $$[$0 - 2].concat($$[$0]);
break;
case 85:
case 87:
parser.checkForKeywords($$[$0 - 1]);
break;
case 86:
case 88:
parser.checkForKeywords($$[$0 - 3]);
break;
case 89:
this.$ = $$[$0 - 2];
this.$.type = $$[$0 - 1];
var keywords = [];
if (!$$[$0]['comment']) {
keywords.push('COMMENT');
}
if (keywords.length > 0) {
this.$.suggestKeywords = keywords;
}
break;
case 90:
case 117:
case 123:
case 124:
case 137:
case 140:
case 149:
case 151:
parser.suggestKeywords(parser.getColumnDataTypeKeywords());
break;
case 93:
this.$ = {};
break;
case 95:
this.$ = {};
this.$[$$[$0]] = true;
break;
case 96:
$$[$0 - 1][$$[$0]] = true;
break;
case 101:
case 102:
this.$ = 'null';
break;
case 103:
this.$ = 'comment';
break;
case 104:
parser.suggestKeywords(['NULL']);
break;
case 122:
parser.suggestKeywords(parser.getTypeKeywords());
break;
case 136:
case 139:
parser.suggestKeywords(['COMMENT']);
break;
case 158:
case 1068:
parser.suggestKeywords(['BY']);
break;
case 159:
parser.suggestKeywords(['RANGE']);
break;
case 168:
case 173:
case 174:
parser.suggestKeywords(['PARTITION']);
break;
case 180:
parser.suggestKeywords(['VALUE', 'VALUES']);
break;
case 181:
if ($$[$0].endsWithLessThanOrEqual) {
parser.suggestKeywords(['VALUES']);
}
break;
case 182:
case 185:
case 188:
parser.suggestKeywords(['<', '<=']);
break;
case 183:
case 522:
case 525:
parser.suggestKeywords(['VALUES']);
break;
case 186:
case 189:
parser.suggestFunctions();
break;
case 197:
parser.commitLocations();
break;
case 199:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['IF NOT EXISTS']);
}
parser.suggestDatabases({ appendDot: true });
break;
case 200:
if (!$$[$0 - 6]) {
parser.suggestKeywords(['IF NOT EXISTS']);
}
break;
case 203:
var keywords = [{ value: 'AS', weight: 1 }];
if (!$$[$0 - 1]) {
keywords.push({ value: 'COMMENT', weight: 3 });
}
parser.suggestKeywords(keywords);
break;
case 210:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['COMMENT']);
}
break;
case 214:
case 216:
this.$ = $$[$0 - 3];
break;
case 231:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['IF EXISTS']);
}
parser.suggestDatabases();
break;
case 232:
parser.suggestKeywords(['CASCADE']);
break;
case 234:
if (!$$[$0 - 3]) {
parser.suggestKeywords(['IF EXISTS']);
}
break;
case 236:
case 255:
parser.addTablePrimary($$[$0 - 1]);
break;
case 238:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['IF EXISTS']);
}
parser.suggestTables({ onlyTables: true });
parser.suggestDatabases({
appendDot: true
});
break;
case 241:
parser.addTablePrimary($$[$0 - 2]);
if (!$$[$0 - 1]) {
parser.suggestKeywords(['PURGE']);
}
break;
case 245:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['IF EXISTS']);
}
parser.suggestTables({ onlyViews: true });
parser.suggestDatabases({ appendDot: true });
break;
case 246:
parser.addTablePrimary($$[$0]);
if (!$$[$0 - 2]) {
parser.suggestKeywords(['IF EXISTS']);
}
break;
case 251:
parser.suggestKeywords(['TABLE']);
break;
case 252:
parser.suggestTables();
parser.suggestDatabases({ appendDot: true });
if (!$$[$0 - 1]) {
parser.suggestKeywords(['IF EXISTS']);
}
break;
case 256:
parser.addTablePrimary($$[$0 - 1]);
if (!$$[$0 - 2]) {
parser.suggestKeywords(['IF EXISTS']);
}
break;
case 261:
case 361:
case 363:
parser.addStatementLocation(_$[$0]);
break;
case 263:
case 264:
parser.suggestDdlAndDmlKeywords();
break;
case 272:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 1], _$[$0 - 1], $$[$0 - 2], _$[$0 - 2]), _$[$0]);
this.$ = { selectList: $$[$0] };
break;
case 273:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 2], _$[$0 - 2], $$[$0 - 3], _$[$0 - 3]), _$[$0 - 1]);
this.$ = { selectList: $$[$0 - 1], tableExpression: $$[$0] };
break;
case 274:
parser.selectListNoTableSuggest($$[$0 - 1], $$[$0 - 2]);
break;
case 276:
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 277:
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 278:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 2], _$[$0 - 2], $$[$0 - 3], _$[$0 - 3]), _$[$0 - 1]);
break;
case 279:
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 280:
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 281:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 3], _$[$0 - 3], $$[$0 - 4], _$[$0 - 4]), _$[$0 - 2]);
parser.checkForSelectListKeywords($$[$0 - 2]);
break;
case 282:
parser.addClauseLocation('selectList', parser.firstDefined($$[$0 - 4], _$[$0 - 4], $$[$0 - 5], _$[$0 - 5]), _$[$0 - 3]);
parser.checkForSelectListKeywords($$[$0 - 3]);
break;
case 283:
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 289:
case 290:
case 291:
case 646:
case 674:
case 695:
case 708:
case 712:
case 736:
case 761:
case 762:
case 843:
case 845:
case 909:
case 919:
case 926:
case 938:
case 1067:
case 1189:
case 1227:
case 1228:
this.$ = $$[$0];
break;
case 292:
case 293:
this.$ = { cursorAtStart: false, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
break;
case 294:
case 913:
case 914:
this.$ = { cursorAtStart: true, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
break;
case 300:
case 301:
case 302:
parser.suggestKeywords(['JOIN', 'OUTER JOIN']);
break;
case 303:
case 305:
case 306:
case 308:
case 309:
case 310:
case 311:
case 313:
case 314:
case 315:
case 316:
this.$ = { suggestKeywords: ['JOIN'] };
break;
case 304:
case 307:
case 312:
this.$ = { suggestKeywords: ['OUTER'] };
break;
case 317:
this.$ = {
suggestKeywords: 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]),
cursorAtEnd: !$$[$0 - 3] && !$$[$0 - 2] && !$$[$0 - 1] && !$$[$0]
};
break;
case 318:
this.$ = {
suggestKeywords: parser.getKeywordsForOptionalsLR([$$[$0 - 1], $$[$0]], [{ value: 'ORDER BY', weight: 5 }, { value: 'LIMIT', weight: 3 }], [true, true]),
cursorAtEnd: !$$[$0 - 1] && !$$[$0]
};
break;
case 319:
this.$ = {
suggestKeywords: parser.getKeywordsForOptionalsLR([$$[$0]], [{ value: 'LIMIT', weight: 3 }], [true]),
cursorAtEnd: !$$[$0]
};
break;
case 331:
if (parser.yy.result.suggestColumns) {
parser.yy.result.suggestColumns.source = 'where';
}
break;
case 332:
if (parser.yy.result.suggestColumns) {
parser.yy.result.suggestColumns.source = 'group by';
}
break;
case 334:
if (parser.yy.result.suggestColumns) {
parser.yy.result.suggestColumns.source = 'order by';
}
break;
case 336:
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 337:
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 338:
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 339:
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 340:
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 346:
$$[$0 - 2].owner = 'insert';
parser.addTablePrimary($$[$0 - 2]);
break;
case 347:
parser.suggestKeywords(['INTO']);
break;
case 348:
if (!$$[$0 - 1]) {
parser.suggestKeywords(['TABLE']);
}
parser.suggestTables();
parser.suggestDatabases({ appendDot: true });
break;
case 350:
$$[$0 - 1].owner = 'insert';
parser.addTablePrimary($$[$0 - 1]);
parser.suggestKeywords(['VALUES']);
break;
case 358:
case 359:
return parser.yy.result;
break;
case 360:
parser.prepareNewStatement();
break;
case 362:
case 364:
parser.addStatementLocation(_$[$0 - 3]);
break;
case 491:
case 494:
case 580:
this.$ = '';
break;
case 506:
case 509:
parser.yy.correlatedSubQuery = false;
break;
case 507:
case 511:
parser.suggestKeywords(['EXISTS']);
break;
case 510:
parser.suggestKeywords(['NOT EXISTS']);
break;
case 521:
case 523:
case 524:
case 526:
parser.suggestKeywords(['<', '<=', '<>', '=', '>', '>=']);
break;
case 547:
case 550:
case 551:
case 576:
case 577:
case 598:
case 601:
case 692:
case 1184:
parser.suggestColumns();
break;
case 555:
case 581:
parser.addTableLocation(_$[$0], [{ name: $$[$0] }]);
this.$ = { identifierChain: [{ name: $$[$0] }] };
break;
case 556:
case 582:
parser.addDatabaseLocation(_$[$0 - 2], [{ name: $$[$0 - 2] }]);
parser.addTableLocation(_$[$0], [{ name: $$[$0 - 2] }, { name: $$[$0] }]);
this.$ = { identifierChain: [{ name: $$[$0 - 2] }, { name: $$[$0] }] };
break;
case 558:
case 563:
parser.suggestDatabases();
this.$ = { identifierChain: [{ name: $$[$0 - 2] }] };
break;
case 559:
case 584:
parser.suggestTablesOrColumns($$[$0 - 2]);
break;
case 560:
this.$ = [{ name: $$[$0] }];
break;
case 561:
this.$ = [{ name: $$[$0 - 2] }, { name: $$[$0 - 1] }];
break;
case 562:
parser.suggestDatabases({ appendDot: true });
break;
case 566:
case 1193:
parser.suggestDatabases();
break;
case 575:
case 697:
case 698:
case 704:
case 705:
case 986:
case 1069:
parser.valueExpressionSuggest();
break;
case 583:
parser.suggestTables();
parser.suggestDatabases({ prependDot: true });
break;
case 586:
this.$ = { identifierChain: $$[$0 - 1].identifierChain, alias: $$[$0] };
break;
case 589:
parser.yy.locations[parser.yy.locations.length - 1].type = 'column';
break;
case 590:
case 877:
parser.addAsteriskLocation(_$[$0], $$[$0 - 2].concat({ asterisk: true }));
break;
case 592:
this.$ = [$$[$0].identifier];
parser.yy.firstChainLocation = parser.addUnknownLocation($$[$0].location, [$$[$0].identifier]);
break;
case 593:
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 594:
parser.suggestColumns({
identifierChain: $$[$0 - 2]
});
this.$ = { suggestKeywords: [{ value: '*', weight: 10000 }] };
break;
case 595:
parser.suggestColumns({
identifierChain: $$[$0 - 4]
});
this.$ = { suggestKeywords: [{ value: '*', weight: 10000 }] };
break;
case 596:
this.$ = [$$[$0].identifier];
break;
case 597:
$$[$0 - 2].push($$[$0].identifier);
break;
case 599:
parser.suggestColumns({ identifierChain: $$[$0 - 2] });
break;
case 600:
parser.suggestColumns({ identifierChain: $$[$0 - 4] });
break;
case 602:
this.$ = { identifier: { name: $$[$0] }, location: _$[$0] };
break;
case 624:
case 924:
this.$ = $$[$0 - 2];
break;
case 627:
parser.addCommonTableExpressions($$[$0 - 3]);
break;
case 628:
case 629:
case 651:
parser.addCommonTableExpressions($$[$0 - 2]);
break;
case 643:
parser.suggestKeywords(['ALL', 'DISTINCT', 'SELECT']);
break;
case 644:
parser.suggestKeywords(['ALL', 'DISTINCT']);
break;
case 649:
this.$ = $$[$0 - 2].concat([$$[$0]]);
break;
case 653:
parser.addCommonTableExpressions($$[$0 - 4]);
break;
case 654:
parser.addCteAliasLocation(_$[$0 - 4], $$[$0 - 4]);
$$[$0 - 1].alias = $$[$0 - 4];
this.$ = $$[$0 - 1];
break;
case 661:
case 662:
parser.addClauseLocation('whereClause', _$[$0 - 1], $$[$0].whereClauseLocation);
parser.addClauseLocation('limitClause', $$[$0].limitClausePreceding || _$[$0 - 1], $$[$0].limitClauseLocation);
break;
case 663:
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 664:
// 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 668:
this.$ = { tableReferenceList: $$[$0] };
break;
case 669:
case 931:
parser.suggestTables();
parser.suggestDatabases({ appendDot: true });
break;
case 671:
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 675:
if ($$[$0].suggestFilters) {
parser.suggestFilters({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
}
break;
case 676:
parser.suggestFunctions();
parser.suggestColumns();
parser.suggestKeywords(['EXISTS', 'NOT EXISTS']);
parser.suggestFilters({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
break;
case 679:
this.$ = { valueExpression: $$[$0] };
break;
case 680:
case 719:
parser.suggestSelectListAliases();
break;
case 681:
parser.valueExpressionSuggest();
parser.suggestSelectListAliases();
parser.suggestGroupBys({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
break;
case 682:
parser.suggestKeywords(['BY']);
parser.suggestGroupBys({ prefix: 'BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
break;
case 709:
if ($$[$0].emptyOrderBy) {
parser.suggestOrderBys({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
}
break;
case 710:
parser.suggestKeywords(['BY']);
parser.suggestOrderBys({ prefix: 'BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
break;
case 714:
this.$ = { emptyOrderBy: false };
parser.valueExpressionSuggest();
parser.suggestAnalyticFunctions();
parser.suggestSelectListAliases();
break;
case 715:
case 716:
case 717:
this.$ = { emptyOrderBy: false };
break;
case 718:
this.$ = parser.mergeSuggestKeywords($$[$0]);
break;
case 720:
this.$ = { emptyOrderBy: true };
parser.valueExpressionSuggest();
parser.suggestAnalyticFunctions();
parser.suggestSelectListAliases();
break;
case 721:
this.$ = { suggestKeywords: ['ASC', 'DESC'] };
break;
case 734:
case 735:
// verifyType($$[$0], 'BOOLEAN');
this.$ = { types: ['BOOLEAN'] };
break;
case 737:
// verifyType($$[$0], 'NUMBER');
this.$ = $$[$0];
$$[$0].types = ['NUMBER'];
break;
case 738:
case 739:
case 740:
case 741:
case 748:
case 749:
case 750:
case 751:
case 752:
case 753:
case 759:
case 760:
case 781:
case 839:
case 840:
case 898:
this.$ = { types: ['BOOLEAN'] };
break;
case 742:
this.$ = { types: ['BOOLEAN'] };
// clear correlated flag after completed sub-query (set by lexer)
parser.yy.correlatedSubQuery = false;
break;
case 744:
case 745:
case 746:
case 747:
parser.addColRefToVariableIfExists($$[$0 - 2], $$[$0]);
this.$ = { types: ['BOOLEAN'] };
break;
case 754:
case 755:
// verifyType($$[$0-2], 'BOOLEAN');
// verifyType($$[$0], 'BOOLEAN');
this.$ = { types: ['BOOLEAN'] };
break;
case 756:
case 757:
case 758:
// verifyType($$[$0-2], 'NUMBER');
// verifyType($$[$0], 'NUMBER');
this.$ = { types: ['NUMBER'] };
break;
case 764:
parser.suggestKeywords(['BETWEEN', 'EXISTS', 'IN', 'LIKE', 'REGEXP', 'RLIKE']);
this.$ = { types: ['BOOLEAN'] };
break;
case 765:
case 767:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 766:
parser.suggestFunctions();
parser.suggestColumns();
parser.suggestKeywords(['EXISTS']);
this.$ = { types: ['BOOLEAN'] };
break;
case 768:
parser.suggestFunctions({ types: ['BOOLEAN'] });
parser.suggestColumns({ types: ['BOOLEAN'] });
this.$ = { types: ['BOOLEAN'] };
break;
case 769:
this.$ = { types: ['T'], suggestFilters: $$[$0].suggestFilters };
break;
case 770:
parser.suggestFunctions();
parser.suggestColumns();
this.$ = { types: ['T'] };
break;
case 771:
if (!$$[$0].typeSet) {
parser.applyTypeToSuggestions('NUMBER');
}
this.$ = { types: ['NUMBER'], suggestFilters: $$[$0].suggestFilters };
break;
case 772:
parser.suggestFunctions({ types: ['NUMBER'] });
parser.suggestColumns({ types: ['NUMBER'] });
this.$ = { types: ['NUMBER'] };
break;
case 773:
parser.suggestKeywords(['FALSE', 'NOT NULL', 'NOT TRUE', 'NOT FALSE', 'NULL', 'TRUE']);
this.$ = { types: ['BOOLEAN'] };
break;
case 774:
parser.suggestKeywords(['FALSE', 'NULL', 'TRUE']);
this.$ = { types: ['BOOLEAN'] };
break;
case 775:
this.$ = { types: ['BOOLEAN'] };
break;
case 776:
case 777:
case 778:
parser.suggestKeywords(['NOT']);
this.$ = { types: ['BOOLEAN'] };
break;
case 779:
parser.valueExpressionSuggest($$[$0 - 5], $$[$0 - 3] ? 'IS NOT DISTINCT FROM' : 'IS DISTINCT FROM');
this.$ = { types: ['BOOLEAN'] };
break;
case 780:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 782:
this.$ = $$[$0 - 1];
break;
case 783:
parser.valueExpressionSuggest();
this.$ = { types: ['T'], typeSet: true };
break;
case 784:
parser.valueExpressionSuggest($$[$0], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0].types);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 785:
case 786:
case 787:
parser.valueExpressionSuggest($$[$0], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0].types);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 788:
case 789:
case 790:
case 791:
if (!$$[$0 - 2].typeSet) {
parser.applyTypeToSuggestions($$[$0].types);
parser.addColRefIfExists($$[$0]);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 792:
case 794:
parser.valueExpressionSuggest($$[$0 - 2], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 2].types);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 793:
parser.valueExpressionSuggest($$[$0 - 2], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 2].types);
this.$ = { types: ['BOOLEAN'], typeSet: true, endsWithLessThanOrEqual: true };
break;
case 795:
parser.valueExpressionSuggest($$[$0 - 2], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 2].types);
this.$ = { types: ['BOOLEAN'], typeSet: true, endsWithLessThanOrEqual: $$[$0 - 1] === '<=' };
break;
case 796:
case 797:
case 798:
case 799:
if (!$$[$0].typeSet) {
parser.applyTypeToSuggestions($$[$0 - 2].types);
parser.addColRefIfExists($$[$0 - 2]);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 800:
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 801:
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 802:
case 803:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 5].suggestFilters };
break;
case 804:
case 805:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 4].suggestFilters };
break;
case 806:
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 807:
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 808:
if ($$[$0 - 5].types[0] === $$[$0 - 2].types[0] && !$$[$0].typeSet) {
parser.applyTypeToSuggestions($$[$0 - 5].types);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 809:
parser.valueExpressionSuggest($$[$0 - 5], $$[$0 - 1]);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 810:
case 816:
parser.suggestValueExpressionKeywords($$[$0 - 1], ['AND']);
this.$ = { types: ['BOOLEAN'] };
break;
case 811:
parser.valueExpressionSuggest($$[$0 - 3], $$[$0 - 2] + ' ' + $$[$0 - 1]);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 812:
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 813:
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 814:
if ($$[$0 - 4].types[0] === $$[$0 - 2].types[0] && !$$[$0].typeSet) {
parser.applyTypeToSuggestions($$[$0 - 4].types);
}
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 815:
parser.valueExpressionSuggest($$[$0 - 4], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 4].types);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 817:
parser.valueExpressionSuggest($$[$0 - 2], $$[$0 - 1]);
parser.applyTypeToSuggestions($$[$0 - 2].types);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 818:
case 820:
case 822:
case 824:
parser.valueExpressionSuggest(undefined, $$[$0 - 1]);
this.$ = { types: ['BOOLEAN'], typeSet: true, suggestFilters: true };
break;
case 819:
case 823:
parser.addColRefIfExists($$[$0]);
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 821:
case 825:
parser.addColRefIfExists($$[$0 - 2]);
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0].suggestFilters };
break;
case 826:
case 827:
parser.valueExpressionSuggest(undefined, $$[$0 - 1]);
parser.applyTypeToSuggestions(['NUMBER']);
this.$ = { types: ['NUMBER'], typeSet: true };
break;
case 828:
case 829:
case 830:
if (!$$[$0 - 2].typeSet) {
parser.applyTypeToSuggestions(['NUMBER']);
parser.addColRefIfExists($$[$0]);
}
this.$ = { types: ['NUMBER'], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 831:
case 832:
case 833:
parser.valueExpressionSuggest(undefined, $$[$0 - 1]);
parser.applyTypeToSuggestions(['NUMBER']);
this.$ = { types: ['NUMBER'], typeSet: true };
break;
case 834:
case 835:
case 836:
if (!$$[$0].typeSet) {
parser.applyTypeToSuggestions(['NUMBER']);
parser.addColRefIfExists($$[$0 - 2]);
}
this.$ = { types: ['NUMBER'], suggestFilters: $$[$0].suggestFilters };
break;
case 837:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 1].suggestFilters };
break;
case 838:
this.$ = { types: ['BOOLEAN'], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 841:
parser.valueExpressionSuggest(undefined, $$[$0]);
parser.applyTypeToSuggestions(['STRING']);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 842:
parser.valueExpressionSuggest(undefined, $$[$0 - 1] + ' ' + $$[$0]);
parser.applyTypeToSuggestions(['STRING']);
this.$ = { types: ['BOOLEAN'], typeSet: true };
break;
case 844:
parser.valueExpressionSuggest();
parser.suggestKeywords(['WHEN']);
this.$ = { types: ['T'], typeSet: true };
break;
case 846:
parser.suggestValueExpressionKeywords($$[$0 - 2], ['WHEN']);
this.$ = { types: ['T'], typeSet: true };
break;
case 847:
this.$ = $$[$0];
this.$.suggestFilters = $$[$0 - 1].suggestFilters;
break;
case 848:
this.$ = { types: ['T'], suggestFilters: $$[$0 - 1].suggestFilters };
break;
case 849:
case 1115:
case 1120:
case 1121:
this.$ = { types: ['T'] };
break;
case 850:
case 852:
$$[$0].position = 1;
break;
case 851:
$$[$0].position = $$[$0 - 2].position + 1;
this.$ = $$[$0];
break;
case 853:
$$[$0 - 2].position += 1;
break;
case 854:
$$[$0 - 2].position = 1;
break;
case 855:
$$[$0 - 4].position += 1;
break;
case 856:
parser.valueExpressionSuggest();
$$[$0 - 2].position += 1;
break;
case 857:
parser.valueExpressionSuggest();
$$[$0 - 4].position += 1;
break;
case 858:
parser.suggestValueExpressionKeywords($$[$0 - 3]);
break;
case 859:
case 860:
parser.valueExpressionSuggest();
this.$ = { cursorAtStart: true, position: 1 };
break;
case 861:
case 862:
parser.valueExpressionSuggest();
this.$ = { position: 2 };
break;
case 866:
this.$ = { types: ['COLREF'], columnReference: $$[$0].chain };
break;
case 867:
// 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 868:
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 870:
this.$ = { types: ['NULL'] };
break;
case 872:
if ($$[$0].suggestKeywords) {
this.$ = { types: ['COLREF'], columnReference: $$[$0], suggestKeywords: $$[$0].suggestKeywords };
}
else {
this.$ = { types: ['COLREF'], columnReference: $$[$0] };
}
break;
case 873:
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 874:
case 1032:
case 1033:
parser.addFunctionLocation(_$[$0 - 1], $$[$0 - 1]);
if ($$[$0].position) {
parser.applyArgumentTypesToSuggestions($$[$0 - 1], $$[$0].position);
}
this.$ = { types: parser.findReturnTypes($$[$0 - 1]) };
break;
case 876:
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 883:
parser.suggestValues($$[$0]);
break;
case 884:
this.$ = { types: ['NUMBER'] };
break;
case 890:
case 892:
this.$ = $$[$0 - 1] + $$[$0];
break;
case 891:
this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0];
break;
case 896:
case 897:
if (/\$\{[^}]*\}/.test($$[$0])) {
parser.addVariableLocation(_$[$0], $$[$0]);
this.$ = { types: ['STRING'], columnReference: [{ name: $$[$0] }] };
}
else {
this.$ = { types: ['STRING'] };
}
break;
case 899:
this.$ = { partialQuote: '\'', missingEndQuote: parser.yy.missingEndQuote };
break;
case 900:
this.$ = { partialQuote: '"', missingEndQuote: parser.yy.missingEndQuote };
break;
case 905:
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 906:
parser.addAsteriskLocation(_$[$0], [{ asterisk: true }]);
this.$ = { asterisk: true };
break;
case 907:
if ($$[$0]) {
parser.addColumnAliasLocation($$[$0].location, $$[$0].alias, _$[$0 - 1]);
}
break;
case 908:
parser.suggestFunctions();
parser.suggestColumns();
parser.addColumnAliasLocation(_$[$0], $$[$0], _$[$0 - 2]);
this.$ = { suggestAggregateFunctions: true };
break;
case 910:
this.$ = [$$[$0]];
break;
case 911:
$$[$0 - 2].push($$[$0]);
break;
case 916:
parser.checkForSelectListKeywords($$[$0 - 2]);
break;
case 917:
parser.checkForSelectListKeywords($$[$0 - 3]);
break;
case 918:
this.$ = { suggestKeywords: parser.getSelectListKeywords(), suggestTables: true, suggestDatabases: true, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
break;
case 920:
case 921:
case 923:
this.$ = { suggestKeywords: parser.getSelectListKeywords(), suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true, };
break;
case 934:
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 941:
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 942:
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 943:
this.$ = { joinType: $$[$0] };
break;
case 944:
this.$ = { joinType: $$[$0 - 1] };
break;
case 945:
if ($$[$0 - 2].suggestKeywords) {
parser.suggestKeywords($$[$0 - 2].suggestKeywords);
}
break;
case 946:
if ($$[$0].suggestKeywords) {
parser.suggestKeywords($$[$0].suggestKeywords);
}
break;
case 949:
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 954:
this.$ = 'CROSS JOIN';
break;
case 955:
this.$ = 'FULL JOIN';
break;
case 956:
this.$ = 'FULL OUTER JOIN';
break;
case 957:
this.$ = 'INNER JOIN';
break;
case 958:
this.$ = 'JOIN';
break;
case 959:
this.$ = 'LEFT INNER JOIN';
break;
case 960:
this.$ = 'LEFT JOIN';
break;
case 961:
this.$ = 'LEFT OUTER JOIN';
break;
case 962:
this.$ = 'LEFT SEMI JOIN';
break;
case 963:
this.$ = 'OUTER JOIN';
break;
case 964:
case 966:
this.$ = 'RIGHT OUTER JOIN';
break;
case 965:
this.$ = 'RIGHT JOIN';
break;
case 967:
this.$ = 'RIGHT SEMI JOIN';
break;
case 968:
this.$ = 'SEMI JOIN';
break;
case 969:
this.$ = { noJoinCondition: true, suggestKeywords: ['ON'] };
break;
case 970:
this.$ = { valueExpression: $$[$0] };
break;
case 974:
parser.valueExpressionSuggest();
parser.suggestJoinConditions({ prependOn: false });
break;
case 975:
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 976:
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 977:
if ($$[$0]) {
parser.addTableAliasLocation($$[$0].location, $$[$0].alias, $$[$0 - 1].identifierChain);
}
break;
case 978:
if ($$[$0]) {
parser.addTablePrimary({ subQueryAlias: $$[$0].alias });
parser.addSubqueryAliasLocation($$[$0].location, $$[$0].alias);
}
break;
case 988:
parser.pushQueryState();
break;
case 989:
parser.popQueryState();
break;
case 991:
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 994:
var subQuery = parser.getSubQuery($$[$0]);
subQuery.columns.forEach(function (column) {
parser.expandIdentifierChain({ wrapper: column });
delete column.linked;
});
parser.popQueryState(subQuery);
this.$ = subQuery;
break;
case 1011:
case 1012:
case 1013:
case 1014:
this.$ = { alias: $$[$0], location: _$[$0] };
break;
case 1020:
if (!$$[$0]) {
$$[$0 - 1].suggestKeywords = ['OVER'];
}
break;
case 1027:
parser.suggestKeywords(['OVER']);
break;
case 1030:
case 1031:
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 1039:
this.$ = { expression: $$[$0 - 1] };
break;
case 1040:
parser.valueExpressionSuggest();
this.$ = { position: 1 };
break;
case 1041:
parser.suggestValueExpressionKeywords($$[$0 - 1]);
break;
case 1049:
case 1127:
case 1148:
this.$ = { types: parser.findReturnTypes($$[$0 - 2]) };
break;
case 1050:
this.$ = { function: $$[$0 - 3], expression: $$[$0 - 2], types: parser.findReturnTypes($$[$0 - 3]) };
break;
case 1051:
parser.valueExpressionSuggest();
parser.applyArgumentTypesToSuggestions($$[$0 - 3], 1);
this.$ = { types: parser.findReturnTypes($$[$0 - 3]) };
break;
case 1052:
parser.suggestValueExpressionKeywords($$[$0 - 2]);
this.$ = { types: parser.findReturnTypes($$[$0 - 4]) };
break;
case 1053:
parser.applyArgumentTypesToSuggestions($$[$0 - 3], $$[$0 - 1].position);
this.$ = { types: parser.findReturnTypes($$[$0 - 3]) };
break;
case 1061:
case 1062:
if (parser.yy.result.suggestFunctions) {
parser.suggestAggregateFunctions();
}
break;
case 1063:
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 1064:
if (!$$[$0 - 1]) {
parser.suggestValueExpressionKeywords($$[$0 - 3], [{ value: 'ORDER BY', weight: 2 }]);
}
else {
parser.suggestValueExpressionKeywords($$[$0 - 3]);
}
break;
case 1073:
// Only allowed in last order by
delete parser.yy.result.suggestAnalyticFunctions;
break;
case 1074:
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 1080:
parser.suggestKeywords(['BETWEEN']);
break;
case 1081:
if (!$$[$0 - 2] && !$$[$0 - 1]) {
parser.suggestKeywords(['CURRENT ROW', 'UNBOUNDED PRECEDING']);
}
else if (!$$[$0 - 1]) {
parser.suggestKeywords(['AND']);
}
break;
case 1086:
lexer.popState();
break;
case 1087:
lexer.begin('hdfs');
break;
case 1089:
parser.suggestHdfs({ path: $$[$0 - 3] });
break;
case 1090:
parser.suggestHdfs({ path: $$[$0 - 2] });
break;
case 1091:
parser.suggestHdfs({ path: $$[$0 - 1] });
break;
case 1092:
parser.suggestHdfs({ path: '' });
break;
case 1093:
parser.suggestHdfs({ path: '' });
break;
case 1099:
parser.suggestKeywords(['PRECEDING']);
break;
case 1100:
case 1105:
parser.suggestKeywords(['ROW']);
break;
case 1104:
parser.suggestKeywords(['CURRENT ROW', 'UNBOUNDED FOLLOWING']);
break;
case 1106:
parser.suggestKeywords(['FOLLOWING']);
break;
case 1112:
parser.valueExpressionSuggest();
parser.suggestAggregateFunctions();
parser.suggestSelectListAliases(true);
break;
case 1113:
parser.suggestAggregateFunctions();
parser.suggestSelectListAliases(true);
break;
case 1114:
case 1119:
this.$ = { types: [$$[$0 - 1].toUpperCase()] };
break;
case 1116:
parser.valueExpressionSuggest();
this.$ = { types: [$$[$0 - 1].toUpperCase()] };
break;
case 1117:
case 1118:
parser.valueExpressionSuggest();
this.$ = { types: ['T'] };
break;
case 1122:
parser.suggestValueExpressionKeywords($$[$0 - 3], [{ value: 'AS', weight: 2 }]);
this.$ = { types: [$$[$0 - 1].toUpperCase()] };
break;
case 1123:
parser.suggestValueExpressionKeywords($$[$0 - 2], [{ value: 'AS', weight: 2 }]);
this.$ = { types: ['T'] };
break;
case 1124:
case 1125:
parser.suggestKeywords(parser.getTypeKeywords());
this.$ = { types: ['T'] };
break;
case 1126:
case 1132:
this.$ = { types: parser.findReturnTypes($$[$0 - 3]) };
break;
case 1128:
case 1133:
case 1147:
this.$ = { types: parser.findReturnTypes($$[$0 - 4]) };
break;
case 1129:
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 1130:
case 1135:
case 1150:
parser.suggestValueExpressionKeywords($$[$0 - 2]);
this.$ = { types: parser.findReturnTypes($$[$0 - 5]) };
break;
case 1131:
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 1134:
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 1136:
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 1149:
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 1151:
if (parser.yy.result.suggestFunctions && !parser.yy.result.suggestFunctions.types) {
parser.applyArgumentTypesToSuggestions($$[$0 - 4], 1);
}
this.$ = { types: parser.findReturnTypes($$[$0 - 4]) };
break;
case 1166:
parser.suggestKeywords(['WHERE']);
break;
case 1167:
parser.suggestKeywords(['SET']);
break;
case 1183:
parser.suggestKeywords(['=']);
break;
case 1192:
if (!parser.yy.cursorFound) {
parser.yy.result.useDatabase = $$[$0];
}
break;
case 1195:
this.$ = { inValueEdit: true };
break;
case 1196:
this.$ = { inValueEdit: true, cursorAtStart: true };
break;
case 1197:
case 1198:
case 1199:
this.$ = { suggestKeywords: ['NOT'] };
break;
case 1203:
case 1204:
case 1205:
parser.suggestFunctions({ types: ['STRING'] });
parser.suggestColumns({ types: ['STRING'] });
this.$ = { types: ['BOOLEAN'] };
break;
case 1206:
case 1208:
this.$ = parser.findCaseType($$[$0 - 1]);
break;
case 1207:
case 1210:
$$[$0 - 3].caseTypes.push($$[$0 - 1]);
this.$ = parser.findCaseType($$[$0 - 3]);
break;
case 1209:
parser.suggestValueExpressionKeywords($$[$0 - 1], ['END']);
$$[$0 - 3].caseTypes.push($$[$0 - 1]);
this.$ = parser.findCaseType($$[$0 - 3]);
break;
case 1211:
this.$ = parser.findCaseType($$[$0 - 2]);
break;
case 1212:
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 1213:
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 1214:
$$[$0 - 3].caseTypes.push($$[$0 - 1]);
this.$ = parser.findCaseType($$[$0 - 3]);
this.$.suggestFilters = $$[$0 - 1].suggestFilters;
break;
case 1215:
parser.valueExpressionSuggest();
this.$ = parser.findCaseType($$[$0 - 3]);
break;
case 1216:
parser.valueExpressionSuggest();
this.$ = { types: ['T'], typeSet: true };
break;
case 1217:
parser.valueExpressionSuggest();
parser.suggestKeywords(['WHEN']);
this.$ = $$[$0 - 1];
break;
case 1218:
parser.valueExpressionSuggest();
parser.suggestKeywords(['WHEN']);
this.$ = { types: ['T'] };
break;
case 1221:
this.$ = { caseTypes: [$$[$0]], lastType: $$[$0] };
break;
case 1222:
$$[$0 - 1].caseTypes.push($$[$0]);
this.$ = { caseTypes: $$[$0 - 1].caseTypes, lastType: $$[$0] };
break;
case 1226:
parser.suggestValueExpressionKeywords($$[$0 - 2], ['WHEN']);
break;
case 1229:
this.$ = { caseTypes: [{ types: ['T'] }], suggestFilters: $$[$0].suggestFilters };
break;
case 1230:
this.$ = { caseTypes: [{ types: ['T'] }], suggestFilters: $$[$0 - 1].suggestFilters };
break;
case 1231:
this.$ = { caseTypes: [$$[$0]], suggestFilters: $$[$0 - 2].suggestFilters };
break;
case 1232:
case 1233:
this.$ = { caseTypes: [$$[$0]], suggestFilters: $$[$0].suggestFilters };
break;
case 1234:
parser.suggestKeywords(['WHEN']);
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
case 1235:
parser.suggestKeywords(['WHEN']);
this.$ = { caseTypes: [$$[$0]] };
break;
case 1236:
parser.valueExpressionSuggest();
parser.suggestKeywords(['WHEN']);
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
case 1237:
parser.valueExpressionSuggest();
parser.suggestKeywords(['WHEN']);
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
case 1238:
case 1240:
parser.valueExpressionSuggest();
this.$ = { caseTypes: [{ types: ['T'] }], suggestFilters: true };
break;
case 1239:
parser.valueExpressionSuggest();
parser.suggestKeywords(['THEN']);
this.$ = { caseTypes: [{ types: ['T'] }], suggestFilters: true };
break;
case 1241:
parser.valueExpressionSuggest();
this.$ = { caseTypes: [$$[$0]], suggestFilters: true };
break;
case 1242:
parser.suggestValueExpressionKeywords($$[$0 - 1], ['THEN']);
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
case 1243:
parser.suggestValueExpressionKeywords($$[$0 - 2], ['THEN']);
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
case 1244:
case 1245:
case 1246:
case 1247:
parser.valueExpressionSuggest();
this.$ = { caseTypes: [{ types: ['T'] }] };
break;
}
},
table: [o($V0, $V1, { 226: 1, 164: 2 }), { 1: [3] }, o($V2, $V3, { 160: 3, 227: 4, 161: 6, 162: 7, 165: 8, 3: 117, 211: 118, 29: 119, 102: 120, 166: 121, 9: 122, 167: 123, 31: 124, 4: 126, 5: 127, 6: 128, 7: 129, 8: 130, 212: 131, 213: 132, 169: 133, 10: 137, 11: 138, 12: 139, 15: 140, 215: 141, 216: 142, 176: 143, 352: 144, 16: 145, 17: 146, 33: 147, 34: 148, 35: 149, 36: 150, 143: 151, 144: 152, 145: 153, 146: 154, 147: 155, 214: 157, 18: 160, 19: 161, 37: 163, 38: 164, 39: 165, 148: 167, 149: 168, 150: 169, 151: 170, 21: 173, 27: 174, 23: 176, 30: 177, 2: $V4, 13: $V5, 14: $V6, 20: $V7, 24: $V8, 28: $V9, 40: $Va, 53: $Vb, 54: $Vc, 69: $Vd, 71: $Ve, 73: $Vf, 77: $Vg, 87: $Vh, 88: $Vi, 99: $Vj, 100: $Vk, 101: $Vl, 104: $Vm, 105: $Vn, 117: $Vo, 118: $Vp, 121: $Vq, 132: $Vr, 134: $Vs, 142: $Vt, 152: $Vu, 157: $Vv, 158: $Vw, 168: $Vx, 170: $Vy, 183: $Vz, 185: $VA, 187: $VB, 188: $VC, 189: $VD, 190: $VE, 191: $VF, 192: $VG, 193: $VH, 194: $VI, 217: $VJ, 218: $VK, 229: $VL, 230: $VM, 231: $VN, 232: $VO, 233: $VP, 234: $VQ, 235: $VR, 236: $VS, 237: $VT, 238: $VU, 239: $VV, 240: $VW, 241: $VX, 242: $VY, 243: $VZ, 244: $V_, 245: $V$, 246: $V01, 247: $V11, 248: $V21, 249: $V31, 250: $V41, 251: $V51, 252: $V61, 253: $V71, 254: $V81, 255: $V91, 256: $Va1, 257: $Vb1, 258: $Vc1, 259: $Vd1, 260: $Ve1, 261: $Vf1, 262: $Vg1, 263: $Vh1, 264: $Vi1, 265: $Vj1, 266: $Vk1, 267: $Vl1, 268: $Vm1, 269: $Vn1, 270: $Vo1, 271: $Vp1, 272: $Vq1, 273: $Vr1, 274: $Vs1, 275: $Vt1, 276: $Vu1, 277: $Vv1, 278: $Vw1, 279: $Vx1, 280: $Vy1, 281: $Vz1, 282: $VA1, 283: $VB1, 284: $VC1, 285: $VD1, 286: $VE1, 287: $VF1, 288: $VG1, 289: $VH1, 290: $VI1, 291: $VJ1, 292: $VK1, 293: $VL1, 294: $VM1, 295: $VN1, 296: $VO1, 297: $VP1, 298: $VQ1, 299: $VR1, 300: $VS1, 301: $VT1, 302: $VU1, 303: $VV1, 357: $VW1, 500: $VX1, 514: $VY1 }), { 163: [1, 179], 225: [1, 178] }, { 225: [1, 180] }, o($V2, [2, 258]), { 2: [1, 181] }, o($V2, [2, 261]), { 163: [1, 182], 225: [2, 361] }, { 2: [2, 374] }, { 2: [2, 375] }, { 2: [2, 376] }, { 2: [2, 377] }, { 2: [2, 378] }, { 2: [2, 379] }, { 2: [2, 380] }, { 2: [2, 381] }, { 2: [2, 382] }, { 2: [2, 383] }, { 2: [2, 384] }, { 2: [2, 385] }, { 2: [2, 386] }, { 2: [2, 387] }, { 2: [2, 388] }, { 2: [2, 389] }, { 2: [2, 390] }, { 2: [2, 391] }, { 2: [2, 392] }, { 2: [2, 393] }, { 2: [2, 394] }, { 2: [2, 395] }, { 2: [2, 396] }, { 2: [2, 397] }, { 2: [2, 398] }, { 2: [2, 399] }, { 2: [2, 400] }, { 2: [2, 401] }, { 2: [2, 402] }, { 2: [2, 403] }, { 2: [2, 404] }, { 2: [2, 405] }, { 2: [2, 406] }, { 2: [2, 407] }, { 2: [2, 408] }, { 2: [2, 409] }, { 2: [2, 410] }, { 2: [2, 411] }, { 2: [2, 412] }, { 2: [2, 413] }, { 2: [2, 414] }, { 2: [2, 415] }, { 2: [2, 416] }, { 2: [2, 417] }, { 2: [2, 418] }, { 2: [2, 419] }, { 2: [2, 420] }, { 2: [2, 421] }, { 2: [2, 422] }, { 2: [2, 423] }, { 2: [2, 424] }, { 2: [2, 425] }, { 2: [2, 426] }, { 2: [2, 427] }, { 2: [2, 428] }, { 2: [2, 429] }, { 2: [2, 430] }, { 2: [2, 431] }, { 2: [2, 432] }, { 2: [2, 433] }, { 2: [2, 434] }, { 2: [2, 435] }, { 2: [2, 436] }, { 2: [2, 437] }, { 2: [2, 438] }, { 2: [2, 439] }, { 2: [2, 440] }, { 2: [2, 441] }, { 2: [2, 442] }, { 2: [2, 443] }, { 2: [2, 444] }, { 2: [2, 445] }, { 2: [2, 446] }, { 2: [2, 447] }, { 2: [2, 448] }, { 2: [2, 449] }, { 2: [2, 450] }, { 2: [2, 451] }, { 2: [2, 452] }, { 2: [2, 453] }, { 2: [2, 454] }, { 2: [2, 455] }, { 2: [2, 456] }, { 2: [2, 457] }, { 2: $VZ1, 14: [1, 183], 43: 186, 105: $V_1, 142: $V$1, 182: 184, 185: $V02, 228: 189, 229: $V12, 230: $V22, 231: $V32 }, { 2: [2, 459] }, { 2: [2, 460] }, { 2: [2, 461] }, { 2: [2, 462] }, { 2: [2, 463] }, { 2: [2, 464] }, { 2: [2, 465] }, { 2: [2, 466] }, { 2: [2, 467] }, { 2: [2, 468] }, { 2: [2, 469] }, { 2: [2, 470] }, { 2: [2, 471] }, { 2: [2, 472] }, { 2: [2, 473] }, { 2: [2, 474] }, { 2: [2, 475] }, { 2: [2, 476] }, { 2: [2, 477] }, { 2: [2, 478] }, { 2: [2, 479] }, { 2: [2, 480] }, { 2: [2, 481] }, o($V2, [2, 365]), o($V2, [2, 366]), o($V2, [2, 367]), o($V2, [2, 264], { 2: [1, 193] }), { 14: [1, 194], 71: $V42, 169: 195, 170: $Vy, 176: 197 }, o($V2, [2, 266]), o($V2, [2, 267]), o($V
defaultActions: { 9: [2, 374], 10: [2, 375], 11: [2, 376], 12: [2, 377], 13: [2, 378], 14: [2, 379], 15: [2, 380], 16: [2, 381], 17: [2, 382], 18: [2, 383], 19: [2, 384], 20: [2, 385], 21: [2, 386], 22: [2, 387], 23: [2, 388], 24: [2, 389], 25: [2, 390], 26: [2, 391], 27: [2, 392], 28: [2, 393], 29: [2, 394], 30: [2, 395], 31: [2, 396], 32: [2, 397], 33: [2, 398], 34: [2, 399], 35: [2, 400], 36: [2, 401], 37: [2, 402], 38: [2, 403], 39: [2, 404], 40: [2, 405], 41: [2, 406], 42: [2, 407], 43: [2, 408], 44: [2, 409], 45: [2, 410], 46: [2, 411], 47: [2, 412], 48: [2, 413], 49: [2, 414], 50: [2, 415], 51: [2, 416], 52: [2, 417], 53: [2, 418], 54: [2, 419], 55: [2, 420], 56: [2, 421], 57: [2, 422], 58: [2, 423], 59: [2, 424], 60: [2, 425], 61: [2, 426], 62: [2, 427], 63: [2, 428], 64: [2, 429], 65: [2, 430], 66: [2, 431], 67: [2, 432], 68: [2, 433], 69: [2, 434], 70: [2, 435], 71: [2, 436], 72: [2, 437], 73: [2, 438], 74: [2, 439], 75: [2, 440], 76: [2, 441], 77: [2, 442], 78: [2, 443], 79: [2, 444], 80: [2, 445], 81: [2, 446], 82: [2, 447], 83: [2, 448], 84: [2, 449], 85: [2, 450], 86: [2, 451], 87: [2, 452], 88: [2, 453], 89: [2, 454], 90: [2, 455], 91: [2, 456], 92: [2, 457], 94: [2, 459], 95: [2, 460], 96: [2, 461], 97: [2, 462], 98: [2, 463], 99: [2, 464], 100: [2, 465], 101: [2, 466], 102: [2, 467], 103: [2, 468], 104: [2, 469], 105: [2, 470], 106: [2, 471], 107: [2, 472], 108: [2, 473], 109: [2, 474], 110: [2, 475], 111: [2, 476], 112: [2, 477], 113: [2, 478], 114: [2, 479], 115: [2, 480], 116: [2, 481], 178: [2, 358], 180: [2, 359], 328: [2, 1034], 329: [2, 1035], 330: [2, 1036], 331: [2, 1037], 370: [2, 1137], 371: [2, 1138], 372: [2, 1139], 373: [2, 1140], 374: [2, 1141], 375: [2, 1142], 376: [2, 1143], 377: [2, 1144], 802: [2, 289], 957: [2, 50], 959: [2, 54], 1380: [2, 290], 1535: [2, 286], 1741: [2, 291], 1743: [2, 294] },
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.initSqlParser(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 303;
break;
case 5:
this.popState();
return 390;
break;
case 6:
return 185;
break;
case 7:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('ALTER', yy_.yylloc, yy.lexer.upcomingInput());
return 20;
break;
case 8:
return 240;
break;
case 9:
return 28;
break;
case 10:
return 242;
break;
case 11:
this.begin('between');
return 245;
break;
case 12:
return 246;
break;
case 13:
return 247;
break;
case 14:
return 118;
break;
case 15:
return 315;
break;
case 16:
return 248;
break;
case 17:
return 250;
break;
case 18:
return 50;
break;
case 19:
parser.determineCase(yy_.yytext);
return 40;
break;
case 20:
return 190;
break;
case 21:
return 252;
break;
case 22:
return 253;
break;
case 23:
return 254;
break;
case 24:
return 255;
break;
case 25:
return 256;
break;
case 26:
return 241;
break;
case 27:
return 257;
break;
case 28:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('DROP', yy_.yylloc, yy.lexer.upcomingInput());
return 152;
break;
case 29:
return 258;
break;
case 30:
return 259;
break;
case 31:
parser.yy.correlatedSubQuery = true;
return 260;
break;
case 32:
return 261;
break;
case 33:
return 262;
break;
case 34:
return 263;
break;
case 35:
parser.determineCase(yy_.yytext);
return 264;
break;
case 36:
return 187;
break;
case 37:
return 265;
break;
case 38:
return 266;
break;
case 39:
return 268;
break;
case 40:
return 269;
break;
case 41:
return 193;
break;
case 42:
return 217;
break;
case 43:
return 270;
break;
case 44:
return 218;
break;
case 45:
return 271;
break;
case 46:
return 191;
break;
case 47:
return 188;
break;
case 48:
return 69;
break;
case 49:
return 272;
break;
case 50:
return 87;
break;
case 51:
return 88;
break;
case 52:
return 275;
break;
case 53:
return 229;
break;
case 54:
return 276;
break;
case 55:
return 277;
break;
case 56:
return 192;
break;
case 57:
return 117;
break;
case 58:
return 279;
break;
case 59:
return 157;
break;
case 60:
return 121;
break;
case 61:
return 280;
break;
case 62:
return 189;
break;
case 63:
return 281;
break;
case 64:
return 282;
break;
case 65:
return 142;
break;
case 66:
return 283;
break;
case 67:
return 284;
break;
case 68:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('SELECT', yy_.yylloc);
return 170;
break;
case 69:
return 194;
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 285;
break;
case 73:
return 288;
break;
case 74:
return 24;
break;
case 75:
return 290;
break;
case 76:
return 291;
break;
case 77:
return 292;
break;
case 78:
return 'TO';
break;
case 79:
return 293;
break;
case 80:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('TRUNCATE', yy_.yylloc, yy.lexer.upcomingInput());
return 158;
break;
case 81:
return 489;
break;
case 82:
return 294;
break;
case 83:
parser.determineCase(yy_.yytext);
return 500;
break;
case 84:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('USE', yy_.yylloc);
return 514;
break;
case 85:
return 132;
break;
case 86:
return 299;
break;
case 87:
return 32;
break;
case 88:
return 301;
break;
case 89:
return 302;
break;
case 90:
parser.determineCase(yy_.yytext);
parser.addStatementTypeLocation('WITH', yy_.yylloc);
return 357;
break;
case 91:
return 278;
break;
case 92:
return 142;
break;
case 93:
yy.lexer.unput('(');
yy_.yytext = 'avg';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 243;
break;
case 94:
yy.lexer.unput('(');
yy_.yytext = 'cast';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 249;
break;
case 95:
yy.lexer.unput('(');
yy_.yytext = 'count';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 251;
break;
case 96:
yy.lexer.unput('(');
yy_.yytext = 'max';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 273;
break;
case 97:
yy.lexer.unput('(');
yy_.yytext = 'min';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 274;
break;
case 98:
yy.lexer.unput('(');
yy_.yytext = 'stddev_pop';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 286;
break;
case 99:
yy.lexer.unput('(');
yy_.yytext = 'stddev_samp';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 287;
break;
case 100:
yy.lexer.unput('(');
yy_.yytext = 'sum';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 289;
break;
case 101:
yy.lexer.unput('(');
yy_.yytext = 'var_pop';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 297;
break;
case 102:
yy.lexer.unput('(');
yy_.yytext = 'var_samp';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 298;
break;
case 103:
yy.lexer.unput('(');
yy_.yytext = 'variance';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 300;
break;
case 104:
yy.lexer.unput('(');
yy_.yytext = 'cume_dist';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 239;
break;
case 105:
yy.lexer.unput('(');
yy_.yytext = 'dense_rank';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 239;
break;
case 106:
yy.lexer.unput('(');
yy_.yytext = 'first_value';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 239;
break;
case 107:
yy.lexer.unput('(');
yy_.yytext = 'lag';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 239;
break;
case 108:
yy.lexer.unput('(');
yy_.yytext = 'last_value';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 239;
break;
case 109:
yy.lexer.unput('(');
yy_.yytext = 'lead';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 239;
break;
case 110:
yy.lexer.unput('(');
yy_.yytext = 'rank';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 239;
break;
case 111:
yy.lexer.unput('(');
yy_.yytext = 'row_number';
parser.addFunctionLocation(yy_.yylloc, yy_.yytext);
return 239;
break;
case 112:
return 295;
break;
case 113:
return 295;
break;
case 114:
return 296;
break;
case 115:
return 230;
break;
case 116:
parser.yy.cursorFound = true;
return 14;
break;
case 117:
parser.yy.cursorFound = true;
return 303;
break;
case 118:
return 267;
break;
case 119:
parser.addFileLocation(yy_.yylloc, yy_.yytext);
return 494;
break;
case 120:
this.popState();
return 495;
break;
case 121:
return 225;
break;
case 122:
return 240;
break;
case 123:
return 276;
break;
case 124:
return 183;
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 234;
break;
case 133:
return 233;
break;
case 134:
return 241;
break;
case 135:
return 241;
break;
case 136:
return 241;
break;
case 137:
return 241;
break;
case 138:
return 241;
break;
case 139:
return 241;
break;
case 140:
return 77;
break;
case 141:
return 235;
break;
case 142:
return 112;
break;
case 143:
return 163;
break;
case 144:
return 238;
break;
case 145:
return 232;
break;
case 146:
return 71;
break;
case 147:
return 73;
break;
case 148:
return 236;
break;
case 149:
return 237;
break;
case 150:
return 231;
break;
case 151:
this.begin('backtickedValue');
return 244;
break;
case 152:
if (parser.handleQuotedValueWithCursor(this, yy_.yytext, yy_.yylloc, '`')) {
return 307;
}
return 55;
break;
case 153:
this.popState();
return 244;
break;
case 154:
this.begin('singleQuotedValue');
return 53;
break;
case 155:
if (parser.handleQuotedValueWithCursor(this, yy_.yytext, yy_.yylloc, '\'')) {
return 307;
}
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 307;
}
return 55;
break;
case 159:
this.popState();
return 54;
break;
case 160:
return 225;
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 = genericAutocompleteParser;