aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/golang.org/x/text/unicode/norm/maketables.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/text/unicode/norm/maketables.go')
-rw-r--r--vendor/golang.org/x/text/unicode/norm/maketables.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/vendor/golang.org/x/text/unicode/norm/maketables.go b/vendor/golang.org/x/text/unicode/norm/maketables.go
index 338c395..30a3aa9 100644
--- a/vendor/golang.org/x/text/unicode/norm/maketables.go
+++ b/vendor/golang.org/x/text/unicode/norm/maketables.go
@@ -12,6 +12,7 @@ package main
12 12
13import ( 13import (
14 "bytes" 14 "bytes"
15 "encoding/binary"
15 "flag" 16 "flag"
16 "fmt" 17 "fmt"
17 "io" 18 "io"
@@ -261,7 +262,7 @@ func compactCCC() {
261 262
262// CompositionExclusions.txt has form: 263// CompositionExclusions.txt has form:
263// 0958 # ... 264// 0958 # ...
264// See http://unicode.org/reports/tr44/ for full explanation 265// See https://unicode.org/reports/tr44/ for full explanation
265func loadCompositionExclusions() { 266func loadCompositionExclusions() {
266 f := gen.OpenUCDFile("CompositionExclusions.txt") 267 f := gen.OpenUCDFile("CompositionExclusions.txt")
267 defer f.Close() 268 defer f.Close()
@@ -735,6 +736,8 @@ func makeTables() {
735 max = n 736 max = n
736 } 737 }
737 } 738 }
739 fmt.Fprintln(w, `import "sync"`)
740 fmt.Fprintln(w)
738 741
739 fmt.Fprintln(w, "const (") 742 fmt.Fprintln(w, "const (")
740 fmt.Fprintln(w, "\t// Version is the Unicode edition from which the tables are derived.") 743 fmt.Fprintln(w, "\t// Version is the Unicode edition from which the tables are derived.")
@@ -782,16 +785,23 @@ func makeTables() {
782 sz := nrentries * 8 785 sz := nrentries * 8
783 size += sz 786 size += sz
784 fmt.Fprintf(w, "// recompMap: %d bytes (entries only)\n", sz) 787 fmt.Fprintf(w, "// recompMap: %d bytes (entries only)\n", sz)
785 fmt.Fprintln(w, "var recompMap = map[uint32]rune{") 788 fmt.Fprintln(w, "var recompMap map[uint32]rune")
789 fmt.Fprintln(w, "var recompMapOnce sync.Once\n")
790 fmt.Fprintln(w, `const recompMapPacked = "" +`)
791 var buf [8]byte
786 for i, c := range chars { 792 for i, c := range chars {
787 f := c.forms[FCanonical] 793 f := c.forms[FCanonical]
788 d := f.decomp 794 d := f.decomp
789 if !f.isOneWay && len(d) > 0 { 795 if !f.isOneWay && len(d) > 0 {
790 key := uint32(uint16(d[0]))<<16 + uint32(uint16(d[1])) 796 key := uint32(uint16(d[0]))<<16 + uint32(uint16(d[1]))
791 fmt.Fprintf(w, "0x%.8X: 0x%.4X,\n", key, i) 797 binary.BigEndian.PutUint32(buf[:4], key)
798 binary.BigEndian.PutUint32(buf[4:], uint32(i))
799 fmt.Fprintf(w, "\t\t%q + // 0x%.8X: 0x%.8X\n", string(buf[:]), key, uint32(i))
792 } 800 }
793 } 801 }
794 fmt.Fprintf(w, "}\n\n") 802 // hack so we don't have to special case the trailing plus sign
803 fmt.Fprintf(w, ` ""`)
804 fmt.Fprintln(w)
795 } 805 }
796 806
797 fmt.Fprintf(w, "// Total size of tables: %dKB (%d bytes)\n", (size+512)/1024, size) 807 fmt.Fprintf(w, "// Total size of tables: %dKB (%d bytes)\n", (size+512)/1024, size)
@@ -857,7 +867,7 @@ func verifyComputed() {
857// DerivedNormalizationProps.txt has form: 867// DerivedNormalizationProps.txt has form:
858// 00C0..00C5 ; NFD_QC; N # ... 868// 00C0..00C5 ; NFD_QC; N # ...
859// 0374 ; NFD_QC; N # ... 869// 0374 ; NFD_QC; N # ...
860// See http://unicode.org/reports/tr44/ for full explanation 870// See https://unicode.org/reports/tr44/ for full explanation
861func testDerived() { 871func testDerived() {
862 f := gen.OpenUCDFile("DerivedNormalizationProps.txt") 872 f := gen.OpenUCDFile("DerivedNormalizationProps.txt")
863 defer f.Close() 873 defer f.Close()