unindent
All checks were successful
/ job (push) Successful in 2m55s

This commit is contained in:
Marc Beninca 2025-08-02 02:57:21 +02:00
parent 6918ff603f
commit 42ebc151c3
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -1,5 +1,7 @@
# code # code
# functions
function alias_eval(alias, name, type) { function alias_eval(alias, name, type) {
text = alias "() { " text = alias "() { "
if (type == "function") { if (type == "function") {
@ -62,47 +64,55 @@ function trim(string) {
return text return text
} }
# begin
BEGIN { BEGIN {
RE_ANY = "(.*)"
RE_BEGIN = "^"
RE_CONST = "([_A-Z][_0-9A-Z]*)"
RE_SET = "=.*"
RE_SPACE = "[[:space:]]"
RE_TSK = "(FIXME|TODO)"
RE_VAR = "([_a-z][_0-9a-z]*)"
RE_SPACES = RE_SPACE "*" RE_ANY = "(.*)"
RE_BEGIN = "^"
RE_CONST = "([_A-Z][_0-9A-Z]*)"
RE_SET = "=.*"
RE_SPACE = "[[:space:]]"
RE_TSK = "(FIXME|TODO)"
RE_VAR = "([_a-z][_0-9a-z]*)"
RE_END = RE_SPACES "$" RE_SPACES = RE_SPACE "*"
RE_FUNC = RE_SPACES "\\(" RE_SPACES "\\)" RE_SPACES "{"
re["alias"] = RE_BEGIN "#=" RE_SPACES RE_VAR RE_END RE_END = RE_SPACES "$"
re["binary"] = RE_BEGIN "#\\|" RE_SPACES RE_VAR RE_END RE_FUNC = RE_SPACES "\\(" RE_SPACES "\\)" RE_SPACES "{"
RE_CLOSE = RE_BEGIN "}" RE_SPACES RE_END
re["command"] = RE_BEGIN "#/" RE_SPACES RE_VAR RE_END re["alias"] = RE_BEGIN "#=" RE_SPACES RE_VAR RE_END
RE_COMMENT = RE_BEGIN "#" RE_ANY RE_END re["binary"] = RE_BEGIN "#\\|" RE_SPACES RE_VAR RE_END
re["constant"] = RE_BEGIN RE_CONST RE_SET RE_END RE_CLOSE = RE_BEGIN "}" RE_SPACES RE_END
RE_DOC = RE_BEGIN RE_SPACES "#" RE_SPACE RE_ANY RE_END re["command"] = RE_BEGIN "#/" RE_SPACES RE_VAR RE_END
re["function"] = RE_BEGIN RE_VAR RE_FUNC RE_END RE_COMMENT = RE_BEGIN "#" RE_ANY RE_END
RE_MODULE = RE_BEGIN "#\\." RE_SPACES RE_ANY RE_END re["constant"] = RE_BEGIN RE_CONST RE_SET RE_END
RE_SHEBANG = RE_BEGIN "#!" RE_SPACES RE_ANY RE_END RE_DOC = RE_BEGIN RE_SPACES "#" RE_SPACE RE_ANY RE_END
RE_TASK = RE_BEGIN RE_SPACES "#" RE_SPACES RE_TSK RE_ANY RE_END re["function"] = RE_BEGIN RE_VAR RE_FUNC RE_END
re["variable"] = RE_BEGIN RE_VAR RE_SET RE_END RE_MODULE = RE_BEGIN "#\\." RE_SPACES RE_ANY RE_END
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_module = 0
match_task = 0
reset()
f = ""
match_alias = 0
match_command = 0
match_module = 0
match_task = 0
reset()
} }
# main
{ {
if (action == "filter") {
if (action == "filter") {
if (match($0, re[target])) { if (match($0, re[target])) {
unique[extract($0, target)] = "" unique[extract($0, target)] = ""
} }
} else if (action == "tasks") {
} else if (action == "tasks") {
line++ line++
if (match($0, RE_MODULE)) { if (match($0, RE_MODULE)) {
line = 1 line = 1
@ -133,7 +143,8 @@ BEGIN {
doc = "" doc = ""
match_task = 0 match_task = 0
} }
} else if (action == "eval") {
} else if (action == "eval") {
if (match($0, re[target])) { if (match($0, re[target])) {
append(extract($0, target)) append(extract($0, target))
} else if (match($0, re["function"])) { } else if (match($0, re["function"])) {
@ -145,7 +156,8 @@ BEGIN {
} else { } else {
reset() reset()
} }
} else if (action == "function") {
} else if (action == "function") {
if (match($0, re["command"])) { if (match($0, re["command"])) {
append(extract($0, "command")) append(extract($0, "command"))
} else if (match($0, re["function"])) { } else if (match($0, re["function"])) {
@ -160,7 +172,8 @@ BEGIN {
} else { } else {
reset() reset()
} }
} else if (action == "doc") {
} else if (action == "doc") {
# doc # doc
if (match($0, RE_SHEBANG)) { if (match($0, RE_SHEBANG)) {
append("! " extract($0, "shebang")) append("! " extract($0, "shebang"))
@ -225,13 +238,18 @@ BEGIN {
reset() reset()
} }
} }
}
} }
}
# end
END { END {
if (action == "filter") {
if (action == "filter") {
for (item in unique) { for (item in unique) {
print item print item
} }
} }
} }