RE: [Doxygen-users] multiline /// comments
Brought to you by:
dimitri
From: Glenn M. <gle...@vo...> - 2002-01-17 19:07:34
|
Hi Gedalia, I realize that you probably grabbed the code out of context. In case you didn't, I've included a couple of statements that makes your stuff more reliable to others. 1) I initialize the $comment_count variable to 0 at the beginning. Better safe than sorry that garbage was in memory and become the starting point. 2) Don't forget the default fall-through which ends up printing the modified $_ input line to the standard output. I purposely did not include the print statement within this little "if" branch, because I needed to have the ability to do other processing to the very same line, like when I change from @bug to my user-defined @lim alias. Glenn > -----Original Message----- > From: Gedalia Pasternak [mailto:ge...@tu...] > Sent: Thursday, January 17, 2002 10:34 AM > To: Glenn Maxey > Cc: dox...@li... > Subject: RE: [Doxygen-users] multiline /// comments > Hey thanks glenn, it seems pretty trivial to convert it over: =20 BEGIN { local ($comment_count) =3D 0; # count if you're in the comments somewhere. } =20 > NEW_LINE: while (<>) { >=20 > #########=20 > # Begin replacement of /// comments with /** ... **/ comments > # This purposely does not do NEW_LINE or printing. > #########=20 > if (/\/\/\//) { > if ($comment_count =3D=3D 0){ > # first line of a comment block > $comment_count++; > $_ =3D~ s/\/\/\//\/\*\*/; > } else { > # Some line in the middle of a comment block. > $comment_count++; > ### > # Changed to have middle stuff with no asterix. > # $_ =3D~ s/\/\/\// \*\*/; > ### > $_ =3D~ s/\/\/\///; > } > } elsif ($comment_count > 0){ > # We were in a comment block; need to terminate it. > $comment_count =3D 0; > $_ =3D " \*\*\/\n" . $_ ; > } > ######### End Comment style change. =20 #########=20 # Default Fall through #########=20 print $_; } # end of the NEW_LINE while loop =20 |