func main() { gen.Init() gen.Repackage("gen_trieval.go", "trieval.go", "bidi") gen.Repackage("gen_ranges.go", "ranges_test.go", "bidi") genTables() }
func main() { gen.Init() genTables() genTests() gen.Repackage("gen_trieval.go", "trieval.go", "width") gen.Repackage("gen_common.go", "common_test.go", "width") }
func main() { gen.Init() gen.Repackage("gen_common.go", "common.go", "language") w := gen.NewCodeWriter() defer w.WriteGoFile("tables.go", "language") fmt.Fprintln(w, `import "golang.org/x/text/internal/tag"`) b := newBuilder(w) gen.WriteCLDRVersion(w) b.parseIndices() b.writeType(fromTo{}) b.writeLanguage() b.writeScript() b.writeRegion() b.writeVariant() // TODO: b.writeLocale() b.computeRegionGroups() b.writeLikelyData() b.writeMatchData() b.writeRegionInclusionData() b.writeParents() }
func main() { gen.Init() gen.Repackage("gen_common.go", "common.go", "currency") // Read the CLDR zip file. r := gen.OpenCLDRCoreZip() defer r.Close() d := &cldr.Decoder{} d.SetDirFilter("supplemental", "main") d.SetSectionFilter("numbers") data, err := d.DecodeZip(r) if err != nil { log.Fatalf("DecodeZip: %v", err) } w := gen.NewCodeWriter() defer w.WriteGoFile(*outputFile, "currency") fmt.Fprintln(w, `import "golang.org/x/text/internal/tag"`) gen.WriteCLDRVersion(w) b := &builder{} b.genCurrencies(w, data.Supplemental()) b.genSymbols(w, data) }
func main() { gen.Init() const pkg = "number" gen.Repackage("gen_common.go", "common.go", pkg) // Read the CLDR zip file. r := gen.OpenCLDRCoreZip() defer r.Close() d := &cldr.Decoder{} d.SetDirFilter("supplemental", "main") d.SetSectionFilter("numbers", "numberingSystem") data, err := d.DecodeZip(r) if err != nil { log.Fatalf("DecodeZip: %v", err) } w := gen.NewCodeWriter() defer w.WriteGoFile(*outputFile, pkg) fmt.Fprintln(w, `import "golang.org/x/text/internal/stringset"`) gen.WriteCLDRVersion(w) genNumSystem(w, data) genSymbols(w, data) }
func main() { gen.Init() names, counts := parse() appendRepeatNames(names, counts) appendUniqueNames(names, counts) table0, table1 := makeTables() gen.Repackage("gen_bits.go", "bits.go", "runenames") w := gen.NewCodeWriter() w.WriteVar("table0", table0) w.WriteVar("table1", table1) w.WriteConst("data", string(data)) w.WriteGoFile("tables.go", "runenames") }
func main() { gen.Init() // Load data runes := []rune{} ucd.Parse(gen.OpenUCDFile("DerivedCoreProperties.txt"), func(p *ucd.Parser) { if p.String(1) == "Default_Ignorable_Code_Point" { runes = append(runes, p.Rune(0)) } }) ucd.Parse(gen.OpenUCDFile("HangulSyllableType.txt"), func(p *ucd.Parser) { if p.String(1) == "LVT" { runes = append(runes, p.Rune(0)) } }) disallowedRunes = rangetable.New(runes...) assigned = rangetable.Assigned(unicode.Version) writeTables() gen.Repackage("gen_trieval.go", "trieval.go", "precis") }
func main() { gen.Init() genTables() genTablesTest() gen.Repackage("gen_trieval.go", "trieval.go", "cases") }
func main() { gen.Init() // Load data runes := []rune{} // PrecisIgnorableProperties: https://tools.ietf.org/html/rfc7564#section-9.13 ucd.Parse(gen.OpenUCDFile("DerivedCoreProperties.txt"), func(p *ucd.Parser) { if p.String(1) == "Default_Ignorable_Code_Point" { runes = append(runes, p.Rune(0)) } }) ucd.Parse(gen.OpenUCDFile("PropList.txt"), func(p *ucd.Parser) { switch p.String(1) { case "Noncharacter_Code_Point": runes = append(runes, p.Rune(0)) } }) // OldHangulJamo: https://tools.ietf.org/html/rfc5892#section-2.9 ucd.Parse(gen.OpenUCDFile("HangulSyllableType.txt"), func(p *ucd.Parser) { switch p.String(1) { case "L", "V", "T": runes = append(runes, p.Rune(0)) } }) disallowedRunes = rangetable.New(runes...) assigned = rangetable.Assigned(unicode.Version) // Load category data. runeCategory['l'] = latinSmallL ucd.Parse(gen.OpenUCDFile("UnicodeData.txt"), func(p *ucd.Parser) { const cccVirama = 9 if p.Int(ucd.CanonicalCombiningClass) == cccVirama { setCategory(p.Rune(0), viramaModifier) } }) ucd.Parse(gen.OpenUCDFile("Scripts.txt"), func(p *ucd.Parser) { switch p.String(1) { case "Greek": setCategory(p.Rune(0), greek) case "Hebrew": setCategory(p.Rune(0), hebrew) case "Hiragana", "Katakana", "Han": setCategory(p.Rune(0), japanese) } }) // Set the rule categories associated with exceptions. This overrides any // previously set categories. The original categories are manually // reintroduced in the categoryTransitions table. for r, e := range exceptions { if e.cat != 0 { runeCategory[r] = e.cat } } cat := map[string]category{ "L": joiningL, "D": joiningD, "T": joiningT, "R": joiningR, } ucd.Parse(gen.OpenUCDFile("extracted/DerivedJoiningType.txt"), func(p *ucd.Parser) { switch v := p.String(1); v { case "L", "D", "T", "R": setCategory(p.Rune(0), cat[v]) } }) writeTables() gen.Repackage("gen_trieval.go", "trieval.go", "precis") }