Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

[インデックス 18555] ファイルの概要

このコミットは、Go言語の標準ライブラリにおけるUnicodeデータのバージョンをUnicode 6.2.0からUnicode 6.3.0にアップグレードするものです。このアップグレードは、主にunicodeパッケージ内の文字プロパティテーブルの更新を伴い、それに伴い、bufiofmtregexp/syntaxといった関連パッケージの文字定義にも微調整が加えられています。この変更は、Goが最新のUnicode標準に準拠し、より正確な文字処理(特にスペース文字の認識や正規表現のマッチング)を提供することを目的としています。

コミット

commit 746d636859262d53d465f61675484250a3947acc
Author: Marcel van Lohuizen <mpvl@golang.org>
Date:   Tue Feb 18 20:12:59 2014 +0100

    unicode: upgrade to Unicode 6.3.0

    This is a relatively minor change.

    This does not result in changes to go.text/unicode/norm. The go.text
    packages will therefore be relatively unaffected. It does make the
    way for an upgrade to CLDR 24, though.

    The tests of all.bash pass, as well as the tests in go.text after
    this update.

    LGTM=r
    R=r
    CC=golang-codereviews
    https://golang.org/cl/65400044

GitHub上でのコミットページへのリンク

https://github.com/golang/go/commit/746d636859262d53d465f61675484250a3947acc

元コミット内容

unicode: upgrade to Unicode 6.3.0

This is a relatively minor change.

This does not result in changes to go.text/unicode/norm. The go.text
packages will therefore be relatively unaffected. It does make the
way for an upgrade to CLDR 24, though.

The tests of all.bash pass, as well as the tests in go.text after
this update.

変更の背景

ソフトウェアがテキストを正確に処理するためには、最新のUnicode標準に準拠することが不可欠です。Unicodeは、世界中のあらゆる文字体系を統一的に扱うための文字コード標準であり、絵文字、特殊記号、新しい言語の文字などが定期的に追加・修正されます。

このコミットの背景には、Go言語の標準ライブラリが提供する文字処理機能(特にスペース文字の識別、正規表現における文字クラスのマッチング、文字のプロパティ判定など)を最新のUnicode標準であるUnicode 6.3.0に同期させる必要がありました。これにより、Goアプリケーションがより広範なテキストデータに対して正確かつ期待通りの動作を保証できるようになります。

コミットメッセージには「比較的マイナーな変更」とありますが、これはgo.text/unicode/normパッケージ(Unicode正規化フォームを扱う)には直接的な影響がないことを指しています。しかし、CLDR 24(Common Locale Data Repository)へのアップグレードの道を開くものであり、将来的な国際化対応の基盤を強化する意味合いも持っています。CLDRは、ロケールに依存するデータ(日付、時刻、通貨、数値の書式、照合順序など)を提供するUnicodeのプロジェクトであり、その更新は国際化されたソフトウェアの正確性を高める上で重要です。

前提知識の解説

Unicode

Unicodeは、世界中の文字をコンピュータで扱うための業界標準です。各文字には一意のコードポイント(数値)が割り当てられ、異なる言語や記号が混在するテキストでも一貫して処理できます。Unicodeはバージョンアップを重ねており、新しい文字の追加や既存の文字プロパティの修正が行われます。

Unicodeプロパティ

Unicodeの各文字には、その文字の特性を示す様々な「プロパティ」が定義されています。例えば、文字が数字であるか(Numeric)、空白文字であるか(White_Space)、句読点であるか(Punctuation)、特定のスクリプト(例: Latin, Arabic)に属するか、といった情報です。Go言語のunicodeパッケージは、これらのプロパティに基づいて文字を分類・処理するための関数やデータを提供します。

unicodeパッケージとmaketablesツール

Go言語の標準ライブラリには、Unicode関連の機能を提供するunicodeパッケージが含まれています。このパッケージは、Unicodeの文字プロパティテーブル(例: Categories, Scripts, Properties)を内部に持っており、これらはUnicode Consortiumが公開しているデータファイル(UnicodeData.txt, CaseFolding.txtなど)から自動生成されます。

