[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: At sign ``@'' in key
- From: Coda Highland <chighland@...>
- Date: Thu, 20 Dec 2012 11:24:11 -0800
On Thu, Dec 20, 2012 at 11:05 AM, Wolfgang Pupp <wolfgang.pupp@gmail.com> wrote:
> Michal Kolodziejczyk wrote:
>> <snip> or use:
>> tab[ [[var@addr]] ]=1
>
> This made me wonder- is "a[[[b]]] = c" actually a syntactically
> correct Lua statement? (it was rejected in every implementation I
> tried)
>
> Looking at the Lua 5.1 EBNF, I'd have interpreted this as:
> var `=´ Name
> with
> var <=> prefixexp `[´ exp `]´ <=> Name `[´ String `]´ <=> `a´ `[´
> `[[b]]´ `]´
>
> Now I'm confused... Is my understanding of the EBNF broken, or was it
> merely an implementation choice to not allow this?
>
> --Wolfgang
>
The spaces in [ [[b]] ] are necessary, otherwise the lexer reads the
first [[ as the string delimiter and tries to parse it as a function
call with a single string argument.
/s/ Adam