function
This commit is contained in:
parent
c97e517c67
commit
7729d5204e
1 changed files with 9 additions and 14 deletions
|
@ -176,7 +176,7 @@ BEGIN {
|
||||||
# │ code │ parse │
|
# │ code │ parse │
|
||||||
# ╰──────┴───────╯
|
# ╰──────┴───────╯
|
||||||
|
|
||||||
function parse(string) {
|
function parse(string, command) {
|
||||||
|
|
||||||
# module
|
# module
|
||||||
if (match(string, RE_MODULE)) {
|
if (match(string, RE_MODULE)) {
|
||||||
|
@ -224,6 +224,9 @@ function parse(string) {
|
||||||
current_match = "function"
|
current_match = "function"
|
||||||
current_function = strip_function(string)
|
current_function = strip_function(string)
|
||||||
ids_put(current_match, current_function)
|
ids_put(current_match, current_function)
|
||||||
|
for (command in commands) {
|
||||||
|
commands[command] = current_function
|
||||||
|
}
|
||||||
|
|
||||||
# task
|
# task
|
||||||
} else if (match(string, RE_TASK)) {
|
} else if (match(string, RE_TASK)) {
|
||||||
|
@ -348,21 +351,13 @@ if (action == "doc") {
|
||||||
|
|
||||||
# function
|
# function
|
||||||
} else if (action == "function") {
|
} else if (action == "function") {
|
||||||
# TODO parse($0)
|
parse($0)
|
||||||
|
|
||||||
if (match($0, re["command"])) {
|
if (current_match == "function") {
|
||||||
doc_append(extract($0, "command"))
|
if (target in commands) {
|
||||||
} else if (match($0, re["function"])) {
|
print commands[target]
|
||||||
split(doc, array, "\n")
|
exit
|
||||||
for (item in array) {
|
|
||||||
if (array[item] == target) {
|
|
||||||
print extract($0, "function")
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
doc_reset()
|
|
||||||
} else {
|
|
||||||
doc_reset()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# eval
|
# eval
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue