Skip to content

Commit d1f3e7f

Browse files
committed
Number pseudoliterals and reserved forms: text improvements from ehuss
1 parent 56105c2 commit d1f3e7f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/tokens.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ Note that `-1.0`, for example, is analyzed as two tokens: `-` followed by `1.0`.
501501
> NUMBER_PSEUDOLITERAL_SUFFIX_NO_E :\
502502
> &nbsp;&nbsp; NUMBER_PSEUDOLITERAL_SUFFIX <sub>_not beginning with `e` or `E`_</sub>
503503
504-
As described [above](#suffixes), tokens with the same form as numeric literals other than in the content of their suffix are accepted by the lexer (with the exception of some reserved forms described below).
504+
Tokenization of numeric literals allows arbitrary suffixes as described in the grammar above.
505+
These values generate valid tokens, but are not valid [literal expressions], so are usually an error except as macro arguments.
505506

506507
Examples of such tokens:
507508
```rust,compile_fail
@@ -531,7 +532,8 @@ Examples of such tokens:
531532
> &nbsp;&nbsp; | `0x` `_`<sup>\*</sup> _end of input or not HEX_DIGIT_\
532533
> &nbsp;&nbsp; | DEC_LITERAL ( . DEC_LITERAL)<sup>?</sup> (`e`|`E`) (`+`|`-`)<sup>?</sup> _end of input or not DEC_DIGIT_
533534
534-
The following lexical forms similar to number literals are _reserved forms_:
535+
The following lexical forms similar to number literals are _reserved forms_.
536+
Due to the possible ambiguity these raise, they are rejected by the tokenizer instead of being interpreted as separate tokens.
535537

536538
* An unsuffixed binary or octal literal followed, without intervening whitespace, by a decimal digit out of the range for its radix.
537539

@@ -543,8 +545,6 @@ The following lexical forms similar to number literals are _reserved forms_:
543545

544546
* Input which has the form of a floating-point literal with no digits in the exponent.
545547

546-
Any input containing one of these reserved forms is reported as an error by the lexer.
547-
548548
Examples of reserved forms:
549549

550550
```rust,compile_fail

0 commit comments

Comments
 (0)