summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/ast.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handlebars/ast.js')
-rw-r--r--lib/handlebars/ast.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/handlebars/ast.js b/lib/handlebars/ast.js
new file mode 100644
index 0000000..d37d378
--- /dev/null
+++ b/lib/handlebars/ast.js
@@ -0,0 +1,53 @@
+var ProgramNode = function(statements, inverse) {
+ this.type = "program";
+ this.statements = statements;
+ this.inverse = inverse;
+};
+
+var MustacheNode = function(params) {
+ this.type = "mustache";
+ this.id = params[0];
+ this.params = params.slice(1);
+};
+
+var PartialNode = function(id) {
+ this.type = "partial";
+ this.id = id;
+};
+
+var BlockNode = function(mustache, program) {
+ this.type = "block";
+ this.mustache = mustache;
+ this.program = program;
+};
+
+var ContentNode = function(string) {
+ this.type = "content";
+ this.string = string;
+}
+
+var IdNode = function(id) {
+ this.type = "ID"
+ this.id = id;
+}
+
+StringNode = function(string) {
+ this.type = "STRING";
+ this.string = string;
+}
+
+CommentNode = function(comment) {
+ this.type = "comment";
+ this.comment = comment;
+}
+
+if(exports) {
+ exports.ProgramNode = ProgramNode;
+ exports.MustacheNode = MustacheNode;
+ exports.ContentNode = ContentNode;
+ exports.IdNode = IdNode;
+ exports.StringNode = StringNode;
+ exports.PartialNode = PartialNode;
+ exports.CommentNode = CommentNode;
+ exports.BlockNode = BlockNode;
+}