Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!kth!osiris!uplog!lynx!pem From: pem@zyx.SE (Per-Erik Martin) Newsgroups: comp.lang.c Subject: Re: Want a way to strip comments from a Message-ID: <859@lynx.zyx.SE> Date: 23 Mar 89 16:38:11 GMT References: <7150@siemens.UUCP> <9900010@bradley> <4896@cbnews.ATT.COM> <978@philmds.UUCP> <3114@nunki.usc.edu> <983@philmds.UUCP> <852@lynx.zyx.SE> <987@philmds.UUCP> Reply-To: pem@lynx.zyx.SE (Per-Erik Martin) Organization: ZYX Sweden AB, Stockholm, Sweden Lines: 26 In article <987@philmds.UUCP> leo@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@zyx.SE - -------------------------------------------------------------------------------