golang.org/x/text@v0.14.0/search/index.go (about) 1 // Copyright 2015 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Note: this file is identical to the file text/collate/index.go. Both files 6 // will be removed when the new colltab package is finished and in use. 7 8 package search 9 10 import "golang.org/x/text/internal/colltab" 11 12 const blockSize = 64 13 14 func getTable(t tableIndex) *colltab.Table { 15 return &colltab.Table{ 16 Index: colltab.Trie{ 17 Index0: mainLookup[:][blockSize*t.lookupOffset:], 18 Values0: mainValues[:][blockSize*t.valuesOffset:], 19 Index: mainLookup[:], 20 Values: mainValues[:], 21 }, 22 ExpandElem: mainExpandElem[:], 23 ContractTries: colltab.ContractTrieSet(mainCTEntries[:]), 24 ContractElem: mainContractElem[:], 25 MaxContractLen: 18, 26 VariableTop: varTop, 27 } 28 } 29 30 // tableIndex holds information for constructing a table 31 // for a certain locale based on the main table. 32 type tableIndex struct { 33 lookupOffset uint32 34 valuesOffset uint32 35 }