parsi/fn/anyof.hpp

namespace parsi

Functions

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

Creates a parser by combining the given parsers where the result of only the one that succeeds or the result of last one that fails will be returned.

See also

fn::AnyOf

namespace fn
template<is_parser... Fs>
struct AnyOf
#include <anyof.hpp>

A parser combinator where it tries the given parsers on the given stream and at least one of them must succeed which its result will be returned, otherwise the result of the last one to fail will be returned.

Public Functions

inline explicit constexpr AnyOf(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