react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / handlebars / dist / cjs / handlebars / compiler / ast.js
80728 views"use strict";1var AST = {2Program: function(statements, blockParams, strip, locInfo) {3this.loc = locInfo;4this.type = 'Program';5this.body = statements;67this.blockParams = blockParams;8this.strip = strip;9},1011MustacheStatement: function(path, params, hash, escaped, strip, locInfo) {12this.loc = locInfo;13this.type = 'MustacheStatement';1415this.path = path;16this.params = params || [];17this.hash = hash;18this.escaped = escaped;1920this.strip = strip;21},2223BlockStatement: function(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) {24this.loc = locInfo;25this.type = 'BlockStatement';2627this.path = path;28this.params = params || [];29this.hash = hash;30this.program = program;31this.inverse = inverse;3233this.openStrip = openStrip;34this.inverseStrip = inverseStrip;35this.closeStrip = closeStrip;36},3738PartialStatement: function(name, params, hash, strip, locInfo) {39this.loc = locInfo;40this.type = 'PartialStatement';4142this.name = name;43this.params = params || [];44this.hash = hash;4546this.indent = '';47this.strip = strip;48},4950ContentStatement: function(string, locInfo) {51this.loc = locInfo;52this.type = 'ContentStatement';53this.original = this.value = string;54},5556CommentStatement: function(comment, strip, locInfo) {57this.loc = locInfo;58this.type = 'CommentStatement';59this.value = comment;6061this.strip = strip;62},6364SubExpression: function(path, params, hash, locInfo) {65this.loc = locInfo;6667this.type = 'SubExpression';68this.path = path;69this.params = params || [];70this.hash = hash;71},7273PathExpression: function(data, depth, parts, original, locInfo) {74this.loc = locInfo;75this.type = 'PathExpression';7677this.data = data;78this.original = original;79this.parts = parts;80this.depth = depth;81},8283StringLiteral: function(string, locInfo) {84this.loc = locInfo;85this.type = 'StringLiteral';86this.original =87this.value = string;88},8990NumberLiteral: function(number, locInfo) {91this.loc = locInfo;92this.type = 'NumberLiteral';93this.original =94this.value = Number(number);95},9697BooleanLiteral: function(bool, locInfo) {98this.loc = locInfo;99this.type = 'BooleanLiteral';100this.original =101this.value = bool === 'true';102},103104Hash: function(pairs, locInfo) {105this.loc = locInfo;106this.type = 'Hash';107this.pairs = pairs;108},109HashPair: function(key, value, locInfo) {110this.loc = locInfo;111this.type = 'HashPair';112this.key = key;113this.value = value;114},115116// Public API used to evaluate derived attributes regarding AST nodes117helpers: {118// a mustache is definitely a helper if:119// * it is an eligible helper, and120// * it has at least one parameter or hash segment121// TODO: Make these public utility methods122helperExpression: function(node) {123return !!(node.type === 'SubExpression' || node.params.length || node.hash);124},125126scopedId: function(path) {127return (/^\.|this\b/).test(path.original);128},129130// an ID is simple if it only has one part, and that part is not131// `..` or `this`.132simpleId: function(path) {133return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;134}135}136};137138139// Must be exported as an object rather than the root of the module as the jison lexer140// must modify the object to operate properly.141exports["default"] = AST;142143