diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-12-14 20:21:03 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-12-14 20:21:03 -0800 |
| commit | 4fe63f253f58f87ab986fea38902d95f2a5ea338 (patch) | |
| tree | 12094f1c69b8ab375eb17507c959c43f9295c6c2 /tools/repl.nom | |
| parent | 6abec65843f0f37f7fc6032ac5db0fff3db71815 (diff) | |
Auto-updated to version 5
Diffstat (limited to 'tools/repl.nom')
| -rw-r--r-- | tools/repl.nom | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/tools/repl.nom b/tools/repl.nom index 8f9d013..3f1eff3 100644 --- a/tools/repl.nom +++ b/tools/repl.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.12.12.8 +#!/usr/bin/env nomsu -V5.12.12.8 # This file defines a Read-Evaluate-Print-Loop (REPL) for Nomsu @@ -9,53 +9,53 @@ use "lib/os.nom" externally [quit, exit] all mean: lua> "os.exit(0)" externally (help) means: - say "\ - ..This is the Nomsu v\(Nomsu version) interactive console. + say " + This is the Nomsu v\(Nomsu version) interactive console. You can type in Nomsu code here and hit 'enter' twice to run it. To exit, type 'exit' or 'quit' and hit enter twice." -say "\ - .. +say " + \(bright)\(underscore)Welcome to the Nomsu v\(Nomsu version) interactive console!\(reset color) press 'enter' twice to run a command " repeat: say (bright (yellow ">> ")) inline - %buff = [] + $buff = [] repeat: say (bright) inline - %line = (%io.read "*L") + $line = ($io.read "*L") say (reset color) inline - if ((%line == "\n") or (not %line)): - if ((size of %buff) > 0): + if (($line == "\n") or (not $line)): + if ((size of $buff) > 0): # clear the line say "\027[1A\027[2K" inline go to (run buffer) - %buff::add (%line::with "\t" -> " ") + $buff|add ($line|with "\t" -> " ") say (dim (yellow ".. ")) inline --- (run buffer) --- - if ((size of %buff) == 0): stop - %buff = (%buff::joined) + if ((size of $buff) == 0): stop + $buff = ($buff|joined) # TODO: support local variables - spoof file %buff + spoof file $buff try: - %ret = (run %buff) - ..and if it barfs %err: say %err + $ret = (run $buff) + ..and if it barfs $err: say $err ..or if it succeeds: - if (type of %ret) is: + if (type of $ret) is: "nil": do nothing "boolean": - say "= \("yes" if %ret else "no")" + say "= \("yes" if $ret else "no")" "table": - if %ret.as_nomsu: - say "= \(%ret::as nomsu)" + if $ret.as_nomsu: + say "= \($ret|as nomsu)" ..else: - say "= \%ret" + say "= \$ret" else: - say "= \%ret" + say "= \$ret" |
