• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
2 
3     #include <boost/proto/detail/preprocessed/matches_.hpp>
4 
5 #elif !defined(BOOST_PP_IS_ITERATING)
6 
7     #define BOOST_PROTO_MATCHES_N_FUN(Z, N, DATA)                                                   \
8         matches_<                                                                                   \
9             typename detail::expr_traits<typename Args1::BOOST_PP_CAT(child, N)>::value_type::proto_derived_expr \
10           , typename detail::expr_traits<typename Args1::BOOST_PP_CAT(child, N)>::value_type::proto_grammar \
11           , typename Args2::BOOST_PP_CAT(child, N)::proto_grammar                                   \
12         >
13 
14     #define BOOST_PROTO_DEFINE_MATCHES(Z, N, DATA)                                                  \
15         matches_<                                                                                   \
16             Expr                                                                                    \
17           , BasicExpr                                                                               \
18           , typename BOOST_PP_CAT(G, N)::proto_grammar                                              \
19         >
20 
21     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
22         #pragma wave option(preserve: 2, line: 0, output: "preprocessed/matches_.hpp")
23     #endif
24 
25     ///////////////////////////////////////////////////////////////////////////////
26     /// \file matches_.hpp
27     /// Definitions of matches_ specializations
28     //
29     //  Copyright 2008 Eric Niebler. Distributed under the Boost
30     //  Software License, Version 1.0. (See accompanying file
31     //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
32 
33     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
34         #pragma wave option(preserve: 1)
35     #endif
36 
37     #define BOOST_PP_ITERATION_PARAMS_1                                                             \
38         (3, (2, BOOST_PP_MAX(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_MAX_LOGICAL_ARITY), <boost/proto/detail/matches_.hpp>))
39     #include BOOST_PP_ITERATE()
40 
41     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
42         #pragma wave option(output: null)
43     #endif
44 
45     #undef BOOST_PROTO_DEFINE_MATCHES
46     #undef BOOST_PROTO_MATCHES_N_FUN
47 
48 #else // BOOST_PP_IS_ITERATING
49 
50     #define N BOOST_PP_ITERATION()
51 
52     #if N <= BOOST_PROTO_MAX_LOGICAL_ARITY
53 
54         // handle proto::or_
55         template<typename Expr, typename BasicExpr BOOST_PP_ENUM_TRAILING_PARAMS(N, typename G)>
56         struct matches_<Expr, BasicExpr, proto::or_<BOOST_PP_ENUM_PARAMS(N, G)> >
57           : BOOST_PP_CAT(or_, N)<
58                 matches_<Expr, BasicExpr, typename G0::proto_grammar>::value,
59                 Expr, BasicExpr BOOST_PP_ENUM_TRAILING_PARAMS(N, G)
60             >
61         {};
62 
63         // handle proto::and_
64         template<typename Expr, typename BasicExpr, BOOST_PP_ENUM_PARAMS(N, typename G)>
65         struct matches_<Expr, BasicExpr, proto::and_<BOOST_PP_ENUM_PARAMS(N, G)> >
66           : detail::BOOST_PP_CAT(and_, N)<
67                 BOOST_PROTO_DEFINE_MATCHES(~, 0, ~)::value,
68                 BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFINE_MATCHES, ~)
69             >
70         {};
71 
72     #endif
73 
74     #if N <= BOOST_PROTO_MAX_ARITY
75 
76         template<typename Expr, typename Tag, typename Args1, typename Args2>
77         struct matches_< Expr, proto::basic_expr<Tag, Args1, N>, proto::basic_expr<Tag, Args2, N> >
78           : BOOST_PP_CAT(and_, N)<
79                 BOOST_PROTO_MATCHES_N_FUN(~, 0, ~)::value,
80                 BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_MATCHES_N_FUN, ~)
81             >
82         {};
83 
84         template<typename Expr, typename Tag, typename Args1, typename Args2>
85         struct matches_< Expr, proto::basic_expr<Tag, Args1, N>, proto::basic_expr<proto::_, Args2, N> >
86           : BOOST_PP_CAT(and_, N)<
87                 BOOST_PROTO_MATCHES_N_FUN(~, 0, ~)::value,
88                 BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_MATCHES_N_FUN, ~)
89             >
90         {};
91 
92     #endif
93 
94     #undef N
95 
96 #endif
97