uchar

package
v0.18.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	/** No numeric value. */
	UPropsNtvNone = 0
	/** Decimal digits: nv=0..9 */
	UPropsNtvDecimalStart = 1
	/** Other digits: nv=0..9 */
	UPropsNtvDigitStart = 11
	/** Small integers: nv=0..154 */
	UPropsNtvNumericStart = 21
	/** Fractions: ((ntv>>4)-12) / ((ntv&0xf)+1) = -1..17 / 1..16 */
	UPropsNtvFractionStart = 0xb0
	/**
	 * Large integers:
	 * ((ntv>>5)-14) * 10^((ntv&0x1f)+2) = (1..9)*(10^2..10^33)
	 * (only one significant decimal digit)
	 */
	UPropsNtvLargeStart = 0x1e0
	/**
	 * Sexagesimal numbers:
	 * ((ntv>>2)-0xbf) * 60^((ntv&3)+1) = (1..9)*(60^1..60^4)
	 */
	UPropsNtvBase60Start = 0x300
	/**
	 * Fraction-20 values:
	 * frac20 = ntv-0x324 = 0..0x17 -> 1|3|5|7 / 20|40|80|160|320|640
	 * numerator: num = 2*(frac20&3)+1
	 * denominator: den = 20<<(frac20>>2)
	 */
	UPropsNtvFraction20Start = UPropsNtvBase60Start + 36 // 0x300+9*4=0x324
	/**
	 * Fraction-32 values:
	 * frac32 = ntv-0x34c = 0..15 -> 1|3|5|7 / 32|64|128|256
	 * numerator: num = 2*(frac32&3)+1
	 * denominator: den = 32<<(frac32>>2)
	 */
	UPropsNtvFraction32Start = UPropsNtvFraction20Start + 24 // 0x324+6*4=0x34c
	/** No numeric value (yet). */
	UPropsNtvReservedStart = UPropsNtvFraction32Start + 16 // 0x34c+4*4=0x35c

	UPropsNtvMaxSmallInt = UPropsNtvFractionStart - UPropsNtvNumericStart - 1
)

Variables

View Source
var (
	GcCnMask = Mask(GeneralOtherTypes)

	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcLuMask = Mask(UppercaseLetter)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcLlMask = Mask(LowercaseLetter)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcLtMask = Mask(TitlecaseLetter)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcLmMask = Mask(ModifierLetter)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcLoMask = Mask(OtherLetter)

	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcMnMask = Mask(NonSpacingMask)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcMeMask = Mask(EnclosingMark)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcMcMask = Mask(CombiningSpacingMask)

	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcNdMask = Mask(DecimalDigitNumber)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcNlMask = Mask(LetterNumber)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcNoMask = Mask(OtherNumber)

	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcZsMask = Mask(SpaceSeparator)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcZlMask = Mask(LineSeparator)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcZpMask = Mask(ParagraphSeparator)

	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcCcMask = Mask(ControlChar)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcCfMask = Mask(FormatChar)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcCoMask = Mask(PrivateUseChar)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcCsMask = Mask(Surrogate)

	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcPdMask = Mask(DashPunctuation)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcPsMask = Mask(StartPunctuation)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcPeMask = Mask(EndPunctuation)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcPcMask = Mask(ConnectorPunctuation)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcPoMask = Mask(OtherPunctuation)

	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcSmMask = Mask(MathSymbol)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcScMask = Mask(CurrencySymbol)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcSkMask = Mask(ModifierSymbol)
	/** Mask constant for a UCharCategory. @stable ICU 2.1 */
	GcSoMask = Mask(OtherSymbol)

	/** Mask constant for multiple UCharCategory bits (L Letters). @stable ICU 2.1 */
	GcLMask = (GcLuMask | GcLlMask | GcLtMask | GcLmMask | GcLoMask)

	/** Mask constant for multiple UCharCategory bits (LC Cased Letters). @stable ICU 2.1 */
	GcLcMask = (GcLuMask | GcLlMask | GcLtMask)

	/** Mask constant for multiple UCharCategory bits (M Marks). @stable ICU 2.1 */
	GcMMask = (GcMnMask | GcMeMask | GcMcMask)

	/** Mask constant for multiple UCharCategory bits (N Numbers). @stable ICU 2.1 */
	GcNMask = (GcNdMask | GcNlMask | GcNoMask)

	/** Mask constant for multiple UCharCategory bits (Z Separators). @stable ICU 2.1 */
	GcZMask = (GcZsMask | GcZlMask | GcZpMask)
)

