Closed epatrizio closed 11 months ago
Check block
definition in parser
https://github.com/epatrizio/ola/blob/main/src/parser.mly
In PR mentioned above (parser full refactoring), return
can only be written as the last block statement.
Otherwise it causes a syntax error.
Check line 76 https://github.com/epatrizio/ola/blob/main/test/blocks.lua
related issue #7
3.3.4 – Control Structures (official documentation) https://www.lua.org/manual/5.4/manual.html#3.3.4
The return statement can only be written as the last statement of a block. If it is necessary to return in the middle of a block, then an explicit inner block can be used, as in the idiom do return end, because now return is the last statement in its (inner) block.
-- Actually, when
return
isn't at the end of the block, the stop is still made at this point.