File indexing completed on 2025-01-18 09:53:50
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MODIFIER_HPP_EAN_04_05_2007
0009 #define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MODIFIER_HPP_EAN_04_05_2007
0010
0011
0012 #if defined(_MSC_VER)
0013 # pragma once
0014 #endif
0015
0016 #include <boost/mpl/sizeof.hpp>
0017 #include <boost/xpressive/detail/detail_fwd.hpp>
0018 #include <boost/xpressive/detail/static/static.hpp>
0019 #include <boost/proto/core.hpp>
0020
0021 #define UNCV(x) typename remove_const<x>::type
0022 #define UNREF(x) typename remove_reference<x>::type
0023 #define UNCVREF(x) UNCV(UNREF(x))
0024
0025 namespace boost { namespace xpressive { namespace detail
0026 {
0027
0028
0029 struct modifier_tag
0030 {};
0031
0032 }}}
0033
0034 namespace boost { namespace xpressive { namespace grammar_detail
0035 {
0036
0037
0038
0039 template<typename Grammar, typename Callable = proto::callable>
0040 struct as_modifier : proto::transform<as_modifier<Grammar, Callable> >
0041 {
0042 template<typename Expr, typename State, typename Data>
0043 struct impl : proto::transform_impl<Expr, State, Data>
0044 {
0045 typedef
0046 typename proto::result_of::value<
0047 typename proto::result_of::left<typename impl::expr>::type
0048 >::type
0049 modifier_type;
0050
0051 typedef
0052 typename modifier_type::template apply<typename impl::data>::type
0053 visitor_type;
0054
0055 typedef
0056 typename proto::result_of::right<Expr>::type
0057 expr_type;
0058
0059 typedef
0060 typename Grammar::template impl<expr_type, State, visitor_type &>::result_type
0061 result_type;
0062
0063 result_type operator ()(
0064 typename impl::expr_param expr
0065 , typename impl::state_param state
0066 , typename impl::data_param data
0067 ) const
0068 {
0069 visitor_type new_visitor(proto::value(proto::left(expr)).call(data));
0070 return typename Grammar::template impl<expr_type, State, visitor_type &>()(
0071 proto::right(expr)
0072 , state
0073 , new_visitor
0074 );
0075 }
0076 };
0077 };
0078
0079 }}}
0080
0081 #undef UNCV
0082 #undef UNREF
0083 #undef UNCVREF
0084
0085 #endif