Compile the given `str` of pug and return a function body.

@param {String} str
@param {Object} options
@return {Object}
@api private
425316
function compileBody(str, options){
  var debug_sources = {};
  debug_sources[options.filename] = str;
  var dependencies = [];
  var plugins = options.plugins || [];
  var ast = load.string(str, {
    filename: options.filename,
    basedir: options.basedir,
    lex: function (str, options) {
      var lexOptions = {};
      Object.keys(options).forEach(function (key) {
        lexOptions[key] = options[key];
      });
      lexOptions.plugins = plugins.filter(function (plugin) {
        return !!plugin.lex;
      }).map(function (plugin) {
        return plugin.lex;
      });
      var contents = applyPlugins(str, {filename: options.filename}, plugins, 'preLex');
      return applyPlugins(lex(contents, lexOptions), options, plugins, 'postLex');
    },
    parse: function (tokens, options) {
      tokens = tokens.map(function (token) {
        if (token.type === 'path' && path.extname(token.val) === '') {
          return {
            type: 'path',
            loc: token.loc,
            val: token.val + '.pug'
          };
        }
        return token;
      });
      tokens = stripComments(tokens, options);
      tokens = applyPlugins(tokens, options, plugins, 'preParse');
      var parseOptions = {};
      Object.keys(options).forEach(function (key) {
        parseOptions[key] = options[key];
      });
      parseOptions.plugins = plugins.filter(function (plugin) {
        return !!plugin.parse;
      }).map(function (plugin) {
        return plugin.parse;
      });

      return applyPlugins(
        applyPlugins(parse(tokens, parseOptions), options, plugins, 'postParse'),
        options, plugins, 'preLoad'
      );
    },
    resolve: function (filename, source, loadOptions) {
      var replacementFunc = findReplacementFunc(plugins, 'resolve');
      if (replacementFunc) {
        return replacementFunc(filename, source, options);
      }

      return load.resolve(filename, source, loadOptions);
    },
    read: function (filename, loadOptions) {
      dependencies.push(filename);

      var contents;

      var replacementFunc = findReplacementFunc(plugins, 'read');
      if (replacementFunc) {
        contents = replacementFunc(filename, options);
      } else {
        contents = load.read(filename, loadOptions);
      }

      var str = applyPlugins(contents, {filename: filename}, plugins, 'preLex');
      debug_sources[filename] = str;
      return str;
    }
  });
  ast = applyPlugins(ast, options, plugins, 'postLoad');
  ast = applyPlugins(ast, options, plugins, 'preFilters');

  var filtersSet = {};
  Object.keys(exports.filters).forEach(function (key) {
    filtersSet[key] = exports.filters[key];
  });
  if (options.filters) {
    Object.keys(options.filters).forEach(function (key) {
      filtersSet[key] = options.filters[key];
    });
  }
  ast = filters.handleFilters(ast, filtersSet, options.filterOptions, options.filterAliases);

  ast = applyPlugins(ast, options, plugins, 'postFilters');
  ast = applyPlugins(ast, options, plugins, 'preLink');
  ast = link(ast);
  ast = applyPlugins(ast, options, plugins, 'postLink');

  // Compile
  ast = applyPlugins(ast, options, plugins, 'preCodeGen');
  var js = generateCode(ast, {
    pretty: options.pretty,
    compileDebug: options.compileDebug,
    doctype: options.doctype,
    inlineRuntimeFunctions: options.inlineRuntimeFunctions,
    globals: options.globals,
    self: options.self,
    includeSources: options.includeSources ? debug_sources : false,
    templateName: options.templateName
  });
  js = applyPlugins(js, options, plugins, 'postCodeGen');
  // Debug compiler
  if (options.debug) {
    console.error('\nCompiled Function:\n\n\u001b[90m%s\u001b[0m', js.replace(/^/gm, '  '));
  }

  return {body: js, dependencies: dependencies};
}
603675
function parse(str, options) {
  var obj = options.object || 'obj'
    , space = options.pretty ? 2 : 0
    , space = options.spaces ? options.spaces : space
    , js = str;
  
  return ''
    + 'var ' + obj + ' = factory();\n'
    + (options.self
      ? 'var self = locals || {};\n' + js
      : 'with (locals || {}) {\n' + js + '\n}\n')
    + 'return JSON.stringify(' + obj + ', null, ' +  space + ')';
}
143164
function sync(str, options) {
  var tmpl = this.cache(options) || this.cache(options, this.engine.compile(str, options));
  return tmpl(options);
}
255467
function parseCover(str) {
    str = str.split(EOL);
    var obj = {};
    var reg = /(\w+)\s?:\s?(.+)/;
    str.forEach(function(val) {
        if (val = reg.exec(val)) {
            obj[val[1]] = val[2];
        }
    });
    return obj;
}
882983
function createETagGenerator (options) {
  return function generateETag (body, encoding) {
    var buf = !Buffer.isBuffer(body)
      ? Buffer.from(body, encoding)
      : body

    return etag(buf, options)
  }
}
977145
function compileToken (token, arg) {
  let fn = tokens[token] || noOp

  return function () {
    return arg ? fn.call(this, arg) : fn.call(this)
  }
}
1098138
function parseString(str) {
  var obj = {};
  var pairs = str.split('&');
  var pair;
  var pos;

  for (var i = 0, len = pairs.length; i < len; ++i) {
    pair = pairs[i];
    pos = pair.indexOf('=');
    if (pos == -1) {
      obj[decodeURIComponent(pair)] = '';
    } else {
      obj[decodeURIComponent(pair.slice(0, pos))] =
        decodeURIComponent(pair.slice(pos + 1));
    }
  }

  return obj;
}
519977
function (str) {
    var lit = this.ast_stringify(t.stringLiteral(str));
    var ast = this.ast_buffer(lit);
    return ast;
  }
