cronapp-common-js
Version:
Cronapp Commons Functions
1,780 lines (1,642 loc) • 348 kB
JavaScript
/*
* Generated by PEG.js 0.10.0.
*
* http://pegjs.org/
*/
"use strict";
function peg$subclass(child, parent) {
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
function peg$SyntaxError(message, expected, found, location) {
this.message = message;
this.expected = expected;
this.found = found;
this.location = location;
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(peg$SyntaxError, Error);
peg$SyntaxError.buildMessage = function(expected, found) {
var DESCRIBE_EXPECTATION_FNS = {
literal: function(expectation) {
return "\"" + literalEscape(expectation.text) + "\"";
},
"class": function(expectation) {
var escapedParts = "",
i;
for (i = 0; i < expectation.parts.length; i++) {
escapedParts += expectation.parts[i] instanceof Array
? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
: classEscape(expectation.parts[i]);
}
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
},
any: function(expectation) {
return "any character";
},
end: function(expectation) {
return "end of input";
},
other: function(expectation) {
return expectation.description;
}
};
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 = new Array(expected.length),
i, j;
for (i = 0; i < expected.length; i++) {
descriptions[i] = describeExpectation(expected[i]);
}
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.";
};
let hasSubstringof = false;
let substringofIndex = [];
let originalFilter;
function peg$remParen(val) {
while (val.startsWith('(')) {
val = val.substr(1);
}
return val;
}
function peg$allExp(input) {
input = peg$remParen(input)
let baseExp1 = input.split(' and ');
let uniqueExp = [];
baseExp1.forEach((b) => {
let baseExp2 = peg$remParen(b).split( ' or ' );
baseExp2.forEach((b2) => uniqueExp.push(b2));
});
return uniqueExp;
}
function peg$prepareForSubstringof(input) {
hasSubstringof = false;
if (input.indexOf('substringof') > -1) {
hasSubstringof = true;
substringofIndex = [];
let uniqueExp = peg$allExp(input);
uniqueExp.forEach((exp, idx) => exp.startsWith('substringof') && substringofIndex.push(idx));
input = input.replace(/substringof/g, 'startswith');
}
return input;
}
function peg$prepare(input) {
originalFilter = input;
input = peg$prepareForSubstringof(input);
return encodeURIComponent(input);
}
function peg$parseExpSubstingof(exp) {
let value = /\'([^)]+)\'/.exec(exp);
value = value[1];
let property = /,\s*(.*?)\s*\)/.exec(exp);
property = property[1].replace('tolower(','');
let genProperty = (p, v) => {
let obj = {};
obj[p] = { $regex: new RegExp(v,'gi') };
return obj;
};
return genProperty(property, value);
}
function peg$setSubstringOfRegex(obj, regex) {
for (let name in obj) {
if (name === 'property') {
return true;
}
else if (Array.isArray(obj[name])) {
for (let idx = 0; idx < obj[name].length; idx++) {
if (peg$setSubstringOfRegex(obj[name][idx], regex)) {
obj[name][idx] = regex;
break;
}
}
}
return false;
}
}
function peg$addSubstringof(peg$result) {
if (hasSubstringof) {
let uniqueExp = peg$allExp(originalFilter);
substringofIndex.forEach((idx) => {
let regex = peg$parseExpSubstingof(uniqueExp[idx]);
if (peg$setSubstringOfRegex(peg$result, regex)) {
peg$result = regex;
}
});
}
return peg$result;
}
function peg$decode(obj) {
for (let name in obj) {
if (typeof obj[name] === 'string') {
obj[name] = decodeURIComponent(obj[name]);
}
else if (typeof obj[name] === 'object') {
peg$decode(obj[name]);
}
else if (Array.isArray(obj[name])) {
for (let idx = 0; idx < obj[name].length; idx++) {
peg$decode(obj[name][idx]);
}
}
}
}
function peg$finish(peg$result) {
peg$result = peg$addSubstringof(peg$result);
peg$decode(peg$result);
return peg$result;
}
function peg$parse(input, options) {
input = peg$prepare(input);
options = options !== void 0 ? options : {};
var peg$FAILED = {},
peg$startRuleFunctions = { filterExpr: peg$parsefilterExpr },
peg$startRuleFunction = peg$parsefilterExpr,
peg$c0 = "/",
peg$c1 = peg$literalExpectation("/", false),
peg$c2 = function(segments) { return segments.map(segment => segment[1]); },
peg$c3 = function() { return text(); },
peg$c4 = "/$count",
peg$c5 = peg$literalExpectation("/$count", false),
peg$c6 = "$filter",
peg$c7 = peg$literalExpectation("$filter", false),
peg$c8 = "filter",
peg$c9 = peg$literalExpectation("filter", false),
peg$c10 = "$search",
peg$c11 = peg$literalExpectation("$search", false),
peg$c12 = "search",
peg$c13 = peg$literalExpectation("search", false),
peg$c14 = "OR",
peg$c15 = peg$literalExpectation("OR", false),
peg$c16 = "AND",
peg$c17 = peg$literalExpectation("AND", false),
peg$c18 = "NOT",
peg$c19 = peg$literalExpectation("NOT", false),
peg$c20 = ".",
peg$c21 = peg$literalExpectation(".", false),
peg$c22 = function(operand, arithmetic, logical, conditional) { return makeCommonExpr(operand, arithmetic, logical, conditional); },
peg$c23 = "$root/",
peg$c24 = peg$literalExpectation("$root/", false),
peg$c25 = function(path) { return path; },
peg$c26 = function(property, navigation) { return [property, ...navigation ? navigation : []] },
peg$c27 = "#",
peg$c28 = peg$literalExpectation("#", false),
peg$c29 = "$it",
peg$c30 = peg$literalExpectation("$it", false),
peg$c31 = "$this",
peg$c32 = peg$literalExpectation("$this", false),
peg$c33 = function(typeName, predicate) { return predicate; },
peg$c34 = function(typeName, path) { return path; },
peg$c35 = "any",
peg$c36 = peg$literalExpectation("any", false),
peg$c37 = "all",
peg$c38 = peg$literalExpectation("all", false),
peg$c39 = "concat",
peg$c40 = peg$literalExpectation("concat", false),
peg$c41 = "contains",
peg$c42 = peg$literalExpectation("contains", false),
peg$c43 = function(property, value) { return makePropertyWithValue(property, { $regex: `.*${value}.*` }); },
peg$c44 = "endswith",
peg$c45 = peg$literalExpectation("endswith", false),
peg$c46 = "indexof",
peg$c47 = peg$literalExpectation("indexof", false),
peg$c48 = "length",
peg$c49 = peg$literalExpectation("length", false),
peg$c50 = "startswith",
peg$c51 = peg$literalExpectation("startswith", false),
peg$c52 = function(property, value) { return makePropertyWithValue(property, { $regex: `${value}.*` }); },
peg$c53 = "substring",
peg$c54 = peg$literalExpectation("substring", false),
peg$c55 = "tolower",
peg$c56 = peg$literalExpectation("tolower", false),
peg$c57 = "toupper",
peg$c58 = peg$literalExpectation("toupper", false),
peg$c59 = "trim",
peg$c60 = peg$literalExpectation("trim", false),
peg$c61 = "year",
peg$c62 = peg$literalExpectation("year", false),
peg$c63 = "month",
peg$c64 = peg$literalExpectation("month", false),
peg$c65 = "day",
peg$c66 = peg$literalExpectation("day", false),
peg$c67 = "hour",
peg$c68 = peg$literalExpectation("hour", false),
peg$c69 = "minute",
peg$c70 = peg$literalExpectation("minute", false),
peg$c71 = "second",
peg$c72 = peg$literalExpectation("second", false),
peg$c73 = "fractionalseconds",
peg$c74 = peg$literalExpectation("fractionalseconds", false),
peg$c75 = "totalseconds",
peg$c76 = peg$literalExpectation("totalseconds", false),
peg$c77 = "date",
peg$c78 = peg$literalExpectation("date", false),
peg$c79 = "time",
peg$c80 = peg$literalExpectation("time", false),
peg$c81 = "totaloffsetminutes",
peg$c82 = peg$literalExpectation("totaloffsetminutes", false),
peg$c83 = "mindatetime",
peg$c84 = peg$literalExpectation("mindatetime", false),
peg$c85 = "maxdatetime",
peg$c86 = peg$literalExpectation("maxdatetime", false),
peg$c87 = "now",
peg$c88 = peg$literalExpectation("now", false),
peg$c89 = "round",
peg$c90 = peg$literalExpectation("round", false),
peg$c91 = "floor",
peg$c92 = peg$literalExpectation("floor", false),
peg$c93 = "ceiling",
peg$c94 = peg$literalExpectation("ceiling", false),
peg$c95 = "geo.distance",
peg$c96 = peg$literalExpectation("geo.distance", false),
peg$c97 = "geo.length",
peg$c98 = peg$literalExpectation("geo.length", false),
peg$c99 = "geo.intersects",
peg$c100 = peg$literalExpectation("geo.intersects", false),
peg$c101 = "hassubset",
peg$c102 = peg$literalExpectation("hassubset", false),
peg$c103 = "hassubsequence",
peg$c104 = peg$literalExpectation("hassubsequence", false),
peg$c105 = function(expr) { return expr; },
peg$c106 = "and",
peg$c107 = peg$literalExpectation("and", false),
peg$c108 = function(expr) { return { $and: [expr] }; },
peg$c109 = "or",
peg$c110 = peg$literalExpectation("or", false),
peg$c111 = function(expr) { return { $or: [expr] }; },
peg$c112 = "eq",
peg$c113 = peg$literalExpectation("eq", false),
peg$c114 = function(expr) { return { $eq: expr }; },
peg$c115 = "ne",
peg$c116 = peg$literalExpectation("ne", false),
peg$c117 = function(expr) { return { $ne: expr }; },
peg$c118 = "lt",
peg$c119 = peg$literalExpectation("lt", false),
peg$c120 = function(expr) { return { $lt: expr }; },
peg$c121 = "le",
peg$c122 = peg$literalExpectation("le", false),
peg$c123 = function(expr) { return { $lte: expr }; },
peg$c124 = "gt",
peg$c125 = peg$literalExpectation("gt", false),
peg$c126 = function(expr) { return { $gt: expr }; },
peg$c127 = "ge",
peg$c128 = peg$literalExpectation("ge", false),
peg$c129 = function(expr) { return { $gte: expr }; },
peg$c130 = "in",
peg$c131 = peg$literalExpectation("in", false),
peg$c132 = function(expr) { return { $in: expr }; },
peg$c133 = "has",
peg$c134 = peg$literalExpectation("has", false),
peg$c135 = "add",
peg$c136 = peg$literalExpectation("add", false),
peg$c137 = "sub",
peg$c138 = peg$literalExpectation("sub", false),
peg$c139 = "mul",
peg$c140 = peg$literalExpectation("mul", false),
peg$c141 = "div",
peg$c142 = peg$literalExpectation("div", false),
peg$c143 = "divby",
peg$c144 = peg$literalExpectation("divby", false),
peg$c145 = "mod",
peg$c146 = peg$literalExpectation("mod", false),
peg$c147 = "-",
peg$c148 = peg$literalExpectation("-", false),
peg$c149 = "not",
peg$c150 = peg$literalExpectation("not", false),
peg$c151 = "isof",
peg$c152 = peg$literalExpectation("isof", false),
peg$c153 = "cast",
peg$c154 = peg$literalExpectation("cast", false),
peg$c155 = "{",
peg$c156 = peg$literalExpectation("{", false),
peg$c157 = "%7B",
peg$c158 = peg$literalExpectation("%7B", false),
peg$c159 = "}",
peg$c160 = peg$literalExpectation("}", false),
peg$c161 = "%7D",
peg$c162 = peg$literalExpectation("%7D", false),
peg$c163 = "[",
peg$c164 = peg$literalExpectation("[", false),
peg$c165 = "%5B",
peg$c166 = peg$literalExpectation("%5B", false),
peg$c167 = "]",
peg$c168 = peg$literalExpectation("]", false),
peg$c169 = "%5D",
peg$c170 = peg$literalExpectation("%5D", false),
peg$c171 = "%22",
peg$c172 = peg$literalExpectation("%22", false),
peg$c173 = "true",
peg$c174 = peg$literalExpectation("true", false),
peg$c175 = "false",
peg$c176 = peg$literalExpectation("false", false),
peg$c177 = "null",
peg$c178 = peg$literalExpectation("null", false),
peg$c179 = "%2F",
peg$c180 = peg$literalExpectation("%2F", false),
peg$c181 = "b",
peg$c182 = peg$literalExpectation("b", false),
peg$c183 = "f",
peg$c184 = peg$literalExpectation("f", false),
peg$c185 = "n",
peg$c186 = peg$literalExpectation("n", false),
peg$c187 = "r",
peg$c188 = peg$literalExpectation("r", false),
peg$c189 = "t",
peg$c190 = peg$literalExpectation("t", false),
peg$c191 = "u",
peg$c192 = peg$literalExpectation("u", false),
peg$c193 = ":",
peg$c194 = peg$literalExpectation(":", false),
peg$c195 = "\\",
peg$c196 = peg$literalExpectation("\\", false),
peg$c197 = "%5C",
peg$c198 = peg$literalExpectation("%5C", false),
peg$c199 = "0",
peg$c200 = peg$literalExpectation("0", false),
peg$c201 = "e",
peg$c202 = peg$literalExpectation("e", false),
peg$c203 = "+",
peg$c204 = peg$literalExpectation("+", false),
peg$c205 = "Collection",
peg$c206 = peg$literalExpectation("Collection", false),
peg$c207 = "_",
peg$c208 = peg$literalExpectation("_", false),
peg$c209 = "Edm.",
peg$c210 = peg$literalExpectation("Edm.", false),
peg$c211 = "Binary",
peg$c212 = peg$literalExpectation("Binary", false),
peg$c213 = "Boolean",
peg$c214 = peg$literalExpectation("Boolean", false),
peg$c215 = "Byte",
peg$c216 = peg$literalExpectation("Byte", false),
peg$c217 = "Date",
peg$c218 = peg$literalExpectation("Date", false),
peg$c219 = "DateTimeOffset",
peg$c220 = peg$literalExpectation("DateTimeOffset", false),
peg$c221 = "Decimal",
peg$c222 = peg$literalExpectation("Decimal", false),
peg$c223 = "Double",
peg$c224 = peg$literalExpectation("Double", false),
peg$c225 = "Duration",
peg$c226 = peg$literalExpectation("Duration", false),
peg$c227 = "Guid",
peg$c228 = peg$literalExpectation("Guid", false),
peg$c229 = "Int16",
peg$c230 = peg$literalExpectation("Int16", false),
peg$c231 = "Int32",
peg$c232 = peg$literalExpectation("Int32", false),
peg$c233 = "Int64",
peg$c234 = peg$literalExpectation("Int64", false),
peg$c235 = "SByte",
peg$c236 = peg$literalExpectation("SByte", false),
peg$c237 = "Single",
peg$c238 = peg$literalExpectation("Single", false),
peg$c239 = "Stream",
peg$c240 = peg$literalExpectation("Stream", false),
peg$c241 = "String",
peg$c242 = peg$literalExpectation("String", false),
peg$c243 = "TimeOfDay",
peg$c244 = peg$literalExpectation("TimeOfDay", false),
peg$c245 = "Geography",
peg$c246 = peg$literalExpectation("Geography", false),
peg$c247 = "Geometry",
peg$c248 = peg$literalExpectation("Geometry", false),
peg$c249 = "LineString",
peg$c250 = peg$literalExpectation("LineString", false),
peg$c251 = "MultiLineString",
peg$c252 = peg$literalExpectation("MultiLineString", false),
peg$c253 = "MultiPoint",
peg$c254 = peg$literalExpectation("MultiPoint", false),
peg$c255 = "MultiPolygon",
peg$c256 = peg$literalExpectation("MultiPolygon", false),
peg$c257 = "Point",
peg$c258 = peg$literalExpectation("Point", false),
peg$c259 = "Polygon",
peg$c260 = peg$literalExpectation("Polygon", false),
peg$c261 = "binary",
peg$c262 = peg$literalExpectation("binary", false),
peg$c263 = "A",
peg$c264 = peg$literalExpectation("A", false),
peg$c265 = "E",
peg$c266 = peg$literalExpectation("E", false),
peg$c267 = "I",
peg$c268 = peg$literalExpectation("I", false),
peg$c269 = "M",
peg$c270 = peg$literalExpectation("M", false),
peg$c271 = "Q",
peg$c272 = peg$literalExpectation("Q", false),
peg$c273 = "U",
peg$c274 = peg$literalExpectation("U", false),
peg$c275 = "Y",
peg$c276 = peg$literalExpectation("Y", false),
peg$c277 = "c",
peg$c278 = peg$literalExpectation("c", false),
peg$c279 = "g",
peg$c280 = peg$literalExpectation("g", false),
peg$c281 = "k",
peg$c282 = peg$literalExpectation("k", false),
peg$c283 = "o",
peg$c284 = peg$literalExpectation("o", false),
peg$c285 = "s",
peg$c286 = peg$literalExpectation("s", false),
peg$c287 = "w",
peg$c288 = peg$literalExpectation("w", false),
peg$c289 = "4",
peg$c290 = peg$literalExpectation("4", false),
peg$c291 = "8",
peg$c292 = peg$literalExpectation("8", false),
peg$c293 = "=",
peg$c294 = peg$literalExpectation("=", false),
peg$c295 = "==",
peg$c296 = peg$literalExpectation("==", false),
peg$c297 = function() { return Number(text()); },
peg$c298 = function(value) { return value; },
peg$c299 = "NaN",
peg$c300 = peg$literalExpectation("NaN", false),
peg$c301 = function() { return NaN; },
peg$c302 = "-INF",
peg$c303 = peg$literalExpectation("-INF", false),
peg$c304 = function() { return -Infinity; },
peg$c305 = "INF",
peg$c306 = peg$literalExpectation("INF", false),
peg$c307 = function() { return Infinity; },
peg$c308 = function(string) { return string; },
peg$c309 = function() { return '\''; },
peg$c310 = "T",
peg$c311 = peg$literalExpectation("T", false),
peg$c312 = "Z",
peg$c313 = peg$literalExpectation("Z", false),
peg$c314 = "duration",
peg$c315 = peg$literalExpectation("duration", false),
peg$c316 = "P",
peg$c317 = peg$literalExpectation("P", false),
peg$c318 = "D",
peg$c319 = peg$literalExpectation("D", false),
peg$c320 = "H",
peg$c321 = peg$literalExpectation("H", false),
peg$c322 = "S",
peg$c323 = peg$literalExpectation("S", false),
peg$c324 = /^[1-9]/,
peg$c325 = peg$classExpectation([["1", "9"]], false, false),
peg$c326 = /^[0-5]/,
peg$c327 = peg$classExpectation([["0", "5"]], false, false),
peg$c328 = "1",
peg$c329 = peg$literalExpectation("1", false),
peg$c330 = /^[0-2]/,
peg$c331 = peg$classExpectation([["0", "2"]], false, false),
peg$c332 = /^[1-2]/,
peg$c333 = peg$classExpectation([["1", "2"]], false, false),
peg$c334 = "3",
peg$c335 = peg$literalExpectation("3", false),
peg$c336 = /^[0-1]/,
peg$c337 = peg$classExpectation([["0", "1"]], false, false),
peg$c338 = "2",
peg$c339 = peg$literalExpectation("2", false),
peg$c340 = /^[0-3]/,
peg$c341 = peg$classExpectation([["0", "3"]], false, false),
peg$c342 = function(type, enumValue) { return makeEnum(type, enumValue); },
peg$c343 = function(first, rest) { return makeEnumValue(first, rest); },
peg$c344 = "Collection(",
peg$c345 = peg$literalExpectation("Collection(", false),
peg$c346 = "MultiLineString(",
peg$c347 = peg$literalExpectation("MultiLineString(", false),
peg$c348 = "MultiPoint(",
peg$c349 = peg$literalExpectation("MultiPoint(", false),
peg$c350 = "MultiPolygon(",
peg$c351 = peg$literalExpectation("MultiPolygon(", false),
peg$c352 = "SRID",
peg$c353 = peg$literalExpectation("SRID", false),
peg$c354 = "geography",
peg$c355 = peg$literalExpectation("geography", false),
peg$c356 = "geometry",
peg$c357 = peg$literalExpectation("geometry", false),
peg$c358 = "%20",
peg$c359 = peg$literalExpectation("%20", false),
peg$c360 = "%09",
peg$c361 = peg$literalExpectation("%09", false),
peg$c362 = "@",
peg$c363 = peg$literalExpectation("@", false),
peg$c364 = "%40",
peg$c365 = peg$literalExpectation("%40", false),
peg$c366 = "%3A",
peg$c367 = peg$literalExpectation("%3A", false),
peg$c368 = ",",
peg$c369 = peg$literalExpectation(",", false),
peg$c370 = "%2C",
peg$c371 = peg$literalExpectation("%2C", false),
peg$c372 = "%2B",
peg$c373 = peg$literalExpectation("%2B", false),
peg$c374 = ";",
peg$c375 = peg$literalExpectation(";", false),
peg$c376 = "%3B",
peg$c377 = peg$literalExpectation("%3B", false),
peg$c378 = "'",
peg$c379 = peg$literalExpectation("'", false),
peg$c380 = "%27",
peg$c381 = peg$literalExpectation("%27", false),
peg$c382 = "(",
peg$c383 = peg$literalExpectation("(", false),
peg$c384 = "%28",
peg$c385 = peg$literalExpectation("%28", false),
peg$c386 = ")",
peg$c387 = peg$literalExpectation(")", false),
peg$c388 = "%29",
peg$c389 = peg$literalExpectation("%29", false),
peg$c390 = "%",
peg$c391 = peg$literalExpectation("%", false),
peg$c392 = "~",
peg$c393 = peg$literalExpectation("~", false),
peg$c394 = "$",
peg$c395 = peg$literalExpectation("$", false),
peg$c396 = "&",
peg$c397 = peg$literalExpectation("&", false),
peg$c398 = "!",
peg$c399 = peg$literalExpectation("!", false),
peg$c400 = "*",
peg$c401 = peg$literalExpectation("*", false),
peg$c402 = /^[3-9]/,
peg$c403 = peg$classExpectation([["3", "9"]], false, false),
peg$c404 = /^[A-F]/,
peg$c405 = peg$classExpectation([["A", "F"]], false, false),
peg$c406 = /^[0-6]/,
peg$c407 = peg$classExpectation([["0", "6"]], false, false),
peg$c408 = /^[8-9]/,
peg$c409 = peg$classExpectation([["8", "9"]], false, false),
peg$c410 = "?",
peg$c411 = peg$literalExpectation("?", false),
peg$c412 = /^[3-4]/,
peg$c413 = peg$classExpectation([["3", "4"]], false, false),
peg$c414 = /^[6-9]/,
peg$c415 = peg$classExpectation([["6", "9"]], false, false),
peg$c416 = "5",
peg$c417 = peg$literalExpectation("5", false),
peg$c418 = /^[A-B]/,
peg$c419 = peg$classExpectation([["A", "B"]], false, false),
peg$c420 = /^[D-F]/,
peg$c421 = peg$classExpectation([["D", "F"]], false, false),
peg$c422 = /^[A-Z]/,
peg$c423 = peg$classExpectation([["A", "Z"]], false, false),
peg$c424 = /^[a-z]/,
peg$c425 = peg$classExpectation([["a", "z"]], false, false),
peg$c426 = /^[0-9]/,
peg$c427 = peg$classExpectation([["0", "9"]], false, false),
peg$c428 = "\"",
peg$c429 = peg$literalExpectation("\"", false),
peg$c430 = " ",
peg$c431 = peg$literalExpectation(" ", false),
peg$c432 = "\t",
peg$c433 = peg$literalExpectation("\t", false),
peg$currPos = 0,
peg$savedPos = 0,
peg$posDetailsCache = [{ line: 1, column: 1 }],
peg$maxFailPos = 0,
peg$maxFailExpected = [],
peg$silentFails = 0,
peg$result;
if ("startRule" in options) {
if (!(options.startRule in peg$startRuleFunctions)) {
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
}
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
}
function text() {
return input.substring(peg$savedPos, peg$currPos);
}
function location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function expected(description, location) {
location = location !== void 0 ? 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 !== void 0 ? 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], 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) {
var startPosDetails = peg$computePosDetails(startPos),
endPosDetails = peg$computePosDetails(endPos);
return {
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
};
}
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$parsefilterExpr() {
var s0;
s0 = peg$parsecommonExpr();
return s0;
}
function peg$parsekeyPredicate() {
var s0;
s0 = peg$parsesimpleKey();
if (s0 === peg$FAILED) {
s0 = peg$parsecompoundKey();
if (s0 === peg$FAILED) {
s0 = peg$parsekeyPathSegments();
}
}
return s0;
}
function peg$parsesimpleKey() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseOPEN();
if (s1 !== peg$FAILED) {
s2 = peg$parseparameterAlias();
if (s2 === peg$FAILED) {
s2 = peg$parseprimitiveLiteral();
}
if (s2 !== peg$FAILED) {
s3 = peg$parseCLOSE();
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsecompoundKey() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parseOPEN();
if (s1 !== peg$FAILED) {
s2 = peg$parsekeyValuePair();
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$currPos;
s5 = peg$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parsekeyValuePair();
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$parseCOMMA();
if (s5 !== peg$FAILED) {
s6 = peg$parsekeyValuePair();
if (s6 !== peg$FAILED) {
s5 = [s5, s6];
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parseCLOSE();
if (s4 !== peg$FAILED) {
s1 = [s1, s2, s3, s4];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsekeyValuePair() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseodataIdentifier();
if (s1 === peg$FAILED) {
s1 = peg$parseodataIdentifier();
}
if (s1 !== peg$FAILED) {
s2 = peg$parseEQ();
if (s2 !== peg$FAILED) {
s3 = peg$parseparameterAlias();
if (s3 === peg$FAILED) {
s3 = peg$parseprimitiveLiteral();
}
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsekeyPathSegments() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = [];
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 47) {
s3 = peg$c0;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c1); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parsekeyPathLiteral();
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 47) {
s3 = peg$c0;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c1); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parsekeyPathLiteral();
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c2(s1);
}
s0 = s1;
return s0;
}
function peg$parsekeyPathLiteral() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
s2 = peg$parsepchar();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsepchar();
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3();
}
s0 = s1;
return s0;
}
function peg$parsecount() {
var s0;
if (input.substr(peg$currPos, 7) === peg$c4) {
s0 = peg$c4;
peg$currPos += 7;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c5); }
}
return s0;
}
function peg$parseparameterAlias() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parseAT();
if (s1 !== peg$FAILED) {
s2 = peg$parseodataIdentifier();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseexpandCountOption() {
var s0;
s0 = peg$parsefilter();
if (s0 === peg$FAILED) {
s0 = peg$parsesearch();
}
return s0;
}
function peg$parsefilter() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 7) === peg$c6) {
s1 = peg$c6;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c7); }
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c8) {
s1 = peg$c8;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c9); }
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseEQ();
if (s2 !== peg$FAILED) {
s3 = peg$parsecommonExpr();
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsesearch() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
if (input.substr(peg$currPos, 7) === peg$c10) {
s1 = peg$c10;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c12) {
s1 = peg$c12;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c13); }
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseEQ();
if (s2 !== peg$FAILED) {
s3 = peg$parseBWS();
if (s3 !== peg$FAILED) {
s4 = peg$parsesearchExpr();
if (s4 !== peg$FAILED) {
s1 = [s1, s2, s3, s4];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsesearchExpr() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$parseOPEN();
if (s2 !== peg$FAILED) {
s3 = peg$parseBWS();
if (s3 !== peg$FAILED) {
s4 = peg$parsesearchExpr();
if (s4 !== peg$FAILED) {
s5 = peg$parseBWS();
if (s5 !== peg$FAILED) {
s6 = peg$parseCLOSE();
if (s6 !== peg$FAILED) {
s2 = [s2, s3, s4, s5, s6];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 === peg$FAILED) {
s1 = peg$parsesearchTerm();
}
if (s1 !== peg$FAILED) {
s2 = peg$parsesearchOrExpr();
if (s2 === peg$FAILED) {
s2 = peg$parsesearchAndExpr();
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsesearchOrExpr() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parseRWS();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c14) {
s2 = peg$c14;
peg$currPos += 2;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c15); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parseRWS();
if (s3 !== peg$FAILED) {
s4 = peg$parsesearchExpr();
if (s4 !== peg$FAILED) {
s1 = [s1, s2, s3, s4];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsesearchAndExpr() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parseRWS();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
if (input.substr(peg$currPos, 3) === peg$c16) {
s3 = peg$c16;
peg$currPos += 3;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c17); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parseRWS();
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
s3 = peg$parsesearchExpr();
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsesearchTerm() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$currPos;
if (input.substr(peg$currPos, 3) === peg$c18) {
s2 = peg$c18;
peg$currPos += 3;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c19); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parseRWS();
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 === peg$FAILED) {
s1 = null;
}
if (s1 !== peg$FAILED) {
s2 = peg$parsesearchPhrase();
if (s2 === peg$FAILED) {
s2 = peg$parsesearchWord();
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsesearchPhrase() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parsequotation_mark();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseqchar_no_AMP_DQUOTE();
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseqchar_no_AMP_DQUOTE();
}
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = peg$parsequotation_mark();
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsesearchWord() {
var s0, s1;
s0 = [];
s1 = peg$parseALPHA();
if (s1 === peg$FAILED) {
s1 = peg$parseDIGIT();
if (s1 === peg$FAILED) {
s1 = peg$parseCOMMA();
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s1 = peg$c20;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c21); }
}
if (s1 === peg$FAILED) {
s1 = peg$parsepct_encoded();
}
}
}
}
if (s1 !== peg$FAILED) {
while (s1 !== peg$FAILED) {
s0.push(s1);
s1 = peg$parseALPHA();
if (s1 === peg$FAILED) {
s1 = peg$parseDIGIT();
if (s1 === peg$FAILED) {
s1 = peg$parseCOMMA();
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s1 = peg$c20;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c21); }
}
if (s1 === peg$FAILED) {
s1 = peg$parsepct_encoded();
}
}
}
}
}
} else {
s0 = peg$FAILED;
}
return s0;
}
function peg$parseparameterValue() {
var s0;
s0 = peg$parsearrayOrObject();
if (s0 === peg$FAILED) {
s0 = peg$parsecommonExpr();
}
return s0;
}
function peg$parsecommonExpr() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parseprimitiveLiteral();
if (s1 === peg$FAILED) {
s1 = peg$parsearrayOrObject();
if (s1 === peg$FAILED) {
s1 = peg$parserootExpr();
if (s1 === peg$FAILED) {
s1 = peg$parsefunctionExpr();
if (s1 === peg$FAILED) {
s1 = peg$parsenegateExpr();
if (s1 === peg$FAILED) {
s1 = peg$parsemethodCallExpr();
if (s1 === peg$FAILED) {
s1 = peg$parseparenExpr();
if (s1 === peg$FAILED) {
s1 = peg$parselistExpr();
if (s1 === peg$FAILED) {
s1 = peg$parsecastExpr();
if (s1 === peg$FAILED) {
s1 = peg$parseisofExpr();
if (s1 === peg$FAILED) {
s1 = peg$parsenotExpr();
if (s1 === peg$FAILED) {
s1 = peg$parsefirstMemberExpr();
}
}
}
}
}
}
}
}
}
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseaddExpr();
if (s2 === peg$FAILED) {
s2 = peg$parsesubExpr();
if (s2 === peg$FAILED) {
s2 = peg$parsemulExpr();
if (s2 === peg$FAILED) {
s2 = peg$parsedivExpr();
if (s2 === peg$FAILED) {
s2 = peg$parsedivbyExpr();
if (s2 === peg$FAILED) {
s2 = peg$parsemodExpr();
}
}
}
}
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
s3 = peg$parseeqExpr();
if (s3 === peg$FAILED) {
s3 = peg$parseneExpr();
if (s3 === peg$FAILED) {
s3 = peg$parseltExpr();
if (s3 === peg$FAILED) {
s3 = peg$parseleExpr();
if (s3 === peg$FAILED) {
s3 = peg$parsegtExpr();
if (s3 === peg$FAILED) {
s3 = peg$parsegeExpr();
if (s3 === peg$FAILED) {
s3 = peg$parsehasExpr();
if (s3 === peg$FAILED) {
s3 = peg$parseinExpr();
}
}
}
}
}
}
}
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseandExpr();
if (s4 === peg$FAILED) {
s4 = peg$parseorExpr();
}
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c22(s1, s2, s3, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parserootExpr() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c23) {
s1 = peg$c23;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c24); }
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = peg$parseodataIdentifier();
if (s3 !== peg$FAILED) {
s4 = peg$parsekeyPredicate();
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 === peg$FAILED) {
s2 = peg$parseodataIdentifier();
}
if (s2 !== peg$FAILED) {
s3 = peg$parsesingleNavigationExpr();
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsefirstMemberExpr() {
var s0, s1, s2, s3, s4;
s0 = peg$parsememberExpr();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseinscopeVariableExpr();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 47) {
s3 = peg$c0;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c1); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parsememberExpr();
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parsememberExpr() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$parsequalifiedEntityTypeName();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 47) {
s3 = peg$c0;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c1); }
}
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 === peg$FAILED) {
s1 = null;
}
if (s1 !== peg$FAILED) {
s2 = peg$parsepropertyPathExpr();
if (s2 === peg$FAILED) {
s2 = peg$parsefunctionExpr();
if (s2 === peg$FAILED) {
s2 = peg$parseannotationExpr();
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c25(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsepropertyPathExpr() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parseodataIdentifier();
if (s1 !== peg$FAILED) {
s2 = peg$parsecollectionNavigationExpr();
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
peg$saved