Commit d5ab44e2 authored by Robert Griesemer's avatar Robert Griesemer

go/scanner: skip first character if it's a BOM

R=r
CC=golang-dev
https://golang.org/cl/6490095
parent 91f2a34d
......@@ -125,6 +125,9 @@ func (s *Scanner) Init(file *token.File, src []byte, err ErrorHandler, mode Mode
s.ErrorCount = 0
s.next()
if s.ch == '\uFEFF' {
s.next() // ignore BOM
}
}
func (s *Scanner) error(offs int, msg string) {
......@@ -390,7 +393,7 @@ func (s *Scanner) scanEscape(quote rune) {
for ; i > 0 && s.ch != quote && s.ch >= 0; i-- {
s.next()
}
if x > max || 0xd800 <= x && x < 0xe000 {
if x > max || 0xD800 <= x && x < 0xE000 {
s.error(offs, "escape sequence is invalid Unicode code point")
}
}
......
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