PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/xpressive/detail/static/transforms/as_marker.hpp

http://hadesmem.googlecode.com/
C++ Header | 58 lines | 40 code | 8 blank | 10 comment | 1 complexity | db0c7fd87731089b710c36a3b2a9489c MD5 | raw file
 1///////////////////////////////////////////////////////////////////////////////
 2// as_marker.hpp
 3//
 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)
 7
 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
10
11// MS compatible compilers support #pragma once
12#if defined(_MSC_VER) && (_MSC_VER >= 1020)
13# pragma once
14#endif
15
16#include <boost/xpressive/detail/detail_fwd.hpp>
17#include <boost/xpressive/detail/static/static.hpp>
18#include <boost/proto/core.hpp>
19
20namespace boost { namespace xpressive { namespace grammar_detail
21{
22
23    ///////////////////////////////////////////////////////////////////////////////
24    // as_marker
25    //   Insert mark tags before and after the expression
26    struct as_marker : proto::transform<as_marker>
27    {
28        template<typename Expr, typename State, typename Data>
29        struct impl : proto::transform_impl<Expr, State, Data>
30        {
31            typedef
32                typename shift_right<
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
37                    >::type
38                >::type
39            result_type;
40
41            result_type operator ()(
42                typename impl::expr_param expr
43              , typename impl::state_param
44              , typename impl::data_param
45            ) const
46            {
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);
50
51                result_type that = {{begin}, {proto::right(expr), {end}}};
52                return that;
53            }
54        };
55    };
56}}}
57
58#endif