lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Jul 7, 2011 3:08 AM, "pansz" <pan.shizhu@gmail.com> wrote:
> The syntax for function definition is
>
>        function ::= function funcbody
>        funcbody ::= `(´ [parlist] `)´ block end
>
> you need to lookahead parse until the "end" to know that this is a funcbody.
>
> () brackets can be a valid statement itself, without "end".

This isn't true. "(exp)" cannot be a statement. It can be used as a prefix to a function call or assignment.

You would need a lookahead parser to verify that the parenthesis do not form this prefix though.