]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/metaparse/example/meta_hs/token.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / metaparse / example / meta_hs / token.hpp
1 #ifndef META_HS_TOKEN_HPP
2 #define META_HS_TOKEN_HPP
3
4 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2012.
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8
9 #include <ast.hpp>
10 #include <except_keywords.hpp>
11
12 #include <boost/metaparse/string.hpp>
13 #include <boost/metaparse/token.hpp>
14 #include <boost/metaparse/always_c.hpp>
15 #include <boost/metaparse/lit_c.hpp>
16 #include <boost/metaparse/one_of.hpp>
17 #include <boost/metaparse/last_of.hpp>
18 #include <boost/metaparse/return_.hpp>
19 #include <boost/metaparse/int_.hpp>
20 #include <boost/metaparse/foldl_reject_incomplete_start_with_parser.hpp>
21 #include <boost/metaparse/alphanum.hpp>
22 #include <boost/metaparse/transform.hpp>
23 #include <boost/metaparse/letter.hpp>
24 #include <boost/metaparse/keyword.hpp>
25 #include <boost/metaparse/optional.hpp>
26
27 #include <boost/mpl/lambda.hpp>
28 #include <boost/mpl/push_back.hpp>
29 #include <boost/mpl/vector.hpp>
30
31 namespace token
32 {
33 typedef
34 boost::metaparse::token<
35 boost::metaparse::always_c<'+',boost::metaparse::string<'.','+','.'> >
36 >
37 plus;
38
39 typedef
40 boost::metaparse::token<
41 boost::metaparse::always_c<'-',boost::metaparse::string<'.','-','.'> >
42 >
43 minus;
44
45 typedef
46 boost::metaparse::token<
47 boost::metaparse::always_c<'*',boost::metaparse::string<'.','*','.'> >
48 >
49 mult;
50
51 typedef
52 boost::metaparse::token<
53 boost::metaparse::always_c<'/',boost::metaparse::string<'.','/','.'> >
54 >
55 div;
56
57 typedef
58 boost::metaparse::token<
59 boost::metaparse::one_of<
60 boost::metaparse::last_of<
61 boost::metaparse::lit_c<'='>,
62 boost::metaparse::lit_c<'='>,
63 boost::metaparse::return_<
64 boost::metaparse::string<'.','=','=','.'>
65 >
66 >,
67 boost::metaparse::last_of<
68 boost::metaparse::lit_c<'/'>,
69 boost::metaparse::lit_c<'='>,
70 boost::metaparse::return_<
71 boost::metaparse::string<'.','/','=','.'>
72 >
73 >,
74 boost::metaparse::last_of<
75 boost::metaparse::lit_c<'<'>,
76 boost::metaparse::one_of<
77 boost::metaparse::always_c<
78 '=',
79 boost::metaparse::string<'.','<','=','.'>
80 >,
81 boost::metaparse::return_<
82 boost::metaparse::string<'.','<','.'>
83 >
84 >
85 >,
86 boost::metaparse::last_of<
87 boost::metaparse::lit_c<'>'>,
88 boost::metaparse::optional<
89 boost::metaparse::always_c<
90 '=',
91 boost::metaparse::string<'.','>','=','.'>
92 >,
93 boost::metaparse::string<'.','>','.'>
94 >
95 >
96 >
97 >
98 cmp;
99
100 typedef
101 boost::metaparse::token<boost::metaparse::lit_c<'('> >
102 open_bracket;
103
104 typedef
105 boost::metaparse::token<boost::metaparse::lit_c<')'> >
106 close_bracket;
107
108 typedef
109 boost::metaparse::token<boost::metaparse::lit_c<'='> >
110 define;
111
112 typedef boost::metaparse::token<boost::metaparse::int_> int_;
113
114 typedef
115 boost::metaparse::token<
116 except_keywords<
117 boost::metaparse::foldl_reject_incomplete_start_with_parser<
118 boost::metaparse::one_of<
119 boost::metaparse::alphanum,
120 boost::metaparse::lit_c<'_'>
121 >,
122 boost::metaparse::transform<
123 boost::metaparse::one_of<
124 boost::metaparse::letter,
125 boost::metaparse::lit_c<'_'>
126 >,
127 boost::mpl::lambda<
128 boost::mpl::push_back<
129 boost::metaparse::string<>,
130 boost::mpl::_1
131 >
132 >::type
133 >,
134 boost::mpl::lambda<
135 boost::mpl::push_back<boost::mpl::_1, boost::mpl::_2>
136 >::type
137 >,
138 boost::mpl::vector<
139 boost::metaparse::string<'i','f'>,
140 boost::metaparse::string<'t','h','e','n'>,
141 boost::metaparse::string<'e','l','s','e'>
142 >
143 >
144 >
145 name;
146
147 typedef
148 boost::metaparse::token<
149 boost::metaparse::keyword<boost::metaparse::string<'i','f'> >
150 >
151 if_;
152
153 typedef
154 boost::metaparse::token<
155 boost::metaparse::keyword<boost::metaparse::string<'t','h','e','n'> >
156 >
157 then;
158
159 typedef
160 boost::metaparse::token<
161 boost::metaparse::keyword<boost::metaparse::string<'e','l','s','e'> >
162 >
163 else_;
164 }
165
166 #endif
167
168