mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1911 lines
50 KiB
1911 lines
50 KiB
/*
|
|
* Generated by PEG.js 0.10.0.
|
|
*
|
|
* http://pegjs.org/
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
function peg$subclass(child, parent) {
|
|
function ctor() { this.constructor = child; }
|
|
ctor.prototype = parent.prototype;
|
|
child.prototype = new ctor();
|
|
}
|
|
|
|
function peg$SyntaxError(message, expected, found, location) {
|
|
this.message = message;
|
|
this.expected = expected;
|
|
this.found = found;
|
|
this.location = location;
|
|
this.name = "SyntaxError";
|
|
|
|
if (typeof Error.captureStackTrace === "function") {
|
|
Error.captureStackTrace(this, peg$SyntaxError);
|
|
}
|
|
}
|
|
|
|
peg$subclass(peg$SyntaxError, Error);
|
|
|
|
peg$SyntaxError.buildMessage = function(expected, found) {
|
|
var DESCRIBE_EXPECTATION_FNS = {
|
|
literal: function(expectation) {
|
|
return "\"" + literalEscape(expectation.text) + "\"";
|
|
},
|
|
|
|
"class": function(expectation) {
|
|
var escapedParts = "",
|
|
i;
|
|
|
|
for (i = 0; i < expectation.parts.length; i++) {
|
|
escapedParts += expectation.parts[i] instanceof Array
|
|
? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
|
|
: classEscape(expectation.parts[i]);
|
|
}
|
|
|
|
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
|
|
},
|
|
|
|
any: function(expectation) {
|
|
return "any character";
|
|
},
|
|
|
|
end: function(expectation) {
|
|
return "end of input";
|
|
},
|
|
|
|
other: function(expectation) {
|
|
return expectation.description;
|
|
}
|
|
};
|
|
|
|
function hex(ch) {
|
|
return ch.charCodeAt(0).toString(16).toUpperCase();
|
|
}
|
|
|
|
function literalEscape(s) {
|
|
return s
|
|
.replace(/\\/g, '\\\\')
|
|
.replace(/"/g, '\\"')
|
|
.replace(/\0/g, '\\0')
|
|
.replace(/\t/g, '\\t')
|
|
.replace(/\n/g, '\\n')
|
|
.replace(/\r/g, '\\r')
|
|
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
|
|
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
|
|
}
|
|
|
|
function classEscape(s) {
|
|
return s
|
|
.replace(/\\/g, '\\\\')
|
|
.replace(/\]/g, '\\]')
|
|
.replace(/\^/g, '\\^')
|
|
.replace(/-/g, '\\-')
|
|
.replace(/\0/g, '\\0')
|
|
.replace(/\t/g, '\\t')
|
|
.replace(/\n/g, '\\n')
|
|
.replace(/\r/g, '\\r')
|
|
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
|
|
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
|
|
}
|
|
|
|
function describeExpectation(expectation) {
|
|
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
}
|
|
|
|
function describeExpected(expected) {
|
|
var descriptions = new Array(expected.length),
|
|
i, j;
|
|
|
|
for (i = 0; i < expected.length; i++) {
|
|
descriptions[i] = describeExpectation(expected[i]);
|
|
}
|
|
|
|
descriptions.sort();
|
|
|
|
if (descriptions.length > 0) {
|
|
for (i = 1, j = 1; i < descriptions.length; i++) {
|
|
if (descriptions[i - 1] !== descriptions[i]) {
|
|
descriptions[j] = descriptions[i];
|
|
j++;
|
|
}
|
|
}
|
|
descriptions.length = j;
|
|
}
|
|
|
|
switch (descriptions.length) {
|
|
case 1:
|
|
return descriptions[0];
|
|
|
|
case 2:
|
|
return descriptions[0] + " or " + descriptions[1];
|
|
|
|
default:
|
|
return descriptions.slice(0, -1).join(", ")
|
|
+ ", or "
|
|
+ descriptions[descriptions.length - 1];
|
|
}
|
|
}
|
|
|
|
function describeFound(found) {
|
|
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
|
|
}
|
|
|
|
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
|
};
|
|
|
|
function peg$parse(input, options) {
|
|
options = options !== void 0 ? options : {};
|
|
|
|
var peg$FAILED = {},
|
|
|
|
peg$startRuleFunctions = { Start: peg$parseStart },
|
|
peg$startRuleFunction = peg$parseStart,
|
|
|
|
peg$c0 = function(statements) { return [].concat(... statements) },
|
|
peg$c1 = "-",
|
|
peg$c2 = peg$literalExpectation("-", false),
|
|
peg$c3 = function(value) { return value },
|
|
peg$c4 = function(statements) { return Object.assign({}, ... statements) },
|
|
peg$c5 = "#",
|
|
peg$c6 = peg$literalExpectation("#", false),
|
|
peg$c7 = peg$anyExpectation(),
|
|
peg$c8 = function() { return {} },
|
|
peg$c9 = ":",
|
|
peg$c10 = peg$literalExpectation(":", false),
|
|
peg$c11 = function(property, value) { return {[property]: value} },
|
|
peg$c12 = ",",
|
|
peg$c13 = peg$literalExpectation(",", false),
|
|
peg$c14 = function(property, other) { return other },
|
|
peg$c15 = function(property, others, value) { return Object.assign({}, ... [property].concat(others).map(property => ({[property]: value}))) },
|
|
peg$c16 = function(statements) { return statements },
|
|
peg$c17 = function(expression) { return expression },
|
|
peg$c18 = peg$otherExpectation("correct indentation"),
|
|
peg$c19 = " ",
|
|
peg$c20 = peg$literalExpectation(" ", false),
|
|
peg$c21 = function(spaces) { return spaces.length === indentLevel * INDENT_STEP },
|
|
peg$c22 = function(spaces) { return spaces.length === (indentLevel + 1) * INDENT_STEP },
|
|
peg$c23 = function() { indentLevel++; return true },
|
|
peg$c24 = function() { indentLevel--; return true },
|
|
peg$c25 = function() { return text() },
|
|
peg$c26 = peg$otherExpectation("pseudostring"),
|
|
peg$c27 = /^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/,
|
|
peg$c28 = peg$classExpectation(["\r", "\n", "\t", " ", "?", ":", ",", "]", "[", "{", "}", "#", "&", "*", "!", "|", ">", "'", "\"", "%", "@", "`", "-"], true, false),
|
|
peg$c29 = /^[^\r\n\t ,\][{}:#"']/,
|
|
peg$c30 = peg$classExpectation(["\r", "\n", "\t", " ", ",", "]", "[", "{", "}", ":", "#", "\"", "'"], true, false),
|
|
peg$c31 = function() { return text().replace(/^ *| *$/g, '') },
|
|
peg$c32 = "--",
|
|
peg$c33 = peg$literalExpectation("--", false),
|
|
peg$c34 = /^[a-zA-Z\/0-9]/,
|
|
peg$c35 = peg$classExpectation([["a", "z"], ["A", "Z"], "/", ["0", "9"]], false, false),
|
|
peg$c36 = /^[^\r\n\t :,]/,
|
|
peg$c37 = peg$classExpectation(["\r", "\n", "\t", " ", ":", ","], true, false),
|
|
peg$c38 = "null",
|
|
peg$c39 = peg$literalExpectation("null", false),
|
|
peg$c40 = function() { return null },
|
|
peg$c41 = "true",
|
|
peg$c42 = peg$literalExpectation("true", false),
|
|
peg$c43 = function() { return true },
|
|
peg$c44 = "false",
|
|
peg$c45 = peg$literalExpectation("false", false),
|
|
peg$c46 = function() { return false },
|
|
peg$c47 = peg$otherExpectation("string"),
|
|
peg$c48 = "\"",
|
|
peg$c49 = peg$literalExpectation("\"", false),
|
|
peg$c50 = function() { return "" },
|
|
peg$c51 = function(chars) { return chars },
|
|
peg$c52 = function(chars) { return chars.join(``) },
|
|
peg$c53 = /^[^"\\\0-\x1F\x7F]/,
|
|
peg$c54 = peg$classExpectation(["\"", "\\", ["\0", "\x1F"], "\x7F"], true, false),
|
|
peg$c55 = "\\\"",
|
|
peg$c56 = peg$literalExpectation("\\\"", false),
|
|
peg$c57 = function() { return `"` },
|
|
peg$c58 = "\\\\",
|
|
peg$c59 = peg$literalExpectation("\\\\", false),
|
|
peg$c60 = function() { return `\\` },
|
|
peg$c61 = "\\/",
|
|
peg$c62 = peg$literalExpectation("\\/", false),
|
|
peg$c63 = function() { return `/` },
|
|
peg$c64 = "\\b",
|
|
peg$c65 = peg$literalExpectation("\\b", false),
|
|
peg$c66 = function() { return `\b` },
|
|
peg$c67 = "\\f",
|
|
peg$c68 = peg$literalExpectation("\\f", false),
|
|
peg$c69 = function() { return `\f` },
|
|
peg$c70 = "\\n",
|
|
peg$c71 = peg$literalExpectation("\\n", false),
|
|
peg$c72 = function() { return `\n` },
|
|
peg$c73 = "\\r",
|
|
peg$c74 = peg$literalExpectation("\\r", false),
|
|
peg$c75 = function() { return `\r` },
|
|
peg$c76 = "\\t",
|
|
peg$c77 = peg$literalExpectation("\\t", false),
|
|
peg$c78 = function() { return `\t` },
|
|
peg$c79 = "\\u",
|
|
peg$c80 = peg$literalExpectation("\\u", false),
|
|
peg$c81 = function(h1, h2, h3, h4) {
|
|
return String.fromCharCode(parseInt(`0x${h1}${h2}${h3}${h4}`));
|
|
},
|
|
peg$c82 = /^[0-9a-fA-F]/,
|
|
peg$c83 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false),
|
|
peg$c84 = peg$otherExpectation("blank space"),
|
|
peg$c85 = /^[ \t]/,
|
|
peg$c86 = peg$classExpectation([" ", "\t"], false, false),
|
|
peg$c87 = peg$otherExpectation("white space"),
|
|
peg$c88 = /^[ \t\n\r]/,
|
|
peg$c89 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false),
|
|
peg$c90 = "\r\n",
|
|
peg$c91 = peg$literalExpectation("\r\n", false),
|
|
peg$c92 = "\n",
|
|
peg$c93 = peg$literalExpectation("\n", false),
|
|
peg$c94 = "\r",
|
|
peg$c95 = peg$literalExpectation("\r", false),
|
|
|
|
peg$currPos = 0,
|
|
peg$savedPos = 0,
|
|
peg$posDetailsCache = [{ line: 1, column: 1 }],
|
|
peg$maxFailPos = 0,
|
|
peg$maxFailExpected = [],
|
|
peg$silentFails = 0,
|
|
|
|
peg$result;
|
|
|
|
if ("startRule" in options) {
|
|
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
|
}
|
|
|
|
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
|
}
|
|
|
|
function text() {
|
|
return input.substring(peg$savedPos, peg$currPos);
|
|
}
|
|
|
|
function location() {
|
|
return peg$computeLocation(peg$savedPos, peg$currPos);
|
|
}
|
|
|
|
function expected(description, location) {
|
|
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
|
|
|
|
throw peg$buildStructuredError(
|
|
[peg$otherExpectation(description)],
|
|
input.substring(peg$savedPos, peg$currPos),
|
|
location
|
|
);
|
|
}
|
|
|
|
function error(message, location) {
|
|
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
|
|
|
|
throw peg$buildSimpleError(message, location);
|
|
}
|
|
|
|
function peg$literalExpectation(text, ignoreCase) {
|
|
return { type: "literal", text: text, ignoreCase: ignoreCase };
|
|
}
|
|
|
|
function peg$classExpectation(parts, inverted, ignoreCase) {
|
|
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
|
|
}
|
|
|
|
function peg$anyExpectation() {
|
|
return { type: "any" };
|
|
}
|
|
|
|
function peg$endExpectation() {
|
|
return { type: "end" };
|
|
}
|
|
|
|
function peg$otherExpectation(description) {
|
|
return { type: "other", description: description };
|
|
}
|
|
|
|
function peg$computePosDetails(pos) {
|
|
var details = peg$posDetailsCache[pos], p;
|
|
|
|
if (details) {
|
|
return details;
|
|
} else {
|
|
p = pos - 1;
|
|
while (!peg$posDetailsCache[p]) {
|
|
p--;
|
|
}
|
|
|
|
details = peg$posDetailsCache[p];
|
|
details = {
|
|
line: details.line,
|
|
column: details.column
|
|
};
|
|
|
|
while (p < pos) {
|
|
if (input.charCodeAt(p) === 10) {
|
|
details.line++;
|
|
details.column = 1;
|
|
} else {
|
|
details.column++;
|
|
}
|
|
|
|
p++;
|
|
}
|
|
|
|
peg$posDetailsCache[pos] = details;
|
|
return details;
|
|
}
|
|
}
|
|
|
|
function peg$computeLocation(startPos, endPos) {
|
|
var startPosDetails = peg$computePosDetails(startPos),
|
|
endPosDetails = peg$computePosDetails(endPos);
|
|
|
|
return {
|
|
start: {
|
|
offset: startPos,
|
|
line: startPosDetails.line,
|
|
column: startPosDetails.column
|
|
},
|
|
end: {
|
|
offset: endPos,
|
|
line: endPosDetails.line,
|
|
column: endPosDetails.column
|
|
}
|
|
};
|
|
}
|
|
|
|
function peg$fail(expected) {
|
|
if (peg$currPos < peg$maxFailPos) { return; }
|
|
|
|
if (peg$currPos > peg$maxFailPos) {
|
|
peg$maxFailPos = peg$currPos;
|
|
peg$maxFailExpected = [];
|
|
}
|
|
|
|
peg$maxFailExpected.push(expected);
|
|
}
|
|
|
|
function peg$buildSimpleError(message, location) {
|
|
return new peg$SyntaxError(message, null, null, location);
|
|
}
|
|
|
|
function peg$buildStructuredError(expected, found, location) {
|
|
return new peg$SyntaxError(
|
|
peg$SyntaxError.buildMessage(expected, found),
|
|
expected,
|
|
found,
|
|
location
|
|
);
|
|
}
|
|
|
|
function peg$parseStart() {
|
|
var s0;
|
|
|
|
s0 = peg$parsePropertyStatements();
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseItemStatements() {
|
|
var s0, s1, s2;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parseItemStatement();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parseItemStatement();
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c0(s1);
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseItemStatement() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseSamedent();
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 45) {
|
|
s2 = peg$c1;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c2); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseB();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseExpression();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c3(s4);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsePropertyStatements() {
|
|
var s0, s1, s2;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parsePropertyStatement();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parsePropertyStatement();
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c4(s1);
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsePropertyStatement() {
|
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseB();
|
|
if (s1 === peg$FAILED) {
|
|
s1 = null;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 35) {
|
|
s3 = peg$c5;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c6); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = [];
|
|
s5 = peg$currPos;
|
|
s6 = peg$currPos;
|
|
peg$silentFails++;
|
|
s7 = peg$parseEOL();
|
|
peg$silentFails--;
|
|
if (s7 === peg$FAILED) {
|
|
s6 = void 0;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
if (input.length > peg$currPos) {
|
|
s7 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c7); }
|
|
}
|
|
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) {
|
|
while (s5 !== peg$FAILED) {
|
|
s4.push(s5);
|
|
s5 = peg$currPos;
|
|
s6 = peg$currPos;
|
|
peg$silentFails++;
|
|
s7 = peg$parseEOL();
|
|
peg$silentFails--;
|
|
if (s7 === peg$FAILED) {
|
|
s6 = void 0;
|
|
} else {
|
|
peg$currPos = s6;
|
|
s6 = peg$FAILED;
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
if (input.length > peg$currPos) {
|
|
s7 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c7); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s6 = [s6, s7];
|
|
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) {
|
|
s2 = null;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$parseEOL_ANY();
|
|
if (s4 !== peg$FAILED) {
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$parseEOL_ANY();
|
|
}
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c8();
|
|
s0 = s1;
|
|
} 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$parseSamedent();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseName();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseB();
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
s4 = peg$c9;
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c10); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseB();
|
|
if (s5 === peg$FAILED) {
|
|
s5 = null;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parseExpression();
|
|
if (s6 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c11(s2, s6);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseSamedent();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseLegacyName();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseB();
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
s4 = peg$c9;
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c10); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseB();
|
|
if (s5 === peg$FAILED) {
|
|
s5 = null;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parseExpression();
|
|
if (s6 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c11(s2, s6);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseSamedent();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseLegacyName();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseB();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseLegacyLiteral();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = [];
|
|
s6 = peg$parseEOL_ANY();
|
|
if (s6 !== peg$FAILED) {
|
|
while (s6 !== peg$FAILED) {
|
|
s5.push(s6);
|
|
s6 = peg$parseEOL_ANY();
|
|
}
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c11(s2, s4);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseSamedent();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseLegacyName();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
s4 = peg$currPos;
|
|
s5 = peg$parseB();
|
|
if (s5 === peg$FAILED) {
|
|
s5 = null;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
s6 = peg$c12;
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c13); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parseB();
|
|
if (s7 === peg$FAILED) {
|
|
s7 = null;
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parseLegacyName();
|
|
if (s8 !== peg$FAILED) {
|
|
peg$savedPos = s4;
|
|
s5 = peg$c14(s2, s8);
|
|
s4 = s5;
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
s4 = peg$currPos;
|
|
s5 = peg$parseB();
|
|
if (s5 === peg$FAILED) {
|
|
s5 = null;
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
s6 = peg$c12;
|
|
peg$currPos++;
|
|
} else {
|
|
s6 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c13); }
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parseB();
|
|
if (s7 === peg$FAILED) {
|
|
s7 = null;
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parseLegacyName();
|
|
if (s8 !== peg$FAILED) {
|
|
peg$savedPos = s4;
|
|
s5 = peg$c14(s2, s8);
|
|
s4 = s5;
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s4;
|
|
s4 = peg$FAILED;
|
|
}
|
|
}
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseB();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = null;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
s5 = peg$c9;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c10); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parseB();
|
|
if (s6 === peg$FAILED) {
|
|
s6 = null;
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parseExpression();
|
|
if (s7 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c15(s2, s3, s7);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} 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$parseExpression() {
|
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
peg$silentFails++;
|
|
s2 = peg$currPos;
|
|
s3 = peg$parseEOL();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseExtradent();
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 45) {
|
|
s5 = peg$c1;
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c2); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parseB();
|
|
if (s6 !== peg$FAILED) {
|
|
s3 = [s3, s4, s5, s6];
|
|
s2 = s3;
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s2;
|
|
s2 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s2 !== peg$FAILED) {
|
|
peg$currPos = s1;
|
|
s1 = void 0;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseEOL_ANY();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseIndent();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseItemStatements();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseDedent();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c16(s4);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseEOL();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseIndent();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsePropertyStatements();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseDedent();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c16(s3);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseLiteral();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$parseEOL_ANY();
|
|
if (s3 !== peg$FAILED) {
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$parseEOL_ANY();
|
|
}
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c17(s1);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseSamedent() {
|
|
var s0, s1, s2;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
s2 = peg$c19;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c20); }
|
|
}
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
s2 = peg$c19;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c20); }
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = peg$currPos;
|
|
s2 = peg$c21(s1);
|
|
if (s2) {
|
|
s2 = void 0;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = [s1, s2];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c18); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseExtradent() {
|
|
var s0, s1, s2;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
s2 = peg$c19;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c20); }
|
|
}
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
s2 = peg$c19;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c20); }
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = peg$currPos;
|
|
s2 = peg$c22(s1);
|
|
if (s2) {
|
|
s2 = void 0;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = [s1, s2];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseIndent() {
|
|
var s0;
|
|
|
|
peg$savedPos = peg$currPos;
|
|
s0 = peg$c23();
|
|
if (s0) {
|
|
s0 = void 0;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseDedent() {
|
|
var s0;
|
|
|
|
peg$savedPos = peg$currPos;
|
|
s0 = peg$c24();
|
|
if (s0) {
|
|
s0 = void 0;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseName() {
|
|
var s0;
|
|
|
|
s0 = peg$parsestring();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsepseudostring();
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseLegacyName() {
|
|
var s0, s1, s2;
|
|
|
|
s0 = peg$parsestring();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parsepseudostringLegacy();
|
|
if (s2 !== peg$FAILED) {
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parsepseudostringLegacy();
|
|
}
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c25();
|
|
}
|
|
s0 = s1;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseLiteral() {
|
|
var s0;
|
|
|
|
s0 = peg$parsenull();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseboolean();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsestring();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsepseudostring();
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseLegacyLiteral() {
|
|
var s0;
|
|
|
|
s0 = peg$parsenull();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsestring();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsepseudostringLegacy();
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepseudostring() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
if (peg$c27.test(input.charAt(peg$currPos))) {
|
|
s1 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c28); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parseB();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = null;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
if (peg$c29.test(input.charAt(peg$currPos))) {
|
|
s5 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c30); }
|
|
}
|
|
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$parseB();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = null;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
if (peg$c29.test(input.charAt(peg$currPos))) {
|
|
s5 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c30); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c31();
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c26); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepseudostringLegacy() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c32) {
|
|
s1 = peg$c32;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c33); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
s1 = null;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
if (peg$c34.test(input.charAt(peg$currPos))) {
|
|
s2 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c35); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = [];
|
|
if (peg$c36.test(input.charAt(peg$currPos))) {
|
|
s4 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c37); }
|
|
}
|
|
while (s4 !== peg$FAILED) {
|
|
s3.push(s4);
|
|
if (peg$c36.test(input.charAt(peg$currPos))) {
|
|
s4 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c37); }
|
|
}
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c31();
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsenull() {
|
|
var s0, s1;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4) === peg$c38) {
|
|
s1 = peg$c38;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c39); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c40();
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseboolean() {
|
|
var s0, s1;
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4) === peg$c41) {
|
|
s1 = peg$c41;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c42); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c43();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 5) === peg$c44) {
|
|
s1 = peg$c44;
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c45); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c46();
|
|
}
|
|
s0 = s1;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsestring() {
|
|
var s0, s1, s2, s3;
|
|
|
|
peg$silentFails++;
|
|
s0 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
s1 = peg$c48;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c49); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
s2 = peg$c48;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c49); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c50();
|
|
s0 = s1;
|
|
} 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) === 34) {
|
|
s1 = peg$c48;
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c49); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsechars();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
s3 = peg$c48;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c49); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c51(s2);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c47); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsechars() {
|
|
var s0, s1, s2;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parsechar();
|
|
if (s2 !== peg$FAILED) {
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parsechar();
|
|
}
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c52(s1);
|
|
}
|
|
s0 = s1;
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsechar() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
if (peg$c53.test(input.charAt(peg$currPos))) {
|
|
s0 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c54); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c55) {
|
|
s1 = peg$c55;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c56); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c57();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
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$c59); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c60();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c61) {
|
|
s1 = peg$c61;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c62); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c63();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c64) {
|
|
s1 = peg$c64;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c65); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c66();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c67) {
|
|
s1 = peg$c67;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c68); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c69();
|
|
}
|
|
s0 = s1;
|
|
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$c71); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c72();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c73) {
|
|
s1 = peg$c73;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c74); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c75();
|
|
}
|
|
s0 = s1;
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 2) === peg$c76) {
|
|
s1 = peg$c76;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c77); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c78();
|
|
}
|
|
s0 = s1;
|
|
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$c80); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsehexDigit();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsehexDigit();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsehexDigit();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parsehexDigit();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c81(s2, s3, s4, s5);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsehexDigit() {
|
|
var s0;
|
|
|
|
if (peg$c82.test(input.charAt(peg$currPos))) {
|
|
s0 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c83); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseB() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = [];
|
|
if (peg$c85.test(input.charAt(peg$currPos))) {
|
|
s1 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c86); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
while (s1 !== peg$FAILED) {
|
|
s0.push(s1);
|
|
if (peg$c85.test(input.charAt(peg$currPos))) {
|
|
s1 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c86); }
|
|
}
|
|
}
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c84); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseS() {
|
|
var s0, s1;
|
|
|
|
peg$silentFails++;
|
|
s0 = [];
|
|
if (peg$c88.test(input.charAt(peg$currPos))) {
|
|
s1 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c89); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
while (s1 !== peg$FAILED) {
|
|
s0.push(s1);
|
|
if (peg$c88.test(input.charAt(peg$currPos))) {
|
|
s1 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c89); }
|
|
}
|
|
}
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
}
|
|
peg$silentFails--;
|
|
if (s0 === peg$FAILED) {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c87); }
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseEOL_ANY() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseEOL();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$currPos;
|
|
s4 = peg$parseB();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = null;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseEOL();
|
|
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$parseB();
|
|
if (s4 === peg$FAILED) {
|
|
s4 = null;
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseEOL();
|
|
if (s5 !== peg$FAILED) {
|
|
s4 = [s4, s5];
|
|
s3 = s4;
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s3;
|
|
s3 = peg$FAILED;
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s1 = [s1, s2];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseEOL() {
|
|
var s0;
|
|
|
|
if (input.substr(peg$currPos, 2) === peg$c90) {
|
|
s0 = peg$c90;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c91); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 10) {
|
|
s0 = peg$c92;
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c93); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 13) {
|
|
s0 = peg$c94;
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c95); }
|
|
}
|
|
}
|
|
}
|
|
|
|
return s0;
|
|
}
|
|
|
|
|
|
const INDENT_STEP = 2;
|
|
|
|
let indentLevel = 0;
|
|
|
|
|
|
peg$result = peg$startRuleFunction();
|
|
|
|
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
|
return peg$result;
|
|
} else {
|
|
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
|
peg$fail(peg$endExpectation());
|
|
}
|
|
|
|
throw peg$buildStructuredError(
|
|
peg$maxFailExpected,
|
|
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
|
|
peg$maxFailPos < input.length
|
|
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
|
|
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
|
|
);
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
SyntaxError: peg$SyntaxError,
|
|
parse: peg$parse
|
|
};
|
|
|