- def StripComments(self, Line):\r
- Comment = u'//'\r
- CommentPos = Line.find(Comment)\r
- while CommentPos >= 0:\r
- # if there are non matched quotes before the comment header\r
- # then we are in the middle of a string\r
- # but we need to ignore the escaped quotes and backslashes.\r
- if ((Line.count(u'"', 0, CommentPos) - Line.count(u'\\"', 0, CommentPos)) & 1) == 1:\r
- CommentPos = Line.find (Comment, CommentPos + 1)\r
- else:\r
- return Line[:CommentPos].strip()\r
- return Line.strip()\r
- \r
-\r