parsi/fn/repeated.hpp
-
namespace parsi
Functions
-
template<std::size_t Min = 0, std::size_t Max = std::numeric_limits<std::size_t>::max(), is_parser F>
constexpr auto repeat(F &&parser) noexcept -> fn::Repeated<std::remove_cvref_t<F>, Min, Max> Creates a repeated parser combinator, a combinator which combines the given parser repeatedly for a given minimum and maximum times.
By default, the range is from 0 to almost infinite, expecting the parser to be repeated from none at all to any amount of times.
See also
-
template<is_parser F>
constexpr auto repeat(F &&parser, std::size_t count) noexcept -> fn::RepeatedRanged<std::remove_cvref_t<F>> Creates a parser that repeats the given
parserwith itself consecutively for exactlycounttimes.See also
-
template<is_parser F>
constexpr auto repeat(F &&parser, std::size_t min, std::size_t max) noexcept -> fn::RepeatedRanged<std::remove_cvref_t<F>> Creates a parser that repeats the given
parserwith itself consecutively for at leastmintimes and maximummaxtimes.If the parser can successfully parse the stream consecutively within
minandmaxrange, then the parsing will be valid, otherwise parsing will fail.See also
-
namespace fn
-
template<is_parser F, std::size_t Min = 0, std::size_t Max = std::numeric_limits<std::size_t>::max()>
struct Repeated - #include <repeated.hpp>
A parser combinator that repeats the parser on stream for a
Minup toMaxtimes consecutively.The parser must succeed to consecutively parse the stream for at least
Mintimes and at mostMaxtimes, otherwise it will result in failure.MinandMaxare compile-time for optimization purposes.
-
template<is_parser F>
struct RepeatedRanged - #include <repeated.hpp>
A parser combinator that repeats the parser on stream for a range of miniumum and maximum count consecutively.
The parser must succeed to consecutively parse the stream for at least
mintimes and at mostmaxtimes, otherwise it will fail.
-
template<is_parser F, std::size_t Min = 0, std::size_t Max = std::numeric_limits<std::size_t>::max()>
-
template<std::size_t Min = 0, std::size_t Max = std::numeric_limits<std::size_t>::max(), is_parser F>