Pattern_Syntax.js (2334B)
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 `Pattern_Syntax` 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 0x000060, 19 0x0000A9, 20 0x0000AE, 21 0x0000B6, 22 0x0000BB, 23 0x0000BF, 24 0x0000D7, 25 0x0000F7, 26 0x003030 27 ], 28 ranges: [ 29 [0x000021, 0x00002F], 30 [0x00003A, 0x000040], 31 [0x00005B, 0x00005E], 32 [0x00007B, 0x00007E], 33 [0x0000A1, 0x0000A7], 34 [0x0000AB, 0x0000AC], 35 [0x0000B0, 0x0000B1], 36 [0x002010, 0x002027], 37 [0x002030, 0x00203E], 38 [0x002041, 0x002053], 39 [0x002055, 0x00205E], 40 [0x002190, 0x00245F], 41 [0x002500, 0x002775], 42 [0x002794, 0x002BFF], 43 [0x002E00, 0x002E7F], 44 [0x003001, 0x003003], 45 [0x003008, 0x003020], 46 [0x00FD3E, 0x00FD3F], 47 [0x00FE45, 0x00FE46] 48 ] 49 }); 50 testPropertyEscapes( 51 /^\p{Pattern_Syntax}+$/u, 52 matchSymbols, 53 "\\p{Pattern_Syntax}" 54 ); 55 testPropertyEscapes( 56 /^\p{Pat_Syn}+$/u, 57 matchSymbols, 58 "\\p{Pat_Syn}" 59 ); 60 61 const nonMatchSymbols = buildString({ 62 loneCodePoints: [ 63 0x00005F, 64 0x0000A8, 65 0x0000AA, 66 0x0000AD, 67 0x0000AF, 68 0x002054 69 ], 70 ranges: [ 71 [0x00DC00, 0x00DFFF], 72 [0x000000, 0x000020], 73 [0x000030, 0x000039], 74 [0x000041, 0x00005A], 75 [0x000061, 0x00007A], 76 [0x00007F, 0x0000A0], 77 [0x0000B2, 0x0000B5], 78 [0x0000B7, 0x0000BA], 79 [0x0000BC, 0x0000BE], 80 [0x0000C0, 0x0000D6], 81 [0x0000D8, 0x0000F6], 82 [0x0000F8, 0x00200F], 83 [0x002028, 0x00202F], 84 [0x00203F, 0x002040], 85 [0x00205F, 0x00218F], 86 [0x002460, 0x0024FF], 87 [0x002776, 0x002793], 88 [0x002C00, 0x002DFF], 89 [0x002E80, 0x003000], 90 [0x003004, 0x003007], 91 [0x003021, 0x00302F], 92 [0x003031, 0x00DBFF], 93 [0x00E000, 0x00FD3D], 94 [0x00FD40, 0x00FE44], 95 [0x00FE47, 0x10FFFF] 96 ] 97 }); 98 testPropertyEscapes( 99 /^\P{Pattern_Syntax}+$/u, 100 nonMatchSymbols, 101 "\\P{Pattern_Syntax}" 102 ); 103 testPropertyEscapes( 104 /^\P{Pat_Syn}+$/u, 105 nonMatchSymbols, 106 "\\P{Pat_Syn}" 107 ); 108 109 reportCompare(0, 0);