4.4.1
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
Public Types | Public Member Functions
fcppt::parse::repetition< Parser > Class Template Reference

Detailed Description

template<typename Parser>
class fcppt::parse::repetition< Parser >

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.

Inheritance diagram for fcppt::parse::repetition< Parser >:
fcppt::parse::tag

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_typeparse (fcppt::reference< fcppt::parse::basic_stream< Ch > >, Skipper const &) const
 

Member Typedef Documentation

◆ result_type

template<typename Parser >
using fcppt::parse::repetition< Parser >::result_type = fcppt::parse::repetition_result<fcppt::parse::result_of<Parser> >

Constructor & Destructor Documentation

◆ repetition()

template<typename Parser >
fcppt::parse::repetition< Parser >::repetition ( Parser &&  )
explicit

Member Function Documentation

◆ parse()

template<typename Parser >
template<typename Ch , typename Skipper >
fcppt::parse::result< Ch, result_type > fcppt::parse::repetition< Parser >::parse ( fcppt::reference< fcppt::parse::basic_stream< Ch > >  ,
Skipper const &   
) const