struct __impl {
[[__maybe_unused__]]
static constexpr auto rule = [] consteval noexcept {
return __lexyd::loop(
__lexyd::peek(__leading_for<__static>) >> __lexyd::p<__static>
// {{ ?name: int }} pattern could only appear at last segment, so break out here
| (__lexyd::peek(__leading_for<__parameter>) >> (__lexyd::lookahead(__lexyd::question_mark, __lexyd::colon) >> (__lexyd::p<__parameter> + __lexyd::break_) | __lexyd::else_ >> __lexyd::p<__parameter>) )
| __lexyd::peek(__leading_for<__any>)
>> __lexyd::p<__any> >> __lexyd::break_)
+ __lexyd::opt(__lexyd::slash) // eat optional trailing slash
+ __lexyd::eof;
}();
// [[__maybe_unused__]]
// static constexpr auto value = ::lexy::bind_sink(__radix_tree_sink{}, ::lexy::parse_state);
};since lexyd::p<...> used, the production produces values in pattern rule(lexyd::loop) In template: static assertion failed due to requirement 'sizeof...(Args) == 0': pattern rule must not produce any valuesclang(static_assert_requirement_failed) if i change lexyd::loop to lexyd::list, then lexyd::break being unusable. or should i use lexyd::must(lexyd::eof).error<...> instead? |
Answered by
foonathan
Oct 13, 2025
Replies: 2 comments
|
Yes, |
0 replies
Answer selected by
foonathan
|
Thanks. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes,
dsl::break_only works withdsl::loop, notdsl::list. I could extenddsl::listto also supportdsl::break_if you have a use case, but if your pattern is:dsl::loop(a | b | c >> break_), you can turn that intodsl::list(a | b) + c(potentially withdsl::mustfor better diagnostics.