1 #ifndef BOOST_METAPARSE_V1_FOLDL_REJECT_INCOMPLETE_START_WITH_PARSER_HPP 2 #define BOOST_METAPARSE_V1_FOLDL_REJECT_INCOMPLETE_START_WITH_PARSER_HPP 3 4 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 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/foldl_reject_incomplete.hpp> 10 #include <boost/metaparse/v1/get_remaining.hpp> 11 #include <boost/metaparse/v1/get_position.hpp> 12 #include <boost/metaparse/v1/get_result.hpp> 13 #include <boost/metaparse/v1/is_error.hpp> 14 15 #include <boost/mpl/eval_if.hpp> 16 17 namespace boost 18 { 19 namespace metaparse 20 { 21 namespace v1 22 { 23 template <class P, class StateP, class ForwardOp> 24 class foldl_reject_incomplete_start_with_parser 25 { 26 private: 27 template <class Res> 28 struct apply_unchecked : 29 foldl_reject_incomplete< 30 P, 31 typename get_result<Res>::type, 32 ForwardOp 33 >::template apply< 34 typename get_remaining<Res>::type, 35 typename get_position<Res>::type 36 > 37 {}; 38 public: 39 typedef foldl_reject_incomplete_start_with_parser type; 40 41 template <class S, class Pos> 42 struct apply : 43 boost::mpl::eval_if< 44 typename is_error<typename StateP::template apply<S, Pos> >::type, 45 typename StateP::template apply<S, Pos>, 46 apply_unchecked<typename StateP::template apply<S, Pos> > 47 > 48 {}; 49 }; 50 } 51 } 52 } 53 54 #endif 55 56