module.exports = (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 = { Grammar: peg$parseGrammar }, peg$startRuleFunction = peg$parseGrammar, peg$c0 = peg$FAILED, peg$c1 = null, peg$c2 = [], peg$c3 = function(initializer, rules) { return { type: "grammar", initializer: extractOptional(initializer, 0), rules: extractList(rules, 0) }; }, peg$c4 = ";", peg$c5 = { type: "literal", value: ";", description: "\";\"" }, peg$c6 = function(code) { return { type: "initializer", code: code }; }, peg$c7 = "=", peg$c8 = { type: "literal", value: "=", description: "\"=\"" }, peg$c9 = function(name, displayName, expression) { return { type: "rule", name: name, expression: displayName !== null ? { type: "named", name: displayName[0], expression: expression } : expression }; }, peg$c10 = "/", peg$c11 = { type: "literal", value: "/", description: "\"/\"" }, peg$c12 = function(first, rest) { return rest.length > 0 ? { type: "choice", alternatives: buildList(first, rest, 3) } : first; }, peg$c13 = function(first, rest, code) { var expression = rest.length > 0 ? { type: "sequence", elements: buildList(first, rest, 1) } : first; return { type: "action", expression: expression, code: code }; }, peg$c14 = function(first, rest) { return rest.length > 0 ? { type: "sequence", elements: buildList(first, rest, 1) } : first; }, peg$c15 = ":", peg$c16 = { type: "literal", value: ":", description: "\":\"" }, peg$c17 = function(label, expression) { return { type: "labeled", label: label, expression: expression }; }, peg$c18 = "$", peg$c19 = { type: "literal", value: "$", description: "\"$\"" }, peg$c20 = function(expression) { return { type: "text", expression: expression }; }, peg$c21 = "&", peg$c22 = { type: "literal", value: "&", description: "\"&\"" }, peg$c23 = function(code) { return { type: "semantic_and", code: code }; }, peg$c24 = function(expression) { return { type: "simple_and", expression: expression }; }, peg$c25 = "!", peg$c26 = { type: "literal", value: "!", description: "\"!\"" }, peg$c27 = function(code) { return { type: "semantic_not", code: code }; }, peg$c28 = function(expression) { return { type: "simple_not", expression: expression }; }, peg$c29 = "?", peg$c30 = { type: "literal", value: "?", description: "\"?\"" }, peg$c31 = function(expression) { return { type: "optional", expression: expression }; }, peg$c32 = "*", peg$c33 = { type: "literal", value: "*", description: "\"*\"" }, peg$c34 = function(expression) { return { type: "zero_or_more", expression: expression }; }, peg$c35 = "+", peg$c36 = { type: "literal", value: "+", description: "\"+\"" }, peg$c37 = function(expression) { return { type: "one_or_more", expression: expression }; }, peg$c38 = void 0, peg$c39 = function(name) { return { type: "rule_ref", name: name }; }, peg$c40 = ".", peg$c41 = { type: "literal", value: ".", description: "\".\"" }, peg$c42 = function() { return { type: "any" }; }, peg$c43 = "(", peg$c44 = { type: "literal", value: "(", description: "\"(\"" }, peg$c45 = ")", peg$c46 = { type: "literal", value: ")", description: "\")\"" }, peg$c47 = function(expression) { return expression; }, peg$c48 = { type: "any", description: "any character" }, peg$c49 = { type: "other", description: "whitespace" }, peg$c50 = "\t", peg$c51 = { type: "literal", value: "\t", description: "\"\\t\"" }, peg$c52 = "\x0B", peg$c53 = { type: "literal", value: "\x0B", description: "\"\\x0B\"" }, peg$c54 = "\f", peg$c55 = { type: "literal", value: "\f", description: "\"\\f\"" }, peg$c56 = " ", peg$c57 = { type: "literal", value: " ", description: "\" \"" }, peg$c58 = "\xA0", peg$c59 = { type: "literal", value: "\xA0", description: "\"\\xA0\"" }, peg$c60 = "\uFEFF", peg$c61 = { type: "literal", value: "\uFEFF", description: "\"\\uFEFF\"" }, peg$c62 = /^[\n\r\u2028\u2029]/, peg$c63 = { type: "class", value: "[\\n\\r\\u2028\\u2029]", description: "[\\n\\r\\u2028\\u2029]" }, peg$c64 = { type: "other", description: "end of line" }, peg$c65 = "\n", peg$c66 = { type: "literal", value: "\n", description: "\"\\n\"" }, peg$c67 = "\r\n", peg$c68 = { type: "literal", value: "\r\n", description: "\"\\r\\n\"" }, peg$c69 = "\r", peg$c70 = { type: "literal", value: "\r", description: "\"\\r\"" }, peg$c71 = "\u2028", peg$c72 = { type: "literal", value: "\u2028", description: "\"\\u2028\"" }, peg$c73 = "\u2029", peg$c74 = { type: "literal", value: "\u2029", description: "\"\\u2029\"" }, peg$c75 = { type: "other", description: "comment" }, peg$c76 = "/*", peg$c77 = { type: "literal", value: "/*", description: "\"/*\"" }, peg$c78 = "*/", peg$c79 = { type: "literal", value: "*/", description: "\"*/\"" }, peg$c80 = "//", peg$c81 = { type: "literal", value: "//", description: "\"//\"" }, peg$c82 = { type: "other", description: "action" }, peg$c83 = function(braced) { return braced.substr(1, braced.length - 2); }, peg$c84 = "{", peg$c85 = { type: "literal", value: "{", description: "\"{\"" }, peg$c86 = "}", peg$c87 = { type: "literal", value: "}", description: "\"}\"" }, peg$c88 = /^[^{}]/, peg$c89 = { type: "class", value: "[^{}]", description: "[^{}]" }, peg$c90 = { type: "other", description: "identifier" }, peg$c91 = "_", peg$c92 = { type: "literal", value: "_", description: "\"_\"" }, peg$c93 = /^[a-z]/, peg$c94 = { type: "class", value: "[a-z]", description: "[a-z]" }, peg$c95 = /^[A-Z]/, peg$c96 = { type: "class", value: "[A-Z]", description: "[A-Z]" }, peg$c97 = { type: "other", description: "literal" }, peg$c98 = "i", peg$c99 = { type: "literal", value: "i", description: "\"i\"" }, peg$c100 = function(value, ignoreCase) { return { type: "literal", value: value, ignoreCase: ignoreCase !== null }; }, peg$c101 = { type: "other", description: "string" }, peg$c102 = "\"", peg$c103 = { type: "literal", value: "\"", description: "\"\\\"\"" }, peg$c104 = function(chars) { return chars.join(""); }, peg$c105 = "'", peg$c106 = { type: "literal", value: "'", description: "\"'\"" }, peg$c107 = "\\", peg$c108 = { type: "literal", value: "\\", description: "\"\\\\\"" }, peg$c109 = function() { return text(); }, peg$c110 = function(sequence) { return sequence; }, peg$c111 = { type: "other", description: "character class" }, peg$c112 = "[", peg$c113 = { type: "literal", value: "[", description: "\"[\"" }, peg$c114 = "^", peg$c115 = { type: "literal", value: "^", description: "\"^\"" }, peg$c116 = "]", peg$c117 = { type: "literal", value: "]", description: "\"]\"" }, peg$c118 = function(inverted, parts, ignoreCase) { return { type: "class", parts: parts, inverted: inverted !== null, ignoreCase: ignoreCase !== null, rawText: text() }; }, peg$c119 = "-", peg$c120 = { type: "literal", value: "-", description: "\"-\"" }, peg$c121 = function(begin, end) { if (begin.charCodeAt(0) > end.charCodeAt(0)) { error( "Invalid character range: " + text() + "." ); } return [begin, end]; }, peg$c122 = function() { return ""; }, peg$c123 = "0", peg$c124 = { type: "literal", value: "0", description: "\"0\"" }, peg$c125 = function() { return "\0"; }, peg$c126 = "b", peg$c127 = { type: "literal", value: "b", description: "\"b\"" }, peg$c128 = function() { return "\b"; }, peg$c129 = "f", peg$c130 = { type: "literal", value: "f", description: "\"f\"" }, peg$c131 = function() { return "\f"; }, peg$c132 = "n", peg$c133 = { type: "literal", value: "n", description: "\"n\"" }, peg$c134 = function() { return "\n"; }, peg$c135 = "r", peg$c136 = { type: "literal", value: "r", description: "\"r\"" }, peg$c137 = function() { return "\r"; }, peg$c138 = "t", peg$c139 = { type: "literal", value: "t", description: "\"t\"" }, peg$c140 = function() { return "\t"; }, peg$c141 = "v", peg$c142 = { type: "literal", value: "v", description: "\"v\"" }, peg$c143 = function() { return "\x0B"; }, peg$c144 = "x", peg$c145 = { type: "literal", value: "x", description: "\"x\"" }, peg$c146 = "u", peg$c147 = { type: "literal", value: "u", description: "\"u\"" }, peg$c148 = function(digits) { return String.fromCharCode(parseInt(digits, 16)); }, peg$c149 = /^[0-9]/, peg$c150 = { type: "class", value: "[0-9]", description: "[0-9]" }, peg$c151 = /^[0-9a-f]/i, peg$c152 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, peg$c153 = /^[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, peg$c154 = { type: "class", value: "[\\u0020\\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]", description: "[\\u0020\\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]" }, 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$parseGrammar() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parse__(); if (s1 !== peg$FAILED) { s2 = peg$currPos; s3 = peg$parseInitializer(); if (s3 !== peg$FAILED) { s4 = peg$parse__(); if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } if (s2 === peg$FAILED) { s2 = peg$c1; } if (s2 !== peg$FAILED) { s3 = []; s4 = peg$currPos; s5 = peg$parseRule(); if (s5 !== peg$FAILED) { s6 = peg$parse__(); if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$c0; } } else { peg$currPos = s4; s4 = peg$c0; } if (s4 !== peg$FAILED) { while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$currPos; s5 = peg$parseRule(); if (s5 !== peg$FAILED) { s6 = peg$parse__(); if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$c0; } } else { peg$currPos = s4; s4 = peg$c0; } } } else { s3 = peg$c0; } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c3(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$parseInitializer() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parseAction(); if (s1 !== peg$FAILED) { s2 = peg$currPos; s3 = peg$parse__(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { s4 = peg$c4; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } if (s2 === peg$FAILED) { s2 = peg$c1; } if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c6(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseRule() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parseIdentifier(); if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { s3 = peg$currPos; s4 = peg$parseStringLiteral(); if (s4 !== peg$FAILED) { s5 = peg$parse__(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } if (s3 === peg$FAILED) { s3 = peg$c1; } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61) { s4 = peg$c7; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s4 !== peg$FAILED) { s5 = peg$parse__(); if (s5 !== peg$FAILED) { s6 = peg$parseChoice(); if (s6 !== peg$FAILED) { s7 = peg$currPos; s8 = peg$parse__(); if (s8 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { s9 = peg$c4; peg$currPos++; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s9 !== peg$FAILED) { s8 = [s8, s9]; s7 = s8; } else { peg$currPos = s7; s7 = peg$c0; } } else { peg$currPos = s7; s7 = peg$c0; } if (s7 === peg$FAILED) { s7 = peg$c1; } if (s7 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c9(s1, s3, 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; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseChoice() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parseSequence(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$parse__(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 47) { s5 = peg$c10; peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s5 !== peg$FAILED) { s6 = peg$parse__(); if (s6 !== peg$FAILED) { s7 = peg$parseSequence(); if (s7 !== peg$FAILED) { s4 = [s4, s5, s6, s7]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$currPos; s4 = peg$parse__(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 47) { s5 = peg$c10; peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s5 !== peg$FAILED) { s6 = peg$parse__(); if (s6 !== peg$FAILED) { s7 = peg$parseSequence(); if (s7 !== peg$FAILED) { s4 = [s4, s5, s6, s7]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c12(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseSequence() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseLabeled(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$parse__(); if (s4 !== peg$FAILED) { s5 = peg$parseLabeled(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$currPos; s4 = peg$parse__(); if (s4 !== peg$FAILED) { s5 = peg$parseLabeled(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } if (s2 !== peg$FAILED) { s3 = peg$parse__(); if (s3 !== peg$FAILED) { s4 = peg$parseAction(); if (s4 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c13(s1, 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; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseLabeled(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$parse__(); if (s4 !== peg$FAILED) { s5 = peg$parseLabeled(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$currPos; s4 = peg$parse__(); if (s4 !== peg$FAILED) { s5 = peg$parseLabeled(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c14(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } return s0; } function peg$parseLabeled() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseIdentifier(); if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { s3 = peg$c15; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s3 !== peg$FAILED) { s4 = peg$parse__(); if (s4 !== peg$FAILED) { s5 = peg$parsePrefixed(); if (s5 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c17(s1, 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; } if (s0 === peg$FAILED) { s0 = peg$parsePrefixed(); } return s0; } function peg$parsePrefixed() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 36) { s1 = peg$c18; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { s3 = peg$parseSuffixed(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c20(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 38) { s1 = peg$c21; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c22); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { s3 = peg$parseAction(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c23(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 38) { s1 = peg$c21; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c22); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { s3 = peg$parseSuffixed(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c24(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 33) { s1 = peg$c25; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { s3 = peg$parseAction(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c27(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 33) { s1 = peg$c25; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { s3 = peg$parseSuffixed(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c28(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$parseSuffixed(); } } } } } return s0; } function peg$parseSuffixed() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsePrimary(); if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 63) { s3 = peg$c29; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c30); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c31(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsePrimary(); if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 42) { s3 = peg$c32; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c33); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c34(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsePrimary(); if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 43) { s3 = peg$c35; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c37(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$parsePrimary(); } } } return s0; } function peg$parsePrimary() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parseIdentifier(); if (s1 !== peg$FAILED) { s2 = peg$currPos; peg$silentFails++; s3 = peg$currPos; s4 = peg$parse__(); if (s4 !== peg$FAILED) { s5 = peg$currPos; s6 = peg$parseStringLiteral(); if (s6 !== peg$FAILED) { s7 = peg$parse__(); if (s7 !== peg$FAILED) { s6 = [s6, s7]; s5 = s6; } else { peg$currPos = s5; s5 = peg$c0; } } else { peg$currPos = s5; s5 = peg$c0; } if (s5 === peg$FAILED) { s5 = peg$c1; } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61) { s6 = peg$c7; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s6 !== peg$FAILED) { s4 = [s4, s5, s6]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } peg$silentFails--; if (s3 === peg$FAILED) { s2 = peg$c38; } else { peg$currPos = s2; s2 = peg$c0; } if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c39(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$parseLiteralMatcher(); if (s0 === peg$FAILED) { s0 = peg$parseCharacterClassMatcher(); if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s1 = peg$c40; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c42(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { s1 = peg$c43; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c44); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { s3 = peg$parseChoice(); if (s3 !== peg$FAILED) { s4 = peg$parse__(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { s5 = peg$c45; peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c46); } } if (s5 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c47(s3); 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$parseSourceCharacter() { var s0; if (input.length > peg$currPos) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c48); } } return s0; } function peg$parseWhiteSpace() { var s0, s1; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 9) { s0 = peg$c50; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c51); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 11) { s0 = peg$c52; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c53); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 12) { s0 = peg$c54; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c55); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 32) { s0 = peg$c56; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c57); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 160) { s0 = peg$c58; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c59); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 65279) { s0 = peg$c60; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c61); } } if (s0 === peg$FAILED) { s0 = peg$parseZs(); } } } } } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c49); } } return s0; } function peg$parseLineTerminator() { var s0; if (peg$c62.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c63); } } return s0; } function peg$parseLineTerminatorSequence() { var s0, s1; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 10) { s0 = peg$c65; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c66); } } if (s0 === peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c67) { s0 = peg$c67; peg$currPos += 2; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c68); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 13) { s0 = peg$c69; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c70); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8232) { s0 = peg$c71; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c72); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8233) { s0 = peg$c73; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c74); } } } } } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c64); } } return s0; } function peg$parseComment() { var s0, s1; peg$silentFails++; s0 = peg$parseMultiLineComment(); if (s0 === peg$FAILED) { s0 = peg$parseSingleLineComment(); } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c75); } } return s0; } function peg$parseMultiLineComment() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c76) { s1 = peg$c76; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c77); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c78) { s5 = peg$c78; peg$currPos += 2; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c79); } } peg$silentFails--; if (s5 === peg$FAILED) { s4 = peg$c38; } else { peg$currPos = s4; s4 = peg$c0; } if (s4 !== peg$FAILED) { s5 = peg$parseSourceCharacter(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c78) { s5 = peg$c78; peg$currPos += 2; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c79); } } peg$silentFails--; if (s5 === peg$FAILED) { s4 = peg$c38; } else { peg$currPos = s4; s4 = peg$c0; } if (s4 !== peg$FAILED) { s5 = peg$parseSourceCharacter(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } if (s2 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c78) { s3 = peg$c78; peg$currPos += 2; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c79); } } if (s3 !== peg$FAILED) { s1 = [s1, 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$parseSingleLineComment() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c80) { s1 = peg$c80; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c81); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; s5 = peg$parseLineTerminator(); peg$silentFails--; if (s5 === peg$FAILED) { s4 = peg$c38; } else { peg$currPos = s4; s4 = peg$c0; } if (s4 !== peg$FAILED) { s5 = peg$parseSourceCharacter(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; s5 = peg$parseLineTerminator(); peg$silentFails--; if (s5 === peg$FAILED) { s4 = peg$c38; } else { peg$currPos = s4; s4 = peg$c0; } if (s4 !== peg$FAILED) { s5 = peg$parseSourceCharacter(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseAction() { var s0, s1, s2; peg$silentFails++; s0 = peg$currPos; s1 = peg$parseBraced(); if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c83(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c82); } } return s0; } function peg$parseBraced() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { s2 = peg$c84; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c85); } } if (s2 !== peg$FAILED) { s3 = []; s4 = peg$parseBraced(); if (s4 === peg$FAILED) { s4 = peg$parseNonBraceCharacters(); } while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$parseBraced(); if (s4 === peg$FAILED) { s4 = peg$parseNonBraceCharacters(); } } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { s4 = peg$c86; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s4 !== peg$FAILED) { s2 = [s2, s3, s4]; s1 = s2; } else { peg$currPos = s1; s1 = peg$c0; } } else { peg$currPos = s1; s1 = peg$c0; } } else { peg$currPos = s1; s1 = peg$c0; } if (s1 !== peg$FAILED) { s1 = input.substring(s0, peg$currPos); } s0 = s1; return s0; } function peg$parseNonBraceCharacters() { var s0, s1; s0 = []; s1 = peg$parseNonBraceCharacter(); if (s1 !== peg$FAILED) { while (s1 !== peg$FAILED) { s0.push(s1); s1 = peg$parseNonBraceCharacter(); } } else { s0 = peg$c0; } return s0; } function peg$parseNonBraceCharacter() { var s0; if (peg$c88.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c89); } } return s0; } function peg$parseIdentifier() { var s0, s1, s2, s3, s4; peg$silentFails++; s0 = peg$currPos; s1 = peg$currPos; s2 = peg$parseLetter(); if (s2 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 95) { s2 = peg$c91; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c92); } } } if (s2 !== peg$FAILED) { s3 = []; s4 = peg$parseLetter(); if (s4 === peg$FAILED) { s4 = peg$parseDecimalDigit(); if (s4 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 95) { s4 = peg$c91; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c92); } } } } while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$parseLetter(); if (s4 === peg$FAILED) { s4 = peg$parseDecimalDigit(); if (s4 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 95) { s4 = peg$c91; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c92); } } } } } if (s3 !== peg$FAILED) { s2 = [s2, s3]; s1 = s2; } else { peg$currPos = s1; s1 = peg$c0; } } else { peg$currPos = s1; s1 = peg$c0; } if (s1 !== peg$FAILED) { s1 = input.substring(s0, peg$currPos); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c90); } } return s0; } function peg$parseLetter() { var s0; s0 = peg$parseLowerCaseLetter(); if (s0 === peg$FAILED) { s0 = peg$parseUpperCaseLetter(); } return s0; } function peg$parseLowerCaseLetter() { var s0; if (peg$c93.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c94); } } return s0; } function peg$parseUpperCaseLetter() { var s0; if (peg$c95.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c96); } } return s0; } function peg$parseLiteralMatcher() { var s0, s1, s2; peg$silentFails++; s0 = peg$currPos; s1 = peg$parseStringLiteral(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 105) { s2 = peg$c98; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c99); } } if (s2 === peg$FAILED) { s2 = peg$c1; } if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c100(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c97); } } return s0; } function peg$parseStringLiteral() { var s0, s1, s2, s3; peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { s1 = peg$c102; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c103); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseDoubleStringCharacter(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseDoubleStringCharacter(); } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { s3 = peg$c102; peg$currPos++; } 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$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { s1 = peg$c105; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseSingleStringCharacter(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseSingleStringCharacter(); } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { s3 = peg$c105; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c104(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c101); } } return s0; } function peg$parseDoubleStringCharacter() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 34) { s2 = peg$c102; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c103); } } if (s2 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 92) { s2 = peg$c107; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s2 === peg$FAILED) { s2 = peg$parseLineTerminator(); } } peg$silentFails--; if (s2 === peg$FAILED) { s1 = peg$c38; } else { peg$currPos = s1; s1 = peg$c0; } if (s1 !== peg$FAILED) { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c109(); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { s1 = peg$c107; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c110(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$parseLineContinuation(); } } return s0; } function peg$parseSingleStringCharacter() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 39) { 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) === 92) { s2 = peg$c107; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s2 === peg$FAILED) { s2 = peg$parseLineTerminator(); } } peg$silentFails--; if (s2 === peg$FAILED) { s1 = peg$c38; } else { peg$currPos = s1; s1 = peg$c0; } if (s1 !== peg$FAILED) { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c109(); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { s1 = peg$c107; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c110(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$parseLineContinuation(); } } return s0; } function peg$parseCharacterClassMatcher() { var s0, s1, s2, s3, s4, s5; peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { s1 = peg$c112; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c113); } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 94) { s2 = peg$c114; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c115); } } if (s2 === peg$FAILED) { s2 = peg$c1; } if (s2 !== peg$FAILED) { s3 = []; s4 = peg$parseClassCharacterRange(); if (s4 === peg$FAILED) { s4 = peg$parseClassCharacter(); } while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$parseClassCharacterRange(); if (s4 === peg$FAILED) { s4 = peg$parseClassCharacter(); } } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { s4 = peg$c116; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c117); } } if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 105) { s5 = peg$c98; peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c99); } } if (s5 === peg$FAILED) { s5 = peg$c1; } if (s5 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c118(s2, s3, 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; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c111); } } return s0; } function peg$parseClassCharacterRange() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseClassCharacter(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c119; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c120); } } if (s2 !== peg$FAILED) { s3 = peg$parseClassCharacter(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c121(s1, 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$parseClassCharacter() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 93) { s2 = peg$c116; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c117); } } if (s2 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 92) { s2 = peg$c107; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s2 === peg$FAILED) { s2 = peg$parseLineTerminator(); } } peg$silentFails--; if (s2 === peg$FAILED) { s1 = peg$c38; } else { peg$currPos = s1; s1 = peg$c0; } if (s1 !== peg$FAILED) { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c109(); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { s1 = peg$c107; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c110(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$parseLineContinuation(); } } return s0; } function peg$parseLineContinuation() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { s1 = peg$c107; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s1 !== peg$FAILED) { s2 = peg$parseLineTerminatorSequence(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c122(); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseEscapeSequence() { var s0, s1, s2, s3; s0 = peg$parseCharacterEscapeSequence(); if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 48) { s1 = peg$c123; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c124); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; peg$silentFails++; s3 = peg$parseDecimalDigit(); peg$silentFails--; if (s3 === peg$FAILED) { s2 = peg$c38; } else { peg$currPos = s2; s2 = peg$c0; } if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c125(); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === peg$FAILED) { s0 = peg$parseHexEscapeSequence(); if (s0 === peg$FAILED) { s0 = peg$parseUnicodeEscapeSequence(); } } } return s0; } function peg$parseCharacterEscapeSequence() { var s0; s0 = peg$parseSingleEscapeCharacter(); if (s0 === peg$FAILED) { s0 = peg$parseNonEscapeCharacter(); } return s0; } function peg$parseSingleEscapeCharacter() { var s0, s1; if (input.charCodeAt(peg$currPos) === 39) { s0 = peg$c105; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { s0 = peg$c102; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c103); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 92) { s0 = peg$c107; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 98) { s1 = peg$c126; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c127); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c128(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 102) { s1 = peg$c129; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c130); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c131(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 110) { s1 = peg$c132; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c133); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c134(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 114) { s1 = peg$c135; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c136); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c137(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 116) { s1 = peg$c138; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c139); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c140(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 118) { s1 = peg$c141; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c142); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c143(); } s0 = s1; } } } } } } } } return s0; } function peg$parseNonEscapeCharacter() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; s2 = peg$parseEscapeCharacter(); if (s2 === peg$FAILED) { s2 = peg$parseLineTerminator(); } peg$silentFails--; if (s2 === peg$FAILED) { s1 = peg$c38; } else { peg$currPos = s1; s1 = peg$c0; } if (s1 !== peg$FAILED) { s2 = peg$parseSourceCharacter(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c109(); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseEscapeCharacter() { var s0; s0 = peg$parseSingleEscapeCharacter(); if (s0 === peg$FAILED) { s0 = peg$parseDecimalDigit(); if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 120) { s0 = peg$c144; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c145); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 117) { s0 = peg$c146; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c147); } } } } } return s0; } function peg$parseHexEscapeSequence() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 120) { s1 = peg$c144; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c145); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; s3 = peg$currPos; s4 = peg$parseHexDigit(); if (s4 !== peg$FAILED) { s5 = peg$parseHexDigit(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } if (s3 !== peg$FAILED) { s3 = input.substring(s2, peg$currPos); } s2 = s3; if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c148(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseUnicodeEscapeSequence() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 117) { s1 = peg$c146; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c147); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; s3 = peg$currPos; s4 = peg$parseHexDigit(); if (s4 !== peg$FAILED) { s5 = peg$parseHexDigit(); if (s5 !== peg$FAILED) { s6 = peg$parseHexDigit(); if (s6 !== peg$FAILED) { s7 = peg$parseHexDigit(); if (s7 !== peg$FAILED) { s4 = [s4, s5, s6, s7]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } if (s3 !== peg$FAILED) { s3 = input.substring(s2, peg$currPos); } s2 = s3; if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c148(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseDecimalDigit() { var s0; if (peg$c149.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c150); } } return s0; } function peg$parseHexDigit() { var s0; if (peg$c151.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c152); } } return s0; } function peg$parseZs() { var s0; if (peg$c153.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c154); } } return s0; } function peg$parse__() { var s0, s1; s0 = []; s1 = peg$parseWhiteSpace(); if (s1 === peg$FAILED) { s1 = peg$parseLineTerminatorSequence(); if (s1 === peg$FAILED) { s1 = peg$parseComment(); } } while (s1 !== peg$FAILED) { s0.push(s1); s1 = peg$parseWhiteSpace(); if (s1 === peg$FAILED) { s1 = peg$parseLineTerminatorSequence(); if (s1 === peg$FAILED) { s1 = peg$parseComment(); } } } return s0; } function extractOptional(optional, index) { return optional ? optional[index] : null; } function extractList(list, index) { var result = new Array(list.length), i; for (i = 0; i < list.length; i++) { result[i] = list[i][index]; } return result; } function buildList(first, rest, index) { return [first].concat(extractList(rest, index)); } 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 }; })();