X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLexer.cpp;h=098faa9737282c3fc40458ec67665b26b8b881ef;hb=175711046db2b986550318fa78d901628de28cb8;hp=bbae12418c0bd1da6abfd542a6cdbc63b2e1976b;hpb=50060053e36b3e9dfe03bc33ed3abac1eacc54b0;p=lyx.git diff --git a/src/Lexer.cpp b/src/Lexer.cpp index bbae12418c..098faa9737 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -148,7 +148,7 @@ public: } }; -} // end of anon namespace +} // namespace Lexer::Pimpl::Pimpl(LexerKeyword * tab, int num) @@ -738,7 +738,7 @@ docstring Lexer::getLongString(docstring const & endtoken) break; if (firstline) { - size_t i = tmpstr.find_first_not_of(char_type(' ')); + size_t i = tmpstr.find_first_not_of(from_ascii(" \t")); if (i != string::npos) prefix = tmpstr.substr(0, i); firstline = false; @@ -747,10 +747,10 @@ docstring Lexer::getLongString(docstring const & endtoken) // further lines in long strings may have the same // whitespace prefix as the first line. Remove it. - if (prefix.length() && prefixIs(tmpstr, prefix)) - tmpstr.erase(0, prefix.length() - 1); + if (!prefix.empty() && prefixIs(tmpstr, prefix)) + tmpstr.erase(0, prefix.length()); - str += ltrim(tmpstr, "\t") + '\n'; + str += tmpstr + '\n'; } if (!pimpl_->is) @@ -762,7 +762,7 @@ docstring Lexer::getLongString(docstring const & endtoken) bool Lexer::getBool() const { - string const s = pimpl_->getString(); + string const s = pimpl_->getString(); if (s == "false" || s == "0") { lastReadOk_ = true; return false; @@ -917,7 +917,7 @@ docstring Lexer::quoteString(docstring const & arg) { docstring res; res += '"'; - res += subst(subst(arg, from_ascii("\\"), from_ascii("\\\\")), + res += subst(subst(arg, from_ascii("\\"), from_ascii("\\\\")), from_ascii("\""), from_ascii("\\\"")); res += '"'; return res; @@ -929,7 +929,7 @@ Lexer & Lexer::operator>>(char const * required) string token; *this >> token; if (token != required) { - LYXERR0("Missing '" << required << "'-tag in " << pimpl_->context + LYXERR0("Missing '" << required << "'-tag in " << pimpl_->context << ". Got " << token << " instead. Line: " << lineNumber()); pushToken(token); }