strip_first

This commit is contained in:
Marc Beninca 2025-08-02 18:01:09 +02:00
parent 73fe260aea
commit dfc7a776f5
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -58,7 +58,7 @@ function extract(string, type) {
} }
} }
function remove_first(string, target, tmp) { function strip_first(string, target, tmp) {
tmp = string tmp = string
sub(target, "", tmp) sub(target, "", tmp)
return trim(tmp) return trim(tmp)
@ -125,14 +125,14 @@ function parse(string) {
# module # module
if (match(string, RE_MODULE)) { if (match(string, RE_MODULE)) {
current_match = "module" current_match = "module"
module = remove_first(string, "#\\.") module = strip_first(string, "#\\.")
doc_reset() doc_reset()
shebang = "" shebang = ""
# shebang # shebang
} else if (match(string, RE_SHEBANG)) { } else if (match(string, RE_SHEBANG)) {
current_match = "shebang" current_match = "shebang"
shebang = remove_first(string, "#!") shebang = strip_first(string, "#!")
# constant # constant
} else if (match(string, re["constant"])) { } else if (match(string, re["constant"])) {
@ -147,14 +147,14 @@ function parse(string) {
# alias # alias
} else if (match(string, re["alias"])) { } else if (match(string, re["alias"])) {
current_match = "alias" current_match = "alias"
alias = remove_first(string, "#=") alias = strip_first(string, "#=")
aliases[alias] = "" aliases[alias] = ""
doc_append("= " alias) doc_append("= " alias)
# command # command
} else if (match(string, re["command"])) { } else if (match(string, re["command"])) {
current_match = "command" current_match = "command"
command = remove_first(string, "#/") command = strip_first(string, "#/")
commands[command] = "" commands[command] = ""
doc_append("/ " command) doc_append("/ " command)