Cannot get Wave + Spirit Compile

Hi, I have (I suppose) a beginner problem -- cannot make wave + spirit compile. I think there is an iterator problem but I cannot understand the compiler error. I am attaching a small example and the error output - can somebody explain how to fix this? I have searched around a lot but can't find an answer to that. Thanks, -- Alex

On 29.8.2011 12:07, Alexander Feldman wrote:
Hi,
I have (I suppose) a beginner problem -- cannot make wave + spirit compile. I think there is an iterator problem but I cannot understand the compiler error. I am attaching a small example and the error output - can somebody explain how to fix this? I have searched around a lot but can't find an answer to that.
Hi, you can't directly pass Wave iterators to Spirit (as you're doing now by passing Wave's pp_iterator< .. > [the context_type::iterator_type] to Spirit's phrase_parse.). The easiest way, I believe, is to simply iterate thru Wave's pp_iterator to generate a preprocessed string (so, instead of pushing your data to std::cout push it to std::stringstream etc.). After you've done that, pass that string to Spirit and it'll work. I guess you could write a ForwardIterator that would directly pass data from Wave to Spirit, but frankly speaking, I didn't even try that myself. Maybe try that after you've experimented with the Wave+Spirit combination a bit more? Br, Pekka

On 08/29/2011 03:43 PM, Pekka Seppänen wrote:
On 29.8.2011 12:07, Alexander Feldman wrote:
Hi,
I have (I suppose) a beginner problem -- cannot make wave + spirit compile. I think there is an iterator problem but I cannot understand the compiler error. I am attaching a small example and the error output - can somebody explain how to fix this? I have searched around a lot but can't find an answer to that.
Hi,
you can't directly pass Wave iterators to Spirit (as you're doing now by passing Wave's pp_iterator< .. > [the context_type::iterator_type] to Spirit's phrase_parse.).
The easiest way, I believe, is to simply iterate thru Wave's pp_iterator to generate a preprocessed string (so, instead of pushing your data to std::cout push it to std::stringstream etc.). After you've done that, pass that string to Spirit and it'll work.
Yeah, I tried your suggestion - it works. Problem is it is not very elegant and also I cannot get access to the file/line # for the error handling.
I guess you could write a ForwardIterator that would directly pass data from Wave to Spirit, but frankly speaking, I didn't even try that myself. Maybe try that after you've experimented with the Wave+Spirit combination a bit more?
I will try to figure out something. Maybe someone else has already done that. Thanks, -- Alex
Br, Pekka _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Alexander Feldman
-
Pekka Seppänen