Complete floating point literals
Timon Gehr
timon.gehr at gmx.ch
Sun Jul 10 12:12:49 PDT 2011
KennyTM~ wrote:
> 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)
I don't get what you are saying here.
The change turns this:
DecimalFloat:
LeadingDecimal .
LeadingDecimal . DecimalDigits
DecimalDigits . DecimalDigits DecimalExponent
. Decimal
. Decimal DecimalExponent
LeadingDecimal DecimalExponent
into this:
DecimalFloat:
LeadingDecimal . LeadingDecimal
DecimalDigits . LeadingDecimal DecimalExponent
LeadingDecimal DecimalExponent
(similarly for hex)
That is making the grammar *simpler* in my book.
> 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.
That is quite ugly.
Cheers,
-Timon
More information about the Digitalmars-d
mailing list