mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
c3b49186a6
commit
4ad5537bfa
5 changed files with 58 additions and 34 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue