aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-13 00:14:58 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-13 00:14:58 -0400
commit35f121bb275493f11ce62069af3e2e188c6d7fa4 (patch)
treeb338fe0b5ac5b63b1bd2eb1aeaa44339ed50e3e9 /stdlib
parentbae83f17cf0cf57ee056ab8d55b390ebe666c408 (diff)
Fix CRLF pattern
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/patterns.c8
1 files changed, 6 insertions, 2 deletions
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)++)};
}
}