parse/alias,command
This commit is contained in:
parent
20b5b095b2
commit
fc19ff4cbe
1 changed files with 18 additions and 14 deletions
|
@ -94,8 +94,6 @@ 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_TASK = RE_BEGIN RE_SPACES "#" RE_SPACES RE_TSK RE_ANY RE_END
|
||||||
re["variable"] = RE_BEGIN RE_VAR RE_SET RE_END
|
re["variable"] = RE_BEGIN RE_VAR RE_SET RE_END
|
||||||
|
|
||||||
match_alias = 0
|
|
||||||
match_command = 0
|
|
||||||
match_task = 0
|
match_task = 0
|
||||||
doc_reset()
|
doc_reset()
|
||||||
|
|
||||||
|
@ -121,6 +119,24 @@ function parse(string) {
|
||||||
sub("#!", "", shebang)
|
sub("#!", "", shebang)
|
||||||
shebang = trim(shebang)
|
shebang = trim(shebang)
|
||||||
|
|
||||||
|
# alias
|
||||||
|
} else if (match(string, re["alias"])) {
|
||||||
|
current_match = "alias"
|
||||||
|
alias = string
|
||||||
|
sub("#=", "", alias)
|
||||||
|
alias = trim(alias)
|
||||||
|
aliases[alias] = ""
|
||||||
|
doc_append("= " alias)
|
||||||
|
|
||||||
|
# command
|
||||||
|
} else if (match(string, re["command"])) {
|
||||||
|
current_match = "command"
|
||||||
|
command = string
|
||||||
|
sub("#/", "", command)
|
||||||
|
command = trim(command)
|
||||||
|
commands[command] = ""
|
||||||
|
doc_append("/ " command)
|
||||||
|
|
||||||
# other
|
# other
|
||||||
} else {
|
} else {
|
||||||
if (module == target) {
|
if (module == target) {
|
||||||
|
@ -145,18 +161,6 @@ if (action == "doc") {
|
||||||
} else {
|
} else {
|
||||||
doc_append(extract($0, "doc"))
|
doc_append(extract($0, "doc"))
|
||||||
}
|
}
|
||||||
} else if (match($0, re["alias"])) {
|
|
||||||
matched = extract($0, "alias")
|
|
||||||
doc_append("= " matched)
|
|
||||||
if (matched == target) {
|
|
||||||
match_alias = 1
|
|
||||||
}
|
|
||||||
} else if (match($0, re["command"])) {
|
|
||||||
matched = extract($0, "command")
|
|
||||||
doc_append("/ " matched)
|
|
||||||
if (matched == target) {
|
|
||||||
match_command = 1
|
|
||||||
}
|
|
||||||
# set
|
# set
|
||||||
} else if (match($0, re["constant"])) {
|
} else if (match($0, re["constant"])) {
|
||||||
matched = extract($0, "constant")
|
matched = extract($0, "constant")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue