react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / handlebars / lib / handlebars / compiler / ast.js
80713 viewsvar AST = {1Program: function(statements, blockParams, strip, locInfo) {2this.loc = locInfo;3this.type = 'Program';4this.body = statements;56this.blockParams = blockParams;7this.strip = strip;8},910MustacheStatement: function(path, params, hash, escaped, strip, locInfo) {11this.loc = locInfo;12this.type = 'MustacheStatement';1314this.path = path;15this.params = params || [];16this.hash = hash;17this.escaped = escaped;1819this.strip = strip;20},2122BlockStatement: function(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) {23this.loc = locInfo;24this.type = 'BlockStatement';2526this.path = path;27this.params = params || [];28this.hash = hash;29this.program = program;30this.inverse = inverse;3132this.openStrip = openStrip;33this.inverseStrip = inverseStrip;34this.closeStrip = closeStrip;35},3637PartialStatement: function(name, params, hash, strip, locInfo) {38this.loc = locInfo;39this.type = 'PartialStatement';4041this.name = name;42this.params = params || [];43this.hash = hash;4445this.indent = '';46this.strip = strip;47},4849ContentStatement: function(string, locInfo) {50this.loc = locInfo;51this.type = 'ContentStatement';52this.original = this.value = string;53},5455CommentStatement: function(comment, strip, locInfo) {56this.loc = locInfo;57this.type = 'CommentStatement';58this.value = comment;5960this.strip = strip;61},6263SubExpression: function(path, params, hash, locInfo) {64this.loc = locInfo;6566this.type = 'SubExpression';67this.path = path;68this.params = params || [];69this.hash = hash;70},7172PathExpression: function(data, depth, parts, original, locInfo) {73this.loc = locInfo;74this.type = 'PathExpression';7576this.data = data;77this.original = original;78this.parts = parts;79this.depth = depth;80},8182StringLiteral: function(string, locInfo) {83this.loc = locInfo;84this.type = 'StringLiteral';85this.original =86this.value = string;87},8889NumberLiteral: function(number, locInfo) {90this.loc = locInfo;91this.type = 'NumberLiteral';92this.original =93this.value = Number(number);94},9596BooleanLiteral: function(bool, locInfo) {97this.loc = locInfo;98this.type = 'BooleanLiteral';99this.original =100this.value = bool === 'true';101},102103Hash: function(pairs, locInfo) {104this.loc = locInfo;105this.type = 'Hash';106this.pairs = pairs;107},108HashPair: function(key, value, locInfo) {109this.loc = locInfo;110this.type = 'HashPair';111this.key = key;112this.value = value;113},114115// Public API used to evaluate derived attributes regarding AST nodes116helpers: {117// a mustache is definitely a helper if:118// * it is an eligible helper, and119// * it has at least one parameter or hash segment120// TODO: Make these public utility methods121helperExpression: function(node) {122return !!(node.type === 'SubExpression' || node.params.length || node.hash);123},124125scopedId: function(path) {126return (/^\.|this\b/).test(path.original);127},128129// an ID is simple if it only has one part, and that part is not130// `..` or `this`.131simpleId: function(path) {132return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;133}134}135};136137138// Must be exported as an object rather than the root of the module as the jison lexer139// must modify the object to operate properly.140export default AST;141142143