1 #ifndef BOOST_METAPARSE_V1_KEYWORD_HPP
2 #define BOOST_METAPARSE_V1_KEYWORD_HPP
4 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
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/impl/void_.hpp>
10 #include <boost/metaparse/v1/lit.hpp>
11 #include <boost/metaparse/v1/return_.hpp>
12 #include <boost/metaparse/v1/is_error.hpp>
13 #include <boost/metaparse/v1/get_remaining.hpp>
14 #include <boost/metaparse/v1/get_position.hpp>
16 #include <boost/mpl/if.hpp>
17 #include <boost/mpl/eval_if.hpp>
18 #include <boost/mpl/empty.hpp>
19 #include <boost/mpl/pop_front.hpp>
20 #include <boost/mpl/front.hpp>
28 // Does not consume/check anything after the keyword
29 template <class Kw, class ResultType = impl::void_>
36 typedef lit<typename boost::mpl::front<Kw>::type> next_char_parser;
39 keyword<typename boost::mpl::pop_front<Kw>::type, ResultType>
42 template <class S, class Pos>
43 struct apply_unchecked :
44 rest_parser::template apply<
45 typename get_remaining<
46 typename next_char_parser::template apply<S, Pos>
48 typename get_position<
49 typename next_char_parser::template apply<S, Pos>
54 template <class S, class Pos>
58 typename next_char_parser::template apply<S, Pos>
60 typename next_char_parser::template apply<S, Pos>,
61 apply_unchecked<S, Pos>
68 template <class S, class Pos>
71 boost::mpl::empty<Kw>,
74 >::type::template apply<S, Pos>