diff --git a/sh/core/code.awk b/sh/core/code.awk index 469d8f0..6565d02 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -23,6 +23,9 @@ function extract(string, type) { } else if (type == "function") { split(string, array, "()") return trim(array[1]) + } else if (type == "module") { + split(string, array, "#\\.") + return trim(array[2]) } else if ((type == "constant") || (type == "variable")) { split(string, array, "=") return trim(array[1]) @@ -90,7 +93,7 @@ BEGIN { unique[extract($0, target)] = "" } } else if (action == "tasks") { - if (match($0, RE_MODULE, m)) { + if (match($0, RE_MODULE)) { if (output_tasks) { print "" print output_module @@ -99,17 +102,17 @@ BEGIN { } doc = "" match_task = 0 - output_module = ". " m[1] - } else if (match($0, RE_TASK, m)) { + output_module = ". " extract($0, "module") + } else if (match($0, RE_TASK)) { if (target) { - if (target == m[1]) { + if (target == extract($0, "task")) { match_task = 1 } } else { match_task = 1 } append($0) - } else if (match($0, RE_COMMENT, m)) { + } else if (match($0, RE_COMMENT)) { append($0) } else { if (match_task) {