Skip to content

Commit

Permalink
chore: use unicode-id-start instead of unic-ucd-ident
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacasonato committed Feb 19, 2025
1 parent e65cfc9 commit 4c62751
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ derive_more = "0.99.16"
url = "2.2.2"
regex = "1.4.3"
serde = { version = "1.0.127", features = ["derive"] }
unic-ucd-ident = { version = "0.9.0", features = ["id"] }
unicode-id-start = "1"

[dev-dependencies]
serde_json = "1.0.66"
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,4 +833,17 @@ mod tests {
})
.unwrap();
}

#[test]
fn issue54() {
let pattern = <UrlPattern>::parse(UrlPatternInit {
pathname: Some("/:thereisa\u{30FB}middledot.".to_owned()),
..Default::default()
})
.unwrap();
assert_eq!(
pattern.pathname.group_name_list,
vec!["thereisa\u{30FB}middledot"]
);
}
}
4 changes: 2 additions & 2 deletions src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ pub fn tokenize(
#[inline]
pub(crate) fn is_valid_name_codepoint(code_point: char, first: bool) -> bool {
if first {
unic_ucd_ident::is_id_start(code_point) || matches!(code_point, '$' | '_')
unicode_id_start::is_id_start(code_point) || matches!(code_point, '$' | '_')
} else {
unic_ucd_ident::is_id_continue(code_point)
unicode_id_start::is_id_continue(code_point)
|| matches!(code_point, '$' | '\u{200C}' | '\u{200D}')
}
}

0 comments on commit 4c62751

Please sign in to comment.