This commit is contained in:
Christoph J. Scherr 2024-02-15 14:26:01 +01:00
parent 3e3855bc8a
commit 7176181aef
Signed by: cscherrNT
GPG Key ID: 8E2B45BC51A27EA7
1 changed files with 6 additions and 3 deletions

View File

@ -8,7 +8,7 @@ function tokenize_args(raw)
-- '*?' does not work
-- '|' is not or
--
-- This means we're better of implementing a programatic lexer.
-- This means we're better of implementing the lexer with an algorithm.
local t = {}
local current = ""
local in_str = false
@ -33,7 +33,9 @@ function tokenize_args(raw)
current = current .. c
end
end
if string.len(current) > 0 then
table.insert(t, current)
end
return t
end
@ -58,7 +60,8 @@ function dump(t)
end
function main()
local mockargs = [[-iab --foo '{"QUX": "BAR"}' --ala=boa]]
local mockargs =
[[--name "tls_service_rs" --base-dir ${PWD%/*/*} --log-level "TRACE" -j '{ "MODE": "server", "CERT": "data/server.crt", "KEY": "data/server.key", "CHAIN": "data/root.crt", "ADDR": "127.0.0.1:9999", "HOSTNAME": "localhost" }']]
print(mockargs)
local split = tokenize_args(mockargs)
print(dump(split))