On Fri, 12 Dec 2003, Mark Taylor wrote: > On Fri, 12 Dec 2003, Giaretta, DL (David) wrote: > > > Surely it can be done in a few lines of Perl - Al? > > With both projects, that was my attitude to start with (I'm a bit > of a reformed Perl enthusiast), but heavy use of regular expressions > turns out to be a pretty bad tool for doing this sort of parsing - > they work OK for 95% of the input but get really really nasty > when you try to push close to 100%. Could be just my insufficient What makes it more tractable in this case is that for our purposes you'd only have to handle #include, #define and #if (and #ifdef, #else, etc), and substitutions on #if lines, so you don't actually have to lex the code at all. So maybe a large few lines of Perl. Norman -- --------------------------------------------------------------------------- Norman Gray http://www.astro.gla.ac.uk/users/norman/ Physics and Astronomy, University of Glasgow, UK [log in to unmask]