]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/metaparse/doc/before_5_2_1.qbk
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / metaparse / doc / before_5_2_1.qbk
1 [#before_5_2_1]
2 ['Definitions before section 5.2.1.]
3
4 #include <boost/metaparse/string.hpp>
5 #include <boost/metaparse/int_.hpp>
6
7 #include <boost/metaparse/build_parser.hpp>
8
9 using namespace boost::metaparse;
10
11 using exp_parser1 = build_parser<int_>;
12 #include <boost/metaparse/entire_input.hpp>
13
14 using exp_parser2 = build_parser<entire_input<int_>>;
15 #include <boost/metaparse/token.hpp>
16
17 using exp_parser3 = build_parser<entire_input<token<int_>>>;
18 #include <boost/metaparse/lit_c.hpp>
19
20 #include <boost/metaparse/sequence.hpp>
21
22 using exp_parser4 = build_parser<sequence<token<int_>, token<lit_c<'+'>>, token<int_>>>;
23
24 #include <metashell/formatter.hpp>
25
26 using int_token = token<int_>;
27
28 using plus_token = token<lit_c<'+'>>;
29
30 using exp_parser5 = build_parser<sequence<int_token, plus_token, int_token>>;
31 #include <boost/metaparse/transform.hpp>
32
33 #include <boost/mpl/plus.hpp>
34
35 #include <boost/mpl/at.hpp>
36
37 template <class Vector>
38 struct eval_plus :
39 boost::mpl::plus<
40 typename boost::mpl::at_c<Vector, 0>::type,
41 typename boost::mpl::at_c<Vector, 2>::type
42 > {};
43
44 #include <boost/mpl/quote.hpp>
45
46 using exp_parser6 =
47 build_parser<
48 transform<
49 sequence<int_token, plus_token, int_token>,
50 boost::mpl::quote1<eval_plus>
51 >
52 >;
53 #include <boost/metaparse/any.hpp>
54
55 using exp_parser7 =
56 build_parser<
57 sequence<
58 int_token, /* The first <number> */
59 repeated<sequence<plus_token, int_token>> /* The "+ <number>" elements */
60 >
61 >;
62 using temp_result = exp_parser7::apply<BOOST_METAPARSE_STRING("1 + 2 + 3 + 4")>::type;
63