Boost logo

Boost Users :

From: Joel de Guzman (joel_at_[hidden])
Date: 2006-06-08 02:49:12


Gabriel Redner wrote:
> Sorry, fat-fingered things and the message was sent too early. trying again:
>
> Hi all,
>
> I am new to spirit, and my only source of information has been the
> current spirit documentation. I am running into a curious problem in
> which the manual suggests some code should compile, yet it does not.
> Test case:
>
> ----------------------------------------------------------------------------------------------
> #include <boost/spirit/core.hpp>
> using namespace boost::spirit;
>
> int main()
> {
> const char *s = "(1)";
> rule<> r = ch_p('(') >> int_p >> ch_p(')');
>
> parse(s, r); // compiles OK
> parse(s, r, space_p); // does NOT compile
> parse(s, ch_p('(') >> int_p >> ch_p(')'), space_p); // compiles OK
> }
> ----------------------------------------------------------------------------------------------
>
> Why does the third parse() compile, but not the second? Does the rule
> require some kind of adaptor to work in this context?

See FAQ no 1 "The Scanner Business".

Oh, BTW, the spirit mailing list is the proper venue for
spirit related questions:

http://boost.org/more/mailing_lists.htm#spirit

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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