Cédric Venet | 24 Feb 18:14

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.

Regards,

--

-- 
Cédric

-------------------------------------------------------------------------
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