From 35f121bb275493f11ce62069af3e2e188c6d7fa4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 13 Mar 2025 00:14:58 -0400 Subject: Fix CRLF pattern --- stdlib/patterns.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'stdlib') diff --git a/stdlib/patterns.c b/stdlib/patterns.c index 7d6ccd37..621cb06c 100644 --- a/stdlib/patterns.c +++ b/stdlib/patterns.c @@ -604,6 +604,10 @@ static pat_t parse_next_pat(TextIter_t *state, int64_t *index) return PAT(PAT_FUNCTION, .fn=match_alphanumeric); } break; + case 'c': + if (strcasecmp(prop_name, "crlf") == 0) + return PAT(PAT_FUNCTION, .fn=match_newline); + break; case 'd': if (strcasecmp(prop_name, "digit") == 0) { return PAT(PAT_PROPERTY, .property=UC_PROPERTY_DECIMAL_DIGIT); @@ -637,8 +641,7 @@ static pat_t parse_next_pat(TextIter_t *state, int64_t *index) } break; case 'n': - if (strcasecmp(prop_name, "nl") == 0 || strcasecmp(prop_name, "newline") == 0 - || strcasecmp(prop_name, "crlf")) { + if (strcasecmp(prop_name, "nl") == 0 || strcasecmp(prop_name, "newline") == 0) { return PAT(PAT_FUNCTION, .fn=match_newline); } else if (strcasecmp(prop_name, "num") == 0) { return PAT(PAT_FUNCTION, .fn=match_num); @@ -674,6 +677,7 @@ static pat_t parse_next_pat(TextIter_t *state, int64_t *index) return PAT(PAT_GRAPHEME, .grapheme=(int32_t)grapheme); #undef PAT } else { + return (pat_t){.tag=PAT_GRAPHEME, .non_capturing=true, .min=1, .max=1, .grapheme=Text$get_grapheme_fast(state, (*index)++)}; } } -- cgit v1.2.3