Subject: [boost] [spirit] Support for one-pass iterators?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-10-18 10:41:04
I'm trying to use Boost.Spirit.Classic to parse a text file content (or,
to be more generic, a content that is read from an STL stream). I
created a grammar that would fit the content, but I'm not sure which
iterator I should pass to the parse function. The parser does not
guarantee that it will read the content only in one pass, and I'm sure
my actors will want to read the content themselves as they are called.
So, obviously, istream_iterator/istreambuf_iterator will not work.
Is there a tool in Boost.Spirit that would provide content buffering
during the parse? If not, what can be suggested to solve this problem?
BTW, the content is line-aligned, i.e. each line is syntactically
distinct from others. I was thinking about writing a loop of
readline/parse combo but I'm not sure how efficient it would be with
regard to the grammar definition construction/destruction within the
parse function. Are these concerns valid?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk