]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2011 Thomas Heller | |
3 | Copyright (c) 2001-2011 Hartmut Kaiser | |
4 | Copyright (c) 2011 Thomas Heller | |
5 | ||
6 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
7 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
8 | ==============================================================================*/ | |
9 | #if !defined(BOOST_SPIRIT_ARGUMENT_MARCH_22_2011_0939PM) | |
10 | #define BOOST_SPIRIT_ARGUMENT_MARCH_22_2011_0939PM | |
11 | ||
12 | #include <boost/spirit/include/phoenix_core.hpp> | |
13 | ||
14 | namespace boost { namespace spirit | |
15 | { | |
16 | template <int N> | |
17 | struct argument; | |
18 | ||
19 | template <typename Dummy> | |
20 | struct attribute_context; | |
21 | ||
22 | namespace expression | |
23 | { | |
24 | template <int N> | |
25 | struct argument | |
26 | : phoenix::expression::terminal<spirit::argument<N> > | |
27 | { | |
28 | typedef typename phoenix::expression::terminal< | |
29 | spirit::argument<N> | |
30 | >::type type; | |
31 | ||
32 | static type make() | |
33 | { | |
34 | type const e = {{{}}}; | |
35 | return e; | |
36 | } | |
37 | }; | |
38 | ||
39 | template <typename Dummy> | |
40 | struct attribute_context | |
41 | : phoenix::expression::terminal<spirit::attribute_context<Dummy> > | |
42 | { | |
43 | typedef typename phoenix::expression::terminal< | |
44 | spirit::attribute_context<Dummy> | |
45 | >::type type; | |
46 | ||
47 | static type make() | |
48 | { | |
49 | type const e = {{{}}}; | |
50 | return e; | |
51 | } | |
52 | }; | |
53 | } | |
54 | }} | |
55 | ||
56 | namespace boost { namespace phoenix | |
57 | { | |
58 | namespace result_of | |
59 | { | |
60 | template <typename Dummy> | |
61 | struct is_nullary<custom_terminal<spirit::attribute_context<Dummy> > > | |
62 | : mpl::false_ | |
63 | {}; | |
64 | ||
65 | template <int N> | |
66 | struct is_nullary<custom_terminal<spirit::argument<N> > > | |
67 | : mpl::false_ | |
68 | {}; | |
69 | } | |
70 | ||
71 | template <typename Dummy> | |
72 | struct is_custom_terminal<spirit::attribute_context<Dummy> > | |
73 | : mpl::true_ | |
74 | {}; | |
75 | ||
76 | template <int N> | |
77 | struct is_custom_terminal<spirit::argument<N> > | |
78 | : mpl::true_ | |
79 | {}; | |
80 | ||
81 | template <typename Dummy> | |
82 | struct custom_terminal<spirit::attribute_context<Dummy> > | |
83 | : proto::call< | |
84 | v2_eval( | |
85 | proto::make<spirit::attribute_context<Dummy>()> | |
86 | , proto::call< | |
87 | functional::env(proto::_state) | |
88 | > | |
89 | ) | |
90 | > | |
91 | {}; | |
92 | ||
93 | template <int N> | |
94 | struct custom_terminal<spirit::argument<N> > | |
95 | : proto::call< | |
96 | v2_eval( | |
97 | proto::make<spirit::argument<N>()> | |
98 | , proto::call< | |
99 | functional::env(proto::_state) | |
100 | > | |
101 | ) | |
102 | > | |
103 | {}; | |
104 | }} | |
105 | ||
106 | #endif |