Skip to content

Commit 28fd9fa

Browse files
committedApr 18, 2025
unicode: add CategoryAliases, Cn, LC
CategoryAliases is for regexp to use, for things like \p{Letter} as an alias for \p{L}. Cn and LC are special-case categories that were never implemented but should have been. These changes were generated by the updated generator in CL 641395. Fixes #70780. Change-Id: Ibba20ff76191c8ae9631ac5ba19965790fe0cc81 Reviewed-on: https://go-review.googlesource.com/c/go/+/641376 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
1 parent 252c939 commit 28fd9fa

File tree

4 files changed

+1420
-19
lines changed

4 files changed

+1420
-19
lines changed
 

‎api/next/70780.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pkg unicode, var CategoryAliases map[string]string #70780
2+
pkg unicode, var Cn *RangeTable #70780
3+
pkg unicode, var LC *RangeTable #70780
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The new [CategoryAliases] map provides access to category alias names, such as “Letter” for “L”.
2+
The new categories [Cn] and [LC] define unassigned codepoints and cased letters, respectively.
3+
These have always been defined by Unicode but were inadvertently omitted in earlier versions of Go.
4+
The [C] category now includes [Cn], meaning it has added all unassigned code points.

‎src/unicode/script_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ var inCategoryTest = []T{
5252
{0x00bb, "P"},
5353
{0x00a2, "S"},
5454
{0x00a0, "Z"},
55+
{0x0065, "LC"},
56+
// Unassigned
57+
{0x0378, "Cn"},
58+
{0x0378, "C"},
5559
}
5660

5761
var inPropTest = []T{

‎src/unicode/tables.go

Lines changed: 1409 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.