diff options
author | tomhuda <tomhuda@strobecorp.com> | 2011-06-01 22:57:22 -0700 |
---|---|---|
committer | tomhuda <tomhuda@strobecorp.com> | 2011-06-01 22:57:22 -0700 |
commit | 1482f1ae72b6bc6fec45e22b0ba87ff452a72c3a (patch) | |
tree | 7e9f079c4a90f95093e09c5ab67953060d2c82bf /lib/handlebars | |
parent | 0f78345d0c3399edd27b897485c7f190fe4e8bf6 (diff) | |
download | handlebars.js-1482f1ae72b6bc6fec45e22b0ba87ff452a72c3a.zip handlebars.js-1482f1ae72b6bc6fec45e22b0ba87ff452a72c3a.tar.gz handlebars.js-1482f1ae72b6bc6fec45e22b0ba87ff452a72c3a.tar.bz2 |
Add BOOLEAN support
Diffstat (limited to 'lib/handlebars')
-rw-r--r-- | lib/handlebars/ast.js | 5 | ||||
-rw-r--r-- | lib/handlebars/compiler.js | 4 | ||||
-rw-r--r-- | lib/handlebars/printer.js | 4 |
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/handlebars/ast.js b/lib/handlebars/ast.js index 86960ab..1002bd5 100644 --- a/lib/handlebars/ast.js +++ b/lib/handlebars/ast.js @@ -88,6 +88,11 @@ var Handlebars = require("handlebars"); this.integer = integer; }; + Handlebars.AST.BooleanNode = function(boolean) { + this.type = "BOOLEAN"; + this.boolean = boolean; + }; + Handlebars.AST.CommentNode = function(comment) { this.type = "comment"; this.comment = comment; diff --git a/lib/handlebars/compiler.js b/lib/handlebars/compiler.js index d66b1db..42e5c2c 100644 --- a/lib/handlebars/compiler.js +++ b/lib/handlebars/compiler.js @@ -228,6 +228,10 @@ Handlebars.JavaScriptCompiler = function() {}; this.opcode('push', integer.integer); }, + BOOLEAN: function(boolean) { + this.opcode('push', boolean.boolean); + }, + comment: function() {}, // HELPERS diff --git a/lib/handlebars/printer.js b/lib/handlebars/printer.js index 6388f01..ff3f038 100644 --- a/lib/handlebars/printer.js +++ b/lib/handlebars/printer.js @@ -113,6 +113,10 @@ Handlebars.PrintVisitor.prototype.INTEGER = function(integer) { return "INTEGER{" + integer.integer + "}"; } +Handlebars.PrintVisitor.prototype.BOOLEAN = function(boolean) { + return "BOOLEAN{" + boolean.boolean + "}"; +} + Handlebars.PrintVisitor.prototype.ID = function(id) { var path = id.parts.join("/"); if(id.parts.length > 1) { |