From 101fd21ce15e15b9896d48824f3df84d6455cae0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 6 Jul 2025 09:32:52 +0200 Subject: [PATCH 1/3] re/close --- sh/main.awk | 1 + 1 file changed, 1 insertion(+) diff --git a/sh/main.awk b/sh/main.awk index 998644d..4d5b018 100644 --- a/sh/main.awk +++ b/sh/main.awk @@ -28,6 +28,7 @@ BEGIN { RE_FUNC = RE_SPACES "\\(" RE_SPACES "\\)" RE_SPACES "{" RE_ALIAS = RE_BEGIN "#=" RE_SPACES RE_VAR RE_END + RE_CLOSE = RE_BEGIN "}" RE_SPACES RE_END RE_CONSTANT = RE_BEGIN RE_CONST RE_SET RE_END RE_DOC = RE_BEGIN "#" RE_SPACE RE_ANY RE_END RE_FUNCTION = RE_BEGIN RE_VAR RE_FUNC RE_END From 1c39fb31a1681181d94a30b708e81e4dca529995 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 6 Jul 2025 09:36:06 +0200 Subject: [PATCH 2/3] =,! --- sh/main.awk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/main.awk b/sh/main.awk index 4d5b018..ec3447d 100644 --- a/sh/main.awk +++ b/sh/main.awk @@ -57,11 +57,11 @@ BEGIN { } else if (action == "doc") { # doc if (match($0, RE_SHEBANG, m)) { - append("shebang: " m[1]) + append("! " m[1]) } else if (match($0, RE_DOC, m)) { append(m[1]) } else if (match($0, RE_ALIAS, m)) { - append("alias: " m[1]) + append("= " m[1]) if (m[1] == target) { alias = 1 } @@ -88,7 +88,7 @@ BEGIN { } } else if (match($0, RE_FUNCTION, m)) { if (alias) { - print "alias: " target + print "= " target printf "function: " output(m[1]) } else if (m[1] == target) { From aeff5a62f2fa70d939530e6bf44b9b9ace344287 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 6 Jul 2025 09:42:23 +0200 Subject: [PATCH 3/3] output/type --- sh/main.awk | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sh/main.awk b/sh/main.awk index ec3447d..2dca2cb 100644 --- a/sh/main.awk +++ b/sh/main.awk @@ -5,8 +5,8 @@ function append(line) { doc = doc line } -function output(name) { - print name +function output(name, type) { + print name " ← " type print doc exit } @@ -68,15 +68,13 @@ BEGIN { # set } else if (match($0, RE_CONSTANT, m)) { if (m[1] == target) { - printf "constant: " - output(m[1]) + output(m[1], "constant") } else { reset() } } else if (match($0, RE_VARIABLE, m)) { if (m[1] == target) { - printf "variable: " - output(m[1]) + output(m[1], "variable") } else { reset() } @@ -89,18 +87,15 @@ BEGIN { } else if (match($0, RE_FUNCTION, m)) { if (alias) { print "= " target - printf "function: " - output(m[1]) + output(m[1], "function") } else if (m[1] == target) { - printf "function: " - output(target) + output(target, "function") } else { reset() } } else { if (module) { - printf "module: " - output(target) + output(target, "module") } else { reset() }