Skip to content

Add Unicode Blocks access and iteration #4803

Open
@sffc

Description

@sffc

We should consider adding Unicode Blocks to the icu_properties crate. It should probably include:

  1. Ability to loop over all blocks
  2. Ability to access the code points in a block
  3. Ability to look up a block by name

Concretely I think the most practical way to implement this would be to make an open enum for the block and then basically treat the block like an enumerated property, including code point access and display name parsing. I think it should pack pretty small in an InversionMap since the code point space is already segmented into fairly large contiguous blocks.

I imagine that the most difficult part of the implementation would be the sourcing of the data in datagen.

This would be a good first issue of medium scope.

Discussed in #4798

Originally posted by faassen April 11, 2024
I dug around the source code, but I couldn't find a representation in Rust code of the Blocks.txt data. There's the unicode_blocks crate, but this misses an important feature; I need to be able to iterate through all blocks. I need to be able to look them up by name, but not the name as given as this has space characters. So iteration seems required so I can do some pre-processing. This is to implement regular expressions as defined by appendix F in the XML Schema specification:

Being able to get a CodePointInvList for a block would also be nice.

https://www.w3.org/TR/xmlschema-2/#regexs

Did I miss something? Is this planned?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-unicodeComponent: Props, sets, triesS-mediumSize: Less than a week (larger bug fix or enhancement)good first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions