Source code
Revision control
Copy as Markdown
Other Tools
// Copyright 2024 Mathias Bynens. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
author: Mathias Bynens
description: >
Unicode property escapes for `Script_Extensions=Latin`
info: |
Unicode v16.0.0
esid: sec-static-semantics-unicodematchproperty-p
features: [regexp-unicode-property-escapes]
includes: [regExpUtils.js]
---*/
const matchSymbols = buildString({
loneCodePoints: [
0x0000AA,
0x0000B7,
0x0000BA,
0x0002BC,
0x0002C7,
0x0002CD,
0x0002D7,
0x0002D9,
0x000313,
0x000320,
0x000358,
0x00035E,
0x0010FB,
0x001DF8,
0x00202F,
0x002071,
0x00207F,
0x0020F0,
0x002132,
0x00214E,
0x002E17,
0x00A7D3,
0x00A92E
],
ranges: [
[0x000041, 0x00005A],
[0x000061, 0x00007A],
[0x0000C0, 0x0000D6],
[0x0000D8, 0x0000F6],
[0x0000F8, 0x0002B8],
[0x0002C9, 0x0002CB],
[0x0002E0, 0x0002E4],
[0x000300, 0x00030E],
[0x000310, 0x000311],
[0x000323, 0x000325],
[0x00032D, 0x00032E],
[0x000330, 0x000331],
[0x000363, 0x00036F],
[0x000485, 0x000486],
[0x000951, 0x000952],
[0x001D00, 0x001D25],
[0x001D2C, 0x001D5C],
[0x001D62, 0x001D65],
[0x001D6B, 0x001D77],
[0x001D79, 0x001DBE],
[0x001E00, 0x001EFF],
[0x002090, 0x00209C],
[0x00212A, 0x00212B],
[0x002160, 0x002188],
[0x002C60, 0x002C7F],
[0x00A700, 0x00A707],
[0x00A722, 0x00A787],
[0x00A78B, 0x00A7CD],
[0x00A7D0, 0x00A7D1],
[0x00A7D5, 0x00A7DC],
[0x00A7F2, 0x00A7FF],
[0x00AB30, 0x00AB5A],
[0x00AB5C, 0x00AB64],
[0x00AB66, 0x00AB69],
[0x00FB00, 0x00FB06],
[0x00FF21, 0x00FF3A],
[0x00FF41, 0x00FF5A],
[0x010780, 0x010785],
[0x010787, 0x0107B0],
[0x0107B2, 0x0107BA],
[0x01DF00, 0x01DF1E],
[0x01DF25, 0x01DF2A]
]
});
testPropertyEscapes(
/^\p{Script_Extensions=Latin}+$/u,
matchSymbols,
"\\p{Script_Extensions=Latin}"
);
testPropertyEscapes(
/^\p{Script_Extensions=Latn}+$/u,
matchSymbols,
"\\p{Script_Extensions=Latn}"
);
testPropertyEscapes(
/^\p{scx=Latin}+$/u,
matchSymbols,
"\\p{scx=Latin}"
);
testPropertyEscapes(
/^\p{scx=Latn}+$/u,
matchSymbols,
"\\p{scx=Latn}"
);
const nonMatchSymbols = buildString({
loneCodePoints: [
0x0000D7,
0x0000F7,
0x0002C8,
0x0002CC,
0x0002D8,
0x00030F,
0x000312,
0x00032F,
0x001D78,
0x00A7D2,
0x00A7D4,
0x00AB5B,
0x00AB65,
0x010786,
0x0107B1
],
ranges: [
[0x00DC00, 0x00DFFF],
[0x000000, 0x000040],
[0x00005B, 0x000060],
[0x00007B, 0x0000A9],
[0x0000AB, 0x0000B6],
[0x0000B8, 0x0000B9],
[0x0000BB, 0x0000BF],
[0x0002B9, 0x0002BB],
[0x0002BD, 0x0002C6],
[0x0002CE, 0x0002D6],
[0x0002DA, 0x0002DF],
[0x0002E5, 0x0002FF],
[0x000314, 0x00031F],
[0x000321, 0x000322],
[0x000326, 0x00032C],
[0x000332, 0x000357],
[0x000359, 0x00035D],
[0x00035F, 0x000362],
[0x000370, 0x000484],
[0x000487, 0x000950],
[0x000953, 0x0010FA],
[0x0010FC, 0x001CFF],
[0x001D26, 0x001D2B],
[0x001D5D, 0x001D61],
[0x001D66, 0x001D6A],
[0x001DBF, 0x001DF7],
[0x001DF9, 0x001DFF],
[0x001F00, 0x00202E],
[0x002030, 0x002070],
[0x002072, 0x00207E],
[0x002080, 0x00208F],
[0x00209D, 0x0020EF],
[0x0020F1, 0x002129],
[0x00212C, 0x002131],
[0x002133, 0x00214D],
[0x00214F, 0x00215F],
[0x002189, 0x002C5F],
[0x002C80, 0x002E16],
[0x002E18, 0x00A6FF],
[0x00A708, 0x00A721],
[0x00A788, 0x00A78A],
[0x00A7CE, 0x00A7CF],
[0x00A7DD, 0x00A7F1],
[0x00A800, 0x00A92D],
[0x00A92F, 0x00AB2F],
[0x00AB6A, 0x00DBFF],
[0x00E000, 0x00FAFF],
[0x00FB07, 0x00FF20],
[0x00FF3B, 0x00FF40],
[0x00FF5B, 0x01077F],
[0x0107BB, 0x01DEFF],
[0x01DF1F, 0x01DF24],
[0x01DF2B, 0x10FFFF]
]
});
testPropertyEscapes(
/^\P{Script_Extensions=Latin}+$/u,
nonMatchSymbols,
"\\P{Script_Extensions=Latin}"
);
testPropertyEscapes(
/^\P{Script_Extensions=Latn}+$/u,
nonMatchSymbols,
"\\P{Script_Extensions=Latn}"
);
testPropertyEscapes(
/^\P{scx=Latin}+$/u,
nonMatchSymbols,
"\\P{scx=Latin}"
);
testPropertyEscapes(
/^\P{scx=Latn}+$/u,
nonMatchSymbols,
"\\P{scx=Latn}"
);
reportCompare(0, 0);