Skip to content

Commit

Permalink
Upgrade to Unicode 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wezm committed Oct 3, 2024
1 parent eee2ea4 commit 5bcf6ef
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 170 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
tables:
yeslogic-ucd-generate case-folding-simple --rust-match ../ucd-generate/ucd-15.0.0/ > src/case_folding_simple.rs
yeslogic-ucd-generate case-mapping ../ucd-generate/ucd-15.0.0/ > src/tables.rs
yeslogic-ucd-generate case-folding-simple --rust-match ../ucd-generate/ucd-16.0.0/ > src/case_folding_simple.rs
yeslogic-ucd-generate case-mapping ../ucd-generate/ucd-16.0.0/ > src/tables.rs
cargo fmt
sed -i.bak -E '/\(([0-9]+), &\[\1\]\)/d' src/tables.rs
rm src/tables.rs.bak


.PHONY: tables
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ unicode-case-mapping
<a href="https://crates.io/crates/unicode-case-mapping">
<img src="https://img.shields.io/crates/v/unicode-case-mapping.svg" alt="Version">
</a>
<img src="https://img.shields.io/badge/unicode-15.0-informational" alt="Unicode Version">
<img src="https://img.shields.io/badge/unicode-16.0-informational" alt="Unicode Version">
<a href="https://github.com/yeslogic/unicode-case-mapping/blob/master/LICENSE">
<img src="https://img.shields.io/crates/l/unicode-case-mapping.svg" alt="License">
</a>
Expand All @@ -19,7 +19,7 @@ unicode-case-mapping
<br>

Fast mapping of a `char` to lowercase, uppercase, titlecase, or its simple case folding
in Rust using Unicode 15.0 data.
in Rust using Unicode 16.0 data.

Usage
-----
Expand Down Expand Up @@ -79,10 +79,8 @@ some runs of repeated values in the first level array.
Regenerating `tables.rs`
------------------------

1. Regenerate with `yeslogic-ucd-generate` (see header of file).
2. Add `#[allow(dead_code)]` to each table to prevent warnings.
3. Delete entries that map to themselves. E.g. in Vim:
`:g/(\(\d\+\), &\[\1\])/d`.
1. Regenerate with `yeslogic-ucd-generate` (run `make`).
2. Add/restore `#[allow(dead_code)]` to each table to prevent warnings.

[ucd-generate]: https://github.com/yeslogic/ucd-generate
[to_uppercase]: https://doc.rust-lang.org/std/primitive.char.html#method.to_uppercase
Expand Down
36 changes: 33 additions & 3 deletions src/case_folding_simple.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
//
// yeslogic-ucd-generate case-folding-simple --rust-match ../ucd-generate/ucd-15.0.0/
// yeslogic-ucd-generate case-folding-simple --rust-match ../ucd-generate/ucd-16.0.0/
//
// Unicode version: 15.0.0.
// Unicode version: 16.0.0.
//
// yeslogic-ucd-generate 0.6.0 is available on crates.io.
// yeslogic-ucd-generate 0.7.0 is available on crates.io.

use std::num::NonZeroU32;

