mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-01-19 12:14:47 +00:00
6454 lines
168 KiB
JavaScript
6454 lines
168 KiB
JavaScript
// @generated by Peggy 5.0.6.
|
|
//
|
|
// https://peggyjs.org/
|
|
|
|
"use strict";
|
|
|
|
|
|
// Collect exec() script paths during parsing (deduplicated)
|
|
// These are reset in the per-parse initializer below
|
|
let execScriptPathsSet;
|
|
let hasDynamicExec;
|
|
|
|
function buildBinaryExpression(head, tail) {
|
|
return tail.reduce((left, [op, right]) => ({
|
|
type: 'BinaryExpression',
|
|
operator: op,
|
|
left,
|
|
right
|
|
}), head);
|
|
}
|
|
|
|
function buildUnaryExpression(operator, argument) {
|
|
return {
|
|
type: 'UnaryExpression',
|
|
operator,
|
|
argument
|
|
};
|
|
}
|
|
|
|
function buildCallExpression(callee, args) {
|
|
// Check if this is an exec() call
|
|
if (callee.type === 'Identifier' && callee.name.toLowerCase() === 'exec') {
|
|
if (args.length > 0 && args[0].type === 'StringLiteral') {
|
|
execScriptPathsSet.add(args[0].value);
|
|
} else {
|
|
hasDynamicExec = true;
|
|
}
|
|
}
|
|
return {
|
|
type: 'CallExpression',
|
|
callee,
|
|
arguments: args
|
|
};
|
|
}
|
|
|
|
function getExecScriptPaths() {
|
|
return Array.from(execScriptPathsSet);
|
|
}
|
|
|
|
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 = {
|
|
Program: peg$parseProgram,
|
|
};
|
|
let peg$startRuleFunction = peg$parseProgram;
|
|
|
|
const peg$c0 = ";";
|
|
const peg$c1 = "package";
|
|
const peg$c2 = "{";
|
|
const peg$c3 = "}";
|
|
const peg$c4 = "function";
|
|
const peg$c5 = "(";
|
|
const peg$c6 = ")";
|
|
const peg$c7 = "::";
|
|
const peg$c8 = ",";
|
|
const peg$c9 = "datablock";
|
|
const peg$c10 = ":";
|
|
const peg$c11 = "new";
|
|
const peg$c12 = "[";
|
|
const peg$c13 = "]";
|
|
const peg$c14 = "=";
|
|
const peg$c15 = ".";
|
|
const peg$c16 = "if";
|
|
const peg$c17 = "else";
|
|
const peg$c18 = "for";
|
|
const peg$c19 = "while";
|
|
const peg$c20 = "do";
|
|
const peg$c21 = "switch$";
|
|
const peg$c22 = "switch";
|
|
const peg$c23 = "case";
|
|
const peg$c24 = "default";
|
|
const peg$c25 = "or";
|
|
const peg$c26 = "return";
|
|
const peg$c27 = "break";
|
|
const peg$c28 = "continue";
|
|
const peg$c29 = "+=";
|
|
const peg$c30 = "-=";
|
|
const peg$c31 = "*=";
|
|
const peg$c32 = "/=";
|
|
const peg$c33 = "%=";
|
|
const peg$c34 = "<<=";
|
|
const peg$c35 = ">>=";
|
|
const peg$c36 = "&=";
|
|
const peg$c37 = "|=";
|
|
const peg$c38 = "^=";
|
|
const peg$c39 = "?";
|
|
const peg$c40 = "||";
|
|
const peg$c41 = "&&";
|
|
const peg$c42 = "|";
|
|
const peg$c43 = "^";
|
|
const peg$c44 = "&";
|
|
const peg$c45 = "==";
|
|
const peg$c46 = "!=";
|
|
const peg$c47 = "<=";
|
|
const peg$c48 = ">=";
|
|
const peg$c49 = "$=";
|
|
const peg$c50 = "!$=";
|
|
const peg$c51 = "@";
|
|
const peg$c52 = "NL";
|
|
const peg$c53 = "TAB";
|
|
const peg$c54 = "SPC";
|
|
const peg$c55 = "<<";
|
|
const peg$c56 = ">>";
|
|
const peg$c57 = "++";
|
|
const peg$c58 = "--";
|
|
const peg$c59 = "*";
|
|
const peg$c60 = "%";
|
|
const peg$c61 = "$";
|
|
const peg$c62 = "parent";
|
|
const peg$c63 = "\"";
|
|
const peg$c64 = "'";
|
|
const peg$c65 = "\\";
|
|
const peg$c66 = "n";
|
|
const peg$c67 = "r";
|
|
const peg$c68 = "t";
|
|
const peg$c69 = "x";
|
|
const peg$c70 = "cr";
|
|
const peg$c71 = "cp";
|
|
const peg$c72 = "co";
|
|
const peg$c73 = "c";
|
|
const peg$c74 = "0";
|
|
const peg$c75 = "-";
|
|
const peg$c76 = "true";
|
|
const peg$c77 = "false";
|
|
const peg$c78 = "//";
|
|
const peg$c79 = "/*";
|
|
const peg$c80 = "*/";
|
|
|
|
const peg$r0 = /^[<>]/;
|
|
const peg$r1 = /^[+\-]/;
|
|
const peg$r2 = /^[%*\/]/;
|
|
const peg$r3 = /^[!\-~]/;
|
|
const peg$r4 = /^[a-zA-Z_]/;
|
|
const peg$r5 = /^[a-zA-Z0-9_]/;
|
|
const peg$r6 = /^[ \t]/;
|
|
const peg$r7 = /^[^"\\\n\r]/;
|
|
const peg$r8 = /^[^'\\\n\r]/;
|
|
const peg$r9 = /^[0-9a-fA-F]/;
|
|
const peg$r10 = /^[0-9]/;
|
|
const peg$r11 = /^[xX]/;
|
|
const peg$r12 = /^[^\n\r]/;
|
|
const peg$r13 = /^[\n\r]/;
|
|
const peg$r14 = /^[ \t\n\r]/;
|
|
|
|
const peg$e0 = peg$literalExpectation(";", false);
|
|
const peg$e1 = peg$literalExpectation("package", false);
|
|
const peg$e2 = peg$literalExpectation("{", false);
|
|
const peg$e3 = peg$literalExpectation("}", false);
|
|
const peg$e4 = peg$literalExpectation("function", false);
|
|
const peg$e5 = peg$literalExpectation("(", false);
|
|
const peg$e6 = peg$literalExpectation(")", false);
|
|
const peg$e7 = peg$literalExpectation("::", false);
|
|
const peg$e8 = peg$literalExpectation(",", false);
|
|
const peg$e9 = peg$literalExpectation("datablock", false);
|
|
const peg$e10 = peg$literalExpectation(":", false);
|
|
const peg$e11 = peg$literalExpectation("new", false);
|
|
const peg$e12 = peg$literalExpectation("[", false);
|
|
const peg$e13 = peg$literalExpectation("]", false);
|
|
const peg$e14 = peg$literalExpectation("=", false);
|
|
const peg$e15 = peg$literalExpectation(".", false);
|
|
const peg$e16 = peg$literalExpectation("if", false);
|
|
const peg$e17 = peg$literalExpectation("else", false);
|
|
const peg$e18 = peg$literalExpectation("for", false);
|
|
const peg$e19 = peg$literalExpectation("while", false);
|
|
const peg$e20 = peg$literalExpectation("do", false);
|
|
const peg$e21 = peg$literalExpectation("switch$", false);
|
|
const peg$e22 = peg$literalExpectation("switch", false);
|
|
const peg$e23 = peg$literalExpectation("case", false);
|
|
const peg$e24 = peg$literalExpectation("default", false);
|
|
const peg$e25 = peg$literalExpectation("or", false);
|
|
const peg$e26 = peg$literalExpectation("return", false);
|
|
const peg$e27 = peg$literalExpectation("break", false);
|
|
const peg$e28 = peg$literalExpectation("continue", false);
|
|
const peg$e29 = peg$literalExpectation("+=", false);
|
|
const peg$e30 = peg$literalExpectation("-=", false);
|
|
const peg$e31 = peg$literalExpectation("*=", false);
|
|
const peg$e32 = peg$literalExpectation("/=", false);
|
|
const peg$e33 = peg$literalExpectation("%=", false);
|
|
const peg$e34 = peg$literalExpectation("<<=", false);
|
|
const peg$e35 = peg$literalExpectation(">>=", false);
|
|
const peg$e36 = peg$literalExpectation("&=", false);
|
|
const peg$e37 = peg$literalExpectation("|=", false);
|
|
const peg$e38 = peg$literalExpectation("^=", false);
|
|
const peg$e39 = peg$literalExpectation("?", false);
|
|
const peg$e40 = peg$literalExpectation("||", false);
|
|
const peg$e41 = peg$literalExpectation("&&", false);
|
|
const peg$e42 = peg$literalExpectation("|", false);
|
|
const peg$e43 = peg$literalExpectation("^", false);
|
|
const peg$e44 = peg$literalExpectation("&", false);
|
|
const peg$e45 = peg$literalExpectation("==", false);
|
|
const peg$e46 = peg$literalExpectation("!=", false);
|
|
const peg$e47 = peg$literalExpectation("<=", false);
|
|
const peg$e48 = peg$literalExpectation(">=", false);
|
|
const peg$e49 = peg$classExpectation(["<", ">"], false, false, false);
|
|
const peg$e50 = peg$literalExpectation("$=", false);
|
|
const peg$e51 = peg$literalExpectation("!$=", false);
|
|
const peg$e52 = peg$literalExpectation("@", false);
|
|
const peg$e53 = peg$literalExpectation("NL", false);
|
|
const peg$e54 = peg$literalExpectation("TAB", false);
|
|
const peg$e55 = peg$literalExpectation("SPC", false);
|
|
const peg$e56 = peg$literalExpectation("<<", false);
|
|
const peg$e57 = peg$literalExpectation(">>", false);
|
|
const peg$e58 = peg$classExpectation(["+", "-"], false, false, false);
|
|
const peg$e59 = peg$classExpectation(["%", "*", "/"], false, false, false);
|
|
const peg$e60 = peg$classExpectation(["!", "-", "~"], false, false, false);
|
|
const peg$e61 = peg$literalExpectation("++", false);
|
|
const peg$e62 = peg$literalExpectation("--", false);
|
|
const peg$e63 = peg$literalExpectation("*", false);
|
|
const peg$e64 = peg$literalExpectation("%", false);
|
|
const peg$e65 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false, false);
|
|
const peg$e66 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false, false);
|
|
const peg$e67 = peg$literalExpectation("$", false);
|
|
const peg$e68 = peg$literalExpectation("parent", false);
|
|
const peg$e69 = peg$classExpectation([" ", "\t"], false, false, false);
|
|
const peg$e70 = peg$literalExpectation("\"", false);
|
|
const peg$e71 = peg$literalExpectation("'", false);
|
|
const peg$e72 = peg$literalExpectation("\\", false);
|
|
const peg$e73 = peg$classExpectation(["\"", "\\", "\n", "\r"], true, false, false);
|
|
const peg$e74 = peg$classExpectation(["'", "\\", "\n", "\r"], true, false, false);
|
|
const peg$e75 = peg$literalExpectation("n", false);
|
|
const peg$e76 = peg$literalExpectation("r", false);
|
|
const peg$e77 = peg$literalExpectation("t", false);
|
|
const peg$e78 = peg$literalExpectation("x", false);
|
|
const peg$e79 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false, false);
|
|
const peg$e80 = peg$literalExpectation("cr", false);
|
|
const peg$e81 = peg$literalExpectation("cp", false);
|
|
const peg$e82 = peg$literalExpectation("co", false);
|
|
const peg$e83 = peg$literalExpectation("c", false);
|
|
const peg$e84 = peg$classExpectation([["0", "9"]], false, false, false);
|
|
const peg$e85 = peg$anyExpectation();
|
|
const peg$e86 = peg$literalExpectation("0", false);
|
|
const peg$e87 = peg$classExpectation(["x", "X"], false, false, false);
|
|
const peg$e88 = peg$literalExpectation("-", false);
|
|
const peg$e89 = peg$literalExpectation("true", false);
|
|
const peg$e90 = peg$literalExpectation("false", false);
|
|
const peg$e91 = peg$literalExpectation("//", false);
|
|
const peg$e92 = peg$classExpectation(["\n", "\r"], true, false, false);
|
|
const peg$e93 = peg$classExpectation(["\n", "\r"], false, false, false);
|
|
const peg$e94 = peg$literalExpectation("/*", false);
|
|
const peg$e95 = peg$literalExpectation("*/", false);
|
|
const peg$e96 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false, false);
|
|
|
|
function peg$f0(items) {
|
|
return {
|
|
type: 'Program',
|
|
body: items.map(([item]) => item).filter(Boolean),
|
|
execScriptPaths: getExecScriptPaths(),
|
|
hasDynamicExec
|
|
};
|
|
}
|
|
function peg$f1() { return null; }
|
|
function peg$f2(decl) { return decl; }
|
|
function peg$f3(decl) { return decl; }
|
|
function peg$f4(name, items) {
|
|
return {
|
|
type: 'PackageDeclaration',
|
|
name,
|
|
body: items.map(([item]) => item).filter(Boolean)
|
|
};
|
|
}
|
|
function peg$f5(name, params, body) {
|
|
return {
|
|
type: 'FunctionDeclaration',
|
|
name,
|
|
params: params || [],
|
|
body
|
|
};
|
|
}
|
|
function peg$f6(namespace, method) {
|
|
return { type: 'MethodName', namespace, method };
|
|
}
|
|
function peg$f7(head, tail) {
|
|
return [head, ...tail.map(([,,,id]) => id)];
|
|
}
|
|
function peg$f8(className, instanceName, parent, body) {
|
|
return {
|
|
type: 'DatablockDeclaration',
|
|
className,
|
|
instanceName,
|
|
parent: parent ? parent[2] : null,
|
|
body: body ? body[2].filter(Boolean) : []
|
|
};
|
|
}
|
|
function peg$f9(className, instanceName, body) {
|
|
return {
|
|
type: 'ObjectDeclaration',
|
|
className,
|
|
instanceName,
|
|
body: body ? body[2].filter(Boolean) : []
|
|
};
|
|
}
|
|
function peg$f10(expr) { return expr; }
|
|
function peg$f11(base, accessors) {
|
|
return accessors.reduce((obj, [,,,indices]) => ({
|
|
type: 'IndexExpression',
|
|
object: obj,
|
|
index: indices
|
|
}), base);
|
|
}
|
|
function peg$f12(obj) { return obj; }
|
|
function peg$f13(db) { return db; }
|
|
function peg$f14(target, value) {
|
|
return {
|
|
type: 'Assignment',
|
|
target,
|
|
value
|
|
};
|
|
}
|
|
function peg$f15(base, accessors) {
|
|
return accessors.reduce((obj, accessor) => {
|
|
if (accessor.type === 'property') {
|
|
return {
|
|
type: 'MemberExpression',
|
|
object: obj,
|
|
property: accessor.value
|
|
};
|
|
} else {
|
|
return {
|
|
type: 'IndexExpression',
|
|
object: obj,
|
|
index: accessor.value
|
|
};
|
|
}
|
|
}, base);
|
|
}
|
|
function peg$f16(property) { return { type: 'property', value: property }; }
|
|
function peg$f17(indices) { return { type: 'index', value: indices }; }
|
|
function peg$f18(head, tail) {
|
|
return tail.length > 0 ? [head, ...tail.map(([,,,expr]) => expr)] : head;
|
|
}
|
|
function peg$f19(test, consequent, alternate) {
|
|
return {
|
|
type: 'IfStatement',
|
|
test,
|
|
consequent,
|
|
alternate: alternate ? alternate[3] : null
|
|
};
|
|
}
|
|
function peg$f20(init, test, update, body) {
|
|
return {
|
|
type: 'ForStatement',
|
|
init,
|
|
test,
|
|
update,
|
|
body
|
|
};
|
|
}
|
|
function peg$f21(test, body) {
|
|
return {
|
|
type: 'WhileStatement',
|
|
test,
|
|
body
|
|
};
|
|
}
|
|
function peg$f22(body, test) {
|
|
return {
|
|
type: 'DoWhileStatement',
|
|
test,
|
|
body
|
|
};
|
|
}
|
|
function peg$f23(discriminant, items) {
|
|
return {
|
|
type: 'SwitchStatement',
|
|
stringMode: true,
|
|
discriminant,
|
|
cases: items.map(([item]) => item).filter(i => i && i.type === 'SwitchCase')
|
|
};
|
|
}
|
|
function peg$f24(discriminant, items) {
|
|
return {
|
|
type: 'SwitchStatement',
|
|
stringMode: false,
|
|
discriminant,
|
|
cases: items.map(([item]) => item).filter(i => i && i.type === 'SwitchCase')
|
|
};
|
|
}
|
|
function peg$f25(tests, items) {
|
|
return {
|
|
type: 'SwitchCase',
|
|
test: tests,
|
|
consequent: items.map(([item]) => item).filter(Boolean)
|
|
};
|
|
}
|
|
function peg$f26(items) {
|
|
return {
|
|
type: 'SwitchCase',
|
|
test: null,
|
|
consequent: items.map(([item]) => item).filter(Boolean)
|
|
};
|
|
}
|
|
function peg$f27(head, tail) {
|
|
return tail.length > 0 ? [head, ...tail.map(([,,,expr]) => expr)] : head;
|
|
}
|
|
function peg$f28(value) {
|
|
return {
|
|
type: 'ReturnStatement',
|
|
value: value ? value[1] : null
|
|
};
|
|
}
|
|
function peg$f29() {
|
|
return { type: 'BreakStatement' };
|
|
}
|
|
function peg$f30() {
|
|
return { type: 'ContinueStatement' };
|
|
}
|
|
function peg$f31(expr) {
|
|
return {
|
|
type: 'ExpressionStatement',
|
|
expression: expr
|
|
};
|
|
}
|
|
function peg$f32(items) {
|
|
return {
|
|
type: 'BlockStatement',
|
|
body: items.map(([item]) => item).filter(Boolean)
|
|
};
|
|
}
|
|
function peg$f33(target, operator, value) {
|
|
return {
|
|
type: 'AssignmentExpression',
|
|
operator,
|
|
target,
|
|
value
|
|
};
|
|
}
|
|
function peg$f34(test, consequent, alternate) {
|
|
return {
|
|
type: 'ConditionalExpression',
|
|
test,
|
|
consequent,
|
|
alternate
|
|
};
|
|
}
|
|
function peg$f35(head, tail) {
|
|
return buildBinaryExpression(head, tail.map(([,op,,right]) => [op, right]));
|
|
}
|
|
function peg$f36(head, tail) {
|
|
return buildBinaryExpression(head, tail.map(([,op,,right]) => [op, right]));
|
|
}
|
|
function peg$f37(head, tail) {
|
|
return buildBinaryExpression(head, tail.map(([,op,,,right]) => [op, right]));
|
|
}
|
|
function peg$f38(head, tail) {
|
|
return buildBinaryExpression(head, tail.map(([,op,,right]) => [op, right]));
|
|
}
|
|
function peg$f39(head, tail) {
|
|
return buildBinaryExpression(head, tail.map(([,op,,,right]) => [op, right]));
|
|
}
|
|
function peg$f40(head, tail) {
|
|
return buildBinaryExpression(head, tail.map(([,op,,right]) => [op, right]));
|
|
}
|
|
function peg$f41(head, tail) {
|
|
return buildBinaryExpression(head, tail.map(([,op,,right]) => [op, right]));
|
|
}
|
|
function peg$f42(head, tail) {
|
|
return buildBinaryExpression(head, tail.map(([,op,,right]) => [op, right]));
|
|
}
|
|
function peg$f43(target, assignOp, value) {
|
|
return {
|
|
type: 'AssignmentExpression',
|
|
operator: assignOp,
|
|
target,
|
|
value
|
|
};
|
|
}
|
|
function peg$f44(head, tail) {
|
|
return buildBinaryExpression(head, tail.map(([,op,,right]) => [op, right]));
|
|
}
|
|
function peg$f45(head, tail) {
|
|
return buildBinaryExpression(head, tail.map(([,op,,right]) => [op, right]));
|
|
}
|
|
function peg$f46(head, tail) {
|
|
return buildBinaryExpression(head, tail.map(([,op,,right]) => [op, right]));
|
|
}
|
|
function peg$f47(operator, argument) {
|
|
return buildUnaryExpression(operator, argument);
|
|
}
|
|
function peg$f48(operator, argument) {
|
|
return buildUnaryExpression(operator, argument);
|
|
}
|
|
function peg$f49(argument) {
|
|
return {
|
|
type: 'TagDereferenceExpression',
|
|
argument
|
|
};
|
|
}
|
|
function peg$f50(target, operator, value) {
|
|
return {
|
|
type: 'AssignmentExpression',
|
|
operator,
|
|
target,
|
|
value
|
|
};
|
|
}
|
|
function peg$f51(argument, operator) {
|
|
return {
|
|
type: 'PostfixExpression',
|
|
operator,
|
|
argument
|
|
};
|
|
}
|
|
function peg$f52(base, tail) {
|
|
return tail.reduce((obj, item) => {
|
|
// Check if it's a function call
|
|
if (item[1] === '(') {
|
|
const [,,,argList] = item;
|
|
return buildCallExpression(obj, argList || []);
|
|
}
|
|
// Otherwise it's an accessor
|
|
const accessor = item[1];
|
|
if (accessor.type === 'property') {
|
|
return {
|
|
type: 'MemberExpression',
|
|
object: obj,
|
|
property: accessor.value
|
|
};
|
|
} else {
|
|
return {
|
|
type: 'IndexExpression',
|
|
object: obj,
|
|
index: accessor.value
|
|
};
|
|
}
|
|
}, base);
|
|
}
|
|
function peg$f53(base, accessors) {
|
|
return accessors.reduce((obj, [, accessor]) => {
|
|
if (accessor.type === 'property') {
|
|
return {
|
|
type: 'MemberExpression',
|
|
object: obj,
|
|
property: accessor.value
|
|
};
|
|
} else {
|
|
return {
|
|
type: 'IndexExpression',
|
|
object: obj,
|
|
index: accessor.value
|
|
};
|
|
}
|
|
}, base);
|
|
}
|
|
function peg$f54(head, tail) {
|
|
return [head, ...tail.map(([,,,expr]) => expr)];
|
|
}
|
|
function peg$f55(expr) { return expr; }
|
|
function peg$f56(name) {
|
|
return {
|
|
type: 'Variable',
|
|
scope: 'local',
|
|
name
|
|
};
|
|
}
|
|
function peg$f57(name) {
|
|
return {
|
|
type: 'Variable',
|
|
scope: 'global',
|
|
name
|
|
};
|
|
}
|
|
function peg$f58(name) {
|
|
return {
|
|
type: 'Identifier',
|
|
name: name.replace(/\s+/g, '')
|
|
};
|
|
}
|
|
function peg$f59(name) {
|
|
return {
|
|
type: 'Identifier',
|
|
name
|
|
};
|
|
}
|
|
function peg$f60(name) {
|
|
return {
|
|
type: 'Identifier',
|
|
name
|
|
};
|
|
}
|
|
function peg$f61(chars) {
|
|
return {
|
|
type: 'StringLiteral',
|
|
value: chars.join('')
|
|
};
|
|
}
|
|
function peg$f62(chars) {
|
|
// Single-quoted strings are "tagged" strings in TorqueScript,
|
|
// used for network optimization (string sent once, then only tag ID)
|
|
return {
|
|
type: 'StringLiteral',
|
|
value: chars.join(''),
|
|
tagged: true
|
|
};
|
|
}
|
|
function peg$f63(char) { return char; }
|
|
function peg$f64(char) { return char; }
|
|
function peg$f65() { return "\n"; }
|
|
function peg$f66() { return "\r"; }
|
|
function peg$f67() { return "\t"; }
|
|
function peg$f68(hex) { return String.fromCharCode(parseInt(hex, 16)); }
|
|
function peg$f69() { return String.fromCharCode(0x0F); }
|
|
function peg$f70() { return String.fromCharCode(0x10); }
|
|
function peg$f71() { return String.fromCharCode(0x11); }
|
|
function peg$f72(code) {
|
|
// collapseRemap: \c0-\c9 map to bytes that avoid \t, \n, \r
|
|
const collapseRemap = [0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0B, 0x0C, 0x0E];
|
|
return String.fromCharCode(collapseRemap[parseInt(code, 10)]);
|
|
}
|
|
function peg$f73(char) { return char; }
|
|
function peg$f74(hex) {
|
|
return {
|
|
type: 'NumberLiteral',
|
|
value: parseInt(hex, 16)
|
|
};
|
|
}
|
|
function peg$f75(number) {
|
|
return {
|
|
type: 'NumberLiteral',
|
|
value: parseFloat(number)
|
|
};
|
|
}
|
|
function peg$f76(value) {
|
|
return {
|
|
type: 'BooleanLiteral',
|
|
value: value === "true"
|
|
};
|
|
}
|
|
function peg$f77(text) {
|
|
return {
|
|
type: 'Comment',
|
|
value: text
|
|
};
|
|
}
|
|
function peg$f78(text) {
|
|
return {
|
|
type: 'Comment',
|
|
value: text
|
|
};
|
|
}
|
|
function peg$f79() { return null; }
|
|
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$parseProgram() {
|
|
let s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsews();
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parseComment();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = peg$parseStatement();
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parsews();
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parseComment();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = peg$parseStatement();
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parsews();
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f0(s2);
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseStatement() {
|
|
let s0, s1, s2, s3;
|
|
|
|
s0 = peg$parsePackageDeclaration();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseFunctionDeclaration();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseDatablockStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseObjectStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseIfStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseForStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseDoWhileStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseWhileStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseSwitchStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseReturnStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseBreakStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseContinueStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseExpressionStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseBlockStatement();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseComment();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s2 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
peg$savedPos = s0;
|
|
s0 = peg$f1();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseDatablockStatement() {
|
|
let s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseDatablockDeclaration();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s3 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
s4 = peg$parse_();
|
|
peg$savedPos = s0;
|
|
s0 = peg$f2(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseObjectStatement() {
|
|
let s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseObjectDeclaration();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s3 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
s4 = peg$parse_();
|
|
peg$savedPos = s0;
|
|
s0 = peg$f3(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsePackageDeclaration() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 7) === peg$c1) {
|
|
s1 = peg$c1;
|
|
peg$currPos += 7;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e1); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse__();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseIdentifier();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 123) {
|
|
s5 = peg$c2;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parsews();
|
|
s7 = [];
|
|
s8 = peg$currPos;
|
|
s9 = peg$parseComment();
|
|
if (s9 === peg$FAILED) {
|
|
s9 = peg$parseStatement();
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = peg$parsews();
|
|
s9 = [s9, s10];
|
|
s8 = s9;
|
|
} else {
|
|
peg$currPos = s8;
|
|
s8 = peg$FAILED;
|
|
}
|
|
while (s8 !== peg$FAILED) {
|
|
s7.push(s8);
|
|
s8 = peg$currPos;
|
|
s9 = peg$parseComment();
|
|
if (s9 === peg$FAILED) {
|
|
s9 = peg$parseStatement();
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = peg$parsews();
|
|
s9 = [s9, s10];
|
|
s8 = s9;
|
|
} else {
|
|
peg$currPos = s8;
|
|
s8 = peg$FAILED;
|
|
}
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 125) {
|
|
s8 = peg$c3;
|
|
peg$currPos++;
|
|
} else {
|
|
s8 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
|
}
|
|
if (s8 !== peg$FAILED) {
|
|
s9 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s10 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s10 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s10 === peg$FAILED) {
|
|
s10 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f4(s3, s7);
|
|
} 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;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseFunctionDeclaration() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 8) === peg$c4) {
|
|
s1 = peg$c4;
|
|
peg$currPos += 8;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e4); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse__();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseFunctionName();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s5 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseParameterList();
|
|
if (s7 === peg$FAILED) {
|
|
s7 = null;
|
|
}
|
|
s8 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s9 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = peg$parse_();
|
|
s11 = peg$parseBlockStatement();
|
|
if (s11 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f5(s3, s7, s11);
|
|
} 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;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseFunctionName() {
|
|
let s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseIdentifier();
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c7) {
|
|
s2 = peg$c7;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseIdentifier();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f6(s1, 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$parseIdentifier();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseParameterList() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseIdentifier();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
s5 = peg$c8;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e8); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseIdentifier();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
s5 = peg$c8;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e8); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseIdentifier();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f7(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseDatablockDeclaration() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 9) === peg$c9) {
|
|
s1 = peg$c9;
|
|
peg$currPos += 9;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e9); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse__();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseIdentifier();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s5 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseObjectName();
|
|
if (s7 === peg$FAILED) {
|
|
s7 = null;
|
|
}
|
|
s8 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s9 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = peg$parse_();
|
|
s11 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
s12 = peg$c10;
|
|
peg$currPos++;
|
|
} else {
|
|
s12 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e10); }
|
|
}
|
|
if (s12 !== peg$FAILED) {
|
|
s13 = peg$parse_();
|
|
s14 = peg$parseIdentifier();
|
|
if (s14 !== peg$FAILED) {
|
|
s12 = [s12, s13, s14];
|
|
s11 = s12;
|
|
} else {
|
|
peg$currPos = s11;
|
|
s11 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s11;
|
|
s11 = peg$FAILED;
|
|
}
|
|
if (s11 === peg$FAILED) {
|
|
s11 = null;
|
|
}
|
|
s12 = peg$parse_();
|
|
s13 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 123) {
|
|
s14 = peg$c2;
|
|
peg$currPos++;
|
|
} else {
|
|
s14 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
}
|
|
if (s14 !== peg$FAILED) {
|
|
s15 = peg$parse_();
|
|
s16 = [];
|
|
s17 = peg$parseObjectBody();
|
|
while (s17 !== peg$FAILED) {
|
|
s16.push(s17);
|
|
s17 = peg$parseObjectBody();
|
|
}
|
|
s17 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 125) {
|
|
s18 = peg$c3;
|
|
peg$currPos++;
|
|
} else {
|
|
s18 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
|
}
|
|
if (s18 !== peg$FAILED) {
|
|
s19 = peg$parse_();
|
|
s14 = [s14, s15, s16, s17, s18, s19];
|
|
s13 = s14;
|
|
} else {
|
|
peg$currPos = s13;
|
|
s13 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s13;
|
|
s13 = peg$FAILED;
|
|
}
|
|
if (s13 === peg$FAILED) {
|
|
s13 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f8(s3, s7, s11, s13);
|
|
} 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;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseObjectDeclaration() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 3) === peg$c11) {
|
|
s1 = peg$c11;
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e11); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse__();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseClassNameExpression();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s5 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseObjectName();
|
|
if (s7 === peg$FAILED) {
|
|
s7 = null;
|
|
}
|
|
s8 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s9 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = peg$parse_();
|
|
s11 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 123) {
|
|
s12 = peg$c2;
|
|
peg$currPos++;
|
|
} else {
|
|
s12 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
}
|
|
if (s12 !== peg$FAILED) {
|
|
s13 = peg$parse_();
|
|
s14 = [];
|
|
s15 = peg$parseObjectBody();
|
|
while (s15 !== peg$FAILED) {
|
|
s14.push(s15);
|
|
s15 = peg$parseObjectBody();
|
|
}
|
|
s15 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 125) {
|
|
s16 = peg$c3;
|
|
peg$currPos++;
|
|
} else {
|
|
s16 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
|
}
|
|
if (s16 !== peg$FAILED) {
|
|
s17 = peg$parse_();
|
|
s12 = [s12, s13, s14, s15, s16, s17];
|
|
s11 = s12;
|
|
} else {
|
|
peg$currPos = s11;
|
|
s11 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s11;
|
|
s11 = peg$FAILED;
|
|
}
|
|
if (s11 === peg$FAILED) {
|
|
s11 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f9(s3, s7, s11);
|
|
} 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;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseClassNameExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s1 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
s3 = peg$parseAssignmentExpression();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s5 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f10(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseIdentifier();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 91) {
|
|
s5 = peg$c12;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e12); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseIndexList();
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 93) {
|
|
s9 = peg$c13;
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e13); }
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7, s8, s9];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 91) {
|
|
s5 = peg$c12;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e12); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseIndexList();
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 93) {
|
|
s9 = peg$c13;
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e13); }
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7, s8, s9];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f11(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseObjectBody() {
|
|
let s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseObjectDeclaration();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s3 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
s4 = peg$parse_();
|
|
peg$savedPos = s0;
|
|
s0 = peg$f12(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseDatablockDeclaration();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s3 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
s4 = peg$parse_();
|
|
peg$savedPos = s0;
|
|
s0 = peg$f13(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseAssignment();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseComment();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseWhitespace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseObjectName() {
|
|
let s0;
|
|
|
|
s0 = peg$parseStringConcatExpression();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseIdentifier();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseNumberLiteral();
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseAssignment() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parse_();
|
|
s2 = peg$parseLeftHandSide();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 61) {
|
|
s4 = peg$c14;
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e14); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parse_();
|
|
s6 = peg$parseAssignmentExpression();
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s8 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s8 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s8 === peg$FAILED) {
|
|
s8 = null;
|
|
}
|
|
s9 = peg$parse_();
|
|
peg$savedPos = s0;
|
|
s0 = peg$f14(s2, s6);
|
|
} 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$parseLeftHandSide() {
|
|
let s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseCallExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$parseAccessor();
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$parseAccessor();
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f15(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseAccessor() {
|
|
let s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
s1 = peg$c15;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e15); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
s3 = peg$parseIdentifier();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f16(s3);
|
|
} 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) === 91) {
|
|
s1 = peg$c12;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e12); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
s3 = peg$parseIndexList();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 93) {
|
|
s5 = peg$c13;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e13); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f17(s3);
|
|
} 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$parseIndexList() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseAssignmentExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
s5 = peg$c8;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e8); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseAssignmentExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
s5 = peg$c8;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e8); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseAssignmentExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f18(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseIfStatement() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c16) {
|
|
s1 = peg$c16;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e16); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s3 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAssignmentExpression();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s7 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parse_();
|
|
s9 = peg$parseStatement();
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = peg$currPos;
|
|
s11 = peg$parse_();
|
|
if (input.substr(peg$currPos, 4) === peg$c17) {
|
|
s12 = peg$c17;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s12 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e17); }
|
|
}
|
|
if (s12 !== peg$FAILED) {
|
|
s13 = peg$parse_();
|
|
s14 = peg$parseStatement();
|
|
if (s14 !== peg$FAILED) {
|
|
s11 = [s11, s12, s13, s14];
|
|
s10 = s11;
|
|
} else {
|
|
peg$currPos = s10;
|
|
s10 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s10;
|
|
s10 = peg$FAILED;
|
|
}
|
|
if (s10 === peg$FAILED) {
|
|
s10 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f19(s5, s9, 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;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseForStatement() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 3) === peg$c18) {
|
|
s1 = peg$c18;
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e18); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s3 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAssignmentExpression();
|
|
if (s5 === peg$FAILED) {
|
|
s5 = null;
|
|
}
|
|
s6 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s7 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parse_();
|
|
s9 = peg$parseAssignmentExpression();
|
|
if (s9 === peg$FAILED) {
|
|
s9 = null;
|
|
}
|
|
s10 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s11 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s11 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s11 !== peg$FAILED) {
|
|
s12 = peg$parse_();
|
|
s13 = peg$parseAssignmentExpression();
|
|
if (s13 === peg$FAILED) {
|
|
s13 = null;
|
|
}
|
|
s14 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s15 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s15 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s15 !== peg$FAILED) {
|
|
s16 = peg$parse_();
|
|
s17 = peg$parseStatement();
|
|
if (s17 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f20(s5, s9, s13, s17);
|
|
} 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;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseWhileStatement() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 5) === peg$c19) {
|
|
s1 = peg$c19;
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e19); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s3 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAssignmentExpression();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s7 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parse_();
|
|
s9 = peg$parseStatement();
|
|
if (s9 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f21(s5, s9);
|
|
} 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;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseDoWhileStatement() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c20) {
|
|
s1 = peg$c20;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e20); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
s3 = peg$parseStatement();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (input.substr(peg$currPos, 5) === peg$c19) {
|
|
s5 = peg$c19;
|
|
peg$currPos += 5;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e19); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s7 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parse_();
|
|
s9 = peg$parseAssignmentExpression();
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s11 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s11 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s11 !== peg$FAILED) {
|
|
s12 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s13 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s13 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s13 === peg$FAILED) {
|
|
s13 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f22(s3, s9);
|
|
} 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;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseSwitchStatement() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 7) === peg$c21) {
|
|
s1 = peg$c21;
|
|
peg$currPos += 7;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e21); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s3 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAssignmentExpression();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s7 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 123) {
|
|
s9 = peg$c2;
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = peg$parsews();
|
|
s11 = [];
|
|
s12 = peg$currPos;
|
|
s13 = peg$parseComment();
|
|
if (s13 === peg$FAILED) {
|
|
s13 = peg$parseSwitchCase();
|
|
}
|
|
if (s13 !== peg$FAILED) {
|
|
s14 = peg$parsews();
|
|
s13 = [s13, s14];
|
|
s12 = s13;
|
|
} else {
|
|
peg$currPos = s12;
|
|
s12 = peg$FAILED;
|
|
}
|
|
while (s12 !== peg$FAILED) {
|
|
s11.push(s12);
|
|
s12 = peg$currPos;
|
|
s13 = peg$parseComment();
|
|
if (s13 === peg$FAILED) {
|
|
s13 = peg$parseSwitchCase();
|
|
}
|
|
if (s13 !== peg$FAILED) {
|
|
s14 = peg$parsews();
|
|
s13 = [s13, s14];
|
|
s12 = s13;
|
|
} else {
|
|
peg$currPos = s12;
|
|
s12 = peg$FAILED;
|
|
}
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 125) {
|
|
s12 = peg$c3;
|
|
peg$currPos++;
|
|
} else {
|
|
s12 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
|
}
|
|
if (s12 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f23(s5, s11);
|
|
} 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;
|
|
if (input.substr(peg$currPos, 6) === peg$c22) {
|
|
s1 = peg$c22;
|
|
peg$currPos += 6;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e22); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s3 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAssignmentExpression();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s7 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 123) {
|
|
s9 = peg$c2;
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = peg$parsews();
|
|
s11 = [];
|
|
s12 = peg$currPos;
|
|
s13 = peg$parseComment();
|
|
if (s13 === peg$FAILED) {
|
|
s13 = peg$parseSwitchCase();
|
|
}
|
|
if (s13 !== peg$FAILED) {
|
|
s14 = peg$parsews();
|
|
s13 = [s13, s14];
|
|
s12 = s13;
|
|
} else {
|
|
peg$currPos = s12;
|
|
s12 = peg$FAILED;
|
|
}
|
|
while (s12 !== peg$FAILED) {
|
|
s11.push(s12);
|
|
s12 = peg$currPos;
|
|
s13 = peg$parseComment();
|
|
if (s13 === peg$FAILED) {
|
|
s13 = peg$parseSwitchCase();
|
|
}
|
|
if (s13 !== peg$FAILED) {
|
|
s14 = peg$parsews();
|
|
s13 = [s13, s14];
|
|
s12 = s13;
|
|
} else {
|
|
peg$currPos = s12;
|
|
s12 = peg$FAILED;
|
|
}
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 125) {
|
|
s12 = peg$c3;
|
|
peg$currPos++;
|
|
} else {
|
|
s12 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
|
}
|
|
if (s12 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f24(s5, s11);
|
|
} 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;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseSwitchCase() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4) === peg$c23) {
|
|
s1 = peg$c23;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e23); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse__();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseCaseTestList();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
s5 = peg$c10;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e10); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parsews();
|
|
s7 = [];
|
|
s8 = peg$currPos;
|
|
s9 = peg$parseComment();
|
|
if (s9 === peg$FAILED) {
|
|
s9 = peg$parseStatement();
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = peg$parsews();
|
|
s9 = [s9, s10];
|
|
s8 = s9;
|
|
} else {
|
|
peg$currPos = s8;
|
|
s8 = peg$FAILED;
|
|
}
|
|
while (s8 !== peg$FAILED) {
|
|
s7.push(s8);
|
|
s8 = peg$currPos;
|
|
s9 = peg$parseComment();
|
|
if (s9 === peg$FAILED) {
|
|
s9 = peg$parseStatement();
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = peg$parsews();
|
|
s9 = [s9, s10];
|
|
s8 = s9;
|
|
} else {
|
|
peg$currPos = s8;
|
|
s8 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f25(s3, s7);
|
|
} 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;
|
|
if (input.substr(peg$currPos, 7) === peg$c24) {
|
|
s1 = peg$c24;
|
|
peg$currPos += 7;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e24); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
s3 = peg$c10;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e10); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsews();
|
|
s5 = [];
|
|
s6 = peg$currPos;
|
|
s7 = peg$parseComment();
|
|
if (s7 === peg$FAILED) {
|
|
s7 = peg$parseStatement();
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parsews();
|
|
s7 = [s7, s8];
|
|
s6 = s7;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
while (s6 !== peg$FAILED) {
|
|
s5.push(s6);
|
|
s6 = peg$currPos;
|
|
s7 = peg$parseComment();
|
|
if (s7 === peg$FAILED) {
|
|
s7 = peg$parseStatement();
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parsews();
|
|
s7 = [s7, s8];
|
|
s6 = s7;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f26(s5);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseCaseTestList() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseAdditiveExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.substr(peg$currPos, 2) === peg$c25) {
|
|
s5 = peg$c25;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e25); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse__();
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parseAdditiveExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.substr(peg$currPos, 2) === peg$c25) {
|
|
s5 = peg$c25;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e25); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse__();
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parseAdditiveExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f27(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseReturnStatement() {
|
|
let s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 6) === peg$c26) {
|
|
s1 = peg$c26;
|
|
peg$currPos += 6;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e26); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
s3 = peg$parse__();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseAssignmentExpression();
|
|
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;
|
|
}
|
|
s3 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s4 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f28(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseBreakStatement() {
|
|
let s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 5) === peg$c27) {
|
|
s1 = peg$c27;
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e27); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s3 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f29();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseContinueStatement() {
|
|
let s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 8) === peg$c28) {
|
|
s1 = peg$c28;
|
|
peg$currPos += 8;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e28); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s3 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f30();
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseExpressionStatement() {
|
|
let s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseAssignmentExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 59) {
|
|
s3 = peg$c0;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e0); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f31(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseBlockStatement() {
|
|
let s0, s1, s2, s3, s4, s5, s6;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 123) {
|
|
s1 = peg$c2;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsews();
|
|
s3 = [];
|
|
s4 = peg$currPos;
|
|
s5 = peg$parseComment();
|
|
if (s5 === peg$FAILED) {
|
|
s5 = peg$parseStatement();
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parsews();
|
|
s5 = [s5, s6];
|
|
s4 = s5;
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$currPos;
|
|
s5 = peg$parseComment();
|
|
if (s5 === peg$FAILED) {
|
|
s5 = peg$parseStatement();
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parsews();
|
|
s5 = [s5, s6];
|
|
s4 = s5;
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 125) {
|
|
s4 = peg$c3;
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f32(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseAssignmentExpression() {
|
|
let s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseLeftHandSide();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
s3 = peg$parseAssignmentOperator();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAssignmentExpression();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f33(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$parseConditionalExpression();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseAssignmentOperator() {
|
|
let s0;
|
|
|
|
if (input.charCodeAt(peg$currPos) === 61) {
|
|
s0 = peg$c14;
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e14); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c29) {
|
|
s0 = peg$c29;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e29); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c30) {
|
|
s0 = peg$c30;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e30); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c31) {
|
|
s0 = peg$c31;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e31); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c32) {
|
|
s0 = peg$c32;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e32); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c33) {
|
|
s0 = peg$c33;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e33); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3) === peg$c34) {
|
|
s0 = peg$c34;
|
|
peg$currPos += 3;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e34); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3) === peg$c35) {
|
|
s0 = peg$c35;
|
|
peg$currPos += 3;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e35); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c36) {
|
|
s0 = peg$c36;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e36); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c37) {
|
|
s0 = peg$c37;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e37); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c38) {
|
|
s0 = peg$c38;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e38); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseConditionalExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseLogicalOrExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 63) {
|
|
s3 = peg$c39;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e39); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAssignmentExpression();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
s7 = peg$c10;
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e10); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parse_();
|
|
s9 = peg$parseAssignmentExpression();
|
|
if (s9 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f34(s1, s5, s9);
|
|
} 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$parseLogicalOrExpression();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseLogicalOrExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseLogicalAndExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.substr(peg$currPos, 2) === peg$c40) {
|
|
s5 = peg$c40;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e40); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseLogicalAndExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.substr(peg$currPos, 2) === peg$c40) {
|
|
s5 = peg$c40;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e40); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseLogicalAndExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f35(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseLogicalAndExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseBitwiseOrExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.substr(peg$currPos, 2) === peg$c41) {
|
|
s5 = peg$c41;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e41); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseBitwiseOrExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.substr(peg$currPos, 2) === peg$c41) {
|
|
s5 = peg$c41;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e41); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseBitwiseOrExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f36(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseBitwiseOrExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseBitwiseXorExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 124) {
|
|
s5 = peg$c42;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e42); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$currPos;
|
|
peg$silentFails++;
|
|
if (input.charCodeAt(peg$currPos) === 124) {
|
|
s7 = peg$c42;
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e42); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s7 === peg$FAILED) {
|
|
s6 = undefined;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parse_();
|
|
s8 = peg$parseBitwiseXorExpression();
|
|
if (s8 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7, s8];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 124) {
|
|
s5 = peg$c42;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e42); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$currPos;
|
|
peg$silentFails++;
|
|
if (input.charCodeAt(peg$currPos) === 124) {
|
|
s7 = peg$c42;
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e42); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s7 === peg$FAILED) {
|
|
s6 = undefined;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parse_();
|
|
s8 = peg$parseBitwiseXorExpression();
|
|
if (s8 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7, s8];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f37(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseBitwiseXorExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseBitwiseAndExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 94) {
|
|
s5 = peg$c43;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e43); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseBitwiseAndExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 94) {
|
|
s5 = peg$c43;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e43); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseBitwiseAndExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f38(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseBitwiseAndExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseEqualityExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 38) {
|
|
s5 = peg$c44;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e44); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$currPos;
|
|
peg$silentFails++;
|
|
if (input.charCodeAt(peg$currPos) === 38) {
|
|
s7 = peg$c44;
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e44); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s7 === peg$FAILED) {
|
|
s6 = undefined;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parse_();
|
|
s8 = peg$parseEqualityExpression();
|
|
if (s8 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7, s8];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 38) {
|
|
s5 = peg$c44;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e44); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$currPos;
|
|
peg$silentFails++;
|
|
if (input.charCodeAt(peg$currPos) === 38) {
|
|
s7 = peg$c44;
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e44); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s7 === peg$FAILED) {
|
|
s6 = undefined;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parse_();
|
|
s8 = peg$parseEqualityExpression();
|
|
if (s8 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7, s8];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f39(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseEqualityExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseRelationalExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseEqualityOperator();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseRelationalExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseEqualityOperator();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseRelationalExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f40(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseEqualityOperator() {
|
|
let s0;
|
|
|
|
if (input.substr(peg$currPos, 2) === peg$c45) {
|
|
s0 = peg$c45;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e45); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c46) {
|
|
s0 = peg$c46;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e46); }
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseRelationalExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseStringConcatExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseRelationalOperator();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseStringConcatExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseRelationalOperator();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseStringConcatExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f41(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseRelationalOperator() {
|
|
let s0;
|
|
|
|
if (input.substr(peg$currPos, 2) === peg$c47) {
|
|
s0 = peg$c47;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e47); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c48) {
|
|
s0 = peg$c48;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e48); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = input.charAt(peg$currPos);
|
|
if (peg$r0.test(s0)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e49); }
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseStringConcatExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseShiftExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseStringConcatOperator();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseStringConcatRightSide();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseStringConcatOperator();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseStringConcatRightSide();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f42(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseStringConcatRightSide() {
|
|
let s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseLeftHandSide();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
s3 = peg$parseAssignmentOperator();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAssignmentExpression();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f43(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$parseShiftExpression();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseStringConcatOperator() {
|
|
let s0;
|
|
|
|
if (input.substr(peg$currPos, 2) === peg$c49) {
|
|
s0 = peg$c49;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e50); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3) === peg$c50) {
|
|
s0 = peg$c50;
|
|
peg$currPos += 3;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e51); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 64) {
|
|
s0 = peg$c51;
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e52); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c52) {
|
|
s0 = peg$c52;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e53); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3) === peg$c53) {
|
|
s0 = peg$c53;
|
|
peg$currPos += 3;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e54); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3) === peg$c54) {
|
|
s0 = peg$c54;
|
|
peg$currPos += 3;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e55); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseShiftExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseAdditiveExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseShiftOperator();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseAdditiveExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseShiftOperator();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseAdditiveExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f44(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseShiftOperator() {
|
|
let s0;
|
|
|
|
if (input.substr(peg$currPos, 2) === peg$c55) {
|
|
s0 = peg$c55;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e56); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c56) {
|
|
s0 = peg$c56;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e57); }
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseAdditiveExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseMultiplicativeExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r1.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e58); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseMultiplicativeExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r1.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e58); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseMultiplicativeExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f45(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseMultiplicativeExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseUnaryExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r2.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e59); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseUnaryExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r2.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e59); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseUnaryExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f46(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseUnaryExpression() {
|
|
let s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = input.charAt(peg$currPos);
|
|
if (peg$r3.test(s1)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e60); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
s3 = peg$parseUnaryOperand();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f47(s1, s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c57) {
|
|
s1 = peg$c57;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e61); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c58) {
|
|
s1 = peg$c58;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e62); }
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
s3 = peg$parseUnaryOperand();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f48(s1, s3);
|
|
} 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) === 42) {
|
|
s1 = peg$c59;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e63); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
s3 = peg$parseUnaryOperand();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f49(s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsePostfixExpression();
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseUnaryOperand() {
|
|
let s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseLeftHandSide();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
s3 = peg$parseAssignmentOperator();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAssignmentExpression();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f50(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$parseUnaryExpression();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsePostfixExpression() {
|
|
let s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseCallExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
if (input.substr(peg$currPos, 2) === peg$c57) {
|
|
s3 = peg$c57;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e61); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c58) {
|
|
s3 = peg$c58;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e62); }
|
|
}
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f51(s1, s3);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseCallExpression();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseCallExpression() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseMemberExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s5 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseArgumentList();
|
|
if (s7 === peg$FAILED) {
|
|
s7 = null;
|
|
}
|
|
s8 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s9 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7, s8, s9];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAccessor();
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s5 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseArgumentList();
|
|
if (s7 === peg$FAILED) {
|
|
s7 = null;
|
|
}
|
|
s8 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s9 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7, s8, s9];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAccessor();
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f52(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseMemberExpression() {
|
|
let s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsePrimaryExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAccessor();
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
s5 = peg$parseAccessor();
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f53(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseArgumentList() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseAssignmentExpression();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
s5 = peg$c8;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e8); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseAssignmentExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
s5 = peg$c8;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e8); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parse_();
|
|
s7 = peg$parseAssignmentExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f54(s1, s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsePrimaryExpression() {
|
|
let s0;
|
|
|
|
s0 = peg$parseObjectDeclaration();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseDatablockDeclaration();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseStringLiteral();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseNumberLiteral();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseBooleanLiteral();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseVariable();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseParenthesizedExpression();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseParenthesizedExpression() {
|
|
let s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 40) {
|
|
s1 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parse_();
|
|
s3 = peg$parseAssignmentExpression();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parse_();
|
|
if (input.charCodeAt(peg$currPos) === 41) {
|
|
s5 = peg$c6;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f55(s3);
|
|
} 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$parseVariable() {
|
|
let s0;
|
|
|
|
s0 = peg$parseLocalVariable();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseGlobalVariable();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsePlainIdentifier();
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseLocalVariable() {
|
|
let s0, s1, s2, s3, s4, s5, s6;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 37) {
|
|
s1 = peg$c60;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e64); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
s3 = peg$currPos;
|
|
s4 = input.charAt(peg$currPos);
|
|
if (peg$r4.test(s4)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = [];
|
|
s6 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s6)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
while (s6 !== peg$FAILED) {
|
|
s5.push(s6);
|
|
s6 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s6)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
}
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s2 = input.substring(s2, peg$currPos);
|
|
} else {
|
|
s2 = s3;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f56(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseGlobalVariable() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 36) {
|
|
s1 = peg$c61;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e67); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
s3 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c7) {
|
|
s4 = peg$c7;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
|
}
|
|
if (s4 === peg$FAILED) {
|
|
s4 = null;
|
|
}
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r4.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = [];
|
|
s7 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s7)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
while (s7 !== peg$FAILED) {
|
|
s6.push(s7);
|
|
s7 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s7)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
}
|
|
s7 = [];
|
|
s8 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c7) {
|
|
s9 = peg$c7;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = input.charAt(peg$currPos);
|
|
if (peg$r4.test(s10)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s10 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s10 !== peg$FAILED) {
|
|
s11 = [];
|
|
s12 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s12)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s12 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
while (s12 !== peg$FAILED) {
|
|
s11.push(s12);
|
|
s12 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s12)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s12 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
}
|
|
s9 = [s9, s10, s11];
|
|
s8 = s9;
|
|
} else {
|
|
peg$currPos = s8;
|
|
s8 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s8;
|
|
s8 = peg$FAILED;
|
|
}
|
|
while (s8 !== peg$FAILED) {
|
|
s7.push(s8);
|
|
s8 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c7) {
|
|
s9 = peg$c7;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
|
}
|
|
if (s9 !== peg$FAILED) {
|
|
s10 = input.charAt(peg$currPos);
|
|
if (peg$r4.test(s10)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s10 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s10 !== peg$FAILED) {
|
|
s11 = [];
|
|
s12 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s12)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s12 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
while (s12 !== peg$FAILED) {
|
|
s11.push(s12);
|
|
s12 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s12)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s12 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
}
|
|
s9 = [s9, s10, s11];
|
|
s8 = s9;
|
|
} else {
|
|
peg$currPos = s8;
|
|
s8 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s8;
|
|
s8 = peg$FAILED;
|
|
}
|
|
}
|
|
s4 = [s4, s5, s6, s7];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s2 = input.substring(s2, peg$currPos);
|
|
} else {
|
|
s2 = s3;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f57(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsePlainIdentifier() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
s2 = peg$currPos;
|
|
if (input.substr(peg$currPos, 6) === peg$c62) {
|
|
s3 = peg$c62;
|
|
peg$currPos += 6;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e68); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = [];
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r6.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e69); }
|
|
}
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r6.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e69); }
|
|
}
|
|
}
|
|
if (input.substr(peg$currPos, 2) === peg$c7) {
|
|
s5 = peg$c7;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = [];
|
|
s7 = input.charAt(peg$currPos);
|
|
if (peg$r6.test(s7)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e69); }
|
|
}
|
|
while (s7 !== peg$FAILED) {
|
|
s6.push(s7);
|
|
s7 = input.charAt(peg$currPos);
|
|
if (peg$r6.test(s7)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e69); }
|
|
}
|
|
}
|
|
s7 = input.charAt(peg$currPos);
|
|
if (peg$r4.test(s7)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = [];
|
|
s9 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s9)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
while (s9 !== peg$FAILED) {
|
|
s8.push(s9);
|
|
s9 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s9)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
}
|
|
s3 = [s3, s4, s5, s6, s7, s8];
|
|
s2 = s3;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = input.substring(s1, peg$currPos);
|
|
} else {
|
|
s1 = s2;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f58(s1);
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
s2 = peg$currPos;
|
|
if (input.substr(peg$currPos, 6) === peg$c62) {
|
|
s3 = peg$c62;
|
|
peg$currPos += 6;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e68); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = [];
|
|
s5 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c7) {
|
|
s6 = peg$c7;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = input.charAt(peg$currPos);
|
|
if (peg$r4.test(s7)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = [];
|
|
s9 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s9)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
while (s9 !== peg$FAILED) {
|
|
s8.push(s9);
|
|
s9 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s9)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
}
|
|
s6 = [s6, s7, s8];
|
|
s5 = s6;
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
s5 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c7) {
|
|
s6 = peg$c7;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = input.charAt(peg$currPos);
|
|
if (peg$r4.test(s7)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = [];
|
|
s9 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s9)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
while (s9 !== peg$FAILED) {
|
|
s8.push(s9);
|
|
s9 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s9)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s9 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
}
|
|
s6 = [s6, s7, s8];
|
|
s5 = s6;
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
}
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
}
|
|
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) {
|
|
s1 = input.substring(s1, peg$currPos);
|
|
} else {
|
|
s1 = s2;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f59(s1);
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
s2 = peg$currPos;
|
|
s3 = input.charAt(peg$currPos);
|
|
if (peg$r4.test(s3)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = [];
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
}
|
|
s5 = [];
|
|
s6 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c7) {
|
|
s7 = peg$c7;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = input.charAt(peg$currPos);
|
|
if (peg$r4.test(s8)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s8 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s8 !== peg$FAILED) {
|
|
s9 = [];
|
|
s10 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s10)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s10 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
while (s10 !== peg$FAILED) {
|
|
s9.push(s10);
|
|
s10 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s10)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s10 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
}
|
|
s7 = [s7, s8, s9];
|
|
s6 = s7;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
while (s6 !== peg$FAILED) {
|
|
s5.push(s6);
|
|
s6 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c7) {
|
|
s7 = peg$c7;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e7); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = input.charAt(peg$currPos);
|
|
if (peg$r4.test(s8)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s8 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e65); }
|
|
}
|
|
if (s8 !== peg$FAILED) {
|
|
s9 = [];
|
|
s10 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s10)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s10 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
while (s10 !== peg$FAILED) {
|
|
s9.push(s10);
|
|
s10 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s10)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s10 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
}
|
|
s7 = [s7, s8, s9];
|
|
s6 = s7;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
}
|
|
s3 = [s3, s4, s5];
|
|
s2 = s3;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = input.substring(s1, peg$currPos);
|
|
} else {
|
|
s1 = s2;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f60(s1);
|
|
}
|
|
s0 = s1;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseIdentifier() {
|
|
let s0;
|
|
|
|
s0 = peg$parseLocalVariable();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseGlobalVariable();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsePlainIdentifier();
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseStringLiteral() {
|
|
let s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
s1 = peg$c63;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e70); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$parseDoubleQuotedChar();
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$parseDoubleQuotedChar();
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
s3 = peg$c63;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e70); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f61(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 39) {
|
|
s1 = peg$c64;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e71); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$parseSingleQuotedChar();
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$parseSingleQuotedChar();
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 39) {
|
|
s3 = peg$c64;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e71); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f62(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseDoubleQuotedChar() {
|
|
let s0, s1, s2;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 92) {
|
|
s1 = peg$c65;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e72); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseEscapeSequence();
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f63(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = input.charAt(peg$currPos);
|
|
if (peg$r7.test(s0)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e73); }
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseSingleQuotedChar() {
|
|
let s0, s1, s2;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 92) {
|
|
s1 = peg$c65;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e72); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseEscapeSequence();
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f64(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = input.charAt(peg$currPos);
|
|
if (peg$r8.test(s0)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e74); }
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseEscapeSequence() {
|
|
let s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 110) {
|
|
s1 = peg$c66;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e75); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f65();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 114) {
|
|
s1 = peg$c67;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e76); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f66();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 116) {
|
|
s1 = peg$c68;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e77); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f67();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 120) {
|
|
s1 = peg$c69;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e78); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
s3 = peg$currPos;
|
|
s4 = input.charAt(peg$currPos);
|
|
if (peg$r9.test(s4)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e79); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r9.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e79); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s2 = input.substring(s2, peg$currPos);
|
|
} else {
|
|
s2 = s3;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f68(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c70) {
|
|
s1 = peg$c70;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e80); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f69();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c71) {
|
|
s1 = peg$c71;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e81); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f70();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c72) {
|
|
s1 = peg$c72;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e82); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f71();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 99) {
|
|
s1 = peg$c73;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e83); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = input.charAt(peg$currPos);
|
|
if (peg$r10.test(s2)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e84); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f72(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.length > peg$currPos) {
|
|
s1 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e85); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f73(s1);
|
|
}
|
|
s0 = s1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseNumberLiteral() {
|
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
s2 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 48) {
|
|
s3 = peg$c74;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e86); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = input.charAt(peg$currPos);
|
|
if (peg$r11.test(s4)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e87); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = [];
|
|
s6 = input.charAt(peg$currPos);
|
|
if (peg$r9.test(s6)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e79); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
while (s6 !== peg$FAILED) {
|
|
s5.push(s6);
|
|
s6 = input.charAt(peg$currPos);
|
|
if (peg$r9.test(s6)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e79); }
|
|
}
|
|
}
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s3 = [s3, s4, s5];
|
|
s2 = s3;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = input.substring(s1, peg$currPos);
|
|
} else {
|
|
s1 = s2;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
peg$silentFails++;
|
|
s3 = peg$parseIdentifierChar();
|
|
peg$silentFails--;
|
|
if (s3 === peg$FAILED) {
|
|
s2 = undefined;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f74(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
s2 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 45) {
|
|
s3 = peg$c75;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e88); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
s4 = [];
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r10.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e84); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
s5 = input.charAt(peg$currPos);
|
|
if (peg$r10.test(s5)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e84); }
|
|
}
|
|
}
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
s6 = peg$c15;
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e15); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = [];
|
|
s8 = input.charAt(peg$currPos);
|
|
if (peg$r10.test(s8)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s8 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e84); }
|
|
}
|
|
if (s8 !== peg$FAILED) {
|
|
while (s8 !== peg$FAILED) {
|
|
s7.push(s8);
|
|
s8 = input.charAt(peg$currPos);
|
|
if (peg$r10.test(s8)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s8 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e84); }
|
|
}
|
|
}
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s6 = [s6, s7];
|
|
s5 = s6;
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
if (s5 === peg$FAILED) {
|
|
s5 = null;
|
|
}
|
|
s3 = [s3, s4, s5];
|
|
s2 = s3;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 45) {
|
|
s3 = peg$c75;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e88); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
s4 = peg$c15;
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e15); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = [];
|
|
s6 = input.charAt(peg$currPos);
|
|
if (peg$r10.test(s6)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e84); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
while (s6 !== peg$FAILED) {
|
|
s5.push(s6);
|
|
s6 = input.charAt(peg$currPos);
|
|
if (peg$r10.test(s6)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e84); }
|
|
}
|
|
}
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s3 = [s3, s4, s5];
|
|
s2 = s3;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = input.substring(s1, peg$currPos);
|
|
} else {
|
|
s1 = s2;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
peg$silentFails++;
|
|
s3 = peg$parseIdentifierChar();
|
|
peg$silentFails--;
|
|
if (s3 === peg$FAILED) {
|
|
s2 = undefined;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f75(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseBooleanLiteral() {
|
|
let s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4) === peg$c76) {
|
|
s1 = peg$c76;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e89); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 5) === peg$c77) {
|
|
s1 = peg$c77;
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e90); }
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
peg$silentFails++;
|
|
s3 = peg$parseIdentifierChar();
|
|
peg$silentFails--;
|
|
if (s3 === peg$FAILED) {
|
|
s2 = undefined;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f76(s1);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseComment() {
|
|
let s0;
|
|
|
|
s0 = peg$parseSingleLineComment();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseMultiLineComment();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseSingleLineComment() {
|
|
let s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c78) {
|
|
s1 = peg$c78;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e91); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
s3 = [];
|
|
s4 = input.charAt(peg$currPos);
|
|
if (peg$r12.test(s4)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e92); }
|
|
}
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = input.charAt(peg$currPos);
|
|
if (peg$r12.test(s4)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e92); }
|
|
}
|
|
}
|
|
s2 = input.substring(s2, peg$currPos);
|
|
s3 = input.charAt(peg$currPos);
|
|
if (peg$r13.test(s3)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e93); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
peg$savedPos = s0;
|
|
s0 = peg$f77(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseMultiLineComment() {
|
|
let s0, s1, s2, s3, s4, s5, s6;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c79) {
|
|
s1 = peg$c79;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e94); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
s3 = [];
|
|
s4 = peg$currPos;
|
|
s5 = peg$currPos;
|
|
peg$silentFails++;
|
|
if (input.substr(peg$currPos, 2) === peg$c80) {
|
|
s6 = peg$c80;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e95); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s6 === peg$FAILED) {
|
|
s5 = undefined;
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
if (input.length > peg$currPos) {
|
|
s6 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e85); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s5 = [s5, s6];
|
|
s4 = s5;
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$currPos;
|
|
s5 = peg$currPos;
|
|
peg$silentFails++;
|
|
if (input.substr(peg$currPos, 2) === peg$c80) {
|
|
s6 = peg$c80;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e95); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s6 === peg$FAILED) {
|
|
s5 = undefined;
|
|
} else {
|
|
peg$currPos = s5;
|
|
s5 = peg$FAILED;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
if (input.length > peg$currPos) {
|
|
s6 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e85); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s5 = [s5, s6];
|
|
s4 = s5;
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
}
|
|
s2 = input.substring(s2, peg$currPos);
|
|
if (input.substr(peg$currPos, 2) === peg$c80) {
|
|
s3 = peg$c80;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e95); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s0 = peg$f78(s2);
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseWhitespace() {
|
|
let s0, s1, s2;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = input.charAt(peg$currPos);
|
|
if (peg$r14.test(s2)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e96); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = input.charAt(peg$currPos);
|
|
if (peg$r14.test(s2)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e96); }
|
|
}
|
|
}
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$f79();
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parse_() {
|
|
let s0, s1;
|
|
|
|
s0 = [];
|
|
s1 = input.charAt(peg$currPos);
|
|
if (peg$r14.test(s1)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e96); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
s1 = peg$parseSkipComment();
|
|
}
|
|
while (s1 !== peg$FAILED) {
|
|
s0.push(s1);
|
|
s1 = input.charAt(peg$currPos);
|
|
if (peg$r14.test(s1)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e96); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
s1 = peg$parseSkipComment();
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parse__() {
|
|
let s0, s1, s2, s3;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = input.charAt(peg$currPos);
|
|
if (peg$r14.test(s2)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e96); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = input.charAt(peg$currPos);
|
|
if (peg$r14.test(s2)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e96); }
|
|
}
|
|
}
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = input.charAt(peg$currPos);
|
|
if (peg$r14.test(s3)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e96); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = peg$parseSkipComment();
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = input.charAt(peg$currPos);
|
|
if (peg$r14.test(s3)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e96); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = peg$parseSkipComment();
|
|
}
|
|
}
|
|
s1 = [s1, s2];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsews() {
|
|
let s0, s1;
|
|
|
|
s0 = [];
|
|
s1 = input.charAt(peg$currPos);
|
|
if (peg$r14.test(s1)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e96); }
|
|
}
|
|
while (s1 !== peg$FAILED) {
|
|
s0.push(s1);
|
|
s1 = input.charAt(peg$currPos);
|
|
if (peg$r14.test(s1)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e96); }
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseSkipComment() {
|
|
let s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c78) {
|
|
s1 = peg$c78;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e91); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = input.charAt(peg$currPos);
|
|
if (peg$r12.test(s3)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e92); }
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = input.charAt(peg$currPos);
|
|
if (peg$r12.test(s3)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e92); }
|
|
}
|
|
}
|
|
s3 = input.charAt(peg$currPos);
|
|
if (peg$r13.test(s3)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e93); }
|
|
}
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
s1 = [s1, s2, s3];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c79) {
|
|
s1 = peg$c79;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e94); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$currPos;
|
|
peg$silentFails++;
|
|
if (input.substr(peg$currPos, 2) === peg$c80) {
|
|
s5 = peg$c80;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e95); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s5 === peg$FAILED) {
|
|
s4 = undefined;
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.length > peg$currPos) {
|
|
s5 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e85); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$currPos;
|
|
s4 = peg$currPos;
|
|
peg$silentFails++;
|
|
if (input.substr(peg$currPos, 2) === peg$c80) {
|
|
s5 = peg$c80;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e95); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s5 === peg$FAILED) {
|
|
s4 = undefined;
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.length > peg$currPos) {
|
|
s5 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e85); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
if (input.substr(peg$currPos, 2) === peg$c80) {
|
|
s3 = peg$c80;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e95); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s1 = [s1, s2, s3];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseIdentifierChar() {
|
|
let s0;
|
|
|
|
s0 = input.charAt(peg$currPos);
|
|
if (peg$r5.test(s0)) {
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$e66); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
|
|
execScriptPathsSet = new Set();
|
|
hasDynamicExec = false;
|
|
|
|
peg$result = peg$startRuleFunction();
|
|
|
|
const peg$success = (peg$result !== peg$FAILED && peg$currPos === input.length);
|
|
function peg$throw() {
|
|
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
|
peg$fail(peg$endExpectation());
|
|
}
|
|
|
|
throw peg$buildStructuredError(
|
|
peg$maxFailExpected,
|
|
peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null,
|
|
peg$maxFailPos < input.length
|
|
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
|
|
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
|
|
);
|
|
}
|
|
if (options.peg$library) {
|
|
return /** @type {any} */ ({
|
|
peg$result,
|
|
peg$currPos,
|
|
peg$FAILED,
|
|
peg$maxFailExpected,
|
|
peg$maxFailPos,
|
|
peg$success,
|
|
peg$throw: peg$success ? undefined : peg$throw,
|
|
});
|
|
}
|
|
if (peg$success) {
|
|
return peg$result;
|
|
} else {
|
|
peg$throw();
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
StartRules: ["Program"],
|
|
SyntaxError: peg$SyntaxError,
|
|
parse: peg$parse,
|
|
};
|