aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/find.nom8
-rwxr-xr-xtools/format.nom6
-rwxr-xr-xtools/parse.nom4
-rwxr-xr-xtools/repl.nom10
-rwxr-xr-xtools/replace.nom14
-rwxr-xr-xtools/test.nom2
-rwxr-xr-xtools/upgrade.nom4
7 files changed, 23 insertions, 25 deletions
diff --git a/tools/find.nom b/tools/find.nom
index 781ca3f..8f2bc9f 100755
--- a/tools/find.nom
+++ b/tools/find.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V6.13.12.8
+#!/usr/bin/env nomsu -V6.14
#
This is a tool to find syntax trees matching a pattern. "*" is a wildcard
that will match any subtree, and "**" is a wildcard that will match any
@@ -24,7 +24,7 @@ use "lib/consolecolor.nom"
$wildcard = ($(COMMAND LINE ARGS).wildcard or "%*")
$pattern = $(COMMAND LINE ARGS).extras.1
if (any of [not $pattern, $pattern == "*", $pattern == "**"]):
- barf ("
+ fail ("
Usage: nomsu -t find [-l] [--wildcard=<wildcard>] <pattern>, where <pattern> is valid Nomsu code
")
$pattern = ($pattern, with "\$wildcard\$wildcard" -> "$multi_wildcard")
@@ -57,11 +57,11 @@ if ((#$filenames) == 0):
for $filename in $filenames:
$file = (read file $filename)
unless $file:
- barf "File does not exist: \$filename"
+ fail "File does not exist: \$filename"
$code = (NomsuCode from ($Source $filename 1 (size of $file)) $file)
try:
$tree = ($code parsed)
- ..and if it barfs $msg:
+ ..if it fails $msg:
say
red ("
\$filename failed to parse:
diff --git a/tools/format.nom b/tools/format.nom
index df89635..4915e46 100755
--- a/tools/format.nom
+++ b/tools/format.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V6.13.12.8
+#!/usr/bin/env nomsu -V6.14
#
Auto-format Nomsu code. Usage:
nomsu -t format [-i] file1 file2...
@@ -21,12 +21,12 @@ if ((#$filenames) == 0):
for $filename in $filenames:
$file = (read file $filename)
unless $file:
- barf "File does not exist: \$filename"
+ fail "File does not exist: \$filename"
$leading_indent = ($file, matching "\n*([ ]*)")
$code = (NomsuCode from ($Source $filename 1 (size of $file)) $file)
try:
$tree = ($code parsed)
- ..and if it barfs $msg:
+ ..if it fails $msg:
if $(COMMAND LINE ARGS).q:
$formatted = $file
..else:
diff --git a/tools/parse.nom b/tools/parse.nom
index ac9c42f..ab2c583 100755
--- a/tools/parse.nom
+++ b/tools/parse.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V6.13.12.8
+#!/usr/bin/env nomsu -V6.14
#
Tool to print out a parse tree of files in an easy-to-read format. Usage:
nomsu tools/parse.nom file1 file2 directory1 ...
@@ -39,7 +39,7 @@ externally (print tree $t at indent $indent) means:
for $filename in $(COMMAND LINE ARGS).extras:
$file = (read file $filename)
unless $file:
- barf "File does not exist: \$filename"
+ fail "File does not exist: \$filename"
$nomsu = (NomsuCode from (Source $filename 1 (size of $file)) $file)
$tree = ($nomsu parsed)
print tree $tree at indent ""
diff --git a/tools/repl.nom b/tools/repl.nom
index 4240ddc..c35abc5 100755
--- a/tools/repl.nom
+++ b/tools/repl.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V6.13.12.8
+#!/usr/bin/env nomsu -V6.14
#
This file defines a Read-Evaluate-Print-Loop (REPL) for Nomsu
@@ -45,7 +45,7 @@ repeat:
spoof file $buff
try:
$tree = ($buff parsed)
- ..and if it barfs $err:
+ ..if it fails $err:
say $err
do next
@@ -55,7 +55,7 @@ repeat:
for $chunk in $tree:
try:
$lua = ($chunk as lua)
- ..and if it barfs $err: say $err
+ ..if it fails $err: say $err
unless $lua:
do next
@@ -66,8 +66,8 @@ repeat:
$lua, remove free vars
try:
$ret = (run $lua)
- ..and if it barfs $err: say $err
- ..or if it succeeds:
+ ..if it fails $err: say $err
+ ..if it succeeds:
if (type of $ret) is:
"nil":
do nothing
diff --git a/tools/replace.nom b/tools/replace.nom
index 9d96c54..aa5d08c 100755
--- a/tools/replace.nom
+++ b/tools/replace.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V6.13.12.8
+#!/usr/bin/env nomsu -V6.14
#
This is a tool to replace syntax trees with something new.
@@ -21,7 +21,7 @@ use "lib/consolecolor.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ((#$(COMMAND LINE ARGS).extras) < 2):
- barf ("
+ fail ("
Usage: nomsu -t replace [--literal="$v1 $v2..."] <pattern> <replacement> file1 file2...
")
$pattern = $(COMMAND LINE ARGS).extras.1
@@ -34,7 +34,7 @@ if $(COMMAND LINE ARGS).literal:
$literal_vars.$var = (yes)
if (($pattern_tree.type == "Var") and (not $literal_vars.($pattern_tree.1))):
- barf "Pattern matches every part of the file."
+ fail "Pattern matches every part of the file."
$pattern_vars = {
: for $ in recursive $pattern_tree:
@@ -77,7 +77,6 @@ $pattern_vars = {
if ((#$tree) != (#$patt)): return (nil)
return $substitution_values
-
$filenames = ($(COMMAND LINE ARGS).extras, from 3 to -1)
if ((#$filenames) == 0):
say ("
@@ -88,14 +87,13 @@ if ((#$filenames) == 0):
for $filename in $filenames:
$file = (read file $filename)
unless $file:
- barf "File does not exist: \$filename"
+ fail "File does not exist: \$filename"
$code = (NomsuCode from ($Source $filename 1 (size of $file)) $file)
try:
$tree = ($code parsed)
- ..and if it barfs $msg:
+ ..if it fails $msg:
if $(COMMAND LINE ARGS).q:
- unless $(COMMAND LINE ARGS).i:
- say $code
+ unless $(COMMAND LINE ARGS).i: say $code
..else:
say $msg
diff --git a/tools/test.nom b/tools/test.nom
index d9e9269..f8373d8 100755
--- a/tools/test.nom
+++ b/tools/test.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V6.13.12.8
+#!/usr/bin/env nomsu -V6.14
#
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 ...
diff --git a/tools/upgrade.nom b/tools/upgrade.nom
index 5cf7d60..01040c8 100755
--- a/tools/upgrade.nom
+++ b/tools/upgrade.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V6.13.12.8
+#!/usr/bin/env nomsu -V6.14
#
Tool to automatically update code from old versions of Nomsu. Usage:
nomsu tools/upgrade.nom [-i] file1 file2 directory1 ...
@@ -18,7 +18,7 @@ $test = ($(COMMAND LINE ARGS).t or $(COMMAND LINE ARGS).test)
for $filename in $(COMMAND LINE ARGS).extras:
$file = (read file $filename)
unless $file:
- barf "File does not exist: \$filename"
+ fail "File does not exist: \$filename"
$leading_indent = ($file, matching "\n*([ ]*)")
$code = (NomsuCode from (Source $filename 1 (size of $file)) $file)
$tree = ($code parsed $start_version)