This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
node-task/node_modules/dustjs-linkedin/lib/parser.js

2665 lines
73 KiB
JavaScript

/* Do not edit the parser directly. This is a generated file created using a build script and the PEG grammar. */
(function(root, factory) {
if (typeof exports === 'object') {
// in Node, require this file if we want to use the parser as a standalone module
module.exports = factory(require('./dust'));
// @see server file for parser methods exposed in node
} else {
// in the browser, store the factory output if we want to use the parser directly
factory(root.dust);
}
}(this, function(dust) {
var parser = (function() {
/*
* Generated by PEG.js 0.8.0.
*
* http://pegjs.majda.cz/
*/
function peg$subclass(child, parent) {
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
function SyntaxError(message, expected, found, offset, line, column) {
this.message = message;
this.expected = expected;
this.found = found;
this.offset = offset;
this.line = line;
this.column = column;
this.name = "SyntaxError";
}
peg$subclass(SyntaxError, Error);
function parse(input) {
var options = arguments.length > 1 ? arguments[1] : {},
peg$FAILED = {},
peg$startRuleFunctions = { start: peg$parsestart },
peg$startRuleFunction = peg$parsestart,
peg$c0 = [],
peg$c1 = function(p) {
return ["body"]
.concat(p)
.concat([['line', line()], ['col', column()]]);
},
peg$c2 = { type: "other", description: "section" },
peg$c3 = peg$FAILED,
peg$c4 = null,
peg$c5 = function(t, b, e, n) {
if( (!n) || (t[1].text !== n.text) ) {
error("Expected end tag for "+t[1].text+" but it was not found.");
}
return true;
},
peg$c6 = void 0,
peg$c7 = function(t, b, e, n) {
e.push(["param", ["literal", "block"], b]);
t.push(e);
return t.concat([['line', line()], ['col', column()]]);
},
peg$c8 = "/",
peg$c9 = { type: "literal", value: "/", description: "\"/\"" },
peg$c10 = function(t) {
t.push(["bodies"]);
return t.concat([['line', line()], ['col', column()]]);
},
peg$c11 = /^[#?\^<+@%]/,
peg$c12 = { type: "class", value: "[#?\\^<+@%]", description: "[#?\\^<+@%]" },
peg$c13 = function(t, n, c, p) { return [t, n, c, p] },
peg$c14 = { type: "other", description: "end tag" },
peg$c15 = function(n) { return n },
peg$c16 = ":",
peg$c17 = { type: "literal", value: ":", description: "\":\"" },
peg$c18 = function(n) {return n},
peg$c19 = function(n) { return n ? ["context", n] : ["context"] },
peg$c20 = { type: "other", description: "params" },
peg$c21 = "=",
peg$c22 = { type: "literal", value: "=", description: "\"=\"" },
peg$c23 = function(k, v) {return ["param", ["literal", k], v]},
peg$c24 = function(p) { return ["params"].concat(p) },
peg$c25 = { type: "other", description: "bodies" },
peg$c26 = function(p) { return ["bodies"].concat(p) },
peg$c27 = { type: "other", description: "reference" },
peg$c28 = function(n, f) { return ["reference", n, f].concat([['line', line()], ['col', column()]]) },
peg$c29 = { type: "other", description: "partial" },
peg$c30 = ">",
peg$c31 = { type: "literal", value: ">", description: "\">\"" },
peg$c32 = "+",
peg$c33 = { type: "literal", value: "+", description: "\"+\"" },
peg$c34 = function(k) {return ["literal", k]},
peg$c35 = function(s, n, c, p) {
var key = (s === ">") ? "partial" : s;
return [key, n, c, p].concat([['line', line()], ['col', column()]]);
},
peg$c36 = { type: "other", description: "filters" },
peg$c37 = "|",
peg$c38 = { type: "literal", value: "|", description: "\"|\"" },
peg$c39 = function(f) { return ["filters"].concat(f) },
peg$c40 = { type: "other", description: "special" },
peg$c41 = "~",
peg$c42 = { type: "literal", value: "~", description: "\"~\"" },
peg$c43 = function(k) { return ["special", k].concat([['line', line()], ['col', column()]]) },
peg$c44 = { type: "other", description: "identifier" },
peg$c45 = function(p) { var arr = ["path"].concat(p); arr.text = p[1].join('.'); return arr; },
peg$c46 = function(k) { var arr = ["key", k]; arr.text = k; return arr; },
peg$c47 = { type: "other", description: "number" },
peg$c48 = function(n) { return ['literal', n]; },
peg$c49 = { type: "other", description: "float" },
peg$c50 = ".",
peg$c51 = { type: "literal", value: ".", description: "\".\"" },
peg$c52 = function(l, r) { return parseFloat(l + "." + r.join('')); },
peg$c53 = { type: "other", description: "integer" },
peg$c54 = /^[0-9]/,
peg$c55 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c56 = function(digits) { return parseInt(digits.join(""), 10); },
peg$c57 = { type: "other", description: "path" },
peg$c58 = function(k, d) {
d = d[0];
if (k && d) {
d.unshift(k);
return [false, d].concat([['line', line()], ['col', column()]]);
}
return [true, d].concat([['line', line()], ['col', column()]]);
},
peg$c59 = function(d) {
if (d.length > 0) {
return [true, d[0]].concat([['line', line()], ['col', column()]]);
}
return [true, []].concat([['line', line()], ['col', column()]]);
},
peg$c60 = { type: "other", description: "key" },
peg$c61 = /^[a-zA-Z_$]/,
peg$c62 = { type: "class", value: "[a-zA-Z_$]", description: "[a-zA-Z_$]" },
peg$c63 = /^[0-9a-zA-Z_$\-]/,
peg$c64 = { type: "class", value: "[0-9a-zA-Z_$\\-]", description: "[0-9a-zA-Z_$\\-]" },
peg$c65 = function(h, t) { return h + t.join('') },
peg$c66 = { type: "other", description: "array" },
peg$c67 = function(n) {return n.join('')},
peg$c68 = function(a) {return a; },
peg$c69 = function(i, nk) { if(nk) { nk.unshift(i); } else {nk = [i] } return nk; },
peg$c70 = { type: "other", description: "array_part" },
peg$c71 = function(k) {return k},
peg$c72 = function(d, a) { if (a) { return d.concat(a); } else { return d; } },
peg$c73 = { type: "other", description: "inline" },
peg$c74 = "\"",
peg$c75 = { type: "literal", value: "\"", description: "\"\\\"\"" },
peg$c76 = function() { return ["literal", ""].concat([['line', line()], ['col', column()]]) },
peg$c77 = function(l) { return ["literal", l].concat([['line', line()], ['col', column()]]) },
peg$c78 = function(p) { return ["body"].concat(p).concat([['line', line()], ['col', column()]]) },
peg$c79 = function(l) { return ["buffer", l] },
peg$c80 = { type: "other", description: "buffer" },
peg$c81 = function(e, w) { return ["format", e, w.join('')].concat([['line', line()], ['col', column()]]) },
peg$c82 = { type: "any", description: "any character" },
peg$c83 = function(c) {return c},
peg$c84 = function(b) { return ["buffer", b.join('')].concat([['line', line()], ['col', column()]]) },
peg$c85 = { type: "other", description: "literal" },
peg$c86 = /^[^"]/,
peg$c87 = { type: "class", value: "[^\"]", description: "[^\"]" },
peg$c88 = function(b) { return b.join('') },
peg$c89 = "\\\"",
peg$c90 = { type: "literal", value: "\\\"", description: "\"\\\\\\\"\"" },
peg$c91 = function() { return '"' },
peg$c92 = { type: "other", description: "raw" },
peg$c93 = "{`",
peg$c94 = { type: "literal", value: "{`", description: "\"{`\"" },
peg$c95 = "`}",
peg$c96 = { type: "literal", value: "`}", description: "\"`}\"" },
peg$c97 = function(char) {return char},
peg$c98 = function(rawText) { return ["raw", rawText.join('')].concat([['line', line()], ['col', column()]]) },
peg$c99 = { type: "other", description: "comment" },
peg$c100 = "{!",
peg$c101 = { type: "literal", value: "{!", description: "\"{!\"" },
peg$c102 = "!}",
peg$c103 = { type: "literal", value: "!}", description: "\"!}\"" },
peg$c104 = function(c) { return ["comment", c.join('')].concat([['line', line()], ['col', column()]]) },
peg$c105 = /^[#?\^><+%:@\/~%]/,
peg$c106 = { type: "class", value: "[#?\\^><+%:@\\/~%]", description: "[#?\\^><+%:@\\/~%]" },
peg$c107 = "{",
peg$c108 = { type: "literal", value: "{", description: "\"{\"" },
peg$c109 = "}",
peg$c110 = { type: "literal", value: "}", description: "\"}\"" },
peg$c111 = "[",
peg$c112 = { type: "literal", value: "[", description: "\"[\"" },
peg$c113 = "]",
peg$c114 = { type: "literal", value: "]", description: "\"]\"" },
peg$c115 = "\n",
peg$c116 = { type: "literal", value: "\n", description: "\"\\n\"" },
peg$c117 = "\r\n",
peg$c118 = { type: "literal", value: "\r\n", description: "\"\\r\\n\"" },
peg$c119 = "\r",
peg$c120 = { type: "literal", value: "\r", description: "\"\\r\"" },
peg$c121 = "\u2028",
peg$c122 = { type: "literal", value: "\u2028", description: "\"\\u2028\"" },
peg$c123 = "\u2029",
peg$c124 = { type: "literal", value: "\u2029", description: "\"\\u2029\"" },
peg$c125 = /^[\t\x0B\f \xA0\uFEFF]/,
peg$c126 = { type: "class", value: "[\\t\\x0B\\f \\xA0\\uFEFF]", description: "[\\t\\x0B\\f \\xA0\\uFEFF]" },
peg$currPos = 0,
peg$reportedPos = 0,
peg$cachedPos = 0,
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
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$reportedPos, peg$currPos);
}
function offset() {
return peg$reportedPos;
}
function line() {
return peg$computePosDetails(peg$reportedPos).line;
}
function column() {
return peg$computePosDetails(peg$reportedPos).column;
}
function expected(description) {
throw peg$buildException(
null,
[{ type: "other", description: description }],
peg$reportedPos
);
}
function error(message) {
throw peg$buildException(message, null, peg$reportedPos);
}
function peg$computePosDetails(pos) {
function advance(details, startPos, endPos) {
var p, ch;
for (p = startPos; p < endPos; p++) {
ch = input.charAt(p);
if (ch === "\n") {
if (!details.seenCR) { details.line++; }
details.column = 1;
details.seenCR = false;
} else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
details.line++;
details.column = 1;
details.seenCR = true;
} else {
details.column++;
details.seenCR = false;
}
}
}
if (peg$cachedPos !== pos) {
if (peg$cachedPos > pos) {
peg$cachedPos = 0;
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
}
advance(peg$cachedPosDetails, peg$cachedPos, pos);
peg$cachedPos = pos;
}
return peg$cachedPosDetails;
}
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$buildException(message, expected, pos) {
function cleanupExpected(expected) {
var i = 1;
expected.sort(function(a, b) {
if (a.description < b.description) {
return -1;
} else if (a.description > b.description) {
return 1;
} else {
return 0;
}
});
while (i < expected.length) {
if (expected[i - 1] === expected[i]) {
expected.splice(i, 1);
} else {
i++;
}
}
}
function buildMessage(expected, found) {
function stringEscape(s) {
function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
return s
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\x08/g, '\\b')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\f/g, '\\f')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
.replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
.replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
}
var expectedDescs = new Array(expected.length),
expectedDesc, foundDesc, i;
for (i = 0; i < expected.length; i++) {
expectedDescs[i] = expected[i].description;
}
expectedDesc = expected.length > 1
? expectedDescs.slice(0, -1).join(", ")
+ " or "
+ expectedDescs[expected.length - 1]
: expectedDescs[0];
foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
return "Expected " + expectedDesc + " but " + foundDesc + " found.";
}
var posDetails = peg$computePosDetails(pos),
found = pos < input.length ? input.charAt(pos) : null;
if (expected !== null) {
cleanupExpected(expected);
}
return new SyntaxError(
message !== null ? message : buildMessage(expected, found),
expected,
found,
pos,
posDetails.line,
posDetails.column
);
}
function peg$parsestart() {
var s0;
s0 = peg$parsebody();
return s0;
}
function peg$parsebody() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
s2 = peg$parsepart();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsepart();
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c1(s1);
}
s0 = s1;
return s0;
}
function peg$parsepart() {
var s0;
s0 = peg$parseraw();
if (s0 === peg$FAILED) {
s0 = peg$parsecomment();
if (s0 === peg$FAILED) {
s0 = peg$parsesection();
if (s0 === peg$FAILED) {
s0 = peg$parsepartial();
if (s0 === peg$FAILED) {
s0 = peg$parsespecial();
if (s0 === peg$FAILED) {
s0 = peg$parsereference();
if (s0 === peg$FAILED) {
s0 = peg$parsebuffer();
}
}
}
}
}
}
return s0;
}
function peg$parsesection() {
var s0, s1, s2, s3, s4, s5, s6, s7;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parsesec_tag_start();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsews();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsews();
}
if (s2 !== peg$FAILED) {
s3 = peg$parserd();
if (s3 !== peg$FAILED) {
s4 = peg$parsebody();
if (s4 !== peg$FAILED) {
s5 = peg$parsebodies();
if (s5 !== peg$FAILED) {
s6 = peg$parseend_tag();
if (s6 === peg$FAILED) {
s6 = peg$c4;
}
if (s6 !== peg$FAILED) {
peg$reportedPos = peg$currPos;
s7 = peg$c5(s1, s4, s5, s6);
if (s7) {
s7 = peg$c6;
} else {
s7 = peg$c3;
}
if (s7 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c7(s1, s4, s5, s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsesec_tag_start();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsews();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsews();
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 47) {
s3 = peg$c8;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c9); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parserd();
if (s4 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c10(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c2); }
}
return s0;
}
function peg$parsesec_tag_start() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parseld();
if (s1 !== peg$FAILED) {
if (peg$c11.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c12); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
if (s3 !== peg$FAILED) {
s4 = peg$parseidentifier();
if (s4 !== peg$FAILED) {
s5 = peg$parsecontext();
if (s5 !== peg$FAILED) {
s6 = peg$parseparams();
if (s6 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c13(s2, s4, s5, s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
return s0;
}
function peg$parseend_tag() {
var s0, s1, s2, s3, s4, s5, s6;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parseld();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 47) {
s2 = peg$c8;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c9); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
if (s3 !== peg$FAILED) {
s4 = peg$parseidentifier();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parsews();
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parsews();
}
if (s5 !== peg$FAILED) {
s6 = peg$parserd();
if (s6 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c15(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c14); }
}
return s0;
}
function peg$parsecontext() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 58) {
s2 = peg$c16;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c17); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parseidentifier();
if (s3 !== peg$FAILED) {
peg$reportedPos = s1;
s2 = peg$c18(s3);
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$c3;
}
} else {
peg$currPos = s1;
s1 = peg$c3;
}
if (s1 === peg$FAILED) {
s1 = peg$c4;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c19(s1);
}
s0 = s1;
return s0;
}
function peg$parseparams() {
var s0, s1, s2, s3, s4, s5, s6;
peg$silentFails++;
s0 = peg$currPos;
s1 = [];
s2 = peg$currPos;
s3 = [];
s4 = peg$parsews();
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
} else {
s3 = peg$c3;
}
if (s3 !== peg$FAILED) {
s4 = peg$parsekey();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 61) {
s5 = peg$c21;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c22); }
}
if (s5 !== peg$FAILED) {
s6 = peg$parsenumber();
if (s6 === peg$FAILED) {
s6 = peg$parseidentifier();
if (s6 === peg$FAILED) {
s6 = peg$parseinline();
}
}
if (s6 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c23(s4, s6);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$currPos;
s3 = [];
s4 = peg$parsews();
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
} else {
s3 = peg$c3;
}
if (s3 !== peg$FAILED) {
s4 = peg$parsekey();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 61) {
s5 = peg$c21;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c22); }
}
if (s5 !== peg$FAILED) {
s6 = peg$parsenumber();
if (s6 === peg$FAILED) {
s6 = peg$parseidentifier();
if (s6 === peg$FAILED) {
s6 = peg$parseinline();
}
}
if (s6 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c23(s4, s6);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c24(s1);
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c20); }
}
return s0;
}
function peg$parsebodies() {
var s0, s1, s2, s3, s4, s5, s6, s7;
peg$silentFails++;
s0 = peg$currPos;
s1 = [];
s2 = peg$currPos;
s3 = peg$parseld();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s4 = peg$c16;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c17); }
}
if (s4 !== peg$FAILED) {
s5 = peg$parsekey();
if (s5 !== peg$FAILED) {
s6 = peg$parserd();
if (s6 !== peg$FAILED) {
s7 = peg$parsebody();
if (s7 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c23(s5, s7);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$currPos;
s3 = peg$parseld();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s4 = peg$c16;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c17); }
}
if (s4 !== peg$FAILED) {
s5 = peg$parsekey();
if (s5 !== peg$FAILED) {
s6 = peg$parserd();
if (s6 !== peg$FAILED) {
s7 = peg$parsebody();
if (s7 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c23(s5, s7);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c26(s1);
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}
return s0;
}
function peg$parsereference() {
var s0, s1, s2, s3, s4;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parseld();
if (s1 !== peg$FAILED) {
s2 = peg$parseidentifier();
if (s2 !== peg$FAILED) {
s3 = peg$parsefilters();
if (s3 !== peg$FAILED) {
s4 = peg$parserd();
if (s4 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c28(s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c27); }
}
return s0;
}
function peg$parsepartial() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parseld();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 62) {
s2 = peg$c30;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c31); }
}
if (s2 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 43) {
s2 = peg$c32;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c33); }
}
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parsews();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parsews();
}
if (s3 !== peg$FAILED) {
s4 = peg$currPos;
s5 = peg$parsekey();
if (s5 !== peg$FAILED) {
peg$reportedPos = s4;
s5 = peg$c34(s5);
}
s4 = s5;
if (s4 === peg$FAILED) {
s4 = peg$parseinline();
}
if (s4 !== peg$FAILED) {
s5 = peg$parsecontext();
if (s5 !== peg$FAILED) {
s6 = peg$parseparams();
if (s6 !== peg$FAILED) {
s7 = [];
s8 = peg$parsews();
while (s8 !== peg$FAILED) {
s7.push(s8);
s8 = peg$parsews();
}
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 47) {
s8 = peg$c8;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c9); }
}
if (s8 !== peg$FAILED) {
s9 = peg$parserd();
if (s9 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c35(s2, s4, s5, s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c29); }
}
return s0;
}
function peg$parsefilters() {
var s0, s1, s2, s3, s4;
peg$silentFails++;
s0 = peg$currPos;
s1 = [];
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 124) {
s3 = peg$c37;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c38); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parsekey();
if (s4 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c18(s4);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 124) {
s3 = peg$c37;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c38); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parsekey();
if (s4 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c18(s4);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c39(s1);
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c36); }
}
return s0;
}
function peg$parsespecial() {
var s0, s1, s2, s3, s4;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parseld();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 126) {
s2 = peg$c41;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c42); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parsekey();
if (s3 !== peg$FAILED) {
s4 = peg$parserd();
if (s4 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c43(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c40); }
}
return s0;
}
function peg$parseidentifier() {
var s0, s1;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parsepath();
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c45(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsekey();
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c46(s1);
}
s0 = s1;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c44); }
}
return s0;
}
function peg$parsenumber() {
var s0, s1;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parsefloat();
if (s1 === peg$FAILED) {
s1 = peg$parseinteger();
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c48(s1);
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c47); }
}
return s0;
}
function peg$parsefloat() {
var s0, s1, s2, s3, s4;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parseinteger();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s2 = peg$c50;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c51); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parseinteger();
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parseinteger();
}
} else {
s3 = peg$c3;
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c52(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c49); }
}
return s0;
}
function peg$parseinteger() {
var s0, s1, s2;
peg$silentFails++;
s0 = peg$currPos;
s1 = [];
if (peg$c54.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c54.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
}
}
} else {
s1 = peg$c3;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c56(s1);
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c53); }
}
return s0;
}
function peg$parsepath() {
var s0, s1, s2, s3;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parsekey();
if (s1 === peg$FAILED) {
s1 = peg$c4;
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsearray_part();
if (s3 === peg$FAILED) {
s3 = peg$parsearray();
}
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsearray_part();
if (s3 === peg$FAILED) {
s3 = peg$parsearray();
}
}
} else {
s2 = peg$c3;
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c58(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 46) {
s1 = peg$c50;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c51); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsearray_part();
if (s3 === peg$FAILED) {
s3 = peg$parsearray();
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsearray_part();
if (s3 === peg$FAILED) {
s3 = peg$parsearray();
}
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c59(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c57); }
}
return s0;
}
function peg$parsekey() {
var s0, s1, s2, s3;
peg$silentFails++;
s0 = peg$currPos;
if (peg$c61.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c62); }
}
if (s1 !== peg$FAILED) {
s2 = [];
if (peg$c63.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c64); }
}
while (s3 !== peg$FAILED) {
s2.push(s3);
if (peg$c63.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c64); }
}
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c65(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c60); }
}
return s0;
}
function peg$parsearray() {
var s0, s1, s2, s3, s4, s5;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$parselb();
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
s4 = [];
if (peg$c54.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
}
if (s5 !== peg$FAILED) {
while (s5 !== peg$FAILED) {
s4.push(s5);
if (peg$c54.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
}
}
} else {
s4 = peg$c3;
}
if (s4 !== peg$FAILED) {
peg$reportedPos = s3;
s4 = peg$c67(s4);
}
s3 = s4;
if (s3 === peg$FAILED) {
s3 = peg$parseidentifier();
}
if (s3 !== peg$FAILED) {
s4 = peg$parserb();
if (s4 !== peg$FAILED) {
peg$reportedPos = s1;
s2 = peg$c68(s3);
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$c3;
}
} else {
peg$currPos = s1;
s1 = peg$c3;
}
} else {
peg$currPos = s1;
s1 = peg$c3;
}
if (s1 !== peg$FAILED) {
s2 = peg$parsearray_part();
if (s2 === peg$FAILED) {
s2 = peg$c4;
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c69(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
return s0;
}
function peg$parsearray_part() {
var s0, s1, s2, s3, s4;
peg$silentFails++;
s0 = peg$currPos;
s1 = [];
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 46) {
s3 = peg$c50;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c51); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parsekey();
if (s4 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c71(s4);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 46) {
s3 = peg$c50;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c51); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parsekey();
if (s4 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c71(s4);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
}
} else {
s1 = peg$c3;
}
if (s1 !== peg$FAILED) {
s2 = peg$parsearray();
if (s2 === peg$FAILED) {
s2 = peg$c4;
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c72(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c70); }
}
return s0;
}
function peg$parseinline() {
var s0, s1, s2, s3;
peg$silentFails++;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 34) {
s1 = peg$c74;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c75); }
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 34) {
s2 = peg$c74;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c75); }
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c76();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 34) {
s1 = peg$c74;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c75); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parseliteral();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 34) {
s3 = peg$c74;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c75); }
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c77(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 34) {
s1 = peg$c74;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c75); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseinline_part();
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseinline_part();
}
} else {
s2 = peg$c3;
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 34) {
s3 = peg$c74;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c75); }
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c78(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c73); }
}
return s0;
}
function peg$parseinline_part() {
var s0, s1;
s0 = peg$parsespecial();
if (s0 === peg$FAILED) {
s0 = peg$parsereference();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseliteral();
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c79(s1);
}
s0 = s1;
}
}
return s0;
}
function peg$parsebuffer() {
var s0, s1, s2, s3, s4, s5, s6, s7;
peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parseeol();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsews();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsews();
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c81(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = [];
s2 = peg$currPos;
s3 = peg$currPos;
peg$silentFails++;
s4 = peg$parsetag();
peg$silentFails--;
if (s4 === peg$FAILED) {
s3 = peg$c6;
} else {
peg$currPos = s3;
s3 = peg$c3;
}
if (s3 !== peg$FAILED) {
s4 = peg$currPos;
peg$silentFails++;
s5 = peg$parseraw();
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = peg$c6;
} else {
peg$currPos = s4;
s4 = peg$c3;
}
if (s4 !== peg$FAILED) {
s5 = peg$currPos;
peg$silentFails++;
s6 = peg$parsecomment();
peg$silentFails--;
if (s6 === peg$FAILED) {
s5 = peg$c6;
} else {
peg$currPos = s5;
s5 = peg$c3;
}
if (s5 !== peg$FAILED) {
s6 = peg$currPos;
peg$silentFails++;
s7 = peg$parseeol();
peg$silentFails--;
if (s7 === peg$FAILED) {
s6 = peg$c6;
} else {
peg$currPos = s6;
s6 = peg$c3;
}
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$c82); }
}
if (s7 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c83(s7);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$currPos;
s3 = peg$currPos;
peg$silentFails++;
s4 = peg$parsetag();
peg$silentFails--;
if (s4 === peg$FAILED) {
s3 = peg$c6;
} else {
peg$currPos = s3;
s3 = peg$c3;
}
if (s3 !== peg$FAILED) {
s4 = peg$currPos;
peg$silentFails++;
s5 = peg$parseraw();
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = peg$c6;
} else {
peg$currPos = s4;
s4 = peg$c3;
}
if (s4 !== peg$FAILED) {
s5 = peg$currPos;
peg$silentFails++;
s6 = peg$parsecomment();
peg$silentFails--;
if (s6 === peg$FAILED) {
s5 = peg$c6;
} else {
peg$currPos = s5;
s5 = peg$c3;
}
if (s5 !== peg$FAILED) {
s6 = peg$currPos;
peg$silentFails++;
s7 = peg$parseeol();
peg$silentFails--;
if (s7 === peg$FAILED) {
s6 = peg$c6;
} else {
peg$currPos = s6;
s6 = peg$c3;
}
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$c82); }
}
if (s7 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c83(s7);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
}
} else {
s1 = peg$c3;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c84(s1);
}
s0 = s1;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c80); }
}
return s0;
}
function peg$parseliteral() {
var s0, s1, s2, s3, s4;
peg$silentFails++;
s0 = peg$currPos;
s1 = [];
s2 = peg$currPos;
s3 = peg$currPos;
peg$silentFails++;
s4 = peg$parsetag();
peg$silentFails--;
if (s4 === peg$FAILED) {
s3 = peg$c6;
} else {
peg$currPos = s3;
s3 = peg$c3;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseesc();
if (s4 === peg$FAILED) {
if (peg$c86.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c87); }
}
}
if (s4 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c83(s4);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$currPos;
s3 = peg$currPos;
peg$silentFails++;
s4 = peg$parsetag();
peg$silentFails--;
if (s4 === peg$FAILED) {
s3 = peg$c6;
} else {
peg$currPos = s3;
s3 = peg$c3;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseesc();
if (s4 === peg$FAILED) {
if (peg$c86.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c87); }
}
}
if (s4 !== peg$FAILED) {
peg$reportedPos = s2;
s3 = peg$c83(s4);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$c3;
}
} else {
peg$currPos = s2;
s2 = peg$c3;
}
}
} else {
s1 = peg$c3;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c88(s1);
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c85); }
}
return s0;
}
function peg$parseesc() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c89) {
s1 = peg$c89;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c90); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c91();
}
s0 = s1;
return s0;
}
function peg$parseraw() {
var s0, s1, s2, s3, s4, s5;
peg$silentFails++;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c93) {
s1 = peg$c93;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c94); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$currPos;
peg$silentFails++;
if (input.substr(peg$currPos, 2) === peg$c95) {
s5 = peg$c95;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c96); }
}
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = peg$c6;
} else {
peg$currPos = s4;
s4 = peg$c3;
}
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$c82); }
}
if (s5 !== peg$FAILED) {
peg$reportedPos = s3;
s4 = peg$c97(s5);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$c3;
}
} else {
peg$currPos = s3;
s3 = peg$c3;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$currPos;
peg$silentFails++;
if (input.substr(peg$currPos, 2) === peg$c95) {
s5 = peg$c95;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c96); }
}
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = peg$c6;
} else {
peg$currPos = s4;
s4 = peg$c3;
}
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$c82); }
}
if (s5 !== peg$FAILED) {
peg$reportedPos = s3;
s4 = peg$c97(s5);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$c3;
}
} else {
peg$currPos = s3;
s3 = peg$c3;
}
}
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c95) {
s3 = peg$c95;
peg$currPos += 2;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c96); }
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c98(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c92); }
}
return s0;
}
function peg$parsecomment() {
var s0, s1, s2, s3, s4, s5;
peg$silentFails++;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c100) {
s1 = peg$c100;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c101); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$currPos;
peg$silentFails++;
if (input.substr(peg$currPos, 2) === peg$c102) {
s5 = peg$c102;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c103); }
}
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = peg$c6;
} else {
peg$currPos = s4;
s4 = peg$c3;
}
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$c82); }
}
if (s5 !== peg$FAILED) {
peg$reportedPos = s3;
s4 = peg$c83(s5);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$c3;
}
} else {
peg$currPos = s3;
s3 = peg$c3;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$currPos;
peg$silentFails++;
if (input.substr(peg$currPos, 2) === peg$c102) {
s5 = peg$c102;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c103); }
}
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = peg$c6;
} else {
peg$currPos = s4;
s4 = peg$c3;
}
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$c82); }
}
if (s5 !== peg$FAILED) {
peg$reportedPos = s3;
s4 = peg$c83(s5);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$c3;
}
} else {
peg$currPos = s3;
s3 = peg$c3;
}
}
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c102) {
s3 = peg$c102;
peg$currPos += 2;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c103); }
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c104(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c99); }
}
return s0;
}
function peg$parsetag() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
s0 = peg$currPos;
s1 = peg$parseld();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsews();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsews();
}
if (s2 !== peg$FAILED) {
if (peg$c105.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c106); }
}
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parsews();
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parsews();
}
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$currPos;
s7 = peg$currPos;
peg$silentFails++;
s8 = peg$parserd();
peg$silentFails--;
if (s8 === peg$FAILED) {
s7 = peg$c6;
} else {
peg$currPos = s7;
s7 = peg$c3;
}
if (s7 !== peg$FAILED) {
s8 = peg$currPos;
peg$silentFails++;
s9 = peg$parseeol();
peg$silentFails--;
if (s9 === peg$FAILED) {
s8 = peg$c6;
} else {
peg$currPos = s8;
s8 = peg$c3;
}
if (s8 !== peg$FAILED) {
if (input.length > peg$currPos) {
s9 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s9 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c82); }
}
if (s9 !== peg$FAILED) {
s7 = [s7, s8, s9];
s6 = s7;
} else {
peg$currPos = s6;
s6 = peg$c3;
}
} else {
peg$currPos = s6;
s6 = peg$c3;
}
} else {
peg$currPos = s6;
s6 = peg$c3;
}
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$currPos;
s7 = peg$currPos;
peg$silentFails++;
s8 = peg$parserd();
peg$silentFails--;
if (s8 === peg$FAILED) {
s7 = peg$c6;
} else {
peg$currPos = s7;
s7 = peg$c3;
}
if (s7 !== peg$FAILED) {
s8 = peg$currPos;
peg$silentFails++;
s9 = peg$parseeol();
peg$silentFails--;
if (s9 === peg$FAILED) {
s8 = peg$c6;
} else {
peg$currPos = s8;
s8 = peg$c3;
}
if (s8 !== peg$FAILED) {
if (input.length > peg$currPos) {
s9 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s9 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c82); }
}
if (s9 !== peg$FAILED) {
s7 = [s7, s8, s9];
s6 = s7;
} else {
peg$currPos = s6;
s6 = peg$c3;
}
} else {
peg$currPos = s6;
s6 = peg$c3;
}
} else {
peg$currPos = s6;
s6 = peg$c3;
}
}
} else {
s5 = peg$c3;
}
if (s5 !== peg$FAILED) {
s6 = [];
s7 = peg$parsews();
while (s7 !== peg$FAILED) {
s6.push(s7);
s7 = peg$parsews();
}
if (s6 !== peg$FAILED) {
s7 = peg$parserd();
if (s7 !== peg$FAILED) {
s1 = [s1, s2, s3, s4, s5, s6, s7];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
} else {
peg$currPos = s0;
s0 = peg$c3;
}
if (s0 === peg$FAILED) {
s0 = peg$parsereference();
}
return s0;
}
function peg$parseld() {
var s0;
if (input.charCodeAt(peg$currPos) === 123) {
s0 = peg$c107;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c108); }
}
return s0;
}
function peg$parserd() {
var s0;
if (input.charCodeAt(peg$currPos) === 125) {
s0 = peg$c109;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c110); }
}
return s0;
}
function peg$parselb() {
var s0;
if (input.charCodeAt(peg$currPos) === 91) {
s0 = peg$c111;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c112); }
}
return s0;
}
function peg$parserb() {
var s0;
if (input.charCodeAt(peg$currPos) === 93) {
s0 = peg$c113;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c114); }
}
return s0;
}
function peg$parseeol() {
var s0;
if (input.charCodeAt(peg$currPos) === 10) {
s0 = peg$c115;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c116); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c117) {
s0 = peg$c117;
peg$currPos += 2;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c118); }
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 13) {
s0 = peg$c119;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c120); }
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 8232) {
s0 = peg$c121;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c122); }
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 8233) {
s0 = peg$c123;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c124); }
}
}
}
}
}
return s0;
}
function peg$parsews() {
var s0;
if (peg$c125.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c126); }
}
if (s0 === peg$FAILED) {
s0 = peg$parseeol();
}
return s0;
}
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({ type: "end", description: "end of input" });
}
throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
}
}
return {
SyntaxError: SyntaxError,
parse: parse
};
})();
// expose parser methods
dust.parse = parser.parse;
return parser;
}));