1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
use crate::unicode::ucd::property_names;

#[derive(Clone, Copy)]
pub struct PropertyName {
    pub full: &'static str,
    pub abbr: &'static str,
}

pub trait UnicodeProperty {
    fn property_value_name(&self) -> PropertyName;
}

#[derive(Debug, PartialEq, Clone, Copy)]
#[repr(u8)]
pub enum BinaryProperty {
    Y,
    N,
}

impl From<bool> for BinaryProperty {
    fn from(val: bool) -> Self {
        match val {
            true => BinaryProperty::Y,
            false => BinaryProperty::N,
        }
    }
}

impl UnicodeProperty for BinaryProperty {
    fn property_value_name(&self) -> PropertyName {
        property_names::binary_property_name(*self)
    }
}

#[derive(Debug, PartialEq, Clone, Copy)]
#[repr(u8)]
pub enum Gc {
    // C - Other
    Cc,
    Cf,
    Cn,
    Co,
    Cs,
    // L - Letter
    // LC - Cased_Letter (Ll | Lt | Lu)
    Ll,
    Lm,
    Lo,
    Lt,
    Lu,
    // M - Mark
    Mc,
    Me,
    Mn,
    // N - Number
    Nd,
    Nl,
    No,
    // P - Punctuation
    Pc,
    Pd,
    Pe,
    Pf,
    Pi,
    Po,
    Ps,
    // S - Symbol
    Sc,
    Sk,
    Sm,
    So,
    // Z - Separator
    Zl,
    Zp,
    Zs,
}

impl UnicodeProperty for Gc {
    fn property_value_name(&self) -> PropertyName {
        property_names::gc_name(*self)
    }
}

#[derive(Debug, PartialEq, Clone, Copy)]
#[repr(u8)]
pub enum Hst {
    L,      //Leading_Jamo
    LV,     //LV_Syllable
    LVT,    //LVT_Syllable
    NA,     //Not_Applicable
    T,      //Trailing_Jamo
    V,      //Vowel_Jamo
}

impl UnicodeProperty for Hst {
    fn property_value_name(&self) -> PropertyName {
        property_names::hst_name(*self)
    }
}

#[derive(Debug, PartialEq, Clone, Copy)]
#[repr(u8)]
pub enum Gcb {
    CN,     // Control
    CR,     // CR
    EB,     // E_Base
    EBG,    // E_Base_GAZ
    EM,     // E_Modifier
    EX,     // Extend
    GAZ,    // Glue_After_Zwj
    L,      // L
    LF,     // LF
    LV,     // LV
    LVT,    // LVT
    PP,     // Prepend
    RI,     // Regional_Indicator
    SM,     // SpacingMark
    T,      // T
    V,      // V
    XX,     // Other
    ZWJ,    // ZWJ
}

impl UnicodeProperty for Gcb {
    fn property_value_name(&self) -> PropertyName {
        property_names::gcb_name(*self)
    }
}

#[derive(Debug, PartialEq, Clone, Copy)]
#[repr(u8)]
pub enum Bc {
    AL,     // Arabic_Letter
    AN,     // Arabic_Number
    B,      // Paragraph_Separator
    BN,     // Boundary_Neutral
    CS,     // Common_Separator
    EN,     // European_Number
    ES,     // European_Separator
    ET,     // European_Terminator
    FSI,    // First_Strong_Isolate
    L,      // Left_To_Right
    LRE,    // Left_To_Right_Embedding
    LRI,    // Left_To_Right_Isolate
    LRO,    // Left_To_Right_Override
    NSM,    // Nonspacing_Mark
    ON,     // Other_Neutral
    PDF,    // Pop_Directional_Format
    PDI,    // Pop_Directional_Isolate
    R,      // Right_To_Left
    RLE,    // Right_To_Left_Embedding
    RLI,    // Right_To_Left_Isolate
    RLO,    // Right_To_Left_Override
    S,      // Segment_Separator
    WS,     // White_Space
}

impl UnicodeProperty for Bc {
    fn property_value_name(&self) -> PropertyName {
        property_names::bc_name(*self)
    }
}

