parsi/fn/sequence.hpp

namespace parsi

Functions

template<is_parser... Fs>
constexpr auto sequence(Fs&&... parsers) noexcept -> fn::Sequence<std::remove_cvref_t<Fs>...>

Creates an instance of fn::Sequence; a combinator to combine multiple parsers to parse a stream sequentially and consecutively.

namespace fn
template<is_parser... Fs>
struct Sequence
#include <sequence.hpp>

Combines multiple parsers in consecutive order.

It starts by passing the incoming stream to the first parser, and on success, its result stream to the second and goes on up to the last parser. If any of the parsers fail, it would return the failed result.

Public Functions

inline explicit constexpr Sequence(std::remove_cvref_t<Fs>... parsers) noexcept
inline constexpr auto operator()(Stream stream) const noexcept -> Result

Public Members

std::tuple<std::remove_cvref_t<Fs>...> parsers

Private Functions

template<std::size_t I> inline  requires (I< sizeof...(Fs)) const expr auto parse_rec(Stream stream) const noexcept -> Result