Warning, file /include/boost/spirit/home/lex/argument.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009 #if !defined(BOOST_SPIRIT_LEX_ARGUMENT_JUNE_07_2009_1106AM)
0010 #define BOOST_SPIRIT_LEX_ARGUMENT_JUNE_07_2009_1106AM
0011
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015
0016 #include <boost/spirit/home/support/string_traits.hpp>
0017 #include <boost/spirit/home/lex/argument_phoenix.hpp>
0018 #include <boost/fusion/include/at.hpp>
0019 #include <boost/mpl/at.hpp>
0020 #include <boost/mpl/bool.hpp>
0021 #include <boost/phoenix/core/actor.hpp>
0022 #include <boost/phoenix/core/argument.hpp>
0023 #include <boost/type_traits/is_same.hpp>
0024 #include <boost/type_traits/remove_const.hpp>
0025 #include <boost/type_traits/remove_reference.hpp>
0026
0027
0028 namespace boost { namespace spirit { namespace lex
0029 {
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 struct state_getter
0044 {
0045 typedef mpl::true_ no_nullary;
0046
0047 template <typename Env>
0048 struct result
0049 {
0050 typedef
0051 typename remove_reference<
0052 typename remove_const<
0053 typename mpl::at_c<typename Env::args_type, 4>::type
0054 >::type
0055 >::type
0056 context_type;
0057
0058 typedef typename context_type::state_name_type type;
0059 };
0060
0061 template <typename Env>
0062 typename result<Env>::type
0063 eval(Env const& env) const
0064 {
0065 return fusion::at_c<4>(env.args()).get_state_name();
0066 }
0067 };
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082 template <typename Actor>
0083 struct state_setter
0084 {
0085 typedef mpl::true_ no_nullary;
0086
0087 template <typename Env>
0088 struct result
0089 {
0090 typedef void type;
0091 };
0092
0093 template <typename Env>
0094 void eval(Env const& env) const
0095 {
0096 fusion::at_c<4>(env.args()).set_state_name(
0097 traits::get_c_string(actor_.eval(env)));
0098 }
0099
0100 state_setter(Actor const& actor)
0101 : actor_(actor) {}
0102
0103 Actor actor_;
0104 };
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118 struct value_getter
0119 {
0120 typedef mpl::true_ no_nullary;
0121
0122 template <typename Env>
0123 struct result
0124 {
0125 typedef
0126 typename remove_reference<
0127 typename remove_const<
0128 typename mpl::at_c<typename Env::args_type, 4>::type
0129 >::type
0130 >::type
0131 context_type;
0132
0133 typedef typename context_type::get_value_type type;
0134 };
0135
0136 template <typename Env>
0137 typename result<Env>::type
0138 eval(Env const& env) const
0139 {
0140 return fusion::at_c<4>(env.args()).get_value();
0141 }
0142 };
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157 template <typename Actor>
0158 struct value_setter
0159 {
0160 typedef mpl::true_ no_nullary;
0161
0162 template <typename Env>
0163 struct result
0164 {
0165 typedef void type;
0166 };
0167
0168 template <typename Env>
0169 void eval(Env const& env) const
0170 {
0171 fusion::at_c<4>(env.args()).set_value(actor_.eval(env));
0172 }
0173
0174 value_setter(Actor const& actor)
0175 : actor_(actor) {}
0176
0177 Actor actor_;
0178 };
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194 struct eoi_getter
0195 {
0196 typedef mpl::true_ no_nullary;
0197
0198 template <typename Env>
0199 struct result
0200 {
0201 typedef
0202 typename remove_reference<
0203 typename remove_const<
0204 typename mpl::at_c<typename Env::args_type, 4>::type
0205 >::type
0206 >::type
0207 context_type;
0208
0209 typedef typename context_type::base_iterator_type const& type;
0210 };
0211
0212 template <typename Env>
0213 typename result<Env>::type
0214 eval(Env const& env) const
0215 {
0216 return fusion::at_c<4>(env.args()).get_eoi();
0217 }
0218 };
0219
0220
0221
0222
0223 typedef phoenix::arg_names::_1_type _start_type;
0224 typedef phoenix::arg_names::_2_type _end_type;
0225 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
0226 _start_type const _start = _start_type();
0227 _end_type const _end = _end_type();
0228 #endif
0229
0230
0231
0232
0233
0234 using boost::spirit::_pass_type;
0235 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
0236 using boost::spirit::_pass;
0237 #endif
0238
0239
0240
0241 typedef phoenix::arg_names::_4_type _tokenid_type;
0242 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
0243 _tokenid_type const _tokenid = _tokenid_type();
0244 #endif
0245
0246 typedef phoenix::actor<value_context> _val_type;
0247 typedef phoenix::actor<state_context> _state_type;
0248 typedef phoenix::actor<eoi_getter> _eoi_type;
0249 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
0250
0251
0252 _val_type const _val = _val_type();
0253
0254
0255 _state_type const _state = _state_type();
0256
0257
0258 _eoi_type const _eoi = _eoi_type();
0259 #endif
0260 }}}
0261
0262
0263 #undef SPIRIT_DECLARE_ARG
0264 #endif
0265