From b4fbcb0dc8858930e9a619ddf935fcc2dc5839a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 14 Jan 2018 15:18:21 +0100 Subject: [PATCH] bump simplecpp --- externals/simplecpp/simplecpp.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/externals/simplecpp/simplecpp.cpp b/externals/simplecpp/simplecpp.cpp index a4c720d26..aa3651a4c 100644 --- a/externals/simplecpp/simplecpp.cpp +++ b/externals/simplecpp/simplecpp.cpp @@ -380,6 +380,11 @@ static void portabilityBackslash(simplecpp::OutputList *outputList, const std::v outputList->push_back(err); } +static bool isRawStringId(const std::string &str) +{ + return str == "R" || str == "uR" || str == "UR" || str == "LR" || str == "u8R"; +} + void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filename, OutputList *outputList) { std::stack loc; @@ -521,7 +526,7 @@ void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filen // string / char literal else if (ch == '\"' || ch == '\'') { // C++11 raw string literal - if (ch == '\"' && cback() && cback()->op == 'R') { + if (ch == '\"' && cback() && cback()->name && isRawStringId(cback()->str)) { std::string delim; ch = readChar(istr,bom); while (istr.good() && ch != '(' && ch != '\n') { @@ -539,7 +544,12 @@ void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filen // TODO report return; currentToken.erase(currentToken.size() - endOfRawString.size(), endOfRawString.size() - 1U); - back()->setstr(escapeString(currentToken)); + if (cback()->op == 'R') + back()->setstr(escapeString(currentToken)); + else { + back()->setstr(cback()->str.substr(0, cback()->str.size() - 1)); + push_back(new Token(currentToken, location)); // push string without newlines + } location.adjust(currentToken); if (currentToken.find_first_of("\r\n") == std::string::npos) location.col += 2 + 2 * delim.size();