Functions

func AddPropertyStarts

func AddPropertyStarts(sa PropertySet)

func GetUnicodeProperties

func GetUnicodeProperties(c rune, column int) uint32

func IsBlank

func IsBlank(c rune) bool

func IsDigit

func IsDigit(c rune) bool

func IsGraphPOSIX

func IsGraphPOSIX(c rune) bool

func IsPOSIXPrint

func IsPOSIXPrint(c rune) bool

func IsXDigit

func IsXDigit(c rune) bool

func Mask

func Mask[T ~int | ~int8](x T) uint32

func NumericTypeValue

func NumericTypeValue(c rune) uint16

func NumericValue

func NumericValue(c rune) float64

func ScriptExtension

func ScriptExtension(idx uint32) uint16

func ScriptExtensions

func ScriptExtensions(idx uint32) []uint16

func VecAddPropertyStarts

func VecAddPropertyStarts(sa PropertySet)

Types

type Category

type Category int8
const (

	/** Non-category for unassigned and non-character code points. @stable ICU 2.0 */
	Unassigned Category = 0
	/** Cn "Other, Not Assigned (no characters in [UnicodeData.txt] have this property)" (same as U_UNASSIGNED!) @stable ICU 2.0 */
	GeneralOtherTypes Category = iota - 1
	/** Lu @stable ICU 2.0 */
	UppercaseLetter
	/** Ll @stable ICU 2.0 */
	LowercaseLetter
	/** Lt @stable ICU 2.0 */
	TitlecaseLetter
	/** Lm @stable ICU 2.0 */
	ModifierLetter
	/** Lo @stable ICU 2.0 */
	OtherLetter
	/** Mn @stable ICU 2.0 */
	NonSpacingMask
	/** Me @stable ICU 2.0 */
	EnclosingMark
	/** Mc @stable ICU 2.0 */
	CombiningSpacingMask
	/** Nd @stable ICU 2.0 */
	DecimalDigitNumber
	/** Nl @stable ICU 2.0 */
	LetterNumber
	/** No @stable ICU 2.0 */
	OtherNumber
	/** Zs @stable ICU 2.0 */
	SpaceSeparator
	/** Zl @stable ICU 2.0 */
	LineSeparator
	/** Zp @stable ICU 2.0 */
	ParagraphSeparator
	/** Cc @stable ICU 2.0 */
	ControlChar
	/** Cf @stable ICU 2.0 */
	FormatChar
	/** Co @stable ICU 2.0 */
	PrivateUseChar
	/** Cs @stable ICU 2.0 */
	Surrogate
	/** Pd @stable ICU 2.0 */
	DashPunctuation
	/** Ps @stable ICU 2.0 */
	StartPunctuation
	/** Pe @stable ICU 2.0 */
	EndPunctuation
	/** Pc @stable ICU 2.0 */
	ConnectorPunctuation
	/** Po @stable ICU 2.0 */
	OtherPunctuation
	/** Sm @stable ICU 2.0 */
	MathSymbol
	/** Sc @stable ICU 2.0 */
	CurrencySymbol
	/** Sk @stable ICU 2.0 */
	ModifierSymbol
	/** So @stable ICU 2.0 */
	OtherSymbol
	/** Pi @stable ICU 2.0 */
	InitialPunctuation
	/** Pf @stable ICU 2.0 */
	FinalPunctuation
	/**
	 * One higher than the last enum UCharCategory constant.
	 * This numeric value is stable (will not change), see
	 * http://www.unicode.org/policies/stability_policy.html#Property_Value
	 *
	 * @stable ICU 2.0
	 */
	CharCategoryCount
)

func CharType

func CharType(c rune) Category

type PropertySet

type PropertySet interface {
	AddRune(ch rune)
}

type UVersionInfo

type UVersionInfo [maxVersionLength]uint8

func CharAge

func CharAge(c rune) UVersionInfo

func VersionFromString

func VersionFromString(str string) (version UVersionInfo)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL