File indexing completed on 2025-01-18 09:40:49
0001 #ifndef BOOST_METAPARSE_V1_FOLDR_START_WITH_PARSER_HPP
0002 #define BOOST_METAPARSE_V1_FOLDR_START_WITH_PARSER_HPP
0003
0004
0005
0006
0007
0008
0009 #include <boost/metaparse/v1/accept.hpp>
0010 #include <boost/metaparse/v1/is_error.hpp>
0011 #include <boost/metaparse/v1/get_position.hpp>
0012 #include <boost/metaparse/v1/get_result.hpp>
0013 #include <boost/metaparse/v1/get_remaining.hpp>
0014
0015 #include <boost/mpl/eval_if.hpp>
0016
0017 namespace boost
0018 {
0019 namespace metaparse
0020 {
0021 namespace v1
0022 {
0023 template <class P, class StateP, class BackwardOp>
0024 struct foldr_start_with_parser
0025 {
0026 private:
0027 template <class Res, class Rem>
0028 struct apply_unchecked1 :
0029 accept<
0030 typename BackwardOp::template apply<
0031 typename get_result<Rem>::type,
0032 typename get_result<Res>::type
0033 >::type,
0034 typename get_remaining<Rem>::type,
0035 typename get_position<Rem>::type
0036 >
0037 {};
0038
0039 template <class Res>
0040 struct apply_unchecked;
0041 public:
0042 typedef foldr_start_with_parser type;
0043
0044 template <class S, class Pos>
0045 struct apply :
0046 boost::mpl::eval_if<
0047 typename is_error<typename P::template apply<S, Pos> >::type,
0048 typename StateP::template apply<S, Pos>,
0049 apply_unchecked<typename P::template apply<S, Pos> >
0050 >
0051 {};
0052 private:
0053 template <class Res>
0054 struct apply_unchecked
0055 {
0056 private:
0057 typedef
0058 typename foldr_start_with_parser::template apply<
0059 typename get_remaining<Res>::type,
0060 typename get_position<Res>::type
0061 >
0062 parsed_remaining;
0063 public:
0064 typedef
0065 typename boost::mpl::eval_if<
0066 typename is_error<parsed_remaining>::type,
0067 parsed_remaining,
0068 apply_unchecked1<Res, parsed_remaining>
0069 >::type
0070 type;
0071 };
0072 };
0073 }
0074 }
0075 }
0076
0077 #endif
0078