icu_properties/
runtime.rs

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
14use crate::provider::*;
15use crate::CodePointSetData;
16#[cfg(doc)]
17use crate::{
18    props::{GeneralCategory, GeneralCategoryGroup, Script},
19    script, CodePointMapData, PropertyParser,
20};
21use 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)]
33enum 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)]
111enum 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)]
131enum 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    IndicConjunctBreak = 0x101A,
142    IndicPositionalCategory = 0x1016,
143    IndicSyllabicCategory = 0x1017,
144    JoiningGroup = 0x1006,
145    JoiningType = 0x1007,
146    LeadCanonicalCombiningClass = 0x1010,
147    LineBreak = 0x1008,
148    NFCQuickCheck = 0x100E,
149    NFDQuickCheck = 0x100C,
150    NFKCQuickCheck = 0x100F,
151    NFKDQuickCheck = 0x100D,
152    NumericType = 0x1009,
153    Script = 0x100A,
154    SentenceBreak = 0x1013,
155    TrailCanonicalCombiningClass = 0x1011,
156    VerticalOrientation = 0x1018,
157    WordBreak = 0x1014,
158}
159
160/// This type can represent any Unicode mask property.
161///
162/// This is intended to be used in situations where the exact unicode property needed is
163/// only known at runtime, for example in regex engines.
164///
165/// The values are intended to be identical to ICU4C's UProperty enum
166#[non_exhaustive]
167#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
168#[allow(dead_code)]
169#[allow(missing_docs)]
170enum MaskProperty {
171    GeneralCategoryMask = 0x2000,
172}
173
174/// This type can represent any numeric Unicode property.
175///
176/// This is intended to be used in situations where the exact unicode property needed is
177/// only known at runtime, for example in regex engines.
178///
179/// The values are intended to be identical to ICU4C's UProperty enum
180#[non_exhaustive]
181#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
182#[allow(dead_code)]
183#[allow(missing_docs)]
184enum NumericProperty {
185    NumericValue = 0x3000,
186}
187
188/// This type can represent any Unicode string property.
189///
190/// This is intended to be used in situations where the exact unicode property needed is
191/// only known at runtime, for example in regex engines.
192///
193/// The values are intended to be identical to ICU4C's UProperty enum
194#[non_exhaustive]
195#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
196#[allow(dead_code)]
197#[allow(missing_docs)]
198enum StringProperty {
199    Age = 0x4000,
200    BidiMirroringGlyph = 0x4001,
201    BidiPairedBracket = 0x400D,
202    CaseFolding = 0x4002,
203    ISOComment = 0x4003,
204    LowercaseMapping = 0x4004,
205    Name = 0x4005,
206    SimpleCaseFolding = 0x4006,
207    SimpleLowercaseMapping = 0x4007,
208    SimpleTitlecaseMapping = 0x4008,
209    SimpleUppercaseMapping = 0x4009,
210    TitlecaseMapping = 0x400A,
211    Unicode1Name = 0x400B,
212    UppercaseMapping = 0x400C,
213}
214
215#[non_exhaustive]
216#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
217#[allow(dead_code)]
218#[allow(missing_docs)]
219enum MiscProperty {
220    ScriptExtensions = 0x7000,
221}
222
223impl CodePointSetData {
224    /// Returns a type capable of looking up values for a property specified as a string, as long as it is a
225    /// [binary property listed in ECMA-262][ecma], using strict matching on the names in the spec.
226    ///
227    /// This handles every property required by ECMA-262 `/u` regular expressions, except for:
228    ///
229    /// - `Script` and `General_Category`: handle these directly using property values parsed via
230    ///   [`PropertyParser<GeneralCategory>`] and [`PropertyParser<Script>`]
231    ///   if necessary.
232    /// - `Script_Extensions`: handle this directly using APIs from [`crate::script::ScriptWithExtensions`]
233    /// - `General_Category` mask values: Handle this alongside `General_Category` using [`GeneralCategoryGroup`],
234    ///   using property values parsed via [`PropertyParser<GeneralCategory>`] if necessary
235    /// - `Assigned`, `All`, and `ASCII` pseudoproperties: Handle these using their equivalent sets:
236    ///    - `Any` can be expressed as the range `[\u{0}-\u{10FFFF}]`
237    ///    - `Assigned` can be expressed as the inverse of the set `gc=Cn` (i.e., `\P{gc=Cn}`).
238    ///    - `ASCII` can be expressed as the range `[\u{0}-\u{7F}]`
239    /// - `General_Category` property values can themselves be treated like properties using a shorthand in ECMA262,
240    ///   simply create the corresponding `GeneralCategory` set.
241    ///
242    /// ✨ *Enabled with the `compiled_data` Cargo feature.*
243    ///
244    /// [📚 Help choosing a constructor](icu_provider::constructors)
245    ///
246    /// ```
247    /// use icu::properties::CodePointSetData;
248    ///
249    /// let emoji = CodePointSetData::new_for_ecma262(b"Emoji")
250    ///     .expect("is an ECMA-262 property");
251    ///
252    /// assert!(emoji.contains('🔥')); // U+1F525 FIRE
253    /// assert!(!emoji.contains('V'));
254    /// ```
255    ///
256    /// [ecma]: https://tc39.es/ecma262/#table-binary-unicode-properties
257    #[cfg(feature = "compiled_data")]
258    pub fn new_for_ecma262(prop: &[u8]) -> Option<crate::CodePointSetDataBorrowed<'static>> {
259        use crate::props::*;
260        Some(match prop {
261            AsciiHexDigit::NAME | AsciiHexDigit::SHORT_NAME => Self::new::<AsciiHexDigit>(),
262            Alphabetic::NAME | Alphabetic::SHORT_NAME => Self::new::<Alphabetic>(),
263            BidiControl::NAME | BidiControl::SHORT_NAME => Self::new::<BidiControl>(),
264            BidiMirrored::NAME | BidiMirrored::SHORT_NAME => Self::new::<BidiMirrored>(),
265            CaseIgnorable::NAME | CaseIgnorable::SHORT_NAME => Self::new::<CaseIgnorable>(),
266            #[allow(unreachable_patterns)] // no short name
267            Cased::NAME | Cased::SHORT_NAME => Self::new::<Cased>(),
268            ChangesWhenCasefolded::NAME | ChangesWhenCasefolded::SHORT_NAME => {
269                Self::new::<ChangesWhenCasefolded>()
270            }
271            ChangesWhenCasemapped::NAME | ChangesWhenCasemapped::SHORT_NAME => {
272                Self::new::<ChangesWhenCasemapped>()
273            }
274            ChangesWhenLowercased::NAME | ChangesWhenLowercased::SHORT_NAME => {
275                Self::new::<ChangesWhenLowercased>()
276            }
277            ChangesWhenNfkcCasefolded::NAME | ChangesWhenNfkcCasefolded::SHORT_NAME => {
278                Self::new::<ChangesWhenNfkcCasefolded>()
279            }
280            ChangesWhenTitlecased::NAME | ChangesWhenTitlecased::SHORT_NAME => {
281                Self::new::<ChangesWhenTitlecased>()
282            }
283            ChangesWhenUppercased::NAME | ChangesWhenUppercased::SHORT_NAME => {
284                Self::new::<ChangesWhenUppercased>()
285            }
286            #[allow(unreachable_patterns)] // no short name
287            Dash::NAME | Dash::SHORT_NAME => Self::new::<Dash>(),
288            DefaultIgnorableCodePoint::NAME | DefaultIgnorableCodePoint::SHORT_NAME => {
289                Self::new::<DefaultIgnorableCodePoint>()
290            }
291            Deprecated::NAME | Deprecated::SHORT_NAME => Self::new::<Deprecated>(),
292            Diacritic::NAME | Diacritic::SHORT_NAME => Self::new::<Diacritic>(),
293            #[allow(unreachable_patterns)] // no short name
294            Emoji::NAME | Emoji::SHORT_NAME => Self::new::<Emoji>(),
295            EmojiComponent::NAME | EmojiComponent::SHORT_NAME => Self::new::<EmojiComponent>(),
296            EmojiModifier::NAME | EmojiModifier::SHORT_NAME => Self::new::<EmojiModifier>(),
297            EmojiModifierBase::NAME | EmojiModifierBase::SHORT_NAME => {
298                Self::new::<EmojiModifierBase>()
299            }
300            EmojiPresentation::NAME | EmojiPresentation::SHORT_NAME => {
301                Self::new::<EmojiPresentation>()
302            }
303            ExtendedPictographic::NAME | ExtendedPictographic::SHORT_NAME => {
304                Self::new::<ExtendedPictographic>()
305            }
306            Extender::NAME | Extender::SHORT_NAME => Self::new::<Extender>(),
307            GraphemeBase::NAME | GraphemeBase::SHORT_NAME => Self::new::<GraphemeBase>(),
308            GraphemeExtend::NAME | GraphemeExtend::SHORT_NAME => Self::new::<GraphemeExtend>(),
309            HexDigit::NAME | HexDigit::SHORT_NAME => Self::new::<HexDigit>(),
310            IdsBinaryOperator::NAME | IdsBinaryOperator::SHORT_NAME => {
311                Self::new::<IdsBinaryOperator>()
312            }
313            IdsTrinaryOperator::NAME | IdsTrinaryOperator::SHORT_NAME => {
314                Self::new::<IdsTrinaryOperator>()
315            }
316            IdContinue::NAME | IdContinue::SHORT_NAME => Self::new::<IdContinue>(),
317            IdStart::NAME | IdStart::SHORT_NAME => Self::new::<IdStart>(),
318            Ideographic::NAME | Ideographic::SHORT_NAME => Self::new::<Ideographic>(),
319            JoinControl::NAME | JoinControl::SHORT_NAME => Self::new::<JoinControl>(),
320            LogicalOrderException::NAME | LogicalOrderException::SHORT_NAME => {
321                Self::new::<LogicalOrderException>()
322            }
323            Lowercase::NAME | Lowercase::SHORT_NAME => Self::new::<Lowercase>(),
324            #[allow(unreachable_patterns)] // no short name
325            Math::NAME | Math::SHORT_NAME => Self::new::<Math>(),
326            NoncharacterCodePoint::NAME | NoncharacterCodePoint::SHORT_NAME => {
327                Self::new::<NoncharacterCodePoint>()
328            }
329            PatternSyntax::NAME | PatternSyntax::SHORT_NAME => Self::new::<PatternSyntax>(),
330            PatternWhiteSpace::NAME | PatternWhiteSpace::SHORT_NAME => {
331                Self::new::<PatternWhiteSpace>()
332            }
333            QuotationMark::NAME | QuotationMark::SHORT_NAME => Self::new::<QuotationMark>(),
334            #[allow(unreachable_patterns)] // no short name
335            Radical::NAME | Radical::SHORT_NAME => Self::new::<Radical>(),
336            RegionalIndicator::NAME | RegionalIndicator::SHORT_NAME => {
337                Self::new::<RegionalIndicator>()
338            }
339            SentenceTerminal::NAME | SentenceTerminal::SHORT_NAME => {
340                Self::new::<SentenceTerminal>()
341            }
342            SoftDotted::NAME | SoftDotted::SHORT_NAME => Self::new::<SoftDotted>(),
343            TerminalPunctuation::NAME | TerminalPunctuation::SHORT_NAME => {
344                Self::new::<TerminalPunctuation>()
345            }
346            UnifiedIdeograph::NAME | UnifiedIdeograph::SHORT_NAME => {
347                Self::new::<UnifiedIdeograph>()
348            }
349            Uppercase::NAME | Uppercase::SHORT_NAME => Self::new::<Uppercase>(),
350            VariationSelector::NAME | VariationSelector::SHORT_NAME => {
351                Self::new::<VariationSelector>()
352            }
353            WhiteSpace::NAME | WhiteSpace::SHORT_NAME => Self::new::<WhiteSpace>(),
354            XidContinue::NAME | XidContinue::SHORT_NAME => Self::new::<XidContinue>(),
355            XidStart::NAME | XidStart::SHORT_NAME => Self::new::<XidStart>(),
356            // Not an ECMA-262 property
357            _ => return None,
358        })
359    }
360
361    icu_provider::gen_buffer_data_constructors!(
362        (prop: &[u8]) -> result: Option<Result<Self, DataError>>,
363        functions: [
364            new_for_ecma262: skip,
365            try_new_for_ecma262_with_buffer_provider,
366            try_new_for_ecma262_unstable,
367            Self,
368        ]
369    );
370
371    #[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new_for_ecma262)]
372    pub fn try_new_for_ecma262_unstable<P>(
373        provider: &P,
374        prop: &[u8],
375    ) -> Option<Result<Self, DataError>>
376    where
377        P: ?Sized
378            + DataProvider<PropertyBinaryAsciiHexDigitV1>
379            + DataProvider<PropertyBinaryAlphabeticV1>
380            + DataProvider<PropertyBinaryBidiControlV1>
381            + DataProvider<PropertyBinaryBidiMirroredV1>
382            + DataProvider<PropertyBinaryCaseIgnorableV1>
383            + DataProvider<PropertyBinaryCasedV1>
384            + DataProvider<PropertyBinaryChangesWhenCasefoldedV1>
385            + DataProvider<PropertyBinaryChangesWhenCasemappedV1>
386            + DataProvider<PropertyBinaryChangesWhenLowercasedV1>
387            + DataProvider<PropertyBinaryChangesWhenNfkcCasefoldedV1>
388            + DataProvider<PropertyBinaryChangesWhenTitlecasedV1>
389            + DataProvider<PropertyBinaryChangesWhenUppercasedV1>
390            + DataProvider<PropertyBinaryDashV1>
391            + DataProvider<PropertyBinaryDefaultIgnorableCodePointV1>
392            + DataProvider<PropertyBinaryDeprecatedV1>
393            + DataProvider<PropertyBinaryDiacriticV1>
394            + DataProvider<PropertyBinaryEmojiV1>
395            + DataProvider<PropertyBinaryEmojiComponentV1>
396            + DataProvider<PropertyBinaryEmojiModifierV1>
397            + DataProvider<PropertyBinaryEmojiModifierBaseV1>
398            + DataProvider<PropertyBinaryEmojiPresentationV1>
399            + DataProvider<PropertyBinaryExtendedPictographicV1>
400            + DataProvider<PropertyBinaryExtenderV1>
401            + DataProvider<PropertyBinaryGraphemeBaseV1>
402            + DataProvider<PropertyBinaryGraphemeExtendV1>
403            + DataProvider<PropertyBinaryHexDigitV1>
404            + DataProvider<PropertyBinaryIdsBinaryOperatorV1>
405            + DataProvider<PropertyBinaryIdsTrinaryOperatorV1>
406            + DataProvider<PropertyBinaryIdContinueV1>
407            + DataProvider<PropertyBinaryIdStartV1>
408            + DataProvider<PropertyBinaryIdeographicV1>
409            + DataProvider<PropertyBinaryJoinControlV1>
410            + DataProvider<PropertyBinaryLogicalOrderExceptionV1>
411            + DataProvider<PropertyBinaryLowercaseV1>
412            + DataProvider<PropertyBinaryMathV1>
413            + DataProvider<PropertyBinaryNoncharacterCodePointV1>
414            + DataProvider<PropertyBinaryPatternSyntaxV1>
415            + DataProvider<PropertyBinaryPatternWhiteSpaceV1>
416            + DataProvider<PropertyBinaryQuotationMarkV1>
417            + DataProvider<PropertyBinaryRadicalV1>
418            + DataProvider<PropertyBinaryRegionalIndicatorV1>
419            + DataProvider<PropertyBinarySentenceTerminalV1>
420            + DataProvider<PropertyBinarySoftDottedV1>
421            + DataProvider<PropertyBinaryTerminalPunctuationV1>
422            + DataProvider<PropertyBinaryUnifiedIdeographV1>
423            + DataProvider<PropertyBinaryUppercaseV1>
424            + DataProvider<PropertyBinaryVariationSelectorV1>
425            + DataProvider<PropertyBinaryWhiteSpaceV1>
426            + DataProvider<PropertyBinaryXidContinueV1>
427            + DataProvider<PropertyBinaryXidStartV1>,
428    {
429        use crate::props::*;
430        Some(match prop {
431            AsciiHexDigit::NAME | AsciiHexDigit::SHORT_NAME => {
432                Self::try_new_unstable::<AsciiHexDigit>(provider)
433            }
434            Alphabetic::NAME | Alphabetic::SHORT_NAME => {
435                Self::try_new_unstable::<Alphabetic>(provider)
436            }
437            BidiControl::NAME | BidiControl::SHORT_NAME => {
438                Self::try_new_unstable::<BidiControl>(provider)
439            }
440            BidiMirrored::NAME | BidiMirrored::SHORT_NAME => {
441                Self::try_new_unstable::<BidiMirrored>(provider)
442            }
443            CaseIgnorable::NAME | CaseIgnorable::SHORT_NAME => {
444                Self::try_new_unstable::<CaseIgnorable>(provider)
445            }
446            #[allow(unreachable_patterns)] // no short name
447            Cased::NAME | Cased::SHORT_NAME => Self::try_new_unstable::<Cased>(provider),
448            ChangesWhenCasefolded::NAME | ChangesWhenCasefolded::SHORT_NAME => {
449                Self::try_new_unstable::<ChangesWhenCasefolded>(provider)
450            }
451            ChangesWhenCasemapped::NAME | ChangesWhenCasemapped::SHORT_NAME => {
452                Self::try_new_unstable::<ChangesWhenCasemapped>(provider)
453            }
454            ChangesWhenLowercased::NAME | ChangesWhenLowercased::SHORT_NAME => {
455                Self::try_new_unstable::<ChangesWhenLowercased>(provider)
456            }
457            ChangesWhenNfkcCasefolded::NAME | ChangesWhenNfkcCasefolded::SHORT_NAME => {
458                Self::try_new_unstable::<ChangesWhenNfkcCasefolded>(provider)
459            }
460            ChangesWhenTitlecased::NAME | ChangesWhenTitlecased::SHORT_NAME => {
461                Self::try_new_unstable::<ChangesWhenTitlecased>(provider)
462            }
463            ChangesWhenUppercased::NAME | ChangesWhenUppercased::SHORT_NAME => {
464                Self::try_new_unstable::<ChangesWhenUppercased>(provider)
465            }
466            #[allow(unreachable_patterns)] // no short name
467            Dash::NAME | Dash::SHORT_NAME => Self::try_new_unstable::<Dash>(provider),
468            DefaultIgnorableCodePoint::NAME | DefaultIgnorableCodePoint::SHORT_NAME => {
469                Self::try_new_unstable::<DefaultIgnorableCodePoint>(provider)
470            }
471            Deprecated::NAME | Deprecated::SHORT_NAME => {
472                Self::try_new_unstable::<Deprecated>(provider)
473            }
474            Diacritic::NAME | Diacritic::SHORT_NAME => {
475                Self::try_new_unstable::<Diacritic>(provider)
476            }
477            #[allow(unreachable_patterns)] // no short name
478            Emoji::NAME | Emoji::SHORT_NAME => Self::try_new_unstable::<Emoji>(provider),
479            EmojiComponent::NAME | EmojiComponent::SHORT_NAME => {
480                Self::try_new_unstable::<EmojiComponent>(provider)
481            }
482            EmojiModifier::NAME | EmojiModifier::SHORT_NAME => {
483                Self::try_new_unstable::<EmojiModifier>(provider)
484            }
485            EmojiModifierBase::NAME | EmojiModifierBase::SHORT_NAME => {
486                Self::try_new_unstable::<EmojiModifierBase>(provider)
487            }
488            EmojiPresentation::NAME | EmojiPresentation::SHORT_NAME => {
489                Self::try_new_unstable::<EmojiPresentation>(provider)
490            }
491            ExtendedPictographic::NAME | ExtendedPictographic::SHORT_NAME => {
492                Self::try_new_unstable::<ExtendedPictographic>(provider)
493            }
494            Extender::NAME | Extender::SHORT_NAME => Self::try_new_unstable::<Extender>(provider),
495            GraphemeBase::NAME | GraphemeBase::SHORT_NAME => {
496                Self::try_new_unstable::<GraphemeBase>(provider)
497            }
498            GraphemeExtend::NAME | GraphemeExtend::SHORT_NAME => {
499                Self::try_new_unstable::<GraphemeExtend>(provider)
500            }
501            HexDigit::NAME | HexDigit::SHORT_NAME => Self::try_new_unstable::<HexDigit>(provider),
502            IdsBinaryOperator::NAME | IdsBinaryOperator::SHORT_NAME => {
503                Self::try_new_unstable::<IdsBinaryOperator>(provider)
504            }
505            IdsTrinaryOperator::NAME | IdsTrinaryOperator::SHORT_NAME => {
506                Self::try_new_unstable::<IdsTrinaryOperator>(provider)
507            }
508            IdContinue::NAME | IdContinue::SHORT_NAME => {
509                Self::try_new_unstable::<IdContinue>(provider)
510            }
511            IdStart::NAME | IdStart::SHORT_NAME => Self::try_new_unstable::<IdStart>(provider),
512            Ideographic::NAME | Ideographic::SHORT_NAME => {
513                Self::try_new_unstable::<Ideographic>(provider)
514            }
515            JoinControl::NAME | JoinControl::SHORT_NAME => {
516                Self::try_new_unstable::<JoinControl>(provider)
517            }
518            LogicalOrderException::NAME | LogicalOrderException::SHORT_NAME => {
519                Self::try_new_unstable::<LogicalOrderException>(provider)
520            }
521            Lowercase::NAME | Lowercase::SHORT_NAME => {
522                Self::try_new_unstable::<Lowercase>(provider)
523            }
524            #[allow(unreachable_patterns)] // no short name
525            Math::NAME | Math::SHORT_NAME => Self::try_new_unstable::<Math>(provider),
526            NoncharacterCodePoint::NAME | NoncharacterCodePoint::SHORT_NAME => {
527                Self::try_new_unstable::<NoncharacterCodePoint>(provider)
528            }
529            PatternSyntax::NAME | PatternSyntax::SHORT_NAME => {
530                Self::try_new_unstable::<PatternSyntax>(provider)
531            }
532            PatternWhiteSpace::NAME | PatternWhiteSpace::SHORT_NAME => {
533                Self::try_new_unstable::<PatternWhiteSpace>(provider)
534            }
535            QuotationMark::NAME | QuotationMark::SHORT_NAME => {
536                Self::try_new_unstable::<QuotationMark>(provider)
537            }
538            #[allow(unreachable_patterns)] // no short name
539            Radical::NAME | Radical::SHORT_NAME => Self::try_new_unstable::<Radical>(provider),
540            RegionalIndicator::NAME | RegionalIndicator::SHORT_NAME => {
541                Self::try_new_unstable::<RegionalIndicator>(provider)
542            }
543            SentenceTerminal::NAME | SentenceTerminal::SHORT_NAME => {
544                Self::try_new_unstable::<SentenceTerminal>(provider)
545            }
546            SoftDotted::NAME | SoftDotted::SHORT_NAME => {
547                Self::try_new_unstable::<SoftDotted>(provider)
548            }
549            TerminalPunctuation::NAME | TerminalPunctuation::SHORT_NAME => {
550                Self::try_new_unstable::<TerminalPunctuation>(provider)
551            }
552            UnifiedIdeograph::NAME | UnifiedIdeograph::SHORT_NAME => {
553                Self::try_new_unstable::<UnifiedIdeograph>(provider)
554            }
555            Uppercase::NAME | Uppercase::SHORT_NAME => {
556                Self::try_new_unstable::<Uppercase>(provider)
557            }
558            VariationSelector::NAME | VariationSelector::SHORT_NAME => {
559                Self::try_new_unstable::<VariationSelector>(provider)
560            }
561            WhiteSpace::NAME | WhiteSpace::SHORT_NAME => {
562                Self::try_new_unstable::<WhiteSpace>(provider)
563            }
564            XidContinue::NAME | XidContinue::SHORT_NAME => {
565                Self::try_new_unstable::<XidContinue>(provider)
566            }
567            XidStart::NAME | XidStart::SHORT_NAME => Self::try_new_unstable::<XidStart>(provider),
568            // Not an ECMA-262 property
569            _ => return None,
570        })
571    }
572}