Simplify inverse only block case

This commit is contained in:
kpdecker
2013-07-30 11:08:46 -05:00
parent 9ca4f9c606
commit 4f5c05ffe9
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -205,7 +205,7 @@ case 4:this.$ = new yy.ProgramNode($$[$0-1], []);
break;
case 5:this.$ = new yy.ProgramNode($$[$0]);
break;
case 6:this.$ = new yy.ProgramNode([], []);
case 6:this.$ = new yy.ProgramNode([]);
break;
case 7:this.$ = new yy.ProgramNode([]);
break;
+2 -2
View File
@@ -108,11 +108,11 @@ describe('parser', function() {
});
it('parses empty blocks with empty inverse section', function() {
ast_for("{{#foo}}{{^}}{{/foo}}").should.equal("BLOCK:\n {{ ID:foo [] }}\n PROGRAM:\n {{^}}\n");
ast_for("{{#foo}}{{^}}{{/foo}}").should.equal("BLOCK:\n {{ ID:foo [] }}\n PROGRAM:\n");
});
it('parses empty blocks with empty inverse (else-style) section', function() {
ast_for("{{#foo}}{{else}}{{/foo}}").should.equal("BLOCK:\n {{ ID:foo [] }}\n PROGRAM:\n {{^}}\n");
ast_for("{{#foo}}{{else}}{{/foo}}").should.equal("BLOCK:\n {{ ID:foo [] }}\n PROGRAM:\n");
});
it('parses non-empty blocks with empty inverse section', function() {
+1 -1
View File
@@ -13,7 +13,7 @@ program
| statements simpleInverse statements -> new yy.ProgramNode($1, $3)
| statements simpleInverse -> new yy.ProgramNode($1, [])
| statements -> new yy.ProgramNode($1)
| simpleInverse -> new yy.ProgramNode([], [])
| simpleInverse -> new yy.ProgramNode([])
| "" -> new yy.ProgramNode([])
;