From 1567b1b8630d6cb7898a8979f6ad644e9936c503 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 2 Aug 2025 19:47:53 +0200 Subject: [PATCH] close --- sh/core/code.awk | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/sh/core/code.awk b/sh/core/code.awk index 8944fb2..c20b230 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -169,6 +169,11 @@ function parse(string) { } else { doc_reset() } + + } + + if (match(string, RE_CLOSE)) { + current_match = "close" } } @@ -179,6 +184,7 @@ function parse(string) { # doc if (action == "doc") { parse($0) + # doc if (match($0, RE_DOC)) { if (current_function) { @@ -186,6 +192,7 @@ if (action == "doc") { } else { doc_append(extract($0, "doc")) } + # constant } else if (current_match == "constant") { if (constant == target) { @@ -194,6 +201,7 @@ if (action == "doc") { doc_reset() constant = "" } + # variable } else if (current_match == "variable") { if (variable == target) { @@ -202,16 +210,19 @@ if (action == "doc") { doc_reset() variable = "" } - # others - } else if (match($0, RE_CLOSE)) { - if (match_alias) { + + } + + # function + if (current_match == "close") { + if (target == current_function) { + doc_output(current_function, "function") + } else if (target in aliases) { print "= " target doc_output(current_function, "function") - } else if (match_command) { + } else if (target in commands) { print "/ " target doc_output(current_function, "function") - } else if (current_function == target) { - doc_output(current_function, "function") } else { current_function = "" doc_reset()