annotate DEPENDENCIES/generic/include/boost/phoenix/scope/local_variable.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 /*==============================================================================
Chris@16 2 Copyright (c) 2005-2010 Joel de Guzman
Chris@16 3 Copyright (c) 2010-2011 Thomas Heller
Chris@16 4
Chris@16 5 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 ==============================================================================*/
Chris@16 8 #ifndef BOOST_PHOENIX_SCOPE_LOCAL_VARIABLE_HPP
Chris@16 9 #define BOOST_PHOENIX_SCOPE_LOCAL_VARIABLE_HPP
Chris@16 10
Chris@16 11 #include <boost/phoenix/core/limits.hpp>
Chris@16 12 #include <boost/phoenix/core/call.hpp>
Chris@16 13 #include <boost/phoenix/core/expression.hpp>
Chris@16 14 #include <boost/phoenix/core/reference.hpp>
Chris@16 15 #include <boost/phoenix/core/value.hpp>
Chris@16 16 #include <boost/phoenix/scope/scoped_environment.hpp>
Chris@16 17 #include <boost/phoenix/scope/detail/local_variable.hpp>
Chris@16 18 #include <boost/phoenix/statement/sequence.hpp>
Chris@16 19
Chris@16 20 namespace boost { namespace phoenix
Chris@16 21 {
Chris@16 22 namespace detail
Chris@16 23 {
Chris@16 24 }
Chris@16 25
Chris@16 26 namespace expression
Chris@16 27 {
Chris@16 28 template <typename Key>
Chris@16 29 struct local_variable
Chris@16 30 : expression::terminal<detail::local<Key> >
Chris@16 31 {
Chris@16 32 typedef typename expression::terminal<detail::local<Key> >::type type;
Chris@16 33
Chris@16 34 static type make()
Chris@16 35 {
Chris@16 36 type const e = {};
Chris@16 37 return e;
Chris@16 38 }
Chris@16 39 };
Chris@16 40 }
Chris@16 41
Chris@16 42 namespace rule
Chris@16 43 {
Chris@16 44 struct local_variable
Chris@16 45 : expression::local_variable<proto::_>
Chris@16 46 {};
Chris@16 47
Chris@16 48 struct local_var_def
Chris@16 49 : proto::assign<local_variable, meta_grammar>
Chris@16 50 {};
Chris@16 51 }
Chris@16 52
Chris@16 53 namespace result_of
Chris@16 54 {
Chris@16 55 template <typename Key>
Chris@16 56 struct is_nullary<custom_terminal<detail::local<Key> > >
Chris@16 57 : mpl::false_
Chris@16 58 {};
Chris@16 59 }
Chris@101 60
Chris@16 61 namespace detail
Chris@16 62 {
Chris@16 63 struct scope_is_nullary_actions
Chris@16 64 {
Chris@16 65 template <typename Rule, typename Dummy = void>
Chris@16 66 struct when
Chris@16 67 : boost::phoenix::is_nullary::when<Rule, Dummy>
Chris@16 68 {};
Chris@16 69 };
Chris@16 70
Chris@16 71 template <typename Dummy>
Chris@16 72 struct scope_is_nullary_actions::when<boost::phoenix::rule::custom_terminal, Dummy>
Chris@16 73 : proto::or_<
Chris@16 74 proto::when<boost::phoenix::rule::local_variable, mpl::true_()>
Chris@16 75 , proto::otherwise<
Chris@16 76 is_nullary::when<boost::phoenix::rule::custom_terminal, Dummy>
Chris@16 77 >
Chris@16 78 >
Chris@16 79 {};
Chris@16 80
Chris@16 81 struct local_var_not_found
Chris@16 82 {
Chris@16 83 };
Chris@16 84 }
Chris@16 85
Chris@16 86 template<typename Key>
Chris@16 87 struct is_custom_terminal<detail::local<Key> >
Chris@16 88 : mpl::true_
Chris@16 89 {};
Chris@16 90
Chris@101 91 template <typename Key>
Chris@101 92 struct custom_terminal<detail::local<Key> >
Chris@16 93 {
Chris@16 94 template <typename Sig>
Chris@16 95 struct result;
Chris@16 96
Chris@16 97 template <typename This, typename Local, typename Context>
Chris@16 98 struct result<This(Local, Context)>
Chris@16 99 : result<This(Local const &, Context)>
Chris@16 100 {};
Chris@16 101
Chris@16 102 template <typename This, typename Local, typename Context>
Chris@16 103 struct result<This(Local &, Context)>
Chris@16 104 {
Chris@16 105 typedef
Chris@16 106 typename remove_reference<
Chris@16 107 typename result_of::env<Context>::type
Chris@16 108 >::type
Chris@16 109 env_type;
Chris@16 110
Chris@16 111 typedef typename detail::apply_local<detail::local<Key>, env_type>::type type;
Chris@16 112 };
Chris@16 113
Chris@16 114 template <typename Local, typename Context>
Chris@16 115 typename result<custom_terminal(Local const &, Context const&)>::type
Chris@16 116 operator()(Local, Context const & ctx)
Chris@16 117 {
Chris@16 118 typedef
Chris@16 119 typename remove_reference<
Chris@16 120 typename result_of::env<Context>::type
Chris@16 121 >::type
Chris@16 122 env_type;
Chris@16 123
Chris@16 124 typedef typename detail::apply_local<detail::local<Key>, env_type>::type return_type;
Chris@16 125
Chris@16 126 static const int index_value = detail::get_index<typename env_type::map_type, detail::local<Key> >::value;
Chris@16 127
Chris@16 128 typedef detail::eval_local<Key> eval_local;
Chris@16 129
Chris@101 130 // Detect if the return_type is for a value.
Chris@101 131 //typedef typename is_value<return_type>::type is_value_type;
Chris@101 132
Chris@16 133 return eval_local::template get<return_type, index_value>(
Chris@16 134 phoenix::env(ctx));
Chris@16 135 }
Chris@16 136 };
Chris@16 137
Chris@16 138 namespace local_names
Chris@16 139 {
Chris@16 140 typedef expression::local_variable<struct _a_key>::type _a_type;
Chris@16 141 typedef expression::local_variable<struct _b_key>::type _b_type;
Chris@16 142 typedef expression::local_variable<struct _c_key>::type _c_type;
Chris@16 143 typedef expression::local_variable<struct _d_key>::type _d_type;
Chris@16 144 typedef expression::local_variable<struct _e_key>::type _e_type;
Chris@16 145 typedef expression::local_variable<struct _f_key>::type _f_type;
Chris@16 146 typedef expression::local_variable<struct _g_key>::type _g_type;
Chris@16 147 typedef expression::local_variable<struct _h_key>::type _h_type;
Chris@16 148 typedef expression::local_variable<struct _i_key>::type _i_type;
Chris@16 149 typedef expression::local_variable<struct _j_key>::type _j_type;
Chris@16 150 typedef expression::local_variable<struct _k_key>::type _k_type;
Chris@16 151 typedef expression::local_variable<struct _l_key>::type _l_type;
Chris@16 152 typedef expression::local_variable<struct _m_key>::type _m_type;
Chris@16 153 typedef expression::local_variable<struct _n_key>::type _n_type;
Chris@16 154 typedef expression::local_variable<struct _o_key>::type _o_type;
Chris@16 155 typedef expression::local_variable<struct _p_key>::type _p_type;
Chris@16 156 typedef expression::local_variable<struct _q_key>::type _q_type;
Chris@16 157 typedef expression::local_variable<struct _r_key>::type _r_type;
Chris@16 158 typedef expression::local_variable<struct _s_key>::type _s_type;
Chris@16 159 typedef expression::local_variable<struct _t_key>::type _t_type;
Chris@16 160 typedef expression::local_variable<struct _u_key>::type _u_type;
Chris@16 161 typedef expression::local_variable<struct _v_key>::type _v_type;
Chris@16 162 typedef expression::local_variable<struct _w_key>::type _w_type;
Chris@16 163 typedef expression::local_variable<struct _x_key>::type _x_type;
Chris@16 164 typedef expression::local_variable<struct _y_key>::type _y_type;
Chris@16 165 typedef expression::local_variable<struct _z_key>::type _z_type;
Chris@16 166
Chris@16 167 #ifndef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS
Chris@16 168 _a_type const _a = {{{}}};
Chris@16 169 _b_type const _b = {{{}}};
Chris@16 170 _c_type const _c = {{{}}};
Chris@16 171 _d_type const _d = {{{}}};
Chris@16 172 _e_type const _e = {{{}}};
Chris@16 173 _f_type const _f = {{{}}};
Chris@16 174 _g_type const _g = {{{}}};
Chris@16 175 _h_type const _h = {{{}}};
Chris@16 176 _i_type const _i = {{{}}};
Chris@16 177 _j_type const _j = {{{}}};
Chris@16 178 _k_type const _k = {{{}}};
Chris@16 179 _l_type const _l = {{{}}};
Chris@16 180 _m_type const _m = {{{}}};
Chris@16 181 _n_type const _n = {{{}}};
Chris@16 182 _o_type const _o = {{{}}};
Chris@16 183 _p_type const _p = {{{}}};
Chris@16 184 _q_type const _q = {{{}}};
Chris@16 185 _r_type const _r = {{{}}};
Chris@16 186 _s_type const _s = {{{}}};
Chris@16 187 _t_type const _t = {{{}}};
Chris@16 188 _u_type const _u = {{{}}};
Chris@16 189 _v_type const _v = {{{}}};
Chris@16 190 _w_type const _w = {{{}}};
Chris@16 191 _x_type const _x = {{{}}};
Chris@16 192 _y_type const _y = {{{}}};
Chris@16 193 _z_type const _z = {{{}}};
Chris@16 194 #endif
Chris@16 195 }
Chris@16 196 }}
Chris@16 197
Chris@16 198 #endif