lua-users home
lua-l archive

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


On Fri, May 20, 2016 at 3:15 AM, Egor Skriptunoff <egor.skriptunoff@gmail.com> wrote:
Suggestion:
Lexer must replace "minus followed by a number" with "plus followed by
negative number" before starting to calculate the number value.


It seems that the problem still exists.

In the following code :
local obj = setmetatable({}, {__sub = ...})
obj = obj-9223372036854775808

we are not able to write it as "obj+math.mininteger" as it would invoke
wrong metamethod ("__add" instead of "__sub").

As lexer does not have enough information to correctly choose
the type of number, it should be parser's job.

Or we should handle "9223372036854775808" as a special literal
in the language grammar.