use dep as denpendency managment tool

This commit is contained in:
jeff
2018-06-14 00:30:44 +08:00
parent 70a3b06987
commit e9d73b7ace
7176 changed files with 393471 additions and 1459392 deletions

View File

@@ -698,8 +698,8 @@ func (b *builder) computeRegionGroups() {
b.groups[group] = index(len(b.groups))
}
}
if len(b.groups) > 32 {
log.Fatalf("only 32 groups supported, found %d", len(b.groups))
if len(b.groups) > 64 {
log.Fatalf("only 64 groups supported, found %d", len(b.groups))
}
b.writeConst("nRegionGroups", len(b.groups))
}
@@ -1417,20 +1417,27 @@ func (b *builder) writeMatchData() {
}
b.writeSlice("regionToGroups", regionToGroups)
// maps language id to in- and out-of-group region.
paradigmLocales := [][3]uint16{}
locales := strings.Split(lm[0].ParadigmLocales[0].Locales, " ")
for i := 0; i < len(locales); i += 2 {
x := [3]uint16{}
for j := 0; j < 2; j++ {
pc := strings.SplitN(locales[i+j], "-", 2)
x[0] = b.langIndex(pc[0])
if len(pc) == 2 {
x[1+j] = uint16(b.region.index(pc[1]))
}
}
paradigmLocales = append(paradigmLocales, x)
}
b.writeSlice("paradigmLocales", paradigmLocales)
b.writeType(mutualIntelligibility{})
b.writeType(scriptIntelligibility{})
b.writeType(regionIntelligibility{})
matchLang := []mutualIntelligibility{{
// TODO: remove once CLDR is fixed.
want: uint16(b.langIndex("sr")),
have: uint16(b.langIndex("hr")),
distance: uint8(5),
}, {
want: uint16(b.langIndex("sr")),
have: uint16(b.langIndex("bs")),
distance: uint8(5),
}}
matchLang := []mutualIntelligibility{}
matchScript := []scriptIntelligibility{}
matchRegion := []regionIntelligibility{}
// Convert the languageMatch entries in lists keyed by desired language.
@@ -1490,8 +1497,14 @@ func (b *builder) writeMatchData() {
if desired == supported && desired == "*_*_*" {
continue
}
if desired != supported { // (Weird but correct.)
log.Fatalf("not supported: desired=%q; supported=%q", desired, supported)
if desired != supported {
// This is now supported by CLDR, but only one case, which
// should already be covered by paradigm locales. For instance,
// test case "und, en, en-GU, en-IN, en-GB ; en-ZA ; en-GB" in
// testdata/CLDRLocaleMatcherTest.txt tests this.
if supported != "en_*_GB" {
log.Fatalf("not supported: desired=%q; supported=%q", desired, supported)
}
continue
}
ri := regionIntelligibility{
@@ -1559,7 +1572,7 @@ func (b *builder) writeRegionInclusionData() {
}
}
regionContainment := make([]uint32, len(b.groups))
regionContainment := make([]uint64, len(b.groups))
for _, g := range b.groups {
l := containment[g]
@@ -1577,10 +1590,10 @@ func (b *builder) writeRegionInclusionData() {
b.writeSlice("regionContainment", regionContainment)
regionInclusion := make([]uint8, len(b.region.s))
bvs := make(map[uint32]index)
bvs := make(map[uint64]index)
// Make the first bitvector positions correspond with the groups.
for r, i := range b.groups {
bv := uint32(1 << i)
bv := uint64(1 << i)
for _, g := range mm[r] {
bv |= 1 << g
}
@@ -1589,7 +1602,7 @@ func (b *builder) writeRegionInclusionData() {
}
for r := 1; r < len(b.region.s); r++ {
if _, ok := b.groups[r]; !ok {
bv := uint32(0)
bv := uint64(0)
for _, g := range mm[r] {
bv |= 1 << g
}
@@ -1604,9 +1617,9 @@ func (b *builder) writeRegionInclusionData() {
}
}
b.writeSlice("regionInclusion", regionInclusion)
regionInclusionBits := make([]uint32, len(bvs))
regionInclusionBits := make([]uint64, len(bvs))
for k, v := range bvs {
regionInclusionBits[v] = uint32(k)
regionInclusionBits[v] = uint64(k)
}
// Add bit vectors for increasingly large distances until a fixed point is reached.
regionInclusionNext := []uint8{}