Source File
trieval.go
Belonging Package
vendor/golang.org/x/net/idna
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.package idna// This file contains definitions for interpreting the trie value of the idna// trie generated by "go run gen*.go". It is shared by both the generator// program and the resultant package. Sharing is achieved by the generator// copying gen_trieval.go to trieval.go and changing what's above this comment.// info holds information from the IDNA mapping table for a single rune. It is// the value returned by a trie lookup. In most cases, all information fits in// a 16-bit value. For mappings, this value may contain an index into a slice// with the mapped string. Such mappings can consist of the actual mapped value// or an XOR pattern to be applied to the bytes of the UTF8 encoding of the// input rune. This technique is used by the cases packages and reduces the// table size significantly.//// The per-rune values have the following format://// if mapped {// if inlinedXOR {// 15..13 inline XOR marker// 12..11 unused// 10..3 inline XOR mask// } else {// 15..3 index into xor or mapping table// }// } else {// 15..14 unused// 13 mayNeedNorm// 12..11 attributes// 10..8 joining type// 7..3 category type// }// 2 use xor pattern// 1..0 mapped category//// See the definitions below for a more detailed description of the various// bits.type info uint16const (catSmallMask = 0x3catBigMask = 0xF8indexShift = 3xorBit = 0x4 // interpret the index as an xor patterninlineXOR = 0xE000 // These bits are set if the XOR pattern is inlined.joinShift = 8joinMask = 0x07// AttributesattributesMask = 0x1800viramaModifier = 0x1800modifier = 0x1000rtl = 0x0800mayNeedNorm = 0x2000)// A category corresponds to a category defined in the IDNA mapping table.type category uint16const (unknown category = 0 // not currently defined in unicode.mapped category = 1disallowedSTD3Mapped category = 2deviation category = 3)const (valid category = 0x08validNV8 category = 0x18validXV8 category = 0x28disallowed category = 0x40disallowedSTD3Valid category = 0x80ignored category = 0xC0)// join types and additional rune informationconst (joiningL = (iota + 1)joiningDjoiningTjoiningR//the following types are derived during processingjoinZWJjoinZWNJjoinViramanumJoinTypes)func ( info) () bool {return &0x3 != 0}func ( info) () category {:= & catSmallMaskif != 0 {return category()}return category( & catBigMask)}func ( info) () info {if .isMapped() {return 0}return ( >> joinShift) & joinMask}func ( info) () bool {return &(modifier|catSmallMask) == modifier}func ( info) () bool {return &(attributesMask|catSmallMask) == viramaModifier}
![]() |
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |