Hi Dean,

I know I struggled with this when I did it with Spirit + Phoenix, I
don't know how Spirit 2 is different. The only way I could find was to
keep a buffer variable containing the possible user info, and then
commit to it once an @ was found.

See my confusion in action here:
http://cpp-netlib.svn.sourceforge.net/viewvc/cpp-netlib/branches/uri/boost/network/uri.hpp?revision=143&view=markup

I don't know if that helps at all, but maybe you can find inspiration
somehow... It looks like the Spirit 2 grammar has an entirely
different form, so I don't really see how it ties into the Spirit 1
model.

Cheers,
- Kim

On Fri, Aug 14, 2009 at 21:46, Dean Michael
Berris<[email protected]> wrote:
> 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:passw...@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
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Cpp-netlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Cpp-netlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel

Reply via email to