[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: C comment extraction, or a bag .deb of small commands

On Sat, Jan 18, 2003 at 08:54:23PM -0500, H. S. Teoh wrote:
> No you don't. But you *do* need real regex matching (as in, not just a
> per-line matching), which is provided by flex. Probably why flex is a good
> choice for this. The following (extended) regex should work:
> 	\/\*([^*]|\*[^/])*\*\/

For what language? :)  C comments are a bit more complicated than that.
For example, you can break a */ sequence across lines:

/* comment *\

Also, C99 accepts // comments, and handling them separately
from /* */ comments does not work:

/* comment // comment */
i++;  // /* comment

Richard Braakman

Reply to: