unicode

Branch: main

Switch branches or tags

Branch: main
Go to file t

413 files indexed

History
Code

ucd/case_mapping/case_mapping.mbt
1///|2/// Case mapping lookup data3/// Generated from UnicodeData.txt and SpecialCasing.txt45///|6/// Case mapping trie top level: `cp >> 8` to mid block index7let case_trie_top : Bytes = [8  0, 1, 2, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 6, 8, 6, 6, 6, 6, 6, 6, 6,9  6, 9, 10, 11, 12, 6, 13, 6, 6, 14, 6, 6, 6, 6, 6, 6, 6, 15, 16, 6, 6, 6, 6, 6,10  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,11  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,12  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,13  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,14  6, 6, 6, 6, 6, 6, 6, 17, 18, 6, 6, 6, 19, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,15  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,16  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,17  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 20, 6, 6, 6, 21, 6, 6, 6, 6, 22, 23, 6, 6,18  6, 6, 6, 6, 24, 25, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 26, 6, 6, 6, 6, 6, 6, 6, 6, 6,19  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,20  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,21  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 27, 6, 6, 6,22  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,23  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,24  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,25  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,26  6, 28, 6, 6, 6, 6, 6, 6, 6, 6, 6, 29, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,27  6, 6, 6, 6, 6, 6, 6, 6,28]2930///|31/// Case mapping trie mid level: leaf block indices32let case_trie_mid : Bytes = [33  0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 5, 6, 7, 8, 9, 10, 10, 10, 11, 12, 10, 10, 13,34  14, 15, 16, 17, 18, 19, 10, 20, 10, 10, 21, 22, 23, 24, 25, 26, 27, 28, 0, 0, 0,35  0, 0, 0, 0, 0, 0, 0, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 10, 37, 38, 6, 6, 8,36  8, 39, 10, 10, 40, 10, 10, 10, 41, 10, 10, 10, 10, 10, 10, 42, 43, 44, 45, 46,37  47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,38  0, 0, 0, 0, 0, 0, 0, 0, 48, 48, 49, 50, 50, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52,39  52, 52, 52, 52, 53, 0, 0, 0, 0, 0, 0, 0, 0, 54, 55, 55, 56, 0, 0, 0, 0, 0, 0, 0,40  0, 0, 0, 0, 57, 58, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 59,41  10, 10, 10, 10, 10, 10, 60, 61, 60, 60, 61, 62, 60, 63, 64, 64, 64, 65, 66, 67,42  68, 69, 0, 0, 70, 71, 72, 0, 73, 74, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43  0, 0, 0, 0, 0, 76, 77, 78, 79, 0, 43, 43, 43, 46, 46, 46, 80, 81, 10, 10, 10, 10,44  10, 10, 82, 83, 84, 84, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,45  10, 10, 86, 0, 10, 87, 0, 0, 0, 0, 0, 0, 0, 0, 88, 88, 10, 10, 10, 89, 90, 91,46  92, 93, 94, 95, 96, 97, 0, 0, 0, 0, 98, 99, 100, 101, 101, 101, 101, 101, 0, 0,47  0, 0, 102, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0,48  0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 104, 105, 106, 106, 0, 0, 0, 0, 0, 0, 104, 104,49  107, 106, 108, 0, 0, 0, 0, 0, 0, 0, 109, 109, 110, 111, 112, 0, 0, 0, 0, 0, 0,50  0, 0, 0, 0, 0, 0, 113, 113, 113, 114, 115, 115, 115, 116, 0, 0, 0, 0, 0, 6, 117,51  8, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 8, 8, 0, 0, 0,52  0, 0, 0, 6, 6, 8, 8, 0, 0, 119, 120, 121, 122, 0, 0, 0, 0, 0, 0, 123, 124, 125,53  88, 0, 126, 0, 0, 0, 0, 0, 0, 127, 127, 128, 129, 130, 0, 0, 0, 0, 0, 0, 0, 0,54  0, 0, 0,55]5657///|58/// Case mapping trie leaf level: record indices in blocks of 1659let case_trie_leaf : Bytes = [60  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,61  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,62  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,63  0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,64  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 4, 2, 2, 2, 2, 2, 2, 2,65  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 5, 6, 7,66  6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 8, 9, 6, 7, 6, 7, 6, 7, 0, 6, 7, 6, 7,67  6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 4, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7,68  10, 6, 7, 6, 7, 6, 7, 11, 12, 13, 6, 7, 6, 7, 14, 6, 7, 15, 15, 6, 7, 0, 16, 17,69  18, 6, 7, 15, 19, 20, 21, 22, 6, 7, 23, 24, 21, 25, 26, 27, 6, 7, 6, 7, 6, 7, 28,70  6, 7, 28, 0, 0, 6, 7, 28, 6, 7, 29, 29, 6, 7, 6, 7, 30, 6, 7, 0, 0, 6, 7, 0, 31,71  0, 0, 0, 0, 32, 33, 34, 32, 33, 34, 32, 33, 34, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6,72  7, 6, 7, 6, 7, 35, 6, 7, 4, 32, 33, 34, 6, 7, 36, 37, 6, 7, 6, 7, 6, 7, 6, 7, 38,73  0, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 0, 0, 0, 0, 0, 0, 39,74  6, 7, 40, 41, 42, 42, 6, 7, 43, 44, 45, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 46, 47, 48,75  49, 50, 0, 51, 51, 0, 52, 0, 53, 54, 0, 0, 0, 51, 55, 0, 56, 57, 58, 59, 0, 60,76  61, 59, 62, 63, 0, 0, 61, 0, 64, 65, 0, 0, 66, 0, 67, 0, 0, 0, 0, 67, 68, 0, 0,77  69, 0, 70, 69, 0, 0, 0, 71, 69, 72, 73, 73, 74, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0,78  0, 0, 0, 0, 0, 0, 76, 77, 0, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,79  7, 6, 7, 0, 0, 6, 7, 0, 0, 0, 26, 26, 26, 0, 79, 0, 0, 0, 0, 0, 0, 80, 0, 81, 81,80  81, 0, 82, 0, 83, 83, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,81  1, 1, 1, 1, 1, 1, 1, 1, 1, 84, 85, 85, 85, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,82  2, 2, 2, 2, 2, 2, 86, 2, 2, 2, 2, 2, 2, 2, 2, 2, 87, 88, 88, 89, 90, 91, 0, 0,83  0, 92, 93, 94, 6, 7, 6, 7, 6, 7, 6, 7, 95, 96, 97, 98, 99, 100, 0, 6, 7, 101, 6,84  7, 0, 38, 38, 38, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,85  102, 102, 102, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,86  6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 6, 7, 6, 7, 103, 6, 7, 6, 7, 6, 7, 6, 7, 6,87  7, 6, 7, 6, 7, 104, 0, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,88  105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,89  105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,90  106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,91  106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,92  106, 106, 106, 106, 106, 106, 4, 0, 0, 0, 0, 0, 0, 0, 0, 107, 107, 107, 107, 107,93  107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,94  107, 0, 107, 0, 0, 0, 0, 0, 107, 0, 0, 108, 108, 108, 108, 108, 108, 108, 108,95  108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,96  108, 108, 108, 0, 0, 108, 108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 109,97  109, 109, 109, 109, 109, 109, 109, 89, 89, 89, 89, 89, 89, 0, 0, 94, 94, 94, 94,98  94, 94, 0, 0, 110, 111, 112, 113, 113, 114, 115, 116, 117, 6, 7, 0, 0, 0, 0, 0,99  118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,100  118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 0, 0, 118, 118, 118, 0,101  0, 0, 0, 0, 0, 0, 0, 0, 119, 0, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,102  0, 0, 0, 0, 121, 0, 6, 7, 6, 7, 6, 7, 4, 4, 4, 4, 4, 122, 0, 0, 123, 0, 124, 124,103  124, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124,104  124, 124, 124, 124, 0, 0, 125, 125, 125, 125, 125, 125, 0, 0, 4, 124, 4, 124, 4,105  124, 4, 124, 0, 125, 0, 125, 0, 125, 0, 125, 126, 126, 127, 127, 127, 127, 128,106  128, 129, 129, 130, 130, 131, 131, 0, 0, 132, 132, 132, 132, 132, 132, 132, 132,107  133, 133, 133, 133, 133, 133, 133, 133, 124, 124, 4, 134, 4, 0, 4, 4, 125, 125,108  135, 135, 136, 0, 137, 0, 0, 0, 4, 134, 4, 0, 4, 4, 138, 138, 138, 138, 136, 0,109  0, 0, 124, 124, 4, 4, 0, 0, 4, 4, 125, 125, 139, 139, 0, 0, 0, 0, 124, 124, 4,110  4, 4, 97, 4, 4, 125, 125, 140, 140, 101, 0, 0, 0, 0, 0, 4, 134, 4, 0, 4, 4, 141,111  141, 142, 142, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 0, 0, 0, 144, 145, 0, 0, 0,112  0, 0, 0, 146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,113  0, 0, 0, 0, 0, 147, 0, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,114  148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,115  149, 149, 149, 149, 0, 0, 0, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,116  0, 0, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,117  150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151,118  151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,119  151, 151, 151, 151, 151, 0, 0, 0, 0, 0, 0, 6, 7, 152, 153, 154, 155, 156, 6, 7,120  6, 7, 6, 7, 157, 158, 159, 160, 0, 6, 7, 0, 6, 7, 0, 0, 0, 0, 0, 0, 0, 161, 161,121  6, 7, 6, 7, 0, 0, 0, 0, 0, 0, 0, 6, 7, 6, 7, 0, 0, 0, 6, 7, 0, 0, 0, 0, 0, 0, 0,122  0, 0, 0, 0, 0, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,123  162, 162, 162, 162, 162, 162, 162, 162, 162, 0, 162, 0, 0, 0, 0, 0, 162, 0, 0,124  6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 0, 0, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6,125  7, 0, 0, 0, 0, 0, 0, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 0, 0, 0, 0, 0, 0,126  0, 0, 0, 6, 7, 6, 7, 163, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 0, 0, 0, 6, 7, 164, 0,127  0, 6, 7, 6, 7, 165, 0, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6,128  7, 166, 167, 168, 169, 166, 0, 170, 171, 172, 173, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7,129  6, 7, 6, 7, 6, 7, 174, 175, 176, 6, 7, 6, 7, 177, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7,130  6, 7, 6, 7, 6, 7, 178, 179, 0, 0, 0, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,131  0, 0, 0, 0, 0, 0, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,132  0, 180, 180, 0, 0, 0, 0, 0, 0, 181, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,133  0, 0, 0, 0, 0, 0, 0, 0, 0, 182, 182, 0, 0, 183, 183, 183, 183, 183, 183, 183, 183,134  183, 183, 183, 183, 183, 183, 183, 183, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0,135  0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 184, 184, 184, 184, 184,136  184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,137  184, 184, 184, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,138  185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 184, 184, 184, 184, 0, 0,139  0, 0, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,140  185, 185, 185, 185, 185, 0, 0, 0, 0, 186, 186, 186, 186, 186, 186, 186, 186, 186,141  186, 186, 0, 186, 186, 186, 186, 186, 186, 186, 0, 186, 186, 0, 187, 187, 187,142  187, 187, 187, 187, 187, 187, 187, 187, 0, 187, 187, 187, 187, 187, 187, 187, 187,143  187, 187, 187, 187, 187, 187, 187, 0, 187, 187, 187, 187, 187, 187, 187, 0, 187,144  187, 0, 0, 0, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,145  82, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 87, 87, 87, 87, 87, 87, 87,146  87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,147  0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,148  0, 0, 0, 0, 0, 0, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,149  188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 0, 0, 189, 189, 189,150  189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,151  189, 189, 189, 189, 189, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 0, 0, 0,152  0, 0, 0, 6, 7, 6, 7, 0, 6, 7, 0, 0, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,153  0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 6, 7, 6, 7, 6, 7, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0,154  0, 0, 0, 0, 0, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,155  190, 190, 190, 190, 190, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191,156  191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191,157  191, 191, 191, 191, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,158]159160///|161/// Simple uppercase mapping of each record as `target - code point`162let case_upper_deltas : ReadOnlyArray[Int32] = [163  0, 0, -32, 743, 0, 121, 0, -1, 0, -232, 0, -300, 195, 0, 0, 0, 0, 0, 0, 0, 97,164  0, 0, 163, 42561, 0, 130, 0, 0, 0, 0, 56, 0, -1, -2, -79, 0, 0, 0, 0, 0, 0, 10815,165  0, 0, 0, 10783, 10780, 10782, -210, -206, -205, -202, -203, 42319, 42315, -207,166  42343, 42280, 42308, -209, -211, 10743, 42305, 10749, -213, -214, 42342, 10727,167  -218, 42307, 42282, -69, -217, -71, -219, 42261, 42258, 84, 0, 0, 0, 0, 0, -38,168  -37, -31, -64, -63, 0, -62, -57, -47, -54, -8, -86, -80, 7, -116, 0, -96, 0, 0,169  0, -15, 0, -48, 0, 3008, 0, -6254, -6253, -6244, -6242, -6243, -6236, -6181, 35266,170  0, 35332, 3814, 35384, -59, 0, 8, 0, 74, 86, 100, 128, 112, 126, 8, 0, 9, 0, 0,171  -7205, 0, 0, 0, 0, 0, 0, 0, 0, 0, -28, 0, -16, 0, -26, 0, 0, 0, -10795, -10792,172  0, 0, 0, 0, 0, -7264, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, -928,173  0, -38864, 0, -40, 0, -39, 0, -27, 0, -34,174]175176///|177/// Simple lowercase mapping of each record as `target - code point`178let case_lower_deltas : ReadOnlyArray[Int32] = [179  0, 32, 0, 0, 0, 0, 1, 0, -199, 0, -121, 0, 0, 210, 206, 205, 79, 202, 203, 207,180  0, 211, 209, 0, 0, 213, 0, 214, 218, 217, 219, 0, 2, 1, 0, 0, -97, -56, -130, 10795,181  -163, 10792, 0, -195, 69, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,182  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 116, 38, 37, 64, 63, 0, 0, 0, 0,183  0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, -60, 0, -7, 80, 15, 0, 48, 0, 7264, 0, 38864,184  0, 0, 0, 0, 0, 0, 0, 0, -3008, 0, 0, 0, 0, -7615, 0, -8, 0, 0, 0, 0, 0, 0, 0, -8,185  0, -74, -9, 0, -86, -100, -112, -128, -126, -7517, -8383, -8262, 28, 0, 16, 0,186  26, 0, -10743, -3814, -10727, 0, 0, -10780, -10749, -10783, -10782, -10815, 0,187  -35332, -42280, 0, -42308, -42319, -42315, -42305, -42258, -42282, -42261, 928,188  -48, -42307, -35384, -42343, -42561, -42342, 0, 0, -33, 0, 40, 0, 39, 0, 27, 0,189  34, 0,190]191192///|193/// Simple titlecase mapping of each record as `target - code point`194let case_title_deltas : ReadOnlyArray[Int32] = [195  0, 0, -32, 743, 0, 121, 0, -1, 0, -232, 0, -300, 195, 0, 0, 0, 0, 0, 0, 0, 97,196  0, 0, 163, 42561, 0, 130, 0, 0, 0, 0, 56, 1, 0, -1, -79, 0, 0, 0, 0, 0, 0, 10815,197  0, 0, 0, 10783, 10780, 10782, -210, -206, -205, -202, -203, 42319, 42315, -207,198  42343, 42280, 42308, -209, -211, 10743, 42305, 10749, -213, -214, 42342, 10727,199  -218, 42307, 42282, -69, -217, -71, -219, 42261, 42258, 84, 0, 0, 0, 0, 0, -38,200  -37, -31, -64, -63, 0, -62, -57, -47, -54, -8, -86, -80, 7, -116, 0, -96, 0, 0,201  0, -15, 0, -48, 0, 0, 0, -6254, -6253, -6244, -6242, -6243, -6236, -6181, 35266,202  0, 35332, 3814, 35384, -59, 0, 8, 0, 74, 86, 100, 128, 112, 126, 8, 0, 9, 0, 0,203  -7205, 0, 0, 0, 0, 0, 0, 0, 0, 0, -28, 0, -16, 0, -26, 0, 0, 0, -10795, -10792,204  0, 0, 0, 0, 0, -7264, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, -928,205  0, -38864, 0, -40, 0, -39, 0, -27, 0, -34,206]207208///|209/// Special full mappings of each record: bit 0 upper, bit 1 lower, bit 2 title210let case_special_flags : Bytes = [211  0, 0, 0, 0, 5, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,212  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,213  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,214  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,215  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,216  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,217  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,218  0, 0, 0,219]220221///|222/// Code points whose full uppercase mapping is not their simple one (sorted for binary search)223let special_upper_cps : ReadOnlyArray[Int32] = [224  0x00DF, 0x0149, 0x01F0, 0x0390, 0x03B0, 0x0587, 0x1E96, 0x1E97, 0x1E98, 0x1E99,225  0x1E9A, 0x1F50, 0x1F52, 0x1F54, 0x1F56, 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84,226  0x1F85, 0x1F86, 0x1F87, 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E,227  0x1F8F, 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97, 0x1F98,228  0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F, 0x1FA0, 0x1FA1, 0x1FA2,229  0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7, 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC,230  0x1FAD, 0x1FAE, 0x1FAF, 0x1FB2, 0x1FB3, 0x1FB4, 0x1FB6, 0x1FB7, 0x1FBC, 0x1FC2,231  0x1FC3, 0x1FC4, 0x1FC6, 0x1FC7, 0x1FCC, 0x1FD2, 0x1FD3, 0x1FD6, 0x1FD7, 0x1FE2,232  0x1FE3, 0x1FE4, 0x1FE6, 0x1FE7, 0x1FF2, 0x1FF3, 0x1FF4, 0x1FF6, 0x1FF7, 0x1FFC,233  0xFB00, 0xFB01, 0xFB02, 0xFB03, 0xFB04, 0xFB05, 0xFB06, 0xFB13, 0xFB14, 0xFB15,234  0xFB16, 0xFB17, 0x1DF95,235]236237///|238/// Full uppercase mapping of each such code point239let special_upper_strings : ReadOnlyArray[String] = [240  "\u{0053}\u{0053}", "\u{02BC}\u{004E}", "\u{004A}\u{030C}", "\u{0399}\u{0308}\u{0301}",241  "\u{03A5}\u{0308}\u{0301}", "\u{0535}\u{0552}", "\u{0048}\u{0331}", "\u{0054}\u{0308}",242  "\u{0057}\u{030A}", "\u{0059}\u{030A}", "\u{0041}\u{02BE}", "\u{03A5}\u{0313}",243  "\u{03A5}\u{0313}\u{0300}", "\u{03A5}\u{0313}\u{0301}", "\u{03A5}\u{0313}\u{0342}",244  "\u{1F08}\u{0399}", "\u{1F09}\u{0399}", "\u{1F0A}\u{0399}", "\u{1F0B}\u{0399}",245  "\u{1F0C}\u{0399}", "\u{1F0D}\u{0399}", "\u{1F0E}\u{0399}", "\u{1F0F}\u{0399}",246  "\u{1F08}\u{0399}", "\u{1F09}\u{0399}", "\u{1F0A}\u{0399}", "\u{1F0B}\u{0399}",247  "\u{1F0C}\u{0399}", "\u{1F0D}\u{0399}", "\u{1F0E}\u{0399}", "\u{1F0F}\u{0399}",248  "\u{1F28}\u{0399}", "\u{1F29}\u{0399}", "\u{1F2A}\u{0399}", "\u{1F2B}\u{0399}",249  "\u{1F2C}\u{0399}", "\u{1F2D}\u{0399}", "\u{1F2E}\u{0399}", "\u{1F2F}\u{0399}",250  "\u{1F28}\u{0399}", "\u{1F29}\u{0399}", "\u{1F2A}\u{0399}", "\u{1F2B}\u{0399}",251  "\u{1F2C}\u{0399}", "\u{1F2D}\u{0399}", "\u{1F2E}\u{0399}", "\u{1F2F}\u{0399}",252  "\u{1F68}\u{0399}", "\u{1F69}\u{0399}", "\u{1F6A}\u{0399}", "\u{1F6B}\u{0399}",253  "\u{1F6C}\u{0399}", "\u{1F6D}\u{0399}", "\u{1F6E}\u{0399}", "\u{1F6F}\u{0399}",254  "\u{1F68}\u{0399}", "\u{1F69}\u{0399}", "\u{1F6A}\u{0399}", "\u{1F6B}\u{0399}",255  "\u{1F6C}\u{0399}", "\u{1F6D}\u{0399}", "\u{1F6E}\u{0399}", "\u{1F6F}\u{0399}",256  "\u{1FBA}\u{0399}", "\u{0391}\u{0399}", "\u{0386}\u{0399}", "\u{0391}\u{0342}",257  "\u{0391}\u{0342}\u{0399}", "\u{0391}\u{0399}", "\u{1FCA}\u{0399}", "\u{0397}\u{0399}",258  "\u{0389}\u{0399}", "\u{0397}\u{0342}", "\u{0397}\u{0342}\u{0399}", "\u{0397}\u{0399}",259  "\u{0399}\u{0308}\u{0300}", "\u{0399}\u{0308}\u{0301}", "\u{0399}\u{0342}", "\u{0399}\u{0308}\u{0342}",260  "\u{03A5}\u{0308}\u{0300}", "\u{03A5}\u{0308}\u{0301}", "\u{03A1}\u{0313}", "\u{03A5}\u{0342}",261  "\u{03A5}\u{0308}\u{0342}", "\u{1FFA}\u{0399}", "\u{03A9}\u{0399}", "\u{038F}\u{0399}",262  "\u{03A9}\u{0342}", "\u{03A9}\u{0342}\u{0399}", "\u{03A9}\u{0399}", "\u{0046}\u{0046}",263  "\u{0046}\u{0049}", "\u{0046}\u{004C}", "\u{0046}\u{0046}\u{0049}", "\u{0046}\u{0046}\u{004C}",264  "\u{0053}\u{0054}", "\u{0053}\u{0054}", "\u{0544}\u{0546}", "\u{0544}\u{0535}",265  "\u{0544}\u{053B}", "\u{054E}\u{0546}", "\u{0544}\u{053D}", "\u{0053}\u{0053}",266]267268///|269/// Code points whose full lowercase mapping is not their simple one (sorted for binary search)270let special_lower_cps : ReadOnlyArray[Int32] = [0x0130]271272///|273/// Full lowercase mapping of each such code point274let special_lower_strings : ReadOnlyArray[String] = ["\u{0069}\u{0307}"]275276///|277/// Code points whose full titlecase mapping is not their simple one (sorted for binary search)278let special_title_cps : ReadOnlyArray[Int32] = [279  0x00DF, 0x0149, 0x01F0, 0x0390, 0x03B0, 0x0587, 0x1E96, 0x1E97, 0x1E98, 0x1E99,280  0x1E9A, 0x1F50, 0x1F52, 0x1F54, 0x1F56, 0x1FB2, 0x1FB4, 0x1FB6, 0x1FB7, 0x1FC2,281  0x1FC4, 0x1FC6, 0x1FC7, 0x1FD2, 0x1FD3, 0x1FD6, 0x1FD7, 0x1FE2, 0x1FE3, 0x1FE4,282  0x1FE6, 0x1FE7, 0x1FF2, 0x1FF4, 0x1FF6, 0x1FF7, 0xFB00, 0xFB01, 0xFB02, 0xFB03,283  0xFB04, 0xFB05, 0xFB06, 0xFB13, 0xFB14, 0xFB15, 0xFB16, 0xFB17, 0x1DF95,284]285286///|287/// Full titlecase mapping of each such code point288let special_title_strings : ReadOnlyArray[String] = [289  "\u{0053}\u{0073}", "\u{02BC}\u{004E}", "\u{004A}\u{030C}", "\u{0399}\u{0308}\u{0301}",290  "\u{03A5}\u{0308}\u{0301}", "\u{0535}\u{0582}", "\u{0048}\u{0331}", "\u{0054}\u{0308}",291  "\u{0057}\u{030A}", "\u{0059}\u{030A}", "\u{0041}\u{02BE}", "\u{03A5}\u{0313}",292  "\u{03A5}\u{0313}\u{0300}", "\u{03A5}\u{0313}\u{0301}", "\u{03A5}\u{0313}\u{0342}",293  "\u{1FBA}\u{0345}", "\u{0386}\u{0345}", "\u{0391}\u{0342}", "\u{0391}\u{0342}\u{0345}",294  "\u{1FCA}\u{0345}", "\u{0389}\u{0345}", "\u{0397}\u{0342}", "\u{0397}\u{0342}\u{0345}",295  "\u{0399}\u{0308}\u{0300}", "\u{0399}\u{0308}\u{0301}", "\u{0399}\u{0342}", "\u{0399}\u{0308}\u{0342}",296  "\u{03A5}\u{0308}\u{0300}", "\u{03A5}\u{0308}\u{0301}", "\u{03A1}\u{0313}", "\u{03A5}\u{0342}",297  "\u{03A5}\u{0308}\u{0342}", "\u{1FFA}\u{0345}", "\u{038F}\u{0345}", "\u{03A9}\u{0342}",298  "\u{03A9}\u{0342}\u{0345}", "\u{0046}\u{0066}", "\u{0046}\u{0069}", "\u{0046}\u{006C}",299  "\u{0046}\u{0066}\u{0069}", "\u{0046}\u{0066}\u{006C}", "\u{0053}\u{0074}", "\u{0053}\u{0074}",300  "\u{0544}\u{0576}", "\u{0544}\u{0565}", "\u{0544}\u{056B}", "\u{054E}\u{0576}",301  "\u{0544}\u{056D}", "\u{0053}\u{0073}",302]303304///|305/// One-character strings of the ASCII characters, so that mapping to one allocates nothing306let ascii_strings : ReadOnlyArray[String] = [307  "\u{0000}", "\u{0001}", "\u{0002}", "\u{0003}", "\u{0004}", "\u{0005}", "\u{0006}",308  "\u{0007}", "\u{0008}", "\u{0009}", "\u{000A}", "\u{000B}", "\u{000C}", "\u{000D}",309  "\u{000E}", "\u{000F}", "\u{0010}", "\u{0011}", "\u{0012}", "\u{0013}", "\u{0014}",310  "\u{0015}", "\u{0016}", "\u{0017}", "\u{0018}", "\u{0019}", "\u{001A}", "\u{001B}",311  "\u{001C}", "\u{001D}", "\u{001E}", "\u{001F}", "\u{0020}", "\u{0021}", "\u{0022}",312  "\u{0023}", "\u{0024}", "\u{0025}", "\u{0026}", "\u{0027}", "\u{0028}", "\u{0029}",313  "\u{002A}", "\u{002B}", "\u{002C}", "\u{002D}", "\u{002E}", "\u{002F}", "\u{0030}",314  "\u{0031}", "\u{0032}", "\u{0033}", "\u{0034}", "\u{0035}", "\u{0036}", "\u{0037}",315  "\u{0038}", "\u{0039}", "\u{003A}", "\u{003B}", "\u{003C}", "\u{003D}", "\u{003E}",316  "\u{003F}", "\u{0040}", "\u{0041}", "\u{0042}", "\u{0043}", "\u{0044}", "\u{0045}",317  "\u{0046}", "\u{0047}", "\u{0048}", "\u{0049}", "\u{004A}", "\u{004B}", "\u{004C}",318  "\u{004D}", "\u{004E}", "\u{004F}", "\u{0050}", "\u{0051}", "\u{0052}", "\u{0053}",319  "\u{0054}", "\u{0055}", "\u{0056}", "\u{0057}", "\u{0058}", "\u{0059}", "\u{005A}",320  "\u{005B}", "\u{005C}", "\u{005D}", "\u{005E}", "\u{005F}", "\u{0060}", "\u{0061}",321  "\u{0062}", "\u{0063}", "\u{0064}", "\u{0065}", "\u{0066}", "\u{0067}", "\u{0068}",322  "\u{0069}", "\u{006A}", "\u{006B}", "\u{006C}", "\u{006D}", "\u{006E}", "\u{006F}",323  "\u{0070}", "\u{0071}", "\u{0072}", "\u{0073}", "\u{0074}", "\u{0075}", "\u{0076}",324  "\u{0077}", "\u{0078}", "\u{0079}", "\u{007A}", "\u{007B}", "\u{007C}", "\u{007D}",325  "\u{007E}", "\u{007F}",326]327328///|329/// Index of the record holding a character's case mappings330fn lookup_case_record(c : Char) -> Int32 {331  let cp = c.to_int()332  if cp >= 0x20000 {333    return 0334  }335  let mid = (case_trie_top[cp >> 8].to_int() << 4) | ((cp >> 4) & 15)336  let leaf = case_trie_mid[mid].to_int()337  case_trie_leaf[(leaf << 4) | (cp & 15)].to_int()338}339340///|341/// Look up simple uppercase mapping for a character342/// Returns the character itself if no mapping exists343pub fn lookup_simple_uppercase(c : Char) -> Char {344  (c.to_int() + case_upper_deltas[lookup_case_record(c)]).unsafe_to_char()345}346347///|348/// Full uppercase mapping of a character as a string349/// Returns the character itself if no mapping exists350pub fn full_uppercase(c : Char) -> String {351  let record = lookup_case_record(c)352  if (case_special_flags[record].to_int() & 1) != 0 {353    let index = find_special_upper(c.to_int())354    if index >= 0 {355      return special_upper_strings[index]356    }357  }358  let target = c.to_int() + case_upper_deltas[record]359  if target < 0x80 {360    ascii_strings[target]361  } else {362    target.unsafe_to_char().to_string()363  }364}365366///|367/// Look up full uppercase mapping for a character368/// Returns Some(array of chars) if a mapping exists, None otherwise369pub fn lookup_full_uppercase(c : Char) -> Array[Char]? {370  let record = lookup_case_record(c)371  if (case_special_flags[record].to_int() & 1) != 0 {372    let index = find_special_upper(c.to_int())373    if index >= 0 {374      return Some(special_upper_strings[index].to_array())375    }376  }377  let delta = case_upper_deltas[record]378  if delta == 0 {379    None380  } else {381    Some([(c.to_int() + delta).unsafe_to_char()])382  }383}384385///|386/// Index of `key` in the sorted array `special_upper_cps`, or -1 if it is absent.387fn find_special_upper(key : Int32) -> Int32 {388  let mut left = 0389  let mut right = special_upper_cps.length() - 1390  while left <= right {391    let mid = (left + right) / 2392    let value = special_upper_cps[mid]393    if key < value {394      right = mid - 1395    } else if key > value {396      left = mid + 1397    } else {398      return mid399    }400  }401  -1402}403404///|405/// Look up simple lowercase mapping for a character406/// Returns the character itself if no mapping exists407pub fn lookup_simple_lowercase(c : Char) -> Char {408  (c.to_int() + case_lower_deltas[lookup_case_record(c)]).unsafe_to_char()409}410411///|412/// Full lowercase mapping of a character as a string413/// Returns the character itself if no mapping exists414pub fn full_lowercase(c : Char) -> String {415  let record = lookup_case_record(c)416  if (case_special_flags[record].to_int() & 2) != 0 {417    let index = find_special_lower(c.to_int())418    if index >= 0 {419      return special_lower_strings[index]420    }421  }422  let target = c.to_int() + case_lower_deltas[record]423  if target < 0x80 {424    ascii_strings[target]425  } else {426    target.unsafe_to_char().to_string()427  }428}429430///|431/// Look up full lowercase mapping for a character432/// Returns Some(array of chars) if a mapping exists, None otherwise433pub fn lookup_full_lowercase(c : Char) -> Array[Char]? {434  let record = lookup_case_record(c)435  if (case_special_flags[record].to_int() & 2) != 0 {436    let index = find_special_lower(c.to_int())437    if index >= 0 {438      return Some(special_lower_strings[index].to_array())439    }440  }441  let delta = case_lower_deltas[record]442  if delta == 0 {443    None444  } else {445    Some([(c.to_int() + delta).unsafe_to_char()])446  }447}448449///|450/// Index of `key` in the sorted array `special_lower_cps`, or -1 if it is absent.451fn find_special_lower(key : Int32) -> Int32 {452  let mut left = 0453  let mut right = special_lower_cps.length() - 1454  while left <= right {455    let mid = (left + right) / 2456    let value = special_lower_cps[mid]457    if key < value {458      right = mid - 1459    } else if key > value {460      left = mid + 1461    } else {462      return mid463    }464  }465  -1466}467468///|469/// Look up simple titlecase mapping for a character470/// Returns the character itself if no mapping exists471pub fn lookup_simple_titlecase(c : Char) -> Char {472  (c.to_int() + case_title_deltas[lookup_case_record(c)]).unsafe_to_char()473}474475///|476/// Full titlecase mapping of a character as a string477/// Returns the character itself if no mapping exists478pub fn full_titlecase(c : Char) -> String {479  let record = lookup_case_record(c)480  if (case_special_flags[record].to_int() & 4) != 0 {481    let index = find_special_title(c.to_int())482    if index >= 0 {483      return special_title_strings[index]484    }485  }486  let target = c.to_int() + case_title_deltas[record]487  if target < 0x80 {488    ascii_strings[target]489  } else {490    target.unsafe_to_char().to_string()491  }492}493494///|495/// Look up full titlecase mapping for a character496/// Returns Some(array of chars) if a mapping exists, None otherwise497pub fn lookup_full_titlecase(c : Char) -> Array[Char]? {498  let record = lookup_case_record(c)499  if (case_special_flags[record].to_int() & 4) != 0 {500    let index = find_special_title(c.to_int())501    if index >= 0 {502      return Some(special_title_strings[index].to_array())503    }504  }505  let delta = case_title_deltas[record]506  if delta == 0 {507    None508  } else {509    Some([(c.to_int() + delta).unsafe_to_char()])510  }511}512513///|514/// Index of `key` in the sorted array `special_title_cps`, or -1 if it is absent.515fn find_special_title(key : Int32) -> Int32 {516  let mut left = 0517  let mut right = special_title_cps.length() - 1518  while left <= right {519    let mid = (left + right) / 2520    let value = special_title_cps[mid]521    if key < value {522      right = mid - 1523    } else if key > value {524      left = mid + 1525    } else {526      return mid527    }528  }529  -1530}531