Skip to content

Commit 4c62751

Browse files
committed
chore: use unicode-id-start instead of unic-ucd-ident
1 parent e65cfc9 commit 4c62751

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ derive_more = "0.99.16"
1212
url = "2.2.2"
1313
regex = "1.4.3"
1414
serde = { version = "1.0.127", features = ["derive"] }
15-
unic-ucd-ident = { version = "0.9.0", features = ["id"] }
15+
unicode-id-start = "1"
1616

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

src/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -833,4 +833,17 @@ mod tests {
833833
})
834834
.unwrap();
835835
}
836+
837+
#[test]
838+
fn issue54() {
839+
let pattern = <UrlPattern>::parse(UrlPatternInit {
840+
pathname: Some("/:thereisa\u{30FB}middledot.".to_owned()),
841+
..Default::default()
842+
})
843+
.unwrap();
844+
assert_eq!(
845+
pattern.pathname.group_name_list,
846+
vec!["thereisa\u{30FB}middledot"]
847+
);
848+
}
836849
}

src/tokenizer.rs

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

0 commit comments

Comments
 (0)