Want a way to strip comments from a

Per-Erik Martin pem at zyx.SE
Fri Mar 24 02:38:11 AEST 1989


In article <987 at philmds.UUCP> leo at philmds.UUCP (Leo de Wit) writes:
>
>Appearances are deceptive, it won't handle trigraphs. For instance, try:
>??' (trigraph for ^) and your code thinks it is in_char.
>
>What's worse, on systems where char isn't signed and EOF == -1, it will
>fail to see EOF (suggestion: don't use a char to compare against EOF).
>
I simply didn't include trigraphs in the automaton and I'm well aware of
the problem with EOF. The point I tried to make was that it's possible
to solve a problem like that in, for example, C in a reasonable time,
instead of using sed-scripts or lex (which is of no use outside the
unix-world anyway).
If you really want a comment stripper you can easily add trigraphs, handle
EOF, etc.

>
>P.S. What's the benefit of having a separate program strip off comments anyway?

Good question. None, as far as I know...

-- 
-------------------------------------------------------------------------------
- Per-Erik Martin, ZYX Sweden AB, Bangardsgatan 13, S-753 20  Uppsala, Sweden -
- Email: pem at zyx.SE                                                           -
-------------------------------------------------------------------------------



More information about the Comp.lang.c mailing list