fix,current_function

This commit is contained in:
Marc Beninca 2025-08-02 16:11:00 +02:00
parent d51d635252
commit 20b5b095b2
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -27,7 +27,7 @@ function doc_output(name, type) {
}
function doc_reset() {
if (f == "") {
if (current_function == "") {
doc = ""
}
}
@ -94,7 +94,6 @@ RE_SHEBANG = RE_BEGIN "#!" RE_SPACES RE_ANY RE_END
RE_TASK = RE_BEGIN RE_SPACES "#" RE_SPACES RE_TSK RE_ANY RE_END
re["variable"] = RE_BEGIN RE_VAR RE_SET RE_END
f = ""
match_alias = 0
match_command = 0
match_task = 0
@ -124,7 +123,7 @@ function parse(string) {
# other
} else {
if (module = target) {
if (module == target) {
doc_output(target, "module")
} else {
doc_reset()
@ -141,7 +140,7 @@ if (action == "doc") {
parse($0)
# doc
if (match($0, RE_DOC)) {
if (f) {
if (current_function) {
doc_append($0)
} else {
doc_append(extract($0, "doc"))
@ -179,14 +178,14 @@ if (action == "doc") {
} else if (match($0, RE_CLOSE)) {
if (match_alias) {
print "= " target
doc_output(f, "function")
doc_output(current_function, "function")
} else if (match_command) {
print "/ " target
doc_output(f, "function")
} else if (f == target) {
doc_output(f, "function")
doc_output(current_function, "function")
} else if (current_function == target) {
doc_output(current_function, "function")
} else {
f = ""
current_function = ""
doc_reset()
}
}