diff --git a/sh/core/code.awk b/sh/core/code.awk index 6418469..a94ed93 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -112,41 +112,8 @@ function parse(string) { # FIXME handle no action -# tasks -if (action == "tasks") { - line++ - if (match($0, RE_MODULE)) { - line = 1 - if (output_tasks) { - print "" - print output_module - print output_tasks - output_tasks = "" - } - doc = "" - match_task = 0 - output_module = ". " extract($0, "module") - } else if (match($0, RE_TASK)) { - if (target) { - if (target == extract($0, "task")) { - match_task = 1 - } - } else { - match_task = 1 - } - append(line ": " $0) - } else if (match($0, RE_COMMENT)) { - append(line ": " $0) - } else { - if (match_task) { - output_tasks = output_tasks "\n" doc - } - doc = "" - match_task = 0 - } - # doc -} else if (action == "doc") { +if (action == "doc") { # doc if (match($0, RE_SHEBANG)) { append("! " extract($0, "shebang")) @@ -212,6 +179,39 @@ if (action == "tasks") { } } +# tasks +} else if (action == "tasks") { + line++ + if (match($0, RE_MODULE)) { + line = 1 + if (output_tasks) { + print "" + print output_module + print output_tasks + output_tasks = "" + } + doc = "" + match_task = 0 + output_module = ". " extract($0, "module") + } else if (match($0, RE_TASK)) { + if (target) { + if (target == extract($0, "task")) { + match_task = 1 + } + } else { + match_task = 1 + } + append(line ": " $0) + } else if (match($0, RE_COMMENT)) { + append(line ": " $0) + } else { + if (match_task) { + output_tasks = output_tasks "\n" doc + } + doc = "" + match_task = 0 + } + # function } else if (action == "function") { if (match($0, re["command"])) {