diff options
author | John Hodge <tpg@mutabah.net> | 2016-02-27 18:10:29 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-02-27 18:10:29 +0800 |
commit | a92d91674e2863bcd401b28e72f0dcf1e7cb73fd (patch) | |
tree | c75ea9c4e3399d04f0b6a145d85dc083a8201693 /src/parse | |
parent | 2fa788e26a8d2447be9b575111a9f7be26eaff93 (diff) | |
download | mrust-a92d91674e2863bcd401b28e72f0dcf1e7cb73fd.tar.gz |
Parse/lex - Ignore the BOM
Diffstat (limited to 'src/parse')
-rw-r--r-- | src/parse/lex.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/parse/lex.cpp b/src/parse/lex.cpp index 829a62de..a3e8c0d0 100644 --- a/src/parse/lex.cpp +++ b/src/parse/lex.cpp @@ -31,8 +31,21 @@ Lexer::Lexer(::std::string filename): { throw ::std::runtime_error("Unable to open file"); } + if( this->getc() == '\xef' ) + { + if( this->getc() != '\xbb' ) + ; + if( this->getc() != '\xbf' ) + ; + m_line_ofs = 0; + } + else + { + this->ungetc(); + } } + #define LINECOMMENT -1 #define BLOCKCOMMENT -2 #define SINGLEQUOTE -3 |