Expand Down Expand Up @@ -547,6 +547,7 @@ pub fn case_folding_simple(cp: u32) -> Option<NonZeroU32> {
7302 => Some(NonZeroU32::new_unchecked(1098)),
7303 => Some(NonZeroU32::new_unchecked(1123)),
7304 => Some(NonZeroU32::new_unchecked(42571)),
7305 => Some(NonZeroU32::new_unchecked(7306)),
7312 => Some(NonZeroU32::new_unchecked(4304)),
7313 => Some(NonZeroU32::new_unchecked(4305)),
7314 => Some(NonZeroU32::new_unchecked(4306)),
Expand Down Expand Up @@ -801,10 +802,12 @@ pub fn case_folding_simple(cp: u32) -> Option<NonZeroU32> {
8138 => Some(NonZeroU32::new_unchecked(8052)),
8139 => Some(NonZeroU32::new_unchecked(8053)),
8140 => Some(NonZeroU32::new_unchecked(8131)),
8147 => Some(NonZeroU32::new_unchecked(912)),
8152 => Some(NonZeroU32::new_unchecked(8144)),
8153 => Some(NonZeroU32::new_unchecked(8145)),
8154 => Some(NonZeroU32::new_unchecked(8054)),
8155 => Some(NonZeroU32::new_unchecked(8055)),
8163 => Some(NonZeroU32::new_unchecked(944)),
8168 => Some(NonZeroU32::new_unchecked(8160)),
8169 => Some(NonZeroU32::new_unchecked(8161)),
8170 => Some(NonZeroU32::new_unchecked(8058)),
Expand Down Expand Up @@ -1097,9 +1100,13 @@ pub fn case_folding_simple(cp: u32) -> Option<NonZeroU32> {
42950 => Some(NonZeroU32::new_unchecked(7566)),
42951 => Some(NonZeroU32::new_unchecked(42952)),
42953 => Some(NonZeroU32::new_unchecked(42954)),
42955 => Some(NonZeroU32::new_unchecked(612)),
42956 => Some(NonZeroU32::new_unchecked(42957)),
42960 => Some(NonZeroU32::new_unchecked(42961)),
42966 => Some(NonZeroU32::new_unchecked(42967)),
42968 => Some(NonZeroU32::new_unchecked(42969)),
42970 => Some(NonZeroU32::new_unchecked(42971)),
42972 => Some(NonZeroU32::new_unchecked(411)),
42997 => Some(NonZeroU32::new_unchecked(42998)),
43888 => Some(NonZeroU32::new_unchecked(5024)),
43889 => Some(NonZeroU32::new_unchecked(5025)),
Expand Down Expand Up @@ -1181,6 +1188,7 @@ pub fn case_folding_simple(cp: u32) -> Option<NonZeroU32> {
43965 => Some(NonZeroU32::new_unchecked(5101)),
43966 => Some(NonZeroU32::new_unchecked(5102)),
43967 => Some(NonZeroU32::new_unchecked(5103)),
64261 => Some(NonZeroU32::new_unchecked(64262)),
65313 => Some(NonZeroU32::new_unchecked(65345)),
65314 => Some(NonZeroU32::new_unchecked(65346)),
65315 => Some(NonZeroU32::new_unchecked(65347)),
Expand Down Expand Up @@ -1369,6 +1377,28 @@ pub fn case_folding_simple(cp: u32) -> Option<NonZeroU32> {
68784 => Some(NonZeroU32::new_unchecked(68848)),
68785 => Some(NonZeroU32::new_unchecked(68849)),
68786 => Some(NonZeroU32::new_unchecked(68850)),
68944 => Some(NonZeroU32::new_unchecked(68976)),
68945 => Some(NonZeroU32::new_unchecked(68977)),
68946 => Some(NonZeroU32::new_unchecked(68978)),
68947 => Some(NonZeroU32::new_unchecked(68979)),
68948 => Some(NonZeroU32::new_unchecked(68980)),
68949 => Some(NonZeroU32::new_unchecked(68981)),
68950 => Some(NonZeroU32::new_unchecked(68982)),
68951 => Some(NonZeroU32::new_unchecked(68983)),
68952 => Some(NonZeroU32::new_unchecked(68984)),
68953 => Some(NonZeroU32::new_unchecked(68985)),
68954 => Some(NonZeroU32::new_unchecked(68986)),
68955 => Some(NonZeroU32::new_unchecked(68987)),
68956 => Some(NonZeroU32::new_unchecked(68988)),
68957 => Some(NonZeroU32::new_unchecked(68989)),
68958 => Some(NonZeroU32::new_unchecked(68990)),
68959 => Some(NonZeroU32::new_unchecked(68991)),
68960 => Some(NonZeroU32::new_unchecked(68992)),
68961 => Some(NonZeroU32::new_unchecked(68993)),
68962 => Some(NonZeroU32::new_unchecked(68994)),
68963 => Some(NonZeroU32::new_unchecked(68995)),
68964 => Some(NonZeroU32::new_unchecked(68996)),
68965 => Some(NonZeroU32::new_unchecked(68997)),
71840 => Some(NonZeroU32::new_unchecked(71872)),
71841 => Some(NonZeroU32::new_unchecked(71873)),
71842 => Some(NonZeroU32::new_unchecked(71874)),
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! // U+0307 is COMBINING DOT ABOVE
//! assert_eq!(unicode_case_mapping::to_lowercase('İ'), ['i' as u32, 0x0307]);
//! assert_eq!(unicode_case_mapping::to_lowercase('ß'), ['ß' as u32, 0]);
//! assert_eq!(unicode_case_mapping::to_lowercase('ß'), [0; 2]);
//! assert_eq!(unicode_case_mapping::to_uppercase('ß'), ['S' as u32, 'S' as u32, 0]);
//! assert_eq!(unicode_case_mapping::to_titlecase('ß'), ['S' as u32, 's' as u32, 0]);
//! assert_eq!(unicode_case_mapping::to_titlecase('-'), [0; 3]);
Expand All @@ -23,4 +23,4 @@ pub use case_mapping::{case_folded, to_lowercase, to_titlecase, to_uppercase};

/// The version of [Unicode](http://www.unicode.org/)
/// that this version of unicode-case-mapping was generated from.
pub const UNICODE_VERSION: (u64, u64, u64) = (15, 0, 0);
pub const UNICODE_VERSION: (u64, u64, u64) = (16, 0, 0);
Loading

0 comments on commit 5bcf6ef

Please sign in to comment.