4.4.1
|
|
Freundlich's C++ toolkit |
Tries a parser repeatedly, producing a vector of results.
Let p
be a parser and rep = repetition{p}
. Initially, the result r
is the empty vector. A single parsing step consists of the following actions: First, the current position pos
is saved. Then, the skipper is run. After that, the parser p
is tried. If it succeeds with result s
, then s
is added to r
. These steps continue as long as p
does not return an error. Once this happens, if the returned error is fatal, then rep
also returns a fatal error. Otherwise, rep
backtracks to pos
and returns r
.
Public Types | |
using | result_type = fcppt::parse::repetition_result< fcppt::parse::result_of< Parser > > |
Public Member Functions | |
repetition (Parser &&) | |
template<typename Ch , typename Skipper > | |
fcppt::parse::result< Ch, result_type > | parse (fcppt::reference< fcppt::parse::basic_stream< Ch > >, Skipper const &) const |
using fcppt::parse::repetition< Parser >::result_type = fcppt::parse::repetition_result<fcppt::parse::result_of<Parser> > |
|
explicit |
fcppt::parse::result< Ch, result_type > fcppt::parse::repetition< Parser >::parse | ( | fcppt::reference< fcppt::parse::basic_stream< Ch > > | , |
Skipper const & | |||
) | const |