sieving
Version:
Query-Based Item-List Reduction for JavaScript
1,809 lines (1,699 loc) • 75.5 kB
JavaScript
/*
** Sieving -- Query-Based Item-List Reduction
** Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
** "Software"), to deal in the Software without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Software, and to
** permit persons to whom the Software is furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Sieving = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";
/*
** Sieving -- Query-Based Item-List Reduction
** Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
** "Software"), to deal in the Software without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Software, and to
** permit persons to whom the Software is furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* external requirements */
const ASTY = require("asty-astq");
const PEGUtil = require("pegjs-util");
const chalk = require("chalk");
const objectHash = require("object-hash");
const minimatch = require("minimatch");
const dice = require("dice-coefficient");
const levenshtein = require("fast-levenshtein");
const Tokenizr = require("tokenizr");
/* pre-parse PEG grammar (replaced by browserify) */
const PEGparser = (// @generated by Peggy 4.0.2.
//
// https://peggyjs.org/
(function() {
"use strict";
function peg$subclass(child, parent) {
function C() { this.constructor = child; }
C.prototype = parent.prototype;
child.prototype = new C();
}
function peg$SyntaxError(message, expected, found, location) {
var self = Error.call(this, message);
// istanbul ignore next Check is a necessary evil to support older environments
if (Object.setPrototypeOf) {
Object.setPrototypeOf(self, peg$SyntaxError.prototype);
}
self.expected = expected;
self.found = found;
self.location = location;
self.name = "SyntaxError";
return self;
}
peg$subclass(peg$SyntaxError, Error);
function peg$padEnd(str, targetLength, padString) {
padString = padString || " ";
if (str.length > targetLength) { return str; }
targetLength -= str.length;
padString += padString.repeat(targetLength);
return str + padString.slice(0, targetLength);
}
peg$SyntaxError.prototype.format = function(sources) {
var str = "Error: " + this.message;
if (this.location) {
var src = null;
var k;
for (k = 0; k < sources.length; k++) {
if (sources[k].source === this.location.source) {
src = sources[k].text.split(/\r\n|\n|\r/g);
break;
}
}
var s = this.location.start;
var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
? this.location.source.offset(s)
: s;
var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
if (src) {
var e = this.location.end;
var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
var line = src[s.line - 1];
var last = s.line === e.line ? e.column : line.length + 1;
var hatLen = (last - s.column) || 1;
str += "\n --> " + loc + "\n"
+ filler + " |\n"
+ offset_s.line + " | " + line + "\n"
+ filler + " | " + peg$padEnd("", s.column - 1, ' ')
+ peg$padEnd("", hatLen, "^");
} else {
str += "\n at " + loc;
}
}
return str;
};
peg$SyntaxError.buildMessage = function(expected, found) {
var DESCRIBE_EXPECTATION_FNS = {
literal: function(expectation) {
return "\"" + literalEscape(expectation.text) + "\"";
},
class: function(expectation) {
var escapedParts = expectation.parts.map(function(part) {
return Array.isArray(part)
? classEscape(part[0]) + "-" + classEscape(part[1])
: classEscape(part);
});
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
},
any: function() {
return "any character";
},
end: function() {
return "end of input";
},
other: function(expectation) {
return expectation.description;
}
};
function hex(ch) {
return ch.charCodeAt(0).toString(16).toUpperCase();
}
function literalEscape(s) {
return s
.replace(/\\/g, "\\\\")
.replace(/"/g, "\\\"")
.replace(/\0/g, "\\0")
.replace(/\t/g, "\\t")
.replace(/\n/g, "\\n")
.replace(/\r/g, "\\r")
.replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
}
function classEscape(s) {
return s
.replace(/\\/g, "\\\\")
.replace(/\]/g, "\\]")
.replace(/\^/g, "\\^")
.replace(/-/g, "\\-")
.replace(/\0/g, "\\0")
.replace(/\t/g, "\\t")
.replace(/\n/g, "\\n")
.replace(/\r/g, "\\r")
.replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
}
function describeExpectation(expectation) {
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
}
function describeExpected(expected) {
var descriptions = expected.map(describeExpectation);
var i, j;
descriptions.sort();
if (descriptions.length > 0) {
for (i = 1, j = 1; i < descriptions.length; i++) {
if (descriptions[i - 1] !== descriptions[i]) {
descriptions[j] = descriptions[i];
j++;
}
}
descriptions.length = j;
}
switch (descriptions.length) {
case 1:
return descriptions[0];
case 2:
return descriptions[0] + " or " + descriptions[1];
default:
return descriptions.slice(0, -1).join(", ")
+ ", or "
+ descriptions[descriptions.length - 1];
}
}
function describeFound(found) {
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
}
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
};
function peg$parse(input, options) {
options = options !== undefined ? options : {};
var peg$FAILED = {};
var peg$source = options.grammarSource;
var peg$startRuleFunctions = { root: peg$parseroot };
var peg$startRuleFunction = peg$parseroot;
var peg$c0 = "(";
var peg$c1 = ")";
var peg$c2 = ",";
var peg$c3 = ":";
var peg$c4 = "^";
var peg$c5 = ".";
var peg$c6 = "/";
var peg$c7 = "\\/";
var peg$c8 = "\"";
var peg$c9 = "'";
var peg$c10 = "\\'";
var peg$c11 = "\\\\";
var peg$c12 = "\\\"";
var peg$c13 = "\\b";
var peg$c14 = "\\v";
var peg$c15 = "\\f";
var peg$c16 = "\\t";
var peg$c17 = "\\r";
var peg$c18 = "\\n";
var peg$c19 = "\\e";
var peg$c20 = "\\x";
var peg$c21 = "\\u";
var peg$r0 = /^[&=]/;
var peg$r1 = /^[+|]/;
var peg$r2 = /^[!\-]/;
var peg$r3 = /^[$#%@&]/;
var peg$r4 = /^[0-9]/;
var peg$r5 = /^[a-zA-Z]/;
var peg$r6 = /^[a-zA-Z0-9\-_]/;
var peg$r7 = /^[^\/]/;
var peg$r8 = /^[*?[\]{}\r\n\t\v\f (),\^+\-]/;
var peg$r9 = /^[*?[\]{}]/;
var peg$r10 = /^[\r\n\t\v\f (),\^+\-]/;
var peg$r11 = /^[^"]/;
var peg$r12 = /^[^']/;
var peg$r13 = /^[0-9a-fA-F]/;
var peg$r14 = /^[ \t\r\n]/;
var peg$e0 = peg$literalExpectation("(", false);
var peg$e1 = peg$literalExpectation(")", false);
var peg$e2 = peg$otherExpectation("outer union operation");
var peg$e3 = peg$literalExpectation(",", false);
var peg$e4 = peg$otherExpectation("intersection/union/subtraction operation");
var peg$e5 = peg$classExpectation(["&", "="], false, false);
var peg$e6 = peg$classExpectation(["+", "|"], false, false);
var peg$e7 = peg$classExpectation(["!", "-"], false, false);
var peg$e8 = peg$otherExpectation("namespace");
var peg$e9 = peg$classExpectation(["$", "#", "%", "@", "&"], false, false);
var peg$e10 = peg$literalExpectation(":", false);
var peg$e11 = peg$otherExpectation("boost");
var peg$e12 = peg$literalExpectation("^", false);
var peg$e13 = peg$otherExpectation("numeric literal");
var peg$e14 = peg$classExpectation([["0", "9"]], false, false);
var peg$e15 = peg$literalExpectation(".", false);
var peg$e16 = peg$otherExpectation("identifier");
var peg$e17 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false);
var peg$e18 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "-", "_"], false, false);
var peg$e19 = peg$otherExpectation("regular expression literal");
var peg$e20 = peg$literalExpectation("/", false);
var peg$e21 = peg$literalExpectation("\\/", false);
var peg$e22 = peg$classExpectation(["/"], true, false);
var peg$e23 = peg$otherExpectation("glob literal");
var peg$e24 = peg$classExpectation(["*", "?", "[", "]", "{", "}", "\r", "\n", "\t", "\v", "\f", " ", "(", ")", ",", "^", "+", "-"], false, false);
var peg$e25 = peg$anyExpectation();
var peg$e26 = peg$classExpectation(["*", "?", "[", "]", "{", "}"], false, false);
var peg$e27 = peg$classExpectation(["\r", "\n", "\t", "\v", "\f", " ", "(", ")", ",", "^", "+", "-"], false, false);
var peg$e28 = peg$otherExpectation("bareword literal");
var peg$e29 = peg$otherExpectation("single-quoted or double-quoted string literal");
var peg$e30 = peg$literalExpectation("\"", false);
var peg$e31 = peg$classExpectation(["\""], true, false);
var peg$e32 = peg$literalExpectation("'", false);
var peg$e33 = peg$literalExpectation("\\'", false);
var peg$e34 = peg$classExpectation(["'"], true, false);
var peg$e35 = peg$otherExpectation("escaped string character");
var peg$e36 = peg$literalExpectation("\\\\", false);
var peg$e37 = peg$literalExpectation("\\\"", false);
var peg$e38 = peg$literalExpectation("\\b", false);
var peg$e39 = peg$literalExpectation("\\v", false);
var peg$e40 = peg$literalExpectation("\\f", false);
var peg$e41 = peg$literalExpectation("\\t", false);
var peg$e42 = peg$literalExpectation("\\r", false);
var peg$e43 = peg$literalExpectation("\\n", false);
var peg$e44 = peg$literalExpectation("\\e", false);
var peg$e45 = peg$literalExpectation("\\x", false);
var peg$e46 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false);
var peg$e47 = peg$literalExpectation("\\u", false);
var peg$e48 = peg$otherExpectation("whitespaces");
var peg$e49 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false);
var peg$e50 = peg$otherExpectation("end of file");
var peg$f0 = function(q) {
return q
};
var peg$f1 = function(prolog, head, tail, epilog) {
let queries = head
for (const item of tail) {
let [ op, query ] = item
queries = op.add(queries, query)
}
if (prolog) queries.set("prolog", prolog + (queries.get("prolog") || ""))
if (epilog) queries.set("epilog", (queries.get("epilog") || "") + epilog)
return queries
};
var peg$f2 = function(prolog, query, epilog) {
if (prolog) query.set("prolog", prolog + (query.get("prolog") || ""))
if (epilog) query.set("epilog", (query.get("epilog") || "") + epilog)
return query
};
var peg$f3 = function(head, tail) {
let result = head
for (const item of tail) {
let [ ws, op, ws2, term ] = item
if (!op) {
let pos = term.pos()
op = ast("intersection").set({ text: "" })
.pos(pos.line, pos.column, pos.offset)
}
op.set({ prolog: ws.get("text") })
if (ws2)
op.set({ epilog: ws2.get("text") })
result = op.add(result, term)
}
return result
};
var peg$f4 = function(prolog, queries, epilog) {
return ast("group").set({ prolog: prolog, epilog: epilog }).add(queries)
};
var peg$f5 = function(ns, term, boost) {
let result = ast("term")
if (ns)
result.add(ns)
result.add(term)
if (boost)
result.add(boost)
return result
};
var peg$f6 = function() {
return ast("union").set({ text: text() })
};
var peg$f7 = function() {
return ast("intersection").set({ text: text() })
};
var peg$f8 = function() {
return ast("union").set({ text: text() })
};
var peg$f9 = function() {
return ast("subtraction").set({ text: text() })
};
var peg$f10 = function(ch) {
return ast("namespace").set({ text: text(), value: ch })
};
var peg$f11 = function(id) {
return ast("namespace").set({ text: text(), value: id.get("value") })
};
var peg$f12 = function(n) {
return ast("boost").set({ text: text(), value: n ? n.get("value") : 1 })
};
var peg$f13 = function(n) {
return ast("number").set({ text: text(), value: parseFloat(n) })
};
var peg$f14 = function(n) {
return ast("number").set({ text: text(), value: parseInt(n, 10) })
};
var peg$f15 = function(s) {
return ast("id").set({ text: text(), value: s })
};
var peg$f16 = function(re) {
var v
try { v = new RegExp(re.replace(/\\\//g, "/")) }
catch (e) { error(e.message) }
return ast("regexp").set({ text: text(), value: v })
};
var peg$f17 = function(s) {
return ast("glob").set({ text: text(), value: s })
};
var peg$f18 = function(s) {
return ast("bareword").set({ text: text(), value: s })
};
var peg$f19 = function(s) {
return ast("dquoted").set({ text: text(), value: s.join("") })
};
var peg$f20 = function(t) {
return ast("squoted").set({ text: text(), value: t.replace(/\\'/g, "'") })
};
var peg$f21 = function() { return "\\" };
var peg$f22 = function() { return "\"" };
var peg$f23 = function() { return "\b" };
var peg$f24 = function() { return "\x0B" };
var peg$f25 = function() { return "\f" };
var peg$f26 = function() { return "\t" };
var peg$f27 = function() { return "\r" };
var peg$f28 = function() { return "\n" };
var peg$f29 = function() { return "\x1B" };
var peg$f30 = function(n) {
return String.fromCharCode(parseInt(n, 16))
};
var peg$f31 = function(n) {
return String.fromCharCode(parseInt(n, 16))
};
var peg$f32 = function() {
return ast("ws").set({ text: text() })
};
var peg$currPos = options.peg$currPos | 0;
var peg$savedPos = peg$currPos;
var peg$posDetailsCache = [{ line: 1, column: 1 }];
var peg$maxFailPos = peg$currPos;
var peg$maxFailExpected = options.peg$maxFailExpected || [];
var peg$silentFails = options.peg$silentFails | 0;
var peg$result;
if (options.startRule) {
if (!(options.startRule in peg$startRuleFunctions)) {
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
}
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
}
function text() {
return input.substring(peg$savedPos, peg$currPos);
}
function offset() {
return peg$savedPos;
}
function range() {
return {
source: peg$source,
start: peg$savedPos,
end: peg$currPos
};
}
function location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function expected(description, location) {
location = location !== undefined
? location
: peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildStructuredError(
[peg$otherExpectation(description)],
input.substring(peg$savedPos, peg$currPos),
location
);
}
function error(message, location) {
location = location !== undefined
? location
: peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildSimpleError(message, location);
}
function peg$literalExpectation(text, ignoreCase) {
return { type: "literal", text: text, ignoreCase: ignoreCase };
}
function peg$classExpectation(parts, inverted, ignoreCase) {
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
}
function peg$anyExpectation() {
return { type: "any" };
}
function peg$endExpectation() {
return { type: "end" };
}
function peg$otherExpectation(description) {
return { type: "other", description: description };
}
function peg$computePosDetails(pos) {
var details = peg$posDetailsCache[pos];
var p;
if (details) {
return details;
} else {
if (pos >= peg$posDetailsCache.length) {
p = peg$posDetailsCache.length - 1;
} else {
p = pos;
while (!peg$posDetailsCache[--p]) {}
}
details = peg$posDetailsCache[p];
details = {
line: details.line,
column: details.column
};
while (p < pos) {
if (input.charCodeAt(p) === 10) {
details.line++;
details.column = 1;
} else {
details.column++;
}
p++;
}
peg$posDetailsCache[pos] = details;
return details;
}
}
function peg$computeLocation(startPos, endPos, offset) {
var startPosDetails = peg$computePosDetails(startPos);
var endPosDetails = peg$computePosDetails(endPos);
var res = {
source: peg$source,
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
};
if (offset && peg$source && (typeof peg$source.offset === "function")) {
res.start = peg$source.offset(res.start);
res.end = peg$source.offset(res.end);
}
return res;
}
function peg$fail(expected) {
if (peg$currPos < peg$maxFailPos) { return; }
if (peg$currPos > peg$maxFailPos) {
peg$maxFailPos = peg$currPos;
peg$maxFailExpected = [];
}
peg$maxFailExpected.push(expected);
}
function peg$buildSimpleError(message, location) {
return new peg$SyntaxError(message, null, null, location);
}
function peg$buildStructuredError(expected, found, location) {
return new peg$SyntaxError(
peg$SyntaxError.buildMessage(expected, found),
expected,
found,
location
);
}
function peg$parseroot() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parsequeries();
if (s1 !== peg$FAILED) {
s2 = peg$parseeof();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f0(s1);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsequeries() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parsews();
if (s1 === peg$FAILED) {
s1 = null;
}
s2 = peg$parsequery();
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$currPos;
s5 = peg$parseouterUnionOperation();
if (s5 !== peg$FAILED) {
s6 = peg$parsequery();
if (s6 !== peg$FAILED) {
s5 = [s5, s6];
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$currPos;
s5 = peg$parseouterUnionOperation();
if (s5 !== peg$FAILED) {
s6 = peg$parsequery();
if (s6 !== peg$FAILED) {
s5 = [s5, s6];
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
}
} else {
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s4 = peg$parsews();
if (s4 === peg$FAILED) {
s4 = null;
}
peg$savedPos = s0;
s0 = peg$f1(s1, s2, s3, s4);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsews();
if (s1 === peg$FAILED) {
s1 = null;
}
s2 = peg$parsequery();
if (s2 !== peg$FAILED) {
s3 = peg$parsews();
if (s3 === peg$FAILED) {
s3 = null;
}
peg$savedPos = s0;
s0 = peg$f2(s1, s2, s3);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parsequery() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseterm();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parsews();
if (s4 !== peg$FAILED) {
s5 = peg$parseoperation();
if (s5 === peg$FAILED) {
s5 = null;
}
s6 = peg$parsews();
if (s6 === peg$FAILED) {
s6 = null;
}
s7 = peg$parseterm();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parsews();
if (s4 !== peg$FAILED) {
s5 = peg$parseoperation();
if (s5 === peg$FAILED) {
s5 = null;
}
s6 = peg$parsews();
if (s6 === peg$FAILED) {
s6 = null;
}
s7 = peg$parseterm();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f3(s1, s2);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parseterm();
}
return s0;
}
function peg$parseterm() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 40) {
s1 = peg$c0;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e0); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsequeries();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s3 = peg$c1;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e1); }
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f4(s1, s2, s3);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsenamespace();
if (s1 === peg$FAILED) {
s1 = null;
}
s2 = peg$parseregexp();
if (s2 === peg$FAILED) {
s2 = peg$parseglob();
if (s2 === peg$FAILED) {
s2 = peg$parsequoted();
if (s2 === peg$FAILED) {
s2 = peg$parsebareword();
}
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parseboost();
if (s3 === peg$FAILED) {
s3 = null;
}
peg$savedPos = s0;
s0 = peg$f5(s1, s2, s3);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseouterUnionOperation() {
var s0, s1, s2, s3;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parsews();
if (s1 === peg$FAILED) {
s1 = null;
}
if (input.charCodeAt(peg$currPos) === 44) {
s2 = peg$c2;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e3); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parsews();
if (s3 === peg$FAILED) {
s3 = null;
}
peg$savedPos = s0;
s0 = peg$f6();
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e2); }
}
return s0;
}
function peg$parseoperation() {
var s0, s1;
peg$silentFails++;
s0 = peg$currPos;
s1 = input.charAt(peg$currPos);
if (peg$r0.test(s1)) {
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e5); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f7();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = input.charAt(peg$currPos);
if (peg$r1.test(s1)) {
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e6); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f8();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = input.charAt(peg$currPos);
if (peg$r2.test(s1)) {
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e7); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f9();
}
s0 = s1;
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e4); }
}
return s0;
}
function peg$parsenamespace() {
var s0, s1, s2;
peg$silentFails++;
s0 = peg$currPos;
s1 = input.charAt(peg$currPos);
if (peg$r3.test(s1)) {
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e9); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f10(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseid();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s2 = peg$c3;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e10); }
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f11(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$e8); }
}
return s0;
}
function peg$parseboost() {
var s0, s1, s2;
peg$silentFails++;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 94) {
s1 = peg$c4;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e12); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsenumber();
if (s2 === peg$FAILED) {
s2 = null;
}
peg$savedPos = s0;
s0 = peg$f12(s2);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e11); }
}
return s0;
}
function peg$parsenumber() {
var s0, s1, s2, s3, s4, s5, s6;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$currPos;
s3 = [];
s4 = input.charAt(peg$currPos);
if (peg$r4.test(s4)) {
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e14); }
}
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = input.charAt(peg$currPos);
if (peg$r4.test(s4)) {
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e14); }
}
}
if (input.charCodeAt(peg$currPos) === 46) {
s4 = peg$c5;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e15); }
}
if (s4 !== peg$FAILED) {
s5 = [];
s6 = input.charAt(peg$currPos);
if (peg$r4.test(s6)) {
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e14); }
}
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = input.charAt(peg$currPos);
if (peg$r4.test(s6)) {
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e14); }
}
}
} else {
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
s3 = [s3, s4, s5];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s1 = input.substring(s1, peg$currPos);
} else {
s1 = s2;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f13(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$currPos;
s2 = [];
s3 = input.charAt(peg$currPos);
if (peg$r4.test(s3)) {
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e14); }
}
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = input.charAt(peg$currPos);
if (peg$r4.test(s3)) {
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e14); }
}
}
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s1 = input.substring(s1, peg$currPos);
} else {
s1 = s2;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f14(s1);
}
s0 = s1;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e13); }
}
return s0;
}
function peg$parseid() {
var s0, s1, s2, s3, s4, s5;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$currPos;
s3 = input.charAt(peg$currPos);
if (peg$r5.test(s3)) {
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e17); }
}
if (s3 !== peg$FAILED) {
s4 = [];
s5 = input.charAt(peg$currPos);
if (peg$r6.test(s5)) {
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e18); }
}
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = input.charAt(peg$currPos);
if (peg$r6.test(s5)) {
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e18); }
}
}
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s1 = input.substring(s1, peg$currPos);
} else {
s1 = s2;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f15(s1);
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e16); }
}
return s0;
}
function peg$parseregexp() {
var s0, s1, s2, s3, s4;
peg$silentFails++;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 47) {
s1 = peg$c6;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e20); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = [];
if (input.substr(peg$currPos, 2) === peg$c7) {
s4 = peg$c7;
peg$currPos += 2;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e21); }
}
if (s4 === peg$FAILED) {
s4 = input.charAt(peg$currPos);
if (peg$r7.test(s4)) {
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e22); }
}
}
while (s4 !== peg$FAILED) {
s3.push(s4);
if (input.substr(peg$currPos, 2) === peg$c7) {
s4 = peg$c7;
peg$currPos += 2;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e21); }
}
if (s4 === peg$FAILED) {
s4 = input.charAt(peg$currPos);
if (peg$r7.test(s4)) {
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e22); }
}
}
}
s2 = input.substring(s2, peg$currPos);
if (input.charCodeAt(peg$currPos) === 47) {
s3 = peg$c6;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e20); }
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f16(s2);
} 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$e19); }
}
return s0;
}
function peg$parseglob() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$currPos;
s3 = [];
s4 = peg$currPos;
s5 = peg$currPos;
peg$silentFails++;
s6 = input.charAt(peg$currPos);
if (peg$r8.test(s6)) {
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e24); }
}
peg$silentFails--;
if (s6 === peg$FAILED) {
s5 = undefined;
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
if (input.length > peg$currPos) {
s6 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e25); }
}
if (s6 !== peg$FAILED) {
s5 = [s5, s6];
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$currPos;
s5 = peg$currPos;
peg$silentFails++;
s6 = input.charAt(peg$currPos);
if (peg$r8.test(s6)) {
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e24); }
}
peg$silentFails--;
if (s6 === peg$FAILED) {
s5 = undefined;
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
if (input.length > peg$currPos) {
s6 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e25); }
}
if (s6 !== peg$FAILED) {
s5 = [s5, s6];
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
}
s4 = input.charAt(peg$currPos);
if (peg$r9.test(s4)) {
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e26); }
}
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$currPos;
s7 = peg$currPos;
peg$silentFails++;
s8 = input.charAt(peg$currPos);
if (peg$r10.test(s8)) {
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e27); }
}
peg$silentFails--;
if (s8 === peg$FAILED) {
s7 = undefined;
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
if (s7 !== peg$FAILED) {
if (input.length > peg$currPos) {
s8 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e25); }
}
if (s8 !== peg$FAILED) {
s7 = [s7, s8];
s6 = s7;
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$currPos;
s7 = peg$currPos;
peg$silentFails++;
s8 = input.charAt(peg$currPos);
if (peg$r10.test(s8)) {
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e27); }
}
peg$silentFails--;
if (s8 === peg$FAILED) {
s7 = undefined;
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
if (s7 !== peg$FAILED) {
if (input.length > peg$currPos) {
s8 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e25); }
}
if (s8 !== peg$FAILED) {
s7 = [s7, s8];
s6 = s7;
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
}
s3 = [s3, s4, s5];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s1 = input.substring(s1, peg$currPos);
} else {
s1 = s2;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f17(s1);
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e23); }
}
return s0;
}
function peg$parsebareword() {
var s0, s1, s2, s3, s4, s5;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = [];
s3 = peg$currPos;
s4 = peg$currPos;
peg$silentFails++;
s5 = input.charAt(peg$currPos);
if (peg$r10.test(s5)) {
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e27); }
}
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = undefined;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
if (input.length > peg$currPos) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e25); }
}
if (s5 !== peg$FAILED) {
s4 = [s4, 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$currPos;
peg$silentFails++;
s5 = input.charAt(peg$currPos);
if (peg$r10.test(s5)) {
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e27); }
}
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = undefined;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
if (input.length > peg$currPos) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e25); }
}
if (s5 !== peg$FAILED) {
s4 = [s4, 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) {
s1 = input.substring(s1, peg$currPos);
} else {
s1 = s2;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f18(s1);
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e28); }
}
return s0;
}
function peg$parsequoted() {
var s0, s1, s2, s3, s4;
peg$silentFails++;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 34) {
s1 = peg$c8;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e30); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsestringEscapedChar();
if (s3 === peg$FAILED) {
s3 = input.charAt(peg$currPos);
if (peg$r11.test(s3)) {
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e31); }
}
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsestringEscapedChar();
if (s3 === peg$FAILED) {
s3 = input.charAt(peg$currPos);
if (peg$r11.test(s3)) {
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e31); }
}
}
}
if (input.charCodeAt(peg$currPos) === 34) {
s3 = peg$c8;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e30); }
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f19(s2);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 39) {
s1 = peg$c9;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e32); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = [];
if (input.substr(peg$currPos, 2) === peg$c10) {
s4 = peg$c10;
peg$currPos += 2;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e33); }
}
if (s4 === peg$FAILED) {
s4 = input.charAt(peg$currPos);
if (peg$r12.test(s4)) {
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e34); }
}
}
while (s4 !== peg$FAILED) {
s3.push(s4);
if (input.substr(peg$currPos, 2) === peg$c10) {
s4 = peg$c10;
peg$currPos += 2;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e33); }
}
if (s4 === peg$FAILED) {
s4 = input.charAt(peg$currPos);
if (peg$r12.test(s4)) {
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e34); }
}
}
}
s2 = input.substring(s2, peg$currPos);
if (input.charCodeAt(peg$currPos) === 39) {
s3 = peg$c9;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e32); }
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f20(s2);
} 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$e29); }
}
return s0;
}
function peg$parsestringEscapedChar() {
var s0, s1, s2, s3, s4, s5, s6, s7;
peg$silentFails++;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c11) {
s1 = peg$c11;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e36); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f21();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c12) {
s1 = peg$c12;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e37); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f22();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c13) {
s1 = peg$c13;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e38); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f23();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c14) {
s1 = peg$c14;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e39); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f24();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c15) {
s1 = peg$c15;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e40); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f25();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c16) {
s1 = peg$c16;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e41); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f26();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c17) {