aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-08 16:59:10 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-11-08 16:59:10 -0800
commitba96cdfa07cea15ada62f8f89b2563de1286a0de (patch)
tree900ec4b4c7a2fb4da5cb17fd68b741421a40e9f7
parent652c29bdef1f0991cc13bef59d6dc78b657ae9a4 (diff)
Fixes/upgrades.
-rw-r--r--examples/how_do_i.nom2
-rwxr-xr-xtools/find_action.nom26
2 files changed, 14 insertions, 14 deletions
diff --git a/examples/how_do_i.nom b/examples/how_do_i.nom
index bb9e855..afa63e0 100644
--- a/examples/how_do_i.nom
+++ b/examples/how_do_i.nom
@@ -328,4 +328,4 @@ say (best of [2, -3, 4, -8] according to ((% squared)'s meaning))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- say (best of [2, -3, 4, -8] where %x has score (%x * %x))
+say (best of [2, -3, 4, -8] where %x has score (%x * %x))
diff --git a/tools/find_action.nom b/tools/find_action.nom
index 04a20e0..5885793 100755
--- a/tools/find_action.nom
+++ b/tools/find_action.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
Find an action by its stub. Usage:
nomsu tools/find_action.nom "foo %" file1 file2 directory1 ...
@@ -14,24 +14,24 @@ say "Looking for stub: \%stub..."
%files = ((command line args).% for % in 2 to (size of (command line args)))
for %path in %files:
for file %filename in %path:
- unless (%filename::matches "%.nom$") (do next %filename)
+ unless (%filename::matches "%.nom$"): do next %filename
%file = (read file %filename)
+ %code = (%NomsuCode (%Source %filename 1 (size of %file)) %file)
try:
- %tree = (parse %file from %filename)
- ..and if it barfs:
- say (red "\%filename failed to parse")
+ %tree = (%code parsed)
+ ..and if it barfs %msg:
+ say (red "\%filename failed to parse:\n\%msg")
%tree = (nil)
unless %tree: do next %filename
%results = []
for %t in recursive %tree:
- if (%t is "Action" syntax tree):
- if (%t.stub is %stub):
- %line_num = (line number of %t.source.start in %file)
- %results::add {..}
- line: %line_num
- text: "\
- ..\(blue "\%filename:\%line_num:")
- \(yellow (source lines of %t))"
+ if ((%t is "Action" syntax tree) and (%t.stub is %stub)):
+ %line_num = (line number of %t.source.start in %file)
+ %results::add {..}
+ line: %line_num
+ text: "\
+ ..\(blue "\%filename:\%line_num:")
+ \(yellow (source lines of %t))"
if (%t is syntax tree):
for %sub in %t: recurse %t on %sub