Ticket #12603: rawstrlit_with_delimiters.cpp

File rawstrlit_with_delimiters.cpp, 1.2 KB (added by edaskel@…, 6 years ago)

minimal example

Line 
1// This testcase demonstrates an issue with Wave's processing of raw string literals
2
3#include <iostream>
4#include <iomanip>
5
6#include <boost/wave.hpp>
7#include <boost/wave/token_ids.hpp>
8#include <boost/wave/cpplexer/cpp_lex_token.hpp>
9#include <boost/wave/cpplexer/cpp_lex_iterator.hpp>
10
11#include <boost/spirit/include/support_istream_iterator.hpp>
12#include <boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp>
13
14typedef boost::wave::cpplexer::lex_token<> cpplexer_token_t;
15typedef boost::wave::cpplexer::lex_iterator<cpplexer_token_t> cpplexer_iterator_t;
16
17int main() {
18
19 // test delimiters
20 std::string cppstr = "R\"###(\nSome Text)\"\n)###\"";
21
22 auto cbeg = cppstr.begin();
23 auto cend = cppstr.end();
24 using namespace boost::wave;
25
26 // works
27 cpplexer_iterator_t beg(cbeg, cend,
28 cpplexer_token_t::position_type("fake.cpp"),
29 language_support(support_cpp0x));
30 cpplexer_iterator_t end;
31
32 std::cout << "source string: |" << cppstr << "|\n";
33 for (auto tok = beg; tok != end; ++tok) {
34 std::cout << ID_FROM_TOKEN(*tok) << " |" << tok->get_value() << "| ";
35 }
36
37 std::cout << "\n";
38
39}
40