mirror of https://github.com/golang/go.git
cmd/compile/internal/syntax: simplify BOM handling
Change-Id: I5e2522d34720d7687e1e9ff0831936702976a1c7
This commit is contained in:
parent
0d8ac5ecf1
commit
a17ec6b30c
|
|
@ -112,8 +112,10 @@ redo:
|
|||
|
||||
// BOM's are only allowed as the first character in a file
|
||||
const BOM = 0xfeff
|
||||
if r == BOM && s.r0 > 0 { // s.r0 is always > 0 after 1st character (fill will set it to 1)
|
||||
s.error("invalid BOM in the middle of the file")
|
||||
if r == BOM {
|
||||
if s.r0 > 0 { // s.r0 is always > 0 after 1st character (fill will set it to 1)
|
||||
s.error("invalid BOM in the middle of the file")
|
||||
}
|
||||
goto redo
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,11 +46,6 @@ func Read(src io.Reader, errh ErrorHandler, mode Mode) (*File, error) {
|
|||
var p parser
|
||||
p.init(src, errh)
|
||||
|
||||
// skip initial BOM if present
|
||||
if p.getr() != '\ufeff' {
|
||||
p.ungetr()
|
||||
}
|
||||
|
||||
p.next()
|
||||
ast := p.file()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue