/*============================================================================== Copyright (c) 2005-2010 Joel de Guzman Copyright (c) 2010-2011 Thomas Heller Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #ifndef BOOST_PHOENIX_SCOPE_LOCAL_VARIABLE_HPP #define BOOST_PHOENIX_SCOPE_LOCAL_VARIABLE_HPP #include #include #include #include #include #include #include #include namespace boost { namespace phoenix { namespace expression { template struct local_variable : expression::terminal > { typedef typename expression::terminal >::type type; static type make() { type const e = {}; return e; } }; } namespace rule { struct local_variable : expression::local_variable {}; struct local_var_def : proto::assign {}; } namespace result_of { template struct is_nullary > > : mpl::false_ {}; } namespace detail { struct scope_is_nullary_actions { template struct when : boost::phoenix::is_nullary::when {}; }; template struct scope_is_nullary_actions::when : proto::or_< proto::when , proto::otherwise< is_nullary::when > > {}; struct local_var_not_found { }; } template struct is_custom_terminal > : mpl::true_ {}; template struct custom_terminal > { template struct result; template struct result : result {}; template struct result { typedef typename remove_reference< typename result_of::env::type >::type env_type; typedef typename detail::apply_local, env_type>::type type; }; template typename result::type operator()(Local, Context const & ctx) { typedef typename remove_reference< typename result_of::env::type >::type env_type; typedef typename detail::apply_local, env_type>::type return_type; static const int index_value = detail::get_index >::value; typedef detail::eval_local eval_local; // Detect if the return_type is for a value. //typedef typename is_value::type is_value_type; return eval_local::template get( phoenix::env(ctx)); } }; namespace local_names { typedef expression::local_variable::type _a_type; typedef expression::local_variable::type _b_type; typedef expression::local_variable::type _c_type; typedef expression::local_variable::type _d_type; typedef expression::local_variable::type _e_type; typedef expression::local_variable::type _f_type; typedef expression::local_variable::type _g_type; typedef expression::local_variable::type _h_type; typedef expression::local_variable::type _i_type; typedef expression::local_variable::type _j_type; typedef expression::local_variable::type _k_type; typedef expression::local_variable::type _l_type; typedef expression::local_variable::type _m_type; typedef expression::local_variable::type _n_type; typedef expression::local_variable::type _o_type; typedef expression::local_variable::type _p_type; typedef expression::local_variable::type _q_type; typedef expression::local_variable::type _r_type; typedef expression::local_variable::type _s_type; typedef expression::local_variable::type _t_type; typedef expression::local_variable::type _u_type; typedef expression::local_variable::type _v_type; typedef expression::local_variable::type _w_type; typedef expression::local_variable::type _x_type; typedef expression::local_variable::type _y_type; typedef expression::local_variable::type _z_type; #ifndef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS BOOST_ATTRIBUTE_UNUSED _a_type const _a = {{{}}}; BOOST_ATTRIBUTE_UNUSED _b_type const _b = {{{}}}; BOOST_ATTRIBUTE_UNUSED _c_type const _c = {{{}}}; BOOST_ATTRIBUTE_UNUSED _d_type const _d = {{{}}}; BOOST_ATTRIBUTE_UNUSED _e_type const _e = {{{}}}; BOOST_ATTRIBUTE_UNUSED _f_type const _f = {{{}}}; BOOST_ATTRIBUTE_UNUSED _g_type const _g = {{{}}}; BOOST_ATTRIBUTE_UNUSED _h_type const _h = {{{}}}; BOOST_ATTRIBUTE_UNUSED _i_type const _i = {{{}}}; BOOST_ATTRIBUTE_UNUSED _j_type const _j = {{{}}}; BOOST_ATTRIBUTE_UNUSED _k_type const _k = {{{}}}; BOOST_ATTRIBUTE_UNUSED _l_type const _l = {{{}}}; BOOST_ATTRIBUTE_UNUSED _m_type const _m = {{{}}}; BOOST_ATTRIBUTE_UNUSED _n_type const _n = {{{}}}; BOOST_ATTRIBUTE_UNUSED _o_type const _o = {{{}}}; BOOST_ATTRIBUTE_UNUSED _p_type const _p = {{{}}}; BOOST_ATTRIBUTE_UNUSED _q_type const _q = {{{}}}; BOOST_ATTRIBUTE_UNUSED _r_type const _r = {{{}}}; BOOST_ATTRIBUTE_UNUSED _s_type const _s = {{{}}}; BOOST_ATTRIBUTE_UNUSED _t_type const _t = {{{}}}; BOOST_ATTRIBUTE_UNUSED _u_type const _u = {{{}}}; BOOST_ATTRIBUTE_UNUSED _v_type const _v = {{{}}}; BOOST_ATTRIBUTE_UNUSED _w_type const _w = {{{}}}; BOOST_ATTRIBUTE_UNUSED _x_type const _x = {{{}}}; BOOST_ATTRIBUTE_UNUSED _y_type const _y = {{{}}}; BOOST_ATTRIBUTE_UNUSED _z_type const _z = {{{}}}; #endif } }} #endif