aboutsummaryrefslogtreecommitdiff
path: root/tools/repl.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-11 15:50:46 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-11-11 15:50:46 -0800
commit4efe44ed271aeed8e25e909344788d92a0d9f82b (patch)
tree73766440b53031d4fc8210dbe3b0aece47e6b852 /tools/repl.nom
parentba03cb67c3c8ba53451eba25dd2186f095cd1db2 (diff)
Fully upgraded to 4.10.12.7, including deprecating the old list/dict
comprehension methods, in favor of the new native support.
Diffstat (limited to 'tools/repl.nom')
-rw-r--r--tools/repl.nom22
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/repl.nom b/tools/repl.nom
index 00efd77..9d9e88d 100644
--- a/tools/repl.nom
+++ b/tools/repl.nom
@@ -1,12 +1,13 @@
-#!/usr/bin/env nomsu -V4
+#!/usr/bin/env nomsu -V4.10.12.7
use "lib/consolecolor.nom"
use "lib/os.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-[quit, exit] all mean: lua> "os.exit(0)"
+externally [quit, exit] all mean:
+ lua> "os.exit(0)"
-(help) means:
+externally (help) means:
say "\
..This is the Nomsu v\(Nomsu version) interactive console.
You can type in Nomsu code here and hit 'enter' twice to run it.
@@ -15,7 +16,7 @@ use "lib/os.nom"
say "\
..
\(bright)\(underscore)Welcome to the Nomsu v\(Nomsu version) interactive console!\(reset color)
- press 'enter' twice to run a command
+ press 'enter' twice to run a command
"
%repl_line = 0
@@ -33,29 +34,28 @@ repeat:
go to (run buffer)
%buff::add (%line::with "\t" -> " ")
%io.write (dim (yellow ".. "))
-
=== (run buffer) ===
- if ((size of %buff) == 0):
- stop
-
+ if ((size of %buff) == 0): stop
%buff = (%buff::joined)
-
+
# TODO: support local variables
spoof file %buff
try:
%ret = (run %buff)
- ..and if it barfs %err:
- say %err
+ ..and if it barfs %err: say %err
..or if it succeeds:
if (type of %ret) is:
"nil":
do nothing
+
"boolean":
say "= \("yes" if %ret else "no")"
+
"table":
if %ret.as_nomsu:
say "= \(%ret::as nomsu)"
..else:
say "= \%ret"
+
else:
say "= \%ret"