go/scanner: partially revert CL4538096 now that we have %#U for runes

R=r, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4572049
This commit is contained in:
Robert Griesemer 2011-06-10 17:19:01 -07:00
parent c8ee1b8ebc
commit 968afa0e8c
2 changed files with 5 additions and 4 deletions

View 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
}

View 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"},