diff --git a/app/assets/javascripts/cmtool/application.js.coffee b/app/assets/javascripts/cmtool/application.js.coffee index 2f47f8f..28a344c 100644 --- a/app/assets/javascripts/cmtool/application.js.coffee +++ b/app/assets/javascripts/cmtool/application.js.coffee @@ -6,6 +6,7 @@ #= require ace/mode-coffee #= require ace/mode-handlebars #= require ace/mode-yaml +#= require ace/mode-haml #= require tinymce-jquery #= require_directory . #= require_self diff --git a/app/assets/javascripts/cmtool/emblem.js b/app/assets/javascripts/cmtool/emblem.js new file mode 100644 index 0000000..56fbd0f --- /dev/null +++ b/app/assets/javascripts/cmtool/emblem.js @@ -0,0 +1,6262 @@ +;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 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 = 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$c31 = 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$c32 = ": ", + peg$c33 = "\": \"", + peg$c34 = function(statements) { return createProgramNode(statements, []); }, + peg$c35 = function(block) { return block && block[2]; }, + peg$c36 = function(e, ret) { + var mustache = ret.mustache || ret; + mustache.escaped = e; + return ret; + }, + peg$c37 = function(isPartial, path, params, hash) { + if(isPartial) { + var n = new AST.PartialNameNode(new AST.StringNode(path.string)); + return new AST.PartialNode(n, params[0]); + } + + 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); + + var mustacheNode = createMustacheNode(actualParams, hash, true); + + var tm = path._emblemSuffixModifier; + if(tm === '!') { + return unshiftParam(mustacheNode, 'unbound'); + } else if(tm === '?') { + return unshiftParam(mustacheNode, 'if'); + } else if(tm === '^') { + return unshiftParam(mustacheNode, 'unless'); + } + + return mustacheNode; + }, + peg$c38 = function(t) { return ['tagName', t]; }, + peg$c39 = function(i) { return ['elementId', i]; }, + peg$c40 = function(c) { return ['class', c]; }, + peg$c41 = function(a) { + return a; + }, + peg$c42 = function(id, classes) { return [id, classes]; }, + peg$c43 = function(classes) { return [null, classes]; }, + peg$c44 = function(a) { return a; }, + peg$c45 = function(h) { return new AST.HashNode(h); }, + peg$c46 = "PathIdent", + peg$c47 = "..", + peg$c48 = "\"..\"", + peg$c49 = ".", + peg$c50 = "\".\"", + peg$c51 = /^[a-zA-Z0-9_$\-!?\^]/, + peg$c52 = "[a-zA-Z0-9_$\\-!?\\^]", + peg$c53 = function(s) { return s; }, + peg$c54 = "Key", + peg$c55 = ":", + peg$c56 = "\":\"", + peg$c57 = function(h) { return [h[0], h[2]]; }, + peg$c58 = function(n) { return n; }, + peg$c59 = function(s, p) { return { part: p, separator: s }; }, + peg$c60 = function(first, tail) { + var ret = [{ part: first }]; + for(var i = 0; i < tail.length; ++i) { + ret.push(tail[i]); + } + return ret; + }, + peg$c61 = "PathSeparator", + peg$c62 = /^[\/.]/, + peg$c63 = "[\\/.]", + peg$c64 = function(v) { + var last = v[v.length - 1]; + 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$c65 = function(v) { return new AST.StringNode(v); }, + peg$c66 = function(v) { return new AST.IntegerNode(v); }, + peg$c67 = function(v) { return new AST.BooleanNode(v); }, + peg$c68 = "Boolean", + peg$c69 = "true", + peg$c70 = "\"true\"", + peg$c71 = "false", + peg$c72 = "\"false\"", + peg$c73 = "Integer", + peg$c74 = "-", + peg$c75 = "\"-\"", + peg$c76 = /^[0-9]/, + peg$c77 = "[0-9]", + peg$c78 = function(s) { return parseInt(s); }, + peg$c79 = "\"", + peg$c80 = "\"\\\"\"", + peg$c81 = "'", + peg$c82 = "\"'\"", + peg$c83 = function(p) { return p[1]; }, + peg$c84 = /^[^"}]/, + peg$c85 = "[^\"}]", + peg$c86 = /^[^'}]/, + peg$c87 = "[^'}]", + peg$c88 = /^[A-Za-z]/, + peg$c89 = "[A-Za-z]", + peg$c90 = 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$c91 = /^[|`']/, + peg$c92 = "[|`']", + peg$c93 = "<", + peg$c94 = "\"<\"", + peg$c95 = function() { return '<'; }, + peg$c96 = 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$c97 = function(first, tail) { + return textNodesResult(first, tail); + }, + peg$c98 = function(first, tail) { return textNodesResult(first, tail); }, + peg$c99 = "{", + peg$c100 = "\"{\"", + peg$c101 = /^[^}]/, + peg$c102 = "[^}]", + peg$c103 = function(text) { + // Force interpretation as mustache. + // TODO: change to just parse with a specific rule? + text = "=" + text; + return Emblem.parse(text).statements[0]; + }, + peg$c104 = function(m) { m.escaped = true; return m; }, + peg$c105 = function(m) { m.escaped = false; return m; }, + peg$c106 = function(a) { return new AST.ContentNode(a); }, + peg$c107 = "any character", + peg$c108 = "SingleMustacheOpen", + peg$c109 = "DoubleMustacheOpen", + peg$c110 = "{{", + peg$c111 = "\"{{\"", + peg$c112 = "TripleMustacheOpen", + peg$c113 = "{{{", + peg$c114 = "\"{{{\"", + peg$c115 = "SingleMustacheClose", + peg$c116 = "}", + peg$c117 = "\"}\"", + peg$c118 = "DoubleMustacheClose", + peg$c119 = "}}", + peg$c120 = "\"}}\"", + peg$c121 = "TripleMustacheClose", + peg$c122 = "}}}", + peg$c123 = "\"}}}\"", + peg$c124 = "InterpolationOpen", + peg$c125 = "#{", + peg$c126 = "\"#{\"", + peg$c127 = "InterpolationClose", + peg$c128 = "==", + peg$c129 = "\"==\"", + peg$c130 = function() { return false; }, + peg$c131 = function() { return true; }, + peg$c132 = function(h, s) { return h || s; }, + peg$c133 = function(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) { + pair = pairs[i2]; + if (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('')]; + } + }, + peg$c134 = function(s) { return { shorthand: s, id: true}; }, + peg$c135 = function(s) { return { shorthand: s }; }, + peg$c136 = 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$c137 = function(a) { + if (a.length) { + return [new AST.ContentNode(' ')].concat(a); + } else { + return []; + } + }, + peg$c138 = /^[A-Za-z.0-9_\-]/, + peg$c139 = "[A-Za-z.0-9_\\-]", + peg$c140 = function(id) { return createMustacheNode([id], null, true); }, + peg$c141 = function(event, mustacheNode) { + // Unshift the action helper and augment the hash + return [unshiftParam(mustacheNode, 'action', [['on', new AST.StringNode(event)]])]; + }, + peg$c142 = function(key, boolValue) { + if (boolValue === 'true') { + return [ new AST.ContentNode(key) ]; + } else { + return []; + } + }, + peg$c143 = function(value) { return value.replace(/ *$/, ''); }, + peg$c144 = "!", + peg$c145 = "\"!\"", + peg$c146 = function(key, value) { return IS_EMBER; }, + peg$c147 = 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$c148 = 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$c149 = function(key, nodes) { + var result = [ new AST.ContentNode(key + '=' + '"') ].concat(nodes); + return result.concat([new AST.ContentNode('"')]); + }, + peg$c150 = "_", + peg$c151 = "\"_\"", + peg$c152 = "%", + peg$c153 = "\"%\"", + peg$c154 = "#", + peg$c155 = "\"#\"", + peg$c156 = function(c) { return c;}, + peg$c157 = "CSSIdentifier", + peg$c158 = /^[_a-zA-Z0-9\-]/, + peg$c159 = "[_a-zA-Z0-9\\-]", + peg$c160 = /^[_a-zA-Z]/, + peg$c161 = "[_a-zA-Z]", + peg$c162 = /^[\x80-\xFF]/, + peg$c163 = "[\\x80-\\xFF]", + peg$c164 = "KnownHTMLTagName", + peg$c165 = function(t) { return !!KNOWN_TAGS[t]; }, + peg$c166 = function(t) { return t; }, + peg$c167 = "a JS event", + peg$c168 = function(t) { return !!KNOWN_EVENTS[t]; }, + peg$c169 = "INDENT", + peg$c170 = "\uEFEF", + peg$c171 = "\"\\uEFEF\"", + peg$c172 = function() { return ''; }, + peg$c173 = "DEDENT", + peg$c174 = "\uEFFE", + peg$c175 = "\"\\uEFFE\"", + peg$c176 = "Unmatched DEDENT", + peg$c177 = "\uEFEE", + peg$c178 = "\"\\uEFEE\"", + peg$c179 = "LineEnd", + peg$c180 = "\r", + peg$c181 = "\"\\r\"", + peg$c182 = "\uEFFF", + peg$c183 = "\"\\uEFFF\"", + peg$c184 = "\n", + peg$c185 = "\"\\n\"", + peg$c186 = "ANYDEDENT", + peg$c187 = "RequiredWhitespace", + peg$c188 = "OptionalWhitespace", + peg$c189 = "InlineWhitespace", + peg$c190 = /^[ \t]/, + peg$c191 = "[ \\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$parsehtmlTerminator() { + var s0, s1, s2, s3, s4; + + 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$parsehtmlNestedTextNodes(); + } + } + } + + 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$c30(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$c31(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$c32) { + s1 = peg$c32; + peg$currPos += 2; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c33); } + } + 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$c34(s1); + } + if (s1 === null) { + peg$currPos = s0; + s0 = s1; + } else { + s0 = s1; + } + 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$c35(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$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$c36(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$parse_(); + if (s2 !== null) { + s3 = peg$parsepathIdNode(); + if (s3 !== null) { + s4 = []; + s5 = peg$parseinMustacheParam(); + while (s5 !== null) { + s4.push(s5); + s5 = peg$parseinMustacheParam(); + } + if (s4 !== null) { + s5 = peg$parsehash(); + if (s5 === null) { + s5 = peg$c1; + } + if (s5 !== null) { + peg$reportedPos = s0; + s1 = peg$c37(s1, s3, 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; + } + + 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$c38(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$c39(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$c40(s3); + } + if (s3 === null) { + peg$currPos = s2; + s2 = s3; + } else { + s2 = s3; + } + } + } + if (s2 !== null) { + peg$reportedPos = s0; + s1 = peg$c41(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$c42(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$c43(s1); + } + if (s1 === null) { + peg$currPos = s0; + s0 = s1; + } else { + s0 = s1; + } + + return s0; + } + + function peg$parseinMustacheParam() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parsehtmlMustacheAttribute(); + if (s1 === null) { + s1 = peg$parseparam(); + } + if (s1 !== null) { + peg$reportedPos = s0; + s1 = peg$c44(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$c45(s1); + } + if (s1 === null) { + peg$currPos = s0; + s0 = s1; + } else { + s0 = s1; + } + + return s0; + } + + function peg$parsepathIdent() { + var s0, s1, s2, s3; + + peg$silentFails++; + if (input.substr(peg$currPos, 2) === peg$c47) { + s0 = peg$c47; + peg$currPos += 2; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c48); } + } + if (s0 === null) { + if (input.charCodeAt(peg$currPos) === 46) { + s0 = peg$c49; + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c50); } + } + if (s0 === null) { + s0 = peg$currPos; + s1 = peg$currPos; + s2 = []; + if (peg$c51.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = null; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s3 !== null) { + while (s3 !== null) { + s2.push(s3); + if (peg$c51.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = null; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + } + } 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$c53(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$c46); } + } + + 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$c55; + peg$currPos++; + } else { + s2 = null; + if (peg$silentFails === 0) { peg$fail(peg$c56); } + } + } + while (s2 !== null) { + s1.push(s2); + s2 = peg$parsenmchar(); + if (s2 === null) { + if (input.charCodeAt(peg$currPos) === 58) { + s2 = peg$c55; + peg$currPos++; + } else { + s2 = null; + if (peg$silentFails === 0) { peg$fail(peg$c56); } + } + } + } + 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$c54); } + } + + 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$parsebooleanNode(); + 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) { + 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$parseintegerNode(); + 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) { + 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$parsepathIdNode(); + 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) { + 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$parsestringNode(); + 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$c57(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$parseparam() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parse__(); + if (s1 !== null) { + s2 = peg$parsebooleanNode(); + if (s2 === null) { + s2 = peg$parseintegerNode(); + if (s2 === null) { + s2 = peg$parsepathIdNode(); + if (s2 === null) { + s2 = peg$parsestringNode(); + } + } + } + if (s2 !== null) { + peg$reportedPos = s0; + s1 = peg$c58(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$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$c59(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$c59(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$c60(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$c62.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c63); } + } + peg$silentFails--; + if (s0 === null) { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + + return s0; + } + + function peg$parsepathIdNode() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parsepath(); + if (s1 !== null) { + peg$reportedPos = s0; + s1 = peg$c64(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$c65(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$c66(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$c67(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$c69) { + s0 = peg$c69; + peg$currPos += 4; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c70); } + } + if (s0 === null) { + if (input.substr(peg$currPos, 5) === peg$c71) { + s0 = peg$c71; + peg$currPos += 5; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c72); } + } + } + peg$silentFails--; + if (s0 === null) { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c68); } + } + + 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$c74; + peg$currPos++; + } else { + s3 = null; + if (peg$silentFails === 0) { peg$fail(peg$c75); } + } + if (s3 === null) { + s3 = peg$c1; + } + if (s3 !== null) { + s4 = []; + if (peg$c76.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = null; + if (peg$silentFails === 0) { peg$fail(peg$c77); } + } + if (s5 !== null) { + while (s5 !== null) { + s4.push(s5); + if (peg$c76.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = null; + if (peg$silentFails === 0) { peg$fail(peg$c77); } + } + } + } 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$c78(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$c73); } + } + + 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$c79; + peg$currPos++; + } else { + s2 = null; + if (peg$silentFails === 0) { peg$fail(peg$c80); } + } + if (s2 !== null) { + s3 = peg$parsehashDoubleQuoteStringValue(); + if (s3 !== null) { + if (input.charCodeAt(peg$currPos) === 34) { + s4 = peg$c79; + peg$currPos++; + } else { + s4 = null; + if (peg$silentFails === 0) { peg$fail(peg$c80); } + } + 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$c81; + peg$currPos++; + } else { + s2 = null; + if (peg$silentFails === 0) { peg$fail(peg$c82); } + } + if (s2 !== null) { + s3 = peg$parsehashSingleQuoteStringValue(); + if (s3 !== null) { + if (input.charCodeAt(peg$currPos) === 39) { + s4 = peg$c81; + peg$currPos++; + } else { + s4 = null; + if (peg$silentFails === 0) { peg$fail(peg$c82); } + } + 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$c83(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$c84.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = null; + if (peg$silentFails === 0) { peg$fail(peg$c85); } + } + 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$c84.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = null; + if (peg$silentFails === 0) { peg$fail(peg$c85); } + } + 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$c86.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = null; + if (peg$silentFails === 0) { peg$fail(peg$c87); } + } + 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$c86.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = null; + if (peg$silentFails === 0) { peg$fail(peg$c87); } + } + 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$c88.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c89); } + } + + 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$c90(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$c91.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c92); } + } + 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$c53(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$c93; + peg$currPos++; + } else { + s2 = null; + if (peg$silentFails === 0) { peg$fail(peg$c94); } + } + peg$silentFails--; + if (s2 !== null) { + peg$currPos = s1; + s1 = peg$c1; + } else { + s1 = peg$c0; + } + if (s1 !== null) { + peg$reportedPos = s0; + s1 = peg$c95(); + } + 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$c96(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$c97(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$c79; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c80); } + } + if (s1 !== null) { + s2 = peg$parseattributeTextNodesInner(); + if (s2 !== null) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c79; + peg$currPos++; + } else { + s3 = null; + if (peg$silentFails === 0) { peg$fail(peg$c80); } + } + if (s3 !== null) { + peg$reportedPos = s0; + s1 = peg$c44(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$c81; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c82); } + } + if (s1 !== null) { + s2 = peg$parseattributeTextNodesInnerSingle(); + if (s2 !== null) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c81; + peg$currPos++; + } else { + s3 = null; + if (peg$silentFails === 0) { peg$fail(peg$c82); } + } + if (s3 !== null) { + peg$reportedPos = s0; + s1 = peg$c44(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$c98(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$c98(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$c99; + peg$currPos++; + } else { + s2 = null; + if (peg$silentFails === 0) { peg$fail(peg$c100); } + } + peg$silentFails--; + if (s2 === null) { + s1 = peg$c1; + } else { + peg$currPos = s1; + s1 = peg$c0; + } + if (s1 !== null) { + s2 = peg$currPos; + s3 = []; + if (peg$c101.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = null; + if (peg$silentFails === 0) { peg$fail(peg$c102); } + } + while (s4 !== null) { + s3.push(s4); + if (peg$c101.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = null; + if (peg$silentFails === 0) { peg$fail(peg$c102); } + } + } + if (s3 !== null) { + s3 = input.substring(s2, peg$currPos); + } + s2 = s3; + if (s2 !== null) { + peg$reportedPos = s0; + s1 = peg$c103(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$c104(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$c104(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$c105(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$c106(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$c106(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$c79; + peg$currPos++; + } else { + s2 = null; + if (peg$silentFails === 0) { peg$fail(peg$c80); } + } + } + 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$c107); } + } + 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$c81; + peg$currPos++; + } else { + s2 = null; + if (peg$silentFails === 0) { peg$fail(peg$c82); } + } + } + 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$c107); } + } + 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$c106(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$c107); } + } + 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$c104(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$c99; + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c100); } + } + peg$silentFails--; + if (s0 === null) { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c108); } + } + + return s0; + } + + function peg$parsedoubleOpen() { + var s0, s1; + + peg$silentFails++; + if (input.substr(peg$currPos, 2) === peg$c110) { + s0 = peg$c110; + peg$currPos += 2; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c111); } + } + peg$silentFails--; + if (s0 === null) { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c109); } + } + + return s0; + } + + function peg$parsetripleOpen() { + var s0, s1; + + peg$silentFails++; + if (input.substr(peg$currPos, 3) === peg$c113) { + s0 = peg$c113; + peg$currPos += 3; + } 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$c112); } + } + + return s0; + } + + function peg$parsesingleClose() { + var s0, s1; + + peg$silentFails++; + if (input.charCodeAt(peg$currPos) === 125) { + s0 = peg$c116; + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c117); } + } + peg$silentFails--; + if (s0 === null) { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c115); } + } + + return s0; + } + + function peg$parsedoubleClose() { + var s0, s1; + + peg$silentFails++; + if (input.substr(peg$currPos, 2) === peg$c119) { + s0 = peg$c119; + peg$currPos += 2; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c120); } + } + peg$silentFails--; + if (s0 === null) { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c118); } + } + + return s0; + } + + function peg$parsetripleClose() { + var s0, s1; + + peg$silentFails++; + if (input.substr(peg$currPos, 3) === peg$c122) { + s0 = peg$c122; + peg$currPos += 3; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c123); } + } + peg$silentFails--; + if (s0 === null) { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c121); } + } + + return s0; + } + + function peg$parsehashStacheOpen() { + var s0, s1; + + peg$silentFails++; + if (input.substr(peg$currPos, 2) === peg$c125) { + s0 = peg$c125; + peg$currPos += 2; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c126); } + } + peg$silentFails--; + if (s0 === null) { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c124); } + } + + return s0; + } + + function peg$parsehashStacheClose() { + var s0, s1; + + peg$silentFails++; + if (input.charCodeAt(peg$currPos) === 125) { + s0 = peg$c116; + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c117); } + } + peg$silentFails--; + if (s0 === null) { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c127); } + } + + return s0; + } + + function peg$parseequalSign() { + var s0, s1, s2; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c128) { + s1 = peg$c128; + peg$currPos += 2; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c129); } + } + 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$c130(); + 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$c131(); + 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$c132(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; + + 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$c133(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$c134(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$c135(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$c134(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$c135(s3); + } + if (s3 === null) { + peg$currPos = s2; + s2 = s3; + } else { + s2 = s3; + } + } + } + } else { + s1 = peg$c0; + } + if (s1 !== null) { + peg$reportedPos = s0; + s1 = peg$c136(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$c137(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$parseboundAttributeValueChar() { + var s0; + + if (peg$c138.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c139); } + } + 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$c140(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$c79; + peg$currPos++; + } else { + s2 = null; + if (peg$silentFails === 0) { peg$fail(peg$c80); } + } + if (s2 !== null) { + s3 = peg$parseinMustache(); + if (s3 !== null) { + if (input.charCodeAt(peg$currPos) === 34) { + s4 = peg$c79; + peg$currPos++; + } else { + s4 = null; + if (peg$silentFails === 0) { peg$fail(peg$c80); } + } + 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$c81; + peg$currPos++; + } else { + s2 = null; + if (peg$silentFails === 0) { peg$fail(peg$c82); } + } + if (s2 !== null) { + s3 = peg$parseinMustache(); + if (s3 !== null) { + if (input.charCodeAt(peg$currPos) === 39) { + s4 = peg$c81; + peg$currPos++; + } else { + s4 = null; + if (peg$silentFails === 0) { peg$fail(peg$c82); } + } + 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$c83(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$c141(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$c69) { + s3 = peg$c69; + peg$currPos += 4; + } else { + s3 = null; + if (peg$silentFails === 0) { peg$fail(peg$c70); } + } + if (s3 === null) { + if (input.substr(peg$currPos, 5) === peg$c71) { + s3 = peg$c71; + peg$currPos += 5; + } else { + s3 = null; + if (peg$silentFails === 0) { peg$fail(peg$c72); } + } + } + if (s3 !== null) { + peg$reportedPos = s0; + s1 = peg$c142(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$c99; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c100); } + } + 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$c116; + peg$currPos++; + } else { + s5 = null; + if (peg$silentFails === 0) { peg$fail(peg$c117); } + } + if (s5 !== null) { + peg$reportedPos = s0; + s1 = peg$c143(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$c144; + peg$currPos++; + } else { + s5 = null; + if (peg$silentFails === 0) { peg$fail(peg$c145); } + } + peg$silentFails--; + if (s5 === null) { + s4 = peg$c1; + } else { + peg$currPos = s4; + s4 = peg$c0; + } + if (s4 !== null) { + peg$reportedPos = peg$currPos; + s5 = peg$c146(s1, s3); + if (s5) { + s5 = peg$c1; + } else { + s5 = peg$c0; + } + if (s5 !== null) { + peg$reportedPos = s0; + s1 = peg$c147(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$c148(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$c149(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$c76.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c77); } + } + if (s0 === null) { + if (input.charCodeAt(peg$currPos) === 95) { + s0 = peg$c150; + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c151); } + } + if (s0 === null) { + if (input.charCodeAt(peg$currPos) === 45) { + s0 = peg$c74; + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c75); } + } + } + } + } + + return s0; + } + + function peg$parsetagNameShorthand() { + var s0, s1, s2; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 37) { + s1 = peg$c152; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c153); } + } + 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$c154; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c155); } + } + if (s1 !== null) { + s2 = peg$parsecssIdentifier(); + if (s2 !== null) { + peg$reportedPos = s0; + s1 = peg$c156(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$c49; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c50); } + } + 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$c157); } + } + + return s0; + } + + function peg$parseident() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = []; + s2 = peg$parsenmchar(); + while (s2 !== null) { + s1.push(s2); + s2 = peg$parsenmchar(); + } + if (s1 !== null) { + s1 = input.substring(s0, peg$currPos); + } + s0 = s1; + + return s0; + } + + function peg$parsenmchar() { + 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$parsenonascii(); + } + + return s0; + } + + function peg$parsenmstart() { + var s0; + + if (peg$c160.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c161); } + } + if (s0 === null) { + s0 = peg$parsenonascii(); + } + + return s0; + } + + function peg$parsenonascii() { + var s0; + + if (peg$c162.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c163); } + } + + 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$c152; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c153); } + } + if (s1 !== null) { + s2 = peg$parse_(); + if (s2 !== null) { + s3 = peg$parsetagString(); + if (s3 !== null) { + peg$reportedPos = s0; + s1 = peg$c53(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$c164); } + } + + return s0; + } + + function peg$parseknownTagName() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parsetagString(); + if (s1 !== null) { + peg$reportedPos = peg$currPos; + s2 = peg$c165(s1); + if (s2) { + s2 = peg$c1; + } else { + s2 = peg$c0; + } + if (s2 !== null) { + peg$reportedPos = s0; + s1 = peg$c166(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$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$parsenonSeparatorColon() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 58) { + s1 = peg$c55; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c56); } + } + 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$c168(s1); + if (s2) { + s2 = peg$c1; + } else { + s2 = peg$c0; + } + if (s2 !== null) { + peg$reportedPos = s0; + s1 = peg$c166(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$c167); } + } + + 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$c53(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$c170; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c171); } + } + if (s1 !== null) { + peg$reportedPos = s0; + s1 = peg$c172(); + } + 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$c169); } + } + + return s0; + } + + function peg$parseDEDENT() { + var s0, s1; + + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 61438) { + s1 = peg$c174; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c175); } + } + if (s1 !== null) { + peg$reportedPos = s0; + s1 = peg$c172(); + } + 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$c173); } + } + + return s0; + } + + function peg$parseUNMATCHED_DEDENT() { + var s0, s1; + + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 61422) { + s1 = peg$c177; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c178); } + } + if (s1 !== null) { + peg$reportedPos = s0; + s1 = peg$c172(); + } + 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$c176); } + } + + return s0; + } + + function peg$parseTERM() { + var s0, s1, s2, s3; + + peg$silentFails++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 13) { + s1 = peg$c180; + peg$currPos++; + } else { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c181); } + } + if (s1 === null) { + s1 = peg$c1; + } + if (s1 !== null) { + if (input.charCodeAt(peg$currPos) === 61439) { + s2 = peg$c182; + peg$currPos++; + } else { + s2 = null; + if (peg$silentFails === 0) { peg$fail(peg$c183); } + } + if (s2 !== null) { + if (input.charCodeAt(peg$currPos) === 10) { + s3 = peg$c184; + peg$currPos++; + } else { + s3 = null; + if (peg$silentFails === 0) { peg$fail(peg$c185); } + } + if (s3 !== null) { + peg$reportedPos = s0; + s1 = peg$c130(); + 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$c179); } + } + + 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$c186); } + } + + 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$c187); } + } + + 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$c188); } + } + + return s0; + } + + function peg$parsewhitespace() { + var s0, s1; + + peg$silentFails++; + if (peg$c190.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = null; + if (peg$silentFails === 0) { peg$fail(peg$c191); } + } + peg$silentFails--; + if (s0 === null) { + s1 = null; + if (peg$silentFails === 0) { peg$fail(peg$c189); } + } + + 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$c107); } + } + 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; + 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); + } + + + 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; + +},{"./emblem":3}],5:[function(require,module,exports){ +var Emblem, Preprocessor, StringScanner; + +StringScanner = require('StringScanner'); + +Emblem = require('./emblem'); + +Emblem.Preprocessor = Preprocessor = (function() { + var DEDENT, INDENT, TERM, UNMATCHED_DEDENT, anyWhitespaceAndNewlinesTouchingEOF, any_whitespaceFollowedByNewlines_, processInput, ws; + + ws = '\\t\\x0B\\f \\xA0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF'; + + INDENT = '\uEFEF'; + + DEDENT = '\uEFFE'; + + UNMATCHED_DEDENT = '\uEFEE'; + + TERM = '\uEFFF'; + + anyWhitespaceAndNewlinesTouchingEOF = RegExp("[" + ws + "\\r?\\n]*$"); + + any_whitespaceFollowedByNewlines_ = RegExp("(?:[" + ws + "]*\\r?\\n)+"); + + function Preprocessor() { + this.base = null; + this.indents = []; + this.context = []; + this.context.peek = function() { + if (this.length) { + return this[this.length - 1]; + } else { + return null; + } + }; + this.context.err = function(c) { + throw new Error("Unexpected " + c); + }; + this.output = ''; + this.context.observe = function(c) { + var top; + top = this.peek(); + switch (c) { + case INDENT: + this.push(c); + break; + case DEDENT: + if (top !== INDENT) { + this.err(c); + } + this.pop(); + break; + case '\r': + if (top !== '/') { + this.err(c); + } + this.pop(); + break; + case '\n': + if (top !== '/') { + this.err(c); + } + this.pop(); + break; + case '/': + this.push(c); + break; + case 'end-\\': + if (top !== '\\') { + this.err(c); + } + this.pop(); + break; + default: + throw new Error("undefined token observed: " + c); + } + return this; + }; + if (this.StringScanner) { + this.ss = new this.StringScanner(''); + } else if (Emblem.StringScanner) { + this.ss = new Emblem.StringScanner(''); + } else { + this.ss = new StringScanner(''); + } + } + + Preprocessor.prototype.p = function(s) { + if (s) { + this.output += s; + } + return s; + }; + + Preprocessor.prototype.scan = function(r) { + return this.p(this.ss.scan(r)); + }; + + Preprocessor.prototype.discard = function(r) { + return this.ss.scan(r); + }; + + processInput = function(isEnd) { + return function(data) { + var b, d, indent, s; + if (!isEnd) { + this.ss.concat(data); + this.discard(any_whitespaceFollowedByNewlines_); + } + while (!this.ss.eos()) { + switch (this.context.peek()) { + case null: + case INDENT: + if (this.ss.bol() || this.discard(any_whitespaceFollowedByNewlines_)) { + if (this.discard(RegExp("[" + ws + "]*\\r?\\n"))) { + this.p("" + TERM + "\n"); + continue; + } + if (this.base != null) { + if ((this.discard(this.base)) == null) { + throw new Error("inconsistent base indentation"); + } + } else { + b = this.discard(RegExp("[" + ws + "]*")); + this.base = RegExp("" + b); + } + if (this.indents.length === 0) { + if (this.ss.check(RegExp("[" + ws + "]+"))) { + this.p(INDENT); + this.context.observe(INDENT); + this.indents.push(this.scan(RegExp("([" + ws + "]+)"))); + } + } else { + indent = this.indents[this.indents.length - 1]; + if (d = this.ss.check(RegExp("(" + indent + ")"))) { + this.discard(d); + if (this.ss.check(RegExp("([" + ws + "]+)"))) { + this.p(INDENT); + this.context.observe(INDENT); + this.indents.push(d + this.scan(RegExp("([" + ws + "]+)"))); + } + } else { + while (this.indents.length) { + indent = this.indents[this.indents.length - 1]; + if (this.discard(RegExp("(?:" + indent + ")"))) { + break; + } + this.context.observe(DEDENT); + this.p(DEDENT); + this.indents.pop(); + } + if (s = this.discard(RegExp("[" + ws + "]+"))) { + this.output = this.output.slice(0, -1); + this.output += UNMATCHED_DEDENT; + this.p(INDENT); + this.context.observe(INDENT); + this.indents.push(s); + } + } + } + } + this.scan(/[^\r\n]+/); + if (this.discard(/\r?\n/)) { + this.p("" + TERM + "\n"); + } + } + } + if (isEnd) { + this.scan(anyWhitespaceAndNewlinesTouchingEOF); + while (this.context.length && INDENT === this.context.peek()) { + this.context.observe(DEDENT); + this.p(DEDENT); + } + if (this.context.length) { + throw new Error('Unclosed ' + (this.context.peek()) + ' at EOF'); + } + } + }; + }; + + Preprocessor.prototype.processData = processInput(false); + + Preprocessor.prototype.processEnd = processInput(true); + + Preprocessor.processSync = function(input) { + var pre; + input += "\n"; + pre = new Preprocessor; + pre.processData(input); + pre.processEnd(); + return pre.output; + }; + + return Preprocessor; + +})(); + +},{"./emblem":3,"StringScanner":6}],6:[function(require,module,exports){ +(function() { + var StringScanner; + StringScanner = (function() { + function StringScanner(str) { + this.str = str != null ? str : ''; + this.str = '' + this.str; + this.pos = 0; + this.lastMatch = { + reset: function() { + this.str = null; + this.captures = []; + return this; + } + }.reset(); + this; + } + StringScanner.prototype.bol = function() { + return this.pos <= 0 || (this.str[this.pos - 1] === "\n"); + }; + StringScanner.prototype.captures = function() { + return this.lastMatch.captures; + }; + StringScanner.prototype.check = function(pattern) { + var matches; + if (this.str.substr(this.pos).search(pattern) !== 0) { + this.lastMatch.reset(); + return null; + } + matches = this.str.substr(this.pos).match(pattern); + this.lastMatch.str = matches[0]; + this.lastMatch.captures = matches.slice(1); + return this.lastMatch.str; + }; + StringScanner.prototype.checkUntil = function(pattern) { + var matches, patternPos; + patternPos = this.str.substr(this.pos).search(pattern); + if (patternPos < 0) { + this.lastMatch.reset(); + return null; + } + matches = this.str.substr(this.pos + patternPos).match(pattern); + this.lastMatch.captures = matches.slice(1); + return this.lastMatch.str = this.str.substr(this.pos, patternPos) + matches[0]; + }; + StringScanner.prototype.clone = function() { + var clone, prop, value, _ref; + clone = new this.constructor(this.str); + clone.pos = this.pos; + clone.lastMatch = {}; + _ref = this.lastMatch; + for (prop in _ref) { + value = _ref[prop]; + clone.lastMatch[prop] = value; + } + return clone; + }; + StringScanner.prototype.concat = function(str) { + this.str += str; + return this; + }; + StringScanner.prototype.eos = function() { + return this.pos === this.str.length; + }; + StringScanner.prototype.exists = function(pattern) { + var matches, patternPos; + patternPos = this.str.substr(this.pos).search(pattern); + if (patternPos < 0) { + this.lastMatch.reset(); + return null; + } + matches = this.str.substr(this.pos + patternPos).match(pattern); + this.lastMatch.str = matches[0]; + this.lastMatch.captures = matches.slice(1); + return patternPos; + }; + StringScanner.prototype.getch = function() { + return this.scan(/./); + }; + StringScanner.prototype.match = function() { + return this.lastMatch.str; + }; + StringScanner.prototype.matches = function(pattern) { + this.check(pattern); + return this.matchSize(); + }; + StringScanner.prototype.matched = function() { + return this.lastMatch.str != null; + }; + StringScanner.prototype.matchSize = function() { + if (this.matched()) { + return this.match().length; + } else { + return null; + } + }; + StringScanner.prototype.peek = function(len) { + return this.str.substr(this.pos, len); + }; + StringScanner.prototype.pointer = function() { + return this.pos; + }; + StringScanner.prototype.setPointer = function(pos) { + pos = +pos; + if (pos < 0) { + pos = 0; + } + if (pos > this.str.length) { + pos = this.str.length; + } + return this.pos = pos; + }; + StringScanner.prototype.reset = function() { + this.lastMatch.reset(); + this.pos = 0; + return this; + }; + StringScanner.prototype.rest = function() { + return this.str.substr(this.pos); + }; + StringScanner.prototype.scan = function(pattern) { + var chk; + chk = this.check(pattern); + if (chk != null) { + this.pos += chk.length; + } + return chk; + }; + StringScanner.prototype.scanUntil = function(pattern) { + var chk; + chk = this.checkUntil(pattern); + if (chk != null) { + this.pos += chk.length; + } + return chk; + }; + StringScanner.prototype.skip = function(pattern) { + this.scan(pattern); + return this.matchSize(); + }; + StringScanner.prototype.skipUntil = function(pattern) { + this.scanUntil(pattern); + return this.matchSize(); + }; + StringScanner.prototype.string = function() { + return this.str; + }; + StringScanner.prototype.terminate = function() { + this.pos = this.str.length; + this.lastMatch.reset(); + return this; + }; + StringScanner.prototype.toString = function() { + return "# 8 ? "" + (this.str.substr(0, 5)) + "..." : this.str)) + ">"; + }; + return StringScanner; + })(); + StringScanner.prototype.beginningOfLine = StringScanner.prototype.bol; + StringScanner.prototype.clear = StringScanner.prototype.terminate; + StringScanner.prototype.dup = StringScanner.prototype.clone; + StringScanner.prototype.endOfString = StringScanner.prototype.eos; + StringScanner.prototype.exist = StringScanner.prototype.exists; + StringScanner.prototype.getChar = StringScanner.prototype.getch; + StringScanner.prototype.position = StringScanner.prototype.pointer; + StringScanner.StringScanner = StringScanner; + module.exports = StringScanner; +}).call(this); + +},{}]},{},[3]) +; \ No newline at end of file diff --git a/app/assets/javascripts/cmtool/handlebars.js b/app/assets/javascripts/cmtool/handlebars.js new file mode 100644 index 0000000..bec7085 --- /dev/null +++ b/app/assets/javascripts/cmtool/handlebars.js @@ -0,0 +1,2746 @@ +/*! + + handlebars v1.3.0 + +Copyright (C) 2011 by Yehuda Katz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +@license +*/ +/* exported Handlebars */ +var Handlebars = (function() { +// handlebars/safe-string.js +var __module4__ = (function() { + "use strict"; + var __exports__; + // Build out our basic SafeString type + function SafeString(string) { + this.string = string; + } + + SafeString.prototype.toString = function() { + return "" + this.string; + }; + + __exports__ = SafeString; + return __exports__; +})(); + +// handlebars/utils.js +var __module3__ = (function(__dependency1__) { + "use strict"; + var __exports__ = {}; + /*jshint -W004 */ + var SafeString = __dependency1__; + + var escape = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" + }; + + var badChars = /[&<>"'`]/g; + var possible = /[&<>"'`]/; + + function escapeChar(chr) { + return escape[chr] || "&"; + } + + function extend(obj, value) { + for(var key in value) { + if(Object.prototype.hasOwnProperty.call(value, key)) { + obj[key] = value[key]; + } + } + } + + __exports__.extend = extend;var toString = Object.prototype.toString; + __exports__.toString = toString; + // Sourced from lodash + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt + var isFunction = function(value) { + return typeof value === 'function'; + }; + // fallback for older versions of Chrome and Safari + if (isFunction(/x/)) { + isFunction = function(value) { + return typeof value === 'function' && toString.call(value) === '[object Function]'; + }; + } + var isFunction; + __exports__.isFunction = isFunction; + var isArray = Array.isArray || function(value) { + return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; + }; + __exports__.isArray = isArray; + + function escapeExpression(string) { + // don't escape SafeStrings, since they're already safe + if (string instanceof SafeString) { + return string.toString(); + } else if (!string && string !== 0) { + return ""; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = "" + string; + + if(!possible.test(string)) { return string; } + return string.replace(badChars, escapeChar); + } + + __exports__.escapeExpression = escapeExpression;function isEmpty(value) { + if (!value && value !== 0) { + return true; + } else if (isArray(value) && value.length === 0) { + return true; + } else { + return false; + } + } + + __exports__.isEmpty = isEmpty; + return __exports__; +})(__module4__); + +// handlebars/exception.js +var __module5__ = (function() { + "use strict"; + var __exports__; + + var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + + function Exception(message, node) { + var line; + if (node && node.firstLine) { + line = node.firstLine; + + message += ' - ' + line + ':' + node.firstColumn; + } + + var tmp = Error.prototype.constructor.call(this, message); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } + + if (line) { + this.lineNumber = line; + this.column = node.firstColumn; + } + } + + Exception.prototype = new Error(); + + __exports__ = Exception; + return __exports__; +})(); + +// handlebars/base.js +var __module2__ = (function(__dependency1__, __dependency2__) { + "use strict"; + var __exports__ = {}; + var Utils = __dependency1__; + var Exception = __dependency2__; + + var VERSION = "1.3.0"; + __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; + __exports__.COMPILER_REVISION = COMPILER_REVISION; + var REVISION_CHANGES = { + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it + 2: '== 1.0.0-rc.3', + 3: '== 1.0.0-rc.4', + 4: '>= 1.0.0' + }; + __exports__.REVISION_CHANGES = REVISION_CHANGES; + var isArray = Utils.isArray, + isFunction = Utils.isFunction, + toString = Utils.toString, + objectType = '[object Object]'; + + function HandlebarsEnvironment(helpers, partials) { + this.helpers = helpers || {}; + this.partials = partials || {}; + + registerDefaultHelpers(this); + } + + __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { + constructor: HandlebarsEnvironment, + + logger: logger, + log: log, + + registerHelper: function(name, fn, inverse) { + if (toString.call(name) === objectType) { + if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } + Utils.extend(this.helpers, name); + } else { + if (inverse) { fn.not = inverse; } + this.helpers[name] = fn; + } + }, + + registerPartial: function(name, str) { + if (toString.call(name) === objectType) { + Utils.extend(this.partials, name); + } else { + this.partials[name] = str; + } + } + }; + + function registerDefaultHelpers(instance) { + instance.registerHelper('helperMissing', function(arg) { + if(arguments.length === 2) { + return undefined; + } else { + throw new Exception("Missing helper: '" + arg + "'"); + } + }); + + instance.registerHelper('blockHelperMissing', function(context, options) { + var inverse = options.inverse || function() {}, fn = options.fn; + + if (isFunction(context)) { context = context.call(this); } + + if(context === true) { + return fn(this); + } else if(context === false || context == null) { + return inverse(this); + } else if (isArray(context)) { + if(context.length > 0) { + return instance.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + return fn(context); + } + }); + + instance.registerHelper('each', function(context, options) { + var fn = options.fn, inverse = options.inverse; + var i = 0, ret = "", data; + + if (isFunction(context)) { context = context.call(this); } + + if (options.data) { + data = createFrame(options.data); + } + + if(context && typeof context === 'object') { + if (isArray(context)) { + for(var j = context.length; i 0) { + throw new Exception("Invalid path: " + original, this); + } else if (part === "..") { + depth++; + } else { + this.isScoped = true; + } + } else { + dig.push(part); + } + } + + this.original = original; + this.parts = dig; + this.string = dig.join('.'); + this.depth = depth; + + // an ID is simple if it only has one part, and that part is not + // `..` or `this`. + this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; + + this.stringModeValue = this.string; + }, + + PartialNameNode: function(name, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "PARTIAL_NAME"; + this.name = name.original; + }, + + DataNode: function(id, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "DATA"; + this.id = id; + }, + + StringNode: function(string, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "STRING"; + this.original = + this.string = + this.stringModeValue = string; + }, + + IntegerNode: function(integer, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "INTEGER"; + this.original = + this.integer = integer; + this.stringModeValue = Number(integer); + }, + + BooleanNode: function(bool, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "BOOLEAN"; + this.bool = bool; + this.stringModeValue = bool === "true"; + }, + + CommentNode: function(comment, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "comment"; + this.comment = comment; + } + }; + + // Must be exported as an object rather than the root of the module as the jison lexer + // most modify the object to operate properly. + __exports__ = AST; + return __exports__; +})(__module5__); + +// handlebars/compiler/parser.js +var __module9__ = (function() { + "use strict"; + var __exports__; + /* jshint ignore:start */ + /* Jison generated parser */ + var handlebars = (function(){ + var parser = {trace: function trace() { }, + yy: {}, + symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"sexpr":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"sexpr_repetition0":28,"sexpr_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"OPEN_SEXPR":35,"CLOSE_SEXPR":36,"hash":37,"hash_repetition_plus0":38,"hashSegment":39,"ID":40,"EQUALS":41,"DATA":42,"pathSegments":43,"SEP":44,"$accept":0,"$end":1}, + terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"}, + productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]], + performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { + + var $0 = $$.length - 1; + switch (yystate) { + case 1: return new yy.ProgramNode($$[$0-1], this._$); + break; + case 2: return new yy.ProgramNode([], this._$); + break; + case 3:this.$ = new yy.ProgramNode([], $$[$0-1], $$[$0], this._$); + break; + case 4:this.$ = new yy.ProgramNode($$[$0-2], $$[$0-1], $$[$0], this._$); + break; + case 5:this.$ = new yy.ProgramNode($$[$0-1], $$[$0], [], this._$); + break; + case 6:this.$ = new yy.ProgramNode($$[$0], this._$); + break; + case 7:this.$ = new yy.ProgramNode([], this._$); + break; + case 8:this.$ = new yy.ProgramNode([], this._$); + break; + case 9:this.$ = [$$[$0]]; + break; + case 10: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; + break; + case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0], this._$); + break; + case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0], this._$); + break; + case 13:this.$ = $$[$0]; + break; + case 14:this.$ = $$[$0]; + break; + case 15:this.$ = new yy.ContentNode($$[$0], this._$); + break; + case 16:this.$ = new yy.CommentNode($$[$0], this._$); + break; + case 17:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 18:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; + break; + case 20:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 21:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0]), this._$); + break; + case 23:this.$ = stripFlags($$[$0-1], $$[$0]); + break; + case 24:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$); + break; + case 25:this.$ = new yy.SexprNode([$$[$0]], null, this._$); + break; + case 26:this.$ = $$[$0]; + break; + case 27:this.$ = new yy.StringNode($$[$0], this._$); + break; + case 28:this.$ = new yy.IntegerNode($$[$0], this._$); + break; + case 29:this.$ = new yy.BooleanNode($$[$0], this._$); + break; + case 30:this.$ = $$[$0]; + break; + case 31:$$[$0-1].isHelper = true; this.$ = $$[$0-1]; + break; + case 32:this.$ = new yy.HashNode($$[$0], this._$); + break; + case 33:this.$ = [$$[$0-2], $$[$0]]; + break; + case 34:this.$ = new yy.PartialNameNode($$[$0], this._$); + break; + case 35:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$); + break; + case 36:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0], this._$)); + break; + case 37:this.$ = new yy.DataNode($$[$0], this._$); + break; + case 38:this.$ = new yy.IdNode($$[$0], this._$); + break; + case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; + break; + case 40:this.$ = [{part: $$[$0]}]; + break; + case 43:this.$ = []; + break; + case 44:$$[$0-1].push($$[$0]); + break; + case 47:this.$ = [$$[$0]]; + break; + case 48:$$[$0-1].push($$[$0]); + break; + } + }, + table: [{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}], + defaultActions: {3:[2,2],16:[2,1],50:[2,42]}, + parseError: function parseError(str, hash) { + throw new Error(str); + }, + parse: function parse(input) { + var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + this.yy.parser = this; + if (typeof this.lexer.yylloc == "undefined") + this.lexer.yylloc = {}; + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + var ranges = this.lexer.options && this.lexer.options.ranges; + if (typeof this.yy.parseError === "function") + this.parseError = this.yy.parseError; + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = self.lexer.lex() || 1; + if (typeof token !== "number") { + token = self.symbols_[token] || token; + } + return token; + } + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + if (!recovering) { + expected = []; + for (p in table[state]) + if (this.terminals_[p] && p > 2) { + expected.push("'" + this.terminals_[p] + "'"); + } + if (this.lexer.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); + } + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) + recovering--; + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + + + function stripFlags(open, close) { + return { + left: open.charAt(2) === '~', + right: close.charAt(0) === '~' || close.charAt(1) === '~' + }; + } + + /* Jison generated lexer */ + var lexer = (function(){ + var lexer = ({EOF:1, + parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + setInput:function (input) { + this._input = input; + this._more = this._less = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; + if (this.options.ranges) this.yylloc.range = [0,0]; + this.offset = 0; + return this; + }, + input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) this.yylloc.range[1]++; + + this._input = this._input.slice(1); + return ch; + }, + unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length-len-1); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length-1); + this.matched = this.matched.substr(0, this.matched.length-1); + + if (lines.length-1) this.yylineno -= lines.length-1; + var r = this.yylloc.range; + + this.yylloc = {first_line: this.yylloc.first_line, + last_line: this.yylineno+1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length: + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + return this; + }, + more:function () { + this._more = true; + return this; + }, + less:function (n) { + this.unput(this.match.slice(n)); + }, + pastInput:function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + }, + upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); + } + return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); + }, + showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c+"^"; + }, + next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) this.done = true; + + var token, + match, + tempMatch, + index, + col, + lines; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i=0;i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (!this.options.flex) break; + } + } + if (match) { + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) this.yylineno += lines.length; + this.yylloc = {first_line: this.yylloc.last_line, + last_line: this.yylineno+1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length}; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); + if (this.done && this._input) this.done = false; + if (token) return token; + else return; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), + {text: "", token: null, line: this.yylineno}); + } + }, + lex:function lex() { + var r = this.next(); + if (typeof r !== 'undefined') { + return r; + } else { + return this.lex(); + } + }, + begin:function begin(condition) { + this.conditionStack.push(condition); + }, + popState:function popState() { + return this.conditionStack.pop(); + }, + _currentRules:function _currentRules() { + return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; + }, + topState:function () { + return this.conditionStack[this.conditionStack.length-2]; + }, + pushState:function begin(condition) { + this.begin(condition); + }}); + lexer.options = {}; + lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { + + + function strip(start, end) { + return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end); + } + + + var YYSTATE=YY_START + switch($avoiding_name_collisions) { + case 0: + if(yy_.yytext.slice(-2) === "\\\\") { + strip(0,1); + this.begin("mu"); + } else if(yy_.yytext.slice(-1) === "\\") { + strip(0,1); + this.begin("emu"); + } else { + this.begin("mu"); + } + if(yy_.yytext) return 14; + + break; + case 1:return 14; + break; + case 2: + this.popState(); + return 14; + + break; + case 3:strip(0,4); this.popState(); return 15; + break; + case 4:return 35; + break; + case 5:return 36; + break; + case 6:return 25; + break; + case 7:return 16; + break; + case 8:return 20; + break; + case 9:return 19; + break; + case 10:return 19; + break; + case 11:return 23; + break; + case 12:return 22; + break; + case 13:this.popState(); this.begin('com'); + break; + case 14:strip(3,5); this.popState(); return 15; + break; + case 15:return 22; + break; + case 16:return 41; + break; + case 17:return 40; + break; + case 18:return 40; + break; + case 19:return 44; + break; + case 20:// ignore whitespace + break; + case 21:this.popState(); return 24; + break; + case 22:this.popState(); return 18; + break; + case 23:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32; + break; + case 24:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32; + break; + case 25:return 42; + break; + case 26:return 34; + break; + case 27:return 34; + break; + case 28:return 33; + break; + case 29:return 40; + break; + case 30:yy_.yytext = strip(1,2); return 40; + break; + case 31:return 'INVALID'; + break; + case 32:return 5; + break; + } + }; + lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; + lexer.conditions = {"mu":{"rules":[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}}; + return lexer;})() + parser.lexer = lexer; + function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; + return new Parser; + })();__exports__ = handlebars; + /* jshint ignore:end */ + return __exports__; +})(); + +// handlebars/compiler/base.js +var __module8__ = (function(__dependency1__, __dependency2__) { + "use strict"; + var __exports__ = {}; + var parser = __dependency1__; + var AST = __dependency2__; + + __exports__.parser = parser; + + function parse(input) { + // Just return if an already-compile AST was passed in. + if(input.constructor === AST.ProgramNode) { return input; } + + parser.yy = AST; + return parser.parse(input); + } + + __exports__.parse = parse; + return __exports__; +})(__module9__, __module7__); + +// handlebars/compiler/compiler.js +var __module10__ = (function(__dependency1__) { + "use strict"; + var __exports__ = {}; + var Exception = __dependency1__; + + function Compiler() {} + + __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a + // function in a context. This is necessary for mustache compatibility, which + // requires that context functions in blocks are evaluated by blockHelperMissing, + // and then proceed as if the resulting value was provided to blockHelperMissing. + + Compiler.prototype = { + compiler: Compiler, + + disassemble: function() { + var opcodes = this.opcodes, opcode, out = [], params, param; + + for (var i=0, l=opcodes.length; i 0) { + this.source[1] = this.source[1] + ", " + locals.join(", "); + } + + // Generate minimizer alias mappings + if (!this.isChild) { + for (var alias in this.context.aliases) { + if (this.context.aliases.hasOwnProperty(alias)) { + this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; + } + } + } + + if (this.source[1]) { + this.source[1] = "var " + this.source[1].substring(2) + ";"; + } + + // Merge children + if (!this.isChild) { + this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; + } + + if (!this.environment.isSimple) { + this.pushSource("return buffer;"); + } + + var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; + + for(var i=0, l=this.environment.depths.list.length; i this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } + return this.topStackName(); + }, + topStackName: function() { + return "stack" + this.stackSlot; + }, + flushInline: function() { + var inlineStack = this.inlineStack; + if (inlineStack.length) { + this.inlineStack = []; + for (var i = 0, len = inlineStack.length; i < len; i++) { + var entry = inlineStack[i]; + if (entry instanceof Literal) { + this.compileStack.push(entry); + } else { + this.pushStack(entry); + } + } + } + }, + isInline: function() { + return this.inlineStack.length; + }, + + popStack: function(wrapped) { + var inline = this.isInline(), + item = (inline ? this.inlineStack : this.compileStack).pop(); + + if (!wrapped && (item instanceof Literal)) { + return item.value; + } else { + if (!inline) { + if (!this.stackSlot) { + throw new Exception('Invalid stack pop'); + } + this.stackSlot--; + } + return item; + } + }, + + topStack: function(wrapped) { + var stack = (this.isInline() ? this.inlineStack : this.compileStack), + item = stack[stack.length - 1]; + + if (!wrapped && (item instanceof Literal)) { + return item.value; + } else { + return item; + } + }, + + quotedString: function(str) { + return '"' + str + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 + .replace(/\u2029/g, '\\u2029') + '"'; + }, + + setupHelper: function(paramSize, name, missingParams) { + var params = [], + paramsInit = this.setupParams(paramSize, params, missingParams); + var foundHelper = this.nameLookup('helpers', name, 'helper'); + + return { + params: params, + paramsInit: paramsInit, + name: foundHelper, + callParams: ["depth0"].concat(params).join(", "), + helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") + }; + }, + + setupOptions: function(paramSize, params) { + var options = [], contexts = [], types = [], param, inverse, program; + + options.push("hash:" + this.popStack()); + + if (this.options.stringParams) { + options.push("hashTypes:" + this.popStack()); + options.push("hashContexts:" + this.popStack()); + } + + inverse = this.popStack(); + program = this.popStack(); + + // Avoid setting fn and inverse if neither are set. This allows + // helpers to do a check for `if (options.fn)` + if (program || inverse) { + if (!program) { + this.context.aliases.self = "this"; + program = "self.noop"; + } + + if (!inverse) { + this.context.aliases.self = "this"; + inverse = "self.noop"; + } + + options.push("inverse:" + inverse); + options.push("fn:" + program); + } + + for(var i=0; i text_field = $(el) + template_field = $("##{text_field.attr('id')}_template") ace_div = $('
').addClass('ace-div') text_field.after ace_div ace_div.css @@ -10,12 +11,24 @@ class HtmlEdit height: '600px' editor = ace.edit(ace_div.get(0)) editor.setTheme 'ace/theme/monokai' - editor.setValue text_field.val(), -1 - editor.getSession().setMode 'ace/mode/handlebars' + if template_field.length + editor.setValue template_field.val(), -1 + editor.getSession().setMode 'ace/mode/haml' + else + editor.setValue text_field.val(), -1 + editor.getSession().setMode 'ace/mode/handlebars' editor.getSession().setTabSize(2) editor.getSession().setUseSoftTabs(true) editor.getSession().on 'change', (e)-> - text_field.val(editor.getValue()).change() + value = editor.getValue() + if template_field.length + try + template = Emblem.compile(Handlebars, value) + result_value = template(page_vars) + template_field.val value + text_field.val result_value + else + text_field.val value text_field.hide() - #ace_div.hide() + template_field.hide() @html_edit = new HtmlEdit() diff --git a/app/views/cmtool/pages/_form.html.slim b/app/views/cmtool/pages/_form.html.slim index c30bfe9..1865353 100644 --- a/app/views/cmtool/pages/_form.html.slim +++ b/app/views/cmtool/pages/_form.html.slim @@ -27,8 +27,8 @@ javascript: .form-field= f.select :locale, Page.locales .form-row = f.label :body - br = f.text_area :body, rows: 30, cols: 80, class: 'html-content' + = f.text_area :body_template = collapsible_content 'Sidebar' do .field = f.label :sidebar diff --git a/lib/cmtool/includes/page.rb b/lib/cmtool/includes/page.rb index b5a0f62..5ee3f72 100644 --- a/lib/cmtool/includes/page.rb +++ b/lib/cmtool/includes/page.rb @@ -11,8 +11,11 @@ module Cmtool klass.property :menu_text klass.property :title klass.property :body - klass.property :footer + klass.property :body_template klass.property :sidebar + klass.property :sidebar_template + klass.property :footer + klass.property :footer_template klass.property :wysiwyg, type: :boolean, default: false klass.property :priority, type: Float, default: 0.5 klass.property :active, type: :boolean, default: true