github.com/go-enjin/golang-org-x-text@v0.12.1-enjin.2/internal/number/gen_common.go (about)

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