Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:48

0001 #ifndef BOOST_METAPARSE_V1_CPP98_ONE_CHAR_EXCEPT_C_HPP
0002 #define BOOST_METAPARSE_V1_CPP98_ONE_CHAR_EXCEPT_C_HPP
0003 
0004 // Copyright Abel Sinkovics (abel@sinkovics.hu)  2011.
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 #include <boost/metaparse/limit_one_char_except_size.hpp>
0010 #include <boost/metaparse/v1/error/unexpected_character.hpp>
0011 #include <boost/metaparse/v1/cpp98/impl/is_none.hpp>
0012 #include <boost/metaparse/v1/accept_when.hpp>
0013 #include <boost/metaparse/v1/one_char.hpp>
0014 
0015 #include <boost/mpl/char.hpp>
0016 
0017 #include <boost/preprocessor/cat.hpp>
0018 #include <boost/preprocessor/arithmetic/sub.hpp>
0019 #include <boost/preprocessor/arithmetic/mul.hpp>
0020 #include <boost/preprocessor/arithmetic/dec.hpp>
0021 #include <boost/preprocessor/repetition/repeat.hpp>
0022 #include <boost/preprocessor/repetition/enum.hpp>
0023 #include <boost/preprocessor/repetition/enum_params.hpp>
0024 #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
0025 #include <boost/preprocessor/punctuation/comma_if.hpp>
0026 #include <boost/preprocessor/tuple/eat.hpp>
0027 
0028 namespace boost
0029 {
0030   namespace metaparse
0031   {
0032     namespace v1
0033     {
0034       template <
0035         BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
0036           BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE,
0037           int C,
0038           1024
0039         )
0040       >
0041       struct one_char_except_c;
0042 
0043       #ifdef BOOST_METAPARSE_WRAP
0044       #  error BOOST_METAPARSE_WRAP already defined
0045       #endif
0046       #define BOOST_METAPARSE_WRAP(z, n, unused) \
0047         boost::mpl::char_<BOOST_PP_CAT(C, n)>
0048 
0049       #ifdef MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE
0050       #  error MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE already defined
0051       #endif
0052       #define MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE(z, n, unused) \
0053         template <BOOST_PP_ENUM_PARAMS(n, int C)> \
0054         struct one_char_except_c< \
0055           BOOST_PP_ENUM_PARAMS(n, C) \
0056           BOOST_PP_COMMA_IF( \
0057             BOOST_PP_MUL( \
0058               n, \
0059               BOOST_PP_SUB( \
0060                 BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE), \
0061                 n \
0062               )\
0063             ) \
0064           ) \
0065           BOOST_PP_ENUM( \
0066             BOOST_PP_SUB( \
0067               BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE), \
0068               n \
0069             ), \
0070             1024 BOOST_PP_TUPLE_EAT(3), \
0071             ~ \
0072           ) \
0073         > : \
0074           accept_when< \
0075             one_char, \
0076             impl::BOOST_PP_CAT(is_none, n)< \
0077               BOOST_PP_ENUM(n, BOOST_METAPARSE_WRAP, ~) \
0078             >, \
0079             error::unexpected_character \
0080           > \
0081         {};
0082 
0083       BOOST_PP_REPEAT(
0084         BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE,
0085         MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE,
0086         ~
0087       )
0088 
0089       #undef MPLLBIS_METAPARSE_ONE_CHAR_EXCEPT_CASE
0090       #undef BOOST_METAPARSE_WRAP
0091     }
0092   }
0093 }
0094 
0095 #endif
0096