1

I'm trying to parse a string to a utree using the following code:

void Parse(const std::string& testString, const MyGrammar<const char*>& parser)
{
    char const* first = testString.c_str();
    char const* last = &first[testString.size()];
    boost::spirit::utree tree;
    boost::spirit::qi::parse(first,last,parser,tree);
    std::cout << "tree: " << tree << '\n';
}

where MyGrammar is

namespace spirit  = boost::spirit;    

class MyGrammar : public spirit::qi::grammar<Iterator, spirit::utree(), spirit::qi::space_type>
{
    ...
}

But this fails to compile with the following message:

Error 1 error C2664: 'bool boost::function4::operator ()(T0,T1,T2,T3) const' : cannot convert parameter 4 from 'const boost::spirit::unused_type' to 'const boost::spirit::qi::char_class ' c:\program files\etas\etasadlib\boost\1.49.0\include\boost\spirit\home\qi\nonterminal\rule.hpp 303 MyGrammarTest

Can someone help me out?

Tobias Langner
  • 10,634
  • 6
  • 46
  • 76

1 Answers1

1

I found the following post from sehe: boost::qi::parse seems to cause compilation errors which answers this question: I need to use phrase_parse with a skipper

boost::spirit::qi::phrase_parse(first,last,parser, boost::spirit::qi::space,tree);
Community
  • 1
  • 1
Tobias Langner
  • 10,634
  • 6
  • 46
  • 76