diff options
Diffstat (limited to 'src/pkg/fmt/scan.go')
-rw-r--r-- | src/pkg/fmt/scan.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/pkg/fmt/scan.go b/src/pkg/fmt/scan.go index d93a8c1da..259451d02 100644 --- a/src/pkg/fmt/scan.go +++ b/src/pkg/fmt/scan.go @@ -271,14 +271,12 @@ func notSpace(r int) bool { return !unicode.IsSpace(r) } - // skipSpace provides Scan() methods the ability to skip space and newline characters // in keeping with the current scanning mode set by format strings and Scan()/Scanln(). func (s *ss) SkipSpace() { s.skipSpace(false) } - // readRune is a structure to enable reading UTF-8 encoded code points // from an io.Reader. It is used if the Reader given to the scanner does // not already implement io.RuneReader. @@ -337,7 +335,6 @@ func (r *readRune) ReadRune() (rune int, size int, err os.Error) { return } - var ssFree = newCache(func() interface{} { return new(ss) }) // Allocate a new ss struct or grab a cached one. @@ -411,7 +408,6 @@ func (s *ss) skipSpace(stopAtNewline bool) { } } - // token returns the next space-delimited string from the input. It // skips white space. For Scanln, it stops at newlines. For Scan, // newlines are treated as spaces. @@ -554,9 +550,11 @@ func (s *ss) getBase(verb int) (base int, digits string) { // scanNumber returns the numerical string with specified digits starting here. func (s *ss) scanNumber(digits string, haveDigits bool) string { - s.notEOF() - if !haveDigits && !s.accept(digits) { - s.errorString("expected integer") + if !haveDigits { + s.notEOF() + if !s.accept(digits) { + s.errorString("expected integer") + } } for s.accept(digits) { } |