This commit is contained in:
Marc Beninca 2025-08-04 11:33:14 +02:00
parent c97e517c67
commit 7729d5204e
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -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