Sorry, the diff of this file is too big to display
+15
-8
@@ -1,2 +0,9 @@ | ||
| # [0.8.2](https://github.com/machty/emblem.js/releases/tag/0.8.2) | ||
| # [0.9.0](https://github.com/machty/emblem.js/releases/tag/v0.9.0) | ||
| - Support bracket params in subexpressions | ||
| - block params no longer allow subexpressions | ||
| - else / else if nodes should now accept the full range of mustache attrs | ||
| - bracketed attrs can have comments (sort of) | ||
| - added yarn | ||
| # [0.8.2](https://github.com/machty/emblem.js/releases/tag/v0.8.2) | ||
| - Fix variation on subexpressions | ||
@@ -6,6 +13,6 @@ - Add menuitem as HTML element | ||
| # [0.8.1](https://github.com/machty/emblem.js/releases/tag/0.8.1) | ||
| # [0.8.1](https://github.com/machty/emblem.js/releases/tag/v0.8.1) | ||
| - Fix issue with bracketed attributes without blocks | ||
| # [0.8.0](https://github.com/machty/emblem.js/releases/tag/0.8.0) | ||
| # [0.8.0](https://github.com/machty/emblem.js/releases/tag/v0.8.0) | ||
| - Add a wider variety of support for bracketed attributes and blocks / block params | ||
@@ -17,6 +24,6 @@ - Initial support for glimmer components using `%` helper | ||
| # [0.7.1](https://github.com/machty/emblem.js/releases/tag/0.7.1) | ||
| # [0.7.1](https://github.com/machty/emblem.js/releases/tag/v0.7.1) | ||
| - Allow slashes in attr values | ||
| # [0.7.0](https://github.com/machty/emblem.js/releases/tag/0.7.0) | ||
| # [0.7.0](https://github.com/machty/emblem.js/releases/tag/v0.7.0) | ||
| - Added new spacing helper: | ||
@@ -28,3 +35,3 @@ `+` will add an extra space before line | ||
| # [0.6.0](https://github.com/machty/emblem.js/releases/tag/0.6.0) | ||
| # [0.6.0](https://github.com/machty/emblem.js/releases/tag/v0.6.0) | ||
@@ -46,7 +53,7 @@ Emblem no longer outputs `{{bind-attr}}`s for attribute bindings, | ||
| # [0.5.1](https://github.com/machty/emblem.js/releases/tag/0.5.1) | ||
| # [0.5.1](https://github.com/machty/emblem.js/releases/tag/v0.5.1) | ||
| Added support for block params. | ||
| # [0.5.0](https://github.com/machty/emblem.js/releases/tag/0.5.0) | ||
| # [0.5.0](https://github.com/machty/emblem.js/releases/tag/v0.5.0) | ||
@@ -53,0 +60,0 @@ As of version 0.5.0, the output of an `Emblem` `compile` call is a |
@@ -12,3 +12,3 @@ 'use strict'; | ||
| compile: compiler.compile, | ||
| VERSION: "0.8.1" | ||
| VERSION: "0.9.0" | ||
| }; |
@@ -40,4 +40,4 @@ 'use strict'; | ||
| peg$startRuleFunctions = { _51start: peg$parse_51start }, | ||
| peg$startRuleFunction = peg$parse_51start, | ||
| peg$startRuleFunctions = { _50start: peg$parse_50start }, | ||
| peg$startRuleFunction = peg$parse_50start, | ||
@@ -127,3 +127,3 @@ peg$c0 = peg$FAILED, | ||
| }, | ||
| peg$c63 = { type: "other", description: "_51DEDENT" }, | ||
| peg$c63 = { type: "other", description: "_50DEDENT" }, | ||
@@ -1330,6 +1330,6 @@ peg$currPos = 0, | ||
| function peg$parse_51start() { | ||
| function peg$parse_50start() { | ||
| var s0; | ||
| s0 = peg$parse_51htmlNestedTextNodes(); | ||
| s0 = peg$parse_50htmlNestedTextNodes(); | ||
@@ -1339,3 +1339,3 @@ return s0; | ||
| function peg$parse_51htmlNestedTextNodes() { | ||
| function peg$parse_50htmlNestedTextNodes() { | ||
| var s0, s1, s2, s3, s4, s5, s6; | ||
@@ -1368,3 +1368,3 @@ | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = peg$parse_51DEDENT(); | ||
| s6 = peg$parse_50DEDENT(); | ||
| if (s6 !== peg$FAILED) { | ||
@@ -1408,3 +1408,3 @@ s4 = [s4, s5, s6]; | ||
| function peg$parse_51DEDENT() { | ||
| function peg$parse_50DEDENT() { | ||
| var s0, s1, s2; | ||
@@ -1556,3 +1556,2 @@ | ||
| function parseInHtml(h, inTagMustaches, fullAttributes, blockParams) { | ||
@@ -1559,0 +1558,0 @@ var tagName = h[0] || 'div', |
@@ -40,82 +40,110 @@ 'use strict'; | ||
| peg$startRuleFunctions = { _54start: peg$parse_54start }, | ||
| peg$startRuleFunction = peg$parse_54start, | ||
| peg$startRuleFunctions = { _51start: peg$parse_51start }, | ||
| peg$startRuleFunction = peg$parse_51start, | ||
| peg$c0 = /^[_a-zA-Z0-9\-]/, | ||
| peg$c1 = { type: "class", value: "[_a-zA-Z0-9\\-]", description: "[_a-zA-Z0-9\\-]" }, | ||
| peg$c2 = /^[\x80-\xFF]/, | ||
| peg$c3 = { type: "class", value: "[\\x80-\\xFF]", description: "[\\x80-\\xFF]" }, | ||
| peg$c4 = { type: "other", description: "_31Key" }, | ||
| peg$c5 = [], | ||
| peg$c6 = ":", | ||
| peg$c7 = { type: "literal", value: ":", description: "\":\"" }, | ||
| peg$c8 = ".", | ||
| peg$c9 = { type: "literal", value: ".", description: "\".\"" }, | ||
| peg$c10 = peg$FAILED, | ||
| peg$c11 = void 0, | ||
| peg$c12 = "{", | ||
| peg$c13 = { type: "literal", value: "{", description: "\"{\"" }, | ||
| peg$c14 = /^[^}]/, | ||
| peg$c15 = { type: "class", value: "[^}]", description: "[^}]" }, | ||
| peg$c16 = function(text) { | ||
| peg$c0 = /^[ \t]/, | ||
| peg$c1 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, | ||
| peg$c2 = { type: "other", description: "_1OptionalWhitespace" }, | ||
| peg$c3 = [], | ||
| peg$c4 = peg$FAILED, | ||
| peg$c5 = void 0, | ||
| peg$c6 = "{", | ||
| peg$c7 = { type: "literal", value: "{", description: "\"{\"" }, | ||
| peg$c8 = /^[^}]/, | ||
| peg$c9 = { type: "class", value: "[^}]", description: "[^}]" }, | ||
| peg$c10 = function(text) { | ||
| return text; | ||
| }, | ||
| peg$c17 = /^[\-_\/A-Za-z0-9]/, | ||
| peg$c18 = { type: "class", value: "[\\-_\\/A-Za-z0-9]", description: "[\\-_\\/A-Za-z0-9]" }, | ||
| peg$c19 = ".[", | ||
| peg$c20 = { type: "literal", value: ".[", description: "\".[\"" }, | ||
| peg$c21 = "]", | ||
| peg$c22 = { type: "literal", value: "]", description: "\"]\"" }, | ||
| peg$c23 = /^[ \t]/, | ||
| peg$c24 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, | ||
| peg$c25 = { type: "other", description: "_1OptionalWhitespace" }, | ||
| peg$c26 = "as", | ||
| peg$c27 = { type: "literal", value: "as", description: "\"as\"" }, | ||
| peg$c28 = "|", | ||
| peg$c29 = { type: "literal", value: "|", description: "\"|\"" }, | ||
| peg$c30 = "\"", | ||
| peg$c31 = { type: "literal", value: "\"", description: "\"\\\"\"" }, | ||
| peg$c32 = "'", | ||
| peg$c33 = { type: "literal", value: "'", description: "\"'\"" }, | ||
| peg$c34 = /^[^'"]/, | ||
| peg$c35 = { type: "class", value: "[^'\"]", description: "[^'\"]" }, | ||
| peg$c36 = function(p) { | ||
| return p; | ||
| }, | ||
| peg$c37 = /^[^()]/, | ||
| peg$c38 = { type: "class", value: "[^()]", description: "[^()]" }, | ||
| peg$c39 = "(", | ||
| peg$c40 = { type: "literal", value: "(", description: "\"(\"" }, | ||
| peg$c41 = ")", | ||
| peg$c42 = { type: "literal", value: ")", description: "\")\"" }, | ||
| peg$c43 = function(v) { | ||
| peg$c11 = /^[\-_\/A-Za-z0-9]/, | ||
| peg$c12 = { type: "class", value: "[\\-_\\/A-Za-z0-9]", description: "[\\-_\\/A-Za-z0-9]" }, | ||
| peg$c13 = ".", | ||
| peg$c14 = { type: "literal", value: ".", description: "\".\"" }, | ||
| peg$c15 = ".[", | ||
| peg$c16 = { type: "literal", value: ".[", description: "\".[\"" }, | ||
| peg$c17 = "]", | ||
| peg$c18 = { type: "literal", value: "]", description: "\"]\"" }, | ||
| peg$c19 = "as", | ||
| peg$c20 = { type: "literal", value: "as", description: "\"as\"" }, | ||
| peg$c21 = "|", | ||
| peg$c22 = { type: "literal", value: "|", description: "\"|\"" }, | ||
| peg$c23 = "\"", | ||
| peg$c24 = { type: "literal", value: "\"", description: "\"\\\"\"" }, | ||
| peg$c25 = "'", | ||
| peg$c26 = { type: "literal", value: "'", description: "\"'\"" }, | ||
| peg$c27 = /^[^'"]/, | ||
| peg$c28 = { type: "class", value: "[^'\"]", description: "[^'\"]" }, | ||
| peg$c29 = function(v) { | ||
| return v; | ||
| }, | ||
| peg$c44 = "/", | ||
| peg$c45 = { type: "literal", value: "/", description: "\"/\"" }, | ||
| peg$c46 = "=", | ||
| peg$c47 = { type: "literal", value: "=", description: "\"=\"" }, | ||
| peg$c48 = function(key, value) { | ||
| peg$c30 = /^[\/(]/, | ||
| peg$c31 = { type: "class", value: "[\\/(]", description: "[\\/(]" }, | ||
| peg$c32 = /^[_a-zA-Z0-9\-]/, | ||
| peg$c33 = { type: "class", value: "[_a-zA-Z0-9\\-]", description: "[_a-zA-Z0-9\\-]" }, | ||
| peg$c34 = /^[\x80-\xFF]/, | ||
| peg$c35 = { type: "class", value: "[\\x80-\\xFF]", description: "[\\x80-\\xFF]" }, | ||
| peg$c36 = { type: "other", description: "_31Key" }, | ||
| peg$c37 = ":", | ||
| peg$c38 = { type: "literal", value: ":", description: "\":\"" }, | ||
| peg$c39 = { type: "other", description: "_3ANYDEDENT" }, | ||
| peg$c40 = { type: "other", description: "_3DEDENT" }, | ||
| peg$c41 = { type: "any", description: "any character" }, | ||
| peg$c42 = function(t) { return preprocessor.DEDENT_SYMBOL === t; }, | ||
| peg$c43 = function(t) { return ''; }, | ||
| peg$c44 = { type: "other", description: "_3Unmatched DEDENT" }, | ||
| peg$c45 = function(t) { return preprocessor.UNMATCHED_DEDENT_SYMBOL === t; }, | ||
| peg$c46 = { type: "other", description: "_4RequiredWhitespace" }, | ||
| peg$c47 = function(s) { return s; }, | ||
| peg$c48 = { type: "other", description: "_5INDENT" }, | ||
| peg$c49 = function(t) { return preprocessor.INDENT_SYMBOL === t; }, | ||
| peg$c50 = function(c) { return c; }, | ||
| peg$c51 = { type: "other", description: "_6INDENT" }, | ||
| peg$c52 = { type: "other", description: "_6DEDENT" }, | ||
| peg$c53 = { type: "other", description: "_6LineEnd" }, | ||
| peg$c54 = null, | ||
| peg$c55 = "\r", | ||
| peg$c56 = { type: "literal", value: "\r", description: "\"\\r\"" }, | ||
| peg$c57 = function(t) { return preprocessor.TERM_SYMBOL == t; }, | ||
| peg$c58 = "\n", | ||
| peg$c59 = { type: "literal", value: "\n", description: "\"\\n\"" }, | ||
| peg$c60 = function(t) { return false; }, | ||
| peg$c61 = "/", | ||
| peg$c62 = { type: "literal", value: "/", description: "\"/\"" }, | ||
| peg$c63 = function() { return []; }, | ||
| peg$c64 = { type: "other", description: "_7LineEnd" }, | ||
| peg$c65 = function(attrs) { | ||
| // Filter out comments | ||
| // @NOTE This will not handle a comment as the first item because of the way the comment parser is structured | ||
| return attrs.filter(function(attr) { | ||
| return attr && attr.length > 0; | ||
| }); | ||
| }, | ||
| peg$c66 = function(attr) { | ||
| return attr; | ||
| }, | ||
| peg$c67 = "[", | ||
| peg$c68 = { type: "literal", value: "[", description: "\"[\"" }, | ||
| peg$c69 = "=", | ||
| peg$c70 = { type: "literal", value: "=", description: "\"=\"" }, | ||
| peg$c71 = function(key, value) { | ||
| return key + '=' + value; | ||
| }, | ||
| peg$c49 = null, | ||
| peg$c50 = function(attr) { return attr;}, | ||
| peg$c51 = function(attrs) { | ||
| peg$c72 = "(", | ||
| peg$c73 = { type: "literal", value: "(", description: "\"(\"" }, | ||
| peg$c74 = ")", | ||
| peg$c75 = { type: "literal", value: ")", description: "\")\"" }, | ||
| peg$c76 = function(helper, attrs) { | ||
| var firstHalf = '(' + helper; | ||
| if (attrs) | ||
| return firstHalf + ' ' + attrs.join(' ') + ')'; | ||
| else | ||
| return firstHalf + ')'; | ||
| }, | ||
| peg$c77 = function(attrs) { | ||
| return attrs; | ||
| }, | ||
| peg$c52 = "[", | ||
| peg$c53 = { type: "literal", value: "[", description: "\"[\"" }, | ||
| peg$c54 = { type: "other", description: "_54INDENT" }, | ||
| peg$c55 = { type: "any", description: "any character" }, | ||
| peg$c56 = function(t) { return preprocessor.INDENT_SYMBOL === t; }, | ||
| peg$c57 = function(t) { return ''; }, | ||
| peg$c58 = { type: "other", description: "_54DEDENT" }, | ||
| peg$c59 = function(t) { return preprocessor.DEDENT_SYMBOL === t; }, | ||
| peg$c60 = { type: "other", description: "_54LineEnd" }, | ||
| peg$c61 = "\r", | ||
| peg$c62 = { type: "literal", value: "\r", description: "\"\\r\"" }, | ||
| peg$c63 = function(t) { return preprocessor.TERM_SYMBOL == t; }, | ||
| peg$c64 = "\n", | ||
| peg$c65 = { type: "literal", value: "\n", description: "\"\\n\"" }, | ||
| peg$c66 = function(t) { return false; }, | ||
| peg$c78 = { type: "other", description: "_51INDENT" }, | ||
| peg$c79 = { type: "other", description: "_51DEDENT" }, | ||
| peg$c80 = { type: "other", description: "_51LineEnd" }, | ||
@@ -288,3 +316,3 @@ peg$currPos = 0, | ||
| function peg$parse_13nmchar() { | ||
| function peg$parse_0start() { | ||
| var s0; | ||
@@ -299,5 +327,2 @@ | ||
| } | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_13nonascii(); | ||
| } | ||
@@ -307,71 +332,16 @@ return s0; | ||
| function peg$parse_13nonascii() { | ||
| var s0; | ||
| function peg$parse_1start() { | ||
| var s0, s1; | ||
| if (peg$c2.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c3); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_31key() { | ||
| var s0, s1, s2; | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| s1 = []; | ||
| s2 = peg$parse_13nmchar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 58) { | ||
| s2 = peg$c6; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
| } | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 46) { | ||
| s2 = peg$c8; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| } | ||
| } | ||
| s0 = []; | ||
| s1 = peg$parse_0start(); | ||
| while (s1 !== peg$FAILED) { | ||
| s0.push(s1); | ||
| s1 = peg$parse_0start(); | ||
| } | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_13nmchar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 58) { | ||
| s2 = peg$c6; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
| } | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 46) { | ||
| s2 = peg$c8; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c4); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c2); } | ||
| } | ||
@@ -389,14 +359,14 @@ | ||
| if (input.charCodeAt(peg$currPos) === 123) { | ||
| s2 = peg$c12; | ||
| s2 = peg$c6; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c13); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
| } | ||
| peg$silentFails--; | ||
| if (s2 === peg$FAILED) { | ||
| s1 = peg$c11; | ||
| s1 = peg$c5; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| s1 = peg$c4; | ||
| } | ||
@@ -406,3 +376,3 @@ if (s1 !== peg$FAILED) { | ||
| s3 = []; | ||
| if (peg$c14.test(input.charAt(peg$currPos))) { | ||
| if (peg$c8.test(input.charAt(peg$currPos))) { | ||
| s4 = input.charAt(peg$currPos); | ||
@@ -412,7 +382,7 @@ peg$currPos++; | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| } | ||
| while (s4 !== peg$FAILED) { | ||
| s3.push(s4); | ||
| if (peg$c14.test(input.charAt(peg$currPos))) { | ||
| if (peg$c8.test(input.charAt(peg$currPos))) { | ||
| s4 = input.charAt(peg$currPos); | ||
@@ -422,3 +392,3 @@ peg$currPos++; | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| } | ||
@@ -432,11 +402,11 @@ } | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c16(s2); | ||
| s1 = peg$c10(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
@@ -450,3 +420,3 @@ | ||
| if (peg$c17.test(input.charAt(peg$currPos))) { | ||
| if (peg$c11.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
@@ -456,3 +426,3 @@ peg$currPos++; | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c18); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c12); } | ||
| } | ||
@@ -463,7 +433,7 @@ if (s0 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 46) { | ||
| s0 = peg$c8; | ||
| s0 = peg$c13; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c14); } | ||
| } | ||
@@ -480,8 +450,8 @@ } | ||
| s0 = peg$currPos; | ||
| if (input.substr(peg$currPos, 2) === peg$c19) { | ||
| s1 = peg$c19; | ||
| if (input.substr(peg$currPos, 2) === peg$c15) { | ||
| s1 = peg$c15; | ||
| peg$currPos += 2; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c16); } | ||
| } | ||
@@ -497,7 +467,7 @@ if (s1 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 93) { | ||
| s3 = peg$c21; | ||
| s3 = peg$c17; | ||
| peg$currPos++; | ||
| } else { | ||
| s3 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c22); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c18); } | ||
| } | ||
@@ -509,11 +479,11 @@ if (s3 !== peg$FAILED) { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
@@ -524,35 +494,2 @@ | ||
| function peg$parse_0start() { | ||
| var s0; | ||
| if (peg$c23.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_1start() { | ||
| var s0, s1; | ||
| peg$silentFails++; | ||
| s0 = []; | ||
| s1 = peg$parse_0start(); | ||
| while (s1 !== peg$FAILED) { | ||
| s0.push(s1); | ||
| s1 = peg$parse_0start(); | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c25); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_43blockStart() { | ||
@@ -562,8 +499,8 @@ var s0, s1, s2, s3; | ||
| s0 = peg$currPos; | ||
| if (input.substr(peg$currPos, 2) === peg$c26) { | ||
| s1 = peg$c26; | ||
| if (input.substr(peg$currPos, 2) === peg$c19) { | ||
| s1 = peg$c19; | ||
| peg$currPos += 2; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c27); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
| } | ||
@@ -574,7 +511,7 @@ if (s1 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 124) { | ||
| s3 = peg$c28; | ||
| s3 = peg$c21; | ||
| peg$currPos++; | ||
| } else { | ||
| s3 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c29); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c22); } | ||
| } | ||
@@ -586,11 +523,11 @@ if (s3 !== peg$FAILED) { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
@@ -607,7 +544,7 @@ | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s2 = peg$c30; | ||
| s2 = peg$c23; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
| } | ||
@@ -618,7 +555,7 @@ if (s2 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s4 = peg$c30; | ||
| s4 = peg$c23; | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
| } | ||
@@ -630,11 +567,11 @@ if (s4 !== peg$FAILED) { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| s1 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| s1 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| s1 = peg$c4; | ||
| } | ||
@@ -649,7 +586,7 @@ if (s1 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s2 = peg$c32; | ||
| s2 = peg$c25; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
| } | ||
@@ -660,7 +597,7 @@ if (s2 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s4 = peg$c32; | ||
| s4 = peg$c25; | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
| } | ||
@@ -672,11 +609,11 @@ if (s4 !== peg$FAILED) { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| s1 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| s1 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| s1 = peg$c4; | ||
| } | ||
@@ -700,7 +637,7 @@ if (s1 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s2 = peg$c32; | ||
| s2 = peg$c25; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
| } | ||
@@ -713,7 +650,7 @@ } | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s2 = peg$c32; | ||
| s2 = peg$c25; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
| } | ||
@@ -738,7 +675,7 @@ } | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s2 = peg$c30; | ||
| s2 = peg$c23; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
| } | ||
@@ -751,7 +688,7 @@ } | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s2 = peg$c30; | ||
| s2 = peg$c23; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
| } | ||
@@ -771,3 +708,3 @@ } | ||
| if (peg$c34.test(input.charAt(peg$currPos))) { | ||
| if (peg$c27.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
@@ -777,3 +714,3 @@ peg$currPos++; | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c28); } | ||
| } | ||
@@ -784,45 +721,24 @@ | ||
| function peg$parse_45subexpression() { | ||
| var s0, s1, s2, s3, s4, s5, s6; | ||
| function peg$parse_45newMustacheAttrValue() { | ||
| var s0, s1, s2, s3; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_1start(); | ||
| s1 = peg$currPos; | ||
| peg$silentFails++; | ||
| s2 = peg$parse_45invalidValueStartChar(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_43blockStart(); | ||
| } | ||
| peg$silentFails--; | ||
| if (s2 === peg$FAILED) { | ||
| s1 = peg$c5; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c4; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$currPos; | ||
| s3 = peg$currPos; | ||
| s4 = peg$parse_45OPEN_PAREN(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = []; | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| while (s6 !== peg$FAILED) { | ||
| s5.push(s6); | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| } | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = peg$parse_45CLOSE_PAREN(); | ||
| if (s6 !== peg$FAILED) { | ||
| s4 = [s4, s5, s6]; | ||
| s3 = s4; | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| s2 = peg$parse_44quotedString(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_45valuePath(); | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s3 = input.substring(s2, peg$currPos); | ||
| } | ||
| s2 = s3; | ||
| if (s2 !== peg$FAILED) { | ||
@@ -832,15 +748,15 @@ s3 = peg$parse_1start(); | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c36(s2); | ||
| s1 = peg$c29(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
@@ -851,6 +767,28 @@ | ||
| function peg$parse_45inParensChar() { | ||
| function peg$parse_45valuePath() { | ||
| var s0, s1, s2; | ||
| s0 = peg$currPos; | ||
| s1 = []; | ||
| s2 = peg$parse_42newMustacheNameChar(); | ||
| if (s2 !== peg$FAILED) { | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_42newMustacheNameChar(); | ||
| } | ||
| } else { | ||
| s1 = peg$c4; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| return s0; | ||
| } | ||
| function peg$parse_45invalidValueStartChar() { | ||
| var s0; | ||
| if (peg$c37.test(input.charAt(peg$currPos))) { | ||
| if (peg$c30.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
@@ -860,3 +798,3 @@ peg$currPos++; | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
@@ -867,12 +805,15 @@ | ||
| function peg$parse_45OPEN_PAREN() { | ||
| function peg$parse_13nmchar() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 40) { | ||
| s0 = peg$c39; | ||
| if (peg$c32.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| } | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_13nonascii(); | ||
| } | ||
@@ -882,11 +823,11 @@ return s0; | ||
| function peg$parse_45CLOSE_PAREN() { | ||
| function peg$parse_13nonascii() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 41) { | ||
| s0 = peg$c41; | ||
| if (peg$c34.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
| } | ||
@@ -897,45 +838,116 @@ | ||
| function peg$parse_46newMustacheAttrValue() { | ||
| var s0, s1, s2, s3; | ||
| function peg$parse_31key() { | ||
| var s0, s1, s2; | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| s1 = peg$currPos; | ||
| peg$silentFails++; | ||
| s2 = peg$parse_46invalidValueStartChar(); | ||
| s1 = []; | ||
| s2 = peg$parse_13nmchar(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_43blockStart(); | ||
| if (input.charCodeAt(peg$currPos) === 58) { | ||
| s2 = peg$c37; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
| } | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 46) { | ||
| s2 = peg$c13; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c14); } | ||
| } | ||
| } | ||
| } | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_13nmchar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 58) { | ||
| s2 = peg$c37; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
| } | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 46) { | ||
| s2 = peg$c13; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c14); } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| peg$silentFails--; | ||
| if (s2 === peg$FAILED) { | ||
| s1 = peg$c11; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c36); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_3anyDedent() { | ||
| var s0, s1; | ||
| peg$silentFails++; | ||
| s0 = peg$parse_3DEDENT(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_3UNMATCHED_DEDENT(); | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_3DEDENT() { | ||
| var s0, s1, s2; | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| if (input.length > peg$currPos) { | ||
| s1 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_44quotedString(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_46valuePath(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_45subexpression(); | ||
| } | ||
| peg$reportedPos = peg$currPos; | ||
| s2 = peg$c42(s1); | ||
| if (s2) { | ||
| s2 = peg$c5; | ||
| } else { | ||
| s2 = peg$c4; | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_1start(); | ||
| if (s3 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c43(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c43(s1); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
| } | ||
@@ -945,15 +957,57 @@ return s0; | ||
| function peg$parse_46valuePath() { | ||
| function peg$parse_3UNMATCHED_DEDENT() { | ||
| var s0, s1, s2; | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| if (input.length > peg$currPos) { | ||
| s1 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| peg$reportedPos = peg$currPos; | ||
| s2 = peg$c45(s1); | ||
| if (s2) { | ||
| s2 = peg$c5; | ||
| } else { | ||
| s2 = peg$c4; | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c43(s1); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c44); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_4start() { | ||
| var s0, s1, s2; | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| s1 = []; | ||
| s2 = peg$parse_42newMustacheNameChar(); | ||
| s2 = peg$parse_0start(); | ||
| if (s2 !== peg$FAILED) { | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_42newMustacheNameChar(); | ||
| s2 = peg$parse_0start(); | ||
| } | ||
| } else { | ||
| s1 = peg$c10; | ||
| s1 = peg$c4; | ||
| } | ||
@@ -964,2 +1018,7 @@ if (s1 !== peg$FAILED) { | ||
| s0 = s1; | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c46); } | ||
| } | ||
@@ -969,12 +1028,62 @@ return s0; | ||
| function peg$parse_46invalidValueStartChar() { | ||
| var s0; | ||
| function peg$parse_5indentation() { | ||
| var s0, s1, s2; | ||
| if (input.charCodeAt(peg$currPos) === 47) { | ||
| s0 = peg$c44; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_5INDENT(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_4start(); | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c47(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_5INDENT() { | ||
| var s0, s1, s2; | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| if (input.length > peg$currPos) { | ||
| s1 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| peg$reportedPos = peg$currPos; | ||
| s2 = peg$c49(s1); | ||
| if (s2) { | ||
| s2 = peg$c5; | ||
| } else { | ||
| s2 = peg$c4; | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c43(s1); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c48); } | ||
| } | ||
@@ -984,44 +1093,330 @@ return s0; | ||
| function peg$parse_52simpleMustacheAttr() { | ||
| var s0, s1, s2, s3, s4, s5; | ||
| function peg$parse_6lineContent() { | ||
| var s0, s1, s2; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_31key(); | ||
| s1 = []; | ||
| s2 = peg$parse_6lineChar(); | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_6lineChar(); | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_1start(); | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| return s0; | ||
| } | ||
| function peg$parse_6lineChar() { | ||
| var s0, s1, s2; | ||
| s0 = peg$currPos; | ||
| s1 = peg$currPos; | ||
| peg$silentFails++; | ||
| s2 = peg$parse_6INDENT(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_6DEDENT(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_6TERM(); | ||
| } | ||
| } | ||
| peg$silentFails--; | ||
| if (s2 === peg$FAILED) { | ||
| s1 = peg$c5; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c4; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| if (input.length > peg$currPos) { | ||
| s2 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 61) { | ||
| s3 = peg$c46; | ||
| peg$currPos++; | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c50(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_6INDENT() { | ||
| var s0, s1, s2; | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| if (input.length > peg$currPos) { | ||
| s1 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| peg$reportedPos = peg$currPos; | ||
| s2 = peg$c49(s1); | ||
| if (s2) { | ||
| s2 = peg$c5; | ||
| } else { | ||
| s2 = peg$c4; | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c43(s1); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c51); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_6DEDENT() { | ||
| var s0, s1, s2; | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| if (input.length > peg$currPos) { | ||
| s1 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| peg$reportedPos = peg$currPos; | ||
| s2 = peg$c42(s1); | ||
| if (s2) { | ||
| s2 = peg$c5; | ||
| } else { | ||
| s2 = peg$c4; | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c43(s1); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c52); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_6TERM() { | ||
| var s0, s1, s2, s3, s4; | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| if (input.charCodeAt(peg$currPos) === 13) { | ||
| s1 = peg$c55; | ||
| peg$currPos++; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c56); } | ||
| } | ||
| if (s1 === peg$FAILED) { | ||
| s1 = peg$c54; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| if (input.length > peg$currPos) { | ||
| s2 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = peg$currPos; | ||
| s3 = peg$c57(s2); | ||
| if (s3) { | ||
| s3 = peg$c5; | ||
| } else { | ||
| s3 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
| s3 = peg$c4; | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s4 = peg$parse_1start(); | ||
| if (input.charCodeAt(peg$currPos) === 10) { | ||
| s4 = peg$c58; | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c59); } | ||
| } | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = peg$parse_46newMustacheAttrValue(); | ||
| if (s5 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c48(s1, s5); | ||
| s0 = s1; | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c60(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c53); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_7comment() { | ||
| var s0, s1, s2; | ||
| s0 = peg$currPos; | ||
| if (input.charCodeAt(peg$currPos) === 47) { | ||
| s1 = peg$c61; | ||
| peg$currPos++; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c62); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_7commentContent(); | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c63(); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_7commentContent() { | ||
| var s0, s1, s2, s3, s4, s5, s6, s7; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_6lineContent(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_7TERM(); | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = []; | ||
| s4 = peg$currPos; | ||
| s5 = peg$parse_5indentation(); | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = []; | ||
| s7 = peg$parse_7commentContent(); | ||
| if (s7 !== peg$FAILED) { | ||
| while (s7 !== peg$FAILED) { | ||
| s6.push(s7); | ||
| s7 = peg$parse_7commentContent(); | ||
| } | ||
| } else { | ||
| s6 = peg$c4; | ||
| } | ||
| if (s6 !== peg$FAILED) { | ||
| s7 = peg$parse_3anyDedent(); | ||
| if (s7 !== peg$FAILED) { | ||
| s5 = [s5, s6, s7]; | ||
| s4 = s5; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| peg$currPos = s4; | ||
| s4 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| peg$currPos = s4; | ||
| s4 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s4; | ||
| s4 = peg$c4; | ||
| } | ||
| while (s4 !== peg$FAILED) { | ||
| s3.push(s4); | ||
| s4 = peg$currPos; | ||
| s5 = peg$parse_5indentation(); | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = []; | ||
| s7 = peg$parse_7commentContent(); | ||
| if (s7 !== peg$FAILED) { | ||
| while (s7 !== peg$FAILED) { | ||
| s6.push(s7); | ||
| s7 = peg$parse_7commentContent(); | ||
| } | ||
| } else { | ||
| s6 = peg$c4; | ||
| } | ||
| if (s6 !== peg$FAILED) { | ||
| s7 = peg$parse_3anyDedent(); | ||
| if (s7 !== peg$FAILED) { | ||
| s5 = [s5, s6, s7]; | ||
| s4 = s5; | ||
| } else { | ||
| peg$currPos = s4; | ||
| s4 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s4; | ||
| s4 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s4; | ||
| s4 = peg$c4; | ||
| } | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c63(); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
@@ -1032,12 +1427,66 @@ | ||
| function peg$parse_53mustacheAttr() { | ||
| var s0; | ||
| function peg$parse_7TERM() { | ||
| var s0, s1, s2, s3, s4; | ||
| s0 = peg$parse_52simpleMustacheAttr(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_45subexpression(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_46newMustacheAttrValue(); | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| if (input.charCodeAt(peg$currPos) === 13) { | ||
| s1 = peg$c55; | ||
| peg$currPos++; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c56); } | ||
| } | ||
| if (s1 === peg$FAILED) { | ||
| s1 = peg$c54; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| if (input.length > peg$currPos) { | ||
| s2 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = peg$currPos; | ||
| s3 = peg$c57(s2); | ||
| if (s3) { | ||
| s3 = peg$c5; | ||
| } else { | ||
| s3 = peg$c4; | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 10) { | ||
| s4 = peg$c58; | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c59); } | ||
| } | ||
| if (s4 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c60(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c64); } | ||
| } | ||
@@ -1047,6 +1496,6 @@ return s0; | ||
| function peg$parse_54start() { | ||
| function peg$parse_51start() { | ||
| var s0; | ||
| s0 = peg$parse_54mustacheAttrs(); | ||
| s0 = peg$parse_51mustacheAttrs(); | ||
@@ -1056,12 +1505,12 @@ return s0; | ||
| function peg$parse_54mustacheAttrs() { | ||
| function peg$parse_51mustacheAttrs() { | ||
| var s0, s1; | ||
| s0 = peg$parse_54bracketedAttrs(); | ||
| s0 = peg$parse_51bracketedAttrs(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = []; | ||
| s1 = peg$parse_53mustacheAttr(); | ||
| s1 = peg$parse_51mustacheAttr(); | ||
| while (s1 !== peg$FAILED) { | ||
| s0.push(s1); | ||
| s1 = peg$parse_53mustacheAttr(); | ||
| s1 = peg$parse_51mustacheAttr(); | ||
| } | ||
@@ -1073,60 +1522,18 @@ } | ||
| function peg$parse_54bracketedAttrs() { | ||
| var s0, s1, s2, s3, s4, s5, s6; | ||
| function peg$parse_51bracketedAttrs() { | ||
| var s0, s1, s2, s3, s4; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_54openBracket(); | ||
| s1 = peg$parse_51openBracket(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = []; | ||
| s3 = peg$currPos; | ||
| s4 = peg$parse_1start(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = peg$parse_53mustacheAttr(); | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = peg$parse_54TERM(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$c49; | ||
| } | ||
| if (s6 !== peg$FAILED) { | ||
| peg$reportedPos = s3; | ||
| s4 = peg$c50(s5); | ||
| s3 = s4; | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| s3 = peg$parse_51bracketedAttr(); | ||
| if (s3 === peg$FAILED) { | ||
| s3 = peg$parse_7comment(); | ||
| } | ||
| while (s3 !== peg$FAILED) { | ||
| s2.push(s3); | ||
| s3 = peg$currPos; | ||
| s4 = peg$parse_1start(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = peg$parse_53mustacheAttr(); | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = peg$parse_54TERM(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$c49; | ||
| } | ||
| if (s6 !== peg$FAILED) { | ||
| peg$reportedPos = s3; | ||
| s4 = peg$c50(s5); | ||
| s3 = s4; | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| s3 = peg$parse_51bracketedAttr(); | ||
| if (s3 === peg$FAILED) { | ||
| s3 = peg$parse_7comment(); | ||
| } | ||
@@ -1137,25 +1544,25 @@ } | ||
| peg$silentFails++; | ||
| s4 = peg$parse_54closeBracket(); | ||
| s4 = peg$parse_51closeBracket(); | ||
| peg$silentFails--; | ||
| if (s4 !== peg$FAILED) { | ||
| peg$currPos = s3; | ||
| s3 = peg$c11; | ||
| s3 = peg$c5; | ||
| } else { | ||
| s3 = peg$c10; | ||
| s3 = peg$c4; | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c51(s2); | ||
| s1 = peg$c65(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
@@ -1166,17 +1573,49 @@ | ||
| function peg$parse_54openBracket() { | ||
| function peg$parse_51bracketedAttr() { | ||
| var s0, s1, s2, s3; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_1start(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_51mustacheAttr(); | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_51TERM(); | ||
| if (s3 === peg$FAILED) { | ||
| s3 = peg$c54; | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c66(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_51openBracket() { | ||
| var s0, s1, s2, s3; | ||
| s0 = peg$currPos; | ||
| if (input.charCodeAt(peg$currPos) === 91) { | ||
| s1 = peg$c52; | ||
| s1 = peg$c67; | ||
| peg$currPos++; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c53); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c68); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_54TERM(); | ||
| s2 = peg$parse_51TERM(); | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_54INDENT(); | ||
| s3 = peg$parse_51INDENT(); | ||
| if (s3 !== peg$FAILED) { | ||
@@ -1187,11 +1626,11 @@ s1 = [s1, s2, s3]; | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
@@ -1202,9 +1641,9 @@ | ||
| function peg$parse_54closeBracket() { | ||
| function peg$parse_51closeBracket() { | ||
| var s0, s1, s2, s3; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_54DEDENT(); | ||
| s1 = peg$parse_51DEDENT(); | ||
| if (s1 === peg$FAILED) { | ||
| s1 = peg$c49; | ||
| s1 = peg$c54; | ||
| } | ||
@@ -1215,7 +1654,7 @@ if (s1 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 93) { | ||
| s3 = peg$c21; | ||
| s3 = peg$c17; | ||
| peg$currPos++; | ||
| } else { | ||
| s3 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c22); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c18); } | ||
| } | ||
@@ -1227,11 +1666,11 @@ if (s3 !== peg$FAILED) { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
@@ -1242,5 +1681,198 @@ | ||
| function peg$parse_54INDENT() { | ||
| function peg$parse_51mustacheAttr() { | ||
| var s0; | ||
| s0 = peg$parse_51mustacheKeyValue(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_51subexpression(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_45newMustacheAttrValue(); | ||
| } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_51mustacheKeyValue() { | ||
| var s0, s1, s2, s3, s4, s5; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_31key(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_1start(); | ||
| if (s2 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 61) { | ||
| s3 = peg$c69; | ||
| peg$currPos++; | ||
| } else { | ||
| s3 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c70); } | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s4 = peg$parse_1start(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = peg$parse_51subexpression(); | ||
| if (s5 === peg$FAILED) { | ||
| s5 = peg$parse_45newMustacheAttrValue(); | ||
| } | ||
| if (s5 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c71(s1, s5); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_51subexpression() { | ||
| var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_1start(); | ||
| if (s1 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 40) { | ||
| s2 = peg$c72; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c73); } | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_1start(); | ||
| if (s3 !== peg$FAILED) { | ||
| s4 = peg$parse_45newMustacheAttrValue(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = peg$parse_1start(); | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = peg$parse_51subexpressionBracketAttrs(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = []; | ||
| s7 = peg$parse_51subexpressionAttrs(); | ||
| if (s7 !== peg$FAILED) { | ||
| while (s7 !== peg$FAILED) { | ||
| s6.push(s7); | ||
| s7 = peg$parse_51subexpressionAttrs(); | ||
| } | ||
| } else { | ||
| s6 = peg$c4; | ||
| } | ||
| } | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$c54; | ||
| } | ||
| if (s6 !== peg$FAILED) { | ||
| s7 = peg$parse_1start(); | ||
| if (s7 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 41) { | ||
| s8 = peg$c74; | ||
| peg$currPos++; | ||
| } else { | ||
| s8 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c75); } | ||
| } | ||
| if (s8 !== peg$FAILED) { | ||
| s9 = peg$parse_1start(); | ||
| if (s9 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c76(s4, s6); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_51subexpressionBracketAttrs() { | ||
| var s0, s1, s2; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_51bracketedAttrs(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_51closeBracket(); | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c77(s1); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_51subexpressionAttrs() { | ||
| var s0; | ||
| s0 = peg$parse_51mustacheKeyValue(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_51subexpression(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_45newMustacheAttrValue(); | ||
| } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_51INDENT() { | ||
| var s0, s1, s2; | ||
| peg$silentFails++; | ||
@@ -1253,23 +1885,23 @@ s0 = peg$currPos; | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c55); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| peg$reportedPos = peg$currPos; | ||
| s2 = peg$c56(s1); | ||
| s2 = peg$c49(s1); | ||
| if (s2) { | ||
| s2 = peg$c11; | ||
| s2 = peg$c5; | ||
| } else { | ||
| s2 = peg$c10; | ||
| s2 = peg$c4; | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c57(s1); | ||
| s1 = peg$c43(s1); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
@@ -1279,3 +1911,3 @@ peg$silentFails--; | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c78); } | ||
| } | ||
@@ -1286,3 +1918,3 @@ | ||
| function peg$parse_54DEDENT() { | ||
| function peg$parse_51DEDENT() { | ||
| var s0, s1, s2; | ||
@@ -1297,23 +1929,23 @@ | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c55); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| peg$reportedPos = peg$currPos; | ||
| s2 = peg$c59(s1); | ||
| s2 = peg$c42(s1); | ||
| if (s2) { | ||
| s2 = peg$c11; | ||
| s2 = peg$c5; | ||
| } else { | ||
| s2 = peg$c10; | ||
| s2 = peg$c4; | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c57(s1); | ||
| s1 = peg$c43(s1); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
@@ -1323,3 +1955,3 @@ peg$silentFails--; | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c58); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c79); } | ||
| } | ||
@@ -1330,3 +1962,3 @@ | ||
| function peg$parse_54TERM() { | ||
| function peg$parse_51TERM() { | ||
| var s0, s1, s2, s3, s4; | ||
@@ -1337,10 +1969,10 @@ | ||
| if (input.charCodeAt(peg$currPos) === 13) { | ||
| s1 = peg$c61; | ||
| s1 = peg$c55; | ||
| peg$currPos++; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c62); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c56); } | ||
| } | ||
| if (s1 === peg$FAILED) { | ||
| s1 = peg$c49; | ||
| s1 = peg$c54; | ||
| } | ||
@@ -1353,39 +1985,39 @@ if (s1 !== peg$FAILED) { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c55); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = peg$currPos; | ||
| s3 = peg$c63(s2); | ||
| s3 = peg$c57(s2); | ||
| if (s3) { | ||
| s3 = peg$c11; | ||
| s3 = peg$c5; | ||
| } else { | ||
| s3 = peg$c10; | ||
| s3 = peg$c4; | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 10) { | ||
| s4 = peg$c64; | ||
| s4 = peg$c58; | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c65); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c59); } | ||
| } | ||
| if (s4 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c66(s2); | ||
| s1 = peg$c60(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| s0 = peg$c4; | ||
| } | ||
@@ -1395,3 +2027,3 @@ peg$silentFails--; | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c60); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c80); } | ||
| } | ||
@@ -1508,3 +2140,2 @@ | ||
| function parseInHtml(h, inTagMustaches, fullAttributes, blockParams) { | ||
@@ -1580,4 +2211,2 @@ var tagName = h[0] || 'div', | ||
| peg$result = peg$startRuleFunction(); | ||
@@ -1584,0 +2213,0 @@ |
@@ -40,4 +40,4 @@ 'use strict'; | ||
| peg$startRuleFunctions = { _46start: peg$parse_46start }, | ||
| peg$startRuleFunction = peg$parse_46start, | ||
| peg$startRuleFunctions = { _45start: peg$parse_45start }, | ||
| peg$startRuleFunction = peg$parse_45start, | ||
@@ -75,16 +75,7 @@ peg$c0 = peg$FAILED, | ||
| peg$c28 = { type: "class", value: "[^'\"]", description: "[^'\"]" }, | ||
| peg$c29 = function(p) { | ||
| return p; | ||
| }, | ||
| peg$c30 = /^[^()]/, | ||
| peg$c31 = { type: "class", value: "[^()]", description: "[^()]" }, | ||
| peg$c32 = "(", | ||
| peg$c33 = { type: "literal", value: "(", description: "\"(\"" }, | ||
| peg$c34 = ")", | ||
| peg$c35 = { type: "literal", value: ")", description: "\")\"" }, | ||
| peg$c36 = function(v) { | ||
| peg$c29 = function(v) { | ||
| return v; | ||
| }, | ||
| peg$c37 = "/", | ||
| peg$c38 = { type: "literal", value: "/", description: "\"/\"" }, | ||
| peg$c30 = /^[\/(]/, | ||
| peg$c31 = { type: "class", value: "[\\/(]", description: "[\\/(]" }, | ||
@@ -632,77 +623,6 @@ peg$currPos = 0, | ||
| function peg$parse_45subexpression() { | ||
| var s0, s1, s2, s3, s4, s5, s6; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_1start(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$currPos; | ||
| s3 = peg$currPos; | ||
| s4 = peg$parse_45OPEN_PAREN(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = []; | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| while (s6 !== peg$FAILED) { | ||
| s5.push(s6); | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| } | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = peg$parse_45CLOSE_PAREN(); | ||
| if (s6 !== peg$FAILED) { | ||
| s4 = [s4, s5, s6]; | ||
| s3 = s4; | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c0; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c0; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c0; | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s3 = input.substring(s2, peg$currPos); | ||
| } | ||
| s2 = s3; | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_1start(); | ||
| if (s3 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c29(s2); | ||
| 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$parse_45inParensChar() { | ||
| function peg$parse_45start() { | ||
| var s0; | ||
| if (peg$c30.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
| s0 = peg$parse_45newMustacheAttrValue(); | ||
@@ -712,39 +632,3 @@ return s0; | ||
| function peg$parse_45OPEN_PAREN() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 40) { | ||
| s0 = peg$c32; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45CLOSE_PAREN() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 41) { | ||
| s0 = peg$c34; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_46start() { | ||
| var s0; | ||
| s0 = peg$parse_46newMustacheAttrValue(); | ||
| return s0; | ||
| } | ||
| function peg$parse_46newMustacheAttrValue() { | ||
| function peg$parse_45newMustacheAttrValue() { | ||
| var s0, s1, s2, s3; | ||
@@ -755,3 +639,3 @@ | ||
| peg$silentFails++; | ||
| s2 = peg$parse_46invalidValueStartChar(); | ||
| s2 = peg$parse_45invalidValueStartChar(); | ||
| if (s2 === peg$FAILED) { | ||
@@ -770,6 +654,3 @@ s2 = peg$parse_43blockStart(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_46valuePath(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_45subexpression(); | ||
| } | ||
| s2 = peg$parse_45valuePath(); | ||
| } | ||
@@ -780,3 +661,3 @@ if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c36(s2); | ||
| s1 = peg$c29(s2); | ||
| s0 = s1; | ||
@@ -799,3 +680,3 @@ } else { | ||
| function peg$parse_46valuePath() { | ||
| function peg$parse_45valuePath() { | ||
| var s0, s1, s2; | ||
@@ -822,11 +703,11 @@ | ||
| function peg$parse_46invalidValueStartChar() { | ||
| function peg$parse_45invalidValueStartChar() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 47) { | ||
| s0 = peg$c37; | ||
| if (peg$c30.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
@@ -940,3 +821,2 @@ | ||
| peg$result = peg$startRuleFunction(); | ||
@@ -943,0 +823,0 @@ |
@@ -40,4 +40,4 @@ 'use strict'; | ||
| peg$startRuleFunctions = { _47start: peg$parse_47start }, | ||
| peg$startRuleFunction = peg$parse_47start, | ||
| peg$startRuleFunctions = { _46start: peg$parse_46start }, | ||
| peg$startRuleFunction = peg$parse_46start, | ||
@@ -213,6 +213,6 @@ peg$c0 = "|", | ||
| function peg$parse_47start() { | ||
| function peg$parse_46start() { | ||
| var s0; | ||
| s0 = peg$parse_47blockEnd(); | ||
| s0 = peg$parse_46blockEnd(); | ||
@@ -222,3 +222,3 @@ return s0; | ||
| function peg$parse_47blockEnd() { | ||
| function peg$parse_46blockEnd() { | ||
| var s0; | ||
@@ -341,3 +341,2 @@ | ||
| peg$result = peg$startRuleFunction(); | ||
@@ -344,0 +343,0 @@ |
@@ -40,4 +40,4 @@ 'use strict'; | ||
| peg$startRuleFunctions = { _48start: peg$parse_48start }, | ||
| peg$startRuleFunction = peg$parse_48start, | ||
| peg$startRuleFunctions = { _47start: peg$parse_47start }, | ||
| peg$startRuleFunction = peg$parse_47start, | ||
@@ -75,17 +75,8 @@ peg$c0 = peg$FAILED, | ||
| peg$c28 = { type: "class", value: "[^'\"]", description: "[^'\"]" }, | ||
| peg$c29 = function(p) { | ||
| return p; | ||
| }, | ||
| peg$c30 = /^[^()]/, | ||
| peg$c31 = { type: "class", value: "[^()]", description: "[^()]" }, | ||
| peg$c32 = "(", | ||
| peg$c33 = { type: "literal", value: "(", description: "\"(\"" }, | ||
| peg$c34 = ")", | ||
| peg$c35 = { type: "literal", value: ")", description: "\")\"" }, | ||
| peg$c36 = function(v) { | ||
| peg$c29 = function(v) { | ||
| return v; | ||
| }, | ||
| peg$c37 = "/", | ||
| peg$c38 = { type: "literal", value: "/", description: "\"/\"" }, | ||
| peg$c39 = function(params) { | ||
| peg$c30 = /^[\/(]/, | ||
| peg$c31 = { type: "class", value: "[\\/(]", description: "[\\/(]" }, | ||
| peg$c32 = function(params) { | ||
| return params; | ||
@@ -635,110 +626,3 @@ }, | ||
| function peg$parse_45subexpression() { | ||
| var s0, s1, s2, s3, s4, s5, s6; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_1start(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$currPos; | ||
| s3 = peg$currPos; | ||
| s4 = peg$parse_45OPEN_PAREN(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = []; | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| while (s6 !== peg$FAILED) { | ||
| s5.push(s6); | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| } | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = peg$parse_45CLOSE_PAREN(); | ||
| if (s6 !== peg$FAILED) { | ||
| s4 = [s4, s5, s6]; | ||
| s3 = s4; | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c0; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c0; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c0; | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s3 = input.substring(s2, peg$currPos); | ||
| } | ||
| s2 = s3; | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_1start(); | ||
| if (s3 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c29(s2); | ||
| 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$parse_45inParensChar() { | ||
| var s0; | ||
| if (peg$c30.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45OPEN_PAREN() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 40) { | ||
| s0 = peg$c32; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45CLOSE_PAREN() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 41) { | ||
| s0 = peg$c34; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_46newMustacheAttrValue() { | ||
| function peg$parse_45newMustacheAttrValue() { | ||
| var s0, s1, s2, s3; | ||
@@ -749,3 +633,3 @@ | ||
| peg$silentFails++; | ||
| s2 = peg$parse_46invalidValueStartChar(); | ||
| s2 = peg$parse_45invalidValueStartChar(); | ||
| if (s2 === peg$FAILED) { | ||
@@ -764,6 +648,3 @@ s2 = peg$parse_43blockStart(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_46valuePath(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_45subexpression(); | ||
| } | ||
| s2 = peg$parse_45valuePath(); | ||
| } | ||
@@ -774,3 +655,3 @@ if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c36(s2); | ||
| s1 = peg$c29(s2); | ||
| s0 = s1; | ||
@@ -793,3 +674,3 @@ } else { | ||
| function peg$parse_46valuePath() { | ||
| function peg$parse_45valuePath() { | ||
| var s0, s1, s2; | ||
@@ -816,11 +697,11 @@ | ||
| function peg$parse_46invalidValueStartChar() { | ||
| function peg$parse_45invalidValueStartChar() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 47) { | ||
| s0 = peg$c37; | ||
| if (peg$c30.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
@@ -831,3 +712,3 @@ | ||
| function peg$parse_47blockEnd() { | ||
| function peg$parse_46blockEnd() { | ||
| var s0; | ||
@@ -846,6 +727,6 @@ | ||
| function peg$parse_48start() { | ||
| function peg$parse_47start() { | ||
| var s0; | ||
| s0 = peg$parse_48blockParams(); | ||
| s0 = peg$parse_47blockParams(); | ||
@@ -855,3 +736,3 @@ return s0; | ||
| function peg$parse_48blockParams() { | ||
| function peg$parse_47blockParams() { | ||
| var s0, s1, s2, s3, s4; | ||
@@ -865,7 +746,7 @@ | ||
| s3 = []; | ||
| s4 = peg$parse_46newMustacheAttrValue(); | ||
| s4 = peg$parse_45newMustacheAttrValue(); | ||
| if (s4 !== peg$FAILED) { | ||
| while (s4 !== peg$FAILED) { | ||
| s3.push(s4); | ||
| s4 = peg$parse_46newMustacheAttrValue(); | ||
| s4 = peg$parse_45newMustacheAttrValue(); | ||
| } | ||
@@ -876,6 +757,6 @@ } else { | ||
| if (s3 !== peg$FAILED) { | ||
| s4 = peg$parse_47blockEnd(); | ||
| s4 = peg$parse_46blockEnd(); | ||
| if (s4 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c39(s3); | ||
| s1 = peg$c32(s3); | ||
| s0 = s1; | ||
@@ -1007,3 +888,2 @@ } else { | ||
| peg$result = peg$startRuleFunction(); | ||
@@ -1010,0 +890,0 @@ |
@@ -40,4 +40,4 @@ 'use strict'; | ||
| peg$startRuleFunctions = { _56start: peg$parse_56start }, | ||
| peg$startRuleFunction = peg$parse_56start, | ||
| peg$startRuleFunctions = { _53start: peg$parse_53start }, | ||
| peg$startRuleFunction = peg$parse_53start, | ||
@@ -215,6 +215,6 @@ peg$c0 = "!", | ||
| function peg$parse_56start() { | ||
| function peg$parse_53start() { | ||
| var s0; | ||
| s0 = peg$parse_56modifierChar(); | ||
| s0 = peg$parse_53modifierChar(); | ||
@@ -224,3 +224,3 @@ return s0; | ||
| function peg$parse_56modifierChar() { | ||
| function peg$parse_53modifierChar() { | ||
| var s0; | ||
@@ -354,3 +354,2 @@ | ||
| function parseInHtml(h, inTagMustaches, fullAttributes, blockParams) { | ||
@@ -428,4 +427,2 @@ var tagName = h[0] || 'div', | ||
| peg$result = peg$startRuleFunction(); | ||
@@ -432,0 +429,0 @@ |
@@ -40,4 +40,4 @@ 'use strict'; | ||
| peg$startRuleFunctions = { _55start: peg$parse_55start }, | ||
| peg$startRuleFunction = peg$parse_55start, | ||
| peg$startRuleFunctions = { _52start: peg$parse_52start }, | ||
| peg$startRuleFunction = peg$parse_52start, | ||
@@ -230,6 +230,6 @@ peg$c0 = peg$FAILED, | ||
| function peg$parse_55start() { | ||
| function peg$parse_52start() { | ||
| var s0; | ||
| s0 = peg$parse_55newMustacheShortHand(); | ||
| s0 = peg$parse_52newMustacheShortHand(); | ||
@@ -239,10 +239,10 @@ return s0; | ||
| function peg$parse_55newMustacheShortHand() { | ||
| function peg$parse_52newMustacheShortHand() { | ||
| var s0; | ||
| s0 = peg$parse_55shortHandTagName(); | ||
| s0 = peg$parse_52shortHandTagName(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_55shortHandIdName(); | ||
| s0 = peg$parse_52shortHandIdName(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_55shortHandClassName(); | ||
| s0 = peg$parse_52shortHandClassName(); | ||
| } | ||
@@ -254,3 +254,3 @@ } | ||
| function peg$parse_55shortHandTagName() { | ||
| function peg$parse_52shortHandTagName() { | ||
| var s0, s1, s2; | ||
@@ -267,3 +267,3 @@ | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_55newMustacheShortHandName(); | ||
| s2 = peg$parse_52newMustacheShortHandName(); | ||
| if (s2 !== peg$FAILED) { | ||
@@ -285,3 +285,3 @@ peg$reportedPos = s0; | ||
| function peg$parse_55shortHandIdName() { | ||
| function peg$parse_52shortHandIdName() { | ||
| var s0, s1, s2; | ||
@@ -298,3 +298,3 @@ | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_55newMustacheShortHandName(); | ||
| s2 = peg$parse_52newMustacheShortHandName(); | ||
| if (s2 !== peg$FAILED) { | ||
@@ -316,3 +316,3 @@ peg$reportedPos = s0; | ||
| function peg$parse_55shortHandClassName() { | ||
| function peg$parse_52shortHandClassName() { | ||
| var s0, s1, s2; | ||
@@ -329,3 +329,3 @@ | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_55newMustacheShortHandName(); | ||
| s2 = peg$parse_52newMustacheShortHandName(); | ||
| if (s2 !== peg$FAILED) { | ||
@@ -347,3 +347,3 @@ peg$reportedPos = s0; | ||
| function peg$parse_55newMustacheShortHandName() { | ||
| function peg$parse_52newMustacheShortHandName() { | ||
| var s0, s1, s2; | ||
@@ -488,3 +488,2 @@ | ||
| function parseInHtml(h, inTagMustaches, fullAttributes, blockParams) { | ||
@@ -561,4 +560,2 @@ var tagName = h[0] || 'div', | ||
| peg$result = peg$startRuleFunction(); | ||
@@ -565,0 +562,0 @@ |
+2
-1
| { | ||
| "name": "emblem", | ||
| "description": "Templating language targeting Handlebars with default Ember.js conventions", | ||
| "version": "0.8.2", | ||
| "version": "0.9.0", | ||
| "homepage": "http://www.emblemjs.com/", | ||
@@ -25,2 +25,3 @@ "keywords": [ | ||
| "devDependencies": { | ||
| "pegjs": "0.9.0", | ||
| "StringScanner": "~0.0.3", | ||
@@ -27,0 +28,0 @@ "broccoli": "^0.13.3", |
+1
-1
@@ -13,3 +13,3 @@ [](https://travis-ci.org/machty/emblem.js) | ||
| [Emblem docs site](http://www.emblemjs.com) for a full explanation | ||
| of the syntax, and check out [Try Emblem](http://bantic.github.io/try-emblem/). | ||
| of the syntax, and check out [Try Emblem](https://mammothhr.github.io/try-emblem/). | ||
@@ -16,0 +16,0 @@ Also check out the |
| 'use strict'; | ||
| var ast_builder = require('./ast-builder'); | ||
| var preprocessor = require('./preprocessor'); | ||
| var events = require('./html/events'); | ||
| var KNOWN_TAGS = require('./html/tags'); | ||
| /*jshint newcap: false, laxbreak: true */ | ||
| var Parser = (function() { | ||
| /* | ||
| * Generated by PEG.js 0.8.0. | ||
| * | ||
| * http://pegjs.majda.cz/ | ||
| */ | ||
| function peg$subclass(child, parent) { | ||
| function ctor() { this.constructor = child; } | ||
| ctor.prototype = parent.prototype; | ||
| child.prototype = new ctor(); | ||
| } | ||
| function SyntaxError(message, expected, found, offset, line, column) { | ||
| this.message = message; | ||
| this.expected = expected; | ||
| this.found = found; | ||
| this.offset = offset; | ||
| this.line = line; | ||
| this.column = column; | ||
| this.name = "SyntaxError"; | ||
| } | ||
| peg$subclass(SyntaxError, Error); | ||
| function parse(input) { | ||
| var options = arguments.length > 1 ? arguments[1] : {}, | ||
| peg$FAILED = {}, | ||
| peg$startRuleFunctions = { _52start: peg$parse_52start }, | ||
| peg$startRuleFunction = peg$parse_52start, | ||
| peg$c0 = /^[_a-zA-Z0-9\-]/, | ||
| peg$c1 = { type: "class", value: "[_a-zA-Z0-9\\-]", description: "[_a-zA-Z0-9\\-]" }, | ||
| peg$c2 = /^[\x80-\xFF]/, | ||
| peg$c3 = { type: "class", value: "[\\x80-\\xFF]", description: "[\\x80-\\xFF]" }, | ||
| peg$c4 = { type: "other", description: "_31Key" }, | ||
| peg$c5 = [], | ||
| peg$c6 = ":", | ||
| peg$c7 = { type: "literal", value: ":", description: "\":\"" }, | ||
| peg$c8 = ".", | ||
| peg$c9 = { type: "literal", value: ".", description: "\".\"" }, | ||
| peg$c10 = peg$FAILED, | ||
| peg$c11 = void 0, | ||
| peg$c12 = "{", | ||
| peg$c13 = { type: "literal", value: "{", description: "\"{\"" }, | ||
| peg$c14 = /^[^}]/, | ||
| peg$c15 = { type: "class", value: "[^}]", description: "[^}]" }, | ||
| peg$c16 = function(text) { | ||
| return text; | ||
| }, | ||
| peg$c17 = /^[\-_\/A-Za-z0-9]/, | ||
| peg$c18 = { type: "class", value: "[\\-_\\/A-Za-z0-9]", description: "[\\-_\\/A-Za-z0-9]" }, | ||
| peg$c19 = ".[", | ||
| peg$c20 = { type: "literal", value: ".[", description: "\".[\"" }, | ||
| peg$c21 = "]", | ||
| peg$c22 = { type: "literal", value: "]", description: "\"]\"" }, | ||
| peg$c23 = /^[ \t]/, | ||
| peg$c24 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, | ||
| peg$c25 = { type: "other", description: "_1OptionalWhitespace" }, | ||
| peg$c26 = "as", | ||
| peg$c27 = { type: "literal", value: "as", description: "\"as\"" }, | ||
| peg$c28 = "|", | ||
| peg$c29 = { type: "literal", value: "|", description: "\"|\"" }, | ||
| peg$c30 = "\"", | ||
| peg$c31 = { type: "literal", value: "\"", description: "\"\\\"\"" }, | ||
| peg$c32 = "'", | ||
| peg$c33 = { type: "literal", value: "'", description: "\"'\"" }, | ||
| peg$c34 = /^[^'"]/, | ||
| peg$c35 = { type: "class", value: "[^'\"]", description: "[^'\"]" }, | ||
| peg$c36 = function(p) { | ||
| return p; | ||
| }, | ||
| peg$c37 = /^[^()]/, | ||
| peg$c38 = { type: "class", value: "[^()]", description: "[^()]" }, | ||
| peg$c39 = "(", | ||
| peg$c40 = { type: "literal", value: "(", description: "\"(\"" }, | ||
| peg$c41 = ")", | ||
| peg$c42 = { type: "literal", value: ")", description: "\")\"" }, | ||
| peg$c43 = function(v) { | ||
| return v; | ||
| }, | ||
| peg$c44 = "/", | ||
| peg$c45 = { type: "literal", value: "/", description: "\"/\"" }, | ||
| peg$c46 = "=", | ||
| peg$c47 = { type: "literal", value: "=", description: "\"=\"" }, | ||
| peg$c48 = function(key, value) { | ||
| return key + '=' + value; | ||
| }, | ||
| peg$currPos = 0, | ||
| peg$reportedPos = 0, | ||
| peg$cachedPos = 0, | ||
| peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, | ||
| peg$maxFailPos = 0, | ||
| peg$maxFailExpected = [], | ||
| peg$silentFails = 0, | ||
| peg$result; | ||
| if ("startRule" in options) { | ||
| if (!(options.startRule in peg$startRuleFunctions)) { | ||
| throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); | ||
| } | ||
| peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; | ||
| } | ||
| function text() { | ||
| return input.substring(peg$reportedPos, peg$currPos); | ||
| } | ||
| function offset() { | ||
| return peg$reportedPos; | ||
| } | ||
| function line() { | ||
| return peg$computePosDetails(peg$reportedPos).line; | ||
| } | ||
| function column() { | ||
| return peg$computePosDetails(peg$reportedPos).column; | ||
| } | ||
| function expected(description) { | ||
| throw peg$buildException( | ||
| null, | ||
| [{ type: "other", description: description }], | ||
| peg$reportedPos | ||
| ); | ||
| } | ||
| function error(message) { | ||
| throw peg$buildException(message, null, peg$reportedPos); | ||
| } | ||
| function peg$computePosDetails(pos) { | ||
| function advance(details, startPos, endPos) { | ||
| var p, ch; | ||
| for (p = startPos; p < endPos; p++) { | ||
| ch = input.charAt(p); | ||
| if (ch === "\n") { | ||
| if (!details.seenCR) { details.line++; } | ||
| details.column = 1; | ||
| details.seenCR = false; | ||
| } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { | ||
| details.line++; | ||
| details.column = 1; | ||
| details.seenCR = true; | ||
| } else { | ||
| details.column++; | ||
| details.seenCR = false; | ||
| } | ||
| } | ||
| } | ||
| if (peg$cachedPos !== pos) { | ||
| if (peg$cachedPos > pos) { | ||
| peg$cachedPos = 0; | ||
| peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; | ||
| } | ||
| advance(peg$cachedPosDetails, peg$cachedPos, pos); | ||
| peg$cachedPos = pos; | ||
| } | ||
| return peg$cachedPosDetails; | ||
| } | ||
| function peg$fail(expected) { | ||
| if (peg$currPos < peg$maxFailPos) { return; } | ||
| if (peg$currPos > peg$maxFailPos) { | ||
| peg$maxFailPos = peg$currPos; | ||
| peg$maxFailExpected = []; | ||
| } | ||
| peg$maxFailExpected.push(expected); | ||
| } | ||
| function peg$buildException(message, expected, pos) { | ||
| function cleanupExpected(expected) { | ||
| var i = 1; | ||
| expected.sort(function(a, b) { | ||
| if (a.description < b.description) { | ||
| return -1; | ||
| } else if (a.description > b.description) { | ||
| return 1; | ||
| } else { | ||
| return 0; | ||
| } | ||
| }); | ||
| while (i < expected.length) { | ||
| if (expected[i - 1] === expected[i]) { | ||
| expected.splice(i, 1); | ||
| } else { | ||
| i++; | ||
| } | ||
| } | ||
| } | ||
| function buildMessage(expected, found) { | ||
| function stringEscape(s) { | ||
| function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } | ||
| return s | ||
| .replace(/\\/g, '\\\\') | ||
| .replace(/"/g, '\\"') | ||
| .replace(/\x08/g, '\\b') | ||
| .replace(/\t/g, '\\t') | ||
| .replace(/\n/g, '\\n') | ||
| .replace(/\f/g, '\\f') | ||
| .replace(/\r/g, '\\r') | ||
| .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) | ||
| .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) | ||
| .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) | ||
| .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); | ||
| } | ||
| var expectedDescs = new Array(expected.length), | ||
| expectedDesc, foundDesc, i; | ||
| for (i = 0; i < expected.length; i++) { | ||
| expectedDescs[i] = expected[i].description; | ||
| } | ||
| expectedDesc = expected.length > 1 | ||
| ? expectedDescs.slice(0, -1).join(", ") | ||
| + " or " | ||
| + expectedDescs[expected.length - 1] | ||
| : expectedDescs[0]; | ||
| foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; | ||
| return "Expected " + expectedDesc + " but " + foundDesc + " found."; | ||
| } | ||
| var posDetails = peg$computePosDetails(pos), | ||
| found = pos < input.length ? input.charAt(pos) : null; | ||
| if (expected !== null) { | ||
| cleanupExpected(expected); | ||
| } | ||
| return new SyntaxError( | ||
| message !== null ? message : buildMessage(expected, found), | ||
| expected, | ||
| found, | ||
| pos, | ||
| posDetails.line, | ||
| posDetails.column | ||
| ); | ||
| } | ||
| function peg$parse_13nmchar() { | ||
| var s0; | ||
| if (peg$c0.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c1); } | ||
| } | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_13nonascii(); | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_13nonascii() { | ||
| var s0; | ||
| if (peg$c2.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c3); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_31key() { | ||
| var s0, s1, s2; | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| s1 = []; | ||
| s2 = peg$parse_13nmchar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 58) { | ||
| s2 = peg$c6; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
| } | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 46) { | ||
| s2 = peg$c8; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| } | ||
| } | ||
| } | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_13nmchar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 58) { | ||
| s2 = peg$c6; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
| } | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 46) { | ||
| s2 = peg$c8; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c4); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_19nonMustache() { | ||
| var s0, s1, s2, s3, s4; | ||
| s0 = peg$currPos; | ||
| s1 = peg$currPos; | ||
| peg$silentFails++; | ||
| if (input.charCodeAt(peg$currPos) === 123) { | ||
| s2 = peg$c12; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c13); } | ||
| } | ||
| peg$silentFails--; | ||
| if (s2 === peg$FAILED) { | ||
| s1 = peg$c11; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$currPos; | ||
| s3 = []; | ||
| if (peg$c14.test(input.charAt(peg$currPos))) { | ||
| s4 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
| } | ||
| while (s4 !== peg$FAILED) { | ||
| s3.push(s4); | ||
| if (peg$c14.test(input.charAt(peg$currPos))) { | ||
| s4 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
| } | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s3 = input.substring(s2, peg$currPos); | ||
| } | ||
| s2 = s3; | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c16(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_42newMustacheNameChar() { | ||
| var s0; | ||
| if (peg$c17.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c18); } | ||
| } | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_42arrayIndex(); | ||
| if (s0 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 46) { | ||
| s0 = peg$c8; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| } | ||
| } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_42arrayIndex() { | ||
| var s0, s1, s2, s3; | ||
| s0 = peg$currPos; | ||
| if (input.substr(peg$currPos, 2) === peg$c19) { | ||
| s1 = peg$c19; | ||
| peg$currPos += 2; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = []; | ||
| s3 = peg$parse_42newMustacheNameChar(); | ||
| while (s3 !== peg$FAILED) { | ||
| s2.push(s3); | ||
| s3 = peg$parse_42newMustacheNameChar(); | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 93) { | ||
| s3 = peg$c21; | ||
| peg$currPos++; | ||
| } else { | ||
| s3 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c22); } | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s1 = [s1, s2, s3]; | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_0start() { | ||
| var s0; | ||
| if (peg$c23.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_1start() { | ||
| var s0, s1; | ||
| peg$silentFails++; | ||
| s0 = []; | ||
| s1 = peg$parse_0start(); | ||
| while (s1 !== peg$FAILED) { | ||
| s0.push(s1); | ||
| s1 = peg$parse_0start(); | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c25); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_43blockStart() { | ||
| var s0, s1, s2, s3; | ||
| s0 = peg$currPos; | ||
| if (input.substr(peg$currPos, 2) === peg$c26) { | ||
| s1 = peg$c26; | ||
| peg$currPos += 2; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c27); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_1start(); | ||
| if (s2 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 124) { | ||
| s3 = peg$c28; | ||
| peg$currPos++; | ||
| } else { | ||
| s3 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c29); } | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s1 = [s1, s2, s3]; | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_44quotedString() { | ||
| var s0, s1, s2, s3, s4; | ||
| s0 = peg$currPos; | ||
| s1 = peg$currPos; | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s2 = peg$c30; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_44stringWithoutDouble(); | ||
| if (s3 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s4 = peg$c30; | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
| if (s4 !== peg$FAILED) { | ||
| s2 = [s2, s3, s4]; | ||
| s1 = s2; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$currPos; | ||
| s1 = peg$currPos; | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s2 = peg$c32; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_44stringWithoutSingle(); | ||
| if (s3 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s4 = peg$c32; | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| } | ||
| if (s4 !== peg$FAILED) { | ||
| s2 = [s2, s3, s4]; | ||
| s1 = s2; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_44stringWithoutDouble() { | ||
| var s0, s1, s2; | ||
| s0 = peg$currPos; | ||
| s1 = []; | ||
| s2 = peg$parse_44inStringChar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s2 = peg$c32; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| } | ||
| } | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_44inStringChar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s2 = peg$c32; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| } | ||
| } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| return s0; | ||
| } | ||
| function peg$parse_44stringWithoutSingle() { | ||
| var s0, s1, s2; | ||
| s0 = peg$currPos; | ||
| s1 = []; | ||
| s2 = peg$parse_44inStringChar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s2 = peg$c30; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
| } | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_44inStringChar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s2 = peg$c30; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
| } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| return s0; | ||
| } | ||
| function peg$parse_44inStringChar() { | ||
| var s0; | ||
| if (peg$c34.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45subexpression() { | ||
| var s0, s1, s2, s3, s4, s5, s6; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_1start(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$currPos; | ||
| s3 = peg$currPos; | ||
| s4 = peg$parse_45OPEN_PAREN(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = []; | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| while (s6 !== peg$FAILED) { | ||
| s5.push(s6); | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| } | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = peg$parse_45CLOSE_PAREN(); | ||
| if (s6 !== peg$FAILED) { | ||
| s4 = [s4, s5, s6]; | ||
| s3 = s4; | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s3 = input.substring(s2, peg$currPos); | ||
| } | ||
| s2 = s3; | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_1start(); | ||
| if (s3 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c36(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45inParensChar() { | ||
| var s0; | ||
| if (peg$c37.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45OPEN_PAREN() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 40) { | ||
| s0 = peg$c39; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45CLOSE_PAREN() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 41) { | ||
| s0 = peg$c41; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_46newMustacheAttrValue() { | ||
| var s0, s1, s2, s3; | ||
| s0 = peg$currPos; | ||
| s1 = peg$currPos; | ||
| peg$silentFails++; | ||
| s2 = peg$parse_46invalidValueStartChar(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_43blockStart(); | ||
| } | ||
| peg$silentFails--; | ||
| if (s2 === peg$FAILED) { | ||
| s1 = peg$c11; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_44quotedString(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_46valuePath(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_45subexpression(); | ||
| } | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_1start(); | ||
| if (s3 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c43(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_46valuePath() { | ||
| var s0, s1, s2; | ||
| s0 = peg$currPos; | ||
| s1 = []; | ||
| s2 = peg$parse_42newMustacheNameChar(); | ||
| if (s2 !== peg$FAILED) { | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_42newMustacheNameChar(); | ||
| } | ||
| } else { | ||
| s1 = peg$c10; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| return s0; | ||
| } | ||
| function peg$parse_46invalidValueStartChar() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 47) { | ||
| s0 = peg$c44; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_52start() { | ||
| var s0; | ||
| s0 = peg$parse_52simpleMustacheAttr(); | ||
| return s0; | ||
| } | ||
| function peg$parse_52simpleMustacheAttr() { | ||
| var s0, s1, s2, s3, s4, s5; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_31key(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_1start(); | ||
| if (s2 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 61) { | ||
| s3 = peg$c46; | ||
| peg$currPos++; | ||
| } else { | ||
| s3 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s4 = peg$parse_1start(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = peg$parse_46newMustacheAttrValue(); | ||
| if (s5 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c48(s1, s5); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function prepareMustachValue(content){ | ||
| var parts = content.split(' '), | ||
| first, | ||
| match; | ||
| // check for '!' unbound helper | ||
| first = parts.shift(); | ||
| if (match = first.match(/(.*)!$/)) { | ||
| parts.unshift( match[1] ); | ||
| content = 'unbound ' + parts.join(' '); | ||
| } else { | ||
| parts.unshift(first); | ||
| } | ||
| // check for '?' if helper | ||
| first = parts.shift(); | ||
| if (match = first.match(/(.*)\?$/)) { | ||
| parts.unshift( match[1] ); | ||
| content = 'if ' + parts.join(' '); | ||
| } else { | ||
| parts.unshift(first); | ||
| } | ||
| return content; | ||
| } | ||
| var LINE_SPACE_MODIFIERS = { | ||
| NEWLINE: '`', | ||
| SPACE_AFTER: "'", | ||
| SPACE_BOTH: '"', | ||
| SPACE_BEFORE: "+" | ||
| }; | ||
| function castStringsToTextNodes(possibleStrings) { | ||
| var ret = []; | ||
| var nodes = []; | ||
| var currentString = null; | ||
| var possibleString; | ||
| for(var i=0, l=possibleStrings.length; i<l; i++) { | ||
| possibleString = possibleStrings[i]; | ||
| if (typeof possibleString === 'string') { | ||
| currentString = (currentString || '') + possibleString; | ||
| } else { | ||
| if (currentString) { | ||
| ret.push( textNode(currentString) ); | ||
| currentString = null; | ||
| } | ||
| ret.push( possibleString ); // not a string, it is a node here | ||
| } | ||
| } | ||
| if (currentString) { | ||
| ret.push( textNode(currentString) ); | ||
| } | ||
| return ret; | ||
| } | ||
| function textNode(content){ | ||
| return builder.generateText(content); | ||
| } | ||
| function buildActionEvent(event, actionContent) { | ||
| actionContent.push('on=\"' + event + '\"'); | ||
| return [ | ||
| builder.generateMustache(actionContent.join(' ')) | ||
| ]; | ||
| } | ||
| function isAliasEvent(event) { | ||
| return !!events.ALIAS_EVENTS[event]; | ||
| } | ||
| function parseInHtml(h, inTagMustaches, fullAttributes, blockParams) { | ||
| var tagName = h[0] || 'div', | ||
| shorthandAttributes = h[1] || [], | ||
| id = shorthandAttributes[0], | ||
| classes = shorthandAttributes[1] || []; | ||
| var i, l; | ||
| var elementNode = builder.generateElement(tagName); | ||
| builder.enter(elementNode); | ||
| for (i=0, l=classes.length;i<l;i++) { | ||
| if (classes[i].type === 'classNameBinding') { | ||
| builder.add('classNameBindings', classes[i]); | ||
| } else { | ||
| builder.classNameBinding(':'+classes[i]); | ||
| } | ||
| } | ||
| if (id) { | ||
| builder.attribute('id', id); | ||
| } | ||
| for(i = 0; i < inTagMustaches.length; ++i) { | ||
| builder.add('attrStaches', inTagMustaches[i]); | ||
| } | ||
| for(i = 0; i < fullAttributes.length; ++i) { | ||
| var currentAttr = fullAttributes[i]; | ||
| if (Array.isArray(currentAttr) && typeof currentAttr[0] === 'string') { // a "normalAttribute", [attrName, attrContent] | ||
| if (currentAttr.length) { // a boolean false attribute will be [] | ||
| // skip classes now, coalesce them later | ||
| if (currentAttr[0] === 'class') { | ||
| builder.classNameBinding(':'+currentAttr[1]); | ||
| } else { | ||
| builder.attribute(currentAttr[0], currentAttr[1]); | ||
| } | ||
| } | ||
| } else if (Array.isArray(currentAttr)) { | ||
| currentAttr.forEach(function(attrNode){ | ||
| builder.add( | ||
| attrNode.type === 'classNameBinding' ? 'classNameBindings' : 'attrStaches', | ||
| attrNode | ||
| ); | ||
| }); | ||
| } else { | ||
| builder.add( | ||
| currentAttr.type === 'classNameBinding' ? 'classNameBindings' : 'attrStaches', | ||
| currentAttr | ||
| ); | ||
| } | ||
| } | ||
| if (blockParams && blockParams.length > 0) { | ||
| var joinedParams = blockParams.join(' '); | ||
| var tagString = 'as |' + joinedParams + '|'; | ||
| builder.inTagText(tagString); | ||
| } | ||
| } | ||
| function isKnownTag(tag) { | ||
| return !!KNOWN_TAGS['default'][tag]; | ||
| } | ||
| peg$result = peg$startRuleFunction(); | ||
| if (peg$result !== peg$FAILED && peg$currPos === input.length) { | ||
| return peg$result; | ||
| } else { | ||
| if (peg$result !== peg$FAILED && peg$currPos < input.length) { | ||
| peg$fail({ type: "end", description: "end of input" }); | ||
| } | ||
| throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); | ||
| } | ||
| } | ||
| return { | ||
| SyntaxError: SyntaxError, | ||
| parse: parse | ||
| }; | ||
| })(); | ||
| var parse = Parser.parse, ParserSyntaxError = Parser.SyntaxError; | ||
| exports['default'] = parse; | ||
| exports.ParserSyntaxError = ParserSyntaxError; | ||
| exports.parse = parse; |
| 'use strict'; | ||
| var ast_builder = require('./ast-builder'); | ||
| var preprocessor = require('./preprocessor'); | ||
| var events = require('./html/events'); | ||
| var KNOWN_TAGS = require('./html/tags'); | ||
| /*jshint newcap: false, laxbreak: true */ | ||
| var Parser = (function() { | ||
| /* | ||
| * Generated by PEG.js 0.8.0. | ||
| * | ||
| * http://pegjs.majda.cz/ | ||
| */ | ||
| function peg$subclass(child, parent) { | ||
| function ctor() { this.constructor = child; } | ||
| ctor.prototype = parent.prototype; | ||
| child.prototype = new ctor(); | ||
| } | ||
| function SyntaxError(message, expected, found, offset, line, column) { | ||
| this.message = message; | ||
| this.expected = expected; | ||
| this.found = found; | ||
| this.offset = offset; | ||
| this.line = line; | ||
| this.column = column; | ||
| this.name = "SyntaxError"; | ||
| } | ||
| peg$subclass(SyntaxError, Error); | ||
| function parse(input) { | ||
| var options = arguments.length > 1 ? arguments[1] : {}, | ||
| peg$FAILED = {}, | ||
| peg$startRuleFunctions = { _53start: peg$parse_53start }, | ||
| peg$startRuleFunction = peg$parse_53start, | ||
| peg$c0 = /^[_a-zA-Z0-9\-]/, | ||
| peg$c1 = { type: "class", value: "[_a-zA-Z0-9\\-]", description: "[_a-zA-Z0-9\\-]" }, | ||
| peg$c2 = /^[\x80-\xFF]/, | ||
| peg$c3 = { type: "class", value: "[\\x80-\\xFF]", description: "[\\x80-\\xFF]" }, | ||
| peg$c4 = { type: "other", description: "_31Key" }, | ||
| peg$c5 = [], | ||
| peg$c6 = ":", | ||
| peg$c7 = { type: "literal", value: ":", description: "\":\"" }, | ||
| peg$c8 = ".", | ||
| peg$c9 = { type: "literal", value: ".", description: "\".\"" }, | ||
| peg$c10 = peg$FAILED, | ||
| peg$c11 = void 0, | ||
| peg$c12 = "{", | ||
| peg$c13 = { type: "literal", value: "{", description: "\"{\"" }, | ||
| peg$c14 = /^[^}]/, | ||
| peg$c15 = { type: "class", value: "[^}]", description: "[^}]" }, | ||
| peg$c16 = function(text) { | ||
| return text; | ||
| }, | ||
| peg$c17 = /^[\-_\/A-Za-z0-9]/, | ||
| peg$c18 = { type: "class", value: "[\\-_\\/A-Za-z0-9]", description: "[\\-_\\/A-Za-z0-9]" }, | ||
| peg$c19 = ".[", | ||
| peg$c20 = { type: "literal", value: ".[", description: "\".[\"" }, | ||
| peg$c21 = "]", | ||
| peg$c22 = { type: "literal", value: "]", description: "\"]\"" }, | ||
| peg$c23 = /^[ \t]/, | ||
| peg$c24 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, | ||
| peg$c25 = { type: "other", description: "_1OptionalWhitespace" }, | ||
| peg$c26 = "as", | ||
| peg$c27 = { type: "literal", value: "as", description: "\"as\"" }, | ||
| peg$c28 = "|", | ||
| peg$c29 = { type: "literal", value: "|", description: "\"|\"" }, | ||
| peg$c30 = "\"", | ||
| peg$c31 = { type: "literal", value: "\"", description: "\"\\\"\"" }, | ||
| peg$c32 = "'", | ||
| peg$c33 = { type: "literal", value: "'", description: "\"'\"" }, | ||
| peg$c34 = /^[^'"]/, | ||
| peg$c35 = { type: "class", value: "[^'\"]", description: "[^'\"]" }, | ||
| peg$c36 = function(p) { | ||
| return p; | ||
| }, | ||
| peg$c37 = /^[^()]/, | ||
| peg$c38 = { type: "class", value: "[^()]", description: "[^()]" }, | ||
| peg$c39 = "(", | ||
| peg$c40 = { type: "literal", value: "(", description: "\"(\"" }, | ||
| peg$c41 = ")", | ||
| peg$c42 = { type: "literal", value: ")", description: "\")\"" }, | ||
| peg$c43 = function(v) { | ||
| return v; | ||
| }, | ||
| peg$c44 = "/", | ||
| peg$c45 = { type: "literal", value: "/", description: "\"/\"" }, | ||
| peg$c46 = "=", | ||
| peg$c47 = { type: "literal", value: "=", description: "\"=\"" }, | ||
| peg$c48 = function(key, value) { | ||
| return key + '=' + value; | ||
| }, | ||
| peg$currPos = 0, | ||
| peg$reportedPos = 0, | ||
| peg$cachedPos = 0, | ||
| peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, | ||
| peg$maxFailPos = 0, | ||
| peg$maxFailExpected = [], | ||
| peg$silentFails = 0, | ||
| peg$result; | ||
| if ("startRule" in options) { | ||
| if (!(options.startRule in peg$startRuleFunctions)) { | ||
| throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); | ||
| } | ||
| peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; | ||
| } | ||
| function text() { | ||
| return input.substring(peg$reportedPos, peg$currPos); | ||
| } | ||
| function offset() { | ||
| return peg$reportedPos; | ||
| } | ||
| function line() { | ||
| return peg$computePosDetails(peg$reportedPos).line; | ||
| } | ||
| function column() { | ||
| return peg$computePosDetails(peg$reportedPos).column; | ||
| } | ||
| function expected(description) { | ||
| throw peg$buildException( | ||
| null, | ||
| [{ type: "other", description: description }], | ||
| peg$reportedPos | ||
| ); | ||
| } | ||
| function error(message) { | ||
| throw peg$buildException(message, null, peg$reportedPos); | ||
| } | ||
| function peg$computePosDetails(pos) { | ||
| function advance(details, startPos, endPos) { | ||
| var p, ch; | ||
| for (p = startPos; p < endPos; p++) { | ||
| ch = input.charAt(p); | ||
| if (ch === "\n") { | ||
| if (!details.seenCR) { details.line++; } | ||
| details.column = 1; | ||
| details.seenCR = false; | ||
| } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { | ||
| details.line++; | ||
| details.column = 1; | ||
| details.seenCR = true; | ||
| } else { | ||
| details.column++; | ||
| details.seenCR = false; | ||
| } | ||
| } | ||
| } | ||
| if (peg$cachedPos !== pos) { | ||
| if (peg$cachedPos > pos) { | ||
| peg$cachedPos = 0; | ||
| peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; | ||
| } | ||
| advance(peg$cachedPosDetails, peg$cachedPos, pos); | ||
| peg$cachedPos = pos; | ||
| } | ||
| return peg$cachedPosDetails; | ||
| } | ||
| function peg$fail(expected) { | ||
| if (peg$currPos < peg$maxFailPos) { return; } | ||
| if (peg$currPos > peg$maxFailPos) { | ||
| peg$maxFailPos = peg$currPos; | ||
| peg$maxFailExpected = []; | ||
| } | ||
| peg$maxFailExpected.push(expected); | ||
| } | ||
| function peg$buildException(message, expected, pos) { | ||
| function cleanupExpected(expected) { | ||
| var i = 1; | ||
| expected.sort(function(a, b) { | ||
| if (a.description < b.description) { | ||
| return -1; | ||
| } else if (a.description > b.description) { | ||
| return 1; | ||
| } else { | ||
| return 0; | ||
| } | ||
| }); | ||
| while (i < expected.length) { | ||
| if (expected[i - 1] === expected[i]) { | ||
| expected.splice(i, 1); | ||
| } else { | ||
| i++; | ||
| } | ||
| } | ||
| } | ||
| function buildMessage(expected, found) { | ||
| function stringEscape(s) { | ||
| function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } | ||
| return s | ||
| .replace(/\\/g, '\\\\') | ||
| .replace(/"/g, '\\"') | ||
| .replace(/\x08/g, '\\b') | ||
| .replace(/\t/g, '\\t') | ||
| .replace(/\n/g, '\\n') | ||
| .replace(/\f/g, '\\f') | ||
| .replace(/\r/g, '\\r') | ||
| .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) | ||
| .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) | ||
| .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) | ||
| .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); | ||
| } | ||
| var expectedDescs = new Array(expected.length), | ||
| expectedDesc, foundDesc, i; | ||
| for (i = 0; i < expected.length; i++) { | ||
| expectedDescs[i] = expected[i].description; | ||
| } | ||
| expectedDesc = expected.length > 1 | ||
| ? expectedDescs.slice(0, -1).join(", ") | ||
| + " or " | ||
| + expectedDescs[expected.length - 1] | ||
| : expectedDescs[0]; | ||
| foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; | ||
| return "Expected " + expectedDesc + " but " + foundDesc + " found."; | ||
| } | ||
| var posDetails = peg$computePosDetails(pos), | ||
| found = pos < input.length ? input.charAt(pos) : null; | ||
| if (expected !== null) { | ||
| cleanupExpected(expected); | ||
| } | ||
| return new SyntaxError( | ||
| message !== null ? message : buildMessage(expected, found), | ||
| expected, | ||
| found, | ||
| pos, | ||
| posDetails.line, | ||
| posDetails.column | ||
| ); | ||
| } | ||
| function peg$parse_13nmchar() { | ||
| var s0; | ||
| if (peg$c0.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c1); } | ||
| } | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_13nonascii(); | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_13nonascii() { | ||
| var s0; | ||
| if (peg$c2.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c3); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_31key() { | ||
| var s0, s1, s2; | ||
| peg$silentFails++; | ||
| s0 = peg$currPos; | ||
| s1 = []; | ||
| s2 = peg$parse_13nmchar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 58) { | ||
| s2 = peg$c6; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
| } | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 46) { | ||
| s2 = peg$c8; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| } | ||
| } | ||
| } | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_13nmchar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 58) { | ||
| s2 = peg$c6; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
| } | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 46) { | ||
| s2 = peg$c8; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c4); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_19nonMustache() { | ||
| var s0, s1, s2, s3, s4; | ||
| s0 = peg$currPos; | ||
| s1 = peg$currPos; | ||
| peg$silentFails++; | ||
| if (input.charCodeAt(peg$currPos) === 123) { | ||
| s2 = peg$c12; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c13); } | ||
| } | ||
| peg$silentFails--; | ||
| if (s2 === peg$FAILED) { | ||
| s1 = peg$c11; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$currPos; | ||
| s3 = []; | ||
| if (peg$c14.test(input.charAt(peg$currPos))) { | ||
| s4 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
| } | ||
| while (s4 !== peg$FAILED) { | ||
| s3.push(s4); | ||
| if (peg$c14.test(input.charAt(peg$currPos))) { | ||
| s4 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
| } | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s3 = input.substring(s2, peg$currPos); | ||
| } | ||
| s2 = s3; | ||
| if (s2 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c16(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_42newMustacheNameChar() { | ||
| var s0; | ||
| if (peg$c17.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c18); } | ||
| } | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_42arrayIndex(); | ||
| if (s0 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 46) { | ||
| s0 = peg$c8; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| } | ||
| } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_42arrayIndex() { | ||
| var s0, s1, s2, s3; | ||
| s0 = peg$currPos; | ||
| if (input.substr(peg$currPos, 2) === peg$c19) { | ||
| s1 = peg$c19; | ||
| peg$currPos += 2; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = []; | ||
| s3 = peg$parse_42newMustacheNameChar(); | ||
| while (s3 !== peg$FAILED) { | ||
| s2.push(s3); | ||
| s3 = peg$parse_42newMustacheNameChar(); | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 93) { | ||
| s3 = peg$c21; | ||
| peg$currPos++; | ||
| } else { | ||
| s3 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c22); } | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s1 = [s1, s2, s3]; | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_0start() { | ||
| var s0; | ||
| if (peg$c23.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_1start() { | ||
| var s0, s1; | ||
| peg$silentFails++; | ||
| s0 = []; | ||
| s1 = peg$parse_0start(); | ||
| while (s1 !== peg$FAILED) { | ||
| s0.push(s1); | ||
| s1 = peg$parse_0start(); | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c25); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_43blockStart() { | ||
| var s0, s1, s2, s3; | ||
| s0 = peg$currPos; | ||
| if (input.substr(peg$currPos, 2) === peg$c26) { | ||
| s1 = peg$c26; | ||
| peg$currPos += 2; | ||
| } else { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c27); } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_1start(); | ||
| if (s2 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 124) { | ||
| s3 = peg$c28; | ||
| peg$currPos++; | ||
| } else { | ||
| s3 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c29); } | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s1 = [s1, s2, s3]; | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_44quotedString() { | ||
| var s0, s1, s2, s3, s4; | ||
| s0 = peg$currPos; | ||
| s1 = peg$currPos; | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s2 = peg$c30; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_44stringWithoutDouble(); | ||
| if (s3 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s4 = peg$c30; | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
| if (s4 !== peg$FAILED) { | ||
| s2 = [s2, s3, s4]; | ||
| s1 = s2; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$currPos; | ||
| s1 = peg$currPos; | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s2 = peg$c32; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_44stringWithoutSingle(); | ||
| if (s3 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s4 = peg$c32; | ||
| peg$currPos++; | ||
| } else { | ||
| s4 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| } | ||
| if (s4 !== peg$FAILED) { | ||
| s2 = [s2, s3, s4]; | ||
| s1 = s2; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_44stringWithoutDouble() { | ||
| var s0, s1, s2; | ||
| s0 = peg$currPos; | ||
| s1 = []; | ||
| s2 = peg$parse_44inStringChar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s2 = peg$c32; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| } | ||
| } | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_44inStringChar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 39) { | ||
| s2 = peg$c32; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
| } | ||
| } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| return s0; | ||
| } | ||
| function peg$parse_44stringWithoutSingle() { | ||
| var s0, s1, s2; | ||
| s0 = peg$currPos; | ||
| s1 = []; | ||
| s2 = peg$parse_44inStringChar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s2 = peg$c30; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
| } | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_44inStringChar(); | ||
| if (s2 === peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 34) { | ||
| s2 = peg$c30; | ||
| peg$currPos++; | ||
| } else { | ||
| s2 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
| } | ||
| } | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| return s0; | ||
| } | ||
| function peg$parse_44inStringChar() { | ||
| var s0; | ||
| if (peg$c34.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45subexpression() { | ||
| var s0, s1, s2, s3, s4, s5, s6; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_1start(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$currPos; | ||
| s3 = peg$currPos; | ||
| s4 = peg$parse_45OPEN_PAREN(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = []; | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| while (s6 !== peg$FAILED) { | ||
| s5.push(s6); | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| } | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = peg$parse_45CLOSE_PAREN(); | ||
| if (s6 !== peg$FAILED) { | ||
| s4 = [s4, s5, s6]; | ||
| s3 = s4; | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c10; | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s3 = input.substring(s2, peg$currPos); | ||
| } | ||
| s2 = s3; | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_1start(); | ||
| if (s3 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c36(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45inParensChar() { | ||
| var s0; | ||
| if (peg$c37.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45OPEN_PAREN() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 40) { | ||
| s0 = peg$c39; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45CLOSE_PAREN() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 41) { | ||
| s0 = peg$c41; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_46newMustacheAttrValue() { | ||
| var s0, s1, s2, s3; | ||
| s0 = peg$currPos; | ||
| s1 = peg$currPos; | ||
| peg$silentFails++; | ||
| s2 = peg$parse_46invalidValueStartChar(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_43blockStart(); | ||
| } | ||
| peg$silentFails--; | ||
| if (s2 === peg$FAILED) { | ||
| s1 = peg$c11; | ||
| } else { | ||
| peg$currPos = s1; | ||
| s1 = peg$c10; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_44quotedString(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_46valuePath(); | ||
| if (s2 === peg$FAILED) { | ||
| s2 = peg$parse_45subexpression(); | ||
| } | ||
| } | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_1start(); | ||
| if (s3 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c43(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_46valuePath() { | ||
| var s0, s1, s2; | ||
| s0 = peg$currPos; | ||
| s1 = []; | ||
| s2 = peg$parse_42newMustacheNameChar(); | ||
| if (s2 !== peg$FAILED) { | ||
| while (s2 !== peg$FAILED) { | ||
| s1.push(s2); | ||
| s2 = peg$parse_42newMustacheNameChar(); | ||
| } | ||
| } else { | ||
| s1 = peg$c10; | ||
| } | ||
| if (s1 !== peg$FAILED) { | ||
| s1 = input.substring(s0, peg$currPos); | ||
| } | ||
| s0 = s1; | ||
| return s0; | ||
| } | ||
| function peg$parse_46invalidValueStartChar() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 47) { | ||
| s0 = peg$c44; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_52simpleMustacheAttr() { | ||
| var s0, s1, s2, s3, s4, s5; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_31key(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$parse_1start(); | ||
| if (s2 !== peg$FAILED) { | ||
| if (input.charCodeAt(peg$currPos) === 61) { | ||
| s3 = peg$c46; | ||
| peg$currPos++; | ||
| } else { | ||
| s3 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s4 = peg$parse_1start(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = peg$parse_46newMustacheAttrValue(); | ||
| if (s5 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c48(s1, s5); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c10; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_53start() { | ||
| var s0; | ||
| s0 = peg$parse_53mustacheAttr(); | ||
| return s0; | ||
| } | ||
| function peg$parse_53mustacheAttr() { | ||
| var s0; | ||
| s0 = peg$parse_52simpleMustacheAttr(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_45subexpression(); | ||
| if (s0 === peg$FAILED) { | ||
| s0 = peg$parse_46newMustacheAttrValue(); | ||
| } | ||
| } | ||
| return s0; | ||
| } | ||
| function prepareMustachValue(content){ | ||
| var parts = content.split(' '), | ||
| first, | ||
| match; | ||
| // check for '!' unbound helper | ||
| first = parts.shift(); | ||
| if (match = first.match(/(.*)!$/)) { | ||
| parts.unshift( match[1] ); | ||
| content = 'unbound ' + parts.join(' '); | ||
| } else { | ||
| parts.unshift(first); | ||
| } | ||
| // check for '?' if helper | ||
| first = parts.shift(); | ||
| if (match = first.match(/(.*)\?$/)) { | ||
| parts.unshift( match[1] ); | ||
| content = 'if ' + parts.join(' '); | ||
| } else { | ||
| parts.unshift(first); | ||
| } | ||
| return content; | ||
| } | ||
| var LINE_SPACE_MODIFIERS = { | ||
| NEWLINE: '`', | ||
| SPACE_AFTER: "'", | ||
| SPACE_BOTH: '"', | ||
| SPACE_BEFORE: "+" | ||
| }; | ||
| function castStringsToTextNodes(possibleStrings) { | ||
| var ret = []; | ||
| var nodes = []; | ||
| var currentString = null; | ||
| var possibleString; | ||
| for(var i=0, l=possibleStrings.length; i<l; i++) { | ||
| possibleString = possibleStrings[i]; | ||
| if (typeof possibleString === 'string') { | ||
| currentString = (currentString || '') + possibleString; | ||
| } else { | ||
| if (currentString) { | ||
| ret.push( textNode(currentString) ); | ||
| currentString = null; | ||
| } | ||
| ret.push( possibleString ); // not a string, it is a node here | ||
| } | ||
| } | ||
| if (currentString) { | ||
| ret.push( textNode(currentString) ); | ||
| } | ||
| return ret; | ||
| } | ||
| function textNode(content){ | ||
| return builder.generateText(content); | ||
| } | ||
| function buildActionEvent(event, actionContent) { | ||
| actionContent.push('on=\"' + event + '\"'); | ||
| return [ | ||
| builder.generateMustache(actionContent.join(' ')) | ||
| ]; | ||
| } | ||
| function isAliasEvent(event) { | ||
| return !!events.ALIAS_EVENTS[event]; | ||
| } | ||
| function parseInHtml(h, inTagMustaches, fullAttributes, blockParams) { | ||
| var tagName = h[0] || 'div', | ||
| shorthandAttributes = h[1] || [], | ||
| id = shorthandAttributes[0], | ||
| classes = shorthandAttributes[1] || []; | ||
| var i, l; | ||
| var elementNode = builder.generateElement(tagName); | ||
| builder.enter(elementNode); | ||
| for (i=0, l=classes.length;i<l;i++) { | ||
| if (classes[i].type === 'classNameBinding') { | ||
| builder.add('classNameBindings', classes[i]); | ||
| } else { | ||
| builder.classNameBinding(':'+classes[i]); | ||
| } | ||
| } | ||
| if (id) { | ||
| builder.attribute('id', id); | ||
| } | ||
| for(i = 0; i < inTagMustaches.length; ++i) { | ||
| builder.add('attrStaches', inTagMustaches[i]); | ||
| } | ||
| for(i = 0; i < fullAttributes.length; ++i) { | ||
| var currentAttr = fullAttributes[i]; | ||
| if (Array.isArray(currentAttr) && typeof currentAttr[0] === 'string') { // a "normalAttribute", [attrName, attrContent] | ||
| if (currentAttr.length) { // a boolean false attribute will be [] | ||
| // skip classes now, coalesce them later | ||
| if (currentAttr[0] === 'class') { | ||
| builder.classNameBinding(':'+currentAttr[1]); | ||
| } else { | ||
| builder.attribute(currentAttr[0], currentAttr[1]); | ||
| } | ||
| } | ||
| } else if (Array.isArray(currentAttr)) { | ||
| currentAttr.forEach(function(attrNode){ | ||
| builder.add( | ||
| attrNode.type === 'classNameBinding' ? 'classNameBindings' : 'attrStaches', | ||
| attrNode | ||
| ); | ||
| }); | ||
| } else { | ||
| builder.add( | ||
| currentAttr.type === 'classNameBinding' ? 'classNameBindings' : 'attrStaches', | ||
| currentAttr | ||
| ); | ||
| } | ||
| } | ||
| if (blockParams && blockParams.length > 0) { | ||
| var joinedParams = blockParams.join(' '); | ||
| var tagString = 'as |' + joinedParams + '|'; | ||
| builder.inTagText(tagString); | ||
| } | ||
| } | ||
| function isKnownTag(tag) { | ||
| return !!KNOWN_TAGS['default'][tag]; | ||
| } | ||
| peg$result = peg$startRuleFunction(); | ||
| if (peg$result !== peg$FAILED && peg$currPos === input.length) { | ||
| return peg$result; | ||
| } else { | ||
| if (peg$result !== peg$FAILED && peg$currPos < input.length) { | ||
| peg$fail({ type: "end", description: "end of input" }); | ||
| } | ||
| throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); | ||
| } | ||
| } | ||
| return { | ||
| SyntaxError: SyntaxError, | ||
| parse: parse | ||
| }; | ||
| })(); | ||
| var parse = Parser.parse, ParserSyntaxError = Parser.SyntaxError; | ||
| exports['default'] = parse; | ||
| exports.ParserSyntaxError = ParserSyntaxError; | ||
| exports.parse = parse; |
| 'use strict'; | ||
| var ast_builder = require('./ast-builder'); | ||
| var preprocessor = require('./preprocessor'); | ||
| var events = require('./html/events'); | ||
| var KNOWN_TAGS = require('./html/tags'); | ||
| /*jshint newcap: false, laxbreak: true */ | ||
| var Parser = (function() { | ||
| /* | ||
| * Generated by PEG.js 0.8.0. | ||
| * | ||
| * http://pegjs.majda.cz/ | ||
| */ | ||
| function peg$subclass(child, parent) { | ||
| function ctor() { this.constructor = child; } | ||
| ctor.prototype = parent.prototype; | ||
| child.prototype = new ctor(); | ||
| } | ||
| function SyntaxError(message, expected, found, offset, line, column) { | ||
| this.message = message; | ||
| this.expected = expected; | ||
| this.found = found; | ||
| this.offset = offset; | ||
| this.line = line; | ||
| this.column = column; | ||
| this.name = "SyntaxError"; | ||
| } | ||
| peg$subclass(SyntaxError, Error); | ||
| function parse(input) { | ||
| var options = arguments.length > 1 ? arguments[1] : {}, | ||
| peg$FAILED = {}, | ||
| peg$startRuleFunctions = { _45start: peg$parse_45start }, | ||
| peg$startRuleFunction = peg$parse_45start, | ||
| peg$c0 = /^[ \t]/, | ||
| peg$c1 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, | ||
| peg$c2 = { type: "other", description: "_1OptionalWhitespace" }, | ||
| peg$c3 = [], | ||
| peg$c4 = peg$FAILED, | ||
| peg$c5 = function(p) { | ||
| return p; | ||
| }, | ||
| peg$c6 = /^[^()]/, | ||
| peg$c7 = { type: "class", value: "[^()]", description: "[^()]" }, | ||
| peg$c8 = "(", | ||
| peg$c9 = { type: "literal", value: "(", description: "\"(\"" }, | ||
| peg$c10 = ")", | ||
| peg$c11 = { type: "literal", value: ")", description: "\")\"" }, | ||
| peg$currPos = 0, | ||
| peg$reportedPos = 0, | ||
| peg$cachedPos = 0, | ||
| peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, | ||
| peg$maxFailPos = 0, | ||
| peg$maxFailExpected = [], | ||
| peg$silentFails = 0, | ||
| peg$result; | ||
| if ("startRule" in options) { | ||
| if (!(options.startRule in peg$startRuleFunctions)) { | ||
| throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); | ||
| } | ||
| peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; | ||
| } | ||
| function text() { | ||
| return input.substring(peg$reportedPos, peg$currPos); | ||
| } | ||
| function offset() { | ||
| return peg$reportedPos; | ||
| } | ||
| function line() { | ||
| return peg$computePosDetails(peg$reportedPos).line; | ||
| } | ||
| function column() { | ||
| return peg$computePosDetails(peg$reportedPos).column; | ||
| } | ||
| function expected(description) { | ||
| throw peg$buildException( | ||
| null, | ||
| [{ type: "other", description: description }], | ||
| peg$reportedPos | ||
| ); | ||
| } | ||
| function error(message) { | ||
| throw peg$buildException(message, null, peg$reportedPos); | ||
| } | ||
| function peg$computePosDetails(pos) { | ||
| function advance(details, startPos, endPos) { | ||
| var p, ch; | ||
| for (p = startPos; p < endPos; p++) { | ||
| ch = input.charAt(p); | ||
| if (ch === "\n") { | ||
| if (!details.seenCR) { details.line++; } | ||
| details.column = 1; | ||
| details.seenCR = false; | ||
| } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { | ||
| details.line++; | ||
| details.column = 1; | ||
| details.seenCR = true; | ||
| } else { | ||
| details.column++; | ||
| details.seenCR = false; | ||
| } | ||
| } | ||
| } | ||
| if (peg$cachedPos !== pos) { | ||
| if (peg$cachedPos > pos) { | ||
| peg$cachedPos = 0; | ||
| peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; | ||
| } | ||
| advance(peg$cachedPosDetails, peg$cachedPos, pos); | ||
| peg$cachedPos = pos; | ||
| } | ||
| return peg$cachedPosDetails; | ||
| } | ||
| function peg$fail(expected) { | ||
| if (peg$currPos < peg$maxFailPos) { return; } | ||
| if (peg$currPos > peg$maxFailPos) { | ||
| peg$maxFailPos = peg$currPos; | ||
| peg$maxFailExpected = []; | ||
| } | ||
| peg$maxFailExpected.push(expected); | ||
| } | ||
| function peg$buildException(message, expected, pos) { | ||
| function cleanupExpected(expected) { | ||
| var i = 1; | ||
| expected.sort(function(a, b) { | ||
| if (a.description < b.description) { | ||
| return -1; | ||
| } else if (a.description > b.description) { | ||
| return 1; | ||
| } else { | ||
| return 0; | ||
| } | ||
| }); | ||
| while (i < expected.length) { | ||
| if (expected[i - 1] === expected[i]) { | ||
| expected.splice(i, 1); | ||
| } else { | ||
| i++; | ||
| } | ||
| } | ||
| } | ||
| function buildMessage(expected, found) { | ||
| function stringEscape(s) { | ||
| function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } | ||
| return s | ||
| .replace(/\\/g, '\\\\') | ||
| .replace(/"/g, '\\"') | ||
| .replace(/\x08/g, '\\b') | ||
| .replace(/\t/g, '\\t') | ||
| .replace(/\n/g, '\\n') | ||
| .replace(/\f/g, '\\f') | ||
| .replace(/\r/g, '\\r') | ||
| .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) | ||
| .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) | ||
| .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) | ||
| .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); | ||
| } | ||
| var expectedDescs = new Array(expected.length), | ||
| expectedDesc, foundDesc, i; | ||
| for (i = 0; i < expected.length; i++) { | ||
| expectedDescs[i] = expected[i].description; | ||
| } | ||
| expectedDesc = expected.length > 1 | ||
| ? expectedDescs.slice(0, -1).join(", ") | ||
| + " or " | ||
| + expectedDescs[expected.length - 1] | ||
| : expectedDescs[0]; | ||
| foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; | ||
| return "Expected " + expectedDesc + " but " + foundDesc + " found."; | ||
| } | ||
| var posDetails = peg$computePosDetails(pos), | ||
| found = pos < input.length ? input.charAt(pos) : null; | ||
| if (expected !== null) { | ||
| cleanupExpected(expected); | ||
| } | ||
| return new SyntaxError( | ||
| message !== null ? message : buildMessage(expected, found), | ||
| expected, | ||
| found, | ||
| pos, | ||
| posDetails.line, | ||
| posDetails.column | ||
| ); | ||
| } | ||
| function peg$parse_0start() { | ||
| var s0; | ||
| if (peg$c0.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c1); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_1start() { | ||
| var s0, s1; | ||
| peg$silentFails++; | ||
| s0 = []; | ||
| s1 = peg$parse_0start(); | ||
| while (s1 !== peg$FAILED) { | ||
| s0.push(s1); | ||
| s1 = peg$parse_0start(); | ||
| } | ||
| peg$silentFails--; | ||
| if (s0 === peg$FAILED) { | ||
| s1 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c2); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45start() { | ||
| var s0; | ||
| s0 = peg$parse_45subexpression(); | ||
| return s0; | ||
| } | ||
| function peg$parse_45subexpression() { | ||
| var s0, s1, s2, s3, s4, s5, s6; | ||
| s0 = peg$currPos; | ||
| s1 = peg$parse_1start(); | ||
| if (s1 !== peg$FAILED) { | ||
| s2 = peg$currPos; | ||
| s3 = peg$currPos; | ||
| s4 = peg$parse_45OPEN_PAREN(); | ||
| if (s4 !== peg$FAILED) { | ||
| s5 = []; | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| while (s6 !== peg$FAILED) { | ||
| s5.push(s6); | ||
| s6 = peg$parse_45inParensChar(); | ||
| if (s6 === peg$FAILED) { | ||
| s6 = peg$parse_45subexpression(); | ||
| } | ||
| } | ||
| if (s5 !== peg$FAILED) { | ||
| s6 = peg$parse_45CLOSE_PAREN(); | ||
| if (s6 !== peg$FAILED) { | ||
| s4 = [s4, s5, s6]; | ||
| s3 = s4; | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s3; | ||
| s3 = peg$c4; | ||
| } | ||
| if (s3 !== peg$FAILED) { | ||
| s3 = input.substring(s2, peg$currPos); | ||
| } | ||
| s2 = s3; | ||
| if (s2 !== peg$FAILED) { | ||
| s3 = peg$parse_1start(); | ||
| if (s3 !== peg$FAILED) { | ||
| peg$reportedPos = s0; | ||
| s1 = peg$c5(s2); | ||
| s0 = s1; | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| } else { | ||
| peg$currPos = s0; | ||
| s0 = peg$c4; | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45inParensChar() { | ||
| var s0; | ||
| if (peg$c6.test(input.charAt(peg$currPos))) { | ||
| s0 = input.charAt(peg$currPos); | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45OPEN_PAREN() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 40) { | ||
| s0 = peg$c8; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
| } | ||
| return s0; | ||
| } | ||
| function peg$parse_45CLOSE_PAREN() { | ||
| var s0; | ||
| if (input.charCodeAt(peg$currPos) === 41) { | ||
| s0 = peg$c10; | ||
| peg$currPos++; | ||
| } else { | ||
| s0 = peg$FAILED; | ||
| if (peg$silentFails === 0) { peg$fail(peg$c11); } | ||
| } | ||
| return s0; | ||
| } | ||
| function prepareMustachValue(content){ | ||
| var parts = content.split(' '), | ||
| first, | ||
| match; | ||
| // check for '!' unbound helper | ||
| first = parts.shift(); | ||
| if (match = first.match(/(.*)!$/)) { | ||
| parts.unshift( match[1] ); | ||
| content = 'unbound ' + parts.join(' '); | ||
| } else { | ||
| parts.unshift(first); | ||
| } | ||
| // check for '?' if helper | ||
| first = parts.shift(); | ||
| if (match = first.match(/(.*)\?$/)) { | ||
| parts.unshift( match[1] ); | ||
| content = 'if ' + parts.join(' '); | ||
| } else { | ||
| parts.unshift(first); | ||
| } | ||
| return content; | ||
| } | ||
| var LINE_SPACE_MODIFIERS = { | ||
| NEWLINE: '`', | ||
| SPACE_AFTER: "'", | ||
| SPACE_BOTH: '"', | ||
| SPACE_BEFORE: "+" | ||
| }; | ||
| function castStringsToTextNodes(possibleStrings) { | ||
| var ret = []; | ||
| var nodes = []; | ||
| var currentString = null; | ||
| var possibleString; | ||
| for(var i=0, l=possibleStrings.length; i<l; i++) { | ||
| possibleString = possibleStrings[i]; | ||
| if (typeof possibleString === 'string') { | ||
| currentString = (currentString || '') + possibleString; | ||
| } else { | ||
| if (currentString) { | ||
| ret.push( textNode(currentString) ); | ||
| currentString = null; | ||
| } | ||
| ret.push( possibleString ); // not a string, it is a node here | ||
| } | ||
| } | ||
| if (currentString) { | ||
| ret.push( textNode(currentString) ); | ||
| } | ||
| return ret; | ||
| } | ||
| function textNode(content){ | ||
| return builder.generateText(content); | ||
| } | ||
| function buildActionEvent(event, actionContent) { | ||
| actionContent.push('on=\"' + event + '\"'); | ||
| return [ | ||
| builder.generateMustache(actionContent.join(' ')) | ||
| ]; | ||
| } | ||
| function isAliasEvent(event) { | ||
| return !!events.ALIAS_EVENTS[event]; | ||
| } | ||
| peg$result = peg$startRuleFunction(); | ||
| if (peg$result !== peg$FAILED && peg$currPos === input.length) { | ||
| return peg$result; | ||
| } else { | ||
| if (peg$result !== peg$FAILED && peg$currPos < input.length) { | ||
| peg$fail({ type: "end", description: "end of input" }); | ||
| } | ||
| throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); | ||
| } | ||
| } | ||
| return { | ||
| SyntaxError: SyntaxError, | ||
| parse: parse | ||
| }; | ||
| })(); | ||
| var parse = Parser.parse, ParserSyntaxError = Parser.SyntaxError; | ||
| exports['default'] = parse; | ||
| exports.ParserSyntaxError = ParserSyntaxError; | ||
| exports.parse = parse; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
3666793
1.5%22
4.76%85
-2.3%112807
-2.79%