diff --git a/package.json b/package.json index 992433e17e6c15..72b35d9d3f1cbb 100644 --- a/package.json +++ b/package.json @@ -300,7 +300,7 @@ "p-retry": "^4.2.0", "papaparse": "^5.2.0", "pdfmake": "^0.1.65", - "pegjs": "0.10.0", + "peggy": "^1.0.0", "pluralize": "3.1.0", "pngjs": "^3.4.0", "polished": "^1.9.2", @@ -573,7 +573,6 @@ "@types/papaparse": "^5.0.3", "@types/parse-link-header": "^1.0.0", "@types/pdfmake": "^0.1.15", - "@types/pegjs": "^0.10.1", "@types/pngjs": "^3.4.0", "@types/prettier": "^2.1.5", "@types/pretty-ms": "^5.0.0", diff --git a/packages/kbn-interpreter/package.json b/packages/kbn-interpreter/package.json index 491a7205be210e..6b9407b0425555 100644 --- a/packages/kbn-interpreter/package.json +++ b/packages/kbn-interpreter/package.json @@ -4,7 +4,7 @@ "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", "scripts": { - "interpreter:peg": "../../node_modules/.bin/pegjs src/common/lib/grammar.peg", + "interpreter:peg": "../../node_modules/.bin/peggy src/common/lib/grammar.peggy", "build": "node scripts/build", "kbn:bootstrap": "node scripts/build --dev", "kbn:watch": "node scripts/build --dev --watch" diff --git a/packages/kbn-interpreter/src/common/lib/grammar.js b/packages/kbn-interpreter/src/common/lib/grammar.js index 3f473b1beea635..b8095f23b0f048 100644 --- a/packages/kbn-interpreter/src/common/lib/grammar.js +++ b/packages/kbn-interpreter/src/common/lib/grammar.js @@ -1,23 +1,21 @@ -/* - * Generated by PEG.js 0.10.0. - * - * http://pegjs.org/ - */ +// Generated by Peggy 0.11.0. +// +// https://github.com/peggyjs/peggy "use strict"; function peg$subclass(child, parent) { - function ctor() { this.constructor = child; } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); + function C() { this.constructor = child; } + C.prototype = parent.prototype; + child.prototype = new C(); } function peg$SyntaxError(message, expected, found, location) { - this.message = message; + this.message = message; this.expected = expected; - this.found = found; + this.found = found; this.location = location; - this.name = "SyntaxError"; + this.name = "SyntaxError"; if (typeof Error.captureStackTrace === "function") { Error.captureStackTrace(this, peg$SyntaxError); @@ -28,35 +26,32 @@ peg$subclass(peg$SyntaxError, Error); peg$SyntaxError.buildMessage = function(expected, found) { var DESCRIBE_EXPECTATION_FNS = { - literal: function(expectation) { - return "\"" + literalEscape(expectation.text) + "\""; - }, - - "class": function(expectation) { - var escapedParts = "", - i; - - for (i = 0; i < expectation.parts.length; i++) { - escapedParts += expectation.parts[i] instanceof Array - ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) - : classEscape(expectation.parts[i]); - } - - return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; - }, - - any: function(expectation) { - return "any character"; - }, - - end: function(expectation) { - return "end of input"; - }, - - other: function(expectation) { - return expectation.description; - } - }; + 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 + "]"; + }, + + 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(); @@ -64,28 +59,28 @@ peg$SyntaxError.buildMessage = function(expected, found) { 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); }); + .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); }); + .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) { @@ -93,12 +88,8 @@ peg$SyntaxError.buildMessage = function(expected, found) { } function describeExpected(expected) { - var descriptions = new Array(expected.length), - i, j; - - for (i = 0; i < expected.length; i++) { - descriptions[i] = describeExpectation(expected[i]); - } + var descriptions = expected.map(describeExpectation); + var i, j; descriptions.sort(); @@ -134,98 +125,98 @@ peg$SyntaxError.buildMessage = function(expected, found) { }; function peg$parse(input, options) { - options = options !== void 0 ? options : {}; - - var peg$FAILED = {}, - - peg$startRuleFunctions = { expression: peg$parseexpression, argument: peg$parseargument }, - peg$startRuleFunction = peg$parseexpression, - - peg$c0 = "|", - peg$c1 = peg$literalExpectation("|", false), - peg$c2 = function(first, fn) { return fn; }, - peg$c3 = function(first, rest) { - return addMeta({ - type: 'expression', - chain: first ? [first].concat(rest) : [] - }, text(), location()); - }, - peg$c4 = peg$otherExpectation("function"), - peg$c5 = function(name, arg_list) { - return addMeta({ - type: 'function', - function: name, - arguments: arg_list - }, text(), location()); - }, - peg$c6 = "=", - peg$c7 = peg$literalExpectation("=", false), - peg$c8 = function(name, value) { - return { name, value }; - }, - peg$c9 = function(value) { - return { name: '_', value }; - }, - peg$c10 = "$", - peg$c11 = peg$literalExpectation("$", false), - peg$c12 = "{", - peg$c13 = peg$literalExpectation("{", false), - peg$c14 = "}", - peg$c15 = peg$literalExpectation("}", false), - peg$c16 = function(expression) { return expression; }, - peg$c17 = function(value) { - return addMeta(value, text(), location()); - }, - peg$c18 = function(arg) { return arg; }, - peg$c19 = function(args) { - return args.reduce((accumulator, { name, value }) => ({ - ...accumulator, - [name]: (accumulator[name] || []).concat(value) - }), {}); - }, - peg$c20 = /^[a-zA-Z0-9_\-]/, - peg$c21 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false), - peg$c22 = function(name) { - return name.join(''); - }, - peg$c23 = peg$otherExpectation("literal"), - peg$c24 = "\"", - peg$c25 = peg$literalExpectation("\"", false), - peg$c26 = function(chars) { return chars.join(''); }, - peg$c27 = "'", - peg$c28 = peg$literalExpectation("'", false), - peg$c29 = function(string) { // this also matches nulls, booleans, and numbers - var result = string.join(''); - // Sort of hacky, but PEG doesn't have backtracking so - // a null/boolean/number rule is hard to read, and performs worse - if (result === 'null') return null; - if (result === 'true') return true; - if (result === 'false') return false; - if (isNaN(Number(result))) return result; // 5bears - return Number(result); - }, - peg$c30 = /^[ \t\r\n]/, - peg$c31 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false), - peg$c32 = "\\", - peg$c33 = peg$literalExpectation("\\", false), - peg$c34 = /^["'(){}<>[\]$`|= \t\n\r]/, - peg$c35 = peg$classExpectation(["\"", "'", "(", ")", "{", "}", "<", ">", "[", "]", "$", "`", "|", "=", " ", "\t", "\n", "\r"], false, false), - peg$c36 = function(sequence) { return sequence; }, - peg$c37 = /^[^"'(){}<>[\]$`|= \t\n\r]/, - peg$c38 = peg$classExpectation(["\"", "'", "(", ")", "{", "}", "<", ">", "[", "]", "$", "`", "|", "=", " ", "\t", "\n", "\r"], true, false), - peg$c39 = /^[^"]/, - peg$c40 = peg$classExpectation(["\""], true, false), - peg$c41 = /^[^']/, - peg$c42 = peg$classExpectation(["'"], true, false), - - peg$currPos = 0, - peg$savedPos = 0, - peg$posDetailsCache = [{ line: 1, column: 1 }], - peg$maxFailPos = 0, - peg$maxFailExpected = [], - peg$silentFails = 0, - - peg$result; + options = options !== undefined ? options : {}; + + var peg$FAILED = {}; + + var peg$startRuleFunctions = { start: peg$parsestart }; + var peg$startRuleFunction = peg$parsestart; + + var peg$c0 = "|"; + var peg$c1 = peg$literalExpectation("|", false); + var peg$c2 = function(first, fn) { return fn; }; + var peg$c3 = function(first, rest) { + return addMeta({ + type: 'expression', + chain: first ? [first].concat(rest) : [] + }, text(), location()); + }; + var peg$c4 = peg$otherExpectation("function"); + var peg$c5 = function(name, arg_list) { + return addMeta({ + type: 'function', + function: name, + arguments: arg_list + }, text(), location()); + }; + var peg$c6 = "="; + var peg$c7 = peg$literalExpectation("=", false); + var peg$c8 = function(name, value) { + return { name, value }; + }; + var peg$c9 = function(value) { + return { name: '_', value }; + }; + var peg$c10 = "$"; + var peg$c11 = peg$literalExpectation("$", false); + var peg$c12 = "{"; + var peg$c13 = peg$literalExpectation("{", false); + var peg$c14 = "}"; + var peg$c15 = peg$literalExpectation("}", false); + var peg$c16 = function(expression) { return expression; }; + var peg$c17 = function(value) { + return addMeta(value, text(), location()); + }; + var peg$c18 = function(arg) { return arg; }; + var peg$c19 = function(args) { + return args.reduce((accumulator, { name, value }) => ({ + ...accumulator, + [name]: (accumulator[name] || []).concat(value) + }), {}); + }; + var peg$c20 = /^[a-zA-Z0-9_\-]/; + var peg$c21 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false); + var peg$c22 = function(name) { + return name.join(''); + }; + var peg$c23 = peg$otherExpectation("literal"); + var peg$c24 = "\""; + var peg$c25 = peg$literalExpectation("\"", false); + var peg$c26 = function(chars) { return chars.join(''); }; + var peg$c27 = "'"; + var peg$c28 = peg$literalExpectation("'", false); + var peg$c29 = function(string) { // this also matches nulls, booleans, and numbers + var result = string.join(''); + // Sort of hacky, but PEG doesn't have backtracking so + // a null/boolean/number rule is hard to read, and performs worse + if (result === 'null') return null; + if (result === 'true') return true; + if (result === 'false') return false; + if (isNaN(Number(result))) return result; // 5bears + return Number(result); + }; + var peg$c30 = /^[ \t\r\n]/; + var peg$c31 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false); + var peg$c32 = "\\"; + var peg$c33 = peg$literalExpectation("\\", false); + var peg$c34 = /^["'(){}<>[\]$`|= \t\n\r]/; + var peg$c35 = peg$classExpectation(["\"", "'", "(", ")", "{", "}", "<", ">", "[", "]", "$", "`", "|", "=", " ", "\t", "\n", "\r"], false, false); + var peg$c36 = function(sequence) { return sequence; }; + var peg$c37 = /^[^"'(){}<>[\]$`|= \t\n\r]/; + var peg$c38 = peg$classExpectation(["\"", "'", "(", ")", "{", "}", "<", ">", "[", "]", "$", "`", "|", "=", " ", "\t", "\n", "\r"], true, false); + var peg$c39 = /^[^"]/; + var peg$c40 = peg$classExpectation(["\""], true, false); + var peg$c41 = /^[^']/; + var peg$c42 = peg$classExpectation(["'"], true, false); + + 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)) { @@ -244,7 +235,9 @@ function peg$parse(input, options) { } function expected(description, location) { - location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) + location = location !== undefined + ? location + : peg$computeLocation(peg$savedPos, peg$currPos); throw peg$buildStructuredError( [peg$otherExpectation(description)], @@ -254,7 +247,9 @@ function peg$parse(input, options) { } function error(message, location) { - location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) + location = location !== undefined + ? location + : peg$computeLocation(peg$savedPos, peg$currPos); throw peg$buildSimpleError(message, location); } @@ -280,7 +275,8 @@ function peg$parse(input, options) { } function peg$computePosDetails(pos) { - var details = peg$posDetailsCache[pos], p; + var details = peg$posDetailsCache[pos]; + var p; if (details) { return details; @@ -292,7 +288,7 @@ function peg$parse(input, options) { details = peg$posDetailsCache[p]; details = { - line: details.line, + line: details.line, column: details.column }; @@ -308,23 +304,24 @@ function peg$parse(input, options) { } peg$posDetailsCache[pos] = details; + return details; } } function peg$computeLocation(startPos, endPos) { - var startPosDetails = peg$computePosDetails(startPos), - endPosDetails = peg$computePosDetails(endPos); + var startPosDetails = peg$computePosDetails(startPos); + var endPosDetails = peg$computePosDetails(endPos); return { start: { offset: startPos, - line: startPosDetails.line, + line: startPosDetails.line, column: startPosDetails.column }, end: { offset: endPos, - line: endPosDetails.line, + line: endPosDetails.line, column: endPosDetails.column } }; @@ -354,6 +351,14 @@ function peg$parse(input, options) { ); } + function peg$parsestart() { + var s0; + + s0 = peg$parseexpression(); + + return s0; + } + function peg$parseexpression() { var s0, s1, s2, s3, s4, s5, s6, s7; @@ -1049,5 +1054,5 @@ function peg$parse(input, options) { module.exports = { SyntaxError: peg$SyntaxError, - parse: peg$parse + parse: peg$parse }; diff --git a/packages/kbn-interpreter/src/common/lib/grammar.peg b/packages/kbn-interpreter/src/common/lib/grammar.peggy similarity index 98% rename from packages/kbn-interpreter/src/common/lib/grammar.peg rename to packages/kbn-interpreter/src/common/lib/grammar.peggy index e8a2988d2b4f67..c67bb55b882a4f 100644 --- a/packages/kbn-interpreter/src/common/lib/grammar.peg +++ b/packages/kbn-interpreter/src/common/lib/grammar.peggy @@ -1,7 +1,7 @@ /* * Canvas syntax parser * -* You MUST use PegJS to generate a .js file to use this. +* You MUST use Peggy to generate a .js file to use this. * Yes, technically you can load this and build the parser in real time, but this makes it annoying * to share the grammar between the front end and back, so, you know, just generate the parser. * You shouldn't be futzing around in the grammar very often anyway. diff --git a/packages/kbn-tinymath/BUILD.bazel b/packages/kbn-tinymath/BUILD.bazel index 9d521776fb4919..ae029c88774e84 100644 --- a/packages/kbn-tinymath/BUILD.bazel +++ b/packages/kbn-tinymath/BUILD.bazel @@ -1,5 +1,5 @@ load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") -load("@npm//pegjs:index.bzl", "pegjs") +load("@npm//peggy:index.bzl", "peggy") PKG_BASE_NAME = "kbn-tinymath" PKG_REQUIRE_NAME = "@kbn/tinymath" @@ -30,16 +30,16 @@ DEPS = [ "@npm//lodash", ] -pegjs( +peggy( name = "grammar", data = [ - ":grammar/grammar.pegjs" + ":grammar/grammar.peggy" ], output_dir = True, args = [ "-o", "$(@D)/index.js", - "./%s/grammar/grammar.pegjs" % package_name() + "./%s/grammar/grammar.peggy" % package_name() ], ) diff --git a/packages/kbn-tinymath/grammar/grammar.pegjs b/packages/kbn-tinymath/grammar/grammar.peggy similarity index 100% rename from packages/kbn-tinymath/grammar/grammar.pegjs rename to packages/kbn-tinymath/grammar/grammar.peggy diff --git a/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js b/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js index 7ee744ad5f4c82..384d88fdd8d07f 100644 --- a/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js +++ b/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js @@ -1,499 +1,537 @@ -module.exports = (function() { - "use strict"; - - /* - * Generated by PEG.js 0.9.0. - * - * http://pegjs.org/ - */ - - function peg$subclass(child, parent) { - function ctor() { this.constructor = child; } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); +// Generated by Peggy 0.11.0. +// +// https://github.com/peggyjs/peggy + +"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) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); } +} - function peg$SyntaxError(message, expected, found, location) { - this.message = message; - this.expected = expected; - this.found = found; - this.location = location; - this.name = "SyntaxError"; +peg$subclass(peg$SyntaxError, Error); - if (typeof Error.captureStackTrace === "function") { - Error.captureStackTrace(this, peg$SyntaxError); - } - } +peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, - peg$subclass(peg$SyntaxError, Error); + class: function(expectation) { + var escapedParts = expectation.parts.map(function(part) { + return Array.isArray(part) + ? classEscape(part[0]) + "-" + classEscape(part[1]) + : classEscape(part); + }); - function peg$parse(input) { - var options = arguments.length > 1 ? arguments[1] : {}, - parser = this, + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, - peg$FAILED = {}, + any: function() { + return "any character"; + }, - peg$startRuleFunctions = { start: peg$parsestart, Literal: peg$parseLiteral }, - peg$startRuleFunction = peg$parsestart, + end: function() { + return "end of input"; + }, - peg$c0 = function(query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - if (query !== null) return query; - return nodeTypes.function.buildNode('is', '*', '*'); - }, - peg$c1 = function(head, query) { return query; }, - peg$c2 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('or', nodes); - }, - peg$c3 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('and', nodes); - }, - peg$c4 = function(query) { - if (query.type === 'cursor') return query; - return buildFunctionNode('not', [query]); - }, - peg$c5 = "(", - peg$c6 = { type: "literal", value: "(", description: "\"(\"" }, - peg$c7 = ")", - peg$c8 = { type: "literal", value: ")", description: "\")\"" }, - peg$c9 = function(query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return query; - }, - peg$c10 = ":", - peg$c11 = { type: "literal", value: ":", description: "\":\"" }, - peg$c12 = "{", - peg$c13 = { type: "literal", value: "{", description: "\"{\"" }, - peg$c14 = "}", - peg$c15 = { type: "literal", value: "}", description: "\"}\"" }, - peg$c16 = function(field, query, trailing) { - if (query.type === 'cursor') { - return { - ...query, - nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, - } - }; + other: function(expectation) { + return expectation.description; + } + }; - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return buildFunctionNode('nested', [field, query]); - }, - peg$c17 = { type: "other", description: "fieldName" }, - peg$c18 = function(field, operator, value) { - if (value.type === 'cursor') { - return { - ...value, - suggestionTypes: ['conjunction'] - }; - } - const range = buildNamedArgNode(operator, value); - return buildFunctionNode('range', [field, range]); - }, - peg$c19 = function(field, partial) { - if (partial.type === 'cursor') { - return { - ...partial, - fieldName: field.value, - suggestionTypes: ['value', 'conjunction'] - }; - } - return partial(field); - }, - peg$c20 = function(partial) { - if (partial.type === 'cursor') { - const fieldName = `${partial.prefix}${partial.suffix}`.trim(); - return { - ...partial, - fieldName, - suggestionTypes: ['field', 'operator', 'conjunction'] - }; - } - const field = buildLiteralNode(null); - return partial(field); - }, - peg$c21 = function(partial, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return partial; - }, - peg$c22 = function(head, partial) { return partial; }, - peg$c23 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'] - }; - } - return (field) => buildFunctionNode('or', nodes.map(partial => partial(field))); - }, - peg$c24 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'] - }; - } - return (field) => buildFunctionNode('and', nodes.map(partial => partial(field))); - }, - peg$c25 = function(partial) { - if (partial.type === 'cursor') { - return { - ...list, - suggestionTypes: ['value'] - }; - } - return (field) => buildFunctionNode('not', [partial(field)]); - }, - peg$c26 = { type: "other", description: "value" }, - peg$c27 = function(value) { - if (value.type === 'cursor') return value; - const isPhrase = buildLiteralNode(true); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }, - peg$c28 = function(value) { - if (value.type === 'cursor') return value; - - if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) { - error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.'); - } + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } - const isPhrase = buildLiteralNode(false); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }, - peg$c29 = { type: "other", description: "OR" }, - peg$c30 = "or", - peg$c31 = { type: "literal", value: "or", description: "\"or\"" }, - peg$c32 = { type: "other", description: "AND" }, - peg$c33 = "and", - peg$c34 = { type: "literal", value: "and", description: "\"and\"" }, - peg$c35 = { type: "other", description: "NOT" }, - peg$c36 = "not", - peg$c37 = { type: "literal", value: "not", description: "\"not\"" }, - peg$c38 = { type: "other", description: "literal" }, - peg$c39 = function() { return parseCursor; }, - peg$c40 = "\"", - peg$c41 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c42 = function(prefix, cursor, suffix) { - const { start, end } = location(); - return { - type: 'cursor', - start: start.offset, - end: end.offset - cursor.length, - prefix: prefix.join(''), - suffix: suffix.join(''), - text: text().replace(cursor, '') - }; - }, - peg$c43 = function(chars) { - return buildLiteralNode(chars.join('')); - }, - peg$c44 = "\\", - peg$c45 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c46 = /^[\\"]/, - peg$c47 = { type: "class", value: "[\\\\\"]", description: "[\\\\\"]" }, - peg$c48 = function(char) { return char; }, - peg$c49 = /^[^"]/, - peg$c50 = { type: "class", value: "[^\"]", description: "[^\"]" }, - peg$c51 = function(chars) { - const sequence = chars.join('').trim(); - if (sequence === 'null') return buildLiteralNode(null); - if (sequence === 'true') return buildLiteralNode(true); - if (sequence === 'false') return buildLiteralNode(false); - if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); - return buildLiteralNode(sequence); - }, - peg$c52 = { type: "any", description: "any character" }, - peg$c53 = "*", - peg$c54 = { type: "literal", value: "*", description: "\"*\"" }, - peg$c55 = function() { return wildcardSymbol; }, - peg$c56 = "\\t", - peg$c57 = { type: "literal", value: "\\t", description: "\"\\\\t\"" }, - peg$c58 = function() { return '\t'; }, - peg$c59 = "\\r", - peg$c60 = { type: "literal", value: "\\r", description: "\"\\\\r\"" }, - peg$c61 = function() { return '\r'; }, - peg$c62 = "\\n", - peg$c63 = { type: "literal", value: "\\n", description: "\"\\\\n\"" }, - peg$c64 = function() { return '\n'; }, - peg$c65 = function(keyword) { return keyword; }, - peg$c66 = /^[\\():<>"*{}]/, - peg$c67 = { type: "class", value: "[\\\\():<>\"*{}]", description: "[\\\\():<>\"*{}]" }, - peg$c68 = function(sequence) { return sequence; }, - peg$c69 = "u", - peg$c70 = { type: "literal", value: "u", description: "\"u\"" }, - peg$c71 = function(digits) { - return String.fromCharCode(parseInt(digits, 16)); - }, - peg$c72 = /^[0-9a-f]/i, - peg$c73 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, - peg$c74 = "<=", - peg$c75 = { type: "literal", value: "<=", description: "\"<=\"" }, - peg$c76 = function() { return 'lte'; }, - peg$c77 = ">=", - peg$c78 = { type: "literal", value: ">=", description: "\">=\"" }, - peg$c79 = function() { return 'gte'; }, - peg$c80 = "<", - peg$c81 = { type: "literal", value: "<", description: "\"<\"" }, - peg$c82 = function() { return 'lt'; }, - peg$c83 = ">", - peg$c84 = { type: "literal", value: ">", description: "\">\"" }, - peg$c85 = function() { return 'gt'; }, - peg$c86 = { type: "other", description: "whitespace" }, - peg$c87 = /^[ \t\r\n\xA0]/, - peg$c88 = { type: "class", value: "[\\ \\t\\r\\n\\u00A0]", description: "[\\ \\t\\r\\n\\u00A0]" }, - peg$c89 = "@kuery-cursor@", - peg$c90 = { type: "literal", value: "@kuery-cursor@", description: "\"@kuery-cursor@\"" }, - peg$c91 = function() { return cursorSymbol; }, - - peg$currPos = 0, - peg$savedPos = 0, - peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }], - peg$maxFailPos = 0, - peg$maxFailExpected = [], - peg$silentFails = 0, - - peg$resultsCache = {}, - - peg$result; - - if ("startRule" in options) { - if (!(options.startRule in peg$startRuleFunctions)) { - throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); - } - - peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; - } - - function text() { - return input.substring(peg$savedPos, peg$currPos); - } - - function location() { - return peg$computeLocation(peg$savedPos, peg$currPos); - } - - function expected(description) { - throw peg$buildException( - null, - [{ type: "other", description: description }], - input.substring(peg$savedPos, peg$currPos), - peg$computeLocation(peg$savedPos, peg$currPos) - ); - } - - function error(message) { - throw peg$buildException( - message, - null, - input.substring(peg$savedPos, peg$currPos), - peg$computeLocation(peg$savedPos, peg$currPos) - ); - } - - function peg$computePosDetails(pos) { - var details = peg$posDetailsCache[pos], - p, ch; - - if (details) { - return details; - } else { - p = pos - 1; - while (!peg$posDetailsCache[p]) { - p--; - } + 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); }); + } - details = peg$posDetailsCache[p]; - details = { - line: details.line, - column: details.column, - seenCR: details.seenCR - }; + 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); }); + } - while (p < pos) { - ch = input.charAt(p); - if (ch === "\n") { - if (!details.seenCR) { details.line++; } - details.column = 1; - details.seenCR = false; - } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { - details.line++; - details.column = 1; - details.seenCR = true; - } else { - details.column++; - details.seenCR = false; - } + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } - p++; - } + function describeExpected(expected) { + var descriptions = expected.map(describeExpectation); + var i, j; - peg$posDetailsCache[pos] = details; - return details; + 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; } - function peg$computeLocation(startPos, endPos) { - var startPosDetails = peg$computePosDetails(startPos), - endPosDetails = peg$computePosDetails(endPos); + switch (descriptions.length) { + case 1: + return descriptions[0]; - return { - start: { - offset: startPos, - line: startPosDetails.line, - column: startPosDetails.column - }, - end: { - offset: endPos, - line: endPosDetails.line, - column: endPosDetails.column - } - }; + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; } + } - function peg$fail(expected) { - if (peg$currPos < peg$maxFailPos) { return; } + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } - if (peg$currPos > peg$maxFailPos) { - peg$maxFailPos = peg$currPos; - peg$maxFailExpected = []; - } + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; +}; - peg$maxFailExpected.push(expected); - } +function peg$parse(input, options) { + options = options !== undefined ? options : {}; - function peg$buildException(message, expected, found, location) { - function cleanupExpected(expected) { - var i = 1; + var peg$FAILED = {}; - expected.sort(function(a, b) { - if (a.description < b.description) { - return -1; - } else if (a.description > b.description) { - return 1; - } else { - return 0; - } - }); + var peg$startRuleFunctions = { start: peg$parsestart }; + var peg$startRuleFunction = peg$parsestart; - while (i < expected.length) { - if (expected[i - 1] === expected[i]) { - expected.splice(i, 1); - } else { - i++; + var peg$c0 = function(query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + if (query !== null) return query; + return nodeTypes.function.buildNode('is', '*', '*'); + }; + var peg$c1 = function(head, query) { return query; }; + var peg$c2 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('or', nodes); + }; + var peg$c3 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('and', nodes); + }; + var peg$c4 = function(query) { + if (query.type === 'cursor') return query; + return buildFunctionNode('not', [query]); + }; + var peg$c5 = "("; + var peg$c6 = peg$literalExpectation("(", false); + var peg$c7 = ")"; + var peg$c8 = peg$literalExpectation(")", false); + var peg$c9 = function(query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + return query; + }; + var peg$c10 = ":"; + var peg$c11 = peg$literalExpectation(":", false); + var peg$c12 = "{"; + var peg$c13 = peg$literalExpectation("{", false); + var peg$c14 = "}"; + var peg$c15 = peg$literalExpectation("}", false); + var peg$c16 = function(field, query, trailing) { + if (query.type === 'cursor') { + return { + ...query, + nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, } + }; + + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; } + return buildFunctionNode('nested', [field, query]); + }; + var peg$c17 = peg$otherExpectation("fieldName"); + var peg$c18 = function(field, operator, value) { + if (value.type === 'cursor') { + return { + ...value, + suggestionTypes: ['conjunction'] + }; + } + const range = buildNamedArgNode(operator, value); + return buildFunctionNode('range', [field, range]); + }; + var peg$c19 = function(field, partial) { + if (partial.type === 'cursor') { + return { + ...partial, + fieldName: field.value, + suggestionTypes: ['value', 'conjunction'] + }; + } + return partial(field); + }; + var peg$c20 = function(partial) { + if (partial.type === 'cursor') { + const fieldName = `${partial.prefix}${partial.suffix}`.trim(); + return { + ...partial, + fieldName, + suggestionTypes: ['field', 'operator', 'conjunction'] + }; + } + const field = buildLiteralNode(null); + return partial(field); + }; + var peg$c21 = function(partial, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + return partial; + }; + var peg$c22 = function(head, partial) { return partial; }; + var peg$c23 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'] + }; + } + return (field) => buildFunctionNode('or', nodes.map(partial => partial(field))); + }; + var peg$c24 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'] + }; + } + return (field) => buildFunctionNode('and', nodes.map(partial => partial(field))); + }; + var peg$c25 = function(partial) { + if (partial.type === 'cursor') { + return { + ...list, + suggestionTypes: ['value'] + }; } + return (field) => buildFunctionNode('not', [partial(field)]); + }; + var peg$c26 = peg$otherExpectation("value"); + var peg$c27 = function(value) { + if (value.type === 'cursor') return value; + const isPhrase = buildLiteralNode(true); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + var peg$c28 = function(value) { + if (value.type === 'cursor') return value; + + if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) { + error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.'); + } + + const isPhrase = buildLiteralNode(false); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + var peg$c29 = peg$otherExpectation("OR"); + var peg$c30 = "or"; + var peg$c31 = peg$literalExpectation("or", true); + var peg$c32 = peg$otherExpectation("AND"); + var peg$c33 = "and"; + var peg$c34 = peg$literalExpectation("and", true); + var peg$c35 = peg$otherExpectation("NOT"); + var peg$c36 = "not"; + var peg$c37 = peg$literalExpectation("not", true); + var peg$c38 = peg$otherExpectation("literal"); + var peg$c39 = function() { return parseCursor; }; + var peg$c40 = "\""; + var peg$c41 = peg$literalExpectation("\"", false); + var peg$c42 = function(prefix, cursor, suffix) { + const { start, end } = location(); + return { + type: 'cursor', + start: start.offset, + end: end.offset - cursor.length, + prefix: prefix.join(''), + suffix: suffix.join(''), + text: text().replace(cursor, '') + }; + }; + var peg$c43 = function(chars) { + return buildLiteralNode(chars.join('')); + }; + var peg$c44 = "\\"; + var peg$c45 = peg$literalExpectation("\\", false); + var peg$c46 = /^[\\"]/; + var peg$c47 = peg$classExpectation(["\\", "\""], false, false); + var peg$c48 = function(char) { return char; }; + var peg$c49 = /^[^"]/; + var peg$c50 = peg$classExpectation(["\""], true, false); + var peg$c51 = function(chars) { + const sequence = chars.join('').trim(); + if (sequence === 'null') return buildLiteralNode(null); + if (sequence === 'true') return buildLiteralNode(true); + if (sequence === 'false') return buildLiteralNode(false); + if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); + return buildLiteralNode(sequence); + }; + var peg$c52 = peg$anyExpectation(); + var peg$c53 = "*"; + var peg$c54 = peg$literalExpectation("*", false); + var peg$c55 = function() { return wildcardSymbol; }; + var peg$c56 = "\\t"; + var peg$c57 = peg$literalExpectation("\\t", false); + var peg$c58 = function() { return '\t'; }; + var peg$c59 = "\\r"; + var peg$c60 = peg$literalExpectation("\\r", false); + var peg$c61 = function() { return '\r'; }; + var peg$c62 = "\\n"; + var peg$c63 = peg$literalExpectation("\\n", false); + var peg$c64 = function() { return '\n'; }; + var peg$c65 = function(keyword) { return keyword; }; + var peg$c66 = /^[\\():<>"*{}]/; + var peg$c67 = peg$classExpectation(["\\", "(", ")", ":", "<", ">", "\"", "*", "{", "}"], false, false); + var peg$c68 = function(sequence) { return sequence; }; + var peg$c69 = "u"; + var peg$c70 = peg$literalExpectation("u", false); + var peg$c71 = function(digits) { + return String.fromCharCode(parseInt(digits, 16)); + }; + var peg$c72 = /^[0-9a-f]/i; + var peg$c73 = peg$classExpectation([["0", "9"], ["a", "f"]], false, true); + var peg$c74 = "<="; + var peg$c75 = peg$literalExpectation("<=", false); + var peg$c76 = function() { return 'lte'; }; + var peg$c77 = ">="; + var peg$c78 = peg$literalExpectation(">=", false); + var peg$c79 = function() { return 'gte'; }; + var peg$c80 = "<"; + var peg$c81 = peg$literalExpectation("<", false); + var peg$c82 = function() { return 'lt'; }; + var peg$c83 = ">"; + var peg$c84 = peg$literalExpectation(">", false); + var peg$c85 = function() { return 'gt'; }; + var peg$c86 = peg$otherExpectation("whitespace"); + var peg$c87 = /^[ \t\r\n\xA0]/; + var peg$c88 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); + var peg$c89 = "@kuery-cursor@"; + var peg$c90 = peg$literalExpectation("@kuery-cursor@", false); + var peg$c91 = function() { return cursorSymbol; }; + + 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 + "\"."); + } - function buildMessage(expected, found) { - function stringEscape(s) { - function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } - - return s - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\x08/g, '\\b') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\f/g, '\\f') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) - .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) - .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) - .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); - } + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } - var expectedDescs = new Array(expected.length), - expectedDesc, foundDesc, i; + function text() { + return input.substring(peg$savedPos, peg$currPos); + } - for (i = 0; i < expected.length; i++) { - expectedDescs[i] = expected[i].description; - } + 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" }; + } - expectedDesc = expected.length > 1 - ? expectedDescs.slice(0, -1).join(", ") - + " or " - + expectedDescs[expected.length - 1] - : expectedDescs[0]; + function peg$endExpectation() { + return { type: "end" }; + } + + function peg$otherExpectation(description) { + return { type: "other", description: description }; + } - foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos]; + var p; - return "Expected " + expectedDesc + " but " + foundDesc + " found."; + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; } - if (expected !== null) { - cleanupExpected(expected); + 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++; } - return new peg$SyntaxError( - message !== null ? message : buildMessage(expected, found), - expected, - found, - location - ); + peg$posDetailsCache[pos] = details; + + return details; } + } - function peg$parsestart() { - var s0, s1, s2, s3; + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos); + var endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } - var key = peg$currPos * 37 + 0, - cached = peg$resultsCache[key]; + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } - if (cached) { - peg$currPos = cached.nextPos; + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } - return cached.result; - } + peg$maxFailExpected.push(expected); + } - s0 = peg$currPos; - s1 = []; + function peg$buildSimpleError(message, location) { + return new peg$SyntaxError(message, null, null, location); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parsestart() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = []; + s2 = peg$parseSpace(); + while (s2 !== peg$FAILED) { + s1.push(s2); s2 = peg$parseSpace(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parseOrQuery(); + if (s2 === peg$FAILED) { + s2 = null; } - if (s1 !== peg$FAILED) { - s2 = peg$parseOrQuery(); - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { - s3 = peg$parseOptionalSpace(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c0(s2, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s2 !== peg$FAILED) { + s3 = peg$parseOptionalSpace(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s2, s3); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -502,184 +540,212 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseOrQuery() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 1, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - s1 = peg$parseAndQuery(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + function peg$parseOrQuery() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseAndQuery(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, 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$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - 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$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + 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; - s1 = peg$c2(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c2(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseAndQuery(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseAndQuery(); } - function peg$parseAndQuery() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 2, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - s1 = peg$parseNotQuery(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + function peg$parseAndQuery() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseNotQuery(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, 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$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - 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$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + 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; - s1 = peg$c3(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c3(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseNotQuery(); - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseNotQuery(); + } - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } - return s0; - } + function peg$parseNotQuery() { + var s0, s1, s2; - function peg$parseNotQuery() { - var s0, s1, s2; + s0 = peg$currPos; + s1 = peg$parseNot(); + if (s1 !== peg$FAILED) { + s2 = peg$parseSubQuery(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c4(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseSubQuery(); + } - var key = peg$currPos * 37 + 3, - cached = peg$resultsCache[key]; + return s0; + } - if (cached) { - peg$currPos = cached.nextPos; + function peg$parseSubQuery() { + var s0, s1, s2, s3, s4, s5; - return cached.result; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c5; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c6); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); } - - s0 = peg$currPos; - s1 = peg$parseNot(); - if (s1 !== peg$FAILED) { - s2 = peg$parseSubQuery(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c4(s2); - s0 = s1; + if (s2 !== peg$FAILED) { + s3 = peg$parseOrQuery(); + if (s3 !== peg$FAILED) { + s4 = peg$parseOptionalSpace(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c7; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c8); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c9(s3, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } } else { peg$currPos = s0; s0 = peg$FAILED; @@ -688,158 +754,75 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseSubQuery(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseNestedQuery(); } - function peg$parseSubQuery() { - var s0, s1, s2, s3, s4, s5; + return s0; + } - var key = peg$currPos * 37 + 4, - cached = peg$resultsCache[key]; + function peg$parseNestedQuery() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c5; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s1 !== peg$FAILED) { - s2 = []; + s0 = peg$currPos; + s1 = peg$parseField(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseOrQuery(); - if (s3 !== peg$FAILED) { - s4 = peg$parseOptionalSpace(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c7; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c9(s3, s4); - s0 = s1; - } 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$parseNestedQuery(); } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseNestedQuery() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; - - var key = peg$currPos * 37 + 5, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseField(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c10; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c11); } } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c10; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c11); } - } - if (s3 !== peg$FAILED) { - s4 = []; + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s5 = peg$c12; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c13); } } - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 123) { - s5 = peg$c12; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } - } - if (s5 !== peg$FAILED) { - s6 = []; + if (s5 !== peg$FAILED) { + s6 = []; + s7 = peg$parseSpace(); + while (s7 !== peg$FAILED) { + s6.push(s7); s7 = peg$parseSpace(); - while (s7 !== peg$FAILED) { - s6.push(s7); - s7 = peg$parseSpace(); - } - if (s6 !== peg$FAILED) { - s7 = peg$parseOrQuery(); - if (s7 !== peg$FAILED) { - s8 = peg$parseOptionalSpace(); - if (s8 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s9 = peg$c14; - peg$currPos++; - } else { - s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c15); } - } - if (s9 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c16(s1, s7, s8); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s6 !== peg$FAILED) { + s7 = peg$parseOrQuery(); + if (s7 !== peg$FAILED) { + s8 = peg$parseOptionalSpace(); + if (s8 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s9 = peg$c14; + peg$currPos++; + } else { + s9 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c15); } + } + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c16(s1, s7, s8); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -872,105 +855,72 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseExpression(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseExpression(); } - function peg$parseExpression() { - var s0; - - var key = peg$currPos * 37 + 6, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseExpression() { + var s0; - s0 = peg$parseFieldRangeExpression(); + s0 = peg$parseFieldRangeExpression(); + if (s0 === peg$FAILED) { + s0 = peg$parseFieldValueExpression(); if (s0 === peg$FAILED) { - s0 = peg$parseFieldValueExpression(); - if (s0 === peg$FAILED) { - s0 = peg$parseValueExpression(); - } + s0 = peg$parseValueExpression(); } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseField() { - var s0, s1; - - var key = peg$currPos * 37 + 7, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - peg$silentFails++; - s0 = peg$parseLiteral(); - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } - } + return s0; + } - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + function peg$parseField() { + var s0, s1; - return s0; + peg$silentFails++; + s0 = peg$parseLiteral(); + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c17); } } - function peg$parseFieldRangeExpression() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 8, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseFieldRangeExpression() { + var s0, s1, s2, s3, s4, s5; - s0 = peg$currPos; - s1 = peg$parseField(); - if (s1 !== peg$FAILED) { - s2 = []; + s0 = peg$currPos; + s1 = peg$parseField(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseRangeOperator(); - if (s3 !== peg$FAILED) { - s4 = []; + } + if (s2 !== peg$FAILED) { + s3 = peg$parseRangeOperator(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseLiteral(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c18(s1, s3, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s4 !== peg$FAILED) { + s5 = peg$parseLiteral(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c18(s1, s3, s5); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -987,58 +937,47 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseFieldValueExpression() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 9, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseFieldValueExpression() { + var s0, s1, s2, s3, s4, s5; - s0 = peg$currPos; - s1 = peg$parseField(); - if (s1 !== peg$FAILED) { - s2 = []; + s0 = peg$currPos; + s1 = peg$parseField(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c10; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c11); } } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c10; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c11); } - } - if (s3 !== peg$FAILED) { - s4 = []; + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c19(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s4 !== peg$FAILED) { + s5 = peg$parseListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c19(s1, s5); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1055,84 +994,62 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseValueExpression() { - var s0, s1; - - var key = peg$currPos * 37 + 10, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseValue(); - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c20(s1); - } - s0 = s1; + return s0; + } - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + function peg$parseValueExpression() { + var s0, s1; - return s0; + s0 = peg$currPos; + s1 = peg$parseValue(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c20(s1); } + s0 = s1; - function peg$parseListOfValues() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 11, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseListOfValues() { + var s0, s1, s2, s3, s4, s5; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c5; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s1 !== peg$FAILED) { - s2 = []; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c5; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c6); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseOrListOfValues(); - if (s3 !== peg$FAILED) { - s4 = peg$parseOptionalSpace(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c7; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c21(s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseOrListOfValues(); + if (s3 !== peg$FAILED) { + s4 = peg$parseOptionalSpace(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c7; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c8); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c21(s3, s4); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1149,363 +1066,239 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseValue(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseValue(); } - function peg$parseOrListOfValues() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 12, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - s1 = peg$parseAndListOfValues(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + function peg$parseOrListOfValues() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseAndListOfValues(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, 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$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - 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$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, s5); + 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; - s1 = peg$c23(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c23(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseAndListOfValues(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseAndListOfValues(); } - function peg$parseAndListOfValues() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 13, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - s1 = peg$parseNotListOfValues(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + function peg$parseAndListOfValues() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseNotListOfValues(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, 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$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - 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$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, s5); + 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; - s1 = peg$c24(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c24(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseNotListOfValues(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseNotListOfValues(); } - function peg$parseNotListOfValues() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 14, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseNotListOfValues() { + var s0, s1, s2; - s0 = peg$currPos; - s1 = peg$parseNot(); - if (s1 !== peg$FAILED) { - s2 = peg$parseListOfValues(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c25(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s0 = peg$currPos; + s1 = peg$parseNot(); + if (s1 !== peg$FAILED) { + s2 = peg$parseListOfValues(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c25(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseListOfValues(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseListOfValues(); } - function peg$parseValue() { - var s0, s1; - - var key = peg$currPos * 37 + 15, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseValue() { + var s0, s1; - peg$silentFails++; + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$parseQuotedString(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c27(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { s0 = peg$currPos; - s1 = peg$parseQuotedString(); + s1 = peg$parseUnquotedLiteral(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c27(s1); + s1 = peg$c28(s1); } s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parseUnquotedLiteral(); - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c28(s1); - } - s0 = s1; - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - - function peg$parseOr() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 37 + 16, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - peg$silentFails++; - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { - s2 = input.substr(peg$currPos, 2); - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - } else { - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - s1 = [s1, s2, s3]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c26); } } - function peg$parseAnd() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 37 + 17, - cached = peg$resultsCache[key]; + return s0; + } - if (cached) { - peg$currPos = cached.nextPos; + function peg$parseOr() { + var s0, s1, s2, s3, s4; - return cached.result; + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = peg$parseSpace(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseSpace(); } - - peg$silentFails++; - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { + s2 = input.substr(peg$currPos, 2); + peg$currPos += 2; } else { - s1 = peg$FAILED; + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c31); } } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { - s2 = input.substr(peg$currPos, 3); - peg$currPos += 3; + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parseSpace(); + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parseSpace(); + } } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } + s3 = peg$FAILED; } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - } else { - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - s1 = [s1, s2, s3]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s3 !== peg$FAILED) { + s1 = [s1, s2, s3]; + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1514,51 +1307,55 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c29); } } - function peg$parseNot() { - var s0, s1, s2, s3; - - var key = peg$currPos * 37 + 18, - cached = peg$resultsCache[key]; + return s0; + } - if (cached) { - peg$currPos = cached.nextPos; + function peg$parseAnd() { + var s0, s1, s2, s3, s4; - return cached.result; + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = peg$parseSpace(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseSpace(); } - - peg$silentFails++; - s0 = peg$currPos; - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { - s1 = input.substr(peg$currPos, 3); + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { + s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c37); } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c34); } } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parseSpace(); + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parseSpace(); } } else { - s2 = peg$FAILED; + s3 = peg$FAILED; } - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; + if (s3 !== peg$FAILED) { + s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; @@ -1568,105 +1365,126 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c35); } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c32); } } - function peg$parseLiteral() { - var s0, s1; - - var key = peg$currPos * 37 + 19, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseNot() { + var s0, s1, s2, s3; - peg$silentFails++; - s0 = peg$parseQuotedString(); - if (s0 === peg$FAILED) { - s0 = peg$parseUnquotedLiteral(); + peg$silentFails++; + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c37); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + } else { + s2 = peg$FAILED; } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c35); } + } + + return s0; + } - function peg$parseQuotedString() { - var s0, s1, s2, s3, s4, s5, s6; + function peg$parseLiteral() { + var s0, s1; - var key = peg$currPos * 37 + 20, - cached = peg$resultsCache[key]; + peg$silentFails++; + s0 = peg$parseQuotedString(); + if (s0 === peg$FAILED) { + s0 = peg$parseUnquotedLiteral(); + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c38); } + } - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseQuotedString() { + var s0, s1, s2, s3, s4, s5, s6; - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = undefined; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s2 = peg$c40; + peg$currPos++; } else { - s1 = peg$FAILED; + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c41); } } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c40; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } - } - if (s2 !== peg$FAILED) { - s3 = []; + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parseQuotedCharacter(); + while (s4 !== peg$FAILED) { + s3.push(s4); s4 = peg$parseQuotedCharacter(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseQuotedCharacter(); - } - if (s3 !== peg$FAILED) { - s4 = peg$parseCursor(); - if (s4 !== peg$FAILED) { - s5 = []; + } + if (s3 !== peg$FAILED) { + s4 = peg$parseCursor(); + if (s4 !== peg$FAILED) { + s5 = []; + s6 = peg$parseQuotedCharacter(); + while (s6 !== peg$FAILED) { + s5.push(s6); s6 = peg$parseQuotedCharacter(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseQuotedCharacter(); + } + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s6 = peg$c40; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c41); } } - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c40; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } - } - if (s6 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s3, s4, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c42(s3, s4, s5); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1687,38 +1505,82 @@ module.exports = (function() { 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) === 34) { + s1 = peg$c40; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c41); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseQuotedCharacter(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseQuotedCharacter(); + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c40; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c41); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c43(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parseQuotedCharacter() { + var s0, s1, s2; + + s0 = peg$parseEscapedWhitespace(); + if (s0 === peg$FAILED) { + s0 = peg$parseEscapedUnicodeSequence(); if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c40; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseQuotedCharacter(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseQuotedCharacter(); + if (peg$c46.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c47); } } if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c40; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c43(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + peg$savedPos = s0; + s1 = peg$c48(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1727,44 +1589,25 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseQuotedCharacter() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 21, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseEscapedWhitespace(); - if (s0 === peg$FAILED) { - s0 = peg$parseEscapedUnicodeSequence(); if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; + s1 = peg$currPos; + peg$silentFails++; + s2 = peg$parseCursor(); + peg$silentFails--; + if (s2 === peg$FAILED) { + s1 = undefined; } else { + peg$currPos = s1; s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { - if (peg$c46.test(input.charAt(peg$currPos))) { + if (peg$c49.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c47); } + if (peg$silentFails === 0) { peg$fail(peg$c50); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; @@ -1778,91 +1621,44 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - s2 = peg$parseCursor(); - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = void 0; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - if (peg$c49.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c50); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c48(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } } } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseUnquotedLiteral() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 22, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseUnquotedLiteral() { + var s0, s1, s2, s3, s4, s5; - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = []; + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = undefined; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseUnquotedCharacter(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseUnquotedCharacter(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseUnquotedCharacter(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseCursor(); - if (s3 !== peg$FAILED) { - s4 = []; + } + if (s2 !== peg$FAILED) { + s3 = peg$parseCursor(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseUnquotedCharacter(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseUnquotedCharacter(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseUnquotedCharacter(); - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s2, s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c42(s2, s3, s4); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1875,101 +1671,90 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - s2 = peg$parseUnquotedCharacter(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseUnquotedCharacter(); - } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c51(s1); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = []; + s2 = peg$parseUnquotedCharacter(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseUnquotedCharacter(); } - s0 = s1; + } else { + s1 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c51(s1); + } + s0 = s1; } - function peg$parseUnquotedCharacter() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 37 + 23, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseUnquotedCharacter() { + var s0, s1, s2, s3, s4; - s0 = peg$parseEscapedWhitespace(); + s0 = peg$parseEscapedWhitespace(); + if (s0 === peg$FAILED) { + s0 = peg$parseEscapedSpecialCharacter(); if (s0 === peg$FAILED) { - s0 = peg$parseEscapedSpecialCharacter(); + s0 = peg$parseEscapedUnicodeSequence(); if (s0 === peg$FAILED) { - s0 = peg$parseEscapedUnicodeSequence(); + s0 = peg$parseEscapedKeyword(); if (s0 === peg$FAILED) { - s0 = peg$parseEscapedKeyword(); + s0 = peg$parseWildcard(); if (s0 === peg$FAILED) { - s0 = peg$parseWildcard(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; + s0 = peg$currPos; + s1 = peg$currPos; + peg$silentFails++; + s2 = peg$parseSpecialCharacter(); + peg$silentFails--; + if (s2 === peg$FAILED) { + s1 = undefined; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; peg$silentFails++; - s2 = peg$parseSpecialCharacter(); + s3 = peg$parseKeyword(); peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = void 0; + if (s3 === peg$FAILED) { + s2 = undefined; } else { - peg$currPos = s1; - s1 = peg$FAILED; + peg$currPos = s2; + s2 = peg$FAILED; } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; + if (s2 !== peg$FAILED) { + s3 = peg$currPos; peg$silentFails++; - s3 = peg$parseKeyword(); + s4 = peg$parseCursor(); peg$silentFails--; - if (s3 === peg$FAILED) { - s2 = void 0; + if (s4 === peg$FAILED) { + s3 = undefined; } else { - peg$currPos = s2; - s2 = peg$FAILED; + peg$currPos = s3; + s3 = peg$FAILED; } - if (s2 !== peg$FAILED) { - s3 = peg$currPos; - peg$silentFails++; - s4 = peg$parseCursor(); - peg$silentFails--; - if (s4 === peg$FAILED) { - s3 = void 0; + if (s3 !== peg$FAILED) { + if (input.length > peg$currPos) { + s4 = input.charAt(peg$currPos); + peg$currPos++; } else { - peg$currPos = s3; - s3 = peg$FAILED; + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } } - if (s3 !== peg$FAILED) { - if (input.length > peg$currPos) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c48(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c48(s4); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1982,92 +1767,70 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } } } } } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseWildcard() { - var s0, s1; - - var key = peg$currPos * 37 + 24, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 42) { - s1 = peg$c53; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c54); } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c55(); - } - s0 = s1; + return s0; + } - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + function peg$parseWildcard() { + var s0, s1; - return s0; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c53; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c54); } } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c55(); + } + s0 = s1; - function peg$parseOptionalSpace() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 25, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseOptionalSpace() { + var s0, s1, s2, s3, s4, s5; - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseCursor(); - if (s3 !== peg$FAILED) { - s4 = []; + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = undefined; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + if (s2 !== peg$FAILED) { + s3 = peg$parseCursor(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s2, s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c42(s2, s3, s4); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2080,312 +1843,235 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = []; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = []; + s1 = peg$parseSpace(); + while (s1 !== peg$FAILED) { + s0.push(s1); s1 = peg$parseSpace(); - while (s1 !== peg$FAILED) { - s0.push(s1); - s1 = peg$parseSpace(); - } } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseEscapedWhitespace() { - var s0, s1; - - var key = peg$currPos * 37 + 26, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseEscapedWhitespace() { + var s0, s1; + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c56) { + s1 = peg$c56; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c57); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c58(); + } + s0 = s1; + if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c56) { - s1 = peg$c56; + if (input.substr(peg$currPos, 2) === peg$c59) { + s1 = peg$c59; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c57); } + if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c58(); + s1 = peg$c61(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c59) { - s1 = peg$c59; + if (input.substr(peg$currPos, 2) === peg$c62) { + s1 = peg$c62; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c60); } + if (peg$silentFails === 0) { peg$fail(peg$c63); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c61(); + s1 = peg$c64(); } s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c62) { - s1 = peg$c62; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c63); } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c64(); - } - s0 = s1; - } } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseEscapedSpecialCharacter() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 27, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseEscapedSpecialCharacter() { + var s0, s1, s2; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseSpecialCharacter(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c48(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c45); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseSpecialCharacter(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c48(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseEscapedKeyword() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 28, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseEscapedKeyword() { + var s0, s1, s2; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c45); } + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { + s2 = input.substr(peg$currPos, 2); + peg$currPos += 2; } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c31); } } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { - s2 = input.substr(peg$currPos, 2); - peg$currPos += 2; + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { + s2 = input.substr(peg$currPos, 3); + peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { - s2 = input.substr(peg$currPos, 3); - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c37); } - } + if (peg$silentFails === 0) { peg$fail(peg$c37); } } } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c65(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c65(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseKeyword() { - var s0; - - var key = peg$currPos * 37 + 29, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseKeyword() { + var s0; - s0 = peg$parseOr(); + s0 = peg$parseOr(); + if (s0 === peg$FAILED) { + s0 = peg$parseAnd(); if (s0 === peg$FAILED) { - s0 = peg$parseAnd(); - if (s0 === peg$FAILED) { - s0 = peg$parseNot(); - } + s0 = peg$parseNot(); } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseSpecialCharacter() { - var s0; - - var key = peg$currPos * 37 + 30, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - if (peg$c66.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c67); } - } + return s0; + } - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + function peg$parseSpecialCharacter() { + var s0; - return s0; + if (peg$c66.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c67); } } - function peg$parseEscapedUnicodeSequence() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 31, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseEscapedUnicodeSequence() { + var s0, s1, s2; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseUnicodeSequence(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c68(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c45); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseUnicodeSequence(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c68(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseUnicodeSequence() { - var s0, s1, s2, s3, s4, s5, s6, s7; - - var key = peg$currPos * 37 + 32, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseUnicodeSequence() { + var s0, s1, s2, s3, s4, s5, s6, s7; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 117) { - s1 = peg$c69; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$currPos; - s4 = peg$parseHexDigit(); - if (s4 !== peg$FAILED) { - s5 = peg$parseHexDigit(); - if (s5 !== peg$FAILED) { - s6 = peg$parseHexDigit(); - if (s6 !== peg$FAILED) { - s7 = peg$parseHexDigit(); - if (s7 !== peg$FAILED) { - s4 = [s4, s5, s6, s7]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 117) { + s1 = peg$c69; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c70); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = peg$currPos; + s4 = peg$parseHexDigit(); + if (s4 !== peg$FAILED) { + s5 = peg$parseHexDigit(); + if (s5 !== peg$FAILED) { + s6 = peg$parseHexDigit(); + if (s6 !== peg$FAILED) { + s7 = peg$parseHexDigit(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; @@ -2398,238 +2084,194 @@ module.exports = (function() { peg$currPos = s3; s3 = peg$FAILED; } - if (s3 !== peg$FAILED) { - s2 = input.substring(s2, peg$currPos); - } else { - s2 = s3; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c71(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } } else { - peg$currPos = s0; - s0 = peg$FAILED; + peg$currPos = s3; + s3 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseHexDigit() { - var s0; - - var key = peg$currPos * 37 + 33, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; + if (s3 !== peg$FAILED) { + s2 = input.substring(s2, peg$currPos); + } else { + s2 = s3; } - - if (peg$c72.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c71(s2); + s0 = s1; } else { + peg$currPos = s0; s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseRangeOperator() { - var s0, s1; + return s0; + } + + function peg$parseHexDigit() { + var s0; - var key = peg$currPos * 37 + 34, - cached = peg$resultsCache[key]; + if (peg$c72.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c73); } + } - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseRangeOperator() { + var s0, s1; + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c74) { + s1 = peg$c74; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c75); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c76(); + } + s0 = s1; + if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c74) { - s1 = peg$c74; + if (input.substr(peg$currPos, 2) === peg$c77) { + s1 = peg$c77; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$c78); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c76(); + s1 = peg$c79(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c77) { - s1 = peg$c77; - peg$currPos += 2; + if (input.charCodeAt(peg$currPos) === 60) { + s1 = peg$c80; + peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c78); } + if (peg$silentFails === 0) { peg$fail(peg$c81); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c79(); + s1 = peg$c82(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 60) { - s1 = peg$c80; + if (input.charCodeAt(peg$currPos) === 62) { + s1 = peg$c83; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$c84); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c82(); + s1 = peg$c85(); } s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 62) { - s1 = peg$c83; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c85(); - } - s0 = s1; - } } } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseSpace() { - var s0, s1; - - var key = peg$currPos * 37 + 35, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - peg$silentFails++; - if (peg$c87.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c88); } - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c86); } - } + return s0; + } - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + function peg$parseSpace() { + var s0, s1; - return s0; + peg$silentFails++; + if (peg$c87.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c88); } + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c86); } } - function peg$parseCursor() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 36, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseCursor() { + var s0, s1, s2; - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = undefined; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 14) === peg$c89) { + s2 = peg$c89; + peg$currPos += 14; } else { - s1 = peg$FAILED; + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c90); } } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 14) === peg$c89) { - s2 = peg$c89; - peg$currPos += 14; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c91(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c91(); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } + return s0; + } - const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; - const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; - const buildLiteralNode = nodeTypes.literal.buildNode; - const buildWildcardNode = nodeTypes.wildcard.buildNode; - const buildNamedArgNode = nodeTypes.namedArg.buildNode; - const { wildcardSymbol } = nodeTypes.wildcard; + const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; + const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; + const buildLiteralNode = nodeTypes.literal.buildNode; + const buildWildcardNode = nodeTypes.wildcard.buildNode; + const buildNamedArgNode = nodeTypes.namedArg.buildNode; + const { wildcardSymbol } = nodeTypes.wildcard; - 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({ type: "end", description: "end of input" }); - } + peg$result = peg$startRuleFunction(); - throw peg$buildException( - null, - 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) - ); + 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) + ); } +} - return { - SyntaxError: peg$SyntaxError, - parse: peg$parse - }; -})(); \ No newline at end of file +module.exports = { + SyntaxError: peg$SyntaxError, + parse: peg$parse +}; diff --git a/src/plugins/data/common/es_query/kuery/ast/kuery.peg b/src/plugins/data/common/es_query/kuery/ast/kuery.peggy similarity index 100% rename from src/plugins/data/common/es_query/kuery/ast/kuery.peg rename to src/plugins/data/common/es_query/kuery/ast/kuery.peggy diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts b/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts index 54f03803a893e2..b7d1d45dfb62ee 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts +++ b/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts @@ -18,12 +18,12 @@ export function escapeQuotes(str: string) { export const escapeKuery = flow(escapeSpecialCharacters, escapeAndOr, escapeNot, escapeWhitespace); -// See the SpecialCharacter rule in kuery.peg +// See the SpecialCharacter rule in kuery.peggy function escapeSpecialCharacters(str: string) { return str.replace(/[\\():<>"*]/g, '\\$&'); // $& means the whole matched string } -// See the Keyword rule in kuery.peg +// See the Keyword rule in kuery.peggy function escapeAndOr(str: string) { return str.replace(/(\s+)(and|or)(\s+)/gi, '$1\\$2$3'); } @@ -32,7 +32,7 @@ function escapeNot(str: string) { return str.replace(/not(\s+)/gi, '\\$&'); } -// See the Space rule in kuery.peg +// See the Space rule in kuery.peggy function escapeWhitespace(str: string) { return str.replace(/\t/g, '\\t').replace(/\r/g, '\\r').replace(/\n/g, '\\n'); } diff --git a/src/plugins/timelion/public/directives/timelion_expression_input.js b/src/plugins/timelion/public/directives/timelion_expression_input.js index 2b0ceddca19574..b5624c7cb8d943 100644 --- a/src/plugins/timelion/public/directives/timelion_expression_input.js +++ b/src/plugins/timelion/public/directives/timelion_expression_input.js @@ -31,8 +31,8 @@ import _ from 'lodash'; import $ from 'jquery'; -import PEG from 'pegjs'; -import grammar from 'raw-loader!../../../vis_type_timelion/common/chain.peg'; +import PEG from 'peggy'; +import grammar from 'raw-loader!../../../vis_type_timelion/common/chain.peggy'; import timelionExpressionInputTemplate from './timelion_expression_input.html'; import { SUGGESTION_TYPE, diff --git a/src/plugins/vis_type_timelion/README.md b/src/plugins/vis_type_timelion/README.md index 89d34527c51d6e..53e05ae45c1d6d 100644 --- a/src/plugins/vis_type_timelion/README.md +++ b/src/plugins/vis_type_timelion/README.md @@ -3,10 +3,12 @@ Contains the timelion visualization and the timelion backend. # Generate a parser -If your grammar was changed in `public/chain.peg` you need to re-generate the static parser. You could use a grunt task: +If your grammar was changed in `public/chain.peggy` you need to re-generate the static parser. You could use a grunt task: ``` grunt peg:timelion_chain ``` -The generated parser will be appeared at `public/_generated_` folder, which is included in `.eslintignore` \ No newline at end of file +or you can run `node_modules/.bin/peggy -o common/_generated_/chain.js common/chain.peggy` directly. + +The generated parser will be appeared at `common/_generated_` folder diff --git a/src/plugins/vis_type_timelion/common/_generated_/chain.js b/src/plugins/vis_type_timelion/common/_generated_/chain.js index f812b94238d43d..98971af3628079 100644 --- a/src/plugins/vis_type_timelion/common/_generated_/chain.js +++ b/src/plugins/vis_type_timelion/common/_generated_/chain.js @@ -1,437 +1,532 @@ -module.exports = (function() { - "use strict"; - - /* - * Generated by PEG.js 0.9.0. - * - * http://pegjs.org/ - */ - - function peg$subclass(child, parent) { - function ctor() { this.constructor = child; } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); +// Generated by Peggy 0.11.0. +// +// https://github.com/peggyjs/peggy + +"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) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); } +} - function peg$SyntaxError(message, expected, found, location) { - this.message = message; - this.expected = expected; - this.found = found; - this.location = location; - this.name = "SyntaxError"; +peg$subclass(peg$SyntaxError, Error); - if (typeof Error.captureStackTrace === "function") { - Error.captureStackTrace(this, peg$SyntaxError); +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 + "]"; + }, + + 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(); } - peg$subclass(peg$SyntaxError, Error); + 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 peg$parse(input) { - var options = arguments.length > 1 ? arguments[1] : {}, - parser = this, + 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); }); + } - peg$FAILED = {}, + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } - peg$startRuleFunctions = { start: peg$parsestart }, - peg$startRuleFunction = peg$parsestart, + function describeExpected(expected) { + var descriptions = expected.map(describeExpectation); + var i, j; - peg$c0 = function(tree) { - return { - tree: tree.filter(function (o) {return o != null}), - functions: functions, - args: args, - variables: variables - } - }, - peg$c1 = ",", - peg$c2 = { type: "literal", value: ",", description: "\",\"" }, - peg$c3 = function(first, arg) {return arg}, - peg$c4 = function(first, rest) { - return [first].concat(rest); - }, - peg$c5 = "=", - peg$c6 = { type: "literal", value: "=", description: "\"=\"" }, - peg$c7 = function(name, value) { - var arg = { - type: 'namedArg', - name: name, - value: value, - location: simpleLocation(location()), - text: text() - }; - currentArgs.push(arg); - return arg; - }, - peg$c8 = function(value) { - var exception = { - type: 'incompleteArgument', - currentArgs: currentArgs, - currentFunction: currentFunction, - location: simpleLocation(location()), - text: text() - } - error(JSON.stringify(exception)); - }, - peg$c9 = function(name) { - var exception = { - type: 'incompleteArgumentValue', - currentArgs: currentArgs, - currentFunction: currentFunction, - name: name, - location: simpleLocation(location()), - text: text() - } - error(JSON.stringify(exception)); - }, - peg$c10 = function(element) {return element}, - peg$c11 = function(literal) { - var result = ltoo(literal); - result.location = simpleLocation(location()), - result.text = text(); - return result; - }, - peg$c12 = "$", - peg$c13 = { type: "literal", value: "$", description: "\"$\"" }, - peg$c14 = function(name) { - if (variables[name]) { - return variables[name]; - } else { - error('$' + name + ' is not defined') - } - }, - peg$c15 = function(name, value) { - variables[name] = value; - }, - peg$c16 = function(first, series) {return series}, - peg$c17 = function(first, rest) { - return [first].concat(rest) - }, - peg$c18 = /^[a-zA-Z]/, - peg$c19 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" }, - peg$c20 = /^[.a-zA-Z0-9_\-]/, - peg$c21 = { type: "class", value: "[.a-zA-Z0-9_-]", description: "[.a-zA-Z0-9_-]" }, - peg$c22 = function(first, rest) { - currentFunction = first.join('') + rest.join(''); - currentArgs = []; - return currentFunction; - }, - peg$c23 = function(first, rest) { return first.join('') + rest.join('') }, - peg$c24 = { type: "other", description: "function" }, - peg$c25 = ".", - peg$c26 = { type: "literal", value: ".", description: "\".\"" }, - peg$c27 = "(", - peg$c28 = { type: "literal", value: "(", description: "\"(\"" }, - peg$c29 = ")", - peg$c30 = { type: "literal", value: ")", description: "\")\"" }, - peg$c31 = function(name, arg_list) { - var result = { - type: 'function', - function: name, - arguments: arg_list || [], - location: simpleLocation(location()), - text: text() - } + descriptions.sort(); - result.arguments.forEach(function (arg) { - arg.function = name; - args.push(arg); - }) - - functions.push(result) - return result; - }, - peg$c32 = function(func) { - var exception = { - type: 'incompleteFunction', - function: func, - location: simpleLocation(location()), - text: text() - } - error(JSON.stringify(exception)); - }, - peg$c33 = "@", - peg$c34 = { type: "literal", value: "@", description: "\"@\"" }, - peg$c35 = ":", - peg$c36 = { type: "literal", value: ":", description: "\":\"" }, - peg$c37 = function(plot, series) { - return { - type: 'reference', - plot: plot, - series: series - } - }, - peg$c38 = function(plot) { - return { - type: 'reference', - plot: plot - } - }, - peg$c39 = function(func, rest) {return {type: 'chain', chain: [func].concat(rest)}}, - peg$c40 = function(grouped, functions) { - var first = { - type: 'chainList', - list: grouped - } - first.label = text(); - - return {type: "chain", chain: [first].concat(functions)}; - }, - peg$c41 = { type: "other", description: "literal" }, - peg$c42 = "\"", - peg$c43 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c44 = function(chars) { return chars.join(''); }, - peg$c45 = "'", - peg$c46 = { type: "literal", value: "'", description: "\"'\"" }, - peg$c47 = "true", - peg$c48 = { type: "literal", value: "true", description: "\"true\"" }, - peg$c49 = function() { return true; }, - peg$c50 = "false", - peg$c51 = { type: "literal", value: "false", description: "\"false\"" }, - peg$c52 = function() { return false; }, - peg$c53 = "null", - peg$c54 = { type: "literal", value: "null", description: "\"null\"" }, - peg$c55 = function() { return null; }, - peg$c56 = /^[^()"',= \t]/, - peg$c57 = { type: "class", value: "[^()\"',=\\ \\t]", description: "[^()\"',=\\ \\t]" }, - peg$c58 = function(string) { // this also matches numbers via Number() - var result = string.join(''); - // Sort of hacky, but PEG doesn't have backtracking so - // a number rule is hard to read, and performs worse - if (isNaN(Number(result))) return result; - return Number(result) - }, - peg$c59 = /^[ \t\r\n]/, - peg$c60 = { type: "class", value: "[\\ \\t\\r\\n]", description: "[\\ \\t\\r\\n]" }, - peg$c61 = "\\", - peg$c62 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c63 = function(sequence) { return sequence; }, - peg$c64 = /^[^"]/, - peg$c65 = { type: "class", value: "[^\"]", description: "[^\"]" }, - peg$c66 = /^[^']/, - peg$c67 = { type: "class", value: "[^']", description: "[^']" }, - peg$c68 = /^[0-9]/, - peg$c69 = { type: "class", value: "[0-9]", description: "[0-9]" }, - peg$c70 = function(digits) {return parseInt(digits.join(''))}, - - peg$currPos = 0, - peg$savedPos = 0, - peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }], - peg$maxFailPos = 0, - peg$maxFailExpected = [], - peg$silentFails = 0, - - peg$result; - - if ("startRule" in options) { - if (!(options.startRule in peg$startRuleFunctions)) { - throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } } - - peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + descriptions.length = j; } - function text() { - return input.substring(peg$savedPos, peg$currPos); - } + switch (descriptions.length) { + case 1: + return descriptions[0]; - function location() { - return peg$computeLocation(peg$savedPos, peg$currPos); - } + case 2: + return descriptions[0] + " or " + descriptions[1]; - function expected(description) { - throw peg$buildException( - null, - [{ type: "other", description: description }], - input.substring(peg$savedPos, peg$currPos), - peg$computeLocation(peg$savedPos, peg$currPos) - ); + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; } + } - function error(message) { - throw peg$buildException( - message, - null, - input.substring(peg$savedPos, peg$currPos), - peg$computeLocation(peg$savedPos, peg$currPos) - ); - } + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } - function peg$computePosDetails(pos) { - var details = peg$posDetailsCache[pos], - p, ch; + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; +}; - if (details) { - return details; - } else { - p = pos - 1; - while (!peg$posDetailsCache[p]) { - p--; - } +function peg$parse(input, options) { + options = options !== undefined ? options : {}; - details = peg$posDetailsCache[p]; - details = { - line: details.line, - column: details.column, - seenCR: details.seenCR - }; - - while (p < pos) { - ch = input.charAt(p); - if (ch === "\n") { - if (!details.seenCR) { details.line++; } - details.column = 1; - details.seenCR = false; - } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { - details.line++; - details.column = 1; - details.seenCR = true; - } else { - details.column++; - details.seenCR = false; - } + var peg$FAILED = {}; - p++; - } + var peg$startRuleFunctions = { start: peg$parsestart }; + var peg$startRuleFunction = peg$parsestart; - peg$posDetailsCache[pos] = details; - return details; - } + var peg$c0 = function(tree) { + return { + tree: tree.filter(function (o) {return o != null}), + functions: functions, + args: args, + variables: variables + } + }; + var peg$c1 = ","; + var peg$c2 = peg$literalExpectation(",", false); + var peg$c3 = function(first, arg) {return arg}; + var peg$c4 = function(first, rest) { + return [first].concat(rest); + }; + var peg$c5 = "="; + var peg$c6 = peg$literalExpectation("=", false); + var peg$c7 = function(name, value) { + var arg = { + type: 'namedArg', + name: name, + value: value, + location: simpleLocation(location()), + text: text() + }; + currentArgs.push(arg); + return arg; + }; + var peg$c8 = function(value) { + var exception = { + type: 'incompleteArgument', + currentArgs: currentArgs, + currentFunction: currentFunction, + location: simpleLocation(location()), + text: text() + } + error(JSON.stringify(exception)); + }; + var peg$c9 = function(name) { + var exception = { + type: 'incompleteArgumentValue', + currentArgs: currentArgs, + currentFunction: currentFunction, + name: name, + location: simpleLocation(location()), + text: text() + } + error(JSON.stringify(exception)); + }; + var peg$c10 = function(element) {return element}; + var peg$c11 = function(literal) { + var result = ltoo(literal); + result.location = simpleLocation(location()), + result.text = text(); + return result; + }; + var peg$c12 = "$"; + var peg$c13 = peg$literalExpectation("$", false); + var peg$c14 = function(name) { + if (variables[name]) { + return variables[name]; + } else { + error('$' + name + ' is not defined') + } + }; + var peg$c15 = function(name, value) { + variables[name] = value; + }; + var peg$c16 = function(first, series) {return series}; + var peg$c17 = function(first, rest) { + return [first].concat(rest) + }; + var peg$c18 = /^[a-zA-Z]/; + var peg$c19 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false); + var peg$c20 = /^[.a-zA-Z0-9_\-]/; + var peg$c21 = peg$classExpectation([".", ["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false); + var peg$c22 = function(first, rest) { + currentFunction = first.join('') + rest.join(''); + currentArgs = []; + return currentFunction; + }; + var peg$c23 = function(first, rest) { return first.join('') + rest.join('') }; + var peg$c24 = peg$otherExpectation("function"); + var peg$c25 = "."; + var peg$c26 = peg$literalExpectation(".", false); + var peg$c27 = "("; + var peg$c28 = peg$literalExpectation("(", false); + var peg$c29 = ")"; + var peg$c30 = peg$literalExpectation(")", false); + var peg$c31 = function(name, arg_list) { + var result = { + type: 'function', + function: name, + arguments: arg_list || [], + location: simpleLocation(location()), + text: text() } - function peg$computeLocation(startPos, endPos) { - var startPosDetails = peg$computePosDetails(startPos), - endPosDetails = peg$computePosDetails(endPos); - - return { - start: { - offset: startPos, - line: startPosDetails.line, - column: startPosDetails.column - }, - end: { - offset: endPos, - line: endPosDetails.line, - column: endPosDetails.column - } - }; + result.arguments.forEach(function (arg) { + arg.function = name; + args.push(arg); + }) + + functions.push(result) + return result; + }; + var peg$c32 = function(func) { + var exception = { + type: 'incompleteFunction', + function: func, + location: simpleLocation(location()), + text: text() + } + error(JSON.stringify(exception)); + }; + var peg$c33 = "@"; + var peg$c34 = peg$literalExpectation("@", false); + var peg$c35 = ":"; + var peg$c36 = peg$literalExpectation(":", false); + var peg$c37 = function(plot, series) { + return { + type: 'reference', + plot: plot, + series: series + } + }; + var peg$c38 = function(plot) { + return { + type: 'reference', + plot: plot + } + }; + var peg$c39 = function(func, rest) {return {type: 'chain', chain: [func].concat(rest)}}; + var peg$c40 = function(grouped, functions) { + var first = { + type: 'chainList', + list: grouped + } + first.label = text(); + + return {type: "chain", chain: [first].concat(functions)}; + }; + var peg$c41 = peg$otherExpectation("literal"); + var peg$c42 = "\""; + var peg$c43 = peg$literalExpectation("\"", false); + var peg$c44 = function(chars) { return chars.join(''); }; + var peg$c45 = "'"; + var peg$c46 = peg$literalExpectation("'", false); + var peg$c47 = "true"; + var peg$c48 = peg$literalExpectation("true", false); + var peg$c49 = function() { return true; }; + var peg$c50 = "false"; + var peg$c51 = peg$literalExpectation("false", false); + var peg$c52 = function() { return false; }; + var peg$c53 = "null"; + var peg$c54 = peg$literalExpectation("null", false); + var peg$c55 = function() { return null; }; + var peg$c56 = /^[^()"',= \t]/; + var peg$c57 = peg$classExpectation(["(", ")", "\"", "'", ",", "=", " ", "\t"], true, false); + var peg$c58 = function(string) { // this also matches numbers via Number() + var result = string.join(''); + // Sort of hacky, but PEG doesn't have backtracking so + // a number rule is hard to read, and performs worse + if (isNaN(Number(result))) return result; + return Number(result) + }; + var peg$c59 = /^[ \t\r\n]/; + var peg$c60 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false); + var peg$c61 = "\\"; + var peg$c62 = peg$literalExpectation("\\", false); + var peg$c63 = function(sequence) { return sequence; }; + var peg$c64 = /^[^"]/; + var peg$c65 = peg$classExpectation(["\""], true, false); + var peg$c66 = /^[^']/; + var peg$c67 = peg$classExpectation(["'"], true, false); + var peg$c68 = /^[0-9]/; + var peg$c69 = peg$classExpectation([["0", "9"]], false, false); + var peg$c70 = function(digits) {return parseInt(digits.join(''))}; + + 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 + "\"."); } - function peg$fail(expected) { - if (peg$currPos < peg$maxFailPos) { return; } + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } - if (peg$currPos > peg$maxFailPos) { - peg$maxFailPos = peg$currPos; - peg$maxFailExpected = []; - } + function text() { + return input.substring(peg$savedPos, peg$currPos); + } - peg$maxFailExpected.push(expected); - } + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); + } - function peg$buildException(message, expected, found, location) { - function cleanupExpected(expected) { - var i = 1; + function expected(description, location) { + location = location !== undefined + ? location + : peg$computeLocation(peg$savedPos, peg$currPos); - expected.sort(function(a, b) { - if (a.description < b.description) { - return -1; - } else if (a.description > b.description) { - return 1; - } else { - return 0; - } - }); + throw peg$buildStructuredError( + [peg$otherExpectation(description)], + input.substring(peg$savedPos, peg$currPos), + location + ); + } - while (i < expected.length) { - if (expected[i - 1] === expected[i]) { - expected.splice(i, 1); - } else { - i++; - } - } - } + function error(message, location) { + location = location !== undefined + ? location + : peg$computeLocation(peg$savedPos, peg$currPos); - function buildMessage(expected, found) { - function stringEscape(s) { - function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } - - return s - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\x08/g, '\\b') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\f/g, '\\f') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) - .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) - .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) - .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); - } + throw peg$buildSimpleError(message, location); + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: "literal", text: text, ignoreCase: ignoreCase }; + } - var expectedDescs = new Array(expected.length), - expectedDesc, foundDesc, i; + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } - for (i = 0; i < expected.length; i++) { - expectedDescs[i] = expected[i].description; - } + function peg$anyExpectation() { + return { type: "any" }; + } - expectedDesc = expected.length > 1 - ? expectedDescs.slice(0, -1).join(", ") - + " or " - + expectedDescs[expected.length - 1] - : expectedDescs[0]; + function peg$endExpectation() { + return { type: "end" }; + } + + function peg$otherExpectation(description) { + return { type: "other", description: description }; + } - foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos]; + var p; - return "Expected " + expectedDesc + " but " + foundDesc + " found."; + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; } - if (expected !== null) { - cleanupExpected(expected); + 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++; } - return new peg$SyntaxError( - message !== null ? message : buildMessage(expected, found), - expected, - found, - location - ); - } + peg$posDetailsCache[pos] = details; - function peg$parsestart() { - var s0, s1, s2; + return details; + } + } - s0 = peg$currPos; - s1 = peg$parsespace(); - if (s1 === peg$FAILED) { - s1 = null; + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos); + var endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column } - if (s1 !== peg$FAILED) { - s2 = peg$parseseries(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c0(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + }; + } + + 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; + + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseseries(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parsearg_list() { - var s0, s1, s2, s3, s4, s5, s6, s7; + return s0; + } - s0 = peg$currPos; - s1 = peg$parseargument(); - if (s1 !== peg$FAILED) { - s2 = []; + function peg$parsearg_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseargument(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parsespace(); + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c1; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c2); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parsespace(); + if (s6 === peg$FAILED) { + s6 = null; + } + if (s6 !== peg$FAILED) { + s7 = peg$parseargument(); + if (s7 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c3(s1, s7); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$currPos; s4 = peg$parsespace(); if (s4 === peg$FAILED) { @@ -472,68 +567,75 @@ module.exports = (function() { peg$currPos = s3; s3 = peg$FAILED; } - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parsespace(); + } + if (s2 !== peg$FAILED) { + s3 = peg$parsespace(); + if (s3 === peg$FAILED) { + s3 = null; + } + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s4 = peg$c1; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c2); } + } if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 44) { - s5 = peg$c1; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c2); } - } - if (s5 !== peg$FAILED) { - s6 = peg$parsespace(); - if (s6 === peg$FAILED) { - s6 = null; - } - if (s6 !== peg$FAILED) { - s7 = peg$parseargument(); - if (s7 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c3(s1, 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; + s1 = peg$c4(s1, s2); + s0 = s1; } else { - peg$currPos = s3; - s3 = peg$FAILED; + peg$currPos = s0; + s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - if (s2 !== peg$FAILED) { - s3 = peg$parsespace(); - if (s3 === peg$FAILED) { - s3 = null; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseargument() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseargument_name(); + if (s1 !== peg$FAILED) { + s2 = peg$parsespace(); + if (s2 === peg$FAILED) { + s2 = null; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s3 = peg$c5; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c6); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsespace(); + if (s4 === peg$FAILED) { + s4 = null; } - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 44) { - s4 = peg$c1; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c2); } - } - if (s4 === peg$FAILED) { - s4 = null; - } - if (s4 !== peg$FAILED) { + if (s4 !== peg$FAILED) { + s5 = peg$parsearg_type(); + if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c4(s1, s2); + s1 = peg$c7(s1, s5); s0 = s1; } else { peg$currPos = s0; @@ -551,43 +653,38 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - function peg$parseargument() { - var s0, s1, s2, s3, s4, s5; - + if (s0 === peg$FAILED) { s0 = peg$currPos; - s1 = peg$parseargument_name(); + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } if (s1 !== peg$FAILED) { - s2 = peg$parsespace(); - if (s2 === peg$FAILED) { - s2 = null; + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c5; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c6); } } if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s3 = peg$c5; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + s3 = peg$parsespace(); + if (s3 === peg$FAILED) { + s3 = null; } if (s3 !== peg$FAILED) { - s4 = peg$parsespace(); + s4 = peg$parsearg_type(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { - s5 = peg$parsearg_type(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c7(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + peg$savedPos = s0; + s1 = peg$c8(s4); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -606,36 +703,24 @@ module.exports = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - s1 = peg$parsespace(); - if (s1 === peg$FAILED) { - s1 = null; - } + s1 = peg$parseargument_name(); if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s2 = peg$c5; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + s2 = peg$parsespace(); + if (s2 === peg$FAILED) { + s2 = null; } if (s2 !== peg$FAILED) { - s3 = peg$parsespace(); - if (s3 === peg$FAILED) { - s3 = null; + if (input.charCodeAt(peg$currPos) === 61) { + s3 = peg$c5; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c6); } } if (s3 !== peg$FAILED) { - s4 = peg$parsearg_type(); - if (s4 === peg$FAILED) { - s4 = null; - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c8(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + peg$savedPos = s0; + s1 = peg$c9(s1); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -650,141 +735,105 @@ module.exports = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - s1 = peg$parseargument_name(); + s1 = peg$parsearg_type(); if (s1 !== peg$FAILED) { - s2 = peg$parsespace(); - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s3 = peg$c5; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c9(s1); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parsearg_type(); - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c10(s1); - } - s0 = s1; + peg$savedPos = s0; + s1 = peg$c10(s1); } + s0 = s1; } } - - return s0; } - function peg$parsearg_type() { - var s0, s1; + return s0; + } - s0 = peg$parsevariable_get(); + function peg$parsearg_type() { + var s0, s1; + + s0 = peg$parsevariable_get(); + if (s0 === peg$FAILED) { + s0 = peg$parseseries_type(); if (s0 === peg$FAILED) { - s0 = peg$parseseries_type(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parseliteral(); - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c11(s1); - } - s0 = s1; + s0 = peg$currPos; + s1 = peg$parseliteral(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c11(s1); } + s0 = s1; } - - return s0; } - function peg$parsevariable_get() { - var s0, s1, s2; + return s0; + } - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 36) { - s1 = peg$c12; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseargument_name(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c14(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + function peg$parsevariable_get() { + var s0, s1, s2; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 36) { + s1 = peg$c12; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c13); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseargument_name(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c14(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parsevariable_set() { - var s0, s1, s2, s3, s4, s5, s6; + return s0; + } - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 36) { - s1 = peg$c12; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseargument_name(); - if (s2 !== peg$FAILED) { - s3 = peg$parsespace(); - if (s3 === peg$FAILED) { - s3 = null; + function peg$parsevariable_set() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 36) { + s1 = peg$c12; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c13); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseargument_name(); + if (s2 !== peg$FAILED) { + s3 = peg$parsespace(); + if (s3 === peg$FAILED) { + s3 = null; + } + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s4 = peg$c5; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c6); } } - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s4 = peg$c5; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + if (s4 !== peg$FAILED) { + s5 = peg$parsespace(); + if (s5 === peg$FAILED) { + s5 = null; } - if (s4 !== peg$FAILED) { - s5 = peg$parsespace(); - if (s5 === peg$FAILED) { - s5 = null; - } - if (s5 !== peg$FAILED) { - s6 = peg$parsearg_type(); - if (s6 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c15(s2, s6); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s5 !== peg$FAILED) { + s6 = peg$parsearg_type(); + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c15(s2, s6); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -805,37 +854,83 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseseries_type() { - var s0; + return s0; + } + + function peg$parseseries_type() { + var s0; - s0 = peg$parsevariable_set(); + s0 = peg$parsevariable_set(); + if (s0 === peg$FAILED) { + s0 = peg$parsevariable_get(); if (s0 === peg$FAILED) { - s0 = peg$parsevariable_get(); + s0 = peg$parsegroup(); if (s0 === peg$FAILED) { - s0 = peg$parsegroup(); + s0 = peg$parsechain(); if (s0 === peg$FAILED) { - s0 = peg$parsechain(); - if (s0 === peg$FAILED) { - s0 = peg$parsereference(); - } + s0 = peg$parsereference(); } } } - - return s0; } - function peg$parseseries() { - var s0, s1, s2, s3, s4, s5, s6, s7; + return s0; + } - s0 = peg$currPos; - s1 = peg$parseseries_type(); - if (s1 !== peg$FAILED) { - s2 = []; + function peg$parseseries() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parseseries_type(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parsespace(); + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c1; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c2); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parsespace(); + if (s6 === peg$FAILED) { + s6 = null; + } + if (s6 !== peg$FAILED) { + s7 = peg$parseseries_type(); + if (s7 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c16(s1, s7); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$currPos; s4 = peg$parsespace(); if (s4 === peg$FAILED) { @@ -876,68 +971,22 @@ module.exports = (function() { peg$currPos = s3; s3 = peg$FAILED; } - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parsespace(); - if (s4 === peg$FAILED) { - s4 = null; - } - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 44) { - s5 = peg$c1; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c2); } - } - if (s5 !== peg$FAILED) { - s6 = peg$parsespace(); - if (s6 === peg$FAILED) { - s6 = null; - } - if (s6 !== peg$FAILED) { - s7 = peg$parseseries_type(); - if (s7 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c16(s1, s7); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s3 = peg$c1; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c2); } } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 44) { - s3 = peg$c1; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c2); } - } - if (s3 === peg$FAILED) { - s3 = null; - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c17(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s3 === peg$FAILED) { + s3 = null; + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c17(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -946,38 +995,51 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parsefunction_name() { - var s0, s1, s2, s3; + return s0; + } - s0 = peg$currPos; - s1 = []; - if (peg$c18.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } - } - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - if (peg$c18.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } - } + function peg$parsefunction_name() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = []; + if (peg$c18.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c19); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c18.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c19); } } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c20.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; } else { - s1 = peg$FAILED; + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c21); } } - if (s1 !== peg$FAILED) { - s2 = []; + while (s3 !== peg$FAILED) { + s2.push(s3); if (peg$c20.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; @@ -985,60 +1047,60 @@ module.exports = (function() { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c21); } } - while (s3 !== peg$FAILED) { - s2.push(s3); - if (peg$c20.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c21); } - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c22(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c22(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseargument_name() { - var s0, s1, s2, s3; + return s0; + } - s0 = peg$currPos; - s1 = []; - if (peg$c18.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } - } - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - if (peg$c18.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } - } + function peg$parseargument_name() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = []; + if (peg$c18.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c19); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c18.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c19); } } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c20.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; } else { - s1 = peg$FAILED; + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c21); } } - if (s1 !== peg$FAILED) { - s2 = []; + while (s3 !== peg$FAILED) { + s2.push(s3); if (peg$c20.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; @@ -1046,100 +1108,87 @@ module.exports = (function() { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c21); } } - while (s3 !== peg$FAILED) { - s2.push(s3); - if (peg$c20.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c21); } - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c23(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c23(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parsefunction() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; + return s0; + } - peg$silentFails++; - s0 = peg$currPos; - s1 = peg$parsespace(); - if (s1 === peg$FAILED) { - s1 = null; + function peg$parsefunction() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c25; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c26); } } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 46) { - s2 = peg$c25; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parsefunction_name(); - if (s3 !== peg$FAILED) { - s4 = peg$parsespace(); - if (s4 === peg$FAILED) { - s4 = null; + if (s2 !== peg$FAILED) { + s3 = peg$parsefunction_name(); + if (s3 !== peg$FAILED) { + s4 = peg$parsespace(); + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 40) { + s5 = peg$c27; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c28); } } - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 40) { - s5 = peg$c27; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c28); } + if (s5 !== peg$FAILED) { + s6 = peg$parsespace(); + if (s6 === peg$FAILED) { + s6 = null; } - if (s5 !== peg$FAILED) { - s6 = peg$parsespace(); - if (s6 === peg$FAILED) { - s6 = null; + if (s6 !== peg$FAILED) { + s7 = peg$parsearg_list(); + if (s7 === peg$FAILED) { + s7 = null; } - if (s6 !== peg$FAILED) { - s7 = peg$parsearg_list(); - if (s7 === peg$FAILED) { - s7 = null; + if (s7 !== peg$FAILED) { + s8 = peg$parsespace(); + if (s8 === peg$FAILED) { + s8 = null; } - if (s7 !== peg$FAILED) { - s8 = peg$parsespace(); - if (s8 === peg$FAILED) { - s8 = null; + if (s8 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s9 = peg$c29; + peg$currPos++; + } else { + s9 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } } - if (s8 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s9 = peg$c29; - peg$currPos++; - } else { - s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } + if (s9 !== peg$FAILED) { + s10 = peg$parsespace(); + if (s10 === peg$FAILED) { + s10 = null; } - if (s9 !== peg$FAILED) { - s10 = peg$parsespace(); - if (s10 === peg$FAILED) { - s10 = null; - } - if (s10 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c31(s3, s7); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s10 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c31(s3, s7); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1176,23 +1225,72 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 46) { - s1 = peg$c25; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s1 = peg$c25; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c26); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsefunction_name(); + if (s2 === peg$FAILED) { + s2 = null; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c32(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c24); } + } + + return s0; + } + + function peg$parsereference() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 64) { + s1 = peg$c33; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c34); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinteger(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c35; peg$currPos++; } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c36); } } - if (s1 !== peg$FAILED) { - s2 = peg$parsefunction_name(); - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { + if (s3 !== peg$FAILED) { + s4 = peg$parseinteger(); + if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c32(s2); + s1 = peg$c37(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -1202,19 +1300,15 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c24); } - } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - function peg$parsereference() { - var s0, s1, s2, s3, s4; - + if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 64) { s1 = peg$c33; @@ -1226,27 +1320,9 @@ module.exports = (function() { if (s1 !== peg$FAILED) { s2 = peg$parseinteger(); if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c35; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } - } - if (s3 !== peg$FAILED) { - s4 = peg$parseinteger(); - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c37(s2, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + peg$savedPos = s0; + s1 = peg$c38(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1255,59 +1331,32 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 64) { - s1 = peg$c33; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseinteger(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c38(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } - - return s0; } - function peg$parsechain() { - var s0, s1, s2, s3, s4; - - s0 = peg$currPos; - s1 = peg$parsefunction(); - if (s1 !== peg$FAILED) { - s2 = peg$parsespace(); - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { - s3 = []; + return s0; + } + + function peg$parsechain() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + s1 = peg$parsefunction(); + if (s1 !== peg$FAILED) { + s2 = peg$parsespace(); + if (s2 === peg$FAILED) { + s2 = null; + } + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parsefunction(); + while (s4 !== peg$FAILED) { + s3.push(s4); s4 = peg$parsefunction(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parsefunction(); - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c39(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c39(s1, s3); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1316,56 +1365,56 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parsegroup() { - var s0, s1, s2, s3, s4, s5, s6, s7; + return s0; + } - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c27; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c28); } + function peg$parsegroup() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c28); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsespace(); + if (s2 === peg$FAILED) { + s2 = null; } - if (s1 !== peg$FAILED) { - s2 = peg$parsespace(); - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { - s3 = peg$parseseries(); - if (s3 !== peg$FAILED) { - s4 = peg$parsespace(); - if (s4 === peg$FAILED) { - s4 = null; + if (s2 !== peg$FAILED) { + s3 = peg$parseseries(); + if (s3 !== peg$FAILED) { + s4 = peg$parsespace(); + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c29; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } } - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c29; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } - } - if (s5 !== peg$FAILED) { - s6 = []; + if (s5 !== peg$FAILED) { + s6 = []; + s7 = peg$parsefunction(); + while (s7 !== peg$FAILED) { + s6.push(s7); s7 = peg$parsefunction(); - while (s7 !== peg$FAILED) { - s6.push(s7); - s7 = peg$parsefunction(); - } - if (s6 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c40(s3, s6); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c40(s3, s6); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1386,36 +1435,80 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseliteral() { - var s0, s1, s2, s3; + return s0; + } + + function peg$parseliteral() { + var s0, s1, s2, s3; - peg$silentFails++; + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c42; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parsedq_char(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parsedq_char(); + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c42; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c44(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c42; + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c45; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c43); } + if (peg$silentFails === 0) { peg$fail(peg$c46); } } if (s1 !== peg$FAILED) { s2 = []; - s3 = peg$parsedq_char(); + s3 = peg$parsesq_char(); while (s3 !== peg$FAILED) { s2.push(s3); - s3 = peg$parsedq_char(); + s3 = peg$parsesq_char(); } if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c42; + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c45; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c43); } + if (peg$silentFails === 0) { peg$fail(peg$c46); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; @@ -1435,346 +1528,304 @@ module.exports = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 39) { - s1 = peg$c45; - peg$currPos++; + if (input.substr(peg$currPos, 4) === peg$c47) { + s1 = peg$c47; + peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } + if (peg$silentFails === 0) { peg$fail(peg$c48); } } if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parsesq_char(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parsesq_char(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c45; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c44(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; + peg$savedPos = s0; + s1 = peg$c49(); } + s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c47) { - s1 = peg$c47; - peg$currPos += 4; + if (input.substr(peg$currPos, 5) === peg$c50) { + s1 = peg$c50; + peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } + if (peg$silentFails === 0) { peg$fail(peg$c51); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c49(); + s1 = peg$c52(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c50) { - s1 = peg$c50; - peg$currPos += 5; + if (input.substr(peg$currPos, 4) === peg$c53) { + s1 = peg$c53; + peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c51); } + if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c52(); + s1 = peg$c55(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c53) { - s1 = peg$c53; - peg$currPos += 4; + s1 = []; + if (peg$c56.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c57); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c56.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c57); } + } + } } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c55(); + s1 = peg$c58(s1); } s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - if (peg$c56.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c57); } - } - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - if (peg$c56.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c57); } - } - } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c58(s1); - } - s0 = s1; - } } } } } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } - } - - return s0; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c41); } } - function peg$parsespace() { - var s0, s1; + return s0; + } - s0 = []; - if (peg$c59.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c60); } - } - if (s1 !== peg$FAILED) { - while (s1 !== peg$FAILED) { - s0.push(s1); - if (peg$c59.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c60); } - } + function peg$parsespace() { + var s0, s1; + + s0 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c59.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } } - } else { - s0 = peg$FAILED; } - - return s0; + } else { + s0 = peg$FAILED; } - function peg$parsedq_char() { - var s0, s1, s2; + return s0; + } + + function peg$parsedq_char() { + var s0, s1, s2; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c61; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c61; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c62); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s2 = peg$c42; peg$currPos++; } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c62); } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c42; + if (s2 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 92) { + s2 = peg$c61; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c43); } - } - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 92) { - s2 = peg$c61; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c62); } - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c63(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c62); } } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c63(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - if (peg$c64.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c65); } - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + if (peg$c64.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } } - - return s0; } - function peg$parsesq_char() { - var s0, s1, s2; + return s0; + } + + function peg$parsesq_char() { + var s0, s1, s2; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c61; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c61; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c62); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s2 = peg$c45; peg$currPos++; } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c62); } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c46); } } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 39) { - s2 = peg$c45; + if (s2 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 92) { + s2 = peg$c61; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } - } - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 92) { - s2 = peg$c61; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c62); } - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c63(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c62); } } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c63(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - if (peg$c66.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c67); } - } - } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - function peg$parseinteger() { - var s0, s1, s2; - - s0 = peg$currPos; - s1 = []; - if (peg$c68.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); + if (s0 === peg$FAILED) { + if (peg$c66.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); peg$currPos++; } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c69); } + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c67); } } - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - if (peg$c68.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c69); } - } + } + + return s0; + } + + function peg$parseinteger() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = []; + if (peg$c68.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c68.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c70(s1); } - s0 = s1; - - return s0; + } else { + s1 = peg$FAILED; } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c70(s1); + } + s0 = s1; + return s0; + } - function ltoo (literal) { - return {type: 'literal', value: literal} - } - function simpleLocation (location) { - // Returns an object representing the position of the function within the expression, - // demarcated by the position of its first character and last character. We calculate these values - // using the offset because the expression could span multiple lines, and we don't want to deal - // with column and line values. - return { - min: location.start.offset, - max: location.end.offset - } - } + function ltoo (literal) { + return {type: 'literal', value: literal} + } - var currentFunction; - var currentArgs = []; + function simpleLocation (location) { + // Returns an object representing the position of the function within the expression, + // demarcated by the position of its first character and last character. We calculate these values + // using the offset because the expression could span multiple lines, and we don't want to deal + // with column and line values. + return { + min: location.start.offset, + max: location.end.offset + } + } - var functions = []; - var args = []; - var variables = {}; + var currentFunction; + var currentArgs = []; + var functions = []; + var args = []; + var variables = {}; - 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({ type: "end", description: "end of input" }); - } + peg$result = peg$startRuleFunction(); - throw peg$buildException( - null, - 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) - ); + 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) + ); } +} - return { - SyntaxError: peg$SyntaxError, - parse: peg$parse - }; -})(); \ No newline at end of file +module.exports = { + SyntaxError: peg$SyntaxError, + parse: peg$parse +}; diff --git a/src/plugins/vis_type_timelion/common/chain.peg b/src/plugins/vis_type_timelion/common/chain.peggy similarity index 100% rename from src/plugins/vis_type_timelion/common/chain.peg rename to src/plugins/vis_type_timelion/common/chain.peggy diff --git a/tasks/config/peg.js b/tasks/config/peggy.js similarity index 83% rename from tasks/config/peg.js rename to tasks/config/peggy.js index 754f7a0290fe7d..e5a64e4dd76478 100644 --- a/tasks/config/peg.js +++ b/tasks/config/peggy.js @@ -8,7 +8,7 @@ module.exports = { kuery: { - src: 'src/plugins/data/common/es_query/kuery/ast/kuery.peg', + src: 'src/plugins/data/common/es_query/kuery/ast/kuery.peggy', dest: 'src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js', options: { allowedStartRules: ['start', 'Literal'], @@ -16,7 +16,7 @@ module.exports = { }, }, timelion_chain: { - src: 'src/plugins/vis_type_timelion/common/chain.peg', + src: 'src/plugins/vis_type_timelion/common/chain.peggy', dest: 'src/plugins/vis_type_timelion/common/_generated_/chain.js', }, }; diff --git a/x-pack/plugins/security_solution/public/common/lib/keury/index.ts b/x-pack/plugins/security_solution/public/common/lib/keury/index.ts index bd026f486471f1..d368d54e929d6e 100644 --- a/x-pack/plugins/security_solution/public/common/lib/keury/index.ts +++ b/x-pack/plugins/security_solution/public/common/lib/keury/index.ts @@ -59,10 +59,10 @@ export const escapeQueryValue = (val: number | string = ''): string | number => const escapeWhitespace = (val: string) => val.replace(/\t/g, '\\t').replace(/\r/g, '\\r').replace(/\n/g, '\\n'); -// See the SpecialCharacter rule in kuery.peg +// See the SpecialCharacter rule in kuery.peggy const escapeSpecialCharacters = (val: string) => val.replace(/["]/g, '\\$&'); // $& means the whole matched string -// See the Keyword rule in kuery.peg +// See the Keyword rule in kuery.peggy // I do not think that we need that anymore since we are doing a full match_phrase all the time now => return `"${escapeKuery(val)}"`; // const escapeAndOr = (val: string) => val.replace(/(\s+)(and|or)(\s+)/gi, '$1\\$2$3'); diff --git a/yarn.lock b/yarn.lock index f4d76841749673..ac61f466799b62 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5438,11 +5438,6 @@ "@types/node" "*" "@types/pdfkit" "*" -"@types/pegjs@^0.10.1": - version "0.10.1" - resolved "https://registry.yarnpkg.com/@types/pegjs/-/pegjs-0.10.1.tgz#9a2f3961dc62430fdb21061eb0ddbd890f9e3b94" - integrity sha512-ra8IchO9odGQmYKbm+94K58UyKCEKdZh9y0vxhG4pIpOJOBlC1C+ZtBVr6jLs+/oJ4pl+1p/4t3JtBA8J10Vvw== - "@types/pngjs@^3.4.0": version "3.4.2" resolved "https://registry.yarnpkg.com/@types/pngjs/-/pngjs-3.4.2.tgz#8dc49b45fbcf18a5873179e3664f049388e39ecf" @@ -21252,10 +21247,10 @@ pdfmake@^0.1.65: pdfkit "^0.11.0" svg-to-pdfkit "^0.1.8" -pegjs@0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/pegjs/-/pegjs-0.10.0.tgz#cf8bafae6eddff4b5a7efb185269eaaf4610ddbd" - integrity sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0= +peggy@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/peggy/-/peggy-1.0.0.tgz#df6c7816c9df0ef35e071aaf96836cb866fe7eb4" + integrity sha512-lH12sxAXj4Aug+vH6IGoByIQOREIlhH+x4Uzb9kce6DD8wcGeidkC0JYEOwHormKrLt5BFLTbR4PuD/tiMOirQ== pegjs@~0.9.0: version "0.9.0"