Implement prefix-based interactive commands via ! (issue #14)
Add !command syntax that runs commands with inherited terminal (no
capture). The lexer treats ! as a statement-starting token, reading
to end-of-line with the same interpolation/escape/pipe support as
backtick commands. The C function sets _ = {code=N, stdout="", stderr=""}.
This commit is contained in:
@@ -124,9 +124,12 @@ lexerror([['alo \98]], "<eof>")
|
||||
-- valid characters in variable names
|
||||
for i = 0, 255 do
|
||||
local s = string.char(i)
|
||||
-- skip '!' which is now a valid statement starter (interactive commands)
|
||||
if s == '!' then goto continue end
|
||||
assert(not string.find(s, "[a-zA-Z_]") == not load(s .. "=1", ""))
|
||||
assert(not string.find(s, "[a-zA-Z_0-9]") ==
|
||||
not load("a" .. s .. "1 = 1", ""))
|
||||
::continue::
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user