var Emblem = require('./emblem'); Emblem.Parser = (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 = { start: peg$parsestart }, peg$startRuleFunction = peg$parsestart, peg$c0 = null, peg$c1 = "", peg$c2 = function(c) {return c;}, peg$c3 = function(c, i) { return createProgramNode(c, i || []); }, peg$c4 = "=", peg$c5 = "\"=\"", peg$c6 = "else", peg$c7 = "\"else\"", peg$c8 = [], peg$c9 = function(statements) { // Coalesce all adjacent ContentNodes into one. var compressedStatements = []; var buffer = []; for(var i = 0; i < statements.length; ++i) { var nodes = statements[i]; for(var j = 0; j < nodes.length; ++j) { var node = nodes[j] if(node.type === "content") { if(node.string) { // Ignore empty strings (comments). buffer.push(node.string); } continue; } // Flush content if present. if(buffer.length) { compressedStatements.push(new AST.ContentNode(buffer.join(''))); buffer = []; } compressedStatements.push(node); } } if(buffer.length) { compressedStatements.push(new AST.ContentNode(buffer.join(''))); } return compressedStatements; }, peg$c10 = "BeginStatement", peg$c11 = "ContentStatement", peg$c12 = function() { return []; }, peg$c13 = ">", peg$c14 = "\">\"", peg$c15 = function(n, params) { return [new AST.PartialNode(n, params[0])]; }, peg$c16 = /^[a-zA-Z0-9_$-\/]/, peg$c17 = "[a-zA-Z0-9_$-\\/]", peg$c18 = function(s) { return new AST.PartialNameNode(new AST.StringNode(s)); }, peg$c19 = function(m) { return [m]; }, peg$c20 = "/", peg$c21 = "\"/\"", peg$c22 = /^[A-Z]/, peg$c23 = "[A-Z]", peg$c24 = function(ret) { // TODO make this configurable var defaultCapitalizedHelper = 'view'; if(ret.mustache) { // Block. Modify inner MustacheNode and return. // Make sure a suffix modifier hasn't already been applied. var ch = ret.mustache.id.string.charAt(0); if(!IS_EMBER || !ch.match(/[A-Z]/)) return ret; ret.mustache = unshiftParam(ret.mustache, defaultCapitalizedHelper); return ret; } else { // Make sure a suffix modifier hasn't already been applied. var ch = ret.id.string.charAt(0); if(!IS_EMBER || !ch.match(/[A-Z]/)) return ret; return unshiftParam(ret, defaultCapitalizedHelper); } }, peg$c25 = " ", peg$c26 = "\" \"", peg$c27 = function(ret, multilineContent) { if(multilineContent) { multilineContent = multilineContent[1]; for(var i = 0, len = multilineContent.length; i < len; ++i) { ret.push(new AST.ContentNode(' ')); ret = ret.concat(multilineContent[i]); } } return ret; }, peg$c28 = function(c) { return c; }, peg$c29 = function(m) { return [m]; }, peg$c30 = "]", peg$c31 = "\"]\"", peg$c32 = function(h) { return h;}, peg$c33 = function(h, nested) { // h is [[open tag content], closing tag ContentNode] var ret = h[0]; if(nested) { ret = ret.concat(nested); } // Push the closing tag ContentNode if it exists (self-closing if not) if(h[1]) { ret.push(h[1]); } return ret; }, peg$c34 = function(mustacheNode, nestedContentProgramNode) { if (!nestedContentProgramNode) { return mustacheNode; } var close = mustacheNode.id; if (use11AST) { close.path = mustacheNode.id; close.strip = { left: false, right: false }; } var block = new AST.BlockNode(mustacheNode, nestedContentProgramNode, nestedContentProgramNode.inverse, close); block.path = mustacheNode.id; return block; }, peg$c35 = ": ", peg$c36 = "\": \"", peg$c37 = function(statements) { return createProgramNode(statements, []); }, peg$c38 = function(block) {return block && block[2]; }, peg$c39 = function(block) { return block; }, peg$c40 = function(e, ret) { var mustache = ret.mustache || ret; mustache.escaped = e; return ret; }, peg$c41 = "[", peg$c42 = "\"[\"", peg$c43 = function(isPartial, sexpr) { if(isPartial) { var n = new AST.PartialNameNode(new AST.StringNode(sexpr.id.string)); return new AST.PartialNode(n, sexpr.params[0]); } var mustacheNode; if (useSexprNodes) { mustacheNode = createMustacheNode(sexpr, null, true); } else { mustacheNode = createMustacheNode([sexpr.id].concat(sexpr.params), sexpr.hash, true); } var tm = sexpr.id._emblemSuffixModifier; if(tm === '!') { return unshiftParam(mustacheNode, 'unbound'); } else if(tm === '?') { return unshiftParam(mustacheNode, 'if'); } else if(tm === '^') { return unshiftParam(mustacheNode, 'unless'); } return mustacheNode; }, peg$c44 = " [", peg$c45 = "\" [\"", peg$c46 = function(path, params, hash) { return parseSexpr(path, params, hash) }, peg$c47 = function(t) { return ['tagName', t]; }, peg$c48 = function(i) { return ['elementId', i]; }, peg$c49 = function(c) { return ['class', c]; }, peg$c50 = function(a) { return a; }, peg$c51 = function(id, classes) { return [id, classes]; }, peg$c52 = function(classes) { return [null, classes]; }, peg$c53 = function(p) { return p; }, peg$c54 = function(a) { return a; }, peg$c55 = function(h) { return new AST.HashNode(h); }, peg$c56 = "PathIdent", peg$c57 = "..", peg$c58 = "\"..\"", peg$c59 = ".", peg$c60 = "\".\"", peg$c61 = /^[a-zA-Z0-9_$\-!?\^@]/, peg$c62 = "[a-zA-Z0-9_$\\-!?\\^@]", peg$c63 = function(s) { return s; }, peg$c64 = /^[^\]]/, peg$c65 = "[^\\]]", peg$c66 = function(segmentLiteral) { return segmentLiteral; }, peg$c67 = "Key", peg$c68 = ":", peg$c69 = "\":\"", peg$c70 = function(h) { return [h[0], h[2]]; }, peg$c71 = function(h) { return [h[0], h[2]];}, peg$c72 = function(s) { s.isHelper = true; return s; }, peg$c73 = function(s, p) { return { part: p, separator: s }; }, peg$c74 = function(first, tail) { var ret = [{ part: first }]; for(var i = 0; i < tail.length; ++i) { ret.push(tail[i]); } return ret; }, peg$c75 = "PathSeparator", peg$c76 = /^[\/.]/, peg$c77 = "[\\/.]", peg$c78 = function(v) { var last = v[v.length - 1]; // Support for data keywords that are prefixed with @ in the each // block helper such as @index, @key, @first, @last if (last.part.charAt(0) === '@') { last.part = last.part.slice(1); var idNode = new AST.IdNode(v); var dataNode = new AST.DataNode(idNode); return dataNode; } var match; var suffixModifier; if(match = last.part.match(/[!\?\^]$/)) { suffixModifier = match[0]; last.part = last.part.slice(0, -1); } var idNode = new AST.IdNode(v); idNode._emblemSuffixModifier = suffixModifier; return idNode; }, peg$c79 = function(v) { return new AST.StringNode(v); }, peg$c80 = function(v) { return new AST.IntegerNode(v); }, peg$c81 = function(v) { return new AST.BooleanNode(v); }, peg$c82 = "Boolean", peg$c83 = "true", peg$c84 = "\"true\"", peg$c85 = "false", peg$c86 = "\"false\"", peg$c87 = "Integer", peg$c88 = "-", peg$c89 = "\"-\"", peg$c90 = /^[0-9]/, peg$c91 = "[0-9]", peg$c92 = function(s) { return parseInt(s); }, peg$c93 = "\"", peg$c94 = "\"\\\"\"", peg$c95 = "'", peg$c96 = "\"'\"", peg$c97 = function(p) { return p[1]; }, peg$c98 = /^[^"}]/, peg$c99 = "[^\"}]", peg$c100 = /^[^'}]/, peg$c101 = "[^'}]", peg$c102 = /^[A-Za-z]/, peg$c103 = "[A-Za-z]", peg$c104 = function(ind, nodes, w) { nodes.unshift(new AST.ContentNode(ind)); for(var i = 0; i < w.length; ++i) { nodes.push(new AST.ContentNode(ind)); nodes = nodes.concat(w[i]); nodes.push("\n"); } return nodes; }, peg$c105 = /^[|`']/, peg$c106 = "[|`']", peg$c107 = "<", peg$c108 = "\"<\"", peg$c109 = function() { return '<'; }, peg$c110 = function(s, nodes, indentedNodes) { if(nodes.length || !indentedNodes) { nodes.push("\n"); } if(indentedNodes) { indentedNodes = indentedNodes[1]; for(var i = 0; i < indentedNodes.length; ++i) { /*nodes.push(new AST.ContentNode("#"));*/ nodes = nodes.concat(indentedNodes[i]); nodes.push("\n"); } } var ret = []; var strip = s !== '`'; for(var i = 0; i < nodes.length; ++i) { var node = nodes[i]; if(node == "\n") { if(!strip) { ret.push(new AST.ContentNode("\n")); } } else { ret.push(node); } } if(s === "'") { ret.push(new AST.ContentNode(" ")); } return ret; }, peg$c111 = function(first, tail) { return textNodesResult(first, tail); }, peg$c112 = function(first, tail) { return textNodesResult(first, tail); }, peg$c113 = "{", peg$c114 = "\"{\"", peg$c115 = /^[^}]/, peg$c116 = "[^}]", peg$c117 = function(text) { // Force interpretation as mustache. // TODO: change to just parse with a specific rule? text = "=" + text; return Emblem.parse(text).statements[0]; }, peg$c118 = function(m) { m.escaped = true; return m; }, peg$c119 = function(m) { m.escaped = false; return m; }, peg$c120 = function(a) { return new AST.ContentNode(a); }, peg$c121 = "any character", peg$c122 = "SingleMustacheOpen", peg$c123 = "DoubleMustacheOpen", peg$c124 = "{{", peg$c125 = "\"{{\"", peg$c126 = "TripleMustacheOpen", peg$c127 = "{{{", peg$c128 = "\"{{{\"", peg$c129 = "SingleMustacheClose", peg$c130 = "}", peg$c131 = "\"}\"", peg$c132 = "DoubleMustacheClose", peg$c133 = "}}", peg$c134 = "\"}}\"", peg$c135 = "TripleMustacheClose", peg$c136 = "}}}", peg$c137 = "\"}}}\"", peg$c138 = "SubexpressionOpen", peg$c139 = "(", peg$c140 = "\"(\"", peg$c141 = "SubexpressionClose", peg$c142 = ")", peg$c143 = "\")\"", peg$c144 = "InterpolationOpen", peg$c145 = "#{", peg$c146 = "\"#{\"", peg$c147 = "InterpolationClose", peg$c148 = "==", peg$c149 = "\"==\"", peg$c150 = function() { return false; }, peg$c151 = function() { return true; }, peg$c152 = function(h, s) { return h || s; }, peg$c153 = function(h, inTagMustaches, fullAttributes) { return parseInHtml(h, inTagMustaches, fullAttributes) }, peg$c154 = function(s) { return { shorthand: s, id: true}; }, peg$c155 = function(s) { return { shorthand: s }; }, peg$c156 = function(shorthands) { var id, classes = []; for(var i = 0, len = shorthands.length; i < len; ++i) { var shorthand = shorthands[i]; if(shorthand.id) { id = shorthand.shorthand; } else { classes.push(shorthand.shorthand); } } return [id, classes]; }, peg$c157 = function(a) { if (a.length) { return [new AST.ContentNode(' ')].concat(a); } else { return []; } }, peg$c158 = /^[A-Za-z.0-9_\-]/, peg$c159 = "[A-Za-z.0-9_\\-]", peg$c160 = function(id) { return createMustacheNode([id], null, true); }, peg$c161 = function(event, mustacheNode) { // Replace the IdNode with a StringNode to prevent unquoted action deprecation warnings mustacheNode.id = new AST.StringNode(mustacheNode.id.string); // Unshift the action helper and augment the hash return [unshiftParam(mustacheNode, 'action', [['on', new AST.StringNode(event)]])]; }, peg$c162 = function(key, boolValue) { if (boolValue === 'true') { return [ new AST.ContentNode(key) ]; } else { return []; } }, peg$c163 = function(value) { return value.replace(/ *$/, ''); }, peg$c164 = "!", peg$c165 = "\"!\"", peg$c166 = function(key, value) { return IS_EMBER; }, peg$c167 = function(key, value) { var hashNode = new AST.HashNode([[key, new AST.StringNode(value)]]); var params = [new AST.IdNode([{part: 'bind-attr'}])]; var mustacheNode = createMustacheNode(params, hashNode); return [mustacheNode]; }, peg$c168 = function(key, id) { var mustacheNode = createMustacheNode([id], null, true); if(IS_EMBER && id._emblemSuffixModifier === '!') { mustacheNode = unshiftParam(mustacheNode, 'unbound'); } return [ new AST.ContentNode(key + '=' + '"'), mustacheNode, new AST.ContentNode('"'), ]; }, peg$c169 = function(key, nodes) { var result = [ new AST.ContentNode(key + '=' + '"') ].concat(nodes); return result.concat([new AST.ContentNode('"')]); }, peg$c170 = "_", peg$c171 = "\"_\"", peg$c172 = "%", peg$c173 = "\"%\"", peg$c174 = "#", peg$c175 = "\"#\"", peg$c176 = function(c) { return c;}, peg$c177 = "CSSIdentifier", peg$c178 = /^[_a-zA-Z0-9\-]/, peg$c179 = "[_a-zA-Z0-9\\-]", peg$c180 = /^[_a-zA-Z]/, peg$c181 = "[_a-zA-Z]", peg$c182 = /^[\x80-\xFF]/, peg$c183 = "[\\x80-\\xFF]", peg$c184 = "KnownHTMLTagName", peg$c185 = function(t) { return !!KNOWN_TAGS[t]; }, peg$c186 = function(t) { return t; }, peg$c187 = "a JS event", peg$c188 = function(t) { return !!KNOWN_EVENTS[t]; }, peg$c189 = "INDENT", peg$c190 = "\uEFEF", peg$c191 = "\"\\uEFEF\"", peg$c192 = function() { return ''; }, peg$c193 = "DEDENT", peg$c194 = "\uEFFE", peg$c195 = "\"\\uEFFE\"", peg$c196 = "Unmatched DEDENT", peg$c197 = "\uEFEE", peg$c198 = "\"\\uEFEE\"", peg$c199 = "LineEnd", peg$c200 = "\r", peg$c201 = "\"\\r\"", peg$c202 = "\uEFFF", peg$c203 = "\"\\uEFFF\"", peg$c204 = "\n", peg$c205 = "\"\\n\"", peg$c206 = "ANYDEDENT", peg$c207 = "RequiredWhitespace", peg$c208 = "OptionalWhitespace", peg$c209 = "InlineWhitespace", peg$c210 = /^[ \t]/, peg$c211 = "[ \\t]", 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$parsestart() { var s0; s0 = peg$parseinvertibleContent(); return s0; } function peg$parseinvertibleContent() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parsecontent(); if (s1 !== null) { s2 = peg$currPos; s3 = peg$parseDEDENT(); if (s3 !== null) { s4 = peg$parseelse(); if (s4 !== null) { s5 = peg$parse_(); if (s5 !== null) { s6 = peg$parseTERM(); if (s6 !== null) { s7 = peg$parseindentation(); if (s7 !== null) { s8 = peg$parsecontent(); if (s8 !== null) { peg$reportedPos = s2; s3 = peg$c2(s8); if (s3 === null) { peg$currPos = s2; s2 = s3; } else { s2 = s3; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c3(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$parseelse() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$currPos; if (input.charCodeAt(peg$currPos) === 61) { s2 = peg$c4; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s2 !== null) { s3 = peg$parse_(); if (s3 !== null) { s2 = [s2, s3]; s1 = s2; } else { peg$currPos = s1; s1 = peg$c0; } } else { peg$currPos = s1; s1 = peg$c0; } if (s1 === null) { s1 = peg$c1; } if (s1 !== null) { if (input.substr(peg$currPos, 4) === peg$c6) { s2 = peg$c6; peg$currPos += 4; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c7); } } 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$parsecontent() { var s0, s1, s2; s0 = peg$currPos; s1 = []; s2 = peg$parsestatement(); while (s2 !== null) { s1.push(s2); s2 = peg$parsestatement(); } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c9(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsestatement() { var s0, s1; peg$silentFails++; s0 = peg$parseblankLine(); if (s0 === null) { s0 = peg$parsecomment(); if (s0 === null) { s0 = peg$parsecontentStatement(); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c10); } } return s0; } function peg$parsecontentStatement() { var s0, s1; peg$silentFails++; s0 = peg$parselegacyPartialInvocation(); if (s0 === null) { s0 = peg$parsehtmlElement(); if (s0 === null) { s0 = peg$parsetextLine(); if (s0 === null) { s0 = peg$parsemustache(); } } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c11); } } return s0; } function peg$parseblankLine() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== null) { s2 = peg$parseTERM(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c12(); 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$parselegacyPartialInvocation() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { s1 = peg$c13; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c14); } } if (s1 !== null) { s2 = peg$parse_(); if (s2 !== null) { s3 = peg$parselegacyPartialName(); if (s3 !== null) { s4 = []; s5 = peg$parseinMustacheParam(); while (s5 !== null) { s4.push(s5); s5 = peg$parseinMustacheParam(); } if (s4 !== null) { s5 = peg$parse_(); if (s5 !== null) { s6 = peg$parseTERM(); if (s6 !== null) { peg$reportedPos = s0; s1 = peg$c15(s3, 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; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parselegacyPartialName() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$currPos; s2 = []; if (peg$c16.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c17); } } if (s3 !== null) { while (s3 !== null) { s2.push(s3); if (peg$c16.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c17); } } } } else { s2 = peg$c0; } if (s2 !== null) { s2 = input.substring(s1, peg$currPos); } s1 = s2; if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c18(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsemustache() { var s0, s1; s0 = peg$currPos; s1 = peg$parseexplicitMustache(); if (s1 === null) { s1 = peg$parselineStartingMustache(); } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c19(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsecommentContent() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parselineContent(); if (s1 !== null) { s2 = peg$parseTERM(); if (s2 !== null) { s3 = []; s4 = peg$currPos; s5 = peg$parseindentation(); if (s5 !== null) { s6 = []; s7 = peg$parsecommentContent(); if (s7 !== null) { while (s7 !== null) { s6.push(s7); s7 = peg$parsecommentContent(); } } else { s6 = peg$c0; } if (s6 !== null) { s7 = peg$parseanyDedent(); if (s7 !== null) { s5 = [s5, s6, s7]; s4 = s5; } else { peg$currPos = s4; s4 = peg$c0; } } else { peg$currPos = s4; s4 = peg$c0; } } else { peg$currPos = s4; s4 = peg$c0; } while (s4 !== null) { s3.push(s4); s4 = peg$currPos; s5 = peg$parseindentation(); if (s5 !== null) { s6 = []; s7 = peg$parsecommentContent(); if (s7 !== null) { while (s7 !== null) { s6.push(s7); s7 = peg$parsecommentContent(); } } else { s6 = peg$c0; } if (s6 !== null) { s7 = peg$parseanyDedent(); if (s7 !== null) { s5 = [s5, s6, s7]; s4 = s5; } else { peg$currPos = s4; s4 = peg$c0; } } else { peg$currPos = s4; s4 = peg$c0; } } else { peg$currPos = s4; s4 = peg$c0; } } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c12(); 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$parsecomment() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 47) { s1 = peg$c20; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c21); } } if (s1 !== null) { s2 = peg$parsecommentContent(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c12(); 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$parseinlineComment() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 47) { s1 = peg$c20; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c21); } } if (s1 !== null) { s2 = peg$parselineContent(); 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$parselineStartingMustache() { var s0; s0 = peg$parsecapitalizedLineStarterMustache(); if (s0 === null) { s0 = peg$parsemustacheOrBlock(); } return s0; } function peg$parsecapitalizedLineStarterMustache() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; if (peg$c22.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c23); } } peg$silentFails--; if (s2 !== null) { peg$currPos = s1; s1 = peg$c1; } else { s1 = peg$c0; } if (s1 !== null) { s2 = peg$parsemustacheOrBlock(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c24(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$parsehtmlNestedTextNodes() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 32) { s1 = peg$c25; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s1 !== null) { s2 = peg$parsetextNodes(); if (s2 !== null) { s3 = peg$currPos; s4 = peg$parseindentation(); if (s4 !== null) { s5 = []; s6 = peg$parsewhitespaceableTextNodes(); if (s6 !== null) { while (s6 !== null) { s5.push(s6); s6 = peg$parsewhitespaceableTextNodes(); } } else { s5 = peg$c0; } if (s5 !== null) { s6 = peg$parseDEDENT(); if (s6 !== null) { 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; } if (s3 === null) { s3 = peg$c1; } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c27(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$parseindentedContent() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = []; s2 = peg$parseblankLine(); while (s2 !== null) { s1.push(s2); s2 = peg$parseblankLine(); } if (s1 !== null) { s2 = peg$parseindentation(); if (s2 !== null) { s3 = peg$parsecontent(); if (s3 !== null) { s4 = peg$parseDEDENT(); if (s4 !== null) { peg$reportedPos = s0; s1 = peg$c28(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; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseunindentedContent() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = []; s2 = peg$parseblankLine(); while (s2 !== null) { s1.push(s2); s2 = peg$parseblankLine(); } if (s1 !== null) { s2 = peg$parsecontent(); if (s2 !== null) { s3 = peg$parseDEDENT(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c28(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$parsehtmlTerminator() { var s0, s1, s2, s3, s4, s5; s0 = peg$parsecolonContent(); if (s0 === null) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== null) { s2 = peg$parseexplicitMustache(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c29(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$parse_(); if (s1 !== null) { s2 = peg$parseinlineComment(); if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { s3 = peg$parseTERM(); if (s3 !== null) { s4 = peg$parseindentedContent(); if (s4 === null) { s4 = peg$c1; } if (s4 !== null) { peg$reportedPos = s0; s1 = peg$c28(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; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== null) { s2 = peg$parseinlineComment(); if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { if (input.charCodeAt(peg$currPos) === 93) { s3 = peg$c30; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s3 !== null) { s4 = peg$parseTERM(); if (s4 !== null) { s5 = peg$parseunindentedContent(); if (s5 === null) { s5 = peg$c1; } if (s5 !== null) { peg$reportedPos = s0; s1 = peg$c28(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; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parsehtmlNestedTextNodes(); if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c32(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } } } } return s0; } function peg$parsehtmlElement() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parseinHtmlTag(); if (s1 !== null) { s2 = peg$parsehtmlTerminator(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c33(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$parsemustacheOrBlock() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parseinMustache(); if (s1 !== null) { s2 = peg$parse_(); if (s2 !== null) { s3 = peg$parseinlineComment(); if (s3 === null) { s3 = peg$c1; } if (s3 !== null) { s4 = peg$parsemustacheNestedContent(); if (s4 !== null) { peg$reportedPos = s0; s1 = peg$c34(s1, 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; } return s0; } function peg$parseinvertibleContent() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsecontent(); if (s1 !== null) { s2 = peg$currPos; s3 = peg$parseDEDENT(); if (s3 !== null) { s4 = peg$parseelse(); if (s4 !== null) { s5 = peg$parse_(); if (s5 !== null) { s6 = peg$parseTERM(); if (s6 !== null) { s7 = []; s8 = peg$parseblankLine(); while (s8 !== null) { s7.push(s8); s8 = peg$parseblankLine(); } if (s7 !== null) { s8 = peg$parseindentation(); if (s8 !== null) { s9 = peg$parsecontent(); if (s9 !== null) { peg$reportedPos = s2; s3 = peg$c2(s9); if (s3 === null) { peg$currPos = s2; s2 = s3; } else { s2 = s3; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c3(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$parsecolonContent() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c35) { s1 = peg$c35; peg$currPos += 2; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s1 !== null) { s2 = peg$parse_(); if (s2 !== null) { s3 = peg$parsecontentStatement(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c28(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$parsemustacheNestedContent() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsecolonContent(); if (s1 === null) { s1 = peg$parsetextLine(); } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c37(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 93) { s2 = peg$c30; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s2 !== null) { s3 = peg$parseTERM(); if (s3 !== null) { s4 = peg$parsecolonContent(); if (s4 === null) { s4 = peg$parsetextLine(); } if (s4 !== null) { s5 = peg$parseDEDENT(); if (s5 !== null) { peg$reportedPos = s0; s1 = peg$c37(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; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parseTERM(); if (s1 !== null) { s2 = peg$currPos; s3 = []; s4 = peg$parseblankLine(); while (s4 !== null) { s3.push(s4); s4 = peg$parseblankLine(); } if (s3 !== null) { s4 = peg$parseindentation(); if (s4 !== null) { s5 = peg$parseinvertibleContent(); if (s5 !== null) { s6 = peg$parseDEDENT(); if (s6 !== null) { s3 = [s3, s4, s5, s6]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c38(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$parse_(); if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 93) { s2 = peg$c30; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s2 !== null) { s3 = peg$parseTERM(); if (s3 !== null) { s4 = peg$parseinvertibleContent(); if (s4 !== null) { s5 = peg$parseDEDENT(); if (s5 !== null) { peg$reportedPos = s0; s1 = peg$c39(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$parseexplicitMustache() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parseequalSign(); if (s1 !== null) { s2 = peg$parsemustacheOrBlock(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c40(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$parseinMustache() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { s1 = peg$c13; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c14); } } if (s1 === null) { s1 = peg$c1; } if (s1 !== null) { s2 = peg$currPos; peg$silentFails++; s3 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { s4 = peg$c41; peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c42); } } if (s4 !== null) { s5 = peg$parseTERM(); 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) { s3 = peg$parse_(); if (s3 !== null) { s4 = peg$parsesexpr(); if (s4 !== null) { peg$reportedPos = s0; s1 = peg$c43(s1, 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; } return s0; } function peg$parsesexpr() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsepathIdNode(); if (s1 !== null) { s2 = peg$currPos; peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c44) { s3 = peg$c44; peg$currPos += 2; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c45); } } peg$silentFails--; if (s3 === null) { s2 = peg$c1; } else { peg$currPos = s2; s2 = peg$c0; } if (s2 !== null) { s3 = []; s4 = peg$parseinMustacheParam(); while (s4 !== null) { s3.push(s4); s4 = peg$parseinMustacheParam(); } if (s3 !== null) { s4 = peg$parsehash(); if (s4 === null) { s4 = peg$c1; } if (s4 !== null) { peg$reportedPos = s0; s1 = peg$c46(s1, s3, 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; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parsepathIdNode(); if (s1 !== null) { s2 = peg$parse_(); if (s2 !== null) { if (input.charCodeAt(peg$currPos) === 91) { s3 = peg$c41; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c42); } } if (s3 !== null) { s4 = peg$parse_(); if (s4 !== null) { s5 = []; s6 = peg$parseTERM(); while (s6 !== null) { s5.push(s6); s6 = peg$parseTERM(); } if (s5 !== null) { s6 = []; s7 = peg$parseINDENT(); while (s7 !== null) { s6.push(s7); s7 = peg$parseINDENT(); } if (s6 !== null) { s7 = peg$parse_(); if (s7 !== null) { s8 = []; s9 = peg$parseinMustacheBracketedParam(); while (s9 !== null) { s8.push(s9); s9 = peg$parseinMustacheBracketedParam(); } if (s8 !== null) { s9 = peg$parsebracketedHash(); if (s9 === null) { s9 = peg$c1; } if (s9 !== null) { peg$reportedPos = s0; s1 = peg$c46(s1, s8, s9); 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; } } 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$parsehtmlMustacheAttribute() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== null) { s2 = peg$currPos; s3 = peg$parsetagNameShorthand(); if (s3 !== null) { peg$reportedPos = s2; s3 = peg$c47(s3); } if (s3 === null) { peg$currPos = s2; s2 = s3; } else { s2 = s3; } if (s2 === null) { s2 = peg$currPos; s3 = peg$parseidShorthand(); if (s3 !== null) { peg$reportedPos = s2; s3 = peg$c48(s3); } if (s3 === null) { peg$currPos = s2; s2 = s3; } else { s2 = s3; } if (s2 === null) { s2 = peg$currPos; s3 = peg$parseclassShorthand(); if (s3 !== null) { peg$reportedPos = s2; s3 = peg$c49(s3); } if (s3 === null) { peg$currPos = s2; s2 = s3; } else { s2 = s3; } } } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c50(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$parseshorthandAttributes() { var s0; s0 = peg$parseattributesAtLeastID(); if (s0 === null) { s0 = peg$parseattributesAtLeastClass(); } return s0; } function peg$parseattributesAtLeastID() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseidShorthand(); if (s1 !== null) { s2 = []; s3 = peg$parseclassShorthand(); while (s3 !== null) { s2.push(s3); s3 = peg$parseclassShorthand(); } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c51(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$parseattributesAtLeastClass() { var s0, s1, s2; s0 = peg$currPos; s1 = []; s2 = peg$parseclassShorthand(); if (s2 !== null) { while (s2 !== null) { s1.push(s2); s2 = peg$parseclassShorthand(); } } else { s1 = peg$c0; } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c52(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parseinMustacheParam() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsehtmlMustacheAttribute(); if (s1 === null) { s1 = peg$currPos; s2 = peg$parse__(); if (s2 !== null) { s3 = peg$parseparam(); if (s3 !== null) { peg$reportedPos = s1; s2 = peg$c53(s3); if (s2 === null) { peg$currPos = s1; s1 = s2; } else { s1 = s2; } } else { peg$currPos = s1; s1 = peg$c0; } } else { peg$currPos = s1; s1 = peg$c0; } } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c54(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parseinMustacheBracketedParam() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsehtmlMustacheAttribute(); if (s1 === null) { s1 = peg$currPos; s2 = peg$parseparam(); if (s2 !== null) { s3 = []; s4 = peg$parseTERM(); while (s4 !== null) { s3.push(s4); s4 = peg$parseTERM(); } if (s3 !== null) { peg$reportedPos = s1; s2 = peg$c53(s2); if (s2 === null) { peg$currPos = s1; s1 = s2; } else { s1 = s2; } } else { peg$currPos = s1; s1 = peg$c0; } } else { peg$currPos = s1; s1 = peg$c0; } } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c54(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsehash() { var s0, s1, s2; s0 = peg$currPos; s1 = []; s2 = peg$parsehashSegment(); if (s2 !== null) { while (s2 !== null) { s1.push(s2); s2 = peg$parsehashSegment(); } } else { s1 = peg$c0; } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c55(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsebracketedHash() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = []; s2 = peg$parseINDENT(); while (s2 !== null) { s1.push(s2); s2 = peg$parseINDENT(); } if (s1 !== null) { s2 = []; if (input.charCodeAt(peg$currPos) === 32) { s3 = peg$c25; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } while (s3 !== null) { s2.push(s3); if (input.charCodeAt(peg$currPos) === 32) { s3 = peg$c25; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } } if (s2 !== null) { s3 = []; s4 = peg$parsebracketedHashSegment(); if (s4 !== null) { while (s4 !== null) { s3.push(s4); s4 = peg$parsebracketedHashSegment(); } } else { s3 = peg$c0; } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c55(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$parsepathIdent() { var s0, s1, s2, s3, s4; peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c57) { s0 = peg$c57; peg$currPos += 2; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c58); } } if (s0 === null) { if (input.charCodeAt(peg$currPos) === 46) { s0 = peg$c59; peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s0 === null) { s0 = peg$currPos; s1 = peg$currPos; s2 = []; if (peg$c61.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c62); } } if (s3 !== null) { while (s3 !== null) { s2.push(s3); if (peg$c61.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c62); } } } } else { s2 = peg$c0; } if (s2 !== null) { s2 = input.substring(s1, peg$currPos); } s1 = s2; if (s1 !== null) { s2 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 61) { s3 = peg$c4; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c5); } } peg$silentFails--; if (s3 === null) { s2 = peg$c1; } else { peg$currPos = s2; s2 = peg$c0; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c63(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; if (input.charCodeAt(peg$currPos) === 91) { s1 = peg$c41; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c42); } } if (s1 !== null) { s2 = peg$currPos; s3 = []; if (peg$c64.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c65); } } while (s4 !== null) { s3.push(s4); if (peg$c64.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c65); } } } if (s3 !== null) { s3 = input.substring(s2, peg$currPos); } s2 = s3; if (s2 !== null) { if (input.charCodeAt(peg$currPos) === 93) { s3 = peg$c30; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c66(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$c56); } } return s0; } function peg$parsekey() { var s0, s1, s2; peg$silentFails++; s0 = peg$currPos; s1 = []; s2 = peg$parsenmchar(); if (s2 === null) { if (input.charCodeAt(peg$currPos) === 58) { s2 = peg$c68; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c69); } } } while (s2 !== null) { s1.push(s2); s2 = peg$parsenmchar(); if (s2 === null) { if (input.charCodeAt(peg$currPos) === 58) { s2 = peg$c68; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c69); } } } } if (s1 !== null) { s1 = input.substring(s0, peg$currPos); } s0 = s1; peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c67); } } return s0; } function peg$parsehashSegment() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parse__(); if (s1 !== null) { s2 = peg$currPos; s3 = peg$parsekey(); if (s3 !== null) { if (input.charCodeAt(peg$currPos) === 61) { s4 = peg$c4; peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s4 !== null) { s5 = peg$parseparam(); if (s5 !== null) { s3 = [s3, s4, s5]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c70(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$parsebracketedHashSegment() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = []; s2 = peg$parseINDENT(); while (s2 !== null) { s1.push(s2); s2 = peg$parseINDENT(); } if (s1 !== null) { s2 = peg$parse_(); if (s2 !== null) { s3 = peg$currPos; s4 = peg$parsekey(); if (s4 !== null) { if (input.charCodeAt(peg$currPos) === 61) { s5 = peg$c4; peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s5 !== null) { s6 = peg$parseparam(); if (s6 !== null) { 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; } if (s3 !== null) { s4 = []; s5 = peg$parseTERM(); while (s5 !== null) { s4.push(s5); s5 = peg$parseTERM(); } if (s4 !== null) { peg$reportedPos = s0; s1 = peg$c71(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; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseparam() { var s0, s1, s2, s3; s0 = peg$parsebooleanNode(); if (s0 === null) { s0 = peg$parseintegerNode(); if (s0 === null) { s0 = peg$parsepathIdNode(); if (s0 === null) { s0 = peg$parsestringNode(); if (s0 === null) { s0 = peg$currPos; s1 = peg$parsesexprOpen(); if (s1 !== null) { s2 = peg$parsesexpr(); if (s2 !== null) { s3 = peg$parsesexprClose(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c72(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$parsepath() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsepathIdent(); if (s1 !== null) { s2 = []; s3 = peg$currPos; s4 = peg$parseseperator(); if (s4 !== null) { s5 = peg$parsepathIdent(); if (s5 !== null) { peg$reportedPos = s3; s4 = peg$c73(s4, s5); if (s4 === null) { peg$currPos = s3; s3 = s4; } else { 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$parseseperator(); if (s4 !== null) { s5 = peg$parsepathIdent(); if (s5 !== null) { peg$reportedPos = s3; s4 = peg$c73(s4, s5); if (s4 === null) { peg$currPos = s3; s3 = s4; } else { s3 = s4; } } else { peg$currPos = s3; s3 = peg$c0; } } else { peg$currPos = s3; s3 = peg$c0; } } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c74(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$parseseperator() { var s0, s1; peg$silentFails++; if (peg$c76.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c77); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c75); } } return s0; } function peg$parsepathIdNode() { var s0, s1; s0 = peg$currPos; s1 = peg$parsepath(); if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c78(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsestringNode() { var s0, s1; s0 = peg$currPos; s1 = peg$parsestring(); if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c79(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parseintegerNode() { var s0, s1; s0 = peg$currPos; s1 = peg$parseinteger(); if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c80(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsebooleanNode() { var s0, s1; s0 = peg$currPos; s1 = peg$parseboolean(); if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c81(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parseboolean() { var s0, s1; peg$silentFails++; if (input.substr(peg$currPos, 4) === peg$c83) { s0 = peg$c83; peg$currPos += 4; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c84); } } if (s0 === null) { if (input.substr(peg$currPos, 5) === peg$c85) { s0 = peg$c85; peg$currPos += 5; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c86); } } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c82); } } return s0; } function peg$parseinteger() { var s0, s1, s2, s3, s4, s5; peg$silentFails++; s0 = peg$currPos; s1 = peg$currPos; s2 = peg$currPos; if (input.charCodeAt(peg$currPos) === 45) { s3 = peg$c88; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s3 === null) { s3 = peg$c1; } if (s3 !== null) { s4 = []; if (peg$c90.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c91); } } if (s5 !== null) { while (s5 !== null) { s4.push(s5); if (peg$c90.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c91); } } } } else { s4 = peg$c0; } 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) { peg$reportedPos = s0; s1 = peg$c92(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c87); } } return s0; } function peg$parsestring() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { s2 = peg$c93; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c94); } } if (s2 !== null) { s3 = peg$parsehashDoubleQuoteStringValue(); if (s3 !== null) { if (input.charCodeAt(peg$currPos) === 34) { s4 = peg$c93; peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c94); } } 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 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { s2 = peg$c95; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c96); } } if (s2 !== null) { s3 = peg$parsehashSingleQuoteStringValue(); if (s3 !== null) { if (input.charCodeAt(peg$currPos) === 39) { s4 = peg$c95; peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c96); } } 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) { peg$reportedPos = s0; s1 = peg$c97(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsehashDoubleQuoteStringValue() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = []; s2 = peg$currPos; s3 = peg$currPos; peg$silentFails++; s4 = peg$parseTERM(); peg$silentFails--; if (s4 === null) { s3 = peg$c1; } else { peg$currPos = s3; s3 = peg$c0; } if (s3 !== null) { if (peg$c98.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c99); } } if (s4 !== null) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } while (s2 !== null) { s1.push(s2); s2 = peg$currPos; s3 = peg$currPos; peg$silentFails++; s4 = peg$parseTERM(); peg$silentFails--; if (s4 === null) { s3 = peg$c1; } else { peg$currPos = s3; s3 = peg$c0; } if (s3 !== null) { if (peg$c98.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c99); } } if (s4 !== null) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } if (s1 !== null) { s1 = input.substring(s0, peg$currPos); } s0 = s1; return s0; } function peg$parsehashSingleQuoteStringValue() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = []; s2 = peg$currPos; s3 = peg$currPos; peg$silentFails++; s4 = peg$parseTERM(); peg$silentFails--; if (s4 === null) { s3 = peg$c1; } else { peg$currPos = s3; s3 = peg$c0; } if (s3 !== null) { if (peg$c100.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c101); } } if (s4 !== null) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } while (s2 !== null) { s1.push(s2); s2 = peg$currPos; s3 = peg$currPos; peg$silentFails++; s4 = peg$parseTERM(); peg$silentFails--; if (s4 === null) { s3 = peg$c1; } else { peg$currPos = s3; s3 = peg$c0; } if (s3 !== null) { if (peg$c100.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c101); } } if (s4 !== null) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c0; } } else { peg$currPos = s2; s2 = peg$c0; } } if (s1 !== null) { s1 = input.substring(s0, peg$currPos); } s0 = s1; return s0; } function peg$parsealpha() { var s0; if (peg$c102.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c103); } } return s0; } function peg$parsewhitespaceableTextNodes() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parseindentation(); if (s1 !== null) { s2 = peg$parsetextNodes(); if (s2 !== null) { s3 = []; s4 = peg$parsewhitespaceableTextNodes(); while (s4 !== null) { s3.push(s4); s4 = peg$parsewhitespaceableTextNodes(); } if (s3 !== null) { s4 = peg$parseanyDedent(); if (s4 !== null) { peg$reportedPos = s0; s1 = peg$c104(s1, 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; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$parsetextNodes(); } return s0; } function peg$parsetextLineStart() { var s0, s1, s2; s0 = peg$currPos; if (peg$c105.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 32) { s2 = peg$c25; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c63(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$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 60) { s2 = peg$c107; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c108); } } peg$silentFails--; if (s2 !== null) { peg$currPos = s1; s1 = peg$c1; } else { s1 = peg$c0; } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c109(); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } return s0; } function peg$parsetextLine() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsetextLineStart(); if (s1 !== null) { s2 = peg$parsetextNodes(); if (s2 !== null) { s3 = peg$currPos; s4 = peg$parseindentation(); if (s4 !== null) { s5 = []; s6 = peg$parsewhitespaceableTextNodes(); while (s6 !== null) { s5.push(s6); s6 = peg$parsewhitespaceableTextNodes(); } if (s5 !== null) { s6 = peg$parseDEDENT(); if (s6 !== null) { 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; } if (s3 === null) { s3 = peg$c1; } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c110(s1, 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$parsetextNodes() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsepreMustacheText(); if (s1 === null) { s1 = peg$c1; } if (s1 !== null) { s2 = []; s3 = peg$currPos; s4 = peg$parserawMustache(); if (s4 !== null) { s5 = peg$parsepreMustacheText(); if (s5 === null) { s5 = peg$c1; } 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$parserawMustache(); if (s4 !== null) { s5 = peg$parsepreMustacheText(); if (s5 === null) { s5 = peg$c1; } 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) { s3 = peg$parseTERM(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c111(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; } return s0; } function peg$parseattributeTextNodes() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { s1 = peg$c93; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c94); } } if (s1 !== null) { s2 = peg$parseattributeTextNodesInner(); if (s2 !== null) { if (input.charCodeAt(peg$currPos) === 34) { s3 = peg$c93; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c94); } } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c54(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; } if (s0 === null) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { s1 = peg$c95; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c96); } } if (s1 !== null) { s2 = peg$parseattributeTextNodesInnerSingle(); if (s2 !== null) { if (input.charCodeAt(peg$currPos) === 39) { s3 = peg$c95; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c96); } } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c54(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$parseattributeTextNodesInner() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsepreAttrMustacheText(); if (s1 === null) { s1 = peg$c1; } if (s1 !== null) { s2 = []; s3 = peg$currPos; s4 = peg$parserawMustache(); if (s4 !== null) { s5 = peg$parsepreAttrMustacheText(); if (s5 === null) { s5 = peg$c1; } 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$parserawMustache(); if (s4 !== null) { s5 = peg$parsepreAttrMustacheText(); if (s5 === null) { s5 = peg$c1; } 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$c112(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$parseattributeTextNodesInnerSingle() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsepreAttrMustacheTextSingle(); if (s1 === null) { s1 = peg$c1; } if (s1 !== null) { s2 = []; s3 = peg$currPos; s4 = peg$parserawMustache(); if (s4 !== null) { s5 = peg$parsepreAttrMustacheTextSingle(); if (s5 === null) { s5 = peg$c1; } 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$parserawMustache(); if (s4 !== null) { s5 = peg$parsepreAttrMustacheTextSingle(); if (s5 === null) { s5 = peg$c1; } 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$c112(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$parserawMustache() { var s0; s0 = peg$parserawMustacheUnescaped(); if (s0 === null) { s0 = peg$parserawMustacheEscaped(); } return s0; } function peg$parserecursivelyParsedMustacheContent() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 123) { s2 = peg$c113; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c114); } } peg$silentFails--; if (s2 === null) { s1 = peg$c1; } else { peg$currPos = s1; s1 = peg$c0; } if (s1 !== null) { s2 = peg$currPos; s3 = []; if (peg$c115.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c116); } } while (s4 !== null) { s3.push(s4); if (peg$c115.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c116); } } } if (s3 !== null) { s3 = input.substring(s2, peg$currPos); } s2 = s3; if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c117(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$parserawMustacheEscaped() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsedoubleOpen(); if (s1 !== null) { s2 = peg$parse_(); if (s2 !== null) { s3 = peg$parserecursivelyParsedMustacheContent(); if (s3 !== null) { s4 = peg$parse_(); if (s4 !== null) { s5 = peg$parsedoubleClose(); if (s5 !== null) { peg$reportedPos = s0; s1 = peg$c118(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; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parsehashStacheOpen(); if (s1 !== null) { s2 = peg$parse_(); if (s2 !== null) { s3 = peg$parserecursivelyParsedMustacheContent(); if (s3 !== null) { s4 = peg$parse_(); if (s4 !== null) { s5 = peg$parsehashStacheClose(); if (s5 !== null) { peg$reportedPos = s0; s1 = peg$c118(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; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } return s0; } function peg$parserawMustacheUnescaped() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsetripleOpen(); if (s1 !== null) { s2 = peg$parse_(); if (s2 !== null) { s3 = peg$parserecursivelyParsedMustacheContent(); if (s3 !== null) { s4 = peg$parse_(); if (s4 !== null) { s5 = peg$parsetripleClose(); if (s5 !== null) { peg$reportedPos = s0; s1 = peg$c119(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; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parsepreAttrMustacheText() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$currPos; s2 = []; s3 = peg$parsepreAttrMustacheUnit(); if (s3 !== null) { while (s3 !== null) { s2.push(s3); s3 = peg$parsepreAttrMustacheUnit(); } } else { s2 = peg$c0; } if (s2 !== null) { s2 = input.substring(s1, peg$currPos); } s1 = s2; if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c120(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsepreAttrMustacheTextSingle() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$currPos; s2 = []; s3 = peg$parsepreAttrMustacheUnitSingle(); if (s3 !== null) { while (s3 !== null) { s2.push(s3); s3 = peg$parsepreAttrMustacheUnitSingle(); } } else { s2 = peg$c0; } if (s2 !== null) { s2 = input.substring(s1, peg$currPos); } s1 = s2; if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c120(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsepreAttrMustacheUnit() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; s2 = peg$parsenonMustacheUnit(); if (s2 === null) { if (input.charCodeAt(peg$currPos) === 34) { s2 = peg$c93; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c94); } } } 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$c121); } } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c28(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$parsepreAttrMustacheUnitSingle() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; s2 = peg$parsenonMustacheUnit(); if (s2 === null) { if (input.charCodeAt(peg$currPos) === 39) { s2 = peg$c95; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c96); } } } 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$c121); } } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c28(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$parsepreMustacheText() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$currPos; s2 = []; s3 = peg$parsepreMustacheUnit(); if (s3 !== null) { while (s3 !== null) { s2.push(s3); s3 = peg$parsepreMustacheUnit(); } } else { s2 = peg$c0; } if (s2 !== null) { s2 = input.substring(s1, peg$currPos); } s1 = s2; if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c120(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsepreMustacheUnit() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; s2 = peg$parsenonMustacheUnit(); 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$c121); } } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c28(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$parsenonMustacheUnit() { var s0; s0 = peg$parsetripleOpen(); if (s0 === null) { s0 = peg$parsedoubleOpen(); if (s0 === null) { s0 = peg$parsehashStacheOpen(); if (s0 === null) { s0 = peg$parseanyDedent(); if (s0 === null) { s0 = peg$parseTERM(); } } } } return s0; } function peg$parserawMustacheSingle() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsesingleOpen(); if (s1 !== null) { s2 = peg$parse_(); if (s2 !== null) { s3 = peg$parserecursivelyParsedMustacheContent(); if (s3 !== null) { s4 = peg$parse_(); if (s4 !== null) { s5 = peg$parsesingleClose(); if (s5 !== null) { peg$reportedPos = s0; s1 = peg$c118(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; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseinTagMustache() { var s0; s0 = peg$parserawMustacheSingle(); if (s0 === null) { s0 = peg$parserawMustacheUnescaped(); if (s0 === null) { s0 = peg$parserawMustacheEscaped(); } } return s0; } function peg$parsesingleOpen() { var s0, s1; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 123) { s0 = peg$c113; peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c114); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c122); } } return s0; } function peg$parsedoubleOpen() { var s0, s1; peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c124) { s0 = peg$c124; peg$currPos += 2; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c125); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c123); } } return s0; } function peg$parsetripleOpen() { var s0, s1; peg$silentFails++; if (input.substr(peg$currPos, 3) === peg$c127) { s0 = peg$c127; peg$currPos += 3; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c128); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c126); } } return s0; } function peg$parsesingleClose() { var s0, s1; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 125) { s0 = peg$c130; peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c131); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c129); } } return s0; } function peg$parsedoubleClose() { var s0, s1; peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c133) { s0 = peg$c133; peg$currPos += 2; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c134); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c132); } } return s0; } function peg$parsetripleClose() { var s0, s1; peg$silentFails++; if (input.substr(peg$currPos, 3) === peg$c136) { s0 = peg$c136; peg$currPos += 3; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c137); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c135); } } return s0; } function peg$parsesexprOpen() { var s0, s1; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 40) { s0 = peg$c139; peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c140); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c138); } } return s0; } function peg$parsesexprClose() { var s0, s1; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 41) { s0 = peg$c142; 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; } function peg$parsehashStacheOpen() { var s0, s1; peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c145) { s0 = peg$c145; peg$currPos += 2; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c146); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c144); } } return s0; } function peg$parsehashStacheClose() { var s0, s1; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 125) { s0 = peg$c130; peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c131); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c147); } } return s0; } function peg$parseequalSign() { var s0, s1, s2; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c148) { s1 = peg$c148; peg$currPos += 2; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c149); } } if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 32) { s2 = peg$c25; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c150(); 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; if (input.charCodeAt(peg$currPos) === 61) { s1 = peg$c4; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 32) { s2 = peg$c25; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c151(); 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$parsehtmlStart() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsehtmlTagName(); if (s1 === null) { s1 = peg$c1; } if (s1 !== null) { s2 = peg$parseshorthandAttributes(); if (s2 === null) { s2 = peg$c1; } if (s2 !== null) { if (input.charCodeAt(peg$currPos) === 47) { s3 = peg$c20; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c21); } } if (s3 === null) { s3 = peg$c1; } if (s3 !== null) { peg$reportedPos = peg$currPos; s4 = peg$c152(s1, s2); if (s4) { s4 = peg$c1; } else { s4 = peg$c0; } if (s4 !== null) { s1 = [s1, s2, s3, s4]; s0 = s1; } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseinHtmlTag() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsehtmlStart(); if (s1 !== null) { if (input.substr(peg$currPos, 2) === peg$c44) { s2 = peg$c44; peg$currPos += 2; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s2 !== null) { s3 = []; s4 = peg$parseTERM(); while (s4 !== null) { s3.push(s4); s4 = peg$parseTERM(); } if (s3 !== null) { s4 = []; s5 = peg$parseinTagMustache(); while (s5 !== null) { s4.push(s5); s5 = peg$parseinTagMustache(); } if (s4 !== null) { s5 = []; s6 = peg$parsebracketedAttribute(); if (s6 !== null) { while (s6 !== null) { s5.push(s6); s6 = peg$parsebracketedAttribute(); } } else { s5 = peg$c0; } if (s5 !== null) { peg$reportedPos = s0; s1 = peg$c153(s1, s4, 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; } if (s0 === null) { s0 = peg$currPos; s1 = peg$parsehtmlStart(); if (s1 !== null) { s2 = []; s3 = peg$parseinTagMustache(); while (s3 !== null) { s2.push(s3); s3 = peg$parseinTagMustache(); } if (s2 !== null) { s3 = []; s4 = peg$parsefullAttribute(); while (s4 !== null) { s3.push(s4); s4 = peg$parsefullAttribute(); } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c153(s1, 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$parseshorthandAttributes() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = []; s2 = peg$currPos; s3 = peg$parseidShorthand(); if (s3 !== null) { peg$reportedPos = s2; s3 = peg$c154(s3); } if (s3 === null) { peg$currPos = s2; s2 = s3; } else { s2 = s3; } if (s2 === null) { s2 = peg$currPos; s3 = peg$parseclassShorthand(); if (s3 !== null) { peg$reportedPos = s2; s3 = peg$c155(s3); } if (s3 === null) { peg$currPos = s2; s2 = s3; } else { s2 = s3; } } if (s2 !== null) { while (s2 !== null) { s1.push(s2); s2 = peg$currPos; s3 = peg$parseidShorthand(); if (s3 !== null) { peg$reportedPos = s2; s3 = peg$c154(s3); } if (s3 === null) { peg$currPos = s2; s2 = s3; } else { s2 = s3; } if (s2 === null) { s2 = peg$currPos; s3 = peg$parseclassShorthand(); if (s3 !== null) { peg$reportedPos = s2; s3 = peg$c155(s3); } if (s3 === null) { peg$currPos = s2; s2 = s3; } else { s2 = s3; } } } } else { s1 = peg$c0; } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c156(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parsefullAttribute() { var s0, s1, s2; s0 = peg$currPos; s1 = []; if (input.charCodeAt(peg$currPos) === 32) { s2 = peg$c25; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s2 !== null) { while (s2 !== null) { s1.push(s2); if (input.charCodeAt(peg$currPos) === 32) { s2 = peg$c25; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } } } else { s1 = peg$c0; } if (s1 !== null) { s2 = peg$parseactionAttribute(); if (s2 === null) { s2 = peg$parsebooleanAttribute(); if (s2 === null) { s2 = peg$parseboundAttribute(); if (s2 === null) { s2 = peg$parserawMustacheAttribute(); if (s2 === null) { s2 = peg$parsenormalAttribute(); } } } } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c157(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$parsebracketedAttribute() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = []; s2 = peg$parseINDENT(); while (s2 !== null) { s1.push(s2); s2 = peg$parseINDENT(); } if (s1 !== null) { s2 = []; if (input.charCodeAt(peg$currPos) === 32) { s3 = peg$c25; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } while (s3 !== null) { s2.push(s3); if (input.charCodeAt(peg$currPos) === 32) { s3 = peg$c25; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } } if (s2 !== null) { s3 = peg$parseactionAttribute(); if (s3 === null) { s3 = peg$parsebooleanAttribute(); if (s3 === null) { s3 = peg$parseboundAttribute(); if (s3 === null) { s3 = peg$parserawMustacheAttribute(); if (s3 === null) { s3 = peg$parsenormalAttribute(); } } } } if (s3 !== null) { s4 = []; s5 = peg$parseTERM(); while (s5 !== null) { s4.push(s5); s5 = peg$parseTERM(); } if (s4 !== null) { peg$reportedPos = s0; s1 = peg$c157(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; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parseboundAttributeValueChar() { var s0; if (peg$c158.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c159); } } if (s0 === null) { s0 = peg$parsenonSeparatorColon(); } return s0; } function peg$parseactionValue() { var s0, s1; s0 = peg$parsequotedActionValue(); if (s0 === null) { s0 = peg$currPos; s1 = peg$parsepathIdNode(); if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c160(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } } return s0; } function peg$parsequotedActionValue() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { s2 = peg$c93; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c94); } } if (s2 !== null) { s3 = peg$parseinMustache(); if (s3 !== null) { if (input.charCodeAt(peg$currPos) === 34) { s4 = peg$c93; peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c94); } } 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 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { s2 = peg$c95; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c96); } } if (s2 !== null) { s3 = peg$parseinMustache(); if (s3 !== null) { if (input.charCodeAt(peg$currPos) === 39) { s4 = peg$c95; peg$currPos++; } else { s4 = null; if (peg$silentFails === 0) { peg$fail(peg$c96); } } 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) { peg$reportedPos = s0; s1 = peg$c97(s1); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } return s0; } function peg$parseactionAttribute() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseknownEvent(); if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 61) { s2 = peg$c4; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s2 !== null) { s3 = peg$parseactionValue(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c161(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$parsebooleanAttribute() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsekey(); if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 61) { s2 = peg$c4; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s2 !== null) { if (input.substr(peg$currPos, 4) === peg$c83) { s3 = peg$c83; peg$currPos += 4; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c84); } } if (s3 === null) { if (input.substr(peg$currPos, 5) === peg$c85) { s3 = peg$c85; peg$currPos += 5; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c86); } } } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c162(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$parseboundAttributeValue() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { s1 = peg$c113; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c114); } } if (s1 !== null) { s2 = peg$parse_(); if (s2 !== null) { s3 = peg$currPos; s4 = []; s5 = peg$parseboundAttributeValueChar(); if (s5 === null) { if (input.charCodeAt(peg$currPos) === 32) { s5 = peg$c25; peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } } if (s5 !== null) { while (s5 !== null) { s4.push(s5); s5 = peg$parseboundAttributeValueChar(); if (s5 === null) { if (input.charCodeAt(peg$currPos) === 32) { s5 = peg$c25; peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } } } } else { s4 = peg$c0; } if (s4 !== null) { s4 = input.substring(s3, peg$currPos); } s3 = s4; if (s3 !== null) { s4 = peg$parse_(); if (s4 !== null) { if (input.charCodeAt(peg$currPos) === 125) { s5 = peg$c130; peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c131); } } if (s5 !== null) { peg$reportedPos = s0; s1 = peg$c163(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; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } if (s0 === null) { s0 = peg$currPos; s1 = []; s2 = peg$parseboundAttributeValueChar(); if (s2 !== null) { while (s2 !== null) { s1.push(s2); s2 = peg$parseboundAttributeValueChar(); } } else { s1 = peg$c0; } if (s1 !== null) { s1 = input.substring(s0, peg$currPos); } s0 = s1; } return s0; } function peg$parseboundAttribute() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsekey(); if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 61) { s2 = peg$c4; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s2 !== null) { s3 = peg$parseboundAttributeValue(); if (s3 !== null) { s4 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 33) { s5 = peg$c164; peg$currPos++; } else { s5 = null; if (peg$silentFails === 0) { peg$fail(peg$c165); } } peg$silentFails--; if (s5 === null) { s4 = peg$c1; } else { peg$currPos = s4; s4 = peg$c0; } if (s4 !== null) { peg$reportedPos = peg$currPos; s5 = peg$c166(s1, s3); if (s5) { s5 = peg$c1; } else { s5 = peg$c0; } if (s5 !== null) { peg$reportedPos = s0; s1 = peg$c167(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; } } else { peg$currPos = s0; s0 = peg$c0; } } else { peg$currPos = s0; s0 = peg$c0; } return s0; } function peg$parserawMustacheAttribute() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsekey(); if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 61) { s2 = peg$c4; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s2 !== null) { s3 = peg$parsepathIdNode(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c168(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$parsenormalAttribute() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsekey(); if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 61) { s2 = peg$c4; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s2 !== null) { s3 = peg$parseattributeTextNodes(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c169(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$parseattributeName() { var s0, s1, s2; s0 = peg$currPos; s1 = []; s2 = peg$parseattributeChar(); while (s2 !== null) { s1.push(s2); s2 = peg$parseattributeChar(); } if (s1 !== null) { s1 = input.substring(s0, peg$currPos); } s0 = s1; return s0; } function peg$parseattributeChar() { var s0; s0 = peg$parsealpha(); if (s0 === null) { if (peg$c90.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c91); } } if (s0 === null) { if (input.charCodeAt(peg$currPos) === 95) { s0 = peg$c170; peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c171); } } if (s0 === null) { if (input.charCodeAt(peg$currPos) === 45) { s0 = peg$c88; peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c89); } } } } } return s0; } function peg$parsetagNameShorthand() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 37) { s1 = peg$c172; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c173); } } if (s1 !== null) { s2 = peg$parsecssIdentifier(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c28(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$parseidShorthand() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 35) { s1 = peg$c174; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c175); } } if (s1 !== null) { s2 = peg$parsecssIdentifier(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c176(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$parseclassShorthand() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s1 = peg$c59; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s1 !== null) { s2 = peg$parsecssIdentifier(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c28(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$parsecssIdentifier() { var s0, s1; peg$silentFails++; s0 = peg$parseident(); peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c177); } } return s0; } function peg$parseident() { var s0, s1, s2; s0 = peg$currPos; s1 = []; s2 = peg$parsenmchar(); if (s2 !== null) { while (s2 !== null) { s1.push(s2); s2 = peg$parsenmchar(); } } else { s1 = peg$c0; } if (s1 !== null) { s1 = input.substring(s0, peg$currPos); } s0 = s1; return s0; } function peg$parsenmchar() { var s0; if (peg$c178.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c179); } } if (s0 === null) { s0 = peg$parsenonascii(); } return s0; } function peg$parsenmstart() { var s0; if (peg$c180.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c181); } } if (s0 === null) { s0 = peg$parsenonascii(); } return s0; } function peg$parsenonascii() { var s0; if (peg$c182.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c183); } } return s0; } function peg$parsetagString() { var s0, s1, s2; s0 = peg$currPos; s1 = []; s2 = peg$parsetagChar(); if (s2 !== null) { while (s2 !== null) { s1.push(s2); s2 = peg$parsetagChar(); } } else { s1 = peg$c0; } if (s1 !== null) { s1 = input.substring(s0, peg$currPos); } s0 = s1; return s0; } function peg$parsehtmlTagName() { var s0, s1, s2, s3; peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 37) { s1 = peg$c172; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c173); } } if (s1 !== null) { s2 = peg$parse_(); if (s2 !== null) { s3 = peg$parsetagString(); if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c63(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$parseknownTagName(); } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c184); } } return s0; } function peg$parseknownTagName() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parsetagString(); if (s1 !== null) { peg$reportedPos = peg$currPos; s2 = peg$c185(s1); if (s2) { s2 = peg$c1; } else { s2 = peg$c0; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c186(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$parsetagChar() { var s0; if (peg$c178.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c179); } } if (s0 === null) { s0 = peg$parsenonSeparatorColon(); } return s0; } function peg$parsenonSeparatorColon() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 58) { s1 = peg$c68; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c69); } } if (s1 !== null) { s2 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 32) { s3 = peg$c25; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c26); } } peg$silentFails--; if (s3 === null) { s2 = peg$c1; } else { peg$currPos = s2; s2 = peg$c0; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c28(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$parseknownEvent() { var s0, s1, s2; peg$silentFails++; s0 = peg$currPos; s1 = peg$parsetagString(); if (s1 !== null) { peg$reportedPos = peg$currPos; s2 = peg$c188(s1); if (s2) { s2 = peg$c1; } else { s2 = peg$c0; } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c186(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$c187); } } return s0; } function peg$parseindentation() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parseINDENT(); if (s1 !== null) { s2 = peg$parse__(); if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c63(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$parseINDENT() { var s0, s1; peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 61423) { s1 = peg$c190; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c191); } } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c192(); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c189); } } return s0; } function peg$parseDEDENT() { var s0, s1; peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 61438) { s1 = peg$c194; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c195); } } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c192(); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c193); } } return s0; } function peg$parseUNMATCHED_DEDENT() { var s0, s1; peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 61422) { s1 = peg$c197; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c198); } } if (s1 !== null) { peg$reportedPos = s0; s1 = peg$c192(); } if (s1 === null) { peg$currPos = s0; s0 = s1; } else { s0 = s1; } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c196); } } return s0; } function peg$parseTERM() { var s0, s1, s2, s3; peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 13) { s1 = peg$c200; peg$currPos++; } else { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c201); } } if (s1 === null) { s1 = peg$c1; } if (s1 !== null) { if (input.charCodeAt(peg$currPos) === 61439) { s2 = peg$c202; peg$currPos++; } else { s2 = null; if (peg$silentFails === 0) { peg$fail(peg$c203); } } if (s2 !== null) { if (input.charCodeAt(peg$currPos) === 10) { s3 = peg$c204; peg$currPos++; } else { s3 = null; if (peg$silentFails === 0) { peg$fail(peg$c205); } } if (s3 !== null) { peg$reportedPos = s0; s1 = peg$c150(); 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$c199); } } return s0; } function peg$parseanyDedent() { var s0, s1; peg$silentFails++; s0 = peg$parseDEDENT(); if (s0 === null) { s0 = peg$parseUNMATCHED_DEDENT(); } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c206); } } return s0; } function peg$parse__() { var s0, s1, s2; peg$silentFails++; s0 = peg$currPos; s1 = []; s2 = peg$parsewhitespace(); if (s2 !== null) { while (s2 !== null) { s1.push(s2); s2 = peg$parsewhitespace(); } } else { s1 = peg$c0; } if (s1 !== null) { s1 = input.substring(s0, peg$currPos); } s0 = s1; peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c207); } } return s0; } function peg$parse_() { var s0, s1; peg$silentFails++; s0 = []; s1 = peg$parsewhitespace(); while (s1 !== null) { s0.push(s1); s1 = peg$parsewhitespace(); } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c208); } } return s0; } function peg$parsewhitespace() { var s0, s1; peg$silentFails++; if (peg$c210.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = null; if (peg$silentFails === 0) { peg$fail(peg$c211); } } peg$silentFails--; if (s0 === null) { s1 = null; if (peg$silentFails === 0) { peg$fail(peg$c209); } } return s0; } function peg$parselineChar() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; s2 = peg$parseINDENT(); if (s2 === null) { s2 = peg$parseDEDENT(); if (s2 === null) { s2 = peg$parseTERM(); } } 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$c121); } } if (s2 !== null) { peg$reportedPos = s0; s1 = peg$c28(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$parselineContent() { var s0, s1, s2; s0 = peg$currPos; s1 = []; s2 = peg$parselineChar(); while (s2 !== null) { s1.push(s2); s2 = peg$parselineChar(); } if (s1 !== null) { s1 = input.substring(s0, peg$currPos); } s0 = s1; return s0; } var handlebarsVariant = Emblem.handlebarsVariant; var IS_EMBER = handlebarsVariant.JavaScriptCompiler.prototype.namespace === "Ember.Handlebars"; var AST = handlebarsVariant.AST; var SELF_CLOSING_TAG = { area: true, base: true, br: true, col: true, command: true, embed: true, hr: true, img: true, input: true, keygen: true, link: true, meta: true, param: true, source: true, track: true, wbr: true }; var KNOWN_TAGS = { figcaption: true, blockquote: true, plaintext: true, textarea: true, progress: true, optgroup: true, noscript: true, noframes: true, frameset: true, fieldset: true, datalist: true, colgroup: true, basefont: true, summary: true, section: true, marquee: true, listing: true, isindex: true, details: true, command: true, caption: true, bgsound: true, article: true, address: true, acronym: true, strong: true, strike: true, spacer: true, source: true, select: true, script: true, output: true, option: true, object: true, legend: true, keygen: true, iframe: true, hgroup: true, header: true, footer: true, figure: true, center: true, canvas: true, button: true, applet: true, video: true, track: true, title: true, thead: true, tfoot: true, tbody: true, table: true, style: true, small: true, param: true, meter: true, label: true, input: true, frame: true, embed: true, blink: true, audio: true, aside: true, time: true, span: true, samp: true, ruby: true, nobr: true, meta: true, menu: true, mark: true, main: true, link: true, html: true, head: true, form: true, font: true, data: true, code: true, cite: true, body: true, base: true, area: true, abbr: true, xmp: true, wbr: true, 'var': true, sup: true, sub: true, pre: true, nav: true, map: true, kbd: true, ins: true, img: true, div: true, dir: true, dfn: true, del: true, col: true, big: true, bdo: true, bdi: true, ul: true, tt: true, tr: true, th: true, td: true, rt: true, rp: true, ol: true, li: true, hr: true, h6: true, h5: true, h4: true, h3: true, h2: true, h1: true, em: true, dt: true, dl: true, dd: true, br: true, u: true, s: true, q: true, p: true, i: true, b: true, a: true }; var KNOWN_EVENTS = { "touchStart": true, "touchMove": true, "touchEnd": true, "touchCancel": true, "keyDown": true, "keyUp": true, "keyPress": true, "mouseDown": true, "mouseUp": true, "contextMenu": true, "click": true, "doubleClick": true, "mouseMove": true, "focusIn": true, "focusOut": true, "mouseEnter": true, "mouseLeave": true, "submit": true, "input": true, "change": true, "dragStart": true, "drag": true, "dragEnter": true, "dragLeave": true, "dragOver": true, "drop": true, "dragEnd": true }; // Ridiculous that we have to do this, but PEG doesn't // support unmatched closing braces in JS code, // so we have to construct. var closeBrace = String.fromCharCode(125); var twoBrace = closeBrace + closeBrace; var threeBrace = twoBrace + closeBrace; var use11AST = handlebarsVariant.VERSION.slice(0, 3) >= 1.1; var useSexprNodes = handlebarsVariant.VERSION.slice(0, 3) >= 1.3; function createMustacheNode(params, hash, escaped) { if (use11AST) { var open = escaped ? twoBrace : threeBrace; return new AST.MustacheNode(params, hash, open, { left: false, right: false }); } else { // old style return new AST.MustacheNode(params, hash, !escaped); } } function createProgramNode(statements, inverse) { if (use11AST) { return new AST.ProgramNode(statements, { left: false, right: false}, inverse, null); } else { return new AST.ProgramNode(statements, inverse); } } // Returns a new MustacheNode with a new preceding param (id). function unshiftParam(mustacheNode, helperName, newHashPairs) { var hash = mustacheNode.hash; // Merge hash. if(newHashPairs) { hash = hash || new AST.HashNode([]); for(var i = 0; i < newHashPairs.length; ++i) { hash.pairs.push(newHashPairs[i]); } } var params = [mustacheNode.id].concat(mustacheNode.params); params.unshift(new AST.IdNode([{ part: helperName}])); return createMustacheNode(params, hash, mustacheNode.escaped); } function textNodesResult(first, tail) { var ret = []; if(first) { ret.push(first); } for(var i = 0; i < tail.length; ++i) { var t = tail[i]; ret.push(t[0]); if(t[1]) { ret.push(t[1]); } } return ret; } // Only for debugging use. function log(msg) { handlebarsVariant.log(9, msg); } function parseSexpr(path, params, hash){ var actualParams = []; var attrs = {}; var hasAttrs = false; // Convert shorthand html attributes (e.g. % = tagName, . = class, etc) for(var i = 0; i < params.length; ++i) { var p = params[i]; var attrKey = p[0]; if(attrKey == 'tagName' || attrKey == 'elementId' || attrKey == 'class') { hasAttrs = true; attrs[attrKey] = attrs[attrKey] || []; attrs[attrKey].push(p[1]); } else { actualParams.push(p); } } if(hasAttrs) { hash = hash || new AST.HashNode([]); for(var k in attrs) { if(!attrs.hasOwnProperty(k)) continue; hash.pairs.push([k, new AST.StringNode(attrs[k].join(' '))]); } } actualParams.unshift(path); if (useSexprNodes) { return new AST.SexprNode(actualParams, hash); } else { // Stub a sexpr-like node for backwards compatibility with pre-1.3 AST. return { id: actualParams[0], params: actualParams.slice(1), hash: hash }; } } function parseInHtml(h, inTagMustaches, fullAttributes) { var tagName = h[0] || 'div', shorthandAttributes = h[1] || [], id = shorthandAttributes[0], classes = shorthandAttributes[1] || [], tagOpenContent = [], updateMustacheNode; updateMustacheNode = function (node) { var pairs, pair, stringNode, original; if (!classes.length) { return; } if (!node.id || node.id.string !== 'bind-attr') { return; } if (node.hash && node.hash.pairs && (pairs = node.hash.pairs)) { for (var i2 in pairs) { if (!pairs.hasOwnProperty(i2)) { continue; } pair = pairs[i2]; if (pair && pair[0] === 'class' && pair[1] instanceof AST.StringNode) { stringNode = pair[1]; original = stringNode.original; stringNode.original = stringNode.string = stringNode.stringModeValue = ':' + classes.join(' :') + ' ' + original; classes = []; } } } }; tagOpenContent.push(new AST.ContentNode('<' + tagName)); if(id) { tagOpenContent.push(new AST.ContentNode(' id="' + id + '"')); } // Pad in tag mustaches with spaces. for(var i = 0; i < inTagMustaches.length; ++i) { // Check if given mustache node has class bindings and prepend shorthand classes updateMustacheNode(inTagMustaches[i]); tagOpenContent.push(new AST.ContentNode(' ')); tagOpenContent.push(inTagMustaches[i]); } for(var i = 0; i < fullAttributes.length; ++i) { for (var i2 in fullAttributes[i]) { if (fullAttributes[i][i2] instanceof AST.MustacheNode) { updateMustacheNode(fullAttributes[i][i2]); } } if (classes.length) { var isClassAttr = fullAttributes[i][1] && fullAttributes[i][1].string === 'class="'; // Check if attribute is class attribute and has content if (isClassAttr && fullAttributes[i].length === 4) { if (fullAttributes[i][2].type == 'mustache') { var mustacheNode, classesContent, hash, params; // If class was mustache binding, transform attribute into bind-attr MustacheNode // In case of 'div.shorthand class=varBinding' will transform into '
')); return [tagOpenContent]; } else { tagOpenContent.push(new AST.ContentNode('>')); return [tagOpenContent, new AST.ContentNode('' + tagName + '>')]; } } 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 }; })(); module.exports = Emblem.Parser;