1
0
Fork 0
mirror of https://github.com/notwa/lips synced 2024-11-14 21:59: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
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
local ok, err = pcall(main) if options.unsafe then
return err return main()
else
local ok, err = pcall(main)
return err
end
end end
return setmetatable(assembler, { return setmetatable(assembler, {