mirror of
https://github.com/Reuh/candran.git
synced 2025-10-27 09:59:29 +00:00
38 lines
894 B
Text
38 lines
894 B
Text
targetName = "Lua 5.1"
|
|
|
|
states.continue = {} -- when in a loop that use continue
|
|
|
|
CONTINUE_START = ()
|
|
return "local " .. var("break") .. newline() .. "repeat" .. indent() .. push("continue", var("break"))
|
|
end
|
|
CONTINUE_STOP = ()
|
|
return pop("continue") .. unindent() .. "until true" .. newline() .. "if " .. var("break") .. " then break end"
|
|
end
|
|
|
|
tags.Continue = ()
|
|
return "break"
|
|
end
|
|
tags.Break = ()
|
|
local inContinue = peek("continue")
|
|
if inContinue then
|
|
return inContinue .. " = true" .. newline() .. "break"
|
|
else
|
|
return "break"
|
|
end
|
|
end
|
|
|
|
-- Unsuported features
|
|
tags.Goto = ()
|
|
error("target "..targetName.." does not support gotos")
|
|
end
|
|
tags.Label = ()
|
|
error("target "..targetName.." does not support goto labels")
|
|
end
|
|
|
|
#placeholder("patch")
|
|
|
|
#local patch = output
|
|
#output = ""
|
|
#import("compiler.luajit", { preprocessorEnv = { patch = patch }, loadPackage = false })
|
|
|
|
return luajit
|