parsi/fn/extract.hpp
-
namespace parsi
Functions
-
template<is_parser F, std::invocable<std::string_view> G>
constexpr auto extract(F &&parser, G &&visitor) noexcept -> fn::Extract<std::remove_cvref_t<F>, std::remove_cvref_t<G>> Creates a
parser
that extracts (non-owning) the portion that was successfully parsed with the givenparser
, and passes the subspan portion to the givenvisitor
.See also
-
namespace fn
-
template<is_parser F, std::invocable<std::string_view> G>
struct Extract - #include <extract.hpp>
Visits the sub portion of the stream that was successfully parsed via
parser
by passing the subspan/substr to thevisitor
, and if the parser fails, thevisitor
won’t be called.The
visitor
can optionally return a boolean to indicate success or failure of the parser.
-
template<is_parser F, std::invocable<std::string_view> G>
-
template<is_parser F, std::invocable<std::string_view> G>