tiesdb-client
Version:
1,901 lines (1,788 loc) • 134 kB
JavaScript
/* parser generated by jison 0.6.1-215 */
/*
* Returns a Parser object of the following structure:
*
* Parser: {
* yy: {} The so-called "shared state" or rather the *source* of it;
* the real "shared state" `yy` passed around to
* the rule actions, etc. is a derivative/copy of this one,
* not a direct reference!
* }
*
* Parser.prototype: {
* yy: {},
* EOF: 1,
* TERROR: 2,
*
* trace: function(errorMessage, ...),
*
* JisonParserError: function(msg, hash),
*
* quoteName: function(name),
* Helper function which can be overridden by user code later on: put suitable
* quotes around literal IDs in a description string.
*
* originalQuoteName: function(name),
* The basic quoteName handler provided by JISON.
* `cleanupAfterParse()` will clean up and reset `quoteName()` to reference this function
* at the end of the `parse()`.
*
* describeSymbol: function(symbol),
* Return a more-or-less human-readable description of the given symbol, when
* available, or the symbol itself, serving as its own 'description' for lack
* of something better to serve up.
*
* Return NULL when the symbol is unknown to the parser.
*
* symbols_: {associative list: name ==> number},
* terminals_: {associative list: number ==> name},
* nonterminals: {associative list: rule-name ==> {associative list: number ==> rule-alt}},
* terminal_descriptions_: (if there are any) {associative list: number ==> description},
* productions_: [...],
*
* performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack),
*
* The function parameters and `this` have the following value/meaning:
* - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`)
* to store/reference the rule value `$$` and location info `@$`.
*
* One important thing to note about `this` a.k.a. `yyval`: every *reduce* action gets
* to see the same object via the `this` reference, i.e. if you wish to carry custom
* data from one reduce action through to the next within a single parse run, then you
* may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data.
*
* `this.yy` is a direct reference to the `yy` shared state object.
*
* `%parse-param`-specified additional `parse()` arguments have been added to this `yy`
* object at `parse()` start and are therefore available to the action code via the
* same named `yy.xxxx` attributes (where `xxxx` represents a identifier name from
* the %parse-param` list.
*
* - `yytext` : reference to the lexer value which belongs to the last lexer token used
* to match this rule. This is *not* the look-ahead token, but the last token
* that's actually part of this rule.
*
* Formulated another way, `yytext` is the value of the token immediately preceeding
* the current look-ahead token.
* Caveats apply for rules which don't require look-ahead, such as epsilon rules.
*
* - `yyleng` : ditto as `yytext`, only now for the lexer.yyleng value.
*
* - `yylineno`: ditto as `yytext`, only now for the lexer.yylineno value.
*
* - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info.
*
* WARNING: since jison 0.4.18-186 this entry may be NULL/UNDEFINED instead
* of an empty object when no suitable location info can be provided.
*
* - `yystate` : the current parser state number, used internally for dispatching and
* executing the action code chunk matching the rule currently being reduced.
*
* - `yysp` : the current state stack position (a.k.a. 'stack pointer')
*
* This one comes in handy when you are going to do advanced things to the parser
* stacks, all of which are accessible from your action code (see the next entries below).
*
* Also note that you can access this and other stack index values using the new double-hash
* syntax, i.e. `##$ === ##0 === yysp`, while `##1` is the stack index for all things
* related to the first rule term, just like you have `$1`, `@1` and `#1`.
* This is made available to write very advanced grammar action rules, e.g. when you want
* to investigate the parse state stack in your action code, which would, for example,
* be relevant when you wish to implement error diagnostics and reporting schemes similar
* to the work described here:
*
* + Pottier, F., 2016. Reachability and error diagnosis in LR(1) automata.
* In Journées Francophones des Languages Applicatifs.
*
* + Jeffery, C.L., 2003. Generating LR syntax error messages from examples.
* ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640.
*
* - `yyrulelength`: the current rule's term count, i.e. the number of entries occupied on the stack.
*
* This one comes in handy when you are going to do advanced things to the parser
* stacks, all of which are accessible from your action code (see the next entries below).
*
* - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc.
* constructs.
*
* - `yylstack`: reference to the parser token location stack. Also accessed via
* the `@1` etc. constructs.
*
* WARNING: since jison 0.4.18-186 this array MAY contain slots which are
* UNDEFINED rather than an empty (location) object, when the lexer/parser
* action code did not provide a suitable location info object when such a
* slot was filled!
*
* - `yystack` : reference to the parser token id stack. Also accessed via the
* `#1` etc. constructs.
*
* Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to
* its numeric token id value, hence that code wouldn't need the `yystack` but *you* might
* want access this array for your own purposes, such as error analysis as mentioned above!
*
* Note that this stack stores the current stack of *tokens*, that is the sequence of
* already parsed=reduced *nonterminals* (tokens representing rules) and *terminals*
* (lexer tokens *shifted* onto the stack until the rule they belong to is found and
* *reduced*.
*
* - `yysstack`: reference to the parser state stack. This one carries the internal parser
* *states* such as the one in `yystate`, which are used to represent
* the parser state machine in the *parse table*. *Very* *internal* stuff,
* what can I say? If you access this one, you're clearly doing wicked things
*
* - `...` : the extra arguments you specified in the `%parse-param` statement in your
* grammar definition file.
*
* table: [...],
* State transition table
* ----------------------
*
* index levels are:
* - `state` --> hash table
* - `symbol` --> action (number or array)
*
* If the `action` is an array, these are the elements' meaning:
* - index [0]: 1 = shift, 2 = reduce, 3 = accept
* - index [1]: GOTO `state`
*
* If the `action` is a number, it is the GOTO `state`
*
* defaultActions: {...},
*
* parseError: function(str, hash, ExceptionClass),
* yyError: function(str, ...),
* yyRecovering: function(),
* yyErrOk: function(),
* yyClearIn: function(),
*
* constructParseErrorInfo: function(error_message, exception_object, expected_token_set, is_recoverable),
* Helper function **which will be set up during the first invocation of the `parse()` method**.
* Produces a new errorInfo 'hash object' which can be passed into `parseError()`.
* See it's use in this parser kernel in many places; example usage:
*
* var infoObj = parser.constructParseErrorInfo('fail!', null,
* parser.collect_expected_token_set(state), true);
* var retVal = parser.parseError(infoObj.errStr, infoObj, parser.JisonParserError);
*
* originalParseError: function(str, hash, ExceptionClass),
* The basic `parseError` handler provided by JISON.
* `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function
* at the end of the `parse()`.
*
* options: { ... parser %options ... },
*
* parse: function(input[, args...]),
* Parse the given `input` and return the parsed value (or `true` when none was provided by
* the root action, in which case the parser is acting as a *matcher*).
* You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar:
* these extra `args...` are added verbatim to the `yy` object reference as member variables.
*
* WARNING:
* Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with
* any attributes already added to `yy` by the jison run-time;
* when such a collision is detected an exception is thrown to prevent the generated run-time
* from silently accepting this confusing and potentially hazardous situation!
*
* The lexer MAY add its own set of additional parameters (via the `%parse-param` line in
* the lexer section of the grammar spec): these will be inserted in the `yy` shared state
* object and any collision with those will be reported by the lexer via a thrown exception.
*
* cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos),
* Helper function **which will be set up during the first invocation of the `parse()` method**.
* This helper API is invoked at the end of the `parse()` call, unless an exception was thrown
* and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY
* be invoked by calling user code to ensure the `post_parse` callbacks are invoked and
* the internal parser gets properly garbage collected under these particular circumstances.
*
* yyMergeLocationInfo: function(first_index, last_index, first_yylloc, last_yylloc, dont_look_back),
* Helper function **which will be set up during the first invocation of the `parse()` method**.
* This helper API can be invoked to calculate a spanning `yylloc` location info object.
*
* Note: %epsilon rules MAY specify no `first_index` and `first_yylloc`, in which case
* this function will attempt to obtain a suitable location marker by inspecting the location stack
* backwards.
*
* For more info see the documentation comment further below, immediately above this function's
* implementation.
*
* lexer: {
* yy: {...}, A reference to the so-called "shared state" `yy` once
* received via a call to the `.setInput(input, yy)` lexer API.
* EOF: 1,
* ERROR: 2,
* JisonLexerError: function(msg, hash),
* parseError: function(str, hash, ExceptionClass),
* setInput: function(input, [yy]),
* input: function(),
* unput: function(str),
* more: function(),
* reject: function(),
* less: function(n),
* pastInput: function(n),
* upcomingInput: function(n),
* showPosition: function(),
* test_match: function(regex_match_array, rule_index, ...),
* next: function(...),
* lex: function(...),
* begin: function(condition),
* pushState: function(condition),
* popState: function(),
* topState: function(),
* _currentRules: function(),
* stateStackSize: function(),
* cleanupAfterLex: function()
*
* options: { ... lexer %options ... },
*
* 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, 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)
* token_id: (the produced terminal token numeric ID, if any)
* line: (yylineno)
* loc: (yylloc)
* }
*
* parser (grammar) errors will also provide these additional members:
*
* {
* expected: (array describing the set of expected tokens;
* may be UNDEFINED when we cannot easily produce such a set)
* state: (integer (or array when the table includes grammar collisions);
* represents the current internal state of the parser kernel.
* can, for example, be used to pass to the `collect_expected_token_set()`
* API to obtain the expected token set)
* action: (integer; represents the current internal action which will be executed)
* new_state: (integer; represents the next/planned internal state, once the current
* action has executed)
* recoverable: (boolean: TRUE when the parser MAY have an error recovery rule
* available for this particular error)
* state_stack: (array: the current parser LALR/LR internal state stack; this can be used,
* for instance, for advanced error analysis and reporting)
* value_stack: (array: the current parser LALR/LR internal `$$` value stack; this can be used,
* for instance, for advanced error analysis and reporting)
* location_stack: (array: the current parser LALR/LR internal location stack; this can be used,
* for instance, for advanced error analysis and reporting)
* yy: (object: the current parser internal "shared state" `yy`
* as is also available in the rule actions; this can be used,
* for instance, for advanced error analysis and reporting)
* lexer: (reference to the current lexer instance used by the parser)
* parser: (reference to the current parser instance)
* }
*
* while `this` will reference the current parser instance.
*
* When `parseError` is invoked by the lexer, `this` will still reference the related *parser*
* instance, while these additional `hash` fields will also be provided:
*
* {
* lexer: (reference to the current lexer instance which reported the error)
* }
*
* When `parseError` is invoked by the parser due to a **JavaScript exception** being fired
* from either the parser or lexer, `this` will still reference the related *parser*
* instance, while these additional `hash` fields will also be provided:
*
* {
* exception: (reference to the exception thrown)
* }
*
* Please do note that in the latter situation, the `expected` field will be omitted as
* this type of failure is assumed not to be due to *parse errors* but rather due to user
* action code in either parser or lexer failing unexpectedly.
*
* ---
*
* You can specify parser options by setting / modifying the `.yy` object of your Parser instance.
* These options are available:
*
* ### options which are global for all parser instances
*
* Parser.pre_parse: function(yy)
* optional: you can specify a pre_parse() function in the chunk following
* the grammar, i.e. after the last `%%`.
* Parser.post_parse: function(yy, retval, parseInfo) { return retval; }
* optional: you can specify a post_parse() function in the chunk following
* the grammar, i.e. after the last `%%`. When it does not return any value,
* the parser will return the original `retval`.
*
* ### options which can be set up per parser instance
*
* yy: {
* pre_parse: function(yy)
* optional: is invoked before the parse cycle starts (and before the first
* invocation of `lex()`) but immediately after the invocation of
* `parser.pre_parse()`).
* post_parse: function(yy, retval, parseInfo) { return retval; }
* optional: is invoked when the parse terminates due to success ('accept')
* or failure (even when exceptions are thrown).
* `retval` contains the return value to be produced by `Parser.parse()`;
* this function can override the return value by returning another.
* When it does not return any value, the parser will return the original
* `retval`.
* This function is invoked immediately before `parser.post_parse()`.
*
* parseError: function(str, hash, ExceptionClass)
* optional: overrides the default `parseError` function.
* quoteName: function(name),
* optional: overrides the default `quoteName` function.
* }
*
* parser.lexer.options: {
* pre_lex: function()
* optional: is invoked before the lexer is invoked to produce another token.
* `this` refers to the Lexer object.
* post_lex: function(token) { return token; }
* optional: is invoked when the lexer has produced a token `token`;
* this function can override the returned token value by returning another.
* When it does not return any (truthy) value, the lexer will return
* the original `token`.
* `this` refers to the Lexer object.
*
* 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 invoked;
* the lexer terminates the scan when a token is returned by the action code.
* xregexp: boolean
* optional: `true` ==> lexer rule regexes are "extended regex format" requiring the
* `XRegExp` library. When this `%option` has not been specified at compile time, all lexer
* rule regexes have been written as standard JavaScript RegExp expressions.
* }
*/
var sql = (function () {
// See also:
// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508
// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility
// with userland code which might access the derived class in a 'classic' way.
function JisonParserError(msg, hash) {
Object.defineProperty(this, 'name', {
enumerable: false,
writable: false,
value: 'JisonParserError'
});
if (msg == null) msg = '???';
Object.defineProperty(this, 'message', {
enumerable: false,
writable: true,
value: msg
});
this.hash = hash;
var stacktrace;
if (hash && hash.exception instanceof Error) {
var ex2 = hash.exception;
this.message = ex2.message || msg;
stacktrace = ex2.stack;
}
if (!stacktrace) {
if (Error.hasOwnProperty('captureStackTrace')) { // V8/Chrome engine
Error.captureStackTrace(this, this.constructor);
} else {
stacktrace = (new Error(msg)).stack;
}
}
if (stacktrace) {
Object.defineProperty(this, 'stack', {
enumerable: false,
writable: false,
value: stacktrace
});
}
}
if (typeof Object.setPrototypeOf === 'function') {
Object.setPrototypeOf(JisonParserError.prototype, Error.prototype);
} else {
JisonParserError.prototype = Object.create(Error.prototype);
}
JisonParserError.prototype.constructor = JisonParserError;
JisonParserError.prototype.name = 'JisonParserError';
// helper: reconstruct the productions[] table
function bp(s) {
var rv = [];
var p = s.pop;
var r = s.rule;
for (var i = 0, l = p.length; i < l; i++) {
rv.push([
p[i],
r[i]
]);
}
return rv;
}
// helper: reconstruct the defaultActions[] table
function bda(s) {
var rv = {};
var d = s.idx;
var g = s.goto;
for (var i = 0, l = d.length; i < l; i++) {
var j = d[i];
rv[j] = g[i];
}
return rv;
}
// helper: reconstruct the 'goto' table
function bt(s) {
var rv = [];
var d = s.len;
var y = s.symbol;
var t = s.type;
var a = s.state;
var m = s.mode;
var g = s.goto;
for (var i = 0, l = d.length; i < l; i++) {
var n = d[i];
var q = {};
for (var j = 0; j < n; j++) {
var z = y.shift();
switch (t.shift()) {
case 2:
q[z] = [
m.shift(),
g.shift()
];
break;
case 0:
q[z] = a.shift();
break;
default:
// type === 1: accept
q[z] = [
3
];
}
}
rv.push(q);
}
return rv;
}
// helper: runlength encoding with increment step: code, length: step (default step = 0)
// `this` references an array
function s(c, l, a) {
a = a || 0;
for (var i = 0; i < l; i++) {
this.push(c);
c += a;
}
}
// helper: duplicate sequence from *relative* offset and length.
// `this` references an array
function c(i, l) {
i = this.length - i;
for (l += i; i < l; i++) {
this.push(this[i]);
}
}
// helper: unpack an array using helpers and data, all passed in an array argument 'a'.
function u(a) {
var rv = [];
for (var i = 0, l = a.length; i < l; i++) {
var e = a[i];
// Is this entry a helper function?
if (typeof e === 'function') {
i++;
e.apply(rv, a[i]);
} else {
rv.push(e);
}
}
return rv;
}
var parser = {
// Code Generator Information Report
// ---------------------------------
//
// Options:
//
// default action mode: ............. ["classic","merge"]
// test-compile action mode: ........ "parser:*,lexer:*"
// try..catch: ...................... true
// default resolve on conflict: ..... true
// on-demand look-ahead: ............ false
// error recovery token skip maximum: 3
// yyerror in parse actions is: ..... NOT recoverable,
// yyerror in lexer actions and other non-fatal lexer are:
// .................................. NOT recoverable,
// debug grammar/output: ............ false
// has partial LR conflict upgrade: true
// rudimentary token-stack support: false
// parser table compression mode: ... 2
// export debug tables: ............. false
// export *all* tables: ............. false
// module type: ..................... commonjs
// parser engine type: .............. lalr
// output main() in the module: ..... true
// has user-specified main(): ....... false
// has user-specified require()/import modules for main():
// .................................. false
// number of expected conflicts: .... 0
//
//
// Parser Analysis flags:
//
// no significant actions (parser is a language matcher only):
// .................................. false
// uses yyleng: ..................... false
// uses yylineno: ................... false
// uses yytext: ..................... false
// uses yylloc: ..................... false
// uses ParseError API: ............. false
// uses YYERROR: .................... false
// uses YYRECOVERING: ............... false
// uses YYERROK: .................... false
// uses YYCLEARIN: .................. false
// tracks rule values: .............. true
// assigns rule values: ............. true
// uses location tracking: .......... false
// assigns location: ................ false
// uses yystack: .................... false
// uses yysstack: ................... false
// uses yysp: ....................... true
// uses yyrulelength: ............... false
// uses yyMergeLocationInfo API: .... false
// has error recovery: .............. false
// has error reporting: ............. false
//
// --------- END OF REPORT -----------
trace: function no_op_trace() { },
JisonParserError: JisonParserError,
yy: {},
options: {
type: "lalr",
hasPartialLrUpgradeOnConflict: true,
errorRecoveryTokenDiscardCount: 3
},
symbols_: {
"$accept": 0,
"$end": 1,
"AND": 30,
"AS": 26,
"ASC": 19,
"BOOLEAN": 36,
"CAST": 31,
"CMP_EQUALS": 3,
"CMP_GREATER": 4,
"CMP_GREATEROREQUAL": 5,
"CMP_LESS": 6,
"CMP_LESSOREQUAL": 7,
"CMP_LIKE": 8,
"CMP_NOTEQUALS": 9,
"CMP_NOTEQUALS_BASIC": 10,
"COMMA": 18,
"DECIMAL": 32,
"DESC": 20,
"DIRECT_IDENTIFIER": 11,
"DISTINCT": 15,
"DOT": 24,
"EOF": 1,
"FROM": 14,
"HEX_INTEGER": 35,
"IDENTIFIER": 42,
"IN": 29,
"LIMIT": 21,
"LPAREN": 27,
"NEGATIVE_INTEGER": 34,
"NULL": 37,
"ORDER_BY": 17,
"POSITIVE_INTEGER": 22,
"QUOTED_IDENTIFIER": 12,
"RPAREN": 28,
"SELECT": 13,
"STAR": 23,
"STRING": 39,
"TYPE_HINT": 25,
"UUID": 38,
"WHERE": 16,
"ZERO": 33,
"castConstruct": 66,
"compare": 41,
"dataType": 67,
"error": 2,
"expressionCompare": 61,
"expressionCompareList": 65,
"expressionFunction": 62,
"expressionUnary": 59,
"expressionUnaryList": 63,
"expressionUnaryTopColumn": 56,
"expressionUnaryWhere": 60,
"expressionUnaryWhereList": 64,
"integer": 69,
"literalTyped": 72,
"literalValue": 70,
"numericValue": 68,
"optColumnExprAlias": 57,
"optColumnType": 55,
"optDistinctClause": 44,
"optLimitClause": 50,
"optOrderByClause": 46,
"optOrderByOrder": 49,
"optWhereClause": 45,
"orderByList": 47,
"orderByListItem": 48,
"qualified_identifier": 53,
"selectClause": 43,
"selectExpr": 54,
"selectExprList": 51,
"selectExprListX": 52,
"stringValue": 71,
"tableExpr": 58,
"tql": 40
},
terminals_: {
1: "EOF",
2: "error",
3: "CMP_EQUALS",
4: "CMP_GREATER",
5: "CMP_GREATEROREQUAL",
6: "CMP_LESS",
7: "CMP_LESSOREQUAL",
8: "CMP_LIKE",
9: "CMP_NOTEQUALS",
10: "CMP_NOTEQUALS_BASIC",
11: "DIRECT_IDENTIFIER",
12: "QUOTED_IDENTIFIER",
13: "SELECT",
14: "FROM",
15: "DISTINCT",
16: "WHERE",
17: "ORDER_BY",
18: "COMMA",
19: "ASC",
20: "DESC",
21: "LIMIT",
22: "POSITIVE_INTEGER",
23: "STAR",
24: "DOT",
25: "TYPE_HINT",
26: "AS",
27: "LPAREN",
28: "RPAREN",
29: "IN",
30: "AND",
31: "CAST",
32: "DECIMAL",
33: "ZERO",
34: "NEGATIVE_INTEGER",
35: "HEX_INTEGER",
36: "BOOLEAN",
37: "NULL",
38: "UUID",
39: "STRING"
},
TERROR: 2,
EOF: 1,
// internals: defined here so the object *structure* doesn't get modified by parse() et al,
// thus helping JIT compilers like Chrome V8.
originalQuoteName: null,
originalParseError: null,
cleanupAfterParse: null,
constructParseErrorInfo: null,
yyMergeLocationInfo: null,
__reentrant_call_depth: 0, // INTERNAL USE ONLY
__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup
__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup
// APIs which will be set up depending on user action code analysis:
//yyRecovering: 0,
//yyErrOk: 0,
//yyClearIn: 0,
// Helper APIs
// -----------
// Helper function which can be overridden by user code later on: put suitable quotes around
// literal IDs in a description string.
quoteName: function parser_quoteName(id_str) {
return '"' + id_str + '"';
},
// Return the name of the given symbol (terminal or non-terminal) as a string, when available.
//
// Return NULL when the symbol is unknown to the parser.
getSymbolName: function parser_getSymbolName(symbol) {
if (this.terminals_[symbol]) {
return this.terminals_[symbol];
}
// Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up.
//
// An example of this may be where a rule's action code contains a call like this:
//
// parser.getSymbolName(#$)
//
// to obtain a human-readable name of the current grammar rule.
var s = this.symbols_;
for (var key in s) {
if (s[key] === symbol) {
return key;
}
}
return null;
},
// Return a more-or-less human-readable description of the given symbol, when available,
// or the symbol itself, serving as its own 'description' for lack of something better to serve up.
//
// Return NULL when the symbol is unknown to the parser.
describeSymbol: function parser_describeSymbol(symbol) {
if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) {
return this.terminal_descriptions_[symbol];
}
else if (symbol === this.EOF) {
return 'end of input';
}
var id = this.getSymbolName(symbol);
if (id) {
return this.quoteName(id);
}
return null;
},
// Produce a (more or less) human-readable list of expected tokens at the point of failure.
//
// The produced list may contain token or token set descriptions instead of the tokens
// themselves to help turning this output into something that easier to read by humans
// unless `do_not_describe` parameter is set, in which case a list of the raw, *numeric*,
// expected terminals and nonterminals is produced.
//
// The returned list (array) will not contain any duplicate entries.
collect_expected_token_set: function parser_collect_expected_token_set(state, do_not_describe) {
var TERROR = this.TERROR;
var tokenset = [];
var check = {};
// Has this (error?) state been outfitted with a custom expectations description text for human consumption?
// If so, use that one instead of the less palatable token set.
if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) {
return [
this.state_descriptions_[state]
];
}
for (var p in this.table[state]) {
p = +p;
if (p !== TERROR) {
var d = do_not_describe ? p : this.describeSymbol(p);
if (d && !check[d]) {
tokenset.push(d);
check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries.
}
}
}
return tokenset;
},
productions_: bp({
pop: u([
40,
s,
[41, 9],
42,
42,
43,
44,
44,
45,
45,
46,
46,
47,
47,
48,
s,
[49, 3],
50,
50,
51,
51,
52,
s,
[52, 4, 1],
55,
s,
[56, 3],
s,
[57, 3],
58,
58,
s,
[59, 5],
s,
[60, 3],
61,
61,
62,
63,
63,
64,
64,
65,
s,
[65, 4, 1],
68,
s,
[69, 4],
s,
[70, 5],
71,
72,
72
]),
rule: u([
2,
6,
s,
[1, 10],
8,
0,
1,
0,
2,
0,
2,
3,
1,
2,
0,
1,
c,
[10, 3],
s,
[1, 3],
s,
[3, 3],
c,
[8, 5],
0,
1,
c,
[14, 5],
s,
[1, 4],
3,
1,
3,
5,
4,
c,
[6, 4],
1,
3,
c,
[59, 11],
c,
[26, 5]
])
}),
performAction: function parser__PerformAction(yystate /* action[1] */, yysp, yyvstack) {
/* this == yyval */
// the JS engine itself can go and remove these statements when `yy` turns out to be unused in any action code!
var yy = this.yy;
var yyparser = yy.parser;
var yylexer = yy.lexer;
switch (yystate) {
case 0:
/*! Production:: $accept : tql $end */
// default action (generated by JISON mode classic/merge :: 1,VT,VA,-,-,-,-,-,-):
this.$ = yyvstack[yysp - 1];
// END of default action (generated by JISON mode classic/merge :: 1,VT,VA,-,-,-,-,-,-)
break;
case 1:
/*! Production:: tql : selectClause EOF */
// default action (generated by JISON mode classic/merge :: 2,VT,VA,-,-,-,-,-,-):
this.$ = yyvstack[yysp - 1];
// END of default action (generated by JISON mode classic/merge :: 2,VT,VA,-,-,-,-,-,-)
return {nodeType: 'tql', value: yyvstack[yysp - 1]};
break;
case 2:
/*! Production:: compare : CMP_EQUALS CMP_GREATER CMP_GREATEROREQUAL CMP_LESS CMP_LESSOREQUAL CMP_LIKE */
// default action (generated by JISON mode classic/merge :: 6,VT,VA,-,-,-,-,-,-):
this.$ = yyvstack[yysp - 5];
// END of default action (generated by JISON mode classic/merge :: 6,VT,VA,-,-,-,-,-,-)
break;
case 3:
/*! Production:: compare : CMP_EQUALS */
case 4:
/*! Production:: compare : CMP_NOTEQUALS */
case 5:
/*! Production:: compare : CMP_NOTEQUALS_BASIC */
case 6:
/*! Production:: compare : CMP_GREATER */
case 7:
/*! Production:: compare : CMP_GREATEROREQUAL */
case 8:
/*! Production:: compare : CMP_LESS */
case 9:
/*! Production:: compare : CMP_LESSOREQUAL */
case 10:
/*! Production:: compare : CMP_LIKE */
case 29:
/*! Production:: selectExprList : selectExprListX */
case 36:
/*! Production:: expressionUnaryTopColumn : expressionFunction */
case 37:
/*! Production:: expressionUnaryTopColumn : castConstruct */
case 38:
/*! Production:: expressionUnaryTopColumn : IDENTIFIER */
case 42:
/*! Production:: tableExpr : IDENTIFIER */
case 43:
/*! Production:: tableExpr : qualified_identifier */
case 44:
/*! Production:: expressionUnary : expressionFunction */
case 46:
/*! Production:: expressionUnary : castConstruct */
case 47:
/*! Production:: expressionUnary : IDENTIFIER */
case 48:
/*! Production:: expressionUnary : literalTyped */
case 49:
/*! Production:: expressionUnaryWhere : expressionFunction */
case 51:
/*! Production:: expressionUnaryWhere : literalTyped */
case 65:
/*! Production:: integer : ZERO */
case 66:
/*! Production:: integer : POSITIVE_INTEGER */
case 67:
/*! Production:: integer : NEGATIVE_INTEGER */
case 68:
/*! Production:: integer : HEX_INTEGER */
case 69:
/*! Production:: literalValue : stringValue */
case 70:
/*! Production:: literalValue : numericValue */
case 75:
/*! Production:: literalTyped : literalValue */
// default action (generated by JISON mode classic/merge :: 1,VT,VA,-,-,-,-,-,-):
this.$ = yyvstack[yysp];
// END of default action (generated by JISON mode classic/merge :: 1,VT,VA,-,-,-,-,-,-)
break;
case 11:
/*! Production:: IDENTIFIER : DIRECT_IDENTIFIER */
case 35:
/*! Production:: optColumnType : TYPE_HINT IDENTIFIER */
case 40:
/*! Production:: optColumnExprAlias : IDENTIFIER */
case 41:
/*! Production:: optColumnExprAlias : AS IDENTIFIER */
case 62:
/*! Production:: dataType : IDENTIFIER */
this.$ = yyvstack[yysp]
break;
case 12:
/*! Production:: IDENTIFIER : QUOTED_IDENTIFIER */
this.$ = yyvstack[yysp].replace(/^"|"$/g, '').replace(/""/g, '"');
break;
case 13:
/*! Production:: selectClause : SELECT optDistinctClause selectExprList FROM tableExpr optWhereClause optOrderByClause optLimitClause */
this.$ = {nodeType: 'SELECT', distinct: yyvstack[yysp - 6], columns: yyvstack[yysp - 5], from: yyvstack[yysp - 3], where:yyvstack[yysp - 2], orderBy:yyvstack[yysp - 1], limit:yyvstack[yysp]};
break;
case 14:
/*! Production:: optDistinctClause : %epsilon */
this.$ = false;
break;
case 15:
/*! Production:: optDistinctClause : DISTINCT */
this.$ = true;
break;
case 16:
/*! Production:: optWhereClause : %epsilon */
case 18:
/*! Production:: optOrderByClause : %epsilon */
case 26:
/*! Production:: optLimitClause : %epsilon */
case 39:
/*! Production:: optColumnExprAlias : %epsilon */
this.$ = null;
break;
case 17:
/*! Production:: optWhereClause : WHERE expressionCompareList */
case 19:
/*! Production:: optOrderByClause : ORDER_BY orderByList */
case 24:
/*! Production:: optOrderByOrder : ASC */
case 25:
/*! Production:: optOrderByOrder : DESC */
case 27:
/*! Production:: optLimitClause : LIMIT POSITIVE_INTEGER */
case 28:
/*! Production:: selectExprList : STAR */
this.$ = yyvstack[yysp];
break;
case 20:
/*! Production:: orderByList : orderByList COMMA orderByListItem */
case 31:
/*! Production:: selectExprListX : selectExprListX COMMA selectExpr */
this.$ = yyvstack[yysp - 2]; yyvstack[yysp - 2].push(yyvstack[yysp]);
break;
case 21:
/*! Production:: orderByList : orderByListItem */
case 30:
/*! Production:: selectExprListX : selectExpr */
this.$ = [yyvstack[yysp]];
break;
case 22:
/*! Production:: orderByListItem : IDENTIFIER optOrderByOrder */
this.$ = {expression:yyvstack[yysp - 1], orderByOrder: yyvstack[yysp]};
break;
case 23:
/*! Production:: optOrderByOrder : %epsilon */
this.$ = '';
break;
case 32:
/*! Production:: qualified_identifier : IDENTIFIER DOT IDENTIFIER */
this.$ = {nodeType: 'QualifiedIdentifier', parent: yyvstack[yysp - 2], value: yyvstack[yysp]};
break;
case 33:
/*! Production:: selectExpr : expressionUnaryTopColumn optColumnType optColumnExprAlias */
this.$ = {nodeType: 'COLUMN', value:yyvstack[yysp - 2], type: yyvstack[yysp - 1], alias:yyvstack[yysp]};
break;
case 34:
/*! Production:: optColumnType : %epsilon */
this.$ = undefined
break;
case 45:
/*! Production:: expressionUnary : LPAREN expressionUnary RPAREN */
case 50:
/*! Production:: expressionUnaryWhere : LPAREN expressionUnary RPAREN */
this.$ = yyvstack[yysp - 1]
break;
case 52:
/*! Production:: expressionCompare : IDENTIFIER compare expressionUnaryWhere */
this.$ = {'nodeType': 'OPERATOR_COMPARE', 'name': yyvstack[yysp - 1], 'left': yyvstack[yysp - 2], 'right': yyvstack[yysp]}
break;
case 53:
/*! Production:: expressionCompare : IDENTIFIER IN LPAREN expressionUnaryWhereList RPAREN */
this.$ = {nodeType: 'OPERATOR_IN', left:yyvstack[yysp - 4], right:yyvstack[yysp - 1]};
break;
case 54:
/*! Production:: expressionFunction : IDENTIFIER LPAREN expressionUnaryList RPAREN */
this.$ = {'nodeType': 'FUNCTION', 'name': yyvstack[yysp - 3], 'args': yyvstack[yysp - 1]}
break;
case 55:
/*! Production:: expressionUnaryList : expressionUnary */
case 57:
/*! Production:: expressionUnaryWhereList : expressionUnaryWhere */
case 59:
/*! Production:: expressionCompareList : expressionCompare */
this.$ = [yyvstack[yysp]]
break;
case 56:
/*! Production:: expressionUnaryList : expressionUnaryList COMMA expressionUnary */
case 58:
/*! Production:: expressionUnaryWhereList : expressionUnaryWhereList COMMA expressionUnaryWhere */
case 60:
/*! Production:: expressionCompareList : expressionCompareList AND expressionCompare */
this.$ = yyvstack[yysp - 2]; yyvstack[yysp - 2].push(yyvstack[yysp])
break;
case 61:
/*! Production:: castConstruct : CAST LPAREN expressionUnary AS dataType RPAREN */
this.$ = {nodeType: 'CAST', expression:yyvstack[yysp - 3], dataType:yyvstack[yysp - 1]};
break;
case 63:
/*! Production:: numericValue : integer */
this.$ = {nodeType: 'INTEGER', value: yyvstack[yysp] }
break;
case 64:
/*! Production:: numericValue : DECIMAL */
this.$ = {nodeType: 'DECIMAL', value: yyvstack[yysp] }
break;
case 71:
/*! Production:: literalValue : BOOLEAN */
this.$ = {nodeType: 'BOOLEAN', value:yyvstack[yysp]};
break;
case 72:
/*! Production:: literalValue : NULL */
this.$ = {nodeType: 'NULL', value:null};
break;
case 73:
/*! Production:: literalValue : UUID */
this.$ = {nodeType: 'UUID', value:yyvstack[yysp]};
break;
case 74:
/*! Production:: stringValue : STRING */
this.$ = {nodeType: 'STRING', value:yyvstack[yysp].replace(/^'|'$/g, '').replace(/\\(.)/g, '$1')};
break;
case 76:
/*! Production:: literalTyped : literalValue TYPE_HINT IDENTIFIER */
this.$ = yyvstack[yysp - 2]; yyvstack[yysp - 2].type = yyvstack[yysp];
break;
}
},
table: bt({
len: u([
3,
1,
1,
6,
0,
11,
0,
1,
0,
2,
0,
7,
0,
0,
7,
1,
0,
0,
5,
8,
7,
3,
23,
22,
5,
5,
s,
[0, 4],
3,
c,
[23, 3],
0,
22,
0,
4,
0,
8,
s,
[0, 12],
1,
4,
5,
3,
c,
[23, 3],
1,
3,
4,
3,
5,
4,
0,
10,
c,
[19, 5],
c,
[3, 3],
3,
0,
6,
4,
20,
1,
13,
s,
[0, 9],
4,
s,
[0, 6],
22,
0,
1,
21,
1,
0,
1,
2,
c,
[36, 4],
20,
c,
[9, 3],
0
]),
symbol: u([
13,
40,
43,
1,
1,
11,
12,
15,
23,
31,
44,
11,
12,
23,
31,
42,
51,
52,
54,
56,
62,
66,
14,
14,
18,
11,
12,
14,
18,
25,
26,
55,
c,
[7, 6],
27,
27,
11,
12,
42,
53,
58,
11,
12,
31,
42,
c,
[31, 4],
c,
[21, 4],
26,
42,
57,
c,
[20, 3],
11,
12,
22,
27,
s,
[31, 9, 1],
42,
59,
62,
63,
66,
s,
[68, 5, 1],
c,
[23, 16],
c,
[22, 6],
1,
16,
17,
21,
45,
c,
[5, 4],
24,
c,
[58, 3],
18,
28,
c,
[37, 22],
18,
26,
27,
28,
1,
17,
18,
21,
25,
26,
28,
30,
26,
1,
17,
21,
46,
c,
[44, 3],
61,
65,
c,
[107, 19],
c,
[47, 6],
c,
[70, 3],
c,
[26, 3],
42,
67,
1,
21,
50,
c,
[7, 3],
47,
48,
c,
[50, 3],
30,
s,
[3, 8, 1],
29,
41,
28,
22,
1,
18,
21,
1,
s,
[18, 4, 1],
49,
c,
[71, 4],
c,
[67, 4],
c,
[66, 9],
60,
62,
c,
[65, 5],
27,
4,
c,
[22, 12],
c,
[38, 3],
48,
c,
[105, 22],
c,
[258, 3],
c,
[61, 13],
64,
c,
[22, 5],
5,
28,
18,
28,
6,
c,
[87, 20],
7,
8
]),
type: u([
2,
0,
0,
1,
s,
[2, 6],
0,
c,
[5, 5],
s,
[0, 6],
s,
[2, 9],
c,
[10, 10],
c,
[27, 4],
c,
[33, 8],
c,
[16, 7],
c,
[31, 13],
c,
[61, 10],
c,
[64, 12],
c,
[23, 13],
c,
[81, 12],
c,
[35, 14],
c,
[37, 15],
c,
[25, 13],
c,
[122, 7],
c,
[84, 26],
c,
[34, 5],
c,
[41, 10],
c,
[60, 14],
c,
[71, 13],
c,
[66, 20],
c,
[112, 17],
c,
[189, 27],
c,
[174, 34],
c,
[87, 11]
]),
state: u([
1,
2,
5,
14,
7,
s,
[9, 5, 1],
20,
25,
26,
24,
14,
27,
c,
[9, 3],
29,
28,
31,
37,
33,
34,
32,
36,
41,
46,
39,
40,
38,
37,
52,
34,
c,
[9, 6],
53,
56,
37,
59,
c,
[11, 7],
62,
66,
65,
64,
67,
37,
68,
c,
[14, 7],
70,
72,
71,
73,
77,
75,
76,
79,
92,
66,
95,
100,
96,
97,
c,
[19, 4],
99,
77,
103,
37,
104,
c,
[30, 7],
100,
106,
97,
105,
c,
[20, 5],
100,
112,
c,
[28, 6]
]),
mode: u([
1,
1,
2,
2,
c,
[3, 4],
s,
[1, 4],
c,
[9, 4],
c,
[14, 5],
s,
[2, 5],
s,
[1, 9],
c,
[11, 11],
s,
[1, 20],
c,
[49, 8],
c,
[26, 19],
c,
[27, 7],
c,
[6, 4],
c,
[39, 4],
c,
[64, 24],
c,
[42, 4],
c,
[29, 13],
c,
[50, 6],
c,
[49, 18],
s,
[2, 12],
s,
[1, 47]
]),
goto: u([
3,
4,
14,
14,
6,
14,
14,
16,
17,
8,
15,
18,
29,
19,
s,
[34, 4],
21,
34,
s,
[38, 6],
22,
23,
16,
17,
16,
17,
15,
16,
17,
39,
39,
30,
c,
[10, 4],
49,
35,
15,
47,
48,
50,
51,
s,
[42, 4, 1],
c,
[13, 14],
54,
16,
16,
s,
[42, 4],
55,
16,
17,
58,
57,
c,
[26, 13],
47,
47,
22,
47,
s,
[75, 4],
60,
s,
[75, 3],
61,
18,
63,
18,
c,
[70, 4],
c,
[33, 13],
69,
c,
[16, 4],
26,
74,
16,
s,
[17, 4],
78,
81,
s,
[84, 5, 1],
82,
83,
80,
89,
90,
19,
91,
19,
23,
23,
93,
94,
c,
[129, 5],
49,
98,
c,
[46, 8],
101,
102,
s,
[3, 12],
c,
[75, 15],
22,
c,
[42, 12],
107,
108,
110,
109,
111,
c,
[17, 12],
113,
114
])
}),
defaultActions: bda({
idx: u([
s,
[4, 5, 2],
13,
16,
17,
s,
[26, 4, 1],
31,
33,
s,
[34, 4, 2],
s,
[41, 11, 1],
56,
57,
65,
s,
[67, 4, 1],
72,
73,
76,
s,
[82, 9, 1],
s,
[92, 6, 1],
99,
103,
106,
108,
109,
112,
114
]),
goto: u([
1,
15,
28,
30,
36,
37,
11,
12,
43,
31,
33,
40,
35,
55,
44,
46,
48,
s,
[69, 6, 1],
s,
[63, 6, 1],
41,
54,
59,
32,
56,
45,
76,
62,
13,
21,
s,
[4, 7, 1],
61,
27,
22,
24,
25,
60,
52,
49,
51,
20,
57,
50,
53,
58,
2
])
}),
parseError: function parseError(str, hash, ExceptionClass) {