[fpc-devel] Patch for lexlib

Michael Van Canneyt michael at freepascal.org
Sun Mar 16 12:15:26 CET 2008



On Sun, 16 Mar 2008, Florian Klaempfl wrote:

> Felipe Monteiro de Carvalho schrieb:
> > Hello,
> > 
> > I am writing scanners using plex, and I found a problem with the
> > current lexlib. It has a function called yywrap which will close the
> > input and the output, and there is no way to prevent that. I would
> > like to parse the same file several times, and simply closing the
> > file, reopening it and reseting it somehow doesn't work. It soon
> > crashes. If I prevent yywrap from closing the file (only possible
> > changing lexlib), then everything works good.
> > 
> > I searched how people solve this in C, and there there is some
> > pre-processor magic which allows them declare their own yywrap
> > function. 
> 
> Wouldn't it be better to make yywrap a procedure variable with a default
> value?

I was going to propose the same thing.

Michael.



More information about the fpc-devel mailing list