lua-users home
lua-l archive

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


Hi,

Luiz Henrique de Figueiredo wrote:
> > BTW: Has anyone noticed that the following:
> > 
> >   x=1y=2print(x,y)
> > 
> > is accepted by the lexer as valid Lua code
> 
> Why shouldn't it?  It may be ugly but it's valid.

I disagree. It should be rejected by the lexer and it should
certainly not be promoted.

It needlessly complicates token based lexers and it violates
the principle of least surprise (big time).

Other languages allowing such constructs are generally in
the 'obfuscated' category. IMHO this is not the right spot
for Lua.

> Hence my insistence on reusing the Lua lexer...

This is all fine and dandy. Except that the Lua lexer has been
written for a specific purpose -- the Lua core -- and works fine
inside of it. But it's not exactly easy to reuse, to embed or
to extend outside of it.

Forcing tool authors to use a specific implementation of
a lexer is not helpful. It would be a bit silly when every
editor with syntax highlighting needs to integrate the original
lexers of all languages it supports.

Bye,
     Mike