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
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
# begin
|
# → begin
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
|
|
||||||
RE_ANY = "(.*)"
|
RE_ANY = "(.*)"
|
||||||
|
@ -101,23 +100,20 @@ match_module = 0
|
||||||
match_task = 0
|
match_task = 0
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
|
# ← begin
|
||||||
}
|
}
|
||||||
|
|
||||||
# parse
|
# parse
|
||||||
|
|
||||||
function parse(string) {
|
function parse(string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# main
|
# → main
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (action == "filter") {
|
# FIXME handle no action
|
||||||
if (match($0, re[target])) {
|
|
||||||
unique[extract($0, target)] = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (action == "tasks") {
|
# tasks
|
||||||
|
if (action == "tasks") {
|
||||||
line++
|
line++
|
||||||
if (match($0, RE_MODULE)) {
|
if (match($0, RE_MODULE)) {
|
||||||
line = 1
|
line = 1
|
||||||
|
@ -149,6 +145,7 @@ if (action == "filter") {
|
||||||
match_task = 0
|
match_task = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# eval
|
||||||
} else if (action == "eval") {
|
} else if (action == "eval") {
|
||||||
if (match($0, re[target])) {
|
if (match($0, re[target])) {
|
||||||
append(extract($0, target))
|
append(extract($0, target))
|
||||||
|
@ -162,6 +159,7 @@ if (action == "filter") {
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# function
|
||||||
} else if (action == "function") {
|
} else if (action == "function") {
|
||||||
if (match($0, re["command"])) {
|
if (match($0, re["command"])) {
|
||||||
append(extract($0, "command"))
|
append(extract($0, "command"))
|
||||||
|
@ -178,6 +176,7 @@ if (action == "filter") {
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# doc
|
||||||
} else if (action == "doc") {
|
} else if (action == "doc") {
|
||||||
# doc
|
# doc
|
||||||
if (match($0, RE_SHEBANG)) {
|
if (match($0, RE_SHEBANG)) {
|
||||||
|
@ -243,18 +242,30 @@ if (action == "filter") {
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# filter
|
||||||
|
} else if (action == "filter") {
|
||||||
|
if (match($0, re[target])) {
|
||||||
|
unique[extract($0, target)] = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# ← action
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ← main
|
||||||
}
|
}
|
||||||
|
|
||||||
# end
|
# → end
|
||||||
|
|
||||||
END {
|
END {
|
||||||
|
|
||||||
|
# filter
|
||||||
if (action == "filter") {
|
if (action == "filter") {
|
||||||
for (item in unique) {
|
for (item in unique) {
|
||||||
print item
|
print item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ← end / action
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ← end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue