From d321a23b3d2128a5c7fb6f2afa993018b1c92ce0 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 3 Sep 2024 21:32:29 -0400 Subject: Bugfix for "?" --- builtins/text.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/builtins/text.c b/builtins/text.c index c318b2c8..81d42e1f 100644 --- a/builtins/text.c +++ b/builtins/text.c @@ -1067,8 +1067,10 @@ int64_t match(Text_t text, Pattern_t pattern, int64_t text_index, int64_t patter fail("Pattern's closing brace is missing: %k", &pattern); while (text_index < text.length) { int32_t c = _next_grapheme(text, &text_state, text_index); - if (c == close) - return (text_index - start_index); + if (c == close) { + ++text_index; + goto next_part_of_pattern; + } if (c == '\\' && text_index < text.length) { text_index += 2; @@ -1312,6 +1314,8 @@ int64_t match(Text_t text, Pattern_t pattern, int64_t text_index, int64_t patter pattern_index += 1; text_index += 1; } + + next_part_of_pattern:; } if (text_index >= text.length && pattern_index < pattern.length) return -1; -- cgit v1.2.3