]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/test/x3/skip.cpp
1 /*=============================================================================
2 Copyright (c) 2001-2015 Joel de Guzman
3 Copyright (c) 2013 Agustin Berge
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
8 #include <boost/spirit/home/x3.hpp>
16 using spirit_test::test
;
17 using spirit_test::test_attr
;
18 using boost::spirit::x3::ascii::space
;
19 using boost::spirit::x3::ascii::space_type
;
20 using boost::spirit::x3::ascii::char_
;
21 using boost::spirit::x3::ascii::alpha
;
22 using boost::spirit::x3::lexeme
;
23 using boost::spirit::x3::skip
;
24 using boost::spirit::x3::lit
;
26 BOOST_SPIRIT_ASSERT_CONSTEXPR_CTORS(skip('x')['y']);
29 BOOST_TEST((test("a b c d", skip(space
)[*char_
])));
34 BOOST_TEST((test_attr("a b c d", skip(space
)[*char_
], s
)));
35 BOOST_TEST(s
== "abcd");
39 BOOST_TEST((test("ab c d", lexeme
[lit('a') >> 'b' >> skip
[lit('c') >> 'd']], space
)));
40 BOOST_TEST((test("abcd", lexeme
[lit('a') >> 'b' >> skip
[lit('c') >> 'd']], space
)));
41 BOOST_TEST(!(test("a bcd", lexeme
[lit('a') >> 'b' >> skip
[lit('c') >> 'd']], space
)));
43 BOOST_TEST((test("ab c d", lexeme
[lexeme
[lit('a') >> 'b' >> skip
[lit('c') >> 'd']]], space
)));
44 BOOST_TEST((test("abcd", lexeme
[lexeme
[lit('a') >> 'b' >> skip
[lit('c') >> 'd']]], space
)));
45 BOOST_TEST(!(test("a bcd", lexeme
[lexeme
[lit('a') >> 'b' >> skip
[lit('c') >> 'd']]], space
)));
48 return boost::report_errors();