diff options
author | kpdecker <kpdecker@gmail.com> | 2014-07-12 18:50:12 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2014-08-12 14:41:58 -0500 |
commit | 4a4dcf16578f28bff42d755da5ece94188f75ba5 (patch) | |
tree | 1d62ca6b313b8251428f5e1b3a25644d9917d33a | |
parent | 6efcaaf8d10b76af2646cbf72200172d42f6772a (diff) | |
download | handlebars.js-4a4dcf16578f28bff42d755da5ece94188f75ba5.zip handlebars.js-4a4dcf16578f28bff42d755da5ece94188f75ba5.tar.gz handlebars.js-4a4dcf16578f28bff42d755da5ece94188f75ba5.tar.bz2 |
Parse context sections by line
-rw-r--r-- | spec/ast.js | 10 | ||||
-rw-r--r-- | src/handlebars.l | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/spec/ast.js b/spec/ast.js index 17a982c..c05e45c 100644 --- a/spec/ast.js +++ b/spec/ast.js @@ -251,22 +251,22 @@ describe('ast', function() { }); it('gets line numbers correct when newlines appear', function(){ - var secondContentNode = statements[2]; - testColumns(secondContentNode, 1, 2, 21, 8); + testColumns(statements[2], 1, 2, 21, 0); + testColumns(statements[3], 2, 2, 0, 8); }); it('gets MustacheNode line numbers correct across newlines', function(){ - var secondMustacheNode = statements[3]; + var secondMustacheNode = statements[4]; testColumns(secondMustacheNode, 2, 2, 8, 22); }); it('gets the block helper information correct', function(){ - var blockHelperNode = statements[5]; + var blockHelperNode = statements[7]; testColumns(blockHelperNode, 3, 7, 8, 23); }); it('correctly records the line numbers of an inverse of a block helper', function(){ - var blockHelperNode = statements[5], + var blockHelperNode = statements[7], inverse = blockHelperNode.inverse; testColumns(inverse, 5, 6, 13, 0); diff --git a/src/handlebars.l b/src/handlebars.l index cafdd72..0a531d5 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>>) { |