aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/autoformat.nom2
-rwxr-xr-xtools/find_action.nom2
-rwxr-xr-xtools/parse.nom2
-rw-r--r--tools/repl.nom61
-rwxr-xr-xtools/replace.nom2
-rwxr-xr-xtools/test.nom2
-rwxr-xr-xtools/upgrade.nom2
7 files changed, 73 insertions, 0 deletions
diff --git a/tools/autoformat.nom b/tools/autoformat.nom
index 13f54ef..fed611d 100755
--- a/tools/autoformat.nom
+++ b/tools/autoformat.nom
@@ -7,6 +7,8 @@
use "lib/os.nom"
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
%args = (command line args)
%inplace = (no)
if (%args.1 is "-i"):
diff --git a/tools/find_action.nom b/tools/find_action.nom
index 02abdbc..04a20e0 100755
--- a/tools/find_action.nom
+++ b/tools/find_action.nom
@@ -7,6 +7,8 @@
use "lib/os.nom"
use "lib/consolecolor.nom"
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
%stub = (command line args).1
say "Looking for stub: \%stub..."
%files = ((command line args).% for % in 2 to (size of (command line args)))
diff --git a/tools/parse.nom b/tools/parse.nom
index de6aff4..1465bb3 100755
--- a/tools/parse.nom
+++ b/tools/parse.nom
@@ -5,6 +5,8 @@
use "lib/os.nom"
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
externally (print tree %t at indent %indent) means:
if %t.type is:
"Action":
diff --git a/tools/repl.nom b/tools/repl.nom
new file mode 100644
index 0000000..00efd77
--- /dev/null
+++ b/tools/repl.nom
@@ -0,0 +1,61 @@
+#!/usr/bin/env nomsu -V4
+use "lib/consolecolor.nom"
+use "lib/os.nom"
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+[quit, exit] all mean: lua> "os.exit(0)"
+
+(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.
+ To exit, type 'exit' or 'quit' and hit enter twice."
+
+say "\
+ ..
+ \(bright)\(underscore)Welcome to the Nomsu v\(Nomsu version) interactive console!\(reset color)
+ press 'enter' twice to run a command
+ "
+
+%repl_line = 0
+repeat:
+ %repl_line += 1
+ %io.write (bright (yellow ">> "))
+ %buff = []
+ repeat:
+ %io.write (bright)
+ %line = (%io.read "*L")
+ %io.write (reset color)
+ if ((%line == "\n") or (not %line)):
+ if ((size of %buff) > 0):
+ %io.write "\027[1A\027[2K"
+ go to (run buffer)
+ %buff::add (%line::with "\t" -> " ")
+ %io.write (dim (yellow ".. "))
+
+ === (run buffer) ===
+ 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
+ ..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"
diff --git a/tools/replace.nom b/tools/replace.nom
index 25ae0ae..a0391d6 100755
--- a/tools/replace.nom
+++ b/tools/replace.nom
@@ -7,6 +7,8 @@
use "lib/os.nom"
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
%args = (command line args)
%inplace = (no)
if (%args.1 is "-i"):
diff --git a/tools/test.nom b/tools/test.nom
index fb70d1c..6e74aa6 100755
--- a/tools/test.nom
+++ b/tools/test.nom
@@ -6,6 +6,8 @@
use "lib/os.nom"
use "lib/consolecolor.nom"
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
%args = (command line args)
if (%args.1 == "-v"):
%args::remove index 1
diff --git a/tools/upgrade.nom b/tools/upgrade.nom
index 575646e..4975aad 100755
--- a/tools/upgrade.nom
+++ b/tools/upgrade.nom
@@ -8,6 +8,8 @@
use "compatibility"
use "lib/os.nom"
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
%args = (command line args)
%inplace = (no)
%start_version = (nil)