summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortomhuda <tomhuda@strobecorp.com>2011-06-01 22:57:22 -0700
committertomhuda <tomhuda@strobecorp.com>2011-06-01 22:57:22 -0700
commit1482f1ae72b6bc6fec45e22b0ba87ff452a72c3a (patch)
tree7e9f079c4a90f95093e09c5ab67953060d2c82bf /src
parent0f78345d0c3399edd27b897485c7f190fe4e8bf6 (diff)
downloadhandlebars.js-1482f1ae72b6bc6fec45e22b0ba87ff452a72c3a.zip
handlebars.js-1482f1ae72b6bc6fec45e22b0ba87ff452a72c3a.tar.gz
handlebars.js-1482f1ae72b6bc6fec45e22b0ba87ff452a72c3a.tar.bz2
Add BOOLEAN support
Diffstat (limited to 'src')
-rw-r--r--src/handlebars.l4
-rw-r--r--src/handlebars.yy2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/handlebars.l b/src/handlebars.l
index 895974a..0d3cdf0 100644
--- a/src/handlebars.l
+++ b/src/handlebars.l
@@ -24,7 +24,9 @@
<mu>"}}}" { this.begin("INITIAL"); return 'CLOSE'; }
<mu>"}}" { this.begin("INITIAL"); return 'CLOSE'; }
<mu>'"'("\\"["]|[^"])*'"' { yytext = yytext.substr(1,yyleng-2).replace(/\\"/g,'"'); return 'STRING'; }
-<mu>[0-9]+/[}\s] { return 'INTEGER' }
+<mu>"true"/[}\s] { return 'BOOLEAN'; }
+<mu>"false"/[}\s] { return 'BOOLEAN'; }
+<mu>[0-9]+/[}\s] { return 'INTEGER'; }
<mu>[a-zA-Z0-9_$-]+/[=}\s/.] { return 'ID'; }
<mu>. { return 'INVALID'; }
diff --git a/src/handlebars.yy b/src/handlebars.yy
index 02f8e21..d3d41df 100644
--- a/src/handlebars.yy
+++ b/src/handlebars.yy
@@ -69,6 +69,7 @@ param
: path { $$ = $1 }
| STRING { $$ = new yy.StringNode($1) }
| INTEGER { $$ = new yy.IntegerNode($1) }
+ | BOOLEAN { $$ = new yy.BooleanNode($1) }
;
hash
@@ -84,6 +85,7 @@ hashSegment
: ID EQUALS path { $$ = [$1, $3] }
| ID EQUALS STRING { $$ = [$1, new yy.StringNode($3)] }
| ID EQUALS INTEGER { $$ = [$1, new yy.IntegerNode($3)] }
+ | ID EQUALS BOOLEAN { $$ = [$1, new yy.BooleanNode($3)] }
;
path