diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-22 13:59:08 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-22 13:59:08 -0700 |
| commit | dfd39f0b14794b360fd6c961c65ab45d229e00b1 (patch) | |
| tree | 51f0c30ef3a32c969c63321da8164436a3ba8b31 /tools/find_action.nom | |
| parent | 01d5f810ed7fd6e9b261b1fe793f8666970b2068 (diff) | |
Shifting further towards having inline tests. Also added a helper
function for directly extracting source lines from a Source or AST.
Diffstat (limited to 'tools/find_action.nom')
| -rwxr-xr-x | tools/find_action.nom | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/find_action.nom b/tools/find_action.nom new file mode 100755 index 0000000..03bae54 --- /dev/null +++ b/tools/find_action.nom @@ -0,0 +1,21 @@ +#!/usr/bin/env nomsu -V2.5.4.3 +use "core" +use "lib/os.nom" +use "lib/consolecolor.nom" + +%stub = (command line args).1 +say "Looking for stub: \%stub (from \(command line args))" +%files = ((command line args).% for % in 2 to (|| (command line args) ||)) +for %path in %files: + for file %filename in %path: + unless (%filename matches "%.nom$") (do next %filename) + %file = (read file %filename) + %tree = (parse %file from %filename) + 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) + say (blue "\%filename:\%line_num:") + say (yellow (source lines of %t)) + + if (%t is syntax tree) (for %sub in %t (recurse %t on %sub)) |
