From ac5f3fd67e977fb19677a4052b3d3efa32819fb7 Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Fri, 19 May 2023 15:30:44 +0800 Subject: [PATCH] chore: pg sql parser (#1890) --- .../postgres-query-interface.ts | 2 +- .../core/database/src/sql-parser/postgres.js | 25505 ++++++++++++++++ 2 files changed, 25506 insertions(+), 1 deletion(-) create mode 100644 packages/core/database/src/sql-parser/postgres.js diff --git a/packages/core/database/src/query-interface/postgres-query-interface.ts b/packages/core/database/src/query-interface/postgres-query-interface.ts index 9d5580c9d..de59b18e5 100644 --- a/packages/core/database/src/query-interface/postgres-query-interface.ts +++ b/packages/core/database/src/query-interface/postgres-query-interface.ts @@ -1,6 +1,6 @@ import QueryInterface from './query-interface'; import { Collection } from '../collection'; -import sqlParser from '../sql-parser'; +import sqlParser from '../sql-parser/postgres'; export default class PostgresQueryInterface extends QueryInterface { constructor(db) { diff --git a/packages/core/database/src/sql-parser/postgres.js b/packages/core/database/src/sql-parser/postgres.js new file mode 100644 index 000000000..798866da8 --- /dev/null +++ b/packages/core/database/src/sql-parser/postgres.js @@ -0,0 +1,25505 @@ +// Generated by Peggy 3.0.2. +// +// https://peggyjs.org/ + +"use strict"; + +function peg$subclass(child, parent) { + function C() { this.constructor = child; } + C.prototype = parent.prototype; + child.prototype = new C(); +} + +function peg$SyntaxError(message, expected, found, location) { + var self = Error.call(this, message); + // istanbul ignore next Check is a necessary evil to support older environments + if (Object.setPrototypeOf) { + Object.setPrototypeOf(self, peg$SyntaxError.prototype); + } + self.expected = expected; + self.found = found; + self.location = location; + self.name = "SyntaxError"; + return self; +} + +peg$subclass(peg$SyntaxError, Error); + +function peg$padEnd(str, targetLength, padString) { + padString = padString || " "; + if (str.length > targetLength) { return str; } + targetLength -= str.length; + padString += padString.repeat(targetLength); + return str + padString.slice(0, targetLength); +} + +peg$SyntaxError.prototype.format = function(sources) { + var str = "Error: " + this.message; + if (this.location) { + var src = null; + var k; + for (k = 0; k < sources.length; k++) { + if (sources[k].source === this.location.source) { + src = sources[k].text.split(/\r\n|\n|\r/g); + break; + } + } + var s = this.location.start; + var offset_s = (this.location.source && (typeof this.location.source.offset === "function")) + ? this.location.source.offset(s) + : s; + var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column; + if (src) { + var e = this.location.end; + var filler = peg$padEnd("", offset_s.line.toString().length, ' '); + var line = src[s.line - 1]; + var last = s.line === e.line ? e.column : line.length + 1; + var hatLen = (last - s.column) || 1; + str += "\n --> " + loc + "\n" + + filler + " |\n" + + offset_s.line + " | " + line + "\n" + + filler + " | " + peg$padEnd("", s.column - 1, ' ') + + peg$padEnd("", hatLen, "^"); + } else { + str += "\n at " + loc; + } + } + return str; +}; + +peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + + class: function(expectation) { + var escapedParts = expectation.parts.map(function(part) { + return Array.isArray(part) + ? classEscape(part[0]) + "-" + classEscape(part[1]) + : classEscape(part); + }); + + return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]"; + }, + + any: function() { + return "any character"; + }, + + end: function() { + 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 = expected.map(describeExpectation); + var i, j; + + 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 !== undefined ? options : {}; + + var peg$FAILED = {}; + var peg$source = options.grammarSource; + + var peg$startRuleFunctions = { start: peg$parsestart }; + var peg$startRuleFunction = peg$parsestart; + + var peg$c0 = "if"; + var peg$c1 = "cascaded"; + var peg$c2 = "local"; + var peg$c3 = "check"; + var peg$c4 = "OPTION"; + var peg$c5 = "algorithm"; + var peg$c6 = "undefined"; + var peg$c7 = "merge"; + var peg$c8 = "temptable"; + var peg$c9 = "sql"; + var peg$c10 = "security"; + var peg$c11 = "definer"; + var peg$c12 = "invoker"; + var peg$c13 = "auto_increment"; + var peg$c14 = "unique"; + var peg$c15 = "key"; + var peg$c16 = "primary"; + var peg$c17 = "@"; + var peg$c18 = "before"; + var peg$c19 = "after"; + var peg$c20 = "follows"; + var peg$c21 = "precedes"; + var peg$c22 = "for"; + var peg$c23 = "each"; + var peg$c24 = "row"; + var peg$c25 = "column_format"; + var peg$c26 = "fixed"; + var peg$c27 = "dynamic"; + var peg$c28 = "default"; + var peg$c29 = "storage"; + var peg$c30 = "disk"; + var peg$c31 = "memory"; + var peg$c32 = "generated"; + var peg$c33 = "always"; + var peg$c34 = "as"; + var peg$c35 = "stored"; + var peg$c36 = "virtual"; + var peg$c37 = "exists"; + var peg$c38 = "instant"; + var peg$c39 = "inplace"; + var peg$c40 = "copy"; + var peg$c41 = "lock"; + var peg$c42 = "none"; + var peg$c43 = "shared"; + var peg$c44 = "exclusive"; + var peg$c45 = "change"; + var peg$c46 = "first"; + var peg$c47 = "foreign"; + var peg$c48 = "nocheck"; + var peg$c49 = "not"; + var peg$c50 = "replication"; + var peg$c51 = "foreign key"; + var peg$c52 = "enforced"; + var peg$c53 = "match full"; + var peg$c54 = "match partial"; + var peg$c55 = "match simple"; + var peg$c56 = "restrict"; + var peg$c57 = "cascade"; + var peg$c58 = "set null"; + var peg$c59 = "no action"; + var peg$c60 = "set default"; + var peg$c61 = "character"; + var peg$c62 = "set"; + var peg$c63 = "charset"; + var peg$c64 = "collate"; + var peg$c65 = "avg_row_length"; + var peg$c66 = "key_block_size"; + var peg$c67 = "max_rows"; + var peg$c68 = "min_rows"; + var peg$c69 = "stats_sample_pages"; + var peg$c70 = "connection"; + var peg$c71 = "compression"; + var peg$c72 = "'"; + var peg$c73 = "zlib"; + var peg$c74 = "lz4"; + var peg$c75 = "engine"; + var peg$c76 = "row_format"; + var peg$c77 = "compressed"; + var peg$c78 = "redundant"; + var peg$c79 = "compact"; + var peg$c80 = "read"; + var peg$c81 = "low_priority"; + var peg$c82 = "write"; + var peg$c83 = "binary"; + var peg$c84 = "master"; + var peg$c85 = "logs"; + var peg$c86 = "triggers"; + var peg$c87 = "status"; + var peg$c88 = "processlist"; + var peg$c89 = "procedure"; + var peg$c90 = "function"; + var peg$c91 = "binlog"; + var peg$c92 = "events"; + var peg$c93 = "collation"; + var peg$c94 = "columns"; + var peg$c95 = "indexes"; + var peg$c96 = "grants"; + var peg$c97 = "("; + var peg$c98 = ")"; + var peg$c99 = "in"; + var peg$c100 = "share"; + var peg$c101 = "mode"; + var peg$c102 = "wait"; + var peg$c103 = "nowait"; + var peg$c104 = "skip"; + var peg$c105 = "locked"; + var peg$c106 = "natural"; + var peg$c107 = "language"; + var peg$c108 = "with"; + var peg$c109 = "query"; + var peg$c110 = "expansion"; + var peg$c111 = "boolean"; + var peg$c112 = "match"; + var peg$c113 = "AGAINST"; + var peg$c114 = "outfile"; + var peg$c115 = "dumpfile"; + var peg$c116 = "btree"; + var peg$c117 = "hash"; + var peg$c118 = "parser"; + var peg$c119 = "visible"; + var peg$c120 = "invisible"; + var peg$c121 = "?"; + var peg$c122 = "="; + var peg$c123 = "duplicate"; + var peg$c124 = "!"; + var peg$c125 = ">="; + var peg$c126 = ">"; + var peg$c127 = "<="; + var peg$c128 = "<>"; + var peg$c129 = "<"; + var peg$c130 = "!="; + var peg$c131 = "+"; + var peg$c132 = "-"; + var peg$c133 = "~"; + var peg$c134 = "*"; + var peg$c135 = "/"; + var peg$c136 = "%"; + var peg$c137 = "||"; + var peg$c138 = "div"; + var peg$c139 = "&"; + var peg$c140 = ">>"; + var peg$c141 = "<<"; + var peg$c142 = "^"; + var peg$c143 = "|"; + var peg$c144 = "\""; + var peg$c145 = "`"; + var peg$c146 = ":"; + var peg$c147 = "over"; + var peg$c148 = "window"; + var peg$c149 = "following"; + var peg$c150 = "preceding"; + var peg$c151 = "current"; + var peg$c152 = "unbounded"; + var peg$c153 = "separator"; + var peg$c154 = "century"; + var peg$c155 = "day"; + var peg$c156 = "date"; + var peg$c157 = "decade"; + var peg$c158 = "dow"; + var peg$c159 = "doy"; + var peg$c160 = "epoch"; + var peg$c161 = "hour"; + var peg$c162 = "isodow"; + var peg$c163 = "isoweek"; + var peg$c164 = "isoyear"; + var peg$c165 = "microseconds"; + var peg$c166 = "millennium"; + var peg$c167 = "milliseconds"; + var peg$c168 = "minute"; + var peg$c169 = "month"; + var peg$c170 = "quarter"; + var peg$c171 = "second"; + var peg$c172 = "time"; + var peg$c173 = "timezone"; + var peg$c174 = "timezone_hour"; + var peg$c175 = "timezone_minute"; + var peg$c176 = "week"; + var peg$c177 = "year"; + var peg$c178 = "date_trunc"; + var peg$c179 = "both"; + var peg$c180 = "leading"; + var peg$c181 = "trailing"; + var peg$c182 = "trim"; + var peg$c183 = "convert"; + var peg$c184 = "_binary"; + var peg$c185 = "_latin1"; + var peg$c186 = "x"; + var peg$c187 = "b"; + var peg$c188 = "0x"; + var peg$c189 = "n"; + var peg$c190 = "\\'"; + var peg$c191 = "\\\""; + var peg$c192 = "\\\\"; + var peg$c193 = "\\/"; + var peg$c194 = "\\b"; + var peg$c195 = "\\f"; + var peg$c196 = "\\n"; + var peg$c197 = "\\r"; + var peg$c198 = "\\t"; + var peg$c199 = "\\u"; + var peg$c200 = "\\"; + var peg$c201 = "''"; + var peg$c202 = "\"\""; + var peg$c203 = "``"; + var peg$c204 = "."; + var peg$c205 = "null"; + var peg$c206 = "not null"; + var peg$c207 = "true"; + var peg$c208 = "to"; + var peg$c209 = "false"; + var peg$c210 = "show"; + var peg$c211 = "drop"; + var peg$c212 = "use"; + var peg$c213 = "alter"; + var peg$c214 = "select"; + var peg$c215 = "update"; + var peg$c216 = "create"; + var peg$c217 = "temporary"; + var peg$c218 = "delete"; + var peg$c219 = "insert"; + var peg$c220 = "RECURSIVE"; + var peg$c221 = "replace"; + var peg$c222 = "rename"; + var peg$c223 = "ignore"; + var peg$c224 = "explain"; + var peg$c225 = "partition"; + var peg$c226 = "into"; + var peg$c227 = "from"; + var peg$c228 = "unlock"; + var peg$c229 = "table"; + var peg$c230 = "trigger"; + var peg$c231 = "tables"; + var peg$c232 = "database"; + var peg$c233 = "schema"; + var peg$c234 = "on"; + var peg$c235 = "left"; + var peg$c236 = "right"; + var peg$c237 = "full"; + var peg$c238 = "inner"; + var peg$c239 = "cross"; + var peg$c240 = "join"; + var peg$c241 = "outer"; + var peg$c242 = "union"; + var peg$c243 = "minus"; + var peg$c244 = "intersect"; + var peg$c245 = "values"; + var peg$c246 = "using"; + var peg$c247 = "where"; + var peg$c248 = "go"; + var peg$c249 = "group"; + var peg$c250 = "by"; + var peg$c251 = "order"; + var peg$c252 = "having"; + var peg$c253 = "limit"; + var peg$c254 = "offset"; + var peg$c255 = "asc"; + var peg$c256 = "desc"; + var peg$c257 = "describe"; + var peg$c258 = "all"; + var peg$c259 = "distinct"; + var peg$c260 = "between"; + var peg$c261 = "is"; + var peg$c262 = "like"; + var peg$c263 = "rlike"; + var peg$c264 = "regexp"; + var peg$c265 = "and"; + var peg$c266 = "or"; + var peg$c267 = "count"; + var peg$c268 = "group_concat"; + var peg$c269 = "max"; + var peg$c270 = "min"; + var peg$c271 = "sum"; + var peg$c272 = "avg"; + var peg$c273 = "extract"; + var peg$c274 = "call"; + var peg$c275 = "case"; + var peg$c276 = "when"; + var peg$c277 = "then"; + var peg$c278 = "else"; + var peg$c279 = "end"; + var peg$c280 = "cast"; + var peg$c281 = "varbinary"; + var peg$c282 = "bit"; + var peg$c283 = "char"; + var peg$c284 = "varchar"; + var peg$c285 = "numeric"; + var peg$c286 = "decimal"; + var peg$c287 = "signed"; + var peg$c288 = "unsigned"; + var peg$c289 = "int"; + var peg$c290 = "zerofill"; + var peg$c291 = "integer"; + var peg$c292 = "json"; + var peg$c293 = "smallint"; + var peg$c294 = "mediumint"; + var peg$c295 = "tinyint"; + var peg$c296 = "tinytext"; + var peg$c297 = "text"; + var peg$c298 = "mediumtext"; + var peg$c299 = "longtext"; + var peg$c300 = "bigint"; + var peg$c301 = "enum"; + var peg$c302 = "float"; + var peg$c303 = "double"; + var peg$c304 = "datetime"; + var peg$c305 = "rows"; + var peg$c306 = "timestamp"; + var peg$c307 = "truncate"; + var peg$c308 = "user"; + var peg$c309 = "current_date"; + var peg$c310 = "adddate"; + var peg$c311 = "interval"; + var peg$c312 = "current_time"; + var peg$c313 = "current_timestamp"; + var peg$c314 = "current_user"; + var peg$c315 = "session_user"; + var peg$c316 = "system_user"; + var peg$c317 = "global"; + var peg$c318 = "session"; + var peg$c319 = "persist"; + var peg$c320 = "persist_only"; + var peg$c321 = "view"; + var peg$c322 = "geometry"; + var peg$c323 = "point"; + var peg$c324 = "linestring"; + var peg$c325 = "polygon"; + var peg$c326 = "multipoint"; + var peg$c327 = "multilinestring"; + var peg$c328 = "multipolygon"; + var peg$c329 = "geometrycollection"; + var peg$c330 = "@@"; + var peg$c331 = "$"; + var peg$c332 = "return"; + var peg$c333 = ":="; + var peg$c334 = "dual"; + var peg$c335 = "add"; + var peg$c336 = "column"; + var peg$c337 = "index"; + var peg$c338 = "fulltext"; + var peg$c339 = "spatial"; + var peg$c340 = "comment"; + var peg$c341 = "constraint"; + var peg$c342 = "references"; + var peg$c343 = "sql_calc_found_rows"; + var peg$c344 = "sql_cache"; + var peg$c345 = "sql_no_cache"; + var peg$c346 = "sql_small_result"; + var peg$c347 = "sql_big_result"; + var peg$c348 = "sql_buffer_result"; + var peg$c349 = ","; + var peg$c350 = "["; + var peg$c351 = "]"; + var peg$c352 = ";"; + var peg$c353 = "->"; + var peg$c354 = "->>"; + var peg$c355 = "&&"; + var peg$c356 = "xor"; + var peg$c357 = "/*"; + var peg$c358 = "*/"; + var peg$c359 = "--"; + var peg$c360 = "#"; + var peg$c361 = "blob"; + var peg$c362 = "tinyblob"; + var peg$c363 = "mediumblob"; + var peg$c364 = "longblob"; + + var peg$r0 = /^[0-9]/; + var peg$r1 = /^[^"]/; + var peg$r2 = /^[^']/; + var peg$r3 = /^[^`\\]/; + var peg$r4 = /^[A-Za-z_]/; + var peg$r5 = /^[A-Za-z0-9_$]/; + var peg$r6 = /^[A-Za-z0-9_:]/; + var peg$r7 = /^[0-9A-Fa-f]/; + var peg$r8 = /^[^"\\\0-\x1F\x7F]/; + var peg$r9 = /^[^'\\]/; + var peg$r10 = /^[\n\r]/; + var peg$r11 = /^[0-9a-fA-F]/; + var peg$r12 = /^[eE]/; + var peg$r13 = /^[+\-]/; + var peg$r14 = /^[ \t\n\r]/; + var peg$r15 = /^[0-6]/; + + var peg$e0 = peg$literalExpectation("IF", true); + var peg$e1 = peg$literalExpectation("CASCADED", true); + var peg$e2 = peg$literalExpectation("LOCAL", true); + var peg$e3 = peg$literalExpectation("CHECK", true); + var peg$e4 = peg$literalExpectation("OPTION", false); + var peg$e5 = peg$literalExpectation("ALGORITHM", true); + var peg$e6 = peg$literalExpectation("UNDEFINED", true); + var peg$e7 = peg$literalExpectation("MERGE", true); + var peg$e8 = peg$literalExpectation("TEMPTABLE", true); + var peg$e9 = peg$literalExpectation("SQL", true); + var peg$e10 = peg$literalExpectation("SECURITY", true); + var peg$e11 = peg$literalExpectation("DEFINER", true); + var peg$e12 = peg$literalExpectation("INVOKER", true); + var peg$e13 = peg$literalExpectation("AUTO_INCREMENT", true); + var peg$e14 = peg$literalExpectation("UNIQUE", true); + var peg$e15 = peg$literalExpectation("KEY", true); + var peg$e16 = peg$literalExpectation("PRIMARY", true); + var peg$e17 = peg$literalExpectation("@", false); + var peg$e18 = peg$literalExpectation("BEFORE", true); + var peg$e19 = peg$literalExpectation("AFTER", true); + var peg$e20 = peg$literalExpectation("FOLLOWS", true); + var peg$e21 = peg$literalExpectation("PRECEDES", true); + var peg$e22 = peg$literalExpectation("FOR", true); + var peg$e23 = peg$literalExpectation("EACH", true); + var peg$e24 = peg$literalExpectation("ROW", true); + var peg$e25 = peg$literalExpectation("COLUMN_FORMAT", true); + var peg$e26 = peg$literalExpectation("FIXED", true); + var peg$e27 = peg$literalExpectation("DYNAMIC", true); + var peg$e28 = peg$literalExpectation("DEFAULT", true); + var peg$e29 = peg$literalExpectation("STORAGE", true); + var peg$e30 = peg$literalExpectation("DISK", true); + var peg$e31 = peg$literalExpectation("MEMORY", true); + var peg$e32 = peg$literalExpectation("GENERATED", true); + var peg$e33 = peg$literalExpectation("ALWAYS", true); + var peg$e34 = peg$literalExpectation("AS", true); + var peg$e35 = peg$literalExpectation("STORED", true); + var peg$e36 = peg$literalExpectation("VIRTUAL", true); + var peg$e37 = peg$literalExpectation("if", true); + var peg$e38 = peg$literalExpectation("exists", true); + var peg$e39 = peg$literalExpectation("INSTANT", true); + var peg$e40 = peg$literalExpectation("INPLACE", true); + var peg$e41 = peg$literalExpectation("COPY", true); + var peg$e42 = peg$literalExpectation("LOCK", true); + var peg$e43 = peg$literalExpectation("NONE", true); + var peg$e44 = peg$literalExpectation("SHARED", true); + var peg$e45 = peg$literalExpectation("EXCLUSIVE", true); + var peg$e46 = peg$literalExpectation("CHANGE", true); + var peg$e47 = peg$literalExpectation("FIRST", true); + var peg$e48 = peg$literalExpectation("FOREIGN", true); + var peg$e49 = peg$literalExpectation("NOCHECK", true); + var peg$e50 = peg$literalExpectation("NOT", true); + var peg$e51 = peg$literalExpectation("REPLICATION", true); + var peg$e52 = peg$literalExpectation("FOREIGN KEY", true); + var peg$e53 = peg$literalExpectation("ENFORCED", true); + var peg$e54 = peg$literalExpectation("MATCH FULL", true); + var peg$e55 = peg$literalExpectation("MATCH PARTIAL", true); + var peg$e56 = peg$literalExpectation("MATCH SIMPLE", true); + var peg$e57 = peg$literalExpectation("RESTRICT", true); + var peg$e58 = peg$literalExpectation("CASCADE", true); + var peg$e59 = peg$literalExpectation("SET NULL", true); + var peg$e60 = peg$literalExpectation("NO ACTION", true); + var peg$e61 = peg$literalExpectation("SET DEFAULT", true); + var peg$e62 = peg$literalExpectation("CHARACTER", true); + var peg$e63 = peg$literalExpectation("SET", true); + var peg$e64 = peg$literalExpectation("CHARSET", true); + var peg$e65 = peg$literalExpectation("COLLATE", true); + var peg$e66 = peg$literalExpectation("AVG_ROW_LENGTH", true); + var peg$e67 = peg$literalExpectation("KEY_BLOCK_SIZE", true); + var peg$e68 = peg$literalExpectation("MAX_ROWS", true); + var peg$e69 = peg$literalExpectation("MIN_ROWS", true); + var peg$e70 = peg$literalExpectation("STATS_SAMPLE_PAGES", true); + var peg$e71 = peg$literalExpectation("CONNECTION", true); + var peg$e72 = peg$literalExpectation("COMPRESSION", true); + var peg$e73 = peg$literalExpectation("'", false); + var peg$e74 = peg$literalExpectation("ZLIB", true); + var peg$e75 = peg$literalExpectation("LZ4", true); + var peg$e76 = peg$literalExpectation("ENGINE", true); + var peg$e77 = peg$literalExpectation("ROW_FORMAT", true); + var peg$e78 = peg$literalExpectation("COMPRESSED", true); + var peg$e79 = peg$literalExpectation("REDUNDANT", true); + var peg$e80 = peg$literalExpectation("COMPACT", true); + var peg$e81 = peg$literalExpectation("READ", true); + var peg$e82 = peg$literalExpectation("LOW_PRIORITY", true); + var peg$e83 = peg$literalExpectation("WRITE", true); + var peg$e84 = peg$literalExpectation("BINARY", true); + var peg$e85 = peg$literalExpectation("MASTER", true); + var peg$e86 = peg$literalExpectation("LOGS", true); + var peg$e87 = peg$literalExpectation("TRIGGERS", true); + var peg$e88 = peg$literalExpectation("STATUS", true); + var peg$e89 = peg$literalExpectation("PROCESSLIST", true); + var peg$e90 = peg$literalExpectation("PROCEDURE", true); + var peg$e91 = peg$literalExpectation("FUNCTION", true); + var peg$e92 = peg$literalExpectation("BINLOG", true); + var peg$e93 = peg$literalExpectation("EVENTS", true); + var peg$e94 = peg$literalExpectation("COLLATION", true); + var peg$e95 = peg$literalExpectation("COLUMNS", true); + var peg$e96 = peg$literalExpectation("INDEXES", true); + var peg$e97 = peg$literalExpectation("GRANTS", true); + var peg$e98 = peg$literalExpectation("(", false); + var peg$e99 = peg$literalExpectation(")", false); + var peg$e100 = peg$classExpectation([["0", "9"]], false, false); + var peg$e101 = peg$literalExpectation("IN", true); + var peg$e102 = peg$literalExpectation("SHARE", true); + var peg$e103 = peg$literalExpectation("MODE", true); + var peg$e104 = peg$literalExpectation("WAIT", true); + var peg$e105 = peg$literalExpectation("NOWAIT", true); + var peg$e106 = peg$literalExpectation("SKIP", true); + var peg$e107 = peg$literalExpectation("LOCKED", true); + var peg$e108 = peg$literalExpectation("NATURAL", true); + var peg$e109 = peg$literalExpectation("LANGUAGE", true); + var peg$e110 = peg$literalExpectation("WITH", true); + var peg$e111 = peg$literalExpectation("QUERY", true); + var peg$e112 = peg$literalExpectation("EXPANSION", true); + var peg$e113 = peg$literalExpectation("BOOLEAN", true); + var peg$e114 = peg$literalExpectation("MATCH", true); + var peg$e115 = peg$literalExpectation("AGAINST", false); + var peg$e116 = peg$literalExpectation("OUTFILE", true); + var peg$e117 = peg$literalExpectation("DUMPFILE", true); + var peg$e118 = peg$literalExpectation("BTREE", true); + var peg$e119 = peg$literalExpectation("HASH", true); + var peg$e120 = peg$literalExpectation("PARSER", true); + var peg$e121 = peg$literalExpectation("VISIBLE", true); + var peg$e122 = peg$literalExpectation("INVISIBLE", true); + var peg$e123 = peg$literalExpectation("?", false); + var peg$e124 = peg$literalExpectation("=", false); + var peg$e125 = peg$literalExpectation("DUPLICATE", true); + var peg$e126 = peg$literalExpectation("!", false); + var peg$e127 = peg$literalExpectation(">=", false); + var peg$e128 = peg$literalExpectation(">", false); + var peg$e129 = peg$literalExpectation("<=", false); + var peg$e130 = peg$literalExpectation("<>", false); + var peg$e131 = peg$literalExpectation("<", false); + var peg$e132 = peg$literalExpectation("!=", false); + var peg$e133 = peg$literalExpectation("+", false); + var peg$e134 = peg$literalExpectation("-", false); + var peg$e135 = peg$literalExpectation("~", false); + var peg$e136 = peg$literalExpectation("*", false); + var peg$e137 = peg$literalExpectation("/", false); + var peg$e138 = peg$literalExpectation("%", false); + var peg$e139 = peg$literalExpectation("||", false); + var peg$e140 = peg$literalExpectation("div", true); + var peg$e141 = peg$literalExpectation("&", false); + var peg$e142 = peg$literalExpectation(">>", false); + var peg$e143 = peg$literalExpectation("<<", false); + var peg$e144 = peg$literalExpectation("^", false); + var peg$e145 = peg$literalExpectation("|", false); + var peg$e146 = peg$literalExpectation("\"", false); + var peg$e147 = peg$classExpectation(["\""], true, false); + var peg$e148 = peg$classExpectation(["'"], true, false); + var peg$e149 = peg$literalExpectation("`", false); + var peg$e150 = peg$classExpectation(["`", "\\"], true, false); + var peg$e151 = peg$classExpectation([["A", "Z"], ["a", "z"], "_"], false, false); + var peg$e152 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"], "_", "$"], false, false); + var peg$e153 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"], "_", ":"], false, false); + var peg$e154 = peg$literalExpectation(":", false); + var peg$e155 = peg$literalExpectation("OVER", true); + var peg$e156 = peg$literalExpectation("WINDOW", true); + var peg$e157 = peg$literalExpectation("FOLLOWING", true); + var peg$e158 = peg$literalExpectation("PRECEDING", true); + var peg$e159 = peg$literalExpectation("CURRENT", true); + var peg$e160 = peg$literalExpectation("UNBOUNDED", true); + var peg$e161 = peg$literalExpectation("SEPARATOR", true); + var peg$e162 = peg$literalExpectation("CENTURY", true); + var peg$e163 = peg$literalExpectation("DAY", true); + var peg$e164 = peg$literalExpectation("DATE", true); + var peg$e165 = peg$literalExpectation("DECADE", true); + var peg$e166 = peg$literalExpectation("DOW", true); + var peg$e167 = peg$literalExpectation("DOY", true); + var peg$e168 = peg$literalExpectation("EPOCH", true); + var peg$e169 = peg$literalExpectation("HOUR", true); + var peg$e170 = peg$literalExpectation("ISODOW", true); + var peg$e171 = peg$literalExpectation("ISOWEEK", true); + var peg$e172 = peg$literalExpectation("ISOYEAR", true); + var peg$e173 = peg$literalExpectation("MICROSECONDS", true); + var peg$e174 = peg$literalExpectation("MILLENNIUM", true); + var peg$e175 = peg$literalExpectation("MILLISECONDS", true); + var peg$e176 = peg$literalExpectation("MINUTE", true); + var peg$e177 = peg$literalExpectation("MONTH", true); + var peg$e178 = peg$literalExpectation("QUARTER", true); + var peg$e179 = peg$literalExpectation("SECOND", true); + var peg$e180 = peg$literalExpectation("TIME", true); + var peg$e181 = peg$literalExpectation("TIMEZONE", true); + var peg$e182 = peg$literalExpectation("TIMEZONE_HOUR", true); + var peg$e183 = peg$literalExpectation("TIMEZONE_MINUTE", true); + var peg$e184 = peg$literalExpectation("WEEK", true); + var peg$e185 = peg$literalExpectation("YEAR", true); + var peg$e186 = peg$literalExpectation("DATE_TRUNC", true); + var peg$e187 = peg$literalExpectation("BOTH", true); + var peg$e188 = peg$literalExpectation("LEADING", true); + var peg$e189 = peg$literalExpectation("TRAILING", true); + var peg$e190 = peg$literalExpectation("trim", true); + var peg$e191 = peg$literalExpectation("convert", true); + var peg$e192 = peg$literalExpectation("binary", true); + var peg$e193 = peg$literalExpectation("_binary", true); + var peg$e194 = peg$literalExpectation("_latin1", true); + var peg$e195 = peg$literalExpectation("X", true); + var peg$e196 = peg$classExpectation([["0", "9"], ["A", "F"], ["a", "f"]], false, false); + var peg$e197 = peg$literalExpectation("b", true); + var peg$e198 = peg$literalExpectation("0x", true); + var peg$e199 = peg$literalExpectation("N", true); + var peg$e200 = peg$classExpectation(["\"", "\\", ["\0", "\x1F"], "\x7F"], true, false); + var peg$e201 = peg$classExpectation(["'", "\\"], true, false); + var peg$e202 = peg$literalExpectation("\\'", false); + var peg$e203 = peg$literalExpectation("\\\"", false); + var peg$e204 = peg$literalExpectation("\\\\", false); + var peg$e205 = peg$literalExpectation("\\/", false); + var peg$e206 = peg$literalExpectation("\\b", false); + var peg$e207 = peg$literalExpectation("\\f", false); + var peg$e208 = peg$literalExpectation("\\n", false); + var peg$e209 = peg$literalExpectation("\\r", false); + var peg$e210 = peg$literalExpectation("\\t", false); + var peg$e211 = peg$literalExpectation("\\u", false); + var peg$e212 = peg$literalExpectation("\\", false); + var peg$e213 = peg$literalExpectation("''", false); + var peg$e214 = peg$literalExpectation("\"\"", false); + var peg$e215 = peg$literalExpectation("``", false); + var peg$e216 = peg$classExpectation(["\n", "\r"], false, false); + var peg$e217 = peg$literalExpectation(".", false); + var peg$e218 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false); + var peg$e219 = peg$classExpectation(["e", "E"], false, false); + var peg$e220 = peg$classExpectation(["+", "-"], false, false); + var peg$e221 = peg$literalExpectation("NULL", true); + var peg$e222 = peg$literalExpectation("NOT NULL", true); + var peg$e223 = peg$literalExpectation("TRUE", true); + var peg$e224 = peg$literalExpectation("TO", true); + var peg$e225 = peg$literalExpectation("FALSE", true); + var peg$e226 = peg$literalExpectation("SHOW", true); + var peg$e227 = peg$literalExpectation("DROP", true); + var peg$e228 = peg$literalExpectation("USE", true); + var peg$e229 = peg$literalExpectation("ALTER", true); + var peg$e230 = peg$literalExpectation("SELECT", true); + var peg$e231 = peg$literalExpectation("UPDATE", true); + var peg$e232 = peg$literalExpectation("CREATE", true); + var peg$e233 = peg$literalExpectation("TEMPORARY", true); + var peg$e234 = peg$literalExpectation("DELETE", true); + var peg$e235 = peg$literalExpectation("INSERT", true); + var peg$e236 = peg$literalExpectation("RECURSIVE", false); + var peg$e237 = peg$literalExpectation("REPLACE", true); + var peg$e238 = peg$literalExpectation("RENAME", true); + var peg$e239 = peg$literalExpectation("IGNORE", true); + var peg$e240 = peg$literalExpectation("EXPLAIN", true); + var peg$e241 = peg$literalExpectation("PARTITION", true); + var peg$e242 = peg$literalExpectation("INTO", true); + var peg$e243 = peg$literalExpectation("FROM", true); + var peg$e244 = peg$literalExpectation("UNLOCK", true); + var peg$e245 = peg$literalExpectation("TABLE", true); + var peg$e246 = peg$literalExpectation("TRIGGER", true); + var peg$e247 = peg$literalExpectation("TABLES", true); + var peg$e248 = peg$literalExpectation("DATABASE", true); + var peg$e249 = peg$literalExpectation("SCHEMA", true); + var peg$e250 = peg$literalExpectation("ON", true); + var peg$e251 = peg$literalExpectation("LEFT", true); + var peg$e252 = peg$literalExpectation("RIGHT", true); + var peg$e253 = peg$literalExpectation("FULL", true); + var peg$e254 = peg$literalExpectation("INNER", true); + var peg$e255 = peg$literalExpectation("CROSS", true); + var peg$e256 = peg$literalExpectation("JOIN", true); + var peg$e257 = peg$literalExpectation("OUTER", true); + var peg$e258 = peg$literalExpectation("UNION", true); + var peg$e259 = peg$literalExpectation("MINUS", true); + var peg$e260 = peg$literalExpectation("INTERSECT", true); + var peg$e261 = peg$literalExpectation("VALUES", true); + var peg$e262 = peg$literalExpectation("USING", true); + var peg$e263 = peg$literalExpectation("WHERE", true); + var peg$e264 = peg$literalExpectation("GO", true); + var peg$e265 = peg$literalExpectation("GROUP", true); + var peg$e266 = peg$literalExpectation("BY", true); + var peg$e267 = peg$literalExpectation("ORDER", true); + var peg$e268 = peg$literalExpectation("HAVING", true); + var peg$e269 = peg$literalExpectation("LIMIT", true); + var peg$e270 = peg$literalExpectation("OFFSET", true); + var peg$e271 = peg$literalExpectation("ASC", true); + var peg$e272 = peg$literalExpectation("DESC", true); + var peg$e273 = peg$literalExpectation("DESCRIBE", true); + var peg$e274 = peg$literalExpectation("ALL", true); + var peg$e275 = peg$literalExpectation("DISTINCT", true); + var peg$e276 = peg$literalExpectation("BETWEEN", true); + var peg$e277 = peg$literalExpectation("IS", true); + var peg$e278 = peg$literalExpectation("LIKE", true); + var peg$e279 = peg$literalExpectation("RLIKE", true); + var peg$e280 = peg$literalExpectation("REGEXP", true); + var peg$e281 = peg$literalExpectation("EXISTS", true); + var peg$e282 = peg$literalExpectation("AND", true); + var peg$e283 = peg$literalExpectation("OR", true); + var peg$e284 = peg$literalExpectation("COUNT", true); + var peg$e285 = peg$literalExpectation("GROUP_CONCAT", true); + var peg$e286 = peg$literalExpectation("MAX", true); + var peg$e287 = peg$literalExpectation("MIN", true); + var peg$e288 = peg$literalExpectation("SUM", true); + var peg$e289 = peg$literalExpectation("AVG", true); + var peg$e290 = peg$literalExpectation("EXTRACT", true); + var peg$e291 = peg$literalExpectation("CALL", true); + var peg$e292 = peg$literalExpectation("CASE", true); + var peg$e293 = peg$literalExpectation("WHEN", true); + var peg$e294 = peg$literalExpectation("THEN", true); + var peg$e295 = peg$literalExpectation("ELSE", true); + var peg$e296 = peg$literalExpectation("END", true); + var peg$e297 = peg$literalExpectation("CAST", true); + var peg$e298 = peg$literalExpectation("VARBINARY", true); + var peg$e299 = peg$literalExpectation("BIT", true); + var peg$e300 = peg$literalExpectation("CHAR", true); + var peg$e301 = peg$literalExpectation("VARCHAR", true); + var peg$e302 = peg$literalExpectation("NUMERIC", true); + var peg$e303 = peg$literalExpectation("DECIMAL", true); + var peg$e304 = peg$literalExpectation("SIGNED", true); + var peg$e305 = peg$literalExpectation("UNSIGNED", true); + var peg$e306 = peg$literalExpectation("INT", true); + var peg$e307 = peg$literalExpectation("ZEROFILL", true); + var peg$e308 = peg$literalExpectation("INTEGER", true); + var peg$e309 = peg$literalExpectation("JSON", true); + var peg$e310 = peg$literalExpectation("SMALLINT", true); + var peg$e311 = peg$literalExpectation("MEDIUMINT", true); + var peg$e312 = peg$literalExpectation("TINYINT", true); + var peg$e313 = peg$literalExpectation("TINYTEXT", true); + var peg$e314 = peg$literalExpectation("TEXT", true); + var peg$e315 = peg$literalExpectation("MEDIUMTEXT", true); + var peg$e316 = peg$literalExpectation("LONGTEXT", true); + var peg$e317 = peg$literalExpectation("BIGINT", true); + var peg$e318 = peg$literalExpectation("ENUM", true); + var peg$e319 = peg$literalExpectation("FLOAT", true); + var peg$e320 = peg$literalExpectation("DOUBLE", true); + var peg$e321 = peg$literalExpectation("DATETIME", true); + var peg$e322 = peg$literalExpectation("ROWS", true); + var peg$e323 = peg$literalExpectation("TIMESTAMP", true); + var peg$e324 = peg$literalExpectation("TRUNCATE", true); + var peg$e325 = peg$literalExpectation("USER", true); + var peg$e326 = peg$literalExpectation("CURRENT_DATE", true); + var peg$e327 = peg$literalExpectation("ADDDATE", true); + var peg$e328 = peg$literalExpectation("INTERVAL", true); + var peg$e329 = peg$literalExpectation("CURRENT_TIME", true); + var peg$e330 = peg$literalExpectation("CURRENT_TIMESTAMP", true); + var peg$e331 = peg$literalExpectation("CURRENT_USER", true); + var peg$e332 = peg$literalExpectation("SESSION_USER", true); + var peg$e333 = peg$literalExpectation("SYSTEM_USER", true); + var peg$e334 = peg$literalExpectation("GLOBAL", true); + var peg$e335 = peg$literalExpectation("SESSION", true); + var peg$e336 = peg$literalExpectation("PERSIST", true); + var peg$e337 = peg$literalExpectation("PERSIST_ONLY", true); + var peg$e338 = peg$literalExpectation("VIEW", true); + var peg$e339 = peg$literalExpectation("GEOMETRY", true); + var peg$e340 = peg$literalExpectation("POINT", true); + var peg$e341 = peg$literalExpectation("LINESTRING", true); + var peg$e342 = peg$literalExpectation("POLYGON", true); + var peg$e343 = peg$literalExpectation("MULTIPOINT", true); + var peg$e344 = peg$literalExpectation("MULTILINESTRING", true); + var peg$e345 = peg$literalExpectation("MULTIPOLYGON", true); + var peg$e346 = peg$literalExpectation("GEOMETRYCOLLECTION", true); + var peg$e347 = peg$literalExpectation("@@", false); + var peg$e348 = peg$literalExpectation("$", false); + var peg$e349 = peg$literalExpectation("return", true); + var peg$e350 = peg$literalExpectation(":=", false); + var peg$e351 = peg$literalExpectation("DUAL", true); + var peg$e352 = peg$literalExpectation("ADD", true); + var peg$e353 = peg$literalExpectation("COLUMN", true); + var peg$e354 = peg$literalExpectation("INDEX", true); + var peg$e355 = peg$literalExpectation("FULLTEXT", true); + var peg$e356 = peg$literalExpectation("SPATIAL", true); + var peg$e357 = peg$literalExpectation("COMMENT", true); + var peg$e358 = peg$literalExpectation("CONSTRAINT", true); + var peg$e359 = peg$literalExpectation("REFERENCES", true); + var peg$e360 = peg$literalExpectation("SQL_CALC_FOUND_ROWS", true); + var peg$e361 = peg$literalExpectation("SQL_CACHE", true); + var peg$e362 = peg$literalExpectation("SQL_NO_CACHE", true); + var peg$e363 = peg$literalExpectation("SQL_SMALL_RESULT", true); + var peg$e364 = peg$literalExpectation("SQL_BIG_RESULT", true); + var peg$e365 = peg$literalExpectation("SQL_BUFFER_RESULT", true); + var peg$e366 = peg$literalExpectation(",", false); + var peg$e367 = peg$literalExpectation("[", false); + var peg$e368 = peg$literalExpectation("]", false); + var peg$e369 = peg$literalExpectation(";", false); + var peg$e370 = peg$literalExpectation("->", false); + var peg$e371 = peg$literalExpectation("->>", false); + var peg$e372 = peg$literalExpectation("&&", false); + var peg$e373 = peg$literalExpectation("XOR", true); + var peg$e374 = peg$literalExpectation("/*", false); + var peg$e375 = peg$literalExpectation("*/", false); + var peg$e376 = peg$literalExpectation("--", false); + var peg$e377 = peg$literalExpectation("#", false); + var peg$e378 = peg$anyExpectation(); + var peg$e379 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false); + var peg$e380 = peg$literalExpectation("boolean", true); + var peg$e381 = peg$literalExpectation("blob", true); + var peg$e382 = peg$literalExpectation("tinyblob", true); + var peg$e383 = peg$literalExpectation("mediumblob", true); + var peg$e384 = peg$literalExpectation("longblob", true); + var peg$e385 = peg$classExpectation([["0", "6"]], false, false); + + var peg$f0 = function(head, tail) { + if (!tail || tail.length === 0) return head + delete head.tableList + delete head.columnList + let cur = head + for (let i = 0; i < tail.length; i++) { + delete tail[i][3].tableList + delete tail[i][3].columnList + cur.go_next = tail[i][3] + cur.go = 'go' + cur = cur.go_next + } + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: head + } + }; + var peg$f1 = function(n) { + return n + }; + var peg$f2 = function(head, tail) { + const cur = [head && head.ast || head]; + for (let i = 0; i < tail.length; i++) { + if(!tail[i][3] || tail[i][3].length === 0) continue; + cur.push(tail[i][3] && tail[i][3].ast || tail[i][3]); + } + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: cur + } + }; + var peg$f3 = function() { return 'union all' }; + var peg$f4 = function() { return 'union' }; + var peg$f5 = function() { return 'minus' }; + var peg$f6 = function() { return 'intersect' }; + var peg$f7 = function(head, tail, ob, l) { + let cur = head + for (let i = 0; i < tail.length; i++) { + cur._next = tail[i][3] + cur.set_op = tail[i][1] + cur = cur._next + } + if(ob) head._orderby = ob + if(l) head._limit = l + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: head + } + }; + var peg$f8 = function(head, tail) { + return createList(head, tail) + }; + var peg$f9 = function(c, o) { return { + column: c, + order: o && o.toLowerCase() || 'asc', + } + }; + var peg$f10 = function(c, o) { + return { + column: c, + order: o && o.toLowerCase() || 'asc', + } + }; + var peg$f11 = function(head, tail) { + return createList(head, tail, 1) + }; + var peg$f12 = function() { + return 'IF NOT EXISTS' + }; + var peg$f13 = function(a, k, ife, t, c) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a[0].toLowerCase(), + keyword: 'database', + if_not_exists: ife, + database: t, + create_definitions: c, + } + } + }; + var peg$f14 = function(c) { + return `with ${c.toLowerCase()} check option` + }; + var peg$f15 = function() { + return 'with check option' + }; + var peg$f16 = function(a, or, al, df, ss, v, c, s, w) { + v.view = v.table + delete v.table + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a[0].toLowerCase(), + keyword: 'view', + replace: or && 'or replace', + algorithm: al && al[4], + definer: df, + sql_security: ss && ss[4], + columns: c && c[2], + select: s, + view: v, + with: w, + } + } + }; + var peg$f17 = function(a, kw, t, n, um, on, ta, cols, io, al, lo) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a[0].toLowerCase(), + index_type: kw && kw.toLowerCase(), + keyword: t.toLowerCase(), + index: n, + on_kw: on[0].toLowerCase(), + table: ta, + index_columns: cols, + index_using: um, + index_options: io, + algorithm_option: al, + lock_option: lo, + } + } + }; + var peg$f18 = function(a, tp, ife, t, lt) { + if(t) tableList.add(`create::${t.db}::${t.table}`) + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a[0].toLowerCase(), + keyword: 'table', + temporary: tp && tp[0].toLowerCase(), + if_not_exists: ife, + table: [t], + like: lt + } + } + }; + var peg$f19 = function(a, tp, ife, t, c, to, ir, as, qe) { + if(t) tableList.add(`create::${t.db}::${t.table}`) + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a[0].toLowerCase(), + keyword: 'table', + temporary: tp && tp[0].toLowerCase(), + if_not_exists: ife, + table: [t], + ignore_replace: ir && ir[0].toLowerCase(), + as: as && as[0].toLowerCase(), + query_expr: qe && qe.ast, + create_definitions: c, + table_options: to + } + } + }; + var peg$f20 = function(t) { + return { + type: 'like', + table: t + } + }; + var peg$f21 = function(e) { + e.parentheses = true; + return e; + }; + var peg$f22 = function(head, tail) { + return createList(head, tail); + }; + var peg$f23 = function(n) { + if (n && !n.value) n.value = 'null' + return { nullable: n } + }; + var peg$f24 = function(d) { + return { default_val: d } + }; + var peg$f25 = function(a) { + return { auto_increment: a.toLowerCase() } + }; + var peg$f26 = function(u) { + const unique_or_primary = [] + if (u) unique_or_primary.push(u[0], u[2]) + return { unique_or_primary: unique_or_primary.filter(v => v).join(' ').toLowerCase('') } + }; + var peg$f27 = function(co) { + return { comment: co } + }; + var peg$f28 = function(ca) { + return { collate: ca } + }; + var peg$f29 = function(cf) { + return { column_format: cf } + }; + var peg$f30 = function(s) { + return { storage: s } + }; + var peg$f31 = function(re) { + return { reference_definition: re } + }; + var peg$f32 = function(ck) { + return { check: ck } + }; + var peg$f33 = function(t, s, v) { + return { character_set: { type: t, value: v, symbol: s }} + }; + var peg$f34 = function(g) { + return { generated: g } + }; + var peg$f35 = function(head, tail) { + let opt = head + for (let i = 0; i < tail.length; i++) { + opt = { ...opt, ...tail[i][1] } + } + return opt + }; + var peg$f36 = function(c, d, cdo) { + columnList.add(`create::${c.table}::${c.column}`) + return { + column: c, + definition: d, + resource: 'column', + ...(cdo || {}) + } + }; + var peg$f37 = function(u, h) { + const userNameSymbol = u.type === 'single_quote_string' ? '\'' : '"' + const hostSymbol = h.type === 'single_quote_string' ? '\'' : '"' + return `DEFINER = ${userNameSymbol}${u.value}${userNameSymbol}@${hostSymbol}${h.value}${hostSymbol}` + }; + var peg$f38 = function() { + return `DEFINER = CURRENT_USER()` + }; + var peg$f39 = function() { + return `DEFINER = CURRENT_USER` + }; + var peg$f40 = function(f, t) { + return { + keyword: f, + trigger: t + } + }; + var peg$f41 = function(s) { + return { + type: 'set', + trigger: s + } + }; + var peg$f42 = function(a, df, ife, t, tt, te, tb, tr, tbo) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a[0].toLowerCase(), + definer: df, + keyword: 'trigger', + for_each: 'for each row', + if_not_exists: ife, + trigger: t, + trigger_time: tt, + trigger_event: te[0], + trigger_order: tr, + table: tb, + trigger_body: tbo, + } + } + }; + var peg$f43 = function(s, ca) { + return { + type: 'collate', + symbol: s, + value: ca, + } + }; + var peg$f44 = function(k, f) { + return { + type: 'column_format', + value: f.toLowerCase() + } + }; + var peg$f45 = function(k, s) { + return { + type: 'storage', + value: s.toLowerCase() + } + }; + var peg$f46 = function(ce) { + return { + type: 'default', + value: ce + } + }; + var peg$f47 = function(ga) { + return ga.join('').toLowerCase() + }; + var peg$f48 = function(gn, expr, st) { + return { + type: 'generated', + expr: expr, + value: gn.filter(s => typeof s === 'string').join(' ').toLowerCase(), + storage_type: st && st[0] && st[0].toLowerCase() + } + }; + var peg$f49 = function(head, tail) { + return createList(head, tail, 1) + }; + var peg$f50 = function() { + return 'if exists' + }; + var peg$f51 = function(a, r, ife, t) { + if(t) t.forEach(tt => tableList.add(`${a}::${tt.db}::${tt.table}`)); + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a.toLowerCase(), + keyword: r.toLowerCase(), + prefix: ife, + name: t + } + }; + }; + var peg$f52 = function(a, r, ife, t, op) { + if(t) t.forEach(tt => tableList.add(`${a}::${tt.db}::${tt.table}`)); + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a.toLowerCase(), + keyword: r.toLowerCase(), + prefix: ife, + name: t, + options: [{ type: 'origin', value: op }], + } + }; + }; + var peg$f53 = function(a, r, i, t, op) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a.toLowerCase(), + keyword: r.toLowerCase(), + name: i, + table: t, + options: op + } + }; + }; + var peg$f54 = function(a, r, ife, t) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a.toLowerCase(), + keyword: r.toLowerCase(), + prefix: ife, + name: t + } + }; + }; + var peg$f55 = function(a, r, ife, t) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a.toLowerCase(), + keyword: r.toLowerCase(), + prefix: ife, + name: [{ + schema: t.db, + trigger: t.table + }] + } + }; + }; + var peg$f56 = function(a, kw, t) { + if(t) t.forEach(tt => tableList.add(`${a}::${tt.db}::${tt.table}`)); + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: a.toLowerCase(), + keyword: kw && kw.toLowerCase() || 'table', + name: t + } + }; + }; + var peg$f57 = function(d) { + tableList.add(`use::${d}::null`); + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'use', + db: d + } + }; + }; + var peg$f58 = function(t, e) { + tableList.add(`alter::${t.db}::${t.table}`) + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'alter', + table: [t], + expr: e + } + }; + }; + var peg$f59 = function(head, tail) { + return createList(head, tail); + }; + var peg$f60 = function(t) { + t.resource = t.keyword + t[t.keyword] = t.value + delete t.value + return { + type: 'alter', + ...t, + } + }; + var peg$f61 = function(kc, cd) { + return { + action: 'add', + ...cd, + keyword: kc, + resource: 'column', + type: 'alter', + } + }; + var peg$f62 = function(cd) { + return { + action: 'add', + ...cd, + resource: 'column', + type: 'alter', + } + }; + var peg$f63 = function(kc, c) { + return { + action: 'drop', + column: c, + keyword: kc, + resource: 'column', + type: 'alter', + } + }; + var peg$f64 = function(c) { + return { + action: 'drop', + column: c, + resource: 'column', + type: 'alter', + } + }; + var peg$f65 = function(id) { + return { + action: 'add', + type: 'alter', + ...id, + } + }; + var peg$f66 = function(kw, tn) { + return { + action: 'rename', + type: 'alter', + resource: 'table', + keyword: kw && kw[0].toLowerCase(), + table: tn + } + }; + var peg$f67 = function(c, kw, tn) { + return { + action: 'rename', + type: 'alter', + resource: 'column', + keyword: 'column', + old_column: c, + prefix: kw && kw[0].toLowerCase(), + column: tn + } + }; + var peg$f68 = function(s, val) { + return { + type: 'alter', + keyword: 'algorithm', + resource: 'algorithm', + symbol: s, + algorithm: val + } + }; + var peg$f69 = function(s, val) { + return { + type: 'alter', + keyword: 'lock', + resource: 'lock', + symbol: s, + lock: val + } + }; + var peg$f70 = function(kc, od, cd, fa) { + return { + action: 'change', + old_column: od, + ...cd, + keyword: kc, + resource: 'column', + type: 'alter', + first_after: fa && { + keyword: fa[0], + column: fa[2] + }, + } + }; + var peg$f71 = function(c) { + return { + action: 'add', + create_definitions: c, + resource: 'constraint', + type: 'alter', + } + }; + var peg$f72 = function() { + return { + action: 'drop', + key: '', + keyword: 'primary key', + resource: 'key', + type: 'alter', + } + }; + var peg$f73 = function(c) { + return { + action: 'drop', + key: c, + keyword: 'foreign key', + resource: 'key', + type: 'alter', + } + }; + var peg$f74 = function(kc, c) { + return { + action: 'drop', + constraint: c, + keyword: kc.toLowerCase(), + resource: 'constraint', + type: 'alter', + } + }; + var peg$f75 = function(c) { + return { + action: 'with', + constraint: c, + keyword: 'check check', + resource: 'constraint', + type: 'alter', + } + }; + var peg$f76 = function(c) { + return { + action: 'nocheck', + constraint: c, + resource: 'constraint', + type: 'alter', + } + }; + var peg$f77 = function(kc, c, t, de, id) { + return { + index: c, + definition: de, + keyword: kc.toLowerCase(), + index_type: t, + resource: 'index', + index_options: id, + } + }; + var peg$f78 = function(p, kc, c, de, id) { + return { + index: c, + definition: de, + keyword: kc && `${p.toLowerCase()} ${kc.toLowerCase()}` || p.toLowerCase(), + index_options: id, + resource: 'index', + } + }; + var peg$f79 = function(kc, c) { + return { + keyword: kc.toLowerCase(), + constraint: c + } + }; + var peg$f80 = function(kc, p, t, de, id) { + return { + constraint: kc && kc.constraint, + definition: de, + constraint_type: `${p[0].toLowerCase()} ${p[2].toLowerCase()}`, + keyword: kc && kc.keyword, + index_type: t, + resource: 'constraint', + index_options: id, + } + }; + var peg$f81 = function(kc, u, p, i, t, de, id) { + return { + constraint: kc && kc.constraint, + definition: de, + constraint_type: p && `${u.toLowerCase()} ${p.toLowerCase()}` || u.toLowerCase(), + keyword: kc && kc.keyword, + index_type: t, + index: i, + resource: 'constraint', + index_options: id + } + }; + var peg$f82 = function(kc, u, nfr, c) { + return { + constraint_type: u.toLowerCase(), + keyword: kc && kc.keyword, + constraint: kc && kc.constraint, + index_type: nfr && { keyword: 'not for replication' }, + definition: [c], + resource: 'constraint', + } + }; + var peg$f83 = function(kc, p, i, de, id) { + return { + constraint: kc && kc.constraint, + definition: de, + constraint_type: p, + keyword: kc && kc.keyword, + index: i, + resource: 'constraint', + reference_definition: id + } + }; + var peg$f84 = function(kc, u, c, ne) { + const enforced = [] + if (ne) enforced.push(ne[0], ne[2]) + return { + constraint_type: u.toLowerCase(), + keyword: kc && kc.keyword, + constraint: kc && kc.constraint, + definition: [c], + enforced: enforced.filter(v => v).join(' ').toLowerCase(), + resource: 'constraint', + } + }; + var peg$f85 = function(kc, t, de, m, od, ou) { + return { + definition: de, + table: t, + keyword: kc.toLowerCase(), + match: m && m.toLowerCase(), + on_action: [od, ou].filter(v => v) + } + }; + var peg$f86 = function(oa) { + return { + on_action: [oa] + } + }; + var peg$f87 = function(kw, ro) { + // => { type: 'on delete' | 'on update'; value: reference_option; } + return { + type: `on ${kw[0].toLowerCase()}`, + value: ro + } + }; + var peg$f88 = function(kc) { + return kc.toLowerCase() + }; + var peg$f89 = function(kc) { + return kc.toLowerCase() + }; + var peg$f90 = function(head, tail) { + return createList(head, tail) + }; + var peg$f91 = function() { + return 'CHARACTER SET' + }; + var peg$f92 = function(kw, t, s, v) { + return { + keyword: kw && `${kw[0].toLowerCase()} ${t.toLowerCase()}` || t.toLowerCase(), + symbol: s, + value: v + } + }; + var peg$f93 = function(kw, s, v) { + return { + keyword: kw.toLowerCase(), + symbol: s, + value: v.value + } + }; + var peg$f94 = function(kw, s, c) { + return { + keyword: kw.toLowerCase(), + symbol: s, + value: `'${c.value}'` + } + }; + var peg$f95 = function(kw, s, v) { + return { + keyword: kw.toLowerCase(), + symbol: s, + value: v.join('').toUpperCase() + } + }; + var peg$f96 = function(kw, s, c) { + return { + keyword: kw.toLowerCase(), + symbol: s, + value: c.toUpperCase() + } + }; + var peg$f97 = function(kw, s, c) { + return { + keyword: kw.toLowerCase(), + symbol: s, + value: c.toUpperCase() + } + }; + var peg$f98 = function(fsid) { + return { + action: 'add', + type: 'alter', + ...fsid, + } + }; + var peg$f99 = function(t) { + t.forEach(tg => tg.forEach(dt => dt.table && tableList.add(`rename::${dt.db}::${dt.table}`))) + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'rename', + table: t + } + }; + }; + var peg$f100 = function(kw, a) { + a.keyword = kw + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'set', + expr: a + } + } + }; + var peg$f101 = function() { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'unlock', + keyword: 'tables' + } + } + }; + var peg$f102 = function(s) { + return { + type: 'read', + suffix: s && 'local' + } + }; + var peg$f103 = function(p) { + return { + type: 'write', + prefix: p && 'low_priority' + } + }; + var peg$f104 = function(t, lt) { + tableList.add(`lock::${t.db}::${t.table}`) + return { + table: t, + lock_type: lt + } + }; + var peg$f105 = function(head, tail) { + return createList(head, tail); + }; + var peg$f106 = function(ltl) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'lock', + keyword: 'tables', + tables: ltl + } + } + }; + var peg$f107 = function(e) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'call', + expr: e + } + } + }; + var peg$f108 = function(t) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'show', + suffix: 'logs', + keyword: t.toLowerCase() + } + } + }; + var peg$f109 = function(keyword) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'show', + keyword: keyword.toLowerCase() + } + } + }; + var peg$f110 = function(keyword) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'show', + keyword: keyword.toLowerCase(), + suffix: 'status', + } + } + }; + var peg$f111 = function(ins, from, limit) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'show', + suffix: 'events', + keyword: 'binlog', + in: ins, + from, + limit, + } + } + }; + var peg$f112 = function(k, e) { + let keyword = Array.isArray(k) && k || [k] + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'show', + suffix: keyword[2] && keyword[2].toLowerCase(), + keyword: keyword[0].toLowerCase(), + expr: e + } + } + }; + var peg$f113 = function(keyword, from) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'show', + keyword: keyword.toLowerCase(), + from + } + }; + }; + var peg$f114 = function(k, t) { + const suffix = k.toLowerCase() + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'show', + keyword: 'create', + suffix, + [suffix]: t + } + }; + }; + var peg$f115 = function(f) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'show', + keyword: 'grants', + for: f, + } + } + }; + var peg$f116 = function(n, h, u) { + return { + user: n, + host: h && h[2], + role_list: u + } + }; + var peg$f117 = function(l) { + return l + }; + var peg$f118 = function(head, tail) { + return createList(head, tail); + }; + var peg$f119 = function(t) { + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: 'desc', + table: t + } + }; + }; + var peg$f120 = function(s) { + return { + ...s[2], + parentheses_symbol: true, + } + }; + var peg$f121 = function(head, tail) { + return createList(head, tail); + }; + var peg$f122 = function(cte) { + cte.recursive = true; + return [cte] + }; + var peg$f123 = function(name, columns, stmt) { + if (typeof name === 'string') name = { type: 'default', value: name } + if (name.table) name = { type: 'default', value: name.table } + return { name, stmt, columns }; + }; + var peg$f124 = function(l) { + return l + }; + var peg$f125 = function(col, l, ob) { + return { + type: 'column_ref', + column: col, + suffix: `(${parseInt(l.join(''), 10)})`, + order_by: ob + }; + }; + var peg$f126 = function(col, ob) { + return { + type: 'column_ref', + column: col, + order_by: ob + }; + }; + var peg$f127 = function(head, tail) { + return createList(head, tail); + }; + var peg$f128 = function(l) { + return l + }; + var peg$f129 = function(fu) { + return `${fu[0]} ${fu[2][0]}` + }; + var peg$f130 = function(m) { + return `${m[0]} ${m[2]} ${m[4]} ${m[6]}` + }; + var peg$f131 = function(w) { return `${w[0]} ${w[2].value}` }; + var peg$f132 = function(sl) { return `${sl[0]} ${sl[2]}` }; + var peg$f133 = function(t, lo) { + return t + (lo ? ` ${lo}` : '') + }; + var peg$f134 = function(cte, opts, d, c, ci, f, fi, w, g, h, o, l, lr, win, li) { + if ((ci && fi) || (ci && li) || (fi && li) || (ci && fi && li)) { + throw new Error('A given SQL statement can contain at most one INTO clause') + } + if(f) f.forEach(info => info.table && tableList.add(`select::${info.db}::${info.table}`)); + return { + with: cte, + type: 'select', + options: opts, + distinct: d, + columns: c, + into: { + ...(ci || fi || li || {}), + position: ci && 'column' || fi && 'from' || li && 'end' + }, + from: f, + where: w, + groupby: g, + having: h, + orderby: o, + limit: l, + locking_read: lr && lr, + window: win, + }; + }; + var peg$f135 = function(head, tail) { + const opts = [head]; + for (let i = 0, l = tail.length; i < l; ++i) { + opts.push(tail[i][1]); + } + return opts; + }; + var peg$f136 = function(option) { return option; }; + var peg$f137 = function(head, tail) { + columnList.add('select::null::(.*)'); + if (tail && tail.length > 0) { + head[0] = { + expr: { + type: 'column_ref', + table: null, + column: '*' + }, + as: null + }; + return createList(head[0], tail); + } + return head[0]; + }; + var peg$f138 = function(head, tail) { + return createList(head, tail); + }; + var peg$f139 = function() { + return { type: 'origin', value: 'IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION' } + }; + var peg$f140 = function() { + return { type: 'origin', value: 'IN NATURAL LANGUAGE MODE' } + }; + var peg$f141 = function() { + return { type: 'origin', value: 'IN BOOLEAN MODE' } + }; + var peg$f142 = function() { + return { type: 'origin', value: 'WITH QUERY EXPANSION' } + }; + var peg$f143 = function(c, e, mo, as) { + const expr = { + against: 'against', + columns: c, + expr: e, + match: 'match', + mode: mo, + type: 'fulltext_search', + as, + } + return expr + }; + var peg$f144 = function(fs) { + const { as, ...expr } = fs + return { expr, as } + }; + var peg$f145 = function(tbl) { + const table = tbl && tbl[0] || null + columnList.add(`select::${table}::(.*)`); + return { + expr: { + type: 'column_ref', + table: table, + column: '*' + }, + as: null + }; + }; + var peg$f146 = function(a) { + return { expr: a, as: null } + }; + var peg$f147 = function(e, alias) { + return { expr: e, as: alias }; + }; + var peg$f148 = function(i) { return i; }; + var peg$f149 = function(i) { return i; }; + var peg$f150 = function(v) { + return { + keyword: 'var', + type: 'into', + expr: v + } + }; + var peg$f151 = function(k, f) { + return { + keyword: k, + type: 'into', + expr: f + } + }; + var peg$f152 = function(l) { return l; }; + var peg$f153 = function(head, tail) { + return createList(head, tail); + }; + var peg$f154 = function(head, tail) { + return [head, tail] + }; + var peg$f155 = function(t) { + return { + keyword: 'using', + type: t.toLowerCase(), + } + }; + var peg$f156 = function(head, tail) { + const result = [head]; + for (let i = 0; i < tail.length; i++) { + result.push(tail[i][1]); + } + return result; + }; + var peg$f157 = function(k, e, kbs) { + return { + type: k.toLowerCase(), + symbol: e, + expr: kbs + }; + }; + var peg$f158 = function(pn) { + return { + type: 'with parser', + expr: pn + } + }; + var peg$f159 = function(k) { + return { + type: k.toLowerCase(), + expr: k.toLowerCase() + } + }; + var peg$f160 = function(head, tail) { + tail.unshift(head); + tail.forEach(tableInfo => { + const { table, as } = tableInfo + tableAlias[table] = table + if (as) tableAlias[as] = table + refreshColumnList(columnList) + }) + return tail; + }; + var peg$f161 = function(t) { return t; }; + var peg$f162 = function(t) { return t; }; + var peg$f163 = function(op, t, head, tail) { + t.join = op; + t.using = createList(head, tail); + return t; + }; + var peg$f164 = function(op, t, expr) { + t.join = op; + t.on = expr; + return t; + }; + var peg$f165 = function(op, stmt, alias, expr) { + stmt.parentheses = true; + return { + expr: stmt, + as: alias, + join: op, + on: expr + }; + }; + var peg$f166 = function() { + return { + type: 'dual' + }; + }; + var peg$f167 = function(t, alias) { + if (t.type === 'var') { + t.as = alias; + return t; + } + return { + db: t.db, + table: t.table, + as: alias, + }; + }; + var peg$f168 = function(t, r, alias) { + const parentheses = true + if (t.type === 'var') { + t.as = alias; + t.parentheses = parentheses + return t; + } + return { + db: t.db, + table: t.table, + as: alias, + parentheses, + }; + }; + var peg$f169 = function(stmt, alias) { + return { + expr: { type: 'values', values: stmt, prefix: 'row' }, + as: alias + }; + }; + var peg$f170 = function(stmt, alias) { + if (Array.isArray(stmt)) stmt = { type: 'values', values: stmt, prefix: 'row' } + stmt.parentheses = true; + return { + expr: stmt, + as: alias + }; + }; + var peg$f171 = function() { return 'LEFT JOIN'; }; + var peg$f172 = function() { return 'RIGHT JOIN'; }; + var peg$f173 = function() { return 'FULL JOIN'; }; + var peg$f174 = function() { return 'CROSS JOIN'; }; + var peg$f175 = function() { return 'INNER JOIN'; }; + var peg$f176 = function(dt, tail) { + const obj = { db: null, table: dt }; + if (tail !== null) { + obj.db = dt; + obj.table = tail[3]; + } + return obj; + }; + var peg$f177 = function(v) { + v.db = null; + v.table = v.name; + return v; + }; + var peg$f178 = function(e) { return e; }; + var peg$f179 = function(e) { return e; }; + var peg$f180 = function(e) { return e.value; }; + var peg$f181 = function(head, tail) { + return createList(head, tail); + }; + var peg$f182 = function(e) { return e; }; + var peg$f183 = function(bc) { return bc; }; + var peg$f184 = function(l) { return l; }; + var peg$f185 = function(head, tail) { + return createList(head, tail); + }; + var peg$f186 = function(e, d) { + const obj = { expr: e, type: 'ASC' }; + if (d === 'DESC') obj.type = 'DESC'; + return obj; + }; + var peg$f187 = function() { + return { + type: 'origin', + value: '?' + } + }; + var peg$f188 = function(i1, tail) { + const res = [i1]; + if (tail) res.push(tail[2]); + return { + seperator: tail && tail[0] && tail[0].toLowerCase() || '', + value: res + }; + }; + var peg$f189 = function(cte, t, l, w, or, lc) { + const dbObj = {} + if (t) t.forEach(tableInfo => { + const { db, as, table, join } = tableInfo + const action = join ? 'select' : 'update' + if (db) dbObj[table] = db + if (table) tableList.add(`${action}::${db}::${table}`) + }); + if(l) { + l.forEach(col => { + if (col.table) { + const table = queryTableAlias(col.table) + tableList.add(`update::${dbObj[table] || null}::${table}`) + } + columnList.add(`update::${col.table}::${col.column}`) + }); + } + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + with: cte, + type: 'update', + table: t, + set: l, + where: w, + orderby: or, + limit: lc, + } + }; + }; + var peg$f190 = function(cte, t, f, w, or, l) { + if(f) f.forEach(tableInfo => { + const { db, as, table, join } = tableInfo + const action = join ? 'select' : 'delete' + if (table) tableList.add(`${action}::${db}::${table}`) + if (!join) columnList.add(`delete::${table}::(.*)`); + }); + if (t === null && f.length === 1) { + const tableInfo = f[0] + t = [{ + db: tableInfo.db, + table: tableInfo.table, + as: tableInfo.as, + addition: true + }] + } + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + with: cte, + type: 'delete', + table: t, + from: f, + where: w, + orderby: or, + limit: l, + } + }; + }; + var peg$f191 = function(head, tail) { + return createList(head, tail); + }; + var peg$f192 = function(tbl, c, v) { + return { column: c, value: v, table: tbl && tbl[0] }; + }; + var peg$f193 = function(head, tail) { + return createList(head, tail) + }; + var peg$f194 = function(v) { + return v + }; + var peg$f195 = function(ri, ig, it, t, p, c, v, odp) { + if (t) { + tableList.add(`insert::${t.db}::${t.table}`) + t.as = null + } + if (c) { + let table = t && t.table || null + if(Array.isArray(v)) { + v.forEach((row, idx) => { + if(row.value.length != c.length) { + throw new Error(`Error: column count doesn't match value count at row ${idx+1}`) + } + }) + } + c.forEach(c => columnList.add(`insert::${table}::${c}`)); + } + const prefix = [ig, it].filter(v => v).map(v => v[0] && v[0].toLowerCase()).join(' ') + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: ri, + table: [t], + columns: c, + values: v, + partition: p, + prefix, + on_duplicate_update: odp, + } + }; + }; + var peg$f196 = function(ri, ig, it, t, p, v, odp) { + if (t) { + tableList.add(`insert::${t.db}::${t.table}`) + columnList.add(`insert::${t.table}::(.*)`); + t.as = null + } + const prefix = [ig, it].filter(v => v).map(v => v[0] && v[0].toLowerCase()).join(' ') + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: ri, + table: [t], + columns: null, + values: v, + partition: p, + prefix, + on_duplicate_update: odp, + } + }; + }; + var peg$f197 = function(ri, it, t, p, l, odp) { + if (t) { + tableList.add(`insert::${t.db}::${t.table}`) + columnList.add(`insert::${t.table}::(.*)`); + t.as = null + } + return { + tableList: Array.from(tableList), + columnList: columnListTableAlias(columnList), + ast: { + type: ri, + table: [t], + columns: null, + partition: p, + prefix: it === null ? '' : it[0], + set: l, + on_duplicate_update: odp, + } + }; + }; + var peg$f198 = function(s) { + return { + keyword: 'on duplicate key update', + set: s + } + }; + var peg$f199 = function() { return 'insert'; }; + var peg$f200 = function() { return 'replace'; }; + var peg$f201 = function(l) { return l; }; + var peg$f202 = function(head, tail) { + return createList(head, tail); + }; + var peg$f203 = function(l) { + return l; + }; + var peg$f204 = function(head, tail) { + const el = { type: 'expr_list' }; + el.value = createList(head, tail); + return el; + }; + var peg$f205 = function(e, u) { + return { + type: 'interval', + expr: e, + unit: u.toLowerCase(), + } + }; + var peg$f206 = function(condition_list, otherwise) { + if (otherwise) condition_list.push(otherwise); + return { + type: 'case', + expr: null, + args: condition_list + }; + }; + var peg$f207 = function(expr, condition_list, otherwise) { + if (otherwise) condition_list.push(otherwise); + return { + type: 'case', + expr: expr, + args: condition_list + }; + }; + var peg$f208 = function(head, tail) { + return createList(head, tail, 1) + }; + var peg$f209 = function(condition, result) { + return { + type: 'when', + cond: condition, + result: result + }; + }; + var peg$f210 = function(result) { + return { type: 'else', result: result }; + }; + var peg$f211 = function(head, tail, rh) { + const logicExpr = createBinaryExprChain(head, tail) + if (rh === null) return logicExpr + else if (rh.type === 'arithmetic') return createBinaryExprChain(logicExpr, rh.tail) + else return createBinaryExpr(rh.op, logicExpr, rh.right) + }; + var peg$f212 = function(op, tail) { + return createUnaryExpr(op, tail[0][1]); + }; + var peg$f213 = function(head, tail) { + const len = tail.length + let result = tail[len - 1][3] + for (let i = len - 1; i >= 0; i--) { + const left = i === 0 ? head : tail[i - 1][3] + result = createBinaryExpr(tail[i][1], left, result) + } + return result + }; + var peg$f214 = function(head, tail) { + const len = tail.length + let result = head; + let seperator = '' + for (let i = 0; i < len; ++i) { + if (tail[i][1] === ',') { + seperator = ',' + if (!Array.isArray(result)) result = [result] + result.push(tail[i][3]) + } else { + result = createBinaryExpr(tail[i][1], result, tail[i][3]); + } + } + if (seperator === ',') { + const el = { type: 'expr_list' } + el.value = result + return el + } + return result + }; + var peg$f215 = function(head, tail) { + return createBinaryExprChain(head, tail); + }; + var peg$f216 = function(head, tail) { + return createBinaryExprChain(head, tail); + }; + var peg$f217 = function(expr) { + return createUnaryExpr('NOT', expr); + }; + var peg$f218 = function(left, rh) { + if (rh === null) return left; + else if (rh.type === 'arithmetic') return createBinaryExprChain(left, rh.tail); + else return createBinaryExpr(rh.op, left, rh.right); + }; + var peg$f219 = function(op, stmt) { + stmt.parentheses = true; + return createUnaryExpr(op, stmt); + }; + var peg$f220 = function(nk) { return nk[0] + ' ' + nk[2]; }; + var peg$f221 = function(l) { + return { type: 'arithmetic', tail: l }; + }; + var peg$f222 = function(right) { + return { op: 'IS', right: right }; + }; + var peg$f223 = function(right) { + return { op: 'IS NOT', right: right }; + }; + var peg$f224 = function(op, begin, end) { + return { + op: op, + right: { + type: 'expr_list', + value: [begin, end] + } + }; + }; + var peg$f225 = function(nk) { return nk[0] + ' ' + nk[2]; }; + var peg$f226 = function(nk) { return nk[0] + ' ' + nk[2]; }; + var peg$f227 = function(n, k) { + return n ? `${n} ${k}` : k + }; + var peg$f228 = function(nk) { return nk[0] + ' ' + nk[2]; }; + var peg$f229 = function(op, b, e) { + return { op: b ? `${op} ${b}` : op, right: e }; + }; + var peg$f230 = function(op, right) { + return { op: op, right: right }; + }; + var peg$f231 = function(op, l) { + return { op: op, right: l }; + }; + var peg$f232 = function(op, e) { + return { op: op, right: e }; + }; + var peg$f233 = function(head, tail) { + return createBinaryExprChain(head, tail); + }; + var peg$f234 = function(head, tail) { + return createBinaryExprChain(head, tail) + }; + var peg$f235 = function() { + return 'DIV' + }; + var peg$f236 = function(list) { + list.parentheses = true; + return list; + }; + var peg$f237 = function(prepared_symbol) { + return { + type: 'origin', + value: prepared_symbol + } + }; + var peg$f238 = function(tbl, col, a, ca) { + const tableName = tbl && tbl[0] || null + columnList.add(`select::${tableName}::${col}`); + return { + type: 'column_ref', + table: tableName, + column: col, + collate: ca, + arrows: a.map(item => item[0]), + properties: a.map(item => item[2]) + }; + }; + var peg$f239 = function(tbl, col) { + columnList.add(`select::${tbl}::${col}`); + return { + type: 'column_ref', + table: tbl, + column: col + }; + }; + var peg$f240 = function(col) { + columnList.add(`select::null::${col}`); + return { + type: 'column_ref', + table: null, + column: col + }; + }; + var peg$f241 = function(head, tail) { + return createList(head, tail); + }; + var peg$f242 = function(name) { return reservedMap[name.toUpperCase()] === true; }; + var peg$f243 = function(name) { + return name; + }; + var peg$f244 = function(name) { + if (reservedMap[name.toUpperCase()] === true) throw new Error("Error: "+ JSON.stringify(name)+" is a reserved word, can not as alias clause"); + return false + }; + var peg$f245 = function(name) { + return name; + }; + var peg$f246 = function(name) { + return name; + }; + var peg$f247 = function(chars) { return chars.join(''); }; + var peg$f248 = function(chars) { return chars.join(''); }; + var peg$f249 = function(chars) { return chars.join(''); }; + var peg$f250 = function(name) { + return name; + }; + var peg$f251 = function(name) { return reservedMap[name.toUpperCase()] === true; }; + var peg$f252 = function(name) { return name; }; + var peg$f253 = function(start, parts) { return start + parts.join(''); }; + var peg$f254 = function(start, parts) { return start + parts.join(''); }; + var peg$f255 = function(l) { + return { type: 'param', value: l[1] }; + }; + var peg$f256 = function(name, e, bc) { + return { + type: 'aggr_func', + name: name, + args: { + expr: e + }, + over: bc, + }; + }; + var peg$f257 = function(kw, l) { + return { + type: 'on update', + keyword: kw, + parentheses: true, + expr: l + } + }; + var peg$f258 = function(kw) { + return { + type: 'on update', + keyword: kw, + } + }; + var peg$f259 = function(aws) { + return { + type: 'window', + as_window_specification: aws, + } + }; + var peg$f260 = function(l) { + // => { keyword: 'window'; type: 'window', expr: named_window_expr_list; } + return { + keyword: 'window', + type: 'window', + expr: l, + } + }; + var peg$f261 = function(head, tail) { + // => named_window_expr[] + return createList(head, tail); + }; + var peg$f262 = function(nw, anw) { + // => { name: ident_name; as_window_specification: as_window_specification; } + return { + name: nw, + as_window_specification: anw, + } + }; + var peg$f263 = function(ws) { + return { + window_specification: ws || {}, + parentheses: true + } + }; + var peg$f264 = function(bc, l, w) { + return { + name: null, + partitionby: bc, + orderby: l, + window_frame_clause: w, + } + }; + var peg$f265 = function(bc, l) { + return { + name: null, + partitionby: bc, + orderby: l, + window_frame_clause: null + } + }; + var peg$f266 = function(kw, s) { + // => string + return `rows ${s.value}` + }; + var peg$f267 = function(p, f) { + // => string + return `rows between ${p.value} and ${f.value}` + }; + var peg$f268 = function(s) { + // => string + s.value += ' FOLLOWING' + return s + }; + var peg$f269 = function(s) { + // => string + s.value += ' PRECEDING' + return s + }; + var peg$f270 = function() { + return { type: 'single_quote_string', value: 'current row' } + }; + var peg$f271 = function(s) { + return { type: 'single_quote_string', value: s.toUpperCase() } + }; + var peg$f272 = function(name, arg, bc) { + return { + type: 'aggr_func', + name: name, + args: arg, + over: bc + }; + }; + var peg$f273 = function(kw, s) { + return { + keyword: kw, + value: s + } + }; + var peg$f274 = function(e) { return { expr: e }; }; + var peg$f275 = function(d, c, or, s) { return { distinct: d, expr: c, orderby: or, parentheses: true, separator: s }; }; + var peg$f276 = function(d, c, or, s) { return { distinct: d, expr: c, orderby: or, separator: s }; }; + var peg$f277 = function() { return { type: 'star', value: '*' }; }; + var peg$f278 = function(c, ch, cs, v) { + const { dataType, length } = ch + let dataTypeStr = dataType + if (length !== undefined) dataTypeStr = `${dataTypeStr}(${length})` + return { + type: 'expr_list', + value: [ + c, + { + type: 'origin', + value: `${dataTypeStr} ${cs} ${v}` + } + ] + } + }; + var peg$f279 = function(c, d) { + return { + type: 'expr_list', + value: [c, { type: 'datatype', ...d, }] + } + }; + var peg$f280 = function(c, d) { + c.suffix = `USING ${d}` + return { + type: 'expr_list', + value: [c] + } + }; + var peg$f281 = function(f) { + return f + }; + var peg$f282 = function(kw, f, t, s) { + return { + type: kw.toLowerCase(), + args: { + field: f, + cast_type: t, + source: s, + } + } + }; + var peg$f283 = function(kw, f, s) { + return { + type: kw.toLowerCase(), + args: { + field: f, + source: s, + } + } + }; + var peg$f284 = function(e, f) { + return { + type: 'function', + name: 'DATE_TRUNC', + args: { type: 'expr_list', value: [e, { type: 'origin', value: f }] }, + over: null, + }; + }; + var peg$f285 = function(p, rm, k) { + let value = [] + if (p) value.push({type: 'origin', value: p }) + if (rm) value.push(rm) + value.push({type: 'origin', value: 'from' }) + return { + type: 'expr_list', + value, + } + }; + var peg$f286 = function(tr, s) { + let args = tr || { type: 'expr_list', value: [] } + args.value.push(s) + return { + type: 'function', + name: 'TRIM', + args, + }; + }; + var peg$f287 = function(l, ca) { + return { + type: 'function', + name: 'CONVERT', + args: l, + collate: ca, + }; + }; + var peg$f288 = function(name, l, bc) { + if (l && l.type !== 'expr_list') l = { type: 'expr_list', value: [l] } + if ((name.toUpperCase() === 'TIMESTAMPDIFF' || name.toUpperCase() === 'TIMESTAMPADD') && l.value && l.value[0]) l.value[0] = { type: 'origin', value: l.value[0].column } + return { + type: 'function', + name: name, + args: l ? l: { type: 'expr_list', value: [] }, + over: bc + }; + }; + var peg$f289 = function(name, l, bc) { + return { + type: 'function', + name: name, + args: l ? l: { type: 'expr_list', value: [] }, + over: bc + }; + }; + var peg$f290 = function(f, up) { + return { + type: 'function', + name: f, + over: up + } + }; + var peg$f291 = function(c, e, ch, cs, v, ca) { + const { dataType, length } = ch + let dataTypeStr = dataType + if (length !== undefined) dataTypeStr = `${dataTypeStr}(${length})` + return { + type: 'cast', + keyword: c.toLowerCase(), + expr: e, + symbol: 'as', + target: { + dataType: `${dataTypeStr} ${cs} ${v.toUpperCase()}` + }, + collate: ca, + }; + }; + var peg$f292 = function(c, e, t) { + return { + type: 'cast', + keyword: c.toLowerCase(), + expr: e, + symbol: 'as', + target: t + }; + }; + var peg$f293 = function(c, e, precision) { + return { + type: 'cast', + keyword: c.toLowerCase(), + expr: e, + symbol: 'as', + target: { + dataType: 'DECIMAL(' + precision + ')' + } + }; + }; + var peg$f294 = function(c, e, precision, scale) { + return { + type: 'cast', + keyword: c.toLowerCase(), + expr: e, + symbol: 'as', + target: { + dataType: 'DECIMAL(' + precision + ', ' + scale + ')' + } + }; + }; + var peg$f295 = function(c, e, s, t) { /* MySQL cast to un-/signed integer */ + return { + type: 'cast', + keyword: c.toLowerCase(), + expr: e, + symbol: 'as', + target: { + dataType: s + (t ? ' ' + t: '') + } + }; + }; + var peg$f296 = function(b, s, ca) { + if (b) s.prefix = b.toLowerCase() + if (ca) s.suffix = { collate: ca[1] } + return s + }; + var peg$f297 = function(head, tail) { + return createList(head, tail); + }; + var peg$f298 = function() { + return { type: 'null', value: null }; + }; + var peg$f299 = function() { + return { + type: 'not null', + value: 'not null', + } + }; + var peg$f300 = function() { + return { type: 'bool', value: true }; + }; + var peg$f301 = function() { + return { type: 'bool', value: false }; + }; + var peg$f302 = function(b, r, ca) { + return { + type: 'hex_string', + prefix: b, + value: ca[1].join('') + }; + }; + var peg$f303 = function(b, r, ca) { + return { + type: 'bit_string', + prefix: b, + value: ca[1].join('') + }; + }; + var peg$f304 = function(b, r, ca) { + return { + type: 'full_hex_string', + prefix: b, + value: ca.join('') + }; + }; + var peg$f305 = function(r, ca) { + return { + type: 'natural_string', + value: ca[1].join('') + }; + }; + var peg$f306 = function(ca) { + return { + type: 'single_quote_string', + value: ca[1].join('') + }; + }; + var peg$f307 = function(ca) { + return { + type: 'string', + value: ca[1].join('') + }; + }; + var peg$f308 = function(type, ca) { + return { + type: type.toLowerCase(), + value: ca[1].join('') + }; + }; + var peg$f309 = function(type, ca) { + return { + type: type.toLowerCase(), + value: ca[1].join('') + }; + }; + var peg$f310 = function() { return "\\'"; }; + var peg$f311 = function() { return '\\"'; }; + var peg$f312 = function() { return "\\\\"; }; + var peg$f313 = function() { return "\\/"; }; + var peg$f314 = function() { return "\b"; }; + var peg$f315 = function() { return "\f"; }; + var peg$f316 = function() { return "\n"; }; + var peg$f317 = function() { return "\r"; }; + var peg$f318 = function() { return "\t"; }; + var peg$f319 = function(h1, h2, h3, h4) { + return String.fromCharCode(parseInt("0x" + h1 + h2 + h3 + h4)); + }; + var peg$f320 = function() { return "\\"; }; + var peg$f321 = function() { return "''" }; + var peg$f322 = function() { return '""' }; + var peg$f323 = function() { return '``' }; + var peg$f324 = function(n) { + if (n && n.type === 'bigint') return n + return { type: 'number', value: n }; + }; + var peg$f325 = function(int_, frac, exp) { + const numStr = int_ + frac + exp + return { + type: 'bigint', + value: numStr + } + }; + var peg$f326 = function(int_, frac) { + const numStr = int_ + frac + if (isBigInt(int_)) return { + type: 'bigint', + value: numStr + } + return parseFloat(numStr); + }; + var peg$f327 = function(int_, exp) { + const numStr = int_ + exp + return { + type: 'bigint', + value: numStr + } + }; + var peg$f328 = function(int_) { + if (isBigInt(int_)) return { + type: 'bigint', + value: int_ + } + return parseFloat(int_); + }; + var peg$f329 = function(op, digits) { return op + digits; }; + var peg$f330 = function(op, digit) { return op + digit; }; + var peg$f331 = function(digits) { return "." + digits; }; + var peg$f332 = function(e, digits) { return e + digits; }; + var peg$f333 = function(digits) { return digits.join(""); }; + var peg$f334 = function(e, sign) { return e + (sign !== null ? sign: ''); }; + var peg$f335 = function() { return 'DROP'; }; + var peg$f336 = function() { return 'PARTITION' }; + var peg$f337 = function() { return 'TABLE'; }; + var peg$f338 = function() { return 'TRIGGER'; }; + var peg$f339 = function() { return 'TABLES'; }; + var peg$f340 = function() { return 'DATABASE'; }; + var peg$f341 = function() { return 'SCHEMA'; }; + var peg$f342 = function() { return 'COLLATE'; }; + var peg$f343 = function() { return 'GO'; }; + var peg$f344 = function() { return 'OFFSET'; }; + var peg$f345 = function() { return 'ASC'; }; + var peg$f346 = function() { return 'DESC'; }; + var peg$f347 = function() { return 'DESCRIBE'; }; + var peg$f348 = function() { return 'ALL'; }; + var peg$f349 = function() { return 'DISTINCT';}; + var peg$f350 = function() { return 'BETWEEN'; }; + var peg$f351 = function() { return 'IN'; }; + var peg$f352 = function() { return 'IS'; }; + var peg$f353 = function() { return 'LIKE'; }; + var peg$f354 = function() { return 'RLIKE'; }; + var peg$f355 = function() { return 'REGEXP'; }; + var peg$f356 = function() { return 'EXISTS'; }; + var peg$f357 = function() { return 'NOT'; }; + var peg$f358 = function() { return 'AND'; }; + var peg$f359 = function() { return 'OR'; }; + var peg$f360 = function() { return 'COUNT'; }; + var peg$f361 = function() { return 'GROUP_CONCAT'; }; + var peg$f362 = function() { return 'MAX'; }; + var peg$f363 = function() { return 'MIN'; }; + var peg$f364 = function() { return 'SUM'; }; + var peg$f365 = function() { return 'AVG'; }; + var peg$f366 = function() { return 'EXTRACT'; }; + var peg$f367 = function() { return 'CALL'; }; + var peg$f368 = function() { return 'CAST' }; + var peg$f369 = function() { return 'BINARY'; }; + var peg$f370 = function() { return 'VARBINARY'; }; + var peg$f371 = function() { return 'BIT'; }; + var peg$f372 = function() { return 'CHAR'; }; + var peg$f373 = function() { return 'VARCHAR';}; + var peg$f374 = function() { return 'NUMERIC'; }; + var peg$f375 = function() { return 'DECIMAL'; }; + var peg$f376 = function() { return 'SIGNED'; }; + var peg$f377 = function() { return 'UNSIGNED'; }; + var peg$f378 = function() { return 'INT'; }; + var peg$f379 = function() { return 'ZEROFILL'; }; + var peg$f380 = function() { return 'INTEGER'; }; + var peg$f381 = function() { return 'JSON'; }; + var peg$f382 = function() { return 'SMALLINT'; }; + var peg$f383 = function() { return 'MEDIUMINT'; }; + var peg$f384 = function() { return 'TINYINT'; }; + var peg$f385 = function() { return 'TINYTEXT'; }; + var peg$f386 = function() { return 'TEXT'; }; + var peg$f387 = function() { return 'MEDIUMTEXT'; }; + var peg$f388 = function() { return 'LONGTEXT'; }; + var peg$f389 = function() { return 'BIGINT'; }; + var peg$f390 = function() { return 'ENUM'; }; + var peg$f391 = function() { return 'FLOAT'; }; + var peg$f392 = function() { return 'DOUBLE'; }; + var peg$f393 = function() { return 'DATE'; }; + var peg$f394 = function() { return 'DATETIME'; }; + var peg$f395 = function() { return 'ROWS'; }; + var peg$f396 = function() { return 'TIME'; }; + var peg$f397 = function() { return 'TIMESTAMP'; }; + var peg$f398 = function() { return 'YEAR'; }; + var peg$f399 = function() { return 'TRUNCATE'; }; + var peg$f400 = function() { return 'USER'; }; + var peg$f401 = function() { return 'CURRENT_DATE'; }; + var peg$f402 = function() { return 'ADDDATE'; }; + var peg$f403 = function() { return 'INTERVAL'; }; + var peg$f404 = function() { return 'YEAR'; }; + var peg$f405 = function() { return 'MONTH'; }; + var peg$f406 = function() { return 'WEEK'; }; + var peg$f407 = function() { return 'DAY'; }; + var peg$f408 = function() { return 'HOUR'; }; + var peg$f409 = function() { return 'MINUTE'; }; + var peg$f410 = function() { return 'SECOND'; }; + var peg$f411 = function() { return 'CURRENT_TIME'; }; + var peg$f412 = function() { return 'CURRENT_TIMESTAMP'; }; + var peg$f413 = function() { return 'CURRENT_USER'; }; + var peg$f414 = function() { return 'SESSION_USER'; }; + var peg$f415 = function() { return 'SYSTEM_USER'; }; + var peg$f416 = function() { return 'GLOBAL'; }; + var peg$f417 = function() { return 'SESSION'; }; + var peg$f418 = function() { return 'LOCAL'; }; + var peg$f419 = function() { return 'PERSIST'; }; + var peg$f420 = function() { return 'PERSIST_ONLY'; }; + var peg$f421 = function() { return 'VIEW'; }; + var peg$f422 = function() { return 'GEOMETRY'; }; + var peg$f423 = function() { return 'POINT'; }; + var peg$f424 = function() { return 'LINESTRING'; }; + var peg$f425 = function() { return 'POLYGON'; }; + var peg$f426 = function() { return 'MULTIPOINT'; }; + var peg$f427 = function() { return 'MULTILINESTRING'; }; + var peg$f428 = function() { return 'MULTIPOLYGON'; }; + var peg$f429 = function() { return 'GEOMETRYCOLLECTION'; }; + var peg$f430 = function() { return 'ADD'; }; + var peg$f431 = function() { return 'COLUMN'; }; + var peg$f432 = function() { return 'INDEX'; }; + var peg$f433 = function() { return 'KEY'; }; + var peg$f434 = function() { return 'FULLTEXT'; }; + var peg$f435 = function() { return 'SPATIAL'; }; + var peg$f436 = function() { return 'UNIQUE'; }; + var peg$f437 = function() { return 'KEY_BLOCK_SIZE'; }; + var peg$f438 = function() { return 'COMMENT'; }; + var peg$f439 = function() { return 'CONSTRAINT'; }; + var peg$f440 = function() { return 'REFERENCES'; }; + var peg$f441 = function() { return 'XOR' }; + var peg$f442 = function(k, s, c) { + return { + type: k.toLowerCase(), + keyword: k.toLowerCase(), + symbol: s, + value: c, + } + }; + var peg$f443 = function() { varList = []; return true; }; + var peg$f444 = function(s) { + return { stmt: s, vars: varList }; + }; + var peg$f445 = function(va, s, e) { + return { + type: 'assign', + left: va, + symbol: s, + right: e + }; + }; + var peg$f446 = function(e) { + return { type: 'return', expr: e }; + }; + var peg$f447 = function(head, tail) { + return createBinaryExprChain(head, tail); + }; + var peg$f448 = function(head, tail) { + return createBinaryExprChain(head, tail); + }; + var peg$f449 = function(lt, op, rt, expr) { + return { + type: 'join', + ltable: lt, + rtable: rt, + op: op, + on: expr + }; + }; + var peg$f450 = function(e) { + e.parentheses = true; + return e; + }; + var peg$f451 = function(dt, tail) { + let name = dt + if (tail !== null) { + name = `${dt}.${tail[3]}` + } + return name; + }; + var peg$f452 = function(n) { + const upperName = n.toUpperCase() + if (reservedMap[upperName] === true) return upperName + return n + }; + var peg$f453 = function(name, l) { + //compatible with original func_call + return { + type: 'function', + name: name, + args: { + type: 'expr_list', + value: l + } + }; + }; + var peg$f454 = function(name) { + return { + type: 'function', + name: name, + args: null + }; + }; + var peg$f455 = function(head, tail) { + return createList(head, tail); + }; + var peg$f456 = function(l) { + return { type: 'array', value: l }; + }; + var peg$f457 = function(head, tail) { + return createList(head, tail) + }; + var peg$f458 = function(p, d) { + return { + type: 'var', + ...d, + prefix: p + }; + }; + var peg$f459 = function(name, m) { + //push for analysis + varList.push(name); + return { + type: 'var', + name: name, + members: m, + prefix: null, + }; + }; + var peg$f460 = function(n) { + return { + type: 'var', + name: n.value, + members: [], + quoted: null, + prefix: null, + } + }; + var peg$f461 = function(l) { + const s = []; + for (let i = 0; i < l.length; i++) { + s.push(l[i][1]); + } + return s; + }; + var peg$f462 = function() { return { dataType: 'BOOLEAN' }; }; + var peg$f463 = function(b) { return { dataType: b.toUpperCase() }; }; + var peg$f464 = function(t, l) { + return { dataType: t, length: parseInt(l.join(''), 10) }; + }; + var peg$f465 = function(t) { return { dataType: t }; }; + var peg$f466 = function(t, l) { + return { dataType: t, length: parseInt(l.join(''), 10) }; + }; + var peg$f467 = function(t) { return { dataType: t }; }; + var peg$f468 = function(t) { return { dataType: t }; }; + var peg$f469 = function(un, ze) { + const result = [] + if (un) result.push(un) + if (ze) result.push(ze) + return result + }; + var peg$f470 = function(t, l, r, s) { return { dataType: t, length: parseInt(l.join(''), 10), scale: r && parseInt(r[2].join(''), 10), parentheses: true, suffix: s }; }; + var peg$f471 = function(t, l, s) { return { dataType: t, length: parseInt(l.join(''), 10), suffix: s }; }; + var peg$f472 = function(t, s) { return { dataType: t, suffix: s }; }; + var peg$f473 = function(t, l, s) { return { dataType: t, length: parseInt(l, 10), parentheses: true }; }; + var peg$f474 = function(t) { return { dataType: t }; }; + var peg$f475 = function(t, e) { + e.parentheses = true + return { + dataType: t, + expr: e + } + }; + var peg$f476 = function(t) { return { dataType: t }; }; + var peg$f477 = function(t) { return { dataType: t }}; + var peg$f478 = function(t) { return { dataType: t }}; + var peg$currPos = 0; + var peg$savedPos = 0; + var peg$posDetailsCache = [{ line: 1, column: 1 }]; + var peg$maxFailPos = 0; + var peg$maxFailExpected = []; + var peg$silentFails = 0; + + var 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 offset() { + return peg$savedPos; + } + + function range() { + return { + source: peg$source, + start: peg$savedPos, + end: peg$currPos + }; + } + + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); + } + + function expected(description, location) { + location = location !== undefined + ? 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 !== undefined + ? 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]; + var 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, offset) { + var startPosDetails = peg$computePosDetails(startPos); + var endPosDetails = peg$computePosDetails(endPos); + + var res = { + source: peg$source, + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + if (offset && peg$source && (typeof peg$source.offset === "function")) { + res.start = peg$source.offset(res.start); + res.end = peg$source.offset(res.end); + } + return res; + } + + 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, s4, s5, s6, s7, s8; + + s0 = peg$currPos; + s1 = peg$parsestart_item(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = []; + s4 = peg$currPos; + s5 = peg$parse__(); + s6 = peg$parseKW_GO(); + if (s6 !== peg$FAILED) { + s7 = peg$parse__(); + s8 = peg$parsestart_item(); + if (s8 !== peg$FAILED) { + s5 = [s5, s6, s7, s8]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + s5 = peg$parse__(); + s6 = peg$parseKW_GO(); + if (s6 !== peg$FAILED) { + s7 = peg$parse__(); + s8 = peg$parsestart_item(); + if (s8 !== peg$FAILED) { + s5 = [s5, s6, s7, s8]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f0(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsestart_item() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parse__(); + s2 = peg$parsemultiple_stmt(); + if (s2 === peg$FAILED) { + s2 = peg$parsecmd_stmt(); + if (s2 === peg$FAILED) { + s2 = peg$parsecrud_stmt(); + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f1(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecmd_stmt() { + var s0; + + s0 = peg$parsedrop_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parsetruncate_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parserename_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parsecall_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parseuse_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parsealter_table_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parseset_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parselock_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parseunlock_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parseshow_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parsedesc_stmt(); + } + } + } + } + } + } + } + } + } + } + } + + return s0; + } + + function peg$parsecreate_stmt() { + var s0; + + s0 = peg$parsecreate_table_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_trigger_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_index_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_db_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_view_stmt(); + } + } + } + } + + return s0; + } + + function peg$parsecrud_stmt() { + var s0; + + s0 = peg$parseset_op_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parseupdate_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parsereplace_insert_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parseinsert_no_columns_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parseinsert_into_set(); + if (s0 === peg$FAILED) { + s0 = peg$parsedelete_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parsecmd_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parseproc_stmts(); + } + } + } + } + } + } + } + + return s0; + } + + function peg$parsemultiple_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parsecrud_stmt(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseSEMICOLON(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecrud_stmt(); + 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; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseSEMICOLON(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecrud_stmt(); + 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 { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f2(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseset_op() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_UNION(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ALL(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f3(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_UNION(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f4(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_MINUS(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f5(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_INTERSECT(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f6(); + } + s0 = s1; + } + } + } + + return s0; + } + + function peg$parseset_op_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__(); + s5 = peg$parseset_op(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseselect_stmt(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseset_op(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseselect_stmt(); + 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; + } + } + s3 = peg$parse__(); + s4 = peg$parseorder_by_clause(); + if (s4 === peg$FAILED) { + s4 = null; + } + s5 = peg$parse__(); + s6 = peg$parselimit_clause(); + if (s6 === peg$FAILED) { + s6 = null; + } + peg$savedPos = s0; + s0 = peg$f7(s1, s2, s4, s6); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecolumn_order_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parsecolumn_order_item(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn_order_item(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn_order_item(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f8(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecolumn_order_item() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parseexpr(); + if (s1 !== peg$FAILED) { + s2 = peg$parseKW_ASC(); + if (s2 === peg$FAILED) { + s2 = peg$parseKW_DESC(); + } + if (s2 === peg$FAILED) { + s2 = null; + } + peg$savedPos = s0; + s0 = peg$f9(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parsecolumn_order(); + } + + return s0; + } + + function peg$parsecolumn_order() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsecolumn_ref(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASC(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_DESC(); + } + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f10(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecreate_db_definition() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parsecreate_option_character_set(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parsecreate_option_character_set(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parsecreate_option_character_set(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f11(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseif_not_exists_stmt() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c0) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e0); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_NOT(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_EXISTS(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f12(); + } 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$parsecreate_db_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseKW_CREATE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_DATABASE(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_SCHEMA(); + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseif_not_exists_stmt(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parseident_name(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsecreate_db_definition(); + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f13(s1, s3, s5, s7, s9); + } 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$parseview_with() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseKW_WITH(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c1) { + s3 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e1); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c2) { + s3 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e2); } + } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c3) { + s5 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + if (input.substr(peg$currPos, 6) === peg$c4) { + s7 = peg$c4; + peg$currPos += 6; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e4); } + } + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f14(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_WITH(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c3) { + s3 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (input.substr(peg$currPos, 6) === peg$c4) { + s5 = peg$c4; + peg$currPos += 6; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e4); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f15(); + } 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$parsecreate_view_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21; + + s0 = peg$currPos; + s1 = peg$parseKW_CREATE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$currPos; + s4 = peg$parseKW_OR(); + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + s6 = peg$parseKW_REPLACE(); + if (s6 !== peg$FAILED) { + s4 = [s4, s5, s6]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c5) { + s6 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + if (s6 !== peg$FAILED) { + s7 = peg$parse__(); + s8 = peg$parseKW_ASSIGIN_EQUAL(); + if (s8 !== peg$FAILED) { + s9 = peg$parse__(); + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c6) { + s10 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e6); } + } + if (s10 === peg$FAILED) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c7) { + s10 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e7); } + } + if (s10 === peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c8) { + s10 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e8); } + } + } + } + if (s10 !== peg$FAILED) { + s6 = [s6, s7, s8, s9, s10]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsetrigger_definer(); + if (s7 === peg$FAILED) { + s7 = null; + } + s8 = peg$parse__(); + s9 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c9) { + s10 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + if (s10 !== peg$FAILED) { + s11 = peg$parse__(); + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c10) { + s12 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s12 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e10); } + } + if (s12 !== peg$FAILED) { + s13 = peg$parse__(); + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c11) { + s14 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s14 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e11); } + } + if (s14 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c12) { + s14 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s14 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e12); } + } + } + if (s14 !== peg$FAILED) { + s10 = [s10, s11, s12, s13, s14]; + s9 = s10; + } else { + peg$currPos = s9; + s9 = peg$FAILED; + } + } else { + peg$currPos = s9; + s9 = peg$FAILED; + } + } else { + peg$currPos = s9; + s9 = peg$FAILED; + } + if (s9 === peg$FAILED) { + s9 = null; + } + s10 = peg$parse__(); + s11 = peg$parseKW_VIEW(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parsetable_name(); + if (s13 !== peg$FAILED) { + s14 = peg$parse__(); + s15 = peg$currPos; + s16 = peg$parseLPAREN(); + if (s16 !== peg$FAILED) { + s17 = peg$parse__(); + s18 = peg$parsecolumn_list(); + if (s18 !== peg$FAILED) { + s19 = peg$parse__(); + s20 = peg$parseRPAREN(); + if (s20 !== peg$FAILED) { + s16 = [s16, s17, s18, s19, s20]; + s15 = s16; + } else { + peg$currPos = s15; + s15 = peg$FAILED; + } + } else { + peg$currPos = s15; + s15 = peg$FAILED; + } + } else { + peg$currPos = s15; + s15 = peg$FAILED; + } + if (s15 === peg$FAILED) { + s15 = null; + } + s16 = peg$parse__(); + s17 = peg$parseKW_AS(); + if (s17 !== peg$FAILED) { + s18 = peg$parse__(); + s19 = peg$parseselect_stmt_nake(); + if (s19 !== peg$FAILED) { + s20 = peg$parse__(); + s21 = peg$parseview_with(); + if (s21 === peg$FAILED) { + s21 = null; + } + peg$savedPos = s0; + s0 = peg$f16(s1, s3, s5, s7, s9, s13, s15, s19, s21); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsecreate_index_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26; + + s0 = peg$currPos; + s1 = peg$parseKW_CREATE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_UNIQUE(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_FULLTEXT(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_SPATIAL(); + } + } + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_INDEX(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseident(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseindex_type(); + if (s9 === peg$FAILED) { + s9 = null; + } + s10 = peg$parse__(); + s11 = peg$parseKW_ON(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parsetable_name(); + if (s13 !== peg$FAILED) { + s14 = peg$parse__(); + s15 = peg$parseLPAREN(); + if (s15 !== peg$FAILED) { + s16 = peg$parse__(); + s17 = peg$parsecolumn_order_list(); + if (s17 !== peg$FAILED) { + s18 = peg$parse__(); + s19 = peg$parseRPAREN(); + if (s19 !== peg$FAILED) { + s20 = peg$parse__(); + s21 = peg$parseindex_options(); + if (s21 === peg$FAILED) { + s21 = null; + } + s22 = peg$parse__(); + s23 = peg$parseALTER_ALGORITHM(); + if (s23 === peg$FAILED) { + s23 = null; + } + s24 = peg$parse__(); + s25 = peg$parseALTER_LOCK(); + if (s25 === peg$FAILED) { + s25 = null; + } + s26 = peg$parse__(); + peg$savedPos = s0; + s0 = peg$f17(s1, s3, s5, s7, s9, s11, s13, s17, s21, s23, s25); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsecreate_table_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19; + + s0 = peg$currPos; + s1 = peg$parseKW_CREATE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TEMPORARY(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_TABLE(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseif_not_exists_stmt(); + if (s7 === peg$FAILED) { + s7 = null; + } + s8 = peg$parse__(); + s9 = peg$parsetable_name(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parsecreate_like_table(); + if (s11 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f18(s1, s3, s7, s9, s11); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_CREATE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TEMPORARY(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_TABLE(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseif_not_exists_stmt(); + if (s7 === peg$FAILED) { + s7 = null; + } + s8 = peg$parse__(); + s9 = peg$parsetable_name(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parsecreate_table_definition(); + if (s11 === peg$FAILED) { + s11 = null; + } + s12 = peg$parse__(); + s13 = peg$parsetable_options(); + if (s13 === peg$FAILED) { + s13 = null; + } + s14 = peg$parse__(); + s15 = peg$parseKW_IGNORE(); + if (s15 === peg$FAILED) { + s15 = peg$parseKW_REPLACE(); + } + if (s15 === peg$FAILED) { + s15 = null; + } + s16 = peg$parse__(); + s17 = peg$parseKW_AS(); + if (s17 === peg$FAILED) { + s17 = null; + } + s18 = peg$parse__(); + s19 = peg$parseset_op_stmt(); + if (s19 === peg$FAILED) { + s19 = null; + } + peg$savedPos = s0; + s0 = peg$f19(s1, s3, s7, s9, s11, s13, s15, s17, s19); + } 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$parsecreate_like_table_simple() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_LIKE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsetable_ref_list(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f20(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecreate_like_table() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$parsecreate_like_table_simple(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseLPAREN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecreate_like_table(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseRPAREN(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f21(s3); + } 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$parsecreate_table_definition() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseLPAREN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecreate_definition(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$currPos; + s6 = peg$parse__(); + s7 = peg$parseCOMMA(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsecreate_definition(); + if (s9 !== peg$FAILED) { + s6 = [s6, s7, s8, s9]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$currPos; + s6 = peg$parse__(); + s7 = peg$parseCOMMA(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsecreate_definition(); + if (s9 !== peg$FAILED) { + s6 = [s6, s7, s8, s9]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } + s5 = peg$parse__(); + s6 = peg$parseRPAREN(); + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f22(s3, s4); + } 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$parsecreate_definition() { + var s0; + + s0 = peg$parsecreate_constraint_definition(); + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_column_definition(); + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_index_definition(); + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_fulltext_spatial_index_definition(); + } + } + } + + return s0; + } + + function peg$parsecolumn_definition_opt() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseliteral_not_null(); + if (s1 === peg$FAILED) { + s1 = peg$parseliteral_null(); + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f23(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsedefault_expr(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f24(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 14).toLowerCase() === peg$c13) { + s1 = input.substr(peg$currPos, 14); + peg$currPos += 14; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f25(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c14) { + s2 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e14); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c15) { + s4 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e15); } + } + if (s4 === peg$FAILED) { + s4 = null; + } + s2 = [s2, s3, s4]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 === peg$FAILED) { + s1 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c16) { + s2 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e16); } + } + if (s2 === peg$FAILED) { + s2 = null; + } + s3 = peg$parse__(); + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c15) { + s4 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e15); } + } + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f26(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsekeyword_comment(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f27(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsecollate_expr(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f28(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsecolumn_format(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f29(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsestorage(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f30(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsereference_definition(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f31(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsecheck_constraint_definition(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f32(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsecreate_option_character_set_kw(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseident_name(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f33(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsegenerated(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f34(s1); + } + s0 = s1; + } + } + } + } + } + } + } + } + } + } + } + + return s0; + } + + function peg$parsecolumn_definition_opt_list() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + s1 = peg$parsecolumn_definition_opt(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = []; + s4 = peg$currPos; + s5 = peg$parse__(); + s6 = peg$parsecolumn_definition_opt(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + s5 = peg$parse__(); + s6 = peg$parsecolumn_definition_opt(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f35(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecreate_column_definition() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parsecolumn_ref(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsedata_type(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecolumn_definition_opt_list(); + if (s5 === peg$FAILED) { + s5 = null; + } + peg$savedPos = s0; + s0 = peg$f36(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsetrigger_definer() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c11) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e11); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseliteral_string(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + if (input.charCodeAt(peg$currPos) === 64) { + s7 = peg$c17; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e17); } + } + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseliteral_string(); + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f37(s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c11) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e11); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_CURRENT_USER(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseLPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseRPAREN(); + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f38(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c11) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e11); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_CURRENT_USER(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f39(); + } 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$parsetrigger_time() { + var s0; + + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c18) { + s0 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e18); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c19) { + s0 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e19); } + } + } + + return s0; + } + + function peg$parsetrigger_event() { + var s0; + + s0 = peg$parseKW_INSERT(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_UPDATE(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_DELETE(); + } + } + + return s0; + } + + function peg$parsetrigger_order() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c20) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e20); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c21) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e21); } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseident_name(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f40(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsetrigger_body() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_SET(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseset_list(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f41(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecreate_trigger_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28; + + s0 = peg$currPos; + s1 = peg$parseKW_CREATE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsetrigger_definer(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_TRIGGER(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseif_not_exists_stmt(); + if (s7 === peg$FAILED) { + s7 = null; + } + s8 = peg$parse__(); + s9 = peg$parseident_name(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parsetrigger_time(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parsetrigger_event(); + if (s13 !== peg$FAILED) { + s14 = peg$parse__(); + s15 = peg$parseKW_ON(); + if (s15 !== peg$FAILED) { + s16 = peg$parse__(); + s17 = peg$parsetable_name(); + if (s17 !== peg$FAILED) { + s18 = peg$parse__(); + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c22) { + s19 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s19 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e22); } + } + if (s19 !== peg$FAILED) { + s20 = peg$parse__(); + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c23) { + s21 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s21 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e23); } + } + if (s21 !== peg$FAILED) { + s22 = peg$parse__(); + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c24) { + s23 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s23 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e24); } + } + if (s23 !== peg$FAILED) { + s24 = peg$parse__(); + s25 = peg$parsetrigger_order(); + if (s25 === peg$FAILED) { + s25 = null; + } + s26 = peg$parse__(); + s27 = peg$parsetrigger_body(); + if (s27 !== peg$FAILED) { + s28 = peg$parse__(); + peg$savedPos = s0; + s0 = peg$f42(s1, s3, s7, s9, s11, s13, s17, s25, s27); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsecollate_expr() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_COLLATE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseident_name(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f43(s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecolumn_format() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 13).toLowerCase() === peg$c25) { + s1 = input.substr(peg$currPos, 13); + peg$currPos += 13; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e25); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c26) { + s3 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e26); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c27) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e27); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c28) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e28); } + } + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f44(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsestorage() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c29) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e29); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c30) { + s3 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e30); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c31) { + s3 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e31); } + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f45(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsedefault_expr() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_DEFAULT(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseliteral(); + if (s3 === peg$FAILED) { + s3 = peg$parseexpr(); + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f46(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsegenerated_always() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + s1 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c32) { + s2 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e32); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c33) { + s4 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e33); } + } + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + 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$f47(s1); + } + s0 = s1; + + return s0; + } + + function peg$parsegenerated() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = peg$parsegenerated_always(); + if (s2 === peg$FAILED) { + s2 = null; + } + s3 = peg$parse__(); + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c34) { + s4 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e34); } + } + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseliteral(); + if (s5 === peg$FAILED) { + s5 = peg$parseexpr(); + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = []; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c35) { + s10 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e35); } + } + if (s10 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c36) { + s10 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e36); } + } + } + while (s10 !== peg$FAILED) { + s9.push(s10); + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c35) { + s10 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e35); } + } + if (s10 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c36) { + s10 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e36); } + } + } + } + peg$savedPos = s0; + s0 = peg$f48(s1, s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsedrop_index_opt() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseALTER_ALGORITHM(); + if (s1 === peg$FAILED) { + s1 = peg$parseALTER_LOCK(); + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseALTER_ALGORITHM(); + if (s5 === peg$FAILED) { + s5 = peg$parseALTER_LOCK(); + } + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseALTER_ALGORITHM(); + if (s5 === peg$FAILED) { + s5 = peg$parseALTER_LOCK(); + } + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f49(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseif_exists() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c0) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e37); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c37) { + s3 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e38); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f50(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsedrop_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12; + + s0 = peg$currPos; + s1 = peg$parseKW_DROP(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TABLE(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseif_exists(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsetable_ref_list(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f51(s1, s3, s5, s7); + } 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$parseKW_DROP(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_VIEW(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseif_exists(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsetable_ref_list(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseview_options(); + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f52(s1, s3, s5, s7, s9); + } 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$parseKW_DROP(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_INDEX(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecolumn_ref(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_ON(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsetable_name(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parsedrop_index_opt(); + if (s11 === peg$FAILED) { + s11 = null; + } + s12 = peg$parse__(); + peg$savedPos = s0; + s0 = peg$f53(s1, s3, s5, s9, s11); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_DROP(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_DATABASE(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_SCHEMA(); + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseif_exists(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parseident_name(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f54(s1, s3, s5, s7); + } 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$parseKW_DROP(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TRIGGER(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseif_exists(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsetable_base(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f55(s1, s3, s5, s7); + } 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$parsetruncate_stmt() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_TRUNCATE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TABLE(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parsetable_ref_list(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f56(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseuse_stmt() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_USE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseident(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f57(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsealter_table_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseKW_ALTER(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TABLE(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsetable_name(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsealter_action_list(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f58(s5, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsealter_action_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parsealter_action(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsealter_action(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsealter_action(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f59(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsealter_action() { + var s0, s1; + + s0 = peg$parseALTER_ADD_CONSTRAINT(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_DROP_CONSTRAINT(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_DROP_KEY(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_ENABLE_CONSTRAINT(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_DISABLE_CONSTRAINT(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_ADD_COLUMN(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_DROP_COLUMN(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_ADD_INDEX_OR_KEY(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_ADD_FULLETXT_SPARITAL_INDEX(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_RENAME_COLUMN(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_RENAME_TABLE(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_ALGORITHM(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_LOCK(); + if (s0 === peg$FAILED) { + s0 = peg$parseALTER_CHANGE_COLUMN(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsetable_option(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f60(s1); + } + s0 = s1; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + + return s0; + } + + function peg$parseALTER_ADD_COLUMN() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_ADD(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_COLUMN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecreate_column_definition(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f61(s3, s5); + } 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$parseKW_ADD(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecreate_column_definition(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f62(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parseALTER_DROP_COLUMN() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_DROP(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_COLUMN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecolumn_ref(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f63(s3, s5); + } 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$parseKW_DROP(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecolumn_ref(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f64(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parseALTER_ADD_INDEX_OR_KEY() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_ADD(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecreate_index_definition(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f65(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseALTER_RENAME_TABLE() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_RENAME(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TO(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_AS(); + } + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseident(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f66(s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseALTER_RENAME_COLUMN() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseKW_RENAME(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_COLUMN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecolumn_ref(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_TO(); + if (s7 === peg$FAILED) { + s7 = peg$parseKW_AS(); + } + if (s7 === peg$FAILED) { + s7 = null; + } + s8 = peg$parse__(); + s9 = peg$parsecolumn_ref(); + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f67(s5, s7, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseALTER_ALGORITHM() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c5) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c28) { + s5 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e28); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c38) { + s5 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e39); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c39) { + s5 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e40); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c40) { + s5 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e41); } + } + } + } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f68(s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseALTER_LOCK() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c41) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e42); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c28) { + s5 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e28); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c42) { + s5 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e43); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c43) { + s5 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e44); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c44) { + s5 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e45); } + } + } + } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f69(s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseALTER_CHANGE_COLUMN() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c45) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e46); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_COLUMN(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parsecolumn_ref(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecreate_column_definition(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c46) { + s10 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e47); } + } + if (s10 === peg$FAILED) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c19) { + s10 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e19); } + } + } + if (s10 !== peg$FAILED) { + s11 = peg$parse__(); + s12 = peg$parsecolumn_ref(); + if (s12 !== peg$FAILED) { + s10 = [s10, s11, s12]; + s9 = s10; + } else { + peg$currPos = s9; + s9 = peg$FAILED; + } + } else { + peg$currPos = s9; + s9 = peg$FAILED; + } + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f70(s3, s5, s7, s9); + } 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$parseALTER_ADD_CONSTRAINT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_ADD(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecreate_constraint_definition(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f71(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseALTER_DROP_KEY() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseKW_DROP(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c16) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e16); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_KEY(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f72(); + } 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$parseKW_DROP(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c47) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e48); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_KEY(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseident_name(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f73(s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseALTER_DROP_CONSTRAINT() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_DROP(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c3) { + s3 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseident_name(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f74(s3, s5); + } 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$parseALTER_ENABLE_CONSTRAINT() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseKW_WITH(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c3) { + s3 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c3) { + s5 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_CONSTRAINT(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseident_name(); + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f75(s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseALTER_DISABLE_CONSTRAINT() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c48) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e49); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_CONSTRAINT(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseident_name(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f76(s5); + } 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$parsecreate_index_definition() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; + + s0 = peg$currPos; + s1 = peg$parseKW_INDEX(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_KEY(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecolumn(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseindex_type(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsecte_idx_column_definition(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseindex_options(); + if (s9 === peg$FAILED) { + s9 = null; + } + s10 = peg$parse__(); + peg$savedPos = s0; + s0 = peg$f77(s1, s3, s5, s7, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecreate_fulltext_spatial_index_definition() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseKW_FULLTEXT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_SPATIAL(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_INDEX(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_KEY(); + } + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parsecolumn(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsecte_column_definition(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseindex_options(); + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f78(s1, s3, s5, s7, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecreate_constraint_definition() { + var s0; + + s0 = peg$parsecreate_constraint_primary(); + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_constraint_unique(); + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_constraint_foreign(); + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_constraint_check(); + } + } + } + + return s0; + } + + function peg$parseconstraint_name() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_CONSTRAINT(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseident(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f79(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecreate_constraint_primary() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseconstraint_name(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c16) { + s4 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e16); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c15) { + s6 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e15); } + } + if (s6 !== peg$FAILED) { + s4 = [s4, s5, s6]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseindex_type(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsecte_column_definition(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseindex_options(); + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f80(s1, s3, s5, s7, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecreate_constraint_unique() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13; + + s0 = peg$currPos; + s1 = peg$parseconstraint_name(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseKW_UNIQUE(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_INDEX(); + if (s5 === peg$FAILED) { + s5 = peg$parseKW_KEY(); + } + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsecolumn(); + if (s7 === peg$FAILED) { + s7 = null; + } + s8 = peg$parse__(); + s9 = peg$parseindex_type(); + if (s9 === peg$FAILED) { + s9 = null; + } + s10 = peg$parse__(); + s11 = peg$parsecte_column_definition(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parseindex_options(); + if (s13 === peg$FAILED) { + s13 = null; + } + peg$savedPos = s0; + s0 = peg$f81(s1, s3, s5, s7, s9, s11, s13); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecreate_constraint_check() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + + s0 = peg$currPos; + s1 = peg$parseconstraint_name(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c3) { + s3 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c49) { + s6 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e50); } + } + if (s6 !== peg$FAILED) { + s7 = peg$parse__(); + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c22) { + s8 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e22); } + } + if (s8 !== peg$FAILED) { + s9 = peg$parse__(); + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c50) { + s10 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s10 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e51); } + } + if (s10 !== peg$FAILED) { + s11 = peg$parse__(); + s6 = [s6, s7, s8, s9, s10, s11]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parseLPAREN(); + if (s6 !== peg$FAILED) { + s7 = peg$parse__(); + s8 = peg$parseexpr(); + if (s8 !== peg$FAILED) { + s9 = peg$parse__(); + s10 = peg$parseRPAREN(); + if (s10 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f82(s1, s3, s5, s8); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsecreate_constraint_foreign() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseconstraint_name(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c51) { + s3 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e52); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecolumn(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsecte_column_definition(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsereference_definition(); + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f83(s1, s3, s5, s7, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecheck_constraint_definition() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14; + + s0 = peg$currPos; + s1 = peg$parseconstraint_name(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c3) { + s3 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseLPAREN(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseexpr(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseRPAREN(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$currPos; + s12 = peg$parseKW_NOT(); + if (s12 === peg$FAILED) { + s12 = null; + } + s13 = peg$parse__(); + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c52) { + s14 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s14 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e53); } + } + if (s14 !== peg$FAILED) { + s12 = [s12, s13, s14]; + s11 = s12; + } else { + peg$currPos = s11; + s11 = peg$FAILED; + } + if (s11 === peg$FAILED) { + s11 = null; + } + peg$savedPos = s0; + s0 = peg$f84(s1, s3, s7, s11); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsereference_definition() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + + s0 = peg$currPos; + s1 = peg$parseKW_REFERENCES(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsetable_ref_list(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecte_column_definition(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c53) { + s7 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e54); } + } + if (s7 === peg$FAILED) { + if (input.substr(peg$currPos, 13).toLowerCase() === peg$c54) { + s7 = input.substr(peg$currPos, 13); + peg$currPos += 13; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e55); } + } + if (s7 === peg$FAILED) { + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c55) { + s7 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e56); } + } + } + } + if (s7 === peg$FAILED) { + s7 = null; + } + s8 = peg$parse__(); + s9 = peg$parseon_reference(); + if (s9 === peg$FAILED) { + s9 = null; + } + s10 = peg$parse__(); + s11 = peg$parseon_reference(); + if (s11 === peg$FAILED) { + s11 = null; + } + peg$savedPos = s0; + s0 = peg$f85(s1, s3, s5, s7, s9, s11); + } 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$parseon_reference(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f86(s1); + } + s0 = s1; + } + + return s0; + } + + function peg$parseon_reference() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_ON(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_DELETE(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_UPDATE(); + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsereference_option(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f87(s3, s5); + } 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$parseview_options() { + var s0, s1; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c56) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e57); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c57) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e58); } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f88(s1); + } + s0 = s1; + + return s0; + } + + function peg$parsereference_option() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parseview_options(); + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c58) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e59); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c59) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e60); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c60) { + s1 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e61); } + } + if (s1 === peg$FAILED) { + s1 = peg$parseKW_CURRENT_TIMESTAMP(); + } + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f89(s1); + } + s0 = s1; + + return s0; + } + + function peg$parsetable_options() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parsetable_option(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsetable_option(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsetable_option(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f90(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecreate_option_character_set_kw() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c61) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e62); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c62) { + s3 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e63); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f91(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecreate_option_character_set() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseKW_DEFAULT(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parsecreate_option_character_set_kw(); + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c63) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e64); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c64) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e65); } + } + } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_ASSIGIN_EQUAL(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parseident_name(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f92(s1, s3, s5, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsetable_option() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 14).toLowerCase() === peg$c13) { + s1 = input.substr(peg$currPos, 14); + peg$currPos += 14; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 14).toLowerCase() === peg$c65) { + s1 = input.substr(peg$currPos, 14); + peg$currPos += 14; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e66); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 14).toLowerCase() === peg$c66) { + s1 = input.substr(peg$currPos, 14); + peg$currPos += 14; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e67); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c67) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e68); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c68) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e69); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 18).toLowerCase() === peg$c69) { + s1 = input.substr(peg$currPos, 18); + peg$currPos += 18; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e70); } + } + } + } + } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseliteral_numeric(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f93(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parsecreate_option_character_set(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_COMMENT(); + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c70) { + s1 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e71); } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseliteral_string(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f94(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c71) { + s1 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e72); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s6 = peg$c72; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s6 !== peg$FAILED) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c73) { + s7 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e74); } + } + if (s7 === peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c74) { + s7 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e75); } + } + if (s7 === peg$FAILED) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c42) { + s7 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e43); } + } + } + } + if (s7 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s8 = peg$c72; + peg$currPos++; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s8 !== peg$FAILED) { + s6 = [s6, s7, s8]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f95(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c75) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e76); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseident_name(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f96(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c76) { + s1 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e77); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_DEFAULT(); + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c27) { + s5 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e27); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c26) { + s5 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e26); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c77) { + s5 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e78); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c78) { + s5 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e79); } + } + if (s5 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c79) { + s5 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e80); } + } + } + } + } + } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f97(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + } + } + + return s0; + } + + function peg$parseALTER_ADD_FULLETXT_SPARITAL_INDEX() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_ADD(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecreate_fulltext_spatial_index_definition(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f98(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parserename_stmt() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_RENAME(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TABLE(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsetable_to_list(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f99(s5); + } 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$parseset_stmt() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_SET(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_GLOBAL(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_SESSION(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_LOCAL(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_PERSIST(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_PERSIST_ONLY(); + } + } + } + } + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseassign_stmt(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f100(s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseunlock_stmt() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_UNLOCK(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TABLES(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f101(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parselock_type() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c80) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e81); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c2) { + s3 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e2); } + } + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f102(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c81) { + s1 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e82); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c82) { + s3 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e83); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f103(s1); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parselock_table() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsetable_base(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parselock_type(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f104(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parselock_table_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parselock_table(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parselock_table(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parselock_table(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f105(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parselock_stmt() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_LOCK(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TABLES(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parselock_table_list(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f106(s5); + } 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$parsecall_stmt() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_CALL(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseproc_func_call(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f107(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseshow_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + + s0 = peg$currPos; + s1 = peg$parseKW_SHOW(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c83) { + s3 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e84); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c84) { + s3 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e85); } + } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c85) { + s5 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e86); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f108(s3); + } 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$parseKW_SHOW(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c86) { + s3 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e87); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c87) { + s3 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e88); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c88) { + s3 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e89); } + } + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f109(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_SHOW(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c89) { + s3 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e90); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c90) { + s3 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e91); } + } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c87) { + s5 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e88); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f110(s3); + } 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$parseKW_SHOW(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c91) { + s3 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e92); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c92) { + s5 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e93); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsein_op_right(); + if (s7 === peg$FAILED) { + s7 = null; + } + s8 = peg$parse__(); + s9 = peg$parsefrom_clause(); + if (s9 === peg$FAILED) { + s9 = null; + } + s10 = peg$parse__(); + s11 = peg$parselimit_clause(); + if (s11 === peg$FAILED) { + s11 = null; + } + peg$savedPos = s0; + s0 = peg$f111(s7, s9, s11); + } 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$parseKW_SHOW(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c61) { + s4 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e62); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c62) { + s6 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e63); } + } + if (s6 !== peg$FAILED) { + s4 = [s4, s5, s6]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c93) { + s3 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e94); } + } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parselike_op_right(); + if (s5 === peg$FAILED) { + s5 = peg$parsewhere_clause(); + } + if (s5 === peg$FAILED) { + s5 = null; + } + peg$savedPos = s0; + s0 = peg$f112(s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_SHOW(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c94) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e95); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c95) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e96); } + } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsefrom_clause(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f113(s3, s5); + } 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$parseKW_SHOW(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_CREATE(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_VIEW(); + if (s5 === peg$FAILED) { + s5 = peg$parseKW_TABLE(); + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsetable_name(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f114(s5, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseshow_grant_stmt(); + } + } + } + } + } + } + } + + return s0; + } + + function peg$parseshow_grant_stmt() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_SHOW(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c96) { + s3 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e97); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseshow_grant_for(); + if (s5 === peg$FAILED) { + s5 = null; + } + peg$savedPos = s0; + s0 = peg$f115(s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseshow_grant_for() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c22) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e22); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseident(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$currPos; + s6 = peg$parseKW_VAR__PRE_AT(); + if (s6 !== peg$FAILED) { + s7 = peg$parse__(); + s8 = peg$parseident(); + if (s8 !== peg$FAILED) { + s6 = [s6, s7, s8]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parseshow_grant_for_using(); + if (s7 === peg$FAILED) { + s7 = null; + } + peg$savedPos = s0; + s0 = peg$f116(s3, s5, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseshow_grant_for_using() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_USING(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseshow_grant_for_using_list(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f117(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseshow_grant_for_using_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseident(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseident(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseident(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f118(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsedesc_stmt() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_DESC(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DESCRIBE(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseident(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f119(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c97; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e98); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parseselect_stmt(); + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + if (input.charCodeAt(peg$currPos) === 41) { + s6 = peg$c98; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e99); } + } + if (s6 !== peg$FAILED) { + s2 = [s2, s3, s4, s5, s6]; + 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$f120(s1); + } + s0 = s1; + } + + return s0; + } + + function peg$parsewith_clause() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseKW_WITH(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecte_definition(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$currPos; + s6 = peg$parse__(); + s7 = peg$parseCOMMA(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsecte_definition(); + if (s9 !== peg$FAILED) { + s6 = [s6, s7, s8, s9]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$currPos; + s6 = peg$parse__(); + s7 = peg$parseCOMMA(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsecte_definition(); + if (s9 !== peg$FAILED) { + s6 = [s6, s7, s8, s9]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f121(s3, s4); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse__(); + s2 = peg$parseKW_WITH(); + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parseKW_RECURSIVE(); + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + s6 = peg$parsecte_definition(); + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f122(s6); + } 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$parsecte_definition() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + + s0 = peg$currPos; + s1 = peg$parseliteral_string(); + if (s1 === peg$FAILED) { + s1 = peg$parseident_name(); + if (s1 === peg$FAILED) { + s1 = peg$parsetable_name(); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecte_column_definition(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_AS(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseLPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseset_op_stmt(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseRPAREN(); + if (s11 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f123(s1, s3, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsecte_column_definition() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseLPAREN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecolumn_ref_index(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseRPAREN(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f124(s3); + } 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_idx_ref() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parsecolumn_without_kw(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = []; + if (peg$r0.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + if (s6 !== peg$FAILED) { + while (s6 !== peg$FAILED) { + s5.push(s6); + if (peg$r0.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + } + } else { + s5 = peg$FAILED; + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseKW_ASC(); + if (s9 === peg$FAILED) { + s9 = peg$parseKW_DESC(); + } + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f125(s1, s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsecolumn_without_kw(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASC(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_DESC(); + } + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f126(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parsecolumn_ref_idx_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parsecolumn_idx_ref(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn_idx_ref(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn_idx_ref(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f127(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecte_idx_column_definition() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseLPAREN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecolumn_ref_idx_list(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseRPAREN(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f128(s3); + } 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$parsefor_update() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + s1 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c22) { + s2 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e22); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parseKW_UPDATE(); + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + 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$f129(s1); + } + s0 = s1; + + return s0; + } + + function peg$parselock_in_share_mode() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8; + + s0 = peg$currPos; + s1 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c41) { + s2 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e42); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c99) { + s4 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e101); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c100) { + s6 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e102); } + } + if (s6 !== peg$FAILED) { + s7 = peg$parse__(); + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c101) { + s8 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e103); } + } + if (s8 !== peg$FAILED) { + s2 = [s2, s3, s4, s5, s6, s7, s8]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } 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$f130(s1); + } + s0 = s1; + + return s0; + } + + function peg$parselock_option() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + s1 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c102) { + s2 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e104); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parseliteral_numeric(); + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + 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$f131(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c103) { + s0 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e105); } + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c104) { + s2 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e106); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c105) { + s4 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e107); } + } + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + 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$f132(s1); + } + s0 = s1; + } + } + + return s0; + } + + function peg$parselocking_read() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsefor_update(); + if (s1 === peg$FAILED) { + s1 = peg$parselock_in_share_mode(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parselock_option(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f133(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseselect_stmt_nake() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27, s28, s29, s30, s31, s32; + + s0 = peg$currPos; + s1 = peg$parse__(); + s2 = peg$parsewith_clause(); + if (s2 === peg$FAILED) { + s2 = null; + } + s3 = peg$parse__(); + s4 = peg$parseKW_SELECT(); + if (s4 !== peg$FAILED) { + s5 = peg$parse___(); + if (s5 !== peg$FAILED) { + s6 = peg$parseoption_clause(); + if (s6 === peg$FAILED) { + s6 = null; + } + s7 = peg$parse__(); + s8 = peg$parseKW_DISTINCT(); + if (s8 === peg$FAILED) { + s8 = null; + } + s9 = peg$parse__(); + s10 = peg$parsecolumn_clause(); + if (s10 !== peg$FAILED) { + s11 = peg$parse__(); + s12 = peg$parseinto_clause(); + if (s12 === peg$FAILED) { + s12 = null; + } + s13 = peg$parse__(); + s14 = peg$parsefrom_clause(); + if (s14 === peg$FAILED) { + s14 = null; + } + s15 = peg$parse__(); + s16 = peg$parseinto_clause(); + if (s16 === peg$FAILED) { + s16 = null; + } + s17 = peg$parse__(); + s18 = peg$parsewhere_clause(); + if (s18 === peg$FAILED) { + s18 = null; + } + s19 = peg$parse__(); + s20 = peg$parsegroup_by_clause(); + if (s20 === peg$FAILED) { + s20 = null; + } + s21 = peg$parse__(); + s22 = peg$parsehaving_clause(); + if (s22 === peg$FAILED) { + s22 = null; + } + s23 = peg$parse__(); + s24 = peg$parseorder_by_clause(); + if (s24 === peg$FAILED) { + s24 = null; + } + s25 = peg$parse__(); + s26 = peg$parselimit_clause(); + if (s26 === peg$FAILED) { + s26 = null; + } + s27 = peg$parse__(); + s28 = peg$parselocking_read(); + if (s28 === peg$FAILED) { + s28 = null; + } + s29 = peg$parse__(); + s30 = peg$parsewindow_clause(); + if (s30 === peg$FAILED) { + s30 = null; + } + s31 = peg$parse__(); + s32 = peg$parseinto_clause(); + if (s32 === peg$FAILED) { + s32 = null; + } + peg$savedPos = s0; + s0 = peg$f134(s2, s6, s8, s10, s12, s14, s16, s18, s20, s22, s24, s26, s28, s30, s32); + } 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$parseoption_clause() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parsequery_option(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parsequery_option(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parsequery_option(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f135(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsequery_option() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parseOPT_SQL_CALC_FOUND_ROWS(); + if (s1 === peg$FAILED) { + s1 = peg$parseOPT_SQL_CACHE(); + if (s1 === peg$FAILED) { + s1 = peg$parseOPT_SQL_NO_CACHE(); + } + if (s1 === peg$FAILED) { + s1 = peg$parseOPT_SQL_BIG_RESULT(); + if (s1 === peg$FAILED) { + s1 = peg$parseOPT_SQL_SMALL_RESULT(); + if (s1 === peg$FAILED) { + s1 = peg$parseOPT_SQL_BUFFER_RESULT(); + } + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f136(s1); + } + s0 = s1; + + 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 = undefined; + } 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) { + s1 = peg$parseSTAR(); + } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn_list_item(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn_list_item(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f137(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsecolumn_list_item(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn_list_item(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn_list_item(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f138(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parsefulltext_search_mode() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13; + + s0 = peg$currPos; + s1 = peg$parseKW_IN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c106) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e108); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c107) { + s5 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e109); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c101) { + s7 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e103); } + } + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c108) { + s9 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s9 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e110); } + } + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c109) { + s11 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s11 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e111); } + } + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c110) { + s13 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s13 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e112); } + } + if (s13 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f139(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_IN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c106) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e108); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c107) { + s5 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e109); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c101) { + s7 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e103); } + } + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f140(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_IN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c111) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e113); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c101) { + s5 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e103); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f141(); + } 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$parseKW_WITH(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c109) { + s3 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e111); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c110) { + s5 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e112); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f142(); + } 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$parsefulltext_search() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c112) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e114); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecolumn_ref_list(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + if (input.substr(peg$currPos, 7) === peg$c113) { + s9 = peg$c113; + peg$currPos += 7; + } else { + s9 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e115); } + } + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseLPAREN(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parseexpr(); + if (s13 !== peg$FAILED) { + s14 = peg$parse__(); + s15 = peg$parsefulltext_search_mode(); + if (s15 === peg$FAILED) { + s15 = null; + } + s16 = peg$parse__(); + s17 = peg$parseRPAREN(); + if (s17 !== peg$FAILED) { + s18 = peg$parse__(); + s19 = peg$parsealias_clause(); + if (s19 === peg$FAILED) { + s19 = null; + } + peg$savedPos = s0; + s0 = peg$f143(s5, s13, s15, s19); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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_list_item() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + s1 = peg$parsefulltext_search(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f144(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$currPos; + s2 = peg$parseident(); + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parseDOT(); + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseSTAR(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f145(s1); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseassign_stmt(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f146(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsebinary_column_expr(); + if (s1 === peg$FAILED) { + s1 = peg$parseexpr(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsealias_clause(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f147(s1, s3); + } 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) { + s2 = peg$parse__(); + s3 = peg$parsealias_ident(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f148(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_AS(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseident(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f149(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parseinto_clause() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_INTO(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsevar_decl_list(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f150(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_INTO(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c114) { + s3 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e116); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c115) { + s3 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e117); } + } + } + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseliteral_string(); + if (s5 === peg$FAILED) { + s5 = peg$parseident(); + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f151(s3, s5); + } 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__(); + s3 = peg$parsetable_ref_list(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f152(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsetable_to_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parsetable_to_item(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsetable_to_item(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsetable_to_item(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f153(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsetable_to_item() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parsetable_name(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TO(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsetable_name(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f154(s1, s5); + } 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$parseindex_type() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_USING(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c116) { + s3 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e118); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c117) { + s3 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e119); } + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f155(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseindex_options() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseindex_option(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseindex_option(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseindex_option(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f156(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseindex_option() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_KEY_BLOCK_SIZE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseliteral_numeric(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f157(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseindex_type(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c108) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e110); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c118) { + s3 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e120); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseident_name(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f158(s5); + } 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; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c119) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e121); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c120) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e122); } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f159(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$parsekeyword_comment(); + } + } + } + } + + 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(); + } + peg$savedPos = s0; + s0 = peg$f160(s1, s2); + } 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__(); + s2 = peg$parseCOMMA(); + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parsetable_base(); + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f161(s4); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse__(); + s2 = peg$parsetable_join(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f162(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parsetable_join() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15; + + s0 = peg$currPos; + s1 = peg$parsejoin_op(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsetable_base(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_USING(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseLPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseident_name(); + if (s9 !== peg$FAILED) { + s10 = []; + s11 = peg$currPos; + s12 = peg$parse__(); + s13 = peg$parseCOMMA(); + if (s13 !== peg$FAILED) { + s14 = peg$parse__(); + s15 = peg$parseident_name(); + if (s15 !== peg$FAILED) { + s12 = [s12, s13, s14, s15]; + s11 = s12; + } else { + peg$currPos = s11; + s11 = peg$FAILED; + } + } else { + peg$currPos = s11; + s11 = peg$FAILED; + } + while (s11 !== peg$FAILED) { + s10.push(s11); + s11 = peg$currPos; + s12 = peg$parse__(); + s13 = peg$parseCOMMA(); + if (s13 !== peg$FAILED) { + s14 = peg$parse__(); + s15 = peg$parseident_name(); + if (s15 !== peg$FAILED) { + s12 = [s12, s13, s14, s15]; + s11 = s12; + } else { + peg$currPos = s11; + s11 = peg$FAILED; + } + } else { + peg$currPos = s11; + s11 = peg$FAILED; + } + } + s11 = peg$parse__(); + s12 = peg$parseRPAREN(); + if (s12 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f163(s1, s3, s9, s10); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsejoin_op(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsetable_base(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseon_clause(); + if (s5 === peg$FAILED) { + s5 = null; + } + peg$savedPos = s0; + s0 = peg$f164(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsejoin_op(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseset_op_stmt(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsealias_clause(); + if (s9 === peg$FAILED) { + s9 = null; + } + s10 = peg$parse__(); + s11 = peg$parseon_clause(); + if (s11 === peg$FAILED) { + s11 = null; + } + peg$savedPos = s0; + s0 = peg$f165(s1, s5, s9, s11); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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_base() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseKW_DUAL(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f166(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsetable_name(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsealias_clause(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f167(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseLPAREN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsetable_name(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseRPAREN(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsealias_clause(); + if (s7 === peg$FAILED) { + s7 = null; + } + peg$savedPos = s0; + s0 = peg$f168(s3, s5, s7); + } 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$parsevalue_clause(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsealias_clause(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f169(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseLPAREN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseset_op_stmt(); + if (s3 === peg$FAILED) { + s3 = peg$parsevalue_clause(); + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseRPAREN(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsealias_clause(); + if (s7 === peg$FAILED) { + s7 = null; + } + peg$savedPos = s0; + s0 = peg$f170(s3, s7); + } 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$parsejoin_op() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_LEFT(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_OUTER(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_JOIN(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f171(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_RIGHT(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_OUTER(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_JOIN(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f172(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_FULL(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_OUTER(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_JOIN(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f173(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_CROSS(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_JOIN(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f174(); + } 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__(); + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parseKW_JOIN(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f175(); + } 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__(); + s4 = peg$parseDOT(); + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + s6 = peg$parseident(); + if (s6 !== peg$FAILED) { + s3 = [s3, s4, s5, s6]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 === peg$FAILED) { + s2 = null; + } + peg$savedPos = s0; + s0 = peg$f176(s1, s2); + } 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$f177(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__(); + s3 = peg$parseor_and_where_expr(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f178(s3); + } 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__(); + s3 = peg$parseor_and_where_expr(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f179(s3); + } 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__(); + s3 = peg$parseKW_BY(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseexpr_list(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f180(s5); + } 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_index() { + var s0; + + s0 = peg$parsecolumn_ref_list(); + if (s0 === peg$FAILED) { + s0 = peg$parseliteral_list(); + } + + 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__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn_ref(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn_ref(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f181(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsehaving_clause() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_HAVING(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseor_and_where_expr(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f182(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsepartition_by_clause() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_PARTITION(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_BY(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecolumn_clause(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f183(s5); + } 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_clause() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_ORDER(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_BY(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseorder_by_list(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f184(s5); + } 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__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f185(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseorder_by_element() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseexpr(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_DESC(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_ASC(); + } + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f186(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsenumber_or_param() { + var s0, s1; + + s0 = peg$parseliteral_numeric(); + if (s0 === peg$FAILED) { + s0 = peg$parseparam(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 63) { + s1 = peg$c121; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e123); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f187(); + } + s0 = s1; + } + } + + 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__(); + s3 = peg$parsenumber_or_param(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$currPos; + s6 = peg$parseCOMMA(); + if (s6 === peg$FAILED) { + s6 = peg$parseKW_OFFSET(); + } + if (s6 !== peg$FAILED) { + s7 = peg$parse__(); + s8 = peg$parsenumber_or_param(); + if (s8 !== peg$FAILED) { + s6 = [s6, s7, s8]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + if (s5 === peg$FAILED) { + s5 = null; + } + peg$savedPos = s0; + s0 = peg$f188(s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseupdate_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16; + + s0 = peg$currPos; + s1 = peg$parse__(); + s2 = peg$parsewith_clause(); + if (s2 === peg$FAILED) { + s2 = null; + } + s3 = peg$parse__(); + s4 = peg$parseKW_UPDATE(); + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + s6 = peg$parsetable_ref_list(); + if (s6 !== peg$FAILED) { + s7 = peg$parse__(); + s8 = peg$parseKW_SET(); + if (s8 !== peg$FAILED) { + s9 = peg$parse__(); + s10 = peg$parseset_list(); + if (s10 !== peg$FAILED) { + s11 = peg$parse__(); + s12 = peg$parsewhere_clause(); + if (s12 === peg$FAILED) { + s12 = null; + } + s13 = peg$parse__(); + s14 = peg$parseorder_by_clause(); + if (s14 === peg$FAILED) { + s14 = null; + } + s15 = peg$parse__(); + s16 = peg$parselimit_clause(); + if (s16 === peg$FAILED) { + s16 = null; + } + peg$savedPos = s0; + s0 = peg$f189(s2, s6, s10, s12, s14, s16); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsedelete_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14; + + s0 = peg$currPos; + s1 = peg$parse__(); + s2 = peg$parsewith_clause(); + if (s2 === peg$FAILED) { + s2 = null; + } + s3 = peg$parse__(); + s4 = peg$parseKW_DELETE(); + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + s6 = peg$parsetable_ref_list(); + if (s6 === peg$FAILED) { + s6 = null; + } + s7 = peg$parse__(); + s8 = peg$parsefrom_clause(); + if (s8 !== peg$FAILED) { + s9 = peg$parse__(); + s10 = peg$parsewhere_clause(); + if (s10 === peg$FAILED) { + s10 = null; + } + s11 = peg$parse__(); + s12 = peg$parseorder_by_clause(); + if (s12 === peg$FAILED) { + s12 = null; + } + s13 = peg$parse__(); + s14 = peg$parselimit_clause(); + if (s14 === peg$FAILED) { + s14 = null; + } + peg$savedPos = s0; + s0 = peg$f190(s2, s6, s8, s10, s12, s14); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseset_item(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseset_item(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f191(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseset_item() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = peg$parseident(); + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parseDOT(); + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parsecolumn(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (input.charCodeAt(peg$currPos) === 61) { + s5 = peg$c122; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e124); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseadditive_expr(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f192(s1, s3, s7); + } 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$parseinsert_value_clause() { + var s0; + + s0 = peg$parsevalue_clause(); + if (s0 === peg$FAILED) { + s0 = peg$parseselect_stmt_nake(); + } + + return s0; + } + + function peg$parseinsert_partition() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + + s0 = peg$currPos; + s1 = peg$parseKW_PARTITION(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseident_name(); + if (s5 !== peg$FAILED) { + s6 = []; + s7 = peg$currPos; + s8 = peg$parse__(); + s9 = peg$parseCOMMA(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseident_name(); + if (s11 !== peg$FAILED) { + s8 = [s8, s9, s10, s11]; + s7 = s8; + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + while (s7 !== peg$FAILED) { + s6.push(s7); + s7 = peg$currPos; + s8 = peg$parse__(); + s9 = peg$parseCOMMA(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseident_name(); + if (s11 !== peg$FAILED) { + s8 = [s8, s9, s10, s11]; + s7 = s8; + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + } + s7 = peg$parse__(); + s8 = peg$parseRPAREN(); + if (s8 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f193(s5, s6); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_PARTITION(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsevalue_item(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f194(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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, s14, s15, s16, s17, s18, s19; + + s0 = peg$currPos; + s1 = peg$parsereplace_insert(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_IGNORE(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_INTO(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsetable_name(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseinsert_partition(); + if (s9 === peg$FAILED) { + s9 = null; + } + s10 = peg$parse__(); + s11 = peg$parseLPAREN(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parsecolumn_list(); + if (s13 !== peg$FAILED) { + s14 = peg$parse__(); + s15 = peg$parseRPAREN(); + if (s15 !== peg$FAILED) { + s16 = peg$parse__(); + s17 = peg$parseinsert_value_clause(); + if (s17 !== peg$FAILED) { + s18 = peg$parse__(); + s19 = peg$parseon_duplicate_update_stmt(); + if (s19 === peg$FAILED) { + s19 = null; + } + peg$savedPos = s0; + s0 = peg$f195(s1, s3, s5, s7, s9, s13, s17, s19); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseinsert_no_columns_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__(); + s3 = peg$parseKW_IGNORE(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_INTO(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parsetable_name(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseinsert_partition(); + if (s9 === peg$FAILED) { + s9 = null; + } + s10 = peg$parse__(); + s11 = peg$parseinsert_value_clause(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parseon_duplicate_update_stmt(); + if (s13 === peg$FAILED) { + s13 = null; + } + peg$savedPos = s0; + s0 = peg$f196(s1, s3, s5, s7, s9, s11, s13); + } 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$parseinsert_into_set() { + 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__(); + s3 = peg$parseKW_INTO(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parsetable_name(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseinsert_partition(); + if (s7 === peg$FAILED) { + s7 = null; + } + s8 = peg$parse__(); + s9 = peg$parseKW_SET(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseset_list(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parseon_duplicate_update_stmt(); + if (s13 === peg$FAILED) { + s13 = null; + } + peg$savedPos = s0; + s0 = peg$f197(s1, s3, s5, s7, s11, s13); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseon_duplicate_update_stmt() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseKW_ON(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c123) { + s3 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e125); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_KEY(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_UPDATE(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseset_list(); + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f198(s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsereplace_insert() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parseKW_INSERT(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f199(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_REPLACE(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f200(); + } + 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__(); + s3 = peg$parsevalue_list(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f201(s3); + } 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__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsevalue_item(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsevalue_item(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f202(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsevalue_item() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c24) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e24); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseexpr_list(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f203(s5); + } 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$parseexpr_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseexpr(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseexpr(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseexpr(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f204(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseinterval_expr() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_INTERVAL(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseexpr(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseinterval_unit(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f205(s3, s5); + } 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$parsecase_expr() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + + s0 = peg$currPos; + s1 = peg$parseKW_CASE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsecase_when_then_list(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecase_else(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parseKW_END(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseKW_CASE(); + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f206(s3, s5); + } 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$parseKW_CASE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseexpr(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecase_when_then_list(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecase_else(); + if (s7 === peg$FAILED) { + s7 = null; + } + s8 = peg$parse__(); + s9 = peg$parseKW_END(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseKW_CASE(); + if (s11 === peg$FAILED) { + s11 = null; + } + peg$savedPos = s0; + s0 = peg$f207(s3, s5, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsecase_when_then_list() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + s1 = peg$parsecase_when_then(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = []; + s4 = peg$currPos; + s5 = peg$parse__(); + s6 = peg$parsecase_when_then(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + s5 = peg$parse__(); + s6 = peg$parsecase_when_then(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f208(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecase_when_then() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseKW_WHEN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseor_and_where_expr(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_THEN(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseexpr(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f209(s3, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsecase_else() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_ELSE(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseexpr(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f210(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseexpr() { + var s0; + + s0 = peg$parselogic_operator_expr(); + if (s0 === peg$FAILED) { + s0 = peg$parseor_expr(); + if (s0 === peg$FAILED) { + s0 = peg$parseunary_expr(); + if (s0 === peg$FAILED) { + s0 = peg$parseset_op_stmt(); + } + } + } + + return s0; + } + + function peg$parselogic_operator_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__(); + s5 = peg$parseLOGIC_OPERATOR(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseprimary(); + 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; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseLOGIC_OPERATOR(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseprimary(); + 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 { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parsecomparison_op_right(); + if (s4 === peg$FAILED) { + s4 = null; + } + peg$savedPos = s0; + s0 = peg$f211(s1, s2, s4); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseunary_expr() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseadditive_operator(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseprimary(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseprimary(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f212(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsebinary_column_expr() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseexpr(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseKW_AND(); + if (s5 === peg$FAILED) { + s5 = peg$parseKW_OR(); + if (s5 === peg$FAILED) { + s5 = peg$parseLOGIC_OPERATOR(); + } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseexpr(); + 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; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseKW_AND(); + if (s5 === peg$FAILED) { + s5 = peg$parseKW_OR(); + if (s5 === peg$FAILED) { + s5 = peg$parseLOGIC_OPERATOR(); + } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseexpr(); + 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 { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f213(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseor_and_where_expr() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseexpr(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseKW_AND(); + if (s5 === peg$FAILED) { + s5 = peg$parseKW_OR(); + if (s5 === peg$FAILED) { + s5 = peg$parseCOMMA(); + } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseexpr(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseKW_AND(); + if (s5 === peg$FAILED) { + s5 = peg$parseKW_OR(); + if (s5 === peg$FAILED) { + s5 = peg$parseCOMMA(); + } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseexpr(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f214(s1, s2); + } else { + peg$currPos = s0; + 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__(); + s7 = peg$parseand_expr(); + 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; + } + 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__(); + s7 = peg$parseand_expr(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f215(s1, s2); + } 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__(); + s7 = peg$parsenot_expr(); + 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; + } + 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__(); + s7 = peg$parsenot_expr(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f216(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsenot_expr() { + var s0, s1, s2, s3, s4; + + s0 = peg$parsecomparison_expr(); + if (s0 === peg$FAILED) { + s0 = peg$parseexists_expr(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_NOT(); + if (s1 === peg$FAILED) { + s1 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 33) { + s2 = peg$c124; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e126); } + } + if (s2 !== peg$FAILED) { + s3 = peg$currPos; + peg$silentFails++; + if (input.charCodeAt(peg$currPos) === 61) { + s4 = peg$c122; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e124); } + } + peg$silentFails--; + if (s4 === peg$FAILED) { + s3 = undefined; + } 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) { + s2 = peg$parse__(); + s3 = peg$parsenot_expr(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f217(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + + 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__(); + s3 = peg$parsecomparison_op_right(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f218(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseliteral_string(); + if (s0 === peg$FAILED) { + s0 = peg$parsecolumn_ref(); + } + } + + return s0; + } + + function peg$parseexists_expr() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseexists_op(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseset_op_stmt(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f219(s1, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseexists_op() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = peg$parseKW_NOT(); + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parseKW_EXISTS(); + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + 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$f220(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$parseKW_EXISTS(); + } + + 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$parseregexp_op_right(); + } + } + } + } + } + + 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__(); + s4 = peg$parsearithmetic_comparison_operator(); + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + s6 = peg$parseadditive_expr(); + if (s6 !== peg$FAILED) { + s3 = [s3, s4, s5, s6]; + s2 = s3; + } 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__(); + s4 = peg$parsearithmetic_comparison_operator(); + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + s6 = peg$parseadditive_expr(); + if (s6 !== peg$FAILED) { + s3 = [s3, s4, s5, s6]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f221(s1); + } + s0 = s1; + + return s0; + } + + function peg$parsearithmetic_comparison_operator() { + var s0; + + if (input.substr(peg$currPos, 2) === peg$c125) { + s0 = peg$c125; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e127); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 62) { + s0 = peg$c126; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e128); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c127) { + s0 = peg$c127; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e129); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c128) { + s0 = peg$c128; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e130); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 60) { + s0 = peg$c129; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e131); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s0 = peg$c122; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e124); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c130) { + s0 = peg$c130; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e132); } + } + } + } + } + } + } + } + + return s0; + } + + function peg$parseis_op_right() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + s1 = peg$parseKW_IS(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseadditive_expr(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f222(s3); + } 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_IS(); + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parseKW_NOT(); + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseadditive_expr(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f223(s3); + } 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$parsebetween_or_not_between_op(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseadditive_expr(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_AND(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseadditive_expr(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f224(s1, s3, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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_or_not_between_op() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = peg$parseKW_NOT(); + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parseKW_BETWEEN(); + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + 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$f225(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$parseKW_BETWEEN(); + } + + 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__(); + 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; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f226(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$parseKW_LIKE(); + } + + return s0; + } + + function peg$parseregexp_op() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_NOT(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseKW_REGEXP(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_RLIKE(); + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f227(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + 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__(); + 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; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f228(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$parseKW_IN(); + } + + return s0; + } + + function peg$parseregexp_op_right() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseregexp_op(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c83) { + s3 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e84); } + } + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parsefunc_call(); + if (s5 === peg$FAILED) { + s5 = peg$parseliteral_string(); + if (s5 === peg$FAILED) { + s5 = peg$parsecolumn_ref(); + } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f229(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + 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__(); + s3 = peg$parseliteral(); + if (s3 === peg$FAILED) { + s3 = peg$parsecomparison_expr(); + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f230(s1, s3); + } 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__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseexpr_list(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f231(s1, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsein_op(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsevar_decl(); + if (s3 === peg$FAILED) { + s3 = peg$parsecolumn_ref(); + if (s3 === peg$FAILED) { + s3 = peg$parseliteral_string(); + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f232(s1, s3); + } 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__(); + s5 = peg$parseadditive_operator(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsemultiplicative_expr(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseadditive_operator(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsemultiplicative_expr(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f233(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseadditive_operator() { + var s0; + + if (input.charCodeAt(peg$currPos) === 43) { + s0 = peg$c131; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e133); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 45) { + s0 = peg$c132; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e134); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 126) { + s0 = peg$c133; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e135); } + } + } + } + + 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__(); + s5 = peg$parsemultiplicative_operator(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseprimary(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parsemultiplicative_operator(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseprimary(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f234(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsemultiplicative_operator() { + var s0, s1; + + if (input.charCodeAt(peg$currPos) === 42) { + s0 = peg$c134; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e136); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 47) { + s0 = peg$c135; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e137); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 37) { + s0 = peg$c136; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e138); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c137) { + s0 = peg$c137; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e139); } + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c138) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e140); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f235(); + } + s0 = s1; + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 38) { + s0 = peg$c139; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e141); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c140) { + s0 = peg$c140; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e142); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c141) { + s0 = peg$c141; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e143); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 94) { + s0 = peg$c142; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e144); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 124) { + s0 = peg$c143; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e145); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 126) { + s0 = peg$c133; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e135); } + } + } + } + } + } + } + } + } + } + } + } + + return s0; + } + + function peg$parseprimary() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$parsecast_expr(); + if (s0 === peg$FAILED) { + s0 = peg$parseliteral(); + if (s0 === peg$FAILED) { + s0 = peg$parsefulltext_search(); + if (s0 === peg$FAILED) { + s0 = peg$parseaggr_func(); + if (s0 === peg$FAILED) { + s0 = peg$parsefunc_call(); + if (s0 === peg$FAILED) { + s0 = peg$parsecase_expr(); + if (s0 === peg$FAILED) { + s0 = peg$parseinterval_expr(); + 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__(); + s3 = peg$parseor_and_where_expr(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseRPAREN(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f236(s3); + } 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$parsevar_decl(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse__(); + if (input.charCodeAt(peg$currPos) === 63) { + s2 = peg$c121; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e123); } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f237(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + } + } + } + } + } + } + } + } + + return s0; + } + + function peg$parsecolumn_ref() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8; + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = peg$parseident(); + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parseDOT(); + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + s2 = [s2, s3, s4, s5]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parsecolumn(); + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = []; + s5 = peg$currPos; + s6 = peg$parseDOUBLE_ARROW(); + if (s6 === peg$FAILED) { + s6 = peg$parseSINGLE_ARROW(); + } + if (s6 !== peg$FAILED) { + s7 = peg$parse__(); + s8 = peg$parseliteral_string(); + if (s8 === peg$FAILED) { + s8 = peg$parseliteral_numeric(); + } + if (s8 !== peg$FAILED) { + s6 = [s6, s7, s8]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$currPos; + s6 = peg$parseDOUBLE_ARROW(); + if (s6 === peg$FAILED) { + s6 = peg$parseSINGLE_ARROW(); + } + if (s6 !== peg$FAILED) { + s7 = peg$parse__(); + s8 = peg$parseliteral_string(); + if (s8 === peg$FAILED) { + s8 = peg$parseliteral_numeric(); + } + if (s8 !== peg$FAILED) { + s6 = [s6, s7, s8]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } + } else { + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + s6 = peg$parsecollate_expr(); + if (s6 === peg$FAILED) { + s6 = null; + } + peg$savedPos = s0; + s0 = peg$f238(s1, s2, s4, s6); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseident_name(); + if (s1 === peg$FAILED) { + s1 = peg$parsebackticks_quoted_ident(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseDOT(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecolumn_without_kw(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f239(s1, s5); + } 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$parsecolumn(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f240(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__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecolumn(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f241(s1, s2); + } 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$f242(s1); + if (s2) { + s2 = peg$FAILED; + } else { + s2 = undefined; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f243(s1); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parsequoted_ident(); + } + + return s0; + } + + function peg$parsealias_ident() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parseident_name(); + if (s1 !== peg$FAILED) { + peg$savedPos = peg$currPos; + s2 = peg$f244(s1); + if (s2) { + s2 = peg$FAILED; + } else { + s2 = undefined; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f245(s1); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsequoted_ident(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f246(s1); + } + s0 = s1; + } + + return s0; + } + + function peg$parsequoted_ident() { + var s0; + + s0 = peg$parsedouble_quoted_ident(); + if (s0 === peg$FAILED) { + s0 = peg$parsesingle_quoted_ident(); + if (s0 === peg$FAILED) { + s0 = peg$parsebackticks_quoted_ident(); + } + } + + return s0; + } + + function peg$parsedouble_quoted_ident() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c144; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e146); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$r1.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e147); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$r1.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e147); } + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c144; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e146); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f247(s2); + } 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$parsesingle_quoted_ident() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c72; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$r2.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e148); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$r2.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e148); } + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c72; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f248(s2); + } 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$parsebackticks_quoted_ident() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 96) { + s1 = peg$c145; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e149); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$r3.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e150); } + } + if (s3 === peg$FAILED) { + s3 = peg$parseescape_char(); + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$r3.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e150); } + } + if (s3 === peg$FAILED) { + s3 = peg$parseescape_char(); + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 96) { + s3 = peg$c145; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e149); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f249(s2); + } 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_without_kw() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parsecolumn_name(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f250(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$parsequoted_ident(); + } + + return s0; + } + + function peg$parsecolumn() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parsecolumn_name(); + if (s1 !== peg$FAILED) { + peg$savedPos = peg$currPos; + s2 = peg$f251(s1); + if (s2) { + s2 = peg$FAILED; + } else { + s2 = undefined; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f252(s1); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parsebackticks_quoted_ident(); + } + + 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(); + } + peg$savedPos = s0; + s0 = peg$f253(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + 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(); + } + peg$savedPos = s0; + s0 = peg$f254(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseident_start() { + var s0; + + if (peg$r4.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e151); } + } + + return s0; + } + + function peg$parseident_part() { + var s0; + + if (peg$r5.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e152); } + } + + return s0; + } + + function peg$parsecolumn_part() { + var s0; + + if (peg$r6.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e153); } + } + + return s0; + } + + function peg$parseparam() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 58) { + s2 = peg$c146; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e154); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseident_name(); + 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$f255(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, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseKW_SUM_MAX_MIN_AVG(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseadditive_expr(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseover_partition(); + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f256(s1, s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$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$parseon_update_current_timestamp() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + + s0 = peg$currPos; + s1 = peg$parseKW_ON(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_UPDATE(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_CURRENT_TIMESTAMP(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseLPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseexpr_list(); + if (s9 === peg$FAILED) { + s9 = null; + } + s10 = peg$parse__(); + s11 = peg$parseRPAREN(); + if (s11 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f257(s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_ON(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_UPDATE(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_CURRENT_TIMESTAMP(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f258(s5); + } 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$parseover_partition() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c147) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e155); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseas_window_specification(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f259(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseon_update_current_timestamp(); + } + + return s0; + } + + function peg$parsewindow_clause() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c148) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e156); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsenamed_window_expr_list(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f260(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsenamed_window_expr_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parsenamed_window_expr(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsenamed_window_expr(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsenamed_window_expr(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f261(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsenamed_window_expr() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseident_name(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_AS(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseas_window_specification(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f262(s1, s5); + } 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$parseas_window_specification() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$parseident_name(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseLPAREN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsewindow_specification(); + s4 = peg$parse__(); + s5 = peg$parseRPAREN(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f263(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parsewindow_specification() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parsepartition_by_clause(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseorder_by_clause(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parsewindow_frame_clause(); + if (s5 === peg$FAILED) { + s5 = null; + } + peg$savedPos = s0; + s0 = peg$f264(s1, s3, s5); + + return s0; + } + + function peg$parsewindow_specification_frameless() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsepartition_by_clause(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseorder_by_clause(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f265(s1, s3); + + return s0; + } + + function peg$parsewindow_frame_clause() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseKW_ROWS(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsewindow_frame_following(); + if (s3 === peg$FAILED) { + s3 = peg$parsewindow_frame_preceding(); + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f266(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_ROWS(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_BETWEEN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsewindow_frame_preceding(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_AND(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsewindow_frame_following(); + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f267(s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsewindow_frame_following() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsewindow_frame_value(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c149) { + s3 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e157); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f268(s1); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parsewindow_frame_current_row(); + } + + return s0; + } + + function peg$parsewindow_frame_preceding() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsewindow_frame_value(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c150) { + s3 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e158); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f269(s1); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parsewindow_frame_current_row(); + } + + return s0; + } + + function peg$parsewindow_frame_current_row() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c151) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e159); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c24) { + s3 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e24); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f270(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsewindow_frame_value() { + var s0, s1; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c152) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e160); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f271(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$parseliteral_numeric(); + } + + return s0; + } + + function peg$parseaggr_fun_count() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseKW_COUNT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_GROUP_CONCAT(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecount_arg(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseover_partition(); + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f272(s1, s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseconcat_separator() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c153) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e161); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseliteral_string(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f273(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecount_arg() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + + s0 = peg$currPos; + s1 = peg$parsestar_expr(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f274(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_DISTINCT(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseexpr(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseorder_by_clause(); + if (s9 === peg$FAILED) { + s9 = null; + } + s10 = peg$parse__(); + s11 = peg$parseconcat_separator(); + if (s11 === peg$FAILED) { + s11 = null; + } + peg$savedPos = s0; + s0 = peg$f275(s1, s5, s9, s11); + } 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$parseKW_DISTINCT(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseexpr(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseorder_by_clause(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parseconcat_separator(); + if (s7 === peg$FAILED) { + s7 = null; + } + peg$savedPos = s0; + s0 = peg$f276(s1, s3, s5, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + + return s0; + } + + function peg$parsestar_expr() { + var s0, s1; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c134; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e136); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f277(); + } + s0 = s1; + + return s0; + } + + function peg$parseconvert_args() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parsecolumn_ref(); + if (s1 === peg$FAILED) { + s1 = peg$parseliteral_string(); + if (s1 === peg$FAILED) { + s1 = peg$parseliteral_numeric(); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseCOMMA(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsecharacter_string_type(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsecreate_option_character_set_kw(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseident_name(); + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f278(s1, s5, s7, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsecolumn_ref(); + if (s1 === peg$FAILED) { + s1 = peg$parseliteral_string(); + if (s1 === peg$FAILED) { + s1 = peg$parseliteral_numeric(); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseCOMMA(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsedata_type(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f279(s1, s5); + } 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$parsecolumn_ref(); + if (s1 === peg$FAILED) { + s1 = peg$parseliteral_string(); + if (s1 === peg$FAILED) { + s1 = peg$parseliteral_numeric(); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_USING(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseident_name(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f280(s1, s5); + } 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$parseextract_filed() { + var s0, s1; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c154) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e162); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c155) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e163); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c156) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e164); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c157) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e165); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c158) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e166); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c159) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e167); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c160) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e168); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c161) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e169); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c162) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e170); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c163) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e171); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c164) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e172); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c165) { + s1 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e173); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c166) { + s1 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e174); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c167) { + s1 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e175); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c168) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e176); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c169) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e177); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c170) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e178); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c171) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e179); } + } + if (s1 === peg$FAILED) { + 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$e180); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c173) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e181); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 13).toLowerCase() === peg$c174) { + s1 = input.substr(peg$currPos, 13); + peg$currPos += 13; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e182); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 15).toLowerCase() === peg$c175) { + s1 = input.substr(peg$currPos, 15); + peg$currPos += 15; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e183); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c176) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e184); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c177) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e185); } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f281(s1); + } + s0 = s1; + + return s0; + } + + function peg$parseextract_func() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13; + + s0 = peg$currPos; + s1 = peg$parseKW_EXTRACT(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseextract_filed(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_FROM(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseKW_TIMESTAMP(); + if (s9 === peg$FAILED) { + s9 = peg$parseKW_INTERVAL(); + if (s9 === peg$FAILED) { + s9 = peg$parseKW_TIME(); + if (s9 === peg$FAILED) { + s9 = peg$parseKW_DATE(); + } + } + } + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseexpr(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parseRPAREN(); + if (s13 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f282(s1, s5, s9, s11); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_EXTRACT(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseextract_filed(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_FROM(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseexpr(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseRPAREN(); + if (s11 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f283(s1, s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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; + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c178) { + s1 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e186); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseexpr(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseCOMMA(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseextract_filed(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseRPAREN(); + if (s11 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f284(s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsetrim_position() { + var s0; + + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c179) { + s0 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e187); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c180) { + s0 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e188); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c181) { + s0 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e189); } + } + } + } + + return s0; + } + + function peg$parsetrim_rem() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parsetrim_position(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseliteral_string(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseKW_FROM(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f285(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsetrim_func_clause() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c182) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e190); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsetrim_rem(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parseexpr(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseRPAREN(); + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f286(s5, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsefunc_call() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$parseextract_func(); + if (s0 === peg$FAILED) { + s0 = peg$parsetrim_func_clause(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c183) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e191); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseconvert_args(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsecollate_expr(); + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f287(s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseproc_func_name(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseor_and_where_expr(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseover_partition(); + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f288(s1, s5, s9); + } 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$parsescalar_func(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseexpr_list(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseover_partition(); + if (s9 === peg$FAILED) { + s9 = null; + } + peg$savedPos = s0; + s0 = peg$f289(s1, s5, s9); + } 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$parsescalar_time_func(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseon_update_current_timestamp(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f290(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + } + } + + return s0; + } + + function peg$parsescalar_time_func() { + var s0; + + s0 = peg$parseKW_CURRENT_DATE(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_CURRENT_TIME(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_CURRENT_TIMESTAMP(); + } + } + + return s0; + } + + function peg$parsescalar_func() { + var s0; + + s0 = peg$parsescalar_time_func(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_CURRENT_USER(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_USER(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_SESSION_USER(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_SYSTEM_USER(); + } + } + } + } + + return s0; + } + + function peg$parsecast_expr() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21; + + s0 = peg$currPos; + s1 = peg$parseKW_CAST(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseexpr(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_AS(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsecharacter_string_type(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parsecreate_option_character_set_kw(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parseident_name(); + if (s13 !== peg$FAILED) { + s14 = peg$parse__(); + s15 = peg$parseRPAREN(); + if (s15 !== peg$FAILED) { + s16 = peg$parse__(); + s17 = peg$parsecollate_expr(); + if (s17 === peg$FAILED) { + s17 = null; + } + peg$savedPos = s0; + s0 = peg$f291(s1, s5, s9, s11, s13, s17); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_CAST(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseexpr(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_AS(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsedata_type(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseRPAREN(); + if (s11 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f292(s1, s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_CAST(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseexpr(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_AS(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseKW_DECIMAL(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseLPAREN(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parseint(); + if (s13 !== peg$FAILED) { + s14 = peg$parse__(); + s15 = peg$parseRPAREN(); + if (s15 !== peg$FAILED) { + s16 = peg$parse__(); + s17 = peg$parseRPAREN(); + if (s17 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f293(s1, s5, s13); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_CAST(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseexpr(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_AS(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parseKW_DECIMAL(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseLPAREN(); + if (s11 !== peg$FAILED) { + s12 = peg$parse__(); + s13 = peg$parseint(); + if (s13 !== peg$FAILED) { + s14 = peg$parse__(); + s15 = peg$parseCOMMA(); + if (s15 !== peg$FAILED) { + s16 = peg$parse__(); + s17 = peg$parseint(); + if (s17 !== peg$FAILED) { + s18 = peg$parse__(); + s19 = peg$parseRPAREN(); + if (s19 !== peg$FAILED) { + s20 = peg$parse__(); + s21 = peg$parseRPAREN(); + if (s21 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f294(s1, s5, s13, s17); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_CAST(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseexpr(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseKW_AS(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsesignedness(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseKW_INTEGER(); + if (s11 === peg$FAILED) { + s11 = null; + } + s12 = peg$parse__(); + s13 = peg$parseRPAREN(); + if (s13 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f295(s1, s5, s9, s11); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parsesignedness() { + var s0; + + s0 = peg$parseKW_SIGNED(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_UNSIGNED(); + } + + return s0; + } + + function peg$parseliteral() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c83) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e192); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c184) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e193); } + } + } + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseliteral_string(); + if (s3 !== peg$FAILED) { + s4 = peg$currPos; + s5 = peg$parse__(); + s6 = peg$parsecollate_expr(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 === peg$FAILED) { + s4 = null; + } + peg$savedPos = s0; + s0 = peg$f296(s1, s3, s4); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseliteral_numeric(); + if (s0 === peg$FAILED) { + s0 = peg$parseliteral_bool(); + if (s0 === peg$FAILED) { + s0 = peg$parseliteral_null(); + if (s0 === peg$FAILED) { + s0 = peg$parseliteral_datetime(); + } + } + } + } + + 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__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseliteral(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseliteral(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f297(s1, s2); + } 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$f298(); + } + s0 = s1; + + return s0; + } + + function peg$parseliteral_not_null() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parseKW_NOT_NULL(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f299(); + } + 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$f300(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_FALSE(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f301(); + } + s0 = s1; + } + + return s0; + } + + function peg$parseliteral_string() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c184) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e193); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c185) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e194); } + } + } + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + if (input.substr(peg$currPos, 1).toLowerCase() === peg$c186) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e195); } + } + if (s3 !== peg$FAILED) { + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s5 = peg$c72; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s5 !== peg$FAILED) { + s6 = []; + if (peg$r7.test(input.charAt(peg$currPos))) { + s7 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e196); } + } + while (s7 !== peg$FAILED) { + s6.push(s7); + if (peg$r7.test(input.charAt(peg$currPos))) { + s7 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e196); } + } + } + if (input.charCodeAt(peg$currPos) === 39) { + s7 = peg$c72; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s7 !== peg$FAILED) { + s5 = [s5, s6, s7]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f302(s1, s3, s4); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c184) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e193); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c185) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e194); } + } + } + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + if (input.substr(peg$currPos, 1).toLowerCase() === peg$c187) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e197); } + } + if (s3 !== peg$FAILED) { + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s5 = peg$c72; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s5 !== peg$FAILED) { + s6 = []; + if (peg$r7.test(input.charAt(peg$currPos))) { + s7 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e196); } + } + while (s7 !== peg$FAILED) { + s6.push(s7); + if (peg$r7.test(input.charAt(peg$currPos))) { + s7 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e196); } + } + } + if (input.charCodeAt(peg$currPos) === 39) { + s7 = peg$c72; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s7 !== peg$FAILED) { + s5 = [s5, s6, s7]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f303(s1, s3, s4); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c184) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e193); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c185) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e194); } + } + } + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c188) { + s3 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e198); } + } + if (s3 !== peg$FAILED) { + s4 = []; + if (peg$r7.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e196); } + } + while (s5 !== peg$FAILED) { + s4.push(s5); + if (peg$r7.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e196); } + } + } + peg$savedPos = s0; + s0 = peg$f304(s1, s3, s4); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 1).toLowerCase() === peg$c189) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e199); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c72; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parsesingle_char(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parsesingle_char(); + } + if (input.charCodeAt(peg$currPos) === 39) { + s5 = peg$c72; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s5 !== peg$FAILED) { + s3 = [s3, s4, s5]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f305(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s2 = peg$c72; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parsesingle_char(); + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parsesingle_char(); + } + if (input.charCodeAt(peg$currPos) === 39) { + s4 = peg$c72; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + 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$f306(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s2 = peg$c144; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e146); } + } + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parsesingle_quote_char(); + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parsesingle_quote_char(); + } + if (input.charCodeAt(peg$currPos) === 34) { + s4 = peg$c144; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e146); } + } + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + 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$f307(s1); + } + s0 = s1; + } + } + } + } + } + + return s0; + } + + function peg$parseliteral_datetime() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + s1 = peg$parseKW_TIME(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DATE(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_TIMESTAMP(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DATETIME(); + } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s4 = peg$c72; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s4 !== peg$FAILED) { + s5 = []; + s6 = peg$parsesingle_char(); + while (s6 !== peg$FAILED) { + s5.push(s6); + s6 = peg$parsesingle_char(); + } + if (input.charCodeAt(peg$currPos) === 39) { + s6 = peg$c72; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e73); } + } + if (s6 !== peg$FAILED) { + s4 = [s4, s5, s6]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f308(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_TIME(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DATE(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_TIMESTAMP(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DATETIME(); + } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s4 = peg$c144; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e146); } + } + if (s4 !== peg$FAILED) { + s5 = []; + s6 = peg$parsesingle_quote_char(); + while (s6 !== peg$FAILED) { + s5.push(s6); + s6 = peg$parsesingle_quote_char(); + } + if (input.charCodeAt(peg$currPos) === 34) { + s6 = peg$c144; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e146); } + } + if (s6 !== peg$FAILED) { + s4 = [s4, s5, s6]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f309(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parsesingle_quote_char() { + var s0; + + if (peg$r8.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e200); } + } + if (s0 === peg$FAILED) { + s0 = peg$parseescape_char(); + } + + return s0; + } + + function peg$parsesingle_char() { + var s0; + + if (peg$r9.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e201); } + } + 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$c190) { + s1 = peg$c190; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e202); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f310(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c191) { + s1 = peg$c191; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e203); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f311(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c192) { + s1 = peg$c192; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e204); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f312(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c193) { + s1 = peg$c193; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e205); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f313(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c194) { + s1 = peg$c194; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e206); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f314(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c195) { + s1 = peg$c195; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e207); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f315(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c196) { + s1 = peg$c196; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e208); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f316(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c197) { + s1 = peg$c197; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e209); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f317(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c198) { + s1 = peg$c198; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e210); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f318(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c199) { + s1 = peg$c199; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e211); } + } + 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; + s0 = peg$f319(s2, s3, s4, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c200; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e212); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f320(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c201) { + s1 = peg$c201; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e213); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f321(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c202) { + s1 = peg$c202; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e214); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f322(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c203) { + s1 = peg$c203; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e215); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f323(); + } + s0 = s1; + } + } + } + } + } + } + } + } + } + } + } + } + } + + return s0; + } + + function peg$parseline_terminator() { + var s0; + + if (peg$r10.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e216); } + } + + return s0; + } + + function peg$parseliteral_numeric() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parsenumber(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f324(s1); + } + s0 = s1; + + return s0; + } + + function peg$parsenumber() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseint(); + if (s1 !== peg$FAILED) { + s2 = peg$parsefrac(); + if (s2 !== peg$FAILED) { + s3 = peg$parseexp(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f325(s1, s2, s3); + } 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$parsefrac(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f326(s1, s2); + } 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$parseexp(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f327(s1, s2); + } 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) { + peg$savedPos = s0; + s1 = peg$f328(s1); + } + s0 = s1; + } + } + } + + return s0; + } + + function peg$parseint() { + var s0, s1, s2; + + s0 = peg$parsedigits(); + if (s0 === peg$FAILED) { + s0 = peg$parsedigit(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 45) { + s1 = peg$c132; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e134); } + } + if (s1 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 43) { + s1 = peg$c131; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e133); } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsedigits(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f329(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 45) { + s1 = peg$c132; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e134); } + } + if (s1 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 43) { + s1 = peg$c131; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e133); } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsedigit(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f330(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + + return s0; + } + + function peg$parsefrac() { + var s0, s1, s2; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s1 = peg$c204; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e217); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsedigits(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f331(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + 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; + s0 = peg$f332(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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(); + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f333(s1); + } + s0 = s1; + + return s0; + } + + function peg$parsedigit() { + var s0; + + if (peg$r0.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + + return s0; + } + + function peg$parsehexDigit() { + var s0; + + if (peg$r11.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e218); } + } + + return s0; + } + + function peg$parsee() { + var s0, s1, s2; + + s0 = peg$currPos; + if (peg$r12.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e219); } + } + if (s1 !== peg$FAILED) { + if (peg$r13.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e220); } + } + if (s2 === peg$FAILED) { + s2 = null; + } + peg$savedPos = s0; + s0 = peg$f334(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_NULL() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c205) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e221); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_DEFAULT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c28) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e28); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_NOT_NULL() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c206) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e222); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c207) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e223); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_TO() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c208) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e224); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c209) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e225); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c210) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e226); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_DROP() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c211) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e227); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f335(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_USE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c212) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e228); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_ALTER() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c213) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e229); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c214) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e230); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c215) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e231); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c216) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e232); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_TEMPORARY() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c217) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e233); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_DELETE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c218) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e234); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c219) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e235); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_RECURSIVE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c220) { + s1 = peg$c220; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e236); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c221) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e237); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_RENAME() { + 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$e238); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_IGNORE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c223) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e239); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c224) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e240); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_PARTITION() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c225) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e241); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f336(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_INTO() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c226) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e242); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c227) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e243); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c62) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e63); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_UNLOCK() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c228) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e244); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_LOCK() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c41) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e42); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c34) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e34); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_TABLE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c229) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e245); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f337(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_TRIGGER() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c230) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e246); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f338(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_TABLES() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c231) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e247); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f339(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_DATABASE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c232) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e248); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f340(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_SCHEMA() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c233) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e249); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f341(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_COLLATE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c64) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e65); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f342(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c234) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e250); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c235) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e251); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_RIGHT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c236) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e252); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_FULL() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c237) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e253); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c238) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e254); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_CROSS() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c239) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e255); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_JOIN() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c240) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e256); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_OUTER() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c241) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e257); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_OVER() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c147) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e155); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c242) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e258); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_MINUS() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c243) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e259); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_INTERSECT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c244) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e260); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c245) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e261); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_USING() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c246) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e262); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_WHERE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c247) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e263); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_WITH() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c108) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e110); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_GO() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c248) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e264); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f343(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c249) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e265); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c250) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e266); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c251) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e267); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c252) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e268); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_LIMIT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c253) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e269); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_OFFSET() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c254) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e270); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f344(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c255) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e271); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f345(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c256) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e272); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f346(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_DESCRIBE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c257) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e273); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f347(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c258) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e274); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f348(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_DISTINCT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c259) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e275); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f349(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c260) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e276); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f350(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c99) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e101); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f351(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c261) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e277); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f352(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_LIKE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c262) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e278); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f353(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_RLIKE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c263) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e279); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f354(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_REGEXP() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c264) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e280); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f355(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c37) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e281); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f356(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c49) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e50); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f357(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c265) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e282); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f358(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_OR() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c266) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e283); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f359(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c267) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e284); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f360(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_GROUP_CONCAT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c268) { + s1 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e285); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f361(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c269) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e286); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f362(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$c270) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e287); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f363(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + 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$e288); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f364(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_AVG() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c272) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e289); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f365(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_EXTRACT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c273) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e290); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f366(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_CALL() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c274) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e291); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f367(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_CASE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c275) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e292); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_WHEN() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c276) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e293); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_THEN() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c277) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e294); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_ELSE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c278) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e295); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_END() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c279) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e296); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_CAST() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c280) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e297); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f368(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_BINARY() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c83) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e84); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f369(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_VARBINARY() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c281) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e298); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f370(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_BIT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c282) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e299); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f371(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_CHAR() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c283) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e300); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f372(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_VARCHAR() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c284) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e301); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f373(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_NUMERIC() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c285) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e302); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f374(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_DECIMAL() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c286) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e303); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f375(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_SIGNED() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c287) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e304); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f376(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_UNSIGNED() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c288) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e305); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f377(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_INT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c289) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e306); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f378(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_ZEROFILL() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c290) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e307); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f379(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_INTEGER() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c291) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e308); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f380(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_JSON() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c292) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e309); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f381(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_SMALLINT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c293) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e310); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f382(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_MEDIUMINT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c294) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e311); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f383(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_TINYINT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c295) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e312); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f384(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_TINYTEXT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c296) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e313); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f385(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_TEXT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c297) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e314); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f386(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_MEDIUMTEXT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c298) { + s1 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e315); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f387(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_LONGTEXT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c299) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e316); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f388(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_BIGINT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c300) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e317); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f389(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_ENUM() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c301) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e318); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f390(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_FLOAT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c302) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e319); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f391(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_DOUBLE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c303) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e320); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f392(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_DATE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c156) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e164); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f393(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_DATETIME() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c304) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e321); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f394(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_ROWS() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c305) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e322); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f395(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_TIME() { + 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$e180); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f396(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_TIMESTAMP() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c306) { + s1 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e323); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f397(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_YEAR() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c177) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e185); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f398(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_TRUNCATE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c307) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e324); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f399(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_USER() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c308) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e325); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f400(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_CURRENT_DATE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c309) { + s1 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e326); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f401(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_ADD_DATE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c310) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e327); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f402(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_INTERVAL() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c311) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e328); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f403(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_UNIT_YEAR() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c177) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e185); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f404(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_UNIT_MONTH() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c169) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e177); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f405(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_UNIT_WEEK() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c176) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e184); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f406(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_UNIT_DAY() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c155) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e163); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f407(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_UNIT_HOUR() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c161) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e169); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f408(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_UNIT_MINUTE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c168) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e176); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f409(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_UNIT_SECOND() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c171) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e179); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f410(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_CURRENT_TIME() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c312) { + s1 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e329); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f411(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_CURRENT_TIMESTAMP() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 17).toLowerCase() === peg$c313) { + s1 = input.substr(peg$currPos, 17); + peg$currPos += 17; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e330); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f412(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_CURRENT_USER() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c314) { + s1 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e331); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f413(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_SESSION_USER() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c315) { + s1 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e332); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f414(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_SYSTEM_USER() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c316) { + s1 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e333); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f415(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_GLOBAL() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c317) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e334); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f416(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_SESSION() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c318) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e335); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f417(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_LOCAL() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c2) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e2); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f418(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_PERSIST() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c319) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e336); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f419(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_PERSIST_ONLY() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c320) { + s1 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e337); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f420(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_VIEW() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c321) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e338); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f421(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_GEOMETRY() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c322) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e339); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f422(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_POINT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c323) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e340); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f423(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_LINESTRING() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c324) { + s1 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e341); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f424(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_POLYGON() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c325) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e342); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f425(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_MULTIPOINT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c326) { + s1 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e343); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f426(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_MULTILINESTRING() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 15).toLowerCase() === peg$c327) { + s1 = input.substr(peg$currPos, 15); + peg$currPos += 15; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e344); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f427(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_MULTIPOLYGON() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c328) { + s1 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e345); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f428(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_GEOMETRYCOLLECTION() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 18).toLowerCase() === peg$c329) { + s1 = input.substr(peg$currPos, 18); + peg$currPos += 18; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e346); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f429(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_VAR__PRE_AT() { + var s0; + + if (input.charCodeAt(peg$currPos) === 64) { + s0 = peg$c17; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e17); } + } + + return s0; + } + + function peg$parseKW_VAR__PRE_AT_AT() { + var s0; + + if (input.substr(peg$currPos, 2) === peg$c330) { + s0 = peg$c330; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e347); } + } + + return s0; + } + + function peg$parseKW_VAR_PRE_DOLLAR() { + var s0; + + if (input.charCodeAt(peg$currPos) === 36) { + s0 = peg$c331; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e348); } + } + + return s0; + } + + function peg$parseKW_VAR_PRE() { + var s0; + + s0 = peg$parseKW_VAR__PRE_AT_AT(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_VAR__PRE_AT(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_VAR_PRE_DOLLAR(); + } + } + + return s0; + } + + function peg$parseKW_RETURN() { + var s0; + + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c332) { + s0 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e349); } + } + + return s0; + } + + function peg$parseKW_ASSIGN() { + var s0; + + if (input.substr(peg$currPos, 2) === peg$c333) { + s0 = peg$c333; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e350); } + } + + return s0; + } + + function peg$parseKW_ASSIGIN_EQUAL() { + var s0; + + if (input.charCodeAt(peg$currPos) === 61) { + s0 = peg$c122; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e124); } + } + + return s0; + } + + function peg$parseKW_DUAL() { + var s0; + + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c334) { + s0 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e351); } + } + + return s0; + } + + function peg$parseKW_ADD() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c335) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e352); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f430(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_COLUMN() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c336) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e353); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f431(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_INDEX() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c337) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e354); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f432(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_KEY() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c15) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e15); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f433(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_FULLTEXT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c338) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e355); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f434(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_SPATIAL() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c339) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e356); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f435(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_UNIQUE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c14) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e14); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f436(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_KEY_BLOCK_SIZE() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 14).toLowerCase() === peg$c66) { + s1 = input.substr(peg$currPos, 14); + peg$currPos += 14; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e67); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f437(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_COMMENT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c340) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e357); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f438(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_CONSTRAINT() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c341) { + s1 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e358); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f439(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKW_REFERENCES() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c342) { + s1 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e359); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f440(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseOPT_SQL_CALC_FOUND_ROWS() { + var s0; + + if (input.substr(peg$currPos, 19).toLowerCase() === peg$c343) { + s0 = input.substr(peg$currPos, 19); + peg$currPos += 19; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e360); } + } + + return s0; + } + + function peg$parseOPT_SQL_CACHE() { + var s0; + + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c344) { + s0 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e361); } + } + + return s0; + } + + function peg$parseOPT_SQL_NO_CACHE() { + var s0; + + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c345) { + s0 = input.substr(peg$currPos, 12); + peg$currPos += 12; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e362); } + } + + return s0; + } + + function peg$parseOPT_SQL_SMALL_RESULT() { + var s0; + + if (input.substr(peg$currPos, 16).toLowerCase() === peg$c346) { + s0 = input.substr(peg$currPos, 16); + peg$currPos += 16; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e363); } + } + + return s0; + } + + function peg$parseOPT_SQL_BIG_RESULT() { + var s0; + + if (input.substr(peg$currPos, 14).toLowerCase() === peg$c347) { + s0 = input.substr(peg$currPos, 14); + peg$currPos += 14; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e364); } + } + + return s0; + } + + function peg$parseOPT_SQL_BUFFER_RESULT() { + var s0; + + if (input.substr(peg$currPos, 17).toLowerCase() === peg$c348) { + s0 = input.substr(peg$currPos, 17); + peg$currPos += 17; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e365); } + } + + return s0; + } + + function peg$parseDOT() { + var s0; + + if (input.charCodeAt(peg$currPos) === 46) { + s0 = peg$c204; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e217); } + } + + return s0; + } + + function peg$parseCOMMA() { + var s0; + + if (input.charCodeAt(peg$currPos) === 44) { + s0 = peg$c349; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e366); } + } + + return s0; + } + + function peg$parseSTAR() { + var s0; + + if (input.charCodeAt(peg$currPos) === 42) { + s0 = peg$c134; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e136); } + } + + return s0; + } + + function peg$parseLPAREN() { + var s0; + + if (input.charCodeAt(peg$currPos) === 40) { + s0 = peg$c97; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e98); } + } + + return s0; + } + + function peg$parseRPAREN() { + var s0; + + if (input.charCodeAt(peg$currPos) === 41) { + s0 = peg$c98; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e99); } + } + + return s0; + } + + function peg$parseLBRAKE() { + var s0; + + if (input.charCodeAt(peg$currPos) === 91) { + s0 = peg$c350; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e367); } + } + + return s0; + } + + function peg$parseRBRAKE() { + var s0; + + if (input.charCodeAt(peg$currPos) === 93) { + s0 = peg$c351; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e368); } + } + + return s0; + } + + function peg$parseSEMICOLON() { + var s0; + + if (input.charCodeAt(peg$currPos) === 59) { + s0 = peg$c352; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e369); } + } + + return s0; + } + + function peg$parseSINGLE_ARROW() { + var s0; + + if (input.substr(peg$currPos, 2) === peg$c353) { + s0 = peg$c353; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e370); } + } + + return s0; + } + + function peg$parseDOUBLE_ARROW() { + var s0; + + if (input.substr(peg$currPos, 3) === peg$c354) { + s0 = peg$c354; + peg$currPos += 3; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e371); } + } + + return s0; + } + + function peg$parseOPERATOR_CONCATENATION() { + var s0; + + if (input.substr(peg$currPos, 2) === peg$c137) { + s0 = peg$c137; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e139); } + } + + return s0; + } + + function peg$parseOPERATOR_AND() { + var s0; + + if (input.substr(peg$currPos, 2) === peg$c355) { + s0 = peg$c355; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e372); } + } + + return s0; + } + + function peg$parseOPERATOR_XOR() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c356) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e373); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f441(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseLOGIC_OPERATOR() { + var s0; + + s0 = peg$parseOPERATOR_CONCATENATION(); + if (s0 === peg$FAILED) { + s0 = peg$parseOPERATOR_AND(); + if (s0 === peg$FAILED) { + s0 = peg$parseOPERATOR_XOR(); + } + } + + return s0; + } + + function peg$parse__() { + var s0, s1; + + s0 = []; + s1 = peg$parsewhitespace(); + if (s1 === peg$FAILED) { + s1 = peg$parsecomment(); + } + while (s1 !== peg$FAILED) { + s0.push(s1); + s1 = peg$parsewhitespace(); + if (s1 === peg$FAILED) { + s1 = peg$parsecomment(); + } + } + + return s0; + } + + function peg$parse___() { + var s0, s1; + + s0 = []; + s1 = peg$parsewhitespace(); + if (s1 === peg$FAILED) { + s1 = peg$parsecomment(); + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + s1 = peg$parsewhitespace(); + if (s1 === peg$FAILED) { + s1 = peg$parsecomment(); + } + } + } else { + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsecomment() { + var s0; + + s0 = peg$parseblock_comment(); + if (s0 === peg$FAILED) { + s0 = peg$parseline_comment(); + if (s0 === peg$FAILED) { + s0 = peg$parsepound_sign_comment(); + } + } + + return s0; + } + + function peg$parseblock_comment() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c357) { + s1 = peg$c357; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e374); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$currPos; + peg$silentFails++; + if (input.substr(peg$currPos, 2) === peg$c358) { + s5 = peg$c358; + peg$currPos += 2; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e375); } + } + peg$silentFails--; + if (s5 === peg$FAILED) { + s4 = undefined; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s5 = peg$parsechar(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } 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$currPos; + peg$silentFails++; + if (input.substr(peg$currPos, 2) === peg$c358) { + s5 = peg$c358; + peg$currPos += 2; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e375); } + } + peg$silentFails--; + if (s5 === peg$FAILED) { + s4 = undefined; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s5 = peg$parsechar(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (input.substr(peg$currPos, 2) === peg$c358) { + s3 = peg$c358; + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e375); } + } + if (s3 !== peg$FAILED) { + s1 = [s1, s2, s3]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseline_comment() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c359) { + s1 = peg$c359; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e376); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$currPos; + peg$silentFails++; + s5 = peg$parseEOL(); + peg$silentFails--; + if (s5 === peg$FAILED) { + s4 = undefined; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s5 = peg$parsechar(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } 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$currPos; + peg$silentFails++; + s5 = peg$parseEOL(); + peg$silentFails--; + if (s5 === peg$FAILED) { + s4 = undefined; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s5 = peg$parsechar(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsepound_sign_comment() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 35) { + s1 = peg$c360; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e377); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$currPos; + peg$silentFails++; + s5 = peg$parseEOL(); + peg$silentFails--; + if (s5 === peg$FAILED) { + s4 = undefined; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s5 = peg$parsechar(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } 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$currPos; + peg$silentFails++; + s5 = peg$parseEOL(); + peg$silentFails--; + if (s5 === peg$FAILED) { + s4 = undefined; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + s5 = peg$parsechar(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsekeyword_comment() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseKW_COMMENT(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGIN_EQUAL(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse__(); + s5 = peg$parseliteral_string(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f442(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + 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$e378); } + } + + return s0; + } + + function peg$parseinterval_unit() { + var s0; + + s0 = peg$parseKW_UNIT_YEAR(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_UNIT_MONTH(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_UNIT_WEEK(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_UNIT_DAY(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_UNIT_HOUR(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_UNIT_MINUTE(); + if (s0 === peg$FAILED) { + s0 = peg$parseKW_UNIT_SECOND(); + } + } + } + } + } + } + + return s0; + } + + function peg$parsewhitespace() { + var s0; + + if (peg$r14.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e379); } + } + + return s0; + } + + function peg$parseEOL() { + var s0, s1; + + s0 = peg$parseEOF(); + if (s0 === peg$FAILED) { + s0 = []; + if (peg$r10.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e216); } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$r10.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e216); } + } + } + } else { + s0 = peg$FAILED; + } + } + + 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$e378); } + } + peg$silentFails--; + if (s1 === peg$FAILED) { + s0 = undefined; + } 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; + peg$savedPos = peg$currPos; + s1 = peg$f443(); + if (s1) { + s1 = undefined; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseassign_stmt(); + if (s3 === peg$FAILED) { + s3 = peg$parsereturn_stmt(); + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f444(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + 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) { + s1 = peg$parsewithout_prefix_var_decl(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_ASSIGN(); + if (s3 === peg$FAILED) { + s3 = peg$parseKW_ASSIGIN_EQUAL(); + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseproc_expr(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f445(s1, s3, s5); + } 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$parsereturn_stmt() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_RETURN(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseproc_expr(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f446(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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__(); + s5 = peg$parseadditive_operator(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseproc_multiplicative_expr(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseadditive_operator(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseproc_multiplicative_expr(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f447(s1, s2); + } 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__(); + s5 = peg$parsemultiplicative_operator(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseproc_primary(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parsemultiplicative_operator(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseproc_primary(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f448(s1, s2); + } 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__(); + s3 = peg$parsejoin_op(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parsevar_decl(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseon_clause(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f449(s1, s3, s5, s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$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$parsecolumn_ref(); + 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__(); + s3 = peg$parseproc_additive_expr(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseRPAREN(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f450(s3); + } 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$parseproc_func_name() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + s1 = peg$parseident_name(); + if (s1 === peg$FAILED) { + s1 = peg$parsequoted_ident(); + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = peg$parse__(); + s4 = peg$parseDOT(); + if (s4 !== peg$FAILED) { + s5 = peg$parse__(); + s6 = peg$parseident_name(); + if (s6 === peg$FAILED) { + s6 = peg$parsequoted_ident(); + } + if (s6 !== peg$FAILED) { + s3 = [s3, s4, s5, s6]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 === peg$FAILED) { + s2 = null; + } + peg$savedPos = s0; + s0 = peg$f451(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseident_name(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f452(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$parsequoted_ident(); + } + } + + return s0; + } + + function peg$parseproc_func_call() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseproc_func_name(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseproc_primary_list(); + if (s5 === peg$FAILED) { + s5 = null; + } + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f453(s1, s5); + } 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$parseproc_func_name(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f454(s1); + } + s0 = s1; + } + + 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__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseproc_primary(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseproc_primary(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f455(s1, s2); + } 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__(); + s3 = peg$parseproc_primary_list(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseRBRAKE(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f456(s3); + } 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$parsevar_decl_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parsevar_decl(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsevar_decl(); + 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; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsevar_decl(); + 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; + } + } + peg$savedPos = s0; + s0 = peg$f457(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsevar_decl() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parseKW_VAR_PRE(); + if (s1 !== peg$FAILED) { + s2 = peg$parsewithout_prefix_var_decl(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f458(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsewithout_prefix_var_decl() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parseident_name(); + if (s1 !== peg$FAILED) { + s2 = peg$parsemem_chain(); + peg$savedPos = s0; + s0 = peg$f459(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseliteral_numeric(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f460(s1); + } + s0 = s1; + } + + 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$c204; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e217); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseident_name(); + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } 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$c204; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e217); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseident_name(); + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } + peg$savedPos = s0; + s1 = peg$f461(s1); + s0 = s1; + + return s0; + } + + function peg$parsedata_type() { + var s0; + + s0 = peg$parsecharacter_string_type(); + if (s0 === peg$FAILED) { + s0 = peg$parsenumeric_type(); + if (s0 === peg$FAILED) { + s0 = peg$parsedatetime_type(); + if (s0 === peg$FAILED) { + s0 = peg$parsejson_type(); + if (s0 === peg$FAILED) { + s0 = peg$parsetext_type(); + if (s0 === peg$FAILED) { + s0 = peg$parseenum_type(); + if (s0 === peg$FAILED) { + s0 = peg$parseboolean_type(); + if (s0 === peg$FAILED) { + s0 = peg$parsebinary_type(); + if (s0 === peg$FAILED) { + s0 = peg$parseblob_type(); + if (s0 === peg$FAILED) { + s0 = peg$parsegeometry_type(); + } + } + } + } + } + } + } + } + } + + return s0; + } + + function peg$parseboolean_type() { + var s0, s1; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c111) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e380); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f462(); + } + s0 = s1; + + return s0; + } + + function peg$parseblob_type() { + var s0, s1; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c361) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e381); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c362) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e382); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c363) { + s1 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e383); } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c364) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e384); } + } + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f463(s1); + } + s0 = s1; + + return s0; + } + + function peg$parsebinary_type() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseKW_BINARY(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_VARBINARY(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = []; + if (peg$r0.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + if (s6 !== peg$FAILED) { + while (s6 !== peg$FAILED) { + s5.push(s6); + if (peg$r0.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + } + } else { + s5 = peg$FAILED; + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f464(s1, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_BINARY(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f465(s1); + } + s0 = s1; + } + + return s0; + } + + function peg$parsecharacter_string_type() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseKW_CHAR(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_VARCHAR(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = []; + if (peg$r0.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + if (s6 !== peg$FAILED) { + while (s6 !== peg$FAILED) { + s5.push(s6); + if (peg$r0.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + } + } else { + s5 = peg$FAILED; + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f466(s1, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_CHAR(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f467(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_VARCHAR(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f468(s1); + } + s0 = s1; + } + } + + return s0; + } + + function peg$parsenumeric_type_suffix() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_UNSIGNED(); + if (s1 === peg$FAILED) { + s1 = null; + } + s2 = peg$parse__(); + s3 = peg$parseKW_ZEROFILL(); + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f469(s1, s3); + + return s0; + } + + function peg$parsenumeric_type() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + + s0 = peg$currPos; + s1 = peg$parseKW_NUMERIC(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DECIMAL(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_INT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_INTEGER(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_SMALLINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_MEDIUMINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_TINYINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_BIGINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_FLOAT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DOUBLE(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_BIT(); + } + } + } + } + } + } + } + } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = []; + if (peg$r0.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + if (s6 !== peg$FAILED) { + while (s6 !== peg$FAILED) { + s5.push(s6); + if (peg$r0.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + } + } else { + s5 = peg$FAILED; + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$currPos; + s8 = peg$parseCOMMA(); + if (s8 !== peg$FAILED) { + s9 = peg$parse__(); + s10 = []; + if (peg$r0.test(input.charAt(peg$currPos))) { + s11 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s11 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + if (s11 !== peg$FAILED) { + while (s11 !== peg$FAILED) { + s10.push(s11); + if (peg$r0.test(input.charAt(peg$currPos))) { + s11 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s11 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + } + } else { + s10 = peg$FAILED; + } + if (s10 !== peg$FAILED) { + s8 = [s8, s9, s10]; + s7 = s8; + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + if (s7 === peg$FAILED) { + s7 = null; + } + s8 = peg$parse__(); + s9 = peg$parseRPAREN(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parsenumeric_type_suffix(); + peg$savedPos = s0; + s0 = peg$f470(s1, s5, s7, s11); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_NUMERIC(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DECIMAL(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_INT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_INTEGER(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_SMALLINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_MEDIUMINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_TINYINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_BIGINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_FLOAT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DOUBLE(); + } + } + } + } + } + } + } + } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$r0.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$r0.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e100); } + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s3 = peg$parse__(); + s4 = peg$parsenumeric_type_suffix(); + peg$savedPos = s0; + s0 = peg$f471(s1, s2, s4); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseKW_NUMERIC(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DECIMAL(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_INT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_INTEGER(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_SMALLINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_MEDIUMINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_TINYINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_BIGINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_FLOAT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DOUBLE(); + } + } + } + } + } + } + } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsenumeric_type_suffix(); + s4 = peg$parse__(); + peg$savedPos = s0; + s0 = peg$f472(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + + return s0; + } + + function peg$parsedatetime_type() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + s1 = peg$parseKW_DATE(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DATETIME(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_TIME(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_TIMESTAMP(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_YEAR(); + } + } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseLPAREN(); + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + if (peg$r15.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e385); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseRPAREN(); + if (s7 !== peg$FAILED) { + s8 = peg$parse__(); + s9 = peg$parsenumeric_type_suffix(); + peg$savedPos = s0; + s0 = peg$f473(s1, s5, s9); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } 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$parseKW_DATE(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_DATETIME(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_TIME(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_TIMESTAMP(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_YEAR(); + } + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f474(s1); + } + s0 = s1; + } + + return s0; + } + + function peg$parseenum_type() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_ENUM(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_SET(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsevalue_item(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f475(s1, s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsejson_type() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parseKW_JSON(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f476(s1); + } + s0 = s1; + + return s0; + } + + function peg$parsetext_type() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parseKW_TINYTEXT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_TEXT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_MEDIUMTEXT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_LONGTEXT(); + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f477(s1); + } + s0 = s1; + + return s0; + } + + function peg$parsegeometry_type() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parseKW_GEOMETRY(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_POINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_LINESTRING(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_POLYGON(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_MULTIPOINT(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_MULTILINESTRING(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_MULTIPOLYGON(); + if (s1 === peg$FAILED) { + s1 = peg$parseKW_GEOMETRYCOLLECTION(); + } + } + } + } + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f478(s1); + } + s0 = s1; + + return s0; + } + + + const reservedMap = { + 'ALTER': true, + 'ALL': true, + 'ADD': true, + 'AND': true, + 'AS': true, + 'ASC': true, + 'ANALYZE': true, + 'ACCESSIBLE': true, + + 'BEFORE': true, + 'BETWEEN': true, + 'BIGINT': true, + 'BLOB': true, + 'BOTH': true, + 'BY': true, + 'BOOLEAN': true, + + 'CALL': true, + 'CASCADE': true, + 'CASE': true, + 'CHAR': true, + 'CHECK': true, + 'COLLATE': true, + // 'COLUMN': true, + 'CONDITION': true, + 'CONSTRAINT': true, + 'CONTINUE': true, + 'CONVERT': true, + 'CREATE': true, + 'CROSS': true, + 'CURRENT_DATE': true, + 'CURRENT_TIME': true, + 'CURRENT_TIMESTAMP': true, + 'CURRENT_USER': true, + 'CURSOR': true, + + 'DATABASE': true, + 'DATABASES': true, + 'DAY_HOUR': true, + 'DAY_MICROSECOND': true, + 'DAY_MINUTE': true, + 'DAY_SECOND': true, + 'DEC': true, + 'DECIMAL': true, + 'DECLARE': true, + 'DEFAULT': true, + 'DELAYED': true, + 'DELETE': true, + 'DESC': true, + 'DESCRIBE': true, + 'DETERMINISTIC': true, + 'DISTINCT': true, + 'DISTINCTROW': true, + 'DIV': true, + 'DROP': true, + 'DOUBLE': true, + 'DUAL': true, + + 'ELSE': true, + 'EACH': true, + 'ELSEIF': true, + 'ENCLOSED': true, + 'ESCAPED': true, + 'EXCEPT': true, + 'EXISTS': true, + 'EXIT': true, + 'EXPLAIN': true, + + 'FALSE': true, + 'FULL': true, + 'FROM': true, + 'FETCH': true, + 'FLOAT': true, + 'FLOAT4': true, + 'FLOAT8': true, + 'FOR': true, + 'FORCE': true, + 'FOREIGN': true, + 'FULLTEXT': true, + 'FUNCTION': true, + + 'GENERATED': true, + 'GET': true, + 'GO': true, + 'GRANT': true, + 'GROUP': true, + 'GROUPING': true, + 'GROUPS': true, + + 'HAVING': true, + 'HIGH_PRIORITY': true, + 'HOUR_MICROSECOND': true, + 'HOUR_MINUTE': true, + 'HOUR_SECOND': true, + + // 'IF': true, + 'IGNORE': true, + 'IN': true, + 'INNER': true, + 'INFILE': true, + 'INOUT': true, + 'INSENSITIVE': true, + 'INSERT': true, + 'INTERSECT': true, + 'INT': true, + 'INT1': true, + 'INT2': true, + 'INT3': true, + 'INT4': true, + 'INT8': true, + 'INTEGER': true, + 'INTERVAL': true, + 'INTO': true, + 'IO_AFTER_GTIDS': true, + 'IO_BEFORE_GTIDS': true, + 'IS': true, + 'ITERATE': true, + + 'JOIN': true, + 'JSON_TABLE': true, + + 'KEY': true, + 'KEYS': true, + 'KILL': true, + + 'LAG': true, // added in 8.0.2 (reserved) + 'LAST_VALUE': true, + 'LATERAL': true, + 'LEAD': true, + 'LEADING': true, + 'LEAVE': true, + 'LEFT': true, + 'LIKE': true, + 'LIMIT': true, + 'LINEAR': true, + 'LINES': true, + 'LOAD': true, + 'LOCALTIME': true, + 'LOCALTIMESTAMP': true, + 'LOCK': true, + 'LONG': true, + 'LONGBLOB': true, + 'LONGTEXT': true, + 'LOOP': true, + 'LOW_PRIORITY': true, // for lock table + + 'MASTER_BIND': true, + 'MATCH': true, + 'MAXVALUE': true, + 'MEDIUMBLOB': true, + 'MEDIUMINT': true, + 'MEDIUMTEXT': true, + 'MIDDLEINT': true, + 'MINUTE_MICROSECOND': true, + 'MINUTE_SECOND': true, + 'MINUS': true, + 'MOD': true, + 'MODIFIES': true, + + + 'NATURAL': true, + 'NOT': true, + 'NO_WRITE_TO_BINLOG': true, + 'NTH_VALUE': true, // added in 8.0.2 (reserved) + 'NTILE': true, // added in 8.0.2 (reserved) + 'NULL': true, + 'NUMERIC': true, + + 'OF': true, // added in 8.0.1 (reserved) + 'ON': true, + 'OPTIMIZE': true, + 'OPTIMIZER_COSTS': true, + 'OPTION': true, + 'OPTIONALLY': true, + 'OR': true, + 'ORDER': true, + 'OUT': true, + 'OUTER': true, + 'OUTFILE': true, + 'OVER': true, // added in 8.0.2 (reserved) + + 'PARTITION': true, + 'PERCENT_RANK': true, // added in 8.0.2 (reserved) + 'PRECISION': true, + 'PRIMARY': true, + 'PROCEDURE': true, + 'PURGE': true, + + 'RANGE': true, + 'RANK': true, // added in 8.0.2 (reserved) + 'READ': true, // for lock table + 'READS': true, // for lock table + 'READ_WRITE': true, // for lock table + 'REAL': true, // for lock table + 'RECURSIVE': true, + 'REFERENCES': true, + 'REGEXP': true, + 'RELEASE': true, + 'RENAME': true, + 'REPEAT': true, + 'REPLACE': true, + 'REQUIRE': true, + 'RESIGNAL': true, + 'RESTRICT': true, + 'RETURN': true, + 'REVOKE': true, + 'RIGHT': true, + 'RLIKE': true, + 'ROW': true, // // added in 8.0.2 (reserved) + 'ROWS': true, // // added in 8.0.2 (reserved) + 'ROW_NUMBER': true, // // added in 8.0.2 (reserved) + + 'SCHEMA': true, + 'SCHEMAS': true, + 'SELECT': true, + 'SENSITIVE': true, + 'SEPARATOR': true, + 'SET': true, + 'SHOW': true, + 'SIGNAL': true, + 'SMALLINT': true, + 'SPATIAL': true, + 'SPECIFIC': true, + 'SQL': true, + 'SQLEXCEPTION': true, + 'SQLSTATE': true, + 'SQLWARNING': true, + 'SQL_BIG_RESULT': true, + // 'SQL_CALC_FOUND_ROWS': true, + // 'SQL_SMALL_RESULT': true, + 'SSL': true, + 'STARTING': true, + 'STORED': true, + 'STRAIGHT_JOIN': true, + 'SYSTEM': true, + + 'TABLE': true, + 'TERMINATED': true, + 'THEN': true, + 'TINYBLOB': true, + 'TINYINT': true, + 'TINYTEXT': true, + 'TO': true, + 'TRAILING': true, + 'TRIGGER': true, + 'TRUE': true, + + 'UNION': true, + 'UNIQUE': true, + 'UNLOCK': true, + 'UNSIGNED': true, + 'UPDATE': true, + 'USAGE': true, + 'USE': true, + 'USING': true, + 'UTC_DATE': true, + 'UTC_TIME': true, + 'UTC_TIMESTAMP': true, + + 'VALUES': true, + 'VARBINARY': true, + 'VARCHAR': true, + 'VARCHARACTER': true, + 'VARYING': true, + 'VIRTUAL': true, + + 'WHEN': true, + 'WHERE': true, + 'WHILE': true, + 'WINDOW': true, // added in 8.0.2 (reserved) + 'WITH': true, + 'WRITE': true, // for lock table + + 'XOR': true, + + 'YEAR_MONTH': true, + + 'ZEROFILL': true, + }; + + 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 isBigInt(numberStr) { + const previousMaxSafe = BigInt(Number.MAX_SAFE_INTEGER) + const num = BigInt(numberStr) + if (num < previousMaxSafe) return false + return true + } + + function createList(head, tail, po = 3) { + const result = [head]; + for (let i = 0; i < tail.length; i++) { + delete tail[i][po].tableList + delete tail[i][po].columnList + result.push(tail[i][po]); + } + return result; + } + + function createBinaryExprChain(head, tail) { + let result = head; + for (let i = 0; i < tail.length; i++) { + result = createBinaryExpr(tail[i][1], result, tail[i][3]); + } + return result; + } + + function queryTableAlias(tableName) { + const alias = tableAlias[tableName] + if (alias) return alias + if (tableName) return tableName + return null + } + + function columnListTableAlias(columnList) { + const newColumnsList = new Set() + const symbolChar = '::' + for(let column of columnList.keys()) { + const columnInfo = column.split(symbolChar) + if (!columnInfo) { + newColumnsList.add(column) + break + } + if (columnInfo && columnInfo[1]) columnInfo[1] = queryTableAlias(columnInfo[1]) + newColumnsList.add(columnInfo.join(symbolChar)) + } + return Array.from(newColumnsList) + } + + function refreshColumnList(columnList) { + const columns = columnListTableAlias(columnList) + columnList.clear() + columns.forEach(col => columnList.add(col)) + } + + const 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 + }; + + // used for dependency analysis + let varList = []; + + const tableList = new Set(); + const columnList = new Set(); + const tableAlias = {}; + + 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) + ); + } +} + +module.exports = { + SyntaxError: peg$SyntaxError, + parse: peg$parse +};