On Jul 11, 11 02:03, bearophile wrote:
Daniel Murphy:

If the only reason for removing 1.f and 1.L is to aid ufcs

It's not the only reason, it's also a special case of the rule that asks for a 
zero.


we should also get rid of leading underscores after the decimal
point.  eg 1._3 also conflicts with ufcs.

I see (this doesn't look nice regardless of UFCS, but changing it introduces a 
special case in the use of the underscore).


No special case needed. Just complicate the grammar to

    // in terms of regex: [0-9][0-9_]*

    DecimalDigits:
       DecimalDigit
       DecimalDigit DecimalDigitsOrUnderscores

    DecimalDigitsOrUnderscores:
       DecimalDigitOrUnderscore
       DecimalDigitOrUnderscore DecimalDigitsOrUnderscores

    DecimalDigit:
       0
       NonZeroDigit

    DecimalDigitOrUnderscore
       _
       DecimalDigit

(similar for HexDigits)

is enough to get rid of leading underscores. (See also http://d.puremagic.com/issues/show_bug.cgi?id=2734) But I'd prefer keeping the grammar simple and require the programmer to add '(' ')'

    (1)._1;
    (4)._0f;
    (0xf).deep-2;

or a space ' '

    1 ._1;
    4 ._0f;
    0xf .deep-2;

if they really meant to.


And don't forget hex floating point literals.

Right.

Bye,
bearophile

Reply via email to