diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-12-30 23:58:47 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-12-30 23:58:47 -0800 |
| commit | 5059c081ac624ede925d5256885509ddd17181c6 (patch) | |
| tree | 0457d135e5193126bf73466bfaae09df94ab8a7d /tools | |
| parent | ec69ee6f62016a2edcc13e3183cbe4cadd75717f (diff) | |
Auto-upgraded code.
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/find.nom | 19 | ||||
| -rwxr-xr-x | tools/format.nom | 6 | ||||
| -rw-r--r-- | tools/repl.nom | 3 | ||||
| -rwxr-xr-x | tools/test.nom | 7 | ||||
| -rwxr-xr-x | tools/upgrade.nom | 4 |
5 files changed, 27 insertions, 12 deletions
diff --git a/tools/find.nom b/tools/find.nom index d2678d2..00b65e5 100755 --- a/tools/find.nom +++ b/tools/find.nom @@ -24,7 +24,9 @@ use "lib/consolecolor.nom" $wildcard = ($(COMMAND LINE ARGS)."--wildcard" or "%*") $pattern = $(COMMAND LINE ARGS).extras.1 if (any of [not $pattern, $pattern == "*", $pattern == "**"]): - barf "Usage: nomsu -t find [-l] [--wildcard=<wildcard>] <pattern>, where <pattern> is valid Nomsu code" + barf (" + Usage: nomsu -t find [-l] [--wildcard=<wildcard>] <pattern>, where <pattern> is valid Nomsu code + ") $pattern = ($pattern, with "\$wildcard\$wildcard" -> "$multi_wildcard") $pattern = ($pattern, with $wildcard -> "$wildcard") $pattern_tree = ($pattern parsed) @@ -47,7 +49,9 @@ $pattern_tree = ($pattern parsed) return (yes) $filenames = ($(COMMAND LINE ARGS).extras, from 2 to -1) if ((#$filenames) == 0): - say "Warning: searching stdin (ctrl-d to abort). To avoid this message, use nomsu -t find -" + say (" + Warning: searching stdin (ctrl-d to abort). To avoid this message, use nomsu -t find - + ") $filenames = ["stdin"] for $filename in $filenames: @@ -58,7 +62,11 @@ for $filename in $filenames: try: $tree = ($code parsed) ..and if it barfs $msg: - say (red "\$filename failed to parse:\n\$msg") + say + red (" + \$filename failed to parse: + \$msg + ") $tree = (nil) unless $tree: @@ -68,8 +76,9 @@ for $filename in $filenames: for $t in recursive $tree: if ($t matches $pattern_tree): $line_num = ($file, line number at $t.source.start) - $results, - add {.line = $line_num, .text = "\(blue "\$filename:\$line_num:")\n\(source lines of $t)"} + $results, add { + .line = $line_num, .text = "\(blue "\$filename:\$line_num:")\n\(source lines of $t)" + } for $sub in $t: if ($sub is syntax tree): diff --git a/tools/format.nom b/tools/format.nom index 7d9d1d4..7d8cca1 100755 --- a/tools/format.nom +++ b/tools/format.nom @@ -12,7 +12,9 @@ use "lib/os.nom" $filenames = $(COMMAND LINE ARGS).extras if ((#$filenames) == 0): - say "Warning: reading from stdin (ctrl-d to abort). To avoid this message, use nomsu -t format -" + say (" + Warning: reading from stdin (ctrl-d to abort). To avoid this message, use nomsu -t format - + ") $filenames = ["stdin"] for $filename in $filenames: @@ -31,7 +33,7 @@ for $filename in $filenames: if ($tree and (not $formatted)): $formatted = - .."\$leading_indent\($tree as nomsu, text, with "\n" -> "\n\$leading_indent")" + "\$leading_indent\($tree as nomsu, text, with "\n" -> "\n\$leading_indent")" if $formatted: if $(COMMAND LINE ARGS)."-i": diff --git a/tools/repl.nom b/tools/repl.nom index 49a4d3d..ef262e1 100644 --- a/tools/repl.nom +++ b/tools/repl.nom @@ -17,7 +17,8 @@ externally (help) means: say (" - \(bright)\(underscore)Welcome to the Nomsu v\(Nomsu version) interactive console!\(reset color) + \(bright)\(underscore)Welcome to the Nomsu v\(Nomsu version) interactive console!\ + ..\(reset color) press 'enter' twice to run a command ") diff --git a/tools/test.nom b/tools/test.nom index 0202675..1e135db 100755 --- a/tools/test.nom +++ b/tools/test.nom @@ -13,7 +13,12 @@ for $filename in $(COMMAND LINE ARGS).extras: use $filename $tests = {: for $s = $t in $TESTS: add (=lua "Source:from_string(\$s)") = $t} for $filename in $(COMMAND LINE ARGS).extras: $file = (read file $filename) - $version = ($file, matching "#![^\n]* nomsu %-V[ ]*([^\n]*)") + $version = + $file, matching (" + #![^ + ]* nomsu %-V[ ]*([^ + ]*) + ") $file_tests = [] for $src = $test in $tests: if ($src.filename == $filename): diff --git a/tools/upgrade.nom b/tools/upgrade.nom index 23716a2..d890dc9 100755 --- a/tools/upgrade.nom +++ b/tools/upgrade.nom @@ -24,10 +24,8 @@ for $filename in $(COMMAND LINE ARGS).extras: $tree = ($code parsed $start_version) $uptree = $tree upgraded from ($start_version or ($tree.version or (Nomsu version))) to - ..$version - + $version $text = "\$leading_indent\($uptree as nomsu, text, with "\n" -> "\n\$leading_indent")" - when: $inplace: say "Upgraded \$filename" |
