Boost logo

Boost Users :

Subject: [Boost-users] [spirit] Parsing quoted string
From: Giampiero Gabbiani (giampiero_at_[hidden])
Date: 2012-10-24 02:06:09


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?

Many thanks in advance
Giampiero


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