diff options
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/autoformat.nom | 4 | ||||
| -rwxr-xr-x | tools/find_action.nom | 8 | ||||
| -rwxr-xr-x | tools/parse.nom | 6 | ||||
| -rwxr-xr-x | tools/replace.nom | 4 | ||||
| -rwxr-xr-x | tools/test.nom | 5 | ||||
| -rwxr-xr-x | tools/upgrade.nom | 14 |
6 files changed, 25 insertions, 16 deletions
diff --git a/tools/autoformat.nom b/tools/autoformat.nom index a915fa4..13f54ef 100755 --- a/tools/autoformat.nom +++ b/tools/autoformat.nom @@ -1,7 +1,7 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # Auto-format Nomsu code. Usage: - nomsu tools/autoformat.nom [-i] file1 file2 directory1 ... + nomsu tools/autoformat.nom [-i] file1 file2 directory1 ... If the first argument is "-i", modifications will be performed in-place. Otherwise, the formatted code will be printed. diff --git a/tools/find_action.nom b/tools/find_action.nom index e30f155..e7e3f49 100755 --- a/tools/find_action.nom +++ b/tools/find_action.nom @@ -1,7 +1,7 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # Find an action by its stub. Usage: - nomsu tools/find_action.nom "foo %" file1 file2 directory1 ... + nomsu tools/find_action.nom "foo %" file1 file2 directory1 ... Will print all the code locations and code that uses the stub. use "lib/os.nom" @@ -28,6 +28,6 @@ for %path in %files: if (%t is syntax tree): for %sub in %t: recurse %t on %sub + sort %results by % -> %.line - for % in %results: - say %.text + for % in %results: say %.text diff --git a/tools/parse.nom b/tools/parse.nom index 9d728e8..de6aff4 100755 --- a/tools/parse.nom +++ b/tools/parse.nom @@ -1,11 +1,11 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # Tool to print out a parse tree of files in an easy-to-read format. Usage: - nomsu tools/parse.nom file1 file2 directory1 ... + nomsu tools/parse.nom file1 file2 directory1 ... use "lib/os.nom" -action [print tree %t at indent %indent]: +externally (print tree %t at indent %indent) means: if %t.type is: "Action": say "\(%indent)Action (\(%t.stub)):" diff --git a/tools/replace.nom b/tools/replace.nom index c55793a..25ae0ae 100755 --- a/tools/replace.nom +++ b/tools/replace.nom @@ -1,7 +1,7 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # Tool to find and replace one tree with another. - nomsu tools/replace.nom [-i] tree_to_replace replacement file1 file2 directory1 ... + nomsu tools/replace.nom [-i] tree_to_replace replacement file1 file2 directory1 ... If "-i" is the first argument, replacements will be performed in-place. Otherwise, the upgraded code will be printed. diff --git a/tools/test.nom b/tools/test.nom index 6d557ea..fb70d1c 100755 --- a/tools/test.nom +++ b/tools/test.nom @@ -1,7 +1,7 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # 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 ... + nomsu tools/test.nom file1 file2 directory1 ... use "lib/os.nom" use "lib/consolecolor.nom" @@ -17,7 +17,6 @@ for %path in (command line args): if (%filename::matches "%.nom$"): use %filename for %path in (command line args): use %path - %tests = ((=lua "Source:from_string(\%s)") = %t for %s = %t in (tests)) for %path in (command line args): for file %filename in %path: diff --git a/tools/upgrade.nom b/tools/upgrade.nom index 7d36793..575646e 100755 --- a/tools/upgrade.nom +++ b/tools/upgrade.nom @@ -1,7 +1,7 @@ #!/usr/bin/env nomsu -V4.8.10 # Tool to automatically update code from old versions of Nomsu. Usage: - nomsu tools/upgrade.nom [-i] file1 file2 directory1 ... + nomsu tools/upgrade.nom [-i] file1 file2 directory1 ... If "-i" is the first argument, upgrades will be performed in-place. Otherwise, the upgraded code will be printed. @@ -10,27 +10,37 @@ use "lib/os.nom" %args = (command line args) %inplace = (no) +%start_version = (nil) %version = (Nomsu version) repeat: if %args.1 is: "-i": %inplace = (yes) %args::remove index 1 + "-t": use "lib/consolecolor.nom" %test = (yes) %args::remove index 1 + "-V": %version = %args.2 %args::remove index 1 %args::remove index 1 + + "-S": + %start_version = %args.2 + %args::remove index 1 + %args::remove index 1 + else: stop for %path in %args: for file %filename in %path: unless (%filename::matches "%.nom$"): do next %filename %tree = (parse (read file %filename) from %filename) - %uptree = (%tree upgraded to %version) + %uptree = (..) + %tree upgraded from (%start_version or (%tree.version or (Nomsu version))) to %version %text = "\ ..#!/usr/bin/env nomsu -V\%version \(%uptree as nomsu)" |
