rust: Switch from `finl_unicode` to `unicode-properties` crate.
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 18 Jul 2025 00:14:08 +0000 (17:14 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 18 Jul 2025 00:14:14 +0000 (17:14 -0700)
I like its design better.

rust/pspp/Cargo.toml
rust/pspp/src/identifier.rs

index 73a2188660e13e1a99f66f05ac3b7c5ca335c911..3ad04a1296bfbabec78df53883b70b5d5c9d547e 100644 (file)
@@ -16,7 +16,6 @@ num = "0.4.0"
 ordered-float = "3.7.0"
 thiserror = "1.0"
 chrono = "0.4.40"
-finl_unicode = "1.2.0"
 unicase = "2.6.0"
 libc = "0.2.147"
 indexmap = "2.1.0"
@@ -49,6 +48,7 @@ cmac = "0.7.2"
 aes = "0.8.4"
 readpass = "1.0.3"
 zeroize = "1.8.1"
+unicode-properties = "0.1.3"
 
 [target.'cfg(windows)'.dependencies]
 windows-sys = { version = "0.48.0", features = ["Win32_Globalization"] }
index cc9b1f213efbb7965f9139ec2fcad450d9960ad4..823ba6e9718d0696eb40d91779e262f0f3808b91 100644 (file)
@@ -23,9 +23,9 @@ use std::{
 };
 
 use encoding_rs::{EncoderResult, Encoding, UTF_8};
-use finl_unicode::categories::{CharacterCategories, MajorCategory};
 use thiserror::Error as ThisError;
 use unicase::UniCase;
+use unicode_properties::UnicodeGeneralCategory;
 
 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
 pub enum Class {
@@ -88,9 +88,10 @@ impl IdentifierChar for char {
         if self < '\u{0080}' {
             self.ascii_may_start_id()
         } else {
-            use MajorCategory::*;
+            use unicode_properties::GeneralCategoryGroup::*;
 
-            [L, M, S].contains(&self.get_major_category()) && self != char::REPLACEMENT_CHARACTER
+            matches!(self.general_category_group(), Letter | Mark | Symbol)
+                && self != char::REPLACEMENT_CHARACTER
         }
     }
 
@@ -102,9 +103,12 @@ impl IdentifierChar for char {
         if self < '\u{0080}' {
             self.ascii_may_continue_id()
         } else {
-            use MajorCategory::*;
+            use unicode_properties::GeneralCategoryGroup::*;
 
-            [L, M, S, N].contains(&self.get_major_category()) && self != char::REPLACEMENT_CHARACTER
+            matches!(
+                self.general_category_group(),
+                Letter | Mark | Symbol | Number
+            ) && self != char::REPLACEMENT_CHARACTER
         }
     }
 }