diff options
author | John Hodge <tpg@mutabah.net> | 2016-08-19 11:36:13 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-08-19 11:36:13 +0800 |
commit | f754b97923a9dd82b14ff6076798680dd703b5ab (patch) | |
tree | 110ada82199d972ae642ff87aafd4d0582935c3d /src/parse | |
parent | 25a3ab46693d285ba596067d85c35327a030afc6 (diff) | |
download | mrust-f754b97923a9dd82b14ff6076798680dd703b5ab.tar.gz |
Lex - Fix BOM handling after uncodefication
Diffstat (limited to 'src/parse')
-rw-r--r-- | src/parse/lex.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/parse/lex.cpp b/src/parse/lex.cpp index 6e274adc..c5b5c11f 100644 --- a/src/parse/lex.cpp +++ b/src/parse/lex.cpp @@ -35,17 +35,19 @@ Lexer::Lexer(const ::std::string& filename): throw ::std::runtime_error("Unable to open file"); } // Consume the BOM - if( this->getc() == '\xef' ) + if( this->getc_byte() == '\xef' ) { - if( this->getc() != '\xbb' ) { + if( this->getc_byte() != '\xbb' ) { + throw ::std::runtime_error("Incomplete BOM - missing \\xBB in second position"); } - if( this->getc() != '\xbf' ) { + if( this->getc_byte() != '\xbf' ) { + throw ::std::runtime_error("Incomplete BOM - missing \\xBF in second position"); } m_line_ofs = 0; } else { - this->ungetc(); + m_istream.unget(); } } |