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
parser
with itself consecutively for exactlycount
times.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
parser
with itself consecutively for at leastmin
times and maximummax
times.If the parser can successfully parse the stream consecutively within
min
andmax
range, 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
Min
up toMax
times consecutively.The parser must succeed to consecutively parse the stream for at least
Min
times and at mostMax
times, otherwise it will result in failure.Min
andMax
are 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
min
times and at mostmax
times, 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>