File indexing completed on 2025-01-31 10:02:17
0001
0002
0003
0004
0005
0006
0007
0008
0009 #if !defined(BOOST_SPIRIT_WRAP_ACTION_APR_19_2008_0103PM)
0010 #define BOOST_SPIRIT_WRAP_ACTION_APR_19_2008_0103PM
0011
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015
0016 #include <boost/spirit/home/support/attributes.hpp>
0017 #include <boost/spirit/home/lex/lexer/pass_flags.hpp>
0018 #include <boost/phoenix/core/argument.hpp>
0019 #include <boost/phoenix/bind.hpp>
0020
0021
0022 namespace boost { namespace spirit { namespace lex { namespace lexertl
0023 {
0024 namespace detail
0025 {
0026 template <typename FunctionType, typename Iterator, typename Context
0027 , typename IdType>
0028 struct wrap_action
0029 {
0030
0031
0032 template <typename F>
0033 static FunctionType call(F const& f)
0034 {
0035 return f;
0036 }
0037
0038
0039 template <typename F>
0040 static void arg4_action(F* f, Iterator& start, Iterator& end
0041 , BOOST_SCOPED_ENUM(pass_flags)& pass, IdType& id
0042 , Context const&)
0043 {
0044 f(start, end, pass, id);
0045 }
0046
0047 template <typename A0, typename A1, typename A2, typename A3>
0048 static FunctionType call(void (*f)(A0, A1, A2, A3))
0049 {
0050 void (*pf)(void(*)(A0, A1, A2, A3)
0051 , Iterator&, Iterator&, BOOST_SCOPED_ENUM(pass_flags)&
0052 , IdType&, Context const&) = &wrap_action::arg4_action;
0053
0054 using phoenix::arg_names::_1;
0055 using phoenix::arg_names::_2;
0056 using phoenix::arg_names::_3;
0057 using phoenix::arg_names::_4;
0058 using phoenix::arg_names::_5;
0059 return phoenix::bind(pf, f, _1, _2, _3, _4, _5);
0060 }
0061
0062
0063 template <typename F>
0064 static void arg3_action(F* f, Iterator& start, Iterator& end
0065 , BOOST_SCOPED_ENUM(pass_flags)& pass, IdType
0066 , Context const&)
0067 {
0068 f(start, end, pass);
0069 }
0070
0071 template <typename A0, typename A1, typename A2>
0072 static FunctionType call(void (*f)(A0, A1, A2))
0073 {
0074 void (*pf)(void(*)(A0, A1, A2), Iterator&, Iterator&
0075 , BOOST_SCOPED_ENUM(pass_flags)&, IdType
0076 , Context const&) = &wrap_action::arg3_action;
0077
0078 using phoenix::arg_names::_1;
0079 using phoenix::arg_names::_2;
0080 using phoenix::arg_names::_3;
0081 using phoenix::arg_names::_4;
0082 using phoenix::arg_names::_5;
0083 return phoenix::bind(pf, f, _1, _2, _3, _4, _5);
0084 }
0085
0086
0087 template <typename F>
0088 static void arg2_action(F* f, Iterator& start, Iterator& end
0089 , BOOST_SCOPED_ENUM(pass_flags)&, IdType, Context const&)
0090 {
0091 f (start, end);
0092 }
0093
0094 template <typename A0, typename A1>
0095 static FunctionType call(void (*f)(A0, A1))
0096 {
0097 void (*pf)(void(*)(A0, A1), Iterator&, Iterator&
0098 , BOOST_SCOPED_ENUM(pass_flags)&
0099 , IdType, Context const&) = &wrap_action::arg2_action;
0100
0101 using phoenix::arg_names::_1;
0102 using phoenix::arg_names::_2;
0103 using phoenix::arg_names::_3;
0104 using phoenix::arg_names::_4;
0105 using phoenix::arg_names::_5;
0106 return phoenix::bind(pf, f, _1, _2, _3, _4, _5);
0107 }
0108
0109
0110
0111
0112
0113
0114 template <typename F>
0115 static void arg0_action(F* f, Iterator&, Iterator&
0116 , BOOST_SCOPED_ENUM(pass_flags)&, IdType, Context const&)
0117 {
0118 f();
0119 }
0120
0121 static FunctionType call(void (*f)())
0122 {
0123 void (*pf)(void(*)(), Iterator&, Iterator&
0124 , BOOST_SCOPED_ENUM(pass_flags)&
0125 , IdType, Context const&) = &arg0_action;
0126
0127 using phoenix::arg_names::_1;
0128 using phoenix::arg_names::_2;
0129 using phoenix::arg_names::_3;
0130 using phoenix::arg_names::_4;
0131 using phoenix::arg_names::_5;
0132 return phoenix::bind(pf, f, _1, _2, _3, _4, _5);
0133 }
0134 };
0135
0136
0137
0138 template <typename Iterator, typename Context, typename Idtype>
0139 struct wrap_action<unused_type, Iterator, Context, Idtype>
0140 {
0141
0142 template <typename F>
0143 static F const& call(F const& f)
0144 {
0145 return f;
0146 }
0147 };
0148 }
0149
0150 }}}}
0151
0152 #endif