Want a way to strip comments from a
Joel Loo
loo at mister-curious.sw.mcc.com
Sat Mar 18 02:45:17 AEST 1989
In article <978 at philmds.UUCP>, leo at philmds.UUCP (Leo de Wit) writes:
> In article <4896 at cbnews.ATT.COM> smk at cbnews.ATT.COM (Stephen M. Kennedy) writes:
> |In article <9900010 at bradley> brian at bradley.UUCP writes:
> |> The following works in vi: :%s/\/\*.*\*\///g
> |
> |/* And this */ important_variable = 42 /* doesn't work either! */
>
> And how about:
>
> puts(" A comment /* in here */");
>
> And you can give more examples showing it isn't that trivial; a challenge
> for the sed adept, perhaps ...
>
> Leo.
[And a lot of previous articles on the same topic]
The problem is: sed and vi do not understand C syntax.
Solution: write a lex program to strip comments. The program must
understand C syntax enough to know what is a comment and what is not.
Encouragement: it should not be too difficult.
--------------------------------------------------------------------
Joel Loo Peing Ling composed on Fri Mar 17 10:44:52 CST 1989
---------------------------- Now: ----------------------------------
MCC | Email: loo at sw.mcc.com
3500 West Balcones Centre Dr. | Voice: (512)338-3680 (O)
Austin, TX 78759 | (512)343-1780 (H)
More information about the Comp.lang.c
mailing list