// This testcase demonstrates an issue with Wave's processing of raw string literals #include #include #include #include #include #include #include #include typedef boost::wave::cpplexer::lex_token<> cpplexer_token_t; typedef boost::wave::cpplexer::lex_iterator cpplexer_iterator_t; int main() { // This input produces an unterminated raw string literal followed by // a bunch of independent tokens. It should produce a single raw string // literal of three characters - "A", backslash, and plus std::string cppstr("R\"(A\\+)\""); // This input simply removes the backslash character. It correctly produces // a single literal of two characters - "A" followed by "+" // std::string cppstr("R\"(A+)\""); auto cbeg = cppstr.begin(); auto cend = cppstr.end(); using namespace boost::wave; // works cpplexer_iterator_t beg(cbeg, cend, cpplexer_token_t::position_type("fake.cpp"), language_support(support_cpp0x)); cpplexer_iterator_t end; std::cout << "source string: |" << cppstr << "|\n"; for (auto tok = beg; tok != end; ++tok) { std::cout << ID_FROM_TOKEN(*tok) << " |" << tok->get_value() << "| "; } std::cout << "\n"; }