• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // This file is part of ICU4X. For terms of use, please see the file
2 // called LICENSE at the top level of the ICU4X source tree
3 // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4 
5 //! �� \[Experimental\] This module is experimental and currently crate-private. Let us know if you
6 //! have a use case for this!
7 //!
8 //! This module contains utilities for working with properties where the specific property in use
9 //! is not known at compile time.
10 //!
11 //! For regex engines, [`crate::sets::load_for_ecma262_unstable()`] is a convenient API for working
12 //! with properties at runtime tailored for the use case of ECMA262-compatible regex engines.
13 
14 use crate::provider::*;
15 use crate::CodePointSetData;
16 #[cfg(doc)]
17 use crate::{
18     props::{GeneralCategory, GeneralCategoryGroup, Script},
19     script, CodePointMapData, PropertyParser,
20 };
21 use icu_provider::prelude::*;
22 
23 /// This type can represent any binary Unicode property.
24 ///
25 /// This is intended to be used in situations where the exact unicode property needed is
26 /// only known at runtime, for example in regex engines.
27 ///
28 /// The values are intended to be identical to ICU4C's UProperty enum
29 #[non_exhaustive]
30 #[allow(missing_docs)]
31 #[allow(dead_code)]
32 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
33 enum BinaryProperty {
34     Alnum = 44,
35     Alphabetic = 0,
36     AsciiHexDigit = 1,
37     BidiControl = 2,
38     BidiMirrored = 3,
39     Blank = 45,
40     Cased = 49,
41     CaseIgnorable = 50,
42     CaseSensitive = 34,
43     ChangesWhenCasefolded = 54,
44     ChangesWhenCasemapped = 55,
45     ChangesWhenLowercased = 51,
46     ChangesWhenNfkcCasefolded = 56,
47     ChangesWhenTitlecased = 53,
48     ChangesWhenUppercased = 52,
49     Dash = 4,
50     DefaultIgnorableCodePoint = 5,
51     Deprecated = 6,
52     Diacritic = 7,
53     Emoji = 57,
54     EmojiComponent = 61,
55     EmojiModifier = 59,
56     EmojiModifierBase = 60,
57     EmojiPresentation = 58,
58     ExtendedPictographic = 64,
59     Extender = 8,
60     FullCompositionExclusion = 9,
61     Graph = 46,
62     GraphemeBase = 10,
63     GraphemeExtend = 11,
64     GraphemeLink = 12,
65     HexDigit = 13,
66     Hyphen = 14,
67     IdContinue = 15,
68     Ideographic = 17,
69     IdsBinaryOperator = 18,
70     IdStart = 16,
71     IdsTrinaryOperator = 19,
72     JoinControl = 20,
73     LogicalOrderException = 21,
74     Lowercase = 22,
75     Math = 23,
76     NfcInert = 39,
77     NfdInert = 37,
78     NfkcInert = 40,
79     NfkdInert = 38,
80     NoncharacterCodePoint = 24,
81     PatternSyntax = 42,
82     PatternWhiteSpace = 43,
83     PrependedConcatenationMark = 63,
84     Print = 47,
85     QuotationMark = 25,
86     Radical = 26,
87     RegionalIndicator = 62,
88     SegmentStarter = 41,
89     SentenceTerminal = 35,
90     SoftDotted = 27,
91     TerminalPunctuation = 28,
92     UnifiedIdeograph = 29,
93     Uppercase = 30,
94     VariationSelector = 36,
95     WhiteSpace = 31,
96     Xdigit = 48,
97     XidContinue = 32,
98     XidStart = 33,
99 }
100 
101 /// This type can represent any binary property over strings.
102 ///
103 /// This is intended to be used in situations where the exact unicode property needed is
104 /// only known at runtime, for example in regex engines.
105 ///
106 /// The values are intended to be identical to ICU4C's UProperty enum
107 #[non_exhaustive]
108 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
109 #[allow(dead_code)]
110 #[allow(missing_docs)]
111 enum StringBinaryProperty {
112     BasicEmoji = 65,
113     EmojiKeycapSequence = 66,
114     RgiEmoji = 71,
115     RgiEmojiFlagSequence = 68,
116     RgiEmojiModifierSequence = 67,
117     RgiEmojiTagSequence = 69,
118     RgiEmojiZWJSequence = 70,
119 }
120 
121 /// This type can represent any enumerated Unicode property.
122 ///
123 /// This is intended to be used in situations where the exact unicode property needed is
124 /// only known at runtime, for example in regex engines.
125 ///
126 /// The values are intended to be identical to ICU4C's UProperty enum
127 #[non_exhaustive]
128 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
129 #[allow(dead_code)]
130 #[allow(missing_docs)]
131 enum EnumeratedProperty {
132     BidiClass = 0x1000,
133     BidiPairedBracketType = 0x1015,
134     Block = 0x1001,
135     CombiningClass = 0x1002,
136     DecompositionType = 0x1003,
137     EastAsianWidth = 0x1004,
138     GeneralCategory = 0x1005,
139     GraphemeClusterBreak = 0x1012,
140     HangulSyllableType = 0x100B,
141     IndicPositionalCategory = 0x1016,
142     IndicSyllabicCategory = 0x1017,
143     JoiningGroup = 0x1006,
144     JoiningType = 0x1007,
145     LeadCanonicalCombiningClass = 0x1010,
146     LineBreak = 0x1008,
147     NFCQuickCheck = 0x100E,
148     NFDQuickCheck = 0x100C,
149     NFKCQuickCheck = 0x100F,
150     NFKDQuickCheck = 0x100D,
151     NumericType = 0x1009,
152     Script = 0x100A,
153     SentenceBreak = 0x1013,
154     TrailCanonicalCombiningClass = 0x1011,
155     VerticalOrientation = 0x1018,
156     WordBreak = 0x1014,
157 }
158 
159 /// This type can represent any Unicode mask property.
160 ///
161 /// This is intended to be used in situations where the exact unicode property needed is
162 /// only known at runtime, for example in regex engines.
163 ///
164 /// The values are intended to be identical to ICU4C's UProperty enum
165 #[non_exhaustive]
166 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
167 #[allow(dead_code)]
168 #[allow(missing_docs)]
169 enum MaskProperty {
170     GeneralCategoryMask = 0x2000,
171 }
172 
173 /// This type can represent any numeric Unicode property.
174 ///
175 /// This is intended to be used in situations where the exact unicode property needed is
176 /// only known at runtime, for example in regex engines.
177 ///
178 /// The values are intended to be identical to ICU4C's UProperty enum
179 #[non_exhaustive]
180 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
181 #[allow(dead_code)]
182 #[allow(missing_docs)]
183 enum NumericProperty {
184     NumericValue = 0x3000,
185 }
186 
187 /// This type can represent any Unicode string property.
188 ///
189 /// This is intended to be used in situations where the exact unicode property needed is
190 /// only known at runtime, for example in regex engines.
191 ///
192 /// The values are intended to be identical to ICU4C's UProperty enum
193 #[non_exhaustive]
194 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
195 #[allow(dead_code)]
196 #[allow(missing_docs)]
197 enum StringProperty {
198     Age = 0x4000,
199     BidiMirroringGlyph = 0x4001,
200     BidiPairedBracket = 0x400D,
201     CaseFolding = 0x4002,
202     ISOComment = 0x4003,
203     LowercaseMapping = 0x4004,
204     Name = 0x4005,
205     SimpleCaseFolding = 0x4006,
206     SimpleLowercaseMapping = 0x4007,
207     SimpleTitlecaseMapping = 0x4008,
208     SimpleUppercaseMapping = 0x4009,
209     TitlecaseMapping = 0x400A,
210     Unicode1Name = 0x400B,
211     UppercaseMapping = 0x400C,
212 }
213 
214 #[non_exhaustive]
215 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
216 #[allow(dead_code)]
217 #[allow(missing_docs)]
218 enum MiscProperty {
219     ScriptExtensions = 0x7000,
220 }
221 
222 impl CodePointSetData {
223     /// Returns a type capable of looking up values for a property specified as a string, as long as it is a
224     /// [binary property listed in ECMA-262][ecma], using strict matching on the names in the spec.
225     ///
226     /// This handles every property required by ECMA-262 `/u` regular expressions, except for:
227     ///
228     /// - `Script` and `General_Category`: handle these directly using property values parsed via
229     ///   [`PropertyParser<GeneralCategory>`] and [`PropertyParser<Script>`]
230     ///    if necessary.
231     /// - `Script_Extensions`: handle this directly using APIs from [`crate::script::ScriptWithExtensions`]
232     /// - `General_Category` mask values: Handle this alongside `General_Category` using [`GeneralCategoryGroup`],
233     ///    using property values parsed via [`PropertyParser<GeneralCategory>`] if necessary
234     /// - `Assigned`, `All`, and `ASCII` pseudoproperties: Handle these using their equivalent sets:
235     ///    - `Any` can be expressed as the range `[\u{0}-\u{10FFFF}]`
236     ///    - `Assigned` can be expressed as the inverse of the set `gc=Cn` (i.e., `\P{gc=Cn}`).
237     ///    - `ASCII` can be expressed as the range `[\u{0}-\u{7F}]`
238     /// - `General_Category` property values can themselves be treated like properties using a shorthand in ECMA262,
239     ///    simply create the corresponding `GeneralCategory` set.
240     ///
241     /// ✨ *Enabled with the `compiled_data` Cargo feature.*
242     ///
243     /// [�� Help choosing a constructor](icu_provider::constructors)
244     ///
245     /// ```
246     /// use icu::properties::CodePointSetData;
247     ///
248     /// let emoji = CodePointSetData::new_for_ecma262(b"Emoji")
249     ///     .expect("is an ECMA-262 property");
250     ///
251     /// assert!(emoji.contains('��')); // U+1F525 FIRE
252     /// assert!(!emoji.contains('V'));
253     /// ```
254     ///
255     /// [ecma]: https://tc39.es/ecma262/#table-binary-unicode-properties
256     #[cfg(feature = "compiled_data")]
new_for_ecma262(prop: &[u8]) -> Option<crate::CodePointSetDataBorrowed<'static>>257     pub fn new_for_ecma262(prop: &[u8]) -> Option<crate::CodePointSetDataBorrowed<'static>> {
258         use crate::props::*;
259         Some(match prop {
260             AsciiHexDigit::NAME | AsciiHexDigit::SHORT_NAME => Self::new::<AsciiHexDigit>(),
261             Alphabetic::NAME | Alphabetic::SHORT_NAME => Self::new::<Alphabetic>(),
262             BidiControl::NAME | BidiControl::SHORT_NAME => Self::new::<BidiControl>(),
263             BidiMirrored::NAME | BidiMirrored::SHORT_NAME => Self::new::<BidiMirrored>(),
264             CaseIgnorable::NAME | CaseIgnorable::SHORT_NAME => Self::new::<CaseIgnorable>(),
265             #[allow(unreachable_patterns)] // no short name
266             Cased::NAME | Cased::SHORT_NAME => Self::new::<Cased>(),
267             ChangesWhenCasefolded::NAME | ChangesWhenCasefolded::SHORT_NAME => {
268                 Self::new::<ChangesWhenCasefolded>()
269             }
270             ChangesWhenCasemapped::NAME | ChangesWhenCasemapped::SHORT_NAME => {
271                 Self::new::<ChangesWhenCasemapped>()
272             }
273             ChangesWhenLowercased::NAME | ChangesWhenLowercased::SHORT_NAME => {
274                 Self::new::<ChangesWhenLowercased>()
275             }
276             ChangesWhenNfkcCasefolded::NAME | ChangesWhenNfkcCasefolded::SHORT_NAME => {
277                 Self::new::<ChangesWhenNfkcCasefolded>()
278             }
279             ChangesWhenTitlecased::NAME | ChangesWhenTitlecased::SHORT_NAME => {
280                 Self::new::<ChangesWhenTitlecased>()
281             }
282             ChangesWhenUppercased::NAME | ChangesWhenUppercased::SHORT_NAME => {
283                 Self::new::<ChangesWhenUppercased>()
284             }
285             #[allow(unreachable_patterns)] // no short name
286             Dash::NAME | Dash::SHORT_NAME => Self::new::<Dash>(),
287             DefaultIgnorableCodePoint::NAME | DefaultIgnorableCodePoint::SHORT_NAME => {
288                 Self::new::<DefaultIgnorableCodePoint>()
289             }
290             Deprecated::NAME | Deprecated::SHORT_NAME => Self::new::<Deprecated>(),
291             Diacritic::NAME | Diacritic::SHORT_NAME => Self::new::<Diacritic>(),
292             #[allow(unreachable_patterns)] // no short name
293             Emoji::NAME | Emoji::SHORT_NAME => Self::new::<Emoji>(),
294             EmojiComponent::NAME | EmojiComponent::SHORT_NAME => Self::new::<EmojiComponent>(),
295             EmojiModifier::NAME | EmojiModifier::SHORT_NAME => Self::new::<EmojiModifier>(),
296             EmojiModifierBase::NAME | EmojiModifierBase::SHORT_NAME => {
297                 Self::new::<EmojiModifierBase>()
298             }
299             EmojiPresentation::NAME | EmojiPresentation::SHORT_NAME => {
300                 Self::new::<EmojiPresentation>()
301             }
302             ExtendedPictographic::NAME | ExtendedPictographic::SHORT_NAME => {
303                 Self::new::<ExtendedPictographic>()
304             }
305             Extender::NAME | Extender::SHORT_NAME => Self::new::<Extender>(),
306             GraphemeBase::NAME | GraphemeBase::SHORT_NAME => Self::new::<GraphemeBase>(),
307             GraphemeExtend::NAME | GraphemeExtend::SHORT_NAME => Self::new::<GraphemeExtend>(),
308             HexDigit::NAME | HexDigit::SHORT_NAME => Self::new::<HexDigit>(),
309             IdsBinaryOperator::NAME | IdsBinaryOperator::SHORT_NAME => {
310                 Self::new::<IdsBinaryOperator>()
311             }
312             IdsTrinaryOperator::NAME | IdsTrinaryOperator::SHORT_NAME => {
313                 Self::new::<IdsTrinaryOperator>()
314             }
315             IdContinue::NAME | IdContinue::SHORT_NAME => Self::new::<IdContinue>(),
316             IdStart::NAME | IdStart::SHORT_NAME => Self::new::<IdStart>(),
317             Ideographic::NAME | Ideographic::SHORT_NAME => Self::new::<Ideographic>(),
318             JoinControl::NAME | JoinControl::SHORT_NAME => Self::new::<JoinControl>(),
319             LogicalOrderException::NAME | LogicalOrderException::SHORT_NAME => {
320                 Self::new::<LogicalOrderException>()
321             }
322             Lowercase::NAME | Lowercase::SHORT_NAME => Self::new::<Lowercase>(),
323             #[allow(unreachable_patterns)] // no short name
324             Math::NAME | Math::SHORT_NAME => Self::new::<Math>(),
325             NoncharacterCodePoint::NAME | NoncharacterCodePoint::SHORT_NAME => {
326                 Self::new::<NoncharacterCodePoint>()
327             }
328             PatternSyntax::NAME | PatternSyntax::SHORT_NAME => Self::new::<PatternSyntax>(),
329             PatternWhiteSpace::NAME | PatternWhiteSpace::SHORT_NAME => {
330                 Self::new::<PatternWhiteSpace>()
331             }
332             QuotationMark::NAME | QuotationMark::SHORT_NAME => Self::new::<QuotationMark>(),
333             #[allow(unreachable_patterns)] // no short name
334             Radical::NAME | Radical::SHORT_NAME => Self::new::<Radical>(),
335             RegionalIndicator::NAME | RegionalIndicator::SHORT_NAME => {
336                 Self::new::<RegionalIndicator>()
337             }
338             SentenceTerminal::NAME | SentenceTerminal::SHORT_NAME => {
339                 Self::new::<SentenceTerminal>()
340             }
341             SoftDotted::NAME | SoftDotted::SHORT_NAME => Self::new::<SoftDotted>(),
342             TerminalPunctuation::NAME | TerminalPunctuation::SHORT_NAME => {
343                 Self::new::<TerminalPunctuation>()
344             }
345             UnifiedIdeograph::NAME | UnifiedIdeograph::SHORT_NAME => {
346                 Self::new::<UnifiedIdeograph>()
347             }
348             Uppercase::NAME | Uppercase::SHORT_NAME => Self::new::<Uppercase>(),
349             VariationSelector::NAME | VariationSelector::SHORT_NAME => {
350                 Self::new::<VariationSelector>()
351             }
352             WhiteSpace::NAME | WhiteSpace::SHORT_NAME => Self::new::<WhiteSpace>(),
353             XidContinue::NAME | XidContinue::SHORT_NAME => Self::new::<XidContinue>(),
354             XidStart::NAME | XidStart::SHORT_NAME => Self::new::<XidStart>(),
355             // Not an ECMA-262 property
356             _ => return None,
357         })
358     }
359 
360     icu_provider::gen_buffer_data_constructors!(
361         (prop: &[u8]) -> result: Option<Result<Self, DataError>>,
362         functions: [
363             new_for_ecma262: skip,
364             try_new_for_ecma262_with_buffer_provider,
365             try_new_for_ecma262_unstable,
366             Self,
367         ]
368     );
369 
370     #[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new_for_ecma262)]
try_new_for_ecma262_unstable<P>( provider: &P, prop: &[u8], ) -> Option<Result<Self, DataError>> where P: ?Sized + DataProvider<AsciiHexDigitV1> + DataProvider<AlphabeticV1> + DataProvider<BidiControlV1> + DataProvider<BidiMirroredV1> + DataProvider<CaseIgnorableV1> + DataProvider<CasedV1> + DataProvider<ChangesWhenCasefoldedV1> + DataProvider<ChangesWhenCasemappedV1> + DataProvider<ChangesWhenLowercasedV1> + DataProvider<ChangesWhenNfkcCasefoldedV1> + DataProvider<ChangesWhenTitlecasedV1> + DataProvider<ChangesWhenUppercasedV1> + DataProvider<DashV1> + DataProvider<DefaultIgnorableCodePointV1> + DataProvider<DeprecatedV1> + DataProvider<DiacriticV1> + DataProvider<EmojiV1> + DataProvider<EmojiComponentV1> + DataProvider<EmojiModifierV1> + DataProvider<EmojiModifierBaseV1> + DataProvider<EmojiPresentationV1> + DataProvider<ExtendedPictographicV1> + DataProvider<ExtenderV1> + DataProvider<GraphemeBaseV1> + DataProvider<GraphemeExtendV1> + DataProvider<HexDigitV1> + DataProvider<IdsBinaryOperatorV1> + DataProvider<IdsTrinaryOperatorV1> + DataProvider<IdContinueV1> + DataProvider<IdStartV1> + DataProvider<IdeographicV1> + DataProvider<JoinControlV1> + DataProvider<LogicalOrderExceptionV1> + DataProvider<LowercaseV1> + DataProvider<MathV1> + DataProvider<NoncharacterCodePointV1> + DataProvider<PatternSyntaxV1> + DataProvider<PatternWhiteSpaceV1> + DataProvider<QuotationMarkV1> + DataProvider<RadicalV1> + DataProvider<RegionalIndicatorV1> + DataProvider<SentenceTerminalV1> + DataProvider<SoftDottedV1> + DataProvider<TerminalPunctuationV1> + DataProvider<UnifiedIdeographV1> + DataProvider<UppercaseV1> + DataProvider<VariationSelectorV1> + DataProvider<WhiteSpaceV1> + DataProvider<XidContinueV1> + DataProvider<XidStartV1>,371     pub fn try_new_for_ecma262_unstable<P>(
372         provider: &P,
373         prop: &[u8],
374     ) -> Option<Result<Self, DataError>>
375     where
376         P: ?Sized
377             + DataProvider<AsciiHexDigitV1>
378             + DataProvider<AlphabeticV1>
379             + DataProvider<BidiControlV1>
380             + DataProvider<BidiMirroredV1>
381             + DataProvider<CaseIgnorableV1>
382             + DataProvider<CasedV1>
383             + DataProvider<ChangesWhenCasefoldedV1>
384             + DataProvider<ChangesWhenCasemappedV1>
385             + DataProvider<ChangesWhenLowercasedV1>
386             + DataProvider<ChangesWhenNfkcCasefoldedV1>
387             + DataProvider<ChangesWhenTitlecasedV1>
388             + DataProvider<ChangesWhenUppercasedV1>
389             + DataProvider<DashV1>
390             + DataProvider<DefaultIgnorableCodePointV1>
391             + DataProvider<DeprecatedV1>
392             + DataProvider<DiacriticV1>
393             + DataProvider<EmojiV1>
394             + DataProvider<EmojiComponentV1>
395             + DataProvider<EmojiModifierV1>
396             + DataProvider<EmojiModifierBaseV1>
397             + DataProvider<EmojiPresentationV1>
398             + DataProvider<ExtendedPictographicV1>
399             + DataProvider<ExtenderV1>
400             + DataProvider<GraphemeBaseV1>
401             + DataProvider<GraphemeExtendV1>
402             + DataProvider<HexDigitV1>
403             + DataProvider<IdsBinaryOperatorV1>
404             + DataProvider<IdsTrinaryOperatorV1>
405             + DataProvider<IdContinueV1>
406             + DataProvider<IdStartV1>
407             + DataProvider<IdeographicV1>
408             + DataProvider<JoinControlV1>
409             + DataProvider<LogicalOrderExceptionV1>
410             + DataProvider<LowercaseV1>
411             + DataProvider<MathV1>
412             + DataProvider<NoncharacterCodePointV1>
413             + DataProvider<PatternSyntaxV1>
414             + DataProvider<PatternWhiteSpaceV1>
415             + DataProvider<QuotationMarkV1>
416             + DataProvider<RadicalV1>
417             + DataProvider<RegionalIndicatorV1>
418             + DataProvider<SentenceTerminalV1>
419             + DataProvider<SoftDottedV1>
420             + DataProvider<TerminalPunctuationV1>
421             + DataProvider<UnifiedIdeographV1>
422             + DataProvider<UppercaseV1>
423             + DataProvider<VariationSelectorV1>
424             + DataProvider<WhiteSpaceV1>
425             + DataProvider<XidContinueV1>
426             + DataProvider<XidStartV1>,
427     {
428         use crate::props::*;
429         Some(match prop {
430             AsciiHexDigit::NAME | AsciiHexDigit::SHORT_NAME => {
431                 Self::try_new_unstable::<AsciiHexDigit>(provider)
432             }
433             Alphabetic::NAME | Alphabetic::SHORT_NAME => {
434                 Self::try_new_unstable::<Alphabetic>(provider)
435             }
436             BidiControl::NAME | BidiControl::SHORT_NAME => {
437                 Self::try_new_unstable::<BidiControl>(provider)
438             }
439             BidiMirrored::NAME | BidiMirrored::SHORT_NAME => {
440                 Self::try_new_unstable::<BidiMirrored>(provider)
441             }
442             CaseIgnorable::NAME | CaseIgnorable::SHORT_NAME => {
443                 Self::try_new_unstable::<CaseIgnorable>(provider)
444             }
445             #[allow(unreachable_patterns)] // no short name
446             Cased::NAME | Cased::SHORT_NAME => Self::try_new_unstable::<Cased>(provider),
447             ChangesWhenCasefolded::NAME | ChangesWhenCasefolded::SHORT_NAME => {
448                 Self::try_new_unstable::<ChangesWhenCasefolded>(provider)
449             }
450             ChangesWhenCasemapped::NAME | ChangesWhenCasemapped::SHORT_NAME => {
451                 Self::try_new_unstable::<ChangesWhenCasemapped>(provider)
452             }
453             ChangesWhenLowercased::NAME | ChangesWhenLowercased::SHORT_NAME => {
454                 Self::try_new_unstable::<ChangesWhenLowercased>(provider)
455             }
456             ChangesWhenNfkcCasefolded::NAME | ChangesWhenNfkcCasefolded::SHORT_NAME => {
457                 Self::try_new_unstable::<ChangesWhenNfkcCasefolded>(provider)
458             }
459             ChangesWhenTitlecased::NAME | ChangesWhenTitlecased::SHORT_NAME => {
460                 Self::try_new_unstable::<ChangesWhenTitlecased>(provider)
461             }
462             ChangesWhenUppercased::NAME | ChangesWhenUppercased::SHORT_NAME => {
463                 Self::try_new_unstable::<ChangesWhenUppercased>(provider)
464             }
465             #[allow(unreachable_patterns)] // no short name
466             Dash::NAME | Dash::SHORT_NAME => Self::try_new_unstable::<Dash>(provider),
467             DefaultIgnorableCodePoint::NAME | DefaultIgnorableCodePoint::SHORT_NAME => {
468                 Self::try_new_unstable::<DefaultIgnorableCodePoint>(provider)
469             }
470             Deprecated::NAME | Deprecated::SHORT_NAME => {
471                 Self::try_new_unstable::<Deprecated>(provider)
472             }
473             Diacritic::NAME | Diacritic::SHORT_NAME => {
474                 Self::try_new_unstable::<Diacritic>(provider)
475             }
476             #[allow(unreachable_patterns)] // no short name
477             Emoji::NAME | Emoji::SHORT_NAME => Self::try_new_unstable::<Emoji>(provider),
478             EmojiComponent::NAME | EmojiComponent::SHORT_NAME => {
479                 Self::try_new_unstable::<EmojiComponent>(provider)
480             }
481             EmojiModifier::NAME | EmojiModifier::SHORT_NAME => {
482                 Self::try_new_unstable::<EmojiModifier>(provider)
483             }
484             EmojiModifierBase::NAME | EmojiModifierBase::SHORT_NAME => {
485                 Self::try_new_unstable::<EmojiModifierBase>(provider)
486             }
487             EmojiPresentation::NAME | EmojiPresentation::SHORT_NAME => {
488                 Self::try_new_unstable::<EmojiPresentation>(provider)
489             }
490             ExtendedPictographic::NAME | ExtendedPictographic::SHORT_NAME => {
491                 Self::try_new_unstable::<ExtendedPictographic>(provider)
492             }
493             Extender::NAME | Extender::SHORT_NAME => Self::try_new_unstable::<Extender>(provider),
494             GraphemeBase::NAME | GraphemeBase::SHORT_NAME => {
495                 Self::try_new_unstable::<GraphemeBase>(provider)
496             }
497             GraphemeExtend::NAME | GraphemeExtend::SHORT_NAME => {
498                 Self::try_new_unstable::<GraphemeExtend>(provider)
499             }
500             HexDigit::NAME | HexDigit::SHORT_NAME => Self::try_new_unstable::<HexDigit>(provider),
501             IdsBinaryOperator::NAME | IdsBinaryOperator::SHORT_NAME => {
502                 Self::try_new_unstable::<IdsBinaryOperator>(provider)
503             }
504             IdsTrinaryOperator::NAME | IdsTrinaryOperator::SHORT_NAME => {
505                 Self::try_new_unstable::<IdsTrinaryOperator>(provider)
506             }
507             IdContinue::NAME | IdContinue::SHORT_NAME => {
508                 Self::try_new_unstable::<IdContinue>(provider)
509             }
510             IdStart::NAME | IdStart::SHORT_NAME => Self::try_new_unstable::<IdStart>(provider),
511             Ideographic::NAME | Ideographic::SHORT_NAME => {
512                 Self::try_new_unstable::<Ideographic>(provider)
513             }
514             JoinControl::NAME | JoinControl::SHORT_NAME => {
515                 Self::try_new_unstable::<JoinControl>(provider)
516             }
517             LogicalOrderException::NAME | LogicalOrderException::SHORT_NAME => {
518                 Self::try_new_unstable::<LogicalOrderException>(provider)
519             }
520             Lowercase::NAME | Lowercase::SHORT_NAME => {
521                 Self::try_new_unstable::<Lowercase>(provider)
522             }
523             #[allow(unreachable_patterns)] // no short name
524             Math::NAME | Math::SHORT_NAME => Self::try_new_unstable::<Math>(provider),
525             NoncharacterCodePoint::NAME | NoncharacterCodePoint::SHORT_NAME => {
526                 Self::try_new_unstable::<NoncharacterCodePoint>(provider)
527             }
528             PatternSyntax::NAME | PatternSyntax::SHORT_NAME => {
529                 Self::try_new_unstable::<PatternSyntax>(provider)
530             }
531             PatternWhiteSpace::NAME | PatternWhiteSpace::SHORT_NAME => {
532                 Self::try_new_unstable::<PatternWhiteSpace>(provider)
533             }
534             QuotationMark::NAME | QuotationMark::SHORT_NAME => {
535                 Self::try_new_unstable::<QuotationMark>(provider)
536             }
537             #[allow(unreachable_patterns)] // no short name
538             Radical::NAME | Radical::SHORT_NAME => Self::try_new_unstable::<Radical>(provider),
539             RegionalIndicator::NAME | RegionalIndicator::SHORT_NAME => {
540                 Self::try_new_unstable::<RegionalIndicator>(provider)
541             }
542             SentenceTerminal::NAME | SentenceTerminal::SHORT_NAME => {
543                 Self::try_new_unstable::<SentenceTerminal>(provider)
544             }
545             SoftDotted::NAME | SoftDotted::SHORT_NAME => {
546                 Self::try_new_unstable::<SoftDotted>(provider)
547             }
548             TerminalPunctuation::NAME | TerminalPunctuation::SHORT_NAME => {
549                 Self::try_new_unstable::<TerminalPunctuation>(provider)
550             }
551             UnifiedIdeograph::NAME | UnifiedIdeograph::SHORT_NAME => {
552                 Self::try_new_unstable::<UnifiedIdeograph>(provider)
553             }
554             Uppercase::NAME | Uppercase::SHORT_NAME => {
555                 Self::try_new_unstable::<Uppercase>(provider)
556             }
557             VariationSelector::NAME | VariationSelector::SHORT_NAME => {
558                 Self::try_new_unstable::<VariationSelector>(provider)
559             }
560             WhiteSpace::NAME | WhiteSpace::SHORT_NAME => {
561                 Self::try_new_unstable::<WhiteSpace>(provider)
562             }
563             XidContinue::NAME | XidContinue::SHORT_NAME => {
564                 Self::try_new_unstable::<XidContinue>(provider)
565             }
566             XidStart::NAME | XidStart::SHORT_NAME => Self::try_new_unstable::<XidStart>(provider),
567             // Not an ECMA-262 property
568             _ => return None,
569         })
570     }
571 }
572