|
Boost : |
From: Olaf van der Spek (ml_at_[hidden])
Date: 2022-07-18 07:24:12
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk