diff options
Diffstat (limited to 'lib/handlebars/compiler/ast.js')
-rw-r--r-- | lib/handlebars/compiler/ast.js | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js index fcf5c6e..b61fa0e 100644 --- a/lib/handlebars/compiler/ast.js +++ b/lib/handlebars/compiler/ast.js @@ -1,12 +1,14 @@ -import { Exception } from "handlebars/utils"; +import { Exception } from "../utils"; -export function ProgramNode(statements, inverse) { +var exports = {}; + +exports.ProgramNode = function ProgramNode(statements, inverse) { this.type = "program"; this.statements = statements; - if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); } + if(inverse) { this.inverse = new ProgramNode(inverse); } }; -export function MustacheNode(rawParams, hash, unescaped) { +exports.MustacheNode = function(rawParams, hash, unescaped) { this.type = "mustache"; this.escaped = !unescaped; this.hash = hash; @@ -28,13 +30,13 @@ export function MustacheNode(rawParams, hash, unescaped) { // pass or at runtime. }; -export function PartialNode(partialName, context) { +exports.PartialNode = function(partialName, context) { this.type = "partial"; this.partialName = partialName; this.context = context; }; -export function BlockNode(mustache, program, inverse, close) { +exports.BlockNode = function(mustache, program, inverse, close) { if(mustache.id.original !== close.original) { throw new Exception(mustache.id.original + " doesn't match " + close.original); } @@ -49,17 +51,17 @@ export function BlockNode(mustache, program, inverse, close) { } }; -export function ContentNode(string) { +exports.ContentNode = function(string) { this.type = "content"; this.string = string; }; -export function HashNode(pairs) { +exports.HashNode = function(pairs) { this.type = "hash"; this.pairs = pairs; }; -export function IdNode(part) { +exports.IdNode = function(parts) { this.type = "ID"; var original = "", @@ -90,37 +92,39 @@ export function IdNode(part) { this.stringModeValue = this.string; }; -export function PartialNameNode(name) { +exports.PartialNameNode = function(name) { this.type = "PARTIAL_NAME"; this.name = name.original; }; -export function DataNode(id) { +exports.DataNode = function(id) { this.type = "DATA"; this.id = id; }; -export function StringNode(string) { +exports.StringNode = function(string) { this.type = "STRING"; this.original = this.string = this.stringModeValue = string; }; -export function IntegerNode(integer) { +exports.IntegerNode = function(integer) { this.type = "INTEGER"; this.original = this.integer = integer; this.stringModeValue = Number(integer); }; -export function BooleanNode(bool) { +exports.BooleanNode = function(bool) { this.type = "BOOLEAN"; this.bool = bool; this.stringModeValue = bool === "true"; }; -export function CommentNode(comment) { +exports.CommentNode = function(comment) { this.type = "comment"; this.comment = comment; }; + +export default exports; |