index.go 1019 B

1234567891011121314151617181920212223242526272829303132333435
  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. // Note: this file is identical to the file text/collate/index.go. Both files
  5. // will be removed when the new colltab package is finished and in use.
  6. package search
  7. import "golang.org/x/text/internal/colltab"
  8. const blockSize = 64
  9. func getTable(t tableIndex) *colltab.Table {
  10. return &colltab.Table{
  11. Index: colltab.Trie{
  12. Index0: mainLookup[:][blockSize*t.lookupOffset:],
  13. Values0: mainValues[:][blockSize*t.valuesOffset:],
  14. Index: mainLookup[:],
  15. Values: mainValues[:],
  16. },
  17. ExpandElem: mainExpandElem[:],
  18. ContractTries: colltab.ContractTrieSet(mainCTEntries[:]),
  19. ContractElem: mainContractElem[:],
  20. MaxContractLen: 18,
  21. VariableTop: varTop,
  22. }
  23. }
  24. // tableIndex holds information for constructing a table
  25. // for a certain locale based on the main table.
  26. type tableIndex struct {
  27. lookupOffset uint32
  28. valuesOffset uint32
  29. }