archives

« Bugzilla Issues Index

#2858 — Define DecimalDigit as one of 0, NonDecimalDigit


I couldn't find any precedent to support this in the spec, so it could possibly be dismissed outright. The following defines DecimalDigit in terms of 0 and the nonterminal symbol NonZeroDigit, whose terminals make up the remaining 1-9 digits. Unless I'm mistaken, then DecimalIntegerLiteral can be refactored to just DecimalDigits.


DecimalIntegerLiteral ::
DecimalDigits

DecimalDigits ::
DecimalDigit
DecimalDigits DecimalDigit

DecimalDigit :: one of
0
NonZeroDigit

NonZeroDigit :: one of
1 2 3 4 5 6 7 8 9


Which is a refactoring of:


DecimalIntegerLiteral ::
0
NonZeroDigit DecimalDigits[opt]

DecimalDigits ::
DecimalDigit
DecimalDigits DecimalDigit

DecimalDigit :: one of
0 1 2 3 4 5 6 7 8 9

NonZeroDigit :: one of
1 2 3 4 5 6 7 8 9


Your proposed syntax would accept e.g. "03", which the existing syntax does not accept (presumably because it looks like a LegacyOctalIntegerLiteral).


(In reply to comment #1)
> Your proposed syntax would accept e.g. "03", which the existing syntax does not
> accept (presumably because it looks like a LegacyOctalIntegerLiteral).

Heh, just a tiny oversight :)

Thanks, closing this.