home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!bcstec!galileo!meb4593
- From: meb4593@galileo.rtn.ca.boeing.com (Michael Bain)
- Newsgroups: comp.lang.perl
- Subject: C comment parser?
- Message-ID: <1268@galileo.rtn.ca.boeing.com>
- Date: 12 Dec 92 00:19:19 GMT
- Organization: Boeing Commercial Airplane Group, Seattle
- Lines: 18
-
- I'm having difficulty developing the regular expression to remove C
- comments from a variable (say $_) that contains a C function. (I'm
- hacking a McCabe metric and am reading in a function at a time)
-
- What I have so far seems to work *most* of the time, but oftentimes it
- misses an ending C comment delimiter (*/) and ends up removing a lot of
- code until it reaches the last delimiter.
-
- Here's the RE:
- s?/\*(.*\n)*.*\*/??; # remove comments
-
- Does somebody have a better one that works?
-
- --
- Michael Bain (206) 234-6942
- Boeing Commercial Airplane Group meb4593@icdfs.ca.boeing.com
- Seattle, WA 98124
-
-