icu_properties/
runtime.rs
1#[cfg(doc)]
15use super::{maps, script, GeneralCategory, GeneralCategoryGroup, Script};
16
17#[allow(clippy::exhaustive_structs)] #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
25pub struct UnicodeProperty(pub u32);
26
27#[allow(non_upper_case_globals)]
28#[allow(unused)] impl UnicodeProperty {
30 pub const Alphabetic: Self = UnicodeProperty(0);
32 pub const AsciiHexDigit: Self = UnicodeProperty(1);
34 pub const BidiControl: Self = UnicodeProperty(2);
36 pub const BidiMirrored: Self = UnicodeProperty(3);
38 pub const Dash: Self = UnicodeProperty(4);
40 pub const DefaultIgnorableCodePoint: Self = UnicodeProperty(5);
42 pub const Deprecated: Self = UnicodeProperty(6);
44 pub const Diacritic: Self = UnicodeProperty(7);
46 pub const Extender: Self = UnicodeProperty(8);
48 pub const FullCompositionExclusion: Self = UnicodeProperty(9);
50 pub const GraphemeBase: Self = UnicodeProperty(10);
52 pub const GraphemeExtend: Self = UnicodeProperty(11);
54 pub const GraphemeLink: Self = UnicodeProperty(12);
56 pub const HexDigit: Self = UnicodeProperty(13);
58 pub const Hyphen: Self = UnicodeProperty(14);
60 pub const IdContinue: Self = UnicodeProperty(15);
62 pub const IdStart: Self = UnicodeProperty(16);
64 pub const Ideographic: Self = UnicodeProperty(17);
66 pub const IdsBinaryOperator: Self = UnicodeProperty(18);
68 pub const IdsTrinaryOperator: Self = UnicodeProperty(19);
70 pub const JoinControl: Self = UnicodeProperty(20);
72 pub const LogicalOrderException: Self = UnicodeProperty(21);
74 pub const Lowercase: Self = UnicodeProperty(22);
76 pub const Math: Self = UnicodeProperty(23);
78 pub const NoncharacterCodePoint: Self = UnicodeProperty(24);
80 pub const QuotationMark: Self = UnicodeProperty(25);
82 pub const Radical: Self = UnicodeProperty(26);
84 pub const SoftDotted: Self = UnicodeProperty(27);
86 pub const TerminalPunctuation: Self = UnicodeProperty(28);
88 pub const UnifiedIdeograph: Self = UnicodeProperty(29);
90 pub const Uppercase: Self = UnicodeProperty(30);
92 pub const WhiteSpace: Self = UnicodeProperty(31);
94 pub const XidContinue: Self = UnicodeProperty(32);
96 pub const XidStart: Self = UnicodeProperty(33);
98 pub const CaseSensitive: Self = UnicodeProperty(34);
100 pub const SentenceTerminal: Self = UnicodeProperty(35);
102 pub const VariationSelector: Self = UnicodeProperty(36);
104 pub const NfdInert: Self = UnicodeProperty(37);
106 pub const NfkdInert: Self = UnicodeProperty(38);
108 pub const NfcInert: Self = UnicodeProperty(39);
110 pub const NfkcInert: Self = UnicodeProperty(40);
112 pub const SegmentStarter: Self = UnicodeProperty(41);
114 pub const PatternSyntax: Self = UnicodeProperty(42);
116 pub const PatternWhiteSpace: Self = UnicodeProperty(43);
118 pub const Alnum: Self = UnicodeProperty(44);
120 pub const Blank: Self = UnicodeProperty(45);
122 pub const Graph: Self = UnicodeProperty(46);
124 pub const Print: Self = UnicodeProperty(47);
126 pub const XDigit: Self = UnicodeProperty(48);
128 pub const Cased: Self = UnicodeProperty(49);
130 pub const CaseIgnorable: Self = UnicodeProperty(50);
132 pub const ChangesWhenLowercased: Self = UnicodeProperty(51);
134 pub const ChangesWhenUppercased: Self = UnicodeProperty(52);
136 pub const ChangesWhenTitlecased: Self = UnicodeProperty(53);
138 pub const ChangesWhenCasefolded: Self = UnicodeProperty(54);
140 pub const ChangesWhenCasemapped: Self = UnicodeProperty(55);
142 pub const ChangesWhenNfkcCasefolded: Self = UnicodeProperty(56);
144 pub const Emoji: Self = UnicodeProperty(57);
146 pub const EmojiPresentation: Self = UnicodeProperty(58);
148 pub const EmojiModifier: Self = UnicodeProperty(59);
150 pub const EmojiModifierBase: Self = UnicodeProperty(60);
152 pub const EmojiComponent: Self = UnicodeProperty(61);
154 pub const RegionalIndicator: Self = UnicodeProperty(62);
156 pub const PrependedConcatenationMark: Self = UnicodeProperty(63);
158 pub const ExtendedPictographic: Self = UnicodeProperty(64);
160 pub const BasicEmoji: Self = UnicodeProperty(65);
162 pub const EmojiKeycapSequence: Self = UnicodeProperty(66);
164 pub const RgiEmojiModifierSequence: Self = UnicodeProperty(67);
166 pub const RgiEmojiFlagSequence: Self = UnicodeProperty(68);
168 pub const RgiEmojiTagSequence: Self = UnicodeProperty(69);
170 pub const RgiEmojiZWJSequence: Self = UnicodeProperty(70);
172 pub const RgiEmoji: Self = UnicodeProperty(71);
174
175 const BINARY_MAX: Self = Self::RgiEmoji;
176
177 pub const BidiClass: Self = UnicodeProperty(0x1000);
179 pub const Block: Self = UnicodeProperty(0x1001);
181 pub const CombiningClass: Self = UnicodeProperty(0x1002);
183 pub const DecompositionType: Self = UnicodeProperty(0x1003);
185 pub const EastAsianWidth: Self = UnicodeProperty(0x1004);
187 pub const GeneralCategory: Self = UnicodeProperty(0x1005);
189 pub const JoiningGroup: Self = UnicodeProperty(0x1006);
191 pub const JoiningType: Self = UnicodeProperty(0x1007);
193 pub const LineBreak: Self = UnicodeProperty(0x1008);
195 pub const NumericType: Self = UnicodeProperty(0x1009);
197 pub const Script: Self = UnicodeProperty(0x100A);
199 pub const HangulSyllableType: Self = UnicodeProperty(0x100B);
201 pub const NFDQuickCheck: Self = UnicodeProperty(0x100C);
203 pub const NFKDQuickCheck: Self = UnicodeProperty(0x100D);
205 pub const NFCQuickCheck: Self = UnicodeProperty(0x100E);
207 pub const NFKCQuickCheck: Self = UnicodeProperty(0x100F);
209 pub const LeadCanonicalCombiningClass: Self = UnicodeProperty(0x1010);
211 pub const TrailCanonicalCombiningClass: Self = UnicodeProperty(0x1011);
213 pub const GraphemeClusterBreak: Self = UnicodeProperty(0x1012);
215 pub const SentenceBreak: Self = UnicodeProperty(0x1013);
217 pub const WordBreak: Self = UnicodeProperty(0x1014);
219 pub const BidiPairedBracketType: Self = UnicodeProperty(0x1015);
221 pub const IndicPositionalCategory: Self = UnicodeProperty(0x1016);
223 pub const IndicSyllabicCategory: Self = UnicodeProperty(0x1017);
225 pub const VerticalOrientation: Self = UnicodeProperty(0x1018);
227
228 const ENUMERATED_MAX: Self = Self::VerticalOrientation;
229
230 pub const GeneralCategoryMask: Self = UnicodeProperty(0x2000);
232
233 pub const NumericValue: Self = UnicodeProperty(0x3000);
235
236 pub const Age: Self = UnicodeProperty(0x4000);
238 pub const BidiMirroringGlyph: Self = UnicodeProperty(0x4001);
240 pub const CaseFolding: Self = UnicodeProperty(0x4002);
242 pub const ISOComment: Self = UnicodeProperty(0x4003);
244 pub const LowercaseMapping: Self = UnicodeProperty(0x4004);
246 pub const Name: Self = UnicodeProperty(0x4005);
248 pub const SimpleCaseFolding: Self = UnicodeProperty(0x4006);
250 pub const SimpleLowercaseMapping: Self = UnicodeProperty(0x4007);
252 pub const SimpleTitlecaseMapping: Self = UnicodeProperty(0x4008);
254 pub const SimpleUppercaseMapping: Self = UnicodeProperty(0x4009);
256 pub const TitlecaseMapping: Self = UnicodeProperty(0x400A);
258 pub const Unicode1_Name: Self = UnicodeProperty(0x400B);
260 pub const UppercaseMapping: Self = UnicodeProperty(0x400C);
262 pub const BidiPairedBracket: Self = UnicodeProperty(0x400D);
264
265 const STRING_MAX: Self = Self::BidiPairedBracket;
266
267 pub const ScriptExtensions: Self = UnicodeProperty(0x7000);
269}
270
271#[allow(unused)] impl UnicodeProperty {
273 pub fn parse_ecma262_name(name: &str) -> Option<Self> {
301 let prop = match name {
302 "General_Category" | "gc" => Self::GeneralCategory,
303 "Script" | "sc" => Self::Script,
304 "Script_Extensions" | "scx" => Self::ScriptExtensions,
305 "ASCII_Hex_Digit" | "AHex" => Self::AsciiHexDigit,
306 "Alphabetic" | "Alpha" => Self::Alphabetic,
307 "Bidi_Control" | "Bidi_C" => Self::BidiControl,
308 "Bidi_Mirrored" | "Bidi_M" => Self::BidiMirrored,
309 "Case_Ignorable" | "CI" => Self::CaseIgnorable,
310 "Cased" => Self::Cased,
311 "Changes_When_Casefolded" | "CWCF" => Self::ChangesWhenCasefolded,
312 "Changes_When_Casemapped" | "CWCM" => Self::ChangesWhenCasemapped,
313 "Changes_When_Lowercased" | "CWL" => Self::ChangesWhenLowercased,
314 "Changes_When_NFKC_Casefolded" | "CWKCF" => Self::ChangesWhenNfkcCasefolded,
315 "Changes_When_Titlecased" | "CWT" => Self::ChangesWhenTitlecased,
316 "Changes_When_Uppercased" | "CWU" => Self::ChangesWhenUppercased,
317 "Dash" => Self::Dash,
318 "Default_Ignorable_Code_Point" | "DI" => Self::DefaultIgnorableCodePoint,
319 "Deprecated" | "Dep" => Self::Deprecated,
320 "Diacritic" | "Dia" => Self::Diacritic,
321 "Emoji" => Self::Emoji,
322 "Emoji_Component" | "EComp" => Self::EmojiComponent,
323 "Emoji_Modifier" | "EMod" => Self::EmojiModifier,
324 "Emoji_Modifier_Base" | "EBase" => Self::EmojiModifierBase,
325 "Emoji_Presentation" | "EPres" => Self::EmojiPresentation,
326 "Extended_Pictographic" | "ExtPict" => Self::ExtendedPictographic,
327 "Extender" | "Ext" => Self::Extender,
328 "Grapheme_Base" | "Gr_Base" => Self::GraphemeBase,
329 "Grapheme_Extend" | "Gr_Ext" => Self::GraphemeExtend,
330 "Hex_Digit" | "Hex" => Self::HexDigit,
331 "IDS_Binary_Operator" | "IDSB" => Self::IdsBinaryOperator,
332 "IDS_Trinary_Operator" | "IDST" => Self::IdsTrinaryOperator,
333 "ID_Continue" | "IDC" => Self::IdContinue,
334 "ID_Start" | "IDS" => Self::IdStart,
335 "Ideographic" | "Ideo" => Self::Ideographic,
336 "Join_Control" | "Join_C" => Self::JoinControl,
337 "Logical_Order_Exception" | "LOE" => Self::LogicalOrderException,
338 "Lowercase" | "Lower" => Self::Lowercase,
339 "Math" => Self::Math,
340 "Noncharacter_Code_Point" | "NChar" => Self::NoncharacterCodePoint,
341 "Pattern_Syntax" | "Pat_Syn" => Self::PatternSyntax,
342 "Pattern_White_Space" | "Pat_WS" => Self::PatternWhiteSpace,
343 "Quotation_Mark" | "QMark" => Self::QuotationMark,
344 "Radical" => Self::Radical,
345 "Regional_Indicator" | "RI" => Self::RegionalIndicator,
346 "Sentence_Terminal" | "STerm" => Self::SentenceTerminal,
347 "Soft_Dotted" | "SD" => Self::SoftDotted,
348 "Terminal_Punctuation" | "Term" => Self::TerminalPunctuation,
349 "Unified_Ideograph" | "UIdeo" => Self::UnifiedIdeograph,
350 "Uppercase" | "Upper" => Self::Uppercase,
351 "Variation_Selector" | "VS" => Self::VariationSelector,
352 "White_Space" | "space" => Self::WhiteSpace,
353 "XID_Continue" | "XIDC" => Self::XidContinue,
354 "XID_Start" | "XIDS" => Self::XidStart,
355 _ => return None,
356 };
357
358 Some(prop)
359 }
360}