help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: run-time-compiled regexes


From: Hans-Bernhard Broeker
Subject: Re: run-time-compiled regexes
Date: Wed, 12 Feb 2003 10:04:21 +0100 (MET)

On Tue, 11 Feb 2003, Sam Bishop wrote:

> I'm trying to scan simulation output files.  These files declare in their
> preambles what separator is used throughout the rest of the file.  Is
> there any way to plug the separator into the regular expressions used for
> scanning the rest of the file, on the fly?  

Not using flex itself.  You would have to override YY_INPUT, and have it
scan for the current separator character or string and replace it with a
special character (say, the default separator, or some non-ASCII char that
will never be in the actual file).  This would be equivalent to making
yyin a pipe handle opened by the equivalent of

        popen("sed -e 's/;/\x001/g' inputfile", "r");

Or you could do this pre-filtering step on the actual file, outside
your flex-based scanning application.

-- 
Hans-Bernhard Broeker (address@hidden)
Even if all the snow were burnt, ashes would remain.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]