lava-oushudb-dt-sql-parser/core/astParser.js

8102 lines
205 KiB
JavaScript
Raw Normal View History

/*
* Generated by PEG.js 0.10.0.
*
* http://pegjs.org/
*/
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof module === "object" && module.exports) {
module.exports = factory();
2018-07-02 18:01:01 +08:00
}
})(this, function() {
"use strict";
function peg$subclass(child, parent) {
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
function peg$SyntaxError(message, expected, found, location) {
this.message = message;
this.expected = expected;
this.found = found;
this.location = location;
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(peg$SyntaxError, Error);
peg$SyntaxError.buildMessage = function(expected, found) {
var DESCRIBE_EXPECTATION_FNS = {
literal: function(expectation) {
return "\"" + literalEscape(expectation.text) + "\"";
},
"class": function(expectation) {
var escapedParts = "",
i;
for (i = 0; i < expectation.parts.length; i++) {
escapedParts += expectation.parts[i] instanceof Array
? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
: classEscape(expectation.parts[i]);
}
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
},
any: function(expectation) {
return "any character";
},
end: function(expectation) {
return "end of input";
},
other: function(expectation) {
return expectation.description;
}
};
function hex(ch) {
return ch.charCodeAt(0).toString(16).toUpperCase();
}
function literalEscape(s) {
return s
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\0/g, '\\0')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
}
function classEscape(s) {
return s
.replace(/\\/g, '\\\\')
.replace(/\]/g, '\\]')
.replace(/\^/g, '\\^')
.replace(/-/g, '\\-')
.replace(/\0/g, '\\0')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
}
function describeExpectation(expectation) {
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
}
function describeExpected(expected) {
var descriptions = new Array(expected.length),
i, j;
for (i = 0; i < expected.length; i++) {
descriptions[i] = describeExpectation(expected[i]);
}
descriptions.sort();
if (descriptions.length > 0) {
for (i = 1, j = 1; i < descriptions.length; i++) {
if (descriptions[i - 1] !== descriptions[i]) {
descriptions[j] = descriptions[i];
j++;
}
}
descriptions.length = j;
}
switch (descriptions.length) {
case 1:
return descriptions[0];
case 2:
return descriptions[0] + " or " + descriptions[1];
default:
return descriptions.slice(0, -1).join(", ")
+ ", or "
+ descriptions[descriptions.length - 1];
}
}
function describeFound(found) {
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
}
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
};
function peg$parse(input, options) {
options = options !== void 0 ? options : {};
var peg$FAILED = {},
peg$startRuleFunctions = { start: peg$parsestart },
peg$startRuleFunction = peg$parsestart,
peg$c0 = function(ast) {
return {
ast : ast,
param : params
}
},
peg$c1 = function(ast) {
return {
ast : ast
}
},
peg$c2 = function() { params = []; return true; },
peg$c3 = function(head, tail) {
var cur = head;
for (var i = 0; i < tail.length; i++) {
cur._next = tail[i][3];
cur = cur._next
}
return head;
},
peg$c4 = "(",
peg$c5 = peg$literalExpectation("(", false),
peg$c6 = ")",
peg$c7 = peg$literalExpectation(")", false),
peg$c8 = function(s) {
return s[2];
},
peg$c9 = function(d, c, f, w, g, o, l) {
return {
type : 'select',
distinct : d,
columns : c,
from : f,
where : w,
groupby : g,
orderby : o,
limit : l
}
},
peg$c10 = function() {
return '*';
},
peg$c11 = function(head, tail) {
return createList(head, tail);
},
peg$c12 = function(e, alias) {
return {
expr : e,
as : alias
};
},
peg$c13 = function(i) { return i; },
peg$c14 = function(l) { return l; },
peg$c15 = function(head, tail) {
tail.unshift(head);
return tail;
},
peg$c16 = function(t) { return t; },
peg$c17 = function(op, t, expr) {
t.join = op;
t.on = expr;
return t;
/*
return {
db : t.db,
table : t.table,
as : t.as,
join : op,
on : expr
}
*/
},
peg$c18 = function(t, alias) {
if (t.type == 'var') {
t.as = alias;
return t;
} else {
return {
db : t.db,
table : t.table,
as : alias
}
}
},
peg$c19 = function() { return 'LEFT JOIN'; },
peg$c20 = function() { return 'INNER JOIN'; },
peg$c21 = function(dt, tail) {
var obj = {
db : '',
table : dt
}
if (tail) {
obj.db = dt;
obj.table = tail[3];
}
return obj;
},
peg$c22 = function(v) {
v.db = '';
v.table = v.name;
return v;
},
peg$c23 = function(e) { return e; },
peg$c24 = function(e, d) {
var obj = {
expr : e,
type : 'ASC'
}
if (d == 'DESC') {
obj.type = 'DESC';
}
return obj;
},
peg$c25 = function(i1, tail) {
var res = [i1];
if (tail == '') {
res.unshift({
type : 'number',
value : 0
});
} else {
res.push(tail[2]);
}
return res;
},
peg$c26 = function(t, l, w) {
return {
type : 'update',
db : t.db,
table : t.table,
set : l,
where : w
}
},
peg$c27 = "=",
peg$c28 = peg$literalExpectation("=", false),
peg$c29 = function(c, v) {
return {
column: c,
value : v
}
},
peg$c30 = function(ri, t, c, v) {
return {
type : ri,
db : t.db,
table : t.table,
columns : c,
values : v
}
},
peg$c31 = function() { return 'insert'; },
peg$c32 = function() { return 'replace' },
peg$c33 = function(l) {
return l;
},
peg$c34 = function(head, tail) {
var el = {
type : 'expr_list'
}
var l = createExprList(head, tail, el);
el.value = l;
return el;
},
peg$c35 = function() {
return {
type : 'expr_list',
value : []
}
},
peg$c36 = function(head, tail) {
return createBinaryExprChain(head, tail);
},
peg$c37 = "!",
peg$c38 = peg$literalExpectation("!", false),
peg$c39 = function(expr) {
return createUnaryExpr('NOT', expr);
},
peg$c40 = function(left, rh) {
if (rh == '') {
return left;
} else {
var res = null;
if (rh.type == 'arithmetic') {
res = createBinaryExprChain(left, rh.tail);
} else {
res = createBinaryExpr(rh.op, left, rh.right);
}
return res;
}
},
peg$c41 = function(l) {
return {
type : 'arithmetic',
tail : l
}
},
peg$c42 = ">=",
peg$c43 = peg$literalExpectation(">=", false),
peg$c44 = ">",
peg$c45 = peg$literalExpectation(">", false),
peg$c46 = "<=",
peg$c47 = peg$literalExpectation("<=", false),
peg$c48 = "<>",
peg$c49 = peg$literalExpectation("<>", false),
peg$c50 = "<",
peg$c51 = peg$literalExpectation("<", false),
peg$c52 = "!=",
peg$c53 = peg$literalExpectation("!=", false),
peg$c54 = function(op, right) {
return {
op : op,
right : right
}
},
peg$c55 = function(op, begin, end) {
return {
op : op,
right : {
type : 'expr_list',
value : [begin, end]
}
}
},
peg$c56 = function(nk) { return nk[0] + ' ' + nk[2]; },
peg$c57 = function(op, right) {
return {
op : op,
right : right
}
},
peg$c58 = function(op, l) {
return {
op : op,
right : l
}
},
peg$c59 = function(op, e) {
return {
op : op,
right : e
}
},
peg$c60 = "+",
peg$c61 = peg$literalExpectation("+", false),
peg$c62 = "-",
peg$c63 = peg$literalExpectation("-", false),
peg$c64 = function(head, tail) {
return createBinaryExprChain(head, tail)
},
peg$c65 = "*",
peg$c66 = peg$literalExpectation("*", false),
peg$c67 = "/",
peg$c68 = peg$literalExpectation("/", false),
peg$c69 = "%",
peg$c70 = peg$literalExpectation("%", false),
peg$c71 = function(e) {
e.paren = true;
return e;
},
peg$c72 = function(tbl, col) {
return {
type : 'column_ref',
table : tbl,
column : col
};
},
peg$c73 = function(col) {
return {
type : 'column_ref',
table : '',
column: col
};
},
peg$c74 = function(name) { return reservedMap[name.toUpperCase()] === true; },
peg$c75 = function(name) {
return name;
},
peg$c76 = "`",
peg$c77 = peg$literalExpectation("`", false),
peg$c78 = /^[^`]/,
peg$c79 = peg$classExpectation(["`"], true, false),
peg$c80 = function(chars) {
return chars.join('');
},
peg$c81 = function(start, parts) { return start + parts.join(''); },
peg$c82 = /^[A-Za-z_]/,
peg$c83 = peg$classExpectation([["A", "Z"], ["a", "z"], "_"], false, false),
peg$c84 = /^[A-Za-z0-9_]/,
peg$c85 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"], "_"], false, false),
peg$c86 = /^[A-Za-z0-9_:]/,
peg$c87 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"], "_", ":"], false, false),
peg$c88 = ":",
peg$c89 = peg$literalExpectation(":", false),
peg$c90 = function(l) {
var p = {
type : 'param',
value: l[1]
}
//var key = 'L' + line + 'C' + column;
//debug(key);
//params[key] = p;
params.push(p);
return p;
},
peg$c91 = function(name, e) {
return {
type : 'aggr_func',
name : name,
args : {
expr : e
}
}
},
peg$c92 = function(name, arg) {
return {
type : 'aggr_func',
name : name,
args : arg
}
},
peg$c93 = function(e) {
return {
expr : e
}
},
peg$c94 = function(d, c) {
return {
distinct : d,
expr : c
}
},
peg$c95 = function() {
return {
type : 'star',
value : '*'
}
},
peg$c96 = function(name, l) {
return {
type : 'function',
name : name,
args : l
}
},
peg$c97 = function(head, tail) {
return createList(head, tail);
},
peg$c98 = function() {
return {
type : 'null',
value : null
};
},
peg$c99 = function() {
return {
type : 'bool',
value : true
};
},
peg$c100 = function() {
return {
type : 'bool',
value : false
};
},
peg$c101 = "\"",
peg$c102 = peg$literalExpectation("\"", false),
peg$c103 = "'",
peg$c104 = peg$literalExpectation("'", false),
peg$c105 = function(ca) {
return {
type : 'string',
value : ca[1].join('')
}
},
peg$c106 = /^[^'\\\0-\x1F\x7F]/,
peg$c107 = peg$classExpectation(["'", "\\", ["\0", "\x1F"], "\x7F"], true, false),
peg$c108 = /^[^"\\\0-\x1F\x7F]/,
peg$c109 = peg$classExpectation(["\"", "\\", ["\0", "\x1F"], "\x7F"], true, false),
peg$c110 = "\\'",
peg$c111 = peg$literalExpectation("\\'", false),
peg$c112 = function() { return "'"; },
peg$c113 = "\\\"",
peg$c114 = peg$literalExpectation("\\\"", false),
peg$c115 = function() { return '"'; },
peg$c116 = "\\\\",
peg$c117 = peg$literalExpectation("\\\\", false),
peg$c118 = function() { return "\\"; },
peg$c119 = "\\/",
peg$c120 = peg$literalExpectation("\\/", false),
peg$c121 = function() { return "/"; },
peg$c122 = "\\b",
peg$c123 = peg$literalExpectation("\\b", false),
peg$c124 = function() { return "\b"; },
peg$c125 = "\\f",
peg$c126 = peg$literalExpectation("\\f", false),
peg$c127 = function() { return "\f"; },
peg$c128 = "\\n",
peg$c129 = peg$literalExpectation("\\n", false),
peg$c130 = function() { return "\n"; },
peg$c131 = "\\r",
peg$c132 = peg$literalExpectation("\\r", false),
peg$c133 = function() { return "\r"; },
peg$c134 = "\\t",
peg$c135 = peg$literalExpectation("\\t", false),
peg$c136 = function() { return "\t"; },
peg$c137 = "\\u",
peg$c138 = peg$literalExpectation("\\u", false),
peg$c139 = function(h1, h2, h3, h4) {
return String.fromCharCode(parseInt("0x" + h1 + h2 + h3 + h4));
},
peg$c140 = /^[\n\r]/,
peg$c141 = peg$classExpectation(["\n", "\r"], false, false),
peg$c142 = function(n) {
return {
type : 'number',
value : n
}
},
peg$c143 = function(int_, frac, exp) { return parseFloat(int_ + frac + exp); },
peg$c144 = function(int_, frac) { return parseFloat(int_ + frac); },
peg$c145 = function(int_, exp) { return parseFloat(int_ + exp); },
peg$c146 = function(int_) { return parseFloat(int_); },
peg$c147 = function(digit19, digits) { return digit19 + digits; },
peg$c148 = function(op, digit19, digits) { return "-" + digit19 + digits; },
peg$c149 = function(op, digit) { return "-" + digit; },
peg$c150 = ".",
peg$c151 = peg$literalExpectation(".", false),
peg$c152 = function(digits) { return "." + digits; },
peg$c153 = function(e, digits) { return e + digits; },
peg$c154 = function(digits) { return digits.join(""); },
peg$c155 = /^[0-9]/,
peg$c156 = peg$classExpectation([["0", "9"]], false, false),
peg$c157 = /^[1-9]/,
peg$c158 = peg$classExpectation([["1", "9"]], false, false),
peg$c159 = /^[0-9a-fA-F]/,
peg$c160 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false),
peg$c161 = /^[eE]/,
peg$c162 = peg$classExpectation(["e", "E"], false, false),
peg$c163 = /^[+\-]/,
peg$c164 = peg$classExpectation(["+", "-"], false, false),
peg$c165 = function(e, sign) { return e + sign; },
peg$c166 = "null",
peg$c167 = peg$literalExpectation("NULL", true),
peg$c168 = "true",
peg$c169 = peg$literalExpectation("TRUE", true),
peg$c170 = "false",
peg$c171 = peg$literalExpectation("FALSE", true),
peg$c172 = "show",
peg$c173 = peg$literalExpectation("SHOW", true),
peg$c174 = "drop",
peg$c175 = peg$literalExpectation("DROP", true),
peg$c176 = "select",
peg$c177 = peg$literalExpectation("SELECT", true),
peg$c178 = "update",
peg$c179 = peg$literalExpectation("UPDATE", true),
peg$c180 = "create",
peg$c181 = peg$literalExpectation("CREATE", true),
peg$c182 = "delete",
peg$c183 = peg$literalExpectation("DELETE", true),
peg$c184 = "insert",
peg$c185 = peg$literalExpectation("INSERT", true),
peg$c186 = "replace",
peg$c187 = peg$literalExpectation("REPLACE", true),
peg$c188 = "explain",
peg$c189 = peg$literalExpectation("EXPLAIN", true),
peg$c190 = "into",
peg$c191 = peg$literalExpectation("INTO", true),
peg$c192 = "from",
peg$c193 = peg$literalExpectation("FROM", true),
peg$c194 = "set",
peg$c195 = peg$literalExpectation("SET", true),
peg$c196 = "as",
peg$c197 = peg$literalExpectation("AS", true),
peg$c198 = "table",
peg$c199 = peg$literalExpectation("TABLE", true),
peg$c200 = "on",
peg$c201 = peg$literalExpectation("ON", true),
peg$c202 = "left",
peg$c203 = peg$literalExpectation("LEFT", true),
peg$c204 = "inner",
peg$c205 = peg$literalExpectation("INNER", true),
peg$c206 = "join",
peg$c207 = peg$literalExpectation("JOIN", true),
peg$c208 = "union",
peg$c209 = peg$literalExpectation("UNION", true),
peg$c210 = "values",
peg$c211 = peg$literalExpectation("VALUES", true),
peg$c212 = "exists",
peg$c213 = peg$literalExpectation("EXISTS", true),
peg$c214 = "where",
peg$c215 = peg$literalExpectation("WHERE", true),
peg$c216 = "group",
peg$c217 = peg$literalExpectation("GROUP", true),
peg$c218 = "by",
peg$c219 = peg$literalExpectation("BY", true),
peg$c220 = "order",
peg$c221 = peg$literalExpectation("ORDER", true),
peg$c222 = "having",
peg$c223 = peg$literalExpectation("HAVING", true),
peg$c224 = "limit",
peg$c225 = peg$literalExpectation("LIMIT", true),
peg$c226 = "asc",
peg$c227 = peg$literalExpectation("ASC", true),
peg$c228 = function() { return 'ASC'; },
peg$c229 = "desc",
peg$c230 = peg$literalExpectation("DESC", true),
peg$c231 = function() { return 'DESC'; },
peg$c232 = "all",
peg$c233 = peg$literalExpectation("ALL", true),
peg$c234 = function() { return 'ALL'; },
peg$c235 = "distinct",
peg$c236 = peg$literalExpectation("DISTINCT", true),
peg$c237 = function() { return 'DISTINCT';},
peg$c238 = "between",
peg$c239 = peg$literalExpectation("BETWEEN", true),
peg$c240 = function() { return 'BETWEEN'; },
peg$c241 = "in",
peg$c242 = peg$literalExpectation("IN", true),
peg$c243 = function() { return 'IN'; },
peg$c244 = "is",
peg$c245 = peg$literalExpectation("IS", true),
peg$c246 = function() { return 'IS'; },
peg$c247 = "like",
peg$c248 = peg$literalExpectation("LIKE", true),
peg$c249 = function() { return 'LIKE'; },
peg$c250 = "contains",
peg$c251 = peg$literalExpectation("CONTAINS", true),
peg$c252 = function() { return 'CONTAINS';},
peg$c253 = "not",
peg$c254 = peg$literalExpectation("NOT", true),
peg$c255 = function() { return 'NOT'; },
peg$c256 = "and",
peg$c257 = peg$literalExpectation("AND", true),
peg$c258 = function() { return 'AND'; },
peg$c259 = "or",
peg$c260 = peg$literalExpectation("OR", true),
peg$c261 = function() { return 'OR'; },
peg$c262 = "count",
peg$c263 = peg$literalExpectation("COUNT", true),
peg$c264 = function() { return 'COUNT'; },
peg$c265 = "max",
peg$c266 = peg$literalExpectation("MAX", true),
peg$c267 = function() { return 'MAX'; },
peg$c268 = "min",
peg$c269 = peg$literalExpectation("MIN", true),
peg$c270 = function() { return 'MIN'; },
peg$c271 = "sum",
peg$c272 = peg$literalExpectation("SUM", true),
peg$c273 = function() { return 'SUM'; },
peg$c274 = "avg",
peg$c275 = peg$literalExpectation("AVG", true),
peg$c276 = function() { return 'AVG'; },
peg$c277 = ",",
peg$c278 = peg$literalExpectation(",", false),
peg$c279 = "[",
peg$c280 = peg$literalExpectation("[", false),
peg$c281 = "]",
peg$c282 = peg$literalExpectation("]", false),
peg$c283 = peg$anyExpectation(),
peg$c284 = /^[ \t\n\r]/,
peg$c285 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false),
peg$c286 = function(s) {
return {
stmt : s,
vars: varList
}
},
peg$c287 = function() { varList = []; return true; },
peg$c288 = function(va, e) {
return {
type : 'assign',
left : va,
right: e
}
},
peg$c289 = function(e) {
return {
type : 'return',
expr: e
}
},
peg$c290 = function(lt, op, rt, expr) {
return {
type : 'join',
ltable : lt,
rtable : rt,
op : op,
on : expr
}
},
peg$c291 = function(name, l) {
//compatible with original func_call
return {
type : 'function',
name : name,
args : {
type : 'expr_list',
value : l
}
}
},
peg$c292 = function(l) {
return {
type : 'array',
value : l
}
},
peg$c293 = function(name, m) {
//push for analysis
varList.push(name);
return {
type : 'var',
name : name,
members : m
}
},
peg$c294 = function(l) {
var s = [];
for (var i = 0; i < l.length; i++) {
s.push(l[i][1]);
}
return s;
},
peg$c295 = "$",
peg$c296 = peg$literalExpectation("$", false),
peg$c297 = "return",
peg$c298 = peg$literalExpectation("return", true),
peg$c299 = ":=",
peg$c300 = peg$literalExpectation(":=", false),
peg$currPos = 0,
peg$savedPos = 0,
peg$posDetailsCache = [{ line: 1, column: 1 }],
peg$maxFailPos = 0,
peg$maxFailExpected = [],
peg$silentFails = 0,
peg$result;
if ("startRule" in options) {
if (!(options.startRule in peg$startRuleFunctions)) {
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
}
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
}
function text() {
return input.substring(peg$savedPos, peg$currPos);
}
function location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function expected(description, location) {
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
throw peg$buildStructuredError(
[peg$otherExpectation(description)],
input.substring(peg$savedPos, peg$currPos),
location
);
}
function error(message, location) {
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
throw peg$buildSimpleError(message, location);
}
function peg$literalExpectation(text, ignoreCase) {
return { type: "literal", text: text, ignoreCase: ignoreCase };
}
function peg$classExpectation(parts, inverted, ignoreCase) {
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
}
function peg$anyExpectation() {
return { type: "any" };
}
function peg$endExpectation() {
return { type: "end" };
}
function peg$otherExpectation(description) {
return { type: "other", description: description };
}
function peg$computePosDetails(pos) {
var details = peg$posDetailsCache[pos], p;
if (details) {
return details;
} else {
p = pos - 1;
while (!peg$posDetailsCache[p]) {
p--;
}
details = peg$posDetailsCache[p];
details = {
line: details.line,
column: details.column
};
while (p < pos) {
if (input.charCodeAt(p) === 10) {
details.line++;
details.column = 1;
} else {
details.column++;
}
p++;
}
peg$posDetailsCache[pos] = details;
return details;
}
}
function peg$computeLocation(startPos, endPos) {
var startPosDetails = peg$computePosDetails(startPos),
endPosDetails = peg$computePosDetails(endPos);
return {
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
2018-07-02 18:01:01 +08:00
};
}
function peg$fail(expected) {
if (peg$currPos < peg$maxFailPos) { return; }
if (peg$currPos > peg$maxFailPos) {
peg$maxFailPos = peg$currPos;
peg$maxFailExpected = [];
}
peg$maxFailExpected.push(expected);
}
function peg$buildSimpleError(message, location) {
return new peg$SyntaxError(message, null, null, location);
}
function peg$buildStructuredError(expected, found, location) {
return new peg$SyntaxError(
peg$SyntaxError.buildMessage(expected, found),
expected,
found,
location
);
}
function peg$parsestart() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$parseinit();
peg$silentFails--;
if (s2 !== peg$FAILED) {
peg$currPos = s1;
s1 = void 0;
} else {
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseunion_stmt();
if (s3 === peg$FAILED) {
s3 = peg$parseupdate_stmt();
if (s3 === peg$FAILED) {
s3 = peg$parsereplace_insert_stmt();
2018-07-02 18:01:01 +08:00
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c0(s3);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseproc_stmts();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c1(s1);
}
s0 = s1;
}
return s0;
}
function peg$parseinit() {
var s0;
peg$savedPos = peg$currPos;
s0 = peg$c2();
if (s0) {
s0 = void 0;
} else {
s0 = peg$FAILED;
}
return s0;
}
function peg$parseunion_stmt() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseselect_stmt();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseKW_UNION();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseselect_stmt();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseKW_UNION();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseselect_stmt();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseselect_stmt() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$parseselect_stmt_nake();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 40) {
s2 = peg$c4;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c5); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseselect_stmt();
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s6 = peg$c6;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c7); }
}
if (s6 !== peg$FAILED) {
s2 = [s2, s3, s4, s5, s6];
s1 = s2;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c8(s1);
}
s0 = s1;
}
return s0;
}
function peg$parseselect_stmt_nake() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15;
s0 = peg$currPos;
s1 = peg$parseKW_SELECT();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseKW_DISTINCT();
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parsecolumn_clause();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsefrom_clause();
if (s7 === peg$FAILED) {
s7 = null;
}
if (s7 !== peg$FAILED) {
s8 = peg$parse__();
if (s8 !== peg$FAILED) {
s9 = peg$parsewhere_clause();
if (s9 === peg$FAILED) {
s9 = null;
}
if (s9 !== peg$FAILED) {
s10 = peg$parse__();
if (s10 !== peg$FAILED) {
s11 = peg$parsegroup_by_clause();
if (s11 === peg$FAILED) {
s11 = null;
}
if (s11 !== peg$FAILED) {
s12 = peg$parse__();
if (s12 !== peg$FAILED) {
s13 = peg$parseorder_by_clause();
if (s13 === peg$FAILED) {
s13 = null;
}
if (s13 !== peg$FAILED) {
s14 = peg$parse__();
if (s14 !== peg$FAILED) {
s15 = peg$parselimit_clause();
if (s15 === peg$FAILED) {
s15 = null;
}
if (s15 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c9(s3, s5, s7, s9, s11, s13, s15);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsecolumn_clause() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseKW_ALL();
if (s1 === peg$FAILED) {
s1 = peg$currPos;
s2 = peg$parseSTAR();
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
peg$silentFails++;
s4 = peg$parseident_start();
peg$silentFails--;
if (s4 === peg$FAILED) {
s3 = void 0;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c10();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsecolumn_list_item();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsecolumn_list_item();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsecolumn_list_item();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c11(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
return s0;
}
function peg$parsecolumn_list_item() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseadditive_expr();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsealias_clause();
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c12(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsealias_clause() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseKW_AS();
if (s1 === peg$FAILED) {
s1 = null;
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseident();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c13(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsefrom_clause() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseKW_FROM();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsetable_ref_list();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c14(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsetable_ref_list() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parsetable_base();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsetable_ref();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsetable_ref();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c15(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsetable_ref() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
s2 = peg$parseCOMMA();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parsetable_base();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c16(s4);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
s2 = peg$parsetable_join();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c16(s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
return s0;
}
function peg$parsetable_join() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parsejoin_op();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsetable_base();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseon_clause();
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c17(s1, s3, s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsetable_base() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parsetable_name();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseKW_AS();
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseident();
if (s5 === peg$FAILED) {
s5 = null;
2018-07-02 18:01:01 +08:00
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c18(s1, s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsejoin_op() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseKW_LEFT();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseKW_JOIN();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c19();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$parseKW_INNER();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s1 === peg$FAILED) {
s1 = null;
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$parseKW_JOIN();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c20();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parsetable_name() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parseident();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseDOT();
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseident_name();
if (s6 !== peg$FAILED) {
s3 = [s3, s4, s5, s6];
s2 = s3;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c21(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsevar_decl();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c22(s1);
}
s0 = s1;
}
return s0;
}
function peg$parseon_clause() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseKW_ON();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseor_expr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c23(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsewhere_clause() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseKW_WHERE();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseor_expr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c23(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsegroup_by_clause() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseKW_GROUP();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseKW_BY();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parsecolumn_ref_list();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c14(s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsecolumn_ref_list() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parsecolumn_ref();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsecolumn_ref();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsecolumn_ref();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c11(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsehaving_clause() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parseKW_HAVING();
if (s1 !== peg$FAILED) {
s2 = peg$parseor_expr();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c23(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseorder_by_clause() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseKW_ORDER();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseKW_BY();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseorder_by_list();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c14(s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseorder_by_list() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseorder_by_element();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseorder_by_element();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseorder_by_element();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c11(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseorder_by_element() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseor_expr();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseKW_DESC();
if (s3 === peg$FAILED) {
s3 = peg$parseKW_ASC();
}
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c24(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsenumber_or_param() {
var s0;
s0 = peg$parseliteral_numeric();
if (s0 === peg$FAILED) {
s0 = peg$parseparam();
}
return s0;
}
function peg$parselimit_clause() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
s0 = peg$currPos;
s1 = peg$parseKW_LIMIT();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsenumber_or_param();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$currPos;
s6 = peg$parseCOMMA();
if (s6 !== peg$FAILED) {
s7 = peg$parse__();
if (s7 !== peg$FAILED) {
s8 = peg$parsenumber_or_param();
if (s8 !== peg$FAILED) {
s6 = [s6, s7, s8];
s5 = s6;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s5;
s5 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s5;
s5 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c25(s3, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseupdate_stmt() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
s0 = peg$currPos;
s1 = peg$parseKW_UPDATE();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsetable_name();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseKW_SET();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseset_list();
if (s7 !== peg$FAILED) {
s8 = peg$parse__();
if (s8 !== peg$FAILED) {
s9 = peg$parsewhere_clause();
if (s9 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c26(s3, s7, s9);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseset_list() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseset_item();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseset_item();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseset_item();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c11(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseset_item() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parsecolumn_name();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 61) {
s3 = peg$c27;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c28); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseadditive_expr();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c29(s1, s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsereplace_insert_stmt() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
s0 = peg$currPos;
s1 = peg$parsereplace_insert();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseKW_INTO();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parsetable_name();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseLPAREN();
if (s7 !== peg$FAILED) {
s8 = peg$parse__();
if (s8 !== peg$FAILED) {
s9 = peg$parsecolumn_list();
if (s9 !== peg$FAILED) {
s10 = peg$parse__();
if (s10 !== peg$FAILED) {
s11 = peg$parseRPAREN();
if (s11 !== peg$FAILED) {
s12 = peg$parse__();
if (s12 !== peg$FAILED) {
s13 = peg$parsevalue_clause();
if (s13 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c30(s1, s5, s9, s13);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsereplace_insert() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseKW_INSERT();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c31();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseKW_REPLACE();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c32();
}
s0 = s1;
}
return s0;
}
function peg$parsevalue_clause() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseKW_VALUES();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsevalue_list();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c14(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsevalue_list() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parsevalue_item();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsevalue_item();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsevalue_item();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c11(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsevalue_item() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseLPAREN();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseexpr_list();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseRPAREN();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c33(s3);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseexpr_list() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseor_expr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseor_expr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseor_expr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c34(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseexpr_list_or_empty() {
var s0;
s0 = peg$parseexpr_list();
if (s0 === peg$FAILED) {
peg$savedPos = peg$currPos;
s0 = peg$c35();
if (s0) {
s0 = void 0;
} else {
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseor_expr() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseand_expr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseKW_OR();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseand_expr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseKW_OR();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseand_expr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c36(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseand_expr() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parsenot_expr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseKW_AND();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsenot_expr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseKW_AND();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsenot_expr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c36(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsenot_expr() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parseKW_NOT();
if (s1 === peg$FAILED) {
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 33) {
s2 = peg$c37;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c38); }
}
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
peg$silentFails++;
if (input.charCodeAt(peg$currPos) === 61) {
s4 = peg$c27;
peg$currPos++;
2018-07-02 18:01:01 +08:00
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c28); }
2018-07-02 18:01:01 +08:00
}
peg$silentFails--;
if (s4 === peg$FAILED) {
s3 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsenot_expr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c39(s3);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parsecomparison_expr();
}
return s0;
}
function peg$parsecomparison_expr() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseadditive_expr();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsecomparison_op_right();
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c40(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsecomparison_op_right() {
var s0;
s0 = peg$parsearithmetic_op_right();
if (s0 === peg$FAILED) {
s0 = peg$parsein_op_right();
if (s0 === peg$FAILED) {
s0 = peg$parsebetween_op_right();
if (s0 === peg$FAILED) {
s0 = peg$parseis_op_right();
if (s0 === peg$FAILED) {
s0 = peg$parselike_op_right();
if (s0 === peg$FAILED) {
s0 = peg$parsecontains_op_right();
2018-07-02 18:01:01 +08:00
}
}
}
}
}
return s0;
}
function peg$parsearithmetic_op_right() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = [];
s2 = peg$currPos;
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parsearithmetic_comparison_operator();
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseadditive_expr();
if (s6 !== peg$FAILED) {
s3 = [s3, s4, s5, s6];
s2 = s3;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$currPos;
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parsearithmetic_comparison_operator();
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseadditive_expr();
if (s6 !== peg$FAILED) {
s3 = [s3, s4, s5, s6];
s2 = s3;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c41(s1);
}
s0 = s1;
return s0;
}
function peg$parsearithmetic_comparison_operator() {
var s0;
if (input.substr(peg$currPos, 2) === peg$c42) {
s0 = peg$c42;
peg$currPos += 2;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c43); }
2018-07-02 18:01:01 +08:00
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 62) {
s0 = peg$c44;
peg$currPos++;
2018-07-02 18:01:01 +08:00
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c45); }
2018-07-02 18:01:01 +08:00
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c46) {
s0 = peg$c46;
peg$currPos += 2;
2018-07-02 18:01:01 +08:00
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c47); }
2018-07-02 18:01:01 +08:00
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c48) {
s0 = peg$c48;
peg$currPos += 2;
2018-07-02 18:01:01 +08:00
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c49); }
2018-07-02 18:01:01 +08:00
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 60) {
s0 = peg$c50;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c51); }
2018-07-02 18:01:01 +08:00
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 61) {
s0 = peg$c27;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c28); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c52) {
s0 = peg$c52;
peg$currPos += 2;
2018-07-02 18:01:01 +08:00
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c53); }
2018-07-02 18:01:01 +08:00
}
}
}
}
}
}
}
return s0;
}
function peg$parseis_op_right() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseKW_IS();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseadditive_expr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c54(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsebetween_op_right() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseKW_BETWEEN();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseadditive_expr();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseKW_AND();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseadditive_expr();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c55(s1, s3, s7);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parselike_op() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$parseKW_NOT();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseKW_LIKE();
if (s4 !== peg$FAILED) {
s2 = [s2, s3, s4];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c56(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$parseKW_LIKE();
}
return s0;
}
function peg$parsein_op() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$parseKW_NOT();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseKW_IN();
if (s4 !== peg$FAILED) {
s2 = [s2, s3, s4];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c56(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$parseKW_IN();
}
return s0;
}
function peg$parsecontains_op() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$parseKW_NOT();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseKW_CONTAINS();
if (s4 !== peg$FAILED) {
s2 = [s2, s3, s4];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c56(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$parseKW_CONTAINS();
}
return s0;
}
function peg$parselike_op_right() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parselike_op();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsecomparison_expr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c57(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsein_op_right() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parsein_op();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseLPAREN();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseexpr_list();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseRPAREN();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c58(s1, s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsein_op();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsevar_decl();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c59(s1, s3);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parsecontains_op_right() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parsecontains_op();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseLPAREN();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseexpr_list();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseRPAREN();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c58(s1, s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsecontains_op();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsevar_decl();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c59(s1, s3);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseadditive_expr() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parsemultiplicative_expr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseadditive_operator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsemultiplicative_expr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseadditive_operator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsemultiplicative_expr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c36(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseadditive_operator() {
var s0;
if (input.charCodeAt(peg$currPos) === 43) {
s0 = peg$c60;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c61); }
2018-07-02 18:01:01 +08:00
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 45) {
s0 = peg$c62;
peg$currPos++;
2018-07-02 18:01:01 +08:00
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c63); }
2018-07-02 18:01:01 +08:00
}
}
return s0;
}
function peg$parsemultiplicative_expr() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseprimary();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parsemultiplicative_operator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseprimary();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parsemultiplicative_operator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseprimary();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c64(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsemultiplicative_operator() {
var s0;
if (input.charCodeAt(peg$currPos) === 42) {
s0 = peg$c65;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
2018-07-02 18:01:01 +08:00
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 47) {
s0 = peg$c67;
peg$currPos++;
2018-07-02 18:01:01 +08:00
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c68); }
2018-07-02 18:01:01 +08:00
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 37) {
s0 = peg$c69;
peg$currPos++;
2018-07-02 18:01:01 +08:00
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c70); }
2018-07-02 18:01:01 +08:00
}
}
}
return s0;
}
function peg$parseprimary() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$parseliteral();
if (s0 === peg$FAILED) {
s0 = peg$parseaggr_func();
if (s0 === peg$FAILED) {
s0 = peg$parsefunc_call();
if (s0 === peg$FAILED) {
s0 = peg$parsecolumn_ref();
if (s0 === peg$FAILED) {
s0 = peg$parseparam();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseLPAREN();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseor_expr();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseRPAREN();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71(s3);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parsevar_decl();
2018-07-02 18:01:01 +08:00
}
}
}
}
}
}
return s0;
}
function peg$parsecolumn_ref() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseident();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseDOT();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parsecolumn();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c72(s1, s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsecolumn();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c73(s1);
}
s0 = s1;
}
return s0;
}
function peg$parsecolumn_list() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parsecolumn();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsecolumn();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parsecolumn();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c11(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseident() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parseident_name();
if (s1 !== peg$FAILED) {
peg$savedPos = peg$currPos;
s2 = peg$c74(s1);
if (s2) {
s2 = peg$FAILED;
} else {
s2 = void 0;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c75(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsecolumn() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parsecolumn_name();
if (s1 !== peg$FAILED) {
peg$savedPos = peg$currPos;
s2 = peg$c74(s1);
if (s2) {
s2 = peg$FAILED;
} else {
s2 = void 0;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c75(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 96) {
s1 = peg$c76;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c77); }
}
if (s1 !== peg$FAILED) {
s2 = [];
if (peg$c78.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c79); }
}
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
if (peg$c78.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c79); }
2018-07-02 18:01:01 +08:00
}
}
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 96) {
s3 = peg$c76;
peg$currPos++;
2018-07-02 18:01:01 +08:00
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c77); }
2018-07-02 18:01:01 +08:00
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c80(s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
return s0;
}
function peg$parsecolumn_name() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseident_start();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsecolumn_part();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsecolumn_part();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c81(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseident_name() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseident_start();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseident_part();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseident_part();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c81(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseident_start() {
var s0;
if (peg$c82.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c83); }
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseident_part() {
var s0;
if (peg$c84.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c85); }
}
return s0;
}
function peg$parsecolumn_part() {
var s0;
if (peg$c86.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c87); }
}
return s0;
}
function peg$parseparam() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 58) {
s2 = peg$c88;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c89); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parseident_name();
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c90(s1);
}
s0 = s1;
return s0;
}
function peg$parseaggr_func() {
var s0;
s0 = peg$parseaggr_fun_count();
if (s0 === peg$FAILED) {
s0 = peg$parseaggr_fun_smma();
}
return s0;
}
function peg$parseaggr_fun_smma() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseKW_SUM_MAX_MIN_AVG();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseLPAREN();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseadditive_expr();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseRPAREN();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c91(s1, s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_SUM_MAX_MIN_AVG() {
var s0;
s0 = peg$parseKW_SUM();
if (s0 === peg$FAILED) {
s0 = peg$parseKW_MAX();
if (s0 === peg$FAILED) {
s0 = peg$parseKW_MIN();
if (s0 === peg$FAILED) {
s0 = peg$parseKW_AVG();
}
}
}
return s0;
}
function peg$parseaggr_fun_count() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseKW_COUNT();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseLPAREN();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parsecount_arg();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseRPAREN();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c92(s1, s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsecount_arg() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parsestar_expr();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c93(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseKW_DISTINCT();
if (s1 === peg$FAILED) {
s1 = null;
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsecolumn_ref();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c94(s1, s3);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
return s0;
}
function peg$parsestar_expr() {
var s0, s1;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 42) {
s1 = peg$c65;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c95();
}
s0 = s1;
return s0;
}
function peg$parsefunc_call() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseident();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseLPAREN();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseexpr_list_or_empty();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseRPAREN();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c96(s1, s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseliteral() {
var s0;
s0 = peg$parseliteral_string();
if (s0 === peg$FAILED) {
s0 = peg$parseliteral_numeric();
if (s0 === peg$FAILED) {
s0 = peg$parseliteral_bool();
if (s0 === peg$FAILED) {
s0 = peg$parseliteral_null();
}
}
}
return s0;
}
function peg$parseliteral_list() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseliteral();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseliteral();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseliteral();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c97(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseliteral_null() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseKW_NULL();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c98();
}
s0 = s1;
return s0;
}
function peg$parseliteral_bool() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseKW_TRUE();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c99();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseKW_FALSE();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c100();
}
s0 = s1;
}
return s0;
}
function peg$parseliteral_string() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 34) {
s2 = peg$c101;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c102); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsedouble_char();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsedouble_char();
}
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 34) {
s4 = peg$c101;
peg$currPos++;
2018-07-02 18:01:01 +08:00
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c102); }
2018-07-02 18:01:01 +08:00
}
if (s4 !== peg$FAILED) {
s2 = [s2, s3, s4];
s1 = s2;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 === peg$FAILED) {
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 39) {
s2 = peg$c103;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c104); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsesingle_char();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsesingle_char();
}
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 39) {
s4 = peg$c103;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c104); }
2018-07-02 18:01:01 +08:00
}
if (s4 !== peg$FAILED) {
s2 = [s2, s3, s4];
s1 = s2;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c105(s1);
2018-07-02 18:01:01 +08:00
}
s0 = s1;
return s0;
}
function peg$parsesingle_char() {
var s0;
if (peg$c106.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c107); }
}
if (s0 === peg$FAILED) {
s0 = peg$parseescape_char();
}
return s0;
}
function peg$parsedouble_char() {
var s0;
if (peg$c108.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c109); }
}
if (s0 === peg$FAILED) {
s0 = peg$parseescape_char();
}
return s0;
}
function peg$parseescape_char() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c110) {
s1 = peg$c110;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c111); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c112();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c113) {
s1 = peg$c113;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c114); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c115();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c116) {
s1 = peg$c116;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c117); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c118();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c119) {
s1 = peg$c119;
peg$currPos += 2;
2018-07-02 18:01:01 +08:00
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c120); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c121();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c122) {
s1 = peg$c122;
peg$currPos += 2;
2018-07-02 18:01:01 +08:00
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c123); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c124();
2018-07-02 18:01:01 +08:00
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c125) {
s1 = peg$c125;
peg$currPos += 2;
2018-07-02 18:01:01 +08:00
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c126); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c127();
2018-07-02 18:01:01 +08:00
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c128) {
s1 = peg$c128;
peg$currPos += 2;
2018-07-02 18:01:01 +08:00
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c129); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c130();
2018-07-02 18:01:01 +08:00
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c131) {
s1 = peg$c131;
peg$currPos += 2;
2018-07-02 18:01:01 +08:00
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c132); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c133();
2018-07-02 18:01:01 +08:00
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c134) {
s1 = peg$c134;
peg$currPos += 2;
2018-07-02 18:01:01 +08:00
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c135); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c136();
2018-07-02 18:01:01 +08:00
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c137) {
s1 = peg$c137;
peg$currPos += 2;
2018-07-02 18:01:01 +08:00
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c138); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$parsehexDigit();
if (s2 !== peg$FAILED) {
s3 = peg$parsehexDigit();
if (s3 !== peg$FAILED) {
s4 = peg$parsehexDigit();
if (s4 !== peg$FAILED) {
s5 = peg$parsehexDigit();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c139(s2, s3, s4, s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
}
}
}
}
}
2018-07-02 18:01:01 +08:00
}
}
}
return s0;
}
function peg$parseline_terminator() {
var s0;
if (peg$c140.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c141); }
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseliteral_numeric() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parsenumber();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c142(s1);
}
s0 = s1;
return s0;
}
function peg$parsenumber() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parseint();
if (s1 !== peg$FAILED) {
s2 = peg$parsefrac();
if (s2 !== peg$FAILED) {
s3 = peg$parseexp();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c143(s1, s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseint();
if (s1 !== peg$FAILED) {
s2 = peg$parsefrac();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c144(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseint();
if (s1 !== peg$FAILED) {
s2 = peg$parseexp();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c145(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseint();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c146(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
2018-07-02 18:01:01 +08:00
}
}
return s0;
}
function peg$parseint() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parsedigit19();
if (s1 !== peg$FAILED) {
s2 = peg$parsedigits();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c147(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parsedigit();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 45) {
s1 = peg$c62;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c63); }
}
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 43) {
s1 = peg$c60;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c61); }
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parsedigit19();
if (s2 !== peg$FAILED) {
s3 = peg$parsedigits();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c148(s1, s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 45) {
s1 = peg$c62;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c63); }
}
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 43) {
s1 = peg$c60;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c61); }
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parsedigit();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c149(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
2018-07-02 18:01:01 +08:00
}
}
}
return s0;
}
function peg$parsefrac() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 46) {
s1 = peg$c150;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c151); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsedigits();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c152(s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseexp() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parsee();
if (s1 !== peg$FAILED) {
s2 = peg$parsedigits();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c153(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsedigits() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
s2 = peg$parsedigit();
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsedigit();
2018-07-02 18:01:01 +08:00
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c154(s1);
}
s0 = s1;
return s0;
}
function peg$parsedigit() {
var s0;
if (peg$c155.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c156); }
}
return s0;
}
function peg$parsedigit19() {
var s0;
if (peg$c157.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c158); }
}
return s0;
}
function peg$parsehexDigit() {
var s0;
if (peg$c159.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c160); }
}
return s0;
}
function peg$parsee() {
var s0, s1, s2;
s0 = peg$currPos;
if (peg$c161.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c162); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
if (peg$c163.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
2018-07-02 18:01:01 +08:00
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c164); }
2018-07-02 18:01:01 +08:00
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c165(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_NULL() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c166) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c167); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_TRUE() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c168) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c169); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_FALSE() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c170) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c171); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_SHOW() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c172) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c173); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_DROP() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c174) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c175); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_SELECT() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c176) {
s1 = input.substr(peg$currPos, 6);
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c177); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_UPDATE() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c178) {
s1 = input.substr(peg$currPos, 6);
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c179); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_CREATE() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c180) {
s1 = input.substr(peg$currPos, 6);
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c181); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_DELETE() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c182) {
s1 = input.substr(peg$currPos, 6);
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c183); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_INSERT() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c184) {
s1 = input.substr(peg$currPos, 6);
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c185); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_REPLACE() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c186) {
s1 = input.substr(peg$currPos, 7);
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c187); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_EXPLAIN() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c188) {
s1 = input.substr(peg$currPos, 7);
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c189); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_INTO() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c190) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c191); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_FROM() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c192) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c193); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_SET() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c194) {
s1 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c195); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_AS() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c196) {
s1 = input.substr(peg$currPos, 2);
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c197); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_TABLE() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c198) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c199); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_ON() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c200) {
s1 = input.substr(peg$currPos, 2);
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c201); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_LEFT() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c202) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c203); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_INNER() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c204) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c205); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_JOIN() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c206) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c207); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_UNION() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c208) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c209); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_VALUES() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c210) {
s1 = input.substr(peg$currPos, 6);
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c211); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_EXISTS() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c212) {
s1 = input.substr(peg$currPos, 6);
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c213); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_WHERE() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c214) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c215); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_GROUP() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c216) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c217); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_BY() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c218) {
s1 = input.substr(peg$currPos, 2);
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c219); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_ORDER() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c220) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c221); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_HAVING() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c222) {
s1 = input.substr(peg$currPos, 6);
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c223); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_LIMIT() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c224) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c225); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_ASC() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c226) {
s1 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c227); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c228();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_DESC() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c229) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c230); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c231();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_ALL() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c232) {
s1 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c233); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c234();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_DISTINCT() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 8).toLowerCase() === peg$c235) {
s1 = input.substr(peg$currPos, 8);
peg$currPos += 8;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c236); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c237();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_BETWEEN() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c238) {
s1 = input.substr(peg$currPos, 7);
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c239); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c240();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_IN() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c241) {
s1 = input.substr(peg$currPos, 2);
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c242); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c243();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_IS() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c244) {
s1 = input.substr(peg$currPos, 2);
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c245); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c246();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_LIKE() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c247) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c248); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c249();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_CONTAINS() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 8).toLowerCase() === peg$c250) {
s1 = input.substr(peg$currPos, 8);
peg$currPos += 8;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c251); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c252();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_NOT() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c253) {
s1 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c254); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c255();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_AND() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c256) {
s1 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c257); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c258();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_OR() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c259) {
s1 = input.substr(peg$currPos, 2);
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c260); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c261();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_COUNT() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c262) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c263); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c264();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_MAX() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c265) {
s1 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c266); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c267();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKW_MIN() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c268) {
s1 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c269); }
2018-07-02 18:01:01 +08:00
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c270();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_SUM() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c271) {
s1 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c272); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c273();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parseKW_AVG() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c274) {
s1 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c275); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseident_start();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c276();
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseDOT() {
var s0;
if (input.charCodeAt(peg$currPos) === 46) {
s0 = peg$c150;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c151); }
}
return s0;
}
function peg$parseCOMMA() {
var s0;
if (input.charCodeAt(peg$currPos) === 44) {
s0 = peg$c277;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c278); }
}
return s0;
}
function peg$parseSTAR() {
var s0;
if (input.charCodeAt(peg$currPos) === 42) {
s0 = peg$c65;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
return s0;
}
function peg$parseLPAREN() {
var s0;
if (input.charCodeAt(peg$currPos) === 40) {
s0 = peg$c4;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c5); }
}
return s0;
}
function peg$parseRPAREN() {
var s0;
if (input.charCodeAt(peg$currPos) === 41) {
s0 = peg$c6;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c7); }
}
return s0;
}
function peg$parseLBRAKE() {
var s0;
if (input.charCodeAt(peg$currPos) === 91) {
s0 = peg$c279;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c280); }
}
return s0;
}
function peg$parseRBRAKE() {
var s0;
if (input.charCodeAt(peg$currPos) === 93) {
s0 = peg$c281;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c282); }
}
return s0;
}
function peg$parse__() {
var s0, s1;
s0 = [];
s1 = peg$parsewhitespace();
while (s1 !== peg$FAILED) {
s0.push(s1);
s1 = peg$parsewhitespace();
}
return s0;
}
function peg$parsechar() {
var s0;
if (input.length > peg$currPos) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c283); }
}
return s0;
}
function peg$parsewhitespace() {
var s0;
if (peg$c284.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c285); }
}
return s0;
}
function peg$parseEOL() {
var s0, s1;
s0 = peg$parseEOF();
if (s0 === peg$FAILED) {
s0 = [];
if (peg$c140.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c141); }
}
if (s1 !== peg$FAILED) {
while (s1 !== peg$FAILED) {
s0.push(s1);
if (peg$c140.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
2018-07-02 18:01:01 +08:00
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c141); }
2018-07-02 18:01:01 +08:00
}
}
} else {
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
return s0;
}
function peg$parseEOF() {
var s0, s1;
s0 = peg$currPos;
peg$silentFails++;
if (input.length > peg$currPos) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c283); }
}
peg$silentFails--;
if (s1 === peg$FAILED) {
s0 = void 0;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseproc_stmts() {
var s0, s1;
s0 = [];
s1 = peg$parseproc_stmt();
while (s1 !== peg$FAILED) {
s0.push(s1);
s1 = peg$parseproc_stmt();
}
return s0;
}
function peg$parseproc_stmt() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$parseproc_init();
peg$silentFails--;
if (s2 !== peg$FAILED) {
peg$currPos = s1;
s1 = void 0;
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseassign_stmt();
if (s3 === peg$FAILED) {
s3 = peg$parsereturn_stmt();
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c286(s3);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseproc_init() {
var s0;
peg$savedPos = peg$currPos;
s0 = peg$c287();
if (s0) {
s0 = void 0;
} else {
s0 = peg$FAILED;
}
return s0;
}
function peg$parseassign_stmt() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parsevar_decl();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseKW_ASSIGN();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseproc_expr();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c288(s1, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
return s0;
}
function peg$parsereturn_stmt() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseKW_RETURN();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseproc_expr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c289(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseproc_expr() {
var s0;
s0 = peg$parseselect_stmt();
if (s0 === peg$FAILED) {
s0 = peg$parseproc_join();
if (s0 === peg$FAILED) {
s0 = peg$parseproc_additive_expr();
if (s0 === peg$FAILED) {
s0 = peg$parseproc_array();
}
}
}
return s0;
}
function peg$parseproc_additive_expr() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseproc_multiplicative_expr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseadditive_operator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseproc_multiplicative_expr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseadditive_operator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseproc_multiplicative_expr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c36(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseproc_multiplicative_expr() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseproc_primary();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parsemultiplicative_operator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseproc_primary();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parsemultiplicative_operator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseproc_primary();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c36(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseproc_join() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parsevar_decl();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parsejoin_op();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parsevar_decl();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseon_clause();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c290(s1, s3, s5, s7);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseproc_primary() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$parseliteral();
if (s0 === peg$FAILED) {
s0 = peg$parsevar_decl();
if (s0 === peg$FAILED) {
s0 = peg$parseproc_func_call();
if (s0 === peg$FAILED) {
s0 = peg$parseparam();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseLPAREN();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseproc_additive_expr();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseRPAREN();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71(s3);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
}
}
}
return s0;
}
function peg$parseproc_func_call() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseident();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseLPAREN();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseproc_primary_list();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseRPAREN();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c291(s1, s5);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseproc_primary_list() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseproc_primary();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseproc_primary();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseproc_primary();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c11(s1, s2);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseproc_array() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseLBRAKE();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseproc_primary_list();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseRBRAKE();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c292(s3);
s0 = s1;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsevar_decl() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseKW_VAR_PRE();
if (s1 !== peg$FAILED) {
s2 = peg$parseident_name();
if (s2 !== peg$FAILED) {
s3 = peg$parsemem_chain();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c293(s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsemem_chain() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = [];
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 46) {
s3 = peg$c150;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c151); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parseident_name();
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 46) {
s3 = peg$c150;
peg$currPos++;
2018-07-02 18:01:01 +08:00
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c151); }
2018-07-02 18:01:01 +08:00
}
if (s3 !== peg$FAILED) {
s4 = peg$parseident_name();
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
2018-07-02 18:01:01 +08:00
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
2018-07-02 18:01:01 +08:00
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c294(s1);
}
s0 = s1;
return s0;
}
function peg$parseKW_VAR_PRE() {
var s0;
if (input.charCodeAt(peg$currPos) === 36) {
s0 = peg$c295;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c296); }
}
return s0;
}
function peg$parseKW_RETURN() {
var s0;
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c297) {
s0 = input.substr(peg$currPos, 6);
peg$currPos += 6;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c298); }
}
return s0;
}
function peg$parseKW_ASSIGN() {
var s0;
if (input.substr(peg$currPos, 2) === peg$c299) {
s0 = peg$c299;
peg$currPos += 2;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c300); }
}
return s0;
}
var util = require('util');
function debug(str){
console.log(str);
}
function inspect(obj){
console.log(util.inspect(obj, false, 10));
}
function createUnaryExpr(op, e) {
return {
type : 'unary_expr',
operator : op,
expr : e
}
}
function createBinaryExpr(op, left, right) {
return {
type : 'binary_expr',
operator : op,
left : left,
right : right
}
}
function createList(head, tail) {
var result = [head];
for (var i = 0; i < tail.length; i++) {
result.push(tail[i][3]);
}
return result;
}
function createExprList(head, tail, room) {
var epList = createList(head, tail);
var exprList = [];
var ep;
for (var i = 0; i < epList.length; i++) {
ep = epList[i];
//the ep has already added to the global params
if (ep.type == 'param') {
ep.room = room;
ep.pos = i;
2018-07-02 18:01:01 +08:00
} else {
exprList.push(ep);
2018-07-02 18:01:01 +08:00
}
}
return exprList;
2018-07-02 18:01:01 +08:00
}
function createBinaryExprChain(head, tail) {
var result = head;
for (var i = 0; i < tail.length; i++) {
result = createBinaryExpr(tail[i][1], result, tail[i][3]);
2018-07-02 18:01:01 +08:00
}
return result;
2018-07-02 18:01:01 +08:00
}
var reservedMap = {
'SHOW' : true,
'DROP' : true,
'SELECT' : true,
'UPDATE' : true,
'CREATE' : true,
'DELETE' : true,
'INSERT' : true,
'REPLACE' : true,
'EXPLAIN' : true,
'ALL' : true,
'DISTINCT': true,
'AS' : true,
'TABLE' : true,
'INTO' : true,
'FROM' : true,
'SET' : true,
'LEFT' : true,
'ON' : true,
'INNER' : true,
'JOIN' : true,
'UNION' : true,
'VALUES' : true,
'EXISTS' : true,
'WHERE' : true,
'GROUP' : true,
'BY' : true,
'HAVING' : true,
'ORDER' : true,
'ASC' : true,
'DESC' : true,
'LIMIT' : true,
'BETWEEN' : true,
'IN' : true,
'IS' : true,
'LIKE' : true,
'CONTAINS': true,
'NOT' : true,
'AND' : true,
'OR' : true,
//literal
'TRUE' : true,
'FALSE' : true,
'NULL' : true
}
var cmpPrefixMap = {
'+' : true,
'-' : true,
'*' : true,
'/' : true,
'>' : true,
'<' : true,
'!' : true,
'=' : true,
//between
'B' : true,
'b' : true,
//for is or in
'I' : true,
'i' : true,
//for like
'L' : true,
'l' : true,
//for not
'N' : true,
'n' : true,
//for contains
'C' : true,
'c' : true,
}
//used for store refered parmas
var params = [];
//used for dependency analysis
var varList = [];
peg$result = peg$startRuleFunction();
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
return peg$result;
} else {
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
peg$fail(peg$endExpectation());
}
throw peg$buildStructuredError(
peg$maxFailExpected,
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
peg$maxFailPos < input.length
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
);
2018-07-02 18:01:01 +08:00
}
}
return {
SyntaxError: peg$SyntaxError,
parse: peg$parse
2018-07-02 18:01:01 +08:00
};
});