[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lpeg with file handles?
- From: Tony Finch <dot@...>
- Date: Thu, 7 Jan 2010 12:50:34 +0000
On Wed, 6 Jan 2010, David Manura wrote:
> On Wed, Jan 6, 2010 at 9:11 PM, Quae Quack wrote:
> >
> > Wondering if roberto could modify lpeg to accept file handles as a
> > subject for a match.... or even allow custom functions that can return
> > another chunk of string to match upon.....
>
> It might not be too hard to patch the code, adding an abstraction over
> character access.
LPEG works in two phases. In the first phase it runs the pattern over the
input string to find if there is a match and where it is, and the second
phase performs capture actions. So at least the matched part of the string
must be in memory. You would also need to augment it so it knows the
earliest part of the input to which it might backtrack, so it is able to
discard input before that point.
Tony.
--
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.
MODERATE OR GOOD.