]> Cypherpunks repositories - gostls13.git/commitdiff
go/scanner: partially revert CL4538096 now that we have %#U for runes
authorRobert Griesemer <gri@golang.org>
Sat, 11 Jun 2011 00:19:01 +0000 (17:19 -0700)
committerRobert Griesemer <gri@golang.org>
Sat, 11 Jun 2011 00:19:01 +0000 (17:19 -0700)
R=r, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4572049

src/pkg/go/scanner/scanner.go
src/pkg/go/scanner/scanner_test.go

index 509abeca57ec2b20d956406546c87836f0c4f195..795f0ac15b19c6ece943868ae576caceafe95a6f 100644 (file)
@@ -22,6 +22,7 @@ package scanner
 
 import (
        "bytes"
+       "fmt"
        "go/token"
        "path/filepath"
        "strconv"
@@ -674,7 +675,7 @@ scanAgain:
                        tok = S.switch3(token.OR, token.OR_ASSIGN, '|', token.LOR)
                default:
                        if S.mode&AllowIllegalChars == 0 {
-                               S.error(offs, "illegal character "+strconv.QuoteRune(ch))
+                               S.error(offs, fmt.Sprintf("illegal character %#U", ch))
                        }
                        insertSemi = S.insertSemi // preserve insertSemi info
                }
index ee1e830a183351933ee43cdad3e096c7dc3099cb..c096e2725e911442ec75f12d5b90fb91df4ade62 100644 (file)
@@ -650,9 +650,9 @@ var errors = []struct {
        pos int
        err string
 }{
-       {"\a", token.ILLEGAL, 0, "illegal character '\\a'"},
-       {`#`, token.ILLEGAL, 0, "illegal character '#'"},
-       {`…`, token.ILLEGAL, 0, "illegal character '…'"},
+       {"\a", token.ILLEGAL, 0, "illegal character U+0007"},
+       {`#`, token.ILLEGAL, 0, "illegal character U+0023 '#'"},
+       {`…`, token.ILLEGAL, 0, "illegal character U+2026 '…'"},
        {`' '`, token.CHAR, 0, ""},
        {`''`, token.CHAR, 0, "illegal character literal"},
        {`'\8'`, token.CHAR, 2, "unknown escape sequence"},