You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

60 lines
1.4 KiB

  1. // Copyright 2016 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. // +build ignore
  5. package main
  6. import (
  7. "unicode/utf8"
  8. "golang.org/x/text/internal/language/compact"
  9. )
  10. // A system identifies a CLDR numbering system.
  11. type system byte
  12. type systemData struct {
  13. id system
  14. digitSize byte // number of UTF-8 bytes per digit
  15. zero [utf8.UTFMax]byte // UTF-8 sequence of zero digit.
  16. }
  17. // A SymbolType identifies a symbol of a specific kind.
  18. type SymbolType int
  19. const (
  20. SymDecimal SymbolType = iota
  21. SymGroup
  22. SymList
  23. SymPercentSign
  24. SymPlusSign
  25. SymMinusSign
  26. SymExponential
  27. SymSuperscriptingExponent
  28. SymPerMille
  29. SymInfinity
  30. SymNan
  31. SymTimeSeparator
  32. NumSymbolTypes
  33. )
  34. const hasNonLatnMask = 0x8000
  35. // symOffset is an offset into altSymData if the bit indicated by hasNonLatnMask
  36. // is not 0 (with this bit masked out), and an offset into symIndex otherwise.
  37. //
  38. // TODO: this type can be a byte again if we use an indirection into altsymData
  39. // and introduce an alt -> offset slice (the length of this will be number of
  40. // alternatives plus 1). This also allows getting rid of the compactTag field
  41. // in altSymData. In total this will save about 1K.
  42. type symOffset uint16
  43. type altSymData struct {
  44. compactTag compact.ID
  45. symIndex symOffset
  46. system system
  47. }