]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/classic/test/subrule_tests.cpp
1 /*=============================================================================
2 Copyright (c) 1998-2003 Joel de Guzman
3 http://spirit.sourceforge.net/
5 Use, modification and distribution is subject to the Boost Software
6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
8 =============================================================================*/
10 #include <boost/detail/lightweight_test.hpp>
13 #include <boost/spirit/include/classic_core.hpp>
14 using namespace BOOST_SPIRIT_CLASSIC_NS
;
16 ///////////////////////////////////////////////////////////////////////////////
20 ///////////////////////////////////////////////////////////////////////////////
29 parse_info
<char const*> pi
;
30 pi
= parse("abcabcacb",
41 BOOST_TEST(pi
.length
== 9);
42 BOOST_TEST(*pi
.stop
== 0);
44 pi
= parse("aaaabababaaabbb",
46 start
= (a
| b
) >> (start
| b
),
54 BOOST_TEST(pi
.length
== 15);
55 BOOST_TEST(*pi
.stop
== 0);
57 pi
= parse("aaaabababaaabba",
59 start
= (a
| b
) >> (start
| b
),
67 BOOST_TEST(pi
.length
== 14);
69 pi
= parse("aaaabababaaabbb",
71 // single subrule test
72 start
= (ch_p('a') | 'b') >> (start
| 'b')
77 BOOST_TEST(pi
.length
== 15);
78 BOOST_TEST(*pi
.stop
== 0);
81 ///////////////////////////////////////////////////////////////////////////////
85 ///////////////////////////////////////////////////////////////////////////////
90 return boost::report_errors();