RE: [Boost-users] [spirit] parse(iter,iter,rule)
Sorry...
Thorsten Ottosen wrote:
Shouldn't it be possible to parse with the following syntax:
std::string text( "fooooo"); static rule<> r = *space_p >> '"' >> (*alnum_p)[assign_a(name)] >> '"'; parse_infostd::string::const_iterator info = boost::spirit::parse( text.begin(), text.end(), r );
How do I otherwise interpret
http://www.boost.org/libs/spirit/doc/scanner.html
?
It should be:
std::string text( "fooooo"); static rulestd::string::iterator r = *space_p >> '"' >> (*alnum_p)[assign_a(name)] >> '"'; parse_infostd::string::const_iterator info =
It should be: parse_infostd::string::iterator info =
boost::spirit::parse( text.begin(), text.end(), r );
Regards Hartmut
"Hartmut Kaiser"
"Hartmut Kaiser"
Thorsten Ottosen wrote:
| > It should be: | > | > std::string text( "fooooo"); | > static rulestd::string::iterator r = | > *space_p >> '"' >> (*alnum_p)[assign_a(name)] >> '"'; | > parse_infostd::string::const_iterator info = | | It should be: | | parse_infostd::string::iterator info = | | > boost::spirit::parse( text.begin(), text.end(), r );
I still can't get it to work. Apparently the template argument for rule is a scanner...so we cannot pass an iterator there, right?
This should be a pretty simple thing...what should I do to fix the example?
Doh! You are right, that's my fault, sorry.
I never use rule's with Spirits's API functions (probably for this reason).
I'd suggest to don't use it either. The better way is to switch to grammar's
these are scanner agnostic.
But for the curious souls out there here is the way to write it with rule's
(for the default use case):
rule
"Hartmut Kaiser"
participants (2)
-
Hartmut Kaiser
-
Thorsten Ottosen