2022-12-26 20:40:53 +00:00
|
|
|
|
const INPUT = `
|
2022-12-26 20:38:51 +00:00
|
|
|
|
/* A */
|
|
|
|
|
{ (u32)0xc0 /* À */ , (u32)'A' },
|
|
|
|
|
{ (u32)0xc1 /* Á */ , (u32)'A' },
|
|
|
|
|
{ (u32)0xc2 /* Â */ , (u32)'A' },
|
|
|
|
|
{ (u32)0xc3 /* Ã */ , (u32)'A' },
|
|
|
|
|
{ (u32)0xc4 /* Ä */ , (u32)'A' },
|
|
|
|
|
{ (u32)0xc5 /* Å */ , (u32)'A' },
|
|
|
|
|
{ (u32)0x100 /* Ā */ , (u32)'A' },
|
|
|
|
|
{ (u32)0x102 /* Ă */ , (u32)'A' },
|
|
|
|
|
{ (u32)0x104 /* Ą */ , (u32)'A' },
|
|
|
|
|
/* C */
|
|
|
|
|
{ (u32)0xc7 /* Ç */ , (u32)'C' },
|
|
|
|
|
{ (u32)0x106 /* Ć */ , (u32)'C' },
|
|
|
|
|
{ (u32)0x108 /* Ĉ */ , (u32)'C' },
|
|
|
|
|
{ (u32)0x10a /* Ċ */ , (u32)'C' },
|
|
|
|
|
{ (u32)0x10c /* Č */ , (u32)'C' },
|
|
|
|
|
/* D */
|
|
|
|
|
{ (u32)0x10e /* Ď */ , (u32)'D' },
|
|
|
|
|
{ (u32)0x110 /* Đ */ , (u32)'D' },
|
|
|
|
|
/* E */
|
|
|
|
|
{ (u32)0xc8 /* È */ , (u32)'E' },
|
|
|
|
|
{ (u32)0xc9 /* É */ , (u32)'E' },
|
|
|
|
|
{ (u32)0xca /* Ê */ , (u32)'E' },
|
|
|
|
|
{ (u32)0xcb /* Ë */ , (u32)'E' },
|
|
|
|
|
{ (u32)0x112 /* Ē */ , (u32)'E' },
|
|
|
|
|
{ (u32)0x114 /* Ĕ */ , (u32)'E' },
|
|
|
|
|
{ (u32)0x116 /* Ė */ , (u32)'E' },
|
|
|
|
|
{ (u32)0x118 /* Ę */ , (u32)'E' },
|
|
|
|
|
{ (u32)0x11a /* Ě */ , (u32)'E' },
|
|
|
|
|
/* G */
|
|
|
|
|
{ (u32)0x11c /* Ĝ */ , (u32)'G' },
|
|
|
|
|
{ (u32)0x11e /* Ğ */ , (u32)'G' },
|
|
|
|
|
{ (u32)0x120 /* Ġ */ , (u32)'G' },
|
|
|
|
|
{ (u32)0x122 /* Ģ */ , (u32)'G' },
|
|
|
|
|
/* H */
|
|
|
|
|
{ (u32)0x124 /* Ĥ */ , (u32)'H' },
|
|
|
|
|
{ (u32)0x126 /* Ħ */ , (u32)'H' },
|
|
|
|
|
/* I */
|
|
|
|
|
{ (u32)0xcc /* Ì */ , (u32)'I' },
|
|
|
|
|
{ (u32)0xcd /* Í */ , (u32)'I' },
|
|
|
|
|
{ (u32)0xce /* Î */ , (u32)'I' },
|
|
|
|
|
{ (u32)0xcf /* Ï */ , (u32)'I' },
|
|
|
|
|
{ (u32)0x128 /* Ĩ */ , (u32)'I' },
|
|
|
|
|
{ (u32)0x12a /* Ī */ , (u32)'I' },
|
|
|
|
|
{ (u32)0x12c /* Ĭ */ , (u32)'I' },
|
|
|
|
|
{ (u32)0x12e /* Į */ , (u32)'I' },
|
|
|
|
|
{ (u32)0x130 /* İ */ , (u32)'I' },
|
|
|
|
|
/* J */
|
|
|
|
|
{ (u32)0x134 /* Ĵ */ , (u32)'J' },
|
|
|
|
|
/* K */
|
|
|
|
|
{ (u32)0x136 /* Ķ */ , (u32)'K' },
|
|
|
|
|
/* L */
|
|
|
|
|
{ (u32)0x139 /* Ĺ */ , (u32)'L' },
|
|
|
|
|
{ (u32)0x13b /* Ļ */ , (u32)'L' },
|
|
|
|
|
{ (u32)0x13d /* Ľ */ , (u32)'L' },
|
|
|
|
|
{ (u32)0x13f /* Ŀ */ , (u32)'L' },
|
|
|
|
|
{ (u32)0x141 /* Ł */ , (u32)'L' },
|
|
|
|
|
/* N */
|
|
|
|
|
{ (u32)0xd1 /* Ñ */ , (u32)'N' },
|
|
|
|
|
{ (u32)0x143 /* Ń */ , (u32)'N' },
|
|
|
|
|
{ (u32)0x145 /* Ņ */ , (u32)'N' },
|
|
|
|
|
{ (u32)0x147 /* Ň */ , (u32)'N' },
|
|
|
|
|
{ (u32)0x149 /* ʼn */ , (u32)'N' },
|
|
|
|
|
{ (u32)0x14b /* ŋ */ , (u32)'N' },
|
|
|
|
|
/* O */
|
|
|
|
|
{ (u32)0xd2 /* Ò */ , (u32)'O' },
|
|
|
|
|
{ (u32)0xd3 /* Ó */ , (u32)'O' },
|
|
|
|
|
{ (u32)0xd4 /* Ô */ , (u32)'O' },
|
|
|
|
|
{ (u32)0xd5 /* Õ */ , (u32)'O' },
|
|
|
|
|
{ (u32)0xd6 /* Ö */ , (u32)'O' },
|
|
|
|
|
{ (u32)0x14c /* Ō */ , (u32)'O' },
|
|
|
|
|
{ (u32)0x14e /* Ŏ */ , (u32)'O' },
|
|
|
|
|
{ (u32)0x150 /* Ő */ , (u32)'O' },
|
|
|
|
|
/* R */
|
|
|
|
|
{ (u32)0x154 /* Ŕ */ , (u32)'R' },
|
|
|
|
|
{ (u32)0x156 /* Ŗ */ , (u32)'R' },
|
|
|
|
|
{ (u32)0x158 /* Ř */ , (u32)'R' },
|
|
|
|
|
/* S */
|
|
|
|
|
{ (u32)0x15a /* Ś */ , (u32)'S' },
|
|
|
|
|
{ (u32)0x15c /* Ŝ */ , (u32)'S' },
|
|
|
|
|
{ (u32)0x15e /* Ş */ , (u32)'S' },
|
|
|
|
|
{ (u32)0x160 /* Š */ , (u32)'S' },
|
|
|
|
|
/* T */
|
|
|
|
|
{ (u32)0x162 /* Ţ */ , (u32)'T' },
|
|
|
|
|
{ (u32)0x164 /* Ť */ , (u32)'T' },
|
|
|
|
|
{ (u32)0x166 /* Ŧ */ , (u32)'T' },
|
|
|
|
|
/* U */
|
|
|
|
|
{ (u32)0xd9 /* Ù */ , (u32)'U' },
|
|
|
|
|
{ (u32)0xda /* Ú */ , (u32)'U' },
|
|
|
|
|
{ (u32)0xdb /* Û */ , (u32)'U' },
|
|
|
|
|
{ (u32)0xdc /* Ü */ , (u32)'U' },
|
|
|
|
|
{ (u32)0x168 /* Ũ */ , (u32)'U' },
|
|
|
|
|
{ (u32)0x16a /* Ū */ , (u32)'U' },
|
|
|
|
|
{ (u32)0x16c /* Ŭ */ , (u32)'U' },
|
|
|
|
|
{ (u32)0x16e /* Ů */ , (u32)'U' },
|
|
|
|
|
{ (u32)0x170 /* Ű */ , (u32)'U' },
|
|
|
|
|
{ (u32)0x172 /* Ų */ , (u32)'U' },
|
|
|
|
|
/* W */
|
|
|
|
|
{ (u32)0x174 /* Ŵ */ , (u32)'W' },
|
|
|
|
|
/* Y */
|
|
|
|
|
{ (u32)0xdd /* Ý */ , (u32)'Y' },
|
|
|
|
|
{ (u32)0x176 /* Ŷ */ , (u32)'Y' },
|
|
|
|
|
{ (u32)0x178 /* Ÿ */ , (u32)'Y' },
|
|
|
|
|
/* S */
|
|
|
|
|
{ (u32)0xdf /* ß */ , (u32)'s' },
|
|
|
|
|
/* Z */
|
|
|
|
|
{ (u32)0x179 /* Ź */ , (u32)'Z' },
|
|
|
|
|
{ (u32)0x17b /* Ż */ , (u32)'Z' },
|
|
|
|
|
{ (u32)0x17d /* Ž */ , (u32)'Z' },
|
|
|
|
|
/* a */
|
|
|
|
|
{ (u32)0xe0 /* à */ , (u32)'a' },
|
|
|
|
|
{ (u32)0xe1 /* á */ , (u32)'a' },
|
|
|
|
|
{ (u32)0xe2 /* â */ , (u32)'a' },
|
|
|
|
|
{ (u32)0xe3 /* ã */ , (u32)'a' },
|
|
|
|
|
{ (u32)0xe4 /* ä */ , (u32)'a' },
|
|
|
|
|
{ (u32)0xe5 /* å */ , (u32)'a' },
|
|
|
|
|
{ (u32)0x101 /* ā */ , (u32)'a' },
|
|
|
|
|
{ (u32)0x103 /* ă */ , (u32)'a' },
|
|
|
|
|
{ (u32)0x105 /* ą */ , (u32)'a' },
|
|
|
|
|
/* c */
|
|
|
|
|
{ (u32)0xe7 /* ç */ , (u32)'c' },
|
|
|
|
|
{ (u32)0x107 /* ć */ , (u32)'c' },
|
|
|
|
|
{ (u32)0x109 /* ĉ */ , (u32)'c' },
|
|
|
|
|
{ (u32)0x10b /* ċ */ , (u32)'c' },
|
|
|
|
|
{ (u32)0x10d /* č */ , (u32)'c' },
|
|
|
|
|
/* d */
|
|
|
|
|
{ (u32)0x10f /* ď */ , (u32)'d' },
|
|
|
|
|
{ (u32)0x111 /* đ */ , (u32)'d' },
|
|
|
|
|
/* e */
|
|
|
|
|
{ (u32)0xe8 /* è */ , (u32)'e' },
|
|
|
|
|
{ (u32)0xe9 /* é */ , (u32)'e' },
|
|
|
|
|
{ (u32)0xea /* ê */ , (u32)'e' },
|
|
|
|
|
{ (u32)0xeb /* ë */ , (u32)'e' },
|
|
|
|
|
{ (u32)0x113 /* ē */ , (u32)'e' },
|
|
|
|
|
{ (u32)0x115 /* ĕ */ , (u32)'e' },
|
|
|
|
|
{ (u32)0x117 /* ė */ , (u32)'e' },
|
|
|
|
|
{ (u32)0x119 /* ę */ , (u32)'e' },
|
|
|
|
|
{ (u32)0x11b /* ě */ , (u32)'e' },
|
|
|
|
|
/* g */
|
|
|
|
|
{ (u32)0x11d /* ĝ */ , (u32)'g' },
|
|
|
|
|
{ (u32)0x11f /* ğ */ , (u32)'g' },
|
|
|
|
|
{ (u32)0x121 /* ġ */ , (u32)'g' },
|
|
|
|
|
{ (u32)0x123 /* ģ */ , (u32)'g' },
|
|
|
|
|
/* h */
|
|
|
|
|
{ (u32)0x125 /* ĥ */ , (u32)'h' },
|
|
|
|
|
{ (u32)0x127 /* ħ */ , (u32)'h' },
|
|
|
|
|
/* i */
|
|
|
|
|
{ (u32)0xec /* ì */ , (u32)'i' },
|
|
|
|
|
{ (u32)0xed /* í */ , (u32)'i' },
|
|
|
|
|
{ (u32)0xee /* î */ , (u32)'i' },
|
|
|
|
|
{ (u32)0xef /* ï */ , (u32)'i' },
|
|
|
|
|
{ (u32)0x129 /* ĩ */ , (u32)'i' },
|
|
|
|
|
{ (u32)0x12b /* ī */ , (u32)'i' },
|
|
|
|
|
{ (u32)0x12d /* ĭ */ , (u32)'i' },
|
|
|
|
|
{ (u32)0x12f /* į */ , (u32)'i' },
|
|
|
|
|
{ (u32)0x131 /* ı */ , (u32)'i' },
|
|
|
|
|
/* j */
|
|
|
|
|
{ (u32)0x135 /* ĵ */ , (u32)'j' },
|
|
|
|
|
/* k */
|
|
|
|
|
{ (u32)0x137 /* ķ */ , (u32)'k' },
|
|
|
|
|
{ (u32)0x138 /* ĸ */ , (u32)'k' },
|
|
|
|
|
/* l */
|
|
|
|
|
{ (u32)0x13a /* ĺ */ , (u32)'l' },
|
|
|
|
|
{ (u32)0x13c /* ļ */ , (u32)'l' },
|
|
|
|
|
{ (u32)0x13e /* ľ */ , (u32)'l' },
|
|
|
|
|
{ (u32)0x140 /* ŀ */ , (u32)'l' },
|
|
|
|
|
{ (u32)0x142 /* ł */ , (u32)'l' },
|
|
|
|
|
/* n */
|
|
|
|
|
{ (u32)0xf1 /* ñ */ , (u32)'n' },
|
|
|
|
|
{ (u32)0x144 /* ń */ , (u32)'n' },
|
|
|
|
|
{ (u32)0x146 /* ņ */ , (u32)'n' },
|
|
|
|
|
{ (u32)0x148 /* ň */ , (u32)'n' },
|
|
|
|
|
{ (u32)0x14a /* Ŋ */ , (u32)'n' },
|
|
|
|
|
/* o */
|
|
|
|
|
{ (u32)0xf2 /* ò */ , (u32)'o' },
|
|
|
|
|
{ (u32)0xf3 /* ó */ , (u32)'o' },
|
|
|
|
|
{ (u32)0xf4 /* ô */ , (u32)'o' },
|
|
|
|
|
{ (u32)0xf5 /* õ */ , (u32)'o' },
|
|
|
|
|
{ (u32)0xf6 /* ö */ , (u32)'o' },
|
|
|
|
|
{ (u32)0xf9 /* ù */ , (u32)'u' },
|
|
|
|
|
{ (u32)0xfa /* ú */ , (u32)'u' },
|
|
|
|
|
{ (u32)0xfb /* û */ , (u32)'u' },
|
|
|
|
|
{ (u32)0xfc /* ü */ , (u32)'u' },
|
|
|
|
|
{ (u32)0x14d /* ō */ , (u32)'o' },
|
|
|
|
|
{ (u32)0x14f /* ŏ */ , (u32)'o' },
|
|
|
|
|
{ (u32)0x151 /* ő */ , (u32)'o' },
|
|
|
|
|
/* r */
|
|
|
|
|
{ (u32)0x155 /* ŕ */ , (u32)'r' },
|
|
|
|
|
{ (u32)0x157 /* ŗ */ , (u32)'r' },
|
|
|
|
|
{ (u32)0x159 /* ř */ , (u32)'r' },
|
|
|
|
|
/* s */
|
|
|
|
|
{ (u32)0x15b /* ś */ , (u32)'s' },
|
|
|
|
|
{ (u32)0x15d /* ŝ */ , (u32)'s' },
|
|
|
|
|
{ (u32)0x15f /* ş */ , (u32)'s' },
|
|
|
|
|
{ (u32)0x161 /* š */ , (u32)'s' },
|
|
|
|
|
{ (u32)0x17f /* ſ */ , (u32)'s' },
|
|
|
|
|
/* t */
|
|
|
|
|
{ (u32)0x163 /* ţ */ , (u32)'t' },
|
|
|
|
|
{ (u32)0x165 /* ť */ , (u32)'t' },
|
|
|
|
|
{ (u32)0x167 /* ŧ */ , (u32)'t' },
|
|
|
|
|
/* u */
|
|
|
|
|
{ (u32)0x169 /* ũ */ , (u32)'u' },
|
|
|
|
|
{ (u32)0x16b /* ū */ , (u32)'u' },
|
|
|
|
|
{ (u32)0x16d /* ŭ */ , (u32)'u' },
|
|
|
|
|
{ (u32)0x16f /* ů */ , (u32)'u' },
|
|
|
|
|
{ (u32)0x171 /* ű */ , (u32)'u' },
|
|
|
|
|
{ (u32)0x173 /* ų */ , (u32)'u' },
|
|
|
|
|
/* w */
|
|
|
|
|
{ (u32)0x175 /* ŵ */ , (u32)'w' },
|
|
|
|
|
/* y */
|
|
|
|
|
{ (u32)0xfd /* ý */ , (u32)'y' },
|
|
|
|
|
{ (u32)0xff /* ÿ */ , (u32)'y' },
|
|
|
|
|
{ (u32)0x177 /* ŷ */ , (u32)'y' },
|
|
|
|
|
/* z */
|
|
|
|
|
{ (u32)0x17a /* ź */ , (u32)'z' },
|
|
|
|
|
{ (u32)0x17c /* ż */ , (u32)'z' },
|
|
|
|
|
{ (u32)0x17e /* ž */ , (u32)'z' },
|
2022-12-26 20:40:53 +00:00
|
|
|
|
`;
|
2022-12-26 20:38:51 +00:00
|
|
|
|
|
|
|
|
|
let result = {};
|
|
|
|
|
let current = { ch: '', values: [] };
|
|
|
|
|
|
2022-12-26 20:40:53 +00:00
|
|
|
|
INPUT.split('\n').forEach((line) => {
|
|
|
|
|
if (line.startsWith(' /* ')) {
|
2022-12-26 20:38:51 +00:00
|
|
|
|
if (current.ch) {
|
|
|
|
|
const existing = result[current.ch] || [];
|
|
|
|
|
result[current.ch] = [...existing, ...current.values];
|
|
|
|
|
}
|
2022-12-26 20:40:53 +00:00
|
|
|
|
ch = line.split('/* ')[1].split(' ')[0];
|
2022-12-26 20:38:51 +00:00
|
|
|
|
const existing = result[ch] || [];
|
2022-12-26 20:40:53 +00:00
|
|
|
|
current = { ch, values: existing };
|
|
|
|
|
} else if (line.startsWith(' { (u32)0x')) {
|
|
|
|
|
const parts = line.split(' { (u32)0x');
|
|
|
|
|
const ch = parts[1].split('/* ')[1].split(' */')[0];
|
2022-12-26 20:38:51 +00:00
|
|
|
|
current.values.push(ch);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
console.log('-------- case sensitive mapping --------');
|
|
|
|
|
|
|
|
|
|
const sensitive = [];
|
2022-12-26 20:40:53 +00:00
|
|
|
|
Object.keys(result).forEach((k) => {
|
2022-12-26 20:38:51 +00:00
|
|
|
|
const values = `"${k}${result[k].join('')}"`;
|
2022-12-26 20:40:53 +00:00
|
|
|
|
const line = ` { (u32)'${k}', u8${values} },`;
|
2022-12-26 20:38:51 +00:00
|
|
|
|
sensitive.push(line);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
console.log(sensitive.join('\n'));
|
|
|
|
|
|
|
|
|
|
console.log('---------- case insensitive mapping ----------');
|
|
|
|
|
|
|
|
|
|
const insensitive = [];
|
2022-12-26 20:40:53 +00:00
|
|
|
|
Object.keys(result).forEach((k) => {
|
2022-12-26 20:38:51 +00:00
|
|
|
|
const l = k.toLowerCase();
|
|
|
|
|
const u = k.toUpperCase();
|
|
|
|
|
const lower = `${(result[l] || []).join('')}`;
|
|
|
|
|
const upper = `${(result[u] || []).join('')}`;
|
|
|
|
|
const line = ` { (u32)'${l}', u8"${u}${l}${lower}${upper}" },`;
|
|
|
|
|
insensitive.push(line);
|
|
|
|
|
});
|
|
|
|
|
|
2022-12-26 20:40:53 +00:00
|
|
|
|
console.log(insensitive.join('\n'));
|