summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-02-27 18:10:29 +0800
committerJohn Hodge <tpg@mutabah.net>2016-02-27 18:10:29 +0800
commita92d91674e2863bcd401b28e72f0dcf1e7cb73fd (patch)
treec75ea9c4e3399d04f0b6a145d85dc083a8201693 /src/parse
parent2fa788e26a8d2447be9b575111a9f7be26eaff93 (diff)
downloadmrust-a92d91674e2863bcd401b28e72f0dcf1e7cb73fd.tar.gz
Parse/lex - Ignore the BOM
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/lex.cpp13
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