1 #ifndef BOOST_METAPARSE_V1_FOLDR_START_WITH_PARSER_HPP
2 #define BOOST_METAPARSE_V1_FOLDR_START_WITH_PARSER_HPP
4 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2012.
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)
9 #include <boost/metaparse/v1/accept.hpp>
10 #include <boost/metaparse/v1/is_error.hpp>
11 #include <boost/metaparse/v1/get_position.hpp>
12 #include <boost/metaparse/v1/get_result.hpp>
13 #include <boost/metaparse/v1/get_remaining.hpp>
15 #include <boost/mpl/eval_if.hpp>
23 template <class P, class StateP, class BackwardOp>
24 struct foldr_start_with_parser
27 template <class Res, class Rem>
28 struct apply_unchecked1 :
30 typename BackwardOp::template apply<
31 typename get_result<Rem>::type,
32 typename get_result<Res>::type
34 typename get_remaining<Rem>::type,
35 typename get_position<Rem>::type
40 struct apply_unchecked;
42 typedef foldr_start_with_parser type;
44 template <class S, class Pos>
47 typename is_error<typename P::template apply<S, Pos> >::type,
48 typename StateP::template apply<S, Pos>,
49 apply_unchecked<typename P::template apply<S, Pos> >
54 struct apply_unchecked
58 typename foldr_start_with_parser::template apply<
59 typename get_remaining<Res>::type,
60 typename get_position<Res>::type
65 typename boost::mpl::eval_if<
66 typename is_error<parsed_remaining>::type,
68 apply_unchecked1<Res, parsed_remaining>