awk/actions,comments
This commit is contained in:
parent
037c64674e
commit
845065a374
1 changed files with 23 additions and 12 deletions
|
@ -64,8 +64,7 @@ function trim(string) {
|
|||
return text
|
||||
}
|
||||
|
||||
# begin
|
||||
|
||||
# → begin
|
||||
BEGIN {
|
||||
|
||||
RE_ANY = "(.*)"
|
||||
|
@ -101,23 +100,20 @@ match_module = 0
|
|||
match_task = 0
|
||||
reset()
|
||||
|
||||
# ← begin
|
||||
}
|
||||
|
||||
# parse
|
||||
|
||||
function parse(string) {
|
||||
}
|
||||
|
||||
# main
|
||||
|
||||
# → main
|
||||
{
|
||||
|
||||
if (action == "filter") {
|
||||
if (match($0, re[target])) {
|
||||
unique[extract($0, target)] = ""
|
||||
}
|
||||
# FIXME handle no action
|
||||
|
||||
} else if (action == "tasks") {
|
||||
# tasks
|
||||
if (action == "tasks") {
|
||||
line++
|
||||
if (match($0, RE_MODULE)) {
|
||||
line = 1
|
||||
|
@ -149,6 +145,7 @@ if (action == "filter") {
|
|||
match_task = 0
|
||||
}
|
||||
|
||||
# eval
|
||||
} else if (action == "eval") {
|
||||
if (match($0, re[target])) {
|
||||
append(extract($0, target))
|
||||
|
@ -162,6 +159,7 @@ if (action == "filter") {
|
|||
reset()
|
||||
}
|
||||
|
||||
# function
|
||||
} else if (action == "function") {
|
||||
if (match($0, re["command"])) {
|
||||
append(extract($0, "command"))
|
||||
|
@ -178,6 +176,7 @@ if (action == "filter") {
|
|||
reset()
|
||||
}
|
||||
|
||||
# doc
|
||||
} else if (action == "doc") {
|
||||
# doc
|
||||
if (match($0, RE_SHEBANG)) {
|
||||
|
@ -243,18 +242,30 @@ if (action == "filter") {
|
|||
reset()
|
||||
}
|
||||
}
|
||||
|
||||
# filter
|
||||
} else if (action == "filter") {
|
||||
if (match($0, re[target])) {
|
||||
unique[extract($0, target)] = ""
|
||||
}
|
||||
|
||||
# ← action
|
||||
}
|
||||
|
||||
# ← main
|
||||
}
|
||||
|
||||
# end
|
||||
|
||||
# → end
|
||||
END {
|
||||
|
||||
# filter
|
||||
if (action == "filter") {
|
||||
for (item in unique) {
|
||||
print item
|
||||
}
|
||||
|
||||
# ← end / action
|
||||
}
|
||||
|
||||
# ← end
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue