Boost logo

Boost Users :

Subject: Re: [Boost-users] [proto] Unable to display_expr a spirit expression
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2010-11-21 13:02:43


> I have a following program:
>
> #include <boost/spirit/include/qi.hpp>
> #include <boost/spirit/include/phoenix_core.hpp>
> #include <boost/proto/core.hpp>
>
> int main () {
> // boost::proto::display_expr(boost::phoenix::arg_names::arg1);
>
> boost::proto::display_expr(boost::spirit::int_[boost::phoenix::arg_names::
> arg1]);
> }
>
> That works as expected:
>
> subscript(
> terminal(N5boost6spirit3tag4int_E)
> , terminal(N5boost7phoenix5actorINS0_8argumentILi0EEEEE)
> )
>
> When I include <boost/spirit/home/phoenix/operator.hpp> (as the last
> include), however, the output of the program changes to:
>
> subscript(
> terminal(N5boost6spirit3tag4int_E)
> , terminal()
>
> I am not sure if this is expected, unsupported, or a bug. Anyone?

That's expected as Proto does not know anything about Phoenix (V2). This
will be different with the new Phoenix V3 (in development), which is built
on top of Proto as well.

> Just to put this in context, I am trying to figure out how does spirit
> intercept phoenix expressions (e.g., in semantic actions) to wrap them in
> proto terminals. The infrastructure of spirit is rather complex, so if
> anyone can point me in the right direction, I would really appreciate it.

Spirit has special code to deal with Phoenix V2 function objects. For
instance, Phoenix semantic actions are handled here:
spirit/home/support/action_dispatch.hpp, line 41.

Regards Hartmut
---------------
http://boost-spirit.com


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