[libc-commits] [libc] [libc][regex] Add ERE {m, n} interval quantifiers (PR #236569)
Alex Strelnikov via libc-commits
libc-commits at lists.llvm.org
Wed Nov 11 09:47:30 PST 2026
================
@@ -165,17 +168,69 @@ ErrorOr<ExprId> parse_bracket_expr(cpp::string_view &rem, int cflags,
// Maximum parenthesized group nesting depth to prevent parser stack overflow.
constexpr size_t MAX_GROUP_DEPTH = 128;
+// Parses a decimal repetition bound in [0, RE_DUP_MAX] from the prefix of spec.
+cpp::optional<uint16_t> consume_bound(cpp::string_view &spec) {
+ if (spec.empty() || !internal::isdigit(spec.front()))
+ return cpp::nullopt;
----------------
strel-12 wrote:
Nit: This function could expect to never be called with an empty `spec` given the code below and the expectation that `parse_repeat_bounds` is called after matching with a leading digit. The check for `isdigit` here could be moved to the `else` on line 206 as it isn't needed for `min_opt`.
https://github.com/llvm/llvm-project/pull/236569
More information about the libc-commits
mailing list