Boost logo

Boost :

Subject: Re: [boost] [Spirit] Creating a simple text format parser
From: Scott McMurray ([hidden])
Date: 2008-11-21 10:28:16

On Fri, Nov 21, 2008 at 09:55, Kisso Bajslovski <ylisaren_at_[hidden]> wrote:
> But the real problem actually is with the text which isn't a tag. I
> use anychar_p for that at the moment to capture it with a simple semantic
> action. The problem is that anychar_p just retrieves a single character,
> when I'd like to actually get it in the form of a string instead. To render
> it 1 char at the time is highly inefficient. I could use some global string
> to which I accumulate the chars and then let the tags check it and render
> its contents, but that seems hackish at best. For a parser such as this, is
> there a better way perhaps?

I'm not a spirit guru, but I suspect you want something like this:

    ( *~ch_p('<') )[ push_the_iterator_range_as_a_string() ]

So you get everything up to the next "tag" at once.

~ Scott

Boost list run by bdawes at, gregod at, cpdaniel at, john at