// repl
var rep = function(str) { return PRINT(EVAL(READ(str), {})); };
-if (typeof require === 'undefined') {
- // Asynchronous browser mode
- readline.rlwrap(function(line) { return rep(line); },
- function(exc) {
- if (exc.stack) { printer.println(exc.stack); }
- else { printer.println(exc); }
- });
-} else if (require.main === module) {
+// repl loop
+if (typeof require !== 'undefined' && require.main === module) {
// Synchronous node.js commandline mode
while (true) {
var line = readline.readline("user> ");
else { printer.println(exc); }
}
}
-} else {
- exports.rep = rep;
}