aboutsummaryrefslogtreecommitdiff
path: root/tools/format.nom
diff options
context:
space:
mode:
Diffstat (limited to 'tools/format.nom')
-rwxr-xr-xtools/format.nom14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/format.nom b/tools/format.nom
index 0f09834..76c4981 100755
--- a/tools/format.nom
+++ b/tools/format.nom
@@ -1,8 +1,8 @@
-#!/usr/bin/env nomsu -V5.12.12.8
+#!/usr/bin/env nomsu -V6.12.12.8
#
Auto-format Nomsu code. Usage:
- nomsu -t format [-i] file1 file2...
-
+ nomsu -t format [-i] file1 file2...
+
If the "-i" flag is used, the file will be edited in-place.
If no files are passed in, this will read from stdin.
@@ -19,7 +19,7 @@ for $filename in $filenames:
$file = (read file $filename)
unless $file:
barf "File does not exist: \$filename"
- $leading_indent = ($file|matching "[\n]*([ ]*)")
+ $leading_indent = ($file, matching "[\n]*([ ]*)")
$code = (NomsuCode from ($Source $filename 1 (size of $file)) $file)
try:
$tree = ($code parsed)
@@ -28,10 +28,10 @@ for $filename in $filenames:
$formatted = $file
..else:
say $msg
-
+
if ($tree and (not $formatted)):
- $formatted = "
- \$leading_indent\((($tree as nomsu)|text)|with "\n" -> "\n\$leading_indent")"
+ $formatted =
+ .."\$leading_indent\($tree as nomsu, text, with "\n" -> "\n\$leading_indent")"
if $formatted:
if $(COMMAND LINE ARGS)."-i":