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