forth: Add . interop special operator and tests
[jackhill/mal.git] / js / step0_repl.js
index 1d2bbfb..f9fa60e 100644 (file)
@@ -20,14 +20,8 @@ function PRINT(exp) {
 // 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> ");
@@ -40,6 +34,4 @@ if (typeof require === 'undefined') {
             else           { printer.println(exc); }
         }
     }
-} else {
-    exports.rep = rep;
 }