811 lines · cpp
1//===---------- Support/UnicodeCaseFold.cpp -------------------------------===//2//3// This file was generated by utils/unicode-case-fold.py from the Unicode4// case folding database at5// http://www.unicode.org/Public/15.1.0/ucd/CaseFolding.txt6//7// To regenerate this file, run:8// utils/unicode-case-fold.py \9// "http://www.unicode.org/Public/15.1.0/ucd/CaseFolding.txt" \10// > lib/Support/UnicodeCaseFold.cpp11//12//===----------------------------------------------------------------------===//13 14#include "llvm/Support/Unicode.h"15 16int llvm::sys::unicode::foldCharSimple(int C) {17 if (C < 0x0041)18 return C;19 // 26 characters20 if (C <= 0x005a)21 return C + 32;22 // MICRO SIGN23 if (C == 0x00b5)24 return 0x03bc;25 if (C < 0x00c0)26 return C;27 // 23 characters28 if (C <= 0x00d6)29 return C + 32;30 if (C < 0x00d8)31 return C;32 // 7 characters33 if (C <= 0x00de)34 return C + 32;35 if (C < 0x0100)36 return C;37 // 24 characters38 if (C <= 0x012e)39 return C | 1;40 if (C < 0x0132)41 return C;42 // 3 characters43 if (C <= 0x0136)44 return C | 1;45 if (C < 0x0139)46 return C;47 // 8 characters48 if (C <= 0x0147 && C % 2 == 1)49 return C + 1;50 if (C < 0x014a)51 return C;52 // 23 characters53 if (C <= 0x0176)54 return C | 1;55 // LATIN CAPITAL LETTER Y WITH DIAERESIS56 if (C == 0x0178)57 return 0x00ff;58 if (C < 0x0179)59 return C;60 // 3 characters61 if (C <= 0x017d && C % 2 == 1)62 return C + 1;63 // LATIN SMALL LETTER LONG S64 if (C == 0x017f)65 return 0x0073;66 // LATIN CAPITAL LETTER B WITH HOOK67 if (C == 0x0181)68 return 0x0253;69 if (C < 0x0182)70 return C;71 // 2 characters72 if (C <= 0x0184)73 return C | 1;74 // LATIN CAPITAL LETTER OPEN O75 if (C == 0x0186)76 return 0x0254;77 // LATIN CAPITAL LETTER C WITH HOOK78 if (C == 0x0187)79 return 0x0188;80 if (C < 0x0189)81 return C;82 // 2 characters83 if (C <= 0x018a)84 return C + 205;85 // LATIN CAPITAL LETTER D WITH TOPBAR86 if (C == 0x018b)87 return 0x018c;88 // LATIN CAPITAL LETTER REVERSED E89 if (C == 0x018e)90 return 0x01dd;91 // LATIN CAPITAL LETTER SCHWA92 if (C == 0x018f)93 return 0x0259;94 // LATIN CAPITAL LETTER OPEN E95 if (C == 0x0190)96 return 0x025b;97 // LATIN CAPITAL LETTER F WITH HOOK98 if (C == 0x0191)99 return 0x0192;100 // LATIN CAPITAL LETTER G WITH HOOK101 if (C == 0x0193)102 return 0x0260;103 // LATIN CAPITAL LETTER GAMMA104 if (C == 0x0194)105 return 0x0263;106 // LATIN CAPITAL LETTER IOTA107 if (C == 0x0196)108 return 0x0269;109 // LATIN CAPITAL LETTER I WITH STROKE110 if (C == 0x0197)111 return 0x0268;112 // LATIN CAPITAL LETTER K WITH HOOK113 if (C == 0x0198)114 return 0x0199;115 // LATIN CAPITAL LETTER TURNED M116 if (C == 0x019c)117 return 0x026f;118 // LATIN CAPITAL LETTER N WITH LEFT HOOK119 if (C == 0x019d)120 return 0x0272;121 // LATIN CAPITAL LETTER O WITH MIDDLE TILDE122 if (C == 0x019f)123 return 0x0275;124 if (C < 0x01a0)125 return C;126 // 3 characters127 if (C <= 0x01a4)128 return C | 1;129 // LATIN LETTER YR130 if (C == 0x01a6)131 return 0x0280;132 // LATIN CAPITAL LETTER TONE TWO133 if (C == 0x01a7)134 return 0x01a8;135 // LATIN CAPITAL LETTER ESH136 if (C == 0x01a9)137 return 0x0283;138 // LATIN CAPITAL LETTER T WITH HOOK139 if (C == 0x01ac)140 return 0x01ad;141 // LATIN CAPITAL LETTER T WITH RETROFLEX HOOK142 if (C == 0x01ae)143 return 0x0288;144 // LATIN CAPITAL LETTER U WITH HORN145 if (C == 0x01af)146 return 0x01b0;147 if (C < 0x01b1)148 return C;149 // 2 characters150 if (C <= 0x01b2)151 return C + 217;152 if (C < 0x01b3)153 return C;154 // 2 characters155 if (C <= 0x01b5 && C % 2 == 1)156 return C + 1;157 // LATIN CAPITAL LETTER EZH158 if (C == 0x01b7)159 return 0x0292;160 if (C < 0x01b8)161 return C;162 // 2 characters163 if (C <= 0x01bc && C % 4 == 0)164 return C + 1;165 // LATIN CAPITAL LETTER DZ WITH CARON166 if (C == 0x01c4)167 return 0x01c6;168 // LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON169 if (C == 0x01c5)170 return 0x01c6;171 // LATIN CAPITAL LETTER LJ172 if (C == 0x01c7)173 return 0x01c9;174 // LATIN CAPITAL LETTER L WITH SMALL LETTER J175 if (C == 0x01c8)176 return 0x01c9;177 // LATIN CAPITAL LETTER NJ178 if (C == 0x01ca)179 return 0x01cc;180 if (C < 0x01cb)181 return C;182 // 9 characters183 if (C <= 0x01db && C % 2 == 1)184 return C + 1;185 if (C < 0x01de)186 return C;187 // 9 characters188 if (C <= 0x01ee)189 return C | 1;190 // LATIN CAPITAL LETTER DZ191 if (C == 0x01f1)192 return 0x01f3;193 if (C < 0x01f2)194 return C;195 // 2 characters196 if (C <= 0x01f4)197 return C | 1;198 // LATIN CAPITAL LETTER HWAIR199 if (C == 0x01f6)200 return 0x0195;201 // LATIN CAPITAL LETTER WYNN202 if (C == 0x01f7)203 return 0x01bf;204 if (C < 0x01f8)205 return C;206 // 20 characters207 if (C <= 0x021e)208 return C | 1;209 // LATIN CAPITAL LETTER N WITH LONG RIGHT LEG210 if (C == 0x0220)211 return 0x019e;212 if (C < 0x0222)213 return C;214 // 9 characters215 if (C <= 0x0232)216 return C | 1;217 // LATIN CAPITAL LETTER A WITH STROKE218 if (C == 0x023a)219 return 0x2c65;220 // LATIN CAPITAL LETTER C WITH STROKE221 if (C == 0x023b)222 return 0x023c;223 // LATIN CAPITAL LETTER L WITH BAR224 if (C == 0x023d)225 return 0x019a;226 // LATIN CAPITAL LETTER T WITH DIAGONAL STROKE227 if (C == 0x023e)228 return 0x2c66;229 // LATIN CAPITAL LETTER GLOTTAL STOP230 if (C == 0x0241)231 return 0x0242;232 // LATIN CAPITAL LETTER B WITH STROKE233 if (C == 0x0243)234 return 0x0180;235 // LATIN CAPITAL LETTER U BAR236 if (C == 0x0244)237 return 0x0289;238 // LATIN CAPITAL LETTER TURNED V239 if (C == 0x0245)240 return 0x028c;241 if (C < 0x0246)242 return C;243 // 5 characters244 if (C <= 0x024e)245 return C | 1;246 // COMBINING GREEK YPOGEGRAMMENI247 if (C == 0x0345)248 return 0x03b9;249 if (C < 0x0370)250 return C;251 // 2 characters252 if (C <= 0x0372)253 return C | 1;254 // GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA255 if (C == 0x0376)256 return 0x0377;257 // GREEK CAPITAL LETTER YOT258 if (C == 0x037f)259 return 0x03f3;260 // GREEK CAPITAL LETTER ALPHA WITH TONOS261 if (C == 0x0386)262 return 0x03ac;263 if (C < 0x0388)264 return C;265 // 3 characters266 if (C <= 0x038a)267 return C + 37;268 // GREEK CAPITAL LETTER OMICRON WITH TONOS269 if (C == 0x038c)270 return 0x03cc;271 if (C < 0x038e)272 return C;273 // 2 characters274 if (C <= 0x038f)275 return C + 63;276 if (C < 0x0391)277 return C;278 // 17 characters279 if (C <= 0x03a1)280 return C + 32;281 if (C < 0x03a3)282 return C;283 // 9 characters284 if (C <= 0x03ab)285 return C + 32;286 // GREEK SMALL LETTER FINAL SIGMA287 if (C == 0x03c2)288 return 0x03c3;289 // GREEK CAPITAL KAI SYMBOL290 if (C == 0x03cf)291 return 0x03d7;292 // GREEK BETA SYMBOL293 if (C == 0x03d0)294 return 0x03b2;295 // GREEK THETA SYMBOL296 if (C == 0x03d1)297 return 0x03b8;298 // GREEK PHI SYMBOL299 if (C == 0x03d5)300 return 0x03c6;301 // GREEK PI SYMBOL302 if (C == 0x03d6)303 return 0x03c0;304 if (C < 0x03d8)305 return C;306 // 12 characters307 if (C <= 0x03ee)308 return C | 1;309 // GREEK KAPPA SYMBOL310 if (C == 0x03f0)311 return 0x03ba;312 // GREEK RHO SYMBOL313 if (C == 0x03f1)314 return 0x03c1;315 // GREEK CAPITAL THETA SYMBOL316 if (C == 0x03f4)317 return 0x03b8;318 // GREEK LUNATE EPSILON SYMBOL319 if (C == 0x03f5)320 return 0x03b5;321 // GREEK CAPITAL LETTER SHO322 if (C == 0x03f7)323 return 0x03f8;324 // GREEK CAPITAL LUNATE SIGMA SYMBOL325 if (C == 0x03f9)326 return 0x03f2;327 // GREEK CAPITAL LETTER SAN328 if (C == 0x03fa)329 return 0x03fb;330 if (C < 0x03fd)331 return C;332 // 3 characters333 if (C <= 0x03ff)334 return C + -130;335 if (C < 0x0400)336 return C;337 // 16 characters338 if (C <= 0x040f)339 return C + 80;340 if (C < 0x0410)341 return C;342 // 32 characters343 if (C <= 0x042f)344 return C + 32;345 if (C < 0x0460)346 return C;347 // 17 characters348 if (C <= 0x0480)349 return C | 1;350 if (C < 0x048a)351 return C;352 // 27 characters353 if (C <= 0x04be)354 return C | 1;355 // CYRILLIC LETTER PALOCHKA356 if (C == 0x04c0)357 return 0x04cf;358 if (C < 0x04c1)359 return C;360 // 7 characters361 if (C <= 0x04cd && C % 2 == 1)362 return C + 1;363 if (C < 0x04d0)364 return C;365 // 48 characters366 if (C <= 0x052e)367 return C | 1;368 if (C < 0x0531)369 return C;370 // 38 characters371 if (C <= 0x0556)372 return C + 48;373 if (C < 0x10a0)374 return C;375 // 38 characters376 if (C <= 0x10c5)377 return C + 7264;378 if (C < 0x10c7)379 return C;380 // 2 characters381 if (C <= 0x10cd && C % 6 == 5)382 return C + 7264;383 if (C < 0x13f8)384 return C;385 // 6 characters386 if (C <= 0x13fd)387 return C + -8;388 // CYRILLIC SMALL LETTER ROUNDED VE389 if (C == 0x1c80)390 return 0x0432;391 // CYRILLIC SMALL LETTER LONG-LEGGED DE392 if (C == 0x1c81)393 return 0x0434;394 // CYRILLIC SMALL LETTER NARROW O395 if (C == 0x1c82)396 return 0x043e;397 if (C < 0x1c83)398 return C;399 // 2 characters400 if (C <= 0x1c84)401 return C + -6210;402 // CYRILLIC SMALL LETTER THREE-LEGGED TE403 if (C == 0x1c85)404 return 0x0442;405 // CYRILLIC SMALL LETTER TALL HARD SIGN406 if (C == 0x1c86)407 return 0x044a;408 // CYRILLIC SMALL LETTER TALL YAT409 if (C == 0x1c87)410 return 0x0463;411 // CYRILLIC SMALL LETTER UNBLENDED UK412 if (C == 0x1c88)413 return 0xa64b;414 if (C < 0x1c90)415 return C;416 // 43 characters417 if (C <= 0x1cba)418 return C + -3008;419 if (C < 0x1cbd)420 return C;421 // 3 characters422 if (C <= 0x1cbf)423 return C + -3008;424 if (C < 0x1e00)425 return C;426 // 75 characters427 if (C <= 0x1e94)428 return C | 1;429 // LATIN SMALL LETTER LONG S WITH DOT ABOVE430 if (C == 0x1e9b)431 return 0x1e61;432 // LATIN CAPITAL LETTER SHARP S433 if (C == 0x1e9e)434 return 0x00df;435 if (C < 0x1ea0)436 return C;437 // 48 characters438 if (C <= 0x1efe)439 return C | 1;440 if (C < 0x1f08)441 return C;442 // 8 characters443 if (C <= 0x1f0f)444 return C + -8;445 if (C < 0x1f18)446 return C;447 // 6 characters448 if (C <= 0x1f1d)449 return C + -8;450 if (C < 0x1f28)451 return C;452 // 8 characters453 if (C <= 0x1f2f)454 return C + -8;455 if (C < 0x1f38)456 return C;457 // 8 characters458 if (C <= 0x1f3f)459 return C + -8;460 if (C < 0x1f48)461 return C;462 // 6 characters463 if (C <= 0x1f4d)464 return C + -8;465 if (C < 0x1f59)466 return C;467 // 4 characters468 if (C <= 0x1f5f && C % 2 == 1)469 return C + -8;470 if (C < 0x1f68)471 return C;472 // 8 characters473 if (C <= 0x1f6f)474 return C + -8;475 if (C < 0x1f88)476 return C;477 // 8 characters478 if (C <= 0x1f8f)479 return C + -8;480 if (C < 0x1f98)481 return C;482 // 8 characters483 if (C <= 0x1f9f)484 return C + -8;485 if (C < 0x1fa8)486 return C;487 // 8 characters488 if (C <= 0x1faf)489 return C + -8;490 if (C < 0x1fb8)491 return C;492 // 2 characters493 if (C <= 0x1fb9)494 return C + -8;495 if (C < 0x1fba)496 return C;497 // 2 characters498 if (C <= 0x1fbb)499 return C + -74;500 // GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI501 if (C == 0x1fbc)502 return 0x1fb3;503 // GREEK PROSGEGRAMMENI504 if (C == 0x1fbe)505 return 0x03b9;506 if (C < 0x1fc8)507 return C;508 // 4 characters509 if (C <= 0x1fcb)510 return C + -86;511 // GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI512 if (C == 0x1fcc)513 return 0x1fc3;514 // GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA515 if (C == 0x1fd3)516 return 0x0390;517 if (C < 0x1fd8)518 return C;519 // 2 characters520 if (C <= 0x1fd9)521 return C + -8;522 if (C < 0x1fda)523 return C;524 // 2 characters525 if (C <= 0x1fdb)526 return C + -100;527 // GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA528 if (C == 0x1fe3)529 return 0x03b0;530 if (C < 0x1fe8)531 return C;532 // 2 characters533 if (C <= 0x1fe9)534 return C + -8;535 if (C < 0x1fea)536 return C;537 // 2 characters538 if (C <= 0x1feb)539 return C + -112;540 // GREEK CAPITAL LETTER RHO WITH DASIA541 if (C == 0x1fec)542 return 0x1fe5;543 if (C < 0x1ff8)544 return C;545 // 2 characters546 if (C <= 0x1ff9)547 return C + -128;548 if (C < 0x1ffa)549 return C;550 // 2 characters551 if (C <= 0x1ffb)552 return C + -126;553 // GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI554 if (C == 0x1ffc)555 return 0x1ff3;556 // OHM SIGN557 if (C == 0x2126)558 return 0x03c9;559 // KELVIN SIGN560 if (C == 0x212a)561 return 0x006b;562 // ANGSTROM SIGN563 if (C == 0x212b)564 return 0x00e5;565 // TURNED CAPITAL F566 if (C == 0x2132)567 return 0x214e;568 if (C < 0x2160)569 return C;570 // 16 characters571 if (C <= 0x216f)572 return C + 16;573 // ROMAN NUMERAL REVERSED ONE HUNDRED574 if (C == 0x2183)575 return 0x2184;576 if (C < 0x24b6)577 return C;578 // 26 characters579 if (C <= 0x24cf)580 return C + 26;581 if (C < 0x2c00)582 return C;583 // 48 characters584 if (C <= 0x2c2f)585 return C + 48;586 // LATIN CAPITAL LETTER L WITH DOUBLE BAR587 if (C == 0x2c60)588 return 0x2c61;589 // LATIN CAPITAL LETTER L WITH MIDDLE TILDE590 if (C == 0x2c62)591 return 0x026b;592 // LATIN CAPITAL LETTER P WITH STROKE593 if (C == 0x2c63)594 return 0x1d7d;595 // LATIN CAPITAL LETTER R WITH TAIL596 if (C == 0x2c64)597 return 0x027d;598 if (C < 0x2c67)599 return C;600 // 3 characters601 if (C <= 0x2c6b && C % 2 == 1)602 return C + 1;603 // LATIN CAPITAL LETTER ALPHA604 if (C == 0x2c6d)605 return 0x0251;606 // LATIN CAPITAL LETTER M WITH HOOK607 if (C == 0x2c6e)608 return 0x0271;609 // LATIN CAPITAL LETTER TURNED A610 if (C == 0x2c6f)611 return 0x0250;612 // LATIN CAPITAL LETTER TURNED ALPHA613 if (C == 0x2c70)614 return 0x0252;615 if (C < 0x2c72)616 return C;617 // 2 characters618 if (C <= 0x2c75 && C % 3 == 2)619 return C + 1;620 if (C < 0x2c7e)621 return C;622 // 2 characters623 if (C <= 0x2c7f)624 return C + -10815;625 if (C < 0x2c80)626 return C;627 // 50 characters628 if (C <= 0x2ce2)629 return C | 1;630 if (C < 0x2ceb)631 return C;632 // 2 characters633 if (C <= 0x2ced && C % 2 == 1)634 return C + 1;635 if (C < 0x2cf2)636 return C;637 // 2 characters638 if (C <= 0xa640 && C % 31054 == 11506)639 return C + 1;640 if (C < 0xa642)641 return C;642 // 22 characters643 if (C <= 0xa66c)644 return C | 1;645 if (C < 0xa680)646 return C;647 // 14 characters648 if (C <= 0xa69a)649 return C | 1;650 if (C < 0xa722)651 return C;652 // 7 characters653 if (C <= 0xa72e)654 return C | 1;655 if (C < 0xa732)656 return C;657 // 31 characters658 if (C <= 0xa76e)659 return C | 1;660 if (C < 0xa779)661 return C;662 // 2 characters663 if (C <= 0xa77b && C % 2 == 1)664 return C + 1;665 // LATIN CAPITAL LETTER INSULAR G666 if (C == 0xa77d)667 return 0x1d79;668 if (C < 0xa77e)669 return C;670 // 5 characters671 if (C <= 0xa786)672 return C | 1;673 // LATIN CAPITAL LETTER SALTILLO674 if (C == 0xa78b)675 return 0xa78c;676 // LATIN CAPITAL LETTER TURNED H677 if (C == 0xa78d)678 return 0x0265;679 if (C < 0xa790)680 return C;681 // 2 characters682 if (C <= 0xa792)683 return C | 1;684 if (C < 0xa796)685 return C;686 // 10 characters687 if (C <= 0xa7a8)688 return C | 1;689 // LATIN CAPITAL LETTER H WITH HOOK690 if (C == 0xa7aa)691 return 0x0266;692 // LATIN CAPITAL LETTER REVERSED OPEN E693 if (C == 0xa7ab)694 return 0x025c;695 // LATIN CAPITAL LETTER SCRIPT G696 if (C == 0xa7ac)697 return 0x0261;698 // LATIN CAPITAL LETTER L WITH BELT699 if (C == 0xa7ad)700 return 0x026c;701 // LATIN CAPITAL LETTER SMALL CAPITAL I702 if (C == 0xa7ae)703 return 0x026a;704 // LATIN CAPITAL LETTER TURNED K705 if (C == 0xa7b0)706 return 0x029e;707 // LATIN CAPITAL LETTER TURNED T708 if (C == 0xa7b1)709 return 0x0287;710 // LATIN CAPITAL LETTER J WITH CROSSED-TAIL711 if (C == 0xa7b2)712 return 0x029d;713 // LATIN CAPITAL LETTER CHI714 if (C == 0xa7b3)715 return 0xab53;716 if (C < 0xa7b4)717 return C;718 // 8 characters719 if (C <= 0xa7c2)720 return C | 1;721 // LATIN CAPITAL LETTER C WITH PALATAL HOOK722 if (C == 0xa7c4)723 return 0xa794;724 // LATIN CAPITAL LETTER S WITH HOOK725 if (C == 0xa7c5)726 return 0x0282;727 // LATIN CAPITAL LETTER Z WITH PALATAL HOOK728 if (C == 0xa7c6)729 return 0x1d8e;730 if (C < 0xa7c7)731 return C;732 // 2 characters733 if (C <= 0xa7c9 && C % 2 == 1)734 return C + 1;735 if (C < 0xa7d0)736 return C;737 // 2 characters738 if (C <= 0xa7d6 && C % 6 == 0)739 return C + 1;740 if (C < 0xa7d8)741 return C;742 // 2 characters743 if (C <= 0xa7f5 && C % 29 == 19)744 return C + 1;745 if (C < 0xab70)746 return C;747 // 80 characters748 if (C <= 0xabbf)749 return C + -38864;750 // LATIN SMALL LIGATURE LONG S T751 if (C == 0xfb05)752 return 0xfb06;753 if (C < 0xff21)754 return C;755 // 26 characters756 if (C <= 0xff3a)757 return C + 32;758 if (C < 0x10400)759 return C;760 // 40 characters761 if (C <= 0x10427)762 return C + 40;763 if (C < 0x104b0)764 return C;765 // 36 characters766 if (C <= 0x104d3)767 return C + 40;768 if (C < 0x10570)769 return C;770 // 11 characters771 if (C <= 0x1057a)772 return C + 39;773 if (C < 0x1057c)774 return C;775 // 15 characters776 if (C <= 0x1058a)777 return C + 39;778 if (C < 0x1058c)779 return C;780 // 7 characters781 if (C <= 0x10592)782 return C + 39;783 if (C < 0x10594)784 return C;785 // 2 characters786 if (C <= 0x10595)787 return C + 39;788 if (C < 0x10c80)789 return C;790 // 51 characters791 if (C <= 0x10cb2)792 return C + 64;793 if (C < 0x118a0)794 return C;795 // 32 characters796 if (C <= 0x118bf)797 return C + 32;798 if (C < 0x16e40)799 return C;800 // 32 characters801 if (C <= 0x16e5f)802 return C + 32;803 if (C < 0x1e900)804 return C;805 // 34 characters806 if (C <= 0x1e921)807 return C + 34;808 809 return C;810}811