mirror of
https://github.com/boostorg/spirit.git
synced 2026-01-19 04:42:11 +00:00
It is better to manage warnings on our side to know what warnings we need to fix or suppress, and the only thing that header does is disabling deprecation warnings on MSVC and ICC which we would prefer to not show to users.
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
// Copyright (c) 2010 Daniel James
|
|
// Copyright (c) 2001-2010 Hartmut Kaiser
|
|
//
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
#include <boost/spirit/include/qi.hpp>
|
|
|
|
#include <boost/core/lightweight_test.hpp>
|
|
#include <vector>
|
|
|
|
int main()
|
|
{
|
|
typedef char const* Iterator;
|
|
namespace qi = boost::spirit::qi;
|
|
|
|
qi::rule<Iterator, std::vector<boost::iterator_range<Iterator> >()> list;
|
|
list = *qi::raw[qi::char_]; // This fails to compile
|
|
|
|
char const* test = "abcdef";
|
|
unsigned test_length = 6;
|
|
char const* test_begin = test;
|
|
char const* test_end = test + test_length;
|
|
std::vector<boost::iterator_range<Iterator> > result;
|
|
bool r = qi::parse(test_begin, test_end, list, result);
|
|
|
|
BOOST_TEST(r);
|
|
BOOST_TEST(test_begin == test_end);
|
|
BOOST_TEST(result.size() == test_length);
|
|
|
|
for(unsigned i = 0; i < test_length; ++i) {
|
|
BOOST_TEST(result[i].begin() == test + i);
|
|
BOOST_TEST(result[i].end() == test + i + 1);
|
|
}
|
|
|
|
return boost::report_errors();
|
|
}
|