Skip to main content

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