From: Dean M. B. <mik...@gm...> - 2009-08-14 19:46:54
|
Hi Guys, I've run into a little conundrum. Here's the problem: I want to be able to parse optional username and password in an HTTP url as in 'http://user:password@host/' with Boost.Spirit2x (the one in Boost trunk). So far every attempt I've tried has brought me compile-time errors or if I get past the compile errors I see the host being put in the user field. So far here is my grammar: bool ok = phrase_parse( start_, end_, ( lit("//") >> -lexeme[*(char_ - ':')] >> -lexeme[':' >> *(char_ - '@')] >> -lexeme['@'] >> +(char_ - '/') >> -lexeme['/' >> *(char_ - '?')] >> -lexeme['?' >> *(char_ - '#')] >> -lexeme['#' >> *char_] ), space, result ); I have committed the failing tests and the grammar to the repository (revision 149, in branches/urllib-dean). Any Spirit2x users out there willing to lend a hand? Thanks in advance. -- Dean Michael Berris blog.cplusplus-soup.com | twitter.com/mikhailberis linkedin.com/in/mikhailberis | facebook.com/dean.berris | deanberris.com |