Skip to content

Commit

Permalink
Syntax: Make \p{Sc} work
Browse files Browse the repository at this point in the history
'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
  • Loading branch information
snsmac committed Aug 1, 2022
1 parent 159a63c commit d175482
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion regex-syntax/src/unicode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ impl<'a> ClassQuery<'a> {
// a general category. (Currently, we don't even support the
// 'Case_Folding' property. But if we do in the future, users will be
// required to spell it out.)
if norm != "cf" {
// 'sc' refers to the 'Currency_Symbol' general category, but is also
// the abbreviation for the 'Script' property.
if norm != "cf" && norm != "sc" {
if let Some(canon) = canonical_prop(&norm)? {
return Ok(CanonicalClassQuery::Binary(canon));
}
Expand Down
1 change: 1 addition & 0 deletions tests/unicode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ mat!(uni_class_gencat_format, r"\p{Format}", "\u{E007F}", Some((0, 4)));
// See: https://github.com/rust-lang/regex/issues/719
mat!(uni_class_gencat_format_abbrev1, r"\p{cf}", "\u{E007F}", Some((0, 4)));
mat!(uni_class_gencat_format_abbrev2, r"\p{gc=cf}", "\u{E007F}", Some((0, 4)));
mat!(uni_class_gencat_format_abbrev3, r"\p{Sc}", "$", Some((0, 1)));
mat!(
uni_class_gencat_initial_punctuation,
r"\p{Initial_Punctuation}",
Expand Down

0 comments on commit d175482

Please sign in to comment.