diff options
Diffstat (limited to 'libgo/go/go/scanner/scanner.go')
-rw-r--r-- | libgo/go/go/scanner/scanner.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libgo/go/go/scanner/scanner.go b/libgo/go/go/scanner/scanner.go index e9476c4dee..a86e4eb668 100644 --- a/libgo/go/go/scanner/scanner.go +++ b/libgo/go/go/scanner/scanner.go @@ -26,7 +26,7 @@ import ( type ErrorHandler func(pos token.Position, msg string) // A Scanner holds the scanner's internal state while processing -// a given text. It can be allocated as part of another data +// a given text. It can be allocated as part of another data // structure but must be initialized via Init before use. // type Scanner struct { @@ -64,7 +64,7 @@ func (s *Scanner) next() { switch { case r == 0: s.error(s.offset, "illegal character NUL") - case r >= 0x80: + case r >= utf8.RuneSelf: // not ASCII r, w = utf8.DecodeRune(s.src[s.rdOffset:]) if r == utf8.RuneError && w == 1 { @@ -255,11 +255,11 @@ func (s *Scanner) findLineEnd() bool { } func isLetter(ch rune) bool { - return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= 0x80 && unicode.IsLetter(ch) + return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= utf8.RuneSelf && unicode.IsLetter(ch) } func isDigit(ch rune) bool { - return '0' <= ch && ch <= '9' || ch >= 0x80 && unicode.IsDigit(ch) + return '0' <= ch && ch <= '9' || ch >= utf8.RuneSelf && unicode.IsDigit(ch) } func (s *Scanner) scanIdentifier() string { @@ -349,7 +349,11 @@ exponent: if s.ch == '-' || s.ch == '+' { s.next() } - s.scanMantissa(10) + if digitVal(s.ch) < 10 { + s.scanMantissa(10) + } else { + s.error(offs, "illegal floating-point exponent") + } } if s.ch == 'i' { |