Commit 968afa0e authored by Robert Griesemer's avatar Robert Griesemer

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

R=r, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4572049
parent c8ee1b8e
...@@ -22,6 +22,7 @@ package scanner ...@@ -22,6 +22,7 @@ package scanner
import ( import (
"bytes" "bytes"
"fmt"
"go/token" "go/token"
"path/filepath" "path/filepath"
"strconv" "strconv"
...@@ -674,7 +675,7 @@ scanAgain: ...@@ -674,7 +675,7 @@ scanAgain:
tok = S.switch3(token.OR, token.OR_ASSIGN, '|', token.LOR) tok = S.switch3(token.OR, token.OR_ASSIGN, '|', token.LOR)
default: default:
if S.mode&AllowIllegalChars == 0 { 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 insertSemi = S.insertSemi // preserve insertSemi info
} }
......
...@@ -650,9 +650,9 @@ var errors = []struct { ...@@ -650,9 +650,9 @@ var errors = []struct {
pos int pos int
err string err string
}{ }{
{"\a", token.ILLEGAL, 0, "illegal character '\\a'"}, {"\a", token.ILLEGAL, 0, "illegal character U+0007"},
{`#`, token.ILLEGAL, 0, "illegal character '#'"}, {`#`, token.ILLEGAL, 0, "illegal character U+0023 '#'"},
{`…`, token.ILLEGAL, 0, "illegal character '…'"}, {`…`, token.ILLEGAL, 0, "illegal character U+2026 '…'"},
{`' '`, token.CHAR, 0, ""}, {`' '`, token.CHAR, 0, ""},
{`''`, token.CHAR, 0, "illegal character literal"}, {`''`, token.CHAR, 0, "illegal character literal"},
{`'\8'`, token.CHAR, 2, "unknown escape sequence"}, {`'\8'`, token.CHAR, 2, "unknown escape sequence"},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment