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 │
|
||||
# ╰──────┴───────╯
|
||||
|
||||
function parse(string) {
|
||||
function parse(string, command) {
|
||||
|
||||
# module
|
||||
if (match(string, RE_MODULE)) {
|
||||
|
@ -224,6 +224,9 @@ function parse(string) {
|
|||
current_match = "function"
|
||||
current_function = strip_function(string)
|
||||
ids_put(current_match, current_function)
|
||||
for (command in commands) {
|
||||
commands[command] = current_function
|
||||
}
|
||||
|
||||
# task
|
||||
} else if (match(string, RE_TASK)) {
|
||||
|
@ -348,21 +351,13 @@ if (action == "doc") {
|
|||
|
||||
# function
|
||||
} else if (action == "function") {
|
||||
# TODO parse($0)
|
||||
parse($0)
|
||||
|
||||
if (match($0, re["command"])) {
|
||||
doc_append(extract($0, "command"))
|
||||
} else if (match($0, re["function"])) {
|
||||
split(doc, array, "\n")
|
||||
for (item in array) {
|
||||
if (array[item] == target) {
|
||||
print extract($0, "function")
|
||||
exit
|
||||
}
|
||||
if (current_match == "function") {
|
||||
if (target in commands) {
|
||||
print commands[target]
|
||||
exit
|
||||
}
|
||||
doc_reset()
|
||||
} else {
|
||||
doc_reset()
|
||||
}
|
||||
|
||||
# eval
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue