Boost logo

Boost Users :

Subject: Re: [Boost-users] [spirit] how to get_position() from a multi_pass<position_iterator <const char*> >
From: Peter Schueller (schueller.p_at_[hidden])
Date: 2009-08-21 02:54:01


On Thu, Aug 20, 2009 at 22:42, Hartmut Kaiser<hartmut.kaiser_at_[hidden]> wrote:
>> I use a position_iterator<const char*> for parsing with boost::spirit.
>>
>> Because I need the regex_p feature, I have to wrap this iterator using
>> a multi_pass iterator.
>>
>> I call pt_parse and get a
>>
>> boost::spirit::tree_parse_info<multi_pass<position_iterator<const
>> char*> >, ...> parse_info.
>>
>> Now I have problems calling the get_position() method on
>> "parse_info.stop".
>>
>> I guess this is the case because multi_pass does not store my iterator
>> but wraps it using boost::iterator which loses the position features
>> of position_iterators and only keeps the const char* pointer.
>>
>> Do you have an advice for me?
>
> It's difficult to tell from here as you didn't provide too much information.
> Would you mind posting a small example exposing your problem?

I have attached a minimal example.

If you do not define MULTIPASSDBG, it builds but you are not allowed
to use regex_p in the parser.

If you define it, you are allowed to use regex_p, but the get_position
does no longer compile and so the iterator becomes a bit useless.

I read something about a "base()" method for wrapping iterators, but
could not find one in the multi_pass sources.

Thanks and regards,
Peter




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