]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/test/x3/rule3.cpp
1 /*=============================================================================
2 Copyright (c) 2001-2012 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)
6 =============================================================================*/
8 // this file deliberately contains non-ascii characters
9 // boostinspect:noascii
11 #include <boost/detail/lightweight_test.hpp>
12 #include <boost/spirit/home/x3.hpp>
13 #include <boost/fusion/include/std_pair.hpp>
20 using boost::spirit::x3::_val
;
24 template <typename Context
>
25 void operator()(Context
const& ctx
) const
27 _val(ctx
) += _attr(ctx
);
33 using spirit_test::test_attr
;
34 using spirit_test::test
;
36 using namespace boost::spirit::x3::ascii
;
37 using boost::spirit::x3::rule
;
38 using boost::spirit::x3::int_
;
39 using boost::spirit::x3::lit
;
42 { // synth attribute value-init
45 typedef rule
<class r
, std::string
> rule_type
;
47 auto rdef
= rule_type()
51 BOOST_TEST(test_attr("abcdef", +rdef
, s
));
52 BOOST_TEST(s
== "abcdef");
55 { // synth attribute value-init
58 typedef rule
<class r
, std::string
> rule_type
;
60 auto rdef
= rule_type() =
64 _val(ctx
) += _attr(ctx
);
68 BOOST_TEST(test_attr("abcdef", +rdef
, s
));
69 BOOST_TEST(s
== "abcdef");
72 return boost::report_errors();