sql-parser
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -6,11 +6,14 @@ (function(root) { | ||
var exports = this; | ||
(function() { | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
var Lexer; | ||
Lexer = (function() { | ||
var BOOLEAN, DBLSTRING, LITERAL, MATH, MATH_MULTI, NUMBER, SEPARATOR, SQL_CONDITIONALS, SQL_FUNCTIONS, SQL_KEYWORDS, SQL_OPERATORS, SQL_SORT_ORDERS, STAR, STRING, WHITESPACE; | ||
var BOOLEAN, DBLSTRING, LITERAL, MATH, MATH_MULTI, NUMBER, PARAMETER, SEPARATOR, SQL_CONDITIONALS, SQL_FUNCTIONS, SQL_OPERATORS, SQL_SORT_ORDERS, STAR, STRING, SUB_SELECT_OP, SUB_SELECT_UNARY_OP, WHITESPACE; | ||
function Lexer(sql, opts) { | ||
var bytesConsumed, i; | ||
if (opts == null) opts = {}; | ||
if (opts == null) { | ||
opts = {}; | ||
} | ||
this.sql = sql; | ||
@@ -22,3 +25,3 @@ this.preserveWhitespace = opts.preserveWhitespace || false; | ||
while (this.chunk = sql.slice(i)) { | ||
bytesConsumed = this.keywordToken() || this.starToken() || this.booleanToken() || this.functionToken() || this.windowExtension() || this.sortOrderToken() || this.seperatorToken() || this.operatorToken() || this.mathToken() || this.dotToken() || this.conditionalToken() || this.numberToken() || this.stringToken() || this.parensToken() || this.whitespaceToken() || this.literalToken(); | ||
bytesConsumed = this.keywordToken() || this.starToken() || this.booleanToken() || this.functionToken() || this.windowExtension() || this.sortOrderToken() || this.seperatorToken() || this.operatorToken() || this.mathToken() || this.dotToken() || this.conditionalToken() || this.subSelectOpToken() || this.subSelectUnaryOpToken() || this.numberToken() || this.stringToken() || this.parameterToken() || this.parensToken() || this.whitespaceToken() || this.literalToken(); | ||
if (bytesConsumed < 1) { | ||
@@ -30,4 +33,25 @@ throw new Error("NOTHING CONSUMED: Stopped at - '" + (this.chunk.slice(0, 30)) + "'"); | ||
this.token('EOF', ''); | ||
this.postProcess(); | ||
} | ||
Lexer.prototype.postProcess = function() { | ||
var i, next_token, token, _i, _len, _ref, _results; | ||
_ref = this.tokens; | ||
_results = []; | ||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { | ||
token = _ref[i]; | ||
if (token[0] === 'STAR') { | ||
next_token = this.tokens[i + 1]; | ||
if (!(next_token[0] === 'SEPARATOR' || next_token[0] === 'FROM')) { | ||
_results.push(token[0] = 'MATH_MULTI'); | ||
} else { | ||
_results.push(void 0); | ||
} | ||
} else { | ||
_results.push(void 0); | ||
} | ||
} | ||
return _results; | ||
}; | ||
Lexer.prototype.token = function(name, value) { | ||
@@ -39,8 +63,18 @@ return this.tokens.push([name, value, this.currentLine]); | ||
var match, partMatch; | ||
if (part == null) part = 0; | ||
if (lengthPart == null) lengthPart = part; | ||
if (output == null) output = true; | ||
if (!(match = regex.exec(this.chunk))) return 0; | ||
if (part == null) { | ||
part = 0; | ||
} | ||
if (lengthPart == null) { | ||
lengthPart = part; | ||
} | ||
if (output == null) { | ||
output = true; | ||
} | ||
if (!(match = regex.exec(this.chunk))) { | ||
return 0; | ||
} | ||
partMatch = match[part]; | ||
if (output) this.token(name, partMatch); | ||
if (output) { | ||
this.token(name, partMatch); | ||
} | ||
return match[lengthPart].length; | ||
@@ -51,7 +85,11 @@ }; | ||
var match, matcher; | ||
if (word == null) word = name; | ||
if (word == null) { | ||
word = name; | ||
} | ||
word = this.regexEscape(word); | ||
matcher = /^\w+$/.test(word) ? new RegExp("^(" + word + ")\\b", 'ig') : new RegExp("^(" + word + ")", 'ig'); | ||
match = matcher.exec(this.chunk); | ||
if (!match) return 0; | ||
if (!match) { | ||
return 0; | ||
} | ||
this.token(name, match[1]); | ||
@@ -67,3 +105,5 @@ return match[1].length; | ||
ret = this.tokenizeFromWord(name, entry); | ||
if (ret > 0) break; | ||
if (ret > 0) { | ||
break; | ||
} | ||
} | ||
@@ -74,3 +114,3 @@ return ret; | ||
Lexer.prototype.keywordToken = function() { | ||
return this.tokenizeFromWord('SELECT') || this.tokenizeFromWord('DISTINCT') || this.tokenizeFromWord('FROM') || this.tokenizeFromWord('WHERE') || this.tokenizeFromWord('GROUP') || this.tokenizeFromWord('ORDER') || this.tokenizeFromWord('BY') || this.tokenizeFromWord('HAVING') || this.tokenizeFromWord('LIMIT') || this.tokenizeFromWord('JOIN') || this.tokenizeFromWord('LEFT') || this.tokenizeFromWord('RIGHT') || this.tokenizeFromWord('INNER') || this.tokenizeFromWord('OUTER') || this.tokenizeFromWord('ON') || this.tokenizeFromWord('AS') || this.tokenizeFromWord('UNION') || this.tokenizeFromWord('ALL'); | ||
return this.tokenizeFromWord('SELECT') || this.tokenizeFromWord('DISTINCT') || this.tokenizeFromWord('FROM') || this.tokenizeFromWord('WHERE') || this.tokenizeFromWord('GROUP') || this.tokenizeFromWord('ORDER') || this.tokenizeFromWord('BY') || this.tokenizeFromWord('HAVING') || this.tokenizeFromWord('LIMIT') || this.tokenizeFromWord('JOIN') || this.tokenizeFromWord('LEFT') || this.tokenizeFromWord('RIGHT') || this.tokenizeFromWord('INNER') || this.tokenizeFromWord('OUTER') || this.tokenizeFromWord('ON') || this.tokenizeFromWord('AS') || this.tokenizeFromWord('UNION') || this.tokenizeFromWord('ALL') || this.tokenizeFromWord('LIMIT') || this.tokenizeFromWord('OFFSET') || this.tokenizeFromWord('FETCH') || this.tokenizeFromWord('ROW') || this.tokenizeFromWord('ROWS') || this.tokenizeFromWord('ONLY') || this.tokenizeFromWord('NEXT') || this.tokenizeFromWord('FIRST'); | ||
}; | ||
@@ -94,2 +134,10 @@ | ||
Lexer.prototype.subSelectOpToken = function() { | ||
return this.tokenizeFromList('SUB_SELECT_OP', SUB_SELECT_OP); | ||
}; | ||
Lexer.prototype.subSelectUnaryOpToken = function() { | ||
return this.tokenizeFromList('SUB_SELECT_UNARY_OP', SUB_SELECT_UNARY_OP); | ||
}; | ||
Lexer.prototype.functionToken = function() { | ||
@@ -123,2 +171,6 @@ return this.tokenizeFromList('FUNCTION', SQL_FUNCTIONS); | ||
Lexer.prototype.parameterToken = function() { | ||
return this.tokenizeFromRegex('PARAMETER', PARAMETER); | ||
}; | ||
Lexer.prototype.stringToken = function() { | ||
@@ -135,3 +187,5 @@ return this.tokenizeFromRegex('STRING', STRING, 1, 0) || this.tokenizeFromRegex('DBLSTRING', DBLSTRING, 1, 0); | ||
match = /^\.(win):(length|time)/i.exec(this.chunk); | ||
if (!match) return 0; | ||
if (!match) { | ||
return 0; | ||
} | ||
this.token('WINDOW', match[1]); | ||
@@ -144,7 +198,11 @@ this.token('WINDOW_FUNCTION', match[2]); | ||
var match, newlines, partMatch; | ||
if (!(match = WHITESPACE.exec(this.chunk))) return 0; | ||
if (!(match = WHITESPACE.exec(this.chunk))) { | ||
return 0; | ||
} | ||
partMatch = match[0]; | ||
newlines = partMatch.replace(/[^\n]/, '').length; | ||
this.currentLine += newlines; | ||
if (this.preserveWhitespace) this.token(name, partMatch); | ||
if (this.preserveWhitespace) { | ||
this.token(name, partMatch); | ||
} | ||
return partMatch.length; | ||
@@ -157,4 +215,2 @@ }; | ||
SQL_KEYWORDS = ['SELECT', 'FROM', 'WHERE', 'GROUP BY', 'ORDER BY', 'HAVING', 'AS']; | ||
SQL_FUNCTIONS = ['AVG', 'COUNT', 'MIN', 'MAX', 'SUM']; | ||
@@ -164,4 +220,8 @@ | ||
SQL_OPERATORS = ['=', '>', '<', 'LIKE', 'IS NOT', 'IS']; | ||
SQL_OPERATORS = ['=', '!=', '>=', '>', '<=', '<>', '<', 'LIKE', 'IS NOT', 'IS']; | ||
SUB_SELECT_OP = ['IN', 'NOT IN', 'ANY', 'ALL', 'SOME']; | ||
SUB_SELECT_UNARY_OP = ['EXISTS']; | ||
SQL_CONDITIONALS = ['AND', 'OR']; | ||
@@ -183,2 +243,4 @@ | ||
PARAMETER = /^\$[0-9]+/; | ||
NUMBER = /^[0-9]+(\.[0-9]+)?/; | ||
@@ -202,19 +264,95 @@ | ||
var exports = this; | ||
/* Jison generated parser */ | ||
/* parser generated by jison 0.4.15 */ | ||
/* | ||
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) | ||
} | ||
*/ | ||
var parser = (function(){ | ||
undefined | ||
var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,8],$V1=[5,26],$V2=[1,14],$V3=[1,13],$V4=[5,26,31,42],$V5=[1,17],$V6=[5,26,31,42,45,62],$V7=[1,27],$V8=[1,29],$V9=[1,38],$Va=[1,42],$Vb=[1,43],$Vc=[1,39],$Vd=[1,40],$Ve=[1,37],$Vf=[1,41],$Vg=[1,25],$Vh=[5,26,31],$Vi=[5,26,31,42,45],$Vj=[1,55],$Vk=[18,43],$Vl=[1,58],$Vm=[1,59],$Vn=[1,60],$Vo=[1,61],$Vp=[5,18,23,26,31,34,37,38,41,42,43,45,62,64,65,66,67,68],$Vq=[5,18,23,26,31,34,37,38,41,42,43,44,45,51,62,64,65,66,67,68,69],$Vr=[1,66],$Vs=[2,80],$Vt=[1,80],$Vu=[1,81],$Vv=[1,96],$Vw=[5,26,31,42,43,44],$Vx=[1,104],$Vy=[5,26,31,42,43,45,64],$Vz=[5,26,31,41,42,45,62],$VA=[1,107],$VB=[1,108],$VC=[1,109],$VD=[5,26,31,34,35,37,38,41,42,45,62],$VE=[5,26,31,34,37,38,41,42,45,62],$VF=[5,26,31,42,56,58]; | ||
var parser = {trace: function trace() { }, | ||
yy: {}, | ||
symbols_: {"error":2,"Root":3,"Query":4,"EOF":5,"SelectQuery":6,"Unions":7,"SelectWithLimitQuery":8,"BasicSelectQuery":9,"Select":10,"OrderClause":11,"GroupClause":12,"LimitClause":13,"SelectClause":14,"WhereClause":15,"SELECT":16,"Fields":17,"FROM":18,"Table":19,"DISTINCT":20,"Joins":21,"Literal":22,"LEFT_PAREN":23,"RIGHT_PAREN":24,"WINDOW":25,"WINDOW_FUNCTION":26,"Number":27,"Union":28,"UNION":29,"ALL":30,"Join":31,"JOIN":32,"ON":33,"Expression":34,"LEFT":35,"RIGHT":36,"INNER":37,"OUTER":38,"WHERE":39,"LIMIT":40,"ORDER":41,"BY":42,"OrderArgs":43,"OrderArg":44,"SEPARATOR":45,"Value":46,"DIRECTION":47,"GroupBasicClause":48,"HavingClause":49,"GROUP":50,"ArgumentList":51,"HAVING":52,"MATH":53,"MATH_MULTI":54,"OPERATOR":55,"CONDITIONAL":56,"String":57,"Function":58,"UserFunction":59,"Boolean":60,"NUMBER":61,"BOOLEAN":62,"STRING":63,"DBLSTRING":64,"LITERAL":65,"DOT":66,"FUNCTION":67,"Field":68,"STAR":69,"AS":70,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",16:"SELECT",18:"FROM",20:"DISTINCT",23:"LEFT_PAREN",24:"RIGHT_PAREN",25:"WINDOW",26:"WINDOW_FUNCTION",29:"UNION",30:"ALL",32:"JOIN",33:"ON",35:"LEFT",36:"RIGHT",37:"INNER",38:"OUTER",39:"WHERE",40:"LIMIT",41:"ORDER",42:"BY",45:"SEPARATOR",47:"DIRECTION",50:"GROUP",52:"HAVING",53:"MATH",54:"MATH_MULTI",55:"OPERATOR",56:"CONDITIONAL",61:"NUMBER",62:"BOOLEAN",63:"STRING",64:"DBLSTRING",65:"LITERAL",66:"DOT",67:"FUNCTION",69:"STAR",70:"AS"}, | ||
productions_: [0,[3,2],[4,1],[4,2],[6,1],[6,1],[9,1],[9,2],[9,2],[9,3],[8,2],[10,1],[10,2],[14,4],[14,5],[14,5],[14,6],[19,1],[19,3],[19,4],[19,6],[7,1],[7,2],[28,2],[28,3],[21,1],[21,2],[31,4],[31,5],[31,5],[31,6],[31,6],[31,6],[31,6],[15,2],[13,2],[11,3],[43,1],[43,3],[44,1],[44,2],[12,1],[12,2],[48,3],[49,2],[34,3],[34,3],[34,3],[34,3],[34,3],[34,1],[46,1],[46,1],[46,1],[46,1],[46,1],[46,1],[27,1],[60,1],[57,1],[57,1],[22,1],[22,3],[58,4],[59,4],[51,1],[51,3],[17,1],[17,3],[68,1],[68,1],[68,3]], | ||
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { | ||
symbols_: {"error":2,"Root":3,"Query":4,"EOF":5,"SelectQuery":6,"Unions":7,"SelectWithLimitQuery":8,"BasicSelectQuery":9,"Select":10,"OrderClause":11,"GroupClause":12,"LimitClause":13,"SelectClause":14,"WhereClause":15,"SELECT":16,"Fields":17,"FROM":18,"Table":19,"DISTINCT":20,"Joins":21,"Literal":22,"AS":23,"LEFT_PAREN":24,"List":25,"RIGHT_PAREN":26,"WINDOW":27,"WINDOW_FUNCTION":28,"Number":29,"Union":30,"UNION":31,"ALL":32,"Join":33,"JOIN":34,"ON":35,"Expression":36,"LEFT":37,"RIGHT":38,"INNER":39,"OUTER":40,"WHERE":41,"LIMIT":42,"SEPARATOR":43,"OFFSET":44,"ORDER":45,"BY":46,"OrderArgs":47,"OffsetClause":48,"OrderArg":49,"Value":50,"DIRECTION":51,"OffsetRows":52,"FetchClause":53,"ROW":54,"ROWS":55,"FETCH":56,"FIRST":57,"ONLY":58,"NEXT":59,"GroupBasicClause":60,"HavingClause":61,"GROUP":62,"ArgumentList":63,"HAVING":64,"MATH":65,"MATH_MULTI":66,"OPERATOR":67,"CONDITIONAL":68,"SUB_SELECT_OP":69,"SubSelectExpression":70,"SUB_SELECT_UNARY_OP":71,"String":72,"Function":73,"UserFunction":74,"Boolean":75,"Parameter":76,"NUMBER":77,"BOOLEAN":78,"PARAMETER":79,"STRING":80,"DBLSTRING":81,"LITERAL":82,"DOT":83,"FUNCTION":84,"AggregateArgumentList":85,"Field":86,"STAR":87,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",16:"SELECT",18:"FROM",20:"DISTINCT",23:"AS",24:"LEFT_PAREN",26:"RIGHT_PAREN",27:"WINDOW",28:"WINDOW_FUNCTION",31:"UNION",32:"ALL",34:"JOIN",35:"ON",37:"LEFT",38:"RIGHT",39:"INNER",40:"OUTER",41:"WHERE",42:"LIMIT",43:"SEPARATOR",44:"OFFSET",45:"ORDER",46:"BY",51:"DIRECTION",54:"ROW",55:"ROWS",56:"FETCH",57:"FIRST",58:"ONLY",59:"NEXT",62:"GROUP",64:"HAVING",65:"MATH",66:"MATH_MULTI",67:"OPERATOR",68:"CONDITIONAL",69:"SUB_SELECT_OP",71:"SUB_SELECT_UNARY_OP",77:"NUMBER",78:"BOOLEAN",79:"PARAMETER",80:"STRING",81:"DBLSTRING",82:"LITERAL",83:"DOT",84:"FUNCTION",87:"STAR"}, | ||
productions_: [0,[3,2],[4,1],[4,2],[6,1],[6,1],[9,1],[9,2],[9,2],[9,3],[8,2],[10,1],[10,2],[14,4],[14,5],[14,5],[14,6],[19,1],[19,2],[19,3],[19,3],[19,3],[19,4],[19,6],[7,1],[7,2],[30,2],[30,3],[21,1],[21,2],[33,4],[33,5],[33,5],[33,6],[33,6],[33,6],[33,6],[15,2],[13,2],[13,4],[13,4],[11,3],[11,4],[47,1],[47,3],[49,1],[49,2],[48,2],[48,3],[52,2],[52,2],[53,4],[53,4],[12,1],[12,2],[60,3],[61,2],[36,3],[36,3],[36,3],[36,3],[36,3],[36,5],[36,3],[36,2],[36,1],[70,3],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[25,1],[29,1],[75,1],[76,1],[72,1],[72,1],[22,1],[22,3],[73,4],[74,4],[85,1],[85,2],[63,1],[63,3],[17,1],[17,3],[86,1],[86,1],[86,3]], | ||
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { | ||
/* this == yyval */ | ||
var $0 = $$.length - 1; | ||
switch (yystate) { | ||
case 1:return this.$ = $$[$0-1]; | ||
case 1: | ||
return this.$ = $$[$0-1]; | ||
break; | ||
case 2:this.$ = $$[$0]; | ||
case 2: case 4: case 5: case 6: case 11: case 53: case 65: case 67: case 68: case 69: case 70: case 71: case 72: case 73: | ||
this.$ = $$[$0]; | ||
break; | ||
case 3:this.$ = (function () { | ||
case 3: | ||
this.$ = (function () { | ||
$$[$0-1].unions = $$[$0]; | ||
@@ -224,9 +362,4 @@ return $$[$0-1]; | ||
break; | ||
case 4:this.$ = $$[$0]; | ||
break; | ||
case 5:this.$ = $$[$0]; | ||
break; | ||
case 6:this.$ = $$[$0]; | ||
break; | ||
case 7:this.$ = (function () { | ||
case 7: | ||
this.$ = (function () { | ||
$$[$0-1].order = $$[$0]; | ||
@@ -236,3 +369,4 @@ return $$[$0-1]; | ||
break; | ||
case 8:this.$ = (function () { | ||
case 8: | ||
this.$ = (function () { | ||
$$[$0-1].group = $$[$0]; | ||
@@ -242,3 +376,4 @@ return $$[$0-1]; | ||
break; | ||
case 9:this.$ = (function () { | ||
case 9: | ||
this.$ = (function () { | ||
$$[$0-2].group = $$[$0-1]; | ||
@@ -249,3 +384,4 @@ $$[$0-2].order = $$[$0]; | ||
break; | ||
case 10:this.$ = (function () { | ||
case 10: | ||
this.$ = (function () { | ||
$$[$0-1].limit = $$[$0]; | ||
@@ -255,5 +391,4 @@ return $$[$0-1]; | ||
break; | ||
case 11:this.$ = $$[$0]; | ||
break; | ||
case 12:this.$ = (function () { | ||
case 12: | ||
this.$ = (function () { | ||
$$[$0-1].where = $$[$0]; | ||
@@ -263,331 +398,341 @@ return $$[$0-1]; | ||
break; | ||
case 13:this.$ = new yy.Select($$[$0-2], $$[$0], false); | ||
case 13: | ||
this.$ = new yy.Select($$[$0-2], $$[$0], false); | ||
break; | ||
case 14:this.$ = new yy.Select($$[$0-2], $$[$0], true); | ||
case 14: | ||
this.$ = new yy.Select($$[$0-2], $$[$0], true); | ||
break; | ||
case 15:this.$ = new yy.Select($$[$0-3], $$[$0-1], false, $$[$0]); | ||
case 15: | ||
this.$ = new yy.Select($$[$0-3], $$[$0-1], false, $$[$0]); | ||
break; | ||
case 16:this.$ = new yy.Select($$[$0-3], $$[$0-1], true, $$[$0]); | ||
case 16: | ||
this.$ = new yy.Select($$[$0-3], $$[$0-1], true, $$[$0]); | ||
break; | ||
case 17:this.$ = new yy.Table($$[$0]); | ||
case 17: | ||
this.$ = new yy.Table($$[$0]); | ||
break; | ||
case 18:this.$ = new yy.SubSelect($$[$0-1]); | ||
case 18: | ||
this.$ = new yy.Table($$[$0-1], $$[$0]); | ||
break; | ||
case 19:this.$ = new yy.SubSelect($$[$0-2], $$[$0]); | ||
case 19: | ||
this.$ = new yy.Table($$[$0-2], $$[$0]); | ||
break; | ||
case 20:this.$ = new yy.Table($$[$0-5], $$[$0-4], $$[$0-3], $$[$0-1]); | ||
case 20: case 49: case 50: case 51: case 52: case 57: | ||
this.$ = $$[$0-1]; | ||
break; | ||
case 21:this.$ = [$$[$0]]; | ||
case 21: case 66: | ||
this.$ = new yy.SubSelect($$[$0-1]); | ||
break; | ||
case 22:this.$ = $$[$0-1].concat($$[$01]); | ||
case 22: | ||
this.$ = new yy.SubSelect($$[$0-2], $$[$0]); | ||
break; | ||
case 23:this.$ = new yy.Union($$[$0]); | ||
case 23: | ||
this.$ = new yy.Table($$[$0-5], null, $$[$0-4], $$[$0-3], $$[$0-1]); | ||
break; | ||
case 24:this.$ = new yy.Union($$[$0], true); | ||
case 24: case 28: case 43: case 86: case 88: | ||
this.$ = [$$[$0]]; | ||
break; | ||
case 25:this.$ = [$$[$0]]; | ||
case 25: | ||
this.$ = $$[$0-1].concat($$[$01]); | ||
break; | ||
case 26:this.$ = $$[$0-1].concat($$[$0]); | ||
case 26: | ||
this.$ = new yy.Union($$[$0]); | ||
break; | ||
case 27:this.$ = new yy.Join($$[$0-2], $$[$0]); | ||
case 27: | ||
this.$ = new yy.Union($$[$0], true); | ||
break; | ||
case 28:this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT'); | ||
case 29: | ||
this.$ = $$[$0-1].concat($$[$0]); | ||
break; | ||
case 29:this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT'); | ||
case 30: | ||
this.$ = new yy.Join($$[$0-2], $$[$0]); | ||
break; | ||
case 30:this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT', 'INNER'); | ||
case 31: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT'); | ||
break; | ||
case 31:this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT', 'INNER'); | ||
case 32: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT'); | ||
break; | ||
case 32:this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT', 'OUTER'); | ||
case 33: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT', 'INNER'); | ||
break; | ||
case 33:this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT', 'OUTER'); | ||
case 34: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT', 'INNER'); | ||
break; | ||
case 34:this.$ = new yy.Where($$[$0]); | ||
case 35: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT', 'OUTER'); | ||
break; | ||
case 35:this.$ = new yy.Limit($$[$0]); | ||
case 36: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT', 'OUTER'); | ||
break; | ||
case 36:this.$ = new yy.Order($$[$0]); | ||
case 37: | ||
this.$ = new yy.Where($$[$0]); | ||
break; | ||
case 37:this.$ = [$$[$0]]; | ||
case 38: | ||
this.$ = new yy.Limit($$[$0]); | ||
break; | ||
case 38:this.$ = $$[$0-2].concat($$[$0]); | ||
case 39: | ||
this.$ = new yy.Limit($$[$0], $$[$0-2]); | ||
break; | ||
case 39:this.$ = new yy.OrderArgument($$[$0], 'ASC'); | ||
case 40: | ||
this.$ = new yy.Limit($$[$0-2], $$[$0]); | ||
break; | ||
case 40:this.$ = new yy.OrderArgument($$[$0-1], $$[$0]); | ||
case 41: | ||
this.$ = new yy.Order($$[$0]); | ||
break; | ||
case 41:this.$ = $$[$0]; | ||
case 42: | ||
this.$ = new yy.Order($$[$0-1], $$[$0]); | ||
break; | ||
case 42:this.$ = (function () { | ||
$$[$0-1].having = $$[$0]; | ||
return $$[$0-1]; | ||
}()); | ||
case 44: case 87: case 89: | ||
this.$ = $$[$0-2].concat($$[$0]); | ||
break; | ||
case 43:this.$ = new yy.Group($$[$0]); | ||
case 45: | ||
this.$ = new yy.OrderArgument($$[$0], 'ASC'); | ||
break; | ||
case 44:this.$ = new yy.Having($$[$0]); | ||
case 46: | ||
this.$ = new yy.OrderArgument($$[$0-1], $$[$0]); | ||
break; | ||
case 45:this.$ = $$[$0-1]; | ||
case 47: | ||
this.$ = new yy.Offset($$[$0]); | ||
break; | ||
case 46:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); | ||
case 48: | ||
this.$ = new yy.Offset($$[$0-1], $$[$0]); | ||
break; | ||
case 47:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); | ||
case 54: | ||
this.$ = (function () { | ||
$$[$0-1].having = $$[$0]; | ||
return $$[$0-1]; | ||
}()); | ||
break; | ||
case 48:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); | ||
case 55: | ||
this.$ = new yy.Group($$[$0]); | ||
break; | ||
case 49:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); | ||
case 56: | ||
this.$ = new yy.Having($$[$0]); | ||
break; | ||
case 50:this.$ = $$[$0]; | ||
case 58: case 59: case 60: case 61: case 63: | ||
this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); | ||
break; | ||
case 51:this.$ = $$[$0]; | ||
case 62: | ||
this.$ = new yy.Op($$[$0-3], $$[$0-4], $$[$0-1]); | ||
break; | ||
case 52:this.$ = $$[$0]; | ||
case 64: | ||
this.$ = new yy.UnaryOp($$[$0-1], $$[$0]); | ||
break; | ||
case 53:this.$ = $$[$0]; | ||
case 74: | ||
this.$ = new yy.ListValue($$[$0]); | ||
break; | ||
case 54:this.$ = $$[$0]; | ||
case 75: | ||
this.$ = new yy.NumberValue($$[$0]); | ||
break; | ||
case 55:this.$ = $$[$0]; | ||
case 76: | ||
this.$ = new yy.BooleanValue($$[$0]); | ||
break; | ||
case 56:this.$ = $$[$0]; | ||
case 77: | ||
this.$ = new yy.ParameterValue($$[$0]); | ||
break; | ||
case 57:this.$ = new yy.NumberValue($$[$0]); | ||
case 78: | ||
this.$ = new yy.StringValue($$[$0], "'"); | ||
break; | ||
case 58:this.$ = new yy.BooleanValue($$[$0]); | ||
case 79: | ||
this.$ = new yy.StringValue($$[$0], '"'); | ||
break; | ||
case 59:this.$ = new yy.StringValue($$[$0], "'"); | ||
case 80: | ||
this.$ = new yy.LiteralValue($$[$0]); | ||
break; | ||
case 60:this.$ = new yy.StringValue($$[$0], '"'); | ||
case 81: | ||
this.$ = new yy.LiteralValue($$[$0-2], $$[$0]); | ||
break; | ||
case 61:this.$ = new yy.LiteralValue($$[$0]); | ||
case 82: | ||
this.$ = new yy.FunctionValue($$[$0-3], $$[$0-1]); | ||
break; | ||
case 62:this.$ = new yy.LiteralValue($$[$0-2], $$[$0]); | ||
case 83: | ||
this.$ = new yy.FunctionValue($$[$0-3], $$[$0-1], true); | ||
break; | ||
case 63:this.$ = new yy.FunctionValue($$[$0-3], $$[$0-1]); | ||
case 84: | ||
this.$ = new yy.ArgumentListValue($$[$0]); | ||
break; | ||
case 64:this.$ = new yy.FunctionValue($$[$0-3], $$[$0-1], true); | ||
case 85: | ||
this.$ = new yy.ArgumentListValue($$[$0], true); | ||
break; | ||
case 65:this.$ = [$$[$0]]; | ||
case 90: | ||
this.$ = new yy.Star(); | ||
break; | ||
case 66:this.$ = $$[$0-2].concat($$[$0]); | ||
case 91: | ||
this.$ = new yy.Field($$[$0]); | ||
break; | ||
case 67:this.$ = [$$[$0]]; | ||
case 92: | ||
this.$ = new yy.Field($$[$0-2], $$[$0]); | ||
break; | ||
case 68:this.$ = $$[$0-2].concat($$[$0]); | ||
break; | ||
case 69:this.$ = new yy.Star(); | ||
break; | ||
case 70:this.$ = new yy.Field($$[$0]); | ||
break; | ||
case 71:this.$ = new yy.Field($$[$0-2], $$[$0]); | ||
break; | ||
} | ||
}, | ||
table: [{3:1,4:2,6:3,8:4,9:5,10:6,14:7,16:[1,8]},{1:[3]},{5:[1,9]},{5:[2,2],7:10,13:11,24:[2,2],28:12,29:[1,14],40:[1,13]},{5:[2,4],24:[2,4],29:[2,4],40:[2,4]},{5:[2,5],24:[2,5],29:[2,5],40:[2,5]},{5:[2,6],11:15,12:16,24:[2,6],29:[2,6],40:[2,6],41:[1,17],48:18,50:[1,19]},{5:[2,11],15:20,24:[2,11],29:[2,11],39:[1,21],40:[2,11],41:[2,11],50:[2,11]},{17:22,20:[1,23],22:29,23:[1,27],27:30,34:26,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39],68:24,69:[1,25]},{1:[2,1]},{5:[2,3],24:[2,3],28:41,29:[1,14]},{5:[2,10],24:[2,10],29:[2,10],40:[2,10]},{5:[2,21],24:[2,21],29:[2,21]},{27:42,61:[1,36]},{6:43,8:4,9:5,10:6,14:7,16:[1,8],30:[1,44]},{5:[2,7],24:[2,7],29:[2,7],40:[2,7]},{5:[2,8],11:45,24:[2,8],29:[2,8],40:[2,8],41:[1,17]},{42:[1,46]},{5:[2,41],24:[2,41],29:[2,41],40:[2,41],41:[2,41],49:47,52:[1,48]},{42:[1,49]},{5:[2,12],24:[2,12],29:[2,12],40:[2,12],41:[2,12],50:[2,12]},{22:29,23:[1,27],27:30,34:50,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{18:[1,51],45:[1,52]},{17:53,22:29,23:[1,27],27:30,34:26,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39],68:24,69:[1,25]},{18:[2,67],45:[2,67]},{18:[2,69],45:[2,69]},{18:[2,70],45:[2,70],53:[1,55],54:[1,56],55:[1,57],56:[1,58],70:[1,54]},{22:29,23:[1,27],27:30,34:59,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,50],18:[2,50],24:[2,50],29:[2,50],32:[2,50],35:[2,50],36:[2,50],39:[2,50],40:[2,50],41:[2,50],45:[2,50],50:[2,50],52:[2,50],53:[2,50],54:[2,50],55:[2,50],56:[2,50],70:[2,50]},{5:[2,51],18:[2,51],24:[2,51],29:[2,51],32:[2,51],35:[2,51],36:[2,51],39:[2,51],40:[2,51],41:[2,51],45:[2,51],47:[2,51],50:[2,51],52:[2,51],53:[2,51],54:[2,51],55:[2,51],56:[2,51],66:[1,60],70:[2,51]},{5:[2,52],18:[2,52],24:[2,52],29:[2,52],32:[2,52],35:[2,52],36:[2,52],39:[2,52],40:[2,52],41:[2,52],45:[2,52],47:[2,52],50:[2,52],52:[2,52],53:[2,52],54:[2,52],55:[2,52],56:[2,52],70:[2,52]},{5:[2,53],18:[2,53],24:[2,53],29:[2,53],32:[2,53],35:[2,53],36:[2,53],39:[2,53],40:[2,53],41:[2,53],45:[2,53],47:[2,53],50:[2,53],52:[2,53],53:[2,53],54:[2,53],55:[2,53],56:[2,53],70:[2,53]},{5:[2,54],18:[2,54],24:[2,54],29:[2,54],32:[2,54],35:[2,54],36:[2,54],39:[2,54],40:[2,54],41:[2,54],45:[2,54],47:[2,54],50:[2,54],52:[2,54],53:[2,54],54:[2,54],55:[2,54],56:[2,54],70:[2,54]},{5:[2,55],18:[2,55],24:[2,55],29:[2,55],32:[2,55],35:[2,55],36:[2,55],39:[2,55],40:[2,55],41:[2,55],45:[2,55],47:[2,55],50:[2,55],52:[2,55],53:[2,55],54:[2,55],55:[2,55],56:[2,55],70:[2,55]},{5:[2,56],18:[2,56],24:[2,56],29:[2,56],32:[2,56],35:[2,56],36:[2,56],39:[2,56],40:[2,56],41:[2,56],45:[2,56],47:[2,56],50:[2,56],52:[2,56],53:[2,56],54:[2,56],55:[2,56],56:[2,56],70:[2,56]},{5:[2,61],18:[2,61],23:[1,61],24:[2,61],29:[2,61],32:[2,61],35:[2,61],36:[2,61],39:[2,61],40:[2,61],41:[2,61],45:[2,61],47:[2,61],50:[2,61],52:[2,61],53:[2,61],54:[2,61],55:[2,61],56:[2,61],66:[2,61],70:[2,61]},{5:[2,57],18:[2,57],24:[2,57],29:[2,57],32:[2,57],35:[2,57],36:[2,57],39:[2,57],40:[2,57],41:[2,57],45:[2,57],47:[2,57],50:[2,57],52:[2,57],53:[2,57],54:[2,57],55:[2,57],56:[2,57],70:[2,57]},{5:[2,59],18:[2,59],24:[2,59],29:[2,59],32:[2,59],35:[2,59],36:[2,59],39:[2,59],40:[2,59],41:[2,59],45:[2,59],47:[2,59],50:[2,59],52:[2,59],53:[2,59],54:[2,59],55:[2,59],56:[2,59],70:[2,59]},{5:[2,60],18:[2,60],24:[2,60],29:[2,60],32:[2,60],35:[2,60],36:[2,60],39:[2,60],40:[2,60],41:[2,60],45:[2,60],47:[2,60],50:[2,60],52:[2,60],53:[2,60],54:[2,60],55:[2,60],56:[2,60],70:[2,60]},{23:[1,62]},{5:[2,58],18:[2,58],24:[2,58],29:[2,58],32:[2,58],35:[2,58],36:[2,58],39:[2,58],40:[2,58],41:[2,58],45:[2,58],47:[2,58],50:[2,58],52:[2,58],53:[2,58],54:[2,58],55:[2,58],56:[2,58],70:[2,58]},{5:[2,22],24:[2,22],29:[2,22]},{5:[2,35],24:[2,35],29:[2,35],40:[2,35]},{5:[2,23],13:11,24:[2,23],29:[2,23],40:[1,13]},{6:63,8:4,9:5,10:6,14:7,16:[1,8]},{5:[2,9],24:[2,9],29:[2,9],40:[2,9]},{22:29,27:30,43:64,44:65,46:66,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,42],24:[2,42],29:[2,42],40:[2,42],41:[2,42]},{22:29,23:[1,27],27:30,34:67,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:69,46:28,51:68,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,34],24:[2,34],29:[2,34],40:[2,34],41:[2,34],50:[2,34],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{19:70,22:71,23:[1,72],65:[1,73]},{22:29,23:[1,27],27:30,34:26,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39],68:74,69:[1,25]},{18:[1,75],45:[1,52]},{22:76,65:[1,73]},{22:29,23:[1,27],27:30,34:77,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:78,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:79,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:80,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{24:[1,81],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{65:[1,82]},{22:29,23:[1,27],27:30,34:69,46:28,51:83,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:69,46:28,51:84,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,24],13:11,24:[2,24],29:[2,24],40:[1,13]},{5:[2,36],24:[2,36],29:[2,36],40:[2,36],45:[1,85]},{5:[2,37],24:[2,37],29:[2,37],40:[2,37],45:[2,37]},{5:[2,39],24:[2,39],29:[2,39],40:[2,39],45:[2,39],47:[1,86]},{5:[2,44],24:[2,44],29:[2,44],40:[2,44],41:[2,44],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{5:[2,43],24:[2,43],29:[2,43],40:[2,43],41:[2,43],45:[1,87],52:[2,43]},{5:[2,65],24:[2,65],29:[2,65],40:[2,65],41:[2,65],45:[2,65],52:[2,65],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{5:[2,13],21:88,24:[2,13],29:[2,13],31:89,32:[1,90],35:[1,91],36:[1,92],39:[2,13],40:[2,13],41:[2,13],50:[2,13]},{5:[2,17],24:[2,17],25:[1,93],29:[2,17],32:[2,17],33:[2,17],35:[2,17],36:[2,17],39:[2,17],40:[2,17],41:[2,17],50:[2,17],66:[1,60]},{4:94,6:3,8:4,9:5,10:6,14:7,16:[1,8]},{5:[2,61],18:[2,61],24:[2,61],25:[2,61],29:[2,61],32:[2,61],33:[2,61],35:[2,61],36:[2,61],39:[2,61],40:[2,61],41:[2,61],45:[2,61],50:[2,61],66:[2,61]},{18:[2,68],45:[2,68]},{19:95,22:71,23:[1,72],65:[1,73]},{18:[2,71],45:[2,71],66:[1,60]},{5:[2,46],18:[2,46],24:[2,46],29:[2,46],32:[2,46],35:[2,46],36:[2,46],39:[2,46],40:[2,46],41:[2,46],45:[2,46],50:[2,46],52:[2,46],53:[2,46],54:[1,56],55:[2,46],56:[2,46],70:[2,46]},{5:[2,47],18:[2,47],24:[2,47],29:[2,47],32:[2,47],35:[2,47],36:[2,47],39:[2,47],40:[2,47],41:[2,47],45:[2,47],50:[2,47],52:[2,47],53:[2,47],54:[2,47],55:[2,47],56:[2,47],70:[2,47]},{5:[2,48],18:[2,48],24:[2,48],29:[2,48],32:[2,48],35:[2,48],36:[2,48],39:[2,48],40:[2,48],41:[2,48],45:[2,48],50:[2,48],52:[2,48],53:[1,55],54:[1,56],55:[2,48],56:[2,48],70:[2,48]},{5:[2,49],18:[2,49],24:[2,49],29:[2,49],32:[2,49],35:[2,49],36:[2,49],39:[2,49],40:[2,49],41:[2,49],45:[2,49],50:[2,49],52:[2,49],53:[1,55],54:[1,56],55:[1,57],56:[2,49],70:[2,49]},{5:[2,45],18:[2,45],24:[2,45],29:[2,45],32:[2,45],35:[2,45],36:[2,45],39:[2,45],40:[2,45],41:[2,45],45:[2,45],50:[2,45],52:[2,45],53:[2,45],54:[2,45],55:[2,45],56:[2,45],70:[2,45]},{5:[2,62],18:[2,62],24:[2,62],25:[2,62],29:[2,62],32:[2,62],33:[2,62],35:[2,62],36:[2,62],39:[2,62],40:[2,62],41:[2,62],45:[2,62],47:[2,62],50:[2,62],52:[2,62],53:[2,62],54:[2,62],55:[2,62],56:[2,62],66:[2,62],70:[2,62]},{24:[1,96],45:[1,87]},{24:[1,97],45:[1,87]},{22:29,27:30,44:98,46:66,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,40],24:[2,40],29:[2,40],40:[2,40],45:[2,40]},{22:29,27:30,46:99,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,15],24:[2,15],29:[2,15],31:100,32:[1,90],35:[1,91],36:[1,92],39:[2,15],40:[2,15],41:[2,15],50:[2,15]},{5:[2,25],24:[2,25],29:[2,25],32:[2,25],35:[2,25],36:[2,25],39:[2,25],40:[2,25],41:[2,25],50:[2,25]},{19:101,22:71,23:[1,72],65:[1,73]},{32:[1,102],37:[1,103],38:[1,104]},{32:[1,105],37:[1,106],38:[1,107]},{26:[1,108]},{24:[1,109]},{5:[2,14],21:110,24:[2,14],29:[2,14],31:89,32:[1,90],35:[1,91],36:[1,92],39:[2,14],40:[2,14],41:[2,14],50:[2,14]},{5:[2,64],18:[2,64],24:[2,64],29:[2,64],32:[2,64],35:[2,64],36:[2,64],39:[2,64],40:[2,64],41:[2,64],45:[2,64],47:[2,64],50:[2,64],52:[2,64],53:[2,64],54:[2,64],55:[2,64],56:[2,64],70:[2,64]},{5:[2,63],18:[2,63],24:[2,63],29:[2,63],32:[2,63],35:[2,63],36:[2,63],39:[2,63],40:[2,63],41:[2,63],45:[2,63],47:[2,63],50:[2,63],52:[2,63],53:[2,63],54:[2,63],55:[2,63],56:[2,63],70:[2,63]},{5:[2,38],24:[2,38],29:[2,38],40:[2,38],45:[2,38]},{5:[2,66],24:[2,66],29:[2,66],40:[2,66],41:[2,66],45:[2,66],52:[2,66]},{5:[2,26],24:[2,26],29:[2,26],32:[2,26],35:[2,26],36:[2,26],39:[2,26],40:[2,26],41:[2,26],50:[2,26]},{33:[1,111]},{19:112,22:71,23:[1,72],65:[1,73]},{32:[1,113]},{32:[1,114]},{19:115,22:71,23:[1,72],65:[1,73]},{32:[1,116]},{32:[1,117]},{23:[1,118]},{5:[2,18],22:119,24:[2,18],29:[2,18],32:[2,18],33:[2,18],35:[2,18],36:[2,18],39:[2,18],40:[2,18],41:[2,18],50:[2,18],65:[1,73]},{5:[2,16],24:[2,16],29:[2,16],31:100,32:[1,90],35:[1,91],36:[1,92],39:[2,16],40:[2,16],41:[2,16],50:[2,16]},{22:29,23:[1,27],27:30,34:120,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{33:[1,121]},{19:122,22:71,23:[1,72],65:[1,73]},{19:123,22:71,23:[1,72],65:[1,73]},{33:[1,124]},{19:125,22:71,23:[1,72],65:[1,73]},{19:126,22:71,23:[1,72],65:[1,73]},{27:127,61:[1,36]},{5:[2,19],24:[2,19],29:[2,19],32:[2,19],33:[2,19],35:[2,19],36:[2,19],39:[2,19],40:[2,19],41:[2,19],50:[2,19],66:[1,60]},{5:[2,27],24:[2,27],29:[2,27],32:[2,27],35:[2,27],36:[2,27],39:[2,27],40:[2,27],41:[2,27],50:[2,27],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{22:29,23:[1,27],27:30,34:128,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{33:[1,129]},{33:[1,130]},{22:29,23:[1,27],27:30,34:131,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{33:[1,132]},{33:[1,133]},{24:[1,134]},{5:[2,28],24:[2,28],29:[2,28],32:[2,28],35:[2,28],36:[2,28],39:[2,28],40:[2,28],41:[2,28],50:[2,28],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{22:29,23:[1,27],27:30,34:135,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:136,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,29],24:[2,29],29:[2,29],32:[2,29],35:[2,29],36:[2,29],39:[2,29],40:[2,29],41:[2,29],50:[2,29],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{22:29,23:[1,27],27:30,34:137,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:138,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,20],24:[2,20],29:[2,20],32:[2,20],33:[2,20],35:[2,20],36:[2,20],39:[2,20],40:[2,20],41:[2,20],50:[2,20]},{5:[2,30],24:[2,30],29:[2,30],32:[2,30],35:[2,30],36:[2,30],39:[2,30],40:[2,30],41:[2,30],50:[2,30],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{5:[2,32],24:[2,32],29:[2,32],32:[2,32],35:[2,32],36:[2,32],39:[2,32],40:[2,32],41:[2,32],50:[2,32],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{5:[2,31],24:[2,31],29:[2,31],32:[2,31],35:[2,31],36:[2,31],39:[2,31],40:[2,31],41:[2,31],50:[2,31],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{5:[2,33],24:[2,33],29:[2,33],32:[2,33],35:[2,33],36:[2,33],39:[2,33],40:[2,33],41:[2,33],50:[2,33],53:[1,55],54:[1,56],55:[1,57],56:[1,58]}], | ||
table: [{3:1,4:2,6:3,8:4,9:5,10:6,14:7,16:$V0},{1:[3]},{5:[1,9]},o($V1,[2,2],{7:10,13:11,30:12,31:$V2,42:$V3}),o($V4,[2,4]),o($V4,[2,5]),o($V4,[2,6],{11:15,12:16,60:18,45:$V5,62:[1,19]}),o($V6,[2,11],{15:20,41:[1,21]}),{17:22,20:[1,23],22:30,24:$V7,29:31,36:26,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf,86:24,87:$Vg},{1:[2,1]},o($V1,[2,3],{30:44,31:$V2}),o($V4,[2,10]),o($Vh,[2,24]),{29:45,77:$V9},{6:46,8:4,9:5,10:6,14:7,16:$V0,32:[1,47]},o($V4,[2,7]),o($V4,[2,8],{11:48,45:$V5}),{46:[1,49]},o($Vi,[2,53],{61:50,64:[1,51]}),{46:[1,52]},o($V6,[2,12]),{22:30,24:$V7,29:31,36:53,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{18:[1,54],43:$Vj},{17:56,22:30,24:$V7,29:31,36:26,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf,86:24,87:$Vg},o($Vk,[2,88]),o($Vk,[2,90]),o($Vk,[2,91],{23:[1,57],65:$Vl,66:$Vm,67:$Vn,68:$Vo}),{22:30,24:$V7,29:31,36:62,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($Vp,[2,65],{69:[1,63]}),{24:[1,65],70:64},o($Vq,[2,67],{83:$Vr}),o($Vq,[2,68]),o($Vq,[2,69]),o($Vq,[2,70]),o($Vq,[2,71]),o($Vq,[2,72]),o($Vq,[2,73]),o([5,18,23,26,31,34,37,38,41,42,43,44,45,51,62,64,65,66,67,68,69,83],$Vs,{24:[1,67]}),o([5,18,23,26,31,34,37,38,41,42,43,44,45,51,54,55,62,64,65,66,67,68,69],[2,75]),o($Vq,[2,78]),o($Vq,[2,79]),{24:[1,68]},o($Vq,[2,76]),o($Vq,[2,77]),o($Vh,[2,25]),o($V4,[2,38],{43:[1,69],44:[1,70]}),o($Vh,[2,26],{13:11,42:$V3}),{6:71,8:4,9:5,10:6,14:7,16:$V0},o($V4,[2,9]),{22:30,29:31,47:72,49:73,50:74,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($Vi,[2,54]),{22:30,24:$V7,29:31,36:75,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:77,50:28,63:76,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($V6,[2,37],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),{19:78,22:79,24:$Vt,82:$Vu},{22:30,24:$V7,29:31,36:26,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf,86:82,87:$Vg},{18:[1,83],43:$Vj},{22:84,82:$Vu},{22:30,24:$V7,29:31,36:85,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:86,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:87,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:88,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{26:[1,89],65:$Vl,66:$Vm,67:$Vn,68:$Vo},{24:[1,90],70:91},o($Vp,[2,64]),{4:92,6:3,8:4,9:5,10:6,14:7,16:$V0},{82:[1,93]},{20:$Vv,22:30,24:$V7,29:31,36:77,50:28,63:95,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf,85:94},{20:$Vv,22:30,24:$V7,29:31,36:77,50:28,63:95,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf,85:97},{29:98,77:$V9},{29:99,77:$V9},o($Vh,[2,27],{13:11,42:$V3}),o($V4,[2,41],{48:100,43:[1,101],44:[1,102]}),o($Vw,[2,43]),o($Vw,[2,45],{51:[1,103]}),o($Vi,[2,56],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),o([5,26,31,42,45,64],[2,55],{43:$Vx}),o($Vy,[2,86],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),o($Vz,[2,13],{21:105,33:106,34:$VA,37:$VB,38:$VC}),o($VD,[2,17],{22:110,23:[1,111],27:[1,112],82:$Vu,83:$Vr}),{4:114,6:3,8:4,9:5,10:6,14:7,16:$V0,22:30,24:$V7,25:113,29:31,36:77,50:28,63:115,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o([5,18,23,26,27,31,34,35,37,38,41,42,43,45,62,82,83],$Vs),o($Vk,[2,89]),{19:116,22:79,24:$Vt,82:$Vu},o($Vk,[2,92],{83:$Vr}),o([5,18,23,26,31,34,37,38,41,42,43,45,62,64,65,67,68],[2,58],{66:$Vm}),o($Vp,[2,59]),o([5,18,23,26,31,34,37,38,41,42,43,45,62,64,67,68],[2,60],{65:$Vl,66:$Vm}),o([5,18,23,26,31,34,37,38,41,42,43,45,62,64,68],[2,61],{65:$Vl,66:$Vm,67:$Vn}),o($Vp,[2,57]),{4:92,6:3,8:4,9:5,10:6,14:7,16:$V0,22:30,24:$V7,25:117,29:31,36:77,50:28,63:115,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($Vp,[2,63]),{26:[1,118]},o([5,18,23,26,27,31,34,35,37,38,41,42,43,44,45,51,62,64,65,66,67,68,69,82,83],[2,81]),{26:[1,119]},{26:[2,84],43:$Vx},{22:30,24:$V7,29:31,36:77,50:28,63:120,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{26:[1,121]},o($V4,[2,39]),o($V4,[2,40]),o($V4,[2,42]),{22:30,29:31,49:122,50:74,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{29:124,52:123,77:$V9},o($Vw,[2,46]),{22:30,29:31,50:125,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($Vz,[2,15],{33:126,34:$VA,37:$VB,38:$VC}),o($VE,[2,28]),{19:127,22:79,24:$Vt,82:$Vu},{34:[1,128],39:[1,129],40:[1,130]},{34:[1,131],39:[1,132],40:[1,133]},o($VD,[2,18],{83:$Vr}),{22:134,82:$Vu},{28:[1,135]},{26:[1,136]},{26:[1,137]},{26:[2,74],43:$Vx},o($Vz,[2,14],{33:106,21:138,34:$VA,37:$VB,38:$VC}),{26:[1,139]},o($Vp,[2,66]),o($Vq,[2,83]),{26:[2,85],43:$Vx},o($Vq,[2,82]),o($Vw,[2,44]),o($V4,[2,47],{53:140,56:[1,141]}),{54:[1,142],55:[1,143]},o($Vy,[2,87]),o($VE,[2,29]),{35:[1,144]},{19:145,22:79,24:$Vt,82:$Vu},{34:[1,146]},{34:[1,147]},{19:148,22:79,24:$Vt,82:$Vu},{34:[1,149]},{34:[1,150]},o($VD,[2,19],{83:$Vr}),{24:[1,151]},o($VD,[2,20]),o($VD,[2,21],{22:152,82:$Vu}),o($Vz,[2,16],{33:126,34:$VA,37:$VB,38:$VC}),o($Vp,[2,62]),o($V4,[2,48]),{57:[1,153],59:[1,154]},o($VF,[2,49]),o($VF,[2,50]),{22:30,24:$V7,29:31,36:155,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{35:[1,156]},{19:157,22:79,24:$Vt,82:$Vu},{19:158,22:79,24:$Vt,82:$Vu},{35:[1,159]},{19:160,22:79,24:$Vt,82:$Vu},{19:161,22:79,24:$Vt,82:$Vu},{29:162,77:$V9},o($VD,[2,22],{83:$Vr}),{29:124,52:163,77:$V9},{29:124,52:164,77:$V9},o($VE,[2,30],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),{22:30,24:$V7,29:31,36:165,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{35:[1,166]},{35:[1,167]},{22:30,24:$V7,29:31,36:168,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{35:[1,169]},{35:[1,170]},{26:[1,171]},{58:[1,172]},{58:[1,173]},o($VE,[2,31],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),{22:30,24:$V7,29:31,36:174,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:175,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($VE,[2,32],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),{22:30,24:$V7,29:31,36:176,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:177,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($VD,[2,23]),o($V4,[2,51]),o($V4,[2,52]),o($VE,[2,33],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),o($VE,[2,35],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),o($VE,[2,34],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),o($VE,[2,36],{65:$Vl,66:$Vm,67:$Vn,68:$Vo})], | ||
defaultActions: {9:[2,1]}, | ||
parseError: function parseError(str, hash) { | ||
throw new Error(str); | ||
if (hash.recoverable) { | ||
this.trace(str); | ||
} else { | ||
throw new Error(str); | ||
} | ||
}, | ||
parse: function parse(input) { | ||
var self = this, | ||
stack = [0], | ||
vstack = [null], // semantic value stack | ||
lstack = [], // location stack | ||
table = this.table, | ||
yytext = '', | ||
yylineno = 0, | ||
yyleng = 0, | ||
recovering = 0, | ||
TERROR = 2, | ||
EOF = 1; | ||
//this.reductionCount = this.shiftCount = 0; | ||
this.lexer.setInput(input); | ||
this.lexer.yy = this.yy; | ||
this.yy.lexer = this.lexer; | ||
if (typeof this.lexer.yylloc == 'undefined') | ||
this.lexer.yylloc = {}; | ||
var yyloc = this.lexer.yylloc; | ||
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; | ||
var args = lstack.slice.call(arguments, 1); | ||
var lexer = Object.create(this.lexer); | ||
var sharedState = { yy: {} }; | ||
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); | ||
if (typeof this.yy.parseError === 'function') | ||
this.parseError = this.yy.parseError; | ||
function popStack (n) { | ||
stack.length = stack.length - 2*n; | ||
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; | ||
} | ||
function lex() { | ||
var token; | ||
token = self.lexer.lex() || 1; // $end = 1 | ||
// if token isn't its numeric value, convert | ||
if (typeof token !== 'number') { | ||
token = self.symbols_[token] || token; | ||
_token_stack: | ||
function lex() { | ||
var token; | ||
token = lexer.lex() || EOF; | ||
if (typeof token !== 'number') { | ||
token = self.symbols_[token] || token; | ||
} | ||
return token; | ||
} | ||
return token; | ||
}; | ||
var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected; | ||
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 | ||
state = stack[stack.length - 1]; | ||
if (this.defaultActions[state]) { | ||
action = this.defaultActions[state]; | ||
} else { | ||
if (symbol == null) | ||
if (symbol === null || typeof symbol == 'undefined') { | ||
symbol = lex(); | ||
// read action for current state and first input | ||
} | ||
action = table[state] && table[state][symbol]; | ||
} | ||
// handle parse error | ||
if (typeof action === 'undefined' || !action.length || !action[0]) { | ||
if (!recovering) { | ||
// Report error | ||
if (typeof action === 'undefined' || !action.length || !action[0]) { | ||
var errStr = ''; | ||
expected = []; | ||
for (p in table[state]) if (this.terminals_[p] && p > 2) { | ||
expected.push("'"+this.terminals_[p]+"'"); | ||
for (p in table[state]) { | ||
if (this.terminals_[p] && p > TERROR) { | ||
expected.push('\'' + this.terminals_[p] + '\''); | ||
} | ||
} | ||
var errStr = ''; | ||
if (this.lexer.showPosition) { | ||
errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+'\nExpecting '+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'"; | ||
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 == 1 /*EOF*/ ? "end of input" : | ||
("'"+(this.terminals_[symbol] || symbol)+"'")); | ||
errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); | ||
} | ||
this.parseError(errStr, | ||
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); | ||
this.parseError(errStr, { | ||
text: lexer.match, | ||
token: this.terminals_[symbol] || symbol, | ||
line: lexer.yylineno, | ||
loc: yyloc, | ||
expected: expected | ||
}); | ||
} | ||
// just recovered from another error | ||
if (recovering == 3) { | ||
if (symbol == EOF) { | ||
throw new Error(errStr || 'Parsing halted.'); | ||
} | ||
// discard current lookahead and grab another | ||
yyleng = this.lexer.yyleng; | ||
yytext = this.lexer.yytext; | ||
yylineno = this.lexer.yylineno; | ||
yyloc = this.lexer.yylloc; | ||
symbol = lex(); | ||
} | ||
// try to recover from error | ||
while (1) { | ||
// check for error recovery rule in this state | ||
if ((TERROR.toString()) in table[state]) { | ||
break; | ||
} | ||
if (state == 0) { | ||
throw new Error(errStr || 'Parsing halted.'); | ||
} | ||
popStack(1); | ||
state = stack[stack.length-1]; | ||
} | ||
preErrorSymbol = 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); | ||
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(this.lexer.yytext); | ||
lstack.push(this.lexer.yylloc); | ||
stack.push(action[1]); // push state | ||
symbol = null; | ||
if (!preErrorSymbol) { // normal execution/no error | ||
yyleng = this.lexer.yyleng; | ||
yytext = this.lexer.yytext; | ||
yylineno = this.lexer.yylineno; | ||
yyloc = this.lexer.yylloc; | ||
if (recovering > 0) | ||
recovering--; | ||
} else { // error just occurred, resume old lookahead f/ before error | ||
symbol = preErrorSymbol; | ||
preErrorSymbol = null; | ||
case 1: | ||
stack.push(symbol); | ||
vstack.push(lexer.yytext); | ||
lstack.push(lexer.yylloc); | ||
stack.push(action[1]); | ||
symbol = null; | ||
if (!preErrorSymbol) { | ||
yyleng = lexer.yyleng; | ||
yytext = lexer.yytext; | ||
yylineno = lexer.yylineno; | ||
yyloc = lexer.yylloc; | ||
if (recovering > 0) { | ||
recovering--; | ||
} | ||
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 | ||
}; | ||
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); | ||
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; | ||
} else { | ||
symbol = preErrorSymbol; | ||
preErrorSymbol = null; | ||
} | ||
break; | ||
case 2: | ||
len = this.productions_[action[1]][1]; | ||
yyval.$ = vstack[vstack.length - len]; | ||
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; | ||
} | ||
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]); | ||
vstack.push(yyval.$); | ||
lstack.push(yyval._$); | ||
newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; | ||
stack.push(newState); | ||
break; | ||
case 3: | ||
return true; | ||
} | ||
} | ||
return true; | ||
}}; | ||
return parser; | ||
function Parser () { | ||
this.yy = {}; | ||
} | ||
Parser.prototype = parser;parser.Parser = Parser; | ||
return new Parser; | ||
})(); | ||
if (typeof require !== 'undefined' && typeof exports !== 'undefined') { | ||
exports.parser = parser; | ||
exports.parse = function () { return parser.parse.apply(parser, arguments); } | ||
exports.Parser = parser.Parser; | ||
exports.parse = function () { return parser.parse.apply(parser, arguments); }; | ||
exports.main = function commonjsMain(args) { | ||
if (!args[1]) | ||
throw new Error('Usage: '+args[0]+' FILE'); | ||
if (typeof process !== 'undefined') { | ||
var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8"); | ||
} else { | ||
var cwd = require("file").path(require("file").cwd()); | ||
var source = cwd.join(args[1]).read({charset: "utf-8"}); | ||
if (!args[1]) { | ||
console.log('Usage: '+args[0]+' FILE'); | ||
process.exit(1); | ||
} | ||
var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); | ||
return exports.parser.parse(source); | ||
} | ||
}; | ||
if (typeof module !== 'undefined' && require.main === module) { | ||
exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); | ||
exports.main(process.argv.slice(1)); | ||
} | ||
@@ -597,4 +742,5 @@ } | ||
var exports = this; | ||
(function() { | ||
var Field, FunctionValue, Group, Having, Join, Limit, LiteralValue, Op, Order, OrderArgument, Select, Star, StringValue, SubSelect, Table, Union, Where, indent; | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
var ArgumentListValue, Field, FunctionValue, Group, Having, Join, Limit, ListValue, LiteralValue, Offset, Op, Order, OrderArgument, ParameterValue, Select, Star, StringValue, SubSelect, Table, UnaryOp, Union, Where, indent; | ||
@@ -616,3 +762,2 @@ indent = function(str) { | ||
exports.Select = Select = (function() { | ||
function Select(fields, source, distinct, joins, unions) { | ||
@@ -631,3 +776,3 @@ this.fields = fields; | ||
Select.prototype.toString = function() { | ||
var join, ret, union, _i, _j, _len, _len2, _ref, _ref2; | ||
var join, ret, union, _i, _j, _len, _len1, _ref, _ref1; | ||
ret = ["SELECT " + (this.fields.join(', '))]; | ||
@@ -640,9 +785,17 @@ ret.push(indent("FROM " + this.source)); | ||
} | ||
if (this.where) ret.push(indent(this.where.toString())); | ||
if (this.group) ret.push(indent(this.group.toString())); | ||
if (this.order) ret.push(indent(this.order.toString())); | ||
if (this.limit) ret.push(indent(this.limit.toString())); | ||
_ref2 = this.unions; | ||
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { | ||
union = _ref2[_j]; | ||
if (this.where) { | ||
ret.push(indent(this.where.toString())); | ||
} | ||
if (this.group) { | ||
ret.push(indent(this.group.toString())); | ||
} | ||
if (this.order) { | ||
ret.push(indent(this.order.toString())); | ||
} | ||
if (this.limit) { | ||
ret.push(indent(this.limit.toString())); | ||
} | ||
_ref1 = this.unions; | ||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | ||
union = _ref1[_j]; | ||
ret.push(union.toString()); | ||
@@ -658,3 +811,2 @@ } | ||
exports.SubSelect = SubSelect = (function() { | ||
function SubSelect(select, name) { | ||
@@ -680,3 +832,2 @@ this.select = select; | ||
exports.Join = Join = (function() { | ||
function Join(right, conditions, side, mode) { | ||
@@ -693,4 +844,8 @@ this.right = right; | ||
ret = ''; | ||
if (this.side != null) ret += "" + this.side + " "; | ||
if (this.mode != null) ret += "" + this.mode + " "; | ||
if (this.side != null) { | ||
ret += "" + this.side + " "; | ||
} | ||
if (this.mode != null) { | ||
ret += "" + this.mode + " "; | ||
} | ||
return ret + ("JOIN " + this.right + "\n") + indent("ON " + this.conditions); | ||
@@ -704,3 +859,2 @@ }; | ||
exports.Union = Union = (function() { | ||
function Union(query, all) { | ||
@@ -723,3 +877,2 @@ this.query = query; | ||
exports.LiteralValue = LiteralValue = (function() { | ||
function LiteralValue(value, value2) { | ||
@@ -747,3 +900,2 @@ this.value = value; | ||
exports.StringValue = StringValue = (function() { | ||
function StringValue(value, quoteType) { | ||
@@ -764,3 +916,2 @@ this.value = value; | ||
exports.NumberValue = LiteralValue = (function() { | ||
function LiteralValue(value) { | ||
@@ -778,4 +929,49 @@ this.value = Number(value); | ||
exports.ListValue = ListValue = (function() { | ||
function ListValue(value) { | ||
this.value = value; | ||
} | ||
ListValue.prototype.toString = function() { | ||
return "(" + (this.value.join(', ')) + ")"; | ||
}; | ||
return ListValue; | ||
})(); | ||
exports.ParameterValue = ParameterValue = (function() { | ||
function ParameterValue(value) { | ||
this.value = value; | ||
this.index = parseInt(value.substr(1), 10) - 1; | ||
} | ||
ParameterValue.prototype.toString = function() { | ||
return "" + this.value; | ||
}; | ||
return ParameterValue; | ||
})(); | ||
exports.ArgumentListValue = ArgumentListValue = (function() { | ||
function ArgumentListValue(value, distinct) { | ||
this.value = value; | ||
this.distinct = distinct != null ? distinct : false; | ||
null; | ||
} | ||
ArgumentListValue.prototype.toString = function() { | ||
if (this.distinct) { | ||
return "DISTINCT " + (this.value.join(', ')); | ||
} else { | ||
return "" + (this.value.join(', ')); | ||
} | ||
}; | ||
return ArgumentListValue; | ||
})(); | ||
exports.BooleanValue = LiteralValue = (function() { | ||
function LiteralValue(value) { | ||
@@ -807,6 +1003,5 @@ this.value = (function() { | ||
exports.FunctionValue = FunctionValue = (function() { | ||
function FunctionValue(name, _arguments, udf) { | ||
this.name = name; | ||
this.arguments = _arguments != null ? _arguments : []; | ||
this["arguments"] = _arguments != null ? _arguments : null; | ||
this.udf = udf != null ? udf : false; | ||
@@ -817,3 +1012,7 @@ null; | ||
FunctionValue.prototype.toString = function() { | ||
return "" + this.name + "(" + (this.arguments.join(', ')) + ")"; | ||
if (this["arguments"]) { | ||
return "" + (this.name.toUpperCase()) + "(" + (this["arguments"].toString()) + ")"; | ||
} else { | ||
return "" + (this.name.toUpperCase()) + "()"; | ||
} | ||
}; | ||
@@ -826,9 +1025,9 @@ | ||
exports.Order = Order = (function() { | ||
function Order(orderings) { | ||
function Order(orderings, offset) { | ||
this.orderings = orderings; | ||
this.offset = offset; | ||
} | ||
Order.prototype.toString = function() { | ||
return "ORDER BY " + (this.orderings.join(', ')); | ||
return ("ORDER BY " + (this.orderings.join(', '))) + (this.offset ? "\n" + this.offset.toString() : ""); | ||
}; | ||
@@ -841,3 +1040,2 @@ | ||
exports.OrderArgument = OrderArgument = (function() { | ||
function OrderArgument(value, direction) { | ||
@@ -857,6 +1055,21 @@ this.value = value; | ||
exports.Offset = Offset = (function() { | ||
function Offset(row_count, limit) { | ||
this.row_count = row_count; | ||
this.limit = limit; | ||
null; | ||
} | ||
Offset.prototype.toString = function() { | ||
return ("OFFSET " + this.row_count + " ROWS") + (this.limit ? "\nFETCH NEXT " + this.limit + " ROWS ONLY" : ""); | ||
}; | ||
return Offset; | ||
})(); | ||
exports.Limit = Limit = (function() { | ||
function Limit(value) { | ||
function Limit(value, offset) { | ||
this.value = value; | ||
this.offset = offset; | ||
null; | ||
@@ -866,3 +1079,3 @@ } | ||
Limit.prototype.toString = function() { | ||
return "LIMIT " + this.value; | ||
return ("LIMIT " + this.value) + (this.offset ? "\nOFFSET " + this.offset : ""); | ||
}; | ||
@@ -875,5 +1088,5 @@ | ||
exports.Table = Table = (function() { | ||
function Table(name, win, winFn, winArg) { | ||
function Table(name, alias, win, winFn, winArg) { | ||
this.name = name; | ||
this.alias = alias != null ? alias : null; | ||
this.win = win != null ? win : null; | ||
@@ -888,2 +1101,4 @@ this.winFn = winFn != null ? winFn : null; | ||
return "" + this.name + "." + this.win + ":" + this.winFn + "(" + this.winArg + ")"; | ||
} else if (this.alias) { | ||
return "" + this.name + " AS " + this.alias; | ||
} else { | ||
@@ -899,3 +1114,2 @@ return this.name.toString(); | ||
exports.Group = Group = (function() { | ||
function Group(fields) { | ||
@@ -909,3 +1123,5 @@ this.fields = fields; | ||
ret = ["GROUP BY " + (this.fields.join(', '))]; | ||
if (this.having) ret.push(this.having.toString()); | ||
if (this.having) { | ||
ret.push(this.having.toString()); | ||
} | ||
return ret.join("\n"); | ||
@@ -919,3 +1135,2 @@ }; | ||
exports.Where = Where = (function() { | ||
function Where(conditions) { | ||
@@ -935,3 +1150,2 @@ this.conditions = conditions; | ||
exports.Having = Having = (function() { | ||
function Having(conditions) { | ||
@@ -951,3 +1165,2 @@ this.conditions = conditions; | ||
exports.Op = Op = (function() { | ||
function Op(operation, left, right) { | ||
@@ -961,3 +1174,3 @@ this.operation = operation; | ||
Op.prototype.toString = function() { | ||
return "(" + this.left + " " + this.operation + " " + this.right + ")"; | ||
return "(" + this.left + " " + (this.operation.toUpperCase()) + " " + this.right + ")"; | ||
}; | ||
@@ -969,4 +1182,18 @@ | ||
exports.UnaryOp = UnaryOp = (function() { | ||
function UnaryOp(operator, operand) { | ||
this.operator = operator; | ||
this.operand = operand; | ||
null; | ||
} | ||
UnaryOp.prototype.toString = function() { | ||
return "(" + (this.operator.toUpperCase()) + " " + this.operand + ")"; | ||
}; | ||
return UnaryOp; | ||
})(); | ||
exports.Field = Field = (function() { | ||
function Field(field, name) { | ||
@@ -991,3 +1218,2 @@ this.field = field; | ||
exports.Star = Star = (function() { | ||
function Star() { | ||
@@ -1011,3 +1237,4 @@ null; | ||
var exports = this; | ||
(function() { | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
var buildParser; | ||
@@ -1046,4 +1273,4 @@ | ||
var exports = this; | ||
(function() { | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
exports.lexer = require('./lexer'); | ||
@@ -1050,0 +1277,0 @@ |
@@ -1,18 +0,94 @@ | ||
/* Jison generated parser */ | ||
/* parser generated by jison 0.4.15 */ | ||
/* | ||
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) | ||
} | ||
*/ | ||
var parser = (function(){ | ||
undefined | ||
var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,8],$V1=[5,26],$V2=[1,14],$V3=[1,13],$V4=[5,26,31,42],$V5=[1,17],$V6=[5,26,31,42,45,62],$V7=[1,27],$V8=[1,29],$V9=[1,38],$Va=[1,42],$Vb=[1,43],$Vc=[1,39],$Vd=[1,40],$Ve=[1,37],$Vf=[1,41],$Vg=[1,25],$Vh=[5,26,31],$Vi=[5,26,31,42,45],$Vj=[1,55],$Vk=[18,43],$Vl=[1,58],$Vm=[1,59],$Vn=[1,60],$Vo=[1,61],$Vp=[5,18,23,26,31,34,37,38,41,42,43,45,62,64,65,66,67,68],$Vq=[5,18,23,26,31,34,37,38,41,42,43,44,45,51,62,64,65,66,67,68,69],$Vr=[1,66],$Vs=[2,80],$Vt=[1,80],$Vu=[1,81],$Vv=[1,96],$Vw=[5,26,31,42,43,44],$Vx=[1,104],$Vy=[5,26,31,42,43,45,64],$Vz=[5,26,31,41,42,45,62],$VA=[1,107],$VB=[1,108],$VC=[1,109],$VD=[5,26,31,34,35,37,38,41,42,45,62],$VE=[5,26,31,34,37,38,41,42,45,62],$VF=[5,26,31,42,56,58]; | ||
var parser = {trace: function trace() { }, | ||
yy: {}, | ||
symbols_: {"error":2,"Root":3,"Query":4,"EOF":5,"SelectQuery":6,"Unions":7,"SelectWithLimitQuery":8,"BasicSelectQuery":9,"Select":10,"OrderClause":11,"GroupClause":12,"LimitClause":13,"SelectClause":14,"WhereClause":15,"SELECT":16,"Fields":17,"FROM":18,"Table":19,"DISTINCT":20,"Joins":21,"Literal":22,"LEFT_PAREN":23,"RIGHT_PAREN":24,"WINDOW":25,"WINDOW_FUNCTION":26,"Number":27,"Union":28,"UNION":29,"ALL":30,"Join":31,"JOIN":32,"ON":33,"Expression":34,"LEFT":35,"RIGHT":36,"INNER":37,"OUTER":38,"WHERE":39,"LIMIT":40,"ORDER":41,"BY":42,"OrderArgs":43,"OrderArg":44,"SEPARATOR":45,"Value":46,"DIRECTION":47,"GroupBasicClause":48,"HavingClause":49,"GROUP":50,"ArgumentList":51,"HAVING":52,"MATH":53,"MATH_MULTI":54,"OPERATOR":55,"CONDITIONAL":56,"String":57,"Function":58,"UserFunction":59,"Boolean":60,"NUMBER":61,"BOOLEAN":62,"STRING":63,"DBLSTRING":64,"LITERAL":65,"DOT":66,"FUNCTION":67,"Field":68,"STAR":69,"AS":70,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",16:"SELECT",18:"FROM",20:"DISTINCT",23:"LEFT_PAREN",24:"RIGHT_PAREN",25:"WINDOW",26:"WINDOW_FUNCTION",29:"UNION",30:"ALL",32:"JOIN",33:"ON",35:"LEFT",36:"RIGHT",37:"INNER",38:"OUTER",39:"WHERE",40:"LIMIT",41:"ORDER",42:"BY",45:"SEPARATOR",47:"DIRECTION",50:"GROUP",52:"HAVING",53:"MATH",54:"MATH_MULTI",55:"OPERATOR",56:"CONDITIONAL",61:"NUMBER",62:"BOOLEAN",63:"STRING",64:"DBLSTRING",65:"LITERAL",66:"DOT",67:"FUNCTION",69:"STAR",70:"AS"}, | ||
productions_: [0,[3,2],[4,1],[4,2],[6,1],[6,1],[9,1],[9,2],[9,2],[9,3],[8,2],[10,1],[10,2],[14,4],[14,5],[14,5],[14,6],[19,1],[19,3],[19,4],[19,6],[7,1],[7,2],[28,2],[28,3],[21,1],[21,2],[31,4],[31,5],[31,5],[31,6],[31,6],[31,6],[31,6],[15,2],[13,2],[11,3],[43,1],[43,3],[44,1],[44,2],[12,1],[12,2],[48,3],[49,2],[34,3],[34,3],[34,3],[34,3],[34,3],[34,1],[46,1],[46,1],[46,1],[46,1],[46,1],[46,1],[27,1],[60,1],[57,1],[57,1],[22,1],[22,3],[58,4],[59,4],[51,1],[51,3],[17,1],[17,3],[68,1],[68,1],[68,3]], | ||
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { | ||
symbols_: {"error":2,"Root":3,"Query":4,"EOF":5,"SelectQuery":6,"Unions":7,"SelectWithLimitQuery":8,"BasicSelectQuery":9,"Select":10,"OrderClause":11,"GroupClause":12,"LimitClause":13,"SelectClause":14,"WhereClause":15,"SELECT":16,"Fields":17,"FROM":18,"Table":19,"DISTINCT":20,"Joins":21,"Literal":22,"AS":23,"LEFT_PAREN":24,"List":25,"RIGHT_PAREN":26,"WINDOW":27,"WINDOW_FUNCTION":28,"Number":29,"Union":30,"UNION":31,"ALL":32,"Join":33,"JOIN":34,"ON":35,"Expression":36,"LEFT":37,"RIGHT":38,"INNER":39,"OUTER":40,"WHERE":41,"LIMIT":42,"SEPARATOR":43,"OFFSET":44,"ORDER":45,"BY":46,"OrderArgs":47,"OffsetClause":48,"OrderArg":49,"Value":50,"DIRECTION":51,"OffsetRows":52,"FetchClause":53,"ROW":54,"ROWS":55,"FETCH":56,"FIRST":57,"ONLY":58,"NEXT":59,"GroupBasicClause":60,"HavingClause":61,"GROUP":62,"ArgumentList":63,"HAVING":64,"MATH":65,"MATH_MULTI":66,"OPERATOR":67,"CONDITIONAL":68,"SUB_SELECT_OP":69,"SubSelectExpression":70,"SUB_SELECT_UNARY_OP":71,"String":72,"Function":73,"UserFunction":74,"Boolean":75,"Parameter":76,"NUMBER":77,"BOOLEAN":78,"PARAMETER":79,"STRING":80,"DBLSTRING":81,"LITERAL":82,"DOT":83,"FUNCTION":84,"AggregateArgumentList":85,"Field":86,"STAR":87,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",16:"SELECT",18:"FROM",20:"DISTINCT",23:"AS",24:"LEFT_PAREN",26:"RIGHT_PAREN",27:"WINDOW",28:"WINDOW_FUNCTION",31:"UNION",32:"ALL",34:"JOIN",35:"ON",37:"LEFT",38:"RIGHT",39:"INNER",40:"OUTER",41:"WHERE",42:"LIMIT",43:"SEPARATOR",44:"OFFSET",45:"ORDER",46:"BY",51:"DIRECTION",54:"ROW",55:"ROWS",56:"FETCH",57:"FIRST",58:"ONLY",59:"NEXT",62:"GROUP",64:"HAVING",65:"MATH",66:"MATH_MULTI",67:"OPERATOR",68:"CONDITIONAL",69:"SUB_SELECT_OP",71:"SUB_SELECT_UNARY_OP",77:"NUMBER",78:"BOOLEAN",79:"PARAMETER",80:"STRING",81:"DBLSTRING",82:"LITERAL",83:"DOT",84:"FUNCTION",87:"STAR"}, | ||
productions_: [0,[3,2],[4,1],[4,2],[6,1],[6,1],[9,1],[9,2],[9,2],[9,3],[8,2],[10,1],[10,2],[14,4],[14,5],[14,5],[14,6],[19,1],[19,2],[19,3],[19,3],[19,3],[19,4],[19,6],[7,1],[7,2],[30,2],[30,3],[21,1],[21,2],[33,4],[33,5],[33,5],[33,6],[33,6],[33,6],[33,6],[15,2],[13,2],[13,4],[13,4],[11,3],[11,4],[47,1],[47,3],[49,1],[49,2],[48,2],[48,3],[52,2],[52,2],[53,4],[53,4],[12,1],[12,2],[60,3],[61,2],[36,3],[36,3],[36,3],[36,3],[36,3],[36,5],[36,3],[36,2],[36,1],[70,3],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[25,1],[29,1],[75,1],[76,1],[72,1],[72,1],[22,1],[22,3],[73,4],[74,4],[85,1],[85,2],[63,1],[63,3],[17,1],[17,3],[86,1],[86,1],[86,3]], | ||
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { | ||
/* this == yyval */ | ||
var $0 = $$.length - 1; | ||
switch (yystate) { | ||
case 1:return this.$ = $$[$0-1]; | ||
case 1: | ||
return this.$ = $$[$0-1]; | ||
break; | ||
case 2:this.$ = $$[$0]; | ||
case 2: case 4: case 5: case 6: case 11: case 53: case 65: case 67: case 68: case 69: case 70: case 71: case 72: case 73: | ||
this.$ = $$[$0]; | ||
break; | ||
case 3:this.$ = (function () { | ||
case 3: | ||
this.$ = (function () { | ||
$$[$0-1].unions = $$[$0]; | ||
@@ -22,9 +98,4 @@ return $$[$0-1]; | ||
break; | ||
case 4:this.$ = $$[$0]; | ||
break; | ||
case 5:this.$ = $$[$0]; | ||
break; | ||
case 6:this.$ = $$[$0]; | ||
break; | ||
case 7:this.$ = (function () { | ||
case 7: | ||
this.$ = (function () { | ||
$$[$0-1].order = $$[$0]; | ||
@@ -34,3 +105,4 @@ return $$[$0-1]; | ||
break; | ||
case 8:this.$ = (function () { | ||
case 8: | ||
this.$ = (function () { | ||
$$[$0-1].group = $$[$0]; | ||
@@ -40,3 +112,4 @@ return $$[$0-1]; | ||
break; | ||
case 9:this.$ = (function () { | ||
case 9: | ||
this.$ = (function () { | ||
$$[$0-2].group = $$[$0-1]; | ||
@@ -47,3 +120,4 @@ $$[$0-2].order = $$[$0]; | ||
break; | ||
case 10:this.$ = (function () { | ||
case 10: | ||
this.$ = (function () { | ||
$$[$0-1].limit = $$[$0]; | ||
@@ -53,5 +127,4 @@ return $$[$0-1]; | ||
break; | ||
case 11:this.$ = $$[$0]; | ||
break; | ||
case 12:this.$ = (function () { | ||
case 12: | ||
this.$ = (function () { | ||
$$[$0-1].where = $$[$0]; | ||
@@ -61,332 +134,342 @@ return $$[$0-1]; | ||
break; | ||
case 13:this.$ = new yy.Select($$[$0-2], $$[$0], false); | ||
case 13: | ||
this.$ = new yy.Select($$[$0-2], $$[$0], false); | ||
break; | ||
case 14:this.$ = new yy.Select($$[$0-2], $$[$0], true); | ||
case 14: | ||
this.$ = new yy.Select($$[$0-2], $$[$0], true); | ||
break; | ||
case 15:this.$ = new yy.Select($$[$0-3], $$[$0-1], false, $$[$0]); | ||
case 15: | ||
this.$ = new yy.Select($$[$0-3], $$[$0-1], false, $$[$0]); | ||
break; | ||
case 16:this.$ = new yy.Select($$[$0-3], $$[$0-1], true, $$[$0]); | ||
case 16: | ||
this.$ = new yy.Select($$[$0-3], $$[$0-1], true, $$[$0]); | ||
break; | ||
case 17:this.$ = new yy.Table($$[$0]); | ||
case 17: | ||
this.$ = new yy.Table($$[$0]); | ||
break; | ||
case 18:this.$ = new yy.SubSelect($$[$0-1]); | ||
case 18: | ||
this.$ = new yy.Table($$[$0-1], $$[$0]); | ||
break; | ||
case 19:this.$ = new yy.SubSelect($$[$0-2], $$[$0]); | ||
case 19: | ||
this.$ = new yy.Table($$[$0-2], $$[$0]); | ||
break; | ||
case 20:this.$ = new yy.Table($$[$0-5], $$[$0-4], $$[$0-3], $$[$0-1]); | ||
case 20: case 49: case 50: case 51: case 52: case 57: | ||
this.$ = $$[$0-1]; | ||
break; | ||
case 21:this.$ = [$$[$0]]; | ||
case 21: case 66: | ||
this.$ = new yy.SubSelect($$[$0-1]); | ||
break; | ||
case 22:this.$ = $$[$0-1].concat($$[$01]); | ||
case 22: | ||
this.$ = new yy.SubSelect($$[$0-2], $$[$0]); | ||
break; | ||
case 23:this.$ = new yy.Union($$[$0]); | ||
case 23: | ||
this.$ = new yy.Table($$[$0-5], null, $$[$0-4], $$[$0-3], $$[$0-1]); | ||
break; | ||
case 24:this.$ = new yy.Union($$[$0], true); | ||
case 24: case 28: case 43: case 86: case 88: | ||
this.$ = [$$[$0]]; | ||
break; | ||
case 25:this.$ = [$$[$0]]; | ||
case 25: | ||
this.$ = $$[$0-1].concat($$[$01]); | ||
break; | ||
case 26:this.$ = $$[$0-1].concat($$[$0]); | ||
case 26: | ||
this.$ = new yy.Union($$[$0]); | ||
break; | ||
case 27:this.$ = new yy.Join($$[$0-2], $$[$0]); | ||
case 27: | ||
this.$ = new yy.Union($$[$0], true); | ||
break; | ||
case 28:this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT'); | ||
case 29: | ||
this.$ = $$[$0-1].concat($$[$0]); | ||
break; | ||
case 29:this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT'); | ||
case 30: | ||
this.$ = new yy.Join($$[$0-2], $$[$0]); | ||
break; | ||
case 30:this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT', 'INNER'); | ||
case 31: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT'); | ||
break; | ||
case 31:this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT', 'INNER'); | ||
case 32: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT'); | ||
break; | ||
case 32:this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT', 'OUTER'); | ||
case 33: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT', 'INNER'); | ||
break; | ||
case 33:this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT', 'OUTER'); | ||
case 34: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT', 'INNER'); | ||
break; | ||
case 34:this.$ = new yy.Where($$[$0]); | ||
case 35: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT', 'OUTER'); | ||
break; | ||
case 35:this.$ = new yy.Limit($$[$0]); | ||
case 36: | ||
this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT', 'OUTER'); | ||
break; | ||
case 36:this.$ = new yy.Order($$[$0]); | ||
case 37: | ||
this.$ = new yy.Where($$[$0]); | ||
break; | ||
case 37:this.$ = [$$[$0]]; | ||
case 38: | ||
this.$ = new yy.Limit($$[$0]); | ||
break; | ||
case 38:this.$ = $$[$0-2].concat($$[$0]); | ||
case 39: | ||
this.$ = new yy.Limit($$[$0], $$[$0-2]); | ||
break; | ||
case 39:this.$ = new yy.OrderArgument($$[$0], 'ASC'); | ||
case 40: | ||
this.$ = new yy.Limit($$[$0-2], $$[$0]); | ||
break; | ||
case 40:this.$ = new yy.OrderArgument($$[$0-1], $$[$0]); | ||
case 41: | ||
this.$ = new yy.Order($$[$0]); | ||
break; | ||
case 41:this.$ = $$[$0]; | ||
case 42: | ||
this.$ = new yy.Order($$[$0-1], $$[$0]); | ||
break; | ||
case 42:this.$ = (function () { | ||
$$[$0-1].having = $$[$0]; | ||
return $$[$0-1]; | ||
}()); | ||
case 44: case 87: case 89: | ||
this.$ = $$[$0-2].concat($$[$0]); | ||
break; | ||
case 43:this.$ = new yy.Group($$[$0]); | ||
case 45: | ||
this.$ = new yy.OrderArgument($$[$0], 'ASC'); | ||
break; | ||
case 44:this.$ = new yy.Having($$[$0]); | ||
case 46: | ||
this.$ = new yy.OrderArgument($$[$0-1], $$[$0]); | ||
break; | ||
case 45:this.$ = $$[$0-1]; | ||
case 47: | ||
this.$ = new yy.Offset($$[$0]); | ||
break; | ||
case 46:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); | ||
case 48: | ||
this.$ = new yy.Offset($$[$0-1], $$[$0]); | ||
break; | ||
case 47:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); | ||
case 54: | ||
this.$ = (function () { | ||
$$[$0-1].having = $$[$0]; | ||
return $$[$0-1]; | ||
}()); | ||
break; | ||
case 48:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); | ||
case 55: | ||
this.$ = new yy.Group($$[$0]); | ||
break; | ||
case 49:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); | ||
case 56: | ||
this.$ = new yy.Having($$[$0]); | ||
break; | ||
case 50:this.$ = $$[$0]; | ||
case 58: case 59: case 60: case 61: case 63: | ||
this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); | ||
break; | ||
case 51:this.$ = $$[$0]; | ||
case 62: | ||
this.$ = new yy.Op($$[$0-3], $$[$0-4], $$[$0-1]); | ||
break; | ||
case 52:this.$ = $$[$0]; | ||
case 64: | ||
this.$ = new yy.UnaryOp($$[$0-1], $$[$0]); | ||
break; | ||
case 53:this.$ = $$[$0]; | ||
case 74: | ||
this.$ = new yy.ListValue($$[$0]); | ||
break; | ||
case 54:this.$ = $$[$0]; | ||
case 75: | ||
this.$ = new yy.NumberValue($$[$0]); | ||
break; | ||
case 55:this.$ = $$[$0]; | ||
case 76: | ||
this.$ = new yy.BooleanValue($$[$0]); | ||
break; | ||
case 56:this.$ = $$[$0]; | ||
case 77: | ||
this.$ = new yy.ParameterValue($$[$0]); | ||
break; | ||
case 57:this.$ = new yy.NumberValue($$[$0]); | ||
case 78: | ||
this.$ = new yy.StringValue($$[$0], "'"); | ||
break; | ||
case 58:this.$ = new yy.BooleanValue($$[$0]); | ||
case 79: | ||
this.$ = new yy.StringValue($$[$0], '"'); | ||
break; | ||
case 59:this.$ = new yy.StringValue($$[$0], "'"); | ||
case 80: | ||
this.$ = new yy.LiteralValue($$[$0]); | ||
break; | ||
case 60:this.$ = new yy.StringValue($$[$0], '"'); | ||
case 81: | ||
this.$ = new yy.LiteralValue($$[$0-2], $$[$0]); | ||
break; | ||
case 61:this.$ = new yy.LiteralValue($$[$0]); | ||
case 82: | ||
this.$ = new yy.FunctionValue($$[$0-3], $$[$0-1]); | ||
break; | ||
case 62:this.$ = new yy.LiteralValue($$[$0-2], $$[$0]); | ||
case 83: | ||
this.$ = new yy.FunctionValue($$[$0-3], $$[$0-1], true); | ||
break; | ||
case 63:this.$ = new yy.FunctionValue($$[$0-3], $$[$0-1]); | ||
case 84: | ||
this.$ = new yy.ArgumentListValue($$[$0]); | ||
break; | ||
case 64:this.$ = new yy.FunctionValue($$[$0-3], $$[$0-1], true); | ||
case 85: | ||
this.$ = new yy.ArgumentListValue($$[$0], true); | ||
break; | ||
case 65:this.$ = [$$[$0]]; | ||
case 90: | ||
this.$ = new yy.Star(); | ||
break; | ||
case 66:this.$ = $$[$0-2].concat($$[$0]); | ||
case 91: | ||
this.$ = new yy.Field($$[$0]); | ||
break; | ||
case 67:this.$ = [$$[$0]]; | ||
case 92: | ||
this.$ = new yy.Field($$[$0-2], $$[$0]); | ||
break; | ||
case 68:this.$ = $$[$0-2].concat($$[$0]); | ||
break; | ||
case 69:this.$ = new yy.Star(); | ||
break; | ||
case 70:this.$ = new yy.Field($$[$0]); | ||
break; | ||
case 71:this.$ = new yy.Field($$[$0-2], $$[$0]); | ||
break; | ||
} | ||
}, | ||
table: [{3:1,4:2,6:3,8:4,9:5,10:6,14:7,16:[1,8]},{1:[3]},{5:[1,9]},{5:[2,2],7:10,13:11,24:[2,2],28:12,29:[1,14],40:[1,13]},{5:[2,4],24:[2,4],29:[2,4],40:[2,4]},{5:[2,5],24:[2,5],29:[2,5],40:[2,5]},{5:[2,6],11:15,12:16,24:[2,6],29:[2,6],40:[2,6],41:[1,17],48:18,50:[1,19]},{5:[2,11],15:20,24:[2,11],29:[2,11],39:[1,21],40:[2,11],41:[2,11],50:[2,11]},{17:22,20:[1,23],22:29,23:[1,27],27:30,34:26,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39],68:24,69:[1,25]},{1:[2,1]},{5:[2,3],24:[2,3],28:41,29:[1,14]},{5:[2,10],24:[2,10],29:[2,10],40:[2,10]},{5:[2,21],24:[2,21],29:[2,21]},{27:42,61:[1,36]},{6:43,8:4,9:5,10:6,14:7,16:[1,8],30:[1,44]},{5:[2,7],24:[2,7],29:[2,7],40:[2,7]},{5:[2,8],11:45,24:[2,8],29:[2,8],40:[2,8],41:[1,17]},{42:[1,46]},{5:[2,41],24:[2,41],29:[2,41],40:[2,41],41:[2,41],49:47,52:[1,48]},{42:[1,49]},{5:[2,12],24:[2,12],29:[2,12],40:[2,12],41:[2,12],50:[2,12]},{22:29,23:[1,27],27:30,34:50,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{18:[1,51],45:[1,52]},{17:53,22:29,23:[1,27],27:30,34:26,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39],68:24,69:[1,25]},{18:[2,67],45:[2,67]},{18:[2,69],45:[2,69]},{18:[2,70],45:[2,70],53:[1,55],54:[1,56],55:[1,57],56:[1,58],70:[1,54]},{22:29,23:[1,27],27:30,34:59,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,50],18:[2,50],24:[2,50],29:[2,50],32:[2,50],35:[2,50],36:[2,50],39:[2,50],40:[2,50],41:[2,50],45:[2,50],50:[2,50],52:[2,50],53:[2,50],54:[2,50],55:[2,50],56:[2,50],70:[2,50]},{5:[2,51],18:[2,51],24:[2,51],29:[2,51],32:[2,51],35:[2,51],36:[2,51],39:[2,51],40:[2,51],41:[2,51],45:[2,51],47:[2,51],50:[2,51],52:[2,51],53:[2,51],54:[2,51],55:[2,51],56:[2,51],66:[1,60],70:[2,51]},{5:[2,52],18:[2,52],24:[2,52],29:[2,52],32:[2,52],35:[2,52],36:[2,52],39:[2,52],40:[2,52],41:[2,52],45:[2,52],47:[2,52],50:[2,52],52:[2,52],53:[2,52],54:[2,52],55:[2,52],56:[2,52],70:[2,52]},{5:[2,53],18:[2,53],24:[2,53],29:[2,53],32:[2,53],35:[2,53],36:[2,53],39:[2,53],40:[2,53],41:[2,53],45:[2,53],47:[2,53],50:[2,53],52:[2,53],53:[2,53],54:[2,53],55:[2,53],56:[2,53],70:[2,53]},{5:[2,54],18:[2,54],24:[2,54],29:[2,54],32:[2,54],35:[2,54],36:[2,54],39:[2,54],40:[2,54],41:[2,54],45:[2,54],47:[2,54],50:[2,54],52:[2,54],53:[2,54],54:[2,54],55:[2,54],56:[2,54],70:[2,54]},{5:[2,55],18:[2,55],24:[2,55],29:[2,55],32:[2,55],35:[2,55],36:[2,55],39:[2,55],40:[2,55],41:[2,55],45:[2,55],47:[2,55],50:[2,55],52:[2,55],53:[2,55],54:[2,55],55:[2,55],56:[2,55],70:[2,55]},{5:[2,56],18:[2,56],24:[2,56],29:[2,56],32:[2,56],35:[2,56],36:[2,56],39:[2,56],40:[2,56],41:[2,56],45:[2,56],47:[2,56],50:[2,56],52:[2,56],53:[2,56],54:[2,56],55:[2,56],56:[2,56],70:[2,56]},{5:[2,61],18:[2,61],23:[1,61],24:[2,61],29:[2,61],32:[2,61],35:[2,61],36:[2,61],39:[2,61],40:[2,61],41:[2,61],45:[2,61],47:[2,61],50:[2,61],52:[2,61],53:[2,61],54:[2,61],55:[2,61],56:[2,61],66:[2,61],70:[2,61]},{5:[2,57],18:[2,57],24:[2,57],29:[2,57],32:[2,57],35:[2,57],36:[2,57],39:[2,57],40:[2,57],41:[2,57],45:[2,57],47:[2,57],50:[2,57],52:[2,57],53:[2,57],54:[2,57],55:[2,57],56:[2,57],70:[2,57]},{5:[2,59],18:[2,59],24:[2,59],29:[2,59],32:[2,59],35:[2,59],36:[2,59],39:[2,59],40:[2,59],41:[2,59],45:[2,59],47:[2,59],50:[2,59],52:[2,59],53:[2,59],54:[2,59],55:[2,59],56:[2,59],70:[2,59]},{5:[2,60],18:[2,60],24:[2,60],29:[2,60],32:[2,60],35:[2,60],36:[2,60],39:[2,60],40:[2,60],41:[2,60],45:[2,60],47:[2,60],50:[2,60],52:[2,60],53:[2,60],54:[2,60],55:[2,60],56:[2,60],70:[2,60]},{23:[1,62]},{5:[2,58],18:[2,58],24:[2,58],29:[2,58],32:[2,58],35:[2,58],36:[2,58],39:[2,58],40:[2,58],41:[2,58],45:[2,58],47:[2,58],50:[2,58],52:[2,58],53:[2,58],54:[2,58],55:[2,58],56:[2,58],70:[2,58]},{5:[2,22],24:[2,22],29:[2,22]},{5:[2,35],24:[2,35],29:[2,35],40:[2,35]},{5:[2,23],13:11,24:[2,23],29:[2,23],40:[1,13]},{6:63,8:4,9:5,10:6,14:7,16:[1,8]},{5:[2,9],24:[2,9],29:[2,9],40:[2,9]},{22:29,27:30,43:64,44:65,46:66,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,42],24:[2,42],29:[2,42],40:[2,42],41:[2,42]},{22:29,23:[1,27],27:30,34:67,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:69,46:28,51:68,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,34],24:[2,34],29:[2,34],40:[2,34],41:[2,34],50:[2,34],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{19:70,22:71,23:[1,72],65:[1,73]},{22:29,23:[1,27],27:30,34:26,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39],68:74,69:[1,25]},{18:[1,75],45:[1,52]},{22:76,65:[1,73]},{22:29,23:[1,27],27:30,34:77,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:78,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:79,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:80,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{24:[1,81],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{65:[1,82]},{22:29,23:[1,27],27:30,34:69,46:28,51:83,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:69,46:28,51:84,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,24],13:11,24:[2,24],29:[2,24],40:[1,13]},{5:[2,36],24:[2,36],29:[2,36],40:[2,36],45:[1,85]},{5:[2,37],24:[2,37],29:[2,37],40:[2,37],45:[2,37]},{5:[2,39],24:[2,39],29:[2,39],40:[2,39],45:[2,39],47:[1,86]},{5:[2,44],24:[2,44],29:[2,44],40:[2,44],41:[2,44],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{5:[2,43],24:[2,43],29:[2,43],40:[2,43],41:[2,43],45:[1,87],52:[2,43]},{5:[2,65],24:[2,65],29:[2,65],40:[2,65],41:[2,65],45:[2,65],52:[2,65],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{5:[2,13],21:88,24:[2,13],29:[2,13],31:89,32:[1,90],35:[1,91],36:[1,92],39:[2,13],40:[2,13],41:[2,13],50:[2,13]},{5:[2,17],24:[2,17],25:[1,93],29:[2,17],32:[2,17],33:[2,17],35:[2,17],36:[2,17],39:[2,17],40:[2,17],41:[2,17],50:[2,17],66:[1,60]},{4:94,6:3,8:4,9:5,10:6,14:7,16:[1,8]},{5:[2,61],18:[2,61],24:[2,61],25:[2,61],29:[2,61],32:[2,61],33:[2,61],35:[2,61],36:[2,61],39:[2,61],40:[2,61],41:[2,61],45:[2,61],50:[2,61],66:[2,61]},{18:[2,68],45:[2,68]},{19:95,22:71,23:[1,72],65:[1,73]},{18:[2,71],45:[2,71],66:[1,60]},{5:[2,46],18:[2,46],24:[2,46],29:[2,46],32:[2,46],35:[2,46],36:[2,46],39:[2,46],40:[2,46],41:[2,46],45:[2,46],50:[2,46],52:[2,46],53:[2,46],54:[1,56],55:[2,46],56:[2,46],70:[2,46]},{5:[2,47],18:[2,47],24:[2,47],29:[2,47],32:[2,47],35:[2,47],36:[2,47],39:[2,47],40:[2,47],41:[2,47],45:[2,47],50:[2,47],52:[2,47],53:[2,47],54:[2,47],55:[2,47],56:[2,47],70:[2,47]},{5:[2,48],18:[2,48],24:[2,48],29:[2,48],32:[2,48],35:[2,48],36:[2,48],39:[2,48],40:[2,48],41:[2,48],45:[2,48],50:[2,48],52:[2,48],53:[1,55],54:[1,56],55:[2,48],56:[2,48],70:[2,48]},{5:[2,49],18:[2,49],24:[2,49],29:[2,49],32:[2,49],35:[2,49],36:[2,49],39:[2,49],40:[2,49],41:[2,49],45:[2,49],50:[2,49],52:[2,49],53:[1,55],54:[1,56],55:[1,57],56:[2,49],70:[2,49]},{5:[2,45],18:[2,45],24:[2,45],29:[2,45],32:[2,45],35:[2,45],36:[2,45],39:[2,45],40:[2,45],41:[2,45],45:[2,45],50:[2,45],52:[2,45],53:[2,45],54:[2,45],55:[2,45],56:[2,45],70:[2,45]},{5:[2,62],18:[2,62],24:[2,62],25:[2,62],29:[2,62],32:[2,62],33:[2,62],35:[2,62],36:[2,62],39:[2,62],40:[2,62],41:[2,62],45:[2,62],47:[2,62],50:[2,62],52:[2,62],53:[2,62],54:[2,62],55:[2,62],56:[2,62],66:[2,62],70:[2,62]},{24:[1,96],45:[1,87]},{24:[1,97],45:[1,87]},{22:29,27:30,44:98,46:66,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,40],24:[2,40],29:[2,40],40:[2,40],45:[2,40]},{22:29,27:30,46:99,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,15],24:[2,15],29:[2,15],31:100,32:[1,90],35:[1,91],36:[1,92],39:[2,15],40:[2,15],41:[2,15],50:[2,15]},{5:[2,25],24:[2,25],29:[2,25],32:[2,25],35:[2,25],36:[2,25],39:[2,25],40:[2,25],41:[2,25],50:[2,25]},{19:101,22:71,23:[1,72],65:[1,73]},{32:[1,102],37:[1,103],38:[1,104]},{32:[1,105],37:[1,106],38:[1,107]},{26:[1,108]},{24:[1,109]},{5:[2,14],21:110,24:[2,14],29:[2,14],31:89,32:[1,90],35:[1,91],36:[1,92],39:[2,14],40:[2,14],41:[2,14],50:[2,14]},{5:[2,64],18:[2,64],24:[2,64],29:[2,64],32:[2,64],35:[2,64],36:[2,64],39:[2,64],40:[2,64],41:[2,64],45:[2,64],47:[2,64],50:[2,64],52:[2,64],53:[2,64],54:[2,64],55:[2,64],56:[2,64],70:[2,64]},{5:[2,63],18:[2,63],24:[2,63],29:[2,63],32:[2,63],35:[2,63],36:[2,63],39:[2,63],40:[2,63],41:[2,63],45:[2,63],47:[2,63],50:[2,63],52:[2,63],53:[2,63],54:[2,63],55:[2,63],56:[2,63],70:[2,63]},{5:[2,38],24:[2,38],29:[2,38],40:[2,38],45:[2,38]},{5:[2,66],24:[2,66],29:[2,66],40:[2,66],41:[2,66],45:[2,66],52:[2,66]},{5:[2,26],24:[2,26],29:[2,26],32:[2,26],35:[2,26],36:[2,26],39:[2,26],40:[2,26],41:[2,26],50:[2,26]},{33:[1,111]},{19:112,22:71,23:[1,72],65:[1,73]},{32:[1,113]},{32:[1,114]},{19:115,22:71,23:[1,72],65:[1,73]},{32:[1,116]},{32:[1,117]},{23:[1,118]},{5:[2,18],22:119,24:[2,18],29:[2,18],32:[2,18],33:[2,18],35:[2,18],36:[2,18],39:[2,18],40:[2,18],41:[2,18],50:[2,18],65:[1,73]},{5:[2,16],24:[2,16],29:[2,16],31:100,32:[1,90],35:[1,91],36:[1,92],39:[2,16],40:[2,16],41:[2,16],50:[2,16]},{22:29,23:[1,27],27:30,34:120,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{33:[1,121]},{19:122,22:71,23:[1,72],65:[1,73]},{19:123,22:71,23:[1,72],65:[1,73]},{33:[1,124]},{19:125,22:71,23:[1,72],65:[1,73]},{19:126,22:71,23:[1,72],65:[1,73]},{27:127,61:[1,36]},{5:[2,19],24:[2,19],29:[2,19],32:[2,19],33:[2,19],35:[2,19],36:[2,19],39:[2,19],40:[2,19],41:[2,19],50:[2,19],66:[1,60]},{5:[2,27],24:[2,27],29:[2,27],32:[2,27],35:[2,27],36:[2,27],39:[2,27],40:[2,27],41:[2,27],50:[2,27],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{22:29,23:[1,27],27:30,34:128,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{33:[1,129]},{33:[1,130]},{22:29,23:[1,27],27:30,34:131,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{33:[1,132]},{33:[1,133]},{24:[1,134]},{5:[2,28],24:[2,28],29:[2,28],32:[2,28],35:[2,28],36:[2,28],39:[2,28],40:[2,28],41:[2,28],50:[2,28],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{22:29,23:[1,27],27:30,34:135,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:136,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,29],24:[2,29],29:[2,29],32:[2,29],35:[2,29],36:[2,29],39:[2,29],40:[2,29],41:[2,29],50:[2,29],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{22:29,23:[1,27],27:30,34:137,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{22:29,23:[1,27],27:30,34:138,46:28,57:31,58:32,59:33,60:34,61:[1,36],62:[1,40],63:[1,37],64:[1,38],65:[1,35],67:[1,39]},{5:[2,20],24:[2,20],29:[2,20],32:[2,20],33:[2,20],35:[2,20],36:[2,20],39:[2,20],40:[2,20],41:[2,20],50:[2,20]},{5:[2,30],24:[2,30],29:[2,30],32:[2,30],35:[2,30],36:[2,30],39:[2,30],40:[2,30],41:[2,30],50:[2,30],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{5:[2,32],24:[2,32],29:[2,32],32:[2,32],35:[2,32],36:[2,32],39:[2,32],40:[2,32],41:[2,32],50:[2,32],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{5:[2,31],24:[2,31],29:[2,31],32:[2,31],35:[2,31],36:[2,31],39:[2,31],40:[2,31],41:[2,31],50:[2,31],53:[1,55],54:[1,56],55:[1,57],56:[1,58]},{5:[2,33],24:[2,33],29:[2,33],32:[2,33],35:[2,33],36:[2,33],39:[2,33],40:[2,33],41:[2,33],50:[2,33],53:[1,55],54:[1,56],55:[1,57],56:[1,58]}], | ||
table: [{3:1,4:2,6:3,8:4,9:5,10:6,14:7,16:$V0},{1:[3]},{5:[1,9]},o($V1,[2,2],{7:10,13:11,30:12,31:$V2,42:$V3}),o($V4,[2,4]),o($V4,[2,5]),o($V4,[2,6],{11:15,12:16,60:18,45:$V5,62:[1,19]}),o($V6,[2,11],{15:20,41:[1,21]}),{17:22,20:[1,23],22:30,24:$V7,29:31,36:26,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf,86:24,87:$Vg},{1:[2,1]},o($V1,[2,3],{30:44,31:$V2}),o($V4,[2,10]),o($Vh,[2,24]),{29:45,77:$V9},{6:46,8:4,9:5,10:6,14:7,16:$V0,32:[1,47]},o($V4,[2,7]),o($V4,[2,8],{11:48,45:$V5}),{46:[1,49]},o($Vi,[2,53],{61:50,64:[1,51]}),{46:[1,52]},o($V6,[2,12]),{22:30,24:$V7,29:31,36:53,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{18:[1,54],43:$Vj},{17:56,22:30,24:$V7,29:31,36:26,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf,86:24,87:$Vg},o($Vk,[2,88]),o($Vk,[2,90]),o($Vk,[2,91],{23:[1,57],65:$Vl,66:$Vm,67:$Vn,68:$Vo}),{22:30,24:$V7,29:31,36:62,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($Vp,[2,65],{69:[1,63]}),{24:[1,65],70:64},o($Vq,[2,67],{83:$Vr}),o($Vq,[2,68]),o($Vq,[2,69]),o($Vq,[2,70]),o($Vq,[2,71]),o($Vq,[2,72]),o($Vq,[2,73]),o([5,18,23,26,31,34,37,38,41,42,43,44,45,51,62,64,65,66,67,68,69,83],$Vs,{24:[1,67]}),o([5,18,23,26,31,34,37,38,41,42,43,44,45,51,54,55,62,64,65,66,67,68,69],[2,75]),o($Vq,[2,78]),o($Vq,[2,79]),{24:[1,68]},o($Vq,[2,76]),o($Vq,[2,77]),o($Vh,[2,25]),o($V4,[2,38],{43:[1,69],44:[1,70]}),o($Vh,[2,26],{13:11,42:$V3}),{6:71,8:4,9:5,10:6,14:7,16:$V0},o($V4,[2,9]),{22:30,29:31,47:72,49:73,50:74,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($Vi,[2,54]),{22:30,24:$V7,29:31,36:75,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:77,50:28,63:76,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($V6,[2,37],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),{19:78,22:79,24:$Vt,82:$Vu},{22:30,24:$V7,29:31,36:26,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf,86:82,87:$Vg},{18:[1,83],43:$Vj},{22:84,82:$Vu},{22:30,24:$V7,29:31,36:85,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:86,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:87,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:88,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{26:[1,89],65:$Vl,66:$Vm,67:$Vn,68:$Vo},{24:[1,90],70:91},o($Vp,[2,64]),{4:92,6:3,8:4,9:5,10:6,14:7,16:$V0},{82:[1,93]},{20:$Vv,22:30,24:$V7,29:31,36:77,50:28,63:95,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf,85:94},{20:$Vv,22:30,24:$V7,29:31,36:77,50:28,63:95,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf,85:97},{29:98,77:$V9},{29:99,77:$V9},o($Vh,[2,27],{13:11,42:$V3}),o($V4,[2,41],{48:100,43:[1,101],44:[1,102]}),o($Vw,[2,43]),o($Vw,[2,45],{51:[1,103]}),o($Vi,[2,56],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),o([5,26,31,42,45,64],[2,55],{43:$Vx}),o($Vy,[2,86],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),o($Vz,[2,13],{21:105,33:106,34:$VA,37:$VB,38:$VC}),o($VD,[2,17],{22:110,23:[1,111],27:[1,112],82:$Vu,83:$Vr}),{4:114,6:3,8:4,9:5,10:6,14:7,16:$V0,22:30,24:$V7,25:113,29:31,36:77,50:28,63:115,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o([5,18,23,26,27,31,34,35,37,38,41,42,43,45,62,82,83],$Vs),o($Vk,[2,89]),{19:116,22:79,24:$Vt,82:$Vu},o($Vk,[2,92],{83:$Vr}),o([5,18,23,26,31,34,37,38,41,42,43,45,62,64,65,67,68],[2,58],{66:$Vm}),o($Vp,[2,59]),o([5,18,23,26,31,34,37,38,41,42,43,45,62,64,67,68],[2,60],{65:$Vl,66:$Vm}),o([5,18,23,26,31,34,37,38,41,42,43,45,62,64,68],[2,61],{65:$Vl,66:$Vm,67:$Vn}),o($Vp,[2,57]),{4:92,6:3,8:4,9:5,10:6,14:7,16:$V0,22:30,24:$V7,25:117,29:31,36:77,50:28,63:115,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($Vp,[2,63]),{26:[1,118]},o([5,18,23,26,27,31,34,35,37,38,41,42,43,44,45,51,62,64,65,66,67,68,69,82,83],[2,81]),{26:[1,119]},{26:[2,84],43:$Vx},{22:30,24:$V7,29:31,36:77,50:28,63:120,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{26:[1,121]},o($V4,[2,39]),o($V4,[2,40]),o($V4,[2,42]),{22:30,29:31,49:122,50:74,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{29:124,52:123,77:$V9},o($Vw,[2,46]),{22:30,29:31,50:125,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($Vz,[2,15],{33:126,34:$VA,37:$VB,38:$VC}),o($VE,[2,28]),{19:127,22:79,24:$Vt,82:$Vu},{34:[1,128],39:[1,129],40:[1,130]},{34:[1,131],39:[1,132],40:[1,133]},o($VD,[2,18],{83:$Vr}),{22:134,82:$Vu},{28:[1,135]},{26:[1,136]},{26:[1,137]},{26:[2,74],43:$Vx},o($Vz,[2,14],{33:106,21:138,34:$VA,37:$VB,38:$VC}),{26:[1,139]},o($Vp,[2,66]),o($Vq,[2,83]),{26:[2,85],43:$Vx},o($Vq,[2,82]),o($Vw,[2,44]),o($V4,[2,47],{53:140,56:[1,141]}),{54:[1,142],55:[1,143]},o($Vy,[2,87]),o($VE,[2,29]),{35:[1,144]},{19:145,22:79,24:$Vt,82:$Vu},{34:[1,146]},{34:[1,147]},{19:148,22:79,24:$Vt,82:$Vu},{34:[1,149]},{34:[1,150]},o($VD,[2,19],{83:$Vr}),{24:[1,151]},o($VD,[2,20]),o($VD,[2,21],{22:152,82:$Vu}),o($Vz,[2,16],{33:126,34:$VA,37:$VB,38:$VC}),o($Vp,[2,62]),o($V4,[2,48]),{57:[1,153],59:[1,154]},o($VF,[2,49]),o($VF,[2,50]),{22:30,24:$V7,29:31,36:155,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{35:[1,156]},{19:157,22:79,24:$Vt,82:$Vu},{19:158,22:79,24:$Vt,82:$Vu},{35:[1,159]},{19:160,22:79,24:$Vt,82:$Vu},{19:161,22:79,24:$Vt,82:$Vu},{29:162,77:$V9},o($VD,[2,22],{83:$Vr}),{29:124,52:163,77:$V9},{29:124,52:164,77:$V9},o($VE,[2,30],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),{22:30,24:$V7,29:31,36:165,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{35:[1,166]},{35:[1,167]},{22:30,24:$V7,29:31,36:168,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{35:[1,169]},{35:[1,170]},{26:[1,171]},{58:[1,172]},{58:[1,173]},o($VE,[2,31],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),{22:30,24:$V7,29:31,36:174,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:175,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($VE,[2,32],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),{22:30,24:$V7,29:31,36:176,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},{22:30,24:$V7,29:31,36:177,50:28,71:$V8,72:32,73:33,74:34,75:35,76:36,77:$V9,78:$Va,79:$Vb,80:$Vc,81:$Vd,82:$Ve,84:$Vf},o($VD,[2,23]),o($V4,[2,51]),o($V4,[2,52]),o($VE,[2,33],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),o($VE,[2,35],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),o($VE,[2,34],{65:$Vl,66:$Vm,67:$Vn,68:$Vo}),o($VE,[2,36],{65:$Vl,66:$Vm,67:$Vn,68:$Vo})], | ||
defaultActions: {9:[2,1]}, | ||
parseError: function parseError(str, hash) { | ||
throw new Error(str); | ||
if (hash.recoverable) { | ||
this.trace(str); | ||
} else { | ||
throw new Error(str); | ||
} | ||
}, | ||
parse: function parse(input) { | ||
var self = this, | ||
stack = [0], | ||
vstack = [null], // semantic value stack | ||
lstack = [], // location stack | ||
table = this.table, | ||
yytext = '', | ||
yylineno = 0, | ||
yyleng = 0, | ||
recovering = 0, | ||
TERROR = 2, | ||
EOF = 1; | ||
//this.reductionCount = this.shiftCount = 0; | ||
this.lexer.setInput(input); | ||
this.lexer.yy = this.yy; | ||
this.yy.lexer = this.lexer; | ||
if (typeof this.lexer.yylloc == 'undefined') | ||
this.lexer.yylloc = {}; | ||
var yyloc = this.lexer.yylloc; | ||
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; | ||
var args = lstack.slice.call(arguments, 1); | ||
var lexer = Object.create(this.lexer); | ||
var sharedState = { yy: {} }; | ||
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); | ||
if (typeof this.yy.parseError === 'function') | ||
this.parseError = this.yy.parseError; | ||
function popStack (n) { | ||
stack.length = stack.length - 2*n; | ||
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; | ||
} | ||
function lex() { | ||
var token; | ||
token = self.lexer.lex() || 1; // $end = 1 | ||
// if token isn't its numeric value, convert | ||
if (typeof token !== 'number') { | ||
token = self.symbols_[token] || token; | ||
_token_stack: | ||
function lex() { | ||
var token; | ||
token = lexer.lex() || EOF; | ||
if (typeof token !== 'number') { | ||
token = self.symbols_[token] || token; | ||
} | ||
return token; | ||
} | ||
return token; | ||
}; | ||
var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected; | ||
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 | ||
state = stack[stack.length - 1]; | ||
if (this.defaultActions[state]) { | ||
action = this.defaultActions[state]; | ||
} else { | ||
if (symbol == null) | ||
if (symbol === null || typeof symbol == 'undefined') { | ||
symbol = lex(); | ||
// read action for current state and first input | ||
} | ||
action = table[state] && table[state][symbol]; | ||
} | ||
// handle parse error | ||
if (typeof action === 'undefined' || !action.length || !action[0]) { | ||
if (!recovering) { | ||
// Report error | ||
if (typeof action === 'undefined' || !action.length || !action[0]) { | ||
var errStr = ''; | ||
expected = []; | ||
for (p in table[state]) if (this.terminals_[p] && p > 2) { | ||
expected.push("'"+this.terminals_[p]+"'"); | ||
for (p in table[state]) { | ||
if (this.terminals_[p] && p > TERROR) { | ||
expected.push('\'' + this.terminals_[p] + '\''); | ||
} | ||
} | ||
var errStr = ''; | ||
if (this.lexer.showPosition) { | ||
errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+'\nExpecting '+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'"; | ||
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 == 1 /*EOF*/ ? "end of input" : | ||
("'"+(this.terminals_[symbol] || symbol)+"'")); | ||
errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); | ||
} | ||
this.parseError(errStr, | ||
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); | ||
this.parseError(errStr, { | ||
text: lexer.match, | ||
token: this.terminals_[symbol] || symbol, | ||
line: lexer.yylineno, | ||
loc: yyloc, | ||
expected: expected | ||
}); | ||
} | ||
// just recovered from another error | ||
if (recovering == 3) { | ||
if (symbol == EOF) { | ||
throw new Error(errStr || 'Parsing halted.'); | ||
} | ||
// discard current lookahead and grab another | ||
yyleng = this.lexer.yyleng; | ||
yytext = this.lexer.yytext; | ||
yylineno = this.lexer.yylineno; | ||
yyloc = this.lexer.yylloc; | ||
symbol = lex(); | ||
} | ||
// try to recover from error | ||
while (1) { | ||
// check for error recovery rule in this state | ||
if ((TERROR.toString()) in table[state]) { | ||
break; | ||
} | ||
if (state == 0) { | ||
throw new Error(errStr || 'Parsing halted.'); | ||
} | ||
popStack(1); | ||
state = stack[stack.length-1]; | ||
} | ||
preErrorSymbol = 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); | ||
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(this.lexer.yytext); | ||
lstack.push(this.lexer.yylloc); | ||
stack.push(action[1]); // push state | ||
symbol = null; | ||
if (!preErrorSymbol) { // normal execution/no error | ||
yyleng = this.lexer.yyleng; | ||
yytext = this.lexer.yytext; | ||
yylineno = this.lexer.yylineno; | ||
yyloc = this.lexer.yylloc; | ||
if (recovering > 0) | ||
recovering--; | ||
} else { // error just occurred, resume old lookahead f/ before error | ||
symbol = preErrorSymbol; | ||
preErrorSymbol = null; | ||
case 1: | ||
stack.push(symbol); | ||
vstack.push(lexer.yytext); | ||
lstack.push(lexer.yylloc); | ||
stack.push(action[1]); | ||
symbol = null; | ||
if (!preErrorSymbol) { | ||
yyleng = lexer.yyleng; | ||
yytext = lexer.yytext; | ||
yylineno = lexer.yylineno; | ||
yyloc = lexer.yylloc; | ||
if (recovering > 0) { | ||
recovering--; | ||
} | ||
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 | ||
}; | ||
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); | ||
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; | ||
} else { | ||
symbol = preErrorSymbol; | ||
preErrorSymbol = null; | ||
} | ||
break; | ||
case 2: | ||
len = this.productions_[action[1]][1]; | ||
yyval.$ = vstack[vstack.length - len]; | ||
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; | ||
} | ||
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]); | ||
vstack.push(yyval.$); | ||
lstack.push(yyval._$); | ||
newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; | ||
stack.push(newState); | ||
break; | ||
case 3: | ||
return true; | ||
} | ||
} | ||
return true; | ||
}}; | ||
return parser; | ||
function Parser () { | ||
this.yy = {}; | ||
} | ||
Parser.prototype = parser;parser.Parser = Parser; | ||
return new Parser; | ||
})(); | ||
if (typeof require !== 'undefined' && typeof exports !== 'undefined') { | ||
exports.parser = parser; | ||
exports.parse = function () { return parser.parse.apply(parser, arguments); } | ||
exports.Parser = parser.Parser; | ||
exports.parse = function () { return parser.parse.apply(parser, arguments); }; | ||
exports.main = function commonjsMain(args) { | ||
if (!args[1]) | ||
throw new Error('Usage: '+args[0]+' FILE'); | ||
if (typeof process !== 'undefined') { | ||
var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8"); | ||
} else { | ||
var cwd = require("file").path(require("file").cwd()); | ||
var source = cwd.join(args[1]).read({charset: "utf-8"}); | ||
if (!args[1]) { | ||
console.log('Usage: '+args[0]+' FILE'); | ||
process.exit(1); | ||
} | ||
var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); | ||
return exports.parser.parse(source); | ||
} | ||
}; | ||
if (typeof module !== 'undefined' && require.main === module) { | ||
exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); | ||
exports.main(process.argv.slice(1)); | ||
} | ||
} |
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -11,3 +12,5 @@ var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; | ||
patternString = patternString.replace(/\s{2,}/g, ' '); | ||
if (!action) return [patternString, '$$ = $1;', options]; | ||
if (!action) { | ||
return [patternString, '$$ = $1;', options]; | ||
} | ||
action = (match = unwrap.exec(action)) ? match[1] : "(" + action + "())"; | ||
@@ -66,2 +69,8 @@ action = action.replace(/\bnew /g, '$&yy.'); | ||
return new Table($1); | ||
}), o('Literal Literal', function() { | ||
return new Table($1, $2); | ||
}), o('Literal AS Literal', function() { | ||
return new Table($1, $3); | ||
}), o('LEFT_PAREN List RIGHT_PAREN', function() { | ||
return $2; | ||
}), o('LEFT_PAREN Query RIGHT_PAREN', function() { | ||
@@ -72,3 +81,3 @@ return new SubSelect($2); | ||
}), o('Literal WINDOW WINDOW_FUNCTION LEFT_PAREN Number RIGHT_PAREN', function() { | ||
return new Table($1, $2, $3, $5); | ||
return new Table($1, null, $2, $3, $5); | ||
}) | ||
@@ -122,2 +131,6 @@ ], | ||
return new Limit($2); | ||
}), o('LIMIT Number SEPARATOR Number', function() { | ||
return new Limit($4, $2); | ||
}), o('LIMIT Number OFFSET Number', function() { | ||
return new Limit($2, $4); | ||
}) | ||
@@ -128,2 +141,4 @@ ], | ||
return new Order($3); | ||
}), o('ORDER BY OrderArgs OffsetClause', function() { | ||
return new Order($3, $4); | ||
}) | ||
@@ -145,2 +160,23 @@ ], | ||
], | ||
OffsetClause: [ | ||
o('OFFSET OffsetRows', function() { | ||
return new Offset($2); | ||
}), o('OFFSET OffsetRows FetchClause', function() { | ||
return new Offset($2, $3); | ||
}) | ||
], | ||
OffsetRows: [ | ||
o('Number ROW', function() { | ||
return $1; | ||
}), o('Number ROWS', function() { | ||
return $1; | ||
}) | ||
], | ||
FetchClause: [ | ||
o('FETCH FIRST OffsetRows ONLY', function() { | ||
return $3; | ||
}), o('FETCH NEXT OffsetRows ONLY', function() { | ||
return $3; | ||
}) | ||
], | ||
GroupClause: [ | ||
@@ -173,5 +209,21 @@ o('GroupBasicClause'), o('GroupBasicClause HavingClause', function() { | ||
return new Op($2, $1, $3); | ||
}), o('Value SUB_SELECT_OP LEFT_PAREN List RIGHT_PAREN', function() { | ||
return new Op($2, $1, $4); | ||
}), o('Value SUB_SELECT_OP SubSelectExpression', function() { | ||
return new Op($2, $1, $3); | ||
}), o('SUB_SELECT_UNARY_OP SubSelectExpression', function() { | ||
return new UnaryOp($1, $2); | ||
}), o('Value') | ||
], | ||
Value: [o('Literal'), o('Number'), o('String'), o('Function'), o('UserFunction'), o('Boolean')], | ||
SubSelectExpression: [ | ||
o('LEFT_PAREN Query RIGHT_PAREN', function() { | ||
return new SubSelect($2); | ||
}) | ||
], | ||
Value: [o('Literal'), o('Number'), o('String'), o('Function'), o('UserFunction'), o('Boolean'), o('Parameter')], | ||
List: [ | ||
o('ArgumentList', function() { | ||
return new ListValue($1); | ||
}) | ||
], | ||
Number: [ | ||
@@ -187,2 +239,7 @@ o('NUMBER', function() { | ||
], | ||
Parameter: [ | ||
o('PARAMETER', function() { | ||
return new ParameterValue($1); | ||
}) | ||
], | ||
String: [ | ||
@@ -203,3 +260,3 @@ o('STRING', function() { | ||
Function: [ | ||
o("FUNCTION LEFT_PAREN ArgumentList RIGHT_PAREN", function() { | ||
o("FUNCTION LEFT_PAREN AggregateArgumentList RIGHT_PAREN", function() { | ||
return new FunctionValue($1, $3); | ||
@@ -209,6 +266,13 @@ }) | ||
UserFunction: [ | ||
o("LITERAL LEFT_PAREN ArgumentList RIGHT_PAREN", function() { | ||
o("LITERAL LEFT_PAREN AggregateArgumentList RIGHT_PAREN", function() { | ||
return new FunctionValue($1, $3, true); | ||
}) | ||
], | ||
AggregateArgumentList: [ | ||
o('ArgumentList', function() { | ||
return new ArgumentListValue($1); | ||
}), o('DISTINCT ArgumentList', function() { | ||
return new ArgumentListValue($2, true); | ||
}) | ||
], | ||
ArgumentList: [ | ||
@@ -246,3 +310,3 @@ o('Expression', function() { | ||
grammar[name] = (function() { | ||
var _i, _j, _len, _len2, _ref, _results; | ||
var _i, _j, _len, _len1, _ref, _results; | ||
_results = []; | ||
@@ -252,7 +316,11 @@ for (_i = 0, _len = alternatives.length; _i < _len; _i++) { | ||
_ref = alt[0].split(' '); | ||
for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) { | ||
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { | ||
token = _ref[_j]; | ||
if (!grammar[token]) tokens.push(token); | ||
if (!grammar[token]) { | ||
tokens.push(token); | ||
} | ||
} | ||
if (name === 'Root') alt[1] = "return " + alt[1]; | ||
if (name === 'Root') { | ||
alt[1] = "return " + alt[1]; | ||
} | ||
_results.push(alt); | ||
@@ -259,0 +327,0 @@ } |
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -5,7 +6,9 @@ var Lexer; | ||
Lexer = (function() { | ||
var BOOLEAN, DBLSTRING, LITERAL, MATH, MATH_MULTI, NUMBER, SEPARATOR, SQL_CONDITIONALS, SQL_FUNCTIONS, SQL_KEYWORDS, SQL_OPERATORS, SQL_SORT_ORDERS, STAR, STRING, WHITESPACE; | ||
var BOOLEAN, DBLSTRING, LITERAL, MATH, MATH_MULTI, NUMBER, PARAMETER, SEPARATOR, SQL_CONDITIONALS, SQL_FUNCTIONS, SQL_OPERATORS, SQL_SORT_ORDERS, STAR, STRING, SUB_SELECT_OP, SUB_SELECT_UNARY_OP, WHITESPACE; | ||
function Lexer(sql, opts) { | ||
var bytesConsumed, i; | ||
if (opts == null) opts = {}; | ||
if (opts == null) { | ||
opts = {}; | ||
} | ||
this.sql = sql; | ||
@@ -17,3 +20,3 @@ this.preserveWhitespace = opts.preserveWhitespace || false; | ||
while (this.chunk = sql.slice(i)) { | ||
bytesConsumed = this.keywordToken() || this.starToken() || this.booleanToken() || this.functionToken() || this.windowExtension() || this.sortOrderToken() || this.seperatorToken() || this.operatorToken() || this.mathToken() || this.dotToken() || this.conditionalToken() || this.numberToken() || this.stringToken() || this.parensToken() || this.whitespaceToken() || this.literalToken(); | ||
bytesConsumed = this.keywordToken() || this.starToken() || this.booleanToken() || this.functionToken() || this.windowExtension() || this.sortOrderToken() || this.seperatorToken() || this.operatorToken() || this.mathToken() || this.dotToken() || this.conditionalToken() || this.subSelectOpToken() || this.subSelectUnaryOpToken() || this.numberToken() || this.stringToken() || this.parameterToken() || this.parensToken() || this.whitespaceToken() || this.literalToken(); | ||
if (bytesConsumed < 1) { | ||
@@ -25,4 +28,25 @@ throw new Error("NOTHING CONSUMED: Stopped at - '" + (this.chunk.slice(0, 30)) + "'"); | ||
this.token('EOF', ''); | ||
this.postProcess(); | ||
} | ||
Lexer.prototype.postProcess = function() { | ||
var i, next_token, token, _i, _len, _ref, _results; | ||
_ref = this.tokens; | ||
_results = []; | ||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { | ||
token = _ref[i]; | ||
if (token[0] === 'STAR') { | ||
next_token = this.tokens[i + 1]; | ||
if (!(next_token[0] === 'SEPARATOR' || next_token[0] === 'FROM')) { | ||
_results.push(token[0] = 'MATH_MULTI'); | ||
} else { | ||
_results.push(void 0); | ||
} | ||
} else { | ||
_results.push(void 0); | ||
} | ||
} | ||
return _results; | ||
}; | ||
Lexer.prototype.token = function(name, value) { | ||
@@ -34,8 +58,18 @@ return this.tokens.push([name, value, this.currentLine]); | ||
var match, partMatch; | ||
if (part == null) part = 0; | ||
if (lengthPart == null) lengthPart = part; | ||
if (output == null) output = true; | ||
if (!(match = regex.exec(this.chunk))) return 0; | ||
if (part == null) { | ||
part = 0; | ||
} | ||
if (lengthPart == null) { | ||
lengthPart = part; | ||
} | ||
if (output == null) { | ||
output = true; | ||
} | ||
if (!(match = regex.exec(this.chunk))) { | ||
return 0; | ||
} | ||
partMatch = match[part]; | ||
if (output) this.token(name, partMatch); | ||
if (output) { | ||
this.token(name, partMatch); | ||
} | ||
return match[lengthPart].length; | ||
@@ -46,7 +80,11 @@ }; | ||
var match, matcher; | ||
if (word == null) word = name; | ||
if (word == null) { | ||
word = name; | ||
} | ||
word = this.regexEscape(word); | ||
matcher = /^\w+$/.test(word) ? new RegExp("^(" + word + ")\\b", 'ig') : new RegExp("^(" + word + ")", 'ig'); | ||
match = matcher.exec(this.chunk); | ||
if (!match) return 0; | ||
if (!match) { | ||
return 0; | ||
} | ||
this.token(name, match[1]); | ||
@@ -62,3 +100,5 @@ return match[1].length; | ||
ret = this.tokenizeFromWord(name, entry); | ||
if (ret > 0) break; | ||
if (ret > 0) { | ||
break; | ||
} | ||
} | ||
@@ -69,3 +109,3 @@ return ret; | ||
Lexer.prototype.keywordToken = function() { | ||
return this.tokenizeFromWord('SELECT') || this.tokenizeFromWord('DISTINCT') || this.tokenizeFromWord('FROM') || this.tokenizeFromWord('WHERE') || this.tokenizeFromWord('GROUP') || this.tokenizeFromWord('ORDER') || this.tokenizeFromWord('BY') || this.tokenizeFromWord('HAVING') || this.tokenizeFromWord('LIMIT') || this.tokenizeFromWord('JOIN') || this.tokenizeFromWord('LEFT') || this.tokenizeFromWord('RIGHT') || this.tokenizeFromWord('INNER') || this.tokenizeFromWord('OUTER') || this.tokenizeFromWord('ON') || this.tokenizeFromWord('AS') || this.tokenizeFromWord('UNION') || this.tokenizeFromWord('ALL'); | ||
return this.tokenizeFromWord('SELECT') || this.tokenizeFromWord('DISTINCT') || this.tokenizeFromWord('FROM') || this.tokenizeFromWord('WHERE') || this.tokenizeFromWord('GROUP') || this.tokenizeFromWord('ORDER') || this.tokenizeFromWord('BY') || this.tokenizeFromWord('HAVING') || this.tokenizeFromWord('LIMIT') || this.tokenizeFromWord('JOIN') || this.tokenizeFromWord('LEFT') || this.tokenizeFromWord('RIGHT') || this.tokenizeFromWord('INNER') || this.tokenizeFromWord('OUTER') || this.tokenizeFromWord('ON') || this.tokenizeFromWord('AS') || this.tokenizeFromWord('UNION') || this.tokenizeFromWord('ALL') || this.tokenizeFromWord('LIMIT') || this.tokenizeFromWord('OFFSET') || this.tokenizeFromWord('FETCH') || this.tokenizeFromWord('ROW') || this.tokenizeFromWord('ROWS') || this.tokenizeFromWord('ONLY') || this.tokenizeFromWord('NEXT') || this.tokenizeFromWord('FIRST'); | ||
}; | ||
@@ -89,2 +129,10 @@ | ||
Lexer.prototype.subSelectOpToken = function() { | ||
return this.tokenizeFromList('SUB_SELECT_OP', SUB_SELECT_OP); | ||
}; | ||
Lexer.prototype.subSelectUnaryOpToken = function() { | ||
return this.tokenizeFromList('SUB_SELECT_UNARY_OP', SUB_SELECT_UNARY_OP); | ||
}; | ||
Lexer.prototype.functionToken = function() { | ||
@@ -118,2 +166,6 @@ return this.tokenizeFromList('FUNCTION', SQL_FUNCTIONS); | ||
Lexer.prototype.parameterToken = function() { | ||
return this.tokenizeFromRegex('PARAMETER', PARAMETER); | ||
}; | ||
Lexer.prototype.stringToken = function() { | ||
@@ -130,3 +182,5 @@ return this.tokenizeFromRegex('STRING', STRING, 1, 0) || this.tokenizeFromRegex('DBLSTRING', DBLSTRING, 1, 0); | ||
match = /^\.(win):(length|time)/i.exec(this.chunk); | ||
if (!match) return 0; | ||
if (!match) { | ||
return 0; | ||
} | ||
this.token('WINDOW', match[1]); | ||
@@ -139,7 +193,11 @@ this.token('WINDOW_FUNCTION', match[2]); | ||
var match, newlines, partMatch; | ||
if (!(match = WHITESPACE.exec(this.chunk))) return 0; | ||
if (!(match = WHITESPACE.exec(this.chunk))) { | ||
return 0; | ||
} | ||
partMatch = match[0]; | ||
newlines = partMatch.replace(/[^\n]/, '').length; | ||
this.currentLine += newlines; | ||
if (this.preserveWhitespace) this.token(name, partMatch); | ||
if (this.preserveWhitespace) { | ||
this.token(name, partMatch); | ||
} | ||
return partMatch.length; | ||
@@ -152,4 +210,2 @@ }; | ||
SQL_KEYWORDS = ['SELECT', 'FROM', 'WHERE', 'GROUP BY', 'ORDER BY', 'HAVING', 'AS']; | ||
SQL_FUNCTIONS = ['AVG', 'COUNT', 'MIN', 'MAX', 'SUM']; | ||
@@ -159,4 +215,8 @@ | ||
SQL_OPERATORS = ['=', '>', '<', 'LIKE', 'IS NOT', 'IS']; | ||
SQL_OPERATORS = ['=', '!=', '>=', '>', '<=', '<>', '<', 'LIKE', 'IS NOT', 'IS']; | ||
SUB_SELECT_OP = ['IN', 'NOT IN', 'ANY', 'ALL', 'SOME']; | ||
SUB_SELECT_UNARY_OP = ['EXISTS']; | ||
SQL_CONDITIONALS = ['AND', 'OR']; | ||
@@ -178,2 +238,4 @@ | ||
PARAMETER = /^\$[0-9]+/; | ||
NUMBER = /^[0-9]+(\.[0-9]+)?/; | ||
@@ -180,0 +242,0 @@ |
159
lib/nodes.js
@@ -0,3 +1,4 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
var Field, FunctionValue, Group, Having, Join, Limit, LiteralValue, Op, Order, OrderArgument, Select, Star, StringValue, SubSelect, Table, Union, Where, indent; | ||
var ArgumentListValue, Field, FunctionValue, Group, Having, Join, Limit, ListValue, LiteralValue, Offset, Op, Order, OrderArgument, ParameterValue, Select, Star, StringValue, SubSelect, Table, UnaryOp, Union, Where, indent; | ||
@@ -19,3 +20,2 @@ indent = function(str) { | ||
exports.Select = Select = (function() { | ||
function Select(fields, source, distinct, joins, unions) { | ||
@@ -34,3 +34,3 @@ this.fields = fields; | ||
Select.prototype.toString = function() { | ||
var join, ret, union, _i, _j, _len, _len2, _ref, _ref2; | ||
var join, ret, union, _i, _j, _len, _len1, _ref, _ref1; | ||
ret = ["SELECT " + (this.fields.join(', '))]; | ||
@@ -43,9 +43,17 @@ ret.push(indent("FROM " + this.source)); | ||
} | ||
if (this.where) ret.push(indent(this.where.toString())); | ||
if (this.group) ret.push(indent(this.group.toString())); | ||
if (this.order) ret.push(indent(this.order.toString())); | ||
if (this.limit) ret.push(indent(this.limit.toString())); | ||
_ref2 = this.unions; | ||
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { | ||
union = _ref2[_j]; | ||
if (this.where) { | ||
ret.push(indent(this.where.toString())); | ||
} | ||
if (this.group) { | ||
ret.push(indent(this.group.toString())); | ||
} | ||
if (this.order) { | ||
ret.push(indent(this.order.toString())); | ||
} | ||
if (this.limit) { | ||
ret.push(indent(this.limit.toString())); | ||
} | ||
_ref1 = this.unions; | ||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | ||
union = _ref1[_j]; | ||
ret.push(union.toString()); | ||
@@ -61,3 +69,2 @@ } | ||
exports.SubSelect = SubSelect = (function() { | ||
function SubSelect(select, name) { | ||
@@ -83,3 +90,2 @@ this.select = select; | ||
exports.Join = Join = (function() { | ||
function Join(right, conditions, side, mode) { | ||
@@ -96,4 +102,8 @@ this.right = right; | ||
ret = ''; | ||
if (this.side != null) ret += "" + this.side + " "; | ||
if (this.mode != null) ret += "" + this.mode + " "; | ||
if (this.side != null) { | ||
ret += "" + this.side + " "; | ||
} | ||
if (this.mode != null) { | ||
ret += "" + this.mode + " "; | ||
} | ||
return ret + ("JOIN " + this.right + "\n") + indent("ON " + this.conditions); | ||
@@ -107,3 +117,2 @@ }; | ||
exports.Union = Union = (function() { | ||
function Union(query, all) { | ||
@@ -126,3 +135,2 @@ this.query = query; | ||
exports.LiteralValue = LiteralValue = (function() { | ||
function LiteralValue(value, value2) { | ||
@@ -150,3 +158,2 @@ this.value = value; | ||
exports.StringValue = StringValue = (function() { | ||
function StringValue(value, quoteType) { | ||
@@ -167,3 +174,2 @@ this.value = value; | ||
exports.NumberValue = LiteralValue = (function() { | ||
function LiteralValue(value) { | ||
@@ -181,4 +187,49 @@ this.value = Number(value); | ||
exports.ListValue = ListValue = (function() { | ||
function ListValue(value) { | ||
this.value = value; | ||
} | ||
ListValue.prototype.toString = function() { | ||
return "(" + (this.value.join(', ')) + ")"; | ||
}; | ||
return ListValue; | ||
})(); | ||
exports.ParameterValue = ParameterValue = (function() { | ||
function ParameterValue(value) { | ||
this.value = value; | ||
this.index = parseInt(value.substr(1), 10) - 1; | ||
} | ||
ParameterValue.prototype.toString = function() { | ||
return "" + this.value; | ||
}; | ||
return ParameterValue; | ||
})(); | ||
exports.ArgumentListValue = ArgumentListValue = (function() { | ||
function ArgumentListValue(value, distinct) { | ||
this.value = value; | ||
this.distinct = distinct != null ? distinct : false; | ||
null; | ||
} | ||
ArgumentListValue.prototype.toString = function() { | ||
if (this.distinct) { | ||
return "DISTINCT " + (this.value.join(', ')); | ||
} else { | ||
return "" + (this.value.join(', ')); | ||
} | ||
}; | ||
return ArgumentListValue; | ||
})(); | ||
exports.BooleanValue = LiteralValue = (function() { | ||
function LiteralValue(value) { | ||
@@ -210,6 +261,5 @@ this.value = (function() { | ||
exports.FunctionValue = FunctionValue = (function() { | ||
function FunctionValue(name, _arguments, udf) { | ||
this.name = name; | ||
this.arguments = _arguments != null ? _arguments : []; | ||
this["arguments"] = _arguments != null ? _arguments : null; | ||
this.udf = udf != null ? udf : false; | ||
@@ -220,3 +270,7 @@ null; | ||
FunctionValue.prototype.toString = function() { | ||
return "" + this.name + "(" + (this.arguments.join(', ')) + ")"; | ||
if (this["arguments"]) { | ||
return "" + (this.name.toUpperCase()) + "(" + (this["arguments"].toString()) + ")"; | ||
} else { | ||
return "" + (this.name.toUpperCase()) + "()"; | ||
} | ||
}; | ||
@@ -229,9 +283,9 @@ | ||
exports.Order = Order = (function() { | ||
function Order(orderings) { | ||
function Order(orderings, offset) { | ||
this.orderings = orderings; | ||
this.offset = offset; | ||
} | ||
Order.prototype.toString = function() { | ||
return "ORDER BY " + (this.orderings.join(', ')); | ||
return ("ORDER BY " + (this.orderings.join(', '))) + (this.offset ? "\n" + this.offset.toString() : ""); | ||
}; | ||
@@ -244,3 +298,2 @@ | ||
exports.OrderArgument = OrderArgument = (function() { | ||
function OrderArgument(value, direction) { | ||
@@ -260,6 +313,21 @@ this.value = value; | ||
exports.Offset = Offset = (function() { | ||
function Offset(row_count, limit) { | ||
this.row_count = row_count; | ||
this.limit = limit; | ||
null; | ||
} | ||
Offset.prototype.toString = function() { | ||
return ("OFFSET " + this.row_count + " ROWS") + (this.limit ? "\nFETCH NEXT " + this.limit + " ROWS ONLY" : ""); | ||
}; | ||
return Offset; | ||
})(); | ||
exports.Limit = Limit = (function() { | ||
function Limit(value) { | ||
function Limit(value, offset) { | ||
this.value = value; | ||
this.offset = offset; | ||
null; | ||
@@ -269,3 +337,3 @@ } | ||
Limit.prototype.toString = function() { | ||
return "LIMIT " + this.value; | ||
return ("LIMIT " + this.value) + (this.offset ? "\nOFFSET " + this.offset : ""); | ||
}; | ||
@@ -278,5 +346,5 @@ | ||
exports.Table = Table = (function() { | ||
function Table(name, win, winFn, winArg) { | ||
function Table(name, alias, win, winFn, winArg) { | ||
this.name = name; | ||
this.alias = alias != null ? alias : null; | ||
this.win = win != null ? win : null; | ||
@@ -291,2 +359,4 @@ this.winFn = winFn != null ? winFn : null; | ||
return "" + this.name + "." + this.win + ":" + this.winFn + "(" + this.winArg + ")"; | ||
} else if (this.alias) { | ||
return "" + this.name + " AS " + this.alias; | ||
} else { | ||
@@ -302,3 +372,2 @@ return this.name.toString(); | ||
exports.Group = Group = (function() { | ||
function Group(fields) { | ||
@@ -312,3 +381,5 @@ this.fields = fields; | ||
ret = ["GROUP BY " + (this.fields.join(', '))]; | ||
if (this.having) ret.push(this.having.toString()); | ||
if (this.having) { | ||
ret.push(this.having.toString()); | ||
} | ||
return ret.join("\n"); | ||
@@ -322,3 +393,2 @@ }; | ||
exports.Where = Where = (function() { | ||
function Where(conditions) { | ||
@@ -338,3 +408,2 @@ this.conditions = conditions; | ||
exports.Having = Having = (function() { | ||
function Having(conditions) { | ||
@@ -354,3 +423,2 @@ this.conditions = conditions; | ||
exports.Op = Op = (function() { | ||
function Op(operation, left, right) { | ||
@@ -364,3 +432,3 @@ this.operation = operation; | ||
Op.prototype.toString = function() { | ||
return "(" + this.left + " " + this.operation + " " + this.right + ")"; | ||
return "(" + this.left + " " + (this.operation.toUpperCase()) + " " + this.right + ")"; | ||
}; | ||
@@ -372,4 +440,18 @@ | ||
exports.UnaryOp = UnaryOp = (function() { | ||
function UnaryOp(operator, operand) { | ||
this.operator = operator; | ||
this.operand = operand; | ||
null; | ||
} | ||
UnaryOp.prototype.toString = function() { | ||
return "(" + (this.operator.toUpperCase()) + " " + this.operand + ")"; | ||
}; | ||
return UnaryOp; | ||
})(); | ||
exports.Field = Field = (function() { | ||
function Field(field, name) { | ||
@@ -394,3 +476,2 @@ this.field = field; | ||
exports.Star = Star = (function() { | ||
function Star() { | ||
@@ -397,0 +478,0 @@ null; |
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -2,0 +3,0 @@ var buildParser; |
@@ -0,3 +1,3 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
exports.lexer = require('./lexer'); | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "sql-parser", | ||
"description": "Lexer and Parser for SQL Syntax", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"scripts": { | ||
"test": "./node_modules/.bin/cake build && ./node_modules/.bin/mocha --require should --compilers coffee:coffee-script/register" | ||
}, | ||
"author": { | ||
@@ -9,3 +12,3 @@ "name": "Andy Kent", | ||
}, | ||
"directories": { | ||
"directories": { | ||
"lib" : "./lib" | ||
@@ -16,8 +19,8 @@ }, | ||
"devDependencies": { | ||
"jison": "https://github.com/pvwoods/jison/tarball/master", | ||
"coffee-script": "1.2.0", | ||
"mocha" : "0.3.2", | ||
"should" : "0.3.2" | ||
"jison": "0.4.15", | ||
"coffee-script": "1.8.0", | ||
"mocha" : "2.0.1", | ||
"should" : "4.1.0" | ||
}, | ||
"engines": [ | ||
"engines": [ | ||
"node" | ||
@@ -24,0 +27,0 @@ ], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
svg-parser |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
175601
0
3414
0
1