lua-users home
lua-l archive

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

I agree that the special case of <expr>.<keyword> could be resolved by having the lexer produce an identifier after the token '.'.

Once you do that the next request will be to support

  { function = 3 }

as the equivalent of

  { ["function"] = 3 }

This is trickier because

  { function = 3 }


  { function () return 5 end }

would both be legal and now we need more lookahead. I believe it's better not to go down this road. Error messages become less meaningful as well.

On Wed, 9 Mar 2011, Axel Kittenberger wrote:

When local variables are allowed to be identical to keywords as well,
then the parser suddenly gets a magnitude more complex!
locel end = 1
if foocondition then end = end + 1 end

if foo then end

This is useless but correct Lua, which makes your example no longer parsable using one token lookahead either.