Go to the documentation of this file.
4 #ifndef LEXY_DSL_SEPARATOR_HPP_INCLUDED
5 #define LEXY_DSL_SEPARATOR_HPP_INCLUDED
17 return "unexpected trailing separator";
25 template <
typename Branch,
typename Tag>
28 template <
typename NextParser>
33 template <
typename Context,
typename Reader,
typename... Args>
35 typename Reader::iterator sep_begin, Args&&... args)
37 auto sep_end = reader.position();
48 template <
typename Context,
typename Reader,
typename... Args>
52 !parser.try_parse(context.control_block, reader))
55 parser.cancel(context);
61 return parser.template finish<_pc>(context, reader, reader.position(),
68 template <
typename Branch,
typename Tag>
74 template <
typename Context,
typename Reader>
76 typename Reader::iterator sep_begin,
77 typename Reader::iterator sep_end)
85 template <
typename NewTag>
90 template <
typename Branch>
91 constexpr
auto sep(Branch)
97 template <
typename Branch>
103 template <
typename Context,
typename Reader>
105 typename Reader::iterator)
110 template <
typename Branch>
117 template <
typename Branch>
123 template <
typename Context,
typename Reader>
125 typename Reader::iterator)
130 template <
typename Branch>
133 static_assert(lexy::is_branch_rule<Branch>);
138 #endif // LEXY_DSL_SEPARATOR_HPP_INCLUDED
static LEXY_CONSTEVAL auto name()
constexpr auto sep(Branch)
Defines a separator for a list.
typename BranchRule::template bp< Reader > branch_parser_for
std::conditional_t< std::is_void_v< T >, Fallback, T > type_or
constexpr auto ignore_trailing_sep(Branch)
Defines a separator for a list that ignores the existence of trailing separators.
#define LEXY_REQUIRE_BRANCH_RULE(Rule, Name)
decltype(lexyd::if_(Branch{})) trailing_rule
constexpr auto parse(const Input &input, const ErrorCallback &callback)
Parses the production into a value, invoking the callback on error.
static constexpr void report_trailing_error(Context &context, Reader &, typename Reader::iterator sep_begin, typename Reader::iterator sep_end)
static constexpr void report_trailing_error(Context &, Reader &, typename Reader::iterator, typename Reader::iterator)
constexpr auto trailing_sep(Branch)
Defines a separator for a list that can be trailing.
static constexpr void report_trailing_error(Context &, Reader &, typename Reader::iterator, typename Reader::iterator)
constexpr auto if_(Branch)
If the branch condition matches, matches the branch then.
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, typename Reader::iterator sep_begin, Args &&... args)
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, Args &&... args)
static constexpr _sep< Branch, NewTag > trailing_error