struct impl {
static constexpr auto lparen = lexyd::lit_c<'('>;
static constexpr auto rparen = lexyd::lit_c<')'>;
[[__maybe_unused__]]
static constexpr auto max_recursion_depth = 4;
[[__maybe_unused__]]
static constexpr auto rule = [] consteval noexcept {
return lexyd::parenthesized(
lexyd::while_(
(lexyd::peek(lparen) >> lexyd::recurse_branch<impl>)
| lexyd::ascii::character - rparen));
}();
};
constexpr auto S = ::lexy::zstring_input("(s(s(a)ss)(a)s)");
static_assert(::lexy::match<impl>(S));
::lexy::parse<impl>(S, ::lexy_ext::report_error).value();
i hope parsing |
Answered by
foonathan
Oct 13, 2025
Replies: 2 comments
|
You turn |
0 replies
Answer selected by
foonathan
|
Thanks, that helps. I used dsl::rule_scanner to achieve what I wanted before. I will go back and look at dsl::capture |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You turn
implinto alexy::token_production(to uniquely handle with whitespace), then usedsl::capture: https://godbolt.org/z/hrd6864Kz