]> Cypherpunks repositories - gostls13.git/commit
text/scanner: don't allow Float exponents with no mantissa
authorBen Hoyt <benhoyt@gmail.com>
Sat, 11 Aug 2018 10:02:52 +0000 (12:02 +0200)
committerRobert Griesemer <gri@golang.org>
Mon, 20 Aug 2018 17:01:34 +0000 (17:01 +0000)
commit6c7e199e500d3f81bda4ce383839e7f0336ed63c
tree0d85882e17f76cba1b73cc799e560c41e42523e7
parent7b9c2c1950c167b16f8b3cda179363ca8df2c1b2
text/scanner: don't allow Float exponents with no mantissa

Previously Scanner would allow float literals like "1.5e" and "1e+"
that weren't actually valid Go float literals, and also not valid
when passed to ParseFloat. This commit fixes that behaviour to match
the documentation ("recognizes all literals as defined by the Go
language specification"), and Scanner emits an error in these cases.

Fixes #26374

Change-Id: I6855402ea43febb448c6dff105b9578e31803c01
Reviewed-on: https://go-review.googlesource.com/129095
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/text/scanner/scanner.go
src/text/scanner/scanner_test.go