Hartmut Kaiser | 25 Feb 00:29

Re: skipper rules silently ignored (spirit2)

Hi,

> Using the latest svn version of spirit2, I have had a small problem
> with the
> skipper rule.
> Since I wanted to use a rule more complexe than space (and that I
> didn't
> have its type):
> 
> charset::space | ('%' >> *~spirit::char_('\n') >> '\n')
> 
> I defined my grammar like this:
> 
> template <typename Iterator>
> struct my_grammar : qi::grammar_def<Iterator, qi::rule<Iterator> >
> {...};
> 
> but doing:
> 
> bool r = phrase_parse(iter, storage.end(), make_parser(def),
> 		charset::space | ('%' >> *~spirit::char_('\n') >> '\n'));
> 
> ignore the skipping rule
> 
> in qi/nonterminal/rule.hpp:170
> 
>   template <typename Iterator_, typename Context, typename Skipper>
>         bool parse(
>             Iterator_& first, Iterator_ const& last
>           , Context& context, Skipper const& skipper) const
>         {
> // in this function, the skipper is ok
> // but this call loose it (select the unused_type for the skipper
> overload
> of the function)
>             return ptr->parse(first, last, context, skipper);
>         }
> 
> Finally, I did:
> 
>   qi::rule<iterator_t> skipper;
>   skipper = charset::space | ('%' >> *~spirit::char_('\n') >> '\n');
> 
>   bool r = phrase_parse(iter, storage.end(), make_parser(def), skipper
> );
> 
> which work.
> 
> It would be great to either make work the first or generate a compile
> time
> error, lost quite some time thinking the problem was in my grammar.

Yeah, I have this one on my list already, but somehow didn't get a chance to
fix it. We'll try to fix it asap (it will generate a compilation error).
Joel, we need to chat about this, I guess.

Regards Hartmut

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Gmane