9 This is a [link parser_combinator parser combinator].
13 [[`P`] [[link parser parser]]]
18 It applies `P` on the input string repeatedly as long as `P` accepts the input.
19 The result of parsing is a sequence of the results of the individual
22 When `P` rejects the input for the first time, `repeated` still accepts the
23 input and the result of parsing is an empty sequence.
25 Here is a diagram showing how `repeated` works by example:
27 using int_token = token<int_>;
29 [$images/metaparse/repeated_diag1.png [width 70%]]
31 Further details can be found in the [link repetition Repetition] section
32 of the [link manual User Manual].
36 #include <boost/metaparse/repeated.hpp>
38 [h1 Expression semantics]
40 For any `p` parser the following are equivalent:
46 /* unspecified empty sequence */,
47 boost::mpl::push_back<_2, _1>
52 #include <boost/metaparse/repeated.hpp>
53 #include <boost/metaparse/digit_val.hpp>
54 #include <boost/metaparse/start.hpp>
55 #include <boost/metaparse/string.hpp>
56 #include <boost/metaparse/get_result.hpp>
58 #include <boost/mpl/equal.hpp>
59 #include <boost/mpl/vector.hpp>
60 #include <boost/mpl/int.hpp>
62 using namespace boost::metaparse;
64 using digits = repeated<digit_val>;
68 get_result<digits::apply<BOOST_METAPARSE_STRING("1234"), start>>::type,
76 "the result of parsing should be the list of digit values"
81 get_result<digits::apply<BOOST_METAPARSE_STRING("x"), start>>::type,
84 "repeated should accept the input when it can't parse anything with digit_val"