Simplify inverse only block case
This commit is contained in:
Vendored
+1
-1
@@ -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
@@ -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
@@ -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([])
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user