2012/10/24 Giampiero Gabbiani
Hi together, I have to parse the following row:
"a_token": true|false,
the last comma is optional.
Testing the following:
bool value; test_parser(" \"orig_bool\": true,", qi::lit('"') >> *(ascii::alnum | qi::char_('_')) >> qi::lit('"') >> qi::lit(':') >> boost::spirit::qi::bool_[phx::ref(value)=_1] >> -(qi::lit(',')));
it works, but with the following instead the program compile but hangs ...
bool value; test_parser(" \"orig_bool\": true,", qi::lit('"') >> *(!qi::lit('"')) >> qi::lit('"') >> qi::lit(':') >> boost::spirit::qi::bool_[phx::ref(value)=_1] >> -(qi::lit(',')));
the only difference is the way by means I get the content of the quoted string, actually instead of using
*(ascii::alnum | qi::char_('_'))
I'd like to use
*(!qi::lit('"'))
that - imho - should be better but it actually hangs.
What/where am I actually missing/wrong?
For one thing, qi::lit exposes no attribute, for another, op"!" conusmes no input, that's why it hangs. I'd suggest *~qi::char_('"').