bump simplecpp (handling #define with multiline comments)
This commit is contained in:
parent
cdfe92b753
commit
f69f7190a0
|
@ -81,6 +81,10 @@ unsigned long long stringToULL(const std::string &s)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool startsWith(const std::string &str, const std::string &s) {
|
||||||
|
return (str.size() >= s.size() && str.compare(0, s.size(), s) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool endsWith(const std::string &s, const std::string &e) {
|
bool endsWith(const std::string &s, const std::string &e) {
|
||||||
return (s.size() >= e.size() && s.compare(s.size() - e.size(), e.size(), e) == 0);
|
return (s.size() >= e.size() && s.compare(s.size() - e.size(), e.size(), e) == 0);
|
||||||
}
|
}
|
||||||
|
@ -400,11 +404,19 @@ void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filen
|
||||||
ch = readChar(istr,bom);
|
ch = readChar(istr,bom);
|
||||||
}
|
}
|
||||||
// multiline..
|
// multiline..
|
||||||
|
|
||||||
std::string::size_type pos = 0;
|
std::string::size_type pos = 0;
|
||||||
while ((pos = currentToken.find("\\\n",pos)) != std::string::npos) {
|
while ((pos = currentToken.find("\\\n",pos)) != std::string::npos) {
|
||||||
currentToken.erase(pos,2);
|
currentToken.erase(pos,2);
|
||||||
++multiline;
|
++multiline;
|
||||||
}
|
}
|
||||||
|
if (multiline || startsWith(lastLine(10),"# ")) {
|
||||||
|
pos = 0;
|
||||||
|
while ((pos = currentToken.find("\n",pos)) != std::string::npos) {
|
||||||
|
currentToken.erase(pos,1);
|
||||||
|
++multiline;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// string / char literal
|
// string / char literal
|
||||||
|
|
Loading…
Reference in New Issue