1
0
Fork 0
mirror of https://github.com/Reuh/candran.git synced 2025-10-27 09:59:29 +00:00

Fixed using return at the end of a loop that use continue

This commit is contained in:
Étienne Fildadut 2019-08-23 21:12:45 +02:00
parent 91948109ca
commit 7df95abc6d
3 changed files with 26 additions and 13 deletions

View file

@ -19,6 +19,13 @@ tags.Break = ()
end
end
tags.Goto = ()
error("Lua 5.1 does not support the goto keyword")
end
tags.Label = ()
error("Lua 5.1 does not support labels")
end
#local patch = output
#output = ""
#import("compiler.luajit", { patch = patch, loadPackage = false })

View file

@ -123,10 +123,10 @@ return function(code, ast, options)
return "do" .. indent() .. "local a = table.pack(" .. toAppend .. ")" .. newline() .. "table.move(a, 1, a.n, #" .. t .. "+1, " .. t .. ")" .. unindent() .. "end"
end
local CONTINUE_START = () -- at the start of loops using continue
return ""
return "do" .. indent()
end
local CONTINUE_STOP = () -- at the start of loops using continue
return newline() .. "::" .. var("continue") .. "::"
return unindent() .. "end" .. newline() .. "::" .. var("continue") .. "::"
end
--- Tag constructors