Documentation
¶
Overview ¶
Command ucd generates internal/regexpsyntax/unicode_tables.go, the Unicode Character Database tables of the regular-expression engine: General_Category, Script and Script_Extensions values, the binary properties of ECMA-262 table 67, the properties of strings of the v flag, simple case folding and the non-u Canonicalize mapping. With -norm it generates engine/unicode_norm_tables.go instead, the normalization data of String.prototype.normalize (norm.go), and with -seg engine/unicode_seg_tables.go, the text segmentation data of Intl.Segmenter (seg.go).
The UCD files are downloaded from unicode.org at generation time only (-cache keeps a local copy); the output is deterministic and committed. The version is pinned to the one tc39/test262 uses for test/built-ins/RegExp/property-escapes/generated/.
Usage (from internal/regexpsyntax/, see the go:generate line in unicode.go):
go run ../gen/ucd -o unicode_tables.go [-cache dir]
and from engine/ (see the go:generate line in string_normalize.go):
go run ../internal/gen/ucd -norm unicode_norm_tables.go [-normtest file] [-cache dir]
and from engine/ (see the go:generate line in segment.go):
go run ../internal/gen/ucd -seg unicode_seg_tables.go [-segtest dir] [-cache dir]