summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-08-19 11:36:13 +0800
committerJohn Hodge <tpg@mutabah.net>2016-08-19 11:36:13 +0800
commitf754b97923a9dd82b14ff6076798680dd703b5ab (patch)
tree110ada82199d972ae642ff87aafd4d0582935c3d /src/parse
parent25a3ab46693d285ba596067d85c35327a030afc6 (diff)
downloadmrust-f754b97923a9dd82b14ff6076798680dd703b5ab.tar.gz
Lex - Fix BOM handling after uncodefication
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/lex.cpp10
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();
}
}