Skip to content

Additional character property parsing #440

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

Merged
merged 2 commits into from
May 27, 2022

Conversation

hamishknight
Copy link
Contributor

Formalize the parsing of Unicode block properties (previously they were the remaining Oniguruma special properties), including allowing the shorthand spelling e.g \p{inBasicLatin}, which is supported by Perl and Oniguruma (though Perl discourages it).

Additionally, start parsing the Java character properties.

Previously we only supported a subset of the
Oniguruma spellings for these. Introduce them as
an actual Unicode property with the key `blk` or
`block`.

Additionally, allow a non-Unicode shorthand syntax
that uses the prefix `in`. This is supported by
Oniguruma and Perl (though Perl discourages its
usage). We may want to warn/error on it and suggest
users switch to the more explicit form.
These correspond to various `is`-prefixed
accessors on `java.lang.Character`. For now, parse
them, but mark them unsupported.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@natecook1000 natecook1000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we can implement the java special property support, but we'll need the block Unicode data to implement those (cc @Azoy).

parseTest(#"\p{inherited}"#, prop(.scriptExtension(.inherited)))

// Make sure these are round-trippable.
for s in Unicode.Script.allCases {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great 👍🏻

@hamishknight hamishknight merged commit 4d04019 into swiftlang:main May 27, 2022
@hamishknight hamishknight deleted the chunk-loader branch May 27, 2022 10:14
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.

2 participants