1 #ifndef BOOST_METAPARSE_V1_IMPL_APPLY_PARSER_HPP
2 #define BOOST_METAPARSE_V1_IMPL_APPLY_PARSER_HPP
3 
4 // Copyright Abel Sinkovics (abel@sinkovics.hu)  2013.
5 // Distributed under the Boost Software License, Version 1.0.
6 //    (See accompanying file LICENSE_1_0.txt or copy at
7 //          http://www.boost.org/LICENSE_1_0.txt)
8 
9 #include <boost/metaparse/v1/unless_error.hpp>
10 #include <boost/metaparse/v1/get_result.hpp>
11 #include <boost/metaparse/v1/get_remaining.hpp>
12 #include <boost/metaparse/v1/get_position.hpp>
13 #include <boost/metaparse/v1/transform.hpp>
14 
15 #include <boost/mpl/push_back.hpp>
16 
17 namespace boost
18 {
19   namespace metaparse
20   {
21     namespace v1
22     {
23       namespace impl
24       {
25         struct apply_parser
26         {
27         private:
28           template <class ListToAppend>
29           struct do_append
30           {
31             template <class Item>
32             struct apply : boost::mpl::push_back<ListToAppend, Item> {};
33           };
34 
35           template <class Accum, class S, class Pos, class Parser>
36           struct apply_unchecked :
37             transform<Parser,do_append<typename Accum::type> >::template apply<
38               typename S::type,
39               typename Pos::type
40             >
41           {};
42 
43         public:
44           template <class State, class Parser>
45           struct apply :
46             unless_error<
47               State,
48               apply_unchecked<
49                 get_result<State>,
50                 get_remaining<State>,
51                 get_position<State>,
52                 Parser
53               >
54             >
55           {};
56         };
57       }
58     }
59   }
60 }
61 
62 #endif
63 
64