maketablesは、これらのUnicodeデータファイルからGo言語のソースコード(具体的にはunicode/tables.gounicode/script.goなど)を生成するためのツールです。Unicodeの新しいバージョンがリリースされると、このツールを使って最新のデータに基づいてテーブルを再生成し、Goの標準ライブラリを更新します。

空白文字の定義

プログラミング言語において「空白文字」の定義は重要です。これは、文字列のトリミング、単語の分割、入力のパースなど、様々な場面で利用されます。Unicodeには、一般的なスペース(U+0020 SPACE)以外にも、様々な種類の空白文字が存在します。これらの文字が正確に識別されることは、国際化されたアプリケーションの堅牢性にとって不可欠です。

正規表現の文字クラス

正規表現では、\p{Property}\P{Property}といった構文を使って、Unicodeプロパティに基づく文字クラスを指定できます。例えば、\p{Z}は「区切り文字(Separator)」カテゴリに属する文字(主に空白文字)にマッチします。Unicodeのバージョンアップにより、これらのプロパティに属する文字の集合が変更されると、正規表現のマッチング結果も影響を受ける可能性があります。

技術的詳細

このコミットの主要な技術的変更点は、Goのunicodeパッケージが参照するUnicodeデータベースのバージョンを6.2.0から6.3.0に更新したことです。これに伴い、以下のファイルと内容が変更されています。

  1. src/pkg/unicode/maketables.go:

    • maketablesツールがUnicodeデータファイルをダウンロードするURLが、http://www.unicode.org/Public/6.2.0/ucd/からhttp://www.unicode.org/Public/6.3.0/ucd/に変更されました。これは、新しいUnicodeバージョンのデータソースを指すようにするための直接的な変更です。
  2. src/pkg/unicode/tables.go:

    • const Version = "6.2.0"const Version = "6.3.0"に更新されました。これは、このファイルが生成されたUnicodeのバージョンを示すものです。
    • _C (Other, Control), _Cf (Format), _Mc (Mark, Spacing Combining), _Mn (Mark, Nonspacing), _P (Punctuation), _Pe (Punctuation, Close), _Ps (Punctuation, Open), _S (Symbol), _Sm (Symbol, Math), _So (Symbol, Other), _Z (Separator), _Zs (Separator, Space) などのRangeTable定義が更新されました。これらのテーブルは、各Unicodeカテゴリに属する文字の範囲を定義しており、Unicode 6.3.0で追加、削除、またはプロパティが変更された文字が反映されています。
      • 特に注目すべきは、_Zおよび_ZsテーブルにおけるU+180E MONGOLIAN VOWEL SEPARATORの削除です。Unicode 6.3.0では、この文字のGeneral CategoryがZs(Space Separator)からCf(Format)に変更されました。これにより、この文字はもはや一般的な空白文字としては扱われなくなります。
      • _P_Pe_Ps_S_Sm_Other_Mathテーブルにおいて、U+2308 LEFT CEILINGU+2309 RIGHT CEILINGU+230A LEFT FLOORU+230B RIGHT FLOORといった数学記号のプロパティが調整されています。
  3. src/pkg/bufio/scan.go:

    • isSpace関数からU+180E MONGOLIAN VOWEL SEPARATORが削除されました。これは、前述のUnicodeプロパティの変更(ZsからCfへ)を反映したものです。この関数は、bufio.Scannerが入力ストリームを単語や行に分割する際に、空白文字を識別するために使用されます。
  4. src/pkg/fmt/scan.go:

    • fmtパッケージのscan.go内のspace変数(空白文字の範囲を定義する配列)から{0x180e, 0x180e}のエントリが削除されました。これもU+180Eのプロパティ変更に対応するものです。fmtパッケージは、フォーマットされた入出力を扱うため、空白文字の正確な識別が重要です。
  5. src/pkg/regexp/syntax/parse_test.go:

    • 正規表現のテストケースにおいて、\pZ(Separator)文字クラスの期待されるマッチング結果から0x180eが削除されました。これは、U+180EがもはやZカテゴリに属さないことを確認するためのテストの修正です。
  6. src/pkg/unicode/script_test.go:

    • inPropTest配列内のテストデータが更新され、U+2069Other_Default_Ignorable_Code_Pointプロパティを持つ文字としてではなく、U+2065がそのプロパティを持つ文字として記述されるようになりました。これは、Unicode 6.3.0におけるOther_Default_Ignorable_Code_Pointプロパティの定義変更を反映したものです。
  7. src/pkg/unicode/tables.goのRangeTableの統計情報:

    • コメント内のRange entriesRange bytesの合計値が更新されています。これは、Unicodeテーブルのデータ構造が、新しいUnicodeバージョンによってわずかに変化したことを示しています。

