ENH: better fix for dos return in lines, use the regular expression and don't edit the input line
This commit is contained in:
parent
d0aec59356
commit
6b1ab49ae6
|
@ -484,18 +484,6 @@ const char *cmSystemTools::ConvertToWindowsSlashesAndCleanUp(std::string& path)
|
||||||
return path.c_str();
|
return path.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CleanText(char* s)
|
|
||||||
{
|
|
||||||
while(*s != 0)
|
|
||||||
{
|
|
||||||
if(*s == '\r')
|
|
||||||
{
|
|
||||||
*s = ' ';
|
|
||||||
}
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cmSystemTools::ParseFunction(std::ifstream& fin,
|
bool cmSystemTools::ParseFunction(std::ifstream& fin,
|
||||||
std::string& name,
|
std::string& name,
|
||||||
std::vector<std::string>& arguments,
|
std::vector<std::string>& arguments,
|
||||||
|
@ -511,12 +499,11 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin,
|
||||||
}
|
}
|
||||||
if(fin.getline(inbuffer, BUFFER_SIZE ) )
|
if(fin.getline(inbuffer, BUFFER_SIZE ) )
|
||||||
{
|
{
|
||||||
CleanText(&inbuffer[0]);
|
cmRegularExpression blankLine("^[ \t\r]*$");
|
||||||
cmRegularExpression blankLine("^[ \t]*$");
|
|
||||||
cmRegularExpression comment("^[ \t]*#.*$");
|
cmRegularExpression comment("^[ \t]*#.*$");
|
||||||
cmRegularExpression oneLiner("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)\\)[ \t]*$");
|
cmRegularExpression oneLiner("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)\\)[ \t\r]*$");
|
||||||
cmRegularExpression multiLine("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)$");
|
cmRegularExpression multiLine("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)$");
|
||||||
cmRegularExpression lastLine("^(.*)\\)[ \t]*$");
|
cmRegularExpression lastLine("^(.*)\\)[ \t\r]*$");
|
||||||
|
|
||||||
// check for black line or comment
|
// check for black line or comment
|
||||||
if(blankLine.find(inbuffer) || comment.find(inbuffer))
|
if(blankLine.find(inbuffer) || comment.find(inbuffer))
|
||||||
|
@ -546,7 +533,6 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin,
|
||||||
// read lines until the end paren is found
|
// read lines until the end paren is found
|
||||||
if(fin.getline(inbuffer, BUFFER_SIZE ) )
|
if(fin.getline(inbuffer, BUFFER_SIZE ) )
|
||||||
{
|
{
|
||||||
CleanText(&inbuffer[0]);
|
|
||||||
// Check for comment lines and ignore them.
|
// Check for comment lines and ignore them.
|
||||||
if(blankLine.find(inbuffer) || comment.find(inbuffer))
|
if(blankLine.find(inbuffer) || comment.find(inbuffer))
|
||||||
{ continue; }
|
{ continue; }
|
||||||
|
|
Loading…
Reference in New Issue