1 // Copyright 2016 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.
9 // Form defines a plural form.
11 // Not all languages support all forms. Also, the meaning of each form varies
12 // per language. It is important to note that the name of a form does not
13 // necessarily correspond one-to-one with the set of numbers. For instance,
14 // for Croation, One matches not only 1, but also 11, 21, etc.
16 // Each language must at least support the form "other".
28 var countMap = map[string]Form{
37 type pluralCheck struct {
45 // opID identifies the type of operand in the plural rule, being i, n or f.
46 // (v, w, and t are treated as filters in our implementation.)
50 opMod opID = 0x1 // is '%' used?
51 opNotEqual opID = 0x2 // using "!=" to compare
52 opI opID = 0 << 2 // integers after taking the absolute value
53 opN opID = 1 << 2 // full number (must be integer)
54 opF opID = 2 << 2 // fraction
55 opV opID = 3 << 2 // number of visible digits
56 opW opID = 4 << 2 // number of visible digits without trailing zeros
57 opBretonM opID = 5 << 2 // hard-wired rule for Breton
58 opItalian800 opID = 6 << 2 // hard-wired rule for Italian
59 opAzerbaijan00s opID = 7 << 2 // hard-wired rule for Azerbaijan
62 // Use this plural form to indicate the next rule needs to match as well.
63 // The last condition in the list will have the correct plural form.
69 // numN indicates the maximum integer, or maximum mod value, for which we
70 // have inclusion masks.
72 // The common denominator of the modulo that is taken.