From 0bf484f76c0c22688249aaab56c8f4ef06957c7f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 2 Aug 2025 17:57:11 +0200 Subject: [PATCH] strip_function --- sh/core/code.awk | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sh/core/code.awk b/sh/core/code.awk index e7cc470..784d25f 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -64,6 +64,13 @@ function remove_first(string, target, tmp) { return trim(tmp) } +# TODO parent function + +function strip_function(string, tmp) { + split(string, tmp, "(") + return trim(tmp[1]) +} + function strip_value(string, tmp) { split(string, tmp, "=") return trim(tmp[1]) @@ -150,6 +157,11 @@ function parse(string) { commands[command] = "" doc_append("/ " command) + # function + } else if (match(string, re["function"])) { + current_match = "function" + current_function = strip_function(string) + # other } else { if (module == target) { @@ -191,8 +203,6 @@ if (action == "doc") { variable = "" } # others - } else if (match($0, re["function"])) { - f = extract($0, "function") } else if (match($0, RE_CLOSE)) { if (match_alias) { print "= " target