// test case demonstrating change in results of "distinct" repo parser #include #include #include int main(int argc, char **argv) { using boost::spirit::repository::distinct; using namespace boost::spirit::qi; typedef std::string::iterator iterator; using boost::spirit::ascii::space_type; using boost::spirit::attr; using boost::spirit::ascii::string; boost::spirit::qi::rule string_keyword; // removing the preamble "+" from the rule and the input data causes this to pass string_keyword %= '+' >> (distinct("0-9a-zA-Z_")[string("ALPHA")] | distinct("0-9a-zA-Z_")[string("BETA")]); using boost::spirit::qi::phrase_parse; using boost::spirit::qi::ascii::space; std::string inputdata("+ BETA"); std::string result; std::string::iterator input_it = inputdata.begin(); if (!phrase_parse(input_it, inputdata.end(), string_keyword, space, result) || (input_it != inputdata.end())) { std::cerr << "parse failed\n"; return 1; } if (result != "BETA") { // beginning with Boost 1.46, the result value is "B" std::cerr << "keyword parse produced incorrect result " << result; std::cerr << " vs. expected value BETA\n"; return 1; } return 0; }