typedef rule<Iterator, Label*(), space_type> label_rule_type;
label = lit(':') > symbol[[&](string& name, typename label_rule_type::context_type& context)
{
boost::fusion::at_c<0>(context.attributes) = _ast->addLabel(name);
}];
the most important part here is the typedef and its context_type. If you just want to use C++11 lambdas to do very simple things with your passed attribute things are very easy, but if you want access to the locals or the qi::_val, you'll have to use the context parameter. context is a very templated instance of boost::spirit::context that gives you access to two boost::fusion sequences; attributes and locals.
No comments:
Post a Comment