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_MARKER_HPP_EAN_04_01_2007
9 #define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MARKER_HPP_EAN_04_01_2007
11 // MS compatible compilers support #pragma once
16 #include <boost/xpressive/detail/detail_fwd.hpp>
17 #include <boost/xpressive/detail/static/static.hpp>
18 #include <boost/proto/core.hpp>
20 namespace boost { namespace xpressive { namespace grammar_detail
23 ///////////////////////////////////////////////////////////////////////////////
25 // Insert mark tags before and after the expression
26 struct as_marker : proto::transform<as_marker>
28 template<typename Expr, typename State, typename Data>
29 struct impl : proto::transform_impl<Expr, State, Data>
33 terminal<detail::mark_begin_matcher>::type
34 , typename shift_right<
35 typename proto::result_of::right<typename impl::expr>::type
36 , terminal<detail::mark_end_matcher>::type
41 result_type operator ()(
42 typename impl::expr_param expr
43 , typename impl::state_param
44 , typename impl::data_param
47 int mark_nbr = detail::get_mark_number(proto::left(expr));
48 detail::mark_begin_matcher begin(mark_nbr);
49 detail::mark_end_matcher end(mark_nbr);
51 result_type that = {{begin}, {proto::right(expr), {end}}};