tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Script_-_Han.js (2412B)


      1 // Copyright 2025 Mathias Bynens. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 author: Mathias Bynens
      6 description: >
      7  Unicode property escapes for `Script=Han`
      8 info: |
      9  Generated by https://github.com/mathiasbynens/unicode-property-escapes-tests
     10  Unicode v17.0.0
     11 esid: sec-static-semantics-unicodematchproperty-p
     12 features: [regexp-unicode-property-escapes]
     13 includes: [regExpUtils.js]
     14 ---*/
     15 
     16 const matchSymbols = buildString({
     17  loneCodePoints: [
     18    0x003005,
     19    0x003007
     20  ],
     21  ranges: [
     22    [0x002E80, 0x002E99],
     23    [0x002E9B, 0x002EF3],
     24    [0x002F00, 0x002FD5],
     25    [0x003021, 0x003029],
     26    [0x003038, 0x00303B],
     27    [0x003400, 0x004DBF],
     28    [0x004E00, 0x009FFF],
     29    [0x00F900, 0x00FA6D],
     30    [0x00FA70, 0x00FAD9],
     31    [0x016FE2, 0x016FE3],
     32    [0x016FF0, 0x016FF6],
     33    [0x020000, 0x02A6DF],
     34    [0x02A700, 0x02B81D],
     35    [0x02B820, 0x02CEAD],
     36    [0x02CEB0, 0x02EBE0],
     37    [0x02EBF0, 0x02EE5D],
     38    [0x02F800, 0x02FA1D],
     39    [0x030000, 0x03134A],
     40    [0x031350, 0x033479]
     41  ]
     42 });
     43 testPropertyEscapes(
     44  /^\p{Script=Han}+$/u,
     45  matchSymbols,
     46  "\\p{Script=Han}"
     47 );
     48 testPropertyEscapes(
     49  /^\p{Script=Hani}+$/u,
     50  matchSymbols,
     51  "\\p{Script=Hani}"
     52 );
     53 testPropertyEscapes(
     54  /^\p{sc=Han}+$/u,
     55  matchSymbols,
     56  "\\p{sc=Han}"
     57 );
     58 testPropertyEscapes(
     59  /^\p{sc=Hani}+$/u,
     60  matchSymbols,
     61  "\\p{sc=Hani}"
     62 );
     63 
     64 const nonMatchSymbols = buildString({
     65  loneCodePoints: [
     66    0x002E9A,
     67    0x003006
     68  ],
     69  ranges: [
     70    [0x00DC00, 0x00DFFF],
     71    [0x000000, 0x002E7F],
     72    [0x002EF4, 0x002EFF],
     73    [0x002FD6, 0x003004],
     74    [0x003008, 0x003020],
     75    [0x00302A, 0x003037],
     76    [0x00303C, 0x0033FF],
     77    [0x004DC0, 0x004DFF],
     78    [0x00A000, 0x00DBFF],
     79    [0x00E000, 0x00F8FF],
     80    [0x00FA6E, 0x00FA6F],
     81    [0x00FADA, 0x016FE1],
     82    [0x016FE4, 0x016FEF],
     83    [0x016FF7, 0x01FFFF],
     84    [0x02A6E0, 0x02A6FF],
     85    [0x02B81E, 0x02B81F],
     86    [0x02CEAE, 0x02CEAF],
     87    [0x02EBE1, 0x02EBEF],
     88    [0x02EE5E, 0x02F7FF],
     89    [0x02FA1E, 0x02FFFF],
     90    [0x03134B, 0x03134F],
     91    [0x03347A, 0x10FFFF]
     92  ]
     93 });
     94 testPropertyEscapes(
     95  /^\P{Script=Han}+$/u,
     96  nonMatchSymbols,
     97  "\\P{Script=Han}"
     98 );
     99 testPropertyEscapes(
    100  /^\P{Script=Hani}+$/u,
    101  nonMatchSymbols,
    102  "\\P{Script=Hani}"
    103 );
    104 testPropertyEscapes(
    105  /^\P{sc=Han}+$/u,
    106  nonMatchSymbols,
    107  "\\P{sc=Han}"
    108 );
    109 testPropertyEscapes(
    110  /^\P{sc=Hani}+$/u,
    111  nonMatchSymbols,
    112  "\\P{sc=Hani}"
    113 );
    114 
    115 reportCompare(0, 0);