Chris@16: /*============================================================================== Chris@16: Copyright (c) 2005-2007 Dan Marsden Chris@16: Copyright (c) 2005-2010 Joel de Guzman Chris@16: Copyright (c) 2010 Thomas Heller Chris@16: Chris@16: Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: ==============================================================================*/ Chris@16: #ifndef BOOST_PHOENIX_STATEMENT_THROW_HPP Chris@16: #define BOOST_PHOENIX_STATEMENT_THROW_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace phoenix Chris@16: { Chris@16: namespace tag Chris@16: { Chris@16: struct throw_ {}; Chris@16: } Chris@16: Chris@16: namespace expression Chris@16: { Chris@16: template Chris@16: struct throw_ Chris@16: : expr Chris@16: {}; Chris@16: } Chris@16: Chris@16: namespace rule Chris@16: { Chris@16: struct throw_ Chris@16: : expression::throw_ Chris@16: {}; Chris@16: } Chris@16: Chris@16: template Chris@16: struct meta_grammar::case_ Chris@16: : enable_rule Chris@16: {}; Chris@16: Chris@16: struct throw_eval Chris@16: { Chris@16: typedef void result_type; Chris@16: Chris@16: template Chris@16: result_type Chris@16: operator()(ThrowExpr const& throw_expr, Context const & ctx) const Chris@16: { Chris@16: throw boost::phoenix::eval(throw_expr, ctx); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct default_actions::when Chris@16: : call Chris@16: {}; Chris@16: Chris@16: template Chris@16: inline Chris@16: typename expression::throw_::type const Chris@16: throw_(ThrowExpr const& throw_expr) Chris@16: { Chris@16: return expression::throw_::make(throw_expr); Chris@16: } Chris@16: Chris@16: namespace detail Chris@16: { Chris@16: struct rethrow {}; Chris@16: } Chris@16: Chris@16: namespace expression Chris@16: { Chris@16: struct rethrow Chris@16: : expression::value Chris@16: {}; Chris@16: } Chris@16: Chris@16: template Chris@16: struct is_custom_terminal Chris@16: : mpl::true_ Chris@16: {}; Chris@16: Chris@16: template Chris@16: struct custom_terminal Chris@16: { Chris@16: typedef void result_type; Chris@101: //#ifndef BOOST_PHOENIX_NO_SPECIALIZE_CUSTOM_TERMINAL Chris@101: typedef void _is_throw_custom_terminal; // fix for #7730 Chris@101: //#endif Chris@16: Chris@16: template Chris@16: void operator()(detail::rethrow, Context &) const Chris@16: { Chris@16: throw; Chris@16: } Chris@16: }; Chris@16: Chris@16: inline Chris@16: expression::rethrow::type const Chris@16: throw_() Chris@16: { Chris@16: return expression::rethrow::make(detail::rethrow()); Chris@16: } Chris@16: Chris@16: }} Chris@16: Chris@16: #endif