David A. Black wrote:

> > I would very much like to be able to provide a Regexp object input
> > from some input source other than a "fixed" string.  Examples of
> > such sources would be a file bufferer that reads chunks from a file
> > and can then make them accessible to the Regexp object as it needs
> > them.  At the moment there's no way to do this.  The exact semantics
> > of such a method might be quite complicated, as it can be hard to
> > maintain the MatchData.  How this is to be done is beyond this
> > initial query, but I would like to know if anyone besides me sees
> > any merit in this.

> We did this in scanf.rb; you can scanf a stream as well as a string.
> I suspect that arbitrary regular expressions would be a lot harder to
> do this with than scanf format specifiers (which are not too easy
> themselves), especially if you got into backtracking and alternation
> and (non-)greediness and so forth.  But as long as the stream was
> rewindable that might not be too great an obstacle.

True.  One solution would be to keep data around as long as its needed.
All we¡Çre doing is generating the string on-the-fly, sort of.  Or am I
missing something in your reasoning?  

This is also a good reason _not_ to have a backtracking engine, but I
guess that¡Çs another battle.

        nikolai

-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}