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

Statement expressions

This commit is contained in:
Étienne Fildadut 2017-08-24 20:28:07 +02:00
parent 1d5390d0a7
commit 20e33c279e
4 changed files with 64 additions and 22 deletions

View file

@ -316,6 +316,30 @@ return function(code, ast, options)
Paren = (t)
return "(" .. lua(t[1]) .. ")"
end,
-- DoExpr{ stat* }
DoExpr = (t)
return "(function()" .. indent() .. lua(t, "Do") .. unindent() .. "end)()"
end,
-- WhileExpr{ expr block }
WhileExpr = (t)
return "(function()" .. indent() .. lua(t, "While") .. unindent() .. "end)()"
end,
-- RepeatExpr{ expr block }
RepeatExpr = (t)
return "(function()" .. indent() .. lua(t, "Repeat") .. unindent() .. "end)()"
end,
-- IfExpr{ (expr block)+ block? }
IfExpr = (t)
return "(function()" .. indent() .. lua(t, "If") .. unindent() .. "end)()"
end,
-- FornumExpr{ ident expr expr expr? block }
FornumExpr = (t)
return "(function()" .. indent() .. lua(t, "Fornum") .. unindent() .. "end)()"
end,
-- Forin{ {ident+} {expr+} block }
ForninExpr = (t)
return "(function()" .. indent() .. lua(t, "Forin") .. unindent() .. "end)()"
end,
-- apply (below)
-- lhs (below)