summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/text
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-04-24 20:11:36 -0400
committerJoram Wilander <jwawilander@gmail.com>2017-04-24 20:11:36 -0400
commitf5437632f486b7d0a0a181c58f113c86d032b02c (patch)
tree407388e3003a210a89f4b2128d7ad656f8b79d26 /vendor/golang.org/x/text
parent7f68a60f8c228d5604e0566bf84cabb145d16c37 (diff)
downloadchat-f5437632f486b7d0a0a181c58f113c86d032b02c.tar.gz
chat-f5437632f486b7d0a0a181c58f113c86d032b02c.tar.bz2
chat-f5437632f486b7d0a0a181c58f113c86d032b02c.zip
Upgrading server dependancies (#6215)
Diffstat (limited to 'vendor/golang.org/x/text')
-rw-r--r--vendor/golang.org/x/text/cases/cases.go4
-rw-r--r--vendor/golang.org/x/text/feature/plural/common.go70
-rw-r--r--vendor/golang.org/x/text/feature/plural/data_test.go192
-rw-r--r--vendor/golang.org/x/text/feature/plural/gen.go (renamed from vendor/golang.org/x/text/internal/number/gen_plural.go)54
-rw-r--r--vendor/golang.org/x/text/feature/plural/gen_common.go74
-rw-r--r--vendor/golang.org/x/text/feature/plural/plural.go234
-rw-r--r--vendor/golang.org/x/text/feature/plural/plural_test.go203
-rw-r--r--vendor/golang.org/x/text/feature/plural/tables.go541
-rw-r--r--vendor/golang.org/x/text/gen.go1
-rw-r--r--vendor/golang.org/x/text/internal/catmsg/varint.go62
-rw-r--r--vendor/golang.org/x/text/internal/catmsg/varint_test.go123
-rw-r--r--vendor/golang.org/x/text/internal/export/idna/example_test.go7
-rw-r--r--vendor/golang.org/x/text/internal/export/idna/idna.go13
-rw-r--r--vendor/golang.org/x/text/internal/format/plural/plural.go38
-rw-r--r--vendor/golang.org/x/text/internal/number/common.go56
-rw-r--r--vendor/golang.org/x/text/internal/number/data_test.go194
-rw-r--r--vendor/golang.org/x/text/internal/number/decimal.go416
-rw-r--r--vendor/golang.org/x/text/internal/number/extfloat.go671
-rw-r--r--vendor/golang.org/x/text/internal/number/ftoa.go448
-rw-r--r--vendor/golang.org/x/text/internal/number/gen.go10
-rw-r--r--vendor/golang.org/x/text/internal/number/gen_common.go54
-rw-r--r--vendor/golang.org/x/text/internal/number/itoa.go111
-rw-r--r--vendor/golang.org/x/text/internal/number/number.go2
-rw-r--r--vendor/golang.org/x/text/internal/number/plural.go119
-rw-r--r--vendor/golang.org/x/text/internal/number/plural_test.go110
-rw-r--r--vendor/golang.org/x/text/internal/number/tables.go537
-rw-r--r--vendor/golang.org/x/text/secure/precis/profile_test.go7
-rw-r--r--vendor/golang.org/x/text/secure/precis/profiles.go17
-rw-r--r--vendor/golang.org/x/text/unicode/norm/composition.go18
-rw-r--r--vendor/golang.org/x/text/unicode/norm/iter.go31
-rw-r--r--vendor/golang.org/x/text/unicode/norm/iter_test.go2
-rw-r--r--vendor/golang.org/x/text/unicode/norm/normalize.go16
-rw-r--r--vendor/golang.org/x/text/unicode/norm/normalize_test.go78
33 files changed, 1673 insertions, 2840 deletions
diff --git a/vendor/golang.org/x/text/cases/cases.go b/vendor/golang.org/x/text/cases/cases.go
index 02043726d..736c0c312 100644
--- a/vendor/golang.org/x/text/cases/cases.go
+++ b/vendor/golang.org/x/text/cases/cases.go
@@ -88,8 +88,8 @@ func Title(t language.Tag, opts ...Option) Caser {
//
// Case folding does not normalize the input and may not preserve a normal form.
// Use the collate or search package for more convenient and linguistically
-// sound comparisons. Use unicode/precis for string comparisons where security
-// aspects are a concern.
+// sound comparisons. Use golang.org/x/text/secure/precis for string comparisons
+// where security aspects are a concern.
func Fold(opts ...Option) Caser {
return Caser{makeFold(getOpts(opts...))}
}
diff --git a/vendor/golang.org/x/text/feature/plural/common.go b/vendor/golang.org/x/text/feature/plural/common.go
new file mode 100644
index 000000000..fdcb373fd
--- /dev/null
+++ b/vendor/golang.org/x/text/feature/plural/common.go
@@ -0,0 +1,70 @@
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+package plural
+
+// Form defines a plural form.
+//
+// Not all languages support all forms. Also, the meaning of each form varies
+// per language. It is important to note that the name of a form does not
+// necessarily correspond one-to-one with the set of numbers. For instance,
+// for Croation, One matches not only 1, but also 11, 21, etc.
+//
+// Each language must at least support the form "other".
+type Form byte
+
+const (
+ Other Form = iota
+ Zero
+ One
+ Two
+ Few
+ Many
+)
+
+var countMap = map[string]Form{
+ "other": Other,
+ "zero": Zero,
+ "one": One,
+ "two": Two,
+ "few": Few,
+ "many": Many,
+}
+
+type pluralCheck struct {
+ // category:
+ // 3..7: opID
+ // 0..2: category
+ cat byte
+ setID byte
+}
+
+// opID identifies the type of operand in the plural rule, being i, n or f.
+// (v, w, and t are treated as filters in our implementation.)
+type opID byte
+
+const (
+ opMod opID = 0x1 // is '%' used?
+ opNotEqual opID = 0x2 // using "!=" to compare
+ opI opID = 0 << 2 // integers after taking the absolute value
+ opN opID = 1 << 2 // full number (must be integer)
+ opF opID = 2 << 2 // fraction
+ opV opID = 3 << 2 // number of visible digits
+ opW opID = 4 << 2 // number of visible digits without trailing zeros
+ opBretonM opID = 5 << 2 // hard-wired rule for Breton
+ opItalian800 opID = 6 << 2 // hard-wired rule for Italian
+ opAzerbaijan00s opID = 7 << 2 // hard-wired rule for Azerbaijan
+)
+const (
+ // Use this plural form to indicate the next rule needs to match as well.
+ // The last condition in the list will have the correct plural form.
+ andNext = 0x7
+ formMask = 0x7
+
+ opShift = 3
+
+ // numN indicates the maximum integer, or maximum mod value, for which we
+ // have inclusion masks.
+ numN = 100
+ // The common denominator of the modulo that is taken.
+ maxMod = 100
+)
diff --git a/vendor/golang.org/x/text/feature/plural/data_test.go b/vendor/golang.org/x/text/feature/plural/data_test.go
new file mode 100644
index 000000000..1efe9e13c
--- /dev/null
+++ b/vendor/golang.org/x/text/feature/plural/data_test.go
@@ -0,0 +1,192 @@
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+package plural
+
+type pluralTest struct {
+ locales string
+ form int
+ integer []string
+ decimal []string
+}
+
+var ordinalTests = []pluralTest{ // 59 elements
+ 0: {locales: "af am ar bg bs ce cs da de dsb el es et eu fa fi fy gl he hr hsb id in is iw ja km kn ko ky lt lv ml mn my nb nl pa pl prg pt root ru sh si sk sl sr sw ta te th tr ur uz yue zh zu", form: 0, integer: []string{"0~15", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 1: {locales: "sv", form: 2, integer: []string{"1", "2", "21", "22", "31", "32", "41", "42", "51", "52", "61", "62", "71", "72", "81", "82", "101", "1001"}, decimal: []string(nil)},
+ 2: {locales: "sv", form: 0, integer: []string{"0", "3~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 3: {locales: "fil fr ga hy lo mo ms ro tl vi", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 4: {locales: "fil fr ga hy lo mo ms ro tl vi", form: 0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 5: {locales: "hu", form: 2, integer: []string{"1", "5"}, decimal: []string(nil)},
+ 6: {locales: "hu", form: 0, integer: []string{"0", "2~4", "6~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 7: {locales: "ne", form: 2, integer: []string{"1~4"}, decimal: []string(nil)},
+ 8: {locales: "ne", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 9: {locales: "be", form: 4, integer: []string{"2", "3", "22", "23", "32", "33", "42", "43", "52", "53", "62", "63", "72", "73", "82", "83", "102", "1002"}, decimal: []string(nil)},
+ 10: {locales: "be", form: 0, integer: []string{"0", "1", "4~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 11: {locales: "uk", form: 4, integer: []string{"3", "23", "33", "43", "53", "63", "73", "83", "103", "1003"}, decimal: []string(nil)},
+ 12: {locales: "uk", form: 0, integer: []string{"0~2", "4~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 13: {locales: "kk", form: 5, integer: []string{"6", "9", "10", "16", "19", "20", "26", "29", "30", "36", "39", "40", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 14: {locales: "kk", form: 0, integer: []string{"0~5", "7", "8", "11~15", "17", "18", "21", "101", "1001"}, decimal: []string(nil)},
+ 15: {locales: "it", form: 5, integer: []string{"8", "11", "80", "800"}, decimal: []string(nil)},
+ 16: {locales: "it", form: 0, integer: []string{"0~7", "9", "10", "12~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 17: {locales: "ka", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 18: {locales: "ka", form: 5, integer: []string{"0", "2~16", "102", "1002"}, decimal: []string(nil)},
+ 19: {locales: "ka", form: 0, integer: []string{"21~36", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 20: {locales: "sq", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 21: {locales: "sq", form: 5, integer: []string{"4", "24", "34", "44", "54", "64", "74", "84", "104", "1004"}, decimal: []string(nil)},
+ 22: {locales: "sq", form: 0, integer: []string{"0", "2", "3", "5~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 23: {locales: "en", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string(nil)},
+ 24: {locales: "en", form: 3, integer: []string{"2", "22", "32", "42", "52", "62", "72", "82", "102", "1002"}, decimal: []string(nil)},
+ 25: {locales: "en", form: 4, integer: []string{"3", "23", "33", "43", "53", "63", "73", "83", "103", "1003"}, decimal: []string(nil)},
+ 26: {locales: "en", form: 0, integer: []string{"0", "4~18", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 27: {locales: "mr", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 28: {locales: "mr", form: 3, integer: []string{"2", "3"}, decimal: []string(nil)},
+ 29: {locales: "mr", form: 4, integer: []string{"4"}, decimal: []string(nil)},
+ 30: {locales: "mr", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 31: {locales: "ca", form: 2, integer: []string{"1", "3"}, decimal: []string(nil)},
+ 32: {locales: "ca", form: 3, integer: []string{"2"}, decimal: []string(nil)},
+ 33: {locales: "ca", form: 4, integer: []string{"4"}, decimal: []string(nil)},
+ 34: {locales: "ca", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 35: {locales: "mk", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string(nil)},
+ 36: {locales: "mk", form: 3, integer: []string{"2", "22", "32", "42", "52", "62", "72", "82", "102", "1002"}, decimal: []string(nil)},
+ 37: {locales: "mk", form: 5, integer: []string{"7", "8", "27", "28", "37", "38", "47", "48", "57", "58", "67", "68", "77", "78", "87", "88", "107", "1007"}, decimal: []string(nil)},
+ 38: {locales: "mk", form: 0, integer: []string{"0", "3~6", "9~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 39: {locales: "az", form: 2, integer: []string{"1", "2", "5", "7", "8", "11", "12", "15", "17", "18", "20~22", "25", "101", "1001"}, decimal: []string(nil)},
+ 40: {locales: "az", form: 4, integer: []string{"3", "4", "13", "14", "23", "24", "33", "34", "43", "44", "53", "54", "63", "64", "73", "74", "100", "1003"}, decimal: []string(nil)},
+ 41: {locales: "az", form: 5, integer: []string{"0", "6", "16", "26", "36", "40", "46", "56", "106", "1006"}, decimal: []string(nil)},
+ 42: {locales: "az", form: 0, integer: []string{"9", "10", "19", "29", "30", "39", "49", "59", "69", "79", "109", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 43: {locales: "gu hi", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 44: {locales: "gu hi", form: 3, integer: []string{"2", "3"}, decimal: []string(nil)},
+ 45: {locales: "gu hi", form: 4, integer: []string{"4"}, decimal: []string(nil)},
+ 46: {locales: "gu hi", form: 5, integer: []string{"6"}, decimal: []string(nil)},
+ 47: {locales: "gu hi", form: 0, integer: []string{"0", "5", "7~20", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 48: {locales: "as bn", form: 2, integer: []string{"1", "5", "7~10"}, decimal: []string(nil)},
+ 49: {locales: "as bn", form: 3, integer: []string{"2", "3"}, decimal: []string(nil)},
+ 50: {locales: "as bn", form: 4, integer: []string{"4"}, decimal: []string(nil)},
+ 51: {locales: "as bn", form: 5, integer: []string{"6"}, decimal: []string(nil)},
+ 52: {locales: "as bn", form: 0, integer: []string{"0", "11~25", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 53: {locales: "cy", form: 1, integer: []string{"0", "7~9"}, decimal: []string(nil)},
+ 54: {locales: "cy", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 55: {locales: "cy", form: 3, integer: []string{"2"}, decimal: []string(nil)},
+ 56: {locales: "cy", form: 4, integer: []string{"3", "4"}, decimal: []string(nil)},
+ 57: {locales: "cy", form: 5, integer: []string{"5", "6"}, decimal: []string(nil)},
+ 58: {locales: "cy", form: 0, integer: []string{"10~25", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+} // Size: 4272 bytes
+
+var cardinalTests = []pluralTest{ // 115 elements
+ 0: {locales: "bm bo dz id ig ii in ja jbo jv jw kde kea km ko lkt lo ms my nqo root sah ses sg th to vi wo yo yue zh", form: 0, integer: []string{"0~15", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 1: {locales: "am as bn fa gu hi kn mr zu", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0~1.0", "0.00~0.04"}},
+ 2: {locales: "am as bn fa gu hi kn mr zu", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"1.1~2.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 3: {locales: "ff fr hy kab", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0~1.5"}},
+ 4: {locales: "ff fr hy kab", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"2.0~3.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 5: {locales: "ast ca de en et fi fy gl it ji nl sv sw ur yi", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 6: {locales: "ast ca de en et fi fy gl it ji nl sv sw ur yi", form: 0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 7: {locales: "si", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0", "0.1", "1.0", "0.00", "0.01", "1.00", "0.000", "0.001", "1.000", "0.0000", "0.0001", "1.0000"}},
+ 8: {locales: "si", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.2~0.9", "1.1~1.8", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 9: {locales: "ak bh guw ln mg nso pa ti wa", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0", "1.0", "0.00", "1.00", "0.000", "1.000", "0.0000", "1.0000"}},
+ 10: {locales: "ak bh guw ln mg nso pa ti wa", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 11: {locales: "tzm", form: 2, integer: []string{"0", "1", "11~24"}, decimal: []string{"0.0", "1.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "19.0", "20.0", "21.0", "22.0", "23.0", "24.0"}},
+ 12: {locales: "tzm", form: 0, integer: []string{"2~10", "100~106", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 13: {locales: "pt", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0", "1.0", "0.00", "1.00", "0.000", "1.000", "0.0000", "1.0000"}},
+ 14: {locales: "pt", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 15: {locales: "af asa az bem bez bg brx ce cgg chr ckb dv ee el eo es eu fo fur gsw ha haw hu jgo jmc ka kaj kcg kk kkj kl ks ksb ku ky lb lg mas mgo ml mn nah nb nd ne nn nnh no nr ny nyn om or os pap ps rm rof rwk saq sdh seh sn so sq ss ssy st syr ta te teo tig tk tn tr ts ug uz ve vo vun wae xh xog", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
+ 16: {locales: "af asa az bem bez bg brx ce cgg chr ckb dv ee el eo es eu fo fur gsw ha haw hu jgo jmc ka kaj kcg kk kkj kl ks ksb ku ky lb lg mas mgo ml mn nah nb nd ne nn nnh no nr ny nyn om or os pap ps rm rof rwk saq sdh seh sn so sq ss ssy st syr ta te teo tig tk tn tr ts ug uz ve vo vun wae xh xog", form: 0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 17: {locales: "pt_PT", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 18: {locales: "pt_PT", form: 0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 19: {locales: "da", form: 2, integer: []string{"1"}, decimal: []string{"0.1~1.6"}},
+ 20: {locales: "da", form: 0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "2.0~3.4", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 21: {locales: "is", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"0.1~1.6", "10.1", "100.1", "1000.1"}},
+ 22: {locales: "is", form: 0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 23: {locales: "mk", form: 2, integer: []string{"1", "11", "21", "31", "41", "51", "61", "71", "101", "1001"}, decimal: []string{"0.1", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
+ 24: {locales: "mk", form: 0, integer: []string{"0", "2~10", "12~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "0.2~1.0", "1.2~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 25: {locales: "fil tl", form: 2, integer: []string{"0~3", "5", "7", "8", "10~13", "15", "17", "18", "20", "21", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.3", "0.5", "0.7", "0.8", "1.0~1.3", "1.5", "1.7", "1.8", "2.0", "2.1", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 26: {locales: "fil tl", form: 0, integer: []string{"4", "6", "9", "14", "16", "19", "24", "26", "104", "1004"}, decimal: []string{"0.4", "0.6", "0.9", "1.4", "1.6", "1.9", "2.4", "2.6", "10.4", "100.4", "1000.4"}},
+ 27: {locales: "lv prg", form: 1, integer: []string{"0", "10~20", "30", "40", "50", "60", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "10.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 28: {locales: "lv prg", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"0.1", "1.0", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
+ 29: {locales: "lv prg", form: 0, integer: []string{"2~9", "22~29", "102", "1002"}, decimal: []string{"0.2~0.9", "1.2~1.9", "10.2", "100.2", "1000.2"}},
+ 30: {locales: "lag", form: 1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
+ 31: {locales: "lag", form: 2, integer: []string{"1"}, decimal: []string{"0.1~1.6"}},
+ 32: {locales: "lag", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"2.0~3.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 33: {locales: "ksh", form: 1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
+ 34: {locales: "ksh", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
+ 35: {locales: "ksh", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 36: {locales: "iu kw naq se sma smi smj smn sms", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
+ 37: {locales: "iu kw naq se sma smi smj smn sms", form: 3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
+ 38: {locales: "iu kw naq se sma smi smj smn sms", form: 0, integer: []string{"0", "3~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 39: {locales: "shi", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0~1.0", "0.00~0.04"}},
+ 40: {locales: "shi", form: 4, integer: []string{"2~10"}, decimal: []string{"2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "2.00", "3.00", "4.00", "5.00", "6.00", "7.00", "8.00"}},
+ 41: {locales: "shi", form: 0, integer: []string{"11~26", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"1.1~1.9", "2.1~2.7", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 42: {locales: "mo ro", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 43: {locales: "mo ro", form: 4, integer: []string{"0", "2~16", "101", "1001"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 44: {locales: "mo ro", form: 0, integer: []string{"20~35", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 45: {locales: "bs hr sh sr", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"0.1", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
+ 46: {locales: "bs hr sh sr", form: 4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string{"0.2~0.4", "1.2~1.4", "2.2~2.4", "3.2~3.4", "4.2~4.4", "5.2", "10.2", "100.2", "1000.2"}},
+ 47: {locales: "bs hr sh sr", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "0.5~1.0", "1.5~2.0", "2.5~2.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 48: {locales: "gd", form: 2, integer: []string{"1", "11"}, decimal: []string{"1.0", "11.0", "1.00", "11.00", "1.000", "11.000", "1.0000"}},
+ 49: {locales: "gd", form: 3, integer: []string{"2", "12"}, decimal: []string{"2.0", "12.0", "2.00", "12.00", "2.000", "12.000", "2.0000"}},
+ 50: {locales: "gd", form: 4, integer: []string{"3~10", "13~19"}, decimal: []string{"3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "19.0", "3.00"}},
+ 51: {locales: "gd", form: 0, integer: []string{"0", "20~34", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 52: {locales: "sl", form: 2, integer: []string{"1", "101", "201", "301", "401", "501", "601", "701", "1001"}, decimal: []string(nil)},
+ 53: {locales: "sl", form: 3, integer: []string{"2", "102", "202", "302", "402", "502", "602", "702", "1002"}, decimal: []string(nil)},
+ 54: {locales: "sl", form: 4, integer: []string{"3", "4", "103", "104", "203", "204", "303", "304", "403", "404", "503", "504", "603", "604", "703", "704", "1003"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 55: {locales: "sl", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 56: {locales: "dsb hsb", form: 2, integer: []string{"1", "101", "201", "301", "401", "501", "601", "701", "1001"}, decimal: []string{"0.1", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
+ 57: {locales: "dsb hsb", form: 3, integer: []string{"2", "102", "202", "302", "402", "502", "602", "702", "1002"}, decimal: []string{"0.2", "1.2", "2.2", "3.2", "4.2", "5.2", "6.2", "7.2", "10.2", "100.2", "1000.2"}},
+ 58: {locales: "dsb hsb", form: 4, integer: []string{"3", "4", "103", "104", "203", "204", "303", "304", "403", "404", "503", "504", "603", "604", "703", "704", "1003"}, decimal: []string{"0.3", "0.4", "1.3", "1.4", "2.3", "2.4", "3.3", "3.4", "4.3", "4.4", "5.3", "5.4", "6.3", "6.4", "7.3", "7.4", "10.3", "100.3", "1000.3"}},
+ 59: {locales: "dsb hsb", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "0.5~1.0", "1.5~2.0", "2.5~2.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 60: {locales: "he iw", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 61: {locales: "he iw", form: 3, integer: []string{"2"}, decimal: []string(nil)},
+ 62: {locales: "he iw", form: 5, integer: []string{"20", "30", "40", "50", "60", "70", "80", "90", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 63: {locales: "he iw", form: 0, integer: []string{"0", "3~17", "101", "1001"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 64: {locales: "cs sk", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 65: {locales: "cs sk", form: 4, integer: []string{"2~4"}, decimal: []string(nil)},
+ 66: {locales: "cs sk", form: 5, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 67: {locales: "cs sk", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 68: {locales: "pl", form: 2, integer: []string{"1"}, decimal: []string(nil)},
+ 69: {locales: "pl", form: 4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string(nil)},
+ 70: {locales: "pl", form: 5, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 71: {locales: "pl", form: 0, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 72: {locales: "be", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"1.0", "21.0", "31.0", "41.0", "51.0", "61.0", "71.0", "81.0", "101.0", "1001.0"}},
+ 73: {locales: "be", form: 4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string{"2.0", "3.0", "4.0", "22.0", "23.0", "24.0", "32.0", "33.0", "102.0", "1002.0"}},
+ 74: {locales: "be", form: 5, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "11.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 75: {locales: "be", form: 0, integer: []string(nil), decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.1", "1000.1"}},
+ 76: {locales: "lt", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"1.0", "21.0", "31.0", "41.0", "51.0", "61.0", "71.0", "81.0", "101.0", "1001.0"}},
+ 77: {locales: "lt", form: 4, integer: []string{"2~9", "22~29", "102", "1002"}, decimal: []string{"2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "22.0", "102.0", "1002.0"}},
+ 78: {locales: "lt", form: 5, integer: []string(nil), decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.1", "1000.1"}},
+ 79: {locales: "lt", form: 0, integer: []string{"0", "10~20", "30", "40", "50", "60", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "10.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 80: {locales: "mt", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
+ 81: {locales: "mt", form: 4, integer: []string{"0", "2~10", "102~107", "1002"}, decimal: []string{"0.0", "2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "10.0", "102.0", "1002.0"}},
+ 82: {locales: "mt", form: 5, integer: []string{"11~19", "111~117", "1011"}, decimal: []string{"11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "111.0", "1011.0"}},
+ 83: {locales: "mt", form: 0, integer: []string{"20~35", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 84: {locales: "ru uk", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string(nil)},
+ 85: {locales: "ru uk", form: 4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string(nil)},
+ 86: {locales: "ru uk", form: 5, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 87: {locales: "ru uk", form: 0, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 88: {locales: "br", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "81", "101", "1001"}, decimal: []string{"1.0", "21.0", "31.0", "41.0", "51.0", "61.0", "81.0", "101.0", "1001.0"}},
+ 89: {locales: "br", form: 3, integer: []string{"2", "22", "32", "42", "52", "62", "82", "102", "1002"}, decimal: []string{"2.0", "22.0", "32.0", "42.0", "52.0", "62.0", "82.0", "102.0", "1002.0"}},
+ 90: {locales: "br", form: 4, integer: []string{"3", "4", "9", "23", "24", "29", "33", "34", "39", "43", "44", "49", "103", "1003"}, decimal: []string{"3.0", "4.0", "9.0", "23.0", "24.0", "29.0", "33.0", "34.0", "103.0", "1003.0"}},
+ 91: {locales: "br", form: 5, integer: []string{"1000000"}, decimal: []string{"1000000.0", "1000000.00", "1000000.000"}},
+ 92: {locales: "br", form: 0, integer: []string{"0", "5~8", "10~20", "100", "1000", "10000", "100000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0"}},
+ 93: {locales: "ga", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
+ 94: {locales: "ga", form: 3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
+ 95: {locales: "ga", form: 4, integer: []string{"3~6"}, decimal: []string{"3.0", "4.0", "5.0", "6.0", "3.00", "4.00", "5.00", "6.00", "3.000", "4.000", "5.000", "6.000", "3.0000", "4.0000", "5.0000", "6.0000"}},
+ 96: {locales: "ga", form: 5, integer: []string{"7~10"}, decimal: []string{"7.0", "8.0", "9.0", "10.0", "7.00", "8.00", "9.00", "10.00", "7.000", "8.000", "9.000", "10.000", "7.0000", "8.0000", "9.0000", "10.0000"}},
+ 97: {locales: "ga", form: 0, integer: []string{"0", "11~25", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 98: {locales: "gv", form: 2, integer: []string{"1", "11", "21", "31", "41", "51", "61", "71", "101", "1001"}, decimal: []string(nil)},
+ 99: {locales: "gv", form: 3, integer: []string{"2", "12", "22", "32", "42", "52", "62", "72", "102", "1002"}, decimal: []string(nil)},
+ 100: {locales: "gv", form: 4, integer: []string{"0", "20", "40", "60", "80", "100", "120", "140", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
+ 101: {locales: "gv", form: 5, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 102: {locales: "gv", form: 0, integer: []string{"3~10", "13~19", "23", "103", "1003"}, decimal: []string(nil)},
+ 103: {locales: "ar ars", form: 1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
+ 104: {locales: "ar ars", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
+ 105: {locales: "ar ars", form: 3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
+ 106: {locales: "ar ars", form: 4, integer: []string{"3~10", "103~110", "1003"}, decimal: []string{"3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "103.0", "1003.0"}},
+ 107: {locales: "ar ars", form: 5, integer: []string{"11~26", "111", "1011"}, decimal: []string{"11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "111.0", "1011.0"}},
+ 108: {locales: "ar ars", form: 0, integer: []string{"100~102", "200~202", "300~302", "400~402", "500~502", "600", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+ 109: {locales: "cy", form: 1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
+ 110: {locales: "cy", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
+ 111: {locales: "cy", form: 3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
+ 112: {locales: "cy", form: 4, integer: []string{"3"}, decimal: []string{"3.0", "3.00", "3.000", "3.0000"}},
+ 113: {locales: "cy", form: 5, integer: []string{"6"}, decimal: []string{"6.0", "6.00", "6.000", "6.0000"}},
+ 114: {locales: "cy", form: 0, integer: []string{"4", "5", "7~20", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
+} // Size: 8304 bytes
+
+// Total table size 12576 bytes (12KiB); checksum: 166DAB75
diff --git a/vendor/golang.org/x/text/internal/number/gen_plural.go b/vendor/golang.org/x/text/feature/plural/gen.go
index 05a672249..a0de986a2 100644
--- a/vendor/golang.org/x/text/internal/number/gen_plural.go
+++ b/vendor/golang.org/x/text/feature/plural/gen.go
@@ -57,21 +57,63 @@ package main
import (
"bufio"
"bytes"
+ "flag"
"fmt"
"log"
"strconv"
"strings"
"golang.org/x/text/internal"
- "golang.org/x/text/internal/format/plural"
"golang.org/x/text/internal/gen"
"golang.org/x/text/language"
"golang.org/x/text/unicode/cldr"
)
+var (
+ test = flag.Bool("test", false,
+ "test existing tables; can be used to compare web data with package data.")
+ outputFile = flag.String("output", "tables.go", "output file")
+ outputTestFile = flag.String("testoutput", "data_test.go", "output file")
+
+ draft = flag.String("draft",
+ "contributed",
+ `Minimal draft requirements (approved, contributed, provisional, unconfirmed).`)
+)
+
+func main() {
+ gen.Init()
+
+ const pkg = "plural"
+
+ gen.Repackage("gen_common.go", "common.go", pkg)
+ // Read the CLDR zip file.
+ r := gen.OpenCLDRCoreZip()
+ defer r.Close()
+
+ d := &cldr.Decoder{}
+ d.SetDirFilter("supplemental", "main")
+ d.SetSectionFilter("numbers", "plurals")
+ data, err := d.DecodeZip(r)
+ if err != nil {
+ log.Fatalf("DecodeZip: %v", err)
+ }
+
+ w := gen.NewCodeWriter()
+ defer w.WriteGoFile(*outputFile, pkg)
+
+ gen.WriteCLDRVersion(w)
+
+ genPlurals(w, data)
+
+ w = gen.NewCodeWriter()
+ defer w.WriteGoFile(*outputTestFile, pkg)
+
+ genPluralsTests(w, data)
+}
+
type pluralTest struct {
- locales string // space-separated list of locales for this test
- form plural.Form
+ locales string // space-separated list of locales for this test
+ form int // Use int instead of Form to simplify generation.
integer []string // Entries of the form \d+ or \d+~\d+
decimal []string // Entries of the form \f+ or \f+ +~\f+, where f is \d+\.\d+
}
@@ -90,7 +132,7 @@ func genPluralsTests(w *gen.CodeWriter, data *cldr.CLDR) {
for _, rule := range pRules.PluralRule {
test := pluralTest{
locales: pRules.Locales,
- form: countMap[rule.Count],
+ form: int(countMap[rule.Count]),
}
scan := bufio.NewScanner(strings.NewReader(rule.Data()))
scan.Split(splitTokens)
@@ -255,7 +297,7 @@ func genPlurals(w *gen.CodeWriter, data *cldr.CLDR) {
type orCondition struct {
original string // for debugging
- form plural.Form
+ form Form
used [32]bool
set [32][numN]bool
}
@@ -316,7 +358,7 @@ var operandIndex = map[string]opID{
//
// @integer and @decimal are followed by examples and are not relevant for the
// rule itself. The are used here to signal the termination of the rule.
-func parsePluralCondition(conds []orCondition, s string, f plural.Form) []orCondition {
+func parsePluralCondition(conds []orCondition, s string, f Form) []orCondition {
scan := bufio.NewScanner(strings.NewReader(s))
scan.Split(splitTokens)
for {
diff --git a/vendor/golang.org/x/text/feature/plural/gen_common.go b/vendor/golang.org/x/text/feature/plural/gen_common.go
new file mode 100644
index 000000000..24aa41505
--- /dev/null
+++ b/vendor/golang.org/x/text/feature/plural/gen_common.go
@@ -0,0 +1,74 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build ignore
+
+package main
+
+// Form defines a plural form.
+//
+// Not all languages support all forms. Also, the meaning of each form varies
+// per language. It is important to note that the name of a form does not
+// necessarily correspond one-to-one with the set of numbers. For instance,
+// for Croation, One matches not only 1, but also 11, 21, etc.
+//
+// Each language must at least support the form "other".
+type Form byte
+
+const (
+ Other Form = iota
+ Zero
+ One
+ Two
+ Few
+ Many
+)
+
+var countMap = map[string]Form{
+ "other": Other,
+ "zero": Zero,
+ "one": One,
+ "two": Two,
+ "few": Few,
+ "many": Many,
+}
+
+type pluralCheck struct {
+ // category:
+ // 3..7: opID
+ // 0..2: category
+ cat byte
+ setID byte
+}
+
+// opID identifies the type of operand in the plural rule, being i, n or f.
+// (v, w, and t are treated as filters in our implementation.)
+type opID byte
+
+const (
+ opMod opID = 0x1 // is '%' used?
+ opNotEqual opID = 0x2 // using "!=" to compare
+ opI opID = 0 << 2 // integers after taking the absolute value
+ opN opID = 1 << 2 // full number (must be integer)
+ opF opID = 2 << 2 // fraction
+ opV opID = 3 << 2 // number of visible digits
+ opW opID = 4 << 2 // number of visible digits without trailing zeros
+ opBretonM opID = 5 << 2 // hard-wired rule for Breton
+ opItalian800 opID = 6 << 2 // hard-wired rule for Italian
+ opAzerbaijan00s opID = 7 << 2 // hard-wired rule for Azerbaijan
+)
+const (
+ // Use this plural form to indicate the next rule needs to match as well.
+ // The last condition in the list will have the correct plural form.
+ andNext = 0x7
+ formMask = 0x7
+
+ opShift = 3
+
+ // numN indicates the maximum integer, or maximum mod value, for which we
+ // have inclusion masks.
+ numN = 100
+ // The common denominator of the modulo that is taken.
+ maxMod = 100
+)
diff --git a/vendor/golang.org/x/text/feature/plural/plural.go b/vendor/golang.org/x/text/feature/plural/plural.go
new file mode 100644
index 000000000..2b4cfe321
--- /dev/null
+++ b/vendor/golang.org/x/text/feature/plural/plural.go
@@ -0,0 +1,234 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:generate go run gen.go gen_common.go
+
+// Package plural provides utilities for handling linguistic plurals in text.
+//
+// The definitions in this package are based on the plural rule handling defined
+// in CLDR. See
+// http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules for
+// details.
+package plural
+
+import (
+ "golang.org/x/text/language"
+)
+
+// Rules defines the plural rules for all languages for a certain plural type.
+//
+//
+// This package is UNDER CONSTRUCTION and its API may change.
+type Rules struct {
+ rules []pluralCheck
+ index []byte
+ langToIndex []byte
+ inclusionMasks []uint64
+}
+
+var (
+ // Cardinal defines the plural rules for numbers indicating quantities.
+ Cardinal *Rules = cardinal
+
+ // Ordinal defines the plural rules for numbers indicating position
+ // (first, second, etc.).
+ Ordinal *Rules = ordinal
+
+ ordinal = &Rules{
+ ordinalRules,
+ ordinalIndex,
+ ordinalLangToIndex,
+ ordinalInclusionMasks[:],
+ }
+
+ cardinal = &Rules{
+ cardinalRules,
+ cardinalIndex,
+ cardinalLangToIndex,
+ cardinalInclusionMasks[:],
+ }
+)
+
+// getIntApprox converts the digits in slice digits[start:end] to an integer
+// according to the following rules:
+// - Let i be asInt(digits[start:end]), where out-of-range digits are assumed
+// to be zero.
+// - Result n is big if i / 10^nMod > 1.
+// - Otherwise the result is i % 10^nMod.
+//
+// For example, if digits is {1, 2, 3} and start:end is 0:5, then the result
+// for various values of nMod is:
+// - when nMod == 2, n == big
+// - when nMod == 3, n == big
+// - when nMod == 4, n == big
+// - when nMod == 5, n == 12300
+// - when nMod == 6, n == 12300
+// - when nMod == 7, n == 12300
+func getIntApprox(digits []byte, start, end, nMod, big int) (n int) {
+ // Leading 0 digits just result in 0.
+ p := start
+ if p < 0 {
+ p = 0
+ }
+ // Range only over the part for which we have digits.
+ mid := end
+ if mid >= len(digits) {
+ mid = len(digits)
+ }
+ // Check digits more significant that nMod.
+ if q := end - nMod; q > 0 {
+ if q > mid {
+ q = mid
+ }
+ for ; p < q; p++ {
+ if digits[p] != 0 {
+ return big
+ }
+ }
+ }
+ for ; p < mid; p++ {
+ n = 10*n + int(digits[p])
+ }
+ // Multiply for trailing zeros.
+ for ; p < end; p++ {
+ n *= 10
+ }
+ return n
+}
+
+// MatchDigits computes the plural form for the given language and the given
+// decimal floating point digits. The digits are stored in big-endian order and
+// are of value byte(0) - byte(9). The floating point position is indicated by
+// exp and the number of visible decimals is scale. All leading and trailing
+// zeros may be omitted from digits.
+//
+// The following table contains examples of possible arguments to represent
+// the given numbers.
+// decimal digits exp scale
+// 123 []byte{1, 2, 3} 3 0
+// 123.4 []byte{1, 2, 3, 4} 3 1
+// 123.40 []byte{1, 2, 3, 4} 3 2
+// 100000 []byte{1} 6......0
+// 100000.00 []byte{1} 6......3
+func (p *Rules) MatchDigits(t language.Tag, digits []byte, exp, scale int) Form {
+ index, _ := language.CompactIndex(t)
+ endN := len(digits) + exp
+
+ // Differentiate up to including mod 1000000 for the integer part.
+ n := getIntApprox(digits, 0, endN, 6, 1000000)
+
+ // Differentiate up to including mod 100 for the fractional part.
+ f := getIntApprox(digits, endN, endN+scale, 2, 100)
+
+ return matchPlural(p, index, n, f, scale)
+}
+
+func validForms(p *Rules, t language.Tag) (forms []Form) {
+ index, _ := language.CompactIndex(t)
+ offset := p.langToIndex[index]
+ rules := p.rules[p.index[offset]:p.index[offset+1]]
+
+ forms = append(forms, Other)
+ last := Other
+ for _, r := range rules {
+ if cat := Form(r.cat & formMask); cat != andNext && last != cat {
+ forms = append(forms, cat)
+ last = cat
+ }
+ }
+ return forms
+}
+
+func (p *Rules) matchComponents(t language.Tag, n, f, scale int) Form {
+ index, _ := language.CompactIndex(t)
+ return matchPlural(p, index, n, f, scale)
+}
+
+func matchPlural(p *Rules, index int, n, f, v int) Form {
+ nMask := p.inclusionMasks[n%maxMod]
+ // Compute the fMask inline in the rules below, as it is relatively rare.
+ // fMask := p.inclusionMasks[f%maxMod]
+ vMask := p.inclusionMasks[v%maxMod]
+
+ // Do the matching
+ offset := p.langToIndex[index]
+ rules := p.rules[p.index[offset]:p.index[offset+1]]
+ for i := 0; i < len(rules); i++ {
+ rule := rules[i]
+ setBit := uint64(1 << rule.setID)
+ var skip bool
+ switch op := opID(rule.cat >> opShift); op {
+ case opI: // i = x
+ skip = n >= numN || nMask&setBit == 0
+
+ case opI | opNotEqual: // i != x
+ skip = n < numN && nMask&setBit != 0
+
+ case opI | opMod: // i % m = x
+ skip = nMask&setBit == 0
+
+ case opI | opMod | opNotEqual: // i % m != x
+ skip = nMask&setBit != 0
+
+ case opN: // n = x
+ skip = f != 0 || n >= numN || nMask&setBit == 0
+
+ case opN | opNotEqual: // n != x
+ skip = f == 0 && n < numN && nMask&setBit != 0
+
+ case opN | opMod: // n % m = x
+ skip = f != 0 || nMask&setBit == 0
+
+ case opN | opMod | opNotEqual: // n % m != x
+ skip = f == 0 && nMask&setBit != 0
+
+ case opF: // f = x
+ skip = f >= numN || p.inclusionMasks[f%maxMod]&setBit == 0
+
+ case opF | opNotEqual: // f != x
+ skip = f < numN && p.inclusionMasks[f%maxMod]&setBit != 0
+
+ case opF | opMod: // f % m = x
+ skip = p.inclusionMasks[f%maxMod]&setBit == 0
+
+ case opF | opMod | opNotEqual: // f % m != x
+ skip = p.inclusionMasks[f%maxMod]&setBit != 0
+
+ case opV: // v = x
+ skip = v < numN && vMask&setBit == 0
+
+ case opV | opNotEqual: // v != x
+ skip = v < numN && vMask&setBit != 0
+
+ case opW: // w == 0
+ skip = f != 0
+
+ case opW | opNotEqual: // w != 0
+ skip = f == 0
+
+ // Hard-wired rules that cannot be handled by our algorithm.
+
+ case opBretonM:
+ skip = f != 0 || n == 0 || n%1000000 != 0
+
+ case opAzerbaijan00s:
+ // 100,200,300,400,500,600,700,800,900
+ skip = n == 0 || n >= 1000 || n%100 != 0
+
+ case opItalian800:
+ skip = (f != 0 || n >= numN || nMask&setBit == 0) && n != 800
+ }
+ if skip {
+ // advance over AND entries.
+ for ; i < len(rules) && rules[i].cat&formMask == andNext; i++ {
+ }
+ continue
+ }
+ // return if we have a final entry.
+ if cat := rule.cat & formMask; cat != andNext {
+ return Form(cat)
+ }
+ }
+ return Other
+}
diff --git a/vendor/golang.org/x/text/feature/plural/plural_test.go b/vendor/golang.org/x/text/feature/plural/plural_test.go
new file mode 100644
index 000000000..e5524c59a
--- /dev/null
+++ b/vendor/golang.org/x/text/feature/plural/plural_test.go
@@ -0,0 +1,203 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package plural
+
+import (
+ "fmt"
+ "reflect"
+ "strconv"
+ "strings"
+ "testing"
+
+ "golang.org/x/text/language"
+)
+
+func TestGetIntApprox(t *testing.T) {
+ const big = 1234567890
+ testCases := []struct {
+ digits string
+ start int
+ end int
+ nMod int
+ want int
+ }{
+ {"123", 0, 1, 1, 1},
+ {"123", 0, 2, 1, big},
+ {"123", 0, 2, 2, 12},
+ {"123", 3, 4, 2, 0},
+ {"12345", 3, 4, 2, 4},
+
+ {"123", 0, 5, 2, big},
+ {"123", 0, 5, 3, big},
+ {"123", 0, 5, 4, big},
+ {"123", 0, 5, 5, 12300},
+ {"123", 0, 5, 6, 12300},
+ {"123", 0, 5, 7, 12300},
+
+ // Translation of examples in MatchDigits.
+ // Integer parts
+ {"123", 0, 3, 3, 123}, // 123
+ {"1234", 0, 3, 3, 123}, // 123.4
+ {"1", 0, 6, 8, 100000}, // 100000
+
+ // Fraction parts
+ {"123", 3, 3, 3, 0}, // 123
+ {"1234", 3, 4, 3, 4}, // 123.4
+ {"1234", 3, 5, 3, 40}, // 123.40
+ {"1", 6, 8, 8, 0}, // 100000.00
+ }
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("%s:%d:%d/%d", tc.digits, tc.start, tc.end, tc.nMod), func(t *testing.T) {
+ got := getIntApprox(mkDigits(tc.digits), tc.start, tc.end, tc.nMod, big)
+ if got != tc.want {
+ t.Errorf("got %d; want %d", got, tc.want)
+ }
+ })
+ }
+}
+
+func mkDigits(s string) []byte {
+ b := []byte(s)
+ for i := range b {
+ b[i] -= '0'
+ }
+ return b
+}
+
+func TestValidForms(t *testing.T) {
+ testCases := []struct {
+ tag language.Tag
+ want []Form
+ }{
+ {language.AmericanEnglish, []Form{Other, One}},
+ {language.Portuguese, []Form{Other, One}},
+ {language.Latvian, []Form{Other, Zero, One}},
+ {language.Arabic, []Form{Other, Zero, One, Two, Few, Many}},
+ {language.Russian, []Form{Other, One, Few, Many}},
+ }
+ for _, tc := range testCases {
+ got := validForms(cardinal, tc.tag)
+ if !reflect.DeepEqual(got, tc.want) {
+ t.Errorf("validForms(%v): got %v; want %v", tc.tag, got, tc.want)
+ }
+ }
+}
+
+func TestOrdinal(t *testing.T) {
+ testPlurals(t, Ordinal, ordinalTests)
+}
+
+func TestCardinal(t *testing.T) {
+ testPlurals(t, Cardinal, cardinalTests)
+}
+
+func testPlurals(t *testing.T, p *Rules, testCases []pluralTest) {
+ for _, tc := range testCases {
+ for _, loc := range strings.Split(tc.locales, " ") {
+ tag := language.MustParse(loc)
+ // Test integers
+ for _, s := range tc.integer {
+ a := strings.Split(s, "~")
+ from := parseUint(t, a[0])
+ to := from
+ if len(a) > 1 {
+ to = parseUint(t, a[1])
+ }
+ for n := from; n <= to; n++ {
+ t.Run(fmt.Sprintf("%s/int(%d)", loc, n), func(t *testing.T) {
+ if f := p.matchComponents(tag, n, 0, 0); f != Form(tc.form) {
+ t.Errorf("matchComponents: got %v; want %v", f, Form(tc.form))
+ }
+ digits := []byte(fmt.Sprint(n))
+ for i := range digits {
+ digits[i] -= '0'
+ }
+ if f := p.MatchDigits(tag, digits, 0, 0); f != Form(tc.form) {
+ t.Errorf("MatchDigits: got %v; want %v", f, Form(tc.form))
+ }
+ })
+ }
+ }
+ // Test decimals
+ for _, s := range tc.decimal {
+ a := strings.Split(s, "~")
+ from, scale := parseFixedPoint(t, a[0])
+ to := from
+ if len(a) > 1 {
+ var toScale int
+ if to, toScale = parseFixedPoint(t, a[1]); toScale != scale {
+ t.Fatalf("%s:%s: non-matching scales %d versus %d", loc, s, scale, toScale)
+ }
+ }
+ m := 1
+ for i := 0; i < scale; i++ {
+ m *= 10
+ }
+ for n := from; n <= to; n++ {
+ num := fmt.Sprintf("%[1]d.%0[3]*[2]d", n/m, n%m, scale)
+ name := fmt.Sprintf("%s:dec(%s)", loc, num)
+ t.Run(name, func(t *testing.T) {
+ if f := p.matchComponents(tag, n/m, n%m, scale); f != Form(tc.form) {
+ t.Errorf("matchComponents: got %v; want %v", f, Form(tc.form))
+ }
+ digits := []byte(strings.Replace(num, ".", "", 1))
+ for i := range digits {
+ digits[i] -= '0'
+ }
+ if f := p.MatchDigits(tag, digits, -scale, scale); f != Form(tc.form) {
+ t.Errorf("MatchDigits: got %v; want %v", f, Form(tc.form))
+ }
+ })
+ }
+ }
+ }
+ }
+}
+
+func parseUint(t *testing.T, s string) int {
+ val, err := strconv.ParseUint(s, 10, 32)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return int(val)
+}
+
+func parseFixedPoint(t *testing.T, s string) (val, scale int) {
+ p := strings.Index(s, ".")
+ s = strings.Replace(s, ".", "", 1)
+ v, err := strconv.ParseUint(s, 10, 32)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return int(v), len(s) - p
+}
+
+func BenchmarkPluralSimpleCases(b *testing.B) {
+ p := Cardinal
+ en, _ := language.CompactIndex(language.English)
+ zh, _ := language.CompactIndex(language.Chinese)
+ for i := 0; i < b.N; i++ {
+ matchPlural(p, en, 0, 0, 0) // 0
+ matchPlural(p, en, 1, 0, 0) // 1
+ matchPlural(p, en, 2, 12, 3) // 2.120
+ matchPlural(p, zh, 0, 0, 0) // 0
+ matchPlural(p, zh, 1, 0, 0) // 1
+ matchPlural(p, zh, 2, 12, 3) // 2.120
+ }
+}
+
+func BenchmarkPluralComplexCases(b *testing.B) {
+ p := Cardinal
+ ar, _ := language.CompactIndex(language.Arabic)
+ lv, _ := language.CompactIndex(language.Latvian)
+ for i := 0; i < b.N; i++ {
+ matchPlural(p, lv, 0, 19, 2) // 0.19
+ matchPlural(p, lv, 11, 0, 3) // 11.000
+ matchPlural(p, lv, 100, 123, 4) // 0.1230
+ matchPlural(p, ar, 0, 0, 0) // 0
+ matchPlural(p, ar, 110, 0, 0) // 110
+ matchPlural(p, ar, 99, 99, 2) // 99.99
+ }
+}
diff --git a/vendor/golang.org/x/text/feature/plural/tables.go b/vendor/golang.org/x/text/feature/plural/tables.go
new file mode 100644
index 000000000..c5f491328
--- /dev/null
+++ b/vendor/golang.org/x/text/feature/plural/tables.go
@@ -0,0 +1,541 @@
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+package plural
+
+// CLDRVersion is the CLDR version from which the tables in this package are derived.
+const CLDRVersion = "30"
+
+var ordinalRules = []pluralCheck{ // 58 elements
+ 0: {cat: 0x2f, setID: 0x4},
+ 1: {cat: 0x3a, setID: 0x5},
+ 2: {cat: 0x22, setID: 0x1},
+ 3: {cat: 0x22, setID: 0x6},
+ 4: {cat: 0x22, setID: 0x7},
+ 5: {cat: 0x2f, setID: 0x8},
+ 6: {cat: 0x3c, setID: 0x9},
+ 7: {cat: 0x2f, setID: 0xa},
+ 8: {cat: 0x3c, setID: 0xb},
+ 9: {cat: 0x2d, setID: 0xc},
+ 10: {cat: 0x2d, setID: 0xd},
+ 11: {cat: 0x2f, setID: 0xe},
+ 12: {cat: 0x35, setID: 0x3},
+ 13: {cat: 0xc5, setID: 0xf},
+ 14: {cat: 0x2, setID: 0x1},
+ 15: {cat: 0x5, setID: 0x3},
+ 16: {cat: 0xd, setID: 0x10},
+ 17: {cat: 0x22, setID: 0x1},
+ 18: {cat: 0x2f, setID: 0x11},
+ 19: {cat: 0x3d, setID: 0x12},
+ 20: {cat: 0x2f, setID: 0x13},
+ 21: {cat: 0x3a, setID: 0x14},
+ 22: {cat: 0x2f, setID: 0x15},
+ 23: {cat: 0x3b, setID: 0x16},
+ 24: {cat: 0x2f, setID: 0xa},
+ 25: {cat: 0x3c, setID: 0xb},
+ 26: {cat: 0x22, setID: 0x1},
+ 27: {cat: 0x23, setID: 0x17},
+ 28: {cat: 0x24, setID: 0x18},
+ 29: {cat: 0x22, setID: 0x19},
+ 30: {cat: 0x23, setID: 0x2},
+ 31: {cat: 0x24, setID: 0x18},
+ 32: {cat: 0xf, setID: 0x13},
+ 33: {cat: 0x1a, setID: 0x14},
+ 34: {cat: 0xf, setID: 0x15},
+ 35: {cat: 0x1b, setID: 0x16},
+ 36: {cat: 0xf, setID: 0x1a},
+ 37: {cat: 0x1d, setID: 0x1b},
+ 38: {cat: 0xa, setID: 0x1c},
+ 39: {cat: 0xa, setID: 0x1d},
+ 40: {cat: 0xc, setID: 0x1e},
+ 41: {cat: 0xe4, setID: 0x0},
+ 42: {cat: 0x5, setID: 0x3},
+ 43: {cat: 0xd, setID: 0xc},
+ 44: {cat: 0xd, setID: 0x1f},
+ 45: {cat: 0x22, setID: 0x1},
+ 46: {cat: 0x23, setID: 0x17},
+ 47: {cat: 0x24, setID: 0x18},
+ 48: {cat: 0x25, setID: 0x20},
+ 49: {cat: 0x22, setID: 0x21},
+ 50: {cat: 0x23, setID: 0x17},
+ 51: {cat: 0x24, setID: 0x18},
+ 52: {cat: 0x25, setID: 0x20},
+ 53: {cat: 0x21, setID: 0x22},
+ 54: {cat: 0x22, setID: 0x1},
+ 55: {cat: 0x23, setID: 0x2},
+ 56: {cat: 0x24, setID: 0x23},
+ 57: {cat: 0x25, setID: 0x24},
+} // Size: 140 bytes
+
+var ordinalIndex = []uint8{ // 20 elements
+ 0x00, 0x00, 0x02, 0x03, 0x04, 0x05, 0x07, 0x09,
+ 0x0d, 0x0e, 0x11, 0x14, 0x1a, 0x1d, 0x20, 0x26,
+ 0x2d, 0x31, 0x35, 0x3a,
+} // Size: 44 bytes
+
+var ordinalLangToIndex = []uint8{ // 752 elements
+ // Entry 0 - 3F
+ 0x00, 0x0d, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00,
+ 0x0f, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x05,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 40 - 7F
+ 0x00, 0x00, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x12, 0x12, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 80 - BF
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ // Entry C0 - FF
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 100 - 13F
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00,
+ 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ // Entry 140 - 17F
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x02, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 180 - 1BF
+ 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 1C0 - 1FF
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00,
+ 0x00, 0x00, 0x0c, 0x0c, 0x02, 0x02, 0x02, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 200 - 23F
+ 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 240 - 27F
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a,
+ // Entry 280 - 2BF
+ 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
+ // Entry 2C0 - 2FF
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+} // Size: 776 bytes
+
+var ordinalInclusionMasks = []uint64{ // 100 elements
+ // Entry 0 - 1F
+ 0x0000000400004009, 0x00000002120800d3, 0x0000000010a10195, 0x0000000842810581,
+ 0x0000000841030081, 0x0000001210010041, 0x0000001100011001, 0x0000000614010001,
+ 0x0000000614018001, 0x0000000600012001, 0x0000000200014001, 0x0000000010198031,
+ 0x0000000010610331, 0x0000000040010f01, 0x0000000040070001, 0x0000000010010001,
+ 0x0000000000011001, 0x000000001c010001, 0x000000001c010001, 0x0000000000012001,
+ 0x0000000020014001, 0x0000000010080011, 0x0000000010200111, 0x0000000040000501,
+ 0x0000000040020001, 0x0000000010000001, 0x0000000000001001, 0x0000000014000001,
+ 0x0000000014000001, 0x0000000000002001, 0x0000000000004001, 0x0000000010080011,
+ // Entry 20 - 3F
+ 0x0000000010200111, 0x0000000040000501, 0x0000000040020001, 0x0000000010000001,
+ 0x0000000000001001, 0x0000000014000001, 0x0000000014000001, 0x0000000000002001,
+ 0x0000000080014001, 0x0000000010080011, 0x0000000010200111, 0x0000000040000501,
+ 0x0000000040020001, 0x0000000010000001, 0x0000000000001001, 0x0000000014000001,
+ 0x0000000014000001, 0x0000000000002001, 0x0000000020004001, 0x0000000010080011,
+ 0x0000000010200111, 0x0000000040000501, 0x0000000040020001, 0x0000000010000001,
+ 0x0000000000001001, 0x0000000014000001, 0x0000000014000001, 0x0000000000002001,
+ 0x0000000080014001, 0x0000000010080011, 0x0000000010200111, 0x0000000040000501,
+ // Entry 40 - 5F
+ 0x0000000040020001, 0x0000000010000001, 0x0000000000001001, 0x0000000014000001,
+ 0x0000000014000001, 0x0000000000002001, 0x0000000020004001, 0x0000000010080011,
+ 0x0000000010200111, 0x0000000040000501, 0x0000000040020001, 0x0000000010000001,
+ 0x0000000000001001, 0x0000000014000001, 0x0000000014000001, 0x0000000000002001,
+ 0x000000002001c001, 0x0000000010080011, 0x0000000010200111, 0x0000000040000501,
+ 0x0000000040020001, 0x0000000010000001, 0x0000000000001001, 0x0000000014000001,
+ 0x0000000014000001, 0x0000000000002001, 0x0000000080004001, 0x0000000010080011,
+ 0x0000000010200111, 0x0000000040000501, 0x0000000040020001, 0x0000000010000001,
+ // Entry 60 - 7F
+ 0x0000000000001001, 0x0000000014000001, 0x0000000014000001, 0x0000000000002001,
+} // Size: 824 bytes
+
+// Slots used for ordinal: 3A of 0xFF rules; 14 of 0xFF indexes; 37 of 64 sets
+
+var cardinalRules = []pluralCheck{ // 169 elements
+ 0: {cat: 0x2, setID: 0x3},
+ 1: {cat: 0x22, setID: 0x1},
+ 2: {cat: 0x2, setID: 0x4},
+ 3: {cat: 0x7, setID: 0x1},
+ 4: {cat: 0x62, setID: 0x3},
+ 5: {cat: 0x22, setID: 0x4},
+ 6: {cat: 0x7, setID: 0x3},
+ 7: {cat: 0x42, setID: 0x1},
+ 8: {cat: 0x22, setID: 0x4},
+ 9: {cat: 0x22, setID: 0x4},
+ 10: {cat: 0x22, setID: 0x5},
+ 11: {cat: 0x27, setID: 0x6},
+ 12: {cat: 0x32, setID: 0x2},
+ 13: {cat: 0x22, setID: 0x1},
+ 14: {cat: 0x27, setID: 0x1},
+ 15: {cat: 0x62, setID: 0x3},
+ 16: {cat: 0x22, setID: 0x1},
+ 17: {cat: 0x7, setID: 0x4},
+ 18: {cat: 0x92, setID: 0x3},
+ 19: {cat: 0xf, setID: 0x7},
+ 20: {cat: 0x1f, setID: 0x8},
+ 21: {cat: 0x82, setID: 0x3},
+ 22: {cat: 0x92, setID: 0x3},
+ 23: {cat: 0xf, setID: 0x7},
+ 24: {cat: 0x62, setID: 0x3},
+ 25: {cat: 0x4a, setID: 0x7},
+ 26: {cat: 0x7, setID: 0x9},
+ 27: {cat: 0x62, setID: 0x3},
+ 28: {cat: 0x1f, setID: 0xa},
+ 29: {cat: 0x62, setID: 0x3},
+ 30: {cat: 0x5f, setID: 0xa},
+ 31: {cat: 0x72, setID: 0x3},
+ 32: {cat: 0x29, setID: 0xb},
+ 33: {cat: 0x29, setID: 0xc},
+ 34: {cat: 0x4f, setID: 0xc},
+ 35: {cat: 0x61, setID: 0x2},
+ 36: {cat: 0x2f, setID: 0x7},
+ 37: {cat: 0x3a, setID: 0x8},
+ 38: {cat: 0x4f, setID: 0x7},
+ 39: {cat: 0x5f, setID: 0x8},
+ 40: {cat: 0x62, setID: 0x2},
+ 41: {cat: 0x4f, setID: 0x7},
+ 42: {cat: 0x72, setID: 0x2},
+ 43: {cat: 0x21, setID: 0x3},
+ 44: {cat: 0x7, setID: 0x4},
+ 45: {cat: 0x32, setID: 0x3},
+ 46: {cat: 0x21, setID: 0x3},
+ 47: {cat: 0x22, setID: 0x1},
+ 48: {cat: 0x22, setID: 0x1},
+ 49: {cat: 0x23, setID: 0x2},
+ 50: {cat: 0x2, setID: 0x3},
+ 51: {cat: 0x22, setID: 0x1},
+ 52: {cat: 0x24, setID: 0xd},
+ 53: {cat: 0x7, setID: 0x1},
+ 54: {cat: 0x62, setID: 0x3},
+ 55: {cat: 0x74, setID: 0x3},
+ 56: {cat: 0x24, setID: 0x3},
+ 57: {cat: 0x2f, setID: 0xe},
+ 58: {cat: 0x34, setID: 0x1},
+ 59: {cat: 0xf, setID: 0x7},
+ 60: {cat: 0x1f, setID: 0x8},
+ 61: {cat: 0x62, setID: 0x3},
+ 62: {cat: 0x4f, setID: 0x7},
+ 63: {cat: 0x5a, setID: 0x8},
+ 64: {cat: 0xf, setID: 0xf},
+ 65: {cat: 0x1f, setID: 0x10},
+ 66: {cat: 0x64, setID: 0x3},
+ 67: {cat: 0x4f, setID: 0xf},
+ 68: {cat: 0x5c, setID: 0x10},
+ 69: {cat: 0x22, setID: 0x11},
+ 70: {cat: 0x23, setID: 0x12},
+ 71: {cat: 0x24, setID: 0x13},
+ 72: {cat: 0xf, setID: 0x1},
+ 73: {cat: 0x62, setID: 0x3},
+ 74: {cat: 0xf, setID: 0x2},
+ 75: {cat: 0x63, setID: 0x3},
+ 76: {cat: 0xf, setID: 0x14},
+ 77: {cat: 0x64, setID: 0x3},
+ 78: {cat: 0x74, setID: 0x3},
+ 79: {cat: 0xf, setID: 0x1},
+ 80: {cat: 0x62, setID: 0x3},
+ 81: {cat: 0x4a, setID: 0x1},
+ 82: {cat: 0xf, setID: 0x2},
+ 83: {cat: 0x63, setID: 0x3},
+ 84: {cat: 0x4b, setID: 0x2},
+ 85: {cat: 0xf, setID: 0x14},
+ 86: {cat: 0x64, setID: 0x3},
+ 87: {cat: 0x4c, setID: 0x14},
+ 88: {cat: 0x7, setID: 0x1},
+ 89: {cat: 0x62, setID: 0x3},
+ 90: {cat: 0x7, setID: 0x2},
+ 91: {cat: 0x63, setID: 0x3},
+ 92: {cat: 0x2f, setID: 0xb},
+ 93: {cat: 0x37, setID: 0x15},
+ 94: {cat: 0x65, setID: 0x3},
+ 95: {cat: 0x7, setID: 0x1},
+ 96: {cat: 0x62, setID: 0x3},
+ 97: {cat: 0x7, setID: 0x16},
+ 98: {cat: 0x64, setID: 0x3},
+ 99: {cat: 0x75, setID: 0x3},
+ 100: {cat: 0x7, setID: 0x1},
+ 101: {cat: 0x62, setID: 0x3},
+ 102: {cat: 0xf, setID: 0xf},
+ 103: {cat: 0x1f, setID: 0x10},
+ 104: {cat: 0x64, setID: 0x3},
+ 105: {cat: 0xf, setID: 0x17},
+ 106: {cat: 0x17, setID: 0x1},
+ 107: {cat: 0x65, setID: 0x3},
+ 108: {cat: 0xf, setID: 0x18},
+ 109: {cat: 0x65, setID: 0x3},
+ 110: {cat: 0xf, setID: 0x10},
+ 111: {cat: 0x65, setID: 0x3},
+ 112: {cat: 0x2f, setID: 0x7},
+ 113: {cat: 0x3a, setID: 0x8},
+ 114: {cat: 0x2f, setID: 0xf},
+ 115: {cat: 0x3c, setID: 0x10},
+ 116: {cat: 0x2d, setID: 0xb},
+ 117: {cat: 0x2d, setID: 0x18},
+ 118: {cat: 0x2d, setID: 0x19},
+ 119: {cat: 0x2f, setID: 0x7},
+ 120: {cat: 0x3a, setID: 0xc},
+ 121: {cat: 0x2f, setID: 0x1a},
+ 122: {cat: 0x3c, setID: 0xc},
+ 123: {cat: 0x55, setID: 0x3},
+ 124: {cat: 0x22, setID: 0x1},
+ 125: {cat: 0x24, setID: 0x3},
+ 126: {cat: 0x2c, setID: 0xd},
+ 127: {cat: 0x2d, setID: 0xc},
+ 128: {cat: 0xf, setID: 0x7},
+ 129: {cat: 0x1f, setID: 0x8},
+ 130: {cat: 0x62, setID: 0x3},
+ 131: {cat: 0xf, setID: 0xf},
+ 132: {cat: 0x1f, setID: 0x10},
+ 133: {cat: 0x64, setID: 0x3},
+ 134: {cat: 0xf, setID: 0xb},
+ 135: {cat: 0x65, setID: 0x3},
+ 136: {cat: 0xf, setID: 0x18},
+ 137: {cat: 0x65, setID: 0x3},
+ 138: {cat: 0xf, setID: 0x19},
+ 139: {cat: 0x65, setID: 0x3},
+ 140: {cat: 0x2f, setID: 0x7},
+ 141: {cat: 0x3a, setID: 0x1b},
+ 142: {cat: 0x2f, setID: 0x1c},
+ 143: {cat: 0x3b, setID: 0x1d},
+ 144: {cat: 0x2f, setID: 0x1e},
+ 145: {cat: 0x3c, setID: 0x1f},
+ 146: {cat: 0x37, setID: 0x3},
+ 147: {cat: 0xa5, setID: 0x0},
+ 148: {cat: 0x22, setID: 0x1},
+ 149: {cat: 0x23, setID: 0x2},
+ 150: {cat: 0x24, setID: 0x20},
+ 151: {cat: 0x25, setID: 0x21},
+ 152: {cat: 0xf, setID: 0x7},
+ 153: {cat: 0x62, setID: 0x3},
+ 154: {cat: 0xf, setID: 0x1c},
+ 155: {cat: 0x63, setID: 0x3},
+ 156: {cat: 0xf, setID: 0x22},
+ 157: {cat: 0x64, setID: 0x3},
+ 158: {cat: 0x75, setID: 0x3},
+ 159: {cat: 0x21, setID: 0x3},
+ 160: {cat: 0x22, setID: 0x1},
+ 161: {cat: 0x23, setID: 0x2},
+ 162: {cat: 0x2c, setID: 0x23},
+ 163: {cat: 0x2d, setID: 0x5},
+ 164: {cat: 0x21, setID: 0x3},
+ 165: {cat: 0x22, setID: 0x1},
+ 166: {cat: 0x23, setID: 0x2},
+ 167: {cat: 0x24, setID: 0x24},
+ 168: {cat: 0x25, setID: 0x25},
+} // Size: 362 bytes
+
+var cardinalIndex = []uint8{ // 37 elements
+ 0x00, 0x00, 0x02, 0x03, 0x05, 0x08, 0x09, 0x0b,
+ 0x0d, 0x0e, 0x10, 0x13, 0x17, 0x1a, 0x20, 0x2b,
+ 0x2e, 0x30, 0x32, 0x35, 0x3b, 0x45, 0x48, 0x4f,
+ 0x58, 0x5f, 0x64, 0x70, 0x77, 0x7c, 0x80, 0x8c,
+ 0x94, 0x98, 0x9f, 0xa4, 0xa9,
+} // Size: 61 bytes
+
+var cardinalLangToIndex = []uint8{ // 752 elements
+ // Entry 0 - 3F
+ 0x00, 0x03, 0x03, 0x08, 0x08, 0x08, 0x00, 0x00,
+ 0x05, 0x05, 0x01, 0x01, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x01, 0x01, 0x08, 0x08, 0x03, 0x03,
+ 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x1b,
+ 0x1b, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x05,
+ // Entry 40 - 7F
+ 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
+ 0x1f, 0x1f, 0x08, 0x08, 0x14, 0x00, 0x00, 0x14,
+ 0x14, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x19,
+ 0x19, 0x00, 0x00, 0x23, 0x23, 0x0a, 0x0a, 0x0a,
+ 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x00, 0x00, 0x17, 0x17, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
+ // Entry 80 - BF
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ // Entry C0 - FF
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ // Entry 100 - 13F
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x08, 0x08,
+ 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x03, 0x03, 0x0d, 0x0d, 0x08, 0x08,
+ 0x08, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ // Entry 140 - 17F
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x08, 0x08, 0x03, 0x03, 0x20, 0x20, 0x15, 0x15,
+ 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x01, 0x01,
+ 0x05, 0x00, 0x00, 0x21, 0x21, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x18, 0x18, 0x01, 0x01, 0x14,
+ 0x14, 0x14, 0x17, 0x17, 0x08, 0x08, 0x02, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x0b,
+ // Entry 180 - 1BF
+ 0x03, 0x03, 0x03, 0x03, 0x11, 0x00, 0x00, 0x00,
+ 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x02,
+ 0x02, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08,
+ 0x08, 0x08, 0x00, 0x00, 0x10, 0x10, 0x08, 0x11,
+ 0x11, 0x08, 0x08, 0x0f, 0x0f, 0x08, 0x08, 0x08,
+ // Entry 1C0 - 1FF
+ 0x08, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0e, 0x08,
+ 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05,
+ 0x00, 0x00, 0x08, 0x08, 0x0c, 0x0c, 0x08, 0x08,
+ 0x08, 0x08, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x1d, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x11, 0x11, 0x08, 0x08, 0x08, 0x08, 0x08,
+ // Entry 200 - 23F
+ 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x05,
+ 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x05, 0x00, 0x00,
+ 0x05, 0x05, 0x08, 0x1a, 0x1a, 0x0e, 0x0e, 0x08,
+ 0x08, 0x07, 0x09, 0x07, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, 0x00,
+ // Entry 240 - 27F
+ 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x13, 0x13,
+ 0x13, 0x08, 0x08, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00,
+ 0x08, 0x08, 0x00, 0x00, 0x08, 0x11, 0x11, 0x11,
+ 0x11, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x12,
+ 0x00, 0x00, 0x12, 0x12, 0x04, 0x04, 0x19, 0x19,
+ 0x16, 0x16, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ // Entry 280 - 2BF
+ 0x08, 0x08, 0x08, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x08, 0x08,
+ 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x05,
+ 0x05, 0x05, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
+ 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x06, 0x06,
+ 0x08, 0x08, 0x1e, 0x1e, 0x03, 0x03, 0x03, 0x08,
+ // Entry 2C0 - 2FF
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x08,
+ 0x08, 0x08, 0x05, 0x08, 0x08, 0x00, 0x08, 0x08,
+ 0x08, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+} // Size: 776 bytes
+
+var cardinalInclusionMasks = []uint64{ // 100 elements
+ // Entry 0 - 1F
+ 0x0000000400a00859, 0x0000000000a242d3, 0x000000001464e245, 0x000000194478e201,
+ 0x000000094478e401, 0x0000000905286001, 0x0000002905286401, 0x0000000a05286001,
+ 0x0000000a05286001, 0x0000000a45286401, 0x0000000a80a86801, 0x000000008a8251a1,
+ 0x00000000b605d021, 0x00000000c609d021, 0x00000000c609d421, 0x0000000085085021,
+ 0x0000000085085421, 0x0000000085085021, 0x0000000085085021, 0x00000000c5085421,
+ 0x0000000400800821, 0x00000000008000a1, 0x0000000014008021, 0x0000000044008021,
+ 0x0000000044008421, 0x0000000005000021, 0x0000000005000421, 0x0000000005000021,
+ 0x0000000005000021, 0x0000000045000421, 0x0000000000800821, 0x00000000008000a1,
+ // Entry 20 - 3F
+ 0x0000000014008021, 0x0000000044008021, 0x0000000044008421, 0x0000000005000021,
+ 0x0000000005000421, 0x0000000005000021, 0x0000000005000021, 0x0000000045000421,
+ 0x0000000400800821, 0x00000000008000a1, 0x0000000014008021, 0x0000000044008021,
+ 0x0000000044008421, 0x0000000005000021, 0x0000000005000421, 0x0000000005000021,
+ 0x0000000005000021, 0x0000000045000421, 0x0000000000800821, 0x00000000008000a1,
+ 0x0000000014008021, 0x0000000044008021, 0x0000000044008421, 0x0000000005000021,
+ 0x0000000005000421, 0x0000000005000021, 0x0000000005000021, 0x0000000045000421,
+ 0x0000000400800821, 0x00000000008000a1, 0x0000000014008021, 0x0000000044008021,
+ // Entry 40 - 5F
+ 0x0000000044008421, 0x0000000005000021, 0x0000000005000421, 0x0000000005000021,
+ 0x0000000005000021, 0x0000000045000421, 0x0000000080800821, 0x00000000888000a1,
+ 0x00000000b4008021, 0x00000000c4008021, 0x00000000c4008421, 0x0000000085000021,
+ 0x0000000085000421, 0x0000000085000021, 0x0000000085000021, 0x00000000c5000421,
+ 0x0000000400800821, 0x00000000008000a1, 0x0000000014008021, 0x0000000044008021,
+ 0x0000000044008421, 0x0000000005000021, 0x0000000005000421, 0x0000000005000021,
+ 0x0000000005000021, 0x0000000045000421, 0x0000000080800821, 0x00000000888000a1,
+ 0x00000000b4008021, 0x00000000c4008021, 0x00000000c4008421, 0x0000000085000021,
+ // Entry 60 - 7F
+ 0x0000000085000421, 0x0000000085000021, 0x0000000085000021, 0x00000000c5000421,
+} // Size: 824 bytes
+
+// Slots used for cardinal: A9 of 0xFF rules; 25 of 0xFF indexes; 38 of 64 sets
+
+// Total table size 3807 bytes (3KiB); checksum: A9B90899
diff --git a/vendor/golang.org/x/text/gen.go b/vendor/golang.org/x/text/gen.go
index a694fddaa..79af97e70 100644
--- a/vendor/golang.org/x/text/gen.go
+++ b/vendor/golang.org/x/text/gen.go
@@ -110,6 +110,7 @@ func main() {
_ = generate("./secure/precis", unicode, norm, rangetable, cases, width, bidi)
_ = generate("./currency", unicode, cldr, language, internal)
_ = generate("./internal/number", unicode, cldr, language, internal)
+ _ = generate("./feature/plural", unicode, cldr, language, internal)
_ = generate("./internal/export/idna", unicode, bidi, norm)
_ = generate("./language/display", unicode, cldr, language, internal)
_ = generate("./collate", unicode, norm, cldr, language, rangetable)
diff --git a/vendor/golang.org/x/text/internal/catmsg/varint.go b/vendor/golang.org/x/text/internal/catmsg/varint.go
new file mode 100644
index 000000000..a2cee2cf5
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/catmsg/varint.go
@@ -0,0 +1,62 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package catmsg
+
+// This file implements varint encoding analogous to the one in encoding/binary.
+// We need a string version of this function, so we add that here and then add
+// the rest for consistency.
+
+import "errors"
+
+var (
+ errIllegalVarint = errors.New("catmsg: illegal varint")
+ errVarintTooLarge = errors.New("catmsg: varint too large for uint64")
+)
+
+const maxVarintBytes = 10 // maximum length of a varint
+
+// encodeUint encodes x as a variable-sized integer into buf and returns the
+// number of bytes written. buf must be at least maxVarintBytes long
+func encodeUint(buf []byte, x uint64) (n int) {
+ for ; x > 127; n++ {
+ buf[n] = 0x80 | uint8(x&0x7F)
+ x >>= 7
+ }
+ buf[n] = uint8(x)
+ n++
+ return n
+}
+
+func decodeUintString(s string) (x uint64, size int, err error) {
+ i := 0
+ for shift := uint(0); shift < 64; shift += 7 {
+ if i >= len(s) {
+ return 0, i, errIllegalVarint
+ }
+ b := uint64(s[i])
+ i++
+ x |= (b & 0x7F) << shift
+ if b&0x80 == 0 {
+ return x, i, nil
+ }
+ }
+ return 0, i, errVarintTooLarge
+}
+
+func decodeUint(b []byte) (x uint64, size int, err error) {
+ i := 0
+ for shift := uint(0); shift < 64; shift += 7 {
+ if i >= len(b) {
+ return 0, i, errIllegalVarint
+ }
+ c := uint64(b[i])
+ i++
+ x |= (c & 0x7F) << shift
+ if c&0x80 == 0 {
+ return x, i, nil
+ }
+ }
+ return 0, i, errVarintTooLarge
+}
diff --git a/vendor/golang.org/x/text/internal/catmsg/varint_test.go b/vendor/golang.org/x/text/internal/catmsg/varint_test.go
new file mode 100644
index 000000000..a079c775d
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/catmsg/varint_test.go
@@ -0,0 +1,123 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package catmsg
+
+import (
+ "fmt"
+ "testing"
+)
+
+func TestEncodeUint(t *testing.T) {
+ testCases := []struct {
+ x uint64
+ enc string
+ }{
+ {0, "\x00"},
+ {1, "\x01"},
+ {2, "\x02"},
+ {0x7f, "\x7f"},
+ {0x80, "\x80\x01"},
+ {1 << 14, "\x80\x80\x01"},
+ {0xffffffff, "\xff\xff\xff\xff\x0f"},
+ {0xffffffffffffffff, "\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01"},
+ }
+ for _, tc := range testCases {
+ buf := [maxVarintBytes]byte{}
+ got := string(buf[:encodeUint(buf[:], tc.x)])
+ if got != tc.enc {
+ t.Errorf("EncodeUint(%#x) = %q; want %q", tc.x, got, tc.enc)
+ }
+ }
+}
+
+func TestDecodeUint(t *testing.T) {
+ testCases := []struct {
+ x uint64
+ size int
+ enc string
+ err error
+ }{{
+ x: 0,
+ size: 0,
+ enc: "",
+ err: errIllegalVarint,
+ }, {
+ x: 0,
+ size: 1,
+ enc: "\x80",
+ err: errIllegalVarint,
+ }, {
+ x: 0,
+ size: 3,
+ enc: "\x80\x80\x80",
+ err: errIllegalVarint,
+ }, {
+ x: 0,
+ size: 1,
+ enc: "\x00",
+ }, {
+ x: 1,
+ size: 1,
+ enc: "\x01",
+ }, {
+ x: 2,
+ size: 1,
+ enc: "\x02",
+ }, {
+ x: 0x7f,
+ size: 1,
+ enc: "\x7f",
+ }, {
+ x: 0x80,
+ size: 2,
+ enc: "\x80\x01",
+ }, {
+ x: 1 << 14,
+ size: 3,
+ enc: "\x80\x80\x01",
+ }, {
+ x: 0xffffffff,
+ size: 5,
+ enc: "\xff\xff\xff\xff\x0f",
+ }, {
+ x: 0xffffffffffffffff,
+ size: 10,
+ enc: "\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01",
+ }, {
+ x: 0xffffffffffffffff,
+ size: 10,
+ enc: "\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x00",
+ }, {
+ x: 0,
+ size: 10,
+ enc: "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01",
+ err: errVarintTooLarge,
+ }}
+ forms := []struct {
+ name string
+ decode func(s string) (x uint64, size int, err error)
+ }{
+ {"decode", func(s string) (x uint64, size int, err error) {
+ return decodeUint([]byte(s))
+ }},
+ {"decodeString", decodeUintString},
+ }
+ for _, f := range forms {
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("%s:%q", f.name, tc.enc), func(t *testing.T) {
+ x, size, err := f.decode(tc.enc)
+ if err != tc.err {
+ t.Error("err = %q; want %q", err, tc.err)
+ }
+ if size != tc.size {
+ t.Errorf("size = %d; want %d", size, tc.size)
+ }
+ if x != tc.x {
+ t.Errorf("decode = %#x; want %#x", x, tc.x)
+ }
+ })
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/export/idna/example_test.go b/vendor/golang.org/x/text/internal/export/idna/example_test.go
index 6e31be97e..6e6b8727c 100644
--- a/vendor/golang.org/x/text/internal/export/idna/example_test.go
+++ b/vendor/golang.org/x/text/internal/export/idna/example_test.go
@@ -49,6 +49,10 @@ func ExampleNew() {
idna.Transitional(true)) // Map ß -> ss
fmt.Println(p.ToASCII("*.faß.com"))
+ // Lookup for registration. Also does not allow '*'.
+ p = idna.New(idna.ValidateForRegistration())
+ fmt.Println(p.ToUnicode("*.faß.com"))
+
// Set up a profile maps for lookup, but allows wild cards.
p = idna.New(
idna.MapForLookup(),
@@ -58,6 +62,7 @@ func ExampleNew() {
// Output:
// *.xn--fa-hia.com <nil>
- // *.fass.com idna: disallowed rune U+002E
+ // *.fass.com idna: disallowed rune U+002A
+ // *.faß.com idna: disallowed rune U+002A
// *.fass.com <nil>
}
diff --git a/vendor/golang.org/x/text/internal/export/idna/idna.go b/vendor/golang.org/x/text/internal/export/idna/idna.go
index a3d9ad29d..3184fbbd9 100644
--- a/vendor/golang.org/x/text/internal/export/idna/idna.go
+++ b/vendor/golang.org/x/text/internal/export/idna/idna.go
@@ -373,23 +373,20 @@ func validateRegistration(p *Profile, s string) (string, error) {
if !norm.NFC.IsNormalString(s) {
return s, &labelError{s, "V1"}
}
- var err error
for i := 0; i < len(s); {
v, sz := trie.lookupString(s[i:])
- i += sz
// Copy bytes not copied so far.
switch p.simplify(info(v).category()) {
// TODO: handle the NV8 defined in the Unicode idna data set to allow
// for strict conformance to IDNA2008.
case valid, deviation:
case disallowed, mapped, unknown, ignored:
- if err == nil {
- r, _ := utf8.DecodeRuneInString(s[i:])
- err = runeError(r)
- }
+ r, _ := utf8.DecodeRuneInString(s[i:])
+ return s, runeError(r)
}
+ i += sz
}
- return s, err
+ return s, nil
}
func validateAndMap(p *Profile, s string) (string, error) {
@@ -408,7 +405,7 @@ func validateAndMap(p *Profile, s string) (string, error) {
continue
case disallowed:
if err == nil {
- r, _ := utf8.DecodeRuneInString(s[i:])
+ r, _ := utf8.DecodeRuneInString(s[start:])
err = runeError(r)
}
continue
diff --git a/vendor/golang.org/x/text/internal/format/plural/plural.go b/vendor/golang.org/x/text/internal/format/plural/plural.go
deleted file mode 100644
index 524d6aaff..000000000
--- a/vendor/golang.org/x/text/internal/format/plural/plural.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package plural defines the grammatical plural feature.
-//
-// The definitions in this package are based on the plural rule handling defined
-// in CLDR. See
-// http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules for
-// details.
-package plural
-
-import "golang.org/x/text/internal/format"
-
-// Form defines a plural form. The meaning of plural forms, as well as which
-// forms are supported, vary per language. Each language must at least support
-// the form "other".
-type Form byte
-
-const (
- Other Form = iota
- Zero
- One
- Two
- Few
- Many
-)
-
-// Interface is implemented by values that have a plural feature.
-type Interface interface {
- // PluralForm reports the plural form of a value, depending on the
- // language declared by the given state.
- PluralForm(s format.State) Form
-}
-
-// TODO
-// - Select function
-// - Definition for message package.
diff --git a/vendor/golang.org/x/text/internal/number/common.go b/vendor/golang.org/x/text/internal/number/common.go
index a29abe493..e428a728d 100644
--- a/vendor/golang.org/x/text/internal/number/common.go
+++ b/vendor/golang.org/x/text/internal/number/common.go
@@ -1,12 +1,8 @@
-// This file was generated by go generate; DO NOT EDIT
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
package number
-import (
- "unicode/utf8"
-
- "golang.org/x/text/internal/format/plural"
-)
+import "unicode/utf8"
// A system identifies a CLDR numbering system.
type system byte
@@ -42,51 +38,3 @@ type altSymData struct {
system system
symIndex byte
}
-
-var countMap = map[string]plural.Form{
- "other": plural.Other,
- "zero": plural.Zero,
- "one": plural.One,
- "two": plural.Two,
- "few": plural.Few,
- "many": plural.Many,
-}
-
-type pluralCheck struct {
- // category:
- // 3..7: opID
- // 0..2: category
- cat byte
- setID byte
-}
-
-// opID identifies the type of operand in the plural rule, being i, n or f.
-// (v, w, and t are treated as filters in our implementation.)
-type opID byte
-
-const (
- opMod opID = 0x1 // is '%' used?
- opNotEqual opID = 0x2 // using "!=" to compare
- opI opID = 0 << 2 // integers after taking the absolute value
- opN opID = 1 << 2 // full number (must be integer)
- opF opID = 2 << 2 // fraction
- opV opID = 3 << 2 // number of visible digits
- opW opID = 4 << 2 // number of visible digits without trailing zeros
- opBretonM opID = 5 << 2 // hard-wired rule for Breton
- opItalian800 opID = 6 << 2 // hard-wired rule for Italian
- opAzerbaijan00s opID = 7 << 2 // hard-wired rule for Azerbaijan
-)
-const (
- // Use this plural form to indicate the next rule needs to match as well.
- // The last condition in the list will have the correct plural form.
- andNext = 0x7
- formMask = 0x7
-
- opShift = 3
-
- // numN indicates the maximum integer, or maximum mod value, for which we
- // have inclusion masks.
- numN = 100
- // The common denominator of the modulo that is taken.
- maxMod = 100
-)
diff --git a/vendor/golang.org/x/text/internal/number/data_test.go b/vendor/golang.org/x/text/internal/number/data_test.go
deleted file mode 100644
index 350be5954..000000000
--- a/vendor/golang.org/x/text/internal/number/data_test.go
+++ /dev/null
@@ -1,194 +0,0 @@
-// This file was generated by go generate; DO NOT EDIT
-
-package number
-
-import "golang.org/x/text/internal/format/plural"
-
-type pluralTest struct {
- locales string
- form plural.Form
- integer []string
- decimal []string
-}
-
-var ordinalTests = []pluralTest{ // 59 elements
- 0: {locales: "af am ar bg bs ce cs da de dsb el es et eu fa fi fy gl he hr hsb id in is iw ja km kn ko ky lt lv ml mn my nb nl pa pl prg pt root ru sh si sk sl sr sw ta te th tr ur uz yue zh zu", form: 0x0, integer: []string{"0~15", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 1: {locales: "sv", form: 0x2, integer: []string{"1", "2", "21", "22", "31", "32", "41", "42", "51", "52", "61", "62", "71", "72", "81", "82", "101", "1001"}, decimal: []string(nil)},
- 2: {locales: "sv", form: 0x0, integer: []string{"0", "3~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 3: {locales: "fil fr ga hy lo mo ms ro tl vi", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 4: {locales: "fil fr ga hy lo mo ms ro tl vi", form: 0x0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 5: {locales: "hu", form: 0x2, integer: []string{"1", "5"}, decimal: []string(nil)},
- 6: {locales: "hu", form: 0x0, integer: []string{"0", "2~4", "6~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 7: {locales: "ne", form: 0x2, integer: []string{"1~4"}, decimal: []string(nil)},
- 8: {locales: "ne", form: 0x0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 9: {locales: "be", form: 0x4, integer: []string{"2", "3", "22", "23", "32", "33", "42", "43", "52", "53", "62", "63", "72", "73", "82", "83", "102", "1002"}, decimal: []string(nil)},
- 10: {locales: "be", form: 0x0, integer: []string{"0", "1", "4~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 11: {locales: "uk", form: 0x4, integer: []string{"3", "23", "33", "43", "53", "63", "73", "83", "103", "1003"}, decimal: []string(nil)},
- 12: {locales: "uk", form: 0x0, integer: []string{"0~2", "4~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 13: {locales: "kk", form: 0x5, integer: []string{"6", "9", "10", "16", "19", "20", "26", "29", "30", "36", "39", "40", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 14: {locales: "kk", form: 0x0, integer: []string{"0~5", "7", "8", "11~15", "17", "18", "21", "101", "1001"}, decimal: []string(nil)},
- 15: {locales: "it", form: 0x5, integer: []string{"8", "11", "80", "800"}, decimal: []string(nil)},
- 16: {locales: "it", form: 0x0, integer: []string{"0~7", "9", "10", "12~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 17: {locales: "ka", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 18: {locales: "ka", form: 0x5, integer: []string{"0", "2~16", "102", "1002"}, decimal: []string(nil)},
- 19: {locales: "ka", form: 0x0, integer: []string{"21~36", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 20: {locales: "sq", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 21: {locales: "sq", form: 0x5, integer: []string{"4", "24", "34", "44", "54", "64", "74", "84", "104", "1004"}, decimal: []string(nil)},
- 22: {locales: "sq", form: 0x0, integer: []string{"0", "2", "3", "5~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 23: {locales: "en", form: 0x2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string(nil)},
- 24: {locales: "en", form: 0x3, integer: []string{"2", "22", "32", "42", "52", "62", "72", "82", "102", "1002"}, decimal: []string(nil)},
- 25: {locales: "en", form: 0x4, integer: []string{"3", "23", "33", "43", "53", "63", "73", "83", "103", "1003"}, decimal: []string(nil)},
- 26: {locales: "en", form: 0x0, integer: []string{"0", "4~18", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 27: {locales: "mr", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 28: {locales: "mr", form: 0x3, integer: []string{"2", "3"}, decimal: []string(nil)},
- 29: {locales: "mr", form: 0x4, integer: []string{"4"}, decimal: []string(nil)},
- 30: {locales: "mr", form: 0x0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 31: {locales: "ca", form: 0x2, integer: []string{"1", "3"}, decimal: []string(nil)},
- 32: {locales: "ca", form: 0x3, integer: []string{"2"}, decimal: []string(nil)},
- 33: {locales: "ca", form: 0x4, integer: []string{"4"}, decimal: []string(nil)},
- 34: {locales: "ca", form: 0x0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 35: {locales: "mk", form: 0x2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string(nil)},
- 36: {locales: "mk", form: 0x3, integer: []string{"2", "22", "32", "42", "52", "62", "72", "82", "102", "1002"}, decimal: []string(nil)},
- 37: {locales: "mk", form: 0x5, integer: []string{"7", "8", "27", "28", "37", "38", "47", "48", "57", "58", "67", "68", "77", "78", "87", "88", "107", "1007"}, decimal: []string(nil)},
- 38: {locales: "mk", form: 0x0, integer: []string{"0", "3~6", "9~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 39: {locales: "az", form: 0x2, integer: []string{"1", "2", "5", "7", "8", "11", "12", "15", "17", "18", "20~22", "25", "101", "1001"}, decimal: []string(nil)},
- 40: {locales: "az", form: 0x4, integer: []string{"3", "4", "13", "14", "23", "24", "33", "34", "43", "44", "53", "54", "63", "64", "73", "74", "100", "1003"}, decimal: []string(nil)},
- 41: {locales: "az", form: 0x5, integer: []string{"0", "6", "16", "26", "36", "40", "46", "56", "106", "1006"}, decimal: []string(nil)},
- 42: {locales: "az", form: 0x0, integer: []string{"9", "10", "19", "29", "30", "39", "49", "59", "69", "79", "109", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 43: {locales: "gu hi", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 44: {locales: "gu hi", form: 0x3, integer: []string{"2", "3"}, decimal: []string(nil)},
- 45: {locales: "gu hi", form: 0x4, integer: []string{"4"}, decimal: []string(nil)},
- 46: {locales: "gu hi", form: 0x5, integer: []string{"6"}, decimal: []string(nil)},
- 47: {locales: "gu hi", form: 0x0, integer: []string{"0", "5", "7~20", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 48: {locales: "as bn", form: 0x2, integer: []string{"1", "5", "7~10"}, decimal: []string(nil)},
- 49: {locales: "as bn", form: 0x3, integer: []string{"2", "3"}, decimal: []string(nil)},
- 50: {locales: "as bn", form: 0x4, integer: []string{"4"}, decimal: []string(nil)},
- 51: {locales: "as bn", form: 0x5, integer: []string{"6"}, decimal: []string(nil)},
- 52: {locales: "as bn", form: 0x0, integer: []string{"0", "11~25", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 53: {locales: "cy", form: 0x1, integer: []string{"0", "7~9"}, decimal: []string(nil)},
- 54: {locales: "cy", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 55: {locales: "cy", form: 0x3, integer: []string{"2"}, decimal: []string(nil)},
- 56: {locales: "cy", form: 0x4, integer: []string{"3", "4"}, decimal: []string(nil)},
- 57: {locales: "cy", form: 0x5, integer: []string{"5", "6"}, decimal: []string(nil)},
- 58: {locales: "cy", form: 0x0, integer: []string{"10~25", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
-} // Size: 4272 bytes
-
-var cardinalTests = []pluralTest{ // 115 elements
- 0: {locales: "bm bo dz id ig ii in ja jbo jv jw kde kea km ko lkt lo ms my nqo root sah ses sg th to vi wo yo yue zh", form: 0x0, integer: []string{"0~15", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 1: {locales: "am as bn fa gu hi kn mr zu", form: 0x2, integer: []string{"0", "1"}, decimal: []string{"0.0~1.0", "0.00~0.04"}},
- 2: {locales: "am as bn fa gu hi kn mr zu", form: 0x0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"1.1~2.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 3: {locales: "ff fr hy kab", form: 0x2, integer: []string{"0", "1"}, decimal: []string{"0.0~1.5"}},
- 4: {locales: "ff fr hy kab", form: 0x0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"2.0~3.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 5: {locales: "ast ca de en et fi fy gl it ji nl sv sw ur yi", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 6: {locales: "ast ca de en et fi fy gl it ji nl sv sw ur yi", form: 0x0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 7: {locales: "si", form: 0x2, integer: []string{"0", "1"}, decimal: []string{"0.0", "0.1", "1.0", "0.00", "0.01", "1.00", "0.000", "0.001", "1.000", "0.0000", "0.0001", "1.0000"}},
- 8: {locales: "si", form: 0x0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.2~0.9", "1.1~1.8", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 9: {locales: "ak bh guw ln mg nso pa ti wa", form: 0x2, integer: []string{"0", "1"}, decimal: []string{"0.0", "1.0", "0.00", "1.00", "0.000", "1.000", "0.0000", "1.0000"}},
- 10: {locales: "ak bh guw ln mg nso pa ti wa", form: 0x0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 11: {locales: "tzm", form: 0x2, integer: []string{"0", "1", "11~24"}, decimal: []string{"0.0", "1.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "19.0", "20.0", "21.0", "22.0", "23.0", "24.0"}},
- 12: {locales: "tzm", form: 0x0, integer: []string{"2~10", "100~106", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 13: {locales: "pt", form: 0x2, integer: []string{"0", "1"}, decimal: []string{"0.0", "1.0", "0.00", "1.00", "0.000", "1.000", "0.0000", "1.0000"}},
- 14: {locales: "pt", form: 0x0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 15: {locales: "af asa az bem bez bg brx ce cgg chr ckb dv ee el eo es eu fo fur gsw ha haw hu jgo jmc ka kaj kcg kk kkj kl ks ksb ku ky lb lg mas mgo ml mn nah nb nd ne nn nnh no nr ny nyn om or os pap ps rm rof rwk saq sdh seh sn so sq ss ssy st syr ta te teo tig tk tn tr ts ug uz ve vo vun wae xh xog", form: 0x2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 16: {locales: "af asa az bem bez bg brx ce cgg chr ckb dv ee el eo es eu fo fur gsw ha haw hu jgo jmc ka kaj kcg kk kkj kl ks ksb ku ky lb lg mas mgo ml mn nah nb nd ne nn nnh no nr ny nyn om or os pap ps rm rof rwk saq sdh seh sn so sq ss ssy st syr ta te teo tig tk tn tr ts ug uz ve vo vun wae xh xog", form: 0x0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 17: {locales: "pt_PT", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 18: {locales: "pt_PT", form: 0x0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 19: {locales: "da", form: 0x2, integer: []string{"1"}, decimal: []string{"0.1~1.6"}},
- 20: {locales: "da", form: 0x0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "2.0~3.4", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 21: {locales: "is", form: 0x2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"0.1~1.6", "10.1", "100.1", "1000.1"}},
- 22: {locales: "is", form: 0x0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 23: {locales: "mk", form: 0x2, integer: []string{"1", "11", "21", "31", "41", "51", "61", "71", "101", "1001"}, decimal: []string{"0.1", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
- 24: {locales: "mk", form: 0x0, integer: []string{"0", "2~10", "12~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "0.2~1.0", "1.2~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 25: {locales: "fil tl", form: 0x2, integer: []string{"0~3", "5", "7", "8", "10~13", "15", "17", "18", "20", "21", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.3", "0.5", "0.7", "0.8", "1.0~1.3", "1.5", "1.7", "1.8", "2.0", "2.1", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 26: {locales: "fil tl", form: 0x0, integer: []string{"4", "6", "9", "14", "16", "19", "24", "26", "104", "1004"}, decimal: []string{"0.4", "0.6", "0.9", "1.4", "1.6", "1.9", "2.4", "2.6", "10.4", "100.4", "1000.4"}},
- 27: {locales: "lv prg", form: 0x1, integer: []string{"0", "10~20", "30", "40", "50", "60", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "10.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 28: {locales: "lv prg", form: 0x2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"0.1", "1.0", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
- 29: {locales: "lv prg", form: 0x0, integer: []string{"2~9", "22~29", "102", "1002"}, decimal: []string{"0.2~0.9", "1.2~1.9", "10.2", "100.2", "1000.2"}},
- 30: {locales: "lag", form: 0x1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
- 31: {locales: "lag", form: 0x2, integer: []string{"1"}, decimal: []string{"0.1~1.6"}},
- 32: {locales: "lag", form: 0x0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"2.0~3.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 33: {locales: "ksh", form: 0x1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
- 34: {locales: "ksh", form: 0x2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 35: {locales: "ksh", form: 0x0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 36: {locales: "iu kw naq se sma smi smj smn sms", form: 0x2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 37: {locales: "iu kw naq se sma smi smj smn sms", form: 0x3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
- 38: {locales: "iu kw naq se sma smi smj smn sms", form: 0x0, integer: []string{"0", "3~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 39: {locales: "shi", form: 0x2, integer: []string{"0", "1"}, decimal: []string{"0.0~1.0", "0.00~0.04"}},
- 40: {locales: "shi", form: 0x4, integer: []string{"2~10"}, decimal: []string{"2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "2.00", "3.00", "4.00", "5.00", "6.00", "7.00", "8.00"}},
- 41: {locales: "shi", form: 0x0, integer: []string{"11~26", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"1.1~1.9", "2.1~2.7", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 42: {locales: "mo ro", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 43: {locales: "mo ro", form: 0x4, integer: []string{"0", "2~16", "101", "1001"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 44: {locales: "mo ro", form: 0x0, integer: []string{"20~35", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 45: {locales: "bs hr sh sr", form: 0x2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"0.1", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
- 46: {locales: "bs hr sh sr", form: 0x4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string{"0.2~0.4", "1.2~1.4", "2.2~2.4", "3.2~3.4", "4.2~4.4", "5.2", "10.2", "100.2", "1000.2"}},
- 47: {locales: "bs hr sh sr", form: 0x0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "0.5~1.0", "1.5~2.0", "2.5~2.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 48: {locales: "gd", form: 0x2, integer: []string{"1", "11"}, decimal: []string{"1.0", "11.0", "1.00", "11.00", "1.000", "11.000", "1.0000"}},
- 49: {locales: "gd", form: 0x3, integer: []string{"2", "12"}, decimal: []string{"2.0", "12.0", "2.00", "12.00", "2.000", "12.000", "2.0000"}},
- 50: {locales: "gd", form: 0x4, integer: []string{"3~10", "13~19"}, decimal: []string{"3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "19.0", "3.00"}},
- 51: {locales: "gd", form: 0x0, integer: []string{"0", "20~34", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 52: {locales: "sl", form: 0x2, integer: []string{"1", "101", "201", "301", "401", "501", "601", "701", "1001"}, decimal: []string(nil)},
- 53: {locales: "sl", form: 0x3, integer: []string{"2", "102", "202", "302", "402", "502", "602", "702", "1002"}, decimal: []string(nil)},
- 54: {locales: "sl", form: 0x4, integer: []string{"3", "4", "103", "104", "203", "204", "303", "304", "403", "404", "503", "504", "603", "604", "703", "704", "1003"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 55: {locales: "sl", form: 0x0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 56: {locales: "dsb hsb", form: 0x2, integer: []string{"1", "101", "201", "301", "401", "501", "601", "701", "1001"}, decimal: []string{"0.1", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
- 57: {locales: "dsb hsb", form: 0x3, integer: []string{"2", "102", "202", "302", "402", "502", "602", "702", "1002"}, decimal: []string{"0.2", "1.2", "2.2", "3.2", "4.2", "5.2", "6.2", "7.2", "10.2", "100.2", "1000.2"}},
- 58: {locales: "dsb hsb", form: 0x4, integer: []string{"3", "4", "103", "104", "203", "204", "303", "304", "403", "404", "503", "504", "603", "604", "703", "704", "1003"}, decimal: []string{"0.3", "0.4", "1.3", "1.4", "2.3", "2.4", "3.3", "3.4", "4.3", "4.4", "5.3", "5.4", "6.3", "6.4", "7.3", "7.4", "10.3", "100.3", "1000.3"}},
- 59: {locales: "dsb hsb", form: 0x0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "0.5~1.0", "1.5~2.0", "2.5~2.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 60: {locales: "he iw", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 61: {locales: "he iw", form: 0x3, integer: []string{"2"}, decimal: []string(nil)},
- 62: {locales: "he iw", form: 0x5, integer: []string{"20", "30", "40", "50", "60", "70", "80", "90", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 63: {locales: "he iw", form: 0x0, integer: []string{"0", "3~17", "101", "1001"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 64: {locales: "cs sk", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 65: {locales: "cs sk", form: 0x4, integer: []string{"2~4"}, decimal: []string(nil)},
- 66: {locales: "cs sk", form: 0x5, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 67: {locales: "cs sk", form: 0x0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 68: {locales: "pl", form: 0x2, integer: []string{"1"}, decimal: []string(nil)},
- 69: {locales: "pl", form: 0x4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string(nil)},
- 70: {locales: "pl", form: 0x5, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 71: {locales: "pl", form: 0x0, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 72: {locales: "be", form: 0x2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"1.0", "21.0", "31.0", "41.0", "51.0", "61.0", "71.0", "81.0", "101.0", "1001.0"}},
- 73: {locales: "be", form: 0x4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string{"2.0", "3.0", "4.0", "22.0", "23.0", "24.0", "32.0", "33.0", "102.0", "1002.0"}},
- 74: {locales: "be", form: 0x5, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "11.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 75: {locales: "be", form: 0x0, integer: []string(nil), decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.1", "1000.1"}},
- 76: {locales: "lt", form: 0x2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"1.0", "21.0", "31.0", "41.0", "51.0", "61.0", "71.0", "81.0", "101.0", "1001.0"}},
- 77: {locales: "lt", form: 0x4, integer: []string{"2~9", "22~29", "102", "1002"}, decimal: []string{"2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "22.0", "102.0", "1002.0"}},
- 78: {locales: "lt", form: 0x5, integer: []string(nil), decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.1", "1000.1"}},
- 79: {locales: "lt", form: 0x0, integer: []string{"0", "10~20", "30", "40", "50", "60", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "10.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 80: {locales: "mt", form: 0x2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 81: {locales: "mt", form: 0x4, integer: []string{"0", "2~10", "102~107", "1002"}, decimal: []string{"0.0", "2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "10.0", "102.0", "1002.0"}},
- 82: {locales: "mt", form: 0x5, integer: []string{"11~19", "111~117", "1011"}, decimal: []string{"11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "111.0", "1011.0"}},
- 83: {locales: "mt", form: 0x0, integer: []string{"20~35", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 84: {locales: "ru uk", form: 0x2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string(nil)},
- 85: {locales: "ru uk", form: 0x4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string(nil)},
- 86: {locales: "ru uk", form: 0x5, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 87: {locales: "ru uk", form: 0x0, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 88: {locales: "br", form: 0x2, integer: []string{"1", "21", "31", "41", "51", "61", "81", "101", "1001"}, decimal: []string{"1.0", "21.0", "31.0", "41.0", "51.0", "61.0", "81.0", "101.0", "1001.0"}},
- 89: {locales: "br", form: 0x3, integer: []string{"2", "22", "32", "42", "52", "62", "82", "102", "1002"}, decimal: []string{"2.0", "22.0", "32.0", "42.0", "52.0", "62.0", "82.0", "102.0", "1002.0"}},
- 90: {locales: "br", form: 0x4, integer: []string{"3", "4", "9", "23", "24", "29", "33", "34", "39", "43", "44", "49", "103", "1003"}, decimal: []string{"3.0", "4.0", "9.0", "23.0", "24.0", "29.0", "33.0", "34.0", "103.0", "1003.0"}},
- 91: {locales: "br", form: 0x5, integer: []string{"1000000"}, decimal: []string{"1000000.0", "1000000.00", "1000000.000"}},
- 92: {locales: "br", form: 0x0, integer: []string{"0", "5~8", "10~20", "100", "1000", "10000", "100000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0"}},
- 93: {locales: "ga", form: 0x2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 94: {locales: "ga", form: 0x3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
- 95: {locales: "ga", form: 0x4, integer: []string{"3~6"}, decimal: []string{"3.0", "4.0", "5.0", "6.0", "3.00", "4.00", "5.00", "6.00", "3.000", "4.000", "5.000", "6.000", "3.0000", "4.0000", "5.0000", "6.0000"}},
- 96: {locales: "ga", form: 0x5, integer: []string{"7~10"}, decimal: []string{"7.0", "8.0", "9.0", "10.0", "7.00", "8.00", "9.00", "10.00", "7.000", "8.000", "9.000", "10.000", "7.0000", "8.0000", "9.0000", "10.0000"}},
- 97: {locales: "ga", form: 0x0, integer: []string{"0", "11~25", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 98: {locales: "gv", form: 0x2, integer: []string{"1", "11", "21", "31", "41", "51", "61", "71", "101", "1001"}, decimal: []string(nil)},
- 99: {locales: "gv", form: 0x3, integer: []string{"2", "12", "22", "32", "42", "52", "62", "72", "102", "1002"}, decimal: []string(nil)},
- 100: {locales: "gv", form: 0x4, integer: []string{"0", "20", "40", "60", "80", "100", "120", "140", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 101: {locales: "gv", form: 0x5, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 102: {locales: "gv", form: 0x0, integer: []string{"3~10", "13~19", "23", "103", "1003"}, decimal: []string(nil)},
- 103: {locales: "ar ars", form: 0x1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
- 104: {locales: "ar ars", form: 0x2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 105: {locales: "ar ars", form: 0x3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
- 106: {locales: "ar ars", form: 0x4, integer: []string{"3~10", "103~110", "1003"}, decimal: []string{"3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "103.0", "1003.0"}},
- 107: {locales: "ar ars", form: 0x5, integer: []string{"11~26", "111", "1011"}, decimal: []string{"11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "111.0", "1011.0"}},
- 108: {locales: "ar ars", form: 0x0, integer: []string{"100~102", "200~202", "300~302", "400~402", "500~502", "600", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 109: {locales: "cy", form: 0x1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
- 110: {locales: "cy", form: 0x2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 111: {locales: "cy", form: 0x3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
- 112: {locales: "cy", form: 0x4, integer: []string{"3"}, decimal: []string{"3.0", "3.00", "3.000", "3.0000"}},
- 113: {locales: "cy", form: 0x5, integer: []string{"6"}, decimal: []string{"6.0", "6.00", "6.000", "6.0000"}},
- 114: {locales: "cy", form: 0x0, integer: []string{"4", "5", "7~20", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
-} // Size: 8304 bytes
-
-// Total table size 12576 bytes (12KiB); checksum: 35F73741
diff --git a/vendor/golang.org/x/text/internal/number/decimal.go b/vendor/golang.org/x/text/internal/number/decimal.go
deleted file mode 100644
index 9c36865d1..000000000
--- a/vendor/golang.org/x/text/internal/number/decimal.go
+++ /dev/null
@@ -1,416 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// TODO: use build tags once a low-level public API has been established in
-// package strconv.
-
-// Multiprecision decimal numbers.
-// For floating-point formatting only; not general purpose.
-// Only operations are assign and (binary) left/right shift.
-// Can do binary floating point in multiprecision decimal precisely
-// because 2 divides 10; cannot do decimal floating point
-// in multiprecision binary precisely.
-
-package number
-
-type decimal struct {
- d [800]byte // digits, big-endian representation
- nd int // number of digits used
- dp int // decimal point
- neg bool
- trunc bool // discarded nonzero digits beyond d[:nd]
-}
-
-func (a *decimal) String() string {
- n := 10 + a.nd
- if a.dp > 0 {
- n += a.dp
- }
- if a.dp < 0 {
- n += -a.dp
- }
-
- buf := make([]byte, n)
- w := 0
- switch {
- case a.nd == 0:
- return "0"
-
- case a.dp <= 0:
- // zeros fill space between decimal point and digits
- buf[w] = '0'
- w++
- buf[w] = '.'
- w++
- w += digitZero(buf[w : w+-a.dp])
- w += copy(buf[w:], a.d[0:a.nd])
-
- case a.dp < a.nd:
- // decimal point in middle of digits
- w += copy(buf[w:], a.d[0:a.dp])
- buf[w] = '.'
- w++
- w += copy(buf[w:], a.d[a.dp:a.nd])
-
- default:
- // zeros fill space between digits and decimal point
- w += copy(buf[w:], a.d[0:a.nd])
- w += digitZero(buf[w : w+a.dp-a.nd])
- }
- return string(buf[0:w])
-}
-
-func digitZero(dst []byte) int {
- for i := range dst {
- dst[i] = '0'
- }
- return len(dst)
-}
-
-// trim trailing zeros from number.
-// (They are meaningless; the decimal point is tracked
-// independent of the number of digits.)
-func trim(a *decimal) {
- for a.nd > 0 && a.d[a.nd-1] == '0' {
- a.nd--
- }
- if a.nd == 0 {
- a.dp = 0
- }
-}
-
-// Assign v to a.
-func (a *decimal) Assign(v uint64) {
- var buf [24]byte
-
- // Write reversed decimal in buf.
- n := 0
- for v > 0 {
- v1 := v / 10
- v -= 10 * v1
- buf[n] = byte(v + '0')
- n++
- v = v1
- }
-
- // Reverse again to produce forward decimal in a.d.
- a.nd = 0
- for n--; n >= 0; n-- {
- a.d[a.nd] = buf[n]
- a.nd++
- }
- a.dp = a.nd
- trim(a)
-}
-
-// Maximum shift that we can do in one pass without overflow.
-// A uint has 32 or 64 bits, and we have to be able to accommodate 9<<k.
-const uintSize = 32 << (^uint(0) >> 63)
-const maxShift = uintSize - 4
-
-// Binary shift right (/ 2) by k bits. k <= maxShift to avoid overflow.
-func rightShift(a *decimal, k uint) {
- r := 0 // read pointer
- w := 0 // write pointer
-
- // Pick up enough leading digits to cover first shift.
- var n uint
- for ; n>>k == 0; r++ {
- if r >= a.nd {
- if n == 0 {
- // a == 0; shouldn't get here, but handle anyway.
- a.nd = 0
- return
- }
- for n>>k == 0 {
- n = n * 10
- r++
- }
- break
- }
- c := uint(a.d[r])
- n = n*10 + c - '0'
- }
- a.dp -= r - 1
-
- // Pick up a digit, put down a digit.
- for ; r < a.nd; r++ {
- c := uint(a.d[r])
- dig := n >> k
- n -= dig << k
- a.d[w] = byte(dig + '0')
- w++
- n = n*10 + c - '0'
- }
-
- // Put down extra digits.
- for n > 0 {
- dig := n >> k
- n -= dig << k
- if w < len(a.d) {
- a.d[w] = byte(dig + '0')
- w++
- } else if dig > 0 {
- a.trunc = true
- }
- n = n * 10
- }
-
- a.nd = w
- trim(a)
-}
-
-// Cheat sheet for left shift: table indexed by shift count giving
-// number of new digits that will be introduced by that shift.
-//
-// For example, leftcheats[4] = {2, "625"}. That means that
-// if we are shifting by 4 (multiplying by 16), it will add 2 digits
-// when the string prefix is "625" through "999", and one fewer digit
-// if the string prefix is "000" through "624".
-//
-// Credit for this trick goes to Ken.
-
-type leftCheat struct {
- delta int // number of new digits
- cutoff string // minus one digit if original < a.
-}
-
-var leftcheats = []leftCheat{
- // Leading digits of 1/2^i = 5^i.
- // 5^23 is not an exact 64-bit floating point number,
- // so have to use bc for the math.
- // Go up to 60 to be large enough for 32bit and 64bit platforms.
- /*
- seq 60 | sed 's/^/5^/' | bc |
- awk 'BEGIN{ print "\t{ 0, \"\" }," }
- {
- log2 = log(2)/log(10)
- printf("\t{ %d, \"%s\" },\t// * %d\n",
- int(log2*NR+1), $0, 2**NR)
- }'
- */
- {0, ""},
- {1, "5"}, // * 2
- {1, "25"}, // * 4
- {1, "125"}, // * 8
- {2, "625"}, // * 16
- {2, "3125"}, // * 32
- {2, "15625"}, // * 64
- {3, "78125"}, // * 128
- {3, "390625"}, // * 256
- {3, "1953125"}, // * 512
- {4, "9765625"}, // * 1024
- {4, "48828125"}, // * 2048
- {4, "244140625"}, // * 4096
- {4, "1220703125"}, // * 8192
- {5, "6103515625"}, // * 16384
- {5, "30517578125"}, // * 32768
- {5, "152587890625"}, // * 65536
- {6, "762939453125"}, // * 131072
- {6, "3814697265625"}, // * 262144
- {6, "19073486328125"}, // * 524288
- {7, "95367431640625"}, // * 1048576
- {7, "476837158203125"}, // * 2097152
- {7, "2384185791015625"}, // * 4194304
- {7, "11920928955078125"}, // * 8388608
- {8, "59604644775390625"}, // * 16777216
- {8, "298023223876953125"}, // * 33554432
- {8, "1490116119384765625"}, // * 67108864
- {9, "7450580596923828125"}, // * 134217728
- {9, "37252902984619140625"}, // * 268435456
- {9, "186264514923095703125"}, // * 536870912
- {10, "931322574615478515625"}, // * 1073741824
- {10, "4656612873077392578125"}, // * 2147483648
- {10, "23283064365386962890625"}, // * 4294967296
- {10, "116415321826934814453125"}, // * 8589934592
- {11, "582076609134674072265625"}, // * 17179869184
- {11, "2910383045673370361328125"}, // * 34359738368
- {11, "14551915228366851806640625"}, // * 68719476736
- {12, "72759576141834259033203125"}, // * 137438953472
- {12, "363797880709171295166015625"}, // * 274877906944
- {12, "1818989403545856475830078125"}, // * 549755813888
- {13, "9094947017729282379150390625"}, // * 1099511627776
- {13, "45474735088646411895751953125"}, // * 2199023255552
- {13, "227373675443232059478759765625"}, // * 4398046511104
- {13, "1136868377216160297393798828125"}, // * 8796093022208
- {14, "5684341886080801486968994140625"}, // * 17592186044416
- {14, "28421709430404007434844970703125"}, // * 35184372088832
- {14, "142108547152020037174224853515625"}, // * 70368744177664
- {15, "710542735760100185871124267578125"}, // * 140737488355328
- {15, "3552713678800500929355621337890625"}, // * 281474976710656
- {15, "17763568394002504646778106689453125"}, // * 562949953421312
- {16, "88817841970012523233890533447265625"}, // * 1125899906842624
- {16, "444089209850062616169452667236328125"}, // * 2251799813685248
- {16, "2220446049250313080847263336181640625"}, // * 4503599627370496
- {16, "11102230246251565404236316680908203125"}, // * 9007199254740992
- {17, "55511151231257827021181583404541015625"}, // * 18014398509481984
- {17, "277555756156289135105907917022705078125"}, // * 36028797018963968
- {17, "1387778780781445675529539585113525390625"}, // * 72057594037927936
- {18, "6938893903907228377647697925567626953125"}, // * 144115188075855872
- {18, "34694469519536141888238489627838134765625"}, // * 288230376151711744
- {18, "173472347597680709441192448139190673828125"}, // * 576460752303423488
- {19, "867361737988403547205962240695953369140625"}, // * 1152921504606846976
-}
-
-// Is the leading prefix of b lexicographically less than s?
-func prefixIsLessThan(b []byte, s string) bool {
- for i := 0; i < len(s); i++ {
- if i >= len(b) {
- return true
- }
- if b[i] != s[i] {
- return b[i] < s[i]
- }
- }
- return false
-}
-
-// Binary shift left (* 2) by k bits. k <= maxShift to avoid overflow.
-func leftShift(a *decimal, k uint) {
- delta := leftcheats[k].delta
- if prefixIsLessThan(a.d[0:a.nd], leftcheats[k].cutoff) {
- delta--
- }
-
- r := a.nd // read index
- w := a.nd + delta // write index
-
- // Pick up a digit, put down a digit.
- var n uint
- for r--; r >= 0; r-- {
- n += (uint(a.d[r]) - '0') << k
- quo := n / 10
- rem := n - 10*quo
- w--
- if w < len(a.d) {
- a.d[w] = byte(rem + '0')
- } else if rem != 0 {
- a.trunc = true
- }
- n = quo
- }
-
- // Put down extra digits.
- for n > 0 {
- quo := n / 10
- rem := n - 10*quo
- w--
- if w < len(a.d) {
- a.d[w] = byte(rem + '0')
- } else if rem != 0 {
- a.trunc = true
- }
- n = quo
- }
-
- a.nd += delta
- if a.nd >= len(a.d) {
- a.nd = len(a.d)
- }
- a.dp += delta
- trim(a)
-}
-
-// Binary shift left (k > 0) or right (k < 0).
-func (a *decimal) Shift(k int) {
- switch {
- case a.nd == 0:
- // nothing to do: a == 0
- case k > 0:
- for k > maxShift {
- leftShift(a, maxShift)
- k -= maxShift
- }
- leftShift(a, uint(k))
- case k < 0:
- for k < -maxShift {
- rightShift(a, maxShift)
- k += maxShift
- }
- rightShift(a, uint(-k))
- }
-}
-
-// If we chop a at nd digits, should we round up?
-func shouldRoundUp(a *decimal, nd int) bool {
- if nd < 0 || nd >= a.nd {
- return false
- }
- if a.d[nd] == '5' && nd+1 == a.nd { // exactly halfway - round to even
- // if we truncated, a little higher than what's recorded - always round up
- if a.trunc {
- return true
- }
- return nd > 0 && (a.d[nd-1]-'0')%2 != 0
- }
- // not halfway - digit tells all
- return a.d[nd] >= '5'
-}
-
-// Round a to nd digits (or fewer).
-// If nd is zero, it means we're rounding
-// just to the left of the digits, as in
-// 0.09 -> 0.1.
-func (a *decimal) Round(nd int) {
- if nd < 0 || nd >= a.nd {
- return
- }
- if shouldRoundUp(a, nd) {
- a.RoundUp(nd)
- } else {
- a.RoundDown(nd)
- }
-}
-
-// Round a down to nd digits (or fewer).
-func (a *decimal) RoundDown(nd int) {
- if nd < 0 || nd >= a.nd {
- return
- }
- a.nd = nd
- trim(a)
-}
-
-// Round a up to nd digits (or fewer).
-func (a *decimal) RoundUp(nd int) {
- if nd < 0 || nd >= a.nd {
- return
- }
-
- // round up
- for i := nd - 1; i >= 0; i-- {
- c := a.d[i]
- if c < '9' { // can stop after this digit
- a.d[i]++
- a.nd = i + 1
- return
- }
- }
-
- // Number is all 9s.
- // Change to single 1 with adjusted decimal point.
- a.d[0] = '1'
- a.nd = 1
- a.dp++
-}
-
-// Extract integer part, rounded appropriately.
-// No guarantees about overflow.
-func (a *decimal) RoundedInteger() uint64 {
- if a.dp > 20 {
- return 0xFFFFFFFFFFFFFFFF
- }
- var i int
- n := uint64(0)
- for i = 0; i < a.dp && i < a.nd; i++ {
- n = n*10 + uint64(a.d[i]-'0')
- }
- for ; i < a.dp; i++ {
- n *= 10
- }
- if shouldRoundUp(a, a.dp) {
- n++
- }
- return n
-}
diff --git a/vendor/golang.org/x/text/internal/number/extfloat.go b/vendor/golang.org/x/text/internal/number/extfloat.go
deleted file mode 100644
index 97138e2b0..000000000
--- a/vendor/golang.org/x/text/internal/number/extfloat.go
+++ /dev/null
@@ -1,671 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// TODO: use build tags once a low-level public API has been established in
-// package strconv.
-
-package number
-
-// An extFloat represents an extended floating-point number, with more
-// precision than a float64. It does not try to save bits: the
-// number represented by the structure is mant*(2^exp), with a negative
-// sign if neg is true.
-type extFloat struct {
- mant uint64
- exp int
- neg bool
-}
-
-// Powers of ten taken from double-conversion library.
-// http://code.google.com/p/double-conversion/
-const (
- firstPowerOfTen = -348
- stepPowerOfTen = 8
-)
-
-var smallPowersOfTen = [...]extFloat{
- {1 << 63, -63, false}, // 1
- {0xa << 60, -60, false}, // 1e1
- {0x64 << 57, -57, false}, // 1e2
- {0x3e8 << 54, -54, false}, // 1e3
- {0x2710 << 50, -50, false}, // 1e4
- {0x186a0 << 47, -47, false}, // 1e5
- {0xf4240 << 44, -44, false}, // 1e6
- {0x989680 << 40, -40, false}, // 1e7
-}
-
-var powersOfTen = [...]extFloat{
- {0xfa8fd5a0081c0288, -1220, false}, // 10^-348
- {0xbaaee17fa23ebf76, -1193, false}, // 10^-340
- {0x8b16fb203055ac76, -1166, false}, // 10^-332
- {0xcf42894a5dce35ea, -1140, false}, // 10^-324
- {0x9a6bb0aa55653b2d, -1113, false}, // 10^-316
- {0xe61acf033d1a45df, -1087, false}, // 10^-308
- {0xab70fe17c79ac6ca, -1060, false}, // 10^-300
- {0xff77b1fcbebcdc4f, -1034, false}, // 10^-292
- {0xbe5691ef416bd60c, -1007, false}, // 10^-284
- {0x8dd01fad907ffc3c, -980, false}, // 10^-276
- {0xd3515c2831559a83, -954, false}, // 10^-268
- {0x9d71ac8fada6c9b5, -927, false}, // 10^-260
- {0xea9c227723ee8bcb, -901, false}, // 10^-252
- {0xaecc49914078536d, -874, false}, // 10^-244
- {0x823c12795db6ce57, -847, false}, // 10^-236
- {0xc21094364dfb5637, -821, false}, // 10^-228
- {0x9096ea6f3848984f, -794, false}, // 10^-220
- {0xd77485cb25823ac7, -768, false}, // 10^-212
- {0xa086cfcd97bf97f4, -741, false}, // 10^-204
- {0xef340a98172aace5, -715, false}, // 10^-196
- {0xb23867fb2a35b28e, -688, false}, // 10^-188
- {0x84c8d4dfd2c63f3b, -661, false}, // 10^-180
- {0xc5dd44271ad3cdba, -635, false}, // 10^-172
- {0x936b9fcebb25c996, -608, false}, // 10^-164
- {0xdbac6c247d62a584, -582, false}, // 10^-156
- {0xa3ab66580d5fdaf6, -555, false}, // 10^-148
- {0xf3e2f893dec3f126, -529, false}, // 10^-140
- {0xb5b5ada8aaff80b8, -502, false}, // 10^-132
- {0x87625f056c7c4a8b, -475, false}, // 10^-124
- {0xc9bcff6034c13053, -449, false}, // 10^-116
- {0x964e858c91ba2655, -422, false}, // 10^-108
- {0xdff9772470297ebd, -396, false}, // 10^-100
- {0xa6dfbd9fb8e5b88f, -369, false}, // 10^-92
- {0xf8a95fcf88747d94, -343, false}, // 10^-84
- {0xb94470938fa89bcf, -316, false}, // 10^-76
- {0x8a08f0f8bf0f156b, -289, false}, // 10^-68
- {0xcdb02555653131b6, -263, false}, // 10^-60
- {0x993fe2c6d07b7fac, -236, false}, // 10^-52
- {0xe45c10c42a2b3b06, -210, false}, // 10^-44
- {0xaa242499697392d3, -183, false}, // 10^-36
- {0xfd87b5f28300ca0e, -157, false}, // 10^-28
- {0xbce5086492111aeb, -130, false}, // 10^-20
- {0x8cbccc096f5088cc, -103, false}, // 10^-12
- {0xd1b71758e219652c, -77, false}, // 10^-4
- {0x9c40000000000000, -50, false}, // 10^4
- {0xe8d4a51000000000, -24, false}, // 10^12
- {0xad78ebc5ac620000, 3, false}, // 10^20
- {0x813f3978f8940984, 30, false}, // 10^28
- {0xc097ce7bc90715b3, 56, false}, // 10^36
- {0x8f7e32ce7bea5c70, 83, false}, // 10^44
- {0xd5d238a4abe98068, 109, false}, // 10^52
- {0x9f4f2726179a2245, 136, false}, // 10^60
- {0xed63a231d4c4fb27, 162, false}, // 10^68
- {0xb0de65388cc8ada8, 189, false}, // 10^76
- {0x83c7088e1aab65db, 216, false}, // 10^84
- {0xc45d1df942711d9a, 242, false}, // 10^92
- {0x924d692ca61be758, 269, false}, // 10^100
- {0xda01ee641a708dea, 295, false}, // 10^108
- {0xa26da3999aef774a, 322, false}, // 10^116
- {0xf209787bb47d6b85, 348, false}, // 10^124
- {0xb454e4a179dd1877, 375, false}, // 10^132
- {0x865b86925b9bc5c2, 402, false}, // 10^140
- {0xc83553c5c8965d3d, 428, false}, // 10^148
- {0x952ab45cfa97a0b3, 455, false}, // 10^156
- {0xde469fbd99a05fe3, 481, false}, // 10^164
- {0xa59bc234db398c25, 508, false}, // 10^172
- {0xf6c69a72a3989f5c, 534, false}, // 10^180
- {0xb7dcbf5354e9bece, 561, false}, // 10^188
- {0x88fcf317f22241e2, 588, false}, // 10^196
- {0xcc20ce9bd35c78a5, 614, false}, // 10^204
- {0x98165af37b2153df, 641, false}, // 10^212
- {0xe2a0b5dc971f303a, 667, false}, // 10^220
- {0xa8d9d1535ce3b396, 694, false}, // 10^228
- {0xfb9b7cd9a4a7443c, 720, false}, // 10^236
- {0xbb764c4ca7a44410, 747, false}, // 10^244
- {0x8bab8eefb6409c1a, 774, false}, // 10^252
- {0xd01fef10a657842c, 800, false}, // 10^260
- {0x9b10a4e5e9913129, 827, false}, // 10^268
- {0xe7109bfba19c0c9d, 853, false}, // 10^276
- {0xac2820d9623bf429, 880, false}, // 10^284
- {0x80444b5e7aa7cf85, 907, false}, // 10^292
- {0xbf21e44003acdd2d, 933, false}, // 10^300
- {0x8e679c2f5e44ff8f, 960, false}, // 10^308
- {0xd433179d9c8cb841, 986, false}, // 10^316
- {0x9e19db92b4e31ba9, 1013, false}, // 10^324
- {0xeb96bf6ebadf77d9, 1039, false}, // 10^332
- {0xaf87023b9bf0ee6b, 1066, false}, // 10^340
-}
-
-// floatBits returns the bits of the float64 that best approximates
-// the extFloat passed as receiver. Overflow is set to true if
-// the resulting float64 is ±Inf.
-func (f *extFloat) floatBits(flt *floatInfo) (bits uint64, overflow bool) {
- f.Normalize()
-
- exp := f.exp + 63
-
- // Exponent too small.
- if exp < flt.bias+1 {
- n := flt.bias + 1 - exp
- f.mant >>= uint(n)
- exp += n
- }
-
- // Extract 1+flt.mantbits bits from the 64-bit mantissa.
- mant := f.mant >> (63 - flt.mantbits)
- if f.mant&(1<<(62-flt.mantbits)) != 0 {
- // Round up.
- mant += 1
- }
-
- // Rounding might have added a bit; shift down.
- if mant == 2<<flt.mantbits {
- mant >>= 1
- exp++
- }
-
- // Infinities.
- if exp-flt.bias >= 1<<flt.expbits-1 {
- // ±Inf
- mant = 0
- exp = 1<<flt.expbits - 1 + flt.bias
- overflow = true
- } else if mant&(1<<flt.mantbits) == 0 {
- // Denormalized?
- exp = flt.bias
- }
- // Assemble bits.
- bits = mant & (uint64(1)<<flt.mantbits - 1)
- bits |= uint64((exp-flt.bias)&(1<<flt.expbits-1)) << flt.mantbits
- if f.neg {
- bits |= 1 << (flt.mantbits + flt.expbits)
- }
- return
-}
-
-// AssignComputeBounds sets f to the floating point value
-// defined by mant, exp and precision given by flt. It returns
-// lower, upper such that any number in the closed interval
-// [lower, upper] is converted back to the same floating point number.
-func (f *extFloat) AssignComputeBounds(mant uint64, exp int, neg bool, flt *floatInfo) (lower, upper extFloat) {
- f.mant = mant
- f.exp = exp - int(flt.mantbits)
- f.neg = neg
- if f.exp <= 0 && mant == (mant>>uint(-f.exp))<<uint(-f.exp) {
- // An exact integer
- f.mant >>= uint(-f.exp)
- f.exp = 0
- return *f, *f
- }
- expBiased := exp - flt.bias
-
- upper = extFloat{mant: 2*f.mant + 1, exp: f.exp - 1, neg: f.neg}
- if mant != 1<<flt.mantbits || expBiased == 1 {
- lower = extFloat{mant: 2*f.mant - 1, exp: f.exp - 1, neg: f.neg}
- } else {
- lower = extFloat{mant: 4*f.mant - 1, exp: f.exp - 2, neg: f.neg}
- }
- return
-}
-
-// Normalize normalizes f so that the highest bit of the mantissa is
-// set, and returns the number by which the mantissa was left-shifted.
-func (f *extFloat) Normalize() (shift uint) {
- mant, exp := f.mant, f.exp
- if mant == 0 {
- return 0
- }
- if mant>>(64-32) == 0 {
- mant <<= 32
- exp -= 32
- }
- if mant>>(64-16) == 0 {
- mant <<= 16
- exp -= 16
- }
- if mant>>(64-8) == 0 {
- mant <<= 8
- exp -= 8
- }
- if mant>>(64-4) == 0 {
- mant <<= 4
- exp -= 4
- }
- if mant>>(64-2) == 0 {
- mant <<= 2
- exp -= 2
- }
- if mant>>(64-1) == 0 {
- mant <<= 1
- exp -= 1
- }
- shift = uint(f.exp - exp)
- f.mant, f.exp = mant, exp
- return
-}
-
-// Multiply sets f to the product f*g: the result is correctly rounded,
-// but not normalized.
-func (f *extFloat) Multiply(g extFloat) {
- fhi, flo := f.mant>>32, uint64(uint32(f.mant))
- ghi, glo := g.mant>>32, uint64(uint32(g.mant))
-
- // Cross products.
- cross1 := fhi * glo
- cross2 := flo * ghi
-
- // f.mant*g.mant is fhi*ghi << 64 + (cross1+cross2) << 32 + flo*glo
- f.mant = fhi*ghi + (cross1 >> 32) + (cross2 >> 32)
- rem := uint64(uint32(cross1)) + uint64(uint32(cross2)) + ((flo * glo) >> 32)
- // Round up.
- rem += (1 << 31)
-
- f.mant += (rem >> 32)
- f.exp = f.exp + g.exp + 64
-}
-
-var uint64pow10 = [...]uint64{
- 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
- 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
-}
-
-// AssignDecimal sets f to an approximate value mantissa*10^exp. It
-// reports whether the value represented by f is guaranteed to be the
-// best approximation of d after being rounded to a float64 or
-// float32 depending on flt.
-func (f *extFloat) AssignDecimal(mantissa uint64, exp10 int, neg bool, trunc bool, flt *floatInfo) (ok bool) {
- const uint64digits = 19
- const errorscale = 8
- errors := 0 // An upper bound for error, computed in errorscale*ulp.
- if trunc {
- // the decimal number was truncated.
- errors += errorscale / 2
- }
-
- f.mant = mantissa
- f.exp = 0
- f.neg = neg
-
- // Multiply by powers of ten.
- i := (exp10 - firstPowerOfTen) / stepPowerOfTen
- if exp10 < firstPowerOfTen || i >= len(powersOfTen) {
- return false
- }
- adjExp := (exp10 - firstPowerOfTen) % stepPowerOfTen
-
- // We multiply by exp%step
- if adjExp < uint64digits && mantissa < uint64pow10[uint64digits-adjExp] {
- // We can multiply the mantissa exactly.
- f.mant *= uint64pow10[adjExp]
- f.Normalize()
- } else {
- f.Normalize()
- f.Multiply(smallPowersOfTen[adjExp])
- errors += errorscale / 2
- }
-
- // We multiply by 10 to the exp - exp%step.
- f.Multiply(powersOfTen[i])
- if errors > 0 {
- errors += 1
- }
- errors += errorscale / 2
-
- // Normalize
- shift := f.Normalize()
- errors <<= shift
-
- // Now f is a good approximation of the decimal.
- // Check whether the error is too large: that is, if the mantissa
- // is perturbated by the error, the resulting float64 will change.
- // The 64 bits mantissa is 1 + 52 bits for float64 + 11 extra bits.
- //
- // In many cases the approximation will be good enough.
- denormalExp := flt.bias - 63
- var extrabits uint
- if f.exp <= denormalExp {
- // f.mant * 2^f.exp is smaller than 2^(flt.bias+1).
- extrabits = 63 - flt.mantbits + 1 + uint(denormalExp-f.exp)
- } else {
- extrabits = 63 - flt.mantbits
- }
-
- halfway := uint64(1) << (extrabits - 1)
- mant_extra := f.mant & (1<<extrabits - 1)
-
- // Do a signed comparison here! If the error estimate could make
- // the mantissa round differently for the conversion to double,
- // then we can't give a definite answer.
- if int64(halfway)-int64(errors) < int64(mant_extra) &&
- int64(mant_extra) < int64(halfway)+int64(errors) {
- return false
- }
- return true
-}
-
-// Frexp10 is an analogue of math.Frexp for decimal powers. It scales
-// f by an approximate power of ten 10^-exp, and returns exp10, so
-// that f*10^exp10 has the same value as the old f, up to an ulp,
-// as well as the index of 10^-exp in the powersOfTen table.
-func (f *extFloat) frexp10() (exp10, index int) {
- // The constants expMin and expMax constrain the final value of the
- // binary exponent of f. We want a small integral part in the result
- // because finding digits of an integer requires divisions, whereas
- // digits of the fractional part can be found by repeatedly multiplying
- // by 10.
- const expMin = -60
- const expMax = -32
- // Find power of ten such that x * 10^n has a binary exponent
- // between expMin and expMax.
- approxExp10 := ((expMin+expMax)/2 - f.exp) * 28 / 93 // log(10)/log(2) is close to 93/28.
- i := (approxExp10 - firstPowerOfTen) / stepPowerOfTen
-Loop:
- for {
- exp := f.exp + powersOfTen[i].exp + 64
- switch {
- case exp < expMin:
- i++
- case exp > expMax:
- i--
- default:
- break Loop
- }
- }
- // Apply the desired decimal shift on f. It will have exponent
- // in the desired range. This is multiplication by 10^-exp10.
- f.Multiply(powersOfTen[i])
-
- return -(firstPowerOfTen + i*stepPowerOfTen), i
-}
-
-// frexp10Many applies a common shift by a power of ten to a, b, c.
-func frexp10Many(a, b, c *extFloat) (exp10 int) {
- exp10, i := c.frexp10()
- a.Multiply(powersOfTen[i])
- b.Multiply(powersOfTen[i])
- return
-}
-
-// FixedDecimal stores in d the first n significant digits
-// of the decimal representation of f. It returns false
-// if it cannot be sure of the answer.
-func (f *extFloat) FixedDecimal(d *decimalSlice, n int) bool {
- if f.mant == 0 {
- d.nd = 0
- d.dp = 0
- d.neg = f.neg
- return true
- }
- if n == 0 {
- panic("strconv: internal error: extFloat.FixedDecimal called with n == 0")
- }
- // Multiply by an appropriate power of ten to have a reasonable
- // number to process.
- f.Normalize()
- exp10, _ := f.frexp10()
-
- shift := uint(-f.exp)
- integer := uint32(f.mant >> shift)
- fraction := f.mant - (uint64(integer) << shift)
- ε := uint64(1) // ε is the uncertainty we have on the mantissa of f.
-
- // Write exactly n digits to d.
- needed := n // how many digits are left to write.
- integerDigits := 0 // the number of decimal digits of integer.
- pow10 := uint64(1) // the power of ten by which f was scaled.
- for i, pow := 0, uint64(1); i < 20; i++ {
- if pow > uint64(integer) {
- integerDigits = i
- break
- }
- pow *= 10
- }
- rest := integer
- if integerDigits > needed {
- // the integral part is already large, trim the last digits.
- pow10 = uint64pow10[integerDigits-needed]
- integer /= uint32(pow10)
- rest -= integer * uint32(pow10)
- } else {
- rest = 0
- }
-
- // Write the digits of integer: the digits of rest are omitted.
- var buf [32]byte
- pos := len(buf)
- for v := integer; v > 0; {
- v1 := v / 10
- v -= 10 * v1
- pos--
- buf[pos] = byte(v + '0')
- v = v1
- }
- for i := pos; i < len(buf); i++ {
- d.d[i-pos] = buf[i]
- }
- nd := len(buf) - pos
- d.nd = nd
- d.dp = integerDigits + exp10
- needed -= nd
-
- if needed > 0 {
- if rest != 0 || pow10 != 1 {
- panic("strconv: internal error, rest != 0 but needed > 0")
- }
- // Emit digits for the fractional part. Each time, 10*fraction
- // fits in a uint64 without overflow.
- for needed > 0 {
- fraction *= 10
- ε *= 10 // the uncertainty scales as we multiply by ten.
- if 2*ε > 1<<shift {
- // the error is so large it could modify which digit to write, abort.
- return false
- }
- digit := fraction >> shift
- d.d[nd] = byte(digit + '0')
- fraction -= digit << shift
- nd++
- needed--
- }
- d.nd = nd
- }
-
- // We have written a truncation of f (a numerator / 10^d.dp). The remaining part
- // can be interpreted as a small number (< 1) to be added to the last digit of the
- // numerator.
- //
- // If rest > 0, the amount is:
- // (rest<<shift | fraction) / (pow10 << shift)
- // fraction being known with a ±ε uncertainty.
- // The fact that n > 0 guarantees that pow10 << shift does not overflow a uint64.
- //
- // If rest = 0, pow10 == 1 and the amount is
- // fraction / (1 << shift)
- // fraction being known with a ±ε uncertainty.
- //
- // We pass this information to the rounding routine for adjustment.
-
- ok := adjustLastDigitFixed(d, uint64(rest)<<shift|fraction, pow10, shift, ε)
- if !ok {
- return false
- }
- // Trim trailing zeros.
- for i := d.nd - 1; i >= 0; i-- {
- if d.d[i] != '0' {
- d.nd = i + 1
- break
- }
- }
- return true
-}
-
-// adjustLastDigitFixed assumes d contains the representation of the integral part
-// of some number, whose fractional part is num / (den << shift). The numerator
-// num is only known up to an uncertainty of size ε, assumed to be less than
-// (den << shift)/2.
-//
-// It will increase the last digit by one to account for correct rounding, typically
-// when the fractional part is greater than 1/2, and will return false if ε is such
-// that no correct answer can be given.
-func adjustLastDigitFixed(d *decimalSlice, num, den uint64, shift uint, ε uint64) bool {
- if num > den<<shift {
- panic("strconv: num > den<<shift in adjustLastDigitFixed")
- }
- if 2*ε > den<<shift {
- panic("strconv: ε > (den<<shift)/2")
- }
- if 2*(num+ε) < den<<shift {
- return true
- }
- if 2*(num-ε) > den<<shift {
- // increment d by 1.
- i := d.nd - 1
- for ; i >= 0; i-- {
- if d.d[i] == '9' {
- d.nd--
- } else {
- break
- }
- }
- if i < 0 {
- d.d[0] = '1'
- d.nd = 1
- d.dp++
- } else {
- d.d[i]++
- }
- return true
- }
- return false
-}
-
-// ShortestDecimal stores in d the shortest decimal representation of f
-// which belongs to the open interval (lower, upper), where f is supposed
-// to lie. It returns false whenever the result is unsure. The implementation
-// uses the Grisu3 algorithm.
-func (f *extFloat) ShortestDecimal(d *decimalSlice, lower, upper *extFloat) bool {
- if f.mant == 0 {
- d.nd = 0
- d.dp = 0
- d.neg = f.neg
- return true
- }
- if f.exp == 0 && *lower == *f && *lower == *upper {
- // an exact integer.
- var buf [24]byte
- n := len(buf) - 1
- for v := f.mant; v > 0; {
- v1 := v / 10
- v -= 10 * v1
- buf[n] = byte(v + '0')
- n--
- v = v1
- }
- nd := len(buf) - n - 1
- for i := 0; i < nd; i++ {
- d.d[i] = buf[n+1+i]
- }
- d.nd, d.dp = nd, nd
- for d.nd > 0 && d.d[d.nd-1] == '0' {
- d.nd--
- }
- if d.nd == 0 {
- d.dp = 0
- }
- d.neg = f.neg
- return true
- }
- upper.Normalize()
- // Uniformize exponents.
- if f.exp > upper.exp {
- f.mant <<= uint(f.exp - upper.exp)
- f.exp = upper.exp
- }
- if lower.exp > upper.exp {
- lower.mant <<= uint(lower.exp - upper.exp)
- lower.exp = upper.exp
- }
-
- exp10 := frexp10Many(lower, f, upper)
- // Take a safety margin due to rounding in frexp10Many, but we lose precision.
- upper.mant++
- lower.mant--
-
- // The shortest representation of f is either rounded up or down, but
- // in any case, it is a truncation of upper.
- shift := uint(-upper.exp)
- integer := uint32(upper.mant >> shift)
- fraction := upper.mant - (uint64(integer) << shift)
-
- // How far we can go down from upper until the result is wrong.
- allowance := upper.mant - lower.mant
- // How far we should go to get a very precise result.
- targetDiff := upper.mant - f.mant
-
- // Count integral digits: there are at most 10.
- var integerDigits int
- for i, pow := 0, uint64(1); i < 20; i++ {
- if pow > uint64(integer) {
- integerDigits = i
- break
- }
- pow *= 10
- }
- for i := 0; i < integerDigits; i++ {
- pow := uint64pow10[integerDigits-i-1]
- digit := integer / uint32(pow)
- d.d[i] = byte(digit + '0')
- integer -= digit * uint32(pow)
- // evaluate whether we should stop.
- if currentDiff := uint64(integer)<<shift + fraction; currentDiff < allowance {
- d.nd = i + 1
- d.dp = integerDigits + exp10
- d.neg = f.neg
- // Sometimes allowance is so large the last digit might need to be
- // decremented to get closer to f.
- return adjustLastDigit(d, currentDiff, targetDiff, allowance, pow<<shift, 2)
- }
- }
- d.nd = integerDigits
- d.dp = d.nd + exp10
- d.neg = f.neg
-
- // Compute digits of the fractional part. At each step fraction does not
- // overflow. The choice of minExp implies that fraction is less than 2^60.
- var digit int
- multiplier := uint64(1)
- for {
- fraction *= 10
- multiplier *= 10
- digit = int(fraction >> shift)
- d.d[d.nd] = byte(digit + '0')
- d.nd++
- fraction -= uint64(digit) << shift
- if fraction < allowance*multiplier {
- // We are in the admissible range. Note that if allowance is about to
- // overflow, that is, allowance > 2^64/10, the condition is automatically
- // true due to the limited range of fraction.
- return adjustLastDigit(d,
- fraction, targetDiff*multiplier, allowance*multiplier,
- 1<<shift, multiplier*2)
- }
- }
-}
-
-// adjustLastDigit modifies d = x-currentDiff*ε, to get closest to
-// d = x-targetDiff*ε, without becoming smaller than x-maxDiff*ε.
-// It assumes that a decimal digit is worth ulpDecimal*ε, and that
-// all data is known with a error estimate of ulpBinary*ε.
-func adjustLastDigit(d *decimalSlice, currentDiff, targetDiff, maxDiff, ulpDecimal, ulpBinary uint64) bool {
- if ulpDecimal < 2*ulpBinary {
- // Approximation is too wide.
- return false
- }
- for currentDiff+ulpDecimal/2+ulpBinary < targetDiff {
- d.d[d.nd-1]--
- currentDiff += ulpDecimal
- }
- if currentDiff+ulpDecimal <= targetDiff+ulpDecimal/2+ulpBinary {
- // we have two choices, and don't know what to do.
- return false
- }
- if currentDiff < ulpBinary || currentDiff > maxDiff-ulpBinary {
- // we went too far
- return false
- }
- if d.nd == 1 && d.d[0] == '0' {
- // the number has actually reached zero.
- d.nd = 0
- d.dp = 0
- }
- return true
-}
diff --git a/vendor/golang.org/x/text/internal/number/ftoa.go b/vendor/golang.org/x/text/internal/number/ftoa.go
deleted file mode 100644
index 073182ece..000000000
--- a/vendor/golang.org/x/text/internal/number/ftoa.go
+++ /dev/null
@@ -1,448 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// TODO: use build tags once a low-level public API has been established in
-// package strconv.
-
-// Binary to decimal floating point conversion.
-// Algorithm:
-// 1) store mantissa in multiprecision decimal
-// 2) shift decimal by exponent
-// 3) read digits out & format
-
-package number
-
-import "math"
-
-var optimize = true
-
-// TODO: move elsewhere?
-type floatInfo struct {
- mantbits uint
- expbits uint
- bias int
-}
-
-var float32info = floatInfo{23, 8, -127}
-var float64info = floatInfo{52, 11, -1023}
-
-// genericFtoa converts the floating-point number f to a string,
-// according to the format fmt and precision prec. It rounds the
-// result assuming that the original was obtained from a floating-point
-// value of bitSize bits (32 for float32, 64 for float64).
-//
-// The format fmt is one of
-// 'b' (-ddddp±ddd, a binary exponent),
-// 'e' (-d.dddde±dd, a decimal exponent),
-// 'E' (-d.ddddE±dd, a decimal exponent),
-// 'f' (-ddd.dddd, no exponent),
-// 'g' ('e' for large exponents, 'f' otherwise), or
-// 'G' ('E' for large exponents, 'f' otherwise).
-//
-// The precision prec controls the number of digits
-// (excluding the exponent) printed by the 'e', 'E', 'f', 'g', and 'G' formats.
-// For 'e', 'E', and 'f' it is the number of digits after the decimal point.
-// For 'g' and 'G' it is the total number of digits.
-// The special precision -1 uses the smallest number of digits
-// necessary such that ParseFloat will return f exactly.
-func genericFtoa(dst []byte, val float64, fmt byte, prec, bitSize int) []byte {
- var bits uint64
- var flt *floatInfo
- switch bitSize {
- case 32:
- bits = uint64(math.Float32bits(float32(val)))
- flt = &float32info
- case 64:
- bits = math.Float64bits(val)
- flt = &float64info
- default:
- panic("strconv: illegal AppendFloat/FormatFloat bitSize")
- }
-
- neg := bits>>(flt.expbits+flt.mantbits) != 0
- exp := int(bits>>flt.mantbits) & (1<<flt.expbits - 1)
- mant := bits & (uint64(1)<<flt.mantbits - 1)
-
- switch exp {
- case 1<<flt.expbits - 1:
- // Inf, NaN
- var s string
- switch {
- case mant != 0:
- s = "NaN"
- case neg:
- s = "-Inf"
- default:
- s = "+Inf"
- }
- return append(dst, s...)
-
- case 0:
- // denormalized
- exp++
-
- default:
- // add implicit top bit
- mant |= uint64(1) << flt.mantbits
- }
- exp += flt.bias
-
- // Pick off easy binary format.
- if fmt == 'b' {
- return fmtB(dst, neg, mant, exp, flt)
- }
-
- if !optimize {
- return bigFtoa(dst, prec, fmt, neg, mant, exp, flt)
- }
-
- var digs decimalSlice
- ok := false
- // Negative precision means "only as much as needed to be exact."
- shortest := prec < 0
- if shortest {
- // Try Grisu3 algorithm.
- f := new(extFloat)
- lower, upper := f.AssignComputeBounds(mant, exp, neg, flt)
- var buf [32]byte
- digs.d = buf[:]
- ok = f.ShortestDecimal(&digs, &lower, &upper)
- if !ok {
- return bigFtoa(dst, prec, fmt, neg, mant, exp, flt)
- }
- // Precision for shortest representation mode.
- switch fmt {
- case 'e', 'E':
- prec = max(digs.nd-1, 0)
- case 'f':
- prec = max(digs.nd-digs.dp, 0)
- case 'g', 'G':
- prec = digs.nd
- }
- } else if fmt != 'f' {
- // Fixed number of digits.
- digits := prec
- switch fmt {
- case 'e', 'E':
- digits++
- case 'g', 'G':
- if prec == 0 {
- prec = 1
- }
- digits = prec
- }
- if digits <= 15 {
- // try fast algorithm when the number of digits is reasonable.
- var buf [24]byte
- digs.d = buf[:]
- f := extFloat{mant, exp - int(flt.mantbits), neg}
- ok = f.FixedDecimal(&digs, digits)
- }
- }
- if !ok {
- return bigFtoa(dst, prec, fmt, neg, mant, exp, flt)
- }
- return formatDigits(dst, shortest, neg, digs, prec, fmt)
-}
-
-// bigFtoa uses multiprecision computations to format a float.
-func bigFtoa(dst []byte, prec int, fmt byte, neg bool, mant uint64, exp int, flt *floatInfo) []byte {
- d := new(decimal)
- d.Assign(mant)
- d.Shift(exp - int(flt.mantbits))
- var digs decimalSlice
- shortest := prec < 0
- if shortest {
- roundShortest(d, mant, exp, flt)
- digs = decimalSlice{d: d.d[:], nd: d.nd, dp: d.dp}
- // Precision for shortest representation mode.
- switch fmt {
- case 'e', 'E':
- prec = digs.nd - 1
- case 'f':
- prec = max(digs.nd-digs.dp, 0)
- case 'g', 'G':
- prec = digs.nd
- }
- } else {
- // Round appropriately.
- switch fmt {
- case 'e', 'E':
- d.Round(prec + 1)
- case 'f':
- d.Round(d.dp + prec)
- case 'g', 'G':
- if prec == 0 {
- prec = 1
- }
- d.Round(prec)
- }
- digs = decimalSlice{d: d.d[:], nd: d.nd, dp: d.dp}
- }
- return formatDigits(dst, shortest, neg, digs, prec, fmt)
-}
-
-func formatDigits(dst []byte, shortest bool, neg bool, digs decimalSlice, prec int, fmt byte) []byte {
- switch fmt {
- case 'e', 'E':
- return fmtE(dst, neg, digs, prec, fmt)
- case 'f':
- return fmtF(dst, neg, digs, prec)
- case 'g', 'G':
- // trailing fractional zeros in 'e' form will be trimmed.
- eprec := prec
- if eprec > digs.nd && digs.nd >= digs.dp {
- eprec = digs.nd
- }
- // %e is used if the exponent from the conversion
- // is less than -4 or greater than or equal to the precision.
- // if precision was the shortest possible, use precision 6 for this decision.
- if shortest {
- eprec = 6
- }
- exp := digs.dp - 1
- if exp < -4 || exp >= eprec {
- if prec > digs.nd {
- prec = digs.nd
- }
- return fmtE(dst, neg, digs, prec-1, fmt+'e'-'g')
- }
- if prec > digs.dp {
- prec = digs.nd
- }
- return fmtF(dst, neg, digs, max(prec-digs.dp, 0))
- }
-
- // unknown format
- return append(dst, '%', fmt)
-}
-
-// roundShortest rounds d (= mant * 2^exp) to the shortest number of digits
-// that will let the original floating point value be precisely reconstructed.
-func roundShortest(d *decimal, mant uint64, exp int, flt *floatInfo) {
- // If mantissa is zero, the number is zero; stop now.
- if mant == 0 {
- d.nd = 0
- return
- }
-
- // Compute upper and lower such that any decimal number
- // between upper and lower (possibly inclusive)
- // will round to the original floating point number.
-
- // We may see at once that the number is already shortest.
- //
- // Suppose d is not denormal, so that 2^exp <= d < 10^dp.
- // The closest shorter number is at least 10^(dp-nd) away.
- // The lower/upper bounds computed below are at distance
- // at most 2^(exp-mantbits).
- //
- // So the number is already shortest if 10^(dp-nd) > 2^(exp-mantbits),
- // or equivalently log2(10)*(dp-nd) > exp-mantbits.
- // It is true if 332/100*(dp-nd) >= exp-mantbits (log2(10) > 3.32).
- minexp := flt.bias + 1 // minimum possible exponent
- if exp > minexp && 332*(d.dp-d.nd) >= 100*(exp-int(flt.mantbits)) {
- // The number is already shortest.
- return
- }
-
- // d = mant << (exp - mantbits)
- // Next highest floating point number is mant+1 << exp-mantbits.
- // Our upper bound is halfway between, mant*2+1 << exp-mantbits-1.
- upper := new(decimal)
- upper.Assign(mant*2 + 1)
- upper.Shift(exp - int(flt.mantbits) - 1)
-
- // d = mant << (exp - mantbits)
- // Next lowest floating point number is mant-1 << exp-mantbits,
- // unless mant-1 drops the significant bit and exp is not the minimum exp,
- // in which case the next lowest is mant*2-1 << exp-mantbits-1.
- // Either way, call it mantlo << explo-mantbits.
- // Our lower bound is halfway between, mantlo*2+1 << explo-mantbits-1.
- var mantlo uint64
- var explo int
- if mant > 1<<flt.mantbits || exp == minexp {
- mantlo = mant - 1
- explo = exp
- } else {
- mantlo = mant*2 - 1
- explo = exp - 1
- }
- lower := new(decimal)
- lower.Assign(mantlo*2 + 1)
- lower.Shift(explo - int(flt.mantbits) - 1)
-
- // The upper and lower bounds are possible outputs only if
- // the original mantissa is even, so that IEEE round-to-even
- // would round to the original mantissa and not the neighbors.
- inclusive := mant%2 == 0
-
- // Now we can figure out the minimum number of digits required.
- // Walk along until d has distinguished itself from upper and lower.
- for i := 0; i < d.nd; i++ {
- l := byte('0') // lower digit
- if i < lower.nd {
- l = lower.d[i]
- }
- m := d.d[i] // middle digit
- u := byte('0') // upper digit
- if i < upper.nd {
- u = upper.d[i]
- }
-
- // Okay to round down (truncate) if lower has a different digit
- // or if lower is inclusive and is exactly the result of rounding
- // down (i.e., and we have reached the final digit of lower).
- okdown := l != m || inclusive && i+1 == lower.nd
-
- // Okay to round up if upper has a different digit and either upper
- // is inclusive or upper is bigger than the result of rounding up.
- okup := m != u && (inclusive || m+1 < u || i+1 < upper.nd)
-
- // If it's okay to do either, then round to the nearest one.
- // If it's okay to do only one, do it.
- switch {
- case okdown && okup:
- d.Round(i + 1)
- return
- case okdown:
- d.RoundDown(i + 1)
- return
- case okup:
- d.RoundUp(i + 1)
- return
- }
- }
-}
-
-type decimalSlice struct {
- d []byte
- nd, dp int
- neg bool
-}
-
-// %e: -d.ddddde±dd
-func fmtE(dst []byte, neg bool, d decimalSlice, prec int, fmt byte) []byte {
- // sign
- if neg {
- dst = append(dst, '-')
- }
-
- // first digit
- ch := byte('0')
- if d.nd != 0 {
- ch = d.d[0]
- }
- dst = append(dst, ch)
-
- // .moredigits
- if prec > 0 {
- dst = append(dst, '.')
- i := 1
- m := min(d.nd, prec+1)
- if i < m {
- dst = append(dst, d.d[i:m]...)
- i = m
- }
- for ; i <= prec; i++ {
- dst = append(dst, '0')
- }
- }
-
- // e±
- dst = append(dst, fmt)
- exp := d.dp - 1
- if d.nd == 0 { // special case: 0 has exponent 0
- exp = 0
- }
- if exp < 0 {
- ch = '-'
- exp = -exp
- } else {
- ch = '+'
- }
- dst = append(dst, ch)
-
- // dd or ddd
- switch {
- case exp < 10:
- dst = append(dst, '0', byte(exp)+'0')
- case exp < 100:
- dst = append(dst, byte(exp/10)+'0', byte(exp%10)+'0')
- default:
- dst = append(dst, byte(exp/100)+'0', byte(exp/10)%10+'0', byte(exp%10)+'0')
- }
-
- return dst
-}
-
-// %f: -ddddddd.ddddd
-func fmtF(dst []byte, neg bool, d decimalSlice, prec int) []byte {
- // sign
- if neg {
- dst = append(dst, '-')
- }
-
- // integer, padded with zeros as needed.
- if d.dp > 0 {
- m := min(d.nd, d.dp)
- dst = append(dst, d.d[:m]...)
- for ; m < d.dp; m++ {
- dst = append(dst, '0')
- }
- } else {
- dst = append(dst, '0')
- }
-
- // fraction
- if prec > 0 {
- dst = append(dst, '.')
- for i := 0; i < prec; i++ {
- ch := byte('0')
- if j := d.dp + i; 0 <= j && j < d.nd {
- ch = d.d[j]
- }
- dst = append(dst, ch)
- }
- }
-
- return dst
-}
-
-// %b: -ddddddddp±ddd
-func fmtB(dst []byte, neg bool, mant uint64, exp int, flt *floatInfo) []byte {
- // sign
- if neg {
- dst = append(dst, '-')
- }
-
- // mantissa
- dst, _ = formatBits(dst, mant, 10, false, true)
-
- // p
- dst = append(dst, 'p')
-
- // ±exponent
- exp -= int(flt.mantbits)
- if exp >= 0 {
- dst = append(dst, '+')
- }
- dst, _ = formatBits(dst, uint64(exp), 10, exp < 0, true)
-
- return dst
-}
-
-func min(a, b int) int {
- if a < b {
- return a
- }
- return b
-}
-
-func max(a, b int) int {
- if a > b {
- return a
- }
- return b
-}
diff --git a/vendor/golang.org/x/text/internal/number/gen.go b/vendor/golang.org/x/text/internal/number/gen.go
index 0d5f592df..598c96c6f 100644
--- a/vendor/golang.org/x/text/internal/number/gen.go
+++ b/vendor/golang.org/x/text/internal/number/gen.go
@@ -45,7 +45,7 @@ func main() {
d := &cldr.Decoder{}
d.SetDirFilter("supplemental", "main")
- d.SetSectionFilter("numbers", "numberingSystem", "plurals")
+ d.SetSectionFilter("numbers", "numberingSystem")
data, err := d.DecodeZip(r)
if err != nil {
log.Fatalf("DecodeZip: %v", err)
@@ -60,15 +60,7 @@ func main() {
genNumSystem(w, data)
genSymbols(w, data)
- genPlurals(w, data)
genFormats(w, data)
-
- w = gen.NewCodeWriter()
- defer w.WriteGoFile(*outputTestFile, pkg)
-
- fmt.Fprintln(w, `import "golang.org/x/text/internal/format/plural"`)
-
- genPluralsTests(w, data)
}
var systemMap = map[string]system{"latn": 0}
diff --git a/vendor/golang.org/x/text/internal/number/gen_common.go b/vendor/golang.org/x/text/internal/number/gen_common.go
index b0c71c5eb..c4b791ce9 100644
--- a/vendor/golang.org/x/text/internal/number/gen_common.go
+++ b/vendor/golang.org/x/text/internal/number/gen_common.go
@@ -6,11 +6,7 @@
package main
-import (
- "unicode/utf8"
-
- "golang.org/x/text/internal/format/plural"
-)
+import "unicode/utf8"
// A system identifies a CLDR numbering system.
type system byte
@@ -46,51 +42,3 @@ type altSymData struct {
system system
symIndex byte
}
-
-var countMap = map[string]plural.Form{
- "other": plural.Other,
- "zero": plural.Zero,
- "one": plural.One,
- "two": plural.Two,
- "few": plural.Few,
- "many": plural.Many,
-}
-
-type pluralCheck struct {
- // category:
- // 3..7: opID
- // 0..2: category
- cat byte
- setID byte
-}
-
-// opID identifies the type of operand in the plural rule, being i, n or f.
-// (v, w, and t are treated as filters in our implementation.)
-type opID byte
-
-const (
- opMod opID = 0x1 // is '%' used?
- opNotEqual opID = 0x2 // using "!=" to compare
- opI opID = 0 << 2 // integers after taking the absolute value
- opN opID = 1 << 2 // full number (must be integer)
- opF opID = 2 << 2 // fraction
- opV opID = 3 << 2 // number of visible digits
- opW opID = 4 << 2 // number of visible digits without trailing zeros
- opBretonM opID = 5 << 2 // hard-wired rule for Breton
- opItalian800 opID = 6 << 2 // hard-wired rule for Italian
- opAzerbaijan00s opID = 7 << 2 // hard-wired rule for Azerbaijan
-)
-const (
- // Use this plural form to indicate the next rule needs to match as well.
- // The last condition in the list will have the correct plural form.
- andNext = 0x7
- formMask = 0x7
-
- opShift = 3
-
- // numN indicates the maximum integer, or maximum mod value, for which we
- // have inclusion masks.
- numN = 100
- // The common denominator of the modulo that is taken.
- maxMod = 100
-)
diff --git a/vendor/golang.org/x/text/internal/number/itoa.go b/vendor/golang.org/x/text/internal/number/itoa.go
deleted file mode 100644
index a459a6b7e..000000000
--- a/vendor/golang.org/x/text/internal/number/itoa.go
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// TODO: use build tags once a low-level public API has been established in
-// package strconv.
-
-package number
-
-const (
- digits = "0123456789abcdefghijklmnopqrstuvwxyz"
-)
-
-var shifts = [len(digits) + 1]uint{
- 1 << 1: 1,
- 1 << 2: 2,
- 1 << 3: 3,
- 1 << 4: 4,
- 1 << 5: 5,
-}
-
-// formatBits computes the string representation of u in the given base.
-// If neg is set, u is treated as negative int64 value. If append_ is
-// set, the string is appended to dst and the resulting byte slice is
-// returned as the first result value; otherwise the string is returned
-// as the second result value.
-//
-func formatBits(dst []byte, u uint64, base int, neg, append_ bool) (d []byte, s string) {
- if base < 2 || base > len(digits) {
- panic("strconv: illegal AppendInt/FormatInt base")
- }
- // 2 <= base && base <= len(digits)
-
- var a [64 + 1]byte // +1 for sign of 64bit value in base 2
- i := len(a)
-
- if neg {
- u = -u
- }
-
- // convert bits
- if base == 10 {
- // common case: use constants for / because
- // the compiler can optimize it into a multiply+shift
-
- if ^uintptr(0)>>32 == 0 {
- for u > uint64(^uintptr(0)) {
- q := u / 1e9
- us := uintptr(u - q*1e9) // us % 1e9 fits into a uintptr
- for j := 9; j > 0; j-- {
- i--
- qs := us / 10
- a[i] = byte(us - qs*10 + '0')
- us = qs
- }
- u = q
- }
- }
-
- // u guaranteed to fit into a uintptr
- us := uintptr(u)
- for us >= 10 {
- i--
- q := us / 10
- a[i] = byte(us - q*10 + '0')
- us = q
- }
- // u < 10
- i--
- a[i] = byte(us + '0')
-
- } else if s := shifts[base]; s > 0 {
- // base is power of 2: use shifts and masks instead of / and %
- b := uint64(base)
- m := uintptr(b) - 1 // == 1<<s - 1
- for u >= b {
- i--
- a[i] = digits[uintptr(u)&m]
- u >>= s
- }
- // u < base
- i--
- a[i] = digits[uintptr(u)]
-
- } else {
- // general case
- b := uint64(base)
- for u >= b {
- i--
- q := u / b
- a[i] = digits[uintptr(u-q*b)]
- u = q
- }
- // u < base
- i--
- a[i] = digits[uintptr(u)]
- }
-
- // add sign, if any
- if neg {
- i--
- a[i] = '-'
- }
-
- if append_ {
- d = append(dst, a[i:]...)
- return
- }
- s = string(a[i:])
- return
-}
diff --git a/vendor/golang.org/x/text/internal/number/number.go b/vendor/golang.org/x/text/internal/number/number.go
index d412194f4..34f4477d0 100644
--- a/vendor/golang.org/x/text/internal/number/number.go
+++ b/vendor/golang.org/x/text/internal/number/number.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate go run gen.go gen_common.go gen_plural.go
+//go:generate go run gen.go gen_common.go
// Package number contains tools and data for formatting numbers.
package number
diff --git a/vendor/golang.org/x/text/internal/number/plural.go b/vendor/golang.org/x/text/internal/number/plural.go
deleted file mode 100644
index 5714e1128..000000000
--- a/vendor/golang.org/x/text/internal/number/plural.go
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package number
-
-import "golang.org/x/text/internal/format/plural"
-
-type pluralRules struct {
- rules []pluralCheck
- index []byte
- langToIndex []byte
- inclusionMasks []uint64
-}
-
-var (
- ordinalData = pluralRules{
- ordinalRules,
- ordinalIndex,
- ordinalLangToIndex,
- ordinalInclusionMasks[:],
- }
- cardinalData = pluralRules{
- cardinalRules,
- cardinalIndex,
- cardinalLangToIndex,
- cardinalInclusionMasks[:],
- }
-)
-
-// See gen_plural.go for an explanation of the algorithm.
-
-func matchPlural(p *pluralRules, index int, n, f, v int) plural.Form {
- nMask := p.inclusionMasks[n%maxMod]
- // Compute the fMask inline in the rules below, as it is relatively rare.
- // fMask := p.inclusionMasks[f%maxMod]
- vMask := p.inclusionMasks[v%maxMod]
-
- // Do the matching
- offset := p.langToIndex[index]
- rules := p.rules[p.index[offset]:p.index[offset+1]]
- for i := 0; i < len(rules); i++ {
- rule := rules[i]
- setBit := uint64(1 << rule.setID)
- var skip bool
- switch op := opID(rule.cat >> opShift); op {
- case opI: // i = x
- skip = n >= numN || nMask&setBit == 0
-
- case opI | opNotEqual: // i != x
- skip = n < numN && nMask&setBit != 0
-
- case opI | opMod: // i % m = x
- skip = nMask&setBit == 0
-
- case opI | opMod | opNotEqual: // i % m != x
- skip = nMask&setBit != 0
-
- case opN: // n = x
- skip = f != 0 || n >= numN || nMask&setBit == 0
-
- case opN | opNotEqual: // n != x
- skip = f == 0 && n < numN && nMask&setBit != 0
-
- case opN | opMod: // n % m = x
- skip = f != 0 || nMask&setBit == 0
-
- case opN | opMod | opNotEqual: // n % m != x
- skip = f == 0 && nMask&setBit != 0
-
- case opF: // f = x
- skip = f >= numN || p.inclusionMasks[f%maxMod]&setBit == 0
-
- case opF | opNotEqual: // f != x
- skip = f < numN && p.inclusionMasks[f%maxMod]&setBit != 0
-
- case opF | opMod: // f % m = x
- skip = p.inclusionMasks[f%maxMod]&setBit == 0
-
- case opF | opMod | opNotEqual: // f % m != x
- skip = p.inclusionMasks[f%maxMod]&setBit != 0
-
- case opV: // v = x
- skip = v < numN && vMask&setBit == 0
-
- case opV | opNotEqual: // v != x
- skip = v < numN && vMask&setBit != 0
-
- case opW: // w == 0
- skip = f != 0
-
- case opW | opNotEqual: // w != 0
- skip = f == 0
-
- // Hard-wired rules that cannot be handled by our algorithm.
-
- case opBretonM:
- skip = f != 0 || n == 0 || n%1000000 != 0
-
- case opAzerbaijan00s:
- // 100,200,300,400,500,600,700,800,900
- skip = n == 0 || n >= 1000 || n%100 != 0
-
- case opItalian800:
- skip = (f != 0 || n >= numN || nMask&setBit == 0) && n != 800
- }
- if skip {
- // advance over AND entries.
- for ; i < len(rules) && rules[i].cat&formMask == andNext; i++ {
- }
- continue
- }
- // return if we have a final entry.
- if cat := rule.cat & formMask; cat != andNext {
- return plural.Form(cat)
- }
- }
- return plural.Other
-}
diff --git a/vendor/golang.org/x/text/internal/number/plural_test.go b/vendor/golang.org/x/text/internal/number/plural_test.go
deleted file mode 100644
index 3383d8c3d..000000000
--- a/vendor/golang.org/x/text/internal/number/plural_test.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package number
-
-import (
- "strconv"
- "strings"
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestOrdinal(t *testing.T) {
- testPlurals(t, &ordinalData, ordinalTests)
-}
-
-func TestCardinal(t *testing.T) {
- testPlurals(t, &cardinalData, cardinalTests)
-}
-
-func testPlurals(t *testing.T, p *pluralRules, testCases []pluralTest) {
- for _, tc := range testCases {
- for _, loc := range strings.Split(tc.locales, " ") {
- langIndex, _ := language.CompactIndex(language.MustParse(loc))
- // Test integers
- for _, s := range tc.integer {
- a := strings.Split(s, "~")
- from := parseUint(t, a[0])
- to := from
- if len(a) > 1 {
- to = parseUint(t, a[1])
- }
- for n := from; n <= to; n++ {
- if f := matchPlural(p, langIndex, n, 0, 0); f != tc.form {
- t.Errorf("%s:int(%d) = %v; want %v", loc, n, f, tc.form)
- }
- }
- }
- // Test decimals
- for _, s := range tc.decimal {
- a := strings.Split(s, "~")
- from, scale := parseFixedPoint(t, a[0])
- to := from
- if len(a) > 1 {
- var toScale int
- if to, toScale = parseFixedPoint(t, a[1]); toScale != scale {
- t.Fatalf("%s:%s: non-matching scales %d versus %d", loc, s, scale, toScale)
- }
- }
- m := 1
- for i := 0; i < scale; i++ {
- m *= 10
- }
- for n := from; n <= to; n++ {
- if f := matchPlural(p, langIndex, n/m, n%m, scale); f != tc.form {
- t.Errorf("%[1]s:dec(%[2]d.%0[4]*[3]d) = %[5]v; want %[6]v", loc, n/m, n%m, scale, f, tc.form)
- }
- }
- }
- }
- }
-}
-
-func parseUint(t *testing.T, s string) int {
- val, err := strconv.ParseUint(s, 10, 32)
- if err != nil {
- t.Fatal(err)
- }
- return int(val)
-}
-
-func parseFixedPoint(t *testing.T, s string) (val, scale int) {
- p := strings.Index(s, ".")
- s = strings.Replace(s, ".", "", 1)
- v, err := strconv.ParseUint(s, 10, 32)
- if err != nil {
- t.Fatal(err)
- }
- return int(v), len(s) - p
-}
-
-func BenchmarkPluralSimpleCases(b *testing.B) {
- p := &cardinalData
- en, _ := language.CompactIndex(language.English)
- zh, _ := language.CompactIndex(language.Chinese)
- for i := 0; i < b.N; i++ {
- matchPlural(p, en, 0, 0, 0) // 0
- matchPlural(p, en, 1, 0, 0) // 1
- matchPlural(p, en, 2, 12, 3) // 2.120
- matchPlural(p, zh, 0, 0, 0) // 0
- matchPlural(p, zh, 1, 0, 0) // 1
- matchPlural(p, zh, 2, 12, 3) // 2.120
- }
-}
-
-func BenchmarkPluralComplexCases(b *testing.B) {
- p := &cardinalData
- ar, _ := language.CompactIndex(language.Arabic)
- lv, _ := language.CompactIndex(language.Latvian)
- for i := 0; i < b.N; i++ {
- matchPlural(p, lv, 0, 19, 2) // 0.19
- matchPlural(p, lv, 11, 0, 3) // 11.000
- matchPlural(p, lv, 100, 123, 4) // 0.1230
- matchPlural(p, ar, 0, 0, 0) // 0
- matchPlural(p, ar, 110, 0, 0) // 110
- matchPlural(p, ar, 99, 99, 2) // 99.99
- }
-}
diff --git a/vendor/golang.org/x/text/internal/number/tables.go b/vendor/golang.org/x/text/internal/number/tables.go
index 845e0b14d..5c799b433 100644
--- a/vendor/golang.org/x/text/internal/number/tables.go
+++ b/vendor/golang.org/x/text/internal/number/tables.go
@@ -1,4 +1,4 @@
-// This file was generated by go generate; DO NOT EDIT
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
package number
@@ -516,539 +516,6 @@ var langToAlt = []altSymData{ // 73 elements
72: {compactTag: 0x2e4, system: 0x4, symIndex: 0x3b},
} // Size: 316 bytes
-var ordinalRules = []pluralCheck{ // 58 elements
- 0: {cat: 0x2f, setID: 0x4},
- 1: {cat: 0x3a, setID: 0x5},
- 2: {cat: 0x22, setID: 0x1},
- 3: {cat: 0x22, setID: 0x6},
- 4: {cat: 0x22, setID: 0x7},
- 5: {cat: 0x2f, setID: 0x8},
- 6: {cat: 0x3c, setID: 0x9},
- 7: {cat: 0x2f, setID: 0xa},
- 8: {cat: 0x3c, setID: 0xb},
- 9: {cat: 0x2d, setID: 0xc},
- 10: {cat: 0x2d, setID: 0xd},
- 11: {cat: 0x2f, setID: 0xe},
- 12: {cat: 0x35, setID: 0x3},
- 13: {cat: 0xc5, setID: 0xf},
- 14: {cat: 0x2, setID: 0x1},
- 15: {cat: 0x5, setID: 0x3},
- 16: {cat: 0xd, setID: 0x10},
- 17: {cat: 0x22, setID: 0x1},
- 18: {cat: 0x2f, setID: 0x11},
- 19: {cat: 0x3d, setID: 0x12},
- 20: {cat: 0x2f, setID: 0x13},
- 21: {cat: 0x3a, setID: 0x14},
- 22: {cat: 0x2f, setID: 0x15},
- 23: {cat: 0x3b, setID: 0x16},
- 24: {cat: 0x2f, setID: 0xa},
- 25: {cat: 0x3c, setID: 0xb},
- 26: {cat: 0x22, setID: 0x1},
- 27: {cat: 0x23, setID: 0x17},
- 28: {cat: 0x24, setID: 0x18},
- 29: {cat: 0x22, setID: 0x19},
- 30: {cat: 0x23, setID: 0x2},
- 31: {cat: 0x24, setID: 0x18},
- 32: {cat: 0xf, setID: 0x13},
- 33: {cat: 0x1a, setID: 0x14},
- 34: {cat: 0xf, setID: 0x15},
- 35: {cat: 0x1b, setID: 0x16},
- 36: {cat: 0xf, setID: 0x1a},
- 37: {cat: 0x1d, setID: 0x1b},
- 38: {cat: 0xa, setID: 0x1c},
- 39: {cat: 0xa, setID: 0x1d},
- 40: {cat: 0xc, setID: 0x1e},
- 41: {cat: 0xe4, setID: 0x0},
- 42: {cat: 0x5, setID: 0x3},
- 43: {cat: 0xd, setID: 0xc},
- 44: {cat: 0xd, setID: 0x1f},
- 45: {cat: 0x22, setID: 0x1},
- 46: {cat: 0x23, setID: 0x17},
- 47: {cat: 0x24, setID: 0x18},
- 48: {cat: 0x25, setID: 0x20},
- 49: {cat: 0x22, setID: 0x21},
- 50: {cat: 0x23, setID: 0x17},
- 51: {cat: 0x24, setID: 0x18},
- 52: {cat: 0x25, setID: 0x20},
- 53: {cat: 0x21, setID: 0x22},
- 54: {cat: 0x22, setID: 0x1},
- 55: {cat: 0x23, setID: 0x2},
- 56: {cat: 0x24, setID: 0x23},
- 57: {cat: 0x25, setID: 0x24},
-} // Size: 140 bytes
-
-var ordinalIndex = []uint8{ // 20 elements
- 0x00, 0x00, 0x02, 0x03, 0x04, 0x05, 0x07, 0x09,
- 0x0d, 0x0e, 0x11, 0x14, 0x1a, 0x1d, 0x20, 0x26,
- 0x2d, 0x31, 0x35, 0x3a,
-} // Size: 44 bytes
-
-var ordinalLangToIndex = []uint8{ // 752 elements
- // Entry 0 - 3F
- 0x00, 0x0d, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00,
- 0x0f, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x05,
- 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- // Entry 40 - 7F
- 0x00, 0x00, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x12, 0x12, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- // Entry 80 - BF
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- // Entry C0 - FF
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- // Entry 100 - 13F
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00,
- 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- // Entry 140 - 17F
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x02, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- // Entry 180 - 1BF
- 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- // Entry 1C0 - 1FF
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00,
- 0x00, 0x00, 0x0c, 0x0c, 0x02, 0x02, 0x02, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- // Entry 200 - 23F
- 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- // Entry 240 - 27F
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a,
- // Entry 280 - 2BF
- 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- // Entry 2C0 - 2FF
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-} // Size: 776 bytes
-
-var ordinalInclusionMasks = []uint64{ // 100 elements
- // Entry 0 - 1F
- 0x0000000400004009, 0x00000002120800d3, 0x0000000010a10195, 0x0000000842810581,
- 0x0000000841030081, 0x0000001210010041, 0x0000001100011001, 0x0000000614010001,
- 0x0000000614018001, 0x0000000600012001, 0x0000000200014001, 0x0000000010198031,
- 0x0000000010610331, 0x0000000040010f01, 0x0000000040070001, 0x0000000010010001,
- 0x0000000000011001, 0x000000001c010001, 0x000000001c010001, 0x0000000000012001,
- 0x0000000020014001, 0x0000000010080011, 0x0000000010200111, 0x0000000040000501,
- 0x0000000040020001, 0x0000000010000001, 0x0000000000001001, 0x0000000014000001,
- 0x0000000014000001, 0x0000000000002001, 0x0000000000004001, 0x0000000010080011,
- // Entry 20 - 3F
- 0x0000000010200111, 0x0000000040000501, 0x0000000040020001, 0x0000000010000001,
- 0x0000000000001001, 0x0000000014000001, 0x0000000014000001, 0x0000000000002001,
- 0x0000000080014001, 0x0000000010080011, 0x0000000010200111, 0x0000000040000501,
- 0x0000000040020001, 0x0000000010000001, 0x0000000000001001, 0x0000000014000001,
- 0x0000000014000001, 0x0000000000002001, 0x0000000020004001, 0x0000000010080011,
- 0x0000000010200111, 0x0000000040000501, 0x0000000040020001, 0x0000000010000001,
- 0x0000000000001001, 0x0000000014000001, 0x0000000014000001, 0x0000000000002001,
- 0x0000000080014001, 0x0000000010080011, 0x0000000010200111, 0x0000000040000501,
- // Entry 40 - 5F
- 0x0000000040020001, 0x0000000010000001, 0x0000000000001001, 0x0000000014000001,
- 0x0000000014000001, 0x0000000000002001, 0x0000000020004001, 0x0000000010080011,
- 0x0000000010200111, 0x0000000040000501, 0x0000000040020001, 0x0000000010000001,
- 0x0000000000001001, 0x0000000014000001, 0x0000000014000001, 0x0000000000002001,
- 0x000000002001c001, 0x0000000010080011, 0x0000000010200111, 0x0000000040000501,
- 0x0000000040020001, 0x0000000010000001, 0x0000000000001001, 0x0000000014000001,
- 0x0000000014000001, 0x0000000000002001, 0x0000000080004001, 0x0000000010080011,
- 0x0000000010200111, 0x0000000040000501, 0x0000000040020001, 0x0000000010000001,
- // Entry 60 - 7F
- 0x0000000000001001, 0x0000000014000001, 0x0000000014000001, 0x0000000000002001,
-} // Size: 824 bytes
-
-// Slots used for ordinal: 3A of 0xFF rules; 14 of 0xFF indexes; 37 of 64 sets
-
-var cardinalRules = []pluralCheck{ // 169 elements
- 0: {cat: 0x2, setID: 0x3},
- 1: {cat: 0x22, setID: 0x1},
- 2: {cat: 0x2, setID: 0x4},
- 3: {cat: 0x7, setID: 0x1},
- 4: {cat: 0x62, setID: 0x3},
- 5: {cat: 0x22, setID: 0x4},
- 6: {cat: 0x7, setID: 0x3},
- 7: {cat: 0x42, setID: 0x1},
- 8: {cat: 0x22, setID: 0x4},
- 9: {cat: 0x22, setID: 0x4},
- 10: {cat: 0x22, setID: 0x5},
- 11: {cat: 0x27, setID: 0x6},
- 12: {cat: 0x32, setID: 0x2},
- 13: {cat: 0x22, setID: 0x1},
- 14: {cat: 0x27, setID: 0x1},
- 15: {cat: 0x62, setID: 0x3},
- 16: {cat: 0x22, setID: 0x1},
- 17: {cat: 0x7, setID: 0x4},
- 18: {cat: 0x92, setID: 0x3},
- 19: {cat: 0xf, setID: 0x7},
- 20: {cat: 0x1f, setID: 0x8},
- 21: {cat: 0x82, setID: 0x3},
- 22: {cat: 0x92, setID: 0x3},
- 23: {cat: 0xf, setID: 0x7},
- 24: {cat: 0x62, setID: 0x3},
- 25: {cat: 0x4a, setID: 0x7},
- 26: {cat: 0x7, setID: 0x9},
- 27: {cat: 0x62, setID: 0x3},
- 28: {cat: 0x1f, setID: 0xa},
- 29: {cat: 0x62, setID: 0x3},
- 30: {cat: 0x5f, setID: 0xa},
- 31: {cat: 0x72, setID: 0x3},
- 32: {cat: 0x29, setID: 0xb},
- 33: {cat: 0x29, setID: 0xc},
- 34: {cat: 0x4f, setID: 0xc},
- 35: {cat: 0x61, setID: 0x2},
- 36: {cat: 0x2f, setID: 0x7},
- 37: {cat: 0x3a, setID: 0x8},
- 38: {cat: 0x4f, setID: 0x7},
- 39: {cat: 0x5f, setID: 0x8},
- 40: {cat: 0x62, setID: 0x2},
- 41: {cat: 0x4f, setID: 0x7},
- 42: {cat: 0x72, setID: 0x2},
- 43: {cat: 0x21, setID: 0x3},
- 44: {cat: 0x7, setID: 0x4},
- 45: {cat: 0x32, setID: 0x3},
- 46: {cat: 0x21, setID: 0x3},
- 47: {cat: 0x22, setID: 0x1},
- 48: {cat: 0x22, setID: 0x1},
- 49: {cat: 0x23, setID: 0x2},
- 50: {cat: 0x2, setID: 0x3},
- 51: {cat: 0x22, setID: 0x1},
- 52: {cat: 0x24, setID: 0xd},
- 53: {cat: 0x7, setID: 0x1},
- 54: {cat: 0x62, setID: 0x3},
- 55: {cat: 0x74, setID: 0x3},
- 56: {cat: 0x24, setID: 0x3},
- 57: {cat: 0x2f, setID: 0xe},
- 58: {cat: 0x34, setID: 0x1},
- 59: {cat: 0xf, setID: 0x7},
- 60: {cat: 0x1f, setID: 0x8},
- 61: {cat: 0x62, setID: 0x3},
- 62: {cat: 0x4f, setID: 0x7},
- 63: {cat: 0x5a, setID: 0x8},
- 64: {cat: 0xf, setID: 0xf},
- 65: {cat: 0x1f, setID: 0x10},
- 66: {cat: 0x64, setID: 0x3},
- 67: {cat: 0x4f, setID: 0xf},
- 68: {cat: 0x5c, setID: 0x10},
- 69: {cat: 0x22, setID: 0x11},
- 70: {cat: 0x23, setID: 0x12},
- 71: {cat: 0x24, setID: 0x13},
- 72: {cat: 0xf, setID: 0x1},
- 73: {cat: 0x62, setID: 0x3},
- 74: {cat: 0xf, setID: 0x2},
- 75: {cat: 0x63, setID: 0x3},
- 76: {cat: 0xf, setID: 0x14},
- 77: {cat: 0x64, setID: 0x3},
- 78: {cat: 0x74, setID: 0x3},
- 79: {cat: 0xf, setID: 0x1},
- 80: {cat: 0x62, setID: 0x3},
- 81: {cat: 0x4a, setID: 0x1},
- 82: {cat: 0xf, setID: 0x2},
- 83: {cat: 0x63, setID: 0x3},
- 84: {cat: 0x4b, setID: 0x2},
- 85: {cat: 0xf, setID: 0x14},
- 86: {cat: 0x64, setID: 0x3},
- 87: {cat: 0x4c, setID: 0x14},
- 88: {cat: 0x7, setID: 0x1},
- 89: {cat: 0x62, setID: 0x3},
- 90: {cat: 0x7, setID: 0x2},
- 91: {cat: 0x63, setID: 0x3},
- 92: {cat: 0x2f, setID: 0xb},
- 93: {cat: 0x37, setID: 0x15},
- 94: {cat: 0x65, setID: 0x3},
- 95: {cat: 0x7, setID: 0x1},
- 96: {cat: 0x62, setID: 0x3},
- 97: {cat: 0x7, setID: 0x16},
- 98: {cat: 0x64, setID: 0x3},
- 99: {cat: 0x75, setID: 0x3},
- 100: {cat: 0x7, setID: 0x1},
- 101: {cat: 0x62, setID: 0x3},
- 102: {cat: 0xf, setID: 0xf},
- 103: {cat: 0x1f, setID: 0x10},
- 104: {cat: 0x64, setID: 0x3},
- 105: {cat: 0xf, setID: 0x17},
- 106: {cat: 0x17, setID: 0x1},
- 107: {cat: 0x65, setID: 0x3},
- 108: {cat: 0xf, setID: 0x18},
- 109: {cat: 0x65, setID: 0x3},
- 110: {cat: 0xf, setID: 0x10},
- 111: {cat: 0x65, setID: 0x3},
- 112: {cat: 0x2f, setID: 0x7},
- 113: {cat: 0x3a, setID: 0x8},
- 114: {cat: 0x2f, setID: 0xf},
- 115: {cat: 0x3c, setID: 0x10},
- 116: {cat: 0x2d, setID: 0xb},
- 117: {cat: 0x2d, setID: 0x18},
- 118: {cat: 0x2d, setID: 0x19},
- 119: {cat: 0x2f, setID: 0x7},
- 120: {cat: 0x3a, setID: 0xc},
- 121: {cat: 0x2f, setID: 0x1a},
- 122: {cat: 0x3c, setID: 0xc},
- 123: {cat: 0x55, setID: 0x3},
- 124: {cat: 0x22, setID: 0x1},
- 125: {cat: 0x24, setID: 0x3},
- 126: {cat: 0x2c, setID: 0xd},
- 127: {cat: 0x2d, setID: 0xc},
- 128: {cat: 0xf, setID: 0x7},
- 129: {cat: 0x1f, setID: 0x8},
- 130: {cat: 0x62, setID: 0x3},
- 131: {cat: 0xf, setID: 0xf},
- 132: {cat: 0x1f, setID: 0x10},
- 133: {cat: 0x64, setID: 0x3},
- 134: {cat: 0xf, setID: 0xb},
- 135: {cat: 0x65, setID: 0x3},
- 136: {cat: 0xf, setID: 0x18},
- 137: {cat: 0x65, setID: 0x3},
- 138: {cat: 0xf, setID: 0x19},
- 139: {cat: 0x65, setID: 0x3},
- 140: {cat: 0x2f, setID: 0x7},
- 141: {cat: 0x3a, setID: 0x1b},
- 142: {cat: 0x2f, setID: 0x1c},
- 143: {cat: 0x3b, setID: 0x1d},
- 144: {cat: 0x2f, setID: 0x1e},
- 145: {cat: 0x3c, setID: 0x1f},
- 146: {cat: 0x37, setID: 0x3},
- 147: {cat: 0xa5, setID: 0x0},
- 148: {cat: 0x22, setID: 0x1},
- 149: {cat: 0x23, setID: 0x2},
- 150: {cat: 0x24, setID: 0x20},
- 151: {cat: 0x25, setID: 0x21},
- 152: {cat: 0xf, setID: 0x7},
- 153: {cat: 0x62, setID: 0x3},
- 154: {cat: 0xf, setID: 0x1c},
- 155: {cat: 0x63, setID: 0x3},
- 156: {cat: 0xf, setID: 0x22},
- 157: {cat: 0x64, setID: 0x3},
- 158: {cat: 0x75, setID: 0x3},
- 159: {cat: 0x21, setID: 0x3},
- 160: {cat: 0x22, setID: 0x1},
- 161: {cat: 0x23, setID: 0x2},
- 162: {cat: 0x2c, setID: 0x23},
- 163: {cat: 0x2d, setID: 0x5},
- 164: {cat: 0x21, setID: 0x3},
- 165: {cat: 0x22, setID: 0x1},
- 166: {cat: 0x23, setID: 0x2},
- 167: {cat: 0x24, setID: 0x24},
- 168: {cat: 0x25, setID: 0x25},
-} // Size: 362 bytes
-
-var cardinalIndex = []uint8{ // 37 elements
- 0x00, 0x00, 0x02, 0x03, 0x05, 0x08, 0x09, 0x0b,
- 0x0d, 0x0e, 0x10, 0x13, 0x17, 0x1a, 0x20, 0x2b,
- 0x2e, 0x30, 0x32, 0x35, 0x3b, 0x45, 0x48, 0x4f,
- 0x58, 0x5f, 0x64, 0x70, 0x77, 0x7c, 0x80, 0x8c,
- 0x94, 0x98, 0x9f, 0xa4, 0xa9,
-} // Size: 61 bytes
-
-var cardinalLangToIndex = []uint8{ // 752 elements
- // Entry 0 - 3F
- 0x00, 0x03, 0x03, 0x08, 0x08, 0x08, 0x00, 0x00,
- 0x05, 0x05, 0x01, 0x01, 0x22, 0x22, 0x22, 0x22,
- 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
- 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
- 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
- 0x22, 0x22, 0x01, 0x01, 0x08, 0x08, 0x03, 0x03,
- 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x1b,
- 0x1b, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x05,
- // Entry 40 - 7F
- 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
- 0x1f, 0x1f, 0x08, 0x08, 0x14, 0x00, 0x00, 0x14,
- 0x14, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x19,
- 0x19, 0x00, 0x00, 0x23, 0x23, 0x0a, 0x0a, 0x0a,
- 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x00, 0x00, 0x17, 0x17, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
- // Entry 80 - BF
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- // Entry C0 - FF
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- // Entry 100 - 13F
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x08, 0x08,
- 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x03, 0x03, 0x0d, 0x0d, 0x08, 0x08,
- 0x08, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- // Entry 140 - 17F
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x08, 0x08, 0x03, 0x03, 0x20, 0x20, 0x15, 0x15,
- 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x01, 0x01,
- 0x05, 0x00, 0x00, 0x21, 0x21, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x18, 0x18, 0x01, 0x01, 0x14,
- 0x14, 0x14, 0x17, 0x17, 0x08, 0x08, 0x02, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x0b,
- // Entry 180 - 1BF
- 0x03, 0x03, 0x03, 0x03, 0x11, 0x00, 0x00, 0x00,
- 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x02,
- 0x02, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08,
- 0x08, 0x08, 0x00, 0x00, 0x10, 0x10, 0x08, 0x11,
- 0x11, 0x08, 0x08, 0x0f, 0x0f, 0x08, 0x08, 0x08,
- // Entry 1C0 - 1FF
- 0x08, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0e, 0x08,
- 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05,
- 0x00, 0x00, 0x08, 0x08, 0x0c, 0x0c, 0x08, 0x08,
- 0x08, 0x08, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x1d, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x11, 0x11, 0x08, 0x08, 0x08, 0x08, 0x08,
- // Entry 200 - 23F
- 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x05,
- 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x05, 0x00, 0x00,
- 0x05, 0x05, 0x08, 0x1a, 0x1a, 0x0e, 0x0e, 0x08,
- 0x08, 0x07, 0x09, 0x07, 0x09, 0x09, 0x09, 0x09,
- 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, 0x00,
- // Entry 240 - 27F
- 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x13, 0x13,
- 0x13, 0x08, 0x08, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
- 0x1e, 0x1e, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00,
- 0x08, 0x08, 0x00, 0x00, 0x08, 0x11, 0x11, 0x11,
- 0x11, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x12,
- 0x00, 0x00, 0x12, 0x12, 0x04, 0x04, 0x19, 0x19,
- 0x16, 0x16, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- // Entry 280 - 2BF
- 0x08, 0x08, 0x08, 0x14, 0x14, 0x14, 0x14, 0x14,
- 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x08, 0x08,
- 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x05,
- 0x05, 0x05, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
- 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x06, 0x06,
- 0x08, 0x08, 0x1e, 0x1e, 0x03, 0x03, 0x03, 0x08,
- // Entry 2C0 - 2FF
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x08,
- 0x08, 0x08, 0x05, 0x08, 0x08, 0x00, 0x08, 0x08,
- 0x08, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
-} // Size: 776 bytes
-
-var cardinalInclusionMasks = []uint64{ // 100 elements
- // Entry 0 - 1F
- 0x0000000400a00859, 0x0000000000a242d3, 0x000000001464e245, 0x000000194478e201,
- 0x000000094478e401, 0x0000000905286001, 0x0000002905286401, 0x0000000a05286001,
- 0x0000000a05286001, 0x0000000a45286401, 0x0000000a80a86801, 0x000000008a8251a1,
- 0x00000000b605d021, 0x00000000c609d021, 0x00000000c609d421, 0x0000000085085021,
- 0x0000000085085421, 0x0000000085085021, 0x0000000085085021, 0x00000000c5085421,
- 0x0000000400800821, 0x00000000008000a1, 0x0000000014008021, 0x0000000044008021,
- 0x0000000044008421, 0x0000000005000021, 0x0000000005000421, 0x0000000005000021,
- 0x0000000005000021, 0x0000000045000421, 0x0000000000800821, 0x00000000008000a1,
- // Entry 20 - 3F
- 0x0000000014008021, 0x0000000044008021, 0x0000000044008421, 0x0000000005000021,
- 0x0000000005000421, 0x0000000005000021, 0x0000000005000021, 0x0000000045000421,
- 0x0000000400800821, 0x00000000008000a1, 0x0000000014008021, 0x0000000044008021,
- 0x0000000044008421, 0x0000000005000021, 0x0000000005000421, 0x0000000005000021,
- 0x0000000005000021, 0x0000000045000421, 0x0000000000800821, 0x00000000008000a1,
- 0x0000000014008021, 0x0000000044008021, 0x0000000044008421, 0x0000000005000021,
- 0x0000000005000421, 0x0000000005000021, 0x0000000005000021, 0x0000000045000421,
- 0x0000000400800821, 0x00000000008000a1, 0x0000000014008021, 0x0000000044008021,
- // Entry 40 - 5F
- 0x0000000044008421, 0x0000000005000021, 0x0000000005000421, 0x0000000005000021,
- 0x0000000005000021, 0x0000000045000421, 0x0000000080800821, 0x00000000888000a1,
- 0x00000000b4008021, 0x00000000c4008021, 0x00000000c4008421, 0x0000000085000021,
- 0x0000000085000421, 0x0000000085000021, 0x0000000085000021, 0x00000000c5000421,
- 0x0000000400800821, 0x00000000008000a1, 0x0000000014008021, 0x0000000044008021,
- 0x0000000044008421, 0x0000000005000021, 0x0000000005000421, 0x0000000005000021,
- 0x0000000005000021, 0x0000000045000421, 0x0000000080800821, 0x00000000888000a1,
- 0x00000000b4008021, 0x00000000c4008021, 0x00000000c4008421, 0x0000000085000021,
- // Entry 60 - 7F
- 0x0000000085000421, 0x0000000085000021, 0x0000000085000021, 0x00000000c5000421,
-} // Size: 824 bytes
-
-// Slots used for cardinal: A9 of 0xFF rules; 25 of 0xFF indexes; 38 of 64 sets
-
var tagToDecimal = []uint8{ // 752 elements
// Entry 0 - 3F
0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01,
@@ -1649,4 +1116,4 @@ var formats = []Pattern{Pattern{Affix: "",
MaxSignificantDigits: 0x0,
MinExponentDigits: 0x0}}
-// Total table size 10908 bytes (10KiB); checksum: B1AF61E6
+// Total table size 7101 bytes (6KiB); checksum: A4A81DF0
diff --git a/vendor/golang.org/x/text/secure/precis/profile_test.go b/vendor/golang.org/x/text/secure/precis/profile_test.go
index 253b2a08a..916fc8b6d 100644
--- a/vendor/golang.org/x/text/secure/precis/profile_test.go
+++ b/vendor/golang.org/x/text/secure/precis/profile_test.go
@@ -100,6 +100,13 @@ var compareTestCases = []struct {
{"Å", "å", true},
{"ff", "ff", true}, // because of NFKC
{"ß", "sS", false},
+
+ // After applying the Nickname profile, \u00a8 becomes \u0020\u0308,
+ // however because the nickname profile is not idempotent, applying it again
+ // to \u0020\u0308 results in \u0308. This behavior is "correct", even if it
+ // is unexpected.
+ {"\u00a8", "\u0020\u0308", false},
+ {"\u0020\u0308", "\u0308", true},
}},
}
diff --git a/vendor/golang.org/x/text/secure/precis/profiles.go b/vendor/golang.org/x/text/secure/precis/profiles.go
index 8b46d504c..86010025c 100644
--- a/vendor/golang.org/x/text/secure/precis/profiles.go
+++ b/vendor/golang.org/x/text/secure/precis/profiles.go
@@ -13,10 +13,19 @@ import (
)
var (
- Nickname *Profile = nickname // Implements the Nickname profile specified in RFC 7700.
- UsernameCaseMapped *Profile = usernameCaseMap // Implements the UsernameCaseMapped profile specified in RFC 7613.
- UsernameCasePreserved *Profile = usernameNoCaseMap // Implements the UsernameCasePreserved profile specified in RFC 7613.
- OpaqueString *Profile = opaquestring // Implements the OpaqueString profile defined in RFC 7613 for passwords and other secure labels.
+ // Implements the Nickname profile specified in RFC 7700.
+ // The nickname profile is not idempotent and may need to be applied multiple
+ // times before being used for comparisons.
+ Nickname *Profile = nickname
+
+ // Implements the UsernameCaseMapped profile specified in RFC 7613.
+ UsernameCaseMapped *Profile = usernameCaseMap
+
+ // Implements the UsernameCasePreserved profile specified in RFC 7613.
+ UsernameCasePreserved *Profile = usernameNoCaseMap
+
+ // Implements the OpaqueString profile defined in RFC 7613 for passwords and other secure labels.
+ OpaqueString *Profile = opaquestring
)
var (
diff --git a/vendor/golang.org/x/text/unicode/norm/composition.go b/vendor/golang.org/x/text/unicode/norm/composition.go
index d17b278ad..bab4c5de0 100644
--- a/vendor/golang.org/x/text/unicode/norm/composition.go
+++ b/vendor/golang.org/x/text/unicode/norm/composition.go
@@ -33,17 +33,9 @@ const (
// streamSafe implements the policy of when a CGJ should be inserted.
type streamSafe uint8
-// mkStreamSafe is a shorthand for declaring a streamSafe var and calling
-// first on it.
-func mkStreamSafe(p Properties) streamSafe {
- return streamSafe(p.nTrailingNonStarters())
-}
-
-// first inserts the first rune of a segment.
+// first inserts the first rune of a segment. It is a faster version of next if
+// it is known p represents the first rune in a segment.
func (ss *streamSafe) first(p Properties) {
- if *ss != 0 {
- panic("!= 0")
- }
*ss = streamSafe(p.nTrailingNonStarters())
}
@@ -66,7 +58,7 @@ func (ss *streamSafe) next(p Properties) ssState {
// be a non-starter. Note that it always hold that if nLead > 0 then
// nLead == nTrail.
if n == 0 {
- *ss = 0
+ *ss = streamSafe(p.nTrailingNonStarters())
return ssStarter
}
return ssSuccess
@@ -142,7 +134,6 @@ func (rb *reorderBuffer) setFlusher(out []byte, f func(*reorderBuffer) bool) {
func (rb *reorderBuffer) reset() {
rb.nrune = 0
rb.nbyte = 0
- rb.ss = 0
}
func (rb *reorderBuffer) doFlush() bool {
@@ -257,6 +248,9 @@ func (rb *reorderBuffer) insertUnsafe(src input, i int, info Properties) {
// It flushes the buffer on each new segment start.
func (rb *reorderBuffer) insertDecomposed(dcomp []byte) insertErr {
rb.tmpBytes.setBytes(dcomp)
+ // As the streamSafe accounting already handles the counting for modifiers,
+ // we don't have to call next. However, we do need to keep the accounting
+ // intact when flushing the buffer.
for i := 0; i < len(dcomp); {
info := rb.f.info(rb.tmpBytes, i)
if info.BoundaryBefore() && rb.nrune > 0 && !rb.doFlush() {
diff --git a/vendor/golang.org/x/text/unicode/norm/iter.go b/vendor/golang.org/x/text/unicode/norm/iter.go
index 0a42a72de..ce17f96c2 100644
--- a/vendor/golang.org/x/text/unicode/norm/iter.go
+++ b/vendor/golang.org/x/text/unicode/norm/iter.go
@@ -41,6 +41,7 @@ func (i *Iter) Init(f Form, src []byte) {
i.next = i.rb.f.nextMain
i.asciiF = nextASCIIBytes
i.info = i.rb.f.info(i.rb.src, i.p)
+ i.rb.ss.first(i.info)
}
// InitString initializes i to iterate over src after normalizing it to Form f.
@@ -56,11 +57,12 @@ func (i *Iter) InitString(f Form, src string) {
i.next = i.rb.f.nextMain
i.asciiF = nextASCIIString
i.info = i.rb.f.info(i.rb.src, i.p)
+ i.rb.ss.first(i.info)
}
// Seek sets the segment to be returned by the next call to Next to start
// at position p. It is the responsibility of the caller to set p to the
-// start of a UTF8 rune.
+// start of a segment.
func (i *Iter) Seek(offset int64, whence int) (int64, error) {
var abs int64
switch whence {
@@ -84,6 +86,7 @@ func (i *Iter) Seek(offset int64, whence int) (int64, error) {
i.multiSeg = nil
i.next = i.rb.f.nextMain
i.info = i.rb.f.info(i.rb.src, i.p)
+ i.rb.ss.first(i.info)
return abs, nil
}
@@ -161,6 +164,7 @@ func nextHangul(i *Iter) []byte {
if next >= i.rb.nsrc {
i.setDone()
} else if i.rb.src.hangul(next) == 0 {
+ i.rb.ss.next(i.info)
i.info = i.rb.f.info(i.rb.src, i.p)
i.next = i.rb.f.nextMain
return i.next(i)
@@ -204,12 +208,10 @@ func nextMultiNorm(i *Iter) []byte {
if info.BoundaryBefore() {
i.rb.compose()
seg := i.buf[:i.rb.flushCopy(i.buf[:])]
- i.rb.ss.first(info)
i.rb.insertUnsafe(input{bytes: d}, j, info)
i.multiSeg = d[j+int(info.size):]
return seg
}
- i.rb.ss.next(info)
i.rb.insertUnsafe(input{bytes: d}, j, info)
j += int(info.size)
}
@@ -222,9 +224,9 @@ func nextMultiNorm(i *Iter) []byte {
func nextDecomposed(i *Iter) (next []byte) {
outp := 0
inCopyStart, outCopyStart := i.p, 0
- ss := mkStreamSafe(i.info)
for {
if sz := int(i.info.size); sz <= 1 {
+ i.rb.ss = 0
p := i.p
i.p++ // ASCII or illegal byte. Either way, advance by 1.
if i.p >= i.rb.nsrc {
@@ -243,6 +245,8 @@ func nextDecomposed(i *Iter) (next []byte) {
p := outp + len(d)
if outp > 0 {
i.rb.src.copySlice(i.buf[outCopyStart:], inCopyStart, i.p)
+ // TODO: this condition should not be possible, but we leave it
+ // in for defensive purposes.
if p > len(i.buf) {
return i.buf[:outp]
}
@@ -266,7 +270,7 @@ func nextDecomposed(i *Iter) (next []byte) {
} else {
i.info = i.rb.f.info(i.rb.src, i.p)
}
- switch ss.next(i.info) {
+ switch i.rb.ss.next(i.info) {
case ssOverflow:
i.next = nextCGJDecompose
fallthrough
@@ -309,7 +313,7 @@ func nextDecomposed(i *Iter) (next []byte) {
}
prevCC := i.info.tccc
i.info = i.rb.f.info(i.rb.src, i.p)
- if v := ss.next(i.info); v == ssStarter {
+ if v := i.rb.ss.next(i.info); v == ssStarter {
break
} else if v == ssOverflow {
i.next = nextCGJDecompose
@@ -335,10 +339,6 @@ doNorm:
func doNormDecomposed(i *Iter) []byte {
for {
- if s := i.rb.ss.next(i.info); s == ssOverflow {
- i.next = nextCGJDecompose
- break
- }
i.rb.insertUnsafe(i.rb.src, i.p, i.info)
if i.p += int(i.info.size); i.p >= i.rb.nsrc {
i.setDone()
@@ -348,6 +348,10 @@ func doNormDecomposed(i *Iter) []byte {
if i.info.ccc == 0 {
break
}
+ if s := i.rb.ss.next(i.info); s == ssOverflow {
+ i.next = nextCGJDecompose
+ break
+ }
}
// new segment or too many combining characters: exit normalization
return i.buf[:i.rb.flushCopy(i.buf[:])]
@@ -357,6 +361,7 @@ func nextCGJDecompose(i *Iter) []byte {
i.rb.ss = 0
i.rb.insertCGJ()
i.next = nextDecomposed
+ i.rb.ss.first(i.info)
buf := doNormDecomposed(i)
return buf
}
@@ -365,7 +370,6 @@ func nextCGJDecompose(i *Iter) []byte {
func nextComposed(i *Iter) []byte {
outp, startp := 0, i.p
var prevCC uint8
- ss := mkStreamSafe(i.info)
for {
if !i.info.isYesC() {
goto doNorm
@@ -385,11 +389,12 @@ func nextComposed(i *Iter) []byte {
i.setDone()
break
} else if i.rb.src._byte(i.p) < utf8.RuneSelf {
+ i.rb.ss = 0
i.next = i.asciiF
break
}
i.info = i.rb.f.info(i.rb.src, i.p)
- if v := ss.next(i.info); v == ssStarter {
+ if v := i.rb.ss.next(i.info); v == ssStarter {
break
} else if v == ssOverflow {
i.next = nextCGJCompose
@@ -401,8 +406,10 @@ func nextComposed(i *Iter) []byte {
}
return i.returnSlice(startp, i.p)
doNorm:
+ // reset to start position
i.p = startp
i.info = i.rb.f.info(i.rb.src, i.p)
+ i.rb.ss.first(i.info)
if i.info.multiSegment() {
d := i.info.Decomposition()
info := i.rb.f.info(input{bytes: d}, 0)
diff --git a/vendor/golang.org/x/text/unicode/norm/iter_test.go b/vendor/golang.org/x/text/unicode/norm/iter_test.go
index e2aa6f251..d95aa304d 100644
--- a/vendor/golang.org/x/text/unicode/norm/iter_test.go
+++ b/vendor/golang.org/x/text/unicode/norm/iter_test.go
@@ -60,7 +60,7 @@ var segmentTestsK = []SegmentTest{
{"\ufdfa" + grave(30), []string{"\u0635", "\u0644", "\u0649", " ", "\u0627", "\u0644", "\u0644", "\u0647", " ", "\u0639", "\u0644", "\u064a", "\u0647", " ", "\u0648", "\u0633", "\u0644", "\u0645" + grave(30), ""}},
{"\uFDFA" + grave(64), []string{"\u0635", "\u0644", "\u0649", " ", "\u0627", "\u0644", "\u0644", "\u0647", " ", "\u0639", "\u0644", "\u064a", "\u0647", " ", "\u0648", "\u0633", "\u0644", "\u0645" + grave(30), cgj + grave(30), cgj + grave(4), ""}},
- // Hangul and Jamo are grouped togeter.
+ // Hangul and Jamo are grouped together.
{"\uAC00", []string{"\u1100\u1161", ""}},
{"\uAC01", []string{"\u1100\u1161\u11A8", ""}},
{"\u1100\u1161", []string{"\u1100\u1161", ""}},
diff --git a/vendor/golang.org/x/text/unicode/norm/normalize.go b/vendor/golang.org/x/text/unicode/norm/normalize.go
index d3f206936..e28ac641a 100644
--- a/vendor/golang.org/x/text/unicode/norm/normalize.go
+++ b/vendor/golang.org/x/text/unicode/norm/normalize.go
@@ -324,7 +324,6 @@ func (f *formInfo) quickSpan(src input, i, end int, atEOF bool) (n int, ok bool)
// have an overflow for runes that are starters (e.g. with U+FF9E).
switch ss.next(info) {
case ssStarter:
- ss.first(info)
lastSegStart = i
case ssOverflow:
return lastSegStart, false
@@ -441,6 +440,8 @@ func (f Form) nextBoundary(src input, nsrc int, atEOF bool) int {
}
return -1
}
+ // TODO: Using streamSafe to determine the boundary isn't the same as
+ // using BoundaryBefore. Determine which should be used.
if s := ss.next(info); s != ssSuccess {
return i
}
@@ -505,15 +506,14 @@ func decomposeSegment(rb *reorderBuffer, sp int, atEOF bool) int {
if info.size == 0 {
return 0
}
- if rb.nrune > 0 {
- if s := rb.ss.next(info); s == ssStarter {
- goto end
- } else if s == ssOverflow {
- rb.insertCGJ()
+ if s := rb.ss.next(info); s == ssStarter {
+ // TODO: this could be removed if we don't support merging.
+ if rb.nrune > 0 {
goto end
}
- } else {
- rb.ss.first(info)
+ } else if s == ssOverflow {
+ rb.insertCGJ()
+ goto end
}
if err := rb.insertFlush(rb.src, sp, info); err != iSuccess {
return int(err)
diff --git a/vendor/golang.org/x/text/unicode/norm/normalize_test.go b/vendor/golang.org/x/text/unicode/norm/normalize_test.go
index ffa103485..69a84bfaa 100644
--- a/vendor/golang.org/x/text/unicode/norm/normalize_test.go
+++ b/vendor/golang.org/x/text/unicode/norm/normalize_test.go
@@ -598,35 +598,42 @@ func runNormTests(t *testing.T, name string, fn appendFunc) {
func runAppendTests(t *testing.T, name string, f Form, fn appendFunc, tests []AppendTest) {
for i, test := range tests {
- if *testn >= 0 && i != *testn {
- continue
- }
- out := []byte(test.left)
- have := string(fn(f, out, test.right))
- if len(have) != len(test.out) {
- t.Errorf("%s.%s:%d: length is %d; want %d (%+q vs %+q)", fstr[f], name, i, len(have), len(test.out), pc(have), pc(test.out))
- }
- if have != test.out {
- k, pf := pidx(have, test.out)
- t.Errorf("%s.%s:%d: \nwas %s%+q; \nwant %s%+q", fstr[f], name, i, pf, pc(have[k:]), pf, pc(test.out[k:]))
- }
-
- // Bootstrap by normalizing input. Ensures that the various variants
- // behave the same.
- for g := NFC; g <= NFKD; g++ {
- if f == g {
- continue
+ t.Run(fmt.Sprintf("%s/%d", fstr[f], i), func(t *testing.T) {
+ id := pc(test.left + test.right)
+ if *testn >= 0 && i != *testn {
+ return
}
- want := g.String(test.left + test.right)
- have := string(fn(g, g.AppendString(nil, test.left), test.right))
- if len(have) != len(want) {
- t.Errorf("%s(%s.%s):%d: length is %d; want %d (%+q vs %+q)", fstr[g], fstr[f], name, i, len(have), len(want), pc(have), pc(want))
- }
- if have != want {
- k, pf := pidx(have, want)
- t.Errorf("%s(%s.%s):%d: \nwas %s%+q; \nwant %s%+q", fstr[g], fstr[f], name, i, pf, pc(have[k:]), pf, pc(want[k:]))
+ t.Run("fn", func(t *testing.T) {
+ out := []byte(test.left)
+ have := string(fn(f, out, test.right))
+ if len(have) != len(test.out) {
+ t.Errorf("%+q: length is %d; want %d (%+q vs %+q)", id, len(have), len(test.out), pc(have), pc(test.out))
+ }
+ if have != test.out {
+ k, pf := pidx(have, test.out)
+ t.Errorf("%+q:\nwas %s%+q; \nwant %s%+q", id, pf, pc(have[k:]), pf, pc(test.out[k:]))
+ }
+ })
+
+ // Bootstrap by normalizing input. Ensures that the various variants
+ // behave the same.
+ for g := NFC; g <= NFKD; g++ {
+ if f == g {
+ continue
+ }
+ t.Run(fstr[g], func(t *testing.T) {
+ want := g.String(test.left + test.right)
+ have := string(fn(g, g.AppendString(nil, test.left), test.right))
+ if len(have) != len(want) {
+ t.Errorf("%+q: length is %d; want %d (%+q vs %+q)", id, len(have), len(want), pc(have), pc(want))
+ }
+ if have != want {
+ k, pf := pidx(have, want)
+ t.Errorf("%+q:\nwas %s%+q; \nwant %s%+q", id, pf, pc(have[k:]), pf, pc(want[k:]))
+ }
+ })
}
- }
+ })
}
}
@@ -768,6 +775,16 @@ var appendTestsNFKC = []AppendTest{
// - Many non-starter decompositions in a row causing overflow.
{"", rep(0x340, 31), rep(0x300, 30) + cgj + "\u0300"},
{"", rep(0xFF9E, 31), rep(0x3099, 30) + cgj + "\u3099"},
+
+ {"", "\u0644\u0625" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + "\u0300\u0300"},
+ {"", "\ufef9" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + rep(0x0300, 2)},
+ {"", "\ufef9" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + rep(0x0300, 2)},
+
+ // U+0F81 TIBETAN VOWEL SIGN REVERSED II splits into two modifiers.
+ {"", "\u0f7f" + rep(0xf71, 29) + "\u0f81", "\u0f7f" + rep(0xf71, 29) + cgj + "\u0f71\u0f80"},
+ {"", "\u0f7f" + rep(0xf71, 28) + "\u0f81", "\u0f7f" + rep(0xf71, 29) + "\u0f80"},
+ {"", "\u0f7f" + rep(0xf81, 16), "\u0f7f" + rep(0xf71, 15) + rep(0xf80, 15) + cgj + "\u0f71\u0f80"},
+
// weird UTF-8
{"\u00E0\xE1", "\x86", "\u00E0\xE1\x86"},
{"a\u0300\u11B7", "\u0300", "\u00E0\u11B7\u0300"},
@@ -780,6 +797,7 @@ var appendTestsNFKC = []AppendTest{
{"", strings.Repeat("a\u0316\u0300", 6), strings.Repeat("\u00E0\u0316", 6)},
// large input.
+ {"", strings.Repeat("a\u0300\u0316", 31), strings.Repeat("\u00E0\u0316", 31)},
{"", strings.Repeat("a\u0300\u0316", 4000), strings.Repeat("\u00E0\u0316", 4000)},
{"", strings.Repeat("\x80\x80", 4000), strings.Repeat("\x80\x80", 4000)},
{"", "\u0041\u0307\u0304", "\u01E0"},
@@ -848,6 +866,12 @@ var appendTestsNFKD = []AppendTest{
"\u0300\u0320a" + grave(34) + "\u0320",
"\u0320\u0300a" + grave(30) + cgj + "\u0320" + grave(4),
},
+ {
+ // U+0F81 TIBETAN VOWEL SIGN REVERSED II splits into two modifiers.
+ "",
+ "a\u0f7f" + rep(0xf71, 29) + "\u0f81",
+ "a\u0f7f" + rep(0xf71, 29) + cgj + "\u0f71\u0f80",
+ },
}
func TestAppend(t *testing.T) {