aboutsummaryrefslogtreecommitdiff
path: root/builtins
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-03 21:32:29 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-03 21:32:29 -0400
commitd321a23b3d2128a5c7fb6f2afa993018b1c92ce0 (patch)
treec295641f731c819f2d02ed6cd5e793b2575a58c6 /builtins
parentcd23e72d337a027af7cb207083a7b10a09e428ad (diff)
Bugfix for "?"
Diffstat (limited to 'builtins')
-rw-r--r--builtins/text.c8
1 files 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;