Skip to content

Commit

Permalink
macros: Bump regex & syn dependencies to latest version (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
jelmer authored Aug 13, 2023
1 parent 84f8c8b commit a8892be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions unicode_names2_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ description = "Support macros for `unicode_names2`."
unstable = []

[dependencies]
regex = "0.1.80"
syn = "0.15"
regex = "1.0"
syn = "2.0"

[dependencies.unicode_names2]
path = ".."
Expand Down
7 changes: 4 additions & 3 deletions unicode_names2_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ impl syn::parse::Parse for StringWithCharNames {
let names_re = regex::Regex::new(r"\\N\{(.*?)(?:\}|$)").unwrap();

let mut errors = Vec::new();
let new = names_re.replace_all(&string.value(), |c: &regex::Captures| {
let full = c.at(0).unwrap();
let string_value = string.value();
let new = names_re.replace_all(string_value.as_str(), |c: &regex::Captures| {
let full = c.get(0).unwrap().as_str();
if !full.ends_with('}') {
errors.push(format!("unclosed escape in `named!`: {}", full));
} else {
let name = c.at(1).unwrap();
let name = c.get(1).unwrap().as_str();
match unicode_names2::character(name) {
Some(c) => return c.to_string(),
None => {
Expand Down

0 comments on commit a8892be

Please sign in to comment.