di 0.1.0
Loading...
Searching...
No Matches
match_one_or_more.h
Go to the documentation of this file.
1#pragma once
2
5#include "di/meta/relation.h"
13
14namespace di::parser {
15namespace detail {
16 struct MatchOneOrMoreFunction {
17 template<concepts::Predicate<c32> Pred>
18 requires(concepts::DecayConstructible<Pred>)
19 constexpr auto operator()(Pred&& predicate) const {
20 return match_zero_or_more(util::forward<Pred>(predicate))
21 << []<concepts::ParserContext Context, typename View>(
22 Context& context, View view) -> meta::ParserContextResult<View, Context> {
23 if (container::empty(view)) {
24 return Unexpected(context.make_error());
25 }
26 return view;
27 };
28 }
29 };
30}
31
32constexpr inline auto match_one_or_more = detail::MatchOneOrMoreFunction {};
33}
constexpr auto empty
Definition empty.h:45
View(Iter, Sent) -> View< Iter, Sent >
vocab::Expected< T, meta::ParserContextError< Context > > ParserContextResult
Definition parser_context_result.h:8
Definition code_point_parser.h:10
constexpr auto match_one_or_more
Definition match_one_or_more.h:32
constexpr auto match_zero_or_more
Definition match_zero_or_more.h:48
Unexpected(E &&) -> Unexpected< meta::UnwrapRefDecay< E > >