1 // Code generated by running "go run gen.go -core" in golang.org/x/text. DO NOT EDIT.
3 // Code generated by running "go generate" in golang_org/x/text. DO NOT EDIT.
7 // This file contains definitions for interpreting the trie value of the idna
8 // trie generated by "go run gen*.go". It is shared by both the generator
9 // program and the resultant package. Sharing is achieved by the generator
10 // copying gen_trieval.go to trieval.go and changing what's above this comment.
12 // info holds information from the IDNA mapping table for a single rune. It is
13 // the value returned by a trie lookup. In most cases, all information fits in
14 // a 16-bit value. For mappings, this value may contain an index into a slice
15 // with the mapped string. Such mappings can consist of the actual mapped value
16 // or an XOR pattern to be applied to the bytes of the UTF8 encoding of the
17 // input rune. This technique is used by the cases packages and reduces the
18 // table size significantly.
20 // The per-rune values have the following format:
24 // 15..13 inline XOR marker
26 // 10..3 inline XOR mask
28 // 15..3 index into xor or mapping table
32 // 12 modifier (including virama)
38 // 1..0 mapped category
40 // See the definitions below for a more detailed description of the various
48 xorBit
= 0x4 // interpret the index as an xor pattern
49 inlineXOR
= 0xE000 // These bits are set if the XOR pattern is inlined.
54 viramaModifier
= 0x0800
58 // A category corresponds to a category defined in the IDNA mapping table.
62 unknown category
= 0 // not defined currently in unicode.
64 disallowedSTD3Mapped category
= 2
65 deviation category
= 3
70 validNV8 category
= 0x18
71 validXV8 category
= 0x28
72 disallowed category
= 0x40
73 disallowedSTD3Valid category
= 0x80
74 ignored category
= 0xC0
77 // join types and additional rune information
84 //the following types are derived during processing
91 func (c info
) isMapped() bool {
95 func (c info
) category() category
{
96 small
:= c
& catSmallMask
98 return category(small
)
100 return category(c
& catBigMask
)
103 func (c info
) joinType() info
{
107 return (c
>> joinShift
) & joinMask
110 func (c info
) isModifier() bool {
111 return c
&(modifier|catSmallMask
) == modifier
114 func (c info
) isViramaModifier() bool {
115 return c
&(viramaModifier|catSmallMask
) == viramaModifier