| 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 `White_Space` |
| 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 |
0x000020, |
| 20 |
0x000085, |
| 21 |
0x0000A0, |
| 22 |
0x001680, |
| 23 |
0x00202F, |
| 24 |
0x00205F, |
| 25 |
0x003000 |
| 26 |
], |
| 27 |
ranges: [ |
| 28 |
[0x000009, 0x00000D], |
| 29 |
[0x002000, 0x00200A], |
| 30 |
[0x002028, 0x002029] |
| 31 |
] |
| 32 |
}); |
| 33 |
testPropertyEscapes( |
| 34 |
/^\p{White_Space}+$/u, |
| 35 |
matchSymbols, |
| 36 |
"\\p{White_Space}" |
| 37 |
); |
| 38 |
testPropertyEscapes( |
| 39 |
/^\p{space}+$/u, |
| 40 |
matchSymbols, |
| 41 |
"\\p{space}" |
| 42 |
); |
| 43 |
|
| 44 |
const nonMatchSymbols = buildString({ |
| 45 |
loneCodePoints: [], |
| 46 |
ranges: [ |
| 47 |
[0x00DC00, 0x00DFFF], |
| 48 |
[0x000000, 0x000008], |
| 49 |
[0x00000E, 0x00001F], |
| 50 |
[0x000021, 0x000084], |
| 51 |
[0x000086, 0x00009F], |
| 52 |
[0x0000A1, 0x00167F], |
| 53 |
[0x001681, 0x001FFF], |
| 54 |
[0x00200B, 0x002027], |
| 55 |
[0x00202A, 0x00202E], |
| 56 |
[0x002030, 0x00205E], |
| 57 |
[0x002060, 0x002FFF], |
| 58 |
[0x003001, 0x00DBFF], |
| 59 |
[0x00E000, 0x10FFFF] |
| 60 |
] |
| 61 |
}); |
| 62 |
testPropertyEscapes( |
| 63 |
/^\P{White_Space}+$/u, |
| 64 |
nonMatchSymbols, |
| 65 |
"\\P{White_Space}" |
| 66 |
); |
| 67 |
testPropertyEscapes( |
| 68 |
/^\P{space}+$/u, |
| 69 |
nonMatchSymbols, |
| 70 |
"\\P{space}" |
| 71 |
); |