lua-users home
lua-l archive

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

My guess is that the lexer works left-to-right with out backtracking, which is the most common and efficient way.

It sees '6' and starts scanning a number,
it sees '4' and continues scanning the number,
it sees '.' and is still happy scanning the number,
and then it sees another '.' which it does not recognise as in a number.

When it gets this far it can't go back and try something different so it generates an error. Having a backtracking scanner would be much slower, and lead to even more strange cases.


----- Original Message -----
> From: "Egor Skriptunoff" <>
> To: "Lua mailing list" <>
> Sent: Monday, 17 September, 2012 3:32:51 PM
> Subject: Probably bug in implementation of numerical constant parsing
> This string causes "malformed number" error:
> print(64..'KB')
> It seems that lexer does not know that two dots are never contained
> in
> numerical constant.
> IMHO, correct parsing of numerical constant should stop before
> concatenation operator.