diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-03 21:34:29 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-03 21:34:29 -0400 |
| commit | 79b48365d6abe0f42b9cadd01959eeb1fa1be0b8 (patch) | |
| tree | cf3b2e01a36e0e0729dd64f097e145cb098ea8ec | |
| parent | d321a23b3d2128a5c7fb6f2afa993018b1c92ce0 (diff) | |
Add comments
| -rw-r--r-- | builtins/text.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/builtins/text.c b/builtins/text.c index 81d42e1f..128209af 100644 --- a/builtins/text.c +++ b/builtins/text.c @@ -1266,6 +1266,7 @@ int64_t match(Text_t text, Pattern_t pattern, int64_t text_index, int64_t patter got_prop:; if (min == 0 && pattern_index < pattern.length) { + // Try matching the rest of the pattern immediately: int64_t match_len = match(text, pattern, text_index, pattern_index); if (match_len >= 0) return (text_index - start_index) + match_len; @@ -1294,6 +1295,7 @@ int64_t match(Text_t text, Pattern_t pattern, int64_t text_index, int64_t patter if (count >= min) { if (pattern_index < pattern.length) { + // If we have the minimum and we match the rest of the pattern, we're good: int64_t match_len = match(text, pattern, text_index, pattern_index); if (match_len >= 0) { return (text_index - start_index) + match_len; |