1161890
function do_js(url, opts) {
	opts = opts || {};
	if(is.object(opts) && is['function'](opts.body)) {
		opts.body = FUNCTION(opts.body).stringify();
	} else if(is.object(opts) && is.string(opts.body)) {
	} else {
		throw new TypeError('opts.body is not function nor string');
	}
	opts.headers = opts.headers || {};
	if(opts.body) {
		opts.headers['Content-Type'] = 'application/javascript;charset=utf8';
	}

	// Default method should be POST since JavaScript code usually might change something.
	if(!opts.method) {
		opts.method = 'post';
	}

	opts.headers.Accept = 'application/json';
	return do_plain(url, opts).then(function(buffer) {
		return JSON.parse(buffer);
	});
}
84677
function parse(str, options) {
  if (typeof str !== 'string') {
    throw new TypeError('argument str must be a string');
  }

  var obj = {}
  var opt = options || {};
  var pairs = str.split(pairSplitRegExp);
  var dec = opt.decode || decode;

  for (var i = 0; i < pairs.length; i++) {
    var pair = pairs[i];
    var eq_idx = pair.indexOf('=');

    // skip things that don't look like key=value
    if (eq_idx < 0) {
      continue;
    }

    var key = pair.substr(0, eq_idx).trim()
    var val = pair.substr(++eq_idx, pair.length).trim();

    // quoted values
    if ('"' == val[0]) {
      val = val.slice(1, -1);
    }

    // only assign once
    if (undefined == obj[key]) {
      obj[key] = tryDecode(val, dec);
    }
  }

  return obj;
}
903624
function (str, parserOptions) {
  parserOptions = parserOptions || {};
  var map = parserOptions.map || identity;
  var loadMethod = parserOptions.loadMethod || 'safeLoad';
  var data = index[loadMethod](str, omit(parserOptions, ['map', 'loadMethod'])) || {};
  return map(data, map);
}
542061
function parse(src, module, makeModule, options) {
		// Find the first valid parser :
		debug('Find a parser for :', module.path)
		var result = _.find(parsers, function(def) {
			// debug('    Check parser match :', def.match)
			if(def.match instanceof RegExp) {
				return def.match.test(module.path);
			} else if ('string'   == typeof def.match) {
				return minimatch(module.path, def.match);
			} else if ('function' == typeof def.match) {
				return def.match(src, module, makeModule, options);
			} else {
				return false;
			}
		});
		if(!result) {
			debug('Warning: No valid parser found for %s. Json string is exported', module.path)
			return 'module.exports = ' + JSON.stringify(src);
		} else {
			debug('Ok parser match :', result.match);
			return result.parse(src, module, makeModule, options);
		}
	}
248054
function compile($str) {
		$fw=$this;
		return preg_replace_callback(
			'/(?<!\w)@(\w(?:[\w\.\[\]\(]|\->|::)*)/',
			function($var) use($fw) {
				return '$'.preg_replace_callback(
					'/\.(\w+)\(|\.(\w+)|\[((?:[^\[\]]*|(?R))*)\]/',
					function($expr) use($fw) {
						return $expr[1]?
							((function_exists($expr[1])?
								('.'.$expr[1]):
								('['.var_export($expr[1],TRUE).']')).'('):
							('['.var_export(
								isset($expr[3])?
									$fw->compile($expr[3]):
									(ctype_digit($expr[2])?
										(int)$expr[2]:
										$expr[2]),TRUE).']');
					},
					$var[1]
				);
			},
			$str
		);
	}
775099
function parseJSON(str) {
                                            var result;
                                            try {
                                                result = $scope.options.parserFn(str);
                                            } catch (e) {
                                                return str;
                                            }
                                            return result;
                                        }
560386
function (str, parserOptions) {
  parserOptions = parserOptions || {};
  // Do a naive test whether this is a string or an object
  var mapFn = parserOptions.map ? str.trim().charAt(0) === '[' ? underscore.map : underscore.mapObject : identity;
  var jsonParser = JSON.parse;
  return mapFn(jsonParser(str, parserOptions.reviver, parserOptions.filename), parserOptions.map);
}
1106328
function Lexer(str, options) {
  options = options || {};
  if (typeof str !== 'string') {
    throw new Error('Expected source code to be a string but got "' + (typeof str) + '"')
  }
  if (typeof options !== 'object') {
    throw new Error('Expected "options" to be an object but got "' + (typeof options) + '"')
  }
  //Strip any UTF-8 BOM off of the start of `str`, if it exists.
  str = str.replace(/^\uFEFF/, '');
  this.input = str.replace(/\r\n|\r/g, '\n');
  this.originalInput = this.input;
  this.filename = options.filename;
  this.interpolated = options.interpolated || false;
  this.lineno = options.startingLine || 1;
  this.colno = options.startingColumn || 1;
  this.plugins = options.plugins || [];
  this.indentStack = [0];
  this.indentRe = null;
  // If #{} or !{} syntax is allowed when adding text
  this.interpolationAllowed = true;

  this.tokens = [];
  this.ended = false;
}
916713
function str2obj(str) {
  if (!str) {
    return {};
  }

  return str.split('&').reduce(function (acc, cur) {
    var _cur$split = cur.split('='),
        _cur$split2 = _slicedToArray(_cur$split, 2),
        k = _cur$split2[0],
        v = _cur$split2[1];

    k = decodeURIComponent(k);
    v = decodeURIComponent(v);
    return _extends({}, acc, _defineProperty({}, k, v));
  }, {});
}