OSDN Git Service

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