| 1 | #include <boost/spirit/include/qi.hpp>
|
|---|
| 2 | #include <cassert>
|
|---|
| 3 |
|
|---|
| 4 | int main() {
|
|---|
| 5 | typedef char const* Iterator;
|
|---|
| 6 | namespace qi = boost::spirit::qi;
|
|---|
| 7 |
|
|---|
| 8 | qi::rule<Iterator, std::vector<boost::iterator_range<Iterator> >()> list;
|
|---|
| 9 | list = *qi::raw[qi::char_]; // This fails to compile
|
|---|
| 10 |
|
|---|
| 11 | char const* test = "abcdef";
|
|---|
| 12 | int test_length = 6;
|
|---|
| 13 | char const* test_begin = test;
|
|---|
| 14 | char const* test_end = test + test_length;
|
|---|
| 15 | std::vector<boost::iterator_range<Iterator> > result;
|
|---|
| 16 | bool r = qi::parse(test_begin, test_end, list, result);
|
|---|
| 17 |
|
|---|
| 18 | assert(r);
|
|---|
| 19 | assert(test_begin == test_end);
|
|---|
| 20 | assert(result.size() == test_length);
|
|---|
| 21 | for(int i = 0; i < test_length; ++i) {
|
|---|
| 22 | assert(result[i].begin() == test + i);
|
|---|
| 23 | assert(result[i].end() == test + i + 1);
|
|---|
| 24 | }
|
|---|
| 25 | }
|
|---|