Go to the documentation of this file.
4 #ifndef LEXY_DSL_REPEAT_HPP_INCLUDED
5 #define LEXY_DSL_REPEAT_HPP_INCLUDED
14 template <
typename Item,
typename Sep>
19 template <
typename Context,
typename Reader,
typename... Sink>
20 static constexpr
bool loop(Context& context, Reader& reader, std::size_t
count, Sink&... sink)
32 for (std::size_t i = 1; i !=
count; ++i)
46 template <
typename Item>
51 template <
typename Context,
typename Reader,
typename... Sink>
52 static constexpr
bool loop(Context& context, Reader& reader, std::size_t
count, Sink&... sink)
64 for (std::size_t i = 1; i !=
count; ++i)
74 template <
typename Item,
typename Sep>
77 template <
typename NextParser>
80 template <
typename Context,
typename Reader,
typename... Args>
91 template <
typename Item,
typename Sep>
94 template <
typename NextParser>
97 template <
typename Context,
typename Reader,
typename... Args>
101 auto sink = context.value_callback().sink();
110 template <
typename Item,
typename Sep>
113 template <
typename NextParser>
116 template <
typename Context,
typename Reader,
typename... Args>
120 auto begin = reader.position();
130 template <
typename Count,
typename Loop>
131 struct _rep : decltype(_maybe_branch(_pas<std::size_t, Count, true>{}, Loop{}))
134 template <
typename Count>
137 template <
typename Item>
142 template <
typename Item,
typename Sep>
145 static_assert(lexy::is_separator<Sep>);
149 template <
typename Item>
150 constexpr
auto list(Item)
const
154 template <
typename Item,
typename Sep>
155 constexpr
auto list(Item, Sep)
const
157 static_assert(lexy::is_separator<Sep>);
161 template <
typename Item>
166 template <
typename Item,
typename Sep>
169 static_assert(lexy::is_separator<Sep>);
175 template <
typename Count>
182 #endif // LEXY_DSL_REPEAT_HPP_INCLUDED
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, std::size_t count, Args &&... args)
constexpr auto operator()(Item) const
constexpr auto list(Item, Sep) const
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, std::size_t count, Args &&... args)
constexpr auto capture(Item) const
constexpr auto capture(Item, Sep) const
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, std::size_t count, Args &&... args)
static constexpr bool loop(Context &context, Reader &reader, std::size_t count, Sink &... sink)
constexpr auto count
Sink that counts all arguments.
constexpr auto parse(const Input &input, const ErrorCallback &callback)
Parses the production into a value, invoking the callback on error.
constexpr auto operator()(Item, Sep) const
A parser that forwards all arguments to a sink, which is the first argument.
static constexpr bool loop(Context &context, Reader &reader, std::size_t count, Sink &... sink)
constexpr auto begin(const C &c) -> decltype(c.begin())
constexpr auto list(Item) const
constexpr auto repeat(Count)
Parses a rule n times, where n is the value produced by Count.
A parser that does not support any arguments.
static LEXY_PARSER_FUNC auto parse(Context &context, Reader &reader, Sink &sink, Args &&... args)
typename Rule::template p< NextParser > parser_for