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
|
doc = doc string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doc_output(name, type) {
|
||||||
|
print "↙ " type
|
||||||
|
print name
|
||||||
|
print doc
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
function doc_reset() {
|
function doc_reset() {
|
||||||
if (f == "") {
|
if (f == "") {
|
||||||
doc = ""
|
doc = ""
|
||||||
|
@ -51,13 +58,6 @@ function extract(string, type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function output(name, type) {
|
|
||||||
print "↙ " type
|
|
||||||
print name
|
|
||||||
print doc
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
function trim(string) {
|
function trim(string) {
|
||||||
text = string
|
text = string
|
||||||
sub("^[\t ]*", "", text)
|
sub("^[\t ]*", "", text)
|
||||||
|
@ -125,7 +125,7 @@ function parse(string) {
|
||||||
# other
|
# other
|
||||||
} else {
|
} else {
|
||||||
if (module = target) {
|
if (module = target) {
|
||||||
output(target, "module")
|
doc_output(target, "module")
|
||||||
} else {
|
} else {
|
||||||
doc_reset()
|
doc_reset()
|
||||||
}
|
}
|
||||||
|
@ -162,14 +162,14 @@ if (action == "doc") {
|
||||||
} else if (match($0, re["constant"])) {
|
} else if (match($0, re["constant"])) {
|
||||||
matched = extract($0, "constant")
|
matched = extract($0, "constant")
|
||||||
if (matched == target) {
|
if (matched == target) {
|
||||||
output(matched, "constant")
|
doc_output(matched, "constant")
|
||||||
} else {
|
} else {
|
||||||
doc_reset()
|
doc_reset()
|
||||||
}
|
}
|
||||||
} else if (match($0, re["variable"])) {
|
} else if (match($0, re["variable"])) {
|
||||||
matched = extract($0, "variable")
|
matched = extract($0, "variable")
|
||||||
if (matched == target) {
|
if (matched == target) {
|
||||||
output(matched, "variable")
|
doc_output(matched, "variable")
|
||||||
} else {
|
} else {
|
||||||
doc_reset()
|
doc_reset()
|
||||||
}
|
}
|
||||||
|
@ -179,12 +179,12 @@ if (action == "doc") {
|
||||||
} else if (match($0, RE_CLOSE)) {
|
} else if (match($0, RE_CLOSE)) {
|
||||||
if (match_alias) {
|
if (match_alias) {
|
||||||
print "= " target
|
print "= " target
|
||||||
output(f, "function")
|
doc_output(f, "function")
|
||||||
} else if (match_command) {
|
} else if (match_command) {
|
||||||
print "/ " target
|
print "/ " target
|
||||||
output(f, "function")
|
doc_output(f, "function")
|
||||||
} else if (f == target) {
|
} else if (f == target) {
|
||||||
output(f, "function")
|
doc_output(f, "function")
|
||||||
} else {
|
} else {
|
||||||
f = ""
|
f = ""
|
||||||
doc_reset()
|
doc_reset()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue