aboutsummaryrefslogtreecommitdiff
path: root/tools/autoformat.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-11 16:26:38 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-11-11 16:27:01 -0800
commit9d82d522c17493ad3016ca0678a951485067408f (patch)
treeda23135f690e843cb5be3798b59d056d8c89f335 /tools/autoformat.nom
parent370fad9cd32e1931411282070963e80c3b1faf0c (diff)
Fixed some autoformatting stuff, and prepping to deprecate some math
shorthand.
Diffstat (limited to 'tools/autoformat.nom')
-rwxr-xr-xtools/autoformat.nom10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/autoformat.nom b/tools/autoformat.nom
index f236ca4..b15f4ce 100755
--- a/tools/autoformat.nom
+++ b/tools/autoformat.nom
@@ -1,7 +1,7 @@
#!/usr/bin/env nomsu -V4.10.12.7
#
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.
@@ -18,10 +18,10 @@ if (%args.1 is "-i"):
for %path in %args:
for file %filename in %path:
unless (%filename::matches "%.nom$"): do next %filename
- %formatted = "\
- ..#!/usr/bin/env nomsu -V\(Nomsu version)
- \((parse (read file %filename) from %filename) as nomsu)"
-
+ %contents = (read file %filename)
+ %code = (%NomsuCode::from (Source %filename 1 (size of %contents)) %contents)
+ %tree = (%code parsed)
+ %formatted = ((%tree as nomsu)::text)
if %inplace:
write %formatted to file %filename
..else: