• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 ///////////////////////////////////////////////////////////////////////////////
2 // as_sequence.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_SEQUENCE_HPP_EAN_04_01_2007
9 #define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_SEQUENCE_HPP_EAN_04_01_2007
10 
11 // MS compatible compilers support #pragma once
12 #if defined(_MSC_VER)
13 # pragma once
14 #endif
15 
16 #include <boost/mpl/assert.hpp>
17 #include <boost/type_traits/is_same.hpp>
18 #include <boost/xpressive/detail/detail_fwd.hpp>
19 #include <boost/xpressive/detail/static/static.hpp>
20 
21 namespace boost { namespace xpressive { namespace grammar_detail
22 {
23     template<typename Grammar, typename Callable = proto::callable>
24     struct in_sequence : proto::transform<in_sequence<Grammar, Callable> >
25     {
26         template<typename Expr, typename State, typename Data>
27         struct impl : proto::transform_impl<Expr, State, Data>
28         {
29             typedef
30                 detail::static_xpression<
31                     typename Grammar::template impl<Expr, State, Data>::result_type
32                   , State
33                 >
34             result_type;
35 
operator ()boost::xpressive::grammar_detail::in_sequence::impl36             result_type operator ()(
37                 typename impl::expr_param expr
38               , typename impl::state_param state
39               , typename impl::data_param data
40             ) const
41             {
42                 return result_type(
43                     typename Grammar::template impl<Expr, State, Data>()(expr, state, data)
44                   , state
45                 );
46             }
47         };
48     };
49 
50 }}}
51 
52 #endif
53