Skip to content

Commit 0598851

Browse files
committed
chore: use unicode-id-start instead of unic-ucd-ident
1 parent 2ba16e7 commit 0598851

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ license = "MIT"
1111
url = "2.4.1"
1212
regex = "1.10.5"
1313
serde = { version = "1.0.127", features = ["derive"] }
14-
unic-ucd-ident = { version = "0.9.0", features = ["id"] }
14+
unicode-id-start = "1"
1515

1616
[dev-dependencies]
1717
serde_json = "1.0.66"

src/lib.rs

+16
Original file line numberDiff line numberDiff line change
@@ -1047,4 +1047,20 @@ mod tests {
10471047
.unwrap();
10481048
assert!(pattern.has_regexp_groups());
10491049
}
1050+
1051+
#[test]
1052+
fn issue54() {
1053+
let pattern = <UrlPattern>::parse(
1054+
UrlPatternInit {
1055+
pathname: Some("/:thereisa\u{30FB}middledot.".to_owned()),
1056+
..Default::default()
1057+
},
1058+
Default::default(),
1059+
)
1060+
.unwrap();
1061+
assert_eq!(
1062+
pattern.pathname.group_name_list,
1063+
vec!["thereisa\u{30FB}middledot"]
1064+
);
1065+
}
10501066
}

src/tokenizer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,9 @@ pub fn tokenize(
319319
#[inline]
320320
pub(crate) fn is_valid_name_codepoint(code_point: char, first: bool) -> bool {
321321
if first {
322-
unic_ucd_ident::is_id_start(code_point) || matches!(code_point, '$' | '_')
322+
unicode_id_start::is_id_start(code_point) || matches!(code_point, '$' | '_')
323323
} else {
324-
unic_ucd_ident::is_id_continue(code_point)
324+
unicode_id_start::is_id_continue(code_point)
325325
|| matches!(code_point, '$' | '\u{200C}' | '\u{200D}')
326326
}
327327
}

0 commit comments

Comments
 (0)