Boost logo

Boost :

From: Daniel James (daniel_james_at_[hidden])
Date: 2006-07-30 15:52:50


Rene Rivera wrote:
> Comment looking substring embedded in string constants:
>
> const char *x = "/* something";
> /* whatever */
>
> And comments within comments:
>
> /**/ something /*/ another /**/
>
> /**
> something();
> //*/
> another();
> /**/
>
> /* something
> /* another
> */
>
> Probably more combinations possible :-)
>
Can't you deal with these by first replacing all the instances of a
single regular expression that matches both strings and comments with
something appropriate? Something like:
/\*.*?\*/|//[^\r\n]*|"(?:[^\r\n"\\]|\\.)" Because the matches won't
overlap it should get this right.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk