6 template <class P, class Msg = error::end_of_input_expected>
9 This is a [link parser_combinator parser combinator].
13 [[`P`] [[link parser parser]]]
14 [[`Msg`] [[link parsing_error_message parsing error message]]]
19 It parses the input using `P` and checks if it consumes the entire input. If `P`
20 fails or doesn't consume the entire input, `entire_input` fails. Otherwise
21 `entire_input` returns the result of `P`. When `P` does not consume the entire
22 input, the error message returned by `entire_input` is `Msg`.
26 #include <boost/metaparse/entire_input.hpp>
28 [h1 Expression semantics]
30 For any `p` parser and `e` parsing error message the following are equivalent
36 change_error_message<empty</* some metaprogramming value */>, e>
41 #include <boost/metaparse/entire_input.hpp>
42 #include <boost/metaparse/int_.hpp>
43 #include <boost/metaparse/string.hpp>
44 #include <boost/metaparse/start.hpp>
45 #include <boost/metaparse/get_result.hpp>
46 #include <boost/metaparse/get_message.hpp>
47 #include <boost/metaparse/define_error.hpp>
49 using namespace boost::metaparse;
51 BOOST_METAPARSE_DEFINE_ERROR(extra_chars_at_end, "Extra chars at end");
53 using int_parser = entire_input<int_, extra_chars_at_end>;
57 int_parser::apply<BOOST_METAPARSE_STRING("1113"), start>
58 >::type::value == 1113,
59 "it should parse the input if it contains only an integer"
65 int_parser::apply<BOOST_METAPARSE_STRING("1113mm"), start>
69 "it should return the specified error message when there are extra characters"