
18 Jul
2022
18 Jul
'22
7:24 a.m.
Hi, The underscore is parsed as a null character. Is this expected. A bug? If a full repro is needed I can create one. qi::rule<iterator_t, std::string(), Skip> identifier; identifier %= lexeme[alpha >> *(alnum | '.' | '_')]; typedef boost::spirit::classic::position_iterator<const char*> iterator_t; std::string s = "a_b blah"; iterator_t is(s.c_str(), s.c_str() + s.size(), "<name>"); std::string out; bool res = qi::phrase_parse(is, iterator_t(), identifier, skip, out); if (!res && is != iterator_t()) error_handler_::err(is); cout << out.size() << "|" << out << "|\n"; cout << int(out[0]) << " " << int(out[1]) << " " << int(out[2]) << "\n"; Output: // 3|ab| // 97 0 98 Greetings, -- Olaf