diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/handlebars.l | 9 | ||||
-rw-r--r-- | src/handlebars.yy | 8 |
2 files changed, 4 insertions, 13 deletions
diff --git a/src/handlebars.l b/src/handlebars.l index 006f2c7..f775cc4 100644 --- a/src/handlebars.l +++ b/src/handlebars.l @@ -28,7 +28,7 @@ ID [^\s!"#%-,\.\/;->@\[-\^`\{-~]+/{LOOKAHEAD} %% -[^\x00]*?/("{{") { +[^\x00\n]*?\n?/("{{") { if(yytext.slice(-2) === "\\\\") { strip(0,1); this.begin("mu"); @@ -41,7 +41,7 @@ ID [^\s!"#%-,\.\/;->@\[-\^`\{-~]+/{LOOKAHEAD} if(yytext) return 'CONTENT'; } -[^\x00]+ return 'CONTENT'; +([^\x00\n]+\n?|\n) return 'CONTENT'; // marks CONTENT up to the next mustache or escaped mustache <emu>[^\x00]{2,}?/("{{"|"\\{{"|"\\\\{{"|<<EOF>>) { @@ -67,11 +67,6 @@ ID [^\s!"#%-,\.\/;->@\[-\^`\{-~]+/{LOOKAHEAD} this.begin('raw'); return 'CLOSE_RAW_BLOCK'; } -<mu>"{{{{"[^\x00]*"}}}}" { - yytext = yytext.substr(4, yyleng-8); - this.popState(); - return 'RAW_BLOCK'; - } <mu>"{{"{LEFT_STRIP}?">" return 'OPEN_PARTIAL'; <mu>"{{"{LEFT_STRIP}?"#" return 'OPEN_BLOCK'; <mu>"{{"{LEFT_STRIP}?"/" return 'OPEN_ENDBLOCK'; diff --git a/src/handlebars.yy b/src/handlebars.yy index 112c1ad..a8d288f 100644 --- a/src/handlebars.yy +++ b/src/handlebars.yy @@ -5,11 +5,11 @@ %% root - : program EOF { return $1; } + : program EOF { yy.prepareProgram($1.statements, true); return $1; } ; program - : statement* -> new yy.ProgramNode($1, {}, @$) + : statement* -> new yy.ProgramNode(yy.prepareProgram($1), {}, @$) ; statement @@ -62,10 +62,6 @@ partial | OPEN_PARTIAL partialName hash? CLOSE -> new yy.PartialNode($2, undefined, $3, yy.stripFlags($1, $4), @$) ; -simpleInverse - : INVERSE -> yy.stripFlags($1, $1) - ; - sexpr : path param* hash? -> new yy.SexprNode([$1].concat($2), $3, @$) | dataName -> new yy.SexprNode([$1], null, @$) |