[Spirit] Incompatible skipper type?
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
On Thu, Jan 10, 2019 at 4:21 PM Michael Powell <mwpowellhtx@gmail.com> wrote:
Hello,
I should also mention, I am using the latest Boost 1.69.0.
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
On Thu, Jan 10, 2019 at 4:22 PM Michael Powell <mwpowellhtx@gmail.com> wrote:
On Thu, Jan 10, 2019 at 4:21 PM Michael Powell <mwpowellhtx@gmail.com> wrote:
Hello,
I should also mention, I am using the latest Boost 1.69.0.
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
It does not matter whether I call: const auto parse_tried = qi::phrase_parse(begin, end, json_grammar_type{}, json_grammar_type::skipper_type{}, actual); Or this: const auto parse_tried = qi::parse(begin, end, json_grammar_type{}, actual);
// 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
participants (1)
-
Michael Powell