|
@ -3,7 +3,7 @@ |
|
|
|
|
|
|
|
|
var utils = require("utils.js"); |
|
|
var utils = require("utils.js"); |
|
|
|
|
|
|
|
|
puts("Type '.help' for options."); |
|
|
utils.puts("Type '.help' for options."); |
|
|
|
|
|
|
|
|
node.stdio.open(); |
|
|
node.stdio.open(); |
|
|
node.stdio.addListener("data", readline); |
|
|
node.stdio.addListener("data", readline); |
|
@ -54,7 +54,7 @@ function readline (cmd) { |
|
|
} |
|
|
} |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
// On error: Print the error and clear the buffer
|
|
|
// On error: Print the error and clear the buffer
|
|
|
puts('caught an exception: ' + e); |
|
|
utils.puts('caught an exception: ' + e); |
|
|
buffered_cmd = ''; |
|
|
buffered_cmd = ''; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -66,7 +66,7 @@ function readline (cmd) { |
|
|
* Used to display the prompt. |
|
|
* Used to display the prompt. |
|
|
*/ |
|
|
*/ |
|
|
function displayPrompt () { |
|
|
function displayPrompt () { |
|
|
print(buffered_cmd.length ? '... ' : exports.prompt); |
|
|
utils.print(buffered_cmd.length ? '... ' : exports.prompt); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -82,7 +82,7 @@ function parseREPLKeyword (cmd) { |
|
|
displayPrompt(); |
|
|
displayPrompt(); |
|
|
return true; |
|
|
return true; |
|
|
case ".clear": |
|
|
case ".clear": |
|
|
puts("Clearing Scope..."); |
|
|
utils.puts("Clearing Scope..."); |
|
|
buffered_cmd = ''; |
|
|
buffered_cmd = ''; |
|
|
exports.scope = {}; |
|
|
exports.scope = {}; |
|
|
displayPrompt(); |
|
|
displayPrompt(); |
|
@ -91,10 +91,10 @@ function parseREPLKeyword (cmd) { |
|
|
node.stdio.close(); |
|
|
node.stdio.close(); |
|
|
return true; |
|
|
return true; |
|
|
case ".help": |
|
|
case ".help": |
|
|
puts(".break\tSometimes you get stuck in a place you can't get out... This will get you out."); |
|
|
utils.puts(".break\tSometimes you get stuck in a place you can't get out... This will get you out."); |
|
|
puts(".clear\tBreak, and also clear the local scope."); |
|
|
utils.puts(".clear\tBreak, and also clear the local scope."); |
|
|
puts(".exit\tExit the prompt"); |
|
|
utils.puts(".exit\tExit the prompt"); |
|
|
puts(".help\tShow repl options"); |
|
|
utils.puts(".help\tShow repl options"); |
|
|
displayPrompt(); |
|
|
displayPrompt(); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|