#[derive(Debug, PartialEq, Clone, Copy)]
#[repr(u8)]
pub enum Ccc {
    NR = 0,         // Not_Reordered
    OV = 1,         // Overlay
    HANR = 6,       // Han_Reading
    NK = 7,         // Nukta
    KV = 8,         // Kana_Voicing
    VR = 9,         // Virama
    CCC10 = 10,     // CCC10
    CCC11 = 11,     // CCC11
    CCC12 = 12,     // CCC12
    CCC13 = 13,     // CCC13
    CCC14 = 14,     // CCC14
    CCC15 = 15,     // CCC15
    CCC16 = 16,     // CCC16
    CCC17 = 17,     // CCC17
    CCC18 = 18,     // CCC18
    CCC19 = 19,     // CCC19
    CCC20 = 20,     // CCC20
    CCC21 = 21,     // CCC21
    CCC22 = 22,     // CCC22
    CCC23 = 23,     // CCC23
    CCC24 = 24,     // CCC24
    CCC25 = 25,     // CCC25
    CCC26 = 26,     // CCC26
    CCC27 = 27,     // CCC27
    CCC28 = 28,     // CCC28
    CCC29 = 29,     // CCC29
    CCC30 = 30,     // CCC30
    CCC31 = 31,     // CCC31
    CCC32 = 32,     // CCC32
    CCC33 = 33,     // CCC33
    CCC34 = 34,     // CCC34
    CCC35 = 35,     // CCC35
    CCC36 = 36,     // CCC36
    CCC84 = 84,     // CCC84
    CCC91 = 91,     // CCC91
    CCC103 = 103,   // CCC103
    CCC107 = 107,   // CCC107
    CCC118 = 118,   // CCC118
    CCC122 = 122,   // CCC122
    CCC129 = 129,   // CCC129
    CCC130 = 130,   // CCC130
    CCC132 = 132,   // CCC132
    CCC133 = 133,   // CCC133 # RESERVED
    ATBL = 200,     // Attached_Below_Left
    ATB = 202,      // Attached_Below
    ATA = 214,      // Attached_Above
    ATAR = 216,     // Attached_Above_Right
    BL = 218,       // Below_Left
    B = 220,        // Below
    BR = 222,       // Below_Right
    L = 224,        // Left
    R = 226,        // Right
    AL = 228,       // Above_Left
    A = 230,        // Above
    AR = 232,       // Above_Right
    DB = 233,       // Double_Below
    DA = 234,       // Double_Above
    IS = 240,       // Iota_Subscript
}

impl UnicodeProperty for Ccc {
    fn property_value_name(&self) -> PropertyName {
        property_names::ccc_name(*self)
    }
}

#[derive(Debug, PartialEq, Clone, Copy)]
#[repr(u8)]
pub enum Dt {
    Can,    // Canonical
    Com,    // Compat
    Enc,    // Circle
    Fin,    // Final
    Font,   // Font
    Fra,    // Fraction
    Init,   // Initial
    Iso,    // Isolated
    Med,    // Medial
    Nar,    // Narrow
    Nb,     // Nobreak
    None,   // None
    Sml,    // Small
    Sqr,    // Square
    Sub,    // Sub
    Sup,    // Super
    Vert,   // Vertical
    Wide,   // Wide
}

impl UnicodeProperty for Dt {
    fn property_value_name(&self) -> PropertyName {
        property_names::dt_name(*self)
    }
}

