summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-05-22 13:48:06 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-05-22 13:48:06 (GMT)
commit2489a3583df89d3b0c23e2170eef7fc5fe284f6b (patch)
treeabda06e43f233a6301fac72425534e7dd90202a4
parentceb365813f1cca968e2e2a80db8268b8e1fbad3b (diff)
downloadCMake-2489a3583df89d3b0c23e2170eef7fc5fe284f6b.zip
CMake-2489a3583df89d3b0c23e2170eef7fc5fe284f6b.tar.gz
CMake-2489a3583df89d3b0c23e2170eef7fc5fe284f6b.tar.bz2
ENH: better comment processing
-rw-r--r--Source/cmSystemTools.cxx23
1 files changed, 19 insertions, 4 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7d51edc..bb9ada6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -743,6 +743,19 @@ std::string cmSystemTools::ConvertToWindowsOutputPath(const char* path)
return ret;
}
+inline void RemoveComments(char* ptr)
+{
+ while(*ptr)
+ {
+ if(*ptr == '#')
+ {
+ *ptr = 0;
+ break;
+ }
+ ++ptr;
+ }
+}
+
bool cmSystemTools::ParseFunction(std::ifstream& fin,
std::string& name,
std::vector<std::string>& arguments,
@@ -760,14 +773,15 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin,
}
if(fin.getline(inbuffer, BUFFER_SIZE ) )
{
+ RemoveComments(inbuffer);
cmRegularExpression blankLine("^[ \t\r]*$");
- cmRegularExpression comment("^[ \t]*#.*$");
+// cmRegularExpression comment("^[ \t]*#.*$");
cmRegularExpression oneLiner("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)\\)[ \t\r]*$");
cmRegularExpression multiLine("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)$");
cmRegularExpression lastLine("^(.*)\\)[ \t\r]*$");
- // check for black line or comment
- if(blankLine.find(inbuffer) || comment.find(inbuffer))
+ // check for blank line or comment
+ if(blankLine.find(inbuffer) )
{
return false;
}
@@ -794,8 +808,9 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin,
// read lines until the end paren is found
if(fin.getline(inbuffer, BUFFER_SIZE ) )
{
+ RemoveComments(inbuffer);
// Check for comment lines and ignore them.
- if(blankLine.find(inbuffer) || comment.find(inbuffer))
+ if(blankLine.find(inbuffer))
{ continue; }
// Is this the last line?
if(lastLine.find(inbuffer))