nodejs教程之环境安装及运行

2020-06-17 06:45:33易采站长站整理

      i += open.length
 
      var prefix, postfix, line = (compileDebug ? ‘__stack.lineno=’ : ”) + lineno;
      switch (str[i]) {
        case ‘=’:
          prefix = “‘, escape((” + line + ‘, ‘;
          postfix = “)), ‘”;
          ++i;
          break;
        case ‘-‘:
          prefix = “‘, (” + line + ‘, ‘;
          postfix = “), ‘”;
          ++i;
          break;
        default:
          prefix = “‘);” + line + ‘;’;
          postfix = “; buf.push(‘”;
      }

      var end = str.indexOf(close, i)
        , js = str.substring(i, end)
        , start = i
        , include = null
        , n = 0;

      if (‘-‘ == js[js.length-1]){
        js = js.substring(0, js.length – 2);
        consumeEOL = true;
      }

      if (0 == js.trim().indexOf(‘include’)) {
        var name = js.trim().slice(7).trim();
        if (!filename) throw new Error(‘filename option is required for includes’);
        var path = resolveInclude(name, filename);
        include = read(path, ‘utf8’);
        include = exports.parse(include, { filename: path, _with: false, open: open, close: close, compileDebug: compileDebug });
        buf += “‘ + (function(){” + include + “})() + ‘”;
        js = ”;
      }

      while (~(n = js.indexOf(“n”, n))) n++, lineno++;
      if (js.substr(0, 1) == ‘:’) js = filtered(js);