#[derive(Debug, PartialEq, Clone, Copy)]
#[repr(u16)]
pub enum Blk {
    // These enum contents are generated by `gen-blk-enum.py` script.
    Adlam,
    AegeanNumbers,
    Ahom,
    Alchemical,
    AlphabeticPf,
    AnatolianHieroglyphs,
    AncientGreekMusic,
    AncientGreekNumbers,
    AncientSymbols,
    Arabic,
    ArabicExtA,
    ArabicMath,
    ArabicPfA,
    ArabicPfB,
    ArabicSup,
    Armenian,
    Arrows,
    Ascii,
    Avestan,
    Balinese,
    Bamum,
    BamumSup,
    BassaVah,
    Batak,
    Bengali,
    Bhaiksuki,
    BlockElements,
    Bopomofo,
    BopomofoExt,
    BoxDrawing,
    Brahmi,
    Braille,
    Buginese,
    Buhid,
    ByzantineMusic,
    Carian,
    CaucasianAlbanian,
    Chakma,
    Cham,
    Cherokee,
    CherokeeSup,
    ChessSymbols,
    Chorasmian,
    Cjk,
    CjkCompat,
    CjkCompatForms,
    CjkCompatIdeographs,
    CjkCompatIdeographsSup,
    CjkExtA,
    CjkExtB,
    CjkExtC,
    CjkExtD,
    CjkExtE,
    CjkExtF,
    CjkExtG,
    CjkRadicalsSup,
    CjkStrokes,
    CjkSymbols,
    CompatJamo,
    ControlPictures,
    Coptic,
    CopticEpactNumbers,
    CountingRod,
    Cuneiform,
    CuneiformNumbers,
    CurrencySymbols,
    CypriotSyllabary,
    Cyrillic,
    CyrillicExtA,
    CyrillicExtB,
    CyrillicExtC,
    CyrillicSup,
    Deseret,
    Devanagari,
    DevanagariExt,
    Diacriticals,
    DiacriticalsExt,
    DiacriticalsForSymbols,
    DiacriticalsSup,
    Dingbats,
    DivesAkuru,
    Dogra,
    Domino,
    Duployan,
    EarlyDynasticCuneiform,
    EgyptianHieroglyphFormatControls,
    EgyptianHieroglyphs,
    Elbasan,
    Elymaic,
    Emoticons,
    EnclosedAlphanum,
    EnclosedAlphanumSup,
    EnclosedCjk,
    EnclosedIdeographicSup,
    Ethiopic,
    EthiopicExt,
    EthiopicExtA,
    EthiopicSup,
    GeometricShapes,
    GeometricShapesExt,
    Georgian,
    GeorgianExt,
    GeorgianSup,
    Glagolitic,
    GlagoliticSup,
    Gothic,
    Grantha,
    Greek,
    GreekExt,
    Gujarati,
    GunjalaGondi,
    Gurmukhi,
    HalfAndFullForms,
    HalfMarks,
    Hangul,
    HanifiRohingya,
    Hanunoo,
    Hatran,
    Hebrew,
    HighPuSurrogates,
    HighSurrogates,
    Hiragana,
    Idc,
    IdeographicSymbols,
    ImperialAramaic,
    IndicNumberForms,
    IndicSiyaqNumbers,
    InscriptionalPahlavi,
    InscriptionalParthian,
    IpaExt,
    Jamo,
    JamoExtA,
    JamoExtB,
    Javanese,
    Kaithi,
    KanaExtA,
    KanaSup,
    Kanbun,
    Kangxi,
    Kannada,
    Katakana,
    KatakanaExt,
    KayahLi,
    Kharoshthi,
    KhitanSmallScript,
    Khmer,
    KhmerSymbols,
    Khojki,
    Khudawadi,
    Lao,
    Latin1Sup,
    LatinExtA,
    LatinExtAdditional,
    LatinExtB,
    LatinExtC,
    LatinExtD,
    LatinExtE,
    Lepcha,
    LetterlikeSymbols,
    Limbu,
    LinearA,
    LinearBIdeograms,
    LinearBSyllabary,
    Lisu,
    LisuSup,
    LowSurrogates,
    Lycian,
    Lydian,
    Mahajani,
    Mahjong,
    Makasar,
    Malayalam,
    Mandaic,
    Manichaean,
    Marchen,
    MasaramGondi,
    MathAlphanum,
    MathOperators,
    MayanNumerals,
    Medefaidrin,
    MeeteiMayek,
    MeeteiMayekExt,
    MendeKikakui,
    MeroiticCursive,
    MeroiticHieroglyphs,
    Miao,
    MiscArrows,
    MiscMathSymbolsA,
    MiscMathSymbolsB,
    MiscPictographs,
    MiscSymbols,
    MiscTechnical,
    Modi,
    ModifierLetters,
    ModifierToneLetters,
    Mongolian,
    MongolianSup,
    Mro,
    Multani,
    Music,
    Myanmar,
    MyanmarExtA,
    MyanmarExtB,
    Nabataean,
    Nandinagari,
    Nb,
    NewTaiLue,
    Newa,
    Nko,
    NumberForms,
    Nushu,
    NyiakengPuachueHmong,
    Ocr,
    Ogham,
    OlChiki,
    OldHungarian,
    OldItalic,
    OldNorthArabian,
    OldPermic,
    OldPersian,
    OldSogdian,
    OldSouthArabian,
    OldTurkic,
    Oriya,
    OrnamentalDingbats,
    Osage,
    Osmanya,
    OttomanSiyaqNumbers,
    PahawhHmong,
    Palmyrene,
    PauCinHau,
    PhagsPa,
    Phaistos,
    Phoenician,
    PhoneticExt,
    PhoneticExtSup,
    PlayingCards,
    PsalterPahlavi,
    Pua,
    Punctuation,
    Rejang,
    Rumi,
    Runic,
    Samaritan,
    Saurashtra,
    Sharada,
    Shavian,
    ShorthandFormatControls,
    Siddham,
    Sinhala,
    SinhalaArchaicNumbers,
    SmallForms,
    SmallKanaExt,
    Sogdian,
    SoraSompeng,
    Soyombo,
    Specials,
    Sundanese,
    SundaneseSup,
    SupArrowsA,
    SupArrowsB,
    SupArrowsC,
    SupMathOperators,
    SupPuaA,
    SupPuaB,
    SupPunctuation,
    SupSymbolsAndPictographs,
    SuperAndSub,
    SuttonSignwriting,
    SylotiNagri,
    SymbolsAndPictographsExtA,
    SymbolsForLegacyComputing,
    Syriac,
    SyriacSup,
    Tagalog,
    Tagbanwa,
    Tags,
    TaiLe,
    TaiTham,
    TaiViet,
    TaiXuanJing,
    Takri,
    Tamil,
    TamilSup,
    Tangut,
    TangutComponents,
    TangutSup,
    Telugu,
    Thaana,
    Thai,
    Tibetan,
    Tifinagh,
    Tirhuta,
    TransportAndMap,
    Ucas,
    UcasExt,
    Ugaritic,
    Vai,
    VedicExt,
    VerticalForms,
    Vs,
    VsSup,
    Wancho,
    WarangCiti,
    Yezidi,
    YiRadicals,
    YiSyllables,
    Yijing,
    ZanabazarSquare,
}

impl UnicodeProperty for Blk {
    fn property_value_name(&self) -> PropertyName {
        property_names::blk_name(*self)
    }
}