aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/fmt/scan.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2016-02-03 21:58:02 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-02-03 21:58:02 +0000
commitf98dd1a338867a408f7c72d73fbad7fe7fc93e3a (patch)
tree2f8da9862a9c1fe0df138917f997b03439c02773 /libgo/go/fmt/scan.go
parentb081ed4efc144da0c45a6484aebfd10e0eb9fda3 (diff)
downloadgcc-f98dd1a338867a408f7c72d73fbad7fe7fc93e3a.zip
gcc-f98dd1a338867a408f7c72d73fbad7fe7fc93e3a.tar.gz
gcc-f98dd1a338867a408f7c72d73fbad7fe7fc93e3a.tar.bz2
libgo: Update to go1.6rc1.
Reviewed-on: https://go-review.googlesource.com/19200 From-SVN: r233110
Diffstat (limited to 'libgo/go/fmt/scan.go')
-rw-r--r--libgo/go/fmt/scan.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/libgo/go/fmt/scan.go b/libgo/go/fmt/scan.go
index e3e0fd0..4618ed4 100644
--- a/libgo/go/fmt/scan.go
+++ b/libgo/go/fmt/scan.go
@@ -538,7 +538,7 @@ func (s *ss) okVerb(verb rune, okVerbs, typ string) bool {
return true
}
}
- s.errorString("bad verb %" + string(verb) + " for " + typ)
+ s.errorString("bad verb '%" + string(verb) + "' for " + typ)
return false
}
@@ -813,7 +813,7 @@ func (s *ss) scanComplex(verb rune, n int) complex128 {
// convertString returns the string represented by the next input characters.
// The format of the input is determined by the verb.
func (s *ss) convertString(verb rune) (str string) {
- if !s.okVerb(verb, "svqx", "string") {
+ if !s.okVerb(verb, "svqxX", "string") {
return ""
}
s.skipSpace(false)
@@ -821,7 +821,7 @@ func (s *ss) convertString(verb rune) (str string) {
switch verb {
case 'q':
str = s.quotedString()
- case 'x':
+ case 'x', 'X':
str = s.hexString()
default:
str = string(s.token(true, notSpace)) // %s and %v just return the next word
@@ -1078,6 +1078,10 @@ func (s *ss) advance(format string) (i int) {
for i < len(format) {
fmtc, w := utf8.DecodeRuneInString(format[i:])
if fmtc == '%' {
+ // % at end of string is an error.
+ if i+w == len(format) {
+ s.errorString("missing verb: % at end of format string")
+ }
// %% acts like a real percent
nextc, _ := utf8.DecodeRuneInString(format[i+w:]) // will not match % if string is empty
if nextc != '%' {
@@ -1179,7 +1183,7 @@ func (s *ss) doScanf(format string, a []interface{}) (numProcessed int, err erro
}
if numProcessed >= len(a) { // out of operands
- s.errorString("too few operands for format %" + format[i-w:])
+ s.errorString("too few operands for format '%" + format[i-w:] + "'")
break
}
arg := a[numProcessed]