var Handlebars = {}; Handlebars.Exception = require("handlebars/utils").Exception; // BEGIN(BROWSER) (function() { Handlebars.AST = {}; Handlebars.AST.ProgramNode = function(statements, inverse) { this.type = "program"; this.statements = statements; if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); } }; Handlebars.AST.MustacheNode = function(params, unescaped) { this.type = "mustache"; this.id = params[0]; this.params = params.slice(1); this.escaped = !unescaped; }; Handlebars.AST.PartialNode = function(id, context) { this.type = "partial"; // TODO: disallow complex IDs this.id = id; this.context = context; }; var verifyMatch = function(open, close) { if(open.original !== close.original) { throw new Handlebars.Exception(open.original + " doesn't match " + close.original); } }; Handlebars.AST.BlockNode = function(mustache, program, close) { verifyMatch(mustache.id, close); this.type = "block"; this.mustache = mustache; this.program = program; }; Handlebars.AST.InverseNode = function(mustache, program, close) { verifyMatch(mustache.id, close); this.type = "inverse"; this.mustache = mustache; this.program = program; }; Handlebars.AST.ContentNode = function(string) { this.type = "content"; this.string = string; }; Handlebars.AST.IdNode = function(parts) { this.type = "ID"; this.original = parts.join("/"); var dig = [], depth = 0; for(var i=0,l=parts.length; i