Re: Parenless calls for function literals

"'TopchetoEU' via lua-l" <[email protected]> Fri, 29 May 2026 11:47:12 +0000
Newsgroups gmane.comp.lang.lua.general
Message-ID <l7XlyKW5sRnK_HeddtHzkxXg5mSOVxclSFOE5hsjfDt44nqCmxNTFaGzJsswClCNF0fOUJp9g-UaI4m3h3OASF-jFO8Z_Jk8BRvMauDdV88=@proton.me>
Your tool wouldn't nicely transform this syntax, as I'm trying to transform `expression begin stm1 stm2 stm3 end` to `expression(function(...) stm1 stm2 stm3 end)`, which on the token level is exponentially harder, because you need to know where the function body ends, so that you can insert the closing call parenthesis.

Off the top of my head, I can think of a scheme where you count then-end, do-end and repeat-until pairs, so you know which `end` token matches `begin`. That however would be more cumbersome than just patching the lua code itself.

On Thursday, May 28th, 2026 at 9:20 PM, Luiz Henrique de Figueiredo <[email protected]> wrote:

> >     called_function begin
> >         body_of_function_literal
> >     end
> 
> Transforming '<name> begin' to 'function <name>()' is very easy with
> ltokenp, my token processor:
> https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/#ltokenp

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/l7XlyKW5sRnK_HeddtHzkxXg5mSOVxclSFOE5hsjfDt44nqCmxNTFaGzJsswClCNF0fOUJp9g-UaI4m3h3OASF-jFO8Z_Jk8BRvMauDdV88%3D%40proton.me.