Skip to content

Commit 8e79044

Browse files
committed
Add tuple index token
1 parent 1226907 commit 8e79044

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/tokens.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,14 @@ literal_. The grammar for recognizing the two kinds of literals is mixed.
294294
> INTEGER_LITERAL :
295295
>    ( DEC_LITERAL | BIN_LITERAL | OCT_LITERAL | HEX_LITERAL )
296296
> INTEGER_SUFFIX<sup>?</sup>
297-
>
297+
>
298298
> DEC_LITERAL :
299299
> &nbsp;&nbsp; DEC_DIGIT (DEC_DIGIT|`_`)<sup>\*</sup>
300300
>
301+
> TUPLE_INDEX :
302+
> &nbsp;&nbsp; &nbsp;&nbsp; `0`
303+
> &nbsp;&nbsp; | NON_ZERO_DEC_DIGIT DEC_DIGIT<sup>\*</sup>
304+
>
301305
> BIN_LITERAL :
302306
> &nbsp;&nbsp; `0b` (BIN_DIGIT|`_`)<sup>\*</sup> BIN_DIGIT (BIN_DIGIT|`_`)<sup>\*</sup>
303307
>
@@ -313,19 +317,23 @@ literal_. The grammar for recognizing the two kinds of literals is mixed.
313317
>
314318
> DEC_DIGIT : [`0`-`9`]
315319
>
320+
> NON_ZERO_DEC_DIGIT : [`1`-`9`]
321+
>
316322
> HEX_DIGIT : [`0`-`9` `a`-`f` `A`-`F`]
317323
>
318324
> INTEGER_SUFFIX :
319325
> &nbsp;&nbsp; &nbsp;&nbsp; `u8` | `u16` | `u32` | `u64` | `usize`
320326
> &nbsp;&nbsp; | `i8` | `i16` | `i32` | `i64` | `isize`
321327
322-
<!-- FIXME: separate the DECIMAL_LITERAL with no prefix or suffix (used on tuple indexing and float_literal -->
323328
<!-- FIXME: u128 and i128 -->
324329

325330
An _integer literal_ has one of four forms:
326331

327332
* A _decimal literal_ starts with a *decimal digit* and continues with any
328333
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].
329337
* A _hex literal_ starts with the character sequence `U+0030` `U+0078`
330338
(`0x`) and continues as any mixture (with at least one digit) of hex digits
331339
and underscores.
@@ -500,3 +508,6 @@ They are catalogued in [the Symbols section][symbols] of the Grammar document.
500508
[symbols]: ../grammar.html#symbols
501509
[keywords]: keywords.html
502510
[identifier]: identifiers.html
511+
[tuples]: types.html#tuple-types
512+
[tuple structs]: items/structs.html
513+
[tuple variants]: items/enumerations.html

0 commit comments

Comments
 (0)