summaryrefslogtreecommitdiff
path: root/libgo/go/text/scanner/scanner.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/text/scanner/scanner.go')
-rw-r--r--libgo/go/text/scanner/scanner.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/libgo/go/text/scanner/scanner.go b/libgo/go/text/scanner/scanner.go
index 0155800f34..e085f8a7d9 100644
--- a/libgo/go/text/scanner/scanner.go
+++ b/libgo/go/text/scanner/scanner.go
@@ -4,12 +4,12 @@
// Package scanner provides a scanner and tokenizer for UTF-8-encoded text.
// It takes an io.Reader providing the source, which then can be tokenized
-// through repeated calls to the Scan function. For compatibility with
+// through repeated calls to the Scan function. For compatibility with
// existing tools, the NUL character is not allowed. If the first character
// in the source is a UTF-8 encoded byte order mark (BOM), it is discarded.
//
// By default, a Scanner skips white space and Go comments and recognizes all
-// literals as defined by the Go language specification. It may be
+// literals as defined by the Go language specification. It may be
// customized to recognize only a subset of those literals and to recognize
// different identifier and white space characters.
package scanner
@@ -37,14 +37,11 @@ func (pos *Position) IsValid() bool { return pos.Line > 0 }
func (pos Position) String() string {
s := pos.Filename
- if pos.IsValid() {
- if s != "" {
- s += ":"
- }
- s += fmt.Sprintf("%d:%d", pos.Line, pos.Column)
- }
if s == "" {
- s = "???"
+ s = "<input>"
+ }
+ if pos.IsValid() {
+ s += fmt.Sprintf(":%d:%d", pos.Line, pos.Column)
}
return s
}