diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-03-19 10:18:18 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-19 10:18:18 -0400 |
| commit | f2290dab9a1261749a99c1a57ff7bd09d448a9f9 (patch) | |
| tree | bab25450b568393a3c8856c18eb08c3c33127e2f | |
| parent | 03a30b56461464d505ccc87bec3cb94ccec908a7 (diff) | |
| parent | 8eaac0843eb206c37b52db9d96094503487cd076 (diff) | |
| download | rust-f2290dab9a1261749a99c1a57ff7bd09d448a9f9.tar.gz rust-f2290dab9a1261749a99c1a57ff7bd09d448a9f9.zip | |
Rollup merge of #40589 - topecongiro:floating-point-literal, r=nagisa
Parse 0e+10 as a valid floating-point literal Fixes issue #40408.
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/issue-40408.rs | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index de8a87e3a2b..d48cf6911ed 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -725,7 +725,7 @@ impl<'a> StringReader<'a> { base = 16; num_digits = self.scan_digits(16, 16); } - '0'...'9' | '_' | '.' => { + '0'...'9' | '_' | '.' | 'e' | 'E' => { num_digits = self.scan_digits(10, 10) + 1; } _ => { diff --git a/src/test/run-pass/issue-40408.rs b/src/test/run-pass/issue-40408.rs new file mode 100644 index 00000000000..a73dc1966b4 --- /dev/null +++ b/src/test/run-pass/issue-40408.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("{}", 0E+10); + println!("{}", 0e+10); + println!("{}", 00e+10); + println!("{}", 00E+10); +} |
