]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/test/karma/debug.cpp
1 // Copyright (c) 2001-2011 Hartmut Kaiser
2 // Copyright (c) 2001-2011 Joel de Guzman
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #define BOOST_SPIRIT_KARMA_DEBUG
9 #include <boost/spirit/include/karma_operator.hpp>
10 #include <boost/spirit/include/karma_char.hpp>
11 #include <boost/spirit/include/karma_string.hpp>
12 #include <boost/spirit/include/karma_numeric.hpp>
13 #include <boost/spirit/include/karma_auxiliary.hpp>
14 #include <boost/spirit/include/karma_nonterminal.hpp>
15 #include <boost/spirit/include/karma_action.hpp>
16 #include <boost/phoenix/core.hpp>
17 #include <boost/phoenix/operator.hpp>
18 #include <boost/fusion/include/std_pair.hpp>
27 using spirit_test::test
;
28 using spirit_test::test_delimited
;
30 using namespace boost::spirit::ascii
;
31 using namespace boost::spirit::karma::labels
;
32 using boost::spirit::karma::locals
;
33 using boost::spirit::karma::rule
;
34 using boost::spirit::karma::char_
;
35 using boost::spirit::karma::debug
;
36 using boost::spirit::karma::space
;
37 using boost::spirit::karma::eps
;
39 typedef spirit_test::output_iterator
<char>::type outiter_type
;
42 rule
<outiter_type
, char()> a
, b
, c
;
43 rule
<outiter_type
, std::vector
<char>()> start
;
58 BOOST_SPIRIT_DEBUG_NODE(a
);
59 BOOST_SPIRIT_DEBUG_NODE(b
);
60 BOOST_SPIRIT_DEBUG_NODE(c
);
63 BOOST_SPIRIT_DEBUG_NODE(start
);
64 BOOST_TEST(test("abacabba", start
, v
));
66 // ignore the delimiter
67 BOOST_TEST(test_delimited("abacabba ", start
, v
, space
));
74 BOOST_SPIRIT_DEBUG_NODE(start
);
75 BOOST_TEST(test("bc", start
, v1
));
78 { // tests with locals
79 rule
<outiter_type
, char()> a
, b
, c
;
80 rule
<outiter_type
, std::vector
<char>(), locals
<int, double> > start
;
95 BOOST_SPIRIT_DEBUG_NODE(a
);
96 BOOST_SPIRIT_DEBUG_NODE(b
);
97 BOOST_SPIRIT_DEBUG_NODE(c
);
99 start
%= eps
[(_a
= 0, _b
= 2.0)] << *(a
[++_a
] | b
| c
);
100 BOOST_SPIRIT_DEBUG_NODE(start
);
101 BOOST_TEST(test("abacabba", start
, v
));
104 return boost::report_errors();