blob: 0d73969c28480056f1de03d352f5f42f06313b50 [file] [log] [blame]
Tommy Martino12978e32020-09-03 10:08:31 -04001/**
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
26const regenerate = require('regenerate');
27const set = regenerate()
28 .add(require('unicode-9.0.0/General_Category/Punctuation/code-points.js'))
29 .add(require('unicode-9.0.0/Binary_Property/White_Space/code-points.js'));
30console.log('/' + set.toString() + '/u');