[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Curiosity of decimal numbers followed by concatenation
- From: Gé Weijers <ge@...>
- Date: Sat, 06 Feb 2010 20:27:56 -0800
On Fri, 2010-02-05 at 15:30 +0100, Michal Kolodziejczyk wrote:
> Because it is ambiguous. Use parentheses or tonumber().
No, it's not ambiguous. Regular programming languages use a 'longest
valid match' rule for lexical scanners. You don't expect Lua to parse
locale = 3
local e = 3
That's why 1...e should be tokenized as 1. followed by .. followed by e,
because those are the longest matches. For expediency or efficiency the
Lua authors have taken a shortcut, which produces strange results in
some corner cases.
Gé Weijers <firstname.lastname@example.org>