|
Boost Users : |
Subject: Re: [Boost-users] regex iterator question
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-03-30 01:39:35
On Mon, Mar 30, 2009 at 02:25, Robert Ramey <ramey_at_[hidden]> wrote:
> I've got a need for regex and I would like to use it to extract tokens
> matching a regular expresssion from a file stream. Â Seems like this would be
> a common desire.
>
> [snip]
>
> But, doesn't work. Â multi_pass is a forward_trasversal iterator while
> regex_token_iterator requires a bidirectional_trasversal_iterator. Â A huge
> disappoint to come soooo close.
>
> Thinking about it, this problem must come very often. Â How is it usually
> addressed? Â There must be a simple bridge across this. Â In a pinch, I'll
> just have to load the whole file into some sort collection, but I prefer the
> ultimate unlimited file size solution.
>
It seems to me that since a bidi iterator can cover the whole range,
an adapter would have to end up just loading it all into memory
eventually.
Have you considered rephrasing your regex as a PEG (which shouldn't be
hard) and using spirit instead? That way the multi-pass would be
sufficient. I seem to recall a mention of a Spirit.Lex that might be
exactly what you need...
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net