]> git.lyx.org Git - features.git/blobdiff - src/Lexer.cpp
The way this was done here is inconsistent with how it is done
[features.git] / src / Lexer.cpp
index 06a3408f41e9591d77afabfbb3074d2f3b18d9de..fa9ffc71e8155040ff9c0b01dd802eee3f520a3d 100644 (file)
@@ -238,14 +238,8 @@ void Lexer::Pimpl::popTable()
 
 bool Lexer::Pimpl::setFile(FileName const & filename)
 {
-#ifdef TEX2LYX
-       // tex2lyx does not read lyxrc and therefore can't really check for
-       // zipped formats.
-       if (false) {
-#else
        // Check the format of the file.
        if (formats.isZippedFile(filename)) {
-#endif
                LYXERR(Debug::LYXLEX, "lyxlex: compressed");
                // The check only outputs a debug message, because it triggers
                // a bug in compaq cxx 6.2, where is_open() returns 'true' for
@@ -575,7 +569,7 @@ void Lexer::Pimpl::pushToken(string const & pt)
 //////////////////////////////////////////////////////////////////////
 
 Lexer::Lexer()
-       : pimpl_(new Pimpl(0, 0))
+       : pimpl_(new Pimpl(0, 0)), lastReadOk_(false)
 {}
 
 
@@ -701,23 +695,23 @@ double Lexer::getFloat() const
 }
 
 
-string const Lexer::getString() const
+string const Lexer::getString(bool trim) const
 {
        lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
 
        if (lastReadOk_)
-       return pimpl_->getString();
+               return trim ? support::trim(pimpl_->getString(), "\t ") : pimpl_->getString();
 
        return string();
 }
 
 
-docstring const Lexer::getDocString() const
+docstring const Lexer::getDocString(bool trim) const
 {
        lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
 
        if (lastReadOk_)
-               return pimpl_->getDocString();
+               return trim ? support::trim(pimpl_->getDocString(), "\t ") : pimpl_->getDocString();
 
        return docstring();
 }