Skip to content

Commit d175482

Browse files
author
snsmac
committed
Syntax: Make \p{Sc} work
'sc' refers to the 'Currency_Symbol' general category, but is also the abbreviation for the 'Script' property. Fixes rust-lang#835 Related rust-lang#719 b1489c8
1 parent 159a63c commit d175482

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

regex-syntax/src/unicode.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ impl<'a> ClassQuery<'a> {
243243
// a general category. (Currently, we don't even support the
244244
// 'Case_Folding' property. But if we do in the future, users will be
245245
// required to spell it out.)
246-
if norm != "cf" {
246+
// 'sc' refers to the 'Currency_Symbol' general category, but is also
247+
// the abbreviation for the 'Script' property.
248+
if norm != "cf" && norm != "sc" {
247249
if let Some(canon) = canonical_prop(&norm)? {
248250
return Ok(CanonicalClassQuery::Binary(canon));
249251
}

tests/unicode.rs

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ mat!(uni_class_gencat_format, r"\p{Format}", "\u{E007F}", Some((0, 4)));
7777
// See: https://github.com/rust-lang/regex/issues/719
7878
mat!(uni_class_gencat_format_abbrev1, r"\p{cf}", "\u{E007F}", Some((0, 4)));
7979
mat!(uni_class_gencat_format_abbrev2, r"\p{gc=cf}", "\u{E007F}", Some((0, 4)));
80+
mat!(uni_class_gencat_format_abbrev3, r"\p{Sc}", "$", Some((0, 1)));
8081
mat!(
8182
uni_class_gencat_initial_punctuation,
8283
r"\p{Initial_Punctuation}",

0 commit comments

Comments
 (0)