[Boost.Spirit] problem with parsing
Hello,
I'm currently writing simple server implementation and want to parse
GET request header and load passed attributes. I though with boost
spirit this will be very simple task but i got some errors I can't
understand. My function (these are my first lines of code using
spirit):
bool GET_parse(std::string &str, std::vectorstd::string &keys,
std::vectorstd::string &values)
{
using namespace boost::spirit;
uint_parser
my_digit; path = ch_p('/') >> !(stri >> *(ch_p('/') >> stri) >> !(ch_p('?') attribs)); stri = +(web_sign); web_sign = alnum_p | ch_p('_') | ch_p('_') | ch_p('.'); attribs = *((+alnum_p)[push_back_a(keys)] >> ch_p('=') >> (+alnum_p)[push_back_a(values)] >> !ch_p('&'));
return parse(str.c_str(), request, space_p).full;
}
and output (for me totally unreadable):
In member function 'typename boost::spirit::parser_result
Michał Nowotka wrote:
and output (for me totally unreadable):
Disclaimer: I admire Spirit, but have never used it myself. But I wonder whether STLFilt might help with the error cascade? http://www.bdsoft.com/tools/stlfilt.html
Michał Nowotka wrote:
Hello, I'm currently writing simple server implementation and want to parse GET request header and load passed attributes. I though with boost spirit this will be very simple task but i got some errors I can't understand. My function (these are my first lines of code using ... rule<> request,method,path,version_id,stri,web_sign,attribs; ... return parse(str.c_str(), request, space_p).full; ... can you tell me where my code is wrong and why?
See the #1 spirit FAQ on scanner business in the docs. In short The default template parameters for rule<> is not compatible in your call to parse using the overload taking a skip grammar. Jeff Flinn
participants (3)
-
Jeff Flinn
-
Michał Nowotka
-
Nat Goodspeed