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