react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / handlebars / dist / amd / handlebars / compiler / ast.js
80738 viewsdefine(1["exports"],2function(__exports__) {3"use strict";4var AST = {5Program: function(statements, blockParams, strip, locInfo) {6this.loc = locInfo;7this.type = 'Program';8this.body = statements;910this.blockParams = blockParams;11this.strip = strip;12},1314MustacheStatement: function(path, params, hash, escaped, strip, locInfo) {15this.loc = locInfo;16this.type = 'MustacheStatement';1718this.path = path;19this.params = params || [];20this.hash = hash;21this.escaped = escaped;2223this.strip = strip;24},2526BlockStatement: function(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) {27this.loc = locInfo;28this.type = 'BlockStatement';2930this.path = path;31this.params = params || [];32this.hash = hash;33this.program = program;34this.inverse = inverse;3536this.openStrip = openStrip;37this.inverseStrip = inverseStrip;38this.closeStrip = closeStrip;39},4041PartialStatement: function(name, params, hash, strip, locInfo) {42this.loc = locInfo;43this.type = 'PartialStatement';4445this.name = name;46this.params = params || [];47this.hash = hash;4849this.indent = '';50this.strip = strip;51},5253ContentStatement: function(string, locInfo) {54this.loc = locInfo;55this.type = 'ContentStatement';56this.original = this.value = string;57},5859CommentStatement: function(comment, strip, locInfo) {60this.loc = locInfo;61this.type = 'CommentStatement';62this.value = comment;6364this.strip = strip;65},6667SubExpression: function(path, params, hash, locInfo) {68this.loc = locInfo;6970this.type = 'SubExpression';71this.path = path;72this.params = params || [];73this.hash = hash;74},7576PathExpression: function(data, depth, parts, original, locInfo) {77this.loc = locInfo;78this.type = 'PathExpression';7980this.data = data;81this.original = original;82this.parts = parts;83this.depth = depth;84},8586StringLiteral: function(string, locInfo) {87this.loc = locInfo;88this.type = 'StringLiteral';89this.original =90this.value = string;91},9293NumberLiteral: function(number, locInfo) {94this.loc = locInfo;95this.type = 'NumberLiteral';96this.original =97this.value = Number(number);98},99100BooleanLiteral: function(bool, locInfo) {101this.loc = locInfo;102this.type = 'BooleanLiteral';103this.original =104this.value = bool === 'true';105},106107Hash: function(pairs, locInfo) {108this.loc = locInfo;109this.type = 'Hash';110this.pairs = pairs;111},112HashPair: function(key, value, locInfo) {113this.loc = locInfo;114this.type = 'HashPair';115this.key = key;116this.value = value;117},118119// Public API used to evaluate derived attributes regarding AST nodes120helpers: {121// a mustache is definitely a helper if:122// * it is an eligible helper, and123// * it has at least one parameter or hash segment124// TODO: Make these public utility methods125helperExpression: function(node) {126return !!(node.type === 'SubExpression' || node.params.length || node.hash);127},128129scopedId: function(path) {130return (/^\.|this\b/).test(path.original);131},132133// an ID is simple if it only has one part, and that part is not134// `..` or `this`.135simpleId: function(path) {136return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;137}138}139};140141142// Must be exported as an object rather than the root of the module as the jison lexer143// must modify the object to operate properly.144__exports__["default"] = AST;145});146147