Parse context sections by line

This commit is contained in:
kpdecker
2014-07-12 18:50:12 -05:00
parent 6efcaaf8d1
commit 4a4dcf1657
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -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);
+2 -2
View File
@@ -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>>) {