Yes, I'm targeting V2. Actually I try to make parser that match string that doesn't contain several characters. Is this the right way to do it :

+(~(char_(':')|'*'|'?'))

Is there any mention in spirit documentation that mention char parser must use operator~() instead of operator !()? I don't see any operator ~() in parser operators section in doc, what it is mean anyway ?

Thanks for your quick response.

--- Pada Rab, )1/12/10, Hartmut Kaiser <hartmut.kaiser@gmail.com> menulis:

Dari: Hartmut Kaiser <hartmut.kaiser@gmail.com>
Judul: Re: [Boost-users] [spirit] This parser hang
Kepada: boost-users@lists.boost.org
Tanggal: Rabu, 1 Desember, 2010, 8:49 AM

> This code:
>
> std::string s("blablabla");
>
> std::string::iterator start = s.begin(); std::string::iterator finish =
> s.end();
>
> bool result = phrase_parse(start, finish, +(!char_(':')), space);
>
> It's just a simple parser that match string which doesn't have ':'
> character in it right ? But when I run it, function phrase_parse is hang,
> it never return anything.
> I'm using boost 1.44 with VC 2008

Are you using Spirit V2.x or Spirit.Classic? I'm asking as the meaning for
the operator '!' has changed. In Spirit.Classic it stands for 'optional',
while in Spirit V2.x it stands for the 'not predicate' (which is different).


I assume you're targeting V2.x, therefore it has to be:

    +(~char_(':'))

instead. Note, the operator~() is applicable to character parsers only. If
you need 'A but not B' in the general case, use:

   +(char_ - char_(':'))

(but for character parsers the first is much more efficient).

Regards Hartmut
---------------
http://boost-spirit.com



_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users