diff options
author | Robert Griesemer <gri@golang.org> | 2019-02-14 17:34:29 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2019-02-19 22:45:09 +0000 |
commit | 4ad5537bfa47a3cb55bb8194c3b6fa46de938fed (patch) | |
tree | 5986cf674d69c2c1d872226d857fa7082fdaaba7 /src/cmd/compile/internal/syntax/tokens.go | |
parent | c3b49186a6781de58a07bc49ae289354ae98e3be (diff) | |
download | go-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/tokens.go')
-rw-r--r-- | src/cmd/compile/internal/syntax/tokens.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/syntax/tokens.go b/src/cmd/compile/internal/syntax/tokens.go index e00255a45e..9b26c9f12f 100644 --- a/src/cmd/compile/internal/syntax/tokens.go +++ b/src/cmd/compile/internal/syntax/tokens.go @@ -92,6 +92,9 @@ func contains(tokset uint64, tok token) bool { type LitKind uint +// TODO(gri) With the 'i' (imaginary) suffix now permitted on integer +// and floating-point numbers, having a single ImagLit does +// not represent the literal kind well anymore. Remove it? const ( IntLit LitKind = iota FloatLit |