module.exports = (function() { /* * Generated by PEG.js 0.7.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(expected, found, offset, line, column) { 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 expectedDesc, foundDesc; switch (expected.length) { case 0: expectedDesc = "end of input"; break; case 1: expectedDesc = expected[0]; break; default: expectedDesc = expected.slice(0, -1).join(", ") + " or " + expected[expected.length - 1]; } foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; return "Expected " + expectedDesc + " but " + foundDesc + " found."; } this.expected = expected; this.found = found; this.offset = offset; this.line = line; this.column = column; this.name = "SyntaxError"; this.message = buildMessage(expected, found); } peg$subclass(SyntaxError, Error); function parse(input) { var options = arguments.length > 1 ? arguments[1] : {}, peg$startRuleFunctions = { grammar: peg$parsegrammar }, peg$startRuleFunction = peg$parsegrammar, peg$c0 = null, peg$c1 = "", peg$c2 = [], peg$c3 = function(initializer, rules) { return { type: "grammar", initializer: initializer !== "" ? initializer : null, rules: rules }; }, peg$c4 = function(code) { return { type: "initializer", code: code }; }, peg$c5 = function(name, displayName, expression) { return { type: "rule", name: name, expression: displayName !== "" ? { type: "named", name: displayName, expression: expression } : expression }; }, peg$c6 = function(head, tail) { if (tail.length > 0) { var alternatives = [head].concat(utils.map( tail, function(element) { return element[1]; } )); return { type: "choice", alternatives: alternatives }; } else { return head; } }, peg$c7 = function(elements, code) { var expression = elements.length !== 1 ? { type: "sequence", elements: elements } : elements[0]; return { type: "action", expression: expression, code: code }; }, peg$c8 = function(elements) { return elements.length !== 1 ? { type: "sequence", elements: elements } : elements[0]; }, peg$c9 = function(label, expression) { return { type: "labeled", label: label, expression: expression }; }, peg$c10 = function(expression) { return { type: "text", expression: expression }; }, peg$c11 = function(code) { return { type: "semantic_and", code: code }; }, peg$c12 = function(expression) { return { type: "simple_and", expression: expression }; }, peg$c13 = function(code) { return { type: "semantic_not", code: code }; }, peg$c14 = function(expression) { return { type: "simple_not", expression: expression }; }, peg$c15 = function(expression) { return { type: "optional", expression: expression }; }, peg$c16 = function(expression) { return { type: "zero_or_more", expression: expression }; }, peg$c17 = function(expression) { return { type: "one_or_more", expression: expression }; }, peg$c18 = function(name) { return { type: "rule_ref", name: name }; }, peg$c19 = function() { return { type: "any" }; }, peg$c20 = function(expression) { return expression; }, peg$c21 = "action", peg$c22 = function(braced) { return braced.substr(1, braced.length - 2); }, peg$c23 = "{", peg$c24 = "\"{\"", peg$c25 = "}", peg$c26 = "\"}\"", peg$c27 = /^[^{}]/, peg$c28 = "[^{}]", peg$c29 = "=", peg$c30 = "\"=\"", peg$c31 = function() { return "="; }, peg$c32 = ":", peg$c33 = "\":\"", peg$c34 = function() { return ":"; }, peg$c35 = ";", peg$c36 = "\";\"", peg$c37 = function() { return ";"; }, peg$c38 = "/", peg$c39 = "\"/\"", peg$c40 = function() { return "/"; }, peg$c41 = "&", peg$c42 = "\"&\"", peg$c43 = function() { return "&"; }, peg$c44 = "!", peg$c45 = "\"!\"", peg$c46 = function() { return "!"; }, peg$c47 = "$", peg$c48 = "\"$\"", peg$c49 = function() { return "$"; }, peg$c50 = "?", peg$c51 = "\"?\"", peg$c52 = function() { return "?"; }, peg$c53 = "*", peg$c54 = "\"*\"", peg$c55 = function() { return "*"; }, peg$c56 = "+", peg$c57 = "\"+\"", peg$c58 = function() { return "+"; }, peg$c59 = "(", peg$c60 = "\"(\"", peg$c61 = function() { return "("; }, peg$c62 = ")", peg$c63 = "\")\"", peg$c64 = function() { return ")"; }, peg$c65 = ".", peg$c66 = "\".\"", peg$c67 = function() { return "."; }, peg$c68 = "identifier", peg$c69 = "_", peg$c70 = "\"_\"", peg$c71 = function(chars) { return chars; }, peg$c72 = "literal", peg$c73 = "i", peg$c74 = "\"i\"", peg$c75 = function(value, flags) { return { type: "literal", value: value, ignoreCase: flags === "i" }; }, peg$c76 = "string", peg$c77 = function(string) { return string; }, peg$c78 = "\"", peg$c79 = "\"\\\"\"", peg$c80 = function(chars) { return chars.join(""); }, peg$c81 = "\\", peg$c82 = "\"\\\\\"", peg$c83 = "any character", peg$c84 = function(char_) { return char_; }, peg$c85 = "'", peg$c86 = "\"'\"", peg$c87 = "character class", peg$c88 = "[", peg$c89 = "\"[\"", peg$c90 = "^", peg$c91 = "\"^\"", peg$c92 = "]", peg$c93 = "\"]\"", peg$c94 = function(inverted, parts, flags) { var partsConverted = utils.map(parts, function(part) { return part.data; }); var rawText = "[" + inverted + utils.map(parts, function(part) { return part.rawText; }).join("") + "]" + flags; return { type: "class", parts: partsConverted, // FIXME: Get the raw text from the input directly. rawText: rawText, inverted: inverted === "^", ignoreCase: flags === "i" }; }, peg$c95 = "-", peg$c96 = "\"-\"", peg$c97 = function(begin, end) { if (begin.data.charCodeAt(0) > end.data.charCodeAt(0)) { throw new this.SyntaxError( "Invalid character range: " + begin.rawText + "-" + end.rawText + "." ); } return { data: [begin.data, end.data], // FIXME: Get the raw text from the input directly. rawText: begin.rawText + "-" + end.rawText }; }, peg$c98 = function(char_) { return { data: char_, // FIXME: Get the raw text from the input directly. rawText: utils.quoteForRegexpClass(char_) }; }, peg$c99 = "x", peg$c100 = "\"x\"", peg$c101 = "u", peg$c102 = "\"u\"", peg$c103 = function(char_) { return char_ .replace("b", "\b") .replace("f", "\f") .replace("n", "\n") .replace("r", "\r") .replace("t", "\t") .replace("v", "\x0B"); // IE does not recognize "\v". }, peg$c104 = "\\0", peg$c105 = "\"\\\\0\"", peg$c106 = function() { return "\x00"; }, peg$c107 = "\\x", peg$c108 = "\"\\\\x\"", peg$c109 = function(digits) { return String.fromCharCode(parseInt(digits, 16)); }, peg$c110 = "\\u", peg$c111 = "\"\\\\u\"", peg$c112 = function(eol) { return eol; }, peg$c113 = /^[0-9]/, peg$c114 = "[0-9]", peg$c115 = /^[0-9a-fA-F]/, peg$c116 = "[0-9a-fA-F]", peg$c117 = /^[a-z]/, peg$c118 = "[a-z]", peg$c119 = /^[A-Z]/, peg$c120 = "[A-Z]", peg$c121 = "comment", peg$c122 = "//", peg$c123 = "\"//\"", peg$c124 = "/*", peg$c125 = "\"/*\"", peg$c126 = "*/", peg$c127 = "\"*/\"", peg$c128 = "end of line", peg$c129 = "\n", peg$c130 = "\"\\n\"", peg$c131 = "\r\n", peg$c132 = "\"\\r\\n\"", peg$c133 = "\r", peg$c134 = "\"\\r\"", peg$c135 = "\u2028", peg$c136 = "\"\\u2028\"", peg$c137 = "\u2029", peg$c138 = "\"\\u2029\"", peg$c139 = /^[\n\r\u2028\u2029]/, peg$c140 = "[\\n\\r\\u2028\\u2029]", peg$c141 = "whitespace", peg$c142 = /^[ \t\x0B\f\xA0\uFEFF\u1680\u180E\u2000-\u200A\u202F\u205F\u3000]/, peg$c143 = "[ \\t\\x0B\\f\\xA0\\uFEFF\\u1680\\u180E\\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 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$cleanupExpected(expected) { var i = 0; expected.sort(); while (i < expected.length) { if (expected[i - 1] === expected[i]) { expected.splice(i, 1); } else { i++; } } } function peg$parsegrammar() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parse__(); if (s1 !== null) { s2 = peg$parseinitializer(); if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { s3 = []; s4 = peg$parserule(); if (s4 !== null) { while (s4 !== null) { s3.push(s4); s4 = peg$parserule(); } } else { s3 = peg$c0; } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c3(s2,s3); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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; s0 = peg$currPos; s1 = peg$parseaction(); if (s1 !== null) { s2 = peg$parsesemicolon(); if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c4(s1); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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; s0 = peg$currPos; s1 = peg$parseidentifier(); if (s1 !== null) { s2 = peg$parsestring(); if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { s3 = peg$parseequals(); if (s3 !== null) { s4 = peg$parsechoice(); if (s4 !== null) { s5 = peg$parsesemicolon(); if (s5 === null) { s5 = peg$c1; } if (s5 !== null) { peg$reportedPos = s0; s1 = peg$c5(s1,s2,s4); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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$parsechoice() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsesequence(); if (s1 !== null) { s2 = []; s3 = peg$currPos; s4 = peg$parseslash(); if (s4 !== null) { s5 = peg$parsesequence(); if (s5 !== null) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } while (s3 !== null) { s2.push(s3); s3 = peg$currPos; s4 = peg$parseslash(); if (s4 !== null) { s5 = peg$parsesequence(); if (s5 !== null) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c6(s1,s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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; s0 = peg$currPos; s1 = []; s2 = peg$parselabeled(); while (s2 !== null) { s1.push(s2); s2 = peg$parselabeled(); } if (s1 !== null) { s2 = peg$parseaction(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c7(s1,s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$currPos; s1 = []; s2 = peg$parselabeled(); while (s2 !== null) { s1.push(s2); s2 = peg$parselabeled(); } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c8(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } return s0; } function peg$parselabeled() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseidentifier(); if (s1 !== null) { s2 = peg$parsecolon(); if (s2 !== null) { s3 = peg$parseprefixed(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c9(s1,s3); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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 === null) { s0 = peg$parseprefixed(); } return s0; } function peg$parseprefixed() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parsedollar(); if (s1 !== null) { s2 = peg$parsesuffixed(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c10(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parseand(); if (s1 !== null) { s2 = peg$parseaction(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c11(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parseand(); if (s1 !== null) { s2 = peg$parsesuffixed(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c12(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parsenot(); if (s1 !== null) { s2 = peg$parseaction(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c13(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parsenot(); if (s1 !== null) { s2 = peg$parsesuffixed(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c14(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$parsesuffixed(); } } } } } return s0; } function peg$parsesuffixed() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parseprimary(); if (s1 !== null) { s2 = peg$parsequestion(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c15(s1); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parseprimary(); if (s1 !== null) { s2 = peg$parsestar(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c16(s1); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parseprimary(); if (s1 !== null) { s2 = peg$parseplus(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c17(s1); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$parseprimary(); } } } return s0; } function peg$parseprimary() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseidentifier(); if (s1 !== null) { s2 = peg$currPos; peg$silentFails++; s3 = peg$currPos; s4 = peg$parsestring(); if (s4 === null) { s4 = peg$c1; } if (s4 !== null) { s5 = peg$parseequals(); if (s5 !== null) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } peg$silentFails--; if (s3 === null) { s2 = peg$c1; } else { peg$currPos = s2; s2 = peg$c0; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c18(s1); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$parseliteral(); if (s0 === null) { s0 = peg$parseclass(); if (s0 === null) { s0 = peg$currPos; s1 = peg$parsedot(); if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c19(); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parselparen(); if (s1 !== null) { s2 = peg$parsechoice(); if (s2 !== null) { s3 = peg$parserparen(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c20(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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$parseaction() { var s0, s1, s2; peg$silentFails++; s0 = peg$currPos; s1 = peg$parsebraced(); if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c22(s1); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c21); } } 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$c23; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c24); } } if (s2 !== null) { s3 = []; s4 = peg$parsebraced(); if (s4 === null) { s4 = peg$parsenonBraceCharacters(); } while (s4 !== null) { s3.push(s4); s4 = peg$parsebraced(); if (s4 === null) { s4 = peg$parsenonBraceCharacters(); } } if (s3 !== null) { if (input.charCodeAt(peg$currPos) === 125) { s4 = peg$c25; peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s4 !== null) { 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 !== null) { s1 = input.substring(s0, peg$currPos); } s0 = s1; return s0; } function peg$parsenonBraceCharacters() { var s0, s1; s0 = []; s1 = peg$parsenonBraceCharacter(); if (s1 !== null) { while (s1 !== null) { s0.push(s1); s1 = peg$parsenonBraceCharacter(); } } else { s0 = peg$c0; } return s0; } function peg$parsenonBraceCharacter() { var s0; if (peg$c27.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c28); } } return s0; } function peg$parseequals() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 61) { s1 = peg$c29; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c30); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c31(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsecolon() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 58) { s1 = peg$c32; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c33); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c34(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsesemicolon() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 59) { s1 = peg$c35; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c37(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseslash() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 47) { s1 = peg$c38; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c39); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c40(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseand() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 38) { s1 = peg$c41; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c42); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c43(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsenot() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 33) { s1 = peg$c44; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c46(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsedollar() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 36) { s1 = peg$c47; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c48); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c49(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsequestion() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 63) { s1 = peg$c50; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c51); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c52(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsestar() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 42) { s1 = peg$c53; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c55(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseplus() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 43) { s1 = peg$c56; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c57); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c58(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parselparen() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { s1 = peg$c59; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c61(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parserparen() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 41) { s1 = peg$c62; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c63); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c64(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsedot() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s1 = peg$c65; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c66); } } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c67(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseidentifier() { var s0, s1, s2, s3, s4, s5; peg$silentFails++; s0 = peg$currPos; s1 = peg$currPos; s2 = peg$currPos; s3 = peg$parseletter(); if (s3 === null) { if (input.charCodeAt(peg$currPos) === 95) { s3 = peg$c69; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c70); } } } if (s3 !== null) { s4 = []; s5 = peg$parseletter(); if (s5 === null) { s5 = peg$parsedigit(); if (s5 === null) { if (input.charCodeAt(peg$currPos) === 95) { s5 = peg$c69; peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c70); } } } } while (s5 !== null) { s4.push(s5); s5 = peg$parseletter(); if (s5 === null) { s5 = peg$parsedigit(); if (s5 === null) { if (input.charCodeAt(peg$currPos) === 95) { s5 = peg$c69; peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c70); } } } } } if (s4 !== null) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } if (s2 !== null) { s2 = input.substring(s1, peg$currPos); } s1 = s2; if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c71(s1); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c68); } } return s0; } function peg$parseliteral() { var s0, s1, s2, s3; peg$silentFails++; s0 = peg$currPos; s1 = peg$parsedoubleQuotedString(); if (s1 === null) { s1 = peg$parsesingleQuotedString(); } if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 105) { s2 = peg$c73; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c74); } } if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { s3 = peg$parse__(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c75(s1,s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c72); } } return s0; } function peg$parsestring() { var s0, s1, s2; peg$silentFails++; s0 = peg$currPos; s1 = peg$parsedoubleQuotedString(); if (s1 === null) { s1 = peg$parsesingleQuotedString(); } if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c77(s1); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c76); } } return s0; } function peg$parsedoubleQuotedString() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { s1 = peg$c78; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c79); } } if (s1 !== null) { s2 = []; s3 = peg$parsedoubleQuotedCharacter(); while (s3 !== null) { s2.push(s3); s3 = peg$parsedoubleQuotedCharacter(); } if (s2 !== null) { if (input.charCodeAt(peg$currPos) === 34) { s3 = peg$c78; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c79); } } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c80(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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$parsedoubleQuotedCharacter() { var s0; s0 = peg$parsesimpleDoubleQuotedCharacter(); if (s0 === null) { s0 = peg$parsesimpleEscapeSequence(); if (s0 === null) { s0 = peg$parsezeroEscapeSequence(); if (s0 === null) { s0 = peg$parsehexEscapeSequence(); if (s0 === null) { s0 = peg$parseunicodeEscapeSequence(); if (s0 === null) { s0 = peg$parseeolEscapeSequence(); } } } } } return s0; } function peg$parsesimpleDoubleQuotedCharacter() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 34) { s2 = peg$c78; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c79); } } if (s2 === null) { if (input.charCodeAt(peg$currPos) === 92) { s2 = peg$c81; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s2 === null) { s2 = peg$parseeolChar(); } } peg$silentFails--; if (s2 === null) { s1 = peg$c1; } else { peg$currPos = s1; s1 = peg$c0; } if (s1 !== null) { if (input.length > peg$currPos) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c84(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsesingleQuotedString() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { s1 = peg$c85; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s1 !== null) { s2 = []; s3 = peg$parsesingleQuotedCharacter(); while (s3 !== null) { s2.push(s3); s3 = peg$parsesingleQuotedCharacter(); } if (s2 !== null) { if (input.charCodeAt(peg$currPos) === 39) { s3 = peg$c85; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c80(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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$parsesingleQuotedCharacter() { var s0; s0 = peg$parsesimpleSingleQuotedCharacter(); if (s0 === null) { s0 = peg$parsesimpleEscapeSequence(); if (s0 === null) { s0 = peg$parsezeroEscapeSequence(); if (s0 === null) { s0 = peg$parsehexEscapeSequence(); if (s0 === null) { s0 = peg$parseunicodeEscapeSequence(); if (s0 === null) { s0 = peg$parseeolEscapeSequence(); } } } } } return s0; } function peg$parsesimpleSingleQuotedCharacter() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 39) { s2 = peg$c85; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s2 === null) { if (input.charCodeAt(peg$currPos) === 92) { s2 = peg$c81; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s2 === null) { s2 = peg$parseeolChar(); } } peg$silentFails--; if (s2 === null) { s1 = peg$c1; } else { peg$currPos = s1; s1 = peg$c0; } if (s1 !== null) { if (input.length > peg$currPos) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c84(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseclass() { var s0, s1, s2, s3, s4, s5, s6; peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { s1 = peg$c88; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 94) { s2 = peg$c90; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c91); } } if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { s3 = []; s4 = peg$parseclassCharacterRange(); if (s4 === null) { s4 = peg$parseclassCharacter(); } while (s4 !== null) { s3.push(s4); s4 = peg$parseclassCharacterRange(); if (s4 === null) { s4 = peg$parseclassCharacter(); } } if (s3 !== null) { if (input.charCodeAt(peg$currPos) === 93) { s4 = peg$c92; peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c93); } } if (s4 !== null) { if (input.charCodeAt(peg$currPos) === 105) { s5 = peg$c73; peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c74); } } if (s5 === null) { s5 = peg$c1; } if (s5 !== null) { s6 = peg$parse__(); if (s6 !== null) { peg$reportedPos = s0; s1 = peg$c94(s2,s3,s5); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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; } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c87); } } return s0; } function peg$parseclassCharacterRange() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseclassCharacter(); if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c95; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c96); } } if (s2 !== null) { s3 = peg$parseclassCharacter(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c97(s1,s3); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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; s0 = peg$currPos; s1 = peg$parsebracketDelimitedCharacter(); if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c98(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsebracketDelimitedCharacter() { var s0; s0 = peg$parsesimpleBracketDelimitedCharacter(); if (s0 === null) { s0 = peg$parsesimpleEscapeSequence(); if (s0 === null) { s0 = peg$parsezeroEscapeSequence(); if (s0 === null) { s0 = peg$parsehexEscapeSequence(); if (s0 === null) { s0 = peg$parseunicodeEscapeSequence(); if (s0 === null) { s0 = peg$parseeolEscapeSequence(); } } } } } return s0; } function peg$parsesimpleBracketDelimitedCharacter() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 93) { s2 = peg$c92; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c93); } } if (s2 === null) { if (input.charCodeAt(peg$currPos) === 92) { s2 = peg$c81; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s2 === null) { s2 = peg$parseeolChar(); } } peg$silentFails--; if (s2 === null) { s1 = peg$c1; } else { peg$currPos = s1; s1 = peg$c0; } if (s1 !== null) { if (input.length > peg$currPos) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c84(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsesimpleEscapeSequence() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { s1 = peg$c81; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s1 !== null) { s2 = peg$currPos; peg$silentFails++; s3 = peg$parsedigit(); if (s3 === null) { if (input.charCodeAt(peg$currPos) === 120) { s3 = peg$c99; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c100); } } if (s3 === null) { if (input.charCodeAt(peg$currPos) === 117) { s3 = peg$c101; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c102); } } if (s3 === null) { s3 = peg$parseeolChar(); } } } peg$silentFails--; if (s3 === null) { s2 = peg$c1; } else { peg$currPos = s2; s2 = peg$c0; } if (s2 !== null) { if (input.length > peg$currPos) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c103(s3); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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$parsezeroEscapeSequence() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c104) { s1 = peg$c104; peg$currPos += 2; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c105); } } if (s1 !== null) { s2 = peg$currPos; peg$silentFails++; s3 = peg$parsedigit(); peg$silentFails--; if (s3 === null) { s2 = peg$c1; } else { peg$currPos = s2; s2 = peg$c0; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c106(); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsehexEscapeSequence() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c107) { s1 = peg$c107; peg$currPos += 2; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c108); } } if (s1 !== null) { s2 = peg$currPos; s3 = peg$currPos; s4 = peg$parsehexDigit(); if (s4 !== null) { s5 = peg$parsehexDigit(); if (s5 !== null) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } if (s3 !== null) { s3 = input.substring(s2, peg$currPos); } s2 = s3; if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c109(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { 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.substr(peg$currPos, 2) === peg$c110) { s1 = peg$c110; peg$currPos += 2; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c111); } } if (s1 !== null) { s2 = peg$currPos; s3 = peg$currPos; s4 = peg$parsehexDigit(); if (s4 !== null) { s5 = peg$parsehexDigit(); if (s5 !== null) { s6 = peg$parsehexDigit(); if (s6 !== null) { s7 = peg$parsehexDigit(); if (s7 !== null) { 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 !== null) { s3 = input.substring(s2, peg$currPos); } s2 = s3; if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c109(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseeolEscapeSequence() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { s1 = peg$c81; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s1 !== null) { s2 = peg$parseeol(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c112(s2); if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsedigit() { var s0; if (peg$c113.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c114); } } return s0; } function peg$parsehexDigit() { var s0; if (peg$c115.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c116); } } return s0; } function peg$parseletter() { var s0; s0 = peg$parselowerCaseLetter(); if (s0 === null) { s0 = peg$parseupperCaseLetter(); } return s0; } function peg$parselowerCaseLetter() { var s0; if (peg$c117.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c118); } } return s0; } function peg$parseupperCaseLetter() { var s0; if (peg$c119.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c120); } } return s0; } function peg$parse__() { var s0, s1; s0 = []; s1 = peg$parsewhitespace(); if (s1 === null) { s1 = peg$parseeol(); if (s1 === null) { s1 = peg$parsecomment(); } } while (s1 !== null) { s0.push(s1); s1 = peg$parsewhitespace(); if (s1 === null) { s1 = peg$parseeol(); if (s1 === null) { s1 = peg$parsecomment(); } } } return s0; } function peg$parsecomment() { var s0, s1; peg$silentFails++; s0 = peg$parsesingleLineComment(); if (s0 === null) { s0 = peg$parsemultiLineComment(); } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c121); } } return s0; } function peg$parsesingleLineComment() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c122) { s1 = peg$c122; peg$currPos += 2; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c123); } } if (s1 !== null) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; s5 = peg$parseeolChar(); peg$silentFails--; if (s5 === null) { s4 = peg$c1; } else { peg$currPos = s4; s4 = peg$c0; } if (s4 !== null) { if (input.length > peg$currPos) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s5 !== null) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } while (s3 !== null) { s2.push(s3); s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; s5 = peg$parseeolChar(); peg$silentFails--; if (s5 === null) { s4 = peg$c1; } else { peg$currPos = s4; s4 = peg$c0; } if (s4 !== null) { if (input.length > peg$currPos) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s5 !== null) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } if (s2 !== null) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsemultiLineComment() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c124) { s1 = peg$c124; peg$currPos += 2; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c125); } } if (s1 !== null) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c126) { s5 = peg$c126; peg$currPos += 2; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c127); } } peg$silentFails--; if (s5 === null) { s4 = peg$c1; } else { peg$currPos = s4; s4 = peg$c0; } if (s4 !== null) { if (input.length > peg$currPos) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s5 !== null) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } while (s3 !== null) { s2.push(s3); s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c126) { s5 = peg$c126; peg$currPos += 2; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c127); } } peg$silentFails--; if (s5 === null) { s4 = peg$c1; } else { peg$currPos = s4; s4 = peg$c0; } if (s4 !== null) { if (input.length > peg$currPos) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s5 !== null) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } if (s2 !== null) { if (input.substr(peg$currPos, 2) === peg$c126) { s3 = peg$c126; peg$currPos += 2; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c127); } } if (s3 !== null) { 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$parseeol() { var s0, s1; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 10) { s0 = peg$c129; peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c130); } } if (s0 === null) { if (input.substr(peg$currPos, 2) === peg$c131) { s0 = peg$c131; peg$currPos += 2; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c132); } } if (s0 === null) { if (input.charCodeAt(peg$currPos) === 13) { s0 = peg$c133; peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c134); } } if (s0 === null) { if (input.charCodeAt(peg$currPos) === 8232) { s0 = peg$c135; peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c136); } } if (s0 === null) { if (input.charCodeAt(peg$currPos) === 8233) { s0 = peg$c137; peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c138); } } } } } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c128); } } return s0; } function peg$parseeolChar() { var s0; if (peg$c139.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c140); } } return s0; } function peg$parsewhitespace() { var s0, s1; peg$silentFails++; if (peg$c142.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c143); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c141); } } return s0; } var utils = require("./utils"); peg$result = peg$startRuleFunction(); if (peg$result !== null && peg$currPos === input.length) { return peg$result; } else { peg$cleanupExpected(peg$maxFailExpected); peg$reportedPos = Math.max(peg$currPos, peg$maxFailPos); throw new SyntaxError( peg$maxFailExpected, peg$reportedPos < input.length ? input.charAt(peg$reportedPos) : null, peg$reportedPos, peg$computePosDetails(peg$reportedPos).line, peg$computePosDetails(peg$reportedPos).column ); } } return { SyntaxError: SyntaxError, parse : parse }; })();