Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:50

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // as_marker.hpp
0003 //
0004 //  Copyright 2008 Eric Niebler. Distributed under the Boost
0005 //  Software License, Version 1.0. (See accompanying file
0006 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 
0008 #ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MARKER_HPP_EAN_04_01_2007
0009 #define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MARKER_HPP_EAN_04_01_2007
0010 
0011 // MS compatible compilers support #pragma once
0012 #if defined(_MSC_VER)
0013 # pragma once
0014 #endif
0015 
0016 #include <boost/xpressive/detail/detail_fwd.hpp>
0017 #include <boost/xpressive/detail/static/static.hpp>
0018 #include <boost/proto/core.hpp>
0019 
0020 namespace boost { namespace xpressive { namespace grammar_detail
0021 {
0022 
0023     ///////////////////////////////////////////////////////////////////////////////
0024     // as_marker
0025     //   Insert mark tags before and after the expression
0026     struct as_marker : proto::transform<as_marker>
0027     {
0028         template<typename Expr, typename State, typename Data>
0029         struct impl : proto::transform_impl<Expr, State, Data>
0030         {
0031             typedef
0032                 typename shift_right<
0033                     terminal<detail::mark_begin_matcher>::type
0034                   , typename shift_right<
0035                         typename proto::result_of::right<typename impl::expr>::type
0036                       , terminal<detail::mark_end_matcher>::type
0037                     >::type
0038                 >::type
0039             result_type;
0040 
0041             result_type operator ()(
0042                 typename impl::expr_param expr
0043               , typename impl::state_param
0044               , typename impl::data_param
0045             ) const
0046             {
0047                 int mark_nbr = detail::get_mark_number(proto::left(expr));
0048                 detail::mark_begin_matcher begin(mark_nbr);
0049                 detail::mark_end_matcher end(mark_nbr);
0050 
0051                 result_type that = {{begin}, {proto::right(expr), {end}}};
0052                 return that;
0053             }
0054         };
0055     };
0056 }}}
0057 
0058 #endif