Path: utzoo!attcan!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.lang.c Subject: Re: request for C comment stripper Message-ID: <985@philmds.UUCP> Date: 20 Mar 89 18:32:04 GMT References: <5693@ux.cs.man.ac.uk> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 28 In article <5693@ux.cs.man.ac.uk> ian@ux.cs.man.ac.uk (Ian Cottam) writes: | |I usually use a lex script for such things. I didn't have one for |C, but the following might do the trick. N.B. Not tested, not proven, |no warranty! [lex script omitted] This will cover most ordinary cases; but not this one: (startcom.h is either empty or contains a /* ). main() { puts("Testing 1"); #include "startcom.h" puts("Testing 2"); /* puts("Testing 3"); */ } The second puts should get commented out or not, depending on the contents of the header file. OK, I'll admit, it is a bit far-fetched 8-); it however proves once again that it isn't exactly trivial to do the general case right. Leo.