common.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
  2. package plural
  3. // Form defines a plural form.
  4. //
  5. // Not all languages support all forms. Also, the meaning of each form varies
  6. // per language. It is important to note that the name of a form does not
  7. // necessarily correspond one-to-one with the set of numbers. For instance,
  8. // for Croation, One matches not only 1, but also 11, 21, etc.
  9. //
  10. // Each language must at least support the form "other".
  11. type Form byte
  12. const (
  13. Other Form = iota
  14. Zero
  15. One
  16. Two
  17. Few
  18. Many
  19. )
  20. var countMap = map[string]Form{
  21. "other": Other,
  22. "zero": Zero,
  23. "one": One,
  24. "two": Two,
  25. "few": Few,
  26. "many": Many,
  27. }
  28. type pluralCheck struct {
  29. // category:
  30. // 3..7: opID
  31. // 0..2: category
  32. cat byte
  33. setID byte
  34. }
  35. // opID identifies the type of operand in the plural rule, being i, n or f.
  36. // (v, w, and t are treated as filters in our implementation.)
  37. type opID byte
  38. const (
  39. opMod opID = 0x1 // is '%' used?
  40. opNotEqual opID = 0x2 // using "!=" to compare
  41. opI opID = 0 << 2 // integers after taking the absolute value
  42. opN opID = 1 << 2 // full number (must be integer)
  43. opF opID = 2 << 2 // fraction
  44. opV opID = 3 << 2 // number of visible digits
  45. opW opID = 4 << 2 // number of visible digits without trailing zeros
  46. opBretonM opID = 5 << 2 // hard-wired rule for Breton
  47. opItalian800 opID = 6 << 2 // hard-wired rule for Italian
  48. opAzerbaijan00s opID = 7 << 2 // hard-wired rule for Azerbaijan
  49. )
  50. const (
  51. // Use this plural form to indicate the next rule needs to match as well.
  52. // The last condition in the list will have the correct plural form.
  53. andNext = 0x7
  54. formMask = 0x7
  55. opShift = 3
  56. // numN indicates the maximum integer, or maximum mod value, for which we
  57. // have inclusion masks.
  58. numN = 100
  59. // The common denominator of the modulo that is taken.
  60. maxMod = 100
  61. )