biofriction-wp-theme/node_modules/handlebars/dist/amd/handlebars/compiler/base.js

46 lines
3.4 KiB
JavaScript

define(['exports', './parser', './whitespace-control', './helpers', '../utils'], function (exports, _parser, _whitespaceControl, _helpers, _utils) {
'use strict';
exports.__esModule = true;
exports.parseWithoutProcessing = parseWithoutProcessing;
exports.parse = parse;
// istanbul ignore next
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _parser2 = _interopRequireDefault(_parser);
var _WhitespaceControl = _interopRequireDefault(_whitespaceControl);
exports.parser = _parser2['default'];
var yy = {};
_utils.extend(yy, _helpers);
function parseWithoutProcessing(input, options) {
// Just return if an already-compiled AST was passed in.
if (input.type === 'Program') {
return input;
}
_parser2['default'].yy = yy;
// Altering the shared object here, but this is ok as parser is a sync operation
yy.locInfo = function (locInfo) {
return new yy.SourceLocation(options && options.srcName, locInfo);
};
var ast = _parser2['default'].parse(input);
return ast;
}
function parse(input, options) {
var ast = parseWithoutProcessing(input, options);
var strip = new _WhitespaceControl['default'](options);
return strip.accept(ast);
}
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2NvbXBpbGVyL2Jhc2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7VUFLUyxNQUFNOztBQUVmLE1BQUksRUFBRSxHQUFHLEVBQUUsQ0FBQztBQUNaLFNBTFMsTUFBTSxDQUtSLEVBQUUsV0FBVSxDQUFDOztBQUViLFdBQVMsc0JBQXNCLENBQUMsS0FBSyxFQUFFLE9BQU8sRUFBRTs7QUFFckQsUUFBSSxLQUFLLENBQUMsSUFBSSxLQUFLLFNBQVMsRUFBRTtBQUM1QixhQUFPLEtBQUssQ0FBQztLQUNkOztBQUVELHdCQUFPLEVBQUUsR0FBRyxFQUFFLENBQUM7OztBQUdmLE1BQUUsQ0FBQyxP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