1 ///////////////////////////////////////////////////////////////////////////////
4 // Copyright 2008 Eric Niebler. Distributed under the Boost
5 // Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MODIFIER_HPP_EAN_04_05_2007
9 #define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MODIFIER_HPP_EAN_04_05_2007
11 // MS compatible compilers support #pragma once
16 #include <boost/mpl/sizeof.hpp>
17 #include <boost/xpressive/detail/detail_fwd.hpp>
18 #include <boost/xpressive/detail/static/static.hpp>
19 #include <boost/proto/core.hpp>
21 #define UNCV(x) typename remove_const<x>::type
22 #define UNREF(x) typename remove_reference<x>::type
23 #define UNCVREF(x) UNCV(UNREF(x))
25 namespace boost { namespace xpressive { namespace detail
27 ///////////////////////////////////////////////////////////////////////////////
28 // regex operator tags
34 namespace boost { namespace xpressive { namespace grammar_detail
37 ///////////////////////////////////////////////////////////////////////////////
39 template<typename Grammar, typename Callable = proto::callable>
40 struct as_modifier : proto::transform<as_modifier<Grammar, Callable> >
42 template<typename Expr, typename State, typename Data>
43 struct impl : proto::transform_impl<Expr, State, Data>
46 typename proto::result_of::value<
47 typename proto::result_of::left<typename impl::expr>::type
52 typename modifier_type::template apply<typename impl::data>::type
56 typename proto::result_of::right<Expr>::type
60 typename Grammar::template impl<expr_type, State, visitor_type &>::result_type
63 result_type operator ()(
64 typename impl::expr_param expr
65 , typename impl::state_param state
66 , typename impl::data_param data
69 visitor_type new_visitor(proto::value(proto::left(expr)).call(data));
70 return typename Grammar::template impl<expr_type, State, visitor_type &>()(