aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/scanner.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2019-02-14 17:34:29 -0800
committerRobert Griesemer <gri@golang.org>2019-02-19 22:45:09 +0000
commit4ad5537bfa47a3cb55bb8194c3b6fa46de938fed (patch)
tree5986cf674d69c2c1d872226d857fa7082fdaaba7 /src/cmd/compile/internal/syntax/scanner.go
parentc3b49186a6781de58a07bc49ae289354ae98e3be (diff)
downloadgo-4ad5537bfa47a3cb55bb8194c3b6fa46de938fed.tar.gz
go-4ad5537bfa47a3cb55bb8194c3b6fa46de938fed.zip
cmd/compile: accept 'i' suffix orthogonally on all numbers
This change accepts the 'i' suffix on binary and octal integer literals as well as hexadecimal floats. The suffix was already accepted on decimal integers and floats. Note that 0123i == 123i for backward-compatibility (and 09i is valid). See also the respective language in the spec change: https://golang.org/cl/161098 Change-Id: I9d2d755cba36a3fa7b9e24308c73754d4568daaf Reviewed-on: https://go-review.googlesource.com/c/162878 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/syntax/scanner.go')
-rw-r--r--src/cmd/compile/internal/syntax/scanner.go3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/syntax/scanner.go b/src/cmd/compile/internal/syntax/scanner.go
index 0a77d48b3d..fbb3e1a40e 100644
--- a/src/cmd/compile/internal/syntax/scanner.go
+++ b/src/cmd/compile/internal/syntax/scanner.go
@@ -512,9 +512,6 @@ func (s *scanner) number(c rune) {
// suffix 'i'
if c == 'i' {
s.kind = ImagLit
- if prefix != 0 && prefix != '0' {
- s.error("invalid suffix 'i' on " + litname(prefix))
- }
c = s.getr()
}
s.ungetr()