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