33Tokens are primitive productions in the grammar defined by regular
44(non-recursive) languages. "Simple" tokens are given in [ string table
55production] form, and occur in the rest of the
6- grammar as double-quoted strings . Other tokens have exact rules given.
6+ grammar in ` monospace ` font . Other tokens have exact rules given.
77
88[ string table production ] : notation.html#string-table-productions
99
@@ -227,8 +227,7 @@ preceded by the characters `U+0062` (`b`) and `U+0022` (double-quote), and
227227followed by the character ` U+0022 ` . If the character ` U+0022 ` is present within
228228the literal, it must be _ escaped_ by a preceding ` U+005C ` (` \ ` ) character.
229229Alternatively, a byte string literal can be a _ raw byte string literal_ , defined
230- below. A byte string literal of length ` n ` is equivalent to a ` &'static [u8; n] ` borrowed fixed-sized array
231- of unsigned 8-bit integers.
230+ below. The type of a byte string literal of length ` n ` is ` &'static [u8; n] ` .
232231
233232Some additional _ escapes_ are available in either byte or non-raw byte string
234233literals. An escape starts with a ` U+005C ` (` \ ` ) and continues with one of the
@@ -295,10 +294,14 @@ literal_. The grammar for recognizing the two kinds of literals is mixed.
295294> INTEGER_LITERAL :
296295>   ;  ; ( DEC_LITERAL | BIN_LITERAL | OCT_LITERAL | HEX_LITERAL )
297296> INTEGER_SUFFIX<sup >?</sup >
298- >
297+ >
299298> DEC_LITERAL :
300299>   ;  ; DEC_DIGIT (DEC_DIGIT|` _ ` )<sup >\* </sup >
301300>
301+ > TUPLE_INDEX :
302+ >   ;  ;   ;  ; ` 0 `
303+ >   ;  ; | NON_ZERO_DEC_DIGIT DEC_DIGIT<sup >\* </sup >
304+ >
302305> BIN_LITERAL :
303306>   ;  ; ` 0b ` (BIN_DIGIT|` _ ` )<sup >\* </sup > BIN_DIGIT (BIN_DIGIT|` _ ` )<sup >\* </sup >
304307>
@@ -314,19 +317,23 @@ literal_. The grammar for recognizing the two kinds of literals is mixed.
314317>
315318> DEC_DIGIT : [ ` 0 ` -` 9 ` ]
316319>
320+ > NON_ZERO_DEC_DIGIT : [ ` 1 ` -` 9 ` ]
321+ >
317322> HEX_DIGIT : [ ` 0 ` -` 9 ` ` a ` -` f ` ` A ` -` F ` ]
318323>
319324> INTEGER_SUFFIX :
320325>   ;  ;   ;  ; ` u8 ` | ` u16 ` | ` u32 ` | ` u64 ` | ` usize `
321326>   ;  ; | ` i8 ` | ` i16 ` | ` i32 ` | ` i64 ` | ` isize `
322327
323- <!-- FIXME: separate the DECIMAL_LITERAL with no prefix or suffix (used on tuple indexing and float_literal -->
324328<!-- FIXME: u128 and i128 -->
325329
326330An _ integer literal_ has one of four forms:
327331
328332* A _ decimal literal_ starts with a * decimal digit* and continues with any
329333 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] .
330337* A _ hex literal_ starts with the character sequence ` U+0030 ` ` U+0078 `
331338 (` 0x ` ) and continues as any mixture (with at least one digit) of hex digits
332339 and underscores.
@@ -501,3 +508,6 @@ They are catalogued in [the Symbols section][symbols] of the Grammar document.
501508[ symbols ] : ../grammar.html#symbols
502509[ keywords ] : keywords.html
503510[ identifier ] : identifiers.html
511+ [ tuples ] : types.html#tuple-types
512+ [ tuple structs ] : items/structs.html
513+ [ tuple variants ] : items/enumerations.html
0 commit comments