doc/output
This commit is contained in:
parent
114e514257
commit
d51d635252
1 changed files with 13 additions and 13 deletions
|
@ -19,6 +19,13 @@ function doc_append(string) {
|
|||
doc = doc string
|
||||
}
|
||||
|
||||
function doc_output(name, type) {
|
||||
print "↙ " type
|
||||
print name
|
||||
print doc
|
||||
exit
|
||||
}
|
||||
|
||||
function doc_reset() {
|
||||
if (f == "") {
|
||||
doc = ""
|
||||
|
@ -51,13 +58,6 @@ function extract(string, type) {
|
|||
}
|
||||
}
|
||||
|
||||
function output(name, type) {
|
||||
print "↙ " type
|
||||
print name
|
||||
print doc
|
||||
exit
|
||||
}
|
||||
|
||||
function trim(string) {
|
||||
text = string
|
||||
sub("^[\t ]*", "", text)
|
||||
|
@ -125,7 +125,7 @@ function parse(string) {
|
|||
# other
|
||||
} else {
|
||||
if (module = target) {
|
||||
output(target, "module")
|
||||
doc_output(target, "module")
|
||||
} else {
|
||||
doc_reset()
|
||||
}
|
||||
|
@ -162,14 +162,14 @@ if (action == "doc") {
|
|||
} else if (match($0, re["constant"])) {
|
||||
matched = extract($0, "constant")
|
||||
if (matched == target) {
|
||||
output(matched, "constant")
|
||||
doc_output(matched, "constant")
|
||||
} else {
|
||||
doc_reset()
|
||||
}
|
||||
} else if (match($0, re["variable"])) {
|
||||
matched = extract($0, "variable")
|
||||
if (matched == target) {
|
||||
output(matched, "variable")
|
||||
doc_output(matched, "variable")
|
||||
} else {
|
||||
doc_reset()
|
||||
}
|
||||
|
@ -179,12 +179,12 @@ if (action == "doc") {
|
|||
} else if (match($0, RE_CLOSE)) {
|
||||
if (match_alias) {
|
||||
print "= " target
|
||||
output(f, "function")
|
||||
doc_output(f, "function")
|
||||
} else if (match_command) {
|
||||
print "/ " target
|
||||
output(f, "function")
|
||||
doc_output(f, "function")
|
||||
} else if (f == target) {
|
||||
output(f, "function")
|
||||
doc_output(f, "function")
|
||||
} else {
|
||||
f = ""
|
||||
doc_reset()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue