Go to the documentation of this file.
4 #ifndef LEXY_DSL_TERMINATOR_HPP_INCLUDED
5 #define LEXY_DSL_TERMINATOR_HPP_INCLUDED
16 template <
typename Terminator,
typename Rule>
18 template <
typename Terminator,
typename R,
typename Sep,
typename Recover>
20 template <
typename Terminator,
typename R,
typename Sep,
typename Recover>
23 template <
typename Terminator,
typename RecoveryLimit =
void>
27 template <
typename... Literals>
30 static_assert(
sizeof...(Literals) > 0);
33 return _term<Terminator, decltype(l)>{};
38 template <
typename Rule>
45 template <
typename Rule>
46 constexpr
auto try_(Rule)
const
53 template <
typename Rule>
54 constexpr
auto opt(Rule)
const
61 template <
typename Rule>
62 constexpr
auto list(Rule)
const
66 template <
typename Rule,
typename Sep>
67 constexpr
auto list(Rule, Sep)
const
69 static_assert(lexy::is_separator<Sep>);
75 template <
typename Rule>
80 template <
typename Rule,
typename Sep>
83 static_assert(lexy::is_separator<Sep>);
97 if constexpr (std::is_void_v<RecoveryLimit>)
105 template <
typename Branch>
113 #endif // LEXY_DSL_TERMINATOR_HPP_INCLUDED
constexpr auto opt(Rule) const
constexpr auto terminator(Branch)
Creates a terminator using the given branch.
constexpr auto _maybe_branch(Condition condition, Then then)
constexpr auto recover(Branches...)
Discards input until one of the branches matches to recover from an error.
constexpr auto terminator() const
Matches the terminator alone.
constexpr auto list(Rule) const
constexpr auto opt_list(Rule) const
#define LEXY_REQUIRE_BRANCH_RULE(Rule, Name)
constexpr auto try_(Rule) const
Matches rule followed by the terminator, recovering on error.
constexpr auto operator()(Rule rule) const
Matches rule followed by the terminator.
constexpr auto recovery_rule() const
Matches the recovery rule alone.
constexpr auto limit(Literals... literals) const
Adds the literal tokens to the recovery limit.
constexpr auto list(Rule, Sep) const
constexpr auto opt_list(Rule, Sep) const