@@ -294,10 +294,14 @@ literal_. The grammar for recognizing the two kinds of literals is mixed.
294
294
> INTEGER_LITERAL :
295
295
>   ;  ; ( DEC_LITERAL | BIN_LITERAL | OCT_LITERAL | HEX_LITERAL )
296
296
> INTEGER_SUFFIX<sup >?</sup >
297
- >
297
+ >
298
298
> DEC_LITERAL :
299
299
>   ;  ; DEC_DIGIT (DEC_DIGIT|` _ ` )<sup >\* </sup >
300
300
>
301
+ > TUPLE_INDEX :
302
+ >   ;  ;   ;  ; ` 0 `
303
+ >   ;  ; | NON_ZERO_DEC_DIGIT DEC_DIGIT<sup >\* </sup >
304
+ >
301
305
> BIN_LITERAL :
302
306
>   ;  ; ` 0b ` (BIN_DIGIT|` _ ` )<sup >\* </sup > BIN_DIGIT (BIN_DIGIT|` _ ` )<sup >\* </sup >
303
307
>
@@ -313,19 +317,23 @@ literal_. The grammar for recognizing the two kinds of literals is mixed.
313
317
>
314
318
> DEC_DIGIT : [ ` 0 ` -` 9 ` ]
315
319
>
320
+ > NON_ZERO_DEC_DIGIT : [ ` 1 ` -` 9 ` ]
321
+ >
316
322
> HEX_DIGIT : [ ` 0 ` -` 9 ` ` a ` -` f ` ` A ` -` F ` ]
317
323
>
318
324
> INTEGER_SUFFIX :
319
325
>   ;  ;   ;  ; ` u8 ` | ` u16 ` | ` u32 ` | ` u64 ` | ` usize `
320
326
>   ;  ; | ` i8 ` | ` i16 ` | ` i32 ` | ` i64 ` | ` isize `
321
327
322
- <!-- FIXME: separate the DECIMAL_LITERAL with no prefix or suffix (used on tuple indexing and float_literal -->
323
328
<!-- FIXME: u128 and i128 -->
324
329
325
330
An _ integer literal_ has one of four forms:
326
331
327
332
* A _ decimal literal_ starts with a * decimal digit* and continues with any
328
333
mixture of * decimal digits* and _ underscores_ .
334
+ * A _ tuple index_ is either ` 0 ` , or starts with a * non-zero decimal digit* and
335
+ continues with zero or more decimal digits. Tuple indexes are used to refer
336
+ to the fields of [ tuples] , [ tuple structs] and [ tuple variants] .
329
337
* A _ hex literal_ starts with the character sequence ` U+0030 ` ` U+0078 `
330
338
(` 0x ` ) and continues as any mixture (with at least one digit) of hex digits
331
339
and underscores.
@@ -500,3 +508,6 @@ They are catalogued in [the Symbols section][symbols] of the Grammar document.
500
508
[ symbols ] : ../grammar.html#symbols
501
509
[ keywords ] : keywords.html
502
510
[ identifier ] : identifiers.html
511
+ [ tuples ] : types.html#tuple-types
512
+ [ tuple structs ] : items/structs.html
513
+ [ tuple variants ] : items/enumerations.html
0 commit comments