progress on migrating to heex templates and font-icons
This commit is contained in:
parent
d43daafdb7
commit
3eff955672
21793 changed files with 2161968 additions and 16895 deletions
assets_old/node_modules/regexpu-core
20
assets_old/node_modules/regexpu-core/LICENSE-MIT.txt
generated
vendored
Normal file
20
assets_old/node_modules/regexpu-core/LICENSE-MIT.txt
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
146
assets_old/node_modules/regexpu-core/README.md
generated
vendored
Normal file
146
assets_old/node_modules/regexpu-core/README.md
generated
vendored
Normal file
|
@ -0,0 +1,146 @@
|
|||
# regexpu-core [](https://travis-ci.org/mathiasbynens/regexpu-core) [](https://codecov.io/gh/mathiasbynens/regexpu-core)
|
||||
|
||||
_regexpu_ is a source code transpiler that enables the use of ES2015 Unicode regular expressions in JavaScript-of-today (ES5).
|
||||
|
||||
_regexpu-core_ contains _regexpu_’s core functionality, i.e. `rewritePattern(pattern, flag)`, which enables rewriting regular expressions that make use of [the ES2015 `u` flag](https://mathiasbynens.be/notes/es6-unicode-regex) into equivalent ES5-compatible regular expression patterns.
|
||||
|
||||
## Installation
|
||||
|
||||
To use _regexpu-core_ programmatically, install it as a dependency via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install regexpu-core --save
|
||||
```
|
||||
|
||||
Then, `require` it:
|
||||
|
||||
```js
|
||||
const rewritePattern = require('regexpu-core');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This module exports a single function named `rewritePattern`.
|
||||
|
||||
### `rewritePattern(pattern, flags, options)`
|
||||
|
||||
This function takes a string that represents a regular expression pattern as well as a string representing its flags, and returns an ES5-compatible version of the pattern.
|
||||
|
||||
```js
|
||||
rewritePattern('foo.bar', 'u');
|
||||
// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF])bar'
|
||||
|
||||
rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'u');
|
||||
// → '(?:[a-z]|\\uD834[\\uDF06-\\uDF08])'
|
||||
|
||||
rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'ui');
|
||||
// → '(?:[a-z\\u017F\\u212A]|\\uD834[\\uDF06-\\uDF08])'
|
||||
```
|
||||
|
||||
_regexpu-core_ can rewrite non-ES6 regular expressions too, which is useful to demonstrate how their behavior changes once the `u` and `i` flags are added:
|
||||
|
||||
```js
|
||||
// In ES5, the dot operator only matches BMP symbols:
|
||||
rewritePattern('foo.bar');
|
||||
// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uFFFF])bar'
|
||||
|
||||
// But with the ES2015 `u` flag, it matches astral symbols too:
|
||||
rewritePattern('foo.bar', 'u');
|
||||
// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF])bar'
|
||||
```
|
||||
|
||||
The optional `options` argument recognizes the following properties:
|
||||
|
||||
#### `dotAllFlag` (default: `false`)
|
||||
|
||||
Setting this option to `true` enables support for [the `s` (`dotAll`) flag](https://github.com/mathiasbynens/es-regexp-dotall-flag).
|
||||
|
||||
```js
|
||||
rewritePattern('.');
|
||||
// → '[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uFFFF]'
|
||||
|
||||
rewritePattern('.', '', {
|
||||
'dotAllFlag': true
|
||||
});
|
||||
// → '[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uFFFF]'
|
||||
|
||||
rewritePattern('.', 's', {
|
||||
'dotAllFlag': true
|
||||
});
|
||||
// → '[\\0-\\uFFFF]'
|
||||
|
||||
rewritePattern('.', 'su', {
|
||||
'dotAllFlag': true
|
||||
});
|
||||
// → '(?:[\\0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])'
|
||||
```
|
||||
|
||||
#### `unicodePropertyEscape` (default: `false`)
|
||||
|
||||
Setting this option to `true` enables [support for Unicode property escapes](property-escapes.md):
|
||||
|
||||
```js
|
||||
rewritePattern('\\p{Script_Extensions=Anatolian_Hieroglyphs}', 'u', {
|
||||
'unicodePropertyEscape': true
|
||||
});
|
||||
// → '(?:\\uD811[\\uDC00-\\uDE46])'
|
||||
```
|
||||
|
||||
#### `lookbehind` (default: `false`)
|
||||
|
||||
Setting this option to `true` enables support for [lookbehind assertions](https://github.com/tc39/proposal-regexp-lookbehind).
|
||||
|
||||
```js
|
||||
rewritePattern('(?<=.)a', '', {
|
||||
'lookbehind': true
|
||||
});
|
||||
// → '(?<=[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uFFFF])a'
|
||||
```
|
||||
|
||||
#### `namedGroup` (default: `false`)
|
||||
|
||||
Setting this option to `true` enables support for [named capture groups](https://github.com/tc39/proposal-regexp-named-groups).
|
||||
|
||||
```js
|
||||
rewritePattern('(?<name>.)\k<name>', '', {
|
||||
'namedGroup': true
|
||||
});
|
||||
// → '(.)\1'
|
||||
```
|
||||
|
||||
#### `onNamedGroup`
|
||||
|
||||
This option is a function that gets called when a named capture group is found. It receives two parameters:
|
||||
the name of the group, and its index.
|
||||
|
||||
```js
|
||||
rewritePattern('(?<name>.)\k<name>', '', {
|
||||
'namedGroup': true,
|
||||
onNamedGroup(name, index) {
|
||||
console.log(name, index);
|
||||
// → 'name', 1
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
#### `useUnicodeFlag` (default: `false`)
|
||||
|
||||
Setting this option to `true` enables the use of Unicode code point escapes of the form `\u{…}`. Note that in regular expressions, such escape sequences only work correctly when the ES2015 `u` flag is set. Enabling this setting often results in more compact output, although there are cases (such as `\p{Lu}`) where it actually _increases_ the output size.
|
||||
|
||||
```js
|
||||
rewritePattern('\\p{Script_Extensions=Anatolian_Hieroglyphs}', 'u', {
|
||||
'unicodePropertyEscape': true,
|
||||
'useUnicodeFlag': true
|
||||
});
|
||||
// → '[\\u{14400}-\\u{14646}]'
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
_regexpu-core_ is available under the [MIT](https://mths.be/mit) license.
|
105
assets_old/node_modules/regexpu-core/data/character-class-escape-sets.js
generated
vendored
Normal file
105
assets_old/node_modules/regexpu-core/data/character-class-escape-sets.js
generated
vendored
Normal file
|
@ -0,0 +1,105 @@
|
|||
// Generated using `npm run build`. Do not edit.
|
||||
'use strict';
|
||||
|
||||
const regenerate = require('regenerate');
|
||||
|
||||
exports.REGULAR = new Map([
|
||||
['d', regenerate()
|
||||
.addRange(0x30, 0x39)],
|
||||
['D', regenerate()
|
||||
.addRange(0x0, 0x2F)
|
||||
.addRange(0x3A, 0xFFFF)],
|
||||
['s', regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF)
|
||||
.addRange(0x9, 0xD)
|
||||
.addRange(0x2000, 0x200A)
|
||||
.addRange(0x2028, 0x2029)],
|
||||
['S', regenerate()
|
||||
.addRange(0x0, 0x8)
|
||||
.addRange(0xE, 0x1F)
|
||||
.addRange(0x21, 0x9F)
|
||||
.addRange(0xA1, 0x167F)
|
||||
.addRange(0x1681, 0x1FFF)
|
||||
.addRange(0x200B, 0x2027)
|
||||
.addRange(0x202A, 0x202E)
|
||||
.addRange(0x2030, 0x205E)
|
||||
.addRange(0x2060, 0x2FFF)
|
||||
.addRange(0x3001, 0xFEFE)
|
||||
.addRange(0xFF00, 0xFFFF)],
|
||||
['w', regenerate(0x5F)
|
||||
.addRange(0x30, 0x39)
|
||||
.addRange(0x41, 0x5A)
|
||||
.addRange(0x61, 0x7A)],
|
||||
['W', regenerate(0x60)
|
||||
.addRange(0x0, 0x2F)
|
||||
.addRange(0x3A, 0x40)
|
||||
.addRange(0x5B, 0x5E)
|
||||
.addRange(0x7B, 0xFFFF)]
|
||||
]);
|
||||
|
||||
exports.UNICODE = new Map([
|
||||
['d', regenerate()
|
||||
.addRange(0x30, 0x39)],
|
||||
['D', regenerate()
|
||||
.addRange(0x0, 0x2F)
|
||||
.addRange(0x3A, 0x10FFFF)],
|
||||
['s', regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF)
|
||||
.addRange(0x9, 0xD)
|
||||
.addRange(0x2000, 0x200A)
|
||||
.addRange(0x2028, 0x2029)],
|
||||
['S', regenerate()
|
||||
.addRange(0x0, 0x8)
|
||||
.addRange(0xE, 0x1F)
|
||||
.addRange(0x21, 0x9F)
|
||||
.addRange(0xA1, 0x167F)
|
||||
.addRange(0x1681, 0x1FFF)
|
||||
.addRange(0x200B, 0x2027)
|
||||
.addRange(0x202A, 0x202E)
|
||||
.addRange(0x2030, 0x205E)
|
||||
.addRange(0x2060, 0x2FFF)
|
||||
.addRange(0x3001, 0xFEFE)
|
||||
.addRange(0xFF00, 0x10FFFF)],
|
||||
['w', regenerate(0x5F)
|
||||
.addRange(0x30, 0x39)
|
||||
.addRange(0x41, 0x5A)
|
||||
.addRange(0x61, 0x7A)],
|
||||
['W', regenerate(0x60)
|
||||
.addRange(0x0, 0x2F)
|
||||
.addRange(0x3A, 0x40)
|
||||
.addRange(0x5B, 0x5E)
|
||||
.addRange(0x7B, 0x10FFFF)]
|
||||
]);
|
||||
|
||||
exports.UNICODE_IGNORE_CASE = new Map([
|
||||
['d', regenerate()
|
||||
.addRange(0x30, 0x39)],
|
||||
['D', regenerate()
|
||||
.addRange(0x0, 0x2F)
|
||||
.addRange(0x3A, 0x10FFFF)],
|
||||
['s', regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF)
|
||||
.addRange(0x9, 0xD)
|
||||
.addRange(0x2000, 0x200A)
|
||||
.addRange(0x2028, 0x2029)],
|
||||
['S', regenerate()
|
||||
.addRange(0x0, 0x8)
|
||||
.addRange(0xE, 0x1F)
|
||||
.addRange(0x21, 0x9F)
|
||||
.addRange(0xA1, 0x167F)
|
||||
.addRange(0x1681, 0x1FFF)
|
||||
.addRange(0x200B, 0x2027)
|
||||
.addRange(0x202A, 0x202E)
|
||||
.addRange(0x2030, 0x205E)
|
||||
.addRange(0x2060, 0x2FFF)
|
||||
.addRange(0x3001, 0xFEFE)
|
||||
.addRange(0xFF00, 0x10FFFF)],
|
||||
['w', regenerate(0x5F, 0x17F, 0x212A)
|
||||
.addRange(0x30, 0x39)
|
||||
.addRange(0x41, 0x5A)
|
||||
.addRange(0x61, 0x7A)],
|
||||
['W', regenerate(0x60)
|
||||
.addRange(0x0, 0x2F)
|
||||
.addRange(0x3A, 0x40)
|
||||
.addRange(0x5B, 0x5E)
|
||||
.addRange(0x7B, 0x17E)
|
||||
.addRange(0x180, 0x2129)
|
||||
.addRange(0x212B, 0x10FFFF)]
|
||||
]);
|
586
assets_old/node_modules/regexpu-core/data/iu-mappings.js
generated
vendored
Normal file
586
assets_old/node_modules/regexpu-core/data/iu-mappings.js
generated
vendored
Normal file
|
@ -0,0 +1,586 @@
|
|||
module.exports = new Map([
|
||||
[0x4B, 0x212A],
|
||||
[0x53, 0x17F],
|
||||
[0x6B, 0x212A],
|
||||
[0x73, 0x17F],
|
||||
[0xB5, 0x39C],
|
||||
[0xC5, 0x212B],
|
||||
[0xDF, 0x1E9E],
|
||||
[0xE5, 0x212B],
|
||||
[0x17F, 0x53],
|
||||
[0x1C4, 0x1C5],
|
||||
[0x1C5, 0x1C4],
|
||||
[0x1C7, 0x1C8],
|
||||
[0x1C8, 0x1C7],
|
||||
[0x1CA, 0x1CB],
|
||||
[0x1CB, 0x1CA],
|
||||
[0x1F1, 0x1F2],
|
||||
[0x1F2, 0x1F1],
|
||||
[0x345, 0x1FBE],
|
||||
[0x392, 0x3D0],
|
||||
[0x395, 0x3F5],
|
||||
[0x398, 0x3F4],
|
||||
[0x399, 0x1FBE],
|
||||
[0x39A, 0x3F0],
|
||||
[0x39C, 0xB5],
|
||||
[0x3A0, 0x3D6],
|
||||
[0x3A1, 0x3F1],
|
||||
[0x3A3, 0x3C2],
|
||||
[0x3A6, 0x3D5],
|
||||
[0x3A9, 0x2126],
|
||||
[0x3B8, 0x3F4],
|
||||
[0x3C2, 0x3A3],
|
||||
[0x3C9, 0x2126],
|
||||
[0x3D0, 0x392],
|
||||
[0x3D1, 0x3F4],
|
||||
[0x3D5, 0x3A6],
|
||||
[0x3D6, 0x3A0],
|
||||
[0x3F0, 0x39A],
|
||||
[0x3F1, 0x3A1],
|
||||
[0x3F4, [
|
||||
0x398,
|
||||
0x3D1,
|
||||
0x3B8
|
||||
]],
|
||||
[0x3F5, 0x395],
|
||||
[0x412, 0x1C80],
|
||||
[0x414, 0x1C81],
|
||||
[0x41E, 0x1C82],
|
||||
[0x421, 0x1C83],
|
||||
[0x422, 0x1C85],
|
||||
[0x42A, 0x1C86],
|
||||
[0x462, 0x1C87],
|
||||
[0x1C80, 0x412],
|
||||
[0x1C81, 0x414],
|
||||
[0x1C82, 0x41E],
|
||||
[0x1C83, 0x421],
|
||||
[0x1C84, 0x1C85],
|
||||
[0x1C85, [
|
||||
0x422,
|
||||
0x1C84
|
||||
]],
|
||||
[0x1C86, 0x42A],
|
||||
[0x1C87, 0x462],
|
||||
[0x1C88, 0xA64A],
|
||||
[0x1E60, 0x1E9B],
|
||||
[0x1E9B, 0x1E60],
|
||||
[0x1E9E, 0xDF],
|
||||
[0x1F80, 0x1F88],
|
||||
[0x1F81, 0x1F89],
|
||||
[0x1F82, 0x1F8A],
|
||||
[0x1F83, 0x1F8B],
|
||||
[0x1F84, 0x1F8C],
|
||||
[0x1F85, 0x1F8D],
|
||||
[0x1F86, 0x1F8E],
|
||||
[0x1F87, 0x1F8F],
|
||||
[0x1F88, 0x1F80],
|
||||
[0x1F89, 0x1F81],
|
||||
[0x1F8A, 0x1F82],
|
||||
[0x1F8B, 0x1F83],
|
||||
[0x1F8C, 0x1F84],
|
||||
[0x1F8D, 0x1F85],
|
||||
[0x1F8E, 0x1F86],
|
||||
[0x1F8F, 0x1F87],
|
||||
[0x1F90, 0x1F98],
|
||||
[0x1F91, 0x1F99],
|
||||
[0x1F92, 0x1F9A],
|
||||
[0x1F93, 0x1F9B],
|
||||
[0x1F94, 0x1F9C],
|
||||
[0x1F95, 0x1F9D],
|
||||
[0x1F96, 0x1F9E],
|
||||
[0x1F97, 0x1F9F],
|
||||
[0x1F98, 0x1F90],
|
||||
[0x1F99, 0x1F91],
|
||||
[0x1F9A, 0x1F92],
|
||||
[0x1F9B, 0x1F93],
|
||||
[0x1F9C, 0x1F94],
|
||||
[0x1F9D, 0x1F95],
|
||||
[0x1F9E, 0x1F96],
|
||||
[0x1F9F, 0x1F97],
|
||||
[0x1FA0, 0x1FA8],
|
||||
[0x1FA1, 0x1FA9],
|
||||
[0x1FA2, 0x1FAA],
|
||||
[0x1FA3, 0x1FAB],
|
||||
[0x1FA4, 0x1FAC],
|
||||
[0x1FA5, 0x1FAD],
|
||||
[0x1FA6, 0x1FAE],
|
||||
[0x1FA7, 0x1FAF],
|
||||
[0x1FA8, 0x1FA0],
|
||||
[0x1FA9, 0x1FA1],
|
||||
[0x1FAA, 0x1FA2],
|
||||
[0x1FAB, 0x1FA3],
|
||||
[0x1FAC, 0x1FA4],
|
||||
[0x1FAD, 0x1FA5],
|
||||
[0x1FAE, 0x1FA6],
|
||||
[0x1FAF, 0x1FA7],
|
||||
[0x1FB3, 0x1FBC],
|
||||
[0x1FBC, 0x1FB3],
|
||||
[0x1FBE, [
|
||||
0x345,
|
||||
0x399
|
||||
]],
|
||||
[0x1FC3, 0x1FCC],
|
||||
[0x1FCC, 0x1FC3],
|
||||
[0x1FF3, 0x1FFC],
|
||||
[0x1FFC, 0x1FF3],
|
||||
[0x2126, [
|
||||
0x3A9,
|
||||
0x3C9
|
||||
]],
|
||||
[0x212A, 0x4B],
|
||||
[0x212B, [
|
||||
0xC5,
|
||||
0xE5
|
||||
]],
|
||||
[0xA64A, 0x1C88],
|
||||
[0x10400, 0x10428],
|
||||
[0x10401, 0x10429],
|
||||
[0x10402, 0x1042A],
|
||||
[0x10403, 0x1042B],
|
||||
[0x10404, 0x1042C],
|
||||
[0x10405, 0x1042D],
|
||||
[0x10406, 0x1042E],
|
||||
[0x10407, 0x1042F],
|
||||
[0x10408, 0x10430],
|
||||
[0x10409, 0x10431],
|
||||
[0x1040A, 0x10432],
|
||||
[0x1040B, 0x10433],
|
||||
[0x1040C, 0x10434],
|
||||
[0x1040D, 0x10435],
|
||||
[0x1040E, 0x10436],
|
||||
[0x1040F, 0x10437],
|
||||
[0x10410, 0x10438],
|
||||
[0x10411, 0x10439],
|
||||
[0x10412, 0x1043A],
|
||||
[0x10413, 0x1043B],
|
||||
[0x10414, 0x1043C],
|
||||
[0x10415, 0x1043D],
|
||||
[0x10416, 0x1043E],
|
||||
[0x10417, 0x1043F],
|
||||
[0x10418, 0x10440],
|
||||
[0x10419, 0x10441],
|
||||
[0x1041A, 0x10442],
|
||||
[0x1041B, 0x10443],
|
||||
[0x1041C, 0x10444],
|
||||
[0x1041D, 0x10445],
|
||||
[0x1041E, 0x10446],
|
||||
[0x1041F, 0x10447],
|
||||
[0x10420, 0x10448],
|
||||
[0x10421, 0x10449],
|
||||
[0x10422, 0x1044A],
|
||||
[0x10423, 0x1044B],
|
||||
[0x10424, 0x1044C],
|
||||
[0x10425, 0x1044D],
|
||||
[0x10426, 0x1044E],
|
||||
[0x10427, 0x1044F],
|
||||
[0x10428, 0x10400],
|
||||
[0x10429, 0x10401],
|
||||
[0x1042A, 0x10402],
|
||||
[0x1042B, 0x10403],
|
||||
[0x1042C, 0x10404],
|
||||
[0x1042D, 0x10405],
|
||||
[0x1042E, 0x10406],
|
||||
[0x1042F, 0x10407],
|
||||
[0x10430, 0x10408],
|
||||
[0x10431, 0x10409],
|
||||
[0x10432, 0x1040A],
|
||||
[0x10433, 0x1040B],
|
||||
[0x10434, 0x1040C],
|
||||
[0x10435, 0x1040D],
|
||||
[0x10436, 0x1040E],
|
||||
[0x10437, 0x1040F],
|
||||
[0x10438, 0x10410],
|
||||
[0x10439, 0x10411],
|
||||
[0x1043A, 0x10412],
|
||||
[0x1043B, 0x10413],
|
||||
[0x1043C, 0x10414],
|
||||
[0x1043D, 0x10415],
|
||||
[0x1043E, 0x10416],
|
||||
[0x1043F, 0x10417],
|
||||
[0x10440, 0x10418],
|
||||
[0x10441, 0x10419],
|
||||
[0x10442, 0x1041A],
|
||||
[0x10443, 0x1041B],
|
||||
[0x10444, 0x1041C],
|
||||
[0x10445, 0x1041D],
|
||||
[0x10446, 0x1041E],
|
||||
[0x10447, 0x1041F],
|
||||
[0x10448, 0x10420],
|
||||
[0x10449, 0x10421],
|
||||
[0x1044A, 0x10422],
|
||||
[0x1044B, 0x10423],
|
||||
[0x1044C, 0x10424],
|
||||
[0x1044D, 0x10425],
|
||||
[0x1044E, 0x10426],
|
||||
[0x1044F, 0x10427],
|
||||
[0x104B0, 0x104D8],
|
||||
[0x104B1, 0x104D9],
|
||||
[0x104B2, 0x104DA],
|
||||
[0x104B3, 0x104DB],
|
||||
[0x104B4, 0x104DC],
|
||||
[0x104B5, 0x104DD],
|
||||
[0x104B6, 0x104DE],
|
||||
[0x104B7, 0x104DF],
|
||||
[0x104B8, 0x104E0],
|
||||
[0x104B9, 0x104E1],
|
||||
[0x104BA, 0x104E2],
|
||||
[0x104BB, 0x104E3],
|
||||
[0x104BC, 0x104E4],
|
||||
[0x104BD, 0x104E5],
|
||||
[0x104BE, 0x104E6],
|
||||
[0x104BF, 0x104E7],
|
||||
[0x104C0, 0x104E8],
|
||||
[0x104C1, 0x104E9],
|
||||
[0x104C2, 0x104EA],
|
||||
[0x104C3, 0x104EB],
|
||||
[0x104C4, 0x104EC],
|
||||
[0x104C5, 0x104ED],
|
||||
[0x104C6, 0x104EE],
|
||||
[0x104C7, 0x104EF],
|
||||
[0x104C8, 0x104F0],
|
||||
[0x104C9, 0x104F1],
|
||||
[0x104CA, 0x104F2],
|
||||
[0x104CB, 0x104F3],
|
||||
[0x104CC, 0x104F4],
|
||||
[0x104CD, 0x104F5],
|
||||
[0x104CE, 0x104F6],
|
||||
[0x104CF, 0x104F7],
|
||||
[0x104D0, 0x104F8],
|
||||
[0x104D1, 0x104F9],
|
||||
[0x104D2, 0x104FA],
|
||||
[0x104D3, 0x104FB],
|
||||
[0x104D8, 0x104B0],
|
||||
[0x104D9, 0x104B1],
|
||||
[0x104DA, 0x104B2],
|
||||
[0x104DB, 0x104B3],
|
||||
[0x104DC, 0x104B4],
|
||||
[0x104DD, 0x104B5],
|
||||
[0x104DE, 0x104B6],
|
||||
[0x104DF, 0x104B7],
|
||||
[0x104E0, 0x104B8],
|
||||
[0x104E1, 0x104B9],
|
||||
[0x104E2, 0x104BA],
|
||||
[0x104E3, 0x104BB],
|
||||
[0x104E4, 0x104BC],
|
||||
[0x104E5, 0x104BD],
|
||||
[0x104E6, 0x104BE],
|
||||
[0x104E7, 0x104BF],
|
||||
[0x104E8, 0x104C0],
|
||||
[0x104E9, 0x104C1],
|
||||
[0x104EA, 0x104C2],
|
||||
[0x104EB, 0x104C3],
|
||||
[0x104EC, 0x104C4],
|
||||
[0x104ED, 0x104C5],
|
||||
[0x104EE, 0x104C6],
|
||||
[0x104EF, 0x104C7],
|
||||
[0x104F0, 0x104C8],
|
||||
[0x104F1, 0x104C9],
|
||||
[0x104F2, 0x104CA],
|
||||
[0x104F3, 0x104CB],
|
||||
[0x104F4, 0x104CC],
|
||||
[0x104F5, 0x104CD],
|
||||
[0x104F6, 0x104CE],
|
||||
[0x104F7, 0x104CF],
|
||||
[0x104F8, 0x104D0],
|
||||
[0x104F9, 0x104D1],
|
||||
[0x104FA, 0x104D2],
|
||||
[0x104FB, 0x104D3],
|
||||
[0x10C80, 0x10CC0],
|
||||
[0x10C81, 0x10CC1],
|
||||
[0x10C82, 0x10CC2],
|
||||
[0x10C83, 0x10CC3],
|
||||
[0x10C84, 0x10CC4],
|
||||
[0x10C85, 0x10CC5],
|
||||
[0x10C86, 0x10CC6],
|
||||
[0x10C87, 0x10CC7],
|
||||
[0x10C88, 0x10CC8],
|
||||
[0x10C89, 0x10CC9],
|
||||
[0x10C8A, 0x10CCA],
|
||||
[0x10C8B, 0x10CCB],
|
||||
[0x10C8C, 0x10CCC],
|
||||
[0x10C8D, 0x10CCD],
|
||||
[0x10C8E, 0x10CCE],
|
||||
[0x10C8F, 0x10CCF],
|
||||
[0x10C90, 0x10CD0],
|
||||
[0x10C91, 0x10CD1],
|
||||
[0x10C92, 0x10CD2],
|
||||
[0x10C93, 0x10CD3],
|
||||
[0x10C94, 0x10CD4],
|
||||
[0x10C95, 0x10CD5],
|
||||
[0x10C96, 0x10CD6],
|
||||
[0x10C97, 0x10CD7],
|
||||
[0x10C98, 0x10CD8],
|
||||
[0x10C99, 0x10CD9],
|
||||
[0x10C9A, 0x10CDA],
|
||||
[0x10C9B, 0x10CDB],
|
||||
[0x10C9C, 0x10CDC],
|
||||
[0x10C9D, 0x10CDD],
|
||||
[0x10C9E, 0x10CDE],
|
||||
[0x10C9F, 0x10CDF],
|
||||
[0x10CA0, 0x10CE0],
|
||||
[0x10CA1, 0x10CE1],
|
||||
[0x10CA2, 0x10CE2],
|
||||
[0x10CA3, 0x10CE3],
|
||||
[0x10CA4, 0x10CE4],
|
||||
[0x10CA5, 0x10CE5],
|
||||
[0x10CA6, 0x10CE6],
|
||||
[0x10CA7, 0x10CE7],
|
||||
[0x10CA8, 0x10CE8],
|
||||
[0x10CA9, 0x10CE9],
|
||||
[0x10CAA, 0x10CEA],
|
||||
[0x10CAB, 0x10CEB],
|
||||
[0x10CAC, 0x10CEC],
|
||||
[0x10CAD, 0x10CED],
|
||||
[0x10CAE, 0x10CEE],
|
||||
[0x10CAF, 0x10CEF],
|
||||
[0x10CB0, 0x10CF0],
|
||||
[0x10CB1, 0x10CF1],
|
||||
[0x10CB2, 0x10CF2],
|
||||
[0x10CC0, 0x10C80],
|
||||
[0x10CC1, 0x10C81],
|
||||
[0x10CC2, 0x10C82],
|
||||
[0x10CC3, 0x10C83],
|
||||
[0x10CC4, 0x10C84],
|
||||
[0x10CC5, 0x10C85],
|
||||
[0x10CC6, 0x10C86],
|
||||
[0x10CC7, 0x10C87],
|
||||
[0x10CC8, 0x10C88],
|
||||
[0x10CC9, 0x10C89],
|
||||
[0x10CCA, 0x10C8A],
|
||||
[0x10CCB, 0x10C8B],
|
||||
[0x10CCC, 0x10C8C],
|
||||
[0x10CCD, 0x10C8D],
|
||||
[0x10CCE, 0x10C8E],
|
||||
[0x10CCF, 0x10C8F],
|
||||
[0x10CD0, 0x10C90],
|
||||
[0x10CD1, 0x10C91],
|
||||
[0x10CD2, 0x10C92],
|
||||
[0x10CD3, 0x10C93],
|
||||
[0x10CD4, 0x10C94],
|
||||
[0x10CD5, 0x10C95],
|
||||
[0x10CD6, 0x10C96],
|
||||
[0x10CD7, 0x10C97],
|
||||
[0x10CD8, 0x10C98],
|
||||
[0x10CD9, 0x10C99],
|
||||
[0x10CDA, 0x10C9A],
|
||||
[0x10CDB, 0x10C9B],
|
||||
[0x10CDC, 0x10C9C],
|
||||
[0x10CDD, 0x10C9D],
|
||||
[0x10CDE, 0x10C9E],
|
||||
[0x10CDF, 0x10C9F],
|
||||
[0x10CE0, 0x10CA0],
|
||||
[0x10CE1, 0x10CA1],
|
||||
[0x10CE2, 0x10CA2],
|
||||
[0x10CE3, 0x10CA3],
|
||||
[0x10CE4, 0x10CA4],
|
||||
[0x10CE5, 0x10CA5],
|
||||
[0x10CE6, 0x10CA6],
|
||||
[0x10CE7, 0x10CA7],
|
||||
[0x10CE8, 0x10CA8],
|
||||
[0x10CE9, 0x10CA9],
|
||||
[0x10CEA, 0x10CAA],
|
||||
[0x10CEB, 0x10CAB],
|
||||
[0x10CEC, 0x10CAC],
|
||||
[0x10CED, 0x10CAD],
|
||||
[0x10CEE, 0x10CAE],
|
||||
[0x10CEF, 0x10CAF],
|
||||
[0x10CF0, 0x10CB0],
|
||||
[0x10CF1, 0x10CB1],
|
||||
[0x10CF2, 0x10CB2],
|
||||
[0x118A0, 0x118C0],
|
||||
[0x118A1, 0x118C1],
|
||||
[0x118A2, 0x118C2],
|
||||
[0x118A3, 0x118C3],
|
||||
[0x118A4, 0x118C4],
|
||||
[0x118A5, 0x118C5],
|
||||
[0x118A6, 0x118C6],
|
||||
[0x118A7, 0x118C7],
|
||||
[0x118A8, 0x118C8],
|
||||
[0x118A9, 0x118C9],
|
||||
[0x118AA, 0x118CA],
|
||||
[0x118AB, 0x118CB],
|
||||
[0x118AC, 0x118CC],
|
||||
[0x118AD, 0x118CD],
|
||||
[0x118AE, 0x118CE],
|
||||
[0x118AF, 0x118CF],
|
||||
[0x118B0, 0x118D0],
|
||||
[0x118B1, 0x118D1],
|
||||
[0x118B2, 0x118D2],
|
||||
[0x118B3, 0x118D3],
|
||||
[0x118B4, 0x118D4],
|
||||
[0x118B5, 0x118D5],
|
||||
[0x118B6, 0x118D6],
|
||||
[0x118B7, 0x118D7],
|
||||
[0x118B8, 0x118D8],
|
||||
[0x118B9, 0x118D9],
|
||||
[0x118BA, 0x118DA],
|
||||
[0x118BB, 0x118DB],
|
||||
[0x118BC, 0x118DC],
|
||||
[0x118BD, 0x118DD],
|
||||
[0x118BE, 0x118DE],
|
||||
[0x118BF, 0x118DF],
|
||||
[0x118C0, 0x118A0],
|
||||
[0x118C1, 0x118A1],
|
||||
[0x118C2, 0x118A2],
|
||||
[0x118C3, 0x118A3],
|
||||
[0x118C4, 0x118A4],
|
||||
[0x118C5, 0x118A5],
|
||||
[0x118C6, 0x118A6],
|
||||
[0x118C7, 0x118A7],
|
||||
[0x118C8, 0x118A8],
|
||||
[0x118C9, 0x118A9],
|
||||
[0x118CA, 0x118AA],
|
||||
[0x118CB, 0x118AB],
|
||||
[0x118CC, 0x118AC],
|
||||
[0x118CD, 0x118AD],
|
||||
[0x118CE, 0x118AE],
|
||||
[0x118CF, 0x118AF],
|
||||
[0x118D0, 0x118B0],
|
||||
[0x118D1, 0x118B1],
|
||||
[0x118D2, 0x118B2],
|
||||
[0x118D3, 0x118B3],
|
||||
[0x118D4, 0x118B4],
|
||||
[0x118D5, 0x118B5],
|
||||
[0x118D6, 0x118B6],
|
||||
[0x118D7, 0x118B7],
|
||||
[0x118D8, 0x118B8],
|
||||
[0x118D9, 0x118B9],
|
||||
[0x118DA, 0x118BA],
|
||||
[0x118DB, 0x118BB],
|
||||
[0x118DC, 0x118BC],
|
||||
[0x118DD, 0x118BD],
|
||||
[0x118DE, 0x118BE],
|
||||
[0x118DF, 0x118BF],
|
||||
[0x16E40, 0x16E60],
|
||||
[0x16E41, 0x16E61],
|
||||
[0x16E42, 0x16E62],
|
||||
[0x16E43, 0x16E63],
|
||||
[0x16E44, 0x16E64],
|
||||
[0x16E45, 0x16E65],
|
||||
[0x16E46, 0x16E66],
|
||||
[0x16E47, 0x16E67],
|
||||
[0x16E48, 0x16E68],
|
||||
[0x16E49, 0x16E69],
|
||||
[0x16E4A, 0x16E6A],
|
||||
[0x16E4B, 0x16E6B],
|
||||
[0x16E4C, 0x16E6C],
|
||||
[0x16E4D, 0x16E6D],
|
||||
[0x16E4E, 0x16E6E],
|
||||
[0x16E4F, 0x16E6F],
|
||||
[0x16E50, 0x16E70],
|
||||
[0x16E51, 0x16E71],
|
||||
[0x16E52, 0x16E72],
|
||||
[0x16E53, 0x16E73],
|
||||
[0x16E54, 0x16E74],
|
||||
[0x16E55, 0x16E75],
|
||||
[0x16E56, 0x16E76],
|
||||
[0x16E57, 0x16E77],
|
||||
[0x16E58, 0x16E78],
|
||||
[0x16E59, 0x16E79],
|
||||
[0x16E5A, 0x16E7A],
|
||||
[0x16E5B, 0x16E7B],
|
||||
[0x16E5C, 0x16E7C],
|
||||
[0x16E5D, 0x16E7D],
|
||||
[0x16E5E, 0x16E7E],
|
||||
[0x16E5F, 0x16E7F],
|
||||
[0x16E60, 0x16E40],
|
||||
[0x16E61, 0x16E41],
|
||||
[0x16E62, 0x16E42],
|
||||
[0x16E63, 0x16E43],
|
||||
[0x16E64, 0x16E44],
|
||||
[0x16E65, 0x16E45],
|
||||
[0x16E66, 0x16E46],
|
||||
[0x16E67, 0x16E47],
|
||||
[0x16E68, 0x16E48],
|
||||
[0x16E69, 0x16E49],
|
||||
[0x16E6A, 0x16E4A],
|
||||
[0x16E6B, 0x16E4B],
|
||||
[0x16E6C, 0x16E4C],
|
||||
[0x16E6D, 0x16E4D],
|
||||
[0x16E6E, 0x16E4E],
|
||||
[0x16E6F, 0x16E4F],
|
||||
[0x16E70, 0x16E50],
|
||||
[0x16E71, 0x16E51],
|
||||
[0x16E72, 0x16E52],
|
||||
[0x16E73, 0x16E53],
|
||||
[0x16E74, 0x16E54],
|
||||
[0x16E75, 0x16E55],
|
||||
[0x16E76, 0x16E56],
|
||||
[0x16E77, 0x16E57],
|
||||
[0x16E78, 0x16E58],
|
||||
[0x16E79, 0x16E59],
|
||||
[0x16E7A, 0x16E5A],
|
||||
[0x16E7B, 0x16E5B],
|
||||
[0x16E7C, 0x16E5C],
|
||||
[0x16E7D, 0x16E5D],
|
||||
[0x16E7E, 0x16E5E],
|
||||
[0x16E7F, 0x16E5F],
|
||||
[0x1E900, 0x1E922],
|
||||
[0x1E901, 0x1E923],
|
||||
[0x1E902, 0x1E924],
|
||||
[0x1E903, 0x1E925],
|
||||
[0x1E904, 0x1E926],
|
||||
[0x1E905, 0x1E927],
|
||||
[0x1E906, 0x1E928],
|
||||
[0x1E907, 0x1E929],
|
||||
[0x1E908, 0x1E92A],
|
||||
[0x1E909, 0x1E92B],
|
||||
[0x1E90A, 0x1E92C],
|
||||
[0x1E90B, 0x1E92D],
|
||||
[0x1E90C, 0x1E92E],
|
||||
[0x1E90D, 0x1E92F],
|
||||
[0x1E90E, 0x1E930],
|
||||
[0x1E90F, 0x1E931],
|
||||
[0x1E910, 0x1E932],
|
||||
[0x1E911, 0x1E933],
|
||||
[0x1E912, 0x1E934],
|
||||
[0x1E913, 0x1E935],
|
||||
[0x1E914, 0x1E936],
|
||||
[0x1E915, 0x1E937],
|
||||
[0x1E916, 0x1E938],
|
||||
[0x1E917, 0x1E939],
|
||||
[0x1E918, 0x1E93A],
|
||||
[0x1E919, 0x1E93B],
|
||||
[0x1E91A, 0x1E93C],
|
||||
[0x1E91B, 0x1E93D],
|
||||
[0x1E91C, 0x1E93E],
|
||||
[0x1E91D, 0x1E93F],
|
||||
[0x1E91E, 0x1E940],
|
||||
[0x1E91F, 0x1E941],
|
||||
[0x1E920, 0x1E942],
|
||||
[0x1E921, 0x1E943],
|
||||
[0x1E922, 0x1E900],
|
||||
[0x1E923, 0x1E901],
|
||||
[0x1E924, 0x1E902],
|
||||
[0x1E925, 0x1E903],
|
||||
[0x1E926, 0x1E904],
|
||||
[0x1E927, 0x1E905],
|
||||
[0x1E928, 0x1E906],
|
||||
[0x1E929, 0x1E907],
|
||||
[0x1E92A, 0x1E908],
|
||||
[0x1E92B, 0x1E909],
|
||||
[0x1E92C, 0x1E90A],
|
||||
[0x1E92D, 0x1E90B],
|
||||
[0x1E92E, 0x1E90C],
|
||||
[0x1E92F, 0x1E90D],
|
||||
[0x1E930, 0x1E90E],
|
||||
[0x1E931, 0x1E90F],
|
||||
[0x1E932, 0x1E910],
|
||||
[0x1E933, 0x1E911],
|
||||
[0x1E934, 0x1E912],
|
||||
[0x1E935, 0x1E913],
|
||||
[0x1E936, 0x1E914],
|
||||
[0x1E937, 0x1E915],
|
||||
[0x1E938, 0x1E916],
|
||||
[0x1E939, 0x1E917],
|
||||
[0x1E93A, 0x1E918],
|
||||
[0x1E93B, 0x1E919],
|
||||
[0x1E93C, 0x1E91A],
|
||||
[0x1E93D, 0x1E91B],
|
||||
[0x1E93E, 0x1E91C],
|
||||
[0x1E93F, 0x1E91D],
|
||||
[0x1E940, 0x1E91E],
|
||||
[0x1E941, 0x1E91F],
|
||||
[0x1E942, 0x1E920],
|
||||
[0x1E943, 0x1E921]
|
||||
]);
|
67
assets_old/node_modules/regexpu-core/package.json
generated
vendored
Normal file
67
assets_old/node_modules/regexpu-core/package.json
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"name": "regexpu-core",
|
||||
"version": "4.7.1",
|
||||
"description": "regexpu’s core functionality (i.e. `rewritePattern(pattern, flag)`), capable of translating ES6 Unicode regular expressions to ES5.",
|
||||
"homepage": "https://mths.be/regexpu",
|
||||
"main": "rewrite-pattern.js",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"keywords": [
|
||||
"codegen",
|
||||
"desugaring",
|
||||
"ecmascript",
|
||||
"es5",
|
||||
"es6",
|
||||
"harmony",
|
||||
"javascript",
|
||||
"refactoring",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular expressions",
|
||||
"rewriting",
|
||||
"syntax",
|
||||
"transformation",
|
||||
"transpile",
|
||||
"transpiler",
|
||||
"unicode"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mathiasbynens/regexpu-core.git"
|
||||
},
|
||||
"bugs": "https://github.com/mathiasbynens/regexpu-core/issues",
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"rewrite-pattern.js",
|
||||
"data/character-class-escape-sets.js",
|
||||
"data/iu-mappings.js"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "node scripts/iu-mappings.js && node scripts/character-class-escape-sets.js",
|
||||
"test": "mocha tests",
|
||||
"cover": "istanbul cover --report html node_modules/.bin/_mocha tests -- -u exports -R spec"
|
||||
},
|
||||
"dependencies": {
|
||||
"regenerate": "^1.4.0",
|
||||
"regenerate-unicode-properties": "^8.2.0",
|
||||
"regjsgen": "^0.5.1",
|
||||
"regjsparser": "^0.6.4",
|
||||
"unicode-match-property-ecmascript": "^1.0.4",
|
||||
"unicode-match-property-value-ecmascript": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"codecov": "^3.6.5",
|
||||
"istanbul": "^0.4.5",
|
||||
"jsesc": "^2.5.2",
|
||||
"lodash": "^4.17.15",
|
||||
"mocha": "^7.1.0",
|
||||
"regexpu-fixtures": "2.1.4",
|
||||
"unicode-13.0.0": "^0.8.0"
|
||||
}
|
||||
}
|
346
assets_old/node_modules/regexpu-core/rewrite-pattern.js
generated
vendored
Normal file
346
assets_old/node_modules/regexpu-core/rewrite-pattern.js
generated
vendored
Normal file
|
@ -0,0 +1,346 @@
|
|||
'use strict';
|
||||
|
||||
const generate = require('regjsgen').generate;
|
||||
const parse = require('regjsparser').parse;
|
||||
const regenerate = require('regenerate');
|
||||
const unicodeMatchProperty = require('unicode-match-property-ecmascript');
|
||||
const unicodeMatchPropertyValue = require('unicode-match-property-value-ecmascript');
|
||||
const iuMappings = require('./data/iu-mappings.js');
|
||||
const ESCAPE_SETS = require('./data/character-class-escape-sets.js');
|
||||
|
||||
// Prepare a Regenerate set containing all code points, used for negative
|
||||
// character classes (if any).
|
||||
const UNICODE_SET = regenerate().addRange(0x0, 0x10FFFF);
|
||||
// Without the `u` flag, the range stops at 0xFFFF.
|
||||
// https://mths.be/es6#sec-pattern-semantics
|
||||
const BMP_SET = regenerate().addRange(0x0, 0xFFFF);
|
||||
|
||||
// Prepare a Regenerate set containing all code points that are supposed to be
|
||||
// matched by `/./u`. https://mths.be/es6#sec-atom
|
||||
const DOT_SET_UNICODE = UNICODE_SET.clone() // all Unicode code points
|
||||
.remove(
|
||||
// minus `LineTerminator`s (https://mths.be/es6#sec-line-terminators):
|
||||
0x000A, // Line Feed <LF>
|
||||
0x000D, // Carriage Return <CR>
|
||||
0x2028, // Line Separator <LS>
|
||||
0x2029 // Paragraph Separator <PS>
|
||||
);
|
||||
|
||||
const getCharacterClassEscapeSet = (character, unicode, ignoreCase) => {
|
||||
if (unicode) {
|
||||
if (ignoreCase) {
|
||||
return ESCAPE_SETS.UNICODE_IGNORE_CASE.get(character);
|
||||
}
|
||||
return ESCAPE_SETS.UNICODE.get(character);
|
||||
}
|
||||
return ESCAPE_SETS.REGULAR.get(character);
|
||||
};
|
||||
|
||||
const getUnicodeDotSet = (dotAll) => {
|
||||
return dotAll ? UNICODE_SET : DOT_SET_UNICODE;
|
||||
};
|
||||
|
||||
const getUnicodePropertyValueSet = (property, value) => {
|
||||
const path = value ?
|
||||
`${ property }/${ value }` :
|
||||
`Binary_Property/${ property }`;
|
||||
try {
|
||||
return require(`regenerate-unicode-properties/${ path }.js`);
|
||||
} catch (exception) {
|
||||
throw new Error(
|
||||
`Failed to recognize value \`${ value }\` for property ` +
|
||||
`\`${ property }\`.`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const handleLoneUnicodePropertyNameOrValue = (value) => {
|
||||
// It could be a `General_Category` value or a binary property.
|
||||
// Note: `unicodeMatchPropertyValue` throws on invalid values.
|
||||
try {
|
||||
const property = 'General_Category';
|
||||
const category = unicodeMatchPropertyValue(property, value);
|
||||
return getUnicodePropertyValueSet(property, category);
|
||||
} catch (exception) {}
|
||||
// It’s not a `General_Category` value, so check if it’s a binary
|
||||
// property. Note: `unicodeMatchProperty` throws on invalid properties.
|
||||
const property = unicodeMatchProperty(value);
|
||||
return getUnicodePropertyValueSet(property);
|
||||
};
|
||||
|
||||
const getUnicodePropertyEscapeSet = (value, isNegative) => {
|
||||
const parts = value.split('=');
|
||||
const firstPart = parts[0];
|
||||
let set;
|
||||
if (parts.length == 1) {
|
||||
set = handleLoneUnicodePropertyNameOrValue(firstPart);
|
||||
} else {
|
||||
// The pattern consists of two parts, i.e. `Property=Value`.
|
||||
const property = unicodeMatchProperty(firstPart);
|
||||
const value = unicodeMatchPropertyValue(property, parts[1]);
|
||||
set = getUnicodePropertyValueSet(property, value);
|
||||
}
|
||||
if (isNegative) {
|
||||
return UNICODE_SET.clone().remove(set);
|
||||
}
|
||||
return set.clone();
|
||||
};
|
||||
|
||||
// Given a range of code points, add any case-folded code points in that range
|
||||
// to a set.
|
||||
regenerate.prototype.iuAddRange = function(min, max) {
|
||||
const $this = this;
|
||||
do {
|
||||
const folded = caseFold(min);
|
||||
if (folded) {
|
||||
$this.add(folded);
|
||||
}
|
||||
} while (++min <= max);
|
||||
return $this;
|
||||
};
|
||||
|
||||
const update = (item, pattern) => {
|
||||
let tree = parse(pattern, config.useUnicodeFlag ? 'u' : '');
|
||||
switch (tree.type) {
|
||||
case 'characterClass':
|
||||
case 'group':
|
||||
case 'value':
|
||||
// No wrapping needed.
|
||||
break;
|
||||
default:
|
||||
// Wrap the pattern in a non-capturing group.
|
||||
tree = wrap(tree, pattern);
|
||||
}
|
||||
Object.assign(item, tree);
|
||||
};
|
||||
|
||||
const wrap = (tree, pattern) => {
|
||||
// Wrap the pattern in a non-capturing group.
|
||||
return {
|
||||
'type': 'group',
|
||||
'behavior': 'ignore',
|
||||
'body': [tree],
|
||||
'raw': `(?:${ pattern })`
|
||||
};
|
||||
};
|
||||
|
||||
const caseFold = (codePoint) => {
|
||||
return iuMappings.get(codePoint) || false;
|
||||
};
|
||||
|
||||
const processCharacterClass = (characterClassItem, regenerateOptions) => {
|
||||
const set = regenerate();
|
||||
for (const item of characterClassItem.body) {
|
||||
switch (item.type) {
|
||||
case 'value':
|
||||
set.add(item.codePoint);
|
||||
if (config.ignoreCase && config.unicode && !config.useUnicodeFlag) {
|
||||
const folded = caseFold(item.codePoint);
|
||||
if (folded) {
|
||||
set.add(folded);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'characterClassRange':
|
||||
const min = item.min.codePoint;
|
||||
const max = item.max.codePoint;
|
||||
set.addRange(min, max);
|
||||
if (config.ignoreCase && config.unicode && !config.useUnicodeFlag) {
|
||||
set.iuAddRange(min, max);
|
||||
}
|
||||
break;
|
||||
case 'characterClassEscape':
|
||||
set.add(getCharacterClassEscapeSet(
|
||||
item.value,
|
||||
config.unicode,
|
||||
config.ignoreCase
|
||||
));
|
||||
break;
|
||||
case 'unicodePropertyEscape':
|
||||
set.add(getUnicodePropertyEscapeSet(item.value, item.negative));
|
||||
break;
|
||||
// The `default` clause is only here as a safeguard; it should never be
|
||||
// reached. Code coverage tools should ignore it.
|
||||
/* istanbul ignore next */
|
||||
default:
|
||||
throw new Error(`Unknown term type: ${ item.type }`);
|
||||
}
|
||||
}
|
||||
if (characterClassItem.negative) {
|
||||
update(characterClassItem, `(?!${set.toString(regenerateOptions)})[\\s\\S]`)
|
||||
} else {
|
||||
update(characterClassItem, set.toString(regenerateOptions));
|
||||
}
|
||||
return characterClassItem;
|
||||
};
|
||||
|
||||
const updateNamedReference = (item, index) => {
|
||||
delete item.name;
|
||||
item.matchIndex = index;
|
||||
};
|
||||
|
||||
const assertNoUnmatchedReferences = (groups) => {
|
||||
const unmatchedReferencesNames = Object.keys(groups.unmatchedReferences);
|
||||
if (unmatchedReferencesNames.length > 0) {
|
||||
throw new Error(`Unknown group names: ${unmatchedReferencesNames}`);
|
||||
}
|
||||
};
|
||||
|
||||
const processTerm = (item, regenerateOptions, groups) => {
|
||||
switch (item.type) {
|
||||
case 'dot':
|
||||
if (config.useDotAllFlag) {
|
||||
break;
|
||||
} else if (config.unicode) {
|
||||
update(
|
||||
item,
|
||||
getUnicodeDotSet(config.dotAll).toString(regenerateOptions)
|
||||
);
|
||||
} else if (config.dotAll) {
|
||||
// TODO: consider changing this at the regenerate level.
|
||||
update(item, '[\\s\\S]');
|
||||
}
|
||||
break;
|
||||
case 'characterClass':
|
||||
item = processCharacterClass(item, regenerateOptions);
|
||||
break;
|
||||
case 'unicodePropertyEscape':
|
||||
if (config.unicodePropertyEscape) {
|
||||
update(
|
||||
item,
|
||||
getUnicodePropertyEscapeSet(item.value, item.negative)
|
||||
.toString(regenerateOptions)
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'characterClassEscape':
|
||||
update(
|
||||
item,
|
||||
getCharacterClassEscapeSet(
|
||||
item.value,
|
||||
config.unicode,
|
||||
config.ignoreCase
|
||||
).toString(regenerateOptions)
|
||||
);
|
||||
break;
|
||||
case 'group':
|
||||
if (item.behavior == 'normal') {
|
||||
groups.lastIndex++;
|
||||
}
|
||||
if (item.name && config.namedGroup) {
|
||||
const name = item.name.value;
|
||||
|
||||
if (groups.names[name]) {
|
||||
throw new Error(
|
||||
`Multiple groups with the same name (${ name }) are not allowed.`
|
||||
);
|
||||
}
|
||||
|
||||
const index = groups.lastIndex;
|
||||
delete item.name;
|
||||
|
||||
groups.names[name] = index;
|
||||
if (groups.onNamedGroup) {
|
||||
groups.onNamedGroup.call(null, name, index);
|
||||
}
|
||||
|
||||
if (groups.unmatchedReferences[name]) {
|
||||
groups.unmatchedReferences[name].forEach(reference => {
|
||||
updateNamedReference(reference, index);
|
||||
});
|
||||
delete groups.unmatchedReferences[name];
|
||||
}
|
||||
}
|
||||
/* falls through */
|
||||
case 'alternative':
|
||||
case 'disjunction':
|
||||
case 'quantifier':
|
||||
item.body = item.body.map(term => {
|
||||
return processTerm(term, regenerateOptions, groups);
|
||||
});
|
||||
break;
|
||||
case 'value':
|
||||
const codePoint = item.codePoint;
|
||||
const set = regenerate(codePoint);
|
||||
if (config.ignoreCase && config.unicode && !config.useUnicodeFlag) {
|
||||
const folded = caseFold(codePoint);
|
||||
if (folded) {
|
||||
set.add(folded);
|
||||
}
|
||||
}
|
||||
update(item, set.toString(regenerateOptions));
|
||||
break;
|
||||
case 'reference':
|
||||
if (item.name) {
|
||||
const name = item.name.value;
|
||||
const index = groups.names[name];
|
||||
if (index) {
|
||||
updateNamedReference(item, index);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!groups.unmatchedReferences[name]) {
|
||||
groups.unmatchedReferences[name] = [];
|
||||
}
|
||||
// Keep track of references used before the corresponding group.
|
||||
groups.unmatchedReferences[name].push(item);
|
||||
}
|
||||
break;
|
||||
case 'anchor':
|
||||
case 'empty':
|
||||
case 'group':
|
||||
// Nothing to do here.
|
||||
break;
|
||||
// The `default` clause is only here as a safeguard; it should never be
|
||||
// reached. Code coverage tools should ignore it.
|
||||
/* istanbul ignore next */
|
||||
default:
|
||||
throw new Error(`Unknown term type: ${ item.type }`);
|
||||
}
|
||||
return item;
|
||||
};
|
||||
|
||||
const config = {
|
||||
'ignoreCase': false,
|
||||
'unicode': false,
|
||||
'dotAll': false,
|
||||
'useDotAllFlag': false,
|
||||
'useUnicodeFlag': false,
|
||||
'unicodePropertyEscape': false,
|
||||
'namedGroup': false
|
||||
};
|
||||
const rewritePattern = (pattern, flags, options) => {
|
||||
config.unicode = flags && flags.includes('u');
|
||||
const regjsparserFeatures = {
|
||||
'unicodePropertyEscape': config.unicode,
|
||||
'namedGroups': true,
|
||||
'lookbehind': options && options.lookbehind
|
||||
};
|
||||
config.ignoreCase = flags && flags.includes('i');
|
||||
const supportDotAllFlag = options && options.dotAllFlag;
|
||||
config.dotAll = supportDotAllFlag && flags && flags.includes('s');
|
||||
config.namedGroup = options && options.namedGroup;
|
||||
config.useDotAllFlag = options && options.useDotAllFlag;
|
||||
config.useUnicodeFlag = options && options.useUnicodeFlag;
|
||||
config.unicodePropertyEscape = options && options.unicodePropertyEscape;
|
||||
if (supportDotAllFlag && config.useDotAllFlag) {
|
||||
throw new Error('`useDotAllFlag` and `dotAllFlag` cannot both be true!');
|
||||
}
|
||||
const regenerateOptions = {
|
||||
'hasUnicodeFlag': config.useUnicodeFlag,
|
||||
'bmpOnly': !config.unicode
|
||||
};
|
||||
const groups = {
|
||||
'onNamedGroup': options && options.onNamedGroup,
|
||||
'lastIndex': 0,
|
||||
'names': Object.create(null), // { [name]: index }
|
||||
'unmatchedReferences': Object.create(null) // { [name]: Array<reference> }
|
||||
};
|
||||
const tree = parse(pattern, flags, regjsparserFeatures);
|
||||
// Note: `processTerm` mutates `tree` and `groups`.
|
||||
processTerm(tree, regenerateOptions, groups);
|
||||
assertNoUnmatchedReferences(groups);
|
||||
return generate(tree);
|
||||
};
|
||||
|
||||
module.exports = rewritePattern;
|
Loading…
Add table
Add a link
Reference in a new issue