Tommy Martino | 12978e3 | 2020-09-03 10:08:31 -0400 | [diff] [blame] | 1 | /** |
| 2 | * Copyright 2020 Google LLC |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /** |
| 18 | * Helper script which outputs an ES5-compatible regex for identifying boundary |
| 19 | * characters. Ideally this would be done in the affected file automatically at |
| 20 | * build-time, but doing so would break integrations that rely on including that |
| 21 | * file uncompiled. Better still would be to use the Unicode Character |
| 22 | * Properties regexes that were added in ES 2018, but it will be a long time |
| 23 | * before those have wide support. |
| 24 | */ |
| 25 | |
| 26 | const regenerate = require('regenerate'); |
Tommy Martino | 7b2a874 | 2020-09-23 15:37:54 -0400 | [diff] [blame] | 27 | const set = |
| 28 | regenerate() |
| 29 | .add(require( |
| 30 | 'unicode-9.0.0/General_Category/Punctuation/code-points.js')) |
| 31 | .add(require( |
| 32 | 'unicode-9.0.0/Binary_Property/White_Space/code-points.js')); |
Tommy Martino | 12978e3 | 2020-09-03 10:08:31 -0400 | [diff] [blame] | 33 | console.log('/' + set.toString() + '/u'); |