...

Source file src/golang.org/x/text/secure/precis/gen_trieval.go

Documentation: golang.org/x/text/secure/precis

     1  // Copyright 2015 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  
     7  package main
     8  
     9  // entry is the entry of a trie table
    10  // 7..6   property (unassigned, disallowed, maybe, valid)
    11  // 5..0   category
    12  type entry uint8
    13  
    14  const (
    15  	propShift = 6
    16  	propMask  = 0xc0
    17  	catMask   = 0x3f
    18  )
    19  
    20  func (e entry) property() property { return property(e & propMask) }
    21  func (e entry) category() category { return category(e & catMask) }
    22  
    23  type property uint8
    24  
    25  // The order of these constants matter. A Profile may consider runes to be
    26  // allowed either from pValid or idDisOrFreePVal.
    27  const (
    28  	unassigned property = iota << propShift
    29  	disallowed
    30  	idDisOrFreePVal // disallowed for Identifier, pValid for FreeForm
    31  	pValid
    32  )
    33  
    34  // compute permutations of all properties and specialCategories.
    35  type category uint8
    36  
    37  const (
    38  	other category = iota
    39  
    40  	// Special rune types
    41  	joiningL
    42  	joiningD
    43  	joiningT
    44  	joiningR
    45  	viramaModifier
    46  	viramaJoinT // Virama + JoiningT
    47  	latinSmallL // U+006c
    48  	greek
    49  	greekJoinT // Greek + JoiningT
    50  	hebrew
    51  	hebrewJoinT // Hebrew + JoiningT
    52  	japanese    // hirigana, katakana, han
    53  
    54  	// Special rune types associated with contextual rules defined in
    55  	// https://tools.ietf.org/html/rfc5892#appendix-A.
    56  	// ContextO
    57  	zeroWidthNonJoiner // rule 1
    58  	zeroWidthJoiner    // rule 2
    59  	// ContextJ
    60  	middleDot                // rule 3
    61  	greekLowerNumeralSign    // rule 4
    62  	hebrewPreceding          // rule 5 and 6
    63  	katakanaMiddleDot        // rule 7
    64  	arabicIndicDigit         // rule 8
    65  	extendedArabicIndicDigit // rule 9
    66  
    67  	numCategories
    68  )
    69  

View as plain text