aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-26 16:28:06 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-11-26 16:28:06 -0800
commit5027bd4f0f2c6dcebf667a6924c50b0ca3df235f (patch)
treeda3ed710dcbfc065a24ac3ab0c8b4917a22b6991 /tools
parent8e5f1b9e1e912f781738a564843e024b0e0b2e96 (diff)
Upgraded/autoformatted.
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.nom2
-rwxr-xr-xtools/replace.nom22
-rwxr-xr-xtools/test.nom6
-rwxr-xr-xtools/upgrade.nom2
7 files changed, 16 insertions, 22 deletions
diff --git a/tools/autoformat.nom b/tools/autoformat.nom
index 5661145..44d91e3 100755
--- a/tools/autoformat.nom
+++ b/tools/autoformat.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.11.12.8
+#!/usr/bin/env nomsu -V4.12.12.8
#
Auto-format Nomsu code. Usage:
nomsu tools/autoformat.nom [-i] file1 file2 directory1 ...
diff --git a/tools/find_action.nom b/tools/find_action.nom
index 6b85ad3..bcc80ac 100755
--- a/tools/find_action.nom
+++ b/tools/find_action.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.11.12.8
+#!/usr/bin/env nomsu -V4.12.12.8
#
Find an action by its stub. Usage:
nomsu tools/find_action.nom "foo %" file1 file2 directory1 ...
diff --git a/tools/parse.nom b/tools/parse.nom
index cb367ab..4e61473 100755
--- a/tools/parse.nom
+++ b/tools/parse.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.11.12.8
+#!/usr/bin/env nomsu -V4.12.12.8
#
Tool to print out a parse tree of files in an easy-to-read format. Usage:
nomsu tools/parse.nom file1 file2 directory1 ...
diff --git a/tools/repl.nom b/tools/repl.nom
index ac61242..8f9d013 100644
--- a/tools/repl.nom
+++ b/tools/repl.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.11.12.8
+#!/usr/bin/env nomsu -V4.12.12.8
#
This file defines a Read-Evaluate-Print-Loop (REPL) for Nomsu
diff --git a/tools/replace.nom b/tools/replace.nom
index 66ca690..3ce2411 100755
--- a/tools/replace.nom
+++ b/tools/replace.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.11.12.8
+#!/usr/bin/env nomsu -V4.12.12.8
#
Tool to find and replace one tree with another.
nomsu tools/replace.nom [-i] tree_to_replace replacement file1 file2 directory1 ...
@@ -10,29 +10,25 @@ use "lib/os.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
barf "Deprecated."
-
if ((size of %args.extra_args) < 3):
say "Usage: nomsu tools/replace.nom [-i] tree_to_replace replacement files..."
lua> "os.exit(1)"
-
-%pattern = ((%args.extra_args.1) parsed)
-%replacement = ((%args.extra_args.2) parsed)
+%pattern = (%args.extra_args.1 parsed)
+%replacement = (%args.extra_args.2 parsed)
for %filename in %args.extra_args at %i:
- if (%i < 3): do next %i
+ if (%i < 3):
+ do next %i
%file = (read file %filename)
- unless %file: barf "File does not exist: \%filename"
+ unless %file:
+ barf "File does not exist: \%filename"
%nomsu = (NomsuCode from (Source %filename 1 (size of %file)) %file)
%tree = (%nomsu parsed)
+
# TODO: fix this to use variable substitution
- %tree2 = (..)
- %tree::map (..)
- for %subtree:
- if (%subtree == %pattern):
- return %replacement
+ %tree2 = (%tree::map (for %subtree: if (%subtree == %pattern): return %replacement))
if (%tree2 == %tree):
say "No changes in \%filename"
do next %filename
-
%text = ((%tree2 as nomsu)::text)
when:
%args."-i":
diff --git a/tools/test.nom b/tools/test.nom
index 1fd5ee3..bcbd289 100755
--- a/tools/test.nom
+++ b/tools/test.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.11.12.8
+#!/usr/bin/env nomsu -V4.12.12.8
#
Tool to run all tests in a file (i.e. the code block inside a call to 'test %'). Usage:
nomsu tools/test.nom file1 file2 directory1 ...
@@ -18,9 +18,7 @@ for %filename in (command line args).extra_args:
for %src = %test in %tests:
if (%src.filename == %filename):
if %version:
- %test = "\
- ..#!/usr/bin/env nomsu -V\(%version)
- \%test"
+ %test = "#!/usr/bin/env nomsu -V\%version\n\%test"
%file_tests::add {test: %test, source: %src}
unless (%file_tests is empty):
diff --git a/tools/upgrade.nom b/tools/upgrade.nom
index 781e71b..0512134 100755
--- a/tools/upgrade.nom
+++ b/tools/upgrade.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.11.12.8
+#!/usr/bin/env nomsu -V4.12.12.8
#
Tool to automatically update code from old versions of Nomsu. Usage:
nomsu tools/upgrade.nom [-i] file1 file2 directory1 ...