@podlite/schema
Version:
AST tools for Podlite markup language
1,284 lines • 317 kB
JavaScript
/*
* Generated by PEG.js 0.10.0.
*
* http://pegjs.org/
*/
"use strict";
function peg$subclass(child, parent) {
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
function peg$SyntaxError(message, expected, found, location) {
this.message = message;
this.expected = expected;
this.found = found;
this.location = location;
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(peg$SyntaxError, Error);
peg$SyntaxError.buildMessage = function (expected, found) {
var DESCRIBE_EXPECTATION_FNS = {
literal: function (expectation) {
return "\"" + literalEscape(expectation.text) + "\"";
},
"class": function (expectation) {
var escapedParts = "", i;
for (i = 0; i < expectation.parts.length; i++) {
escapedParts += expectation.parts[i] instanceof Array
? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
: classEscape(expectation.parts[i]);
}
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
},
any: function (expectation) {
return "any character";
},
end: function (expectation) {
return "end of input";
},
other: function (expectation) {
return expectation.description;
}
};
function hex(ch) {
return ch.charCodeAt(0).toString(16).toUpperCase();
}
function literalEscape(s) {
return s
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\0/g, '\\0')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x0F]/g, function (ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return '\\x' + hex(ch); });
}
function classEscape(s) {
return s
.replace(/\\/g, '\\\\')
.replace(/\]/g, '\\]')
.replace(/\^/g, '\\^')
.replace(/-/g, '\\-')
.replace(/\0/g, '\\0')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x0F]/g, function (ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return '\\x' + hex(ch); });
}
function describeExpectation(expectation) {
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
}
function describeExpected(expected) {
var descriptions = new Array(expected.length), i, j;
for (i = 0; i < expected.length; i++) {
descriptions[i] = describeExpectation(expected[i]);
}
descriptions.sort();
if (descriptions.length > 0) {
for (i = 1, j = 1; i < descriptions.length; i++) {
if (descriptions[i - 1] !== descriptions[i]) {
descriptions[j] = descriptions[i];
j++;
}
}
descriptions.length = j;
}
switch (descriptions.length) {
case 1:
return descriptions[0];
case 2:
return descriptions[0] + " or " + descriptions[1];
default:
return descriptions.slice(0, -1).join(", ")
+ ", or "
+ descriptions[descriptions.length - 1];
}
}
function describeFound(found) {
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
}
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
};
function peg$parse(input, options) {
options = options !== void 0 ? options : {};
var peg$FAILED = {}, peg$startRuleFunctions = { Expression: peg$parseExpression }, peg$startRuleFunction = peg$parseExpression, peg$c0 = "A", peg$c1 = peg$literalExpectation("A", false), peg$c2 = "V", peg$c3 = peg$literalExpectation("V", false), peg$c4 = "R", peg$c5 = peg$literalExpectation("R", false), peg$c6 = "B", peg$c7 = peg$literalExpectation("B", false), peg$c8 = "I", peg$c9 = peg$literalExpectation("I", false), peg$c10 = "C", peg$c11 = peg$literalExpectation("C", false), peg$c12 = "D", peg$c13 = peg$literalExpectation("D", false), peg$c14 = "E", peg$c15 = peg$literalExpectation("E", false), peg$c16 = "K", peg$c17 = peg$literalExpectation("K", false), peg$c18 = "L", peg$c19 = peg$literalExpectation("L", false), peg$c20 = "S", peg$c21 = peg$literalExpectation("S", false), peg$c22 = "T", peg$c23 = peg$literalExpectation("T", false), peg$c24 = "F", peg$c25 = peg$literalExpectation("F", false), peg$c26 = "U", peg$c27 = peg$literalExpectation("U", false), peg$c28 = "Z", peg$c29 = peg$literalExpectation("Z", false), peg$c30 = "N", peg$c31 = peg$literalExpectation("N", false), peg$c32 = "X", peg$c33 = peg$literalExpectation("X", false), peg$c34 = /^[a-zA-Z]/, peg$c35 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false), peg$c36 = /^[a-zA-Z0-9_\-]/, peg$c37 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false), peg$c38 = /^[ \t\f]/, peg$c39 = peg$classExpectation([" ", "\t", "\f"], false, false), peg$c40 = function (char) {
return !(options.allowed || []).length //allow all formatting codes by default
||
(options.allowed || []).includes(char);
}, peg$c41 = peg$anyExpectation(), peg$c42 = function (id) { return id; }, peg$c43 = function (name) { return name === "A"; }, peg$c44 = function (name, content) {
return {
content,
'type': "fcode",
name,
};
}, peg$c45 = function (name) { return name === "D"; }, peg$c46 = function (name, content, t) { return flattenDeep(t); }, peg$c47 = function (name, content, synonyms) {
return {
content,
'type': "fcode",
name,
synonyms
};
}, peg$c48 = function (name) { return name === "V"; }, peg$c49 = function (name, content) {
return {
content,
'type': "fcode",
name,
};
}, peg$c50 = "<", peg$c51 = peg$literalExpectation("<", false), peg$c52 = ">", peg$c53 = peg$literalExpectation(">", false), peg$c54 = function () { return text(); }, peg$c55 = "\xAB", peg$c56 = peg$literalExpectation("\xAB", false), peg$c57 = "\xBB", peg$c58 = peg$literalExpectation("\xBB", false), peg$c59 = function (text) { return text; }, peg$c60 = function (name) { return name.code === "C"; }, peg$c61 = function (name, etag) { return etag === name.end_tag; }, peg$c62 = function (name, text) { return text; }, peg$c63 = function (name, content, end_tag) { return end_tag === name.end_tag; }, peg$c64 = function (name, content, end_tag) {
return {
content,
'type': "fcode",
name: name.code,
};
}, peg$c65 = "|", peg$c66 = peg$literalExpectation("|", false), peg$c67 = function (text) { return text; }, peg$c68 = function (name) { return name.code === "L"; }, peg$c69 = function (name, content, t) { return t; }, peg$c70 = function (name, content, meta, end_tag) { return end_tag === name.end_tag; }, peg$c71 = function (name, content, meta, end_tag) {
return {
content,
'type': "fcode",
name: name.code,
meta
};
}, peg$c72 = ";", peg$c73 = peg$literalExpectation(";", false), peg$c74 = /^[ \xA0\u2001\t\f\u2008]/, peg$c75 = peg$classExpectation([" ", "\xA0", "\u2001", "\t", "\f", "\u2008"], false, false), peg$c76 = function (code, codes) { return flattenDeep([code, codes]); }, peg$c77 = function (code) { return [code]; }, peg$c78 = function (name) { return name === "X"; }, peg$c79 = function (name, content, entry) {
return {
content,
'type': "fcode",
name,
entry
};
}, peg$c80 = function (name) { return name === "S"; }, peg$c81 = function (name) { return name === "Z"; }, peg$c82 = /^[0-9]/, peg$c83 = peg$classExpectation([["0", "9"]], false, false), peg$c84 = "0d", peg$c85 = peg$literalExpectation("0d", false), peg$c86 = function (number) { return parseInt(number, 10); }, peg$c87 = "0o", peg$c88 = peg$literalExpectation("0o", false), peg$c89 = function (number) { return parseInt(number, 8); }, peg$c90 = "0b", peg$c91 = peg$literalExpectation("0b", false), peg$c92 = function (number) { return parseInt(number, 2); }, peg$c93 = "0x", peg$c94 = peg$literalExpectation("0x", false), peg$c95 = /^[0-9A-Fa-f]/, peg$c96 = peg$classExpectation([["0", "9"], ["A", "F"], ["a", "f"]], false, false), peg$c97 = function () { return parseInt(text()); }, peg$c98 = /^[A-Z ]/, peg$c99 = peg$classExpectation([["A", "Z"], " "], false, false), peg$c100 = function () { return text() === text().toUpperCase(); }, peg$c101 = /^[a-z]/, peg$c102 = peg$classExpectation([["a", "z"]], false, false), peg$c103 = /^[a-z0-9]/, peg$c104 = peg$classExpectation([["a", "z"], ["0", "9"]], false, false), peg$c105 = function (s) { return text(); }, peg$c106 = function (number) { return { type: 'number', value: parseInt(number, 10) }; }, peg$c107 = function (name) { return { type: 'unicode_name', value: name }; }, peg$c108 = function (name) { return { type: 'html_named', value: name }; }, peg$c109 = function (name) { return name === "E"; }, peg$c110 = function (name, t) { return flattenDeep(t); }, peg$c111 = function (name, content) {
return {
content: content ? content : [],
'type': "fcode",
name
};
}, peg$c112 = function (name) { return name; }, peg$c113 = function (name, begin_tag) { return { code: name, begin_tag, end_tag: get_pair_tag(begin_tag) }; }, peg$c114 = function (name) { return name.code !== 'C'; }, peg$c115 = function (name, content, end_tag) { return end_tag === name.end_tag; }, peg$c116 = function (name, content, end_tag) { return { content, type: 'fcode', name: name.code }; }, 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$parseExpression() {
var s0, s1;
s0 = [];
s1 = peg$parseallowed_rules();
if (s1 === peg$FAILED) {
s1 = peg$parsecode_2();
if (s1 === peg$FAILED) {
s1 = peg$parsetext();
if (s1 === peg$FAILED) {
s1 = peg$parseraw_text();
}
}
}
while (s1 !== peg$FAILED) {
s0.push(s1);
s1 = peg$parseallowed_rules();
if (s1 === peg$FAILED) {
s1 = peg$parsecode_2();
if (s1 === peg$FAILED) {
s1 = peg$parsetext();
if (s1 === peg$FAILED) {
s1 = peg$parseraw_text();
}
}
}
}
return s0;
}
function peg$parseallowed_rules() {
var s0;
s0 = peg$parsecode_A();
if (s0 === peg$FAILED) {
s0 = peg$parsecode_S();
if (s0 === peg$FAILED) {
s0 = peg$parsecode_C();
if (s0 === peg$FAILED) {
s0 = peg$parsecode_D();
if (s0 === peg$FAILED) {
s0 = peg$parsecode_E();
if (s0 === peg$FAILED) {
s0 = peg$parsecode_V();
if (s0 === peg$FAILED) {
s0 = peg$parsecode_L();
if (s0 === peg$FAILED) {
s0 = peg$parsecode_X();
if (s0 === peg$FAILED) {
s0 = peg$parsecode_Z();
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseallpossible_codes() {
var s0;
if (input.charCodeAt(peg$currPos) === 65) {
s0 = peg$c0;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c1);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 86) {
s0 = peg$c2;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c3);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 82) {
s0 = peg$c4;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c5);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 66) {
s0 = peg$c6;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c7);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 73) {
s0 = peg$c8;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c9);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 67) {
s0 = peg$c10;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c11);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 68) {
s0 = peg$c12;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c13);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 69) {
s0 = peg$c14;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c15);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 75) {
s0 = peg$c16;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c17);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 76) {
s0 = peg$c18;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c19);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 83) {
s0 = peg$c20;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c21);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 84) {
s0 = peg$c22;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c23);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 70) {
s0 = peg$c24;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c25);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 85) {
s0 = peg$c26;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c27);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 90) {
s0 = peg$c28;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c29);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 78) {
s0 = peg$c30;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c31);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 88) {
s0 = peg$c32;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c33);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseidentifier() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$currPos;
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);
}
}
if (s4 !== peg$FAILED) {
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);
}
}
}
}
else {
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
}
else {
peg$currPos = s1;
s1 = peg$FAILED;
}
}
else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s0 = input.substring(s0, peg$currPos);
}
else {
s0 = s1;
}
return s0;
}
function peg$parse_() {
var s0, s1;
s0 = [];
if (peg$c38.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c39);
}
}
while (s1 !== peg$FAILED) {
s0.push(s1);
if (peg$c38.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c39);
}
}
}
return s0;
}
function peg$parseallowed_code() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parseallpossible_codes();
if (s1 !== peg$FAILED) {
peg$savedPos = peg$currPos;
s2 = peg$c40(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$parseraw_text() {
var s0, s1;
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$c41);
}
}
if (s1 !== peg$FAILED) {
s0 = input.substring(s0, peg$currPos);
}
else {
s0 = s1;
}
return s0;
}
function peg$parsecontent_A() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$parseend_code();
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
}
else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
s4 = peg$parseidentifier();
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
s3 = input.substring(s3, peg$currPos);
}
else {
s3 = s4;
}
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c42(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 = null;
}
return s0;
}
function peg$parsecode_A() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parsestart_code();
if (s1 !== peg$FAILED) {
peg$savedPos = peg$currPos;
s2 = peg$c43(s1);
if (s2) {
s2 = void 0;
}
else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = peg$parsecontent_A();
if (s3 !== peg$FAILED) {
s4 = peg$parseend_code();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c44(s1, 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;
}
return s0;
}
function peg$parsecode_D() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parsestart_code();
if (s1 !== peg$FAILED) {
peg$savedPos = peg$currPos;
s2 = peg$c45(s1);
if (s2) {
s2 = void 0;
}
else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsetext_L();
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsetext_L();
}
}
else {
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s4 = peg$currPos;
s5 = peg$parseseparator();
if (s5 !== peg$FAILED) {
s6 = [];
s7 = peg$parsearray_items();
while (s7 !== peg$FAILED) {
s6.push(s7);
s7 = peg$parsearray_items();
}
if (s6 !== peg$FAILED) {
peg$savedPos = s4;
s5 = peg$c46(s1, s3, s6);
s4 = s5;
}
else {
peg$currPos = s4;
s4 = peg$FAILED;
}
}
else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
s5 = peg$parseend_code();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c47(s1, s3, s4);
s0 = s1;
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsecode_V() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parsestart_code();
if (s1 !== peg$FAILED) {
peg$savedPos = peg$currPos;
s2 = peg$c48(s1);
if (s2) {
s2 = void 0;
}
else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
s4 = [];
s5 = peg$parsetext_C();
if (s5 !== peg$FAILED) {
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parsetext_C();
}
}
else {
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
s3 = input.substring(s3, peg$currPos);
}
else {
s3 = s4;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseend_code();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c49(s1, 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;
}
return s0;
}
function peg$parseallowed_code_C() {
var s0;
if (input.charCodeAt(peg$currPos) === 66) {
s0 = peg$c6;
peg$currPos++;
}
else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c7);
}
}
return s0;
}
function peg$parselooks_like_code_C() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseallowed_code_C();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
}
else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
if (input.length > peg$currPos) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c41);
}
}
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
}
else {
peg$currPos = s1;
s1 = peg$FAILED;
}
}
else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 60) {
s2 = peg$c50;
peg$currPos++;
}
else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c51);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parsenot_code();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 62) {
s4 = peg$c52;
peg$currPos++;
}
else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c53);
}
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c54();
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$currPos;
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseallowed_code_C();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
}
else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
if (input.length > peg$currPos) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
}
else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c41);
}
}
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
}
else {
peg$currPos = s1;
s1 = peg$FAILED;
}
}
else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 171) {
s2 = peg$c55;
peg$currPos++;
}
else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c56);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parsenot_code();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 187) {
s4 = peg$c57;
peg$currPos++;
}
else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c58);
}
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c54();
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$parsetext_C() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = [];
s3 = peg$currPos;
s4 = peg$currPos;
s5 = peg$currPos;
peg$silentFails++;
if (input.charCodeAt(peg$currPos) === 60) {
s6 = peg$c50;
peg$currPos++;
}
else {
s6 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c51);
}
}
peg$silentFails--;
if (s6 === peg$FAILED) {
s5 = void 0;
}
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$c41);
}
}
if (s6 !== peg$FAILED) {
s5 = [s5, s6];
s4 = s5;
}
else {
peg$currPos = s4;
s4 = peg$FAILED;
}
}
else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 60) {
s5 = peg$c50;
peg$currPos++;
}
else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c51);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parsetext_C();
if (s6 === peg$FAILED) {
s6 = null;
}
if (s6 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 62) {
s7 = peg$c52;
peg$currPos++;
}
else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c53);
}
}
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;
}
}
else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 === peg$FAILED) {
s3 = peg$currPos;
s4 = peg$currPos;
s5 = peg$currPos;
peg$silentFails++;
if (input.charCodeAt(peg$currPos) === 171) {
s6 = peg$c55;
peg$currPos++;
}
else {
s6 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c56);
}
}
peg$silentFails--;
if (s6 === peg$FAILED) {
s5 = void 0;
}
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$c41);
}
}
if (s6 !== peg$FAILED) {
s5 = [s5, s6];
s4 = s5;
}
else {
peg$currPos = s4;
s4 = peg$FAILED;
}
}
else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 171) {
s5 = peg$c55;
peg$currPos++;
}
else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c56);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parsetext_C();
if (s6 === peg$FAILED) {
s6 = null;
}
if (s6 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 187) {
s7 = peg$c57;
peg$currPos++;
}
else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c58);
}
}
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
}
else {
peg$currPos = s3;
s3 = peg$FAILE