diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-12-30 19:04:34 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-12-30 19:04:45 -0800 |
| commit | 8a3c32408733a2f5e14f8a2dbafa3f980b2f73a1 (patch) | |
| tree | 68f1e8a8b956c33ed24cc7a6a369fd97b8849321 /tools/format.nom | |
| parent | 359152da1772ce501609edd8f84b4985ed3e42f2 (diff) | |
Update to new syntax.
Diffstat (limited to 'tools/format.nom')
| -rwxr-xr-x | tools/format.nom | 14 |
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": |
