1 #ifndef BOOST_METAPARSE_V1_FAIL_AT_FIRST_CHAR_EXPECTED_HPP
2 #define BOOST_METAPARSE_V1_FAIL_AT_FIRST_CHAR_EXPECTED_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/impl/void_.hpp>
10 #include <boost/metaparse/v1/accept.hpp>
11 #include <boost/metaparse/v1/reject.hpp>
12 #include <boost/metaparse/v1/is_error.hpp>
13 #include <boost/metaparse/v1/get_position.hpp>
14 
15 #include <boost/metaparse/v1/error/expected_to_fail.hpp>
16 
17 #include <boost/mpl/eval_if.hpp>
18 #include <boost/mpl/equal_to.hpp>
19 
20 namespace boost
21 {
22   namespace metaparse
23   {
24     namespace v1
25     {
26       template <class P>
27       struct fail_at_first_char_expected
28       {
29       private:
30         template <class S, class Pos>
31         struct apply_err :
32           boost::mpl::eval_if<
33             typename boost::mpl::equal_to<
34               Pos,
35               typename get_position<typename P::template apply<S, Pos> >::type
36             >::type,
37             accept<impl::void_, S, Pos>,
38             typename P::template apply<S, Pos>
39           >
40         {};
41       public:
42         typedef fail_at_first_char_expected type;
43 
44         template <class S, class Pos>
45         struct apply :
46           boost::mpl::eval_if<
47             typename is_error<typename P::template apply<S, Pos> >::type,
48             apply_err<S, Pos>,
49             reject<error::expected_to_fail, Pos>
50           >
51         {};
52       };
53     }
54   }
55 }
56 
57 #endif
58 
59