Boost logo

Boost Users :

Subject: [Boost-users] [Spirit] Incompatible skipper type?
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2019-01-10 21:21:34


Hello,

I'm a bit confused here, not sure what this means:

Severity Code Description Project File Line Suppression State
Error C2664 'bool boost::function4<R,T0,T1,T2,T3>::operator
()(T0,T1,T2,T3) const': cannot convert argument 4 from 'const Skipper'
to 'T3' Kingdom.Json.Parser.Tests
d:\dev\boost.org\boost_1_69_0\boost\spirit\home\qi\nonterminal\rule.hpp
304

// If you are seeing a compilation error here stating that the
// fourth parameter can't be converted to a required target type
// then you are probably trying to use a rule or a grammar with
// an incompatible skipper type.
if (f(first, last, context, skipper)) {}

Incompatible where? How? Requires clarification please. The default
Skipper type, which I am using at the moment, is
boost::spirit::qi::space_type. I aim to use the proven Comment Skipper
that I leveraged in a previous iteration eventually, but I expect that
compilation should work with the simple space type at least.

Because as far as I can determine all of the rules in my Grammar have
the same Skipper type.

struct json_grammar : qi::grammar<It, value_t(), Skipper> {
    using iterator_type = It;
    using skipper_type = Skipper;
    using char_rule_type = qi::rule<It, char()>;
    json_grammar() : json_grammar::base_type(value_) {
        // ...
     }
private:
    struct escapes_t : qi::symbols<char, char> {
        escapes_t() {
            this->add("\\b", '\b')
                ("\\f", '\f')
                ("\\n", '\n')
                ("\\r", '\r')
                ("\\t", '\t')
                ("\\v", '\v')
                ("\\\\", '\\')
                ("\\/", '/')
                ("\\'", '\'')
                ("\\\"", '"')
                ;
        }
    } char_esc;

    //qi::rule<iterator_type> line_cont;
    char_rule_type hex_esc, unicode_esc;
    qi::rule<iterator_type, str_t()> quot_str, tick_str, str_lit;

    qi::rule<iterator_type, std::vector<value_t>(), skipper_type> array_;
    qi::rule<iterator_type, boost::tuple<key_t, value_t>(),
skipper_type> member;
    qi::rule<iterator_type, std::vector<boost::tuple<key_t,
value_t>>(), skipper_type> object_;

    qi::rule<iterator_type, key_t(), skipper_type> member_key;
    qi::rule<iterator_type, value_t(), skipper_type> value_;

    qi::rule<iterator_type, numeric_sign_t(), skipper_type> numeric_sign;
    qi::rule<iterator_type, float_t(), skipper_type> float_lit;
    qi::rule<iterator_type, floating_point_number_t(), skipper_type>
floating_point;
    qi::rule<iterator_type, int_t(), skipper_type> hex_int, oct_int,
dec_int, int_lit;
    qi::rule<iterator_type, integer_number_t(), skipper_type> integer;

    qi::rule<iterator_type, boolean_t(), skipper_type> bool_lit;
    qi::rule<iterator_type, null_t(), skipper_type> null_lit;
};

Best regards,

Michael Powell


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