parent
6918ff603f
commit
42ebc151c3
1 changed files with 163 additions and 145 deletions
|
@ -1,5 +1,7 @@
|
||||||
# code
|
# code
|
||||||
|
|
||||||
|
# functions
|
||||||
|
|
||||||
function alias_eval(alias, name, type) {
|
function alias_eval(alias, name, type) {
|
||||||
text = alias "() { "
|
text = alias "() { "
|
||||||
if (type == "function") {
|
if (type == "function") {
|
||||||
|
@ -62,7 +64,10 @@ function trim(string) {
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# begin
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
|
|
||||||
RE_ANY = "(.*)"
|
RE_ANY = "(.*)"
|
||||||
RE_BEGIN = "^"
|
RE_BEGIN = "^"
|
||||||
RE_CONST = "([_A-Z][_0-9A-Z]*)"
|
RE_CONST = "([_A-Z][_0-9A-Z]*)"
|
||||||
|
@ -95,13 +100,18 @@ BEGIN {
|
||||||
match_module = 0
|
match_module = 0
|
||||||
match_task = 0
|
match_task = 0
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# main
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (action == "filter") {
|
if (action == "filter") {
|
||||||
if (match($0, re[target])) {
|
if (match($0, re[target])) {
|
||||||
unique[extract($0, target)] = ""
|
unique[extract($0, target)] = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (action == "tasks") {
|
} else if (action == "tasks") {
|
||||||
line++
|
line++
|
||||||
if (match($0, RE_MODULE)) {
|
if (match($0, RE_MODULE)) {
|
||||||
|
@ -133,6 +143,7 @@ BEGIN {
|
||||||
doc = ""
|
doc = ""
|
||||||
match_task = 0
|
match_task = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
} 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))
|
||||||
|
@ -145,6 +156,7 @@ BEGIN {
|
||||||
} else {
|
} else {
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
} 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"))
|
||||||
|
@ -160,6 +172,7 @@ BEGIN {
|
||||||
} else {
|
} else {
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (action == "doc") {
|
} else if (action == "doc") {
|
||||||
# doc
|
# doc
|
||||||
if (match($0, RE_SHEBANG)) {
|
if (match($0, RE_SHEBANG)) {
|
||||||
|
@ -226,12 +239,17 @@ BEGIN {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# end
|
||||||
|
|
||||||
END {
|
END {
|
||||||
|
|
||||||
if (action == "filter") {
|
if (action == "filter") {
|
||||||
for (item in unique) {
|
for (item in unique) {
|
||||||
print item
|
print item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue