aboutsummaryrefslogtreecommitdiff
path: root/tools/parse.nom
diff options
context:
space:
mode:
Diffstat (limited to 'tools/parse.nom')
-rwxr-xr-xtools/parse.nom19
1 files changed, 7 insertions, 12 deletions
diff --git a/tools/parse.nom b/tools/parse.nom
index 9e43c88..cb367ab 100755
--- a/tools/parse.nom
+++ b/tools/parse.nom
@@ -35,15 +35,10 @@ externally (print tree %t at indent %indent) means:
else:
say "\%indent \(quote %arg)"
-for %path in (command line args):
- for %filename in (files for %path):
- if (%filename == "-"):
- %filename = "stdin"
-
- unless ((%filename == "stdin") or (%filename::matches "%.nom$")):
- do next %filename
-
- %text = (read file %filename)
- %nomsu = (NomsuCode from (Source %filename 1 (size of %text)) %text)
- %tree = (%nomsu parsed)
- print tree %tree at indent ""
+for %filename in (command line args).extra_args:
+ %file = (read file %filename)
+ unless %file:
+ barf "File does not exist: \%filename"
+ %nomsu = (NomsuCode from (Source %filename 1 (size of %file)) %file)
+ %tree = (%nomsu parsed)
+ print tree %tree at indent ""