forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow leading underscores in float exponents.
Such as `1e_3`, `1E+__3`, `1e-_________3_3`. - They are ugly and never used in practice. (The test suite and compiler code have no examples of them.) - They don't match normal decimal literals. (You can't write `x = _3;`.) - They complicate attempts to allow integers with suffixes beginning with `e`, such as `1em` (currently disallowed, but desired in rust-lang#111615). Because when given a char sequence like `1e` the lexer must decide whether what follows the `e` is a decimal integer (in which case it's a float with exponent) or something else (in which case it's an integer with a suffix). But unbounded char lookahead is required to get past the possibly unlimited number of leading underscores. Disallowing the leading underscores reduces the lookahead to two: one for a possible `+`/`-`, and then one more for a digit or non-digit.
- Loading branch information
1 parent
d12c6e9
commit 99c21f2
Showing
3 changed files
with
92 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters