* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
* \author Jean-Marc Lasgouttes
* \author John Levon
*
#include "support/FileName.h"
#include "support/filetools.h"
#include "support/gzstream.h"
+#include "support/lassert.h"
#include "support/lstrings.h"
#include "support/lyxalgo.h"
#include "support/types.h"
is.rdbuf(&gz_);
name = filename.absFilename();
lineno = 0;
- return gz_.is_open() && is.good();
+ if (!gz_.is_open() || !is.good())
+ return false;
} else {
LYXERR(Debug::LYXLEX, "lyxlex: UNcompressed");
is.rdbuf(&fb_);
name = filename.absFilename();
lineno = 0;
- return fb_.is_open() && is.good();
+ if (!fb_.is_open() || !is.good())
+ return false;
}
+
+ // Skip byte order mark.
+ if (is.peek() == 0xef) {
+ int c = is.get();
+ if (is.peek() == 0xbb) {
+ c = is.get();
+ LASSERT(is.get() == 0xbf, /**/);
+ } else
+ is.unget();
+ }
+
+ return true;
}
}
+// same for docstring
+docstring Lexer::quoteString(docstring const & arg)
+{
+ docstring res;
+ res += '"';
+ res += subst(subst(arg, from_ascii("\\"), from_ascii("\\\\")),
+ from_ascii("\""), from_ascii("\\\""));
+ res += '"';
+ return res;
+}
+
+
Lexer & Lexer::operator>>(char const * required)
{
string token;