1 /*=============================================================================
2 Copyright (c) 2001-2011 Hartmut Kaiser
3 Copyright (c) 2001-2011 Joel de Guzman
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(BOOST_PP_IS_ITERATING)
10 #if !defined(BOOST_SPIRIT_MATCH_MANIP_ATTR_MAY_05_2007_1202PM)
11 #define BOOST_SPIRIT_MATCH_MANIP_ATTR_MAY_05_2007_1202PM
13 #include <boost/spirit/home/qi/stream/match_manip.hpp>
15 #include <boost/fusion/include/vector.hpp>
16 #include <boost/preprocessor/iterate.hpp>
17 #include <boost/preprocessor/repetition/enum.hpp>
18 #include <boost/preprocessor/repetition/enum_params.hpp>
19 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
21 #define BOOST_PP_FILENAME_1 \
22 <boost/spirit/home/qi/stream/match_manip_attr.hpp>
23 #define BOOST_PP_ITERATION_LIMITS (2, SPIRIT_ARGUMENTS_LIMIT)
24 #include BOOST_PP_ITERATE()
28 ///////////////////////////////////////////////////////////////////////////////
30 // Preprocessor vertical repetition code
32 ///////////////////////////////////////////////////////////////////////////////
33 #else // defined(BOOST_PP_IS_ITERATING)
35 #define N BOOST_PP_ITERATION()
36 #define BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE(z, n, A) BOOST_PP_CAT(A, n) &
38 ///////////////////////////////////////////////////////////////////////////////
39 namespace boost { namespace spirit { namespace qi
41 ///////////////////////////////////////////////////////////////////////////
42 template <typename Expr, BOOST_PP_ENUM_PARAMS(N, typename A)>
43 inline detail::match_manip<Expr, mpl::false_, mpl::true_, unused_type
45 BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
49 , BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
51 using qi::detail::match_manip;
53 // Report invalid expression error as early as possible.
54 // If you got an error_invalid_expression error message here,
55 // then the expression (expr) is not a valid spirit qi expression.
56 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
58 typedef fusion::vector<
59 BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
62 vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
63 return match_manip<Expr, mpl::false_, mpl::true_, unused_type, vector_type>(
67 ///////////////////////////////////////////////////////////////////////////
68 template <typename Expr, typename Skipper
69 , BOOST_PP_ENUM_PARAMS(N, typename A)>
70 inline detail::match_manip<Expr, mpl::false_, mpl::true_, Skipper
72 BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
77 , BOOST_SCOPED_ENUM(skip_flag) post_skip
78 , BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
80 using qi::detail::match_manip;
82 // Report invalid expression error as early as possible.
83 // If you got an error_invalid_expression error message here,
84 // then either the expression (expr) or skipper is not a valid
85 // spirit qi expression.
86 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
87 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
89 typedef fusion::vector<
90 BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
93 vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
94 return match_manip<Expr, mpl::false_, mpl::true_, Skipper, vector_type>(
95 xpr, s, post_skip, attr);
98 template <typename Expr, typename Skipper
99 , BOOST_PP_ENUM_PARAMS(N, typename A)>
100 inline detail::match_manip<Expr, mpl::false_, mpl::true_, Skipper
102 BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
107 , BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
109 using qi::detail::match_manip;
111 // Report invalid expression error as early as possible.
112 // If you got an error_invalid_expression error message here,
113 // then either the expression (expr) or skipper is not a valid
114 // spirit qi expression.
115 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
116 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
118 typedef fusion::vector<
119 BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
122 vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
123 return match_manip<Expr, mpl::false_, mpl::true_, Skipper, vector_type>(
129 #undef BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE