apigeelint
Version:
Node module and tool to lint a bundle for an Apigee API Proxy or sharedflow.
1,636 lines (1,535 loc) • 70.4 kB
JavaScript
// Generated by Peggy 3.0.2.
//
// 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]};
}
function peg$subclass(child, parent) {
function C() { this.constructor = child; }
C.prototype = parent.prototype;
child.prototype = new C();
}
function peg$SyntaxError(message, expected, found, location) {
var self = Error.call(this, message);
// istanbul ignore next Check is a necessary evil to support older environments
if (Object.setPrototypeOf) {
Object.setPrototypeOf(self, peg$SyntaxError.prototype);
}
self.expected = expected;
self.found = found;
self.location = location;
self.name = "SyntaxError";
return self;
}
peg$subclass(peg$SyntaxError, Error);
function peg$padEnd(str, targetLength, padString) {
padString = padString || " ";
if (str.length > targetLength) { return str; }
targetLength -= str.length;
padString += padString.repeat(targetLength);
return str + padString.slice(0, targetLength);
}
peg$SyntaxError.prototype.format = function(sources) {
var str = "Error: " + this.message;
if (this.location) {
var src = null;
var k;
for (k = 0; k < sources.length; k++) {
if (sources[k].source === this.location.source) {
src = sources[k].text.split(/\r\n|\n|\r/g);
break;
}
}
var s = this.location.start;
var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
? this.location.source.offset(s)
: s;
var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
if (src) {
var e = this.location.end;
var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
var line = src[s.line - 1];
var last = s.line === e.line ? e.column : line.length + 1;
var hatLen = (last - s.column) || 1;
str += "\n --> " + loc + "\n"
+ filler + " |\n"
+ offset_s.line + " | " + line + "\n"
+ filler + " | " + peg$padEnd("", s.column - 1, ' ')
+ peg$padEnd("", hatLen, "^");
} else {
str += "\n at " + loc;
}
}
return str;
};
peg$SyntaxError.buildMessage = function(expected, found) {
var DESCRIBE_EXPECTATION_FNS = {
literal: function(expectation) {
return "\"" + literalEscape(expectation.text) + "\"";
},
class: function(expectation) {
var escapedParts = expectation.parts.map(function(part) {
return Array.isArray(part)
? classEscape(part[0]) + "-" + classEscape(part[1])
: classEscape(part);
});
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
},
any: function() {
return "any character";
},
end: function() {
return "end of input";
},
other: function(expectation) {
return expectation.description;
}
};
function hex(ch) {
return ch.charCodeAt(0).toString(16).toUpperCase();
}
function literalEscape(s) {
return s
.replace(/\\/g, "\\\\")
.replace(/"/g, "\\\"")
.replace(/\0/g, "\\0")
.replace(/\t/g, "\\t")
.replace(/\n/g, "\\n")
.replace(/\r/g, "\\r")
.replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
}
function classEscape(s) {
return s
.replace(/\\/g, "\\\\")
.replace(/\]/g, "\\]")
.replace(/\^/g, "\\^")
.replace(/-/g, "\\-")
.replace(/\0/g, "\\0")
.replace(/\t/g, "\\t")
.replace(/\n/g, "\\n")
.replace(/\r/g, "\\r")
.replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
}
function describeExpectation(expectation) {
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
}
function describeExpected(expected) {
var descriptions = expected.map(describeExpectation);
var i, j;
descriptions.sort();
if (descriptions.length > 0) {
for (i = 1, j = 1; i < descriptions.length; i++) {
if (descriptions[i - 1] !== descriptions[i]) {
descriptions[j] = descriptions[i];
j++;
}
}
descriptions.length = j;
}
switch (descriptions.length) {
case 1:
return descriptions[0];
case 2:
return descriptions[0] + " or " + descriptions[1];
default:
return descriptions.slice(0, -1).join(", ")
+ ", or "
+ descriptions[descriptions.length - 1];
}
}
function describeFound(found) {
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
}
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
};
function peg$parse(input, options) {
options = options !== undefined ? options : {};
var peg$FAILED = {};
var peg$source = options.grammarSource;
var peg$startRuleFunctions = { start: peg$parsestart };
var peg$startRuleFunction = peg$parsestart;
var peg$c0 = "(";
var peg$c1 = ")";
var peg$c2 = "and";
var peg$c3 = "&&";
var peg$c4 = "not";
var peg$c5 = "!";
var peg$c6 = "or";
var peg$c7 = "||";
var peg$c8 = "==";
var peg$c9 = "=";
var peg$c10 = "equals";
var peg$c11 = "is";
var peg$c12 = "!=";
var peg$c13 = "notequals";
var peg$c14 = "isnot";
var peg$c15 = ":=";
var peg$c16 = "equalscaseinsensitive";
var peg$c17 = ">";
var peg$c18 = "greaterthan";
var peg$c19 = ">=";
var peg$c20 = "greaterthanorequals";
var peg$c21 = "<";
var peg$c22 = "lesserthan";
var peg$c23 = "<=";
var peg$c24 = "lesserthanorequals";
var peg$c25 = "~~";
var peg$c26 = "javaregex";
var peg$c27 = "~";
var peg$c28 = "matches";
var peg$c29 = "like";
var peg$c30 = "~/";
var peg$c31 = "matchespath";
var peg$c32 = "likepath";
var peg$c33 = "=|";
var peg$c34 = "startswith";
var peg$c35 = ".";
var peg$c36 = "-";
var peg$c37 = "0";
var peg$c38 = "\"";
var peg$c39 = "null";
var peg$c40 = "false";
var peg$c41 = "true";
var peg$r0 = /^[0-9]/;
var peg$r1 = /^[1-9]/;
var peg$r2 = /^[a-zA-Z]/;
var peg$r3 = /^[\-a-zA-Z0-9_.]/;
var peg$r4 = /^[^"]/;
var peg$r5 = /^[ \t\n]/;
var peg$e0 = peg$literalExpectation("(", false);
var peg$e1 = peg$literalExpectation(")", false);
var peg$e2 = peg$literalExpectation("and", true);
var peg$e3 = peg$literalExpectation("&&", false);
var peg$e4 = peg$literalExpectation("not", true);
var peg$e5 = peg$literalExpectation("!", false);
var peg$e6 = peg$literalExpectation("or", true);
var peg$e7 = peg$literalExpectation("||", false);
var peg$e8 = peg$literalExpectation("==", false);
var peg$e9 = peg$literalExpectation("=", false);
var peg$e10 = peg$literalExpectation("Equals", true);
var peg$e11 = peg$literalExpectation("Is", true);
var peg$e12 = peg$literalExpectation("!=", false);
var peg$e13 = peg$literalExpectation("NotEquals", true);
var peg$e14 = peg$literalExpectation("IsNot", true);
var peg$e15 = peg$literalExpectation(":=", false);
var peg$e16 = peg$literalExpectation("EqualsCaseInsensitive", true);
var peg$e17 = peg$literalExpectation(">", false);
var peg$e18 = peg$literalExpectation("GreaterThan", true);
var peg$e19 = peg$literalExpectation(">=", false);
var peg$e20 = peg$literalExpectation("GreaterThanOrEquals", true);
var peg$e21 = peg$literalExpectation("<", false);
var peg$e22 = peg$literalExpectation("LesserThan", true);
var peg$e23 = peg$literalExpectation("<=", false);
var peg$e24 = peg$literalExpectation("LesserThanOrEquals", true);
var peg$e25 = peg$literalExpectation("~~", false);
var peg$e26 = peg$literalExpectation("JavaRegex", true);
var peg$e27 = peg$literalExpectation("~", false);
var peg$e28 = peg$literalExpectation("Matches", true);
var peg$e29 = peg$literalExpectation("Like", true);
var peg$e30 = peg$literalExpectation("~/", false);
var peg$e31 = peg$literalExpectation("MatchesPath", true);
var peg$e32 = peg$literalExpectation("LikePath", true);
var peg$e33 = peg$literalExpectation("=|", false);
var peg$e34 = peg$literalExpectation("StartsWith", true);
var peg$e35 = peg$literalExpectation(".", false);
var peg$e36 = peg$literalExpectation("-", false);
var peg$e37 = peg$literalExpectation("0", false);
var peg$e38 = peg$classExpectation([["0", "9"]], false, false);
var peg$e39 = peg$classExpectation([["1", "9"]], false, false);
var peg$e40 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false);
var peg$e41 = peg$classExpectation(["-", ["a", "z"], ["A", "Z"], ["0", "9"], "_", "."], false, false);
var peg$e42 = peg$literalExpectation("\"", false);
var peg$e43 = peg$classExpectation(["\""], true, false);
var peg$e44 = peg$literalExpectation("null", false);
var peg$e45 = peg$literalExpectation("false", false);
var peg$e46 = peg$literalExpectation("true", false);
var peg$e47 = peg$classExpectation([" ", "\t", "\n"], false, false);
var peg$f0 = function(left, op1, right) { return {operator:op1, operands:[left, right] } };
var peg$f1 = function(left, op1, right) { return {operator:op1, operands:[left,right]} };
var peg$f2 = function(operand) { return {operator:"NOT", operands:[operand] } };
var peg$f3 = function(t1, op1, v1) {
return parseBinaryOp(t1,op1,v1,error);
};
var peg$f4 = function(t1, op1, v1) {
return parseBinaryOp(t1,op1,v1,error);
};
var peg$f5 = function(t1, op1, v1) {
return parseBinaryOp(t1,op1,v1,error);
};
var peg$f6 = function(t1, op1, v1) {
return parseBinaryOp(t1,op1,v1,error);
};
var peg$f7 = function(t1, op1, t2) {
return { operator:op1, operands:[t1, t2]};
};
var peg$f8 = function(t1, op1, t2) {
return { operator:op1, operands:[t1, t2]};
};
var peg$f9 = function(t1, op1, t2) {
return { operator:op1, operands:[t1, t2]};
};
var peg$f10 = function(t1, op1, t2) {
return { operator:op1, operands:[t1, t2]};
};
var peg$f11 = function(token1) { return token1; };
var peg$f12 = function(token1) { return token1; };
var peg$f13 = function(stmt1) { return stmt1; };
var peg$f14 = function() {return "AND"; };
var peg$f15 = function() {return "OR"; };
var peg$f16 = function() { return "EqualsCaseInsensitive"; };
var peg$f17 = function() {return "StartsWith";};
var peg$f18 = function() { return "NotEquals"; };
var peg$f19 = function() { return "Equals"; };
var peg$f20 = function() {return "GreaterThanOrEquals";};
var peg$f21 = function() {return "GreaterThan";};
var peg$f22 = function() {return "LesserThanOrEquals";};
var peg$f23 = function() {return "LesserThan";};
var peg$f24 = function() {return "JavaRegex";};
var peg$f25 = function() {return "MatchesPath";};
var peg$f26 = function() {return "Matches";};
var peg$f27 = function() { return "EqualsCaseInsensitive"; };
var peg$f28 = function() {return "StartsWith";};
var peg$f29 = function() { return "NotEquals"; };
var peg$f30 = function() { return "Equals"; };
var peg$f31 = function() {return "GreaterThanOrEquals";};
var peg$f32 = function() {return "GreaterThan";};
var peg$f33 = function() {return "LesserThanOrEquals";};
var peg$f34 = function() {return "LesserThan";};
var peg$f35 = function() {return "JavaRegex";};
var peg$f36 = function() {return "MatchesPath";};
var peg$f37 = function() {return "Matches";};
var peg$f38 = function() {return "StartsWith";};
var peg$f39 = function() { return "NotEquals"; };
var peg$f40 = function() { return "Equals"; };
var peg$f41 = function() {return "GreaterThanOrEquals";};
var peg$f42 = function() {return "GreaterThan";};
var peg$f43 = function() {return "LesserThanOrEquals";};
var peg$f44 = function() {return "LesserThan";};
var peg$f45 = function() {return "StartsWith";};
var peg$f46 = function() { return "NotEquals"; };
var peg$f47 = function() { return "Equals"; };
var peg$f48 = function() {return "GreaterThanOrEquals";};
var peg$f49 = function() {return "GreaterThan";};
var peg$f50 = function() {return "LesserThanOrEquals";};
var peg$f51 = function() {return "LesserThan";};
var peg$f52 = function(int1) { return "." + chars.join(''); };
var peg$f53 = function() {
return { type: "Literal", value: parseFloat(text()) };
};
var peg$f54 = function() {
return { type: "Literal", value: parseFloat(text()) };
};
var peg$f55 = function() {
return { type: "Literal", value: parseInt(text()) };
};
var peg$f56 = function() { return text(); };
var peg$f57 = function(value) { value.unshift("'"); value.push("'"); return value; };
var peg$f58 = function() { return null; };
var peg$f59 = function() { return false; };
var peg$f60 = function() { return true; };
var peg$f61 = function(value) { return value.value; };
var peg$currPos = 0;
var peg$savedPos = 0;
var peg$posDetailsCache = [{ line: 1, column: 1 }];
var peg$maxFailPos = 0;
var peg$maxFailExpected = [];
var peg$silentFails = 0;
var peg$result;
if ("startRule" in options) {
if (!(options.startRule in peg$startRuleFunctions)) {
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
}
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
}
function text() {
return input.substring(peg$savedPos, peg$currPos);
}
function offset() {
return peg$savedPos;
}
function range() {
return {
source: peg$source,
start: peg$savedPos,
end: peg$currPos
};
}
function location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function expected(description, location) {
location = location !== undefined
? location
: peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildStructuredError(
[peg$otherExpectation(description)],
input.substring(peg$savedPos, peg$currPos),
location
);
}
function error(message, location) {
location = location !== undefined
? location
: peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildSimpleError(message, location);
}
function peg$literalExpectation(text, ignoreCase) {
return { type: "literal", text: text, ignoreCase: ignoreCase };
}
function peg$classExpectation(parts, inverted, ignoreCase) {
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
}
function peg$anyExpectation() {
return { type: "any" };
}
function peg$endExpectation() {
return { type: "end" };
}
function peg$otherExpectation(description) {
return { type: "other", description: description };
}
function peg$computePosDetails(pos) {
var details = peg$posDetailsCache[pos];
var p;
if (details) {
return details;
} else {
p = pos - 1;
while (!peg$posDetailsCache[p]) {
p--;
}
details = peg$posDetailsCache[p];
details = {
line: details.line,
column: details.column
};
while (p < pos) {
if (input.charCodeAt(p) === 10) {
details.line++;
details.column = 1;
} else {
details.column++;
}
p++;
}
peg$posDetailsCache[pos] = details;
return details;
}
}
function peg$computeLocation(startPos, endPos, offset) {
var startPosDetails = peg$computePosDetails(startPos);
var endPosDetails = peg$computePosDetails(endPos);
var res = {
source: peg$source,
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
};
if (offset && peg$source && (typeof peg$source.offset === "function")) {
res.start = peg$source.offset(res.start);
res.end = peg$source.offset(res.end);
}
return res;
}
function peg$fail(expected) {
if (peg$currPos < peg$maxFailPos) { return; }
if (peg$currPos > peg$maxFailPos) {
peg$maxFailPos = peg$currPos;
peg$maxFailExpected = [];
}
peg$maxFailExpected.push(expected);
}
function peg$buildSimpleError(message, location) {
return new peg$SyntaxError(message, null, null, location);
}
function peg$buildStructuredError(expected, found, location) {
return new peg$SyntaxError(
peg$SyntaxError.buildMessage(expected, found),
expected,
found,
location
);
}
function peg$parsestart() {
var s0;
s0 = peg$parseboolean_stmt1();
return s0;
}
function peg$parseboolean_stmt1() {
var 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() {
var 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() {
var 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() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
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();
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$f4(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 = peg$parsetoken();
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_accepts_literal();
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$parsevalue();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f5(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$currPos;
s1 = peg$parsetoken();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsews();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsews();
}
s3 = peg$parseop_accepts_literal_sym();
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parsews();
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parsews();
}
s5 = peg$parsevalue();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f6(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$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$f7(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();
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
s6 = peg$parseop_accepts_variable_sym();
if (s6 !== peg$FAILED) {
s7 = [];
s8 = peg$parsews();
while (s8 !== peg$FAILED) {
s7.push(s8);
s8 = peg$parsews();
}
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$f8(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 = peg$parsetoken();
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_accepts_variable();
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$parsetoken();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f9(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$currPos;
s1 = peg$parsetoken();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsews();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsews();
}
s3 = peg$parseop_accepts_variable_sym();
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parsews();
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parsews();
}
s5 = peg$parsetoken();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f10(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$currPos;
s1 = peg$parsetoken();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f11(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
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 = [];
s3 = peg$parsews();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsews();
}
s3 = peg$parsetoken();
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parsews();
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parsews();
}
if (input.charCodeAt(peg$currPos) === 41) {
s5 = peg$c1;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e1); }
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s0 = peg$f12(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;
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$parseboolean_stmt1();
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$f13(s2);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
}
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseop_boolean() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseop_and();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f14();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_or();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f15();
}
s0 = s1;
}
return s0;
}
function peg$parseop_and() {
var s0;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c2) {
s0 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e2); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c3) {
s0 = peg$c3;
peg$currPos += 2;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e3); }
}
}
return s0;
}
function peg$parseop_not() {
var s0;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c4) {
s0 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e4); }
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 33) {
s0 = peg$c5;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e5); }
}
}
return s0;
}
function peg$parseop_or() {
var s0;
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c6) {
s0 = input.substr(peg$currPos, 2);
peg$currPos += 2;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e6); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c7) {
s0 = peg$c7;
peg$currPos += 2;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e7); }
}
}
return s0;
}
function peg$parseop_accepts_literal_sym() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseop_equalsnocase_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f16();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_startswith_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f17();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_notequals_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f18();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_equals_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f19();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_greatereq_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f20();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_greater_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f21();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_lessereq_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f22();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_lesser_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f23();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_regexmatch_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f24();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_matchespath_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f25();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_matches_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f26();
}
s0 = s1;
}
}
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseop_accepts_literal() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseop_equalsnocase();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f27();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_startswith();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f28();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_notequals();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f29();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_equals();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f30();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_greatereq();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f31();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_greater();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f32();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_lessereq();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f33();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_lesser();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f34();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_regexmatch();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f35();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_matchespath();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f36();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseop_matches();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f37();
}
s0 = s1;
}
}
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseop_accepts_variable_sym() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseop_startswith_sym();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$f38(