From 20b5b095b2843ff7d469cd1f2eda114cb285acfa Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 2 Aug 2025 16:11:00 +0200 Subject: [PATCH] fix,current_function --- sh/core/code.awk | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sh/core/code.awk b/sh/core/code.awk index 5edee5b..41baf26 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -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() } }