]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef BOOST_METAPARSE_V1_ONE_CHAR_EXCEPT_HPP |
2 | #define BOOST_METAPARSE_V1_ONE_CHAR_EXCEPT_HPP | |
3 | ||
4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. | |
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 <boost/metaparse/v1/error/unexpected_character.hpp> | |
10 | #include <boost/metaparse/v1/impl/is_any.hpp> | |
11 | #include <boost/metaparse/v1/impl/one_char_except_not_used.hpp> | |
12 | #include <boost/metaparse/v1/one_char.hpp> | |
13 | #include <boost/metaparse/v1/accept_when.hpp> | |
14 | #include <boost/metaparse/v1/define_error.hpp> | |
15 | #include <boost/metaparse/limit_one_char_except_size.hpp> | |
16 | ||
17 | #include <boost/preprocessor/cat.hpp> | |
18 | #include <boost/preprocessor/arithmetic/dec.hpp> | |
19 | #include <boost/preprocessor/arithmetic/mul.hpp> | |
20 | #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> | |
21 | #include <boost/preprocessor/repetition/repeat.hpp> | |
22 | #include <boost/preprocessor/repetition/enum.hpp> | |
23 | #include <boost/preprocessor/punctuation/comma_if.hpp> | |
24 | #include <boost/preprocessor/tuple/eat.hpp> | |
25 | ||
26 | namespace boost | |
27 | { | |
28 | namespace metaparse | |
29 | { | |
30 | namespace v1 | |
31 | { | |
32 | template < | |
33 | BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( | |
34 | BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE, | |
35 | class C, | |
36 | impl::one_char_except_not_used | |
37 | ) | |
38 | > | |
39 | struct one_char_except; | |
40 | ||
41 | #ifdef MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE | |
42 | # error MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE already defined | |
43 | #endif | |
44 | #define MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE(z, n, unused) \ | |
45 | template <BOOST_PP_ENUM_PARAMS(n, class T)> \ | |
46 | struct one_char_except< \ | |
47 | BOOST_PP_ENUM_PARAMS(n, T) \ | |
48 | BOOST_PP_COMMA_IF( \ | |
49 | BOOST_PP_MUL( \ | |
50 | n, \ | |
51 | BOOST_PP_SUB( \ | |
52 | BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE), \ | |
53 | n \ | |
54 | ) \ | |
55 | ) \ | |
56 | ) \ | |
57 | BOOST_PP_ENUM( \ | |
58 | BOOST_PP_SUB( \ | |
59 | BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE), \ | |
60 | n \ | |
61 | ), \ | |
62 | impl::one_char_except_not_used BOOST_PP_TUPLE_EAT(3), \ | |
63 | ~ \ | |
64 | ) \ | |
65 | > :\ | |
66 | accept_when< \ | |
67 | one_char, \ | |
68 | impl::BOOST_PP_CAT(is_any, n)<BOOST_PP_ENUM_PARAMS(n, T)>, \ | |
69 | error::unexpected_character \ | |
70 | > \ | |
71 | {}; | |
72 | ||
73 | BOOST_PP_REPEAT( | |
74 | BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE, | |
75 | MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE, | |
76 | ~ | |
77 | ) | |
78 | ||
79 | #undef MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE | |
80 | } | |
81 | } | |
82 | } | |
83 | ||
84 | #endif | |
85 |