| Submitter | Ian Taylor |
|---|---|
| Date | Sept. 19, 2012, 3:51 p.m. |
| Message ID | <mcr8vc6qadl.fsf@google.com> |
| Download | mbox | patch |
| Permalink | /patch/185089/ |
| State | New |
| Headers | show |
Comments
Patch
diff -r 858f39eca5c5 go/lex.cc --- a/go/lex.cc Tue Sep 18 22:24:35 2012 -0700 +++ b/go/lex.cc Wed Sep 19 08:45:16 2012 -0700 @@ -722,7 +722,16 @@ unsigned int ci; bool issued_error; this->lineoff_ = p - this->linebuf_; - this->advance_one_utf8_char(p, &ci, &issued_error); + const char *pnext = this->advance_one_utf8_char(p, &ci, + &issued_error); + + // Ignore byte order mark at start of file. + if (ci == 0xfeff && this->lineno_ == 1 && this->lineoff_ == 0) + { + p = pnext; + break; + } + if (Lex::is_unicode_letter(ci)) return this->gather_identifier();