| 1 |
// Copyright 2017 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 `Hex_Digit` |
| 8 |
info: | |
| 9 |
Generated by https://github.com/mathiasbynens/unicode-property-escapes-tests |
| 10 |
Unicode v10.0.0 |
| 11 |
Emoji v5.0 (UTR51) |
| 12 |
esid: sec-static-semantics-unicodematchproperty-p |
| 13 |
features: [regexp-unicode-property-escapes] |
| 14 |
includes: [regExpUtils.js] |
| 15 |
---*/ |
| 16 |
|
| 17 |
const matchSymbols = buildString({ |
| 18 |
loneCodePoints: [], |
| 19 |
ranges: [ |
| 20 |
[0x000030, 0x000039], |
| 21 |
[0x000041, 0x000046], |
| 22 |
[0x000061, 0x000066], |
| 23 |
[0x00FF10, 0x00FF19], |
| 24 |
[0x00FF21, 0x00FF26], |
| 25 |
[0x00FF41, 0x00FF46] |
| 26 |
] |
| 27 |
}); |
| 28 |
testPropertyEscapes( |
| 29 |
/^\p{Hex_Digit}+$/u, |
| 30 |
matchSymbols, |
| 31 |
"\\p{Hex_Digit}" |
| 32 |
); |
| 33 |
testPropertyEscapes( |
| 34 |
/^\p{Hex}+$/u, |
| 35 |
matchSymbols, |
| 36 |
"\\p{Hex}" |
| 37 |
); |
| 38 |
|
| 39 |
const nonMatchSymbols = buildString({ |
| 40 |
loneCodePoints: [], |
| 41 |
ranges: [ |
| 42 |
[0x00DC00, 0x00DFFF], |
| 43 |
[0x000000, 0x00002F], |
| 44 |
[0x00003A, 0x000040], |
| 45 |
[0x000047, 0x000060], |
| 46 |
[0x000067, 0x00DBFF], |
| 47 |
[0x00E000, 0x00FF0F], |
| 48 |
[0x00FF1A, 0x00FF20], |
| 49 |
[0x00FF27, 0x00FF40], |
| 50 |
[0x00FF47, 0x10FFFF] |
| 51 |
] |
| 52 |
}); |
| 53 |
testPropertyEscapes( |
| 54 |
/^\P{Hex_Digit}+$/u, |
| 55 |
nonMatchSymbols, |
| 56 |
"\\P{Hex_Digit}" |
| 57 |
); |
| 58 |
testPropertyEscapes( |
| 59 |
/^\P{Hex}+$/u, |
| 60 |
nonMatchSymbols, |
| 61 |
"\\P{Hex}" |
| 62 |
); |