Quick (hopefully simple) Spirit::Qi question

I have a grammar that fully works. I'm in the process of now adding semantic actions to actually *do* something, and I'm hitting a snag. (BTW, I've used Boost::Spirit::Classic, but this is my first time w/ Qi) Grammar: template <typename Iterator> struct FortranLineGrammar : grammar<Iterator, space_type> { FortranLineGrammar() : FortranLineGrammar::base_type(start) { lvalue %= !hex_int >> lexeme[alpha >> *(alnum | '_')] >> *dim; BOOST_SPIRIT_DEBUG_NODE(lvalue); assignment = lvalue[ppp_print] >> "=" >> command; BOOST_SPIRIT_DEBUG_NODE(assignment); ... } typedef rule<Iterator, std::string(), space_type> string_rule_t; string_rule_t lvalue; }; Semantic action: extern void ppp_print(std::string& b); and later void ppp_print(std::string& b) { std::cout << b << std::endl; } So, what I'm going for, is when an lvalue is encountered, to call ppp_print with whatever matched that value. Unfortunately, I'm only getting the first character?!? Here is the debug output, not the right match, but I'm still tweaking the grammar. Looking at the actions only... PRINT *, 'AHHHH! ' <start> <lvalue> <try>PRINT *, 'AHHHH! '</try> <dim> <try> *, 'AHHHH! '</try> <fail/> </dim> <success> *, 'AHHHH! '</success> <attributes>[[P]]</attributes> </lvalue> So what gives?

On 2/21/12 8:37 AM, david.weber@l-3com.com wrote:
I have a grammar that fully works. I'm in the process of now adding semantic actions to actually **do** something, and I'm hitting a snag. (BTW, I've used Boost::Spirit::Classic, but this is my first time w/ Qi)
[snip] There's a Spirit mailing list: http://boost-spirit.com/home/feedback-and-support/ Could you please re-post there? Also, it would be good to provide a minimal test case. Thanks! Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
participants (2)
-
david.weber@l-3com.com
-
Joel de Guzman