summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Marcotte <dmarcotte@gmail.com>2012-12-11 09:47:49 -0800
committerDaniel Marcotte <dmarcotte@gmail.com>2012-12-11 09:47:49 -0800
commit4cfda479fa0cf801d37cb01201a1a81ea88c6f84 (patch)
tree2c9423cdde540dc61aeeccdf9e63af2187aaa12b /src
parentbd0490145438e8f9df05abd2f4c25687bac81326 (diff)
downloadhandlebars.js-4cfda479fa0cf801d37cb01201a1a81ea88c6f84.zip
handlebars.js-4cfda479fa0cf801d37cb01201a1a81ea88c6f84.tar.gz
handlebars.js-4cfda479fa0cf801d37cb01201a1a81ea88c6f84.tar.bz2
Allow empty blocks around simple inverses
Previously, the parser required at least one character of whitespace to properly interpret empty blocks around simple inverses, which was non-intuitive and inconsistent with empty block parsing. Update the parser to allow empty blocks around simple inverses.
Diffstat (limited to 'src')
-rw-r--r--src/handlebars.yy5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/handlebars.yy b/src/handlebars.yy
index 70b7777..30e3e7c 100644
--- a/src/handlebars.yy
+++ b/src/handlebars.yy
@@ -7,8 +7,11 @@ root
;
program
- : statements simpleInverse statements { $$ = new yy.ProgramNode($1, $3); }
+ : simpleInverse statements { $$ = new yy.ProgramNode([], $2); }
+ | statements simpleInverse statements { $$ = new yy.ProgramNode($1, $3); }
+ | statements simpleInverse { $$ = new yy.ProgramNode($1, []); }
| statements { $$ = new yy.ProgramNode($1); }
+ | simpleInverse { $$ = new yy.ProgramNode([], []); }
| "" { $$ = new yy.ProgramNode([]); }
;