gen_trieval.go 1.6 KB

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