code-points.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996
  1. 'use strict';
  2. const { range } = require('./util');
  3. /**
  4. * A.1 Unassigned code points in Unicode 3.2
  5. * @link https://tools.ietf.org/html/rfc3454#appendix-A.1
  6. */
  7. const unassigned_code_points = new Set([
  8. 0x0221,
  9. ...range(0x0234, 0x024f),
  10. ...range(0x02ae, 0x02af),
  11. ...range(0x02ef, 0x02ff),
  12. ...range(0x0350, 0x035f),
  13. ...range(0x0370, 0x0373),
  14. ...range(0x0376, 0x0379),
  15. ...range(0x037b, 0x037d),
  16. ...range(0x037f, 0x0383),
  17. 0x038b,
  18. 0x038d,
  19. 0x03a2,
  20. 0x03cf,
  21. ...range(0x03f7, 0x03ff),
  22. 0x0487,
  23. 0x04cf,
  24. ...range(0x04f6, 0x04f7),
  25. ...range(0x04fa, 0x04ff),
  26. ...range(0x0510, 0x0530),
  27. ...range(0x0557, 0x0558),
  28. 0x0560,
  29. 0x0588,
  30. ...range(0x058b, 0x0590),
  31. 0x05a2,
  32. 0x05ba,
  33. ...range(0x05c5, 0x05cf),
  34. ...range(0x05eb, 0x05ef),
  35. ...range(0x05f5, 0x060b),
  36. ...range(0x060d, 0x061a),
  37. ...range(0x061c, 0x061e),
  38. 0x0620,
  39. ...range(0x063b, 0x063f),
  40. ...range(0x0656, 0x065f),
  41. ...range(0x06ee, 0x06ef),
  42. 0x06ff,
  43. 0x070e,
  44. ...range(0x072d, 0x072f),
  45. ...range(0x074b, 0x077f),
  46. ...range(0x07b2, 0x0900),
  47. 0x0904,
  48. ...range(0x093a, 0x093b),
  49. ...range(0x094e, 0x094f),
  50. ...range(0x0955, 0x0957),
  51. ...range(0x0971, 0x0980),
  52. 0x0984,
  53. ...range(0x098d, 0x098e),
  54. ...range(0x0991, 0x0992),
  55. 0x09a9,
  56. 0x09b1,
  57. ...range(0x09b3, 0x09b5),
  58. ...range(0x09ba, 0x09bb),
  59. 0x09bd,
  60. ...range(0x09c5, 0x09c6),
  61. ...range(0x09c9, 0x09ca),
  62. ...range(0x09ce, 0x09d6),
  63. ...range(0x09d8, 0x09db),
  64. 0x09de,
  65. ...range(0x09e4, 0x09e5),
  66. ...range(0x09fb, 0x0a01),
  67. ...range(0x0a03, 0x0a04),
  68. ...range(0x0a0b, 0x0a0e),
  69. ...range(0x0a11, 0x0a12),
  70. 0x0a29,
  71. 0x0a31,
  72. 0x0a34,
  73. 0x0a37,
  74. ...range(0x0a3a, 0x0a3b),
  75. 0x0a3d,
  76. ...range(0x0a43, 0x0a46),
  77. ...range(0x0a49, 0x0a4a),
  78. ...range(0x0a4e, 0x0a58),
  79. 0x0a5d,
  80. ...range(0x0a5f, 0x0a65),
  81. ...range(0x0a75, 0x0a80),
  82. 0x0a84,
  83. 0x0a8c,
  84. 0x0a8e,
  85. 0x0a92,
  86. 0x0aa9,
  87. 0x0ab1,
  88. 0x0ab4,
  89. ...range(0x0aba, 0x0abb),
  90. 0x0ac6,
  91. 0x0aca,
  92. ...range(0x0ace, 0x0acf),
  93. ...range(0x0ad1, 0x0adf),
  94. ...range(0x0ae1, 0x0ae5),
  95. ...range(0x0af0, 0x0b00),
  96. 0x0b04,
  97. ...range(0x0b0d, 0x0b0e),
  98. ...range(0x0b11, 0x0b12),
  99. 0x0b29,
  100. 0x0b31,
  101. ...range(0x0b34, 0x0b35),
  102. ...range(0x0b3a, 0x0b3b),
  103. ...range(0x0b44, 0x0b46),
  104. ...range(0x0b49, 0x0b4a),
  105. ...range(0x0b4e, 0x0b55),
  106. ...range(0x0b58, 0x0b5b),
  107. 0x0b5e,
  108. ...range(0x0b62, 0x0b65),
  109. ...range(0x0b71, 0x0b81),
  110. 0x0b84,
  111. ...range(0x0b8b, 0x0b8d),
  112. 0x0b91,
  113. ...range(0x0b96, 0x0b98),
  114. 0x0b9b,
  115. 0x0b9d,
  116. ...range(0x0ba0, 0x0ba2),
  117. ...range(0x0ba5, 0x0ba7),
  118. ...range(0x0bab, 0x0bad),
  119. 0x0bb6,
  120. ...range(0x0bba, 0x0bbd),
  121. ...range(0x0bc3, 0x0bc5),
  122. 0x0bc9,
  123. ...range(0x0bce, 0x0bd6),
  124. ...range(0x0bd8, 0x0be6),
  125. ...range(0x0bf3, 0x0c00),
  126. 0x0c04,
  127. 0x0c0d,
  128. 0x0c11,
  129. 0x0c29,
  130. 0x0c34,
  131. ...range(0x0c3a, 0x0c3d),
  132. 0x0c45,
  133. 0x0c49,
  134. ...range(0x0c4e, 0x0c54),
  135. ...range(0x0c57, 0x0c5f),
  136. ...range(0x0c62, 0x0c65),
  137. ...range(0x0c70, 0x0c81),
  138. 0x0c84,
  139. 0x0c8d,
  140. 0x0c91,
  141. 0x0ca9,
  142. 0x0cb4,
  143. ...range(0x0cba, 0x0cbd),
  144. 0x0cc5,
  145. 0x0cc9,
  146. ...range(0x0cce, 0x0cd4),
  147. ...range(0x0cd7, 0x0cdd),
  148. 0x0cdf,
  149. ...range(0x0ce2, 0x0ce5),
  150. ...range(0x0cf0, 0x0d01),
  151. 0x0d04,
  152. 0x0d0d,
  153. 0x0d11,
  154. 0x0d29,
  155. ...range(0x0d3a, 0x0d3d),
  156. ...range(0x0d44, 0x0d45),
  157. 0x0d49,
  158. ...range(0x0d4e, 0x0d56),
  159. ...range(0x0d58, 0x0d5f),
  160. ...range(0x0d62, 0x0d65),
  161. ...range(0x0d70, 0x0d81),
  162. 0x0d84,
  163. ...range(0x0d97, 0x0d99),
  164. 0x0db2,
  165. 0x0dbc,
  166. ...range(0x0dbe, 0x0dbf),
  167. ...range(0x0dc7, 0x0dc9),
  168. ...range(0x0dcb, 0x0dce),
  169. 0x0dd5,
  170. 0x0dd7,
  171. ...range(0x0de0, 0x0df1),
  172. ...range(0x0df5, 0x0e00),
  173. ...range(0x0e3b, 0x0e3e),
  174. ...range(0x0e5c, 0x0e80),
  175. 0x0e83,
  176. ...range(0x0e85, 0x0e86),
  177. 0x0e89,
  178. ...range(0x0e8b, 0x0e8c),
  179. ...range(0x0e8e, 0x0e93),
  180. 0x0e98,
  181. 0x0ea0,
  182. 0x0ea4,
  183. 0x0ea6,
  184. ...range(0x0ea8, 0x0ea9),
  185. 0x0eac,
  186. 0x0eba,
  187. ...range(0x0ebe, 0x0ebf),
  188. 0x0ec5,
  189. 0x0ec7,
  190. ...range(0x0ece, 0x0ecf),
  191. ...range(0x0eda, 0x0edb),
  192. ...range(0x0ede, 0x0eff),
  193. 0x0f48,
  194. ...range(0x0f6b, 0x0f70),
  195. ...range(0x0f8c, 0x0f8f),
  196. 0x0f98,
  197. 0x0fbd,
  198. ...range(0x0fcd, 0x0fce),
  199. ...range(0x0fd0, 0x0fff),
  200. 0x1022,
  201. 0x1028,
  202. 0x102b,
  203. ...range(0x1033, 0x1035),
  204. ...range(0x103a, 0x103f),
  205. ...range(0x105a, 0x109f),
  206. ...range(0x10c6, 0x10cf),
  207. ...range(0x10f9, 0x10fa),
  208. ...range(0x10fc, 0x10ff),
  209. ...range(0x115a, 0x115e),
  210. ...range(0x11a3, 0x11a7),
  211. ...range(0x11fa, 0x11ff),
  212. 0x1207,
  213. 0x1247,
  214. 0x1249,
  215. ...range(0x124e, 0x124f),
  216. 0x1257,
  217. 0x1259,
  218. ...range(0x125e, 0x125f),
  219. 0x1287,
  220. 0x1289,
  221. ...range(0x128e, 0x128f),
  222. 0x12af,
  223. 0x12b1,
  224. ...range(0x12b6, 0x12b7),
  225. 0x12bf,
  226. 0x12c1,
  227. ...range(0x12c6, 0x12c7),
  228. 0x12cf,
  229. 0x12d7,
  230. 0x12ef,
  231. 0x130f,
  232. 0x1311,
  233. ...range(0x1316, 0x1317),
  234. 0x131f,
  235. 0x1347,
  236. ...range(0x135b, 0x1360),
  237. ...range(0x137d, 0x139f),
  238. ...range(0x13f5, 0x1400),
  239. ...range(0x1677, 0x167f),
  240. ...range(0x169d, 0x169f),
  241. ...range(0x16f1, 0x16ff),
  242. 0x170d,
  243. ...range(0x1715, 0x171f),
  244. ...range(0x1737, 0x173f),
  245. ...range(0x1754, 0x175f),
  246. 0x176d,
  247. 0x1771,
  248. ...range(0x1774, 0x177f),
  249. ...range(0x17dd, 0x17df),
  250. ...range(0x17ea, 0x17ff),
  251. 0x180f,
  252. ...range(0x181a, 0x181f),
  253. ...range(0x1878, 0x187f),
  254. ...range(0x18aa, 0x1dff),
  255. ...range(0x1e9c, 0x1e9f),
  256. ...range(0x1efa, 0x1eff),
  257. ...range(0x1f16, 0x1f17),
  258. ...range(0x1f1e, 0x1f1f),
  259. ...range(0x1f46, 0x1f47),
  260. ...range(0x1f4e, 0x1f4f),
  261. 0x1f58,
  262. 0x1f5a,
  263. 0x1f5c,
  264. 0x1f5e,
  265. ...range(0x1f7e, 0x1f7f),
  266. 0x1fb5,
  267. 0x1fc5,
  268. ...range(0x1fd4, 0x1fd5),
  269. 0x1fdc,
  270. ...range(0x1ff0, 0x1ff1),
  271. 0x1ff5,
  272. 0x1fff,
  273. ...range(0x2053, 0x2056),
  274. ...range(0x2058, 0x205e),
  275. ...range(0x2064, 0x2069),
  276. ...range(0x2072, 0x2073),
  277. ...range(0x208f, 0x209f),
  278. ...range(0x20b2, 0x20cf),
  279. ...range(0x20eb, 0x20ff),
  280. ...range(0x213b, 0x213c),
  281. ...range(0x214c, 0x2152),
  282. ...range(0x2184, 0x218f),
  283. ...range(0x23cf, 0x23ff),
  284. ...range(0x2427, 0x243f),
  285. ...range(0x244b, 0x245f),
  286. 0x24ff,
  287. ...range(0x2614, 0x2615),
  288. 0x2618,
  289. ...range(0x267e, 0x267f),
  290. ...range(0x268a, 0x2700),
  291. 0x2705,
  292. ...range(0x270a, 0x270b),
  293. 0x2728,
  294. 0x274c,
  295. 0x274e,
  296. ...range(0x2753, 0x2755),
  297. 0x2757,
  298. ...range(0x275f, 0x2760),
  299. ...range(0x2795, 0x2797),
  300. 0x27b0,
  301. ...range(0x27bf, 0x27cf),
  302. ...range(0x27ec, 0x27ef),
  303. ...range(0x2b00, 0x2e7f),
  304. 0x2e9a,
  305. ...range(0x2ef4, 0x2eff),
  306. ...range(0x2fd6, 0x2fef),
  307. ...range(0x2ffc, 0x2fff),
  308. 0x3040,
  309. ...range(0x3097, 0x3098),
  310. ...range(0x3100, 0x3104),
  311. ...range(0x312d, 0x3130),
  312. 0x318f,
  313. ...range(0x31b8, 0x31ef),
  314. ...range(0x321d, 0x321f),
  315. ...range(0x3244, 0x3250),
  316. ...range(0x327c, 0x327e),
  317. ...range(0x32cc, 0x32cf),
  318. 0x32ff,
  319. ...range(0x3377, 0x337a),
  320. ...range(0x33de, 0x33df),
  321. 0x33ff,
  322. ...range(0x4db6, 0x4dff),
  323. ...range(0x9fa6, 0x9fff),
  324. ...range(0xa48d, 0xa48f),
  325. ...range(0xa4c7, 0xabff),
  326. ...range(0xd7a4, 0xd7ff),
  327. ...range(0xfa2e, 0xfa2f),
  328. ...range(0xfa6b, 0xfaff),
  329. ...range(0xfb07, 0xfb12),
  330. ...range(0xfb18, 0xfb1c),
  331. 0xfb37,
  332. 0xfb3d,
  333. 0xfb3f,
  334. 0xfb42,
  335. 0xfb45,
  336. ...range(0xfbb2, 0xfbd2),
  337. ...range(0xfd40, 0xfd4f),
  338. ...range(0xfd90, 0xfd91),
  339. ...range(0xfdc8, 0xfdcf),
  340. ...range(0xfdfd, 0xfdff),
  341. ...range(0xfe10, 0xfe1f),
  342. ...range(0xfe24, 0xfe2f),
  343. ...range(0xfe47, 0xfe48),
  344. 0xfe53,
  345. 0xfe67,
  346. ...range(0xfe6c, 0xfe6f),
  347. 0xfe75,
  348. ...range(0xfefd, 0xfefe),
  349. 0xff00,
  350. ...range(0xffbf, 0xffc1),
  351. ...range(0xffc8, 0xffc9),
  352. ...range(0xffd0, 0xffd1),
  353. ...range(0xffd8, 0xffd9),
  354. ...range(0xffdd, 0xffdf),
  355. 0xffe7,
  356. ...range(0xffef, 0xfff8),
  357. ...range(0x10000, 0x102ff),
  358. 0x1031f,
  359. ...range(0x10324, 0x1032f),
  360. ...range(0x1034b, 0x103ff),
  361. ...range(0x10426, 0x10427),
  362. ...range(0x1044e, 0x1cfff),
  363. ...range(0x1d0f6, 0x1d0ff),
  364. ...range(0x1d127, 0x1d129),
  365. ...range(0x1d1de, 0x1d3ff),
  366. 0x1d455,
  367. 0x1d49d,
  368. ...range(0x1d4a0, 0x1d4a1),
  369. ...range(0x1d4a3, 0x1d4a4),
  370. ...range(0x1d4a7, 0x1d4a8),
  371. 0x1d4ad,
  372. 0x1d4ba,
  373. 0x1d4bc,
  374. 0x1d4c1,
  375. 0x1d4c4,
  376. 0x1d506,
  377. ...range(0x1d50b, 0x1d50c),
  378. 0x1d515,
  379. 0x1d51d,
  380. 0x1d53a,
  381. 0x1d53f,
  382. 0x1d545,
  383. ...range(0x1d547, 0x1d549),
  384. 0x1d551,
  385. ...range(0x1d6a4, 0x1d6a7),
  386. ...range(0x1d7ca, 0x1d7cd),
  387. ...range(0x1d800, 0x1fffd),
  388. ...range(0x2a6d7, 0x2f7ff),
  389. ...range(0x2fa1e, 0x2fffd),
  390. ...range(0x30000, 0x3fffd),
  391. ...range(0x40000, 0x4fffd),
  392. ...range(0x50000, 0x5fffd),
  393. ...range(0x60000, 0x6fffd),
  394. ...range(0x70000, 0x7fffd),
  395. ...range(0x80000, 0x8fffd),
  396. ...range(0x90000, 0x9fffd),
  397. ...range(0xa0000, 0xafffd),
  398. ...range(0xb0000, 0xbfffd),
  399. ...range(0xc0000, 0xcfffd),
  400. ...range(0xd0000, 0xdfffd),
  401. 0xe0000,
  402. ...range(0xe0002, 0xe001f),
  403. ...range(0xe0080, 0xefffd),
  404. ]);
  405. /**
  406. * B.1 Commonly mapped to nothing
  407. * @link https://tools.ietf.org/html/rfc3454#appendix-B.1
  408. */
  409. const commonly_mapped_to_nothing = new Set([
  410. 0x00ad,
  411. 0x034f,
  412. 0x1806,
  413. 0x180b,
  414. 0x180c,
  415. 0x180d,
  416. 0x200b,
  417. 0x200c,
  418. 0x200d,
  419. 0x2060,
  420. 0xfe00,
  421. 0xfe01,
  422. 0xfe02,
  423. 0xfe03,
  424. 0xfe04,
  425. 0xfe05,
  426. 0xfe06,
  427. 0xfe07,
  428. 0xfe08,
  429. 0xfe09,
  430. 0xfe0a,
  431. 0xfe0b,
  432. 0xfe0c,
  433. 0xfe0d,
  434. 0xfe0e,
  435. 0xfe0f,
  436. 0xfeff,
  437. ]);
  438. /**
  439. * C.1.2 Non-ASCII space characters
  440. * @link https://tools.ietf.org/html/rfc3454#appendix-C.1.2
  441. */
  442. const non_ASCII_space_characters = new Set([
  443. 0x00a0 /* NO-BREAK SPACE */,
  444. 0x1680 /* OGHAM SPACE MARK */,
  445. 0x2000 /* EN QUAD */,
  446. 0x2001 /* EM QUAD */,
  447. 0x2002 /* EN SPACE */,
  448. 0x2003 /* EM SPACE */,
  449. 0x2004 /* THREE-PER-EM SPACE */,
  450. 0x2005 /* FOUR-PER-EM SPACE */,
  451. 0x2006 /* SIX-PER-EM SPACE */,
  452. 0x2007 /* FIGURE SPACE */,
  453. 0x2008 /* PUNCTUATION SPACE */,
  454. 0x2009 /* THIN SPACE */,
  455. 0x200a /* HAIR SPACE */,
  456. 0x200b /* ZERO WIDTH SPACE */,
  457. 0x202f /* NARROW NO-BREAK SPACE */,
  458. 0x205f /* MEDIUM MATHEMATICAL SPACE */,
  459. 0x3000 /* IDEOGRAPHIC SPACE */,
  460. ]);
  461. /**
  462. * 2.3. Prohibited Output
  463. * @type {Set}
  464. */
  465. const prohibited_characters = new Set([
  466. ...non_ASCII_space_characters,
  467. /**
  468. * C.2.1 ASCII control characters
  469. * @link https://tools.ietf.org/html/rfc3454#appendix-C.2.1
  470. */
  471. ...range(0, 0x001f) /* [CONTROL CHARACTERS] */,
  472. 0x007f /* DELETE */,
  473. /**
  474. * C.2.2 Non-ASCII control characters
  475. * @link https://tools.ietf.org/html/rfc3454#appendix-C.2.2
  476. */
  477. ...range(0x0080, 0x009f) /* [CONTROL CHARACTERS] */,
  478. 0x06dd /* ARABIC END OF AYAH */,
  479. 0x070f /* SYRIAC ABBREVIATION MARK */,
  480. 0x180e /* MONGOLIAN VOWEL SEPARATOR */,
  481. 0x200c /* ZERO WIDTH NON-JOINER */,
  482. 0x200d /* ZERO WIDTH JOINER */,
  483. 0x2028 /* LINE SEPARATOR */,
  484. 0x2029 /* PARAGRAPH SEPARATOR */,
  485. 0x2060 /* WORD JOINER */,
  486. 0x2061 /* FUNCTION APPLICATION */,
  487. 0x2062 /* INVISIBLE TIMES */,
  488. 0x2063 /* INVISIBLE SEPARATOR */,
  489. ...range(0x206a, 0x206f) /* [CONTROL CHARACTERS] */,
  490. 0xfeff /* ZERO WIDTH NO-BREAK SPACE */,
  491. ...range(0xfff9, 0xfffc) /* [CONTROL CHARACTERS] */,
  492. ...range(0x1d173, 0x1d17a) /* [MUSICAL CONTROL CHARACTERS] */,
  493. /**
  494. * C.3 Private use
  495. * @link https://tools.ietf.org/html/rfc3454#appendix-C.3
  496. */
  497. ...range(0xe000, 0xf8ff) /* [PRIVATE USE, PLANE 0] */,
  498. ...range(0xf0000, 0xffffd) /* [PRIVATE USE, PLANE 15] */,
  499. ...range(0x100000, 0x10fffd) /* [PRIVATE USE, PLANE 16] */,
  500. /**
  501. * C.4 Non-character code points
  502. * @link https://tools.ietf.org/html/rfc3454#appendix-C.4
  503. */
  504. ...range(0xfdd0, 0xfdef) /* [NONCHARACTER CODE POINTS] */,
  505. ...range(0xfffe, 0xffff) /* [NONCHARACTER CODE POINTS] */,
  506. ...range(0x1fffe, 0x1ffff) /* [NONCHARACTER CODE POINTS] */,
  507. ...range(0x2fffe, 0x2ffff) /* [NONCHARACTER CODE POINTS] */,
  508. ...range(0x3fffe, 0x3ffff) /* [NONCHARACTER CODE POINTS] */,
  509. ...range(0x4fffe, 0x4ffff) /* [NONCHARACTER CODE POINTS] */,
  510. ...range(0x5fffe, 0x5ffff) /* [NONCHARACTER CODE POINTS] */,
  511. ...range(0x6fffe, 0x6ffff) /* [NONCHARACTER CODE POINTS] */,
  512. ...range(0x7fffe, 0x7ffff) /* [NONCHARACTER CODE POINTS] */,
  513. ...range(0x8fffe, 0x8ffff) /* [NONCHARACTER CODE POINTS] */,
  514. ...range(0x9fffe, 0x9ffff) /* [NONCHARACTER CODE POINTS] */,
  515. ...range(0xafffe, 0xaffff) /* [NONCHARACTER CODE POINTS] */,
  516. ...range(0xbfffe, 0xbffff) /* [NONCHARACTER CODE POINTS] */,
  517. ...range(0xcfffe, 0xcffff) /* [NONCHARACTER CODE POINTS] */,
  518. ...range(0xdfffe, 0xdffff) /* [NONCHARACTER CODE POINTS] */,
  519. ...range(0xefffe, 0xeffff) /* [NONCHARACTER CODE POINTS] */,
  520. ...range(0x10fffe, 0x10ffff) /* [NONCHARACTER CODE POINTS] */,
  521. /**
  522. * C.5 Surrogate codes
  523. * @link https://tools.ietf.org/html/rfc3454#appendix-C.5
  524. */
  525. ...range(0xd800, 0xdfff),
  526. /**
  527. * C.6 Inappropriate for plain text
  528. * @link https://tools.ietf.org/html/rfc3454#appendix-C.6
  529. */
  530. 0xfff9 /* INTERLINEAR ANNOTATION ANCHOR */,
  531. 0xfffa /* INTERLINEAR ANNOTATION SEPARATOR */,
  532. 0xfffb /* INTERLINEAR ANNOTATION TERMINATOR */,
  533. 0xfffc /* OBJECT REPLACEMENT CHARACTER */,
  534. 0xfffd /* REPLACEMENT CHARACTER */,
  535. /**
  536. * C.7 Inappropriate for canonical representation
  537. * @link https://tools.ietf.org/html/rfc3454#appendix-C.7
  538. */
  539. ...range(0x2ff0, 0x2ffb) /* [IDEOGRAPHIC DESCRIPTION CHARACTERS] */,
  540. /**
  541. * C.8 Change display properties or are deprecated
  542. * @link https://tools.ietf.org/html/rfc3454#appendix-C.8
  543. */
  544. 0x0340 /* COMBINING GRAVE TONE MARK */,
  545. 0x0341 /* COMBINING ACUTE TONE MARK */,
  546. 0x200e /* LEFT-TO-RIGHT MARK */,
  547. 0x200f /* RIGHT-TO-LEFT MARK */,
  548. 0x202a /* LEFT-TO-RIGHT EMBEDDING */,
  549. 0x202b /* RIGHT-TO-LEFT EMBEDDING */,
  550. 0x202c /* POP DIRECTIONAL FORMATTING */,
  551. 0x202d /* LEFT-TO-RIGHT OVERRIDE */,
  552. 0x202e /* RIGHT-TO-LEFT OVERRIDE */,
  553. 0x206a /* INHIBIT SYMMETRIC SWAPPING */,
  554. 0x206b /* ACTIVATE SYMMETRIC SWAPPING */,
  555. 0x206c /* INHIBIT ARABIC FORM SHAPING */,
  556. 0x206d /* ACTIVATE ARABIC FORM SHAPING */,
  557. 0x206e /* NATIONAL DIGIT SHAPES */,
  558. 0x206f /* NOMINAL DIGIT SHAPES */,
  559. /**
  560. * C.9 Tagging characters
  561. * @link https://tools.ietf.org/html/rfc3454#appendix-C.9
  562. */
  563. 0xe0001 /* LANGUAGE TAG */,
  564. ...range(0xe0020, 0xe007f) /* [TAGGING CHARACTERS] */,
  565. ]);
  566. /**
  567. * D.1 Characters with bidirectional property "R" or "AL"
  568. * @link https://tools.ietf.org/html/rfc3454#appendix-D.1
  569. */
  570. const bidirectional_r_al = new Set([
  571. 0x05be,
  572. 0x05c0,
  573. 0x05c3,
  574. ...range(0x05d0, 0x05ea),
  575. ...range(0x05f0, 0x05f4),
  576. 0x061b,
  577. 0x061f,
  578. ...range(0x0621, 0x063a),
  579. ...range(0x0640, 0x064a),
  580. ...range(0x066d, 0x066f),
  581. ...range(0x0671, 0x06d5),
  582. 0x06dd,
  583. ...range(0x06e5, 0x06e6),
  584. ...range(0x06fa, 0x06fe),
  585. ...range(0x0700, 0x070d),
  586. 0x0710,
  587. ...range(0x0712, 0x072c),
  588. ...range(0x0780, 0x07a5),
  589. 0x07b1,
  590. 0x200f,
  591. 0xfb1d,
  592. ...range(0xfb1f, 0xfb28),
  593. ...range(0xfb2a, 0xfb36),
  594. ...range(0xfb38, 0xfb3c),
  595. 0xfb3e,
  596. ...range(0xfb40, 0xfb41),
  597. ...range(0xfb43, 0xfb44),
  598. ...range(0xfb46, 0xfbb1),
  599. ...range(0xfbd3, 0xfd3d),
  600. ...range(0xfd50, 0xfd8f),
  601. ...range(0xfd92, 0xfdc7),
  602. ...range(0xfdf0, 0xfdfc),
  603. ...range(0xfe70, 0xfe74),
  604. ...range(0xfe76, 0xfefc),
  605. ]);
  606. /**
  607. * D.2 Characters with bidirectional property "L"
  608. * @link https://tools.ietf.org/html/rfc3454#appendix-D.2
  609. */
  610. const bidirectional_l = new Set([
  611. ...range(0x0041, 0x005a),
  612. ...range(0x0061, 0x007a),
  613. 0x00aa,
  614. 0x00b5,
  615. 0x00ba,
  616. ...range(0x00c0, 0x00d6),
  617. ...range(0x00d8, 0x00f6),
  618. ...range(0x00f8, 0x0220),
  619. ...range(0x0222, 0x0233),
  620. ...range(0x0250, 0x02ad),
  621. ...range(0x02b0, 0x02b8),
  622. ...range(0x02bb, 0x02c1),
  623. ...range(0x02d0, 0x02d1),
  624. ...range(0x02e0, 0x02e4),
  625. 0x02ee,
  626. 0x037a,
  627. 0x0386,
  628. ...range(0x0388, 0x038a),
  629. 0x038c,
  630. ...range(0x038e, 0x03a1),
  631. ...range(0x03a3, 0x03ce),
  632. ...range(0x03d0, 0x03f5),
  633. ...range(0x0400, 0x0482),
  634. ...range(0x048a, 0x04ce),
  635. ...range(0x04d0, 0x04f5),
  636. ...range(0x04f8, 0x04f9),
  637. ...range(0x0500, 0x050f),
  638. ...range(0x0531, 0x0556),
  639. ...range(0x0559, 0x055f),
  640. ...range(0x0561, 0x0587),
  641. 0x0589,
  642. 0x0903,
  643. ...range(0x0905, 0x0939),
  644. ...range(0x093d, 0x0940),
  645. ...range(0x0949, 0x094c),
  646. 0x0950,
  647. ...range(0x0958, 0x0961),
  648. ...range(0x0964, 0x0970),
  649. ...range(0x0982, 0x0983),
  650. ...range(0x0985, 0x098c),
  651. ...range(0x098f, 0x0990),
  652. ...range(0x0993, 0x09a8),
  653. ...range(0x09aa, 0x09b0),
  654. 0x09b2,
  655. ...range(0x09b6, 0x09b9),
  656. ...range(0x09be, 0x09c0),
  657. ...range(0x09c7, 0x09c8),
  658. ...range(0x09cb, 0x09cc),
  659. 0x09d7,
  660. ...range(0x09dc, 0x09dd),
  661. ...range(0x09df, 0x09e1),
  662. ...range(0x09e6, 0x09f1),
  663. ...range(0x09f4, 0x09fa),
  664. ...range(0x0a05, 0x0a0a),
  665. ...range(0x0a0f, 0x0a10),
  666. ...range(0x0a13, 0x0a28),
  667. ...range(0x0a2a, 0x0a30),
  668. ...range(0x0a32, 0x0a33),
  669. ...range(0x0a35, 0x0a36),
  670. ...range(0x0a38, 0x0a39),
  671. ...range(0x0a3e, 0x0a40),
  672. ...range(0x0a59, 0x0a5c),
  673. 0x0a5e,
  674. ...range(0x0a66, 0x0a6f),
  675. ...range(0x0a72, 0x0a74),
  676. 0x0a83,
  677. ...range(0x0a85, 0x0a8b),
  678. 0x0a8d,
  679. ...range(0x0a8f, 0x0a91),
  680. ...range(0x0a93, 0x0aa8),
  681. ...range(0x0aaa, 0x0ab0),
  682. ...range(0x0ab2, 0x0ab3),
  683. ...range(0x0ab5, 0x0ab9),
  684. ...range(0x0abd, 0x0ac0),
  685. 0x0ac9,
  686. ...range(0x0acb, 0x0acc),
  687. 0x0ad0,
  688. 0x0ae0,
  689. ...range(0x0ae6, 0x0aef),
  690. ...range(0x0b02, 0x0b03),
  691. ...range(0x0b05, 0x0b0c),
  692. ...range(0x0b0f, 0x0b10),
  693. ...range(0x0b13, 0x0b28),
  694. ...range(0x0b2a, 0x0b30),
  695. ...range(0x0b32, 0x0b33),
  696. ...range(0x0b36, 0x0b39),
  697. ...range(0x0b3d, 0x0b3e),
  698. 0x0b40,
  699. ...range(0x0b47, 0x0b48),
  700. ...range(0x0b4b, 0x0b4c),
  701. 0x0b57,
  702. ...range(0x0b5c, 0x0b5d),
  703. ...range(0x0b5f, 0x0b61),
  704. ...range(0x0b66, 0x0b70),
  705. 0x0b83,
  706. ...range(0x0b85, 0x0b8a),
  707. ...range(0x0b8e, 0x0b90),
  708. ...range(0x0b92, 0x0b95),
  709. ...range(0x0b99, 0x0b9a),
  710. 0x0b9c,
  711. ...range(0x0b9e, 0x0b9f),
  712. ...range(0x0ba3, 0x0ba4),
  713. ...range(0x0ba8, 0x0baa),
  714. ...range(0x0bae, 0x0bb5),
  715. ...range(0x0bb7, 0x0bb9),
  716. ...range(0x0bbe, 0x0bbf),
  717. ...range(0x0bc1, 0x0bc2),
  718. ...range(0x0bc6, 0x0bc8),
  719. ...range(0x0bca, 0x0bcc),
  720. 0x0bd7,
  721. ...range(0x0be7, 0x0bf2),
  722. ...range(0x0c01, 0x0c03),
  723. ...range(0x0c05, 0x0c0c),
  724. ...range(0x0c0e, 0x0c10),
  725. ...range(0x0c12, 0x0c28),
  726. ...range(0x0c2a, 0x0c33),
  727. ...range(0x0c35, 0x0c39),
  728. ...range(0x0c41, 0x0c44),
  729. ...range(0x0c60, 0x0c61),
  730. ...range(0x0c66, 0x0c6f),
  731. ...range(0x0c82, 0x0c83),
  732. ...range(0x0c85, 0x0c8c),
  733. ...range(0x0c8e, 0x0c90),
  734. ...range(0x0c92, 0x0ca8),
  735. ...range(0x0caa, 0x0cb3),
  736. ...range(0x0cb5, 0x0cb9),
  737. 0x0cbe,
  738. ...range(0x0cc0, 0x0cc4),
  739. ...range(0x0cc7, 0x0cc8),
  740. ...range(0x0cca, 0x0ccb),
  741. ...range(0x0cd5, 0x0cd6),
  742. 0x0cde,
  743. ...range(0x0ce0, 0x0ce1),
  744. ...range(0x0ce6, 0x0cef),
  745. ...range(0x0d02, 0x0d03),
  746. ...range(0x0d05, 0x0d0c),
  747. ...range(0x0d0e, 0x0d10),
  748. ...range(0x0d12, 0x0d28),
  749. ...range(0x0d2a, 0x0d39),
  750. ...range(0x0d3e, 0x0d40),
  751. ...range(0x0d46, 0x0d48),
  752. ...range(0x0d4a, 0x0d4c),
  753. 0x0d57,
  754. ...range(0x0d60, 0x0d61),
  755. ...range(0x0d66, 0x0d6f),
  756. ...range(0x0d82, 0x0d83),
  757. ...range(0x0d85, 0x0d96),
  758. ...range(0x0d9a, 0x0db1),
  759. ...range(0x0db3, 0x0dbb),
  760. 0x0dbd,
  761. ...range(0x0dc0, 0x0dc6),
  762. ...range(0x0dcf, 0x0dd1),
  763. ...range(0x0dd8, 0x0ddf),
  764. ...range(0x0df2, 0x0df4),
  765. ...range(0x0e01, 0x0e30),
  766. ...range(0x0e32, 0x0e33),
  767. ...range(0x0e40, 0x0e46),
  768. ...range(0x0e4f, 0x0e5b),
  769. ...range(0x0e81, 0x0e82),
  770. 0x0e84,
  771. ...range(0x0e87, 0x0e88),
  772. 0x0e8a,
  773. 0x0e8d,
  774. ...range(0x0e94, 0x0e97),
  775. ...range(0x0e99, 0x0e9f),
  776. ...range(0x0ea1, 0x0ea3),
  777. 0x0ea5,
  778. 0x0ea7,
  779. ...range(0x0eaa, 0x0eab),
  780. ...range(0x0ead, 0x0eb0),
  781. ...range(0x0eb2, 0x0eb3),
  782. 0x0ebd,
  783. ...range(0x0ec0, 0x0ec4),
  784. 0x0ec6,
  785. ...range(0x0ed0, 0x0ed9),
  786. ...range(0x0edc, 0x0edd),
  787. ...range(0x0f00, 0x0f17),
  788. ...range(0x0f1a, 0x0f34),
  789. 0x0f36,
  790. 0x0f38,
  791. ...range(0x0f3e, 0x0f47),
  792. ...range(0x0f49, 0x0f6a),
  793. 0x0f7f,
  794. 0x0f85,
  795. ...range(0x0f88, 0x0f8b),
  796. ...range(0x0fbe, 0x0fc5),
  797. ...range(0x0fc7, 0x0fcc),
  798. 0x0fcf,
  799. ...range(0x1000, 0x1021),
  800. ...range(0x1023, 0x1027),
  801. ...range(0x1029, 0x102a),
  802. 0x102c,
  803. 0x1031,
  804. 0x1038,
  805. ...range(0x1040, 0x1057),
  806. ...range(0x10a0, 0x10c5),
  807. ...range(0x10d0, 0x10f8),
  808. 0x10fb,
  809. ...range(0x1100, 0x1159),
  810. ...range(0x115f, 0x11a2),
  811. ...range(0x11a8, 0x11f9),
  812. ...range(0x1200, 0x1206),
  813. ...range(0x1208, 0x1246),
  814. 0x1248,
  815. ...range(0x124a, 0x124d),
  816. ...range(0x1250, 0x1256),
  817. 0x1258,
  818. ...range(0x125a, 0x125d),
  819. ...range(0x1260, 0x1286),
  820. 0x1288,
  821. ...range(0x128a, 0x128d),
  822. ...range(0x1290, 0x12ae),
  823. 0x12b0,
  824. ...range(0x12b2, 0x12b5),
  825. ...range(0x12b8, 0x12be),
  826. 0x12c0,
  827. ...range(0x12c2, 0x12c5),
  828. ...range(0x12c8, 0x12ce),
  829. ...range(0x12d0, 0x12d6),
  830. ...range(0x12d8, 0x12ee),
  831. ...range(0x12f0, 0x130e),
  832. 0x1310,
  833. ...range(0x1312, 0x1315),
  834. ...range(0x1318, 0x131e),
  835. ...range(0x1320, 0x1346),
  836. ...range(0x1348, 0x135a),
  837. ...range(0x1361, 0x137c),
  838. ...range(0x13a0, 0x13f4),
  839. ...range(0x1401, 0x1676),
  840. ...range(0x1681, 0x169a),
  841. ...range(0x16a0, 0x16f0),
  842. ...range(0x1700, 0x170c),
  843. ...range(0x170e, 0x1711),
  844. ...range(0x1720, 0x1731),
  845. ...range(0x1735, 0x1736),
  846. ...range(0x1740, 0x1751),
  847. ...range(0x1760, 0x176c),
  848. ...range(0x176e, 0x1770),
  849. ...range(0x1780, 0x17b6),
  850. ...range(0x17be, 0x17c5),
  851. ...range(0x17c7, 0x17c8),
  852. ...range(0x17d4, 0x17da),
  853. 0x17dc,
  854. ...range(0x17e0, 0x17e9),
  855. ...range(0x1810, 0x1819),
  856. ...range(0x1820, 0x1877),
  857. ...range(0x1880, 0x18a8),
  858. ...range(0x1e00, 0x1e9b),
  859. ...range(0x1ea0, 0x1ef9),
  860. ...range(0x1f00, 0x1f15),
  861. ...range(0x1f18, 0x1f1d),
  862. ...range(0x1f20, 0x1f45),
  863. ...range(0x1f48, 0x1f4d),
  864. ...range(0x1f50, 0x1f57),
  865. 0x1f59,
  866. 0x1f5b,
  867. 0x1f5d,
  868. ...range(0x1f5f, 0x1f7d),
  869. ...range(0x1f80, 0x1fb4),
  870. ...range(0x1fb6, 0x1fbc),
  871. 0x1fbe,
  872. ...range(0x1fc2, 0x1fc4),
  873. ...range(0x1fc6, 0x1fcc),
  874. ...range(0x1fd0, 0x1fd3),
  875. ...range(0x1fd6, 0x1fdb),
  876. ...range(0x1fe0, 0x1fec),
  877. ...range(0x1ff2, 0x1ff4),
  878. ...range(0x1ff6, 0x1ffc),
  879. 0x200e,
  880. 0x2071,
  881. 0x207f,
  882. 0x2102,
  883. 0x2107,
  884. ...range(0x210a, 0x2113),
  885. 0x2115,
  886. ...range(0x2119, 0x211d),
  887. 0x2124,
  888. 0x2126,
  889. 0x2128,
  890. ...range(0x212a, 0x212d),
  891. ...range(0x212f, 0x2131),
  892. ...range(0x2133, 0x2139),
  893. ...range(0x213d, 0x213f),
  894. ...range(0x2145, 0x2149),
  895. ...range(0x2160, 0x2183),
  896. ...range(0x2336, 0x237a),
  897. 0x2395,
  898. ...range(0x249c, 0x24e9),
  899. ...range(0x3005, 0x3007),
  900. ...range(0x3021, 0x3029),
  901. ...range(0x3031, 0x3035),
  902. ...range(0x3038, 0x303c),
  903. ...range(0x3041, 0x3096),
  904. ...range(0x309d, 0x309f),
  905. ...range(0x30a1, 0x30fa),
  906. ...range(0x30fc, 0x30ff),
  907. ...range(0x3105, 0x312c),
  908. ...range(0x3131, 0x318e),
  909. ...range(0x3190, 0x31b7),
  910. ...range(0x31f0, 0x321c),
  911. ...range(0x3220, 0x3243),
  912. ...range(0x3260, 0x327b),
  913. ...range(0x327f, 0x32b0),
  914. ...range(0x32c0, 0x32cb),
  915. ...range(0x32d0, 0x32fe),
  916. ...range(0x3300, 0x3376),
  917. ...range(0x337b, 0x33dd),
  918. ...range(0x33e0, 0x33fe),
  919. ...range(0x3400, 0x4db5),
  920. ...range(0x4e00, 0x9fa5),
  921. ...range(0xa000, 0xa48c),
  922. ...range(0xac00, 0xd7a3),
  923. ...range(0xd800, 0xfa2d),
  924. ...range(0xfa30, 0xfa6a),
  925. ...range(0xfb00, 0xfb06),
  926. ...range(0xfb13, 0xfb17),
  927. ...range(0xff21, 0xff3a),
  928. ...range(0xff41, 0xff5a),
  929. ...range(0xff66, 0xffbe),
  930. ...range(0xffc2, 0xffc7),
  931. ...range(0xffca, 0xffcf),
  932. ...range(0xffd2, 0xffd7),
  933. ...range(0xffda, 0xffdc),
  934. ...range(0x10300, 0x1031e),
  935. ...range(0x10320, 0x10323),
  936. ...range(0x10330, 0x1034a),
  937. ...range(0x10400, 0x10425),
  938. ...range(0x10428, 0x1044d),
  939. ...range(0x1d000, 0x1d0f5),
  940. ...range(0x1d100, 0x1d126),
  941. ...range(0x1d12a, 0x1d166),
  942. ...range(0x1d16a, 0x1d172),
  943. ...range(0x1d183, 0x1d184),
  944. ...range(0x1d18c, 0x1d1a9),
  945. ...range(0x1d1ae, 0x1d1dd),
  946. ...range(0x1d400, 0x1d454),
  947. ...range(0x1d456, 0x1d49c),
  948. ...range(0x1d49e, 0x1d49f),
  949. 0x1d4a2,
  950. ...range(0x1d4a5, 0x1d4a6),
  951. ...range(0x1d4a9, 0x1d4ac),
  952. ...range(0x1d4ae, 0x1d4b9),
  953. 0x1d4bb,
  954. ...range(0x1d4bd, 0x1d4c0),
  955. ...range(0x1d4c2, 0x1d4c3),
  956. ...range(0x1d4c5, 0x1d505),
  957. ...range(0x1d507, 0x1d50a),
  958. ...range(0x1d50d, 0x1d514),
  959. ...range(0x1d516, 0x1d51c),
  960. ...range(0x1d51e, 0x1d539),
  961. ...range(0x1d53b, 0x1d53e),
  962. ...range(0x1d540, 0x1d544),
  963. 0x1d546,
  964. ...range(0x1d54a, 0x1d550),
  965. ...range(0x1d552, 0x1d6a3),
  966. ...range(0x1d6a8, 0x1d7c9),
  967. ...range(0x20000, 0x2a6d6),
  968. ...range(0x2f800, 0x2fa1d),
  969. ...range(0xf0000, 0xffffd),
  970. ...range(0x100000, 0x10fffd),
  971. ]);
  972. module.exports = {
  973. unassigned_code_points,
  974. commonly_mapped_to_nothing,
  975. non_ASCII_space_characters,
  976. prohibited_characters,
  977. bidirectional_r_al,
  978. bidirectional_l,
  979. };