aboutsummaryrefslogtreecommitdiff
path: root/tools/find_action.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-11 15:50:46 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-11-11 15:50:46 -0800
commit4efe44ed271aeed8e25e909344788d92a0d9f82b (patch)
tree73766440b53031d4fc8210dbe3b0aece47e6b852 /tools/find_action.nom
parentba03cb67c3c8ba53451eba25dd2186f095cd1db2 (diff)
Fully upgraded to 4.10.12.7, including deprecating the old list/dict
comprehension methods, in favor of the new native support.
Diffstat (limited to 'tools/find_action.nom')
-rwxr-xr-xtools/find_action.nom19
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/find_action.nom b/tools/find_action.nom
index 5885793..a6be84f 100755
--- a/tools/find_action.nom
+++ b/tools/find_action.nom
@@ -3,7 +3,7 @@
Find an action by its stub. Usage:
nomsu tools/find_action.nom "foo %" file1 file2 directory1 ...
Will print all the code locations and code that uses the stub.
-
+
use "lib/os.nom"
use "lib/consolecolor.nom"
@@ -22,19 +22,20 @@ for %path in %files:
..and if it barfs %msg:
say (red "\%filename failed to parse:\n\%msg")
%tree = (nil)
- unless %tree: do next %filename
+
+ unless %tree:
+ do next %filename
+
%results = []
for %t in recursive %tree:
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))"
+ line: %line_num, text: "\(blue "\%filename:\%line_num:")\n\(yellow (source lines of %t))"
if (%t is syntax tree):
- for %sub in %t: recurse %t on %sub
-
+ for %sub in %t:
+ recurse %t on %sub
sort %results by % -> %.line
- for % in %results: say %.text
+ for % in %results:
+ say %.text