FILE: parser/pb_parser.php
private function _strip_comments(&$string)
{
$string = preg_replace('/\/\/.+/', '', $string);
// now replace empty lines and whitespaces in front
$string = preg_replace('/\\r?\\n\s*/', "\n", $string);
}
The first preg_replace() call in the _strip_comments() function is used to
strip out comments from a proto message. However, there might be no
characters after the precending '//'.
Example:
//
// COMMENT
//
So the regular expression should be written in the form of '/\/\/.*/' to
match any characters (except newline) that has zero or more duplicates.
Original issue reported on code.google.com by che...@gmail.com on 8 Apr 2009 at 1:51
Original issue reported on code.google.com by
che...@gmail.com
on 8 Apr 2009 at 1:51