apigeelint
Version:
Node module and tool to lint a bundle for an Apigee API Proxy or sharedflow.
1,535 lines (1,456 loc) • 113 kB
JavaScript
// @generated by Peggy 5.0.6.
//
// https://peggyjs.org/
"use strict";
function stringOp(op) {
return ["EqualsCaseInsensitive","StartsWith","Equals", "NotEquals", "JavaRegex","MatchesPath","Matches"].includes(op);
}
function numericOp(op) {
return ["Equals", "NotEquals", "GreaterThanOrEquals","GreaterThan","LesserThanOrEquals","LesserThan"].includes(op);
}
function parseBinaryOp(t1,op1,v1,error) {
let isStringOp = stringOp(op1),
isNumericOp = numericOp(op1),
vType = Object.prototype.toString.call(v1),
v = (vType=== '[object Array]' ) ? v1.join("") : v1;
if (vType==='[object Number]' && !isNumericOp) {
error("not expecting number on RHS");
}
if (vType!=='[object Number]' && !isStringOp) {
error("expecting number on RHS");
}
return { operator:op1, operands:[t1, v]};
}
class peg$SyntaxError extends SyntaxError {
constructor(message, expected, found, location) {
super(message);
this.expected = expected;
this.found = found;
this.location = location;
this.name = "SyntaxError";
}
format(sources) {
let str = "Error: " + this.message;
if (this.location) {
let src = null;
const st = sources.find(s => s.source === this.location.source);
if (st) {
src = st.text.split(/\r\n|\n|\r/g);
}
const s = this.location.start;
const offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
? this.location.source.offset(s)
: s;
const loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
if (src) {
const e = this.location.end;
const filler = "".padEnd(offset_s.line.toString().length, " ");
const line = src[s.line - 1];
const last = s.line === e.line ? e.column : line.length + 1;
const hatLen = (last - s.column) || 1;
str += "\n --> " + loc + "\n"
+ filler + " |\n"
+ offset_s.line + " | " + line + "\n"
+ filler + " | " + "".padEnd(s.column - 1, " ")
+ "".padEnd(hatLen, "^");
} else {
str += "\n at " + loc;
}
}
return str;
}
static buildMessage(expected, found) {
function hex(ch) {
return ch.codePointAt(0).toString(16).toUpperCase();
}
const nonPrintable = Object.prototype.hasOwnProperty.call(RegExp.prototype, "unicode")
? new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]", "gu")
: null;
function unicodeEscape(s) {
if (nonPrintable) {
return s.replace(nonPrintable, ch => "\\u{" + hex(ch) + "}");
}
return s;
}
function literalEscape(s) {
return unicodeEscape(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, ch => "\\x0" + hex(ch))
.replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
}
function classEscape(s) {
return unicodeEscape(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, ch => "\\x0" + hex(ch))
.replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
}
const DESCRIBE_EXPECTATION_FNS = {
literal(expectation) {
return "\"" + literalEscape(expectation.text) + "\"";
},
class(expectation) {
const escapedParts = expectation.parts.map(
part => (Array.isArray(part)
? classEscape(part[0]) + "-" + classEscape(part[1])
: classEscape(part))
);
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]" + (expectation.unicode ? "u" : "");
},
any() {
return "any character";
},
end() {
return "end of input";
},
other(expectation) {
return expectation.description;
},
};
function describeExpectation(expectation) {
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
}
function describeExpected(expected) {
const descriptions = expected.map(describeExpectation);
descriptions.sort();
if (descriptions.length > 0) {
let j = 1;
for (let i = 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 : {};
const peg$FAILED = {};
const peg$source = options.grammarSource;
const peg$startRuleFunctions = {
start: peg$parsestart,
};
let peg$startRuleFunction = peg$parsestart;
const peg$c0 = "(";
const peg$c1 = ")";
const peg$c2 = "and";
const peg$c3 = "&&";
const peg$c4 = "not";
const peg$c5 = "!";
const peg$c6 = "or";
const peg$c7 = "||";
const peg$c8 = "==";
const peg$c9 = "=";
const peg$c10 = "equals";
const peg$c11 = "is";
const peg$c12 = "!=";
const peg$c13 = "notequals";
const peg$c14 = "isnot";
const peg$c15 = ":=";
const peg$c16 = "equalscaseinsensitive";
const peg$c17 = ">";
const peg$c18 = "greaterthan";
const peg$c19 = ">=";
const peg$c20 = "greaterthanorequals";
const peg$c21 = "<";
const peg$c22 = "lesserthan";
const peg$c23 = "<=";
const peg$c24 = "lesserthanorequals";
const peg$c25 = "~~";
const peg$c26 = "javaregex";
const peg$c27 = "~";
const peg$c28 = "matches";
const peg$c29 = "like";
const peg$c30 = "~/";
const peg$c31 = "matchespath";
const peg$c32 = "likepath";
const peg$c33 = "=|";
const peg$c34 = "startswith";
const peg$c35 = "-";
const peg$c36 = ".";
const peg$c37 = "0";
const peg$c38 = "\"";
const peg$c39 = "null";
const peg$c40 = "false";
const peg$c41 = "true";
const peg$r0 = /^[0-9]/;
const peg$r1 = /^[1-9]/;
const peg$r2 = /^[a-zA-Z]/;
const peg$r3 = /^[\-a-zA-Z0-9_.]/;
const peg$r4 = /^[^"]/;
const peg$r5 = /^[ \t\n\r]/;
const peg$e0 = peg$literalExpectation("(", false);
const peg$e1 = peg$literalExpectation(")", false);
const peg$e2 = peg$literalExpectation("and", true);
const peg$e3 = peg$literalExpectation("&&", false);
const peg$e4 = peg$literalExpectation("not", true);
const peg$e5 = peg$literalExpectation("!", false);
const peg$e6 = peg$literalExpectation("or", true);
const peg$e7 = peg$literalExpectation("||", false);
const peg$e8 = peg$literalExpectation("==", false);
const peg$e9 = peg$literalExpectation("=", false);
const peg$e10 = peg$literalExpectation("Equals", true);
const peg$e11 = peg$literalExpectation("Is", true);
const peg$e12 = peg$literalExpectation("!=", false);
const peg$e13 = peg$literalExpectation("NotEquals", true);
const peg$e14 = peg$literalExpectation("IsNot", true);
const peg$e15 = peg$literalExpectation(":=", false);
const peg$e16 = peg$literalExpectation("EqualsCaseInsensitive", true);
const peg$e17 = peg$literalExpectation(">", false);
const peg$e18 = peg$literalExpectation("GreaterThan", true);
const peg$e19 = peg$literalExpectation(">=", false);
const peg$e20 = peg$literalExpectation("GreaterThanOrEquals", true);
const peg$e21 = peg$literalExpectation("<", false);
const peg$e22 = peg$literalExpectation("LesserThan", true);
const peg$e23 = peg$literalExpectation("<=", false);
const peg$e24 = peg$literalExpectation("LesserThanOrEquals", true);
const peg$e25 = peg$literalExpectation("~~", false);
const peg$e26 = peg$literalExpectation("JavaRegex", true);
const peg$e27 = peg$literalExpectation("~", false);
const peg$e28 = peg$literalExpectation("Matches", true);
const peg$e29 = peg$literalExpectation("Like", true);
const peg$e30 = peg$literalExpectation("~/", false);
const peg$e31 = peg$literalExpectation("MatchesPath", true);
const peg$e32 = peg$literalExpectation("LikePath", true);
const peg$e33 = peg$literalExpectation("=|", false);
const peg$e34 = peg$literalExpectation("StartsWith", true);
const peg$e35 = peg$literalExpectation("-", false);
const peg$e36 = peg$literalExpectation(".", false);
const peg$e37 = peg$literalExpectation("0", false);
const peg$e38 = peg$classExpectation([["0", "9"]], false, false, false);
const peg$e39 = peg$classExpectation([["1", "9"]], false, false, false);
const peg$e40 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false, false);
const peg$e41 = peg$classExpectation(["-", ["a", "z"], ["A", "Z"], ["0", "9"], "_", "."], false, false, false);
const peg$e42 = peg$classExpectation(["\""], true, false, false);
const peg$e43 = peg$literalExpectation("\"", false);
const peg$e44 = peg$literalExpectation("null", false);
const peg$e45 = peg$literalExpectation("false", false);
const peg$e46 = peg$literalExpectation("true", false);
const peg$e47 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false, false);
function peg$f0(left, op1, right) { return {operator:op1, operands:[left, right] } }
function peg$f1(left, op1, right) { return {operator:op1, operands:[left,right]} }
function peg$f2(operand) { return {operator:"NOT", operands:[operand] } }
function peg$f3(t1, op1, v1) {
return parseBinaryOp(t1,op1,v1,error);
}
function peg$f4(t1, op1, v1) {
let operand = parseBinaryOp(t1,op1,v1,error);
return {operator:"NOT", operands:[operand] };
}
function peg$f5(t1, op1, v1) {
return parseBinaryOp(t1,op1,v1,error);
}
function peg$f6(t1, op1, v1) {
let operand = parseBinaryOp(t1,op1,v1,error);
return {operator:"NOT", operands:[operand] };
}
function peg$f7(t1, op1, v1) {
return parseBinaryOp(t1,op1,v1,error);
}
function peg$f8(t1, op1, v1) {
let operand = parseBinaryOp(t1,op1,v1,error);
return {operator:"NOT", operands:[operand] };
}
function peg$f9(t1, op1, v1) {
return parseBinaryOp(t1,op1,v1,error);
}
function peg$f10(t1, op1, v1) {
let operand = parseBinaryOp(t1,op1,v1,error);
return {operator:"NOT", operands:[operand] };
}
function peg$f11(t1, op1, t2) {
return { operator:op1, operands:[t1, t2]};
}
function peg$f12(t1, op1, t2) {
let operand = { operator:op1, operands:[t1, t2]};
return {operator:"NOT", operands:[operand] };
}
function peg$f13(t1, op1, t2) {
return { operator:op1, operands:[t1, t2]};
}
function peg$f14(t1, op1, t2) {
let operand = { operator:op1, operands:[t1, t2]};
return {operator:"NOT", operands:[operand] };
}
function peg$f15(t1, op1, t2) {
return { operator:op1, operands:[t1, t2]};
}
function peg$f16(t1, op1, t2) {
let operand = { operator:op1, operands:[t1, t2]};
return {operator:"NOT", operands:[operand] };
}
function peg$f17(t1, op1, t2) {
return { operator:op1, operands:[t1, t2]};
}
function peg$f18(t1, op1, t2) {
let operand = { operator:op1, operands:[t1, t2]};
return {operator:"NOT", operands:[operand] };
}
function peg$f19(token1) { return token1; }
function peg$f20(token1) { return token1; }
function peg$f21(stmt1) { return stmt1; }
function peg$f22() {return "AND"; }
function peg$f23() {return "OR"; }
function peg$f24() { return "EqualsCaseInsensitive"; }
function peg$f25() {return "StartsWith"; }
function peg$f26() { return "NotEquals"; }
function peg$f27() { return "Equals"; }
function peg$f28() {return "GreaterThanOrEquals"; }
function peg$f29() {return "GreaterThan"; }
function peg$f30() {return "LesserThanOrEquals"; }
function peg$f31() {return "LesserThan"; }
function peg$f32() {return "JavaRegex"; }
function peg$f33() {return "MatchesPath"; }
function peg$f34() {return "Matches"; }
function peg$f35() {return "StartsWith"; }
function peg$f36() {return "JavaRegex"; }
function peg$f37() {return "MatchesPath"; }
function peg$f38() {return "Matches"; }
function peg$f39() { return "EqualsCaseInsensitive"; }
function peg$f40() {return "StartsWith"; }
function peg$f41() { return "NotEquals"; }
function peg$f42() { return "Equals"; }
function peg$f43() {return "GreaterThanOrEquals"; }
function peg$f44() {return "GreaterThan"; }
function peg$f45() {return "LesserThanOrEquals"; }
function peg$f46() {return "LesserThan"; }
function peg$f47() {return "JavaRegex"; }
function peg$f48() {return "MatchesPath"; }
function peg$f49() {return "Matches"; }
function peg$f50() {return "StartsWith"; }
function peg$f51() {return "JavaRegex"; }
function peg$f52() {return "MatchesPath"; }
function peg$f53() {return "Matches"; }
function peg$f54() {return "StartsWith"; }
function peg$f55() { return "NotEquals"; }
function peg$f56() { return "Equals"; }
function peg$f57() {return "GreaterThanOrEquals"; }
function peg$f58() {return "GreaterThan"; }
function peg$f59() {return "LesserThanOrEquals"; }
function peg$f60() {return "LesserThan"; }
function peg$f61() {return "StartsWith"; }
function peg$f62() {return "StartsWith"; }
function peg$f63() { return "NotEquals"; }
function peg$f64() { return "Equals"; }
function peg$f65() {return "GreaterThanOrEquals"; }
function peg$f66() {return "GreaterThan"; }
function peg$f67() {return "LesserThanOrEquals"; }
function peg$f68() {return "LesserThan"; }
function peg$f69() {return "StartsWith"; }
function peg$f70() {
return { type: "Literal", value: parseFloat(text()) };
}
function peg$f71() {
return { type: "Literal", value: parseFloat(text()) };
}
function peg$f72() {
return { type: "Literal", value: parseInt(text()) };
}
function peg$f73() { return text(); }
function peg$f74(value) { value.unshift("'"); value.push("'"); return value; }
function peg$f75() { return null; }
function peg$f76() { return false; }
function peg$f77() { return true; }
function peg$f78(value) { return value.value; }
let peg$currPos = options.peg$currPos | 0;
let peg$savedPos = peg$currPos;
const peg$posDetailsCache = [{ line: 1, column: 1 }];
let peg$maxFailPos = peg$currPos;
let peg$maxFailExpected = options.peg$maxFailExpected || [];
let peg$silentFails = options.peg$silentFails | 0;
let 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$getUnicode(pos = peg$currPos) {
const cp = input.codePointAt(pos);
if (cp === undefined) {
return "";
}
return String.fromCodePoint(cp);
}
function peg$literalExpectation(text, ignoreCase) {
return { type: "literal", text, ignoreCase };
}
function peg$classExpectation(parts, inverted, ignoreCase, unicode) {
return { type: "class", parts, inverted, ignoreCase, unicode };
}
function peg$anyExpectation() {
return { type: "any" };
}
function peg$endExpectation() {
return { type: "end" };
}
function peg$otherExpectation(description) {
return { type: "other", description };
}
function peg$computePosDetails(pos) {
let details = peg$posDetailsCache[pos];
let 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) {
const startPosDetails = peg$computePosDetails(startPos);
const endPosDetails = peg$computePosDetails(endPos);
const res = {
source: peg$source,
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column,
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column,
},
};
if (offset && peg$source && (typeof peg$source.offset === "function")) {
res.start = peg$source.offset(res.start);
res.end = peg$source.offset(res.end);
}
return res;
}
function peg$fail(expected) {
if (peg$currPos < peg$maxFailPos) { return; }
if (peg$currPos > peg$maxFailPos) {
peg$maxFailPos = peg$currPos;
peg$maxFailExpected = [];
}
peg$maxFailExpected.push(expected);
}
function peg$buildSimpleError(message, location) {
return new peg$SyntaxError(message, null, null, location);
}
function peg$buildStructuredError(expected, found, location) {
return new peg$SyntaxError(
peg$SyntaxError.buildMessage(expected, found),
expected,
found,
location
);
}
function peg$parsestart() {
let s0;
s0 = peg$parseboolean_stmt1();
return s0;
}
function peg$parseboolean_stmt1() {
let s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseboolean_stmt2();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsews();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsews();
}
s3 = peg$parseop_boolean();
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parsews();
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parsews();
}
s5 = peg$parseboolean_stmt1();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f0(s1, s3, s5);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parseboolean_stmt2();
}
return s0;
}
function peg$parseboolean_stmt2() {
let s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parsefactor();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsews();
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsews();
}
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = peg$parseop_boolean();
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parsews();
if (s5 !== peg$FAILED) {
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parsews();
}
} else {
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
s5 = peg$parseboolean_stmt2();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f1(s1, s3, s5);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parsefactor();
}
return s0;
}
function peg$parsefactor() {
let s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseop_not();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsews();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsews();
}
s3 = peg$parsefactor();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f2(s3);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parseprimary();
}
return s0;
}
function peg$parseprimary() {
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
s0 = peg$currPos;
s1 = [];
s2 = peg$parsews();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 40) {
s2 = peg$c0;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e0); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
s4 = peg$parsetoken();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parsews();
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
} else {
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
s6 = peg$parseop_accepts_literal();
if (s6 !== peg$FAILED) {
s7 = [];
s8 = peg$parsews();
if (s8 !== peg$FAILED) {
while (s8 !== peg$FAILED) {
s7.push(s8);
s8 = peg$parsews();
}
} else {
s7 = peg$FAILED;
}
if (s7 !== peg$FAILED) {
s8 = peg$parsevalue();
if (s8 !== peg$FAILED) {
s9 = [];
s10 = peg$parsews();
while (s10 !== peg$FAILED) {
s9.push(s10);
s10 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 41) {
s10 = peg$c1;
peg$currPos++;
} else {
s10 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e1); }
}
if (s10 !== peg$FAILED) {
s11 = [];
s12 = peg$parsews();
while (s12 !== peg$FAILED) {
s11.push(s12);
s12 = peg$parsews();
}
peg$savedPos = s0;
s0 = peg$f3(s4, s6, s8);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} 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 = [];
s2 = peg$parsews();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 40) {
s2 = peg$c0;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e0); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
s4 = peg$parsetoken();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parsews();
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
} else {
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
s6 = peg$parseop_not();
if (s6 !== peg$FAILED) {
s7 = [];
s8 = peg$parsews();
if (s8 !== peg$FAILED) {
while (s8 !== peg$FAILED) {
s7.push(s8);
s8 = peg$parsews();
}
} else {
s7 = peg$FAILED;
}
if (s7 !== peg$FAILED) {
s8 = peg$parseop_accepts_literal_and_negation();
if (s8 !== peg$FAILED) {
s9 = [];
s10 = peg$parsews();
if (s10 !== peg$FAILED) {
while (s10 !== peg$FAILED) {
s9.push(s10);
s10 = peg$parsews();
}
} else {
s9 = peg$FAILED;
}
if (s9 !== peg$FAILED) {
s10 = peg$parsevalue();
if (s10 !== peg$FAILED) {
s11 = [];
s12 = peg$parsews();
while (s12 !== peg$FAILED) {
s11.push(s12);
s12 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 41) {
s12 = peg$c1;
peg$currPos++;
} else {
s12 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e1); }
}
if (s12 !== peg$FAILED) {
s13 = [];
s14 = peg$parsews();
while (s14 !== peg$FAILED) {
s13.push(s14);
s14 = peg$parsews();
}
peg$savedPos = s0;
s0 = peg$f4(s4, s8, s10);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} 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 = [];
s2 = peg$parsews();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 40) {
s2 = peg$c0;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e0); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
s4 = peg$parsetoken();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parsews();
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
s6 = peg$parseop_accepts_literal_sym();
if (s6 !== peg$FAILED) {
s7 = [];
s8 = peg$parsews();
while (s8 !== peg$FAILED) {
s7.push(s8);
s8 = peg$parsews();
}
s8 = peg$parsevalue();
if (s8 !== peg$FAILED) {
s9 = [];
s10 = peg$parsews();
while (s10 !== peg$FAILED) {
s9.push(s10);
s10 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 41) {
s10 = peg$c1;
peg$currPos++;
} else {
s10 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e1); }
}
if (s10 !== peg$FAILED) {
s11 = [];
s12 = peg$parsews();
while (s12 !== peg$FAILED) {
s11.push(s12);
s12 = peg$parsews();
}
peg$savedPos = s0;
s0 = peg$f5(s4, s6, s8);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = [];
s2 = peg$parsews();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 40) {
s2 = peg$c0;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e0); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
s4 = peg$parsetoken();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parsews();
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
} else {
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
s6 = peg$parseop_not();
if (s6 !== peg$FAILED) {
s7 = [];
s8 = peg$parsews();
if (s8 !== peg$FAILED) {
while (s8 !== peg$FAILED) {
s7.push(s8);
s8 = peg$parsews();
}
} else {
s7 = peg$FAILED;
}
if (s7 !== peg$FAILED) {
s8 = peg$parseop_accepts_literal_and_negation_sym();
if (s8 !== peg$FAILED) {
s9 = [];
s10 = peg$parsews();
while (s10 !== peg$FAILED) {
s9.push(s10);
s10 = peg$parsews();
}
s10 = peg$parsevalue();
if (s10 !== peg$FAILED) {
s11 = [];
s12 = peg$parsews();
while (s12 !== peg$FAILED) {
s11.push(s12);
s12 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 41) {
s12 = peg$c1;
peg$currPos++;
} else {
s12 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e1); }
}
if (s12 !== peg$FAILED) {
s13 = [];
s14 = peg$parsews();
while (s14 !== peg$FAILED) {
s13.push(s14);
s14 = peg$parsews();
}
peg$savedPos = s0;
s0 = peg$f6(s4, s8, s10);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = [];
s2 = peg$parsews();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsews();
}
s2 = peg$parsetoken();
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
} else {
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseop_accepts_literal();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parsews();
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
} else {
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
s6 = peg$parsevalue();
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f7(s2, s4, s6);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = [];
s2 = peg$parsews();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsews();
}
s2 = peg$parsetoken();
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
} else {
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseop_not();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parsews();
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
} else {
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
s6 = peg$parseop_accepts_literal_and_negation();
if (s6 !== peg$FAILED) {
s7 = [];
s8 = peg$parsews();
if (s8 !== peg$FAILED) {
while (s8 !== peg$FAILED) {
s7.push(s8);
s8 = peg$parsews();
}
} else {
s7 = peg$FAILED;
}
if (s7 !== peg$FAILED) {
s8 = peg$parsevalue();
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f8(s2, s6, s8);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} 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 = [];
s2 = peg$parsews();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsews();
}
s2 = peg$parsetoken();
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
s4 = peg$parseop_accepts_literal_sym();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parsews();
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
s6 = peg$parsevalue();
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f9(s2, s4, s6);
} 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 = [];
s2 = peg$parsews();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsews();
}
s2 = peg$parsetoken();
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
} else {
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseop_not();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parsews();
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
} else {
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
s6 = peg$parseop_accepts_literal_and_negation_sym();
if (s6 !== peg$FAILED) {
s7 = [];
s8 = peg$parsews();
while (s8 !== peg$FAILED) {
s7.push(s8);
s8 = peg$parsews();
}
s8 = peg$parsevalue();
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f10(s2, s6, s8);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = [];
s2 = peg$parsews();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 40) {
s2 = peg$c0;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e0); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
s4 = peg$parsetoken();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parsews();
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
} else {
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
s6 = peg$parseop_accepts_variable();
if (s6 !== peg$FAILED) {
s7 = [];
s8 = peg$parsews();
if (s8 !== peg$FAILED) {
while (s8 !== peg$FAILED) {
s7.push(s8);
s8 = peg$parsews();
}
} else {
s7 = peg$FAILED;
}
if (s7 !== peg$FAILED) {
s8 = peg$parsetoken();
if (s8 !== peg$FAILED) {
s9 = [];
s10 = peg$parsews();
while (s10 !== peg$FAILED) {
s9.push(s10);
s10 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 41) {
s10 = peg$c1;
peg$currPos++;
} else {
s10 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e1); }
}
if (s10 !== peg$FAILED) {
s11 = [];
s12 = peg$parsews();
while (s12 !== peg$FAILED) {
s11.push(s12);
s12 = peg$parsews();
}
peg$savedPos = s0;
s0 = peg$f11(s4, s6, s8);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} 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 = [];
s2 = peg$parsews();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 40) {
s2 = peg$c0;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e0); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
s4 = peg$parsetoken();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parsews();
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
} else {
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
s6 = peg$parseop_not();
if (s6 !== peg$FAILED) {
s7 = [];
s8 = peg$parsews();
if (s8 !== peg$FAILED) {
while (s8 !== peg$FAILED) {
s7.push(s8);