Skip to content

Commit

Permalink
Add alias search fallback to character() (#12)
Browse files Browse the repository at this point in the history
* Add NameAliases.txt from 14.0.0

https://www.unicode.org/Public/14.0.0/ucd/NameAliases.txt

* NameAliases database

* Add alias search fallback for character()

Co-Authored-By: Dimitris Fasarakis Hilliard <d.f.hilliard@gmail.com>

* Remove generated code from src/ directory

---------

Co-authored-by: The Unicode Consortium <>
Co-authored-by: Dimitris Fasarakis Hilliard <d.f.hilliard@gmail.com>
Co-authored-by: Valentin Lorentz <progval+git@progval.net>
  • Loading branch information
3 people authored Sep 24, 2023
1 parent ccbf6cb commit 40b85a7
Show file tree
Hide file tree
Showing 7 changed files with 770 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ no_std = []
path = "unicode_names2_macros"
version = ">=0.3, <2.0"

[dependencies]
phf = { version = "0.11.1", default-features = false }

[dev-dependencies]
rand = "0.8.5"
rand_xorshift = "0.3.0"
Expand Down
13 changes: 12 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ use std::{env, path::PathBuf};
use unicode_names2_generator as generator;

const UNICODE_DATA: &str = include_str!("data/UnicodeData.txt");
/// Unicode aliases
///
/// [NamesList.txt] contents contains a map of unicode aliases to their corresponding values.
///
/// [NamesList.txt]: https://www.unicode.org/Public/14.0.0/ucd/NameAliases.txt
const NAME_ALIASES: &str = include_str!("data/NameAliases.txt");

fn main() {
println!("cargo:rerun-if-changed=build.rs");
Expand All @@ -14,8 +20,13 @@ fn main() {
generator::generate(UNICODE_DATA, Some(&generated_path), None);
}
{
let mut generated_phf_path = out_dir;
let mut generated_phf_path = out_dir.clone();
generated_phf_path.push("generated_phf.rs");
generator::generate_phf(UNICODE_DATA, Some(&generated_phf_path), None, 3, 2);
}
{
let mut generated_alias_path = out_dir;
generated_alias_path.push("generated_alias.rs");
generator::generate_aliases(NAME_ALIASES, &generated_alias_path);
}
}
Loading

0 comments on commit 40b85a7

Please sign in to comment.