aqueous
Version:
Proportional vertical layouts
1,367 lines (1,285 loc) • 68.3 kB
JavaScript
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$FAILED,
peg$c1 = null,
peg$c2 = function(e, extra) {return {"node":e.join("")||"div","extra":extra}},
peg$c3 = /^[^.#,>+~[\]|=\^$*:)( ]/,
peg$c4 = { type: "class", value: "[^.#,>+~[\\]|=\\^$*:)( ]", description: "[^.#,>+~[\\]|=\\^$*:)( ]" },
peg$c5 = [],
peg$c6 = "*",
peg$c7 = { type: "literal", value: "*", description: "\"*\"" },
peg$c8 = function(node) {return node},
peg$c9 = ":",
peg$c10 = { type: "literal", value: ":", description: "\":\"" },
peg$c11 = "active",
peg$c12 = { type: "literal", value: "active", description: "\"active\"" },
peg$c13 = "after",
peg$c14 = { type: "literal", value: "after", description: "\"after\"" },
peg$c15 = "before",
peg$c16 = { type: "literal", value: "before", description: "\"before\"" },
peg$c17 = "checked",
peg$c18 = { type: "literal", value: "checked", description: "\"checked\"" },
peg$c19 = "disabled",
peg$c20 = { type: "literal", value: "disabled", description: "\"disabled\"" },
peg$c21 = "empty",
peg$c22 = { type: "literal", value: "empty", description: "\"empty\"" },
peg$c23 = "enabled",
peg$c24 = { type: "literal", value: "enabled", description: "\"enabled\"" },
peg$c25 = "first-child",
peg$c26 = { type: "literal", value: "first-child", description: "\"first-child\"" },
peg$c27 = "first-letter",
peg$c28 = { type: "literal", value: "first-letter", description: "\"first-letter\"" },
peg$c29 = "first-line",
peg$c30 = { type: "literal", value: "first-line", description: "\"first-line\"" },
peg$c31 = "first-of-type",
peg$c32 = { type: "literal", value: "first-of-type", description: "\"first-of-type\"" },
peg$c33 = "focus",
peg$c34 = { type: "literal", value: "focus", description: "\"focus\"" },
peg$c35 = "hover",
peg$c36 = { type: "literal", value: "hover", description: "\"hover\"" },
peg$c37 = "in-range",
peg$c38 = { type: "literal", value: "in-range", description: "\"in-range\"" },
peg$c39 = "invalid",
peg$c40 = { type: "literal", value: "invalid", description: "\"invalid\"" },
peg$c41 = "last-child",
peg$c42 = { type: "literal", value: "last-child", description: "\"last-child\"" },
peg$c43 = "last-of-type",
peg$c44 = { type: "literal", value: "last-of-type", description: "\"last-of-type\"" },
peg$c45 = "link",
peg$c46 = { type: "literal", value: "link", description: "\"link\"" },
peg$c47 = "only-of-type",
peg$c48 = { type: "literal", value: "only-of-type", description: "\"only-of-type\"" },
peg$c49 = "only-child",
peg$c50 = { type: "literal", value: "only-child", description: "\"only-child\"" },
peg$c51 = "optional",
peg$c52 = { type: "literal", value: "optional", description: "\"optional\"" },
peg$c53 = "out-of-range",
peg$c54 = { type: "literal", value: "out-of-range", description: "\"out-of-range\"" },
peg$c55 = "read-only",
peg$c56 = { type: "literal", value: "read-only", description: "\"read-only\"" },
peg$c57 = "read-write",
peg$c58 = { type: "literal", value: "read-write", description: "\"read-write\"" },
peg$c59 = "required",
peg$c60 = { type: "literal", value: "required", description: "\"required\"" },
peg$c61 = "root",
peg$c62 = { type: "literal", value: "root", description: "\"root\"" },
peg$c63 = "selection",
peg$c64 = { type: "literal", value: "selection", description: "\"selection\"" },
peg$c65 = "target",
peg$c66 = { type: "literal", value: "target", description: "\"target\"" },
peg$c67 = "valid",
peg$c68 = { type: "literal", value: "valid", description: "\"valid\"" },
peg$c69 = "visited",
peg$c70 = { type: "literal", value: "visited", description: "\"visited\"" },
peg$c71 = function(p, extra) {var a={};a.pseudo=p;a.extra=extra||{};return a},
peg$c72 = "lang",
peg$c73 = { type: "literal", value: "lang", description: "\"lang\"" },
peg$c74 = "nth-child",
peg$c75 = { type: "literal", value: "nth-child", description: "\"nth-child\"" },
peg$c76 = "nth-last-child",
peg$c77 = { type: "literal", value: "nth-last-child", description: "\"nth-last-child\"" },
peg$c78 = "nth-last-of-type",
peg$c79 = { type: "literal", value: "nth-last-of-type", description: "\"nth-last-of-type\"" },
peg$c80 = "nth-of-type",
peg$c81 = { type: "literal", value: "nth-of-type", description: "\"nth-of-type\"" },
peg$c82 = "(",
peg$c83 = { type: "literal", value: "(", description: "\"(\"" },
peg$c84 = /^[0-9]/,
peg$c85 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c86 = ")",
peg$c87 = { type: "literal", value: ")", description: "\")\"" },
peg$c88 = function(p, v, extra) {var a={};a.pseudo=p;a.value=v.join("");a.extra=extra||{};return a},
peg$c89 = "not",
peg$c90 = { type: "literal", value: "not", description: "\"not\"" },
peg$c91 = function(p, e, v, extra) {var a={};a.pseudo=p;a.value={};a.value.node=e.join("")||"div";a.value.extra=v;a.extra=extra||{};return a},
peg$c92 = "[",
peg$c93 = { type: "literal", value: "[", description: "\"[\"" },
peg$c94 = "]",
peg$c95 = { type: "literal", value: "]", description: "\"]\"" },
peg$c96 = function(cond, extra) {cond.extra=extra||{};return cond},
peg$c97 = ".",
peg$c98 = { type: "literal", value: ".", description: "\".\"" },
peg$c99 = function(val, extra) {return {"class":val.join(""),"extra":extra||{}}},
peg$c100 = "#",
peg$c101 = { type: "literal", value: "#", description: "\"#\"" },
peg$c102 = function(val, extra) {return {"id":val.join(""),"extra":extra||{}}},
peg$c103 = " ",
peg$c104 = { type: "literal", value: " ", description: "\" \"" },
peg$c105 = ",",
peg$c106 = { type: "literal", value: ",", description: "\",\"" },
peg$c107 = function(e, extra) {return {"node":e.join(""),"extra":extra||{}}},
peg$c108 = function(e, extra) {return {"contains":e.join(""),"extra":extra||{}}},
peg$c109 = ">",
peg$c110 = { type: "literal", value: ">", description: "\">\"" },
peg$c111 = function(e, extra) {return {"child":e.join(""),"extra":extra||{}}},
peg$c112 = "+",
peg$c113 = { type: "literal", value: "+", description: "\"+\"" },
peg$c114 = function(e, extra) {return {"immediate_child":e.join(""),"extra":extra||{}}},
peg$c115 = "~",
peg$c116 = { type: "literal", value: "~", description: "\"~\"" },
peg$c117 = function(e, extra) {return {"after":e.join(""),"extra":extra||{}}},
peg$c118 = function(attr) {return {"attr":attr.join("")}},
peg$c119 = "=",
peg$c120 = { type: "literal", value: "=", description: "\"=\"" },
peg$c121 = /^[^\]]/,
peg$c122 = { type: "class", value: "[^\\]]", description: "[^\\]]" },
peg$c123 = function(attr, val) {return {"attr_is":attr.join(""),"value":val.join("")}},
peg$c124 = "~=",
peg$c125 = { type: "literal", value: "~=", description: "\"~=\"" },
peg$c126 = function(attr, val) {return {"attr_has_word":attr.join(""),"value":val.join("")}},
peg$c127 = "|=",
peg$c128 = { type: "literal", value: "|=", description: "\"|=\"" },
peg$c129 = function(attr, val) {return {"attr_starts_hyphen":attr.join(""),"value":val.join("")}},
peg$c130 = "^=",
peg$c131 = { type: "literal", value: "^=", description: "\"^=\"" },
peg$c132 = function(attr, val) {return {"attr_starts":attr.join(""),"value":val.join("")}},
peg$c133 = "$=",
peg$c134 = { type: "literal", value: "$=", description: "\"$=\"" },
peg$c135 = function(attr, val) {return {"attr_ends":attr.join(""),"value":val.join("")}},
peg$c136 = "*=",
peg$c137 = { type: "literal", value: "*=", description: "\"*=\"" },
peg$c138 = function(attr, val) {return {"attr_has":attr.join(""),"value":val.join("")}},
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, s1, s2;
s0 = peg$currPos;
s1 = peg$parseelement();
if (s1 === peg$FAILED) {
s1 = peg$c1;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseextra();
if (s2 === peg$FAILED) {
s2 = peg$c1;
}
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c2(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parsevalid() {
var s0;
if (peg$c3.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c4); }
}
return s0;
}
function peg$parseelement() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
s2 = peg$parsevalid();
if (s2 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 42) {
s2 = peg$c6;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c7); }
}
}
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsevalid();
if (s2 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 42) {
s2 = peg$c6;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c7); }
}
}
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c8(s1);
}
s0 = s1;
return s0;
}
function peg$parseextra() {
var s0;
s0 = peg$parseattributes();
if (s0 === peg$FAILED) {
s0 = peg$parsepseudo();
if (s0 === peg$FAILED) {
s0 = peg$parsepseudoSpecial();
if (s0 === peg$FAILED) {
s0 = peg$parsepseudoSpecialO();
if (s0 === peg$FAILED) {
s0 = peg$parsemulti();
if (s0 === peg$FAILED) {
s0 = peg$parsechild();
if (s0 === peg$FAILED) {
s0 = peg$parseichild();
if (s0 === peg$FAILED) {
s0 = peg$parseafter();
if (s0 === peg$FAILED) {
s0 = peg$parsecontains();
if (s0 === peg$FAILED) {
s0 = peg$parsebrackets();
}
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseattributes() {
var s0;
s0 = peg$parseclass();
if (s0 === peg$FAILED) {
s0 = peg$parseid();
}
return s0;
}
function peg$parsepseudo() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 58) {
s1 = peg$c9;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s2 = peg$c9;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (s2 === peg$FAILED) {
s2 = peg$c1;
}
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c11) {
s3 = peg$c11;
peg$currPos += 6;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c12); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c13) {
s3 = peg$c13;
peg$currPos += 5;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c14); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c15) {
s3 = peg$c15;
peg$currPos += 6;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c16); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c17) {
s3 = peg$c17;
peg$currPos += 7;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c18); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 8) === peg$c19) {
s3 = peg$c19;
peg$currPos += 8;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c20); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c21) {
s3 = peg$c21;
peg$currPos += 5;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c22); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c23) {
s3 = peg$c23;
peg$currPos += 7;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c24); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 11) === peg$c25) {
s3 = peg$c25;
peg$currPos += 11;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c26); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 12) === peg$c27) {
s3 = peg$c27;
peg$currPos += 12;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c28); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 10) === peg$c29) {
s3 = peg$c29;
peg$currPos += 10;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c30); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 13) === peg$c31) {
s3 = peg$c31;
peg$currPos += 13;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c32); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c33) {
s3 = peg$c33;
peg$currPos += 5;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c34); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c35) {
s3 = peg$c35;
peg$currPos += 5;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c36); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 8) === peg$c37) {
s3 = peg$c37;
peg$currPos += 8;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c38); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c39) {
s3 = peg$c39;
peg$currPos += 7;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c40); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 10) === peg$c41) {
s3 = peg$c41;
peg$currPos += 10;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c42); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 12) === peg$c43) {
s3 = peg$c43;
peg$currPos += 12;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c44); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c45) {
s3 = peg$c45;
peg$currPos += 4;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c46); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 12) === peg$c47) {
s3 = peg$c47;
peg$currPos += 12;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c48); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 10) === peg$c49) {
s3 = peg$c49;
peg$currPos += 10;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c50); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 8) === peg$c51) {
s3 = peg$c51;
peg$currPos += 8;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c52); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 12) === peg$c53) {
s3 = peg$c53;
peg$currPos += 12;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c54); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 9) === peg$c55) {
s3 = peg$c55;
peg$currPos += 9;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c56); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 10) === peg$c57) {
s3 = peg$c57;
peg$currPos += 10;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c58); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 8) === peg$c59) {
s3 = peg$c59;
peg$currPos += 8;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c60); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c61) {
s3 = peg$c61;
peg$currPos += 4;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c62); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 9) === peg$c63) {
s3 = peg$c63;
peg$currPos += 9;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c64); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c65) {
s3 = peg$c65;
peg$currPos += 6;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c67) {
s3 = peg$c67;
peg$currPos += 5;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c68); }
}
if (s3 === peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c69) {
s3 = peg$c69;
peg$currPos += 7;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c70); }
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parseextra();
if (s4 === peg$FAILED) {
s4 = peg$c1;
}
if (s4 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c71(s3, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parsepseudoSpecial() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 58) {
s1 = peg$c9;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c72) {
s2 = peg$c72;
peg$currPos += 4;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c73); }
}
if (s2 === peg$FAILED) {
if (input.substr(peg$currPos, 9) === peg$c74) {
s2 = peg$c74;
peg$currPos += 9;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c75); }
}
if (s2 === peg$FAILED) {
if (input.substr(peg$currPos, 14) === peg$c76) {
s2 = peg$c76;
peg$currPos += 14;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c77); }
}
if (s2 === peg$FAILED) {
if (input.substr(peg$currPos, 16) === peg$c78) {
s2 = peg$c78;
peg$currPos += 16;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c79); }
}
if (s2 === peg$FAILED) {
if (input.substr(peg$currPos, 11) === peg$c80) {
s2 = peg$c80;
peg$currPos += 11;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c81); }
}
}
}
}
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c82;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c83); }
}
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parsevalid();
if (s5 === peg$FAILED) {
if (peg$c84.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c85); }
}
}
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parsevalid();
if (s5 === peg$FAILED) {
if (peg$c84.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c85); }
}
}
}
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s5 = peg$c86;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c87); }
}
if (s5 !== peg$FAILED) {
s6 = peg$parseextra();
if (s6 === peg$FAILED) {
s6 = peg$c1;
}
if (s6 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c88(s2, s4, s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parsepseudoSpecialO() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 58) {
s1 = peg$c9;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 3) === peg$c89) {
s2 = peg$c89;
peg$currPos += 3;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c90); }
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c82;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c83); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parseelement();
if (s4 === peg$FAILED) {
s4 = peg$c1;
}
if (s4 !== peg$FAILED) {
s5 = peg$parseextra();
if (s5 === peg$FAILED) {
s5 = peg$c1;
}
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s6 = peg$c86;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c87); }
}
if (s6 !== peg$FAILED) {
s7 = peg$parseextra();
if (s7 === peg$FAILED) {
s7 = peg$c1;
}
if (s7 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c91(s2, s4, s5, s7);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parsebrackets() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 91) {
s1 = peg$c92;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c93); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parseequal();
if (s2 === peg$FAILED) {
s2 = peg$parsehasword();
if (s2 === peg$FAILED) {
s2 = peg$parsehas();
if (s2 === peg$FAILED) {
s2 = peg$parsestartsh();
if (s2 === peg$FAILED) {
s2 = peg$parsestarts();
if (s2 === peg$FAILED) {
s2 = peg$parseend();
if (s2 === peg$FAILED) {
s2 = peg$parseattr();
}
}
}
}
}
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s3 = peg$c94;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c95); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parseextra();
if (s4 === peg$FAILED) {
s4 = peg$c1;
}
if (s4 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c96(s2, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parseclass() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 46) {
s1 = peg$c97;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c98); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsevalid();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsevalid();
}
if (s2 !== peg$FAILED) {
s3 = peg$parseextra();
if (s3 === peg$FAILED) {
s3 = peg$c1;
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c99(s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parseid() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 35) {
s1 = peg$c100;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c101); }
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parsevalid();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parsevalid();
}
if (s2 !== peg$FAILED) {
s3 = peg$parseextra();
if (s3 === peg$FAILED) {
s3 = peg$c1;
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c102(s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parsemulti() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 32) {
s1 = peg$c103;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c104); }
}
if (s1 === peg$FAILED) {
s1 = peg$c1;
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s2 = peg$c105;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c106); }
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 32) {
s3 = peg$c103;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c104); }
}
if (s3 === peg$FAILED) {
s3 = peg$c1;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseelement();
if (s4 !== peg$FAILED) {
s5 = peg$parseextra();
if (s5 === peg$FAILED) {
s5 = peg$c1;
}
if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c107(s4, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parsecontains() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 32) {
s1 = peg$c103;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c104); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parseelement();
if (s2 !== peg$FAILED) {
s3 = peg$parseextra();
if (s3 === peg$FAILED) {
s3 = peg$c1;
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c108(s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parsechild() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 32) {
s1 = peg$c103;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c104); }
}
if (s1 === peg$FAILED) {
s1 = peg$c1;
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 62) {
s2 = peg$c109;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c110); }
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 32) {
s3 = peg$c103;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c104); }
}
if (s3 === peg$FAILED) {
s3 = peg$c1;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseelement();
if (s4 !== peg$FAILED) {
s5 = peg$parseextra();
if (s5 === peg$FAILED) {
s5 = peg$c1;
}
if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c111(s4, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
} else {
peg$currPos = s0;
s0 = peg$c0;
}
return s0;
}
function peg$parseichild() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 32) {
s1 = peg$c103;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c104); }
}
if (s1 === peg$FAILED) {
s1 = peg$c1;
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 43) {
s2 = peg$c112;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c113); }
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 32) {
s3 = peg$c103;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c104); }
}
if (s3 === peg$FAILED) {
s3 = peg$c1;
}
if