lib/xjs.js
function interpret(source) {
  var tree = parser.parse(source);
  var js = [
    'module.exports = function (out, globals) {',
    '  var end = false;',
    '  if (Object.getPrototypeOf(out) !== module.xjs.XjsStream.prototype) {',
    '    out = new module.xjs.XjsStream(out);',
    '    end = true;',
    '  }',
    '  if (globals && typeof globals.length === "number" && typeof globals !== "string") {',
    '    var callee = arguments.callee;',
    '    for (var i in globals) {',
    '      callee.call(this, out, globals[i]);',
    '    }',
    '    return;',
    '  }',
    '  globals = globals || {};',
    '  with (globals) {'
  ];
  interpretChildren(js, tree, '    ');
  js.push(
    '  }',
    '  if (end) {',
    '    out.end();',
    '  }',
    '}'
  );
  js = js.join('\n');
  return js;
}
function interpret(source) {
  var tree = parser.parse(source);
  var js = [
    'module.exports = function (out, globals) {',
    '  var end = false;',
    '  if (Object.getPrototypeOf(out) !== module.xjs.XjsStream.prototype) {',
    '    out = new module.xjs.XjsStream(out);',
    '    end = true;',
    '  }',
    '  if (globals && typeof globals.length === "number" && typeof globals !== "string") {',
    '    var callee = arguments.callee;',
    '    for (var i in globals) {',
    '      callee.call(this, out, globals[i]);',
    '    }',
    '    return;',
    '  }',
    '  globals = globals || {};',
    '  with (globals) {'
  ];
  interpretChildren(js, tree, '    ');
  js.push(
    '  }',
    '  if (end) {',
    '    out.end();',
    '  }',
    '}'
  );
  js = js.join('\n');
  return js;
}
function interpret ( source ) { var tree = parser . parse ( source ) ; var js = [ 'module.exports = function (out, globals) {' , '  var end = false;' , '  if (Object.getPrototypeOf(out) !== module.xjs.XjsStream.prototype) {' , '    out = new module.xjs.XjsStream(out);' , '    end = true;' , '  }' , '  if (globals && typeof globals.length === "number" && typeof globals !== "string") {' , '    var callee = arguments.callee;' , '    for (var i in globals) {' , '      callee.call(this, out, globals[i]);' , '    }' , '    return;' , '  }' , '  globals = globals || {};' , '  with (globals) {' ] ; interpretChildren ( js , tree , '    ' ) ; js . push ( '  }' , '  if (end) {' , '    out.end();' , '  }' , '}' ) ; js = js . join ( '\n' ) ; return js ; }
Convert xjs source into javascript.
Convert xjs source into javascript .