Go to the documentation of this file.
4 #ifndef LEXY_DSL_LOOP_HPP_INCLUDED
5 #define LEXY_DSL_LOOP_HPP_INCLUDED
14 template <
typename NextParser>
17 template <
typename Context,
typename Reader,
typename LoopControl,
typename... Args>
20 cntrl.loop_break =
true;
25 template <
typename Reader>
35 template <
typename Rule>
38 template <
typename NextParser>
41 template <
typename Context,
typename Reader,
typename... Args>
46 bool loop_break =
false;
62 template <
typename Rule>
71 template <
typename Branch>
74 template <
typename NextParser>
77 template <
typename Context,
typename Reader,
typename... Args>
81 while (branch.try_parse(context.control_block, reader))
86 branch.cancel(context);
94 template <
typename Rule>
105 template <
typename Rule>
109 return rule >>
while_(rule);
116 template <
typename Then,
typename Condition>
117 constexpr
auto do_while(Then then, Condition condition)
123 #endif // LEXY_DSL_LOOP_HPP_INCLUDED
static LEXY_PARSER_FUNC bool parse(Context &, Reader &, LoopControl &cntrl, Args &&...)
constexpr auto while_(Rule)
Matches the branch rule as often as possible.
constexpr auto _maybe_branch(Condition condition, Then then)
typename BranchRule::template bp< Reader > branch_parser_for
#define LEXY_REQUIRE_BRANCH_RULE(Rule, Name)
constexpr auto loop(Rule)
Repeatedly matches the rule until a break rule matches.
constexpr auto parse(const Input &input, const ErrorCallback &callback)
Parses the production into a value, invoking the callback on error.
A branch parser that takes a branch unconditionally and forwards to the regular parser.
constexpr auto do_while(Then then, Condition condition)
Matches then once, then while_(condition >> then).
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, Args &&... args)
A parser that does not support any arguments.
constexpr auto break_
Exits a loop().
constexpr auto while_one(Rule rule)
Matches the rule at least once, then as often as possible.
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, Args &&... args)
typename Rule::template p< NextParser > parser_for