aboutsummaryrefslogtreecommitdiff
path: root/tools/upgrade.nom
diff options
context:
space:
mode:
Diffstat (limited to 'tools/upgrade.nom')
-rwxr-xr-xtools/upgrade.nom50
1 files changed, 25 insertions, 25 deletions
diff --git a/tools/upgrade.nom b/tools/upgrade.nom
index 0512134..48f1811 100755
--- a/tools/upgrade.nom
+++ b/tools/upgrade.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.12.12.8
+#!/usr/bin/env nomsu -V5.12.12.8
#
Tool to automatically update code from old versions of Nomsu. Usage:
nomsu tools/upgrade.nom [-i] file1 file2 directory1 ...
@@ -11,32 +11,32 @@ use "lib/consolecolor.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-%args = (command line args)
-%inplace = (%args."-i" or %args."--inplace")
-%start_version = %args."--upgrade-from"
-%version = (%args."--upgrade-to" or (Nomsu version))
-%test = (%args."-t" or %args."--test")
-for %filename in %args.extra_args:
- %file = (read file %filename)
- unless %file:
- barf "File does not exist: \%filename"
- %leading_indent = (%file::matching "[\n]*([ ]*)")
- %code = (NomsuCode from (Source %filename 1 (size of %file)) %file)
- %tree = (%code parsed)
- %uptree = (..)
- %tree upgraded from (%start_version or (%tree.version or (Nomsu version))) to \
- ..%version
- %text = "\%leading_indent\(((%uptree as nomsu)::text)::with "\n" -> "\n\%leading_indent")"
+$args = (command line args)
+$inplace = ($args."-i" or $args."--inplace")
+$start_version = $args."--upgrade-from"
+$version = ($args."--upgrade-to" or (Nomsu version))
+$test = ($args."-t" or $args."--test")
+for $filename in $args.extra_args:
+ $file = (read file $filename)
+ unless $file:
+ barf "File does not exist: \$filename"
+ $leading_indent = ($file|matching "[\n]*([ ]*)")
+ $code = (NomsuCode from (Source $filename 1 (size of $file)) $file)
+ $tree = ($code parsed)
+ $uptree = (..)
+ $tree upgraded from ($start_version or ($tree.version or (Nomsu version))) to \
+ ..$version
+ $text = "\$leading_indent\((($uptree as nomsu)|text)|with "\n" -> "\n\$leading_indent")"
when:
- %inplace:
- say "Upgraded \%filename"
- write %text to file %filename
+ $inplace:
+ say "Upgraded \$filename"
+ write $text to file $filename
- %test:
- if (%uptree == %tree):
- say (dim "\%filename will not be changed")
+ $test:
+ if ($uptree == $tree):
+ say (dim "\$filename will not be changed")
..else:
- say (bright "\%filename will be changed")
+ say (bright "\$filename will be changed")
else:
- say %text inline
+ say $text inline