not the way ... (was Re: Want a way to strip comments from a)
John Rupley
rupley at arizona.edu
Sat Mar 25 13:45:06 AEST 1989
In article <1492 at wpi.wpi.edu>, lfoard at wpi.wpi.edu (Lawrence C Foard) writes:
> I tried the comment stripper I poster earlier today on these pathological
> cases and it seems to get the right answer.
Close, but no cigar.
We're talking real pathology, here.... try:
(echo '/*';yes '*//*';echo 'cosmetic */') | stripper_name
Recursion blows the stack for your program. Previously posted strippers
handle the above.
If you insist on a compilable file, use a script to produce:
/*
[stack-blowing number of lines of *//*]
*/
compilable program text
Why strip comments? (1) the original poster had a broken compiler that choked
on comments; (2) the start of a cheap way to get a list or inverted index of
identifiers (cpp does too much).
I suspect all useful points (and more? :-) have been made about
comment stripping -- perhaps this thread should die now.
John Rupley
rupley!local at megaron.arizona.edu
More information about the Comp.lang.c
mailing list