[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Probably bug in implementation of numerical constant parsing
- From: Robert Virding <robert.virding@...>
- Date: Mon, 17 Sep 2012 15:26:24 +0100 (BST)
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.
Robert
----- Original Message -----
> From: "Egor Skriptunoff" <egor.skriptunoff@gmail.com>
> To: "Lua mailing list" <lua-l@lists.lua.org>
> 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.
>
>