Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new option to generate a Rust enum for script #15

Closed
wants to merge 2 commits into from

Conversation

wezm
Copy link
Contributor

@wezm wezm commented Dec 4, 2019

This is an extension of #14, which I've closed in favour of this PR. It adds an option to allow generating a Rust enum for script. This is designed to match servo/unicode-script pretty closely so that it can be updated to use ucd-generate. (I've done that work on the ucd-generate-unicode-12 branch of my fork).

Sample output from the --rust-enum option:

// DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
//
//  ucd-generate script --rust-enum /home/wmoore/Downloads/ucd-12.1
//
// ucd-generate is available on crates.io.

#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)]
pub enum Script {
  Unknown, Adlam, Ahom, AnatolianHieroglyphs, Arabic, Armenian, Avestan,
  Balinese, Bamum, BassaVah, Batak, Bengali, Bhaiksuki, Bopomofo, Brahmi,
  Braille, Buginese, Buhid, CanadianAboriginal, Carian, CaucasianAlbanian,}

pub const SCRIPT: &'static [(u32, u32, Script)] = &[
  (0, 64, Script::Common), (65, 90, Script::Latin), (91, 96, Script::Common),
  (97, 122, Script::Latin), (123, 169, Script::Common),
  (170, 170, Script::Latin), (171, 185, Script::Common),
  (186, 186, Script::Latin), (187, 191, Script::Common),
  (192, 214, Script::Latin), (215, 215, Script::Common),
  (216, 246, Script::Latin), (247, 247, Script::Common),
  (248, 696, Script::Latin), (697, 735, Script::Common),
  (736, 740, Script::Latin), (741, 745, Script::Common),
  (746, 747, Script::Bopomofo), (748, 767, Script::Common),];

@wezm
Copy link
Contributor Author

wezm commented Jan 7, 2020

Hi @BurntSushi just wanted to touch base on this PR and let you know of some other activities I've been up to in the Unicode Rust space described here: unicode-org/rust-discuss#11

I'd like to raise the PRs against unicode-bidi and unicode-script with a published version of ucd-generate. If there's anything I can do to help with PR review, please let me know. I do understand you are maintaining this in your own time and are under no obligation to respond. Alternatively, if you'd prefer, we (YesLogic) can publish our own version of ucd-generate (yeslogic-ucd-generate perhaps) with the necessary changes and move forward with that.

@wezm wezm force-pushed the script-rust-enum branch from cade1de to 19f6489 Compare January 9, 2020 03:12
@Manishearth
Copy link

@BurntSushi perhaps we can transfer ownership of this repo to unicode-rs or some other commons, and grant maintainership to the various folks writing unicode crates?

@BurntSushi
Copy link
Owner

BurntSushi commented Jan 9, 2020

@Manishearth Honestly, I'd rather maintain creative control for the time being. I'm not opposed to doing that in the future, but there is at least one pending migration that I want to see ucd-generate through (#11). I've been away for a bit, but hadn't noticed anything urgent filed against this repo. I'll take a look through the PRs now. Another migration I want to see through is the use of a templating library, as the output generation code has become a bit monstrous.

@Manishearth
Copy link

Manishearth commented Jan 9, 2020 via email

@BurntSushi BurntSushi closed this in 31fd9c5 Jan 9, 2020
@BurntSushi
Copy link
Owner

BurntSushi commented Jan 9, 2020

@wezm Thanks! Sorry about the tardy response. I merged this PR after tidying up a few stylistic nits. (Mostly line lengths.) I'll switch over to rustfmt and put out a new release once I clear the rest of the PR queue.

@BurntSushi
Copy link
Owner

This PR is in ucd-generate 0.2.4 on crates.io.

@wezm
Copy link
Contributor Author

wezm commented Jan 9, 2020

Thanks @BurntSushi I have a number of follow up PRs that build upon this one. Happy for me to raise them?

@BurntSushi
Copy link
Owner

Yeah definitely, bring it on!

@wezm wezm deleted the script-rust-enum branch November 13, 2020 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants