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