diff options
author | Kevin Smith <git@kismith.co.uk> | 2013-01-12 18:41:34 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2013-01-13 10:36:26 (GMT) |
commit | f3bc816af1b0d61452de973963e453bf3b3f95a2 (patch) | |
tree | e895f8afa3580e6cff6f5ad2017d45bf147a17c2 /3rdParty/Boost/src/boost/phoenix/core/terminal.hpp | |
parent | 188fc285c6555eadd3c9d50ab8a94adcade78d89 (diff) | |
download | swift-contrib-f3bc816af1b0d61452de973963e453bf3b3f95a2.zip swift-contrib-f3bc816af1b0d61452de973963e453bf3b3f95a2.tar.bz2 |
Adding in the spirit Boost stuff
Change-Id: I4f127ce61667243b64081b0aa309028d5077045f
Diffstat (limited to '3rdParty/Boost/src/boost/phoenix/core/terminal.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/phoenix/core/terminal.hpp | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/phoenix/core/terminal.hpp b/3rdParty/Boost/src/boost/phoenix/core/terminal.hpp new file mode 100644 index 0000000..79ebe64 --- /dev/null +++ b/3rdParty/Boost/src/boost/phoenix/core/terminal.hpp @@ -0,0 +1,137 @@ +/*============================================================================== + Copyright (c) 2005-2010 Joel de Guzman + Copyright (c) 2010 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_CORE_TERMINAL_HPP +#define BOOST_PHOENIX_CORE_TERMINAL_HPP + +#include <boost/phoenix/core/limits.hpp> +#include <boost/call_traits.hpp> +#include <boost/is_placeholder.hpp> +#include <boost/phoenix/core/actor.hpp> +#include <boost/phoenix/core/meta_grammar.hpp> +#include <boost/phoenix/core/terminal_fwd.hpp> +#include <boost/proto/matches.hpp> +#include <boost/proto/transform/lazy.hpp> +#include <boost/proto/functional/fusion/at.hpp> +#include <boost/type_traits/remove_pointer.hpp> + +#define BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(Template, Terminal, IsNullary, EvalFun)\ + namespace boost { namespace phoenix \ + { \ + namespace result_of \ + { \ + Template \ + struct is_nullary< \ + custom_terminal< \ + Terminal \ + > \ + > \ + : IsNullary \ + {}; \ + } \ + Template \ + struct is_custom_terminal<Terminal >: mpl::true_ {}; \ + \ + Template \ + struct custom_terminal<Terminal > : proto::call<EvalFun > {}; \ + }} \ +/**/ + +namespace boost { namespace phoenix +{ + template <typename T, typename Dummy> + struct is_custom_terminal + : mpl::false_ {}; + + template <typename T, typename Dummy> + struct custom_terminal; + + namespace expression + { + template <typename T, template <typename> class Actor = actor> + struct terminal + : proto::terminal< + T//typename call_traits<T>::value_type + > + { + typedef + proto::basic_expr< + proto::tag::terminal + , proto::term<T> + , 0 + > + base_type; + typedef Actor<base_type> type; + + static const type make(typename call_traits<T>::param_type t) + { + actor<base_type> const e = {base_type::make(t)}; + return e; + } + }; + } + + namespace rule + { + struct argument + : proto::if_<boost::is_placeholder<proto::_value>()> + {}; + + struct custom_terminal + : proto::if_<boost::phoenix::is_custom_terminal<proto::_value>()> + {}; + + struct terminal + : proto::terminal<proto::_> + {}; + } + + template <typename Dummy> + struct meta_grammar::case_<proto::tag::terminal, Dummy> + : proto::or_< + enable_rule<rule::argument , Dummy> + , enable_rule<rule::custom_terminal, Dummy> + , enable_rule<rule::terminal , Dummy> + > + {}; + + template <typename Dummy> + struct default_actions::when<rule::custom_terminal, Dummy> + : proto::lazy< + custom_terminal<proto::_value>( + proto::_value + , _context + ) + > + {}; + + namespace detail + { + template <typename N> + struct placeholder_idx + : mpl::int_<N::value> + {}; + } + + template <typename Grammar> + struct default_actions::when<rule::argument, Grammar> + : proto::call< + proto::functional::at( + _env + , proto::make< + detail::placeholder_idx< + proto::make< + boost::is_placeholder<proto::_value>() + > + >() + > + ) + > + {}; +}} + +#endif |