全体として、このコミットはGo言語のUnicode処理が最新の標準に準拠し、より正確な文字分類と処理を提供することを保証します。特に、U+180E MONGOLIAN VOWEL SEPARATORのプロパティ変更は、空白文字の扱いが変更されるという点で、既存のアプリケーションの挙動に微細な影響を与える可能性があります。

コアとなるコードの変更箇所

src/pkg/bufio/scan.go

--- a/src/pkg/bufio/scan.go
+++ b/src/pkg/bufio/scan.go
@@ -306,7 +306,7 @@ func isSpace(r rune) bool {
 		return true
 	}
 	switch r {
-	case '\u1680', '\u180e', '\u2028', '\u2029', '\u202f', '\u205f', '\u3000':
+	case '\u1680', '\u2028', '\u2029', '\u202f', '\u205f', '\u3000':
 		return true
 	}
 	return false

src/pkg/fmt/scan.go

--- a/src/pkg/fmt/scan.go
+++ b/src/pkg/fmt/scan.go
@@ -284,7 +284,6 @@ var space = [][2]uint16{
 	{0x0085, 0x0085},
 	{0x00a0, 0x00a0},
 	{0x1680, 0x1680},
-\t{0x180e, 0x180e},
 	{0x2000, 0x200a},
 	{0x2028, 0x2029},
 	{0x202f, 0x202f},

src/pkg/regexp/syntax/parse_test.go

--- a/src/pkg/regexp/syntax/parse_test.go
+++ b/src/pkg/regexp/syntax/parse_test.go
@@ -100,12 +100,12 @@ var parseTests = []parseTest{
 	{`\P{Braille}`, `cc{0x0-0x27ff 0x2900-0x10ffff}`},
 	{`\p{^Braille}`, `cc{0x0-0x27ff 0x2900-0x10ffff}`},
 	{`\P{^Braille}`, `cc{0x2800-0x28ff}`},
-	{`\pZ`, `cc{0x20 0xa0 0x1680 0x180e 0x2000-0x200a 0x2028-0x2029 0x202f 0x205f 0x3000}`},
+	{`\pZ`, `cc{0x20 0xa0 0x1680 0x2000-0x200a 0x2028-0x2029 0x202f 0x205f 0x3000}`},
 	{`[\\p{Braille}]`, `cc{0x2800-0x28ff}`},
 	{`[\\P{Braille}]`, `cc{0x0-0x27ff 0x2900-0x10ffff}`},
 	{`[\\p{^Braille}]`, `cc{0x0-0x27ff 0x2900-0x10ffff}`},
 	{`[\\P{^Braille}]`, `cc{0x2800-0x28ff}`},
-	{`[\\pZ]`, `cc{0x20 0xa0 0x1680 0x180e 0x2000-0x200a 0x2028-0x2029 0x202f 0x205f 0x3000}`},
+	{`[\\pZ]`, `cc{0x20 0xa0 0x1680 0x2000-0x200a 0x2028-0x2029 0x202f 0x205f 0x3000}`},
 	{`\p{Lu}`, mkCharClass(unicode.IsUpper)},
 	{`[\\p{Lu}]`, mkCharClass(unicode.IsUpper)},
 	{`(?i)[\\p{Lu}]`, mkCharClass(isUpperFold)},

src/pkg/unicode/maketables.go

--- a/src/pkg/unicode/maketables.go
+++ b/src/pkg/unicode/maketables.go
@@ -40,7 +40,7 @@ func main() {
 var dataURL = flag.String("data", "", "full URL for UnicodeData.txt; defaults to --url/UnicodeData.txt")
 var casefoldingURL = flag.String("casefolding", "", "full URL for CaseFolding.txt; defaults to --url/CaseFolding.txt")
 var url = flag.String("url",
-"http://www.unicode.org/Public/6.2.0/ucd/",
+"http://www.unicode.org/Public/6.3.0/ucd/",
 	"URL of Unicode database directory")
 var tablelist = flag.String("tables",
 	"all",

src/pkg/unicode/tables.go

--- a/src/pkg/unicode/tables.go
+++ b/src/pkg/unicode/tables.go
@@ -3,13 +3,13 @@
 // license that can be found in the LICENSE file.
 
 // Generated by running
-//	maketables --tables=all --data=http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt --casefolding=http://www.unicode.org/Public/6.2.0/ucd/CaseFolding.txt
+//	maketables --tables=all --data=http://www.unicode.org/Public/6.3.0/ucd/UnicodeData.txt --casefolding=http://www.unicode.org/Public/6.3.0/ucd/CaseFolding.txt
 // DO NOT EDIT
 
 package unicode
 
 // Version is the Unicode edition from which the tables are derived.
-const Version = "6.2.0"
+const Version = "6.3.0"
 
 // Categories is the set of Unicode category tables.
 var Categories = map[string]*RangeTable{
@@ -57,11 +57,12 @@ var _C = &RangeTable{
 		{0x007f, 0x009f, 1},
 		{0x00ad, 0x0600, 1363},
 		{0x0601, 0x0604, 1},
-\t\t{0x06dd, 0x070f, 50},
+\t\t{0x061c, 0x06dd, 193},
+\t\t{0x070f, 0x180e, 4351},
 		{0x200b, 0x200f, 1},
 		{0x202a, 0x202e, 1},
 		{0x2060, 0x2064, 1},
-\t\t{0x206a, 0x206f, 1},\n+\t\t{0x2066, 0x206f, 1},
+\t\t{0x2066, 0x206f, 1},
 		{0xd800, 0xf8ff, 1},
 		{0xfeff, 0xfff9, 250},
 		{0xfffa, 0xfffb, 1},
@@ -89,11 +90,12 @@ var _Cf = &RangeTable{
 	R16: []Range16{
 		{0x00ad, 0x0600, 1363},
 		{0x0601, 0x0604, 1},
-\t\t{0x06dd, 0x070f, 50},
+\t\t{0x061c, 0x06dd, 193},
+\t\t{0x070f, 0x180e, 4351},
 		{0x200b, 0x200f, 1},
 		{0x202a, 0x202e, 1},
 		{0x2060, 0x2064, 1},
-\t\t{0x206a, 0x206f, 1},
+\t\t{0x2066, 0x206f, 1},
 		{0xfeff, 0xfff9, 250},
 		{0xfffa, 0xfffb, 1},
 	},
@@ -1549,7 +1551,7 @@ var _Mc = &RangeTable{
 		{0x1933, 0x1938, 1},
 		{0x19b0, 0x19c0, 1},
 		{0x19c8, 0x19c9, 1},
-\t\t{0x1a19, 0x1a1b, 1},
+\t\t{0x1a19, 0x1a1a, 1},
 		{0x1a55, 0x1a57, 2},
 		{0x1a61, 0x1a63, 2},
 		{0x1a64, 0x1a6d, 9},
@@ -1721,8 +1723,8 @@ var _Mn = &RangeTable{
 		{0x1932, 0x1939, 7},
 		{0x193a, 0x193b, 1},
 		{0x1a17, 0x1a18, 1},
-\t\t{0x1a56, 0x1a58, 2},
-\t\t{0x1a59, 0x1a5e, 1},
+\t\t{0x1a1b, 0x1a56, 59},
+\t\t{0x1a58, 0x1a5e, 1},
 		{0x1a60, 0x1a62, 2},
 		{0x1a65, 0x1a6c, 1},
 		{0x1a73, 0x1a7c, 1},
@@ -2090,6 +2092,7 @@ var _P = &RangeTable{
 		{0x2053, 0x205e, 1},
 		{0x207d, 0x207e, 1},
 		{0x208d, 0x208e, 1},
+\t\t{0x2308, 0x230b, 1},
 		{0x2329, 0x232a, 1},
 		{0x2768, 0x2775, 1},
 		{0x27c5, 0x27c6, 1},
@@ -2187,7 +2190,8 @@ var _Pe = &RangeTable{
 		{0x007d, 0x0f3b, 3774},
 		{0x0f3d, 0x169c, 1887},
 		{0x2046, 0x207e, 56},
-\t\t{0x208e, 0x232a, 668},
+\t\t{0x208e, 0x2309, 635},
+\t\t{0x230b, 0x232a, 31},
 		{0x2769, 0x2775, 2},
 		{0x27c6, 0x27e7, 33},
 		{0x27e9, 0x27ef, 2},
@@ -2364,7 +2368,8 @@ var _Ps = &RangeTable{
 		{0x0f3c, 0x169b, 1887},
 		{0x201a, 0x201e, 4},
 		{0x2045, 0x207d, 56},
-\t\t{0x208d, 0x2329, 668},
+\t\t{0x208d, 0x2308, 635},
+\t\t{0x230a, 0x2329, 31},
 		{0x2768, 0x2774, 2},
 		{0x27c5, 0x27e6, 33},
 		{0x27e8, 0x27ee, 2},
@@ -2454,7 +2459,8 @@ var _S = &RangeTable{
 		{0x2141, 0x2144, 1},
 		{0x214a, 0x214d, 1},
 		{0x214f, 0x2190, 65},
-\t\t{0x2191, 0x2328, 1},
+\t\t{0x2191, 0x2307, 1},
+\t\t{0x230c, 0x2328, 1},
 		{0x232b, 0x23f3, 1},
 		{0x2400, 0x2426, 1},
 		{0x2440, 0x244a, 1},
@@ -2634,7 +2640,6 @@ var _Sm = &RangeTable{
 		{0x21cf, 0x21d2, 3},
 		{0x21d4, 0x21f4, 32},
 		{0x21f5, 0x22ff, 1},
-\t\t{0x2308, 0x230b, 1},
 		{0x2320, 0x2321, 1},
 		{0x237c, 0x239b, 31},
 		{0x239c, 0x23b3, 1},
@@ -2822,8 +2827,8 @@ var _So = &RangeTable{
 var _Z = &RangeTable{
 	R16: []Range16{
 		{0x0020, 0x00a0, 128},
-\t\t{0x1680, 0x180e, 398},
-\t\t{0x2000, 0x200a, 1},
+\t\t{0x1680, 0x2000, 2432},
+\t\t{0x2001, 0x200a, 1},
 		{0x2028, 0x2029, 1},
 		{0x202f, 0x205f, 48},
 		{0x3000, 0x3000, 1},
@@ -2846,8 +2851,8 @@ var _Zp = &RangeTable{
 var _Zs = &RangeTable{
 	R16: []Range16{
 		{0x0020, 0x00a0, 128},
-\t\t{0x1680, 0x180e, 398},
-\t\t{0x2000, 0x200a, 1},
+\t\t{0x1680, 0x2000, 2432},
+\t\t{0x2001, 0x200a, 1},
 		{0x202f, 0x205f, 48},
 		{0x3000, 0x3000, 1},
 	},
@@ -2906,7 +2911,7 @@ var (\
 )
 
 // Generated by running
-//	maketables --scripts=all --url=http://www.unicode.org/Public/6.2.0/ucd/\n+//	maketables --scripts=all --url=http://www.unicode.org/Public/6.3.0/ucd/
+//	maketables --scripts=all --url=http://www.unicode.org/Public/6.3.0/ucd/
 // DO NOT EDIT
 
 // Scripts is the set of Unicode script tables.
@@ -3020,6 +3025,7 @@ var _Arabic = &RangeTable{
 		{0x0600, 0x0604, 1},
 		{0x0606, 0x060b, 1},
 		{0x060d, 0x061a, 1},
+\t\t{0x061c, 0x061c, 1},
 		{0x061e, 0x061e, 1},
 		{0x0620, 0x063f, 1},
 		{0x0641, 0x064a, 1},
@@ -3249,7 +3255,7 @@ var _Common = &RangeTable{
 		{0x1cf5, 0x1cf6, 1},
 		{0x2000, 0x200b, 1},
 		{0x200e, 0x2064, 1},
-\t\t{0x206a, 0x2070, 1},
+\t\t{0x2066, 0x2070, 1},
 		{0x2074, 0x207e, 1},
 		{0x2080, 0x208e, 1},
 		{0x20a0, 0x20ba, 1},
@@ -3285,6 +3291,7 @@ var _Common = &RangeTable{
 		{0xa700, 0xa721, 1},
 		{0xa788, 0xa78a, 1},
 		{0xa830, 0xa839, 1},
+\t\t{0xa9cf, 0xa9cf, 1},
 		{0xfd3e, 0xfd3f, 1},
 		{0xfdfd, 0xfdfd, 1},
 		{0xfe10, 0xfe19, 1},
@@ -3714,7 +3721,7 @@ var _Inscriptional_Parthian = &RangeTable{
 var _Javanese = &RangeTable{
 	R16: []Range16{
 		{0xa980, 0xa9cd, 1},
-\t\t{0xa9cf, 0xa9d9, 1},
+\t\t{0xa9d0, 0xa9d9, 1},
 		{0xa9de, 0xa9df, 1},
 	},
 }
@@ -4407,7 +4414,7 @@ var (\
 )
 
 // Generated by running
-//	maketables --props=all --url=http://www.unicode.org/Public/6.2.0/ucd/\n+//	maketables --props=all --url=http://www.unicode.org/Public/6.3.0/ucd/
+//	maketables --props=all --url=http://www.unicode.org/Public/6.3.0/ucd/
 // DO NOT EDIT
 
 // Properties is the set of Unicode property tables.
@@ -4457,8 +4464,10 @@ var _ASCII_Hex_Digit = &RangeTable{
 
 var _Bidi_Control = &RangeTable{
 	R16: []Range16{
+\t\t{0x061c, 0x061c, 1},
 		{0x200e, 0x200f, 1},
 		{0x202a, 0x202e, 1},
+\t\t{0x2066, 0x2069, 1},
 	},
 }
 
@@ -4935,7 +4944,7 @@ var _Other_Default_Ignorable_Code_Point = &RangeTable{
 		{0x034f, 0x034f, 1},
 		{0x115f, 0x1160, 1},
 		{0x17b4, 0x17b5, 1},
-\t\t{0x2065, 0x2069, 1},
+\t\t{0x2065, 0x2065, 1},
 		{0x3164, 0x3164, 1},
 		{0xffa0, 0xffa0, 1},
 		{0xfff0, 0xfff8, 1},
@@ -5057,6 +5066,7 @@ var _Other_Math = &RangeTable{
 		{0x21d5, 0x21db, 1},
 		{0x21dd, 0x21dd, 1},
 		{0x21e4, 0x21e5, 1},
+\t\t{0x2308, 0x230b, 1},
 		{0x23b4, 0x23b5, 1},
 		{0x23b7, 0x23b7, 1},
 		{0x23d0, 0x23d0, 1},
@@ -5444,7 +5454,6 @@ var _White_Space = &RangeTable{
 		{0x0085, 0x0085, 1},
 		{0x00a0, 0x00a0, 1},
 		{0x1680, 0x1680, 1},
-\t\t{0x180e, 0x180e, 1},
 		{0x2000, 0x200a, 1},
 		{0x2028, 0x2029, 1},
 		{0x202f, 0x202f, 1},
@@ -5491,7 +5500,7 @@ var (\
 )
 
 // Generated by running
-//	maketables --data=http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt --casefolding=http://www.unicode.org/Public/6.2.0/ucd/CaseFolding.txt
+//	maketables --data=http://www.unicode.org/Public/6.3.0/ucd/UnicodeData.txt --casefolding=http://www.unicode.org/Public/6.3.0/ucd/CaseFolding.txt
 // DO NOT EDIT
 
 // CaseRanges is the table describing case mappings for all letters with
@@ -6376,7 +6385,7 @@ var foldMn = &RangeTable{\
 // If there is no entry for a script name, there are no such points.\nvar FoldScript = map[string]*RangeTable{}\n\n-// Range entries: 3462 16-bit, 832 32-bit, 4294 total.\n-// Range bytes: 20772 16-bit, 9984 32-bit, 30756 total.\n+// Range entries: 3471 16-bit, 832 32-bit, 4303 total.\n+// Range bytes: 20826 16-bit, 9984 32-bit, 30810 total.\n \n // Fold orbit bytes: 63 pairs, 252 bytes

コアとなるコードの解説

このコミットのコアとなる変更は、Unicode 6.3.0へのアップグレードに伴う文字プロパティデータの更新です。

  1. src/pkg/unicode/maketables.go: このファイルは、Unicodeデータテーブルを生成するためのGoプログラムです。変更は、Unicode ConsortiumのデータファイルがホストされているURLをUnicode 6.2.0から6.3.0のパスに更新しただけです。これにより、maketablesツールが実行される際に、最新のUnicodeデータが取得されるようになります。

  2. src/pkg/unicode/tables.go: このファイルはmaketablesツールによって自動生成されるもので、Goのunicodeパッケージが使用するすべてのUnicode文字プロパティテーブルが含まれています。

    • const Versionの更新は、このファイルがどのUnicodeバージョンに基づいて生成されたかを示すメタデータです。
    • 最も重要な変更は、RangeTable構造体の定義です。これらのテーブルは、特定のUnicodeカテゴリ(例: _C (Control), _Z (Separator), _P (Punctuation) など)に属する文字の範囲を効率的に表現します。Unicode 6.3.0では、既存の文字のプロパティが変更されたり、新しい文字が追加されたりしたため、これらのテーブルの範囲定義が更新されました。
    • 特に、U+180E MONGOLIAN VOWEL SEPARATORの扱いが変更されたことが顕著です。この文字はUnicode 6.3.0でGeneral CategoryZs(Space Separator)からCf(Format)に変更されました。これにより、_Zおよび_Zsテーブルからこの文字の範囲が削除され、代わりに_Cfテーブルにその範囲が追加されています。これは、この文字がもはや一般的な空白文字として扱われるべきではないというUnicodeの決定を反映しています。
    • また、_P, _Pe, _Ps, _S, _Sm, _Other_Mathなどのテーブルでも、特定の数学記号(例: U+2308からU+230B)のプロパティが調整されています。これは、これらの文字が属するカテゴリやプロパティがUnicode 6.3.0でより正確に定義されたためです。
  3. src/pkg/bufio/scan.go: isSpace関数は、bufio.Scannerが入力ストリームをスキャンする際に、空白文字を識別するために使用されます。U+180EがUnicode 6.3.0で空白文字ではなくなったため、この関数から\u180eが明示的に削除されました。これにより、bufioパッケージは最新のUnicode標準に従って空白文字を正しく識別するようになります。

  4. src/pkg/fmt/scan.go: fmtパッケージ内のspace変数は、フォーマットされた入力をスキャンする際に空白文字として認識される文字の範囲を定義します。ここからもU+180Eが削除されました。これはbufioパッケージと同様に、fmtパッケージが最新のUnicode標準に準拠して空白文字を処理することを保証します。

  5. src/pkg/regexp/syntax/parse_test.go: このファイルは正規表現の構文解析に関するテストを含んでいます。\pZ(Separatorカテゴリの文字にマッチする正規表現)のテストケースから0x180eが削除されました。これは、U+180EがもはやZカテゴリに属さないというUnicode 6.3.0の変更を反映し、正規表現エンジンがこの変更を正しく処理することを確認するためのテスト修正です。

これらの変更は、Go言語がUnicodeの最新の定義に準拠し、国際化されたテキストデータをより正確に処理できるようにするための基盤を強化します。特に、空白文字の定義変更は、文字列の分割やパースといった基本的な操作に影響を与える可能性があるため、重要な更新と言えます。

関連リンク

参考にした情報源リンク

  • コミットメッセージと差分情報 (./commit_data/18555.txt)
  • Unicode Consortiumの公式ウェブサイト (Unicode 6.3.0の変更点に関する一般的な情報)
  • Go言語の公式ドキュメント (Goのunicodeパッケージとmaketablesツールの一般的な理解)
  • CLDR (Common Locale Data Repository) の一般的な情報