mirror of
https://github.com/notwa/lips
synced 2024-11-14 19:39:03 -08:00
added 'unsafe' option to not wrap execution in pcall
This commit is contained in:
parent
d1edcf4fab
commit
5aa0b5abe1
1 changed files with 7 additions and 3 deletions
6
lips.lua
6
lips.lua
|
@ -1308,7 +1308,7 @@ function Dumper:dump()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function assemble(fn_or_asm, writer)
|
local function assemble(fn_or_asm, writer, options)
|
||||||
-- assemble MIPS R4300i assembly code.
|
-- assemble MIPS R4300i assembly code.
|
||||||
-- if fn_or_asm contains a newline; treat as assembly, otherwise load file.
|
-- if fn_or_asm contains a newline; treat as assembly, otherwise load file.
|
||||||
-- returns error message on error, or nil on success.
|
-- returns error message on error, or nil on success.
|
||||||
|
@ -1334,8 +1334,12 @@ local function assemble(fn_or_asm, writer)
|
||||||
return parser:parse(asm)
|
return parser:parse(asm)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if options.unsafe then
|
||||||
|
return main()
|
||||||
|
else
|
||||||
local ok, err = pcall(main)
|
local ok, err = pcall(main)
|
||||||
return err
|
return err
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return setmetatable(assembler, {
|
return setmetatable(assembler, {
|
||||||
|
|
Loading…
Reference in a new issue