[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Unary Minus for Constants
- From: roberto@... (Roberto Ierusalimschy)
- Date: Thu, 9 Aug 2007 09:41:41 -0300
> However, the Lua parser takes the preceding "-" and does not
> pass it to the numeric conversion routine.
>
> Instead, it passes everything AFTER the "-" and then does the
> unary minus as defined for the default arithmetic type.
Most languages do this. If you include the "-" as part of the number
you will need some trick to parse "x-1", as it would read as a variable
("x") followed by a constant ("-1"), with no operation.
-- Roberto