diff options
author | Marcio Junior <marciojunior_eu@yahoo.com.br> | 2015-02-07 02:48:52 -0200 |
---|---|---|
committer | Marcio Junior <marciojunior_eu@yahoo.com.br> | 2015-02-08 19:31:38 -0200 |
commit | f857471cc8dd8dca301cd78bfef03bd774b5d4c2 (patch) | |
tree | 77abc9c6be9b3d1aada850efe0a23a0d98acd2a5 | |
parent | fd8484798c9bb001a5bcaf205252779ac24d5c23 (diff) | |
download | handlebars.js-f857471cc8dd8dca301cd78bfef03bd774b5d4c2.zip handlebars.js-f857471cc8dd8dca301cd78bfef03bd774b5d4c2.tar.gz handlebars.js-f857471cc8dd8dca301cd78bfef03bd774b5d4c2.tar.bz2 |
Boolean literals can be passed to mustaches
-rw-r--r-- | spec/parser.js | 4 | ||||
-rw-r--r-- | src/handlebars.yy | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/spec/parser.js b/spec/parser.js index 73bff27..3d3dccf 100644 --- a/spec/parser.js +++ b/spec/parser.js @@ -10,6 +10,10 @@ describe('parser', function() { } it('parses simple mustaches', function() { + equals(ast_for('{{123}}'), "{{ NUMBER{123} [] }}\n"); + equals(ast_for('{{"foo"}}'), '{{ "foo" [] }}\n'); + equals(ast_for('{{false}}'), '{{ BOOLEAN{false} [] }}\n'); + equals(ast_for('{{true}}'), '{{ BOOLEAN{true} [] }}\n'); equals(ast_for('{{foo}}'), "{{ PATH:foo [] }}\n"); equals(ast_for('{{foo?}}'), "{{ PATH:foo? [] }}\n"); equals(ast_for('{{foo_}}'), "{{ PATH:foo_ [] }}\n"); diff --git a/src/handlebars.yy b/src/handlebars.yy index 39f8027..7de04dd 100644 --- a/src/handlebars.yy +++ b/src/handlebars.yy @@ -110,6 +110,7 @@ helperName | dataName -> $1 | STRING -> new yy.StringLiteral($1, yy.locInfo(@$)), yy.locInfo(@$) | NUMBER -> new yy.NumberLiteral($1, yy.locInfo(@$)) + | BOOLEAN -> new yy.BooleanLiteral($1, yy.locInfo(@$)) ; partialName |