lua-users home
lua-l archive

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


>> local resource x = 5
> So what you showed appears invalid grammatically ... but the parser allows it?

It's interpreted as `local resource; x = 5`, which is valid.

Paul.

On Wed, Jun 5, 2019 at 7:59 AM Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
>
> On Wed, 5 Jun 2019 at 15:53, Matthew Wild <mwild1@gmail.com> wrote:
> > $ cat resource.lua
> > local resource x = 5
> > print(resource, x)
> >
> > $ lua5.3 resource.lua
> > nil        5
> >
>
> Okay, I am a bit puzzled. The grammar says:
>
> local namelist [‘=’ explist]
>
> namelist ::= Name {‘,’ Name}
>
> So what you showed appears invalid grammatically ... but the parser allows it?
>
> But I agree that if above statement is currently accepted then there
> is a compatibility issue.
>
> Regards
>