aboutsummaryrefslogtreecommitdiff
path: root/tools/find.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-12-30 23:58:47 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-12-30 23:58:47 -0800
commit5059c081ac624ede925d5256885509ddd17181c6 (patch)
tree0457d135e5193126bf73466bfaae09df94ab8a7d /tools/find.nom
parentec69ee6f62016a2edcc13e3183cbe4cadd75717f (diff)
Auto-upgraded code.
Diffstat (limited to 'tools/find.nom')
-rwxr-xr-xtools/find.nom19
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/find.nom b/tools/find.nom
index d2678d2..00b65e5 100755
--- a/tools/find.nom
+++ b/tools/find.nom
@@ -24,7 +24,9 @@ use "lib/consolecolor.nom"
$wildcard = ($(COMMAND LINE ARGS)."--wildcard" or "%*")
$pattern = $(COMMAND LINE ARGS).extras.1
if (any of [not $pattern, $pattern == "*", $pattern == "**"]):
- barf "Usage: nomsu -t find [-l] [--wildcard=<wildcard>] <pattern>, where <pattern> is valid Nomsu code"
+ barf ("
+ Usage: nomsu -t find [-l] [--wildcard=<wildcard>] <pattern>, where <pattern> is valid Nomsu code
+ ")
$pattern = ($pattern, with "\$wildcard\$wildcard" -> "$multi_wildcard")
$pattern = ($pattern, with $wildcard -> "$wildcard")
$pattern_tree = ($pattern parsed)
@@ -47,7 +49,9 @@ $pattern_tree = ($pattern parsed)
return (yes)
$filenames = ($(COMMAND LINE ARGS).extras, from 2 to -1)
if ((#$filenames) == 0):
- say "Warning: searching stdin (ctrl-d to abort). To avoid this message, use nomsu -t find -"
+ say ("
+ Warning: searching stdin (ctrl-d to abort). To avoid this message, use nomsu -t find -
+ ")
$filenames = ["stdin"]
for $filename in $filenames:
@@ -58,7 +62,11 @@ for $filename in $filenames:
try:
$tree = ($code parsed)
..and if it barfs $msg:
- say (red "\$filename failed to parse:\n\$msg")
+ say
+ red ("
+ \$filename failed to parse:
+ \$msg
+ ")
$tree = (nil)
unless $tree:
@@ -68,8 +76,9 @@ for $filename in $filenames:
for $t in recursive $tree:
if ($t matches $pattern_tree):
$line_num = ($file, line number at $t.source.start)
- $results,
- add {.line = $line_num, .text = "\(blue "\$filename:\$line_num:")\n\(source lines of $t)"}
+ $results, add {
+ .line = $line_num, .text = "\(blue "\$filename:\$line_num:")\n\(source lines of $t)"
+ }
for $sub in $t:
if ($sub is syntax tree):