blob: 2ed6ad0f1cf520139a831f67768aa0dad7f9ba07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*==============================================================================
Copyright (c) 2005-2007 Dan Marsden
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_STATEMENT_THROW_HPP
#define BOOST_PHOENIX_STATEMENT_THROW_HPP
#include <boost/phoenix/core/limits.hpp>
#include <boost/phoenix/core/actor.hpp>
#include <boost/phoenix/core/call.hpp>
#include <boost/phoenix/core/meta_grammar.hpp>
#include <boost/phoenix/core/expression.hpp>
#include <boost/phoenix/core/terminal.hpp>
#include <boost/phoenix/core/value.hpp>
namespace boost { namespace phoenix
{
namespace tag
{
struct throw_ {};
}
namespace expression
{
template <typename A>
struct throw_
: expr<tag::throw_, A>
{};
}
namespace rule
{
struct throw_
: expression::throw_<meta_grammar>
{};
}
template <typename Dummy>
struct meta_grammar::case_<tag::throw_, Dummy>
: enable_rule<rule::throw_, Dummy>
{};
struct throw_eval
{
typedef void result_type;
template <typename ThrowExpr, typename Context>
result_type
operator()(ThrowExpr const& throw_expr, Context & ctx) const
{
throw boost::phoenix::eval(throw_expr, ctx);
}
};
template <typename Dummy>
struct default_actions::when<rule::throw_, Dummy>
: call<throw_eval>
{};
template <typename ThrowExpr>
inline
typename expression::throw_<ThrowExpr>::type const
throw_(ThrowExpr const& throw_expr)
{
return expression::throw_<ThrowExpr>::make(throw_expr);
}
namespace detail
{
struct rethrow {};
}
namespace expression
{
struct rethrow
: expression::value<detail::rethrow>
{};
}
template<typename Dummy>
struct is_custom_terminal<detail::rethrow, Dummy>
: mpl::true_
{};
template<typename Dummy>
struct custom_terminal<detail::rethrow, Dummy>
{
typedef void result_type;
template <typename Context>
void operator()(detail::rethrow, Context &) const
{
throw;
}
};
inline
expression::rethrow::type const
throw_()
{
return expression::rethrow::make(detail::rethrow());
}
}}
#endif
|