1
0
Fork 0
mirror of https://github.com/notwa/lips synced 2024-11-14 17:09:03 -08:00

added 'unsafe' option to not wrap execution in pcall

This commit is contained in:
Connor Olding 2015-11-24 17:06:38 -08:00
parent d1edcf4fab
commit 5aa0b5abe1

View file

@ -1308,7 +1308,7 @@ function Dumper:dump()
end
end
local function assemble(fn_or_asm, writer)
local function assemble(fn_or_asm, writer, options)
-- assemble MIPS R4300i assembly code.
-- if fn_or_asm contains a newline; treat as assembly, otherwise load file.
-- returns error message on error, or nil on success.
@ -1334,8 +1334,12 @@ local function assemble(fn_or_asm, writer)
return parser:parse(asm)
end
if options.unsafe then
return main()
else
local ok, err = pcall(main)
return err
end
end
return setmetatable(assembler, {