summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/text/internal
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2019-01-12 18:39:45 +0100
committerRuben Pollan <meskio@sindominio.net>2019-01-17 12:30:32 +0100
commitb1247d2d0d51108c910a73891ff3116e5f032ab1 (patch)
treee9948964f0bfb1ad2df3bc7bad02aa1f41ccfbd8 /vendor/golang.org/x/text/internal
parentefcb8312e31b5c2261b1a1e95ace55b322cfcc27 (diff)
[pkg] all your deps are vendored to us
Diffstat (limited to 'vendor/golang.org/x/text/internal')
-rw-r--r--vendor/golang.org/x/text/internal/catmsg/catmsg.go415
-rw-r--r--vendor/golang.org/x/text/internal/catmsg/catmsg_test.go327
-rw-r--r--vendor/golang.org/x/text/internal/catmsg/codec.go407
-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/colltab/collate_test.go121
-rw-r--r--vendor/golang.org/x/text/internal/colltab/collelem.go371
-rw-r--r--vendor/golang.org/x/text/internal/colltab/collelem_test.go183
-rw-r--r--vendor/golang.org/x/text/internal/colltab/colltab.go105
-rw-r--r--vendor/golang.org/x/text/internal/colltab/colltab_test.go66
-rw-r--r--vendor/golang.org/x/text/internal/colltab/contract.go145
-rw-r--r--vendor/golang.org/x/text/internal/colltab/contract_test.go131
-rw-r--r--vendor/golang.org/x/text/internal/colltab/iter.go178
-rw-r--r--vendor/golang.org/x/text/internal/colltab/iter_test.go63
-rw-r--r--vendor/golang.org/x/text/internal/colltab/numeric.go236
-rw-r--r--vendor/golang.org/x/text/internal/colltab/numeric_test.go159
-rw-r--r--vendor/golang.org/x/text/internal/colltab/table.go275
-rw-r--r--vendor/golang.org/x/text/internal/colltab/trie.go159
-rw-r--r--vendor/golang.org/x/text/internal/colltab/trie_test.go106
-rw-r--r--vendor/golang.org/x/text/internal/colltab/weighter.go31
-rw-r--r--vendor/golang.org/x/text/internal/colltab/weighter_test.go42
-rw-r--r--vendor/golang.org/x/text/internal/format/format.go41
-rw-r--r--vendor/golang.org/x/text/internal/format/parser.go358
-rw-r--r--vendor/golang.org/x/text/internal/format/parser_test.go32
-rw-r--r--vendor/golang.org/x/text/internal/gen/code.go371
-rw-r--r--vendor/golang.org/x/text/internal/gen/gen.go333
-rw-r--r--vendor/golang.org/x/text/internal/internal.go49
-rw-r--r--vendor/golang.org/x/text/internal/internal_test.go38
-rw-r--r--vendor/golang.org/x/text/internal/language/common.go16
-rw-r--r--vendor/golang.org/x/text/internal/language/compact.go29
-rw-r--r--vendor/golang.org/x/text/internal/language/compact/compact.go61
-rw-r--r--vendor/golang.org/x/text/internal/language/compact/gen.go64
-rw-r--r--vendor/golang.org/x/text/internal/language/compact/gen_index.go113
-rw-r--r--vendor/golang.org/x/text/internal/language/compact/gen_parents.go54
-rw-r--r--vendor/golang.org/x/text/internal/language/compact/gen_test.go38
-rw-r--r--vendor/golang.org/x/text/internal/language/compact/language.go260
-rw-r--r--vendor/golang.org/x/text/internal/language/compact/language_test.go236
-rw-r--r--vendor/golang.org/x/text/internal/language/compact/parents.go120
-rw-r--r--vendor/golang.org/x/text/internal/language/compact/parse_test.go196
-rw-r--r--vendor/golang.org/x/text/internal/language/compact/tables.go1015
-rw-r--r--vendor/golang.org/x/text/internal/language/compact/tags.go91
-rw-r--r--vendor/golang.org/x/text/internal/language/compose.go167
-rw-r--r--vendor/golang.org/x/text/internal/language/compose_test.go67
-rw-r--r--vendor/golang.org/x/text/internal/language/coverage.go28
-rw-r--r--vendor/golang.org/x/text/internal/language/gen.go1520
-rw-r--r--vendor/golang.org/x/text/internal/language/gen_common.go20
-rw-r--r--vendor/golang.org/x/text/internal/language/language.go596
-rw-r--r--vendor/golang.org/x/text/internal/language/language_test.go736
-rw-r--r--vendor/golang.org/x/text/internal/language/lookup.go412
-rw-r--r--vendor/golang.org/x/text/internal/language/lookup_test.go457
-rw-r--r--vendor/golang.org/x/text/internal/language/match.go226
-rw-r--r--vendor/golang.org/x/text/internal/language/match_test.go161
-rw-r--r--vendor/golang.org/x/text/internal/language/parse.go594
-rw-r--r--vendor/golang.org/x/text/internal/language/parse_test.go364
-rw-r--r--vendor/golang.org/x/text/internal/language/tables.go3431
-rw-r--r--vendor/golang.org/x/text/internal/language/tags.go48
-rw-r--r--vendor/golang.org/x/text/internal/match.go67
-rw-r--r--vendor/golang.org/x/text/internal/match_test.go56
-rw-r--r--vendor/golang.org/x/text/internal/number/common.go55
-rw-r--r--vendor/golang.org/x/text/internal/number/decimal.go498
-rw-r--r--vendor/golang.org/x/text/internal/number/decimal_test.go329
-rw-r--r--vendor/golang.org/x/text/internal/number/format.go535
-rw-r--r--vendor/golang.org/x/text/internal/number/format_test.go522
-rw-r--r--vendor/golang.org/x/text/internal/number/gen.go458
-rw-r--r--vendor/golang.org/x/text/internal/number/gen_common.go59
-rw-r--r--vendor/golang.org/x/text/internal/number/number.go152
-rw-r--r--vendor/golang.org/x/text/internal/number/number_test.go104
-rw-r--r--vendor/golang.org/x/text/internal/number/pattern.go485
-rw-r--r--vendor/golang.org/x/text/internal/number/pattern_test.go438
-rw-r--r--vendor/golang.org/x/text/internal/number/roundingmode_string.go16
-rw-r--r--vendor/golang.org/x/text/internal/number/tables.go1219
-rw-r--r--vendor/golang.org/x/text/internal/number/tables_test.go126
-rw-r--r--vendor/golang.org/x/text/internal/stringset/set.go86
-rw-r--r--vendor/golang.org/x/text/internal/stringset/set_test.go53
-rw-r--r--vendor/golang.org/x/text/internal/tag/tag.go100
-rw-r--r--vendor/golang.org/x/text/internal/tag/tag_test.go67
-rw-r--r--vendor/golang.org/x/text/internal/testtext/codesize.go53
-rw-r--r--vendor/golang.org/x/text/internal/testtext/flag.go22
-rw-r--r--vendor/golang.org/x/text/internal/testtext/gc.go14
-rw-r--r--vendor/golang.org/x/text/internal/testtext/gccgo.go11
-rw-r--r--vendor/golang.org/x/text/internal/testtext/go1_6.go23
-rw-r--r--vendor/golang.org/x/text/internal/testtext/go1_7.go17
-rw-r--r--vendor/golang.org/x/text/internal/testtext/text.go105
-rw-r--r--vendor/golang.org/x/text/internal/ucd/example_test.go81
-rw-r--r--vendor/golang.org/x/text/internal/ucd/ucd.go371
-rw-r--r--vendor/golang.org/x/text/internal/ucd/ucd_test.go105
86 files changed, 22274 insertions, 0 deletions
diff --git a/vendor/golang.org/x/text/internal/catmsg/catmsg.go b/vendor/golang.org/x/text/internal/catmsg/catmsg.go
new file mode 100644
index 0000000..c0bf86f
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/catmsg/catmsg.go
@@ -0,0 +1,415 @@
+// 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 contains support types for package x/text/message/catalog.
+//
+// This package contains the low-level implementations of Message used by the
+// catalog package and provides primitives for other packages to implement their
+// own. For instance, the plural package provides functionality for selecting
+// translation strings based on the plural category of substitution arguments.
+//
+//
+// Encoding and Decoding
+//
+// Catalogs store Messages encoded as a single string. Compiling a message into
+// a string both results in compacter representation and speeds up evaluation.
+//
+// A Message must implement a Compile method to convert its arbitrary
+// representation to a string. The Compile method takes an Encoder which
+// facilitates serializing the message. Encoders also provide more context of
+// the messages's creation (such as for which language the message is intended),
+// which may not be known at the time of the creation of the message.
+//
+// Each message type must also have an accompanying decoder registered to decode
+// the message. This decoder takes a Decoder argument which provides the
+// counterparts for the decoding.
+//
+//
+// Renderers
+//
+// A Decoder must be initialized with a Renderer implementation. These
+// implementations must be provided by packages that use Catalogs, typically
+// formatting packages such as x/text/message. A typical user will not need to
+// worry about this type; it is only relevant to packages that do string
+// formatting and want to use the catalog package to handle localized strings.
+//
+// A package that uses catalogs for selecting strings receives selection results
+// as sequence of substrings passed to the Renderer. The following snippet shows
+// how to express the above example using the message package.
+//
+// message.Set(language.English, "You are %d minute(s) late.",
+// catalog.Var("minutes", plural.Select(1, "one", "minute")),
+// catalog.String("You are %[1]d ${minutes} late."))
+//
+// p := message.NewPrinter(language.English)
+// p.Printf("You are %d minute(s) late.", 5) // always 5 minutes late.
+//
+// To evaluate the Printf, package message wraps the arguments in a Renderer
+// that is passed to the catalog for message decoding. The call sequence that
+// results from evaluating the above message, assuming the person is rather
+// tardy, is:
+//
+// Render("You are %[1]d ")
+// Arg(1)
+// Render("minutes")
+// Render(" late.")
+//
+// The calls to Arg is caused by the plural.Select execution, which evaluates
+// the argument to determine whether the singular or plural message form should
+// be selected. The calls to Render reports the partial results to the message
+// package for further evaluation.
+package catmsg
+
+import (
+ "errors"
+ "fmt"
+ "strconv"
+ "strings"
+ "sync"
+
+ "golang.org/x/text/language"
+)
+
+// A Handle refers to a registered message type.
+type Handle int
+
+// A Handler decodes and evaluates data compiled by a Message and sends the
+// result to the Decoder. The output may depend on the value of the substitution
+// arguments, accessible by the Decoder's Arg method. The Handler returns false
+// if there is no translation for the given substitution arguments.
+type Handler func(d *Decoder) bool
+
+// Register records the existence of a message type and returns a Handle that
+// can be used in the Encoder's EncodeMessageType method to create such
+// messages. The prefix of the name should be the package path followed by
+// an optional disambiguating string.
+// Register will panic if a handle for the same name was already registered.
+func Register(name string, handler Handler) Handle {
+ mutex.Lock()
+ defer mutex.Unlock()
+
+ if _, ok := names[name]; ok {
+ panic(fmt.Errorf("catmsg: handler for %q already exists", name))
+ }
+ h := Handle(len(handlers))
+ names[name] = h
+ handlers = append(handlers, handler)
+ return h
+}
+
+// These handlers require fixed positions in the handlers slice.
+const (
+ msgVars Handle = iota
+ msgFirst
+ msgRaw
+ msgString
+ msgAffix
+ // Leave some arbitrary room for future expansion: 20 should suffice.
+ numInternal = 20
+)
+
+const prefix = "golang.org/x/text/internal/catmsg."
+
+var (
+ // TODO: find a more stable way to link handles to message types.
+ mutex sync.Mutex
+ names = map[string]Handle{
+ prefix + "Vars": msgVars,
+ prefix + "First": msgFirst,
+ prefix + "Raw": msgRaw,
+ prefix + "String": msgString,
+ prefix + "Affix": msgAffix,
+ }
+ handlers = make([]Handler, numInternal)
+)
+
+func init() {
+ // This handler is a message type wrapper that initializes a decoder
+ // with a variable block. This message type, if present, is always at the
+ // start of an encoded message.
+ handlers[msgVars] = func(d *Decoder) bool {
+ blockSize := int(d.DecodeUint())
+ d.vars = d.data[:blockSize]
+ d.data = d.data[blockSize:]
+ return d.executeMessage()
+ }
+
+ // First takes the first message in a sequence that results in a match for
+ // the given substitution arguments.
+ handlers[msgFirst] = func(d *Decoder) bool {
+ for !d.Done() {
+ if d.ExecuteMessage() {
+ return true
+ }
+ }
+ return false
+ }
+
+ handlers[msgRaw] = func(d *Decoder) bool {
+ d.Render(d.data)
+ return true
+ }
+
+ // A String message alternates between a string constant and a variable
+ // substitution.
+ handlers[msgString] = func(d *Decoder) bool {
+ for !d.Done() {
+ if str := d.DecodeString(); str != "" {
+ d.Render(str)
+ }
+ if d.Done() {
+ break
+ }
+ d.ExecuteSubstitution()
+ }
+ return true
+ }
+
+ handlers[msgAffix] = func(d *Decoder) bool {
+ // TODO: use an alternative method for common cases.
+ prefix := d.DecodeString()
+ suffix := d.DecodeString()
+ if prefix != "" {
+ d.Render(prefix)
+ }
+ ret := d.ExecuteMessage()
+ if suffix != "" {
+ d.Render(suffix)
+ }
+ return ret
+ }
+}
+
+var (
+ // ErrIncomplete indicates a compiled message does not define translations
+ // for all possible argument values. If this message is returned, evaluating
+ // a message may result in the ErrNoMatch error.
+ ErrIncomplete = errors.New("catmsg: incomplete message; may not give result for all inputs")
+
+ // ErrNoMatch indicates no translation message matched the given input
+ // parameters when evaluating a message.
+ ErrNoMatch = errors.New("catmsg: no translation for inputs")
+)
+
+// A Message holds a collection of translations for the same phrase that may
+// vary based on the values of substitution arguments.
+type Message interface {
+ // Compile encodes the format string(s) of the message as a string for later
+ // evaluation.
+ //
+ // The first call Compile makes on the encoder must be EncodeMessageType.
+ // The handle passed to this call may either be a handle returned by
+ // Register to encode a single custom message, or HandleFirst followed by
+ // a sequence of calls to EncodeMessage.
+ //
+ // Compile must return ErrIncomplete if it is possible for evaluation to
+ // not match any translation for a given set of formatting parameters.
+ // For example, selecting a translation based on plural form may not yield
+ // a match if the form "Other" is not one of the selectors.
+ //
+ // Compile may return any other application-specific error. For backwards
+ // compatibility with package like fmt, which often do not do sanity
+ // checking of format strings ahead of time, Compile should still make an
+ // effort to have some sensible fallback in case of an error.
+ Compile(e *Encoder) error
+}
+
+// Compile converts a Message to a data string that can be stored in a Catalog.
+// The resulting string can subsequently be decoded by passing to the Execute
+// method of a Decoder.
+func Compile(tag language.Tag, macros Dictionary, m Message) (data string, err error) {
+ // TODO: pass macros so they can be used for validation.
+ v := &Encoder{inBody: true} // encoder for variables
+ v.root = v
+ e := &Encoder{root: v, parent: v, tag: tag} // encoder for messages
+ err = m.Compile(e)
+ // This package serves te message package, which in turn is meant to be a
+ // drop-in replacement for fmt. With the fmt package, format strings are
+ // evaluated lazily and errors are handled by substituting strings in the
+ // result, rather then returning an error. Dealing with multiple languages
+ // makes it more important to check errors ahead of time. We chose to be
+ // consistent and compatible and allow graceful degradation in case of
+ // errors.
+ buf := e.buf[stripPrefix(e.buf):]
+ if len(v.buf) > 0 {
+ // Prepend variable block.
+ b := make([]byte, 1+maxVarintBytes+len(v.buf)+len(buf))
+ b[0] = byte(msgVars)
+ b = b[:1+encodeUint(b[1:], uint64(len(v.buf)))]
+ b = append(b, v.buf...)
+ b = append(b, buf...)
+ buf = b
+ }
+ if err == nil {
+ err = v.err
+ }
+ return string(buf), err
+}
+
+// FirstOf is a message type that prints the first message in the sequence that
+// resolves to a match for the given substitution arguments.
+type FirstOf []Message
+
+// Compile implements Message.
+func (s FirstOf) Compile(e *Encoder) error {
+ e.EncodeMessageType(msgFirst)
+ err := ErrIncomplete
+ for i, m := range s {
+ if err == nil {
+ return fmt.Errorf("catalog: message argument %d is complete and blocks subsequent messages", i-1)
+ }
+ err = e.EncodeMessage(m)
+ }
+ return err
+}
+
+// Var defines a message that can be substituted for a placeholder of the same
+// name. If an expression does not result in a string after evaluation, Name is
+// used as the substitution. For example:
+// Var{
+// Name: "minutes",
+// Message: plural.Select(1, "one", "minute"),
+// }
+// will resolve to minute for singular and minutes for plural forms.
+type Var struct {
+ Name string
+ Message Message
+}
+
+var errIsVar = errors.New("catmsg: variable used as message")
+
+// Compile implements Message.
+//
+// Note that this method merely registers a variable; it does not create an
+// encoded message.
+func (v *Var) Compile(e *Encoder) error {
+ if err := e.addVar(v.Name, v.Message); err != nil {
+ return err
+ }
+ // Using a Var by itself is an error. If it is in a sequence followed by
+ // other messages referring to it, this error will be ignored.
+ return errIsVar
+}
+
+// Raw is a message consisting of a single format string that is passed as is
+// to the Renderer.
+//
+// Note that a Renderer may still do its own variable substitution.
+type Raw string
+
+// Compile implements Message.
+func (r Raw) Compile(e *Encoder) (err error) {
+ e.EncodeMessageType(msgRaw)
+ // Special case: raw strings don't have a size encoding and so don't use
+ // EncodeString.
+ e.buf = append(e.buf, r...)
+ return nil
+}
+
+// String is a message consisting of a single format string which contains
+// placeholders that may be substituted with variables.
+//
+// Variable substitutions are marked with placeholders and a variable name of
+// the form ${name}. Any other substitutions such as Go templates or
+// printf-style substitutions are left to be done by the Renderer.
+//
+// When evaluation a string interpolation, a Renderer will receive separate
+// calls for each placeholder and interstitial string. For example, for the
+// message: "%[1]v ${invites} %[2]v to ${their} party." The sequence of calls
+// is:
+// d.Render("%[1]v ")
+// d.Arg(1)
+// d.Render(resultOfInvites)
+// d.Render(" %[2]v to ")
+// d.Arg(2)
+// d.Render(resultOfTheir)
+// d.Render(" party.")
+// where the messages for "invites" and "their" both use a plural.Select
+// referring to the first argument.
+//
+// Strings may also invoke macros. Macros are essentially variables that can be
+// reused. Macros may, for instance, be used to make selections between
+// different conjugations of a verb. See the catalog package description for an
+// overview of macros.
+type String string
+
+// Compile implements Message. It parses the placeholder formats and returns
+// any error.
+func (s String) Compile(e *Encoder) (err error) {
+ msg := string(s)
+ const subStart = "${"
+ hasHeader := false
+ p := 0
+ b := []byte{}
+ for {
+ i := strings.Index(msg[p:], subStart)
+ if i == -1 {
+ break
+ }
+ b = append(b, msg[p:p+i]...)
+ p += i + len(subStart)
+ if i = strings.IndexByte(msg[p:], '}'); i == -1 {
+ b = append(b, "$!(MISSINGBRACE)"...)
+ err = fmt.Errorf("catmsg: missing '}'")
+ p = len(msg)
+ break
+ }
+ name := strings.TrimSpace(msg[p : p+i])
+ if q := strings.IndexByte(name, '('); q == -1 {
+ if !hasHeader {
+ hasHeader = true
+ e.EncodeMessageType(msgString)
+ }
+ e.EncodeString(string(b))
+ e.EncodeSubstitution(name)
+ b = b[:0]
+ } else if j := strings.IndexByte(name[q:], ')'); j == -1 {
+ // TODO: what should the error be?
+ b = append(b, "$!(MISSINGPAREN)"...)
+ err = fmt.Errorf("catmsg: missing ')'")
+ } else if x, sErr := strconv.ParseUint(strings.TrimSpace(name[q+1:q+j]), 10, 32); sErr != nil {
+ // TODO: handle more than one argument
+ b = append(b, "$!(BADNUM)"...)
+ err = fmt.Errorf("catmsg: invalid number %q", strings.TrimSpace(name[q+1:q+j]))
+ } else {
+ if !hasHeader {
+ hasHeader = true
+ e.EncodeMessageType(msgString)
+ }
+ e.EncodeString(string(b))
+ e.EncodeSubstitution(name[:q], int(x))
+ b = b[:0]
+ }
+ p += i + 1
+ }
+ b = append(b, msg[p:]...)
+ if !hasHeader {
+ // Simplify string to a raw string.
+ Raw(string(b)).Compile(e)
+ } else if len(b) > 0 {
+ e.EncodeString(string(b))
+ }
+ return err
+}
+
+// Affix is a message that adds a prefix and suffix to another message.
+// This is mostly used add back whitespace to a translation that was stripped
+// before sending it out.
+type Affix struct {
+ Message Message
+ Prefix string
+ Suffix string
+}
+
+// Compile implements Message.
+func (a Affix) Compile(e *Encoder) (err error) {
+ // TODO: consider adding a special message type that just adds a single
+ // return. This is probably common enough to handle the majority of cases.
+ // Get some stats first, though.
+ e.EncodeMessageType(msgAffix)
+ e.EncodeString(a.Prefix)
+ e.EncodeString(a.Suffix)
+ e.EncodeMessage(a.Message)
+ return nil
+}
diff --git a/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go b/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go
new file mode 100644
index 0000000..b2a7a9e
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go
@@ -0,0 +1,327 @@
+// 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 (
+ "errors"
+ "strings"
+ "testing"
+
+ "golang.org/x/text/language"
+)
+
+type renderer struct {
+ args []int
+ result string
+}
+
+func (r *renderer) Arg(i int) interface{} {
+ if i >= len(r.args) {
+ return nil
+ }
+ return r.args[i]
+}
+
+func (r *renderer) Render(s string) {
+ if r.result != "" {
+ r.result += "|"
+ }
+ r.result += s
+}
+
+func TestCodec(t *testing.T) {
+ type test struct {
+ args []int
+ out string
+ decErr string
+ }
+ single := func(out, err string) []test { return []test{{out: out, decErr: err}} }
+ testCases := []struct {
+ desc string
+ m Message
+ enc string
+ encErr string
+ tests []test
+ }{{
+ desc: "unused variable",
+ m: &Var{"name", String("foo")},
+ encErr: errIsVar.Error(),
+ tests: single("", ""),
+ }, {
+ desc: "empty",
+ m: empty{},
+ tests: single("", ""),
+ }, {
+ desc: "sequence with empty",
+ m: seq{empty{}},
+ tests: single("", ""),
+ }, {
+ desc: "raw string",
+ m: Raw("foo"),
+ tests: single("foo", ""),
+ }, {
+ desc: "raw string no sub",
+ m: Raw("${foo}"),
+ enc: "\x02${foo}",
+ tests: single("${foo}", ""),
+ }, {
+ desc: "simple string",
+ m: String("foo"),
+ tests: single("foo", ""),
+ }, {
+ desc: "affix",
+ m: &Affix{String("foo"), "\t", "\n"},
+ tests: single("\t|foo|\n", ""),
+ }, {
+ desc: "missing var",
+ m: String("foo${bar}"),
+ enc: "\x03\x03foo\x02\x03bar",
+ encErr: `unknown var "bar"`,
+ tests: single("foo|bar", ""),
+ }, {
+ desc: "empty var",
+ m: seq{
+ &Var{"bar", seq{}},
+ String("foo${bar}"),
+ },
+ enc: "\x00\x05\x04\x02bar\x03\x03foo\x00\x00",
+ // TODO: recognize that it is cheaper to substitute bar.
+ tests: single("foo|bar", ""),
+ }, {
+ desc: "var after value",
+ m: seq{
+ String("foo${bar}"),
+ &Var{"bar", String("baz")},
+ },
+ encErr: errIsVar.Error(),
+ tests: single("foo|bar", ""),
+ }, {
+ desc: "substitution",
+ m: seq{
+ &Var{"bar", String("baz")},
+ String("foo${bar}"),
+ },
+ tests: single("foo|baz", ""),
+ }, {
+ desc: "affix with substitution",
+ m: &Affix{seq{
+ &Var{"bar", String("baz")},
+ String("foo${bar}"),
+ }, "\t", "\n"},
+ tests: single("\t|foo|baz|\n", ""),
+ }, {
+ desc: "shadowed variable",
+ m: seq{
+ &Var{"bar", String("baz")},
+ seq{
+ &Var{"bar", String("BAZ")},
+ String("foo${bar}"),
+ },
+ },
+ tests: single("foo|BAZ", ""),
+ }, {
+ desc: "nested value",
+ m: nestedLang{nestedLang{empty{}}},
+ tests: single("nl|nl", ""),
+ }, {
+ desc: "not shadowed variable",
+ m: seq{
+ &Var{"bar", String("baz")},
+ seq{
+ String("foo${bar}"),
+ &Var{"bar", String("BAZ")},
+ },
+ },
+ encErr: errIsVar.Error(),
+ tests: single("foo|baz", ""),
+ }, {
+ desc: "duplicate variable",
+ m: seq{
+ &Var{"bar", String("baz")},
+ &Var{"bar", String("BAZ")},
+ String("${bar}"),
+ },
+ encErr: "catmsg: duplicate variable \"bar\"",
+ tests: single("baz", ""),
+ }, {
+ desc: "complete incomplete variable",
+ m: seq{
+ &Var{"bar", incomplete{}},
+ String("${bar}"),
+ },
+ enc: "\x00\t\b\x01\x01\x14\x04\x02bar\x03\x00\x00\x00",
+ // TODO: recognize that it is cheaper to substitute bar.
+ tests: single("bar", ""),
+ }, {
+ desc: "incomplete sequence",
+ m: seq{
+ incomplete{},
+ incomplete{},
+ },
+ encErr: ErrIncomplete.Error(),
+ tests: single("", ErrNoMatch.Error()),
+ }, {
+ desc: "compile error variable",
+ m: seq{
+ &Var{"bar", errorCompileMsg{}},
+ String("${bar}"),
+ },
+ encErr: errCompileTest.Error(),
+ tests: single("bar", ""),
+ }, {
+ desc: "compile error message",
+ m: errorCompileMsg{},
+ encErr: errCompileTest.Error(),
+ tests: single("", ""),
+ }, {
+ desc: "compile error sequence",
+ m: seq{
+ errorCompileMsg{},
+ errorCompileMsg{},
+ },
+ encErr: errCompileTest.Error(),
+ tests: single("", ""),
+ }, {
+ desc: "macro",
+ m: String("${exists(1)}"),
+ tests: single("you betya!", ""),
+ }, {
+ desc: "macro incomplete",
+ m: String("${incomplete(1)}"),
+ enc: "\x03\x00\x01\nincomplete\x01",
+ tests: single("incomplete", ""),
+ }, {
+ desc: "macro undefined at end",
+ m: String("${undefined(1)}"),
+ enc: "\x03\x00\x01\tundefined\x01",
+ tests: single("undefined", "catmsg: undefined macro \"undefined\""),
+ }, {
+ desc: "macro undefined with more text following",
+ m: String("${undefined(1)}."),
+ enc: "\x03\x00\x01\tundefined\x01\x01.",
+ tests: single("undefined|.", "catmsg: undefined macro \"undefined\""),
+ }, {
+ desc: "macro missing paren",
+ m: String("${missing(1}"),
+ encErr: "catmsg: missing ')'",
+ tests: single("$!(MISSINGPAREN)", ""),
+ }, {
+ desc: "macro bad num",
+ m: String("aa${bad(a)}"),
+ encErr: "catmsg: invalid number \"a\"",
+ tests: single("aa$!(BADNUM)", ""),
+ }, {
+ desc: "var missing brace",
+ m: String("a${missing"),
+ encErr: "catmsg: missing '}'",
+ tests: single("a$!(MISSINGBRACE)", ""),
+ }}
+ r := &renderer{}
+ dec := NewDecoder(language.Und, r, macros)
+ for _, tc := range testCases {
+ t.Run(tc.desc, func(t *testing.T) {
+ // Use a language other than Und so that we can test
+ // passing the language to nested values.
+ data, err := Compile(language.Dutch, macros, tc.m)
+ if failErr(err, tc.encErr) {
+ t.Errorf("encoding error: got %+q; want %+q", err, tc.encErr)
+ }
+ if tc.enc != "" && data != tc.enc {
+ t.Errorf("encoding: got %+q; want %+q", data, tc.enc)
+ }
+ for _, st := range tc.tests {
+ t.Run("", func(t *testing.T) {
+ *r = renderer{args: st.args}
+ if err = dec.Execute(data); failErr(err, st.decErr) {
+ t.Errorf("decoding error: got %+q; want %+q", err, st.decErr)
+ }
+ if r.result != st.out {
+ t.Errorf("decode: got %+q; want %+q", r.result, st.out)
+ }
+ })
+ }
+ })
+ }
+}
+
+func failErr(got error, want string) bool {
+ if got == nil {
+ return want != ""
+ }
+ return want == "" || !strings.Contains(got.Error(), want)
+}
+
+type seq []Message
+
+func (s seq) Compile(e *Encoder) (err error) {
+ err = ErrIncomplete
+ e.EncodeMessageType(msgFirst)
+ for _, m := range s {
+ // Pass only the last error, but allow erroneous or complete messages
+ // here to allow testing different scenarios.
+ err = e.EncodeMessage(m)
+ }
+ return err
+}
+
+type empty struct{}
+
+func (empty) Compile(e *Encoder) (err error) { return nil }
+
+var msgIncomplete = Register(
+ "golang.org/x/text/internal/catmsg.incomplete",
+ func(d *Decoder) bool { return false })
+
+type incomplete struct{}
+
+func (incomplete) Compile(e *Encoder) (err error) {
+ e.EncodeMessageType(msgIncomplete)
+ return ErrIncomplete
+}
+
+var msgNested = Register(
+ "golang.org/x/text/internal/catmsg.nested",
+ func(d *Decoder) bool {
+ d.Render(d.DecodeString())
+ d.ExecuteMessage()
+ return true
+ })
+
+type nestedLang struct{ Message }
+
+func (n nestedLang) Compile(e *Encoder) (err error) {
+ e.EncodeMessageType(msgNested)
+ e.EncodeString(e.Language().String())
+ e.EncodeMessage(n.Message)
+ return nil
+}
+
+type errorCompileMsg struct{}
+
+var errCompileTest = errors.New("catmsg: compile error test")
+
+func (errorCompileMsg) Compile(e *Encoder) (err error) {
+ return errCompileTest
+}
+
+type dictionary struct{}
+
+var (
+ macros = dictionary{}
+ dictMessages = map[string]string{
+ "exists": compile(String("you betya!")),
+ "incomplete": compile(incomplete{}),
+ }
+)
+
+func (d dictionary) Lookup(key string) (data string, ok bool) {
+ data, ok = dictMessages[key]
+ return
+}
+
+func compile(m Message) (data string) {
+ data, _ = Compile(language.Und, macros, m)
+ return data
+}
diff --git a/vendor/golang.org/x/text/internal/catmsg/codec.go b/vendor/golang.org/x/text/internal/catmsg/codec.go
new file mode 100644
index 0000000..49c9fc9
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/catmsg/codec.go
@@ -0,0 +1,407 @@
+// 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 (
+ "errors"
+ "fmt"
+
+ "golang.org/x/text/language"
+)
+
+// A Renderer renders a Message.
+type Renderer interface {
+ // Render renders the given string. The given string may be interpreted as a
+ // format string, such as the one used by the fmt package or a template.
+ Render(s string)
+
+ // Arg returns the i-th argument passed to format a message. This method
+ // should return nil if there is no such argument. Messages need access to
+ // arguments to allow selecting a message based on linguistic features of
+ // those arguments.
+ Arg(i int) interface{}
+}
+
+// A Dictionary specifies a source of messages, including variables or macros.
+type Dictionary interface {
+ // Lookup returns the message for the given key. It returns false for ok if
+ // such a message could not be found.
+ Lookup(key string) (data string, ok bool)
+
+ // TODO: consider returning an interface, instead of a string. This will
+ // allow implementations to do their own message type decoding.
+}
+
+// An Encoder serializes a Message to a string.
+type Encoder struct {
+ // The root encoder is used for storing encoded variables.
+ root *Encoder
+ // The parent encoder provides the surrounding scopes for resolving variable
+ // names.
+ parent *Encoder
+
+ tag language.Tag
+
+ // buf holds the encoded message so far. After a message completes encoding,
+ // the contents of buf, prefixed by the encoded length, are flushed to the
+ // parent buffer.
+ buf []byte
+
+ // vars is the lookup table of variables in the current scope.
+ vars []keyVal
+
+ err error
+ inBody bool // if false next call must be EncodeMessageType
+}
+
+type keyVal struct {
+ key string
+ offset int
+}
+
+// Language reports the language for which the encoded message will be stored
+// in the Catalog.
+func (e *Encoder) Language() language.Tag { return e.tag }
+
+func (e *Encoder) setError(err error) {
+ if e.root.err == nil {
+ e.root.err = err
+ }
+}
+
+// EncodeUint encodes x.
+func (e *Encoder) EncodeUint(x uint64) {
+ e.checkInBody()
+ var buf [maxVarintBytes]byte
+ n := encodeUint(buf[:], x)
+ e.buf = append(e.buf, buf[:n]...)
+}
+
+// EncodeString encodes s.
+func (e *Encoder) EncodeString(s string) {
+ e.checkInBody()
+ e.EncodeUint(uint64(len(s)))
+ e.buf = append(e.buf, s...)
+}
+
+// EncodeMessageType marks the current message to be of type h.
+//
+// It must be the first call of a Message's Compile method.
+func (e *Encoder) EncodeMessageType(h Handle) {
+ if e.inBody {
+ panic("catmsg: EncodeMessageType not the first method called")
+ }
+ e.inBody = true
+ e.EncodeUint(uint64(h))
+}
+
+// EncodeMessage serializes the given message inline at the current position.
+func (e *Encoder) EncodeMessage(m Message) error {
+ e = &Encoder{root: e.root, parent: e, tag: e.tag}
+ err := m.Compile(e)
+ if _, ok := m.(*Var); !ok {
+ e.flushTo(e.parent)
+ }
+ return err
+}
+
+func (e *Encoder) checkInBody() {
+ if !e.inBody {
+ panic("catmsg: expected prior call to EncodeMessageType")
+ }
+}
+
+// stripPrefix indicates the number of prefix bytes that must be stripped to
+// turn a single-element sequence into a message that is just this single member
+// without its size prefix. If the message can be stripped, b[1:n] contains the
+// size prefix.
+func stripPrefix(b []byte) (n int) {
+ if len(b) > 0 && Handle(b[0]) == msgFirst {
+ x, n, _ := decodeUint(b[1:])
+ if 1+n+int(x) == len(b) {
+ return 1 + n
+ }
+ }
+ return 0
+}
+
+func (e *Encoder) flushTo(dst *Encoder) {
+ data := e.buf
+ p := stripPrefix(data)
+ if p > 0 {
+ data = data[1:]
+ } else {
+ // Prefix the size.
+ dst.EncodeUint(uint64(len(data)))
+ }
+ dst.buf = append(dst.buf, data...)
+}
+
+func (e *Encoder) addVar(key string, m Message) error {
+ for _, v := range e.parent.vars {
+ if v.key == key {
+ err := fmt.Errorf("catmsg: duplicate variable %q", key)
+ e.setError(err)
+ return err
+ }
+ }
+ scope := e.parent
+ // If a variable message is Incomplete, and does not evaluate to a message
+ // during execution, we fall back to the variable name. We encode this by
+ // appending the variable name if the message reports it's incomplete.
+
+ err := m.Compile(e)
+ if err != ErrIncomplete {
+ e.setError(err)
+ }
+ switch {
+ case len(e.buf) == 1 && Handle(e.buf[0]) == msgFirst: // empty sequence
+ e.buf = e.buf[:0]
+ e.inBody = false
+ fallthrough
+ case len(e.buf) == 0:
+ // Empty message.
+ if err := String(key).Compile(e); err != nil {
+ e.setError(err)
+ }
+ case err == ErrIncomplete:
+ if Handle(e.buf[0]) != msgFirst {
+ seq := &Encoder{root: e.root, parent: e}
+ seq.EncodeMessageType(msgFirst)
+ e.flushTo(seq)
+ e = seq
+ }
+ // e contains a sequence; append the fallback string.
+ e.EncodeMessage(String(key))
+ }
+
+ // Flush result to variable heap.
+ offset := len(e.root.buf)
+ e.flushTo(e.root)
+ e.buf = e.buf[:0]
+
+ // Record variable offset in current scope.
+ scope.vars = append(scope.vars, keyVal{key: key, offset: offset})
+ return err
+}
+
+const (
+ substituteVar = iota
+ substituteMacro
+ substituteError
+)
+
+// EncodeSubstitution inserts a resolved reference to a variable or macro.
+//
+// This call must be matched with a call to ExecuteSubstitution at decoding
+// time.
+func (e *Encoder) EncodeSubstitution(name string, arguments ...int) {
+ if arity := len(arguments); arity > 0 {
+ // TODO: also resolve macros.
+ e.EncodeUint(substituteMacro)
+ e.EncodeString(name)
+ for _, a := range arguments {
+ e.EncodeUint(uint64(a))
+ }
+ return
+ }
+ for scope := e; scope != nil; scope = scope.parent {
+ for _, v := range scope.vars {
+ if v.key != name {
+ continue
+ }
+ e.EncodeUint(substituteVar) // TODO: support arity > 0
+ e.EncodeUint(uint64(v.offset))
+ return
+ }
+ }
+ // TODO: refer to dictionary-wide scoped variables.
+ e.EncodeUint(substituteError)
+ e.EncodeString(name)
+ e.setError(fmt.Errorf("catmsg: unknown var %q", name))
+}
+
+// A Decoder deserializes and evaluates messages that are encoded by an encoder.
+type Decoder struct {
+ tag language.Tag
+ dst Renderer
+ macros Dictionary
+
+ err error
+ vars string
+ data string
+
+ macroArg int // TODO: allow more than one argument
+}
+
+// NewDecoder returns a new Decoder.
+//
+// Decoders are designed to be reused for multiple invocations of Execute.
+// Only one goroutine may call Execute concurrently.
+func NewDecoder(tag language.Tag, r Renderer, macros Dictionary) *Decoder {
+ return &Decoder{
+ tag: tag,
+ dst: r,
+ macros: macros,
+ }
+}
+
+func (d *Decoder) setError(err error) {
+ if d.err == nil {
+ d.err = err
+ }
+}
+
+// Language returns the language in which the message is being rendered.
+//
+// The destination language may be a child language of the language used for
+// encoding. For instance, a decoding language of "pt-PT"" is consistent with an
+// encoding language of "pt".
+func (d *Decoder) Language() language.Tag { return d.tag }
+
+// Done reports whether there are more bytes to process in this message.
+func (d *Decoder) Done() bool { return len(d.data) == 0 }
+
+// Render implements Renderer.
+func (d *Decoder) Render(s string) { d.dst.Render(s) }
+
+// Arg implements Renderer.
+//
+// During evaluation of macros, the argument positions may be mapped to
+// arguments that differ from the original call.
+func (d *Decoder) Arg(i int) interface{} {
+ if d.macroArg != 0 {
+ if i != 1 {
+ panic("catmsg: only macros with single argument supported")
+ }
+ i = d.macroArg
+ }
+ return d.dst.Arg(i)
+}
+
+// DecodeUint decodes a number that was encoded with EncodeUint and advances the
+// position.
+func (d *Decoder) DecodeUint() uint64 {
+ x, n, err := decodeUintString(d.data)
+ d.data = d.data[n:]
+ if err != nil {
+ d.setError(err)
+ }
+ return x
+}
+
+// DecodeString decodes a string that was encoded with EncodeString and advances
+// the position.
+func (d *Decoder) DecodeString() string {
+ size := d.DecodeUint()
+ s := d.data[:size]
+ d.data = d.data[size:]
+ return s
+}
+
+// SkipMessage skips the message at the current location and advances the
+// position.
+func (d *Decoder) SkipMessage() {
+ n := int(d.DecodeUint())
+ d.data = d.data[n:]
+}
+
+// Execute decodes and evaluates msg.
+//
+// Only one goroutine may call execute.
+func (d *Decoder) Execute(msg string) error {
+ d.err = nil
+ if !d.execute(msg) {
+ return ErrNoMatch
+ }
+ return d.err
+}
+
+func (d *Decoder) execute(msg string) bool {
+ saved := d.data
+ d.data = msg
+ ok := d.executeMessage()
+ d.data = saved
+ return ok
+}
+
+// executeMessageFromData is like execute, but also decodes a leading message
+// size and clips the given string accordingly.
+//
+// It reports the number of bytes consumed and whether a message was selected.
+func (d *Decoder) executeMessageFromData(s string) (n int, ok bool) {
+ saved := d.data
+ d.data = s
+ size := int(d.DecodeUint())
+ n = len(s) - len(d.data)
+ // Sanitize the setting. This allows skipping a size argument for
+ // RawString and method Done.
+ d.data = d.data[:size]
+ ok = d.executeMessage()
+ n += size - len(d.data)
+ d.data = saved
+ return n, ok
+}
+
+var errUnknownHandler = errors.New("catmsg: string contains unsupported handler")
+
+// executeMessage reads the handle id, initializes the decoder and executes the
+// message. It is assumed that all of d.data[d.p:] is the single message.
+func (d *Decoder) executeMessage() bool {
+ if d.Done() {
+ // We interpret no data as a valid empty message.
+ return true
+ }
+ handle := d.DecodeUint()
+
+ var fn Handler
+ mutex.Lock()
+ if int(handle) < len(handlers) {
+ fn = handlers[handle]
+ }
+ mutex.Unlock()
+ if fn == nil {
+ d.setError(errUnknownHandler)
+ d.execute(fmt.Sprintf("\x02$!(UNKNOWNMSGHANDLER=%#x)", handle))
+ return true
+ }
+ return fn(d)
+}
+
+// ExecuteMessage decodes and executes the message at the current position.
+func (d *Decoder) ExecuteMessage() bool {
+ n, ok := d.executeMessageFromData(d.data)
+ d.data = d.data[n:]
+ return ok
+}
+
+// ExecuteSubstitution executes the message corresponding to the substitution
+// as encoded by EncodeSubstitution.
+func (d *Decoder) ExecuteSubstitution() {
+ switch x := d.DecodeUint(); x {
+ case substituteVar:
+ offset := d.DecodeUint()
+ d.executeMessageFromData(d.vars[offset:])
+ case substituteMacro:
+ name := d.DecodeString()
+ data, ok := d.macros.Lookup(name)
+ old := d.macroArg
+ // TODO: support macros of arity other than 1.
+ d.macroArg = int(d.DecodeUint())
+ switch {
+ case !ok:
+ // TODO: detect this at creation time.
+ d.setError(fmt.Errorf("catmsg: undefined macro %q", name))
+ fallthrough
+ case !d.execute(data):
+ d.dst.Render(name) // fall back to macro name.
+ }
+ d.macroArg = old
+ case substituteError:
+ d.dst.Render(d.DecodeString())
+ default:
+ panic("catmsg: unreachable")
+ }
+}
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 0000000..a2cee2c
--- /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 0000000..04d881d
--- /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.Errorf("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/colltab/collate_test.go b/vendor/golang.org/x/text/internal/colltab/collate_test.go
new file mode 100644
index 0000000..580c85c
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/collate_test.go
@@ -0,0 +1,121 @@
+// Copyright 2014 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 colltab_test
+
+// This file contains tests which need to import package collate, which causes
+// an import cycle when done within package colltab itself.
+
+import (
+ "bytes"
+ "testing"
+ "unicode"
+
+ "golang.org/x/text/collate"
+ "golang.org/x/text/language"
+ "golang.org/x/text/unicode/rangetable"
+)
+
+// assigned is used to only test runes that are inside the scope of the Unicode
+// version used to generation the collation table.
+var assigned = rangetable.Assigned(collate.UnicodeVersion)
+
+func TestNonDigits(t *testing.T) {
+ c := collate.New(language.English, collate.Loose, collate.Numeric)
+
+ // Verify that all non-digit numbers sort outside of the number range.
+ for r, hi := rune(unicode.N.R16[0].Lo), rune(unicode.N.R32[0].Hi); r <= hi; r++ {
+ if unicode.In(r, unicode.Nd) || !unicode.In(r, assigned) {
+ continue
+ }
+ if a := string(r); c.CompareString(a, "0") != -1 && c.CompareString(a, "999999") != 1 {
+ t.Errorf("%+q non-digit number is collated as digit", a)
+ }
+ }
+}
+
+func TestNumericCompare(t *testing.T) {
+ c := collate.New(language.English, collate.Loose, collate.Numeric)
+
+ // Iterate over all digits.
+ for _, r16 := range unicode.Nd.R16 {
+ testDigitCompare(t, c, rune(r16.Lo), rune(r16.Hi))
+ }
+ for _, r32 := range unicode.Nd.R32 {
+ testDigitCompare(t, c, rune(r32.Lo), rune(r32.Hi))
+ }
+}
+
+func testDigitCompare(t *testing.T, c *collate.Collator, zero, nine rune) {
+ if !unicode.In(zero, assigned) {
+ return
+ }
+ n := int(nine - zero + 1)
+ if n%10 != 0 {
+ t.Fatalf("len([%+q, %+q]) = %d; want a multiple of 10", zero, nine, n)
+ }
+ for _, tt := range []struct {
+ prefix string
+ b [11]string
+ }{
+ {
+ prefix: "",
+ b: [11]string{
+ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
+ },
+ },
+ {
+ prefix: "1",
+ b: [11]string{
+ "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
+ },
+ },
+ {
+ prefix: "0",
+ b: [11]string{
+ "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10",
+ },
+ },
+ {
+ prefix: "00",
+ b: [11]string{
+ "000", "001", "002", "003", "004", "005", "006", "007", "008", "009", "010",
+ },
+ },
+ {
+ prefix: "9",
+ b: [11]string{
+ "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "100",
+ },
+ },
+ } {
+ for k := 0; k <= n; k++ {
+ i := k % 10
+ a := tt.prefix + string(zero+rune(i))
+ for j, b := range tt.b {
+ want := 0
+ switch {
+ case i < j:
+ want = -1
+ case i > j:
+ want = 1
+ }
+ got := c.CompareString(a, b)
+ if got != want {
+ t.Errorf("Compare(%+q, %+q) = %d; want %d", a, b, got, want)
+ return
+ }
+ }
+ }
+ }
+}
+
+func BenchmarkNumericWeighter(b *testing.B) {
+ c := collate.New(language.English, collate.Numeric)
+ input := bytes.Repeat([]byte("Testing, testing 123..."), 100)
+ b.SetBytes(int64(2 * len(input)))
+ for i := 0; i < b.N; i++ {
+ c.Compare(input, input)
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/collelem.go b/vendor/golang.org/x/text/internal/colltab/collelem.go
new file mode 100644
index 0000000..396cebd
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/collelem.go
@@ -0,0 +1,371 @@
+// Copyright 2012 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 colltab
+
+import (
+ "fmt"
+ "unicode"
+)
+
+// Level identifies the collation comparison level.
+// The primary level corresponds to the basic sorting of text.
+// The secondary level corresponds to accents and related linguistic elements.
+// The tertiary level corresponds to casing and related concepts.
+// The quaternary level is derived from the other levels by the
+// various algorithms for handling variable elements.
+type Level int
+
+const (
+ Primary Level = iota
+ Secondary
+ Tertiary
+ Quaternary
+ Identity
+
+ NumLevels
+)
+
+const (
+ defaultSecondary = 0x20
+ defaultTertiary = 0x2
+ maxTertiary = 0x1F
+ MaxQuaternary = 0x1FFFFF // 21 bits.
+)
+
+// Elem is a representation of a collation element. This API provides ways to encode
+// and decode Elems. Implementations of collation tables may use values greater
+// or equal to PrivateUse for their own purposes. However, these should never be
+// returned by AppendNext.
+type Elem uint32
+
+const (
+ maxCE Elem = 0xAFFFFFFF
+ PrivateUse = minContract
+ minContract = 0xC0000000
+ maxContract = 0xDFFFFFFF
+ minExpand = 0xE0000000
+ maxExpand = 0xEFFFFFFF
+ minDecomp = 0xF0000000
+)
+
+type ceType int
+
+const (
+ ceNormal ceType = iota // ceNormal includes implicits (ce == 0)
+ ceContractionIndex // rune can be a start of a contraction
+ ceExpansionIndex // rune expands into a sequence of collation elements
+ ceDecompose // rune expands using NFKC decomposition
+)
+
+func (ce Elem) ctype() ceType {
+ if ce <= maxCE {
+ return ceNormal
+ }
+ if ce <= maxContract {
+ return ceContractionIndex
+ } else {
+ if ce <= maxExpand {
+ return ceExpansionIndex
+ }
+ return ceDecompose
+ }
+ panic("should not reach here")
+ return ceType(-1)
+}
+
+// For normal collation elements, we assume that a collation element either has
+// a primary or non-default secondary value, not both.
+// Collation elements with a primary value are of the form
+// 01pppppp pppppppp ppppppp0 ssssssss
+// - p* is primary collation value
+// - s* is the secondary collation value
+// 00pppppp pppppppp ppppppps sssttttt, where
+// - p* is primary collation value
+// - s* offset of secondary from default value.
+// - t* is the tertiary collation value
+// 100ttttt cccccccc pppppppp pppppppp
+// - t* is the tertiar collation value
+// - c* is the canonical combining class
+// - p* is the primary collation value
+// Collation elements with a secondary value are of the form
+// 1010cccc ccccssss ssssssss tttttttt, where
+// - c* is the canonical combining class
+// - s* is the secondary collation value
+// - t* is the tertiary collation value
+// 11qqqqqq qqqqqqqq qqqqqqq0 00000000
+// - q* quaternary value
+const (
+ ceTypeMask = 0xC0000000
+ ceTypeMaskExt = 0xE0000000
+ ceIgnoreMask = 0xF00FFFFF
+ ceType1 = 0x40000000
+ ceType2 = 0x00000000
+ ceType3or4 = 0x80000000
+ ceType4 = 0xA0000000
+ ceTypeQ = 0xC0000000
+ Ignore = ceType4
+ firstNonPrimary = 0x80000000
+ lastSpecialPrimary = 0xA0000000
+ secondaryMask = 0x80000000
+ hasTertiaryMask = 0x40000000
+ primaryValueMask = 0x3FFFFE00
+ maxPrimaryBits = 21
+ compactPrimaryBits = 16
+ maxSecondaryBits = 12
+ maxTertiaryBits = 8
+ maxCCCBits = 8
+ maxSecondaryCompactBits = 8
+ maxSecondaryDiffBits = 4
+ maxTertiaryCompactBits = 5
+ primaryShift = 9
+ compactSecondaryShift = 5
+ minCompactSecondary = defaultSecondary - 4
+)
+
+func makeImplicitCE(primary int) Elem {
+ return ceType1 | Elem(primary<<primaryShift) | defaultSecondary
+}
+
+// MakeElem returns an Elem for the given values. It will return an error
+// if the given combination of values is invalid.
+func MakeElem(primary, secondary, tertiary int, ccc uint8) (Elem, error) {
+ if w := primary; w >= 1<<maxPrimaryBits || w < 0 {
+ return 0, fmt.Errorf("makeCE: primary weight out of bounds: %x >= %x", w, 1<<maxPrimaryBits)
+ }
+ if w := secondary; w >= 1<<maxSecondaryBits || w < 0 {
+ return 0, fmt.Errorf("makeCE: secondary weight out of bounds: %x >= %x", w, 1<<maxSecondaryBits)
+ }
+ if w := tertiary; w >= 1<<maxTertiaryBits || w < 0 {
+ return 0, fmt.Errorf("makeCE: tertiary weight out of bounds: %x >= %x", w, 1<<maxTertiaryBits)
+ }
+ ce := Elem(0)
+ if primary != 0 {
+ if ccc != 0 {
+ if primary >= 1<<compactPrimaryBits {
+ return 0, fmt.Errorf("makeCE: primary weight with non-zero CCC out of bounds: %x >= %x", primary, 1<<compactPrimaryBits)
+ }
+ if secondary != defaultSecondary {
+ return 0, fmt.Errorf("makeCE: cannot combine non-default secondary value (%x) with non-zero CCC (%x)", secondary, ccc)
+ }
+ ce = Elem(tertiary << (compactPrimaryBits + maxCCCBits))
+ ce |= Elem(ccc) << compactPrimaryBits
+ ce |= Elem(primary)
+ ce |= ceType3or4
+ } else if tertiary == defaultTertiary {
+ if secondary >= 1<<maxSecondaryCompactBits {
+ return 0, fmt.Errorf("makeCE: secondary weight with non-zero primary out of bounds: %x >= %x", secondary, 1<<maxSecondaryCompactBits)
+ }
+ ce = Elem(primary<<(maxSecondaryCompactBits+1) + secondary)
+ ce |= ceType1
+ } else {
+ d := secondary - defaultSecondary + maxSecondaryDiffBits
+ if d >= 1<<maxSecondaryDiffBits || d < 0 {
+ return 0, fmt.Errorf("makeCE: secondary weight diff out of bounds: %x < 0 || %x > %x", d, d, 1<<maxSecondaryDiffBits)
+ }
+ if tertiary >= 1<<maxTertiaryCompactBits {
+ return 0, fmt.Errorf("makeCE: tertiary weight with non-zero primary out of bounds: %x > %x", tertiary, 1<<maxTertiaryCompactBits)
+ }
+ ce = Elem(primary<<maxSecondaryDiffBits + d)
+ ce = ce<<maxTertiaryCompactBits + Elem(tertiary)
+ }
+ } else {
+ ce = Elem(secondary<<maxTertiaryBits + tertiary)
+ ce += Elem(ccc) << (maxSecondaryBits + maxTertiaryBits)
+ ce |= ceType4
+ }
+ return ce, nil
+}
+
+// MakeQuaternary returns an Elem with the given quaternary value.
+func MakeQuaternary(v int) Elem {
+ return ceTypeQ | Elem(v<<primaryShift)
+}
+
+// Mask sets weights for any level smaller than l to 0.
+// The resulting Elem can be used to test for equality with
+// other Elems to which the same mask has been applied.
+func (ce Elem) Mask(l Level) uint32 {
+ return 0
+}
+
+// CCC returns the canonical combining class associated with the underlying character,
+// if applicable, or 0 otherwise.
+func (ce Elem) CCC() uint8 {
+ if ce&ceType3or4 != 0 {
+ if ce&ceType4 == ceType3or4 {
+ return uint8(ce >> 16)
+ }
+ return uint8(ce >> 20)
+ }
+ return 0
+}
+
+// Primary returns the primary collation weight for ce.
+func (ce Elem) Primary() int {
+ if ce >= firstNonPrimary {
+ if ce > lastSpecialPrimary {
+ return 0
+ }
+ return int(uint16(ce))
+ }
+ return int(ce&primaryValueMask) >> primaryShift
+}
+
+// Secondary returns the secondary collation weight for ce.
+func (ce Elem) Secondary() int {
+ switch ce & ceTypeMask {
+ case ceType1:
+ return int(uint8(ce))
+ case ceType2:
+ return minCompactSecondary + int((ce>>compactSecondaryShift)&0xF)
+ case ceType3or4:
+ if ce < ceType4 {
+ return defaultSecondary
+ }
+ return int(ce>>8) & 0xFFF
+ case ceTypeQ:
+ return 0
+ }
+ panic("should not reach here")
+}
+
+// Tertiary returns the tertiary collation weight for ce.
+func (ce Elem) Tertiary() uint8 {
+ if ce&hasTertiaryMask == 0 {
+ if ce&ceType3or4 == 0 {
+ return uint8(ce & 0x1F)
+ }
+ if ce&ceType4 == ceType4 {
+ return uint8(ce)
+ }
+ return uint8(ce>>24) & 0x1F // type 2
+ } else if ce&ceTypeMask == ceType1 {
+ return defaultTertiary
+ }
+ // ce is a quaternary value.
+ return 0
+}
+
+func (ce Elem) updateTertiary(t uint8) Elem {
+ if ce&ceTypeMask == ceType1 {
+ // convert to type 4
+ nce := ce & primaryValueMask
+ nce |= Elem(uint8(ce)-minCompactSecondary) << compactSecondaryShift
+ ce = nce
+ } else if ce&ceTypeMaskExt == ceType3or4 {
+ ce &= ^Elem(maxTertiary << 24)
+ return ce | (Elem(t) << 24)
+ } else {
+ // type 2 or 4
+ ce &= ^Elem(maxTertiary)
+ }
+ return ce | Elem(t)
+}
+
+// Quaternary returns the quaternary value if explicitly specified,
+// 0 if ce == Ignore, or MaxQuaternary otherwise.
+// Quaternary values are used only for shifted variants.
+func (ce Elem) Quaternary() int {
+ if ce&ceTypeMask == ceTypeQ {
+ return int(ce&primaryValueMask) >> primaryShift
+ } else if ce&ceIgnoreMask == Ignore {
+ return 0
+ }
+ return MaxQuaternary
+}
+
+// Weight returns the collation weight for the given level.
+func (ce Elem) Weight(l Level) int {
+ switch l {
+ case Primary:
+ return ce.Primary()
+ case Secondary:
+ return ce.Secondary()
+ case Tertiary:
+ return int(ce.Tertiary())
+ case Quaternary:
+ return ce.Quaternary()
+ }
+ return 0 // return 0 (ignore) for undefined levels.
+}
+
+// For contractions, collation elements are of the form
+// 110bbbbb bbbbbbbb iiiiiiii iiiinnnn, where
+// - n* is the size of the first node in the contraction trie.
+// - i* is the index of the first node in the contraction trie.
+// - b* is the offset into the contraction collation element table.
+// See contract.go for details on the contraction trie.
+const (
+ maxNBits = 4
+ maxTrieIndexBits = 12
+ maxContractOffsetBits = 13
+)
+
+func splitContractIndex(ce Elem) (index, n, offset int) {
+ n = int(ce & (1<<maxNBits - 1))
+ ce >>= maxNBits
+ index = int(ce & (1<<maxTrieIndexBits - 1))
+ ce >>= maxTrieIndexBits
+ offset = int(ce & (1<<maxContractOffsetBits - 1))
+ return
+}
+
+// For expansions, Elems are of the form 11100000 00000000 bbbbbbbb bbbbbbbb,
+// where b* is the index into the expansion sequence table.
+const maxExpandIndexBits = 16
+
+func splitExpandIndex(ce Elem) (index int) {
+ return int(uint16(ce))
+}
+
+// Some runes can be expanded using NFKD decomposition. Instead of storing the full
+// sequence of collation elements, we decompose the rune and lookup the collation
+// elements for each rune in the decomposition and modify the tertiary weights.
+// The Elem, in this case, is of the form 11110000 00000000 wwwwwwww vvvvvvvv, where
+// - v* is the replacement tertiary weight for the first rune,
+// - w* is the replacement tertiary weight for the second rune,
+// Tertiary weights of subsequent runes should be replaced with maxTertiary.
+// See https://www.unicode.org/reports/tr10/#Compatibility_Decompositions for more details.
+func splitDecompose(ce Elem) (t1, t2 uint8) {
+ return uint8(ce), uint8(ce >> 8)
+}
+
+const (
+ // These constants were taken from https://www.unicode.org/versions/Unicode6.0.0/ch12.pdf.
+ minUnified rune = 0x4E00
+ maxUnified = 0x9FFF
+ minCompatibility = 0xF900
+ maxCompatibility = 0xFAFF
+ minRare = 0x3400
+ maxRare = 0x4DBF
+)
+const (
+ commonUnifiedOffset = 0x10000
+ rareUnifiedOffset = 0x20000 // largest rune in common is U+FAFF
+ otherOffset = 0x50000 // largest rune in rare is U+2FA1D
+ illegalOffset = otherOffset + int(unicode.MaxRune)
+ maxPrimary = illegalOffset + 1
+)
+
+// implicitPrimary returns the primary weight for the a rune
+// for which there is no entry for the rune in the collation table.
+// We take a different approach from the one specified in
+// https://unicode.org/reports/tr10/#Implicit_Weights,
+// but preserve the resulting relative ordering of the runes.
+func implicitPrimary(r rune) int {
+ if unicode.Is(unicode.Ideographic, r) {
+ if r >= minUnified && r <= maxUnified {
+ // The most common case for CJK.
+ return int(r) + commonUnifiedOffset
+ }
+ if r >= minCompatibility && r <= maxCompatibility {
+ // This will typically not hit. The DUCET explicitly specifies mappings
+ // for all characters that do not decompose.
+ return int(r) + commonUnifiedOffset
+ }
+ return int(r) + rareUnifiedOffset
+ }
+ return int(r) + otherOffset
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/collelem_test.go b/vendor/golang.org/x/text/internal/colltab/collelem_test.go
new file mode 100644
index 0000000..f131ecc
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/collelem_test.go
@@ -0,0 +1,183 @@
+// Copyright 2012 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 colltab
+
+import (
+ "fmt"
+ "testing"
+ "unicode"
+)
+
+func (e Elem) String() string {
+ q := ""
+ if v := e.Quaternary(); v == MaxQuaternary {
+ q = "max"
+ } else {
+ q = fmt.Sprint(v)
+ }
+ return fmt.Sprintf("[%d, %d, %d, %s]",
+ e.Primary(),
+ e.Secondary(),
+ e.Tertiary(),
+ q)
+}
+
+type ceTest struct {
+ f func(inout []int) (Elem, ceType)
+ arg []int
+}
+
+func makeCE(weights []int) Elem {
+ ce, _ := MakeElem(weights[0], weights[1], weights[2], uint8(weights[3]))
+ return ce
+}
+
+var defaultValues = []int{0, defaultSecondary, defaultTertiary, 0}
+
+func e(w ...int) Elem {
+ return makeCE(append(w, defaultValues[len(w):]...))
+}
+
+func makeContractIndex(index, n, offset int) Elem {
+ const (
+ contractID = 0xC0000000
+ maxNBits = 4
+ maxTrieIndexBits = 12
+ maxContractOffsetBits = 13
+ )
+ ce := Elem(contractID)
+ ce += Elem(offset << (maxNBits + maxTrieIndexBits))
+ ce += Elem(index << maxNBits)
+ ce += Elem(n)
+ return ce
+}
+
+func makeExpandIndex(index int) Elem {
+ const expandID = 0xE0000000
+ return expandID + Elem(index)
+}
+
+func makeDecompose(t1, t2 int) Elem {
+ const decompID = 0xF0000000
+ return Elem(t2<<8+t1) + decompID
+}
+
+func normalCE(inout []int) (ce Elem, t ceType) {
+ ce = makeCE(inout)
+ inout[0] = ce.Primary()
+ inout[1] = ce.Secondary()
+ inout[2] = int(ce.Tertiary())
+ inout[3] = int(ce.CCC())
+ return ce, ceNormal
+}
+
+func expandCE(inout []int) (ce Elem, t ceType) {
+ ce = makeExpandIndex(inout[0])
+ inout[0] = splitExpandIndex(ce)
+ return ce, ceExpansionIndex
+}
+
+func contractCE(inout []int) (ce Elem, t ceType) {
+ ce = makeContractIndex(inout[0], inout[1], inout[2])
+ i, n, o := splitContractIndex(ce)
+ inout[0], inout[1], inout[2] = i, n, o
+ return ce, ceContractionIndex
+}
+
+func decompCE(inout []int) (ce Elem, t ceType) {
+ ce = makeDecompose(inout[0], inout[1])
+ t1, t2 := splitDecompose(ce)
+ inout[0], inout[1] = int(t1), int(t2)
+ return ce, ceDecompose
+}
+
+var ceTests = []ceTest{
+ {normalCE, []int{0, 0, 0, 0}},
+ {normalCE, []int{0, 30, 3, 0}},
+ {normalCE, []int{0, 30, 3, 0xFF}},
+ {normalCE, []int{100, defaultSecondary, defaultTertiary, 0}},
+ {normalCE, []int{100, defaultSecondary, defaultTertiary, 0xFF}},
+ {normalCE, []int{100, defaultSecondary, 3, 0}},
+ {normalCE, []int{0x123, defaultSecondary, 8, 0xFF}},
+
+ {contractCE, []int{0, 0, 0}},
+ {contractCE, []int{1, 1, 1}},
+ {contractCE, []int{1, (1 << maxNBits) - 1, 1}},
+ {contractCE, []int{(1 << maxTrieIndexBits) - 1, 1, 1}},
+ {contractCE, []int{1, 1, (1 << maxContractOffsetBits) - 1}},
+
+ {expandCE, []int{0}},
+ {expandCE, []int{5}},
+ {expandCE, []int{(1 << maxExpandIndexBits) - 1}},
+
+ {decompCE, []int{0, 0}},
+ {decompCE, []int{1, 1}},
+ {decompCE, []int{0x1F, 0x1F}},
+}
+
+func TestColElem(t *testing.T) {
+ for i, tt := range ceTests {
+ inout := make([]int, len(tt.arg))
+ copy(inout, tt.arg)
+ ce, typ := tt.f(inout)
+ if ce.ctype() != typ {
+ t.Errorf("%d: type is %d; want %d (ColElem: %X)", i, ce.ctype(), typ, ce)
+ }
+ for j, a := range tt.arg {
+ if inout[j] != a {
+ t.Errorf("%d: argument %d is %X; want %X (ColElem: %X)", i, j, inout[j], a, ce)
+ }
+ }
+ }
+}
+
+type implicitTest struct {
+ r rune
+ p int
+}
+
+var implicitTests = []implicitTest{
+ {0x33FF, 0x533FF},
+ {0x3400, 0x23400},
+ {0x4DC0, 0x54DC0},
+ {0x4DFF, 0x54DFF},
+ {0x4E00, 0x14E00},
+ {0x9FCB, 0x19FCB},
+ {0xA000, 0x5A000},
+ {0xF8FF, 0x5F8FF},
+ {0xF900, 0x1F900},
+ {0xFA23, 0x1FA23},
+ {0xFAD9, 0x1FAD9},
+ {0xFB00, 0x5FB00},
+ {0x20000, 0x40000},
+ {0x2B81C, 0x4B81C},
+ {unicode.MaxRune, 0x15FFFF}, // maximum primary value
+}
+
+func TestImplicit(t *testing.T) {
+ for _, tt := range implicitTests {
+ if p := implicitPrimary(tt.r); p != tt.p {
+ t.Errorf("%U: was %X; want %X", tt.r, p, tt.p)
+ }
+ }
+}
+
+func TestUpdateTertiary(t *testing.T) {
+ tests := []struct {
+ in, out Elem
+ t uint8
+ }{
+ {0x4000FE20, 0x0000FE8A, 0x0A},
+ {0x4000FE21, 0x0000FEAA, 0x0A},
+ {0x0000FE8B, 0x0000FE83, 0x03},
+ {0x82FF0188, 0x9BFF0188, 0x1B},
+ {0xAFF0CC02, 0xAFF0CC1B, 0x1B},
+ }
+ for i, tt := range tests {
+ if out := tt.in.updateTertiary(tt.t); out != tt.out {
+ t.Errorf("%d: was %X; want %X", i, out, tt.out)
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/colltab.go b/vendor/golang.org/x/text/internal/colltab/colltab.go
new file mode 100644
index 0000000..02f2247
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/colltab.go
@@ -0,0 +1,105 @@
+// Copyright 2015 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 colltab contains functionality related to collation tables.
+// It is only to be used by the collate and search packages.
+package colltab // import "golang.org/x/text/internal/colltab"
+
+import (
+ "sort"
+
+ "golang.org/x/text/language"
+)
+
+// MatchLang finds the index of t in tags, using a matching algorithm used for
+// collation and search. tags[0] must be language.Und, the remaining tags should
+// be sorted alphabetically.
+//
+// Language matching for collation and search is different from the matching
+// defined by language.Matcher: the (inferred) base language must be an exact
+// match for the relevant fields. For example, "gsw" should not match "de".
+// Also the parent relation is different, as a parent may have a different
+// script. So usually the parent of zh-Hant is und, whereas for MatchLang it is
+// zh.
+func MatchLang(t language.Tag, tags []language.Tag) int {
+ // Canonicalize the values, including collapsing macro languages.
+ t, _ = language.All.Canonicalize(t)
+
+ base, conf := t.Base()
+ // Estimate the base language, but only use high-confidence values.
+ if conf < language.High {
+ // The root locale supports "search" and "standard". We assume that any
+ // implementation will only use one of both.
+ return 0
+ }
+
+ // Maximize base and script and normalize the tag.
+ if _, s, r := t.Raw(); (r != language.Region{}) {
+ p, _ := language.Raw.Compose(base, s, r)
+ // Taking the parent forces the script to be maximized.
+ p = p.Parent()
+ // Add back region and extensions.
+ t, _ = language.Raw.Compose(p, r, t.Extensions())
+ } else {
+ // Set the maximized base language.
+ t, _ = language.Raw.Compose(base, s, t.Extensions())
+ }
+
+ // Find start index of the language tag.
+ start := 1 + sort.Search(len(tags)-1, func(i int) bool {
+ b, _, _ := tags[i+1].Raw()
+ return base.String() <= b.String()
+ })
+ if start < len(tags) {
+ if b, _, _ := tags[start].Raw(); b != base {
+ return 0
+ }
+ }
+
+ // Besides the base language, script and region, only the collation type and
+ // the custom variant defined in the 'u' extension are used to distinguish a
+ // locale.
+ // Strip all variants and extensions and add back the custom variant.
+ tdef, _ := language.Raw.Compose(t.Raw())
+ tdef, _ = tdef.SetTypeForKey("va", t.TypeForKey("va"))
+
+ // First search for a specialized collation type, if present.
+ try := []language.Tag{tdef}
+ if co := t.TypeForKey("co"); co != "" {
+ tco, _ := tdef.SetTypeForKey("co", co)
+ try = []language.Tag{tco, tdef}
+ }
+
+ for _, tx := range try {
+ for ; tx != language.Und; tx = parent(tx) {
+ for i, t := range tags[start:] {
+ if b, _, _ := t.Raw(); b != base {
+ break
+ }
+ if tx == t {
+ return start + i
+ }
+ }
+ }
+ }
+ return 0
+}
+
+// parent computes the structural parent. This means inheritance may change
+// script. So, unlike the CLDR parent, parent(zh-Hant) == zh.
+func parent(t language.Tag) language.Tag {
+ if t.TypeForKey("va") != "" {
+ t, _ = t.SetTypeForKey("va", "")
+ return t
+ }
+ result := language.Und
+ if b, s, r := t.Raw(); (r != language.Region{}) {
+ result, _ = language.Raw.Compose(b, s, t.Extensions())
+ } else if (s != language.Script{}) {
+ result, _ = language.Raw.Compose(b, t.Extensions())
+ } else if (b != language.Base{}) {
+ result, _ = language.Raw.Compose(t.Extensions())
+ }
+ return result
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/colltab_test.go b/vendor/golang.org/x/text/internal/colltab/colltab_test.go
new file mode 100644
index 0000000..36943f0
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/colltab_test.go
@@ -0,0 +1,66 @@
+package colltab
+
+import (
+ "testing"
+
+ "golang.org/x/text/language"
+)
+
+func TestMatchLang(t *testing.T) {
+ tags := []language.Tag{
+ 0: language.Und,
+ 1: language.MustParse("bs"),
+ 2: language.German,
+ 3: language.English,
+ 4: language.AmericanEnglish,
+ 5: language.MustParse("en-US-u-va-posix"),
+ 6: language.Portuguese,
+ 7: language.Serbian,
+ 8: language.MustParse("sr-Latn"),
+ 9: language.Chinese,
+ 10: language.MustParse("zh-u-co-stroke"),
+ 11: language.MustParse("zh-Hant-u-co-pinyin"),
+ 12: language.TraditionalChinese,
+ }
+ for i, tc := range []struct {
+ x int
+ t language.Tag
+ }{
+ {0, language.Und},
+ {0, language.Persian}, // Default to first element when no match.
+ {3, language.English},
+ {4, language.AmericanEnglish},
+ {5, language.MustParse("en-US-u-va-posix")}, // Ext. variant match.
+ {4, language.MustParse("en-US-u-va-noposix")}, // Ext. variant mismatch.
+ {3, language.MustParse("en-UK-u-va-noposix")}, // Ext. variant mismatch.
+ {7, language.Serbian},
+ {0, language.Croatian}, // Don't match to close language!
+ {0, language.MustParse("gsw")}, // Don't match to close language!
+ {1, language.MustParse("bs-Cyrl")}, // Odd, but correct.
+ {1, language.MustParse("bs-Latn")}, // Estimated script drops.
+ {8, language.MustParse("sr-Latn")},
+ {9, language.Chinese},
+ {9, language.SimplifiedChinese},
+ {12, language.TraditionalChinese},
+ {11, language.MustParse("zh-Hant-u-co-pinyin")},
+ // TODO: should this be 12? Either inherited value (10) or default is
+ // fine in this case, though. Other locales are not affected.
+ {10, language.MustParse("zh-Hant-u-co-stroke")},
+ // There is no "phonebk" sorting order for zh-Hant, so use default.
+ {12, language.MustParse("zh-Hant-u-co-phonebk")},
+ {10, language.MustParse("zh-u-co-stroke")},
+ {12, language.MustParse("und-TW")}, // Infer script and language.
+ {12, language.MustParse("und-HK")}, // Infer script and language.
+ {6, language.MustParse("und-BR")}, // Infer script and language.
+ {6, language.MustParse("und-PT")}, // Infer script and language.
+ {2, language.MustParse("und-Latn-DE")}, // Infer language.
+ {0, language.MustParse("und-Jpan-BR")}, // Infers "ja", so no match.
+ {0, language.MustParse("zu")}, // No match past index.
+ } {
+ t.Run(tc.t.String(), func(t *testing.T) {
+ if x := MatchLang(tc.t, tags); x != tc.x {
+ t.Errorf("%d: MatchLang(%q, tags) = %d; want %d", i, tc.t, x, tc.x)
+ }
+ })
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/contract.go b/vendor/golang.org/x/text/internal/colltab/contract.go
new file mode 100644
index 0000000..25649d4
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/contract.go
@@ -0,0 +1,145 @@
+// Copyright 2012 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 colltab
+
+import "unicode/utf8"
+
+// For a description of ContractTrieSet, see text/collate/build/contract.go.
+
+type ContractTrieSet []struct{ L, H, N, I uint8 }
+
+// ctScanner is used to match a trie to an input sequence.
+// A contraction may match a non-contiguous sequence of bytes in an input string.
+// For example, if there is a contraction for <a, combining_ring>, it should match
+// the sequence <a, combining_cedilla, combining_ring>, as combining_cedilla does
+// not block combining_ring.
+// ctScanner does not automatically skip over non-blocking non-starters, but rather
+// retains the state of the last match and leaves it up to the user to continue
+// the match at the appropriate points.
+type ctScanner struct {
+ states ContractTrieSet
+ s []byte
+ n int
+ index int
+ pindex int
+ done bool
+}
+
+type ctScannerString struct {
+ states ContractTrieSet
+ s string
+ n int
+ index int
+ pindex int
+ done bool
+}
+
+func (t ContractTrieSet) scanner(index, n int, b []byte) ctScanner {
+ return ctScanner{s: b, states: t[index:], n: n}
+}
+
+func (t ContractTrieSet) scannerString(index, n int, str string) ctScannerString {
+ return ctScannerString{s: str, states: t[index:], n: n}
+}
+
+// result returns the offset i and bytes consumed p so far. If no suffix
+// matched, i and p will be 0.
+func (s *ctScanner) result() (i, p int) {
+ return s.index, s.pindex
+}
+
+func (s *ctScannerString) result() (i, p int) {
+ return s.index, s.pindex
+}
+
+const (
+ final = 0
+ noIndex = 0xFF
+)
+
+// scan matches the longest suffix at the current location in the input
+// and returns the number of bytes consumed.
+func (s *ctScanner) scan(p int) int {
+ pr := p // the p at the rune start
+ str := s.s
+ states, n := s.states, s.n
+ for i := 0; i < n && p < len(str); {
+ e := states[i]
+ c := str[p]
+ // TODO: a significant number of contractions are of a form that
+ // cannot match discontiguous UTF-8 in a normalized string. We could let
+ // a negative value of e.n mean that we can set s.done = true and avoid
+ // the need for additional matches.
+ if c >= e.L {
+ if e.L == c {
+ p++
+ if e.I != noIndex {
+ s.index = int(e.I)
+ s.pindex = p
+ }
+ if e.N != final {
+ i, states, n = 0, states[int(e.H)+n:], int(e.N)
+ if p >= len(str) || utf8.RuneStart(str[p]) {
+ s.states, s.n, pr = states, n, p
+ }
+ } else {
+ s.done = true
+ return p
+ }
+ continue
+ } else if e.N == final && c <= e.H {
+ p++
+ s.done = true
+ s.index = int(c-e.L) + int(e.I)
+ s.pindex = p
+ return p
+ }
+ }
+ i++
+ }
+ return pr
+}
+
+// scan is a verbatim copy of ctScanner.scan.
+func (s *ctScannerString) scan(p int) int {
+ pr := p // the p at the rune start
+ str := s.s
+ states, n := s.states, s.n
+ for i := 0; i < n && p < len(str); {
+ e := states[i]
+ c := str[p]
+ // TODO: a significant number of contractions are of a form that
+ // cannot match discontiguous UTF-8 in a normalized string. We could let
+ // a negative value of e.n mean that we can set s.done = true and avoid
+ // the need for additional matches.
+ if c >= e.L {
+ if e.L == c {
+ p++
+ if e.I != noIndex {
+ s.index = int(e.I)
+ s.pindex = p
+ }
+ if e.N != final {
+ i, states, n = 0, states[int(e.H)+n:], int(e.N)
+ if p >= len(str) || utf8.RuneStart(str[p]) {
+ s.states, s.n, pr = states, n, p
+ }
+ } else {
+ s.done = true
+ return p
+ }
+ continue
+ } else if e.N == final && c <= e.H {
+ p++
+ s.done = true
+ s.index = int(c-e.L) + int(e.I)
+ s.pindex = p
+ return p
+ }
+ }
+ i++
+ }
+ return pr
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/contract_test.go b/vendor/golang.org/x/text/internal/colltab/contract_test.go
new file mode 100644
index 0000000..ce2871d
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/contract_test.go
@@ -0,0 +1,131 @@
+// Copyright 2012 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 colltab
+
+import (
+ "testing"
+)
+
+type lookupStrings struct {
+ str string
+ offset int
+ n int // bytes consumed from input
+}
+
+type LookupTest struct {
+ lookup []lookupStrings
+ n int
+ tries ContractTrieSet
+}
+
+var lookupTests = []LookupTest{{
+ []lookupStrings{
+ {"abc", 1, 3},
+ {"a", 0, 0},
+ {"b", 0, 0},
+ {"c", 0, 0},
+ {"d", 0, 0},
+ },
+ 1,
+ ContractTrieSet{
+ {'a', 0, 1, 0xFF},
+ {'b', 0, 1, 0xFF},
+ {'c', 'c', 0, 1},
+ },
+}, {
+ []lookupStrings{
+ {"abc", 1, 3},
+ {"abd", 2, 3},
+ {"abe", 3, 3},
+ {"a", 0, 0},
+ {"ab", 0, 0},
+ {"d", 0, 0},
+ {"f", 0, 0},
+ },
+ 1,
+ ContractTrieSet{
+ {'a', 0, 1, 0xFF},
+ {'b', 0, 1, 0xFF},
+ {'c', 'e', 0, 1},
+ },
+}, {
+ []lookupStrings{
+ {"abc", 1, 3},
+ {"ab", 2, 2},
+ {"a", 3, 1},
+ {"abcd", 1, 3},
+ {"abe", 2, 2},
+ },
+ 1,
+ ContractTrieSet{
+ {'a', 0, 1, 3},
+ {'b', 0, 1, 2},
+ {'c', 'c', 0, 1},
+ },
+}, {
+ []lookupStrings{
+ {"abc", 1, 3},
+ {"abd", 2, 3},
+ {"ab", 3, 2},
+ {"ac", 4, 2},
+ {"a", 5, 1},
+ {"b", 6, 1},
+ {"ba", 6, 1},
+ },
+ 2,
+ ContractTrieSet{
+ {'b', 'b', 0, 6},
+ {'a', 0, 2, 5},
+ {'c', 'c', 0, 4},
+ {'b', 0, 1, 3},
+ {'c', 'd', 0, 1},
+ },
+}, {
+ []lookupStrings{
+ {"bcde", 2, 4},
+ {"bc", 7, 2},
+ {"ab", 6, 2},
+ {"bcd", 5, 3},
+ {"abcd", 1, 4},
+ {"abc", 4, 3},
+ {"bcdf", 3, 4},
+ },
+ 2,
+ ContractTrieSet{
+ {'b', 3, 1, 0xFF},
+ {'a', 0, 1, 0xFF},
+ {'b', 0, 1, 6},
+ {'c', 0, 1, 4},
+ {'d', 'd', 0, 1},
+ {'c', 0, 1, 7},
+ {'d', 0, 1, 5},
+ {'e', 'f', 0, 2},
+ },
+}}
+
+func lookup(c *ContractTrieSet, nnode int, s []uint8) (i, n int) {
+ scan := c.scanner(0, nnode, s)
+ scan.scan(0)
+ return scan.result()
+}
+
+func TestLookupContraction(t *testing.T) {
+ for i, tt := range lookupTests {
+ cts := ContractTrieSet(tt.tries)
+ for j, lu := range tt.lookup {
+ str := lu.str
+ for _, s := range []string{str, str + "X"} {
+ const msg = `%d:%d: %s of "%s" %v; want %v`
+ offset, n := lookup(&cts, tt.n, []byte(s))
+ if offset != lu.offset {
+ t.Errorf(msg, i, j, "offset", s, offset, lu.offset)
+ }
+ if n != lu.n {
+ t.Errorf(msg, i, j, "bytes consumed", s, n, len(str))
+ }
+ }
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/iter.go b/vendor/golang.org/x/text/internal/colltab/iter.go
new file mode 100644
index 0000000..c1b1ba8
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/iter.go
@@ -0,0 +1,178 @@
+// Copyright 2015 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 colltab
+
+// An Iter incrementally converts chunks of the input text to collation
+// elements, while ensuring that the collation elements are in normalized order
+// (that is, they are in the order as if the input text were normalized first).
+type Iter struct {
+ Weighter Weighter
+ Elems []Elem
+ // N is the number of elements in Elems that will not be reordered on
+ // subsequent iterations, N <= len(Elems).
+ N int
+
+ bytes []byte
+ str string
+ // Because the Elems buffer may contain collation elements that are needed
+ // for look-ahead, we need two positions in the text (bytes or str): one for
+ // the end position in the text for the current iteration and one for the
+ // start of the next call to appendNext.
+ pEnd int // end position in text corresponding to N.
+ pNext int // pEnd <= pNext.
+}
+
+// Reset sets the position in the current input text to p and discards any
+// results obtained so far.
+func (i *Iter) Reset(p int) {
+ i.Elems = i.Elems[:0]
+ i.N = 0
+ i.pEnd = p
+ i.pNext = p
+}
+
+// Len returns the length of the input text.
+func (i *Iter) Len() int {
+ if i.bytes != nil {
+ return len(i.bytes)
+ }
+ return len(i.str)
+}
+
+// Discard removes the collation elements up to N.
+func (i *Iter) Discard() {
+ // TODO: change this such that only modifiers following starters will have
+ // to be copied.
+ i.Elems = i.Elems[:copy(i.Elems, i.Elems[i.N:])]
+ i.N = 0
+}
+
+// End returns the end position of the input text for which Next has returned
+// results.
+func (i *Iter) End() int {
+ return i.pEnd
+}
+
+// SetInput resets i to input s.
+func (i *Iter) SetInput(s []byte) {
+ i.bytes = s
+ i.str = ""
+ i.Reset(0)
+}
+
+// SetInputString resets i to input s.
+func (i *Iter) SetInputString(s string) {
+ i.str = s
+ i.bytes = nil
+ i.Reset(0)
+}
+
+func (i *Iter) done() bool {
+ return i.pNext >= len(i.str) && i.pNext >= len(i.bytes)
+}
+
+func (i *Iter) appendNext() bool {
+ if i.done() {
+ return false
+ }
+ var sz int
+ if i.bytes == nil {
+ i.Elems, sz = i.Weighter.AppendNextString(i.Elems, i.str[i.pNext:])
+ } else {
+ i.Elems, sz = i.Weighter.AppendNext(i.Elems, i.bytes[i.pNext:])
+ }
+ if sz == 0 {
+ sz = 1
+ }
+ i.pNext += sz
+ return true
+}
+
+// Next appends Elems to the internal array. On each iteration, it will either
+// add starters or modifiers. In the majority of cases, an Elem with a primary
+// value > 0 will have a CCC of 0. The CCC values of collation elements are also
+// used to detect if the input string was not normalized and to adjust the
+// result accordingly.
+func (i *Iter) Next() bool {
+ if i.N == len(i.Elems) && !i.appendNext() {
+ return false
+ }
+
+ // Check if the current segment starts with a starter.
+ prevCCC := i.Elems[len(i.Elems)-1].CCC()
+ if prevCCC == 0 {
+ i.N = len(i.Elems)
+ i.pEnd = i.pNext
+ return true
+ } else if i.Elems[i.N].CCC() == 0 {
+ // set i.N to only cover part of i.Elems for which prevCCC == 0 and
+ // use rest for the next call to next.
+ for i.N++; i.N < len(i.Elems) && i.Elems[i.N].CCC() == 0; i.N++ {
+ }
+ i.pEnd = i.pNext
+ return true
+ }
+
+ // The current (partial) segment starts with modifiers. We need to collect
+ // all successive modifiers to ensure that they are normalized.
+ for {
+ p := len(i.Elems)
+ i.pEnd = i.pNext
+ if !i.appendNext() {
+ break
+ }
+
+ if ccc := i.Elems[p].CCC(); ccc == 0 || len(i.Elems)-i.N > maxCombiningCharacters {
+ // Leave the starter for the next iteration. This ensures that we
+ // do not return sequences of collation elements that cross two
+ // segments.
+ //
+ // TODO: handle large number of combining characters by fully
+ // normalizing the input segment before iteration. This ensures
+ // results are consistent across the text repo.
+ i.N = p
+ return true
+ } else if ccc < prevCCC {
+ i.doNorm(p, ccc) // should be rare, never occurs for NFD and FCC.
+ } else {
+ prevCCC = ccc
+ }
+ }
+
+ done := len(i.Elems) != i.N
+ i.N = len(i.Elems)
+ return done
+}
+
+// nextNoNorm is the same as next, but does not "normalize" the collation
+// elements.
+func (i *Iter) nextNoNorm() bool {
+ // TODO: remove this function. Using this instead of next does not seem
+ // to improve performance in any significant way. We retain this until
+ // later for evaluation purposes.
+ if i.done() {
+ return false
+ }
+ i.appendNext()
+ i.N = len(i.Elems)
+ return true
+}
+
+const maxCombiningCharacters = 30
+
+// doNorm reorders the collation elements in i.Elems.
+// It assumes that blocks of collation elements added with appendNext
+// either start and end with the same CCC or start with CCC == 0.
+// This allows for a single insertion point for the entire block.
+// The correctness of this assumption is verified in builder.go.
+func (i *Iter) doNorm(p int, ccc uint8) {
+ n := len(i.Elems)
+ k := p
+ for p--; p > i.N && ccc < i.Elems[p-1].CCC(); p-- {
+ }
+ i.Elems = append(i.Elems, i.Elems[p:k]...)
+ copy(i.Elems[p:], i.Elems[k:])
+ i.Elems = i.Elems[:n]
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/iter_test.go b/vendor/golang.org/x/text/internal/colltab/iter_test.go
new file mode 100644
index 0000000..5783534
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/iter_test.go
@@ -0,0 +1,63 @@
+// Copyright 2015 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 colltab
+
+import (
+ "testing"
+)
+
+func TestDoNorm(t *testing.T) {
+ const div = -1 // The insertion point of the next block.
+ tests := []struct {
+ in, out []int
+ }{{
+ in: []int{4, div, 3},
+ out: []int{3, 4},
+ }, {
+ in: []int{4, div, 3, 3, 3},
+ out: []int{3, 3, 3, 4},
+ }, {
+ in: []int{0, 4, div, 3},
+ out: []int{0, 3, 4},
+ }, {
+ in: []int{0, 0, 4, 5, div, 3, 3},
+ out: []int{0, 0, 3, 3, 4, 5},
+ }, {
+ in: []int{0, 0, 1, 4, 5, div, 3, 3},
+ out: []int{0, 0, 1, 3, 3, 4, 5},
+ }, {
+ in: []int{0, 0, 1, 4, 5, div, 4, 4},
+ out: []int{0, 0, 1, 4, 4, 4, 5},
+ },
+ }
+ for j, tt := range tests {
+ i := Iter{}
+ var w, p int
+ for k, cc := range tt.in {
+
+ if cc == div {
+ w = 100
+ p = k
+ continue
+ }
+ i.Elems = append(i.Elems, makeCE([]int{w, defaultSecondary, 2, cc}))
+ }
+ i.doNorm(p, i.Elems[p].CCC())
+ if len(i.Elems) != len(tt.out) {
+ t.Errorf("%d: length was %d; want %d", j, len(i.Elems), len(tt.out))
+ }
+ prevCCC := uint8(0)
+ for k, ce := range i.Elems {
+ if int(ce.CCC()) != tt.out[k] {
+ t.Errorf("%d:%d: unexpected CCC. Was %d; want %d", j, k, ce.CCC(), tt.out[k])
+ }
+ if k > 0 && ce.CCC() == prevCCC && i.Elems[k-1].Primary() > ce.Primary() {
+ t.Errorf("%d:%d: normalization crossed across CCC boundary.", j, k)
+ }
+ }
+ }
+
+ // Combining rune overflow is tested in search/pattern_test.go.
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/numeric.go b/vendor/golang.org/x/text/internal/colltab/numeric.go
new file mode 100644
index 0000000..53b819c
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/numeric.go
@@ -0,0 +1,236 @@
+// Copyright 2014 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 colltab
+
+import (
+ "unicode"
+ "unicode/utf8"
+)
+
+// NewNumericWeighter wraps w to replace individual digits to sort based on their
+// numeric value.
+//
+// Weighter w must have a free primary weight after the primary weight for 9.
+// If this is not the case, numeric value will sort at the same primary level
+// as the first primary sorting after 9.
+func NewNumericWeighter(w Weighter) Weighter {
+ getElem := func(s string) Elem {
+ elems, _ := w.AppendNextString(nil, s)
+ return elems[0]
+ }
+ nine := getElem("9")
+
+ // Numbers should order before zero, but the DUCET has no room for this.
+ // TODO: move before zero once we use fractional collation elements.
+ ns, _ := MakeElem(nine.Primary()+1, nine.Secondary(), int(nine.Tertiary()), 0)
+
+ return &numericWeighter{
+ Weighter: w,
+
+ // We assume that w sorts digits of different kinds in order of numeric
+ // value and that the tertiary weight order is preserved.
+ //
+ // TODO: evaluate whether it is worth basing the ranges on the Elem
+ // encoding itself once the move to fractional weights is complete.
+ zero: getElem("0"),
+ zeroSpecialLo: getElem("0"), // U+FF10 FULLWIDTH DIGIT ZERO
+ zeroSpecialHi: getElem("₀"), // U+2080 SUBSCRIPT ZERO
+ nine: nine,
+ nineSpecialHi: getElem("₉"), // U+2089 SUBSCRIPT NINE
+ numberStart: ns,
+ }
+}
+
+// A numericWeighter translates a stream of digits into a stream of weights
+// representing the numeric value.
+type numericWeighter struct {
+ Weighter
+
+ // The Elems below all demarcate boundaries of specific ranges. With the
+ // current element encoding digits are in two ranges: normal (default
+ // tertiary value) and special. For most languages, digits have collation
+ // elements in the normal range.
+ //
+ // Note: the range tests are very specific for the element encoding used by
+ // this implementation. The tests in collate_test.go are designed to fail
+ // if this code is not updated when an encoding has changed.
+
+ zero Elem // normal digit zero
+ zeroSpecialLo Elem // special digit zero, low tertiary value
+ zeroSpecialHi Elem // special digit zero, high tertiary value
+ nine Elem // normal digit nine
+ nineSpecialHi Elem // special digit nine
+ numberStart Elem
+}
+
+// AppendNext calls the namesake of the underlying weigher, but replaces single
+// digits with weights representing their value.
+func (nw *numericWeighter) AppendNext(buf []Elem, s []byte) (ce []Elem, n int) {
+ ce, n = nw.Weighter.AppendNext(buf, s)
+ nc := numberConverter{
+ elems: buf,
+ w: nw,
+ b: s,
+ }
+ isZero, ok := nc.checkNextDigit(ce)
+ if !ok {
+ return ce, n
+ }
+ // ce might have been grown already, so take it instead of buf.
+ nc.init(ce, len(buf), isZero)
+ for n < len(s) {
+ ce, sz := nw.Weighter.AppendNext(nc.elems, s[n:])
+ nc.b = s
+ n += sz
+ if !nc.update(ce) {
+ break
+ }
+ }
+ return nc.result(), n
+}
+
+// AppendNextString calls the namesake of the underlying weigher, but replaces
+// single digits with weights representing their value.
+func (nw *numericWeighter) AppendNextString(buf []Elem, s string) (ce []Elem, n int) {
+ ce, n = nw.Weighter.AppendNextString(buf, s)
+ nc := numberConverter{
+ elems: buf,
+ w: nw,
+ s: s,
+ }
+ isZero, ok := nc.checkNextDigit(ce)
+ if !ok {
+ return ce, n
+ }
+ nc.init(ce, len(buf), isZero)
+ for n < len(s) {
+ ce, sz := nw.Weighter.AppendNextString(nc.elems, s[n:])
+ nc.s = s
+ n += sz
+ if !nc.update(ce) {
+ break
+ }
+ }
+ return nc.result(), n
+}
+
+type numberConverter struct {
+ w *numericWeighter
+
+ elems []Elem
+ nDigits int
+ lenIndex int
+
+ s string // set if the input was of type string
+ b []byte // set if the input was of type []byte
+}
+
+// init completes initialization of a numberConverter and prepares it for adding
+// more digits. elems is assumed to have a digit starting at oldLen.
+func (nc *numberConverter) init(elems []Elem, oldLen int, isZero bool) {
+ // Insert a marker indicating the start of a number and a placeholder
+ // for the number of digits.
+ if isZero {
+ elems = append(elems[:oldLen], nc.w.numberStart, 0)
+ } else {
+ elems = append(elems, 0, 0)
+ copy(elems[oldLen+2:], elems[oldLen:])
+ elems[oldLen] = nc.w.numberStart
+ elems[oldLen+1] = 0
+
+ nc.nDigits = 1
+ }
+ nc.elems = elems
+ nc.lenIndex = oldLen + 1
+}
+
+// checkNextDigit reports whether bufNew adds a single digit relative to the old
+// buffer. If it does, it also reports whether this digit is zero.
+func (nc *numberConverter) checkNextDigit(bufNew []Elem) (isZero, ok bool) {
+ if len(nc.elems) >= len(bufNew) {
+ return false, false
+ }
+ e := bufNew[len(nc.elems)]
+ if e < nc.w.zeroSpecialLo || nc.w.nine < e {
+ // Not a number.
+ return false, false
+ }
+ if e < nc.w.zero {
+ if e > nc.w.nineSpecialHi {
+ // Not a number.
+ return false, false
+ }
+ if !nc.isDigit() {
+ return false, false
+ }
+ isZero = e <= nc.w.zeroSpecialHi
+ } else {
+ // This is the common case if we encounter a digit.
+ isZero = e == nc.w.zero
+ }
+ // Test the remaining added collation elements have a zero primary value.
+ if n := len(bufNew) - len(nc.elems); n > 1 {
+ for i := len(nc.elems) + 1; i < len(bufNew); i++ {
+ if bufNew[i].Primary() != 0 {
+ return false, false
+ }
+ }
+ // In some rare cases, collation elements will encode runes in
+ // unicode.No as a digit. For example Ethiopic digits (U+1369 - U+1371)
+ // are not in Nd. Also some digits that clearly belong in unicode.No,
+ // like U+0C78 TELUGU FRACTION DIGIT ZERO FOR ODD POWERS OF FOUR, have
+ // collation elements indistinguishable from normal digits.
+ // Unfortunately, this means we need to make this check for nearly all
+ // non-Latin digits.
+ //
+ // TODO: check the performance impact and find something better if it is
+ // an issue.
+ if !nc.isDigit() {
+ return false, false
+ }
+ }
+ return isZero, true
+}
+
+func (nc *numberConverter) isDigit() bool {
+ if nc.b != nil {
+ r, _ := utf8.DecodeRune(nc.b)
+ return unicode.In(r, unicode.Nd)
+ }
+ r, _ := utf8.DecodeRuneInString(nc.s)
+ return unicode.In(r, unicode.Nd)
+}
+
+// We currently support a maximum of about 2M digits (the number of primary
+// values). Such numbers will compare correctly against small numbers, but their
+// comparison against other large numbers is undefined.
+//
+// TODO: define a proper fallback, such as comparing large numbers textually or
+// actually allowing numbers of unlimited length.
+//
+// TODO: cap this to a lower number (like 100) and maybe allow a larger number
+// in an option?
+const maxDigits = 1<<maxPrimaryBits - 1
+
+func (nc *numberConverter) update(elems []Elem) bool {
+ isZero, ok := nc.checkNextDigit(elems)
+ if nc.nDigits == 0 && isZero {
+ return true
+ }
+ nc.elems = elems
+ if !ok {
+ return false
+ }
+ nc.nDigits++
+ return nc.nDigits < maxDigits
+}
+
+// result fills in the length element for the digit sequence and returns the
+// completed collation elements.
+func (nc *numberConverter) result() []Elem {
+ e, _ := MakeElem(nc.nDigits, defaultSecondary, defaultTertiary, 0)
+ nc.elems[nc.lenIndex] = e
+ return nc.elems
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/numeric_test.go b/vendor/golang.org/x/text/internal/colltab/numeric_test.go
new file mode 100644
index 0000000..e9406ae
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/numeric_test.go
@@ -0,0 +1,159 @@
+// Copyright 2014 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 colltab
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+
+ "golang.org/x/text/internal/testtext"
+)
+
+const (
+ digSec = defaultSecondary
+ digTert = defaultTertiary
+)
+
+var tPlus3 = e(0, 50, digTert+3)
+
+// numWeighter is a testWeighter used for testing numericWeighter.
+var numWeighter = testWeighter{
+ "0": p(100),
+ "0": []Elem{e(100, digSec, digTert+1)}, // U+FF10 FULLWIDTH DIGIT ZERO
+ "₀": []Elem{e(100, digSec, digTert+5)}, // U+2080 SUBSCRIPT ZERO
+
+ "1": p(101),
+ // Allow non-primary collation elements to be inserted.
+ "١": append(p(101), tPlus3), // U+0661 ARABIC-INDIC DIGIT ONE
+ // Allow varying tertiary weight if the number is Nd.
+ "1": []Elem{e(101, digSec, digTert+1)}, // U+FF11 FULLWIDTH DIGIT ONE
+ "2": p(102),
+ // Allow non-primary collation elements to be inserted.
+ "٢": append(p(102), tPlus3), // U+0662 ARABIC-INDIC DIGIT TWO
+ // Varying tertiary weights should be ignored.
+ "2": []Elem{e(102, digSec, digTert+3)}, // U+FF12 FULLWIDTH DIGIT TWO
+ "3": p(103),
+ "4": p(104),
+ "5": p(105),
+ "6": p(106),
+ "7": p(107),
+ // Weights must be strictly monotonically increasing, but do not need to be
+ // consecutive.
+ "8": p(118),
+ "9": p(119),
+ // Allow non-primary collation elements to be inserted.
+ "٩": append(p(119), tPlus3), // U+0669 ARABIC-INDIC DIGIT NINE
+ // Varying tertiary weights should be ignored.
+ "9": []Elem{e(119, digSec, digTert+1)}, // U+FF19 FULLWIDTH DIGIT NINE
+ "₉": []Elem{e(119, digSec, digTert+5)}, // U+2089 SUBSCRIPT NINE
+
+ "a": p(5),
+ "b": p(6),
+ "c": p(8, 2),
+
+ "klm": p(99),
+
+ "nop": p(121),
+
+ "x": p(200),
+ "y": p(201),
+}
+
+func p(w ...int) (elems []Elem) {
+ for _, x := range w {
+ e, _ := MakeElem(x, digSec, digTert, 0)
+ elems = append(elems, e)
+ }
+ return elems
+}
+
+func TestNumericAppendNext(t *testing.T) {
+ for _, tt := range []struct {
+ in string
+ w []Elem
+ }{
+ {"a", p(5)},
+ {"klm", p(99)},
+ {"aa", p(5, 5)},
+ {"1", p(120, 1, 101)},
+ {"0", p(120, 0)},
+ {"01", p(120, 1, 101)},
+ {"0001", p(120, 1, 101)},
+ {"10", p(120, 2, 101, 100)},
+ {"99", p(120, 2, 119, 119)},
+ {"9999", p(120, 4, 119, 119, 119, 119)},
+ {"1a", p(120, 1, 101, 5)},
+ {"0b", p(120, 0, 6)},
+ {"01c", p(120, 1, 101, 8, 2)},
+ {"10x", p(120, 2, 101, 100, 200)},
+ {"99y", p(120, 2, 119, 119, 201)},
+ {"9999nop", p(120, 4, 119, 119, 119, 119, 121)},
+
+ // Allow follow-up collation elements if they have a zero non-primary.
+ {"١٢٩", []Elem{e(120), e(3), e(101), tPlus3, e(102), tPlus3, e(119), tPlus3}},
+ {
+ "129",
+ []Elem{
+ e(120), e(3),
+ e(101, digSec, digTert+1),
+ e(102, digSec, digTert+3),
+ e(119, digSec, digTert+1),
+ },
+ },
+
+ // Ensure AppendNext* adds to the given buffer.
+ {"a10", p(5, 120, 2, 101, 100)},
+ } {
+ nw := NewNumericWeighter(numWeighter)
+
+ b := []byte(tt.in)
+ got := []Elem(nil)
+ for n, sz := 0, 0; n < len(b); {
+ got, sz = nw.AppendNext(got, b[n:])
+ n += sz
+ }
+ if !reflect.DeepEqual(got, tt.w) {
+ t.Errorf("AppendNext(%q) =\n%v; want\n%v", tt.in, got, tt.w)
+ }
+
+ got = nil
+ for n, sz := 0, 0; n < len(tt.in); {
+ got, sz = nw.AppendNextString(got, tt.in[n:])
+ n += sz
+ }
+ if !reflect.DeepEqual(got, tt.w) {
+ t.Errorf("AppendNextString(%q) =\n%v; want\n%v", tt.in, got, tt.w)
+ }
+ }
+}
+
+func TestNumericOverflow(t *testing.T) {
+ manyDigits := strings.Repeat("9", maxDigits+1) + "a"
+
+ nw := NewNumericWeighter(numWeighter)
+
+ got, n := nw.AppendNextString(nil, manyDigits)
+
+ if n != maxDigits {
+ t.Errorf("n: got %d; want %d", n, maxDigits)
+ }
+
+ if got[1].Primary() != maxDigits {
+ t.Errorf("primary(e[1]): got %d; want %d", n, maxDigits)
+ }
+}
+
+func TestNumericWeighterAlloc(t *testing.T) {
+ buf := make([]Elem, 100)
+ w := NewNumericWeighter(numWeighter)
+ s := "1234567890a"
+
+ nNormal := testtext.AllocsPerRun(3, func() { numWeighter.AppendNextString(buf, s) })
+ nNumeric := testtext.AllocsPerRun(3, func() { w.AppendNextString(buf, s) })
+ if n := nNumeric - nNormal; n > 0 {
+ t.Errorf("got %f; want 0", n)
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/table.go b/vendor/golang.org/x/text/internal/colltab/table.go
new file mode 100644
index 0000000..e26e36d
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/table.go
@@ -0,0 +1,275 @@
+// Copyright 2012 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 colltab
+
+import (
+ "unicode/utf8"
+
+ "golang.org/x/text/unicode/norm"
+)
+
+// Table holds all collation data for a given collation ordering.
+type Table struct {
+ Index Trie // main trie
+
+ // expansion info
+ ExpandElem []uint32
+
+ // contraction info
+ ContractTries ContractTrieSet
+ ContractElem []uint32
+ MaxContractLen int
+ VariableTop uint32
+}
+
+func (t *Table) AppendNext(w []Elem, b []byte) (res []Elem, n int) {
+ return t.appendNext(w, source{bytes: b})
+}
+
+func (t *Table) AppendNextString(w []Elem, s string) (res []Elem, n int) {
+ return t.appendNext(w, source{str: s})
+}
+
+func (t *Table) Start(p int, b []byte) int {
+ // TODO: implement
+ panic("not implemented")
+}
+
+func (t *Table) StartString(p int, s string) int {
+ // TODO: implement
+ panic("not implemented")
+}
+
+func (t *Table) Domain() []string {
+ // TODO: implement
+ panic("not implemented")
+}
+
+func (t *Table) Top() uint32 {
+ return t.VariableTop
+}
+
+type source struct {
+ str string
+ bytes []byte
+}
+
+func (src *source) lookup(t *Table) (ce Elem, sz int) {
+ if src.bytes == nil {
+ return t.Index.lookupString(src.str)
+ }
+ return t.Index.lookup(src.bytes)
+}
+
+func (src *source) tail(sz int) {
+ if src.bytes == nil {
+ src.str = src.str[sz:]
+ } else {
+ src.bytes = src.bytes[sz:]
+ }
+}
+
+func (src *source) nfd(buf []byte, end int) []byte {
+ if src.bytes == nil {
+ return norm.NFD.AppendString(buf[:0], src.str[:end])
+ }
+ return norm.NFD.Append(buf[:0], src.bytes[:end]...)
+}
+
+func (src *source) rune() (r rune, sz int) {
+ if src.bytes == nil {
+ return utf8.DecodeRuneInString(src.str)
+ }
+ return utf8.DecodeRune(src.bytes)
+}
+
+func (src *source) properties(f norm.Form) norm.Properties {
+ if src.bytes == nil {
+ return f.PropertiesString(src.str)
+ }
+ return f.Properties(src.bytes)
+}
+
+// appendNext appends the weights corresponding to the next rune or
+// contraction in s. If a contraction is matched to a discontinuous
+// sequence of runes, the weights for the interstitial runes are
+// appended as well. It returns a new slice that includes the appended
+// weights and the number of bytes consumed from s.
+func (t *Table) appendNext(w []Elem, src source) (res []Elem, n int) {
+ ce, sz := src.lookup(t)
+ tp := ce.ctype()
+ if tp == ceNormal {
+ if ce == 0 {
+ r, _ := src.rune()
+ const (
+ hangulSize = 3
+ firstHangul = 0xAC00
+ lastHangul = 0xD7A3
+ )
+ if r >= firstHangul && r <= lastHangul {
+ // TODO: performance can be considerably improved here.
+ n = sz
+ var buf [16]byte // Used for decomposing Hangul.
+ for b := src.nfd(buf[:0], hangulSize); len(b) > 0; b = b[sz:] {
+ ce, sz = t.Index.lookup(b)
+ w = append(w, ce)
+ }
+ return w, n
+ }
+ ce = makeImplicitCE(implicitPrimary(r))
+ }
+ w = append(w, ce)
+ } else if tp == ceExpansionIndex {
+ w = t.appendExpansion(w, ce)
+ } else if tp == ceContractionIndex {
+ n := 0
+ src.tail(sz)
+ if src.bytes == nil {
+ w, n = t.matchContractionString(w, ce, src.str)
+ } else {
+ w, n = t.matchContraction(w, ce, src.bytes)
+ }
+ sz += n
+ } else if tp == ceDecompose {
+ // Decompose using NFKD and replace tertiary weights.
+ t1, t2 := splitDecompose(ce)
+ i := len(w)
+ nfkd := src.properties(norm.NFKD).Decomposition()
+ for p := 0; len(nfkd) > 0; nfkd = nfkd[p:] {
+ w, p = t.appendNext(w, source{bytes: nfkd})
+ }
+ w[i] = w[i].updateTertiary(t1)
+ if i++; i < len(w) {
+ w[i] = w[i].updateTertiary(t2)
+ for i++; i < len(w); i++ {
+ w[i] = w[i].updateTertiary(maxTertiary)
+ }
+ }
+ }
+ return w, sz
+}
+
+func (t *Table) appendExpansion(w []Elem, ce Elem) []Elem {
+ i := splitExpandIndex(ce)
+ n := int(t.ExpandElem[i])
+ i++
+ for _, ce := range t.ExpandElem[i : i+n] {
+ w = append(w, Elem(ce))
+ }
+ return w
+}
+
+func (t *Table) matchContraction(w []Elem, ce Elem, suffix []byte) ([]Elem, int) {
+ index, n, offset := splitContractIndex(ce)
+
+ scan := t.ContractTries.scanner(index, n, suffix)
+ buf := [norm.MaxSegmentSize]byte{}
+ bufp := 0
+ p := scan.scan(0)
+
+ if !scan.done && p < len(suffix) && suffix[p] >= utf8.RuneSelf {
+ // By now we should have filtered most cases.
+ p0 := p
+ bufn := 0
+ rune := norm.NFD.Properties(suffix[p:])
+ p += rune.Size()
+ if rune.LeadCCC() != 0 {
+ prevCC := rune.TrailCCC()
+ // A gap may only occur in the last normalization segment.
+ // This also ensures that len(scan.s) < norm.MaxSegmentSize.
+ if end := norm.NFD.FirstBoundary(suffix[p:]); end != -1 {
+ scan.s = suffix[:p+end]
+ }
+ for p < len(suffix) && !scan.done && suffix[p] >= utf8.RuneSelf {
+ rune = norm.NFD.Properties(suffix[p:])
+ if ccc := rune.LeadCCC(); ccc == 0 || prevCC >= ccc {
+ break
+ }
+ prevCC = rune.TrailCCC()
+ if pp := scan.scan(p); pp != p {
+ // Copy the interstitial runes for later processing.
+ bufn += copy(buf[bufn:], suffix[p0:p])
+ if scan.pindex == pp {
+ bufp = bufn
+ }
+ p, p0 = pp, pp
+ } else {
+ p += rune.Size()
+ }
+ }
+ }
+ }
+ // Append weights for the matched contraction, which may be an expansion.
+ i, n := scan.result()
+ ce = Elem(t.ContractElem[i+offset])
+ if ce.ctype() == ceNormal {
+ w = append(w, ce)
+ } else {
+ w = t.appendExpansion(w, ce)
+ }
+ // Append weights for the runes in the segment not part of the contraction.
+ for b, p := buf[:bufp], 0; len(b) > 0; b = b[p:] {
+ w, p = t.appendNext(w, source{bytes: b})
+ }
+ return w, n
+}
+
+// TODO: unify the two implementations. This is best done after first simplifying
+// the algorithm taking into account the inclusion of both NFC and NFD forms
+// in the table.
+func (t *Table) matchContractionString(w []Elem, ce Elem, suffix string) ([]Elem, int) {
+ index, n, offset := splitContractIndex(ce)
+
+ scan := t.ContractTries.scannerString(index, n, suffix)
+ buf := [norm.MaxSegmentSize]byte{}
+ bufp := 0
+ p := scan.scan(0)
+
+ if !scan.done && p < len(suffix) && suffix[p] >= utf8.RuneSelf {
+ // By now we should have filtered most cases.
+ p0 := p
+ bufn := 0
+ rune := norm.NFD.PropertiesString(suffix[p:])
+ p += rune.Size()
+ if rune.LeadCCC() != 0 {
+ prevCC := rune.TrailCCC()
+ // A gap may only occur in the last normalization segment.
+ // This also ensures that len(scan.s) < norm.MaxSegmentSize.
+ if end := norm.NFD.FirstBoundaryInString(suffix[p:]); end != -1 {
+ scan.s = suffix[:p+end]
+ }
+ for p < len(suffix) && !scan.done && suffix[p] >= utf8.RuneSelf {
+ rune = norm.NFD.PropertiesString(suffix[p:])
+ if ccc := rune.LeadCCC(); ccc == 0 || prevCC >= ccc {
+ break
+ }
+ prevCC = rune.TrailCCC()
+ if pp := scan.scan(p); pp != p {
+ // Copy the interstitial runes for later processing.
+ bufn += copy(buf[bufn:], suffix[p0:p])
+ if scan.pindex == pp {
+ bufp = bufn
+ }
+ p, p0 = pp, pp
+ } else {
+ p += rune.Size()
+ }
+ }
+ }
+ }
+ // Append weights for the matched contraction, which may be an expansion.
+ i, n := scan.result()
+ ce = Elem(t.ContractElem[i+offset])
+ if ce.ctype() == ceNormal {
+ w = append(w, ce)
+ } else {
+ w = t.appendExpansion(w, ce)
+ }
+ // Append weights for the runes in the segment not part of the contraction.
+ for b, p := buf[:bufp], 0; len(b) > 0; b = b[p:] {
+ w, p = t.appendNext(w, source{bytes: b})
+ }
+ return w, n
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/trie.go b/vendor/golang.org/x/text/internal/colltab/trie.go
new file mode 100644
index 0000000..a0eaa0d
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/trie.go
@@ -0,0 +1,159 @@
+// Copyright 2012 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.
+
+// The trie in this file is used to associate the first full character in an
+// UTF-8 string to a collation element. All but the last byte in a UTF-8 byte
+// sequence are used to lookup offsets in the index table to be used for the
+// next byte. The last byte is used to index into a table of collation elements.
+// For a full description, see go.text/collate/build/trie.go.
+
+package colltab
+
+const blockSize = 64
+
+type Trie struct {
+ Index0 []uint16 // index for first byte (0xC0-0xFF)
+ Values0 []uint32 // index for first byte (0x00-0x7F)
+ Index []uint16
+ Values []uint32
+}
+
+const (
+ t1 = 0x00 // 0000 0000
+ tx = 0x80 // 1000 0000
+ t2 = 0xC0 // 1100 0000
+ t3 = 0xE0 // 1110 0000
+ t4 = 0xF0 // 1111 0000
+ t5 = 0xF8 // 1111 1000
+ t6 = 0xFC // 1111 1100
+ te = 0xFE // 1111 1110
+)
+
+func (t *Trie) lookupValue(n uint16, b byte) Elem {
+ return Elem(t.Values[int(n)<<6+int(b)])
+}
+
+// lookup returns the trie value for the first UTF-8 encoding in s and
+// the width in bytes of this encoding. The size will be 0 if s does not
+// hold enough bytes to complete the encoding. len(s) must be greater than 0.
+func (t *Trie) lookup(s []byte) (v Elem, sz int) {
+ c0 := s[0]
+ switch {
+ case c0 < tx:
+ return Elem(t.Values0[c0]), 1
+ case c0 < t2:
+ return 0, 1
+ case c0 < t3:
+ if len(s) < 2 {
+ return 0, 0
+ }
+ i := t.Index0[c0]
+ c1 := s[1]
+ if c1 < tx || t2 <= c1 {
+ return 0, 1
+ }
+ return t.lookupValue(i, c1), 2
+ case c0 < t4:
+ if len(s) < 3 {
+ return 0, 0
+ }
+ i := t.Index0[c0]
+ c1 := s[1]
+ if c1 < tx || t2 <= c1 {
+ return 0, 1
+ }
+ o := int(i)<<6 + int(c1)
+ i = t.Index[o]
+ c2 := s[2]
+ if c2 < tx || t2 <= c2 {
+ return 0, 2
+ }
+ return t.lookupValue(i, c2), 3
+ case c0 < t5:
+ if len(s) < 4 {
+ return 0, 0
+ }
+ i := t.Index0[c0]
+ c1 := s[1]
+ if c1 < tx || t2 <= c1 {
+ return 0, 1
+ }
+ o := int(i)<<6 + int(c1)
+ i = t.Index[o]
+ c2 := s[2]
+ if c2 < tx || t2 <= c2 {
+ return 0, 2
+ }
+ o = int(i)<<6 + int(c2)
+ i = t.Index[o]
+ c3 := s[3]
+ if c3 < tx || t2 <= c3 {
+ return 0, 3
+ }
+ return t.lookupValue(i, c3), 4
+ }
+ // Illegal rune
+ return 0, 1
+}
+
+// The body of lookupString is a verbatim copy of that of lookup.
+func (t *Trie) lookupString(s string) (v Elem, sz int) {
+ c0 := s[0]
+ switch {
+ case c0 < tx:
+ return Elem(t.Values0[c0]), 1
+ case c0 < t2:
+ return 0, 1
+ case c0 < t3:
+ if len(s) < 2 {
+ return 0, 0
+ }
+ i := t.Index0[c0]
+ c1 := s[1]
+ if c1 < tx || t2 <= c1 {
+ return 0, 1
+ }
+ return t.lookupValue(i, c1), 2
+ case c0 < t4:
+ if len(s) < 3 {
+ return 0, 0
+ }
+ i := t.Index0[c0]
+ c1 := s[1]
+ if c1 < tx || t2 <= c1 {
+ return 0, 1
+ }
+ o := int(i)<<6 + int(c1)
+ i = t.Index[o]
+ c2 := s[2]
+ if c2 < tx || t2 <= c2 {
+ return 0, 2
+ }
+ return t.lookupValue(i, c2), 3
+ case c0 < t5:
+ if len(s) < 4 {
+ return 0, 0
+ }
+ i := t.Index0[c0]
+ c1 := s[1]
+ if c1 < tx || t2 <= c1 {
+ return 0, 1
+ }
+ o := int(i)<<6 + int(c1)
+ i = t.Index[o]
+ c2 := s[2]
+ if c2 < tx || t2 <= c2 {
+ return 0, 2
+ }
+ o = int(i)<<6 + int(c2)
+ i = t.Index[o]
+ c3 := s[3]
+ if c3 < tx || t2 <= c3 {
+ return 0, 3
+ }
+ return t.lookupValue(i, c3), 4
+ }
+ // Illegal rune
+ return 0, 1
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/trie_test.go b/vendor/golang.org/x/text/internal/colltab/trie_test.go
new file mode 100644
index 0000000..b056a81
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/trie_test.go
@@ -0,0 +1,106 @@
+// Copyright 2012 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 colltab
+
+import (
+ "testing"
+)
+
+// We take the smallest, largest and an arbitrary value for each
+// of the UTF-8 sequence lengths.
+var testRunes = []rune{
+ 0x01, 0x0C, 0x7F, // 1-byte sequences
+ 0x80, 0x100, 0x7FF, // 2-byte sequences
+ 0x800, 0x999, 0xFFFF, // 3-byte sequences
+ 0x10000, 0x10101, 0x10FFFF, // 4-byte sequences
+ 0x200, 0x201, 0x202, 0x210, 0x215, // five entries in one sparse block
+}
+
+// Test cases for illegal runes.
+type trietest struct {
+ size int
+ bytes []byte
+}
+
+var tests = []trietest{
+ // illegal runes
+ {1, []byte{0x80}},
+ {1, []byte{0xFF}},
+ {1, []byte{t2, tx - 1}},
+ {1, []byte{t2, t2}},
+ {2, []byte{t3, tx, tx - 1}},
+ {2, []byte{t3, tx, t2}},
+ {1, []byte{t3, tx - 1, tx}},
+ {3, []byte{t4, tx, tx, tx - 1}},
+ {3, []byte{t4, tx, tx, t2}},
+ {1, []byte{t4, t2, tx, tx - 1}},
+ {2, []byte{t4, tx, t2, tx - 1}},
+
+ // short runes
+ {0, []byte{t2}},
+ {0, []byte{t3, tx}},
+ {0, []byte{t4, tx, tx}},
+
+ // we only support UTF-8 up to utf8.UTFMax bytes (4 bytes)
+ {1, []byte{t5, tx, tx, tx, tx}},
+ {1, []byte{t6, tx, tx, tx, tx, tx}},
+}
+
+func TestLookupTrie(t *testing.T) {
+ for i, r := range testRunes {
+ b := []byte(string(r))
+ v, sz := testTrie.lookup(b)
+ if int(v) != i {
+ t.Errorf("lookup(%U): found value %#x, expected %#x", r, v, i)
+ }
+ if sz != len(b) {
+ t.Errorf("lookup(%U): found size %d, expected %d", r, sz, len(b))
+ }
+ }
+ for i, tt := range tests {
+ v, sz := testTrie.lookup(tt.bytes)
+ if int(v) != 0 {
+ t.Errorf("lookup of illegal rune, case %d: found value %#x, expected 0", i, v)
+ }
+ if sz != tt.size {
+ t.Errorf("lookup of illegal rune, case %d: found size %d, expected %d", i, sz, tt.size)
+ }
+ }
+}
+
+// test data is taken from exp/collate/locale/build/trie_test.go
+var testValues = [832]uint32{
+ 0x000c: 0x00000001,
+ 0x007f: 0x00000002,
+ 0x00c0: 0x00000003,
+ 0x0100: 0x00000004,
+ 0x0140: 0x0000000c, 0x0141: 0x0000000d, 0x0142: 0x0000000e,
+ 0x0150: 0x0000000f,
+ 0x0155: 0x00000010,
+ 0x01bf: 0x00000005,
+ 0x01c0: 0x00000006,
+ 0x0219: 0x00000007,
+ 0x027f: 0x00000008,
+ 0x0280: 0x00000009,
+ 0x02c1: 0x0000000a,
+ 0x033f: 0x0000000b,
+}
+
+var testLookup = [640]uint16{
+ 0x0e0: 0x05, 0x0e6: 0x06,
+ 0x13f: 0x07,
+ 0x140: 0x08, 0x144: 0x09,
+ 0x190: 0x03,
+ 0x1ff: 0x0a,
+ 0x20f: 0x05,
+ 0x242: 0x01, 0x244: 0x02,
+ 0x248: 0x03,
+ 0x25f: 0x04,
+ 0x260: 0x01,
+ 0x26f: 0x02,
+ 0x270: 0x04, 0x274: 0x06,
+}
+
+var testTrie = Trie{testLookup[6*blockSize:], testValues[:], testLookup[:], testValues[:]}
diff --git a/vendor/golang.org/x/text/internal/colltab/weighter.go b/vendor/golang.org/x/text/internal/colltab/weighter.go
new file mode 100644
index 0000000..f1ec45f
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/weighter.go
@@ -0,0 +1,31 @@
+// Copyright 2013 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 colltab // import "golang.org/x/text/internal/colltab"
+
+// A Weighter can be used as a source for Collator and Searcher.
+type Weighter interface {
+ // Start finds the start of the segment that includes position p.
+ Start(p int, b []byte) int
+
+ // StartString finds the start of the segment that includes position p.
+ StartString(p int, s string) int
+
+ // AppendNext appends Elems to buf corresponding to the longest match
+ // of a single character or contraction from the start of s.
+ // It returns the new buf and the number of bytes consumed.
+ AppendNext(buf []Elem, s []byte) (ce []Elem, n int)
+
+ // AppendNextString appends Elems to buf corresponding to the longest match
+ // of a single character or contraction from the start of s.
+ // It returns the new buf and the number of bytes consumed.
+ AppendNextString(buf []Elem, s string) (ce []Elem, n int)
+
+ // Domain returns a slice of all single characters and contractions for which
+ // collation elements are defined in this table.
+ Domain() []string
+
+ // Top returns the highest variable primary value.
+ Top() uint32
+}
diff --git a/vendor/golang.org/x/text/internal/colltab/weighter_test.go b/vendor/golang.org/x/text/internal/colltab/weighter_test.go
new file mode 100644
index 0000000..b5f8487
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/colltab/weighter_test.go
@@ -0,0 +1,42 @@
+// Copyright 2014 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 colltab
+
+// testWeighter is a simple Weighter that returns weights from a user-defined map.
+type testWeighter map[string][]Elem
+
+func (t testWeighter) Start(int, []byte) int { return 0 }
+func (t testWeighter) StartString(int, string) int { return 0 }
+func (t testWeighter) Domain() []string { return nil }
+func (t testWeighter) Top() uint32 { return 0 }
+
+// maxContractBytes is the maximum length of any key in the map.
+const maxContractBytes = 10
+
+func (t testWeighter) AppendNext(buf []Elem, s []byte) ([]Elem, int) {
+ n := len(s)
+ if n > maxContractBytes {
+ n = maxContractBytes
+ }
+ for i := n; i > 0; i-- {
+ if e, ok := t[string(s[:i])]; ok {
+ return append(buf, e...), i
+ }
+ }
+ panic("incomplete testWeighter: could not find " + string(s))
+}
+
+func (t testWeighter) AppendNextString(buf []Elem, s string) ([]Elem, int) {
+ n := len(s)
+ if n > maxContractBytes {
+ n = maxContractBytes
+ }
+ for i := n; i > 0; i-- {
+ if e, ok := t[s[:i]]; ok {
+ return append(buf, e...), i
+ }
+ }
+ panic("incomplete testWeighter: could not find " + s)
+}
diff --git a/vendor/golang.org/x/text/internal/format/format.go b/vendor/golang.org/x/text/internal/format/format.go
new file mode 100644
index 0000000..ee1c57a
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/format/format.go
@@ -0,0 +1,41 @@
+// Copyright 2015 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 format contains types for defining language-specific formatting of
+// values.
+//
+// This package is internal now, but will eventually be exposed after the API
+// settles.
+package format // import "golang.org/x/text/internal/format"
+
+import (
+ "fmt"
+
+ "golang.org/x/text/language"
+)
+
+// State represents the printer state passed to custom formatters. It provides
+// access to the fmt.State interface and the sentence and language-related
+// context.
+type State interface {
+ fmt.State
+
+ // Language reports the requested language in which to render a message.
+ Language() language.Tag
+
+ // TODO: consider this and removing rune from the Format method in the
+ // Formatter interface.
+ //
+ // Verb returns the format variant to render, analogous to the types used
+ // in fmt. Use 'v' for the default or only variant.
+ // Verb() rune
+
+ // TODO: more info:
+ // - sentence context such as linguistic features passed by the translator.
+}
+
+// Formatter is analogous to fmt.Formatter.
+type Formatter interface {
+ Format(state State, verb rune)
+}
diff --git a/vendor/golang.org/x/text/internal/format/parser.go b/vendor/golang.org/x/text/internal/format/parser.go
new file mode 100644
index 0000000..855aed7
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/format/parser.go
@@ -0,0 +1,358 @@
+// 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 format
+
+import (
+ "reflect"
+ "unicode/utf8"
+)
+
+// A Parser parses a format string. The result from the parse are set in the
+// struct fields.
+type Parser struct {
+ Verb rune
+
+ WidthPresent bool
+ PrecPresent bool
+ Minus bool
+ Plus bool
+ Sharp bool
+ Space bool
+ Zero bool
+
+ // For the formats %+v %#v, we set the plusV/sharpV flags
+ // and clear the plus/sharp flags since %+v and %#v are in effect
+ // different, flagless formats set at the top level.
+ PlusV bool
+ SharpV bool
+
+ HasIndex bool
+
+ Width int
+ Prec int // precision
+
+ // retain arguments across calls.
+ Args []interface{}
+ // retain current argument number across calls
+ ArgNum int
+
+ // reordered records whether the format string used argument reordering.
+ Reordered bool
+ // goodArgNum records whether the most recent reordering directive was valid.
+ goodArgNum bool
+
+ // position info
+ format string
+ startPos int
+ endPos int
+ Status Status
+}
+
+// Reset initializes a parser to scan format strings for the given args.
+func (p *Parser) Reset(args []interface{}) {
+ p.Args = args
+ p.ArgNum = 0
+ p.startPos = 0
+ p.Reordered = false
+}
+
+// Text returns the part of the format string that was parsed by the last call
+// to Scan. It returns the original substitution clause if the current scan
+// parsed a substitution.
+func (p *Parser) Text() string { return p.format[p.startPos:p.endPos] }
+
+// SetFormat sets a new format string to parse. It does not reset the argument
+// count.
+func (p *Parser) SetFormat(format string) {
+ p.format = format
+ p.startPos = 0
+ p.endPos = 0
+}
+
+// Status indicates the result type of a call to Scan.
+type Status int
+
+const (
+ StatusText Status = iota
+ StatusSubstitution
+ StatusBadWidthSubstitution
+ StatusBadPrecSubstitution
+ StatusNoVerb
+ StatusBadArgNum
+ StatusMissingArg
+)
+
+// ClearFlags reset the parser to default behavior.
+func (p *Parser) ClearFlags() {
+ p.WidthPresent = false
+ p.PrecPresent = false
+ p.Minus = false
+ p.Plus = false
+ p.Sharp = false
+ p.Space = false
+ p.Zero = false
+
+ p.PlusV = false
+ p.SharpV = false
+
+ p.HasIndex = false
+}
+
+// Scan scans the next part of the format string and sets the status to
+// indicate whether it scanned a string literal, substitution or error.
+func (p *Parser) Scan() bool {
+ p.Status = StatusText
+ format := p.format
+ end := len(format)
+ if p.endPos >= end {
+ return false
+ }
+ afterIndex := false // previous item in format was an index like [3].
+
+ p.startPos = p.endPos
+ p.goodArgNum = true
+ i := p.startPos
+ for i < end && format[i] != '%' {
+ i++
+ }
+ if i > p.startPos {
+ p.endPos = i
+ return true
+ }
+ // Process one verb
+ i++
+
+ p.Status = StatusSubstitution
+
+ // Do we have flags?
+ p.ClearFlags()
+
+simpleFormat:
+ for ; i < end; i++ {
+ c := p.format[i]
+ switch c {
+ case '#':
+ p.Sharp = true
+ case '0':
+ p.Zero = !p.Minus // Only allow zero padding to the left.
+ case '+':
+ p.Plus = true
+ case '-':
+ p.Minus = true
+ p.Zero = false // Do not pad with zeros to the right.
+ case ' ':
+ p.Space = true
+ default:
+ // Fast path for common case of ascii lower case simple verbs
+ // without precision or width or argument indices.
+ if 'a' <= c && c <= 'z' && p.ArgNum < len(p.Args) {
+ if c == 'v' {
+ // Go syntax
+ p.SharpV = p.Sharp
+ p.Sharp = false
+ // Struct-field syntax
+ p.PlusV = p.Plus
+ p.Plus = false
+ }
+ p.Verb = rune(c)
+ p.ArgNum++
+ p.endPos = i + 1
+ return true
+ }
+ // Format is more complex than simple flags and a verb or is malformed.
+ break simpleFormat
+ }
+ }
+
+ // Do we have an explicit argument index?
+ i, afterIndex = p.updateArgNumber(format, i)
+
+ // Do we have width?
+ if i < end && format[i] == '*' {
+ i++
+ p.Width, p.WidthPresent = p.intFromArg()
+
+ if !p.WidthPresent {
+ p.Status = StatusBadWidthSubstitution
+ }
+
+ // We have a negative width, so take its value and ensure
+ // that the minus flag is set
+ if p.Width < 0 {
+ p.Width = -p.Width
+ p.Minus = true
+ p.Zero = false // Do not pad with zeros to the right.
+ }
+ afterIndex = false
+ } else {
+ p.Width, p.WidthPresent, i = parsenum(format, i, end)
+ if afterIndex && p.WidthPresent { // "%[3]2d"
+ p.goodArgNum = false
+ }
+ }
+
+ // Do we have precision?
+ if i+1 < end && format[i] == '.' {
+ i++
+ if afterIndex { // "%[3].2d"
+ p.goodArgNum = false
+ }
+ i, afterIndex = p.updateArgNumber(format, i)
+ if i < end && format[i] == '*' {
+ i++
+ p.Prec, p.PrecPresent = p.intFromArg()
+ // Negative precision arguments don't make sense
+ if p.Prec < 0 {
+ p.Prec = 0
+ p.PrecPresent = false
+ }
+ if !p.PrecPresent {
+ p.Status = StatusBadPrecSubstitution
+ }
+ afterIndex = false
+ } else {
+ p.Prec, p.PrecPresent, i = parsenum(format, i, end)
+ if !p.PrecPresent {
+ p.Prec = 0
+ p.PrecPresent = true
+ }
+ }
+ }
+
+ if !afterIndex {
+ i, afterIndex = p.updateArgNumber(format, i)
+ }
+ p.HasIndex = afterIndex
+
+ if i >= end {
+ p.endPos = i
+ p.Status = StatusNoVerb
+ return true
+ }
+
+ verb, w := utf8.DecodeRuneInString(format[i:])
+ p.endPos = i + w
+ p.Verb = verb
+
+ switch {
+ case verb == '%': // Percent does not absorb operands and ignores f.wid and f.prec.
+ p.startPos = p.endPos - 1
+ p.Status = StatusText
+ case !p.goodArgNum:
+ p.Status = StatusBadArgNum
+ case p.ArgNum >= len(p.Args): // No argument left over to print for the current verb.
+ p.Status = StatusMissingArg
+ p.ArgNum++
+ case verb == 'v':
+ // Go syntax
+ p.SharpV = p.Sharp
+ p.Sharp = false
+ // Struct-field syntax
+ p.PlusV = p.Plus
+ p.Plus = false
+ fallthrough
+ default:
+ p.ArgNum++
+ }
+ return true
+}
+
+// intFromArg gets the ArgNumth element of Args. On return, isInt reports
+// whether the argument has integer type.
+func (p *Parser) intFromArg() (num int, isInt bool) {
+ if p.ArgNum < len(p.Args) {
+ arg := p.Args[p.ArgNum]
+ num, isInt = arg.(int) // Almost always OK.
+ if !isInt {
+ // Work harder.
+ switch v := reflect.ValueOf(arg); v.Kind() {
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ n := v.Int()
+ if int64(int(n)) == n {
+ num = int(n)
+ isInt = true
+ }
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ n := v.Uint()
+ if int64(n) >= 0 && uint64(int(n)) == n {
+ num = int(n)
+ isInt = true
+ }
+ default:
+ // Already 0, false.
+ }
+ }
+ p.ArgNum++
+ if tooLarge(num) {
+ num = 0
+ isInt = false
+ }
+ }
+ return
+}
+
+// parseArgNumber returns the value of the bracketed number, minus 1
+// (explicit argument numbers are one-indexed but we want zero-indexed).
+// The opening bracket is known to be present at format[0].
+// The returned values are the index, the number of bytes to consume
+// up to the closing paren, if present, and whether the number parsed
+// ok. The bytes to consume will be 1 if no closing paren is present.
+func parseArgNumber(format string) (index int, wid int, ok bool) {
+ // There must be at least 3 bytes: [n].
+ if len(format) < 3 {
+ return 0, 1, false
+ }
+
+ // Find closing bracket.
+ for i := 1; i < len(format); i++ {
+ if format[i] == ']' {
+ width, ok, newi := parsenum(format, 1, i)
+ if !ok || newi != i {
+ return 0, i + 1, false
+ }
+ return width - 1, i + 1, true // arg numbers are one-indexed and skip paren.
+ }
+ }
+ return 0, 1, false
+}
+
+// updateArgNumber returns the next argument to evaluate, which is either the value of the passed-in
+// argNum or the value of the bracketed integer that begins format[i:]. It also returns
+// the new value of i, that is, the index of the next byte of the format to process.
+func (p *Parser) updateArgNumber(format string, i int) (newi int, found bool) {
+ if len(format) <= i || format[i] != '[' {
+ return i, false
+ }
+ p.Reordered = true
+ index, wid, ok := parseArgNumber(format[i:])
+ if ok && 0 <= index && index < len(p.Args) {
+ p.ArgNum = index
+ return i + wid, true
+ }
+ p.goodArgNum = false
+ return i + wid, ok
+}
+
+// tooLarge reports whether the magnitude of the integer is
+// too large to be used as a formatting width or precision.
+func tooLarge(x int) bool {
+ const max int = 1e6
+ return x > max || x < -max
+}
+
+// parsenum converts ASCII to integer. num is 0 (and isnum is false) if no number present.
+func parsenum(s string, start, end int) (num int, isnum bool, newi int) {
+ if start >= end {
+ return 0, false, end
+ }
+ for newi = start; newi < end && '0' <= s[newi] && s[newi] <= '9'; newi++ {
+ if tooLarge(num) {
+ return 0, false, end // Overflow; crazy long number most likely.
+ }
+ num = num*10 + int(s[newi]-'0')
+ isnum = true
+ }
+ return
+}
diff --git a/vendor/golang.org/x/text/internal/format/parser_test.go b/vendor/golang.org/x/text/internal/format/parser_test.go
new file mode 100644
index 0000000..7229908
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/format/parser_test.go
@@ -0,0 +1,32 @@
+// 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 format
+
+import "testing"
+
+// TODO: most of Parser is tested in x/message. Move some tests here.
+
+func TestParsenum(t *testing.T) {
+ testCases := []struct {
+ s string
+ start, end int
+ num int
+ isnum bool
+ newi int
+ }{
+ {"a123", 0, 4, 0, false, 0},
+ {"1234", 1, 1, 0, false, 1},
+ {"123a", 0, 4, 123, true, 3},
+ {"12a3", 0, 4, 12, true, 2},
+ {"1234", 0, 4, 1234, true, 4},
+ {"1a234", 1, 3, 0, false, 1},
+ }
+ for _, tt := range testCases {
+ num, isnum, newi := parsenum(tt.s, tt.start, tt.end)
+ if num != tt.num || isnum != tt.isnum || newi != tt.newi {
+ t.Errorf("parsenum(%q, %d, %d) = %d, %v, %d, want %d, %v, %d", tt.s, tt.start, tt.end, num, isnum, newi, tt.num, tt.isnum, tt.newi)
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/gen/code.go b/vendor/golang.org/x/text/internal/gen/code.go
new file mode 100644
index 0000000..8622c7f
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/gen/code.go
@@ -0,0 +1,371 @@
+// Copyright 2015 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 gen
+
+import (
+ "bytes"
+ "encoding/gob"
+ "fmt"
+ "hash"
+ "hash/fnv"
+ "io"
+ "log"
+ "os"
+ "reflect"
+ "strings"
+ "unicode"
+ "unicode/utf8"
+)
+
+// This file contains utilities for generating code.
+
+// TODO: other write methods like:
+// - slices, maps, types, etc.
+
+// CodeWriter is a utility for writing structured code. It computes the content
+// hash and size of written content. It ensures there are newlines between
+// written code blocks.
+type CodeWriter struct {
+ buf bytes.Buffer
+ Size int
+ Hash hash.Hash32 // content hash
+ gob *gob.Encoder
+ // For comments we skip the usual one-line separator if they are followed by
+ // a code block.
+ skipSep bool
+}
+
+func (w *CodeWriter) Write(p []byte) (n int, err error) {
+ return w.buf.Write(p)
+}
+
+// NewCodeWriter returns a new CodeWriter.
+func NewCodeWriter() *CodeWriter {
+ h := fnv.New32()
+ return &CodeWriter{Hash: h, gob: gob.NewEncoder(h)}
+}
+
+// WriteGoFile appends the buffer with the total size of all created structures
+// and writes it as a Go file to the given file with the given package name.
+func (w *CodeWriter) WriteGoFile(filename, pkg string) {
+ f, err := os.Create(filename)
+ if err != nil {
+ log.Fatalf("Could not create file %s: %v", filename, err)
+ }
+ defer f.Close()
+ if _, err = w.WriteGo(f, pkg, ""); err != nil {
+ log.Fatalf("Error writing file %s: %v", filename, err)
+ }
+}
+
+// WriteVersionedGoFile appends the buffer with the total size of all created
+// structures and writes it as a Go file to the given file with the given
+// package name and build tags for the current Unicode version,
+func (w *CodeWriter) WriteVersionedGoFile(filename, pkg string) {
+ tags := buildTags()
+ if tags != "" {
+ filename = insertVersion(filename, UnicodeVersion())
+ }
+ f, err := os.Create(filename)
+ if err != nil {
+ log.Fatalf("Could not create file %s: %v", filename, err)
+ }
+ defer f.Close()
+ if _, err = w.WriteGo(f, pkg, tags); err != nil {
+ log.Fatalf("Error writing file %s: %v", filename, err)
+ }
+}
+
+// WriteGo appends the buffer with the total size of all created structures and
+// writes it as a Go file to the given writer with the given package name.
+func (w *CodeWriter) WriteGo(out io.Writer, pkg, tags string) (n int, err error) {
+ sz := w.Size
+ w.WriteComment("Total table size %d bytes (%dKiB); checksum: %X\n", sz, sz/1024, w.Hash.Sum32())
+ defer w.buf.Reset()
+ return WriteGo(out, pkg, tags, w.buf.Bytes())
+}
+
+func (w *CodeWriter) printf(f string, x ...interface{}) {
+ fmt.Fprintf(w, f, x...)
+}
+
+func (w *CodeWriter) insertSep() {
+ if w.skipSep {
+ w.skipSep = false
+ return
+ }
+ // Use at least two newlines to ensure a blank space between the previous
+ // block. WriteGoFile will remove extraneous newlines.
+ w.printf("\n\n")
+}
+
+// WriteComment writes a comment block. All line starts are prefixed with "//".
+// Initial empty lines are gobbled. The indentation for the first line is
+// stripped from consecutive lines.
+func (w *CodeWriter) WriteComment(comment string, args ...interface{}) {
+ s := fmt.Sprintf(comment, args...)
+ s = strings.Trim(s, "\n")
+
+ // Use at least two newlines to ensure a blank space between the previous
+ // block. WriteGoFile will remove extraneous newlines.
+ w.printf("\n\n// ")
+ w.skipSep = true
+
+ // strip first indent level.
+ sep := "\n"
+ for ; len(s) > 0 && (s[0] == '\t' || s[0] == ' '); s = s[1:] {
+ sep += s[:1]
+ }
+
+ strings.NewReplacer(sep, "\n// ", "\n", "\n// ").WriteString(w, s)
+
+ w.printf("\n")
+}
+
+func (w *CodeWriter) writeSizeInfo(size int) {
+ w.printf("// Size: %d bytes\n", size)
+}
+
+// WriteConst writes a constant of the given name and value.
+func (w *CodeWriter) WriteConst(name string, x interface{}) {
+ w.insertSep()
+ v := reflect.ValueOf(x)
+
+ switch v.Type().Kind() {
+ case reflect.String:
+ w.printf("const %s %s = ", name, typeName(x))
+ w.WriteString(v.String())
+ w.printf("\n")
+ default:
+ w.printf("const %s = %#v\n", name, x)
+ }
+}
+
+// WriteVar writes a variable of the given name and value.
+func (w *CodeWriter) WriteVar(name string, x interface{}) {
+ w.insertSep()
+ v := reflect.ValueOf(x)
+ oldSize := w.Size
+ sz := int(v.Type().Size())
+ w.Size += sz
+
+ switch v.Type().Kind() {
+ case reflect.String:
+ w.printf("var %s %s = ", name, typeName(x))
+ w.WriteString(v.String())
+ case reflect.Struct:
+ w.gob.Encode(x)
+ fallthrough
+ case reflect.Slice, reflect.Array:
+ w.printf("var %s = ", name)
+ w.writeValue(v)
+ w.writeSizeInfo(w.Size - oldSize)
+ default:
+ w.printf("var %s %s = ", name, typeName(x))
+ w.gob.Encode(x)
+ w.writeValue(v)
+ w.writeSizeInfo(w.Size - oldSize)
+ }
+ w.printf("\n")
+}
+
+func (w *CodeWriter) writeValue(v reflect.Value) {
+ x := v.Interface()
+ switch v.Kind() {
+ case reflect.String:
+ w.WriteString(v.String())
+ case reflect.Array:
+ // Don't double count: callers of WriteArray count on the size being
+ // added, so we need to discount it here.
+ w.Size -= int(v.Type().Size())
+ w.writeSlice(x, true)
+ case reflect.Slice:
+ w.writeSlice(x, false)
+ case reflect.Struct:
+ w.printf("%s{\n", typeName(v.Interface()))
+ t := v.Type()
+ for i := 0; i < v.NumField(); i++ {
+ w.printf("%s: ", t.Field(i).Name)
+ w.writeValue(v.Field(i))
+ w.printf(",\n")
+ }
+ w.printf("}")
+ default:
+ w.printf("%#v", x)
+ }
+}
+
+// WriteString writes a string literal.
+func (w *CodeWriter) WriteString(s string) {
+ io.WriteString(w.Hash, s) // content hash
+ w.Size += len(s)
+
+ const maxInline = 40
+ if len(s) <= maxInline {
+ w.printf("%q", s)
+ return
+ }
+
+ // We will render the string as a multi-line string.
+ const maxWidth = 80 - 4 - len(`"`) - len(`" +`)
+
+ // When starting on its own line, go fmt indents line 2+ an extra level.
+ n, max := maxWidth, maxWidth-4
+
+ // As per https://golang.org/issue/18078, the compiler has trouble
+ // compiling the concatenation of many strings, s0 + s1 + s2 + ... + sN,
+ // for large N. We insert redundant, explicit parentheses to work around
+ // that, lowering the N at any given step: (s0 + s1 + ... + s63) + (s64 +
+ // ... + s127) + etc + (etc + ... + sN).
+ explicitParens, extraComment := len(s) > 128*1024, ""
+ if explicitParens {
+ w.printf(`(`)
+ extraComment = "; the redundant, explicit parens are for https://golang.org/issue/18078"
+ }
+
+ // Print "" +\n, if a string does not start on its own line.
+ b := w.buf.Bytes()
+ if p := len(bytes.TrimRight(b, " \t")); p > 0 && b[p-1] != '\n' {
+ w.printf("\"\" + // Size: %d bytes%s\n", len(s), extraComment)
+ n, max = maxWidth, maxWidth
+ }
+
+ w.printf(`"`)
+
+ for sz, p, nLines := 0, 0, 0; p < len(s); {
+ var r rune
+ r, sz = utf8.DecodeRuneInString(s[p:])
+ out := s[p : p+sz]
+ chars := 1
+ if !unicode.IsPrint(r) || r == utf8.RuneError || r == '"' {
+ switch sz {
+ case 1:
+ out = fmt.Sprintf("\\x%02x", s[p])
+ case 2, 3:
+ out = fmt.Sprintf("\\u%04x", r)
+ case 4:
+ out = fmt.Sprintf("\\U%08x", r)
+ }
+ chars = len(out)
+ } else if r == '\\' {
+ out = "\\" + string(r)
+ chars = 2
+ }
+ if n -= chars; n < 0 {
+ nLines++
+ if explicitParens && nLines&63 == 63 {
+ w.printf("\") + (\"")
+ }
+ w.printf("\" +\n\"")
+ n = max - len(out)
+ }
+ w.printf("%s", out)
+ p += sz
+ }
+ w.printf(`"`)
+ if explicitParens {
+ w.printf(`)`)
+ }
+}
+
+// WriteSlice writes a slice value.
+func (w *CodeWriter) WriteSlice(x interface{}) {
+ w.writeSlice(x, false)
+}
+
+// WriteArray writes an array value.
+func (w *CodeWriter) WriteArray(x interface{}) {
+ w.writeSlice(x, true)
+}
+
+func (w *CodeWriter) writeSlice(x interface{}, isArray bool) {
+ v := reflect.ValueOf(x)
+ w.gob.Encode(v.Len())
+ w.Size += v.Len() * int(v.Type().Elem().Size())
+ name := typeName(x)
+ if isArray {
+ name = fmt.Sprintf("[%d]%s", v.Len(), name[strings.Index(name, "]")+1:])
+ }
+ if isArray {
+ w.printf("%s{\n", name)
+ } else {
+ w.printf("%s{ // %d elements\n", name, v.Len())
+ }
+
+ switch kind := v.Type().Elem().Kind(); kind {
+ case reflect.String:
+ for _, s := range x.([]string) {
+ w.WriteString(s)
+ w.printf(",\n")
+ }
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
+ reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
+ // nLine and nBlock are the number of elements per line and block.
+ nLine, nBlock, format := 8, 64, "%d,"
+ switch kind {
+ case reflect.Uint8:
+ format = "%#02x,"
+ case reflect.Uint16:
+ format = "%#04x,"
+ case reflect.Uint32:
+ nLine, nBlock, format = 4, 32, "%#08x,"
+ case reflect.Uint, reflect.Uint64:
+ nLine, nBlock, format = 4, 32, "%#016x,"
+ case reflect.Int8:
+ nLine = 16
+ }
+ n := nLine
+ for i := 0; i < v.Len(); i++ {
+ if i%nBlock == 0 && v.Len() > nBlock {
+ w.printf("// Entry %X - %X\n", i, i+nBlock-1)
+ }
+ x := v.Index(i).Interface()
+ w.gob.Encode(x)
+ w.printf(format, x)
+ if n--; n == 0 {
+ n = nLine
+ w.printf("\n")
+ }
+ }
+ w.printf("\n")
+ case reflect.Struct:
+ zero := reflect.Zero(v.Type().Elem()).Interface()
+ for i := 0; i < v.Len(); i++ {
+ x := v.Index(i).Interface()
+ w.gob.EncodeValue(v)
+ if !reflect.DeepEqual(zero, x) {
+ line := fmt.Sprintf("%#v,\n", x)
+ line = line[strings.IndexByte(line, '{'):]
+ w.printf("%d: ", i)
+ w.printf(line)
+ }
+ }
+ case reflect.Array:
+ for i := 0; i < v.Len(); i++ {
+ w.printf("%d: %#v,\n", i, v.Index(i).Interface())
+ }
+ default:
+ panic("gen: slice elem type not supported")
+ }
+ w.printf("}")
+}
+
+// WriteType writes a definition of the type of the given value and returns the
+// type name.
+func (w *CodeWriter) WriteType(x interface{}) string {
+ t := reflect.TypeOf(x)
+ w.printf("type %s struct {\n", t.Name())
+ for i := 0; i < t.NumField(); i++ {
+ w.printf("\t%s %s\n", t.Field(i).Name, t.Field(i).Type)
+ }
+ w.printf("}\n")
+ return t.Name()
+}
+
+// typeName returns the name of the go type of x.
+func typeName(x interface{}) string {
+ t := reflect.ValueOf(x).Type()
+ return strings.Replace(fmt.Sprint(t), "main.", "", 1)
+}
diff --git a/vendor/golang.org/x/text/internal/gen/gen.go b/vendor/golang.org/x/text/internal/gen/gen.go
new file mode 100644
index 0000000..13257d6
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/gen/gen.go
@@ -0,0 +1,333 @@
+// Copyright 2015 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 gen contains common code for the various code generation tools in the
+// text repository. Its usage ensures consistency between tools.
+//
+// This package defines command line flags that are common to most generation
+// tools. The flags allow for specifying specific Unicode and CLDR versions
+// in the public Unicode data repository (https://www.unicode.org/Public).
+//
+// A local Unicode data mirror can be set through the flag -local or the
+// environment variable UNICODE_DIR. The former takes precedence. The local
+// directory should follow the same structure as the public repository.
+//
+// IANA data can also optionally be mirrored by putting it in the iana directory
+// rooted at the top of the local mirror. Beware, though, that IANA data is not
+// versioned. So it is up to the developer to use the right version.
+package gen // import "golang.org/x/text/internal/gen"
+
+import (
+ "bytes"
+ "flag"
+ "fmt"
+ "go/build"
+ "go/format"
+ "io"
+ "io/ioutil"
+ "log"
+ "net/http"
+ "os"
+ "path"
+ "path/filepath"
+ "strings"
+ "sync"
+ "unicode"
+
+ "golang.org/x/text/unicode/cldr"
+)
+
+var (
+ url = flag.String("url",
+ "https://www.unicode.org/Public",
+ "URL of Unicode database directory")
+ iana = flag.String("iana",
+ "http://www.iana.org",
+ "URL of the IANA repository")
+ unicodeVersion = flag.String("unicode",
+ getEnv("UNICODE_VERSION", unicode.Version),
+ "unicode version to use")
+ cldrVersion = flag.String("cldr",
+ getEnv("CLDR_VERSION", cldr.Version),
+ "cldr version to use")
+)
+
+func getEnv(name, def string) string {
+ if v := os.Getenv(name); v != "" {
+ return v
+ }
+ return def
+}
+
+// Init performs common initialization for a gen command. It parses the flags
+// and sets up the standard logging parameters.
+func Init() {
+ log.SetPrefix("")
+ log.SetFlags(log.Lshortfile)
+ flag.Parse()
+}
+
+const header = `// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+`
+
+// UnicodeVersion reports the requested Unicode version.
+func UnicodeVersion() string {
+ return *unicodeVersion
+}
+
+// CLDRVersion reports the requested CLDR version.
+func CLDRVersion() string {
+ return *cldrVersion
+}
+
+var tags = []struct{ version, buildTags string }{
+ {"10.0.0", "go1.10"},
+ {"", "!go1.10"},
+}
+
+// buildTags reports the build tags used for the current Unicode version.
+func buildTags() string {
+ v := UnicodeVersion()
+ for _, x := range tags {
+ // We should do a numeric comparison, but including the collate package
+ // would create an import cycle. We approximate it by assuming that
+ // longer version strings are later.
+ if len(x.version) <= len(v) {
+ return x.buildTags
+ }
+ if len(x.version) == len(v) && x.version <= v {
+ return x.buildTags
+ }
+ }
+ return tags[0].buildTags
+}
+
+// IsLocal reports whether data files are available locally.
+func IsLocal() bool {
+ dir, err := localReadmeFile()
+ if err != nil {
+ return false
+ }
+ if _, err = os.Stat(dir); err != nil {
+ return false
+ }
+ return true
+}
+
+// OpenUCDFile opens the requested UCD file. The file is specified relative to
+// the public Unicode root directory. It will call log.Fatal if there are any
+// errors.
+func OpenUCDFile(file string) io.ReadCloser {
+ return openUnicode(path.Join(*unicodeVersion, "ucd", file))
+}
+
+// OpenCLDRCoreZip opens the CLDR core zip file. It will call log.Fatal if there
+// are any errors.
+func OpenCLDRCoreZip() io.ReadCloser {
+ return OpenUnicodeFile("cldr", *cldrVersion, "core.zip")
+}
+
+// OpenUnicodeFile opens the requested file of the requested category from the
+// root of the Unicode data archive. The file is specified relative to the
+// public Unicode root directory. If version is "", it will use the default
+// Unicode version. It will call log.Fatal if there are any errors.
+func OpenUnicodeFile(category, version, file string) io.ReadCloser {
+ if version == "" {
+ version = UnicodeVersion()
+ }
+ return openUnicode(path.Join(category, version, file))
+}
+
+// OpenIANAFile opens the requested IANA file. The file is specified relative
+// to the IANA root, which is typically either http://www.iana.org or the
+// iana directory in the local mirror. It will call log.Fatal if there are any
+// errors.
+func OpenIANAFile(path string) io.ReadCloser {
+ return Open(*iana, "iana", path)
+}
+
+var (
+ dirMutex sync.Mutex
+ localDir string
+)
+
+const permissions = 0755
+
+func localReadmeFile() (string, error) {
+ p, err := build.Import("golang.org/x/text", "", build.FindOnly)
+ if err != nil {
+ return "", fmt.Errorf("Could not locate package: %v", err)
+ }
+ return filepath.Join(p.Dir, "DATA", "README"), nil
+}
+
+func getLocalDir() string {
+ dirMutex.Lock()
+ defer dirMutex.Unlock()
+
+ readme, err := localReadmeFile()
+ if err != nil {
+ log.Fatal(err)
+ }
+ dir := filepath.Dir(readme)
+ if _, err := os.Stat(readme); err != nil {
+ if err := os.MkdirAll(dir, permissions); err != nil {
+ log.Fatalf("Could not create directory: %v", err)
+ }
+ ioutil.WriteFile(readme, []byte(readmeTxt), permissions)
+ }
+ return dir
+}
+
+const readmeTxt = `Generated by golang.org/x/text/internal/gen. DO NOT EDIT.
+
+This directory contains downloaded files used to generate the various tables
+in the golang.org/x/text subrepo.
+
+Note that the language subtag repo (iana/assignments/language-subtag-registry)
+and all other times in the iana subdirectory are not versioned and will need
+to be periodically manually updated. The easiest way to do this is to remove
+the entire iana directory. This is mostly of concern when updating the language
+package.
+`
+
+// Open opens subdir/path if a local directory is specified and the file exists,
+// where subdir is a directory relative to the local root, or fetches it from
+// urlRoot/path otherwise. It will call log.Fatal if there are any errors.
+func Open(urlRoot, subdir, path string) io.ReadCloser {
+ file := filepath.Join(getLocalDir(), subdir, filepath.FromSlash(path))
+ return open(file, urlRoot, path)
+}
+
+func openUnicode(path string) io.ReadCloser {
+ file := filepath.Join(getLocalDir(), filepath.FromSlash(path))
+ return open(file, *url, path)
+}
+
+// TODO: automatically periodically update non-versioned files.
+
+func open(file, urlRoot, path string) io.ReadCloser {
+ if f, err := os.Open(file); err == nil {
+ return f
+ }
+ r := get(urlRoot, path)
+ defer r.Close()
+ b, err := ioutil.ReadAll(r)
+ if err != nil {
+ log.Fatalf("Could not download file: %v", err)
+ }
+ os.MkdirAll(filepath.Dir(file), permissions)
+ if err := ioutil.WriteFile(file, b, permissions); err != nil {
+ log.Fatalf("Could not create file: %v", err)
+ }
+ return ioutil.NopCloser(bytes.NewReader(b))
+}
+
+func get(root, path string) io.ReadCloser {
+ url := root + "/" + path
+ fmt.Printf("Fetching %s...", url)
+ defer fmt.Println(" done.")
+ resp, err := http.Get(url)
+ if err != nil {
+ log.Fatalf("HTTP GET: %v", err)
+ }
+ if resp.StatusCode != 200 {
+ log.Fatalf("Bad GET status for %q: %q", url, resp.Status)
+ }
+ return resp.Body
+}
+
+// TODO: use Write*Version in all applicable packages.
+
+// WriteUnicodeVersion writes a constant for the Unicode version from which the
+// tables are generated.
+func WriteUnicodeVersion(w io.Writer) {
+ fmt.Fprintf(w, "// UnicodeVersion is the Unicode version from which the tables in this package are derived.\n")
+ fmt.Fprintf(w, "const UnicodeVersion = %q\n\n", UnicodeVersion())
+}
+
+// WriteCLDRVersion writes a constant for the CLDR version from which the
+// tables are generated.
+func WriteCLDRVersion(w io.Writer) {
+ fmt.Fprintf(w, "// CLDRVersion is the CLDR version from which the tables in this package are derived.\n")
+ fmt.Fprintf(w, "const CLDRVersion = %q\n\n", CLDRVersion())
+}
+
+// WriteGoFile prepends a standard file comment and package statement to the
+// given bytes, applies gofmt, and writes them to a file with the given name.
+// It will call log.Fatal if there are any errors.
+func WriteGoFile(filename, pkg string, b []byte) {
+ w, err := os.Create(filename)
+ if err != nil {
+ log.Fatalf("Could not create file %s: %v", filename, err)
+ }
+ defer w.Close()
+ if _, err = WriteGo(w, pkg, "", b); err != nil {
+ log.Fatalf("Error writing file %s: %v", filename, err)
+ }
+}
+
+func insertVersion(filename, version string) string {
+ suffix := ".go"
+ if strings.HasSuffix(filename, "_test.go") {
+ suffix = "_test.go"
+ }
+ return fmt.Sprint(filename[:len(filename)-len(suffix)], version, suffix)
+}
+
+// WriteVersionedGoFile prepends a standard file comment, adds build tags to
+// version the file for the current Unicode version, and package statement to
+// the given bytes, applies gofmt, and writes them to a file with the given
+// name. It will call log.Fatal if there are any errors.
+func WriteVersionedGoFile(filename, pkg string, b []byte) {
+ tags := buildTags()
+ if tags != "" {
+ filename = insertVersion(filename, UnicodeVersion())
+ }
+ w, err := os.Create(filename)
+ if err != nil {
+ log.Fatalf("Could not create file %s: %v", filename, err)
+ }
+ defer w.Close()
+ if _, err = WriteGo(w, pkg, tags, b); err != nil {
+ log.Fatalf("Error writing file %s: %v", filename, err)
+ }
+}
+
+// WriteGo prepends a standard file comment and package statement to the given
+// bytes, applies gofmt, and writes them to w.
+func WriteGo(w io.Writer, pkg, tags string, b []byte) (n int, err error) {
+ src := []byte(header)
+ if tags != "" {
+ src = append(src, fmt.Sprintf("// +build %s\n\n", tags)...)
+ }
+ src = append(src, fmt.Sprintf("package %s\n\n", pkg)...)
+ src = append(src, b...)
+ formatted, err := format.Source(src)
+ if err != nil {
+ // Print the generated code even in case of an error so that the
+ // returned error can be meaningfully interpreted.
+ n, _ = w.Write(src)
+ return n, err
+ }
+ return w.Write(formatted)
+}
+
+// Repackage rewrites a Go file from belonging to package main to belonging to
+// the given package.
+func Repackage(inFile, outFile, pkg string) {
+ src, err := ioutil.ReadFile(inFile)
+ if err != nil {
+ log.Fatalf("reading %s: %v", inFile, err)
+ }
+ const toDelete = "package main\n\n"
+ i := bytes.Index(src, []byte(toDelete))
+ if i < 0 {
+ log.Fatalf("Could not find %q in %s.", toDelete, inFile)
+ }
+ w := &bytes.Buffer{}
+ w.Write(src[i+len(toDelete):])
+ WriteGoFile(outFile, pkg, w.Bytes())
+}
diff --git a/vendor/golang.org/x/text/internal/internal.go b/vendor/golang.org/x/text/internal/internal.go
new file mode 100644
index 0000000..3cddbbd
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/internal.go
@@ -0,0 +1,49 @@
+// Copyright 2015 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 internal contains non-exported functionality that are used by
+// packages in the text repository.
+package internal // import "golang.org/x/text/internal"
+
+import (
+ "sort"
+
+ "golang.org/x/text/language"
+)
+
+// SortTags sorts tags in place.
+func SortTags(tags []language.Tag) {
+ sort.Sort(sorter(tags))
+}
+
+type sorter []language.Tag
+
+func (s sorter) Len() int {
+ return len(s)
+}
+
+func (s sorter) Swap(i, j int) {
+ s[i], s[j] = s[j], s[i]
+}
+
+func (s sorter) Less(i, j int) bool {
+ return s[i].String() < s[j].String()
+}
+
+// UniqueTags sorts and filters duplicate tags in place and returns a slice with
+// only unique tags.
+func UniqueTags(tags []language.Tag) []language.Tag {
+ if len(tags) <= 1 {
+ return tags
+ }
+ SortTags(tags)
+ k := 0
+ for i := 1; i < len(tags); i++ {
+ if tags[k].String() < tags[i].String() {
+ k++
+ tags[k] = tags[i]
+ }
+ }
+ return tags[:k+1]
+}
diff --git a/vendor/golang.org/x/text/internal/internal_test.go b/vendor/golang.org/x/text/internal/internal_test.go
new file mode 100644
index 0000000..ce1b9a3
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/internal_test.go
@@ -0,0 +1,38 @@
+// Copyright 2015 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 internal
+
+import (
+ "fmt"
+ "strings"
+ "testing"
+
+ "golang.org/x/text/language"
+)
+
+func TestUnique(t *testing.T) {
+ testCases := []struct {
+ in, want string
+ }{
+ {"", "[]"},
+ {"en", "[en]"},
+ {"en en", "[en]"},
+ {"en en en", "[en]"},
+ {"en-u-cu-eur en", "[en en-u-cu-eur]"},
+ {"nl en", "[en nl]"},
+ {"pt-Pt pt", "[pt pt-PT]"},
+ }
+ for _, tc := range testCases {
+ tags := []language.Tag{}
+ for _, s := range strings.Split(tc.in, " ") {
+ if s != "" {
+ tags = append(tags, language.MustParse(s))
+ }
+ }
+ if got := fmt.Sprint(UniqueTags(tags)); got != tc.want {
+ t.Errorf("Unique(%s) = %s; want %s", tc.in, got, tc.want)
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/language/common.go b/vendor/golang.org/x/text/internal/language/common.go
new file mode 100644
index 0000000..cdfdb74
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/common.go
@@ -0,0 +1,16 @@
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+package language
+
+// This file contains code common to the maketables.go and the package code.
+
+// AliasType is the type of an alias in AliasMap.
+type AliasType int8
+
+const (
+ Deprecated AliasType = iota
+ Macro
+ Legacy
+
+ AliasTypeUnknown AliasType = -1
+)
diff --git a/vendor/golang.org/x/text/internal/language/compact.go b/vendor/golang.org/x/text/internal/language/compact.go
new file mode 100644
index 0000000..46a0015
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact.go
@@ -0,0 +1,29 @@
+// Copyright 2018 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 language
+
+// CompactCoreInfo is a compact integer with the three core tags encoded.
+type CompactCoreInfo uint32
+
+// GetCompactCore generates a uint32 value that is guaranteed to be unique for
+// different language, region, and script values.
+func GetCompactCore(t Tag) (cci CompactCoreInfo, ok bool) {
+ if t.LangID > langNoIndexOffset {
+ return 0, false
+ }
+ cci |= CompactCoreInfo(t.LangID) << (8 + 12)
+ cci |= CompactCoreInfo(t.ScriptID) << 12
+ cci |= CompactCoreInfo(t.RegionID)
+ return cci, true
+}
+
+// Tag generates a tag from c.
+func (c CompactCoreInfo) Tag() Tag {
+ return Tag{
+ LangID: Language(c >> 20),
+ RegionID: Region(c & 0x3ff),
+ ScriptID: Script(c>>12) & 0xff,
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/language/compact/compact.go b/vendor/golang.org/x/text/internal/language/compact/compact.go
new file mode 100644
index 0000000..1b36935
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact/compact.go
@@ -0,0 +1,61 @@
+// Copyright 2018 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 compact defines a compact representation of language tags.
+//
+// Common language tags (at least all for which locale information is defined
+// in CLDR) are assigned a unique index. Each Tag is associated with such an
+// ID for selecting language-related resources (such as translations) as well
+// as one for selecting regional defaults (currency, number formatting, etc.)
+//
+// It may want to export this functionality at some point, but at this point
+// this is only available for use within x/text.
+package compact // import "golang.org/x/text/internal/language/compact"
+
+import (
+ "sort"
+ "strings"
+
+ "golang.org/x/text/internal/language"
+)
+
+// ID is an integer identifying a single tag.
+type ID uint16
+
+func getCoreIndex(t language.Tag) (id ID, ok bool) {
+ cci, ok := language.GetCompactCore(t)
+ if !ok {
+ return 0, false
+ }
+ i := sort.Search(len(coreTags), func(i int) bool {
+ return cci <= coreTags[i]
+ })
+ if i == len(coreTags) || coreTags[i] != cci {
+ return 0, false
+ }
+ return ID(i), true
+}
+
+// Parent returns the ID of the parent or the root ID if id is already the root.
+func (id ID) Parent() ID {
+ return parents[id]
+}
+
+// Tag converts id to an internal language Tag.
+func (id ID) Tag() language.Tag {
+ if int(id) >= len(coreTags) {
+ return specialTags[int(id)-len(coreTags)]
+ }
+ return coreTags[id].Tag()
+}
+
+var specialTags []language.Tag
+
+func init() {
+ tags := strings.Split(specialTagsStr, " ")
+ specialTags = make([]language.Tag, len(tags))
+ for i, t := range tags {
+ specialTags[i] = language.MustParse(t)
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/language/compact/gen.go b/vendor/golang.org/x/text/internal/language/compact/gen.go
new file mode 100644
index 0000000..0c36a05
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact/gen.go
@@ -0,0 +1,64 @@
+// Copyright 2013 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
+
+// Language tag table generator.
+// Data read from the web.
+
+package main
+
+import (
+ "flag"
+ "fmt"
+ "log"
+
+ "golang.org/x/text/internal/gen"
+ "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 for generated tables")
+)
+
+func main() {
+ gen.Init()
+
+ w := gen.NewCodeWriter()
+ defer w.WriteGoFile("tables.go", "compact")
+
+ fmt.Fprintln(w, `import "golang.org/x/text/internal/language"`)
+
+ b := newBuilder(w)
+ gen.WriteCLDRVersion(w)
+
+ b.writeCompactIndex()
+}
+
+type builder struct {
+ w *gen.CodeWriter
+ data *cldr.CLDR
+ supp *cldr.SupplementalData
+}
+
+func newBuilder(w *gen.CodeWriter) *builder {
+ r := gen.OpenCLDRCoreZip()
+ defer r.Close()
+ d := &cldr.Decoder{}
+ data, err := d.DecodeZip(r)
+ if err != nil {
+ log.Fatal(err)
+ }
+ b := builder{
+ w: w,
+ data: data,
+ supp: data.Supplemental(),
+ }
+ return &b
+}
diff --git a/vendor/golang.org/x/text/internal/language/compact/gen_index.go b/vendor/golang.org/x/text/internal/language/compact/gen_index.go
new file mode 100644
index 0000000..136cefa
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact/gen_index.go
@@ -0,0 +1,113 @@
+// Copyright 2015 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
+
+// This file generates derivative tables based on the language package itself.
+
+import (
+ "fmt"
+ "log"
+ "sort"
+ "strings"
+
+ "golang.org/x/text/internal/language"
+)
+
+// Compact indices:
+// Note -va-X variants only apply to localization variants.
+// BCP variants only ever apply to language.
+// The only ambiguity between tags is with regions.
+
+func (b *builder) writeCompactIndex() {
+ // Collect all language tags for which we have any data in CLDR.
+ m := map[language.Tag]bool{}
+ for _, lang := range b.data.Locales() {
+ // We include all locales unconditionally to be consistent with en_US.
+ // We want en_US, even though it has no data associated with it.
+
+ // TODO: put any of the languages for which no data exists at the end
+ // of the index. This allows all components based on ICU to use that
+ // as the cutoff point.
+ // if x := data.RawLDML(lang); false ||
+ // x.LocaleDisplayNames != nil ||
+ // x.Characters != nil ||
+ // x.Delimiters != nil ||
+ // x.Measurement != nil ||
+ // x.Dates != nil ||
+ // x.Numbers != nil ||
+ // x.Units != nil ||
+ // x.ListPatterns != nil ||
+ // x.Collations != nil ||
+ // x.Segmentations != nil ||
+ // x.Rbnf != nil ||
+ // x.Annotations != nil ||
+ // x.Metadata != nil {
+
+ // TODO: support POSIX natively, albeit non-standard.
+ tag := language.Make(strings.Replace(lang, "_POSIX", "-u-va-posix", 1))
+ m[tag] = true
+ // }
+ }
+
+ // TODO: plural rules are also defined for the deprecated tags:
+ // iw mo sh tl
+ // Consider removing these as compact tags.
+
+ // Include locales for plural rules, which uses a different structure.
+ for _, plurals := range b.supp.Plurals {
+ for _, rules := range plurals.PluralRules {
+ for _, lang := range strings.Split(rules.Locales, " ") {
+ m[language.Make(lang)] = true
+ }
+ }
+ }
+
+ var coreTags []language.CompactCoreInfo
+ var special []string
+
+ for t := range m {
+ if x := t.Extensions(); len(x) != 0 && fmt.Sprint(x) != "[u-va-posix]" {
+ log.Fatalf("Unexpected extension %v in %v", x, t)
+ }
+ if len(t.Variants()) == 0 && len(t.Extensions()) == 0 {
+ cci, ok := language.GetCompactCore(t)
+ if !ok {
+ log.Fatalf("Locale for non-basic language %q", t)
+ }
+ coreTags = append(coreTags, cci)
+ } else {
+ special = append(special, t.String())
+ }
+ }
+
+ w := b.w
+
+ sort.Slice(coreTags, func(i, j int) bool { return coreTags[i] < coreTags[j] })
+ sort.Strings(special)
+
+ w.WriteComment(`
+ NumCompactTags is the number of common tags. The maximum tag is
+ NumCompactTags-1.`)
+ w.WriteConst("NumCompactTags", len(m))
+
+ fmt.Fprintln(w, "const (")
+ for i, t := range coreTags {
+ fmt.Fprintf(w, "%s ID = %d\n", ident(t.Tag().String()), i)
+ }
+ for i, t := range special {
+ fmt.Fprintf(w, "%s ID = %d\n", ident(t), i+len(coreTags))
+ }
+ fmt.Fprintln(w, ")")
+
+ w.WriteVar("coreTags", coreTags)
+
+ w.WriteConst("specialTagsStr", strings.Join(special, " "))
+}
+
+func ident(s string) string {
+ return strings.Replace(s, "-", "", -1) + "Index"
+}
diff --git a/vendor/golang.org/x/text/internal/language/compact/gen_parents.go b/vendor/golang.org/x/text/internal/language/compact/gen_parents.go
new file mode 100644
index 0000000..9543d58
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact/gen_parents.go
@@ -0,0 +1,54 @@
+// Copyright 2018 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
+
+import (
+ "log"
+
+ "golang.org/x/text/internal/gen"
+ "golang.org/x/text/internal/language"
+ "golang.org/x/text/internal/language/compact"
+ "golang.org/x/text/unicode/cldr"
+)
+
+func main() {
+ r := gen.OpenCLDRCoreZip()
+ defer r.Close()
+
+ d := &cldr.Decoder{}
+ data, err := d.DecodeZip(r)
+ if err != nil {
+ log.Fatalf("DecodeZip: %v", err)
+ }
+
+ w := gen.NewCodeWriter()
+ defer w.WriteGoFile("parents.go", "compact")
+
+ // Create parents table.
+ type ID uint16
+ parents := make([]ID, compact.NumCompactTags)
+ for _, loc := range data.Locales() {
+ tag := language.MustParse(loc)
+ index, ok := compact.FromTag(tag)
+ if !ok {
+ continue
+ }
+ parentIndex := compact.ID(0) // und
+ for p := tag.Parent(); p != language.Und; p = p.Parent() {
+ if x, ok := compact.FromTag(p); ok {
+ parentIndex = x
+ break
+ }
+ }
+ parents[index] = ID(parentIndex)
+ }
+
+ w.WriteComment(`
+ parents maps a compact index of a tag to the compact index of the parent of
+ this tag.`)
+ w.WriteVar("parents", parents)
+}
diff --git a/vendor/golang.org/x/text/internal/language/compact/gen_test.go b/vendor/golang.org/x/text/internal/language/compact/gen_test.go
new file mode 100644
index 0000000..3b74252
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact/gen_test.go
@@ -0,0 +1,38 @@
+// Copyright 2015 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 compact
+
+import (
+ "testing"
+
+ "golang.org/x/text/internal/language"
+)
+
+func TestParents(t *testing.T) {
+ testCases := []struct {
+ tag, parent string
+ }{
+ {"af", "und"},
+ {"en", "und"},
+ {"en-001", "en"},
+ {"en-AU", "en-001"},
+ {"en-US", "en"},
+ {"en-US-u-va-posix", "en-US"},
+ {"ca-ES-valencia", "ca-ES"},
+ }
+ for _, tc := range testCases {
+ tag, ok := LanguageID(Make(language.MustParse(tc.tag)))
+ if !ok {
+ t.Fatalf("Could not get index of flag %s", tc.tag)
+ }
+ want, ok := LanguageID(Make(language.MustParse(tc.parent)))
+ if !ok {
+ t.Fatalf("Could not get index of parent %s of tag %s", tc.parent, tc.tag)
+ }
+ if got := parents[tag]; got != want {
+ t.Errorf("Parent[%s] = %d; want %d (%s)", tc.tag, got, want, tc.parent)
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/language/compact/language.go b/vendor/golang.org/x/text/internal/language/compact/language.go
new file mode 100644
index 0000000..83816a7
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact/language.go
@@ -0,0 +1,260 @@
+// Copyright 2013 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_index.go -output tables.go
+//go:generate go run gen_parents.go
+
+package compact
+
+// TODO: Remove above NOTE after:
+// - verifying that tables are dropped correctly (most notably matcher tables).
+
+import (
+ "strings"
+
+ "golang.org/x/text/internal/language"
+)
+
+// Tag represents a BCP 47 language tag. It is used to specify an instance of a
+// specific language or locale. All language tag values are guaranteed to be
+// well-formed.
+type Tag struct {
+ // NOTE: exported tags will become part of the public API.
+ language ID
+ locale ID
+ full fullTag // always a language.Tag for now.
+}
+
+const _und = 0
+
+type fullTag interface {
+ IsRoot() bool
+ Parent() language.Tag
+}
+
+// Make a compact Tag from a fully specified internal language Tag.
+func Make(t language.Tag) (tag Tag) {
+ if region := t.TypeForKey("rg"); len(region) == 6 && region[2:] == "zzzz" {
+ if r, err := language.ParseRegion(region[:2]); err == nil {
+ tFull := t
+ t, _ = t.SetTypeForKey("rg", "")
+ // TODO: should we not consider "va" for the language tag?
+ var exact1, exact2 bool
+ tag.language, exact1 = FromTag(t)
+ t.RegionID = r
+ tag.locale, exact2 = FromTag(t)
+ if !exact1 || !exact2 {
+ tag.full = tFull
+ }
+ return tag
+ }
+ }
+ lang, ok := FromTag(t)
+ tag.language = lang
+ tag.locale = lang
+ if !ok {
+ tag.full = t
+ }
+ return tag
+}
+
+// Tag returns an internal language Tag version of this tag.
+func (t Tag) Tag() language.Tag {
+ if t.full != nil {
+ return t.full.(language.Tag)
+ }
+ tag := t.language.Tag()
+ if t.language != t.locale {
+ loc := t.locale.Tag()
+ tag, _ = tag.SetTypeForKey("rg", strings.ToLower(loc.RegionID.String())+"zzzz")
+ }
+ return tag
+}
+
+// IsCompact reports whether this tag is fully defined in terms of ID.
+func (t *Tag) IsCompact() bool {
+ return t.full == nil
+}
+
+// MayHaveVariants reports whether a tag may have variants. If it returns false
+// it is guaranteed the tag does not have variants.
+func (t Tag) MayHaveVariants() bool {
+ return t.full != nil || int(t.language) >= len(coreTags)
+}
+
+// MayHaveExtensions reports whether a tag may have extensions. If it returns
+// false it is guaranteed the tag does not have them.
+func (t Tag) MayHaveExtensions() bool {
+ return t.full != nil ||
+ int(t.language) >= len(coreTags) ||
+ t.language != t.locale
+}
+
+// IsRoot returns true if t is equal to language "und".
+func (t Tag) IsRoot() bool {
+ if t.full != nil {
+ return t.full.IsRoot()
+ }
+ return t.language == _und
+}
+
+// Parent returns the CLDR parent of t. In CLDR, missing fields in data for a
+// specific language are substituted with fields from the parent language.
+// The parent for a language may change for newer versions of CLDR.
+func (t Tag) Parent() Tag {
+ if t.full != nil {
+ return Make(t.full.Parent())
+ }
+ if t.language != t.locale {
+ // Simulate stripping -u-rg-xxxxxx
+ return Tag{language: t.language, locale: t.language}
+ }
+ // TODO: use parent lookup table once cycle from internal package is
+ // removed. Probably by internalizing the table and declaring this fast
+ // enough.
+ // lang := compactID(internal.Parent(uint16(t.language)))
+ lang, _ := FromTag(t.language.Tag().Parent())
+ return Tag{language: lang, locale: lang}
+}
+
+// returns token t and the rest of the string.
+func nextToken(s string) (t, tail string) {
+ p := strings.Index(s[1:], "-")
+ if p == -1 {
+ return s[1:], ""
+ }
+ p++
+ return s[1:p], s[p:]
+}
+
+// LanguageID returns an index, where 0 <= index < NumCompactTags, for tags
+// for which data exists in the text repository.The index will change over time
+// and should not be stored in persistent storage. If t does not match a compact
+// index, exact will be false and the compact index will be returned for the
+// first match after repeatedly taking the Parent of t.
+func LanguageID(t Tag) (id ID, exact bool) {
+ return t.language, t.full == nil
+}
+
+// RegionalID returns the ID for the regional variant of this tag. This index is
+// used to indicate region-specific overrides, such as default currency, default
+// calendar and week data, default time cycle, and default measurement system
+// and unit preferences.
+//
+// For instance, the tag en-GB-u-rg-uszzzz specifies British English with US
+// settings for currency, number formatting, etc. The CompactIndex for this tag
+// will be that for en-GB, while the RegionalID will be the one corresponding to
+// en-US.
+func RegionalID(t Tag) (id ID, exact bool) {
+ return t.locale, t.full == nil
+}
+
+// LanguageTag returns t stripped of regional variant indicators.
+//
+// At the moment this means it is stripped of a regional and variant subtag "rg"
+// and "va" in the "u" extension.
+func (t Tag) LanguageTag() Tag {
+ if t.full == nil {
+ return Tag{language: t.language, locale: t.language}
+ }
+ tt := t.Tag()
+ tt.SetTypeForKey("rg", "")
+ tt.SetTypeForKey("va", "")
+ return Make(tt)
+}
+
+// RegionalTag returns the regional variant of the tag.
+//
+// At the moment this means that the region is set from the regional subtag
+// "rg" in the "u" extension.
+func (t Tag) RegionalTag() Tag {
+ rt := Tag{language: t.locale, locale: t.locale}
+ if t.full == nil {
+ return rt
+ }
+ b := language.Builder{}
+ tag := t.Tag()
+ // tag, _ = tag.SetTypeForKey("rg", "")
+ b.SetTag(t.locale.Tag())
+ if v := tag.Variants(); v != "" {
+ for _, v := range strings.Split(v, "-") {
+ b.AddVariant(v)
+ }
+ }
+ for _, e := range tag.Extensions() {
+ b.AddExt(e)
+ }
+ return t
+}
+
+// FromTag reports closest matching ID for an internal language Tag.
+func FromTag(t language.Tag) (id ID, exact bool) {
+ // TODO: perhaps give more frequent tags a lower index.
+ // TODO: we could make the indexes stable. This will excluded some
+ // possibilities for optimization, so don't do this quite yet.
+ exact = true
+
+ b, s, r := t.Raw()
+ if t.HasString() {
+ if t.IsPrivateUse() {
+ // We have no entries for user-defined tags.
+ return 0, false
+ }
+ hasExtra := false
+ if t.HasVariants() {
+ if t.HasExtensions() {
+ build := language.Builder{}
+ build.SetTag(language.Tag{LangID: b, ScriptID: s, RegionID: r})
+ build.AddVariant(t.Variants())
+ exact = false
+ t = build.Make()
+ }
+ hasExtra = true
+ } else if _, ok := t.Extension('u'); ok {
+ // TODO: va may mean something else. Consider not considering it.
+ // Strip all but the 'va' entry.
+ old := t
+ variant := t.TypeForKey("va")
+ t = language.Tag{LangID: b, ScriptID: s, RegionID: r}
+ if variant != "" {
+ t, _ = t.SetTypeForKey("va", variant)
+ hasExtra = true
+ }
+ exact = old == t
+ } else {
+ exact = false
+ }
+ if hasExtra {
+ // We have some variants.
+ for i, s := range specialTags {
+ if s == t {
+ return ID(i + len(coreTags)), exact
+ }
+ }
+ exact = false
+ }
+ }
+ if x, ok := getCoreIndex(t); ok {
+ return x, exact
+ }
+ exact = false
+ if r != 0 && s == 0 {
+ // Deal with cases where an extra script is inserted for the region.
+ t, _ := t.Maximize()
+ if x, ok := getCoreIndex(t); ok {
+ return x, exact
+ }
+ }
+ for t = t.Parent(); t != root; t = t.Parent() {
+ // No variants specified: just compare core components.
+ // The key has the form lllssrrr, where l, s, and r are nibbles for
+ // respectively the langID, scriptID, and regionID.
+ if x, ok := getCoreIndex(t); ok {
+ return x, exact
+ }
+ }
+ return 0, exact
+}
+
+var root = language.Tag{}
diff --git a/vendor/golang.org/x/text/internal/language/compact/language_test.go b/vendor/golang.org/x/text/internal/language/compact/language_test.go
new file mode 100644
index 0000000..57fd13f
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact/language_test.go
@@ -0,0 +1,236 @@
+// Copyright 2013 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 compact
+
+import (
+ "reflect"
+ "testing"
+
+ "golang.org/x/text/internal/language"
+)
+
+func mustParse(s string) Tag {
+ t, err := language.Parse(s)
+ if err != nil {
+ panic(err)
+ }
+ return Make(t)
+}
+
+func TestTagSize(t *testing.T) {
+ id := Tag{}
+ typ := reflect.TypeOf(id)
+ if typ.Size() > 24 {
+ t.Errorf("size of Tag was %d; want 24", typ.Size())
+ }
+}
+
+func TestNoPublic(t *testing.T) {
+ noExportedField(t, reflect.TypeOf(Tag{}))
+}
+
+func noExportedField(t *testing.T, typ reflect.Type) {
+ for i := 0; i < typ.NumField(); i++ {
+ f := typ.Field(i)
+ if f.PkgPath == "" {
+ t.Errorf("Tag may not have exported fields, but has field %q", f.Name)
+ }
+ if f.Anonymous {
+ noExportedField(t, f.Type)
+ }
+ }
+}
+
+func TestEquality(t *testing.T) {
+ for i, tt := range parseTests() {
+ s := tt.in
+ tag := mk(s)
+ t1 := mustParse(tag.Tag().String())
+ if tag != t1 {
+ t.Errorf("%d:%s: equality test 1 failed\n got: %#v\nwant: %#v)", i, s, t1, tag)
+ }
+ }
+}
+
+type compactTest struct {
+ tag string
+ index ID
+ ok bool
+}
+
+var compactTests = []compactTest{
+ // TODO: these values will change with each CLDR update. This issue
+ // will be solved if we decide to fix the indexes.
+ {"und", undIndex, true},
+ {"ca-ES-valencia", caESvalenciaIndex, true},
+ {"ca-ES-valencia-u-va-posix", caESvalenciaIndex, false},
+ {"ca-ES-valencia-u-co-phonebk", caESvalenciaIndex, false},
+ {"ca-ES-valencia-u-co-phonebk-va-posix", caESvalenciaIndex, false},
+ {"x-klingon", 0, false},
+ {"en-US", enUSIndex, true},
+ {"en-US-u-va-posix", enUSuvaposixIndex, true},
+ {"en", enIndex, true},
+ {"en-u-co-phonebk", enIndex, false},
+ {"en-001", en001Index, true},
+ {"zh-Hant-HK", zhHantHKIndex, true},
+ {"zh-HK", zhHantHKIndex, false}, // maximized to zh-Hant-HK
+ {"nl-Beng", 0, false}, // parent skips script
+ {"nl-NO", nlIndex, false}, // region is ignored
+ {"nl-Latn-NO", nlIndex, false},
+ {"nl-Latn-NO-u-co-phonebk", nlIndex, false},
+ {"nl-Latn-NO-valencia", nlIndex, false},
+ {"nl-Latn-NO-oxendict", nlIndex, false},
+ {"sh", shIndex, true}, // From plural rules.
+}
+
+func TestLanguageID(t *testing.T) {
+ tests := append(compactTests, []compactTest{
+ {"en-GB", enGBIndex, true},
+ {"en-GB-u-rg-uszzzz", enGBIndex, true},
+ {"en-GB-u-rg-USZZZZ", enGBIndex, true},
+ {"en-GB-u-rg-uszzzz-va-posix", enGBIndex, false},
+ {"en-GB-u-co-phonebk-rg-uszzzz", enGBIndex, false},
+ // Invalid region specifications are ignored.
+ {"en-GB-u-rg-usz-va-posix", enGBIndex, false},
+ {"en-GB-u-co-phonebk-rg-usz", enGBIndex, false},
+ }...)
+ for _, tt := range tests {
+ x, ok := LanguageID(mustParse(tt.tag))
+ if ID(x) != tt.index || ok != tt.ok {
+ t.Errorf("%s: got %d, %v; want %d %v", tt.tag, x, ok, tt.index, tt.ok)
+ }
+ }
+}
+
+func TestRegionalID(t *testing.T) {
+ tests := append(compactTests, []compactTest{
+ {"en-GB", enGBIndex, true},
+ {"en-GB-u-rg-uszzzz", enUSIndex, true},
+ {"en-GB-u-rg-USZZZZ", enUSIndex, true},
+ // TODO: use different exact values for language and regional tag?
+ {"en-GB-u-rg-uszzzz-va-posix", enUSuvaposixIndex, false},
+ {"en-GB-u-co-phonebk-rg-uszzzz-va-posix", enUSuvaposixIndex, false},
+ {"en-GB-u-co-phonebk-rg-uszzzz", enUSIndex, false},
+ // Invalid region specifications are ignored.
+ {"en-GB-u-rg-usz-va-posix", enGBIndex, false},
+ {"en-GB-u-co-phonebk-rg-usz", enGBIndex, false},
+ }...)
+ for _, tt := range tests {
+ x, ok := RegionalID(mustParse(tt.tag))
+ if ID(x) != tt.index || ok != tt.ok {
+ t.Errorf("%s: got %d, %v; want %d %v", tt.tag, x, ok, tt.index, tt.ok)
+ }
+ }
+}
+
+func TestParent(t *testing.T) {
+ tests := []struct{ in, out string }{
+ // Strip variants and extensions first
+ {"de-u-co-phonebk", "de"},
+ {"de-1994", "de"},
+ {"de-Latn-1994", "de"}, // remove superfluous script.
+
+ // Ensure the canonical Tag for an entry is in the chain for base-script
+ // pairs.
+ {"zh-Hans", "zh"},
+
+ // Skip the script if it is the maximized version. CLDR files for the
+ // skipped tag are always empty.
+ {"zh-Hans-TW", "zh"},
+ {"zh-Hans-CN", "zh"},
+
+ // Insert the script if the maximized script is not the same as the
+ // maximized script of the base language.
+ {"zh-TW", "zh-Hant"},
+ {"zh-HK", "zh-Hant"},
+ {"zh-Hant-TW", "zh-Hant"},
+ {"zh-Hant-HK", "zh-Hant"},
+
+ // Non-default script skips to und.
+ // CLDR
+ {"az-Cyrl", "und"},
+ {"bs-Cyrl", "und"},
+ {"en-Dsrt", "und"},
+ {"ha-Arab", "und"},
+ {"mn-Mong", "und"},
+ {"pa-Arab", "und"},
+ {"shi-Latn", "und"},
+ {"sr-Latn", "und"},
+ {"uz-Arab", "und"},
+ {"uz-Cyrl", "und"},
+ {"vai-Latn", "und"},
+ {"zh-Hant", "und"},
+ // extra
+ {"nl-Cyrl", "und"},
+
+ // World english inherits from en-001.
+ {"en-150", "en-001"},
+ {"en-AU", "en-001"},
+ {"en-BE", "en-001"},
+ {"en-GG", "en-001"},
+ {"en-GI", "en-001"},
+ {"en-HK", "en-001"},
+ {"en-IE", "en-001"},
+ {"en-IM", "en-001"},
+ {"en-IN", "en-001"},
+ {"en-JE", "en-001"},
+ {"en-MT", "en-001"},
+ {"en-NZ", "en-001"},
+ {"en-PK", "en-001"},
+ {"en-SG", "en-001"},
+
+ // Spanish in Latin-American countries have es-419 as parent.
+ {"es-AR", "es-419"},
+ {"es-BO", "es-419"},
+ {"es-CL", "es-419"},
+ {"es-CO", "es-419"},
+ {"es-CR", "es-419"},
+ {"es-CU", "es-419"},
+ {"es-DO", "es-419"},
+ {"es-EC", "es-419"},
+ {"es-GT", "es-419"},
+ {"es-HN", "es-419"},
+ {"es-MX", "es-419"},
+ {"es-NI", "es-419"},
+ {"es-PA", "es-419"},
+ {"es-PE", "es-419"},
+ {"es-PR", "es-419"},
+ {"es-PY", "es-419"},
+ {"es-SV", "es-419"},
+ {"es-US", "es-419"},
+ {"es-UY", "es-419"},
+ {"es-VE", "es-419"},
+ // exceptions (according to CLDR)
+ {"es-CW", "es"},
+
+ // Inherit from pt-PT, instead of pt for these countries.
+ {"pt-AO", "pt-PT"},
+ {"pt-CV", "pt-PT"},
+ {"pt-GW", "pt-PT"},
+ {"pt-MO", "pt-PT"},
+ {"pt-MZ", "pt-PT"},
+ {"pt-ST", "pt-PT"},
+ {"pt-TL", "pt-PT"},
+
+ {"en-GB-u-co-phonebk-rg-uszzzz", "en-GB"},
+ {"en-GB-u-rg-uszzzz", "en-GB"},
+ {"en-US-u-va-posix", "en-US"},
+
+ // Difference between language and regional tag.
+ {"ca-ES-valencia", "ca-ES"},
+ {"ca-ES-valencia-u-rg-ptzzzz", "ca-ES"}, // t.full != nil
+ {"en-US-u-va-variant", "en-US"},
+ {"en-u-va-variant", "en"}, // t.full != nil
+ {"en-u-rg-gbzzzz", "en"},
+ {"en-US-u-rg-gbzzzz", "en-US"},
+ {"nl-US-u-rg-gbzzzz", "nl-US"}, // t.full != nil
+ }
+ for _, tt := range tests {
+ tag := mustParse(tt.in)
+ if p := mustParse(tt.out); p != tag.Parent() {
+ t.Errorf("%s: was %v; want %v", tt.in, tag.Parent(), p)
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/language/compact/parents.go b/vendor/golang.org/x/text/internal/language/compact/parents.go
new file mode 100644
index 0000000..8d81072
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact/parents.go
@@ -0,0 +1,120 @@
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+package compact
+
+// parents maps a compact index of a tag to the compact index of the parent of
+// this tag.
+var parents = []ID{ // 775 elements
+ // Entry 0 - 3F
+ 0x0000, 0x0000, 0x0001, 0x0001, 0x0000, 0x0004, 0x0000, 0x0006,
+ 0x0000, 0x0008, 0x0000, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a,
+ 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a,
+ 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a,
+ 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x0000,
+ 0x0000, 0x0028, 0x0000, 0x002a, 0x0000, 0x002c, 0x0000, 0x0000,
+ 0x002f, 0x002e, 0x002e, 0x0000, 0x0033, 0x0000, 0x0035, 0x0000,
+ 0x0037, 0x0000, 0x0039, 0x0000, 0x003b, 0x0000, 0x0000, 0x003e,
+ // Entry 40 - 7F
+ 0x0000, 0x0040, 0x0040, 0x0000, 0x0043, 0x0043, 0x0000, 0x0046,
+ 0x0000, 0x0048, 0x0000, 0x0000, 0x004b, 0x004a, 0x004a, 0x0000,
+ 0x004f, 0x004f, 0x004f, 0x004f, 0x0000, 0x0054, 0x0054, 0x0000,
+ 0x0057, 0x0000, 0x0059, 0x0000, 0x005b, 0x0000, 0x005d, 0x005d,
+ 0x0000, 0x0060, 0x0000, 0x0062, 0x0000, 0x0064, 0x0000, 0x0066,
+ 0x0066, 0x0000, 0x0069, 0x0000, 0x006b, 0x006b, 0x006b, 0x006b,
+ 0x006b, 0x006b, 0x006b, 0x0000, 0x0073, 0x0000, 0x0075, 0x0000,
+ 0x0077, 0x0000, 0x0000, 0x007a, 0x0000, 0x007c, 0x0000, 0x007e,
+ // Entry 80 - BF
+ 0x0000, 0x0080, 0x0080, 0x0000, 0x0083, 0x0083, 0x0000, 0x0086,
+ 0x0087, 0x0087, 0x0087, 0x0086, 0x0088, 0x0087, 0x0087, 0x0087,
+ 0x0086, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0088,
+ 0x0087, 0x0087, 0x0087, 0x0087, 0x0088, 0x0087, 0x0088, 0x0087,
+ 0x0087, 0x0088, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087,
+ 0x0087, 0x0087, 0x0087, 0x0086, 0x0087, 0x0087, 0x0087, 0x0087,
+ 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087,
+ 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0086, 0x0087, 0x0086,
+ // Entry C0 - FF
+ 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087,
+ 0x0088, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087,
+ 0x0086, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0088, 0x0087,
+ 0x0087, 0x0088, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087,
+ 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0086, 0x0086, 0x0087,
+ 0x0087, 0x0086, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0000,
+ 0x00ef, 0x0000, 0x00f1, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f2,
+ 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f1, 0x00f2, 0x00f1, 0x00f1,
+ // Entry 100 - 13F
+ 0x00f2, 0x00f2, 0x00f1, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f1,
+ 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x0000, 0x010e,
+ 0x0000, 0x0110, 0x0000, 0x0112, 0x0000, 0x0114, 0x0114, 0x0000,
+ 0x0117, 0x0117, 0x0117, 0x0117, 0x0000, 0x011c, 0x0000, 0x011e,
+ 0x0000, 0x0120, 0x0120, 0x0000, 0x0123, 0x0123, 0x0123, 0x0123,
+ 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123,
+ 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123,
+ 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123,
+ // Entry 140 - 17F
+ 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123,
+ 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123,
+ 0x0123, 0x0123, 0x0000, 0x0152, 0x0000, 0x0154, 0x0000, 0x0156,
+ 0x0000, 0x0158, 0x0000, 0x015a, 0x0000, 0x015c, 0x015c, 0x015c,
+ 0x0000, 0x0160, 0x0000, 0x0000, 0x0163, 0x0000, 0x0165, 0x0000,
+ 0x0167, 0x0167, 0x0167, 0x0000, 0x016b, 0x0000, 0x016d, 0x0000,
+ 0x016f, 0x0000, 0x0171, 0x0171, 0x0000, 0x0174, 0x0000, 0x0176,
+ 0x0000, 0x0178, 0x0000, 0x017a, 0x0000, 0x017c, 0x0000, 0x017e,
+ // Entry 180 - 1BF
+ 0x0000, 0x0000, 0x0000, 0x0182, 0x0000, 0x0184, 0x0184, 0x0184,
+ 0x0184, 0x0000, 0x0000, 0x0000, 0x018b, 0x0000, 0x0000, 0x018e,
+ 0x0000, 0x0000, 0x0191, 0x0000, 0x0000, 0x0000, 0x0195, 0x0000,
+ 0x0197, 0x0000, 0x0000, 0x019a, 0x0000, 0x0000, 0x019d, 0x0000,
+ 0x019f, 0x0000, 0x01a1, 0x0000, 0x01a3, 0x0000, 0x01a5, 0x0000,
+ 0x01a7, 0x0000, 0x01a9, 0x0000, 0x01ab, 0x0000, 0x01ad, 0x0000,
+ 0x01af, 0x0000, 0x01b1, 0x01b1, 0x0000, 0x01b4, 0x0000, 0x01b6,
+ 0x0000, 0x01b8, 0x0000, 0x01ba, 0x0000, 0x01bc, 0x0000, 0x0000,
+ // Entry 1C0 - 1FF
+ 0x01bf, 0x0000, 0x01c1, 0x0000, 0x01c3, 0x0000, 0x01c5, 0x0000,
+ 0x01c7, 0x0000, 0x01c9, 0x0000, 0x01cb, 0x01cb, 0x01cb, 0x01cb,
+ 0x0000, 0x01d0, 0x0000, 0x01d2, 0x01d2, 0x0000, 0x01d5, 0x0000,
+ 0x01d7, 0x0000, 0x01d9, 0x0000, 0x01db, 0x0000, 0x01dd, 0x0000,
+ 0x01df, 0x01df, 0x0000, 0x01e2, 0x0000, 0x01e4, 0x0000, 0x01e6,
+ 0x0000, 0x01e8, 0x0000, 0x01ea, 0x0000, 0x01ec, 0x0000, 0x01ee,
+ 0x0000, 0x01f0, 0x0000, 0x0000, 0x01f3, 0x0000, 0x01f5, 0x01f5,
+ 0x01f5, 0x0000, 0x01f9, 0x0000, 0x01fb, 0x0000, 0x01fd, 0x0000,
+ // Entry 200 - 23F
+ 0x01ff, 0x0000, 0x0000, 0x0202, 0x0000, 0x0204, 0x0204, 0x0000,
+ 0x0207, 0x0000, 0x0209, 0x0209, 0x0000, 0x020c, 0x020c, 0x0000,
+ 0x020f, 0x020f, 0x020f, 0x020f, 0x020f, 0x020f, 0x020f, 0x0000,
+ 0x0217, 0x0000, 0x0219, 0x0000, 0x021b, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0221, 0x0000, 0x0000, 0x0224, 0x0000, 0x0226,
+ 0x0226, 0x0000, 0x0229, 0x0000, 0x022b, 0x022b, 0x0000, 0x0000,
+ 0x022f, 0x022e, 0x022e, 0x0000, 0x0000, 0x0234, 0x0000, 0x0236,
+ 0x0000, 0x0238, 0x0000, 0x0244, 0x023a, 0x0244, 0x0244, 0x0244,
+ // Entry 240 - 27F
+ 0x0244, 0x0244, 0x0244, 0x0244, 0x023a, 0x0244, 0x0244, 0x0000,
+ 0x0247, 0x0247, 0x0247, 0x0000, 0x024b, 0x0000, 0x024d, 0x0000,
+ 0x024f, 0x024f, 0x0000, 0x0252, 0x0000, 0x0254, 0x0254, 0x0254,
+ 0x0254, 0x0254, 0x0254, 0x0000, 0x025b, 0x0000, 0x025d, 0x0000,
+ 0x025f, 0x0000, 0x0261, 0x0000, 0x0263, 0x0000, 0x0265, 0x0000,
+ 0x0000, 0x0268, 0x0268, 0x0268, 0x0000, 0x026c, 0x0000, 0x026e,
+ 0x0000, 0x0270, 0x0000, 0x0000, 0x0000, 0x0274, 0x0273, 0x0273,
+ 0x0000, 0x0278, 0x0000, 0x027a, 0x0000, 0x027c, 0x0000, 0x0000,
+ // Entry 280 - 2BF
+ 0x0000, 0x0000, 0x0281, 0x0000, 0x0000, 0x0284, 0x0000, 0x0286,
+ 0x0286, 0x0286, 0x0286, 0x0000, 0x028b, 0x028b, 0x028b, 0x0000,
+ 0x028f, 0x028f, 0x028f, 0x028f, 0x028f, 0x0000, 0x0295, 0x0295,
+ 0x0295, 0x0295, 0x0000, 0x0000, 0x0000, 0x0000, 0x029d, 0x029d,
+ 0x029d, 0x0000, 0x02a1, 0x02a1, 0x02a1, 0x02a1, 0x0000, 0x0000,
+ 0x02a7, 0x02a7, 0x02a7, 0x02a7, 0x0000, 0x02ac, 0x0000, 0x02ae,
+ 0x02ae, 0x0000, 0x02b1, 0x0000, 0x02b3, 0x0000, 0x02b5, 0x02b5,
+ 0x0000, 0x0000, 0x02b9, 0x0000, 0x0000, 0x0000, 0x02bd, 0x0000,
+ // Entry 2C0 - 2FF
+ 0x02bf, 0x02bf, 0x0000, 0x0000, 0x02c3, 0x0000, 0x02c5, 0x0000,
+ 0x02c7, 0x0000, 0x02c9, 0x0000, 0x02cb, 0x0000, 0x02cd, 0x02cd,
+ 0x0000, 0x0000, 0x02d1, 0x0000, 0x02d3, 0x02d0, 0x02d0, 0x0000,
+ 0x0000, 0x02d8, 0x02d7, 0x02d7, 0x0000, 0x0000, 0x02dd, 0x0000,
+ 0x02df, 0x0000, 0x02e1, 0x0000, 0x0000, 0x02e4, 0x0000, 0x02e6,
+ 0x0000, 0x0000, 0x02e9, 0x0000, 0x02eb, 0x0000, 0x02ed, 0x0000,
+ 0x02ef, 0x02ef, 0x0000, 0x0000, 0x02f3, 0x02f2, 0x02f2, 0x0000,
+ 0x02f7, 0x0000, 0x02f9, 0x02f9, 0x02f9, 0x02f9, 0x02f9, 0x0000,
+ // Entry 300 - 33F
+ 0x02ff, 0x0300, 0x02ff, 0x0000, 0x0303, 0x0051, 0x00e6,
+} // Size: 1574 bytes
+
+// Total table size 1574 bytes (1KiB); checksum: 895AAF0B
diff --git a/vendor/golang.org/x/text/internal/language/compact/parse_test.go b/vendor/golang.org/x/text/internal/language/compact/parse_test.go
new file mode 100644
index 0000000..abe3a58
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact/parse_test.go
@@ -0,0 +1,196 @@
+// Copyright 2013 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 compact
+
+import (
+ "strings"
+ "testing"
+
+ "golang.org/x/text/internal/language"
+)
+
+var errSyntax = language.ErrSyntax
+
+type parseTest struct {
+ i int // the index of this test
+ in string
+ lang, script, region string
+ variants, ext string
+ extList []string // only used when more than one extension is present
+ invalid bool
+ rewrite bool // special rewrite not handled by parseTag
+ changed bool // string needed to be reformatted
+}
+
+func parseTests() []parseTest {
+ tests := []parseTest{
+ {in: "root", lang: "und"},
+ {in: "und", lang: "und"},
+ {in: "en", lang: "en"},
+
+ {in: "en-US-u-va-posix", lang: "en", region: "US", ext: "u-va-posix"},
+ {in: "ca-ES-valencia", lang: "ca", region: "ES", variants: "valencia"},
+ {in: "en-US-u-rg-gbzzzz", lang: "en", region: "US", ext: "u-rg-gbzzzz"},
+
+ {in: "xy", lang: "und", invalid: true},
+ {in: "en-ZY", lang: "en", invalid: true},
+ {in: "gsw", lang: "gsw"},
+ {in: "sr_Latn", lang: "sr", script: "Latn"},
+ {in: "af-Arab", lang: "af", script: "Arab"},
+ {in: "nl-BE", lang: "nl", region: "BE"},
+ {in: "es-419", lang: "es", region: "419"},
+ {in: "und-001", lang: "und", region: "001"},
+ {in: "de-latn-be", lang: "de", script: "Latn", region: "BE"},
+ // Variants
+ {in: "de-1901", lang: "de", variants: "1901"},
+ // Accept with unsuppressed script.
+ {in: "de-Latn-1901", lang: "de", script: "Latn", variants: "1901"},
+ // Specialized.
+ {in: "sl-rozaj", lang: "sl", variants: "rozaj"},
+ {in: "sl-rozaj-lipaw", lang: "sl", variants: "rozaj-lipaw"},
+ {in: "sl-rozaj-biske", lang: "sl", variants: "rozaj-biske"},
+ {in: "sl-rozaj-biske-1994", lang: "sl", variants: "rozaj-biske-1994"},
+ {in: "sl-rozaj-1994", lang: "sl", variants: "rozaj-1994"},
+ // Maximum number of variants while adhering to prefix rules.
+ {in: "sl-rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp", lang: "sl", variants: "rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp"},
+
+ // Sorting.
+ {in: "sl-1994-biske-rozaj", lang: "sl", variants: "rozaj-biske-1994", changed: true},
+ {in: "sl-rozaj-biske-1994-alalc97-fonupa-fonipa-fonxsamp", lang: "sl", variants: "rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp", changed: true},
+ {in: "nl-fonxsamp-alalc97-fonipa-fonupa", lang: "nl", variants: "alalc97-fonipa-fonupa-fonxsamp", changed: true},
+
+ // Duplicates variants are removed, but not an error.
+ {in: "nl-fonupa-fonupa", lang: "nl", variants: "fonupa"},
+
+ // Variants that do not have correct prefixes. We still accept these.
+ {in: "de-Cyrl-1901", lang: "de", script: "Cyrl", variants: "1901"},
+ {in: "sl-rozaj-lipaw-1994", lang: "sl", variants: "rozaj-lipaw-1994"},
+ {in: "sl-1994-biske-rozaj-1994-biske-rozaj", lang: "sl", variants: "rozaj-biske-1994", changed: true},
+ {in: "de-Cyrl-1901", lang: "de", script: "Cyrl", variants: "1901"},
+
+ // Invalid variant.
+ {in: "de-1902", lang: "de", variants: "", invalid: true},
+
+ {in: "EN_CYRL", lang: "en", script: "Cyrl"},
+ // private use and extensions
+ {in: "x-a-b-c-d", ext: "x-a-b-c-d"},
+ {in: "x_A.-B-C_D", ext: "x-b-c-d", invalid: true, changed: true},
+ {in: "x-aa-bbbb-cccccccc-d", ext: "x-aa-bbbb-cccccccc-d"},
+ {in: "en-c_cc-b-bbb-a-aaa", lang: "en", changed: true, extList: []string{"a-aaa", "b-bbb", "c-cc"}},
+ {in: "en-x_cc-b-bbb-a-aaa", lang: "en", ext: "x-cc-b-bbb-a-aaa", changed: true},
+ {in: "en-c_cc-b-bbb-a-aaa-x-x", lang: "en", changed: true, extList: []string{"a-aaa", "b-bbb", "c-cc", "x-x"}},
+ {in: "en-v-c", lang: "en", ext: "", invalid: true},
+ {in: "en-v-abcdefghi", lang: "en", ext: "", invalid: true},
+ {in: "en-v-abc-x", lang: "en", ext: "v-abc", invalid: true},
+ {in: "en-v-abc-x-", lang: "en", ext: "v-abc", invalid: true},
+ {in: "en-v-abc-w-x-xx", lang: "en", extList: []string{"v-abc", "x-xx"}, invalid: true, changed: true},
+ {in: "en-v-abc-w-y-yx", lang: "en", extList: []string{"v-abc", "y-yx"}, invalid: true, changed: true},
+ {in: "en-v-c-abc", lang: "en", ext: "c-abc", invalid: true, changed: true},
+ {in: "en-v-w-abc", lang: "en", ext: "w-abc", invalid: true, changed: true},
+ {in: "en-v-x-abc", lang: "en", ext: "x-abc", invalid: true, changed: true},
+ {in: "en-v-x-a", lang: "en", ext: "x-a", invalid: true, changed: true},
+ {in: "en-9-aa-0-aa-z-bb-x-a", lang: "en", extList: []string{"0-aa", "9-aa", "z-bb", "x-a"}, changed: true},
+ {in: "en-u-c", lang: "en", ext: "", invalid: true},
+ {in: "en-u-co-phonebk", lang: "en", ext: "u-co-phonebk"},
+ {in: "en-u-co-phonebk-ca", lang: "en", ext: "u-co-phonebk", invalid: true},
+ {in: "en-u-nu-arabic-co-phonebk-ca", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
+ {in: "en-u-nu-arabic-co-phonebk-ca-x", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
+ {in: "en-u-nu-arabic-co-phonebk-ca-s", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
+ {in: "en-u-nu-arabic-co-phonebk-ca-a12345678", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
+ {in: "en-u-co-phonebook", lang: "en", ext: "", invalid: true},
+ {in: "en-u-co-phonebook-cu-xau", lang: "en", ext: "u-cu-xau", invalid: true, changed: true},
+ {in: "en-Cyrl-u-co-phonebk", lang: "en", script: "Cyrl", ext: "u-co-phonebk"},
+ {in: "en-US-u-co-phonebk", lang: "en", region: "US", ext: "u-co-phonebk"},
+ {in: "en-US-u-co-phonebk-cu-xau", lang: "en", region: "US", ext: "u-co-phonebk-cu-xau"},
+ {in: "en-scotland-u-co-phonebk", lang: "en", variants: "scotland", ext: "u-co-phonebk"},
+ {in: "en-u-cu-xua-co-phonebk", lang: "en", ext: "u-co-phonebk-cu-xua", changed: true},
+ {in: "en-u-def-abc-cu-xua-co-phonebk", lang: "en", ext: "u-abc-def-co-phonebk-cu-xua", changed: true},
+ {in: "en-u-def-abc", lang: "en", ext: "u-abc-def", changed: true},
+ {in: "en-u-cu-xua-co-phonebk-a-cd", lang: "en", extList: []string{"a-cd", "u-co-phonebk-cu-xua"}, changed: true},
+ // Invalid "u" extension. Drop invalid parts.
+ {in: "en-u-cu-co-phonebk", lang: "en", extList: []string{"u-co-phonebk"}, invalid: true, changed: true},
+ {in: "en-u-cu-xau-co", lang: "en", extList: []string{"u-cu-xau"}, invalid: true},
+ // We allow duplicate keys as the LDML spec does not explicitly prohibit it.
+ // TODO: Consider eliminating duplicates and returning an error.
+ {in: "en-u-cu-xau-co-phonebk-cu-xau", lang: "en", ext: "u-co-phonebk-cu-xau", changed: true},
+ {in: "en-t-en-Cyrl-NL-fonipa", lang: "en", ext: "t-en-cyrl-nl-fonipa", changed: true},
+ {in: "en-t-en-Cyrl-NL-fonipa-t0-abc-def", lang: "en", ext: "t-en-cyrl-nl-fonipa-t0-abc-def", changed: true},
+ {in: "en-t-t0-abcd", lang: "en", ext: "t-t0-abcd"},
+ // Not necessary to have changed here.
+ {in: "en-t-nl-abcd", lang: "en", ext: "t-nl", invalid: true},
+ {in: "en-t-nl-latn", lang: "en", ext: "t-nl-latn"},
+ {in: "en-t-t0-abcd-x-a", lang: "en", extList: []string{"t-t0-abcd", "x-a"}},
+ // invalid
+ {in: "", lang: "und", invalid: true},
+ {in: "-", lang: "und", invalid: true},
+ {in: "x", lang: "und", invalid: true},
+ {in: "x-", lang: "und", invalid: true},
+ {in: "x--", lang: "und", invalid: true},
+ {in: "a-a-b-c-d", lang: "und", invalid: true},
+ {in: "en-", lang: "en", invalid: true},
+ {in: "enne-", lang: "und", invalid: true},
+ {in: "en.", lang: "und", invalid: true},
+ {in: "en.-latn", lang: "und", invalid: true},
+ {in: "en.-en", lang: "en", invalid: true},
+ {in: "x-a-tooManyChars-c-d", ext: "x-a-c-d", invalid: true, changed: true},
+ {in: "a-tooManyChars-c-d", lang: "und", invalid: true},
+ // TODO: check key-value validity
+ // { in: "en-u-cu-xd", lang: "en", ext: "u-cu-xd", invalid: true },
+ {in: "en-t-abcd", lang: "en", invalid: true},
+ {in: "en-Latn-US-en", lang: "en", script: "Latn", region: "US", invalid: true},
+ // rewrites (more tests in TestGrandfathered)
+ {in: "zh-min-nan", lang: "nan"},
+ {in: "zh-yue", lang: "yue"},
+ {in: "zh-xiang", lang: "hsn", rewrite: true},
+ {in: "zh-guoyu", lang: "cmn", rewrite: true},
+ {in: "iw", lang: "iw"},
+ {in: "sgn-BE-FR", lang: "sfb", rewrite: true},
+ {in: "i-klingon", lang: "tlh", rewrite: true},
+ }
+ for i, tt := range tests {
+ tests[i].i = i
+ if tt.extList != nil {
+ tests[i].ext = strings.Join(tt.extList, "-")
+ }
+ if tt.ext != "" && tt.extList == nil {
+ tests[i].extList = []string{tt.ext}
+ }
+ }
+ return tests
+}
+
+// partChecks runs checks for each part by calling the function returned by f.
+func partChecks(t *testing.T, f func(*parseTest) (Tag, bool)) {
+ for i, tt := range parseTests() {
+ tag, skip := f(&tt)
+ if skip {
+ continue
+ }
+ if l, _ := language.ParseBase(tt.lang); l != tag.Tag().LangID {
+ t.Errorf("%d: lang was %q; want %q", i, tag.Tag().LangID, l)
+ }
+ if sc, _ := language.ParseScript(tt.script); sc != tag.Tag().ScriptID {
+ t.Errorf("%d: script was %q; want %q", i, tag.Tag().ScriptID, sc)
+ }
+ if r, _ := language.ParseRegion(tt.region); r != tag.Tag().RegionID {
+ t.Errorf("%d: region was %q; want %q", i, tag.Tag().RegionID, r)
+ }
+ v := tag.Tag().Variants()
+ if v != "" {
+ v = v[1:]
+ }
+ if v != tt.variants {
+ t.Errorf("%d: variants was %q; want %q", i, v, tt.variants)
+ }
+ if e := strings.Join(tag.Tag().Extensions(), "-"); e != tt.ext {
+ t.Errorf("%d: extensions were %q; want %q", i, e, tt.ext)
+ }
+ }
+}
+
+func mk(s string) Tag {
+ tag, _ := language.Parse(s)
+ return Make(tag)
+}
diff --git a/vendor/golang.org/x/text/internal/language/compact/tables.go b/vendor/golang.org/x/text/internal/language/compact/tables.go
new file mode 100644
index 0000000..554ca35
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact/tables.go
@@ -0,0 +1,1015 @@
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+package compact
+
+import "golang.org/x/text/internal/language"
+
+// CLDRVersion is the CLDR version from which the tables in this package are derived.
+const CLDRVersion = "32"
+
+// NumCompactTags is the number of common tags. The maximum tag is
+// NumCompactTags-1.
+const NumCompactTags = 775
+const (
+ undIndex ID = 0
+ afIndex ID = 1
+ afNAIndex ID = 2
+ afZAIndex ID = 3
+ agqIndex ID = 4
+ agqCMIndex ID = 5
+ akIndex ID = 6
+ akGHIndex ID = 7
+ amIndex ID = 8
+ amETIndex ID = 9
+ arIndex ID = 10
+ ar001Index ID = 11
+ arAEIndex ID = 12
+ arBHIndex ID = 13
+ arDJIndex ID = 14
+ arDZIndex ID = 15
+ arEGIndex ID = 16
+ arEHIndex ID = 17
+ arERIndex ID = 18
+ arILIndex ID = 19
+ arIQIndex ID = 20
+ arJOIndex ID = 21
+ arKMIndex ID = 22
+ arKWIndex ID = 23
+ arLBIndex ID = 24
+ arLYIndex ID = 25
+ arMAIndex ID = 26
+ arMRIndex ID = 27
+ arOMIndex ID = 28
+ arPSIndex ID = 29
+ arQAIndex ID = 30
+ arSAIndex ID = 31
+ arSDIndex ID = 32
+ arSOIndex ID = 33
+ arSSIndex ID = 34
+ arSYIndex ID = 35
+ arTDIndex ID = 36
+ arTNIndex ID = 37
+ arYEIndex ID = 38
+ arsIndex ID = 39
+ asIndex ID = 40
+ asINIndex ID = 41
+ asaIndex ID = 42
+ asaTZIndex ID = 43
+ astIndex ID = 44
+ astESIndex ID = 45
+ azIndex ID = 46
+ azCyrlIndex ID = 47
+ azCyrlAZIndex ID = 48
+ azLatnIndex ID = 49
+ azLatnAZIndex ID = 50
+ basIndex ID = 51
+ basCMIndex ID = 52
+ beIndex ID = 53
+ beBYIndex ID = 54
+ bemIndex ID = 55
+ bemZMIndex ID = 56
+ bezIndex ID = 57
+ bezTZIndex ID = 58
+ bgIndex ID = 59
+ bgBGIndex ID = 60
+ bhIndex ID = 61
+ bmIndex ID = 62
+ bmMLIndex ID = 63
+ bnIndex ID = 64
+ bnBDIndex ID = 65
+ bnINIndex ID = 66
+ boIndex ID = 67
+ boCNIndex ID = 68
+ boINIndex ID = 69
+ brIndex ID = 70
+ brFRIndex ID = 71
+ brxIndex ID = 72
+ brxINIndex ID = 73
+ bsIndex ID = 74
+ bsCyrlIndex ID = 75
+ bsCyrlBAIndex ID = 76
+ bsLatnIndex ID = 77
+ bsLatnBAIndex ID = 78
+ caIndex ID = 79
+ caADIndex ID = 80
+ caESIndex ID = 81
+ caFRIndex ID = 82
+ caITIndex ID = 83
+ ccpIndex ID = 84
+ ccpBDIndex ID = 85
+ ccpINIndex ID = 86
+ ceIndex ID = 87
+ ceRUIndex ID = 88
+ cggIndex ID = 89
+ cggUGIndex ID = 90
+ chrIndex ID = 91
+ chrUSIndex ID = 92
+ ckbIndex ID = 93
+ ckbIQIndex ID = 94
+ ckbIRIndex ID = 95
+ csIndex ID = 96
+ csCZIndex ID = 97
+ cuIndex ID = 98
+ cuRUIndex ID = 99
+ cyIndex ID = 100
+ cyGBIndex ID = 101
+ daIndex ID = 102
+ daDKIndex ID = 103
+ daGLIndex ID = 104
+ davIndex ID = 105
+ davKEIndex ID = 106
+ deIndex ID = 107
+ deATIndex ID = 108
+ deBEIndex ID = 109
+ deCHIndex ID = 110
+ deDEIndex ID = 111
+ deITIndex ID = 112
+ deLIIndex ID = 113
+ deLUIndex ID = 114
+ djeIndex ID = 115
+ djeNEIndex ID = 116
+ dsbIndex ID = 117
+ dsbDEIndex ID = 118
+ duaIndex ID = 119
+ duaCMIndex ID = 120
+ dvIndex ID = 121
+ dyoIndex ID = 122
+ dyoSNIndex ID = 123
+ dzIndex ID = 124
+ dzBTIndex ID = 125
+ ebuIndex ID = 126
+ ebuKEIndex ID = 127
+ eeIndex ID = 128
+ eeGHIndex ID = 129
+ eeTGIndex ID = 130
+ elIndex ID = 131
+ elCYIndex ID = 132
+ elGRIndex ID = 133
+ enIndex ID = 134
+ en001Index ID = 135
+ en150Index ID = 136
+ enAGIndex ID = 137
+ enAIIndex ID = 138
+ enASIndex ID = 139
+ enATIndex ID = 140
+ enAUIndex ID = 141
+ enBBIndex ID = 142
+ enBEIndex ID = 143
+ enBIIndex ID = 144
+ enBMIndex ID = 145
+ enBSIndex ID = 146
+ enBWIndex ID = 147
+ enBZIndex ID = 148
+ enCAIndex ID = 149
+ enCCIndex ID = 150
+ enCHIndex ID = 151
+ enCKIndex ID = 152
+ enCMIndex ID = 153
+ enCXIndex ID = 154
+ enCYIndex ID = 155
+ enDEIndex ID = 156
+ enDGIndex ID = 157
+ enDKIndex ID = 158
+ enDMIndex ID = 159
+ enERIndex ID = 160
+ enFIIndex ID = 161
+ enFJIndex ID = 162
+ enFKIndex ID = 163
+ enFMIndex ID = 164
+ enGBIndex ID = 165
+ enGDIndex ID = 166
+ enGGIndex ID = 167
+ enGHIndex ID = 168
+ enGIIndex ID = 169
+ enGMIndex ID = 170
+ enGUIndex ID = 171
+ enGYIndex ID = 172
+ enHKIndex ID = 173
+ enIEIndex ID = 174
+ enILIndex ID = 175
+ enIMIndex ID = 176
+ enINIndex ID = 177
+ enIOIndex ID = 178
+ enJEIndex ID = 179
+ enJMIndex ID = 180
+ enKEIndex ID = 181
+ enKIIndex ID = 182
+ enKNIndex ID = 183
+ enKYIndex ID = 184
+ enLCIndex ID = 185
+ enLRIndex ID = 186
+ enLSIndex ID = 187
+ enMGIndex ID = 188
+ enMHIndex ID = 189
+ enMOIndex ID = 190
+ enMPIndex ID = 191
+ enMSIndex ID = 192
+ enMTIndex ID = 193
+ enMUIndex ID = 194
+ enMWIndex ID = 195
+ enMYIndex ID = 196
+ enNAIndex ID = 197
+ enNFIndex ID = 198
+ enNGIndex ID = 199
+ enNLIndex ID = 200
+ enNRIndex ID = 201
+ enNUIndex ID = 202
+ enNZIndex ID = 203
+ enPGIndex ID = 204
+ enPHIndex ID = 205
+ enPKIndex ID = 206
+ enPNIndex ID = 207
+ enPRIndex ID = 208
+ enPWIndex ID = 209
+ enRWIndex ID = 210
+ enSBIndex ID = 211
+ enSCIndex ID = 212
+ enSDIndex ID = 213
+ enSEIndex ID = 214
+ enSGIndex ID = 215
+ enSHIndex ID = 216
+ enSIIndex ID = 217
+ enSLIndex ID = 218
+ enSSIndex ID = 219
+ enSXIndex ID = 220
+ enSZIndex ID = 221
+ enTCIndex ID = 222
+ enTKIndex ID = 223
+ enTOIndex ID = 224
+ enTTIndex ID = 225
+ enTVIndex ID = 226
+ enTZIndex ID = 227
+ enUGIndex ID = 228
+ enUMIndex ID = 229
+ enUSIndex ID = 230
+ enVCIndex ID = 231
+ enVGIndex ID = 232
+ enVIIndex ID = 233
+ enVUIndex ID = 234
+ enWSIndex ID = 235
+ enZAIndex ID = 236
+ enZMIndex ID = 237
+ enZWIndex ID = 238
+ eoIndex ID = 239
+ eo001Index ID = 240
+ esIndex ID = 241
+ es419Index ID = 242
+ esARIndex ID = 243
+ esBOIndex ID = 244
+ esBRIndex ID = 245
+ esBZIndex ID = 246
+ esCLIndex ID = 247
+ esCOIndex ID = 248
+ esCRIndex ID = 249
+ esCUIndex ID = 250
+ esDOIndex ID = 251
+ esEAIndex ID = 252
+ esECIndex ID = 253
+ esESIndex ID = 254
+ esGQIndex ID = 255
+ esGTIndex ID = 256
+ esHNIndex ID = 257
+ esICIndex ID = 258
+ esMXIndex ID = 259
+ esNIIndex ID = 260
+ esPAIndex ID = 261
+ esPEIndex ID = 262
+ esPHIndex ID = 263
+ esPRIndex ID = 264
+ esPYIndex ID = 265
+ esSVIndex ID = 266
+ esUSIndex ID = 267
+ esUYIndex ID = 268
+ esVEIndex ID = 269
+ etIndex ID = 270
+ etEEIndex ID = 271
+ euIndex ID = 272
+ euESIndex ID = 273
+ ewoIndex ID = 274
+ ewoCMIndex ID = 275
+ faIndex ID = 276
+ faAFIndex ID = 277
+ faIRIndex ID = 278
+ ffIndex ID = 279
+ ffCMIndex ID = 280
+ ffGNIndex ID = 281
+ ffMRIndex ID = 282
+ ffSNIndex ID = 283
+ fiIndex ID = 284
+ fiFIIndex ID = 285
+ filIndex ID = 286
+ filPHIndex ID = 287
+ foIndex ID = 288
+ foDKIndex ID = 289
+ foFOIndex ID = 290
+ frIndex ID = 291
+ frBEIndex ID = 292
+ frBFIndex ID = 293
+ frBIIndex ID = 294
+ frBJIndex ID = 295
+ frBLIndex ID = 296
+ frCAIndex ID = 297
+ frCDIndex ID = 298
+ frCFIndex ID = 299
+ frCGIndex ID = 300
+ frCHIndex ID = 301
+ frCIIndex ID = 302
+ frCMIndex ID = 303
+ frDJIndex ID = 304
+ frDZIndex ID = 305
+ frFRIndex ID = 306
+ frGAIndex ID = 307
+ frGFIndex ID = 308
+ frGNIndex ID = 309
+ frGPIndex ID = 310
+ frGQIndex ID = 311
+ frHTIndex ID = 312
+ frKMIndex ID = 313
+ frLUIndex ID = 314
+ frMAIndex ID = 315
+ frMCIndex ID = 316
+ frMFIndex ID = 317
+ frMGIndex ID = 318
+ frMLIndex ID = 319
+ frMQIndex ID = 320
+ frMRIndex ID = 321
+ frMUIndex ID = 322
+ frNCIndex ID = 323
+ frNEIndex ID = 324
+ frPFIndex ID = 325
+ frPMIndex ID = 326
+ frREIndex ID = 327
+ frRWIndex ID = 328
+ frSCIndex ID = 329
+ frSNIndex ID = 330
+ frSYIndex ID = 331
+ frTDIndex ID = 332
+ frTGIndex ID = 333
+ frTNIndex ID = 334
+ frVUIndex ID = 335
+ frWFIndex ID = 336
+ frYTIndex ID = 337
+ furIndex ID = 338
+ furITIndex ID = 339
+ fyIndex ID = 340
+ fyNLIndex ID = 341
+ gaIndex ID = 342
+ gaIEIndex ID = 343
+ gdIndex ID = 344
+ gdGBIndex ID = 345
+ glIndex ID = 346
+ glESIndex ID = 347
+ gswIndex ID = 348
+ gswCHIndex ID = 349
+ gswFRIndex ID = 350
+ gswLIIndex ID = 351
+ guIndex ID = 352
+ guINIndex ID = 353
+ guwIndex ID = 354
+ guzIndex ID = 355
+ guzKEIndex ID = 356
+ gvIndex ID = 357
+ gvIMIndex ID = 358
+ haIndex ID = 359
+ haGHIndex ID = 360
+ haNEIndex ID = 361
+ haNGIndex ID = 362
+ hawIndex ID = 363
+ hawUSIndex ID = 364
+ heIndex ID = 365
+ heILIndex ID = 366
+ hiIndex ID = 367
+ hiINIndex ID = 368
+ hrIndex ID = 369
+ hrBAIndex ID = 370
+ hrHRIndex ID = 371
+ hsbIndex ID = 372
+ hsbDEIndex ID = 373
+ huIndex ID = 374
+ huHUIndex ID = 375
+ hyIndex ID = 376
+ hyAMIndex ID = 377
+ idIndex ID = 378
+ idIDIndex ID = 379
+ igIndex ID = 380
+ igNGIndex ID = 381
+ iiIndex ID = 382
+ iiCNIndex ID = 383
+ inIndex ID = 384
+ ioIndex ID = 385
+ isIndex ID = 386
+ isISIndex ID = 387
+ itIndex ID = 388
+ itCHIndex ID = 389
+ itITIndex ID = 390
+ itSMIndex ID = 391
+ itVAIndex ID = 392
+ iuIndex ID = 393
+ iwIndex ID = 394
+ jaIndex ID = 395
+ jaJPIndex ID = 396
+ jboIndex ID = 397
+ jgoIndex ID = 398
+ jgoCMIndex ID = 399
+ jiIndex ID = 400
+ jmcIndex ID = 401
+ jmcTZIndex ID = 402
+ jvIndex ID = 403
+ jwIndex ID = 404
+ kaIndex ID = 405
+ kaGEIndex ID = 406
+ kabIndex ID = 407
+ kabDZIndex ID = 408
+ kajIndex ID = 409
+ kamIndex ID = 410
+ kamKEIndex ID = 411
+ kcgIndex ID = 412
+ kdeIndex ID = 413
+ kdeTZIndex ID = 414
+ keaIndex ID = 415
+ keaCVIndex ID = 416
+ khqIndex ID = 417
+ khqMLIndex ID = 418
+ kiIndex ID = 419
+ kiKEIndex ID = 420
+ kkIndex ID = 421
+ kkKZIndex ID = 422
+ kkjIndex ID = 423
+ kkjCMIndex ID = 424
+ klIndex ID = 425
+ klGLIndex ID = 426
+ klnIndex ID = 427
+ klnKEIndex ID = 428
+ kmIndex ID = 429
+ kmKHIndex ID = 430
+ knIndex ID = 431
+ knINIndex ID = 432
+ koIndex ID = 433
+ koKPIndex ID = 434
+ koKRIndex ID = 435
+ kokIndex ID = 436
+ kokINIndex ID = 437
+ ksIndex ID = 438
+ ksINIndex ID = 439
+ ksbIndex ID = 440
+ ksbTZIndex ID = 441
+ ksfIndex ID = 442
+ ksfCMIndex ID = 443
+ kshIndex ID = 444
+ kshDEIndex ID = 445
+ kuIndex ID = 446
+ kwIndex ID = 447
+ kwGBIndex ID = 448
+ kyIndex ID = 449
+ kyKGIndex ID = 450
+ lagIndex ID = 451
+ lagTZIndex ID = 452
+ lbIndex ID = 453
+ lbLUIndex ID = 454
+ lgIndex ID = 455
+ lgUGIndex ID = 456
+ lktIndex ID = 457
+ lktUSIndex ID = 458
+ lnIndex ID = 459
+ lnAOIndex ID = 460
+ lnCDIndex ID = 461
+ lnCFIndex ID = 462
+ lnCGIndex ID = 463
+ loIndex ID = 464
+ loLAIndex ID = 465
+ lrcIndex ID = 466
+ lrcIQIndex ID = 467
+ lrcIRIndex ID = 468
+ ltIndex ID = 469
+ ltLTIndex ID = 470
+ luIndex ID = 471
+ luCDIndex ID = 472
+ luoIndex ID = 473
+ luoKEIndex ID = 474
+ luyIndex ID = 475
+ luyKEIndex ID = 476
+ lvIndex ID = 477
+ lvLVIndex ID = 478
+ masIndex ID = 479
+ masKEIndex ID = 480
+ masTZIndex ID = 481
+ merIndex ID = 482
+ merKEIndex ID = 483
+ mfeIndex ID = 484
+ mfeMUIndex ID = 485
+ mgIndex ID = 486
+ mgMGIndex ID = 487
+ mghIndex ID = 488
+ mghMZIndex ID = 489
+ mgoIndex ID = 490
+ mgoCMIndex ID = 491
+ mkIndex ID = 492
+ mkMKIndex ID = 493
+ mlIndex ID = 494
+ mlINIndex ID = 495
+ mnIndex ID = 496
+ mnMNIndex ID = 497
+ moIndex ID = 498
+ mrIndex ID = 499
+ mrINIndex ID = 500
+ msIndex ID = 501
+ msBNIndex ID = 502
+ msMYIndex ID = 503
+ msSGIndex ID = 504
+ mtIndex ID = 505
+ mtMTIndex ID = 506
+ muaIndex ID = 507
+ muaCMIndex ID = 508
+ myIndex ID = 509
+ myMMIndex ID = 510
+ mznIndex ID = 511
+ mznIRIndex ID = 512
+ nahIndex ID = 513
+ naqIndex ID = 514
+ naqNAIndex ID = 515
+ nbIndex ID = 516
+ nbNOIndex ID = 517
+ nbSJIndex ID = 518
+ ndIndex ID = 519
+ ndZWIndex ID = 520
+ ndsIndex ID = 521
+ ndsDEIndex ID = 522
+ ndsNLIndex ID = 523
+ neIndex ID = 524
+ neINIndex ID = 525
+ neNPIndex ID = 526
+ nlIndex ID = 527
+ nlAWIndex ID = 528
+ nlBEIndex ID = 529
+ nlBQIndex ID = 530
+ nlCWIndex ID = 531
+ nlNLIndex ID = 532
+ nlSRIndex ID = 533
+ nlSXIndex ID = 534
+ nmgIndex ID = 535
+ nmgCMIndex ID = 536
+ nnIndex ID = 537
+ nnNOIndex ID = 538
+ nnhIndex ID = 539
+ nnhCMIndex ID = 540
+ noIndex ID = 541
+ nqoIndex ID = 542
+ nrIndex ID = 543
+ nsoIndex ID = 544
+ nusIndex ID = 545
+ nusSSIndex ID = 546
+ nyIndex ID = 547
+ nynIndex ID = 548
+ nynUGIndex ID = 549
+ omIndex ID = 550
+ omETIndex ID = 551
+ omKEIndex ID = 552
+ orIndex ID = 553
+ orINIndex ID = 554
+ osIndex ID = 555
+ osGEIndex ID = 556
+ osRUIndex ID = 557
+ paIndex ID = 558
+ paArabIndex ID = 559
+ paArabPKIndex ID = 560
+ paGuruIndex ID = 561
+ paGuruINIndex ID = 562
+ papIndex ID = 563
+ plIndex ID = 564
+ plPLIndex ID = 565
+ prgIndex ID = 566
+ prg001Index ID = 567
+ psIndex ID = 568
+ psAFIndex ID = 569
+ ptIndex ID = 570
+ ptAOIndex ID = 571
+ ptBRIndex ID = 572
+ ptCHIndex ID = 573
+ ptCVIndex ID = 574
+ ptGQIndex ID = 575
+ ptGWIndex ID = 576
+ ptLUIndex ID = 577
+ ptMOIndex ID = 578
+ ptMZIndex ID = 579
+ ptPTIndex ID = 580
+ ptSTIndex ID = 581
+ ptTLIndex ID = 582
+ quIndex ID = 583
+ quBOIndex ID = 584
+ quECIndex ID = 585
+ quPEIndex ID = 586
+ rmIndex ID = 587
+ rmCHIndex ID = 588
+ rnIndex ID = 589
+ rnBIIndex ID = 590
+ roIndex ID = 591
+ roMDIndex ID = 592
+ roROIndex ID = 593
+ rofIndex ID = 594
+ rofTZIndex ID = 595
+ ruIndex ID = 596
+ ruBYIndex ID = 597
+ ruKGIndex ID = 598
+ ruKZIndex ID = 599
+ ruMDIndex ID = 600
+ ruRUIndex ID = 601
+ ruUAIndex ID = 602
+ rwIndex ID = 603
+ rwRWIndex ID = 604
+ rwkIndex ID = 605
+ rwkTZIndex ID = 606
+ sahIndex ID = 607
+ sahRUIndex ID = 608
+ saqIndex ID = 609
+ saqKEIndex ID = 610
+ sbpIndex ID = 611
+ sbpTZIndex ID = 612
+ sdIndex ID = 613
+ sdPKIndex ID = 614
+ sdhIndex ID = 615
+ seIndex ID = 616
+ seFIIndex ID = 617
+ seNOIndex ID = 618
+ seSEIndex ID = 619
+ sehIndex ID = 620
+ sehMZIndex ID = 621
+ sesIndex ID = 622
+ sesMLIndex ID = 623
+ sgIndex ID = 624
+ sgCFIndex ID = 625
+ shIndex ID = 626
+ shiIndex ID = 627
+ shiLatnIndex ID = 628
+ shiLatnMAIndex ID = 629
+ shiTfngIndex ID = 630
+ shiTfngMAIndex ID = 631
+ siIndex ID = 632
+ siLKIndex ID = 633
+ skIndex ID = 634
+ skSKIndex ID = 635
+ slIndex ID = 636
+ slSIIndex ID = 637
+ smaIndex ID = 638
+ smiIndex ID = 639
+ smjIndex ID = 640
+ smnIndex ID = 641
+ smnFIIndex ID = 642
+ smsIndex ID = 643
+ snIndex ID = 644
+ snZWIndex ID = 645
+ soIndex ID = 646
+ soDJIndex ID = 647
+ soETIndex ID = 648
+ soKEIndex ID = 649
+ soSOIndex ID = 650
+ sqIndex ID = 651
+ sqALIndex ID = 652
+ sqMKIndex ID = 653
+ sqXKIndex ID = 654
+ srIndex ID = 655
+ srCyrlIndex ID = 656
+ srCyrlBAIndex ID = 657
+ srCyrlMEIndex ID = 658
+ srCyrlRSIndex ID = 659
+ srCyrlXKIndex ID = 660
+ srLatnIndex ID = 661
+ srLatnBAIndex ID = 662
+ srLatnMEIndex ID = 663
+ srLatnRSIndex ID = 664
+ srLatnXKIndex ID = 665
+ ssIndex ID = 666
+ ssyIndex ID = 667
+ stIndex ID = 668
+ svIndex ID = 669
+ svAXIndex ID = 670
+ svFIIndex ID = 671
+ svSEIndex ID = 672
+ swIndex ID = 673
+ swCDIndex ID = 674
+ swKEIndex ID = 675
+ swTZIndex ID = 676
+ swUGIndex ID = 677
+ syrIndex ID = 678
+ taIndex ID = 679
+ taINIndex ID = 680
+ taLKIndex ID = 681
+ taMYIndex ID = 682
+ taSGIndex ID = 683
+ teIndex ID = 684
+ teINIndex ID = 685
+ teoIndex ID = 686
+ teoKEIndex ID = 687
+ teoUGIndex ID = 688
+ tgIndex ID = 689
+ tgTJIndex ID = 690
+ thIndex ID = 691
+ thTHIndex ID = 692
+ tiIndex ID = 693
+ tiERIndex ID = 694
+ tiETIndex ID = 695
+ tigIndex ID = 696
+ tkIndex ID = 697
+ tkTMIndex ID = 698
+ tlIndex ID = 699
+ tnIndex ID = 700
+ toIndex ID = 701
+ toTOIndex ID = 702
+ trIndex ID = 703
+ trCYIndex ID = 704
+ trTRIndex ID = 705
+ tsIndex ID = 706
+ ttIndex ID = 707
+ ttRUIndex ID = 708
+ twqIndex ID = 709
+ twqNEIndex ID = 710
+ tzmIndex ID = 711
+ tzmMAIndex ID = 712
+ ugIndex ID = 713
+ ugCNIndex ID = 714
+ ukIndex ID = 715
+ ukUAIndex ID = 716
+ urIndex ID = 717
+ urINIndex ID = 718
+ urPKIndex ID = 719
+ uzIndex ID = 720
+ uzArabIndex ID = 721
+ uzArabAFIndex ID = 722
+ uzCyrlIndex ID = 723
+ uzCyrlUZIndex ID = 724
+ uzLatnIndex ID = 725
+ uzLatnUZIndex ID = 726
+ vaiIndex ID = 727
+ vaiLatnIndex ID = 728
+ vaiLatnLRIndex ID = 729
+ vaiVaiiIndex ID = 730
+ vaiVaiiLRIndex ID = 731
+ veIndex ID = 732
+ viIndex ID = 733
+ viVNIndex ID = 734
+ voIndex ID = 735
+ vo001Index ID = 736
+ vunIndex ID = 737
+ vunTZIndex ID = 738
+ waIndex ID = 739
+ waeIndex ID = 740
+ waeCHIndex ID = 741
+ woIndex ID = 742
+ woSNIndex ID = 743
+ xhIndex ID = 744
+ xogIndex ID = 745
+ xogUGIndex ID = 746
+ yavIndex ID = 747
+ yavCMIndex ID = 748
+ yiIndex ID = 749
+ yi001Index ID = 750
+ yoIndex ID = 751
+ yoBJIndex ID = 752
+ yoNGIndex ID = 753
+ yueIndex ID = 754
+ yueHansIndex ID = 755
+ yueHansCNIndex ID = 756
+ yueHantIndex ID = 757
+ yueHantHKIndex ID = 758
+ zghIndex ID = 759
+ zghMAIndex ID = 760
+ zhIndex ID = 761
+ zhHansIndex ID = 762
+ zhHansCNIndex ID = 763
+ zhHansHKIndex ID = 764
+ zhHansMOIndex ID = 765
+ zhHansSGIndex ID = 766
+ zhHantIndex ID = 767
+ zhHantHKIndex ID = 768
+ zhHantMOIndex ID = 769
+ zhHantTWIndex ID = 770
+ zuIndex ID = 771
+ zuZAIndex ID = 772
+ caESvalenciaIndex ID = 773
+ enUSuvaposixIndex ID = 774
+)
+
+var coreTags = []language.CompactCoreInfo{ // 773 elements
+ // Entry 0 - 1F
+ 0x00000000, 0x01600000, 0x016000d2, 0x01600161,
+ 0x01c00000, 0x01c00052, 0x02100000, 0x02100080,
+ 0x02700000, 0x0270006f, 0x03a00000, 0x03a00001,
+ 0x03a00023, 0x03a00039, 0x03a00062, 0x03a00067,
+ 0x03a0006b, 0x03a0006c, 0x03a0006d, 0x03a00097,
+ 0x03a0009b, 0x03a000a1, 0x03a000a8, 0x03a000ac,
+ 0x03a000b0, 0x03a000b9, 0x03a000ba, 0x03a000c9,
+ 0x03a000e1, 0x03a000ed, 0x03a000f3, 0x03a00108,
+ // Entry 20 - 3F
+ 0x03a0010b, 0x03a00115, 0x03a00117, 0x03a0011c,
+ 0x03a00120, 0x03a00128, 0x03a0015e, 0x04000000,
+ 0x04300000, 0x04300099, 0x04400000, 0x0440012f,
+ 0x04800000, 0x0480006e, 0x05800000, 0x0581f000,
+ 0x0581f032, 0x05857000, 0x05857032, 0x05e00000,
+ 0x05e00052, 0x07100000, 0x07100047, 0x07500000,
+ 0x07500162, 0x07900000, 0x0790012f, 0x07e00000,
+ 0x07e00038, 0x08200000, 0x0a000000, 0x0a0000c3,
+ // Entry 40 - 5F
+ 0x0a500000, 0x0a500035, 0x0a500099, 0x0a900000,
+ 0x0a900053, 0x0a900099, 0x0b200000, 0x0b200078,
+ 0x0b500000, 0x0b500099, 0x0b700000, 0x0b71f000,
+ 0x0b71f033, 0x0b757000, 0x0b757033, 0x0d700000,
+ 0x0d700022, 0x0d70006e, 0x0d700078, 0x0d70009e,
+ 0x0db00000, 0x0db00035, 0x0db00099, 0x0dc00000,
+ 0x0dc00106, 0x0df00000, 0x0df00131, 0x0e500000,
+ 0x0e500135, 0x0e900000, 0x0e90009b, 0x0e90009c,
+ // Entry 60 - 7F
+ 0x0fa00000, 0x0fa0005e, 0x0fe00000, 0x0fe00106,
+ 0x10000000, 0x1000007b, 0x10100000, 0x10100063,
+ 0x10100082, 0x10800000, 0x108000a4, 0x10d00000,
+ 0x10d0002e, 0x10d00036, 0x10d0004e, 0x10d00060,
+ 0x10d0009e, 0x10d000b2, 0x10d000b7, 0x11700000,
+ 0x117000d4, 0x11f00000, 0x11f00060, 0x12400000,
+ 0x12400052, 0x12800000, 0x12b00000, 0x12b00114,
+ 0x12d00000, 0x12d00043, 0x12f00000, 0x12f000a4,
+ // Entry 80 - 9F
+ 0x13000000, 0x13000080, 0x13000122, 0x13600000,
+ 0x1360005d, 0x13600087, 0x13900000, 0x13900001,
+ 0x1390001a, 0x13900025, 0x13900026, 0x1390002d,
+ 0x1390002e, 0x1390002f, 0x13900034, 0x13900036,
+ 0x1390003a, 0x1390003d, 0x13900042, 0x13900046,
+ 0x13900048, 0x13900049, 0x1390004a, 0x1390004e,
+ 0x13900050, 0x13900052, 0x1390005c, 0x1390005d,
+ 0x13900060, 0x13900061, 0x13900063, 0x13900064,
+ // Entry A0 - BF
+ 0x1390006d, 0x13900072, 0x13900073, 0x13900074,
+ 0x13900075, 0x1390007b, 0x1390007c, 0x1390007f,
+ 0x13900080, 0x13900081, 0x13900083, 0x1390008a,
+ 0x1390008c, 0x1390008d, 0x13900096, 0x13900097,
+ 0x13900098, 0x13900099, 0x1390009a, 0x1390009f,
+ 0x139000a0, 0x139000a4, 0x139000a7, 0x139000a9,
+ 0x139000ad, 0x139000b1, 0x139000b4, 0x139000b5,
+ 0x139000bf, 0x139000c0, 0x139000c6, 0x139000c7,
+ // Entry C0 - DF
+ 0x139000ca, 0x139000cb, 0x139000cc, 0x139000ce,
+ 0x139000d0, 0x139000d2, 0x139000d5, 0x139000d6,
+ 0x139000d9, 0x139000dd, 0x139000df, 0x139000e0,
+ 0x139000e6, 0x139000e7, 0x139000e8, 0x139000eb,
+ 0x139000ec, 0x139000f0, 0x13900107, 0x13900109,
+ 0x1390010a, 0x1390010b, 0x1390010c, 0x1390010d,
+ 0x1390010e, 0x1390010f, 0x13900112, 0x13900117,
+ 0x1390011b, 0x1390011d, 0x1390011f, 0x13900125,
+ // Entry E0 - FF
+ 0x13900129, 0x1390012c, 0x1390012d, 0x1390012f,
+ 0x13900131, 0x13900133, 0x13900135, 0x13900139,
+ 0x1390013c, 0x1390013d, 0x1390013f, 0x13900142,
+ 0x13900161, 0x13900162, 0x13900164, 0x13c00000,
+ 0x13c00001, 0x13e00000, 0x13e0001f, 0x13e0002c,
+ 0x13e0003f, 0x13e00041, 0x13e00048, 0x13e00051,
+ 0x13e00054, 0x13e00056, 0x13e00059, 0x13e00065,
+ 0x13e00068, 0x13e00069, 0x13e0006e, 0x13e00086,
+ // Entry 100 - 11F
+ 0x13e00089, 0x13e0008f, 0x13e00094, 0x13e000cf,
+ 0x13e000d8, 0x13e000e2, 0x13e000e4, 0x13e000e7,
+ 0x13e000ec, 0x13e000f1, 0x13e0011a, 0x13e00135,
+ 0x13e00136, 0x13e0013b, 0x14000000, 0x1400006a,
+ 0x14500000, 0x1450006e, 0x14600000, 0x14600052,
+ 0x14800000, 0x14800024, 0x1480009c, 0x14e00000,
+ 0x14e00052, 0x14e00084, 0x14e000c9, 0x14e00114,
+ 0x15100000, 0x15100072, 0x15300000, 0x153000e7,
+ // Entry 120 - 13F
+ 0x15800000, 0x15800063, 0x15800076, 0x15e00000,
+ 0x15e00036, 0x15e00037, 0x15e0003a, 0x15e0003b,
+ 0x15e0003c, 0x15e00049, 0x15e0004b, 0x15e0004c,
+ 0x15e0004d, 0x15e0004e, 0x15e0004f, 0x15e00052,
+ 0x15e00062, 0x15e00067, 0x15e00078, 0x15e0007a,
+ 0x15e0007e, 0x15e00084, 0x15e00085, 0x15e00086,
+ 0x15e00091, 0x15e000a8, 0x15e000b7, 0x15e000ba,
+ 0x15e000bb, 0x15e000be, 0x15e000bf, 0x15e000c3,
+ // Entry 140 - 15F
+ 0x15e000c8, 0x15e000c9, 0x15e000cc, 0x15e000d3,
+ 0x15e000d4, 0x15e000e5, 0x15e000ea, 0x15e00102,
+ 0x15e00107, 0x15e0010a, 0x15e00114, 0x15e0011c,
+ 0x15e00120, 0x15e00122, 0x15e00128, 0x15e0013f,
+ 0x15e00140, 0x15e0015f, 0x16900000, 0x1690009e,
+ 0x16d00000, 0x16d000d9, 0x16e00000, 0x16e00096,
+ 0x17e00000, 0x17e0007b, 0x19000000, 0x1900006e,
+ 0x1a300000, 0x1a30004e, 0x1a300078, 0x1a3000b2,
+ // Entry 160 - 17F
+ 0x1a400000, 0x1a400099, 0x1a900000, 0x1ab00000,
+ 0x1ab000a4, 0x1ac00000, 0x1ac00098, 0x1b400000,
+ 0x1b400080, 0x1b4000d4, 0x1b4000d6, 0x1b800000,
+ 0x1b800135, 0x1bc00000, 0x1bc00097, 0x1be00000,
+ 0x1be00099, 0x1d100000, 0x1d100033, 0x1d100090,
+ 0x1d200000, 0x1d200060, 0x1d500000, 0x1d500092,
+ 0x1d700000, 0x1d700028, 0x1e100000, 0x1e100095,
+ 0x1e700000, 0x1e7000d6, 0x1ea00000, 0x1ea00053,
+ // Entry 180 - 19F
+ 0x1f300000, 0x1f500000, 0x1f800000, 0x1f80009d,
+ 0x1f900000, 0x1f90004e, 0x1f90009e, 0x1f900113,
+ 0x1f900138, 0x1fa00000, 0x1fb00000, 0x20000000,
+ 0x200000a2, 0x20300000, 0x20700000, 0x20700052,
+ 0x20800000, 0x20a00000, 0x20a0012f, 0x20e00000,
+ 0x20f00000, 0x21000000, 0x2100007d, 0x21200000,
+ 0x21200067, 0x21600000, 0x21700000, 0x217000a4,
+ 0x21f00000, 0x22300000, 0x2230012f, 0x22700000,
+ // Entry 1A0 - 1BF
+ 0x2270005a, 0x23400000, 0x234000c3, 0x23900000,
+ 0x239000a4, 0x24200000, 0x242000ae, 0x24400000,
+ 0x24400052, 0x24500000, 0x24500082, 0x24600000,
+ 0x246000a4, 0x24a00000, 0x24a000a6, 0x25100000,
+ 0x25100099, 0x25400000, 0x254000aa, 0x254000ab,
+ 0x25600000, 0x25600099, 0x26a00000, 0x26a00099,
+ 0x26b00000, 0x26b0012f, 0x26d00000, 0x26d00052,
+ 0x26e00000, 0x26e00060, 0x27400000, 0x28100000,
+ // Entry 1C0 - 1DF
+ 0x2810007b, 0x28a00000, 0x28a000a5, 0x29100000,
+ 0x2910012f, 0x29500000, 0x295000b7, 0x2a300000,
+ 0x2a300131, 0x2af00000, 0x2af00135, 0x2b500000,
+ 0x2b50002a, 0x2b50004b, 0x2b50004c, 0x2b50004d,
+ 0x2b800000, 0x2b8000af, 0x2bf00000, 0x2bf0009b,
+ 0x2bf0009c, 0x2c000000, 0x2c0000b6, 0x2c200000,
+ 0x2c20004b, 0x2c400000, 0x2c4000a4, 0x2c500000,
+ 0x2c5000a4, 0x2c700000, 0x2c7000b8, 0x2d100000,
+ // Entry 1E0 - 1FF
+ 0x2d1000a4, 0x2d10012f, 0x2e900000, 0x2e9000a4,
+ 0x2ed00000, 0x2ed000cc, 0x2f100000, 0x2f1000bf,
+ 0x2f200000, 0x2f2000d1, 0x2f400000, 0x2f400052,
+ 0x2ff00000, 0x2ff000c2, 0x30400000, 0x30400099,
+ 0x30b00000, 0x30b000c5, 0x31000000, 0x31b00000,
+ 0x31b00099, 0x31f00000, 0x31f0003e, 0x31f000d0,
+ 0x31f0010d, 0x32000000, 0x320000cb, 0x32500000,
+ 0x32500052, 0x33100000, 0x331000c4, 0x33a00000,
+ // Entry 200 - 21F
+ 0x33a0009c, 0x34100000, 0x34500000, 0x345000d2,
+ 0x34700000, 0x347000da, 0x34700110, 0x34e00000,
+ 0x34e00164, 0x35000000, 0x35000060, 0x350000d9,
+ 0x35100000, 0x35100099, 0x351000db, 0x36700000,
+ 0x36700030, 0x36700036, 0x36700040, 0x3670005b,
+ 0x367000d9, 0x36700116, 0x3670011b, 0x36800000,
+ 0x36800052, 0x36a00000, 0x36a000da, 0x36c00000,
+ 0x36c00052, 0x36f00000, 0x37500000, 0x37600000,
+ // Entry 220 - 23F
+ 0x37a00000, 0x38000000, 0x38000117, 0x38700000,
+ 0x38900000, 0x38900131, 0x39000000, 0x3900006f,
+ 0x390000a4, 0x39500000, 0x39500099, 0x39800000,
+ 0x3980007d, 0x39800106, 0x39d00000, 0x39d05000,
+ 0x39d050e8, 0x39d33000, 0x39d33099, 0x3a100000,
+ 0x3b300000, 0x3b3000e9, 0x3bd00000, 0x3bd00001,
+ 0x3be00000, 0x3be00024, 0x3c000000, 0x3c00002a,
+ 0x3c000041, 0x3c00004e, 0x3c00005a, 0x3c000086,
+ // Entry 240 - 25F
+ 0x3c00008b, 0x3c0000b7, 0x3c0000c6, 0x3c0000d1,
+ 0x3c0000ee, 0x3c000118, 0x3c000126, 0x3c400000,
+ 0x3c40003f, 0x3c400069, 0x3c4000e4, 0x3d400000,
+ 0x3d40004e, 0x3d900000, 0x3d90003a, 0x3dc00000,
+ 0x3dc000bc, 0x3dc00104, 0x3de00000, 0x3de0012f,
+ 0x3e200000, 0x3e200047, 0x3e2000a5, 0x3e2000ae,
+ 0x3e2000bc, 0x3e200106, 0x3e200130, 0x3e500000,
+ 0x3e500107, 0x3e600000, 0x3e60012f, 0x3eb00000,
+ // Entry 260 - 27F
+ 0x3eb00106, 0x3ec00000, 0x3ec000a4, 0x3f300000,
+ 0x3f30012f, 0x3fa00000, 0x3fa000e8, 0x3fc00000,
+ 0x3fd00000, 0x3fd00072, 0x3fd000da, 0x3fd0010c,
+ 0x3ff00000, 0x3ff000d1, 0x40100000, 0x401000c3,
+ 0x40200000, 0x4020004c, 0x40700000, 0x40800000,
+ 0x40857000, 0x408570ba, 0x408dc000, 0x408dc0ba,
+ 0x40c00000, 0x40c000b3, 0x41200000, 0x41200111,
+ 0x41600000, 0x4160010f, 0x41c00000, 0x41d00000,
+ // Entry 280 - 29F
+ 0x41e00000, 0x41f00000, 0x41f00072, 0x42200000,
+ 0x42300000, 0x42300164, 0x42900000, 0x42900062,
+ 0x4290006f, 0x429000a4, 0x42900115, 0x43100000,
+ 0x43100027, 0x431000c2, 0x4310014d, 0x43200000,
+ 0x4321f000, 0x4321f033, 0x4321f0bd, 0x4321f105,
+ 0x4321f14d, 0x43257000, 0x43257033, 0x432570bd,
+ 0x43257105, 0x4325714d, 0x43700000, 0x43a00000,
+ 0x43b00000, 0x44400000, 0x44400031, 0x44400072,
+ // Entry 2A0 - 2BF
+ 0x4440010c, 0x44500000, 0x4450004b, 0x445000a4,
+ 0x4450012f, 0x44500131, 0x44e00000, 0x45000000,
+ 0x45000099, 0x450000b3, 0x450000d0, 0x4500010d,
+ 0x46100000, 0x46100099, 0x46400000, 0x464000a4,
+ 0x46400131, 0x46700000, 0x46700124, 0x46b00000,
+ 0x46b00123, 0x46f00000, 0x46f0006d, 0x46f0006f,
+ 0x47100000, 0x47600000, 0x47600127, 0x47a00000,
+ 0x48000000, 0x48200000, 0x48200129, 0x48a00000,
+ // Entry 2C0 - 2DF
+ 0x48a0005d, 0x48a0012b, 0x48e00000, 0x49400000,
+ 0x49400106, 0x4a400000, 0x4a4000d4, 0x4a900000,
+ 0x4a9000ba, 0x4ac00000, 0x4ac00053, 0x4ae00000,
+ 0x4ae00130, 0x4b400000, 0x4b400099, 0x4b4000e8,
+ 0x4bc00000, 0x4bc05000, 0x4bc05024, 0x4bc1f000,
+ 0x4bc1f137, 0x4bc57000, 0x4bc57137, 0x4be00000,
+ 0x4be57000, 0x4be570b4, 0x4bee3000, 0x4bee30b4,
+ 0x4c000000, 0x4c300000, 0x4c30013e, 0x4c900000,
+ // Entry 2E0 - 2FF
+ 0x4c900001, 0x4cc00000, 0x4cc0012f, 0x4ce00000,
+ 0x4cf00000, 0x4cf0004e, 0x4e500000, 0x4e500114,
+ 0x4f200000, 0x4fb00000, 0x4fb00131, 0x50900000,
+ 0x50900052, 0x51200000, 0x51200001, 0x51800000,
+ 0x5180003b, 0x518000d6, 0x51f00000, 0x51f38000,
+ 0x51f38053, 0x51f39000, 0x51f3908d, 0x52800000,
+ 0x528000ba, 0x52900000, 0x52938000, 0x52938053,
+ 0x5293808d, 0x529380c6, 0x5293810d, 0x52939000,
+ // Entry 300 - 31F
+ 0x5293908d, 0x529390c6, 0x5293912e, 0x52f00000,
+ 0x52f00161,
+} // Size: 3116 bytes
+
+const specialTagsStr string = "ca-ES-valencia en-US-u-va-posix"
+
+// Total table size 3147 bytes (3KiB); checksum: F4E57D15
diff --git a/vendor/golang.org/x/text/internal/language/compact/tags.go b/vendor/golang.org/x/text/internal/language/compact/tags.go
new file mode 100644
index 0000000..ca135d2
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compact/tags.go
@@ -0,0 +1,91 @@
+// Copyright 2013 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 compact
+
+var (
+ und = Tag{}
+
+ Und Tag = Tag{}
+
+ Afrikaans Tag = Tag{language: afIndex, locale: afIndex}
+ Amharic Tag = Tag{language: amIndex, locale: amIndex}
+ Arabic Tag = Tag{language: arIndex, locale: arIndex}
+ ModernStandardArabic Tag = Tag{language: ar001Index, locale: ar001Index}
+ Azerbaijani Tag = Tag{language: azIndex, locale: azIndex}
+ Bulgarian Tag = Tag{language: bgIndex, locale: bgIndex}
+ Bengali Tag = Tag{language: bnIndex, locale: bnIndex}
+ Catalan Tag = Tag{language: caIndex, locale: caIndex}
+ Czech Tag = Tag{language: csIndex, locale: csIndex}
+ Danish Tag = Tag{language: daIndex, locale: daIndex}
+ German Tag = Tag{language: deIndex, locale: deIndex}
+ Greek Tag = Tag{language: elIndex, locale: elIndex}
+ English Tag = Tag{language: enIndex, locale: enIndex}
+ AmericanEnglish Tag = Tag{language: enUSIndex, locale: enUSIndex}
+ BritishEnglish Tag = Tag{language: enGBIndex, locale: enGBIndex}
+ Spanish Tag = Tag{language: esIndex, locale: esIndex}
+ EuropeanSpanish Tag = Tag{language: esESIndex, locale: esESIndex}
+ LatinAmericanSpanish Tag = Tag{language: es419Index, locale: es419Index}
+ Estonian Tag = Tag{language: etIndex, locale: etIndex}
+ Persian Tag = Tag{language: faIndex, locale: faIndex}
+ Finnish Tag = Tag{language: fiIndex, locale: fiIndex}
+ Filipino Tag = Tag{language: filIndex, locale: filIndex}
+ French Tag = Tag{language: frIndex, locale: frIndex}
+ CanadianFrench Tag = Tag{language: frCAIndex, locale: frCAIndex}
+ Gujarati Tag = Tag{language: guIndex, locale: guIndex}
+ Hebrew Tag = Tag{language: heIndex, locale: heIndex}
+ Hindi Tag = Tag{language: hiIndex, locale: hiIndex}
+ Croatian Tag = Tag{language: hrIndex, locale: hrIndex}
+ Hungarian Tag = Tag{language: huIndex, locale: huIndex}
+ Armenian Tag = Tag{language: hyIndex, locale: hyIndex}
+ Indonesian Tag = Tag{language: idIndex, locale: idIndex}
+ Icelandic Tag = Tag{language: isIndex, locale: isIndex}
+ Italian Tag = Tag{language: itIndex, locale: itIndex}
+ Japanese Tag = Tag{language: jaIndex, locale: jaIndex}
+ Georgian Tag = Tag{language: kaIndex, locale: kaIndex}
+ Kazakh Tag = Tag{language: kkIndex, locale: kkIndex}
+ Khmer Tag = Tag{language: kmIndex, locale: kmIndex}
+ Kannada Tag = Tag{language: knIndex, locale: knIndex}
+ Korean Tag = Tag{language: koIndex, locale: koIndex}
+ Kirghiz Tag = Tag{language: kyIndex, locale: kyIndex}
+ Lao Tag = Tag{language: loIndex, locale: loIndex}
+ Lithuanian Tag = Tag{language: ltIndex, locale: ltIndex}
+ Latvian Tag = Tag{language: lvIndex, locale: lvIndex}
+ Macedonian Tag = Tag{language: mkIndex, locale: mkIndex}
+ Malayalam Tag = Tag{language: mlIndex, locale: mlIndex}
+ Mongolian Tag = Tag{language: mnIndex, locale: mnIndex}
+ Marathi Tag = Tag{language: mrIndex, locale: mrIndex}
+ Malay Tag = Tag{language: msIndex, locale: msIndex}
+ Burmese Tag = Tag{language: myIndex, locale: myIndex}
+ Nepali Tag = Tag{language: neIndex, locale: neIndex}
+ Dutch Tag = Tag{language: nlIndex, locale: nlIndex}
+ Norwegian Tag = Tag{language: noIndex, locale: noIndex}
+ Punjabi Tag = Tag{language: paIndex, locale: paIndex}
+ Polish Tag = Tag{language: plIndex, locale: plIndex}
+ Portuguese Tag = Tag{language: ptIndex, locale: ptIndex}
+ BrazilianPortuguese Tag = Tag{language: ptBRIndex, locale: ptBRIndex}
+ EuropeanPortuguese Tag = Tag{language: ptPTIndex, locale: ptPTIndex}
+ Romanian Tag = Tag{language: roIndex, locale: roIndex}
+ Russian Tag = Tag{language: ruIndex, locale: ruIndex}
+ Sinhala Tag = Tag{language: siIndex, locale: siIndex}
+ Slovak Tag = Tag{language: skIndex, locale: skIndex}
+ Slovenian Tag = Tag{language: slIndex, locale: slIndex}
+ Albanian Tag = Tag{language: sqIndex, locale: sqIndex}
+ Serbian Tag = Tag{language: srIndex, locale: srIndex}
+ SerbianLatin Tag = Tag{language: srLatnIndex, locale: srLatnIndex}
+ Swedish Tag = Tag{language: svIndex, locale: svIndex}
+ Swahili Tag = Tag{language: swIndex, locale: swIndex}
+ Tamil Tag = Tag{language: taIndex, locale: taIndex}
+ Telugu Tag = Tag{language: teIndex, locale: teIndex}
+ Thai Tag = Tag{language: thIndex, locale: thIndex}
+ Turkish Tag = Tag{language: trIndex, locale: trIndex}
+ Ukrainian Tag = Tag{language: ukIndex, locale: ukIndex}
+ Urdu Tag = Tag{language: urIndex, locale: urIndex}
+ Uzbek Tag = Tag{language: uzIndex, locale: uzIndex}
+ Vietnamese Tag = Tag{language: viIndex, locale: viIndex}
+ Chinese Tag = Tag{language: zhIndex, locale: zhIndex}
+ SimplifiedChinese Tag = Tag{language: zhHansIndex, locale: zhHansIndex}
+ TraditionalChinese Tag = Tag{language: zhHantIndex, locale: zhHantIndex}
+ Zulu Tag = Tag{language: zuIndex, locale: zuIndex}
+)
diff --git a/vendor/golang.org/x/text/internal/language/compose.go b/vendor/golang.org/x/text/internal/language/compose.go
new file mode 100644
index 0000000..4ae78e0
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compose.go
@@ -0,0 +1,167 @@
+// Copyright 2018 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 language
+
+import (
+ "sort"
+ "strings"
+)
+
+// A Builder allows constructing a Tag from individual components.
+// Its main user is Compose in the top-level language package.
+type Builder struct {
+ Tag Tag
+
+ private string // the x extension
+ variants []string
+ extensions []string
+}
+
+// Make returns a new Tag from the current settings.
+func (b *Builder) Make() Tag {
+ t := b.Tag
+
+ if len(b.extensions) > 0 || len(b.variants) > 0 {
+ sort.Sort(sortVariants(b.variants))
+ sort.Strings(b.extensions)
+
+ if b.private != "" {
+ b.extensions = append(b.extensions, b.private)
+ }
+ n := maxCoreSize + tokenLen(b.variants...) + tokenLen(b.extensions...)
+ buf := make([]byte, n)
+ p := t.genCoreBytes(buf)
+ t.pVariant = byte(p)
+ p += appendTokens(buf[p:], b.variants...)
+ t.pExt = uint16(p)
+ p += appendTokens(buf[p:], b.extensions...)
+ t.str = string(buf[:p])
+ // We may not always need to remake the string, but when or when not
+ // to do so is rather tricky.
+ scan := makeScanner(buf[:p])
+ t, _ = parse(&scan, "")
+ return t
+
+ } else if b.private != "" {
+ t.str = b.private
+ t.RemakeString()
+ }
+ return t
+}
+
+// SetTag copies all the settings from a given Tag. Any previously set values
+// are discarded.
+func (b *Builder) SetTag(t Tag) {
+ b.Tag.LangID = t.LangID
+ b.Tag.RegionID = t.RegionID
+ b.Tag.ScriptID = t.ScriptID
+ // TODO: optimize
+ b.variants = b.variants[:0]
+ if variants := t.Variants(); variants != "" {
+ for _, vr := range strings.Split(variants[1:], "-") {
+ b.variants = append(b.variants, vr)
+ }
+ }
+ b.extensions, b.private = b.extensions[:0], ""
+ for _, e := range t.Extensions() {
+ b.AddExt(e)
+ }
+}
+
+// AddExt adds extension e to the tag. e must be a valid extension as returned
+// by Tag.Extension. If the extension already exists, it will be discarded,
+// except for a -u extension, where non-existing key-type pairs will added.
+func (b *Builder) AddExt(e string) {
+ if e[0] == 'x' {
+ if b.private == "" {
+ b.private = e
+ }
+ return
+ }
+ for i, s := range b.extensions {
+ if s[0] == e[0] {
+ if e[0] == 'u' {
+ b.extensions[i] += e[1:]
+ }
+ return
+ }
+ }
+ b.extensions = append(b.extensions, e)
+}
+
+// SetExt sets the extension e to the tag. e must be a valid extension as
+// returned by Tag.Extension. If the extension already exists, it will be
+// overwritten, except for a -u extension, where the individual key-type pairs
+// will be set.
+func (b *Builder) SetExt(e string) {
+ if e[0] == 'x' {
+ b.private = e
+ return
+ }
+ for i, s := range b.extensions {
+ if s[0] == e[0] {
+ if e[0] == 'u' {
+ b.extensions[i] = e + s[1:]
+ } else {
+ b.extensions[i] = e
+ }
+ return
+ }
+ }
+ b.extensions = append(b.extensions, e)
+}
+
+// AddVariant adds any number of variants.
+func (b *Builder) AddVariant(v ...string) {
+ for _, v := range v {
+ if v != "" {
+ b.variants = append(b.variants, v)
+ }
+ }
+}
+
+// ClearVariants removes any variants previously added, including those
+// copied from a Tag in SetTag.
+func (b *Builder) ClearVariants() {
+ b.variants = b.variants[:0]
+}
+
+// ClearExtensions removes any extensions previously added, including those
+// copied from a Tag in SetTag.
+func (b *Builder) ClearExtensions() {
+ b.private = ""
+ b.extensions = b.extensions[:0]
+}
+
+func tokenLen(token ...string) (n int) {
+ for _, t := range token {
+ n += len(t) + 1
+ }
+ return
+}
+
+func appendTokens(b []byte, token ...string) int {
+ p := 0
+ for _, t := range token {
+ b[p] = '-'
+ copy(b[p+1:], t)
+ p += 1 + len(t)
+ }
+ return p
+}
+
+type sortVariants []string
+
+func (s sortVariants) Len() int {
+ return len(s)
+}
+
+func (s sortVariants) Swap(i, j int) {
+ s[j], s[i] = s[i], s[j]
+}
+
+func (s sortVariants) Less(i, j int) bool {
+ return variantIndex[s[i]] < variantIndex[s[j]]
+}
diff --git a/vendor/golang.org/x/text/internal/language/compose_test.go b/vendor/golang.org/x/text/internal/language/compose_test.go
new file mode 100644
index 0000000..1930d3d
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/compose_test.go
@@ -0,0 +1,67 @@
+// Copyright 2018 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 language
+
+import (
+ "strings"
+ "testing"
+)
+
+func parseBase(s string) Language {
+ if s == "" {
+ return 0
+ }
+ return MustParseBase(s)
+}
+
+func parseScript(s string) Script {
+ if s == "" {
+ return 0
+ }
+ return MustParseScript(s)
+}
+
+func parseRegion(s string) Region {
+ if s == "" {
+ return 0
+ }
+ return MustParseRegion(s)
+}
+
+func TestBuilder(t *testing.T) {
+ partChecks(t, func(t *testing.T, tt *parseTest) (id Tag, skip bool) {
+ tag := Make(tt.in)
+ b := Builder{}
+ b.SetTag(Tag{
+ LangID: parseBase(tt.lang),
+ ScriptID: parseScript(tt.script),
+ RegionID: parseRegion(tt.region),
+ })
+ if tt.variants != "" {
+ b.AddVariant(strings.Split(tt.variants, "-")...)
+ }
+ for _, e := range tag.Extensions() {
+ b.AddExt(e)
+ }
+ got := b.Make()
+ if got != tag {
+ t.Errorf("%s: got %v; want %v", tt.in, got, tag)
+ }
+ return got, false
+ })
+}
+
+func TestSetTag(t *testing.T) {
+ partChecks(t, func(t *testing.T, tt *parseTest) (id Tag, skip bool) {
+ tag := Make(tt.in)
+ b := Builder{}
+ b.SetTag(tag)
+ got := b.Make()
+ if got != tag {
+ t.Errorf("%s: got %v; want %v", tt.in, got, tag)
+ }
+ return got, false
+ })
+}
diff --git a/vendor/golang.org/x/text/internal/language/coverage.go b/vendor/golang.org/x/text/internal/language/coverage.go
new file mode 100644
index 0000000..9b20b88
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/coverage.go
@@ -0,0 +1,28 @@
+// Copyright 2014 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 language
+
+// BaseLanguages returns the list of all supported base languages. It generates
+// the list by traversing the internal structures.
+func BaseLanguages() []Language {
+ base := make([]Language, 0, NumLanguages)
+ for i := 0; i < langNoIndexOffset; i++ {
+ // We included "und" already for the value 0.
+ if i != nonCanonicalUnd {
+ base = append(base, Language(i))
+ }
+ }
+ i := langNoIndexOffset
+ for _, v := range langNoIndex {
+ for k := 0; k < 8; k++ {
+ if v&1 == 1 {
+ base = append(base, Language(i))
+ }
+ v >>= 1
+ i++
+ }
+ }
+ return base
+}
diff --git a/vendor/golang.org/x/text/internal/language/gen.go b/vendor/golang.org/x/text/internal/language/gen.go
new file mode 100644
index 0000000..cdcc7fe
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/gen.go
@@ -0,0 +1,1520 @@
+// Copyright 2013 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
+
+// Language tag table generator.
+// Data read from the web.
+
+package main
+
+import (
+ "bufio"
+ "flag"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "log"
+ "math"
+ "reflect"
+ "regexp"
+ "sort"
+ "strconv"
+ "strings"
+
+ "golang.org/x/text/internal/gen"
+ "golang.org/x/text/internal/tag"
+ "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 for generated tables")
+)
+
+var comment = []string{
+ `
+lang holds an alphabetically sorted list of ISO-639 language identifiers.
+All entries are 4 bytes. The index of the identifier (divided by 4) is the language tag.
+For 2-byte language identifiers, the two successive bytes have the following meaning:
+ - if the first letter of the 2- and 3-letter ISO codes are the same:
+ the second and third letter of the 3-letter ISO code.
+ - otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3.
+For 3-byte language identifiers the 4th byte is 0.`,
+ `
+langNoIndex is a bit vector of all 3-letter language codes that are not used as an index
+in lookup tables. The language ids for these language codes are derived directly
+from the letters and are not consecutive.`,
+ `
+altLangISO3 holds an alphabetically sorted list of 3-letter language code alternatives
+to 2-letter language codes that cannot be derived using the method described above.
+Each 3-letter code is followed by its 1-byte langID.`,
+ `
+altLangIndex is used to convert indexes in altLangISO3 to langIDs.`,
+ `
+AliasMap maps langIDs to their suggested replacements.`,
+ `
+script is an alphabetically sorted list of ISO 15924 codes. The index
+of the script in the string, divided by 4, is the internal scriptID.`,
+ `
+isoRegionOffset needs to be added to the index of regionISO to obtain the regionID
+for 2-letter ISO codes. (The first isoRegionOffset regionIDs are reserved for
+the UN.M49 codes used for groups.)`,
+ `
+regionISO holds a list of alphabetically sorted 2-letter ISO region codes.
+Each 2-letter codes is followed by two bytes with the following meaning:
+ - [A-Z}{2}: the first letter of the 2-letter code plus these two
+ letters form the 3-letter ISO code.
+ - 0, n: index into altRegionISO3.`,
+ `
+regionTypes defines the status of a region for various standards.`,
+ `
+m49 maps regionIDs to UN.M49 codes. The first isoRegionOffset entries are
+codes indicating collections of regions.`,
+ `
+m49Index gives indexes into fromM49 based on the three most significant bits
+of a 10-bit UN.M49 code. To search an UN.M49 code in fromM49, search in
+ fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]]
+for an entry where the first 7 bits match the 7 lsb of the UN.M49 code.
+The region code is stored in the 9 lsb of the indexed value.`,
+ `
+fromM49 contains entries to map UN.M49 codes to regions. See m49Index for details.`,
+ `
+altRegionISO3 holds a list of 3-letter region codes that cannot be
+mapped to 2-letter codes using the default algorithm. This is a short list.`,
+ `
+altRegionIDs holds a list of regionIDs the positions of which match those
+of the 3-letter ISO codes in altRegionISO3.`,
+ `
+variantNumSpecialized is the number of specialized variants in variants.`,
+ `
+suppressScript is an index from langID to the dominant script for that language,
+if it exists. If a script is given, it should be suppressed from the language tag.`,
+ `
+likelyLang is a lookup table, indexed by langID, for the most likely
+scripts and regions given incomplete information. If more entries exist for a
+given language, region and script are the index and size respectively
+of the list in likelyLangList.`,
+ `
+likelyLangList holds lists info associated with likelyLang.`,
+ `
+likelyRegion is a lookup table, indexed by regionID, for the most likely
+languages and scripts given incomplete information. If more entries exist
+for a given regionID, lang and script are the index and size respectively
+of the list in likelyRegionList.
+TODO: exclude containers and user-definable regions from the list.`,
+ `
+likelyRegionList holds lists info associated with likelyRegion.`,
+ `
+likelyScript is a lookup table, indexed by scriptID, for the most likely
+languages and regions given a script.`,
+ `
+nRegionGroups is the number of region groups.`,
+ `
+regionInclusion maps region identifiers to sets of regions in regionInclusionBits,
+where each set holds all groupings that are directly connected in a region
+containment graph.`,
+ `
+regionInclusionBits is an array of bit vectors where every vector represents
+a set of region groupings. These sets are used to compute the distance
+between two regions for the purpose of language matching.`,
+ `
+regionInclusionNext marks, for each entry in regionInclusionBits, the set of
+all groups that are reachable from the groups set in the respective entry.`,
+}
+
+// TODO: consider changing some of these structures to tries. This can reduce
+// memory, but may increase the need for memory allocations. This could be
+// mitigated if we can piggyback on language tags for common cases.
+
+func failOnError(e error) {
+ if e != nil {
+ log.Panic(e)
+ }
+}
+
+type setType int
+
+const (
+ Indexed setType = 1 + iota // all elements must be of same size
+ Linear
+)
+
+type stringSet struct {
+ s []string
+ sorted, frozen bool
+
+ // We often need to update values after the creation of an index is completed.
+ // We include a convenience map for keeping track of this.
+ update map[string]string
+ typ setType // used for checking.
+}
+
+func (ss *stringSet) clone() stringSet {
+ c := *ss
+ c.s = append([]string(nil), c.s...)
+ return c
+}
+
+func (ss *stringSet) setType(t setType) {
+ if ss.typ != t && ss.typ != 0 {
+ log.Panicf("type %d cannot be assigned as it was already %d", t, ss.typ)
+ }
+}
+
+// parse parses a whitespace-separated string and initializes ss with its
+// components.
+func (ss *stringSet) parse(s string) {
+ scan := bufio.NewScanner(strings.NewReader(s))
+ scan.Split(bufio.ScanWords)
+ for scan.Scan() {
+ ss.add(scan.Text())
+ }
+}
+
+func (ss *stringSet) assertChangeable() {
+ if ss.frozen {
+ log.Panic("attempt to modify a frozen stringSet")
+ }
+}
+
+func (ss *stringSet) add(s string) {
+ ss.assertChangeable()
+ ss.s = append(ss.s, s)
+ ss.sorted = ss.frozen
+}
+
+func (ss *stringSet) freeze() {
+ ss.compact()
+ ss.frozen = true
+}
+
+func (ss *stringSet) compact() {
+ if ss.sorted {
+ return
+ }
+ a := ss.s
+ sort.Strings(a)
+ k := 0
+ for i := 1; i < len(a); i++ {
+ if a[k] != a[i] {
+ a[k+1] = a[i]
+ k++
+ }
+ }
+ ss.s = a[:k+1]
+ ss.sorted = ss.frozen
+}
+
+type funcSorter struct {
+ fn func(a, b string) bool
+ sort.StringSlice
+}
+
+func (s funcSorter) Less(i, j int) bool {
+ return s.fn(s.StringSlice[i], s.StringSlice[j])
+}
+
+func (ss *stringSet) sortFunc(f func(a, b string) bool) {
+ ss.compact()
+ sort.Sort(funcSorter{f, sort.StringSlice(ss.s)})
+}
+
+func (ss *stringSet) remove(s string) {
+ ss.assertChangeable()
+ if i, ok := ss.find(s); ok {
+ copy(ss.s[i:], ss.s[i+1:])
+ ss.s = ss.s[:len(ss.s)-1]
+ }
+}
+
+func (ss *stringSet) replace(ol, nu string) {
+ ss.s[ss.index(ol)] = nu
+ ss.sorted = ss.frozen
+}
+
+func (ss *stringSet) index(s string) int {
+ ss.setType(Indexed)
+ i, ok := ss.find(s)
+ if !ok {
+ if i < len(ss.s) {
+ log.Panicf("find: item %q is not in list. Closest match is %q.", s, ss.s[i])
+ }
+ log.Panicf("find: item %q is not in list", s)
+
+ }
+ return i
+}
+
+func (ss *stringSet) find(s string) (int, bool) {
+ ss.compact()
+ i := sort.SearchStrings(ss.s, s)
+ return i, i != len(ss.s) && ss.s[i] == s
+}
+
+func (ss *stringSet) slice() []string {
+ ss.compact()
+ return ss.s
+}
+
+func (ss *stringSet) updateLater(v, key string) {
+ if ss.update == nil {
+ ss.update = map[string]string{}
+ }
+ ss.update[v] = key
+}
+
+// join joins the string and ensures that all entries are of the same length.
+func (ss *stringSet) join() string {
+ ss.setType(Indexed)
+ n := len(ss.s[0])
+ for _, s := range ss.s {
+ if len(s) != n {
+ log.Panicf("join: not all entries are of the same length: %q", s)
+ }
+ }
+ ss.s = append(ss.s, strings.Repeat("\xff", n))
+ return strings.Join(ss.s, "")
+}
+
+// ianaEntry holds information for an entry in the IANA Language Subtag Repository.
+// All types use the same entry.
+// See http://tools.ietf.org/html/bcp47#section-5.1 for a description of the various
+// fields.
+type ianaEntry struct {
+ typ string
+ description []string
+ scope string
+ added string
+ preferred string
+ deprecated string
+ suppressScript string
+ macro string
+ prefix []string
+}
+
+type builder struct {
+ w *gen.CodeWriter
+ hw io.Writer // MultiWriter for w and w.Hash
+ data *cldr.CLDR
+ supp *cldr.SupplementalData
+
+ // indices
+ locale stringSet // common locales
+ lang stringSet // canonical language ids (2 or 3 letter ISO codes) with data
+ langNoIndex stringSet // 3-letter ISO codes with no associated data
+ script stringSet // 4-letter ISO codes
+ region stringSet // 2-letter ISO or 3-digit UN M49 codes
+ variant stringSet // 4-8-alphanumeric variant code.
+
+ // Region codes that are groups with their corresponding group IDs.
+ groups map[int]index
+
+ // langInfo
+ registry map[string]*ianaEntry
+}
+
+type index uint
+
+func newBuilder(w *gen.CodeWriter) *builder {
+ r := gen.OpenCLDRCoreZip()
+ defer r.Close()
+ d := &cldr.Decoder{}
+ data, err := d.DecodeZip(r)
+ failOnError(err)
+ b := builder{
+ w: w,
+ hw: io.MultiWriter(w, w.Hash),
+ data: data,
+ supp: data.Supplemental(),
+ }
+ b.parseRegistry()
+ return &b
+}
+
+func (b *builder) parseRegistry() {
+ r := gen.OpenIANAFile("assignments/language-subtag-registry")
+ defer r.Close()
+ b.registry = make(map[string]*ianaEntry)
+
+ scan := bufio.NewScanner(r)
+ scan.Split(bufio.ScanWords)
+ var record *ianaEntry
+ for more := scan.Scan(); more; {
+ key := scan.Text()
+ more = scan.Scan()
+ value := scan.Text()
+ switch key {
+ case "Type:":
+ record = &ianaEntry{typ: value}
+ case "Subtag:", "Tag:":
+ if s := strings.SplitN(value, "..", 2); len(s) > 1 {
+ for a := s[0]; a <= s[1]; a = inc(a) {
+ b.addToRegistry(a, record)
+ }
+ } else {
+ b.addToRegistry(value, record)
+ }
+ case "Suppress-Script:":
+ record.suppressScript = value
+ case "Added:":
+ record.added = value
+ case "Deprecated:":
+ record.deprecated = value
+ case "Macrolanguage:":
+ record.macro = value
+ case "Preferred-Value:":
+ record.preferred = value
+ case "Prefix:":
+ record.prefix = append(record.prefix, value)
+ case "Scope:":
+ record.scope = value
+ case "Description:":
+ buf := []byte(value)
+ for more = scan.Scan(); more; more = scan.Scan() {
+ b := scan.Bytes()
+ if b[0] == '%' || b[len(b)-1] == ':' {
+ break
+ }
+ buf = append(buf, ' ')
+ buf = append(buf, b...)
+ }
+ record.description = append(record.description, string(buf))
+ continue
+ default:
+ continue
+ }
+ more = scan.Scan()
+ }
+ if scan.Err() != nil {
+ log.Panic(scan.Err())
+ }
+}
+
+func (b *builder) addToRegistry(key string, entry *ianaEntry) {
+ if info, ok := b.registry[key]; ok {
+ if info.typ != "language" || entry.typ != "extlang" {
+ log.Fatalf("parseRegistry: tag %q already exists", key)
+ }
+ } else {
+ b.registry[key] = entry
+ }
+}
+
+var commentIndex = make(map[string]string)
+
+func init() {
+ for _, s := range comment {
+ key := strings.TrimSpace(strings.SplitN(s, " ", 2)[0])
+ commentIndex[key] = s
+ }
+}
+
+func (b *builder) comment(name string) {
+ if s := commentIndex[name]; len(s) > 0 {
+ b.w.WriteComment(s)
+ } else {
+ fmt.Fprintln(b.w)
+ }
+}
+
+func (b *builder) pf(f string, x ...interface{}) {
+ fmt.Fprintf(b.hw, f, x...)
+ fmt.Fprint(b.hw, "\n")
+}
+
+func (b *builder) p(x ...interface{}) {
+ fmt.Fprintln(b.hw, x...)
+}
+
+func (b *builder) addSize(s int) {
+ b.w.Size += s
+ b.pf("// Size: %d bytes", s)
+}
+
+func (b *builder) writeConst(name string, x interface{}) {
+ b.comment(name)
+ b.w.WriteConst(name, x)
+}
+
+// writeConsts computes f(v) for all v in values and writes the results
+// as constants named _v to a single constant block.
+func (b *builder) writeConsts(f func(string) int, values ...string) {
+ b.pf("const (")
+ for _, v := range values {
+ b.pf("\t_%s = %v", v, f(v))
+ }
+ b.pf(")")
+}
+
+// writeType writes the type of the given value, which must be a struct.
+func (b *builder) writeType(value interface{}) {
+ b.comment(reflect.TypeOf(value).Name())
+ b.w.WriteType(value)
+}
+
+func (b *builder) writeSlice(name string, ss interface{}) {
+ b.writeSliceAddSize(name, 0, ss)
+}
+
+func (b *builder) writeSliceAddSize(name string, extraSize int, ss interface{}) {
+ b.comment(name)
+ b.w.Size += extraSize
+ v := reflect.ValueOf(ss)
+ t := v.Type().Elem()
+ b.pf("// Size: %d bytes, %d elements", v.Len()*int(t.Size())+extraSize, v.Len())
+
+ fmt.Fprintf(b.w, "var %s = ", name)
+ b.w.WriteArray(ss)
+ b.p()
+}
+
+type FromTo struct {
+ From, To uint16
+}
+
+func (b *builder) writeSortedMap(name string, ss *stringSet, index func(s string) uint16) {
+ ss.sortFunc(func(a, b string) bool {
+ return index(a) < index(b)
+ })
+ m := []FromTo{}
+ for _, s := range ss.s {
+ m = append(m, FromTo{index(s), index(ss.update[s])})
+ }
+ b.writeSlice(name, m)
+}
+
+const base = 'z' - 'a' + 1
+
+func strToInt(s string) uint {
+ v := uint(0)
+ for i := 0; i < len(s); i++ {
+ v *= base
+ v += uint(s[i] - 'a')
+ }
+ return v
+}
+
+// converts the given integer to the original ASCII string passed to strToInt.
+// len(s) must match the number of characters obtained.
+func intToStr(v uint, s []byte) {
+ for i := len(s) - 1; i >= 0; i-- {
+ s[i] = byte(v%base) + 'a'
+ v /= base
+ }
+}
+
+func (b *builder) writeBitVector(name string, ss []string) {
+ vec := make([]uint8, int(math.Ceil(math.Pow(base, float64(len(ss[0])))/8)))
+ for _, s := range ss {
+ v := strToInt(s)
+ vec[v/8] |= 1 << (v % 8)
+ }
+ b.writeSlice(name, vec)
+}
+
+// TODO: convert this type into a list or two-stage trie.
+func (b *builder) writeMapFunc(name string, m map[string]string, f func(string) uint16) {
+ b.comment(name)
+ v := reflect.ValueOf(m)
+ sz := v.Len() * (2 + int(v.Type().Key().Size()))
+ for _, k := range m {
+ sz += len(k)
+ }
+ b.addSize(sz)
+ keys := []string{}
+ b.pf(`var %s = map[string]uint16{`, name)
+ for k := range m {
+ keys = append(keys, k)
+ }
+ sort.Strings(keys)
+ for _, k := range keys {
+ b.pf("\t%q: %v,", k, f(m[k]))
+ }
+ b.p("}")
+}
+
+func (b *builder) writeMap(name string, m interface{}) {
+ b.comment(name)
+ v := reflect.ValueOf(m)
+ sz := v.Len() * (2 + int(v.Type().Key().Size()) + int(v.Type().Elem().Size()))
+ b.addSize(sz)
+ f := strings.FieldsFunc(fmt.Sprintf("%#v", m), func(r rune) bool {
+ return strings.IndexRune("{}, ", r) != -1
+ })
+ sort.Strings(f[1:])
+ b.pf(`var %s = %s{`, name, f[0])
+ for _, kv := range f[1:] {
+ b.pf("\t%s,", kv)
+ }
+ b.p("}")
+}
+
+func (b *builder) langIndex(s string) uint16 {
+ if s == "und" {
+ return 0
+ }
+ if i, ok := b.lang.find(s); ok {
+ return uint16(i)
+ }
+ return uint16(strToInt(s)) + uint16(len(b.lang.s))
+}
+
+// inc advances the string to its lexicographical successor.
+func inc(s string) string {
+ const maxTagLength = 4
+ var buf [maxTagLength]byte
+ intToStr(strToInt(strings.ToLower(s))+1, buf[:len(s)])
+ for i := 0; i < len(s); i++ {
+ if s[i] <= 'Z' {
+ buf[i] -= 'a' - 'A'
+ }
+ }
+ return string(buf[:len(s)])
+}
+
+func (b *builder) parseIndices() {
+ meta := b.supp.Metadata
+
+ for k, v := range b.registry {
+ var ss *stringSet
+ switch v.typ {
+ case "language":
+ if len(k) == 2 || v.suppressScript != "" || v.scope == "special" {
+ b.lang.add(k)
+ continue
+ } else {
+ ss = &b.langNoIndex
+ }
+ case "region":
+ ss = &b.region
+ case "script":
+ ss = &b.script
+ case "variant":
+ ss = &b.variant
+ default:
+ continue
+ }
+ ss.add(k)
+ }
+ // Include any language for which there is data.
+ for _, lang := range b.data.Locales() {
+ if x := b.data.RawLDML(lang); false ||
+ x.LocaleDisplayNames != nil ||
+ x.Characters != nil ||
+ x.Delimiters != nil ||
+ x.Measurement != nil ||
+ x.Dates != nil ||
+ x.Numbers != nil ||
+ x.Units != nil ||
+ x.ListPatterns != nil ||
+ x.Collations != nil ||
+ x.Segmentations != nil ||
+ x.Rbnf != nil ||
+ x.Annotations != nil ||
+ x.Metadata != nil {
+
+ from := strings.Split(lang, "_")
+ if lang := from[0]; lang != "root" {
+ b.lang.add(lang)
+ }
+ }
+ }
+ // Include locales for plural rules, which uses a different structure.
+ for _, plurals := range b.data.Supplemental().Plurals {
+ for _, rules := range plurals.PluralRules {
+ for _, lang := range strings.Split(rules.Locales, " ") {
+ if lang = strings.Split(lang, "_")[0]; lang != "root" {
+ b.lang.add(lang)
+ }
+ }
+ }
+ }
+ // Include languages in likely subtags.
+ for _, m := range b.supp.LikelySubtags.LikelySubtag {
+ from := strings.Split(m.From, "_")
+ b.lang.add(from[0])
+ }
+ // Include ISO-639 alpha-3 bibliographic entries.
+ for _, a := range meta.Alias.LanguageAlias {
+ if a.Reason == "bibliographic" {
+ b.langNoIndex.add(a.Type)
+ }
+ }
+ // Include regions in territoryAlias (not all are in the IANA registry!)
+ for _, reg := range b.supp.Metadata.Alias.TerritoryAlias {
+ if len(reg.Type) == 2 {
+ b.region.add(reg.Type)
+ }
+ }
+
+ for _, s := range b.lang.s {
+ if len(s) == 3 {
+ b.langNoIndex.remove(s)
+ }
+ }
+ b.writeConst("NumLanguages", len(b.lang.slice())+len(b.langNoIndex.slice()))
+ b.writeConst("NumScripts", len(b.script.slice()))
+ b.writeConst("NumRegions", len(b.region.slice()))
+
+ // Add dummy codes at the start of each list to represent "unspecified".
+ b.lang.add("---")
+ b.script.add("----")
+ b.region.add("---")
+
+ // common locales
+ b.locale.parse(meta.DefaultContent.Locales)
+}
+
+// TODO: region inclusion data will probably not be use used in future matchers.
+
+func (b *builder) computeRegionGroups() {
+ b.groups = make(map[int]index)
+
+ // Create group indices.
+ for i := 1; b.region.s[i][0] < 'A'; i++ { // Base M49 indices on regionID.
+ b.groups[i] = index(len(b.groups))
+ }
+ for _, g := range b.supp.TerritoryContainment.Group {
+ // Skip UN and EURO zone as they are flattening the containment
+ // relationship.
+ if g.Type == "EZ" || g.Type == "UN" {
+ continue
+ }
+ group := b.region.index(g.Type)
+ if _, ok := b.groups[group]; !ok {
+ b.groups[group] = index(len(b.groups))
+ }
+ }
+ if len(b.groups) > 64 {
+ log.Fatalf("only 64 groups supported, found %d", len(b.groups))
+ }
+ b.writeConst("nRegionGroups", len(b.groups))
+}
+
+var langConsts = []string{
+ "af", "am", "ar", "az", "bg", "bn", "ca", "cs", "da", "de", "el", "en", "es",
+ "et", "fa", "fi", "fil", "fr", "gu", "he", "hi", "hr", "hu", "hy", "id", "is",
+ "it", "ja", "ka", "kk", "km", "kn", "ko", "ky", "lo", "lt", "lv", "mk", "ml",
+ "mn", "mo", "mr", "ms", "mul", "my", "nb", "ne", "nl", "no", "pa", "pl", "pt",
+ "ro", "ru", "sh", "si", "sk", "sl", "sq", "sr", "sv", "sw", "ta", "te", "th",
+ "tl", "tn", "tr", "uk", "ur", "uz", "vi", "zh", "zu",
+
+ // constants for grandfathered tags (if not already defined)
+ "jbo", "ami", "bnn", "hak", "tlh", "lb", "nv", "pwn", "tao", "tay", "tsu",
+ "nn", "sfb", "vgt", "sgg", "cmn", "nan", "hsn",
+}
+
+// writeLanguage generates all tables needed for language canonicalization.
+func (b *builder) writeLanguage() {
+ meta := b.supp.Metadata
+
+ b.writeConst("nonCanonicalUnd", b.lang.index("und"))
+ b.writeConsts(func(s string) int { return int(b.langIndex(s)) }, langConsts...)
+ b.writeConst("langPrivateStart", b.langIndex("qaa"))
+ b.writeConst("langPrivateEnd", b.langIndex("qtz"))
+
+ // Get language codes that need to be mapped (overlong 3-letter codes,
+ // deprecated 2-letter codes, legacy and grandfathered tags.)
+ langAliasMap := stringSet{}
+ aliasTypeMap := map[string]AliasType{}
+
+ // altLangISO3 get the alternative ISO3 names that need to be mapped.
+ altLangISO3 := stringSet{}
+ // Add dummy start to avoid the use of index 0.
+ altLangISO3.add("---")
+ altLangISO3.updateLater("---", "aa")
+
+ lang := b.lang.clone()
+ for _, a := range meta.Alias.LanguageAlias {
+ if a.Replacement == "" {
+ a.Replacement = "und"
+ }
+ // TODO: support mapping to tags
+ repl := strings.SplitN(a.Replacement, "_", 2)[0]
+ if a.Reason == "overlong" {
+ if len(a.Replacement) == 2 && len(a.Type) == 3 {
+ lang.updateLater(a.Replacement, a.Type)
+ }
+ } else if len(a.Type) <= 3 {
+ switch a.Reason {
+ case "macrolanguage":
+ aliasTypeMap[a.Type] = Macro
+ case "deprecated":
+ // handled elsewhere
+ continue
+ case "bibliographic", "legacy":
+ if a.Type == "no" {
+ continue
+ }
+ aliasTypeMap[a.Type] = Legacy
+ default:
+ log.Fatalf("new %s alias: %s", a.Reason, a.Type)
+ }
+ langAliasMap.add(a.Type)
+ langAliasMap.updateLater(a.Type, repl)
+ }
+ }
+ // Manually add the mapping of "nb" (Norwegian) to its macro language.
+ // This can be removed if CLDR adopts this change.
+ langAliasMap.add("nb")
+ langAliasMap.updateLater("nb", "no")
+ aliasTypeMap["nb"] = Macro
+
+ for k, v := range b.registry {
+ // Also add deprecated values for 3-letter ISO codes, which CLDR omits.
+ if v.typ == "language" && v.deprecated != "" && v.preferred != "" {
+ langAliasMap.add(k)
+ langAliasMap.updateLater(k, v.preferred)
+ aliasTypeMap[k] = Deprecated
+ }
+ }
+ // Fix CLDR mappings.
+ lang.updateLater("tl", "tgl")
+ lang.updateLater("sh", "hbs")
+ lang.updateLater("mo", "mol")
+ lang.updateLater("no", "nor")
+ lang.updateLater("tw", "twi")
+ lang.updateLater("nb", "nob")
+ lang.updateLater("ak", "aka")
+ lang.updateLater("bh", "bih")
+
+ // Ensure that each 2-letter code is matched with a 3-letter code.
+ for _, v := range lang.s[1:] {
+ s, ok := lang.update[v]
+ if !ok {
+ if s, ok = lang.update[langAliasMap.update[v]]; !ok {
+ continue
+ }
+ lang.update[v] = s
+ }
+ if v[0] != s[0] {
+ altLangISO3.add(s)
+ altLangISO3.updateLater(s, v)
+ }
+ }
+
+ // Complete canonicalized language tags.
+ lang.freeze()
+ for i, v := range lang.s {
+ // We can avoid these manual entries by using the IANA registry directly.
+ // Seems easier to update the list manually, as changes are rare.
+ // The panic in this loop will trigger if we miss an entry.
+ add := ""
+ if s, ok := lang.update[v]; ok {
+ if s[0] == v[0] {
+ add = s[1:]
+ } else {
+ add = string([]byte{0, byte(altLangISO3.index(s))})
+ }
+ } else if len(v) == 3 {
+ add = "\x00"
+ } else {
+ log.Panicf("no data for long form of %q", v)
+ }
+ lang.s[i] += add
+ }
+ b.writeConst("lang", tag.Index(lang.join()))
+
+ b.writeConst("langNoIndexOffset", len(b.lang.s))
+
+ // space of all valid 3-letter language identifiers.
+ b.writeBitVector("langNoIndex", b.langNoIndex.slice())
+
+ altLangIndex := []uint16{}
+ for i, s := range altLangISO3.slice() {
+ altLangISO3.s[i] += string([]byte{byte(len(altLangIndex))})
+ if i > 0 {
+ idx := b.lang.index(altLangISO3.update[s])
+ altLangIndex = append(altLangIndex, uint16(idx))
+ }
+ }
+ b.writeConst("altLangISO3", tag.Index(altLangISO3.join()))
+ b.writeSlice("altLangIndex", altLangIndex)
+
+ b.writeSortedMap("AliasMap", &langAliasMap, b.langIndex)
+ types := make([]AliasType, len(langAliasMap.s))
+ for i, s := range langAliasMap.s {
+ types[i] = aliasTypeMap[s]
+ }
+ b.writeSlice("AliasTypes", types)
+}
+
+var scriptConsts = []string{
+ "Latn", "Hani", "Hans", "Hant", "Qaaa", "Qaai", "Qabx", "Zinh", "Zyyy",
+ "Zzzz",
+}
+
+func (b *builder) writeScript() {
+ b.writeConsts(b.script.index, scriptConsts...)
+ b.writeConst("script", tag.Index(b.script.join()))
+
+ supp := make([]uint8, len(b.lang.slice()))
+ for i, v := range b.lang.slice()[1:] {
+ if sc := b.registry[v].suppressScript; sc != "" {
+ supp[i+1] = uint8(b.script.index(sc))
+ }
+ }
+ b.writeSlice("suppressScript", supp)
+
+ // There is only one deprecated script in CLDR. This value is hard-coded.
+ // We check here if the code must be updated.
+ for _, a := range b.supp.Metadata.Alias.ScriptAlias {
+ if a.Type != "Qaai" {
+ log.Panicf("unexpected deprecated stript %q", a.Type)
+ }
+ }
+}
+
+func parseM49(s string) int16 {
+ if len(s) == 0 {
+ return 0
+ }
+ v, err := strconv.ParseUint(s, 10, 10)
+ failOnError(err)
+ return int16(v)
+}
+
+var regionConsts = []string{
+ "001", "419", "BR", "CA", "ES", "GB", "MD", "PT", "UK", "US",
+ "ZZ", "XA", "XC", "XK", // Unofficial tag for Kosovo.
+}
+
+func (b *builder) writeRegion() {
+ b.writeConsts(b.region.index, regionConsts...)
+
+ isoOffset := b.region.index("AA")
+ m49map := make([]int16, len(b.region.slice()))
+ fromM49map := make(map[int16]int)
+ altRegionISO3 := ""
+ altRegionIDs := []uint16{}
+
+ b.writeConst("isoRegionOffset", isoOffset)
+
+ // 2-letter region lookup and mapping to numeric codes.
+ regionISO := b.region.clone()
+ regionISO.s = regionISO.s[isoOffset:]
+ regionISO.sorted = false
+
+ regionTypes := make([]byte, len(b.region.s))
+
+ // Is the region valid BCP 47?
+ for s, e := range b.registry {
+ if len(s) == 2 && s == strings.ToUpper(s) {
+ i := b.region.index(s)
+ for _, d := range e.description {
+ if strings.Contains(d, "Private use") {
+ regionTypes[i] = iso3166UserAssigned
+ }
+ }
+ regionTypes[i] |= bcp47Region
+ }
+ }
+
+ // Is the region a valid ccTLD?
+ r := gen.OpenIANAFile("domains/root/db")
+ defer r.Close()
+
+ buf, err := ioutil.ReadAll(r)
+ failOnError(err)
+ re := regexp.MustCompile(`"/domains/root/db/([a-z]{2}).html"`)
+ for _, m := range re.FindAllSubmatch(buf, -1) {
+ i := b.region.index(strings.ToUpper(string(m[1])))
+ regionTypes[i] |= ccTLD
+ }
+
+ b.writeSlice("regionTypes", regionTypes)
+
+ iso3Set := make(map[string]int)
+ update := func(iso2, iso3 string) {
+ i := regionISO.index(iso2)
+ if j, ok := iso3Set[iso3]; !ok && iso3[0] == iso2[0] {
+ regionISO.s[i] += iso3[1:]
+ iso3Set[iso3] = -1
+ } else {
+ if ok && j >= 0 {
+ regionISO.s[i] += string([]byte{0, byte(j)})
+ } else {
+ iso3Set[iso3] = len(altRegionISO3)
+ regionISO.s[i] += string([]byte{0, byte(len(altRegionISO3))})
+ altRegionISO3 += iso3
+ altRegionIDs = append(altRegionIDs, uint16(isoOffset+i))
+ }
+ }
+ }
+ for _, tc := range b.supp.CodeMappings.TerritoryCodes {
+ i := regionISO.index(tc.Type) + isoOffset
+ if d := m49map[i]; d != 0 {
+ log.Panicf("%s found as a duplicate UN.M49 code of %03d", tc.Numeric, d)
+ }
+ m49 := parseM49(tc.Numeric)
+ m49map[i] = m49
+ if r := fromM49map[m49]; r == 0 {
+ fromM49map[m49] = i
+ } else if r != i {
+ dep := b.registry[regionISO.s[r-isoOffset]].deprecated
+ if t := b.registry[tc.Type]; t != nil && dep != "" && (t.deprecated == "" || t.deprecated > dep) {
+ fromM49map[m49] = i
+ }
+ }
+ }
+ for _, ta := range b.supp.Metadata.Alias.TerritoryAlias {
+ if len(ta.Type) == 3 && ta.Type[0] <= '9' && len(ta.Replacement) == 2 {
+ from := parseM49(ta.Type)
+ if r := fromM49map[from]; r == 0 {
+ fromM49map[from] = regionISO.index(ta.Replacement) + isoOffset
+ }
+ }
+ }
+ for _, tc := range b.supp.CodeMappings.TerritoryCodes {
+ if len(tc.Alpha3) == 3 {
+ update(tc.Type, tc.Alpha3)
+ }
+ }
+ // This entries are not included in territoryCodes. Mostly 3-letter variants
+ // of deleted codes and an entry for QU.
+ for _, m := range []struct{ iso2, iso3 string }{
+ {"CT", "CTE"},
+ {"DY", "DHY"},
+ {"HV", "HVO"},
+ {"JT", "JTN"},
+ {"MI", "MID"},
+ {"NH", "NHB"},
+ {"NQ", "ATN"},
+ {"PC", "PCI"},
+ {"PU", "PUS"},
+ {"PZ", "PCZ"},
+ {"RH", "RHO"},
+ {"VD", "VDR"},
+ {"WK", "WAK"},
+ // These three-letter codes are used for others as well.
+ {"FQ", "ATF"},
+ } {
+ update(m.iso2, m.iso3)
+ }
+ for i, s := range regionISO.s {
+ if len(s) != 4 {
+ regionISO.s[i] = s + " "
+ }
+ }
+ b.writeConst("regionISO", tag.Index(regionISO.join()))
+ b.writeConst("altRegionISO3", altRegionISO3)
+ b.writeSlice("altRegionIDs", altRegionIDs)
+
+ // Create list of deprecated regions.
+ // TODO: consider inserting SF -> FI. Not included by CLDR, but is the only
+ // Transitionally-reserved mapping not included.
+ regionOldMap := stringSet{}
+ // Include regions in territoryAlias (not all are in the IANA registry!)
+ for _, reg := range b.supp.Metadata.Alias.TerritoryAlias {
+ if len(reg.Type) == 2 && reg.Reason == "deprecated" && len(reg.Replacement) == 2 {
+ regionOldMap.add(reg.Type)
+ regionOldMap.updateLater(reg.Type, reg.Replacement)
+ i, _ := regionISO.find(reg.Type)
+ j, _ := regionISO.find(reg.Replacement)
+ if k := m49map[i+isoOffset]; k == 0 {
+ m49map[i+isoOffset] = m49map[j+isoOffset]
+ }
+ }
+ }
+ b.writeSortedMap("regionOldMap", &regionOldMap, func(s string) uint16 {
+ return uint16(b.region.index(s))
+ })
+ // 3-digit region lookup, groupings.
+ for i := 1; i < isoOffset; i++ {
+ m := parseM49(b.region.s[i])
+ m49map[i] = m
+ fromM49map[m] = i
+ }
+ b.writeSlice("m49", m49map)
+
+ const (
+ searchBits = 7
+ regionBits = 9
+ )
+ if len(m49map) >= 1<<regionBits {
+ log.Fatalf("Maximum number of regions exceeded: %d > %d", len(m49map), 1<<regionBits)
+ }
+ m49Index := [9]int16{}
+ fromM49 := []uint16{}
+ m49 := []int{}
+ for k, _ := range fromM49map {
+ m49 = append(m49, int(k))
+ }
+ sort.Ints(m49)
+ for _, k := range m49[1:] {
+ val := (k & (1<<searchBits - 1)) << regionBits
+ fromM49 = append(fromM49, uint16(val|fromM49map[int16(k)]))
+ m49Index[1:][k>>searchBits] = int16(len(fromM49))
+ }
+ b.writeSlice("m49Index", m49Index)
+ b.writeSlice("fromM49", fromM49)
+}
+
+const (
+ // TODO: put these lists in regionTypes as user data? Could be used for
+ // various optimizations and refinements and could be exposed in the API.
+ iso3166Except = "AC CP DG EA EU FX IC SU TA UK"
+ iso3166Trans = "AN BU CS NT TP YU ZR" // SF is not in our set of Regions.
+ // DY and RH are actually not deleted, but indeterminately reserved.
+ iso3166DelCLDR = "CT DD DY FQ HV JT MI NH NQ PC PU PZ RH VD WK YD"
+)
+
+const (
+ iso3166UserAssigned = 1 << iota
+ ccTLD
+ bcp47Region
+)
+
+func find(list []string, s string) int {
+ for i, t := range list {
+ if t == s {
+ return i
+ }
+ }
+ return -1
+}
+
+// writeVariants generates per-variant information and creates a map from variant
+// name to index value. We assign index values such that sorting multiple
+// variants by index value will result in the correct order.
+// There are two types of variants: specialized and general. Specialized variants
+// are only applicable to certain language or language-script pairs. Generalized
+// variants apply to any language. Generalized variants always sort after
+// specialized variants. We will therefore always assign a higher index value
+// to a generalized variant than any other variant. Generalized variants are
+// sorted alphabetically among themselves.
+// Specialized variants may also sort after other specialized variants. Such
+// variants will be ordered after any of the variants they may follow.
+// We assume that if a variant x is followed by a variant y, then for any prefix
+// p of x, p-x is a prefix of y. This allows us to order tags based on the
+// maximum of the length of any of its prefixes.
+// TODO: it is possible to define a set of Prefix values on variants such that
+// a total order cannot be defined to the point that this algorithm breaks.
+// In other words, we cannot guarantee the same order of variants for the
+// future using the same algorithm or for non-compliant combinations of
+// variants. For this reason, consider using simple alphabetic sorting
+// of variants and ignore Prefix restrictions altogether.
+func (b *builder) writeVariant() {
+ generalized := stringSet{}
+ specialized := stringSet{}
+ specializedExtend := stringSet{}
+ // Collate the variants by type and check assumptions.
+ for _, v := range b.variant.slice() {
+ e := b.registry[v]
+ if len(e.prefix) == 0 {
+ generalized.add(v)
+ continue
+ }
+ c := strings.Split(e.prefix[0], "-")
+ hasScriptOrRegion := false
+ if len(c) > 1 {
+ _, hasScriptOrRegion = b.script.find(c[1])
+ if !hasScriptOrRegion {
+ _, hasScriptOrRegion = b.region.find(c[1])
+
+ }
+ }
+ if len(c) == 1 || len(c) == 2 && hasScriptOrRegion {
+ // Variant is preceded by a language.
+ specialized.add(v)
+ continue
+ }
+ // Variant is preceded by another variant.
+ specializedExtend.add(v)
+ prefix := c[0] + "-"
+ if hasScriptOrRegion {
+ prefix += c[1]
+ }
+ for _, p := range e.prefix {
+ // Verify that the prefix minus the last element is a prefix of the
+ // predecessor element.
+ i := strings.LastIndex(p, "-")
+ pred := b.registry[p[i+1:]]
+ if find(pred.prefix, p[:i]) < 0 {
+ log.Fatalf("prefix %q for variant %q not consistent with predecessor spec", p, v)
+ }
+ // The sorting used below does not work in the general case. It works
+ // if we assume that variants that may be followed by others only have
+ // prefixes of the same length. Verify this.
+ count := strings.Count(p[:i], "-")
+ for _, q := range pred.prefix {
+ if c := strings.Count(q, "-"); c != count {
+ log.Fatalf("variant %q preceding %q has a prefix %q of size %d; want %d", p[i+1:], v, q, c, count)
+ }
+ }
+ if !strings.HasPrefix(p, prefix) {
+ log.Fatalf("prefix %q of variant %q should start with %q", p, v, prefix)
+ }
+ }
+ }
+
+ // Sort extended variants.
+ a := specializedExtend.s
+ less := func(v, w string) bool {
+ // Sort by the maximum number of elements.
+ maxCount := func(s string) (max int) {
+ for _, p := range b.registry[s].prefix {
+ if c := strings.Count(p, "-"); c > max {
+ max = c
+ }
+ }
+ return
+ }
+ if cv, cw := maxCount(v), maxCount(w); cv != cw {
+ return cv < cw
+ }
+ // Sort by name as tie breaker.
+ return v < w
+ }
+ sort.Sort(funcSorter{less, sort.StringSlice(a)})
+ specializedExtend.frozen = true
+
+ // Create index from variant name to index.
+ variantIndex := make(map[string]uint8)
+ add := func(s []string) {
+ for _, v := range s {
+ variantIndex[v] = uint8(len(variantIndex))
+ }
+ }
+ add(specialized.slice())
+ add(specializedExtend.s)
+ numSpecialized := len(variantIndex)
+ add(generalized.slice())
+ if n := len(variantIndex); n > 255 {
+ log.Fatalf("maximum number of variants exceeded: was %d; want <= 255", n)
+ }
+ b.writeMap("variantIndex", variantIndex)
+ b.writeConst("variantNumSpecialized", numSpecialized)
+}
+
+func (b *builder) writeLanguageInfo() {
+}
+
+// writeLikelyData writes tables that are used both for finding parent relations and for
+// language matching. Each entry contains additional bits to indicate the status of the
+// data to know when it cannot be used for parent relations.
+func (b *builder) writeLikelyData() {
+ const (
+ isList = 1 << iota
+ scriptInFrom
+ regionInFrom
+ )
+ type ( // generated types
+ likelyScriptRegion struct {
+ region uint16
+ script uint8
+ flags uint8
+ }
+ likelyLangScript struct {
+ lang uint16
+ script uint8
+ flags uint8
+ }
+ likelyLangRegion struct {
+ lang uint16
+ region uint16
+ }
+ // likelyTag is used for getting likely tags for group regions, where
+ // the likely region might be a region contained in the group.
+ likelyTag struct {
+ lang uint16
+ region uint16
+ script uint8
+ }
+ )
+ var ( // generated variables
+ likelyRegionGroup = make([]likelyTag, len(b.groups))
+ likelyLang = make([]likelyScriptRegion, len(b.lang.s))
+ likelyRegion = make([]likelyLangScript, len(b.region.s))
+ likelyScript = make([]likelyLangRegion, len(b.script.s))
+ likelyLangList = []likelyScriptRegion{}
+ likelyRegionList = []likelyLangScript{}
+ )
+ type fromTo struct {
+ from, to []string
+ }
+ langToOther := map[int][]fromTo{}
+ regionToOther := map[int][]fromTo{}
+ for _, m := range b.supp.LikelySubtags.LikelySubtag {
+ from := strings.Split(m.From, "_")
+ to := strings.Split(m.To, "_")
+ if len(to) != 3 {
+ log.Fatalf("invalid number of subtags in %q: found %d, want 3", m.To, len(to))
+ }
+ if len(from) > 3 {
+ log.Fatalf("invalid number of subtags: found %d, want 1-3", len(from))
+ }
+ if from[0] != to[0] && from[0] != "und" {
+ log.Fatalf("unexpected language change in expansion: %s -> %s", from, to)
+ }
+ if len(from) == 3 {
+ if from[2] != to[2] {
+ log.Fatalf("unexpected region change in expansion: %s -> %s", from, to)
+ }
+ if from[0] != "und" {
+ log.Fatalf("unexpected fully specified from tag: %s -> %s", from, to)
+ }
+ }
+ if len(from) == 1 || from[0] != "und" {
+ id := 0
+ if from[0] != "und" {
+ id = b.lang.index(from[0])
+ }
+ langToOther[id] = append(langToOther[id], fromTo{from, to})
+ } else if len(from) == 2 && len(from[1]) == 4 {
+ sid := b.script.index(from[1])
+ likelyScript[sid].lang = uint16(b.langIndex(to[0]))
+ likelyScript[sid].region = uint16(b.region.index(to[2]))
+ } else {
+ r := b.region.index(from[len(from)-1])
+ if id, ok := b.groups[r]; ok {
+ if from[0] != "und" {
+ log.Fatalf("region changed unexpectedly: %s -> %s", from, to)
+ }
+ likelyRegionGroup[id].lang = uint16(b.langIndex(to[0]))
+ likelyRegionGroup[id].script = uint8(b.script.index(to[1]))
+ likelyRegionGroup[id].region = uint16(b.region.index(to[2]))
+ } else {
+ regionToOther[r] = append(regionToOther[r], fromTo{from, to})
+ }
+ }
+ }
+ b.writeType(likelyLangRegion{})
+ b.writeSlice("likelyScript", likelyScript)
+
+ for id := range b.lang.s {
+ list := langToOther[id]
+ if len(list) == 1 {
+ likelyLang[id].region = uint16(b.region.index(list[0].to[2]))
+ likelyLang[id].script = uint8(b.script.index(list[0].to[1]))
+ } else if len(list) > 1 {
+ likelyLang[id].flags = isList
+ likelyLang[id].region = uint16(len(likelyLangList))
+ likelyLang[id].script = uint8(len(list))
+ for _, x := range list {
+ flags := uint8(0)
+ if len(x.from) > 1 {
+ if x.from[1] == x.to[2] {
+ flags = regionInFrom
+ } else {
+ flags = scriptInFrom
+ }
+ }
+ likelyLangList = append(likelyLangList, likelyScriptRegion{
+ region: uint16(b.region.index(x.to[2])),
+ script: uint8(b.script.index(x.to[1])),
+ flags: flags,
+ })
+ }
+ }
+ }
+ // TODO: merge suppressScript data with this table.
+ b.writeType(likelyScriptRegion{})
+ b.writeSlice("likelyLang", likelyLang)
+ b.writeSlice("likelyLangList", likelyLangList)
+
+ for id := range b.region.s {
+ list := regionToOther[id]
+ if len(list) == 1 {
+ likelyRegion[id].lang = uint16(b.langIndex(list[0].to[0]))
+ likelyRegion[id].script = uint8(b.script.index(list[0].to[1]))
+ if len(list[0].from) > 2 {
+ likelyRegion[id].flags = scriptInFrom
+ }
+ } else if len(list) > 1 {
+ likelyRegion[id].flags = isList
+ likelyRegion[id].lang = uint16(len(likelyRegionList))
+ likelyRegion[id].script = uint8(len(list))
+ for i, x := range list {
+ if len(x.from) == 2 && i != 0 || i > 0 && len(x.from) != 3 {
+ log.Fatalf("unspecified script must be first in list: %v at %d", x.from, i)
+ }
+ x := likelyLangScript{
+ lang: uint16(b.langIndex(x.to[0])),
+ script: uint8(b.script.index(x.to[1])),
+ }
+ if len(list[0].from) > 2 {
+ x.flags = scriptInFrom
+ }
+ likelyRegionList = append(likelyRegionList, x)
+ }
+ }
+ }
+ b.writeType(likelyLangScript{})
+ b.writeSlice("likelyRegion", likelyRegion)
+ b.writeSlice("likelyRegionList", likelyRegionList)
+
+ b.writeType(likelyTag{})
+ b.writeSlice("likelyRegionGroup", likelyRegionGroup)
+}
+
+func (b *builder) writeRegionInclusionData() {
+ var (
+ // mm holds for each group the set of groups with a distance of 1.
+ mm = make(map[int][]index)
+
+ // containment holds for each group the transitive closure of
+ // containment of other groups.
+ containment = make(map[index][]index)
+ )
+ for _, g := range b.supp.TerritoryContainment.Group {
+ // Skip UN and EURO zone as they are flattening the containment
+ // relationship.
+ if g.Type == "EZ" || g.Type == "UN" {
+ continue
+ }
+ group := b.region.index(g.Type)
+ groupIdx := b.groups[group]
+ for _, mem := range strings.Split(g.Contains, " ") {
+ r := b.region.index(mem)
+ mm[r] = append(mm[r], groupIdx)
+ if g, ok := b.groups[r]; ok {
+ mm[group] = append(mm[group], g)
+ containment[groupIdx] = append(containment[groupIdx], g)
+ }
+ }
+ }
+
+ regionContainment := make([]uint64, len(b.groups))
+ for _, g := range b.groups {
+ l := containment[g]
+
+ // Compute the transitive closure of containment.
+ for i := 0; i < len(l); i++ {
+ l = append(l, containment[l[i]]...)
+ }
+
+ // Compute the bitmask.
+ regionContainment[g] = 1 << g
+ for _, v := range l {
+ regionContainment[g] |= 1 << v
+ }
+ }
+ b.writeSlice("regionContainment", regionContainment)
+
+ regionInclusion := make([]uint8, len(b.region.s))
+ bvs := make(map[uint64]index)
+ // Make the first bitvector positions correspond with the groups.
+ for r, i := range b.groups {
+ bv := uint64(1 << i)
+ for _, g := range mm[r] {
+ bv |= 1 << g
+ }
+ bvs[bv] = i
+ regionInclusion[r] = uint8(bvs[bv])
+ }
+ for r := 1; r < len(b.region.s); r++ {
+ if _, ok := b.groups[r]; !ok {
+ bv := uint64(0)
+ for _, g := range mm[r] {
+ bv |= 1 << g
+ }
+ if bv == 0 {
+ // Pick the world for unspecified regions.
+ bv = 1 << b.groups[b.region.index("001")]
+ }
+ if _, ok := bvs[bv]; !ok {
+ bvs[bv] = index(len(bvs))
+ }
+ regionInclusion[r] = uint8(bvs[bv])
+ }
+ }
+ b.writeSlice("regionInclusion", regionInclusion)
+ regionInclusionBits := make([]uint64, len(bvs))
+ for k, v := range bvs {
+ regionInclusionBits[v] = uint64(k)
+ }
+ // Add bit vectors for increasingly large distances until a fixed point is reached.
+ regionInclusionNext := []uint8{}
+ for i := 0; i < len(regionInclusionBits); i++ {
+ bits := regionInclusionBits[i]
+ next := bits
+ for i := uint(0); i < uint(len(b.groups)); i++ {
+ if bits&(1<<i) != 0 {
+ next |= regionInclusionBits[i]
+ }
+ }
+ if _, ok := bvs[next]; !ok {
+ bvs[next] = index(len(bvs))
+ regionInclusionBits = append(regionInclusionBits, next)
+ }
+ regionInclusionNext = append(regionInclusionNext, uint8(bvs[next]))
+ }
+ b.writeSlice("regionInclusionBits", regionInclusionBits)
+ b.writeSlice("regionInclusionNext", regionInclusionNext)
+}
+
+type parentRel struct {
+ lang uint16
+ script uint8
+ maxScript uint8
+ toRegion uint16
+ fromRegion []uint16
+}
+
+func (b *builder) writeParents() {
+ b.writeType(parentRel{})
+
+ parents := []parentRel{}
+
+ // Construct parent overrides.
+ n := 0
+ for _, p := range b.data.Supplemental().ParentLocales.ParentLocale {
+ // Skipping non-standard scripts to root is implemented using addTags.
+ if p.Parent == "root" {
+ continue
+ }
+
+ sub := strings.Split(p.Parent, "_")
+ parent := parentRel{lang: b.langIndex(sub[0])}
+ if len(sub) == 2 {
+ // TODO: check that all undefined scripts are indeed Latn in these
+ // cases.
+ parent.maxScript = uint8(b.script.index("Latn"))
+ parent.toRegion = uint16(b.region.index(sub[1]))
+ } else {
+ parent.script = uint8(b.script.index(sub[1]))
+ parent.maxScript = parent.script
+ parent.toRegion = uint16(b.region.index(sub[2]))
+ }
+ for _, c := range strings.Split(p.Locales, " ") {
+ region := b.region.index(c[strings.LastIndex(c, "_")+1:])
+ parent.fromRegion = append(parent.fromRegion, uint16(region))
+ }
+ parents = append(parents, parent)
+ n += len(parent.fromRegion)
+ }
+ b.writeSliceAddSize("parents", n*2, parents)
+}
+
+func main() {
+ gen.Init()
+
+ gen.Repackage("gen_common.go", "common.go", "language")
+
+ w := gen.NewCodeWriter()
+ defer w.WriteGoFile("tables.go", "language")
+
+ fmt.Fprintln(w, `import "golang.org/x/text/internal/tag"`)
+
+ b := newBuilder(w)
+ gen.WriteCLDRVersion(w)
+
+ b.parseIndices()
+ b.writeType(FromTo{})
+ b.writeLanguage()
+ b.writeScript()
+ b.writeRegion()
+ b.writeVariant()
+ // TODO: b.writeLocale()
+ b.computeRegionGroups()
+ b.writeLikelyData()
+ b.writeRegionInclusionData()
+ b.writeParents()
+}
diff --git a/vendor/golang.org/x/text/internal/language/gen_common.go b/vendor/golang.org/x/text/internal/language/gen_common.go
new file mode 100644
index 0000000..c419cee
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/gen_common.go
@@ -0,0 +1,20 @@
+// Copyright 2014 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
+
+// This file contains code common to the maketables.go and the package code.
+
+// AliasType is the type of an alias in AliasMap.
+type AliasType int8
+
+const (
+ Deprecated AliasType = iota
+ Macro
+ Legacy
+
+ AliasTypeUnknown AliasType = -1
+)
diff --git a/vendor/golang.org/x/text/internal/language/language.go b/vendor/golang.org/x/text/internal/language/language.go
new file mode 100644
index 0000000..1e74d1a
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/language.go
@@ -0,0 +1,596 @@
+// Copyright 2013 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 -output tables.go
+
+package language // import "golang.org/x/text/internal/language"
+
+// TODO: Remove above NOTE after:
+// - verifying that tables are dropped correctly (most notably matcher tables).
+
+import (
+ "errors"
+ "fmt"
+ "strings"
+)
+
+const (
+ // maxCoreSize is the maximum size of a BCP 47 tag without variants and
+ // extensions. Equals max lang (3) + script (4) + max reg (3) + 2 dashes.
+ maxCoreSize = 12
+
+ // max99thPercentileSize is a somewhat arbitrary buffer size that presumably
+ // is large enough to hold at least 99% of the BCP 47 tags.
+ max99thPercentileSize = 32
+
+ // maxSimpleUExtensionSize is the maximum size of a -u extension with one
+ // key-type pair. Equals len("-u-") + key (2) + dash + max value (8).
+ maxSimpleUExtensionSize = 14
+)
+
+// Tag represents a BCP 47 language tag. It is used to specify an instance of a
+// specific language or locale. All language tag values are guaranteed to be
+// well-formed. The zero value of Tag is Und.
+type Tag struct {
+ // TODO: the following fields have the form TagTypeID. This name is chosen
+ // to allow refactoring the public package without conflicting with its
+ // Base, Script, and Region methods. Once the transition is fully completed
+ // the ID can be stripped from the name.
+
+ LangID Language
+ RegionID Region
+ // TODO: we will soon run out of positions for ScriptID. Idea: instead of
+ // storing lang, region, and ScriptID codes, store only the compact index and
+ // have a lookup table from this code to its expansion. This greatly speeds
+ // up table lookup, speed up common variant cases.
+ // This will also immediately free up 3 extra bytes. Also, the pVariant
+ // field can now be moved to the lookup table, as the compact index uniquely
+ // determines the offset of a possible variant.
+ ScriptID Script
+ pVariant byte // offset in str, includes preceding '-'
+ pExt uint16 // offset of first extension, includes preceding '-'
+
+ // str is the string representation of the Tag. It will only be used if the
+ // tag has variants or extensions.
+ str string
+}
+
+// Make is a convenience wrapper for Parse that omits the error.
+// In case of an error, a sensible default is returned.
+func Make(s string) Tag {
+ t, _ := Parse(s)
+ return t
+}
+
+// Raw returns the raw base language, script and region, without making an
+// attempt to infer their values.
+// TODO: consider removing
+func (t Tag) Raw() (b Language, s Script, r Region) {
+ return t.LangID, t.ScriptID, t.RegionID
+}
+
+// equalTags compares language, script and region subtags only.
+func (t Tag) equalTags(a Tag) bool {
+ return t.LangID == a.LangID && t.ScriptID == a.ScriptID && t.RegionID == a.RegionID
+}
+
+// IsRoot returns true if t is equal to language "und".
+func (t Tag) IsRoot() bool {
+ if int(t.pVariant) < len(t.str) {
+ return false
+ }
+ return t.equalTags(Und)
+}
+
+// IsPrivateUse reports whether the Tag consists solely of an IsPrivateUse use
+// tag.
+func (t Tag) IsPrivateUse() bool {
+ return t.str != "" && t.pVariant == 0
+}
+
+// RemakeString is used to update t.str in case lang, script or region changed.
+// It is assumed that pExt and pVariant still point to the start of the
+// respective parts.
+func (t *Tag) RemakeString() {
+ if t.str == "" {
+ return
+ }
+ extra := t.str[t.pVariant:]
+ if t.pVariant > 0 {
+ extra = extra[1:]
+ }
+ if t.equalTags(Und) && strings.HasPrefix(extra, "x-") {
+ t.str = extra
+ t.pVariant = 0
+ t.pExt = 0
+ return
+ }
+ var buf [max99thPercentileSize]byte // avoid extra memory allocation in most cases.
+ b := buf[:t.genCoreBytes(buf[:])]
+ if extra != "" {
+ diff := len(b) - int(t.pVariant)
+ b = append(b, '-')
+ b = append(b, extra...)
+ t.pVariant = uint8(int(t.pVariant) + diff)
+ t.pExt = uint16(int(t.pExt) + diff)
+ } else {
+ t.pVariant = uint8(len(b))
+ t.pExt = uint16(len(b))
+ }
+ t.str = string(b)
+}
+
+// genCoreBytes writes a string for the base languages, script and region tags
+// to the given buffer and returns the number of bytes written. It will never
+// write more than maxCoreSize bytes.
+func (t *Tag) genCoreBytes(buf []byte) int {
+ n := t.LangID.StringToBuf(buf[:])
+ if t.ScriptID != 0 {
+ n += copy(buf[n:], "-")
+ n += copy(buf[n:], t.ScriptID.String())
+ }
+ if t.RegionID != 0 {
+ n += copy(buf[n:], "-")
+ n += copy(buf[n:], t.RegionID.String())
+ }
+ return n
+}
+
+// String returns the canonical string representation of the language tag.
+func (t Tag) String() string {
+ if t.str != "" {
+ return t.str
+ }
+ if t.ScriptID == 0 && t.RegionID == 0 {
+ return t.LangID.String()
+ }
+ buf := [maxCoreSize]byte{}
+ return string(buf[:t.genCoreBytes(buf[:])])
+}
+
+// MarshalText implements encoding.TextMarshaler.
+func (t Tag) MarshalText() (text []byte, err error) {
+ if t.str != "" {
+ text = append(text, t.str...)
+ } else if t.ScriptID == 0 && t.RegionID == 0 {
+ text = append(text, t.LangID.String()...)
+ } else {
+ buf := [maxCoreSize]byte{}
+ text = buf[:t.genCoreBytes(buf[:])]
+ }
+ return text, nil
+}
+
+// UnmarshalText implements encoding.TextUnmarshaler.
+func (t *Tag) UnmarshalText(text []byte) error {
+ tag, err := Parse(string(text))
+ *t = tag
+ return err
+}
+
+// Variants returns the part of the tag holding all variants or the empty string
+// if there are no variants defined.
+func (t Tag) Variants() string {
+ if t.pVariant == 0 {
+ return ""
+ }
+ return t.str[t.pVariant:t.pExt]
+}
+
+// VariantOrPrivateUseTags returns variants or private use tags.
+func (t Tag) VariantOrPrivateUseTags() string {
+ if t.pExt > 0 {
+ return t.str[t.pVariant:t.pExt]
+ }
+ return t.str[t.pVariant:]
+}
+
+// HasString reports whether this tag defines more than just the raw
+// components.
+func (t Tag) HasString() bool {
+ return t.str != ""
+}
+
+// Parent returns the CLDR parent of t. In CLDR, missing fields in data for a
+// specific language are substituted with fields from the parent language.
+// The parent for a language may change for newer versions of CLDR.
+func (t Tag) Parent() Tag {
+ if t.str != "" {
+ // Strip the variants and extensions.
+ b, s, r := t.Raw()
+ t = Tag{LangID: b, ScriptID: s, RegionID: r}
+ if t.RegionID == 0 && t.ScriptID != 0 && t.LangID != 0 {
+ base, _ := addTags(Tag{LangID: t.LangID})
+ if base.ScriptID == t.ScriptID {
+ return Tag{LangID: t.LangID}
+ }
+ }
+ return t
+ }
+ if t.LangID != 0 {
+ if t.RegionID != 0 {
+ maxScript := t.ScriptID
+ if maxScript == 0 {
+ max, _ := addTags(t)
+ maxScript = max.ScriptID
+ }
+
+ for i := range parents {
+ if Language(parents[i].lang) == t.LangID && Script(parents[i].maxScript) == maxScript {
+ for _, r := range parents[i].fromRegion {
+ if Region(r) == t.RegionID {
+ return Tag{
+ LangID: t.LangID,
+ ScriptID: Script(parents[i].script),
+ RegionID: Region(parents[i].toRegion),
+ }
+ }
+ }
+ }
+ }
+
+ // Strip the script if it is the default one.
+ base, _ := addTags(Tag{LangID: t.LangID})
+ if base.ScriptID != maxScript {
+ return Tag{LangID: t.LangID, ScriptID: maxScript}
+ }
+ return Tag{LangID: t.LangID}
+ } else if t.ScriptID != 0 {
+ // The parent for an base-script pair with a non-default script is
+ // "und" instead of the base language.
+ base, _ := addTags(Tag{LangID: t.LangID})
+ if base.ScriptID != t.ScriptID {
+ return Und
+ }
+ return Tag{LangID: t.LangID}
+ }
+ }
+ return Und
+}
+
+// ParseExtension parses s as an extension and returns it on success.
+func ParseExtension(s string) (ext string, err error) {
+ scan := makeScannerString(s)
+ var end int
+ if n := len(scan.token); n != 1 {
+ return "", ErrSyntax
+ }
+ scan.toLower(0, len(scan.b))
+ end = parseExtension(&scan)
+ if end != len(s) {
+ return "", ErrSyntax
+ }
+ return string(scan.b), nil
+}
+
+// HasVariants reports whether t has variants.
+func (t Tag) HasVariants() bool {
+ return uint16(t.pVariant) < t.pExt
+}
+
+// HasExtensions reports whether t has extensions.
+func (t Tag) HasExtensions() bool {
+ return int(t.pExt) < len(t.str)
+}
+
+// Extension returns the extension of type x for tag t. It will return
+// false for ok if t does not have the requested extension. The returned
+// extension will be invalid in this case.
+func (t Tag) Extension(x byte) (ext string, ok bool) {
+ for i := int(t.pExt); i < len(t.str)-1; {
+ var ext string
+ i, ext = getExtension(t.str, i)
+ if ext[0] == x {
+ return ext, true
+ }
+ }
+ return "", false
+}
+
+// Extensions returns all extensions of t.
+func (t Tag) Extensions() []string {
+ e := []string{}
+ for i := int(t.pExt); i < len(t.str)-1; {
+ var ext string
+ i, ext = getExtension(t.str, i)
+ e = append(e, ext)
+ }
+ return e
+}
+
+// TypeForKey returns the type associated with the given key, where key and type
+// are of the allowed values defined for the Unicode locale extension ('u') in
+// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers.
+// TypeForKey will traverse the inheritance chain to get the correct value.
+func (t Tag) TypeForKey(key string) string {
+ if start, end, _ := t.findTypeForKey(key); end != start {
+ return t.str[start:end]
+ }
+ return ""
+}
+
+var (
+ errPrivateUse = errors.New("cannot set a key on a private use tag")
+ errInvalidArguments = errors.New("invalid key or type")
+)
+
+// SetTypeForKey returns a new Tag with the key set to type, where key and type
+// are of the allowed values defined for the Unicode locale extension ('u') in
+// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers.
+// An empty value removes an existing pair with the same key.
+func (t Tag) SetTypeForKey(key, value string) (Tag, error) {
+ if t.IsPrivateUse() {
+ return t, errPrivateUse
+ }
+ if len(key) != 2 {
+ return t, errInvalidArguments
+ }
+
+ // Remove the setting if value is "".
+ if value == "" {
+ start, end, _ := t.findTypeForKey(key)
+ if start != end {
+ // Remove key tag and leading '-'.
+ start -= 4
+
+ // Remove a possible empty extension.
+ if (end == len(t.str) || t.str[end+2] == '-') && t.str[start-2] == '-' {
+ start -= 2
+ }
+ if start == int(t.pVariant) && end == len(t.str) {
+ t.str = ""
+ t.pVariant, t.pExt = 0, 0
+ } else {
+ t.str = fmt.Sprintf("%s%s", t.str[:start], t.str[end:])
+ }
+ }
+ return t, nil
+ }
+
+ if len(value) < 3 || len(value) > 8 {
+ return t, errInvalidArguments
+ }
+
+ var (
+ buf [maxCoreSize + maxSimpleUExtensionSize]byte
+ uStart int // start of the -u extension.
+ )
+
+ // Generate the tag string if needed.
+ if t.str == "" {
+ uStart = t.genCoreBytes(buf[:])
+ buf[uStart] = '-'
+ uStart++
+ }
+
+ // Create new key-type pair and parse it to verify.
+ b := buf[uStart:]
+ copy(b, "u-")
+ copy(b[2:], key)
+ b[4] = '-'
+ b = b[:5+copy(b[5:], value)]
+ scan := makeScanner(b)
+ if parseExtensions(&scan); scan.err != nil {
+ return t, scan.err
+ }
+
+ // Assemble the replacement string.
+ if t.str == "" {
+ t.pVariant, t.pExt = byte(uStart-1), uint16(uStart-1)
+ t.str = string(buf[:uStart+len(b)])
+ } else {
+ s := t.str
+ start, end, hasExt := t.findTypeForKey(key)
+ if start == end {
+ if hasExt {
+ b = b[2:]
+ }
+ t.str = fmt.Sprintf("%s-%s%s", s[:start], b, s[end:])
+ } else {
+ t.str = fmt.Sprintf("%s%s%s", s[:start], value, s[end:])
+ }
+ }
+ return t, nil
+}
+
+// findKeyAndType returns the start and end position for the type corresponding
+// to key or the point at which to insert the key-value pair if the type
+// wasn't found. The hasExt return value reports whether an -u extension was present.
+// Note: the extensions are typically very small and are likely to contain
+// only one key-type pair.
+func (t Tag) findTypeForKey(key string) (start, end int, hasExt bool) {
+ p := int(t.pExt)
+ if len(key) != 2 || p == len(t.str) || p == 0 {
+ return p, p, false
+ }
+ s := t.str
+
+ // Find the correct extension.
+ for p++; s[p] != 'u'; p++ {
+ if s[p] > 'u' {
+ p--
+ return p, p, false
+ }
+ if p = nextExtension(s, p); p == len(s) {
+ return len(s), len(s), false
+ }
+ }
+ // Proceed to the hyphen following the extension name.
+ p++
+
+ // curKey is the key currently being processed.
+ curKey := ""
+
+ // Iterate over keys until we get the end of a section.
+ for {
+ // p points to the hyphen preceding the current token.
+ if p3 := p + 3; s[p3] == '-' {
+ // Found a key.
+ // Check whether we just processed the key that was requested.
+ if curKey == key {
+ return start, p, true
+ }
+ // Set to the next key and continue scanning type tokens.
+ curKey = s[p+1 : p3]
+ if curKey > key {
+ return p, p, true
+ }
+ // Start of the type token sequence.
+ start = p + 4
+ // A type is at least 3 characters long.
+ p += 7 // 4 + 3
+ } else {
+ // Attribute or type, which is at least 3 characters long.
+ p += 4
+ }
+ // p points past the third character of a type or attribute.
+ max := p + 5 // maximum length of token plus hyphen.
+ if len(s) < max {
+ max = len(s)
+ }
+ for ; p < max && s[p] != '-'; p++ {
+ }
+ // Bail if we have exhausted all tokens or if the next token starts
+ // a new extension.
+ if p == len(s) || s[p+2] == '-' {
+ if curKey == key {
+ return start, p, true
+ }
+ return p, p, true
+ }
+ }
+}
+
+// ParseBase parses a 2- or 3-letter ISO 639 code.
+// It returns a ValueError if s is a well-formed but unknown language identifier
+// or another error if another error occurred.
+func ParseBase(s string) (Language, error) {
+ if n := len(s); n < 2 || 3 < n {
+ return 0, ErrSyntax
+ }
+ var buf [3]byte
+ return getLangID(buf[:copy(buf[:], s)])
+}
+
+// ParseScript parses a 4-letter ISO 15924 code.
+// It returns a ValueError if s is a well-formed but unknown script identifier
+// or another error if another error occurred.
+func ParseScript(s string) (Script, error) {
+ if len(s) != 4 {
+ return 0, ErrSyntax
+ }
+ var buf [4]byte
+ return getScriptID(script, buf[:copy(buf[:], s)])
+}
+
+// EncodeM49 returns the Region for the given UN M.49 code.
+// It returns an error if r is not a valid code.
+func EncodeM49(r int) (Region, error) {
+ return getRegionM49(r)
+}
+
+// ParseRegion parses a 2- or 3-letter ISO 3166-1 or a UN M.49 code.
+// It returns a ValueError if s is a well-formed but unknown region identifier
+// or another error if another error occurred.
+func ParseRegion(s string) (Region, error) {
+ if n := len(s); n < 2 || 3 < n {
+ return 0, ErrSyntax
+ }
+ var buf [3]byte
+ return getRegionID(buf[:copy(buf[:], s)])
+}
+
+// IsCountry returns whether this region is a country or autonomous area. This
+// includes non-standard definitions from CLDR.
+func (r Region) IsCountry() bool {
+ if r == 0 || r.IsGroup() || r.IsPrivateUse() && r != _XK {
+ return false
+ }
+ return true
+}
+
+// IsGroup returns whether this region defines a collection of regions. This
+// includes non-standard definitions from CLDR.
+func (r Region) IsGroup() bool {
+ if r == 0 {
+ return false
+ }
+ return int(regionInclusion[r]) < len(regionContainment)
+}
+
+// Contains returns whether Region c is contained by Region r. It returns true
+// if c == r.
+func (r Region) Contains(c Region) bool {
+ if r == c {
+ return true
+ }
+ g := regionInclusion[r]
+ if g >= nRegionGroups {
+ return false
+ }
+ m := regionContainment[g]
+
+ d := regionInclusion[c]
+ b := regionInclusionBits[d]
+
+ // A contained country may belong to multiple disjoint groups. Matching any
+ // of these indicates containment. If the contained region is a group, it
+ // must strictly be a subset.
+ if d >= nRegionGroups {
+ return b&m != 0
+ }
+ return b&^m == 0
+}
+
+var errNoTLD = errors.New("language: region is not a valid ccTLD")
+
+// TLD returns the country code top-level domain (ccTLD). UK is returned for GB.
+// In all other cases it returns either the region itself or an error.
+//
+// This method may return an error for a region for which there exists a
+// canonical form with a ccTLD. To get that ccTLD canonicalize r first. The
+// region will already be canonicalized it was obtained from a Tag that was
+// obtained using any of the default methods.
+func (r Region) TLD() (Region, error) {
+ // See http://en.wikipedia.org/wiki/Country_code_top-level_domain for the
+ // difference between ISO 3166-1 and IANA ccTLD.
+ if r == _GB {
+ r = _UK
+ }
+ if (r.typ() & ccTLD) == 0 {
+ return 0, errNoTLD
+ }
+ return r, nil
+}
+
+// Canonicalize returns the region or a possible replacement if the region is
+// deprecated. It will not return a replacement for deprecated regions that
+// are split into multiple regions.
+func (r Region) Canonicalize() Region {
+ if cr := normRegion(r); cr != 0 {
+ return cr
+ }
+ return r
+}
+
+// Variant represents a registered variant of a language as defined by BCP 47.
+type Variant struct {
+ ID uint8
+ str string
+}
+
+// ParseVariant parses and returns a Variant. An error is returned if s is not
+// a valid variant.
+func ParseVariant(s string) (Variant, error) {
+ s = strings.ToLower(s)
+ if id, ok := variantIndex[s]; ok {
+ return Variant{id, s}, nil
+ }
+ return Variant{}, NewValueError([]byte(s))
+}
+
+// String returns the string representation of the variant.
+func (v Variant) String() string {
+ return v.str
+}
diff --git a/vendor/golang.org/x/text/internal/language/language_test.go b/vendor/golang.org/x/text/internal/language/language_test.go
new file mode 100644
index 0000000..6c7c108
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/language_test.go
@@ -0,0 +1,736 @@
+// Copyright 2013 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 language
+
+import (
+ "reflect"
+ "testing"
+
+ "golang.org/x/text/internal/testtext"
+)
+
+func TestTagSize(t *testing.T) {
+ id := Tag{}
+ typ := reflect.TypeOf(id)
+ if typ.Size() > 24 {
+ t.Errorf("size of Tag was %d; want 24", typ.Size())
+ }
+}
+
+func TestIsRoot(t *testing.T) {
+ loc := Tag{}
+ if !loc.IsRoot() {
+ t.Errorf("unspecified should be root.")
+ }
+ for i, tt := range parseTests() {
+ loc, _ := Parse(tt.in)
+ undef := tt.lang == "und" && tt.script == "" && tt.region == "" && tt.ext == ""
+ if loc.IsRoot() != undef {
+ t.Errorf("%d: was %v; want %v", i, loc.IsRoot(), undef)
+ }
+ }
+}
+
+func TestEquality(t *testing.T) {
+ for i, tt := range parseTests() {
+ s := tt.in
+ tag := Make(s)
+ t1 := Make(tag.String())
+ if tag != t1 {
+ t.Errorf("%d:%s: equality test 1 failed\n got: %#v\nwant: %#v)", i, s, t1, tag)
+ }
+ }
+}
+
+func TestMakeString(t *testing.T) {
+ tests := []struct{ in, out string }{
+ {"und", "und"},
+ {"und", "und-CW"},
+ {"nl", "nl-NL"},
+ {"de-1901", "nl-1901"},
+ {"de-1901", "de-Arab-1901"},
+ {"x-a-b", "de-Arab-x-a-b"},
+ {"x-a-b", "x-a-b"},
+ }
+ for i, tt := range tests {
+ id, _ := Parse(tt.in)
+ mod, _ := Parse(tt.out)
+ id.setTagsFrom(mod)
+ for j := 0; j < 2; j++ {
+ id.RemakeString()
+ if str := id.String(); str != tt.out {
+ t.Errorf("%d:%d: found %s; want %s", i, j, id.String(), tt.out)
+ }
+ }
+ // The bytes to string conversion as used in remakeString
+ // occasionally measures as more than one alloc, breaking this test.
+ // To alleviate this we set the number of runs to more than 1.
+ if n := testtext.AllocsPerRun(8, id.RemakeString); n > 1 {
+ t.Errorf("%d: # allocs got %.1f; want <= 1", i, n)
+ }
+ }
+}
+
+func TestMarshal(t *testing.T) {
+ testCases := []string{
+ // TODO: these values will change with each CLDR update. This issue
+ // will be solved if we decide to fix the indexes.
+ "und",
+ "ca-ES-valencia",
+ "ca-ES-valencia-u-va-posix",
+ "ca-ES-valencia-u-co-phonebk",
+ "ca-ES-valencia-u-co-phonebk-va-posix",
+ "x-klingon",
+ "en-US",
+ "en-US-u-va-posix",
+ "en",
+ "en-u-co-phonebk",
+ "en-001",
+ "sh",
+ }
+ for _, tc := range testCases {
+ var tag Tag
+ err := tag.UnmarshalText([]byte(tc))
+ if err != nil {
+ t.Errorf("UnmarshalText(%q): unexpected error: %v", tc, err)
+ }
+ b, err := tag.MarshalText()
+ if err != nil {
+ t.Errorf("MarshalText(%q): unexpected error: %v", tc, err)
+ }
+ if got := string(b); got != tc {
+ t.Errorf("%s: got %q; want %q", tc, got, tc)
+ }
+ }
+}
+
+func TestParseBase(t *testing.T) {
+ tests := []struct {
+ in string
+ out string
+ ok bool
+ }{
+ {"en", "en", true},
+ {"EN", "en", true},
+ {"nld", "nl", true},
+ {"dut", "dut", true}, // bibliographic
+ {"aaj", "und", false}, // unknown
+ {"qaa", "qaa", true},
+ {"a", "und", false},
+ {"", "und", false},
+ {"aaaa", "und", false},
+ }
+ for i, tt := range tests {
+ x, err := ParseBase(tt.in)
+ if x.String() != tt.out || err == nil != tt.ok {
+ t.Errorf("%d:%s: was %s, %v; want %s, %v", i, tt.in, x, err == nil, tt.out, tt.ok)
+ }
+ if y, _, _ := Make(tt.out).Raw(); x != y {
+ t.Errorf("%d:%s: tag was %s; want %s", i, tt.in, x, y)
+ }
+ }
+}
+
+func TestParseScript(t *testing.T) {
+ tests := []struct {
+ in string
+ out string
+ ok bool
+ }{
+ {"Latn", "Latn", true},
+ {"zzzz", "Zzzz", true},
+ {"zyyy", "Zyyy", true},
+ {"Latm", "Zzzz", false},
+ {"Zzz", "Zzzz", false},
+ {"", "Zzzz", false},
+ {"Zzzxx", "Zzzz", false},
+ }
+ for i, tt := range tests {
+ x, err := ParseScript(tt.in)
+ if x.String() != tt.out || err == nil != tt.ok {
+ t.Errorf("%d:%s: was %s, %v; want %s, %v", i, tt.in, x, err == nil, tt.out, tt.ok)
+ }
+ if err == nil {
+ if _, y, _ := Make("und-" + tt.out).Raw(); x != y {
+ t.Errorf("%d:%s: tag was %s; want %s", i, tt.in, x, y)
+ }
+ }
+ }
+}
+
+func TestEncodeM49(t *testing.T) {
+ tests := []struct {
+ m49 int
+ code string
+ ok bool
+ }{
+ {1, "001", true},
+ {840, "US", true},
+ {899, "ZZ", false},
+ }
+ for i, tt := range tests {
+ if r, err := EncodeM49(tt.m49); r.String() != tt.code || err == nil != tt.ok {
+ t.Errorf("%d:%d: was %s, %v; want %s, %v", i, tt.m49, r, err == nil, tt.code, tt.ok)
+ }
+ }
+ for i := 1; i <= 1000; i++ {
+ if r, err := EncodeM49(i); err == nil && r.M49() == 0 {
+ t.Errorf("%d has no error, but maps to undefined region", i)
+ }
+ }
+}
+
+func TestParseRegion(t *testing.T) {
+ tests := []struct {
+ in string
+ out string
+ ok bool
+ }{
+ {"001", "001", true},
+ {"840", "US", true},
+ {"899", "ZZ", false},
+ {"USA", "US", true},
+ {"US", "US", true},
+ {"BC", "ZZ", false},
+ {"C", "ZZ", false},
+ {"CCCC", "ZZ", false},
+ {"01", "ZZ", false},
+ }
+ for i, tt := range tests {
+ r, err := ParseRegion(tt.in)
+ if r.String() != tt.out || err == nil != tt.ok {
+ t.Errorf("%d:%s: was %s, %v; want %s, %v", i, tt.in, r, err == nil, tt.out, tt.ok)
+ }
+ if err == nil {
+ if _, _, y := Make("und-" + tt.out).Raw(); r != y {
+ t.Errorf("%d:%s: tag was %s; want %s", i, tt.in, r, y)
+ }
+ }
+ }
+}
+
+func TestIsCountry(t *testing.T) {
+ tests := []struct {
+ reg string
+ country bool
+ }{
+ {"US", true},
+ {"001", false},
+ {"958", false},
+ {"419", false},
+ {"203", true},
+ {"020", true},
+ {"900", false},
+ {"999", false},
+ {"QO", false},
+ {"EU", false},
+ {"AA", false},
+ {"XK", true},
+ }
+ for i, tt := range tests {
+ r, _ := getRegionID([]byte(tt.reg))
+ if r.IsCountry() != tt.country {
+ t.Errorf("%d: IsCountry(%s) was %v; want %v", i, tt.reg, r.IsCountry(), tt.country)
+ }
+ }
+}
+
+func TestIsGroup(t *testing.T) {
+ tests := []struct {
+ reg string
+ group bool
+ }{
+ {"US", false},
+ {"001", true},
+ {"958", false},
+ {"419", true},
+ {"203", false},
+ {"020", false},
+ {"900", false},
+ {"999", false},
+ {"QO", true},
+ {"EU", true},
+ {"AA", false},
+ {"XK", false},
+ }
+ for i, tt := range tests {
+ r, _ := getRegionID([]byte(tt.reg))
+ if r.IsGroup() != tt.group {
+ t.Errorf("%d: IsGroup(%s) was %v; want %v", i, tt.reg, r.IsGroup(), tt.group)
+ }
+ }
+}
+
+func TestContains(t *testing.T) {
+ tests := []struct {
+ enclosing, contained string
+ contains bool
+ }{
+ // A region contains itself.
+ {"US", "US", true},
+ {"001", "001", true},
+
+ // Direct containment.
+ {"001", "002", true},
+ {"039", "XK", true},
+ {"150", "XK", true},
+ {"EU", "AT", true},
+ {"QO", "AQ", true},
+
+ // Indirect containemnt.
+ {"001", "US", true},
+ {"001", "419", true},
+ {"001", "013", true},
+
+ // No containment.
+ {"US", "001", false},
+ {"155", "EU", false},
+ }
+ for i, tt := range tests {
+ enc, _ := getRegionID([]byte(tt.enclosing))
+ con, _ := getRegionID([]byte(tt.contained))
+ r := enc
+ if got := r.Contains(con); got != tt.contains {
+ t.Errorf("%d: %s.Contains(%s) was %v; want %v", i, tt.enclosing, tt.contained, got, tt.contains)
+ }
+ }
+}
+
+func TestRegionCanonicalize(t *testing.T) {
+ for i, tt := range []struct{ in, out string }{
+ {"UK", "GB"},
+ {"TP", "TL"},
+ {"QU", "EU"},
+ {"SU", "SU"},
+ {"VD", "VN"},
+ {"DD", "DE"},
+ } {
+ r := MustParseRegion(tt.in)
+ want := MustParseRegion(tt.out)
+ if got := r.Canonicalize(); got != want {
+ t.Errorf("%d: got %v; want %v", i, got, want)
+ }
+ }
+}
+
+func TestRegionTLD(t *testing.T) {
+ for _, tt := range []struct {
+ in, out string
+ ok bool
+ }{
+ {"EH", "EH", true},
+ {"FR", "FR", true},
+ {"TL", "TL", true},
+
+ // In ccTLD before in ISO.
+ {"GG", "GG", true},
+
+ // Non-standard assignment of ccTLD to ISO code.
+ {"GB", "UK", true},
+
+ // Exceptionally reserved in ISO and valid ccTLD.
+ {"UK", "UK", true},
+ {"AC", "AC", true},
+ {"EU", "EU", true},
+ {"SU", "SU", true},
+
+ // Exceptionally reserved in ISO and invalid ccTLD.
+ {"CP", "ZZ", false},
+ {"DG", "ZZ", false},
+ {"EA", "ZZ", false},
+ {"FX", "ZZ", false},
+ {"IC", "ZZ", false},
+ {"TA", "ZZ", false},
+
+ // Transitionally reserved in ISO (e.g. deprecated) but valid ccTLD as
+ // it is still being phased out.
+ {"AN", "AN", true},
+ {"TP", "TP", true},
+
+ // Transitionally reserved in ISO (e.g. deprecated) and invalid ccTLD.
+ // Defined in package language as it has a mapping in CLDR.
+ {"BU", "ZZ", false},
+ {"CS", "ZZ", false},
+ {"NT", "ZZ", false},
+ {"YU", "ZZ", false},
+ {"ZR", "ZZ", false},
+ // Not defined in package: SF.
+
+ // Indeterminately reserved in ISO.
+ // Defined in package language as it has a legacy mapping in CLDR.
+ {"DY", "ZZ", false},
+ {"RH", "ZZ", false},
+ {"VD", "ZZ", false},
+ // Not defined in package: EW, FL, JA, LF, PI, RA, RB, RC, RI, RL, RM,
+ // RN, RP, WG, WL, WV, and YV.
+
+ // Not assigned in ISO, but legacy definitions in CLDR.
+ {"DD", "ZZ", false},
+ {"YD", "ZZ", false},
+
+ // Normal mappings but somewhat special status in ccTLD.
+ {"BL", "BL", true},
+ {"MF", "MF", true},
+ {"BV", "BV", true},
+ {"SJ", "SJ", true},
+
+ // Have values when normalized, but not as is.
+ {"QU", "ZZ", false},
+
+ // ISO Private Use.
+ {"AA", "ZZ", false},
+ {"QM", "ZZ", false},
+ {"QO", "ZZ", false},
+ {"XA", "ZZ", false},
+ {"XK", "ZZ", false}, // Sometimes used for Kosovo, but invalid ccTLD.
+ } {
+ if tt.in == "" {
+ continue
+ }
+
+ r := MustParseRegion(tt.in)
+ var want Region
+ if tt.out != "ZZ" {
+ want = MustParseRegion(tt.out)
+ }
+ tld, err := r.TLD()
+ if got := err == nil; got != tt.ok {
+ t.Errorf("error(%v): got %v; want %v", r, got, tt.ok)
+ }
+ if tld != want {
+ t.Errorf("TLD(%v): got %v; want %v", r, tld, want)
+ }
+ }
+}
+
+func TestTypeForKey(t *testing.T) {
+ tests := []struct{ key, in, out string }{
+ {"co", "en", ""},
+ {"co", "en-u-abc", ""},
+ {"co", "en-u-co-phonebk", "phonebk"},
+ {"co", "en-u-co-phonebk-cu-aud", "phonebk"},
+ {"co", "x-foo-u-co-phonebk", ""},
+ {"nu", "en-u-co-phonebk-nu-arabic", "arabic"},
+ {"kc", "cmn-u-co-stroke", ""},
+ }
+ for _, tt := range tests {
+ if v := Make(tt.in).TypeForKey(tt.key); v != tt.out {
+ t.Errorf("%q[%q]: was %q; want %q", tt.in, tt.key, v, tt.out)
+ }
+ }
+}
+
+func TestSetTypeForKey(t *testing.T) {
+ tests := []struct {
+ key, value, in, out string
+ err bool
+ }{
+ // replace existing value
+ {"co", "pinyin", "en-u-co-phonebk", "en-u-co-pinyin", false},
+ {"co", "pinyin", "en-u-co-phonebk-cu-xau", "en-u-co-pinyin-cu-xau", false},
+ {"co", "pinyin", "en-u-co-phonebk-v-xx", "en-u-co-pinyin-v-xx", false},
+ {"co", "pinyin", "en-u-co-phonebk-x-x", "en-u-co-pinyin-x-x", false},
+ {"nu", "arabic", "en-u-co-phonebk-nu-vaai", "en-u-co-phonebk-nu-arabic", false},
+ // add to existing -u extension
+ {"co", "pinyin", "en-u-ca-gregory", "en-u-ca-gregory-co-pinyin", false},
+ {"co", "pinyin", "en-u-ca-gregory-nu-vaai", "en-u-ca-gregory-co-pinyin-nu-vaai", false},
+ {"co", "pinyin", "en-u-ca-gregory-v-va", "en-u-ca-gregory-co-pinyin-v-va", false},
+ {"co", "pinyin", "en-u-ca-gregory-x-a", "en-u-ca-gregory-co-pinyin-x-a", false},
+ {"ca", "gregory", "en-u-co-pinyin", "en-u-ca-gregory-co-pinyin", false},
+ // remove pair
+ {"co", "", "en-u-co-phonebk", "en", false},
+ {"co", "", "en-u-ca-gregory-co-phonebk", "en-u-ca-gregory", false},
+ {"co", "", "en-u-co-phonebk-nu-arabic", "en-u-nu-arabic", false},
+ {"co", "", "en", "en", false},
+ // add -u extension
+ {"co", "pinyin", "en", "en-u-co-pinyin", false},
+ {"co", "pinyin", "und", "und-u-co-pinyin", false},
+ {"co", "pinyin", "en-a-aaa", "en-a-aaa-u-co-pinyin", false},
+ {"co", "pinyin", "en-x-aaa", "en-u-co-pinyin-x-aaa", false},
+ {"co", "pinyin", "en-v-aa", "en-u-co-pinyin-v-aa", false},
+ {"co", "pinyin", "en-a-aaa-x-x", "en-a-aaa-u-co-pinyin-x-x", false},
+ {"co", "pinyin", "en-a-aaa-v-va", "en-a-aaa-u-co-pinyin-v-va", false},
+ // error on invalid values
+ {"co", "pinyinxxx", "en", "en", true},
+ {"co", "piny.n", "en", "en", true},
+ {"co", "pinyinxxx", "en-a-aaa", "en-a-aaa", true},
+ {"co", "pinyinxxx", "en-u-aaa", "en-u-aaa", true},
+ {"co", "pinyinxxx", "en-u-aaa-co-pinyin", "en-u-aaa-co-pinyin", true},
+ {"co", "pinyi.", "en-u-aaa-co-pinyin", "en-u-aaa-co-pinyin", true},
+ {"col", "pinyin", "en", "en", true},
+ {"co", "cu", "en", "en", true},
+ // error when setting on a private use tag
+ {"co", "phonebook", "x-foo", "x-foo", true},
+ }
+ for i, tt := range tests {
+ tag := Make(tt.in)
+ if v, err := tag.SetTypeForKey(tt.key, tt.value); v.String() != tt.out {
+ t.Errorf("%d:%q[%q]=%q: was %q; want %q", i, tt.in, tt.key, tt.value, v, tt.out)
+ } else if (err != nil) != tt.err {
+ t.Errorf("%d:%q[%q]=%q: error was %v; want %v", i, tt.in, tt.key, tt.value, err != nil, tt.err)
+ } else if val := v.TypeForKey(tt.key); err == nil && val != tt.value {
+ t.Errorf("%d:%q[%q]==%q: was %v; want %v", i, tt.out, tt.key, tt.value, val, tt.value)
+ }
+ if len(tag.String()) <= 3 {
+ // Simulate a tag for which the string has not been set.
+ tag.str, tag.pExt, tag.pVariant = "", 0, 0
+ if tag, err := tag.SetTypeForKey(tt.key, tt.value); err == nil {
+ if val := tag.TypeForKey(tt.key); err == nil && val != tt.value {
+ t.Errorf("%d:%q[%q]==%q: was %v; want %v", i, tt.out, tt.key, tt.value, val, tt.value)
+ }
+ }
+ }
+ }
+}
+
+func TestFindKeyAndType(t *testing.T) {
+ // out is either the matched type in case of a match or the original
+ // string up till the insertion point.
+ tests := []struct {
+ key string
+ hasExt bool
+ in, out string
+ }{
+ // Don't search past a private use extension.
+ {"co", false, "en-x-foo-u-co-pinyin", "en"},
+ {"co", false, "x-foo-u-co-pinyin", ""},
+ {"co", false, "en-s-fff-x-foo", "en-s-fff"},
+ // Insertion points in absence of -u extension.
+ {"cu", false, "en", ""}, // t.str is ""
+ {"cu", false, "en-v-va", "en"},
+ {"cu", false, "en-a-va", "en-a-va"},
+ {"cu", false, "en-a-va-v-va", "en-a-va"},
+ {"cu", false, "en-x-a", "en"},
+ // Tags with the -u extension.
+ {"co", true, "en-u-co-standard", "standard"},
+ {"co", true, "yue-u-co-pinyin", "pinyin"},
+ {"co", true, "en-u-co-abc", "abc"},
+ {"co", true, "en-u-co-abc-def", "abc-def"},
+ {"co", true, "en-u-co-abc-def-x-foo", "abc-def"},
+ {"co", true, "en-u-co-standard-nu-arab", "standard"},
+ {"co", true, "yue-u-co-pinyin-nu-arab", "pinyin"},
+ // Insertion points.
+ {"cu", true, "en-u-co-standard", "en-u-co-standard"},
+ {"cu", true, "yue-u-co-pinyin-x-foo", "yue-u-co-pinyin"},
+ {"cu", true, "en-u-co-abc", "en-u-co-abc"},
+ {"cu", true, "en-u-nu-arabic", "en-u"},
+ {"cu", true, "en-u-co-abc-def-nu-arabic", "en-u-co-abc-def"},
+ }
+ for i, tt := range tests {
+ start, end, hasExt := Make(tt.in).findTypeForKey(tt.key)
+ if start != end {
+ res := tt.in[start:end]
+ if res != tt.out {
+ t.Errorf("%d:%s: was %q; want %q", i, tt.in, res, tt.out)
+ }
+ } else {
+ if hasExt != tt.hasExt {
+ t.Errorf("%d:%s: hasExt was %v; want %v", i, tt.in, hasExt, tt.hasExt)
+ continue
+ }
+ if tt.in[:start] != tt.out {
+ t.Errorf("%d:%s: insertion point was %q; want %q", i, tt.in, tt.in[:start], tt.out)
+ }
+ }
+ }
+}
+
+func TestParent(t *testing.T) {
+ tests := []struct{ in, out string }{
+ // Strip variants and extensions first
+ {"de-u-co-phonebk", "de"},
+ {"de-1994", "de"},
+ {"de-Latn-1994", "de"}, // remove superfluous script.
+
+ // Ensure the canonical Tag for an entry is in the chain for base-script
+ // pairs.
+ {"zh-Hans", "zh"},
+
+ // Skip the script if it is the maximized version. CLDR files for the
+ // skipped tag are always empty.
+ {"zh-Hans-TW", "zh"},
+ {"zh-Hans-CN", "zh"},
+
+ // Insert the script if the maximized script is not the same as the
+ // maximized script of the base language.
+ {"zh-TW", "zh-Hant"},
+ {"zh-HK", "zh-Hant"},
+ {"zh-Hant-TW", "zh-Hant"},
+ {"zh-Hant-HK", "zh-Hant"},
+
+ // Non-default script skips to und.
+ // CLDR
+ {"az-Cyrl", "und"},
+ {"bs-Cyrl", "und"},
+ {"en-Dsrt", "und"},
+ {"ha-Arab", "und"},
+ {"mn-Mong", "und"},
+ {"pa-Arab", "und"},
+ {"shi-Latn", "und"},
+ {"sr-Latn", "und"},
+ {"uz-Arab", "und"},
+ {"uz-Cyrl", "und"},
+ {"vai-Latn", "und"},
+ {"zh-Hant", "und"},
+ // extra
+ {"nl-Cyrl", "und"},
+
+ // World english inherits from en-001.
+ {"en-150", "en-001"},
+ {"en-AU", "en-001"},
+ {"en-BE", "en-001"},
+ {"en-GG", "en-001"},
+ {"en-GI", "en-001"},
+ {"en-HK", "en-001"},
+ {"en-IE", "en-001"},
+ {"en-IM", "en-001"},
+ {"en-IN", "en-001"},
+ {"en-JE", "en-001"},
+ {"en-MT", "en-001"},
+ {"en-NZ", "en-001"},
+ {"en-PK", "en-001"},
+ {"en-SG", "en-001"},
+
+ // Spanish in Latin-American countries have es-419 as parent.
+ {"es-AR", "es-419"},
+ {"es-BO", "es-419"},
+ {"es-CL", "es-419"},
+ {"es-CO", "es-419"},
+ {"es-CR", "es-419"},
+ {"es-CU", "es-419"},
+ {"es-DO", "es-419"},
+ {"es-EC", "es-419"},
+ {"es-GT", "es-419"},
+ {"es-HN", "es-419"},
+ {"es-MX", "es-419"},
+ {"es-NI", "es-419"},
+ {"es-PA", "es-419"},
+ {"es-PE", "es-419"},
+ {"es-PR", "es-419"},
+ {"es-PY", "es-419"},
+ {"es-SV", "es-419"},
+ {"es-US", "es-419"},
+ {"es-UY", "es-419"},
+ {"es-VE", "es-419"},
+ // exceptions (according to CLDR)
+ {"es-CW", "es"},
+
+ // Inherit from pt-PT, instead of pt for these countries.
+ {"pt-AO", "pt-PT"},
+ {"pt-CV", "pt-PT"},
+ {"pt-GW", "pt-PT"},
+ {"pt-MO", "pt-PT"},
+ {"pt-MZ", "pt-PT"},
+ {"pt-ST", "pt-PT"},
+ {"pt-TL", "pt-PT"},
+ }
+ for _, tt := range tests {
+ tag := MustParse(tt.in)
+ if p := MustParse(tt.out); p != tag.Parent() {
+ t.Errorf("%s: was %v; want %v", tt.in, tag.Parent(), p)
+ }
+ }
+}
+
+var (
+ // Tags without error that don't need to be changed.
+ benchBasic = []string{
+ "en",
+ "en-Latn",
+ "en-GB",
+ "za",
+ "zh-Hant",
+ "zh",
+ "zh-HK",
+ "ar-MK",
+ "en-CA",
+ "fr-CA",
+ "fr-CH",
+ "fr",
+ "lv",
+ "he-IT",
+ "tlh",
+ "ja",
+ "ja-Jpan",
+ "ja-Jpan-JP",
+ "de-1996",
+ "de-CH",
+ "sr",
+ "sr-Latn",
+ }
+ // Tags with extensions, not changes required.
+ benchExt = []string{
+ "x-a-b-c-d",
+ "x-aa-bbbb-cccccccc-d",
+ "en-x_cc-b-bbb-a-aaa",
+ "en-c_cc-b-bbb-a-aaa-x-x",
+ "en-u-co-phonebk",
+ "en-Cyrl-u-co-phonebk",
+ "en-US-u-co-phonebk-cu-xau",
+ "en-nedix-u-co-phonebk",
+ "en-t-t0-abcd",
+ "en-t-nl-latn",
+ "en-t-t0-abcd-x-a",
+ }
+ // Change, but not memory allocation required.
+ benchSimpleChange = []string{
+ "EN",
+ "i-klingon",
+ "en-latn",
+ "zh-cmn-Hans-CN",
+ "iw-NL",
+ }
+ // Change and memory allocation required.
+ benchChangeAlloc = []string{
+ "en-c_cc-b-bbb-a-aaa",
+ "en-u-cu-xua-co-phonebk",
+ "en-u-cu-xua-co-phonebk-a-cd",
+ "en-u-def-abc-cu-xua-co-phonebk",
+ "en-t-en-Cyrl-NL-1994",
+ "en-t-en-Cyrl-NL-1994-t0-abc-def",
+ }
+ // Tags that result in errors.
+ benchErr = []string{
+ // IllFormed
+ "x_A.-B-C_D",
+ "en-u-cu-co-phonebk",
+ "en-u-cu-xau-co",
+ "en-t-nl-abcd",
+ // Invalid
+ "xx",
+ "nl-Uuuu",
+ "nl-QB",
+ }
+ benchChange = append(benchSimpleChange, benchChangeAlloc...)
+ benchAll = append(append(append(benchBasic, benchExt...), benchChange...), benchErr...)
+)
+
+func doParse(b *testing.B, tag []string) {
+ for i := 0; i < b.N; i++ {
+ // Use the modulo instead of looping over all tags so that we get a somewhat
+ // meaningful ns/op.
+ Parse(tag[i%len(tag)])
+ }
+}
+
+func BenchmarkParse(b *testing.B) {
+ doParse(b, benchAll)
+}
+
+func BenchmarkParseBasic(b *testing.B) {
+ doParse(b, benchBasic)
+}
+
+func BenchmarkParseError(b *testing.B) {
+ doParse(b, benchErr)
+}
+
+func BenchmarkParseSimpleChange(b *testing.B) {
+ doParse(b, benchSimpleChange)
+}
+
+func BenchmarkParseChangeAlloc(b *testing.B) {
+ doParse(b, benchChangeAlloc)
+}
diff --git a/vendor/golang.org/x/text/internal/language/lookup.go b/vendor/golang.org/x/text/internal/language/lookup.go
new file mode 100644
index 0000000..6294b81
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/lookup.go
@@ -0,0 +1,412 @@
+// Copyright 2013 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 language
+
+import (
+ "bytes"
+ "fmt"
+ "sort"
+ "strconv"
+
+ "golang.org/x/text/internal/tag"
+)
+
+// findIndex tries to find the given tag in idx and returns a standardized error
+// if it could not be found.
+func findIndex(idx tag.Index, key []byte, form string) (index int, err error) {
+ if !tag.FixCase(form, key) {
+ return 0, ErrSyntax
+ }
+ i := idx.Index(key)
+ if i == -1 {
+ return 0, NewValueError(key)
+ }
+ return i, nil
+}
+
+func searchUint(imap []uint16, key uint16) int {
+ return sort.Search(len(imap), func(i int) bool {
+ return imap[i] >= key
+ })
+}
+
+type Language uint16
+
+// getLangID returns the langID of s if s is a canonical subtag
+// or langUnknown if s is not a canonical subtag.
+func getLangID(s []byte) (Language, error) {
+ if len(s) == 2 {
+ return getLangISO2(s)
+ }
+ return getLangISO3(s)
+}
+
+// TODO language normalization as well as the AliasMaps could be moved to the
+// higher level package, but it is a bit tricky to separate the generation.
+
+func (id Language) Canonicalize() (Language, AliasType) {
+ return normLang(id)
+}
+
+// mapLang returns the mapped langID of id according to mapping m.
+func normLang(id Language) (Language, AliasType) {
+ k := sort.Search(len(AliasMap), func(i int) bool {
+ return AliasMap[i].From >= uint16(id)
+ })
+ if k < len(AliasMap) && AliasMap[k].From == uint16(id) {
+ return Language(AliasMap[k].To), AliasTypes[k]
+ }
+ return id, AliasTypeUnknown
+}
+
+// getLangISO2 returns the langID for the given 2-letter ISO language code
+// or unknownLang if this does not exist.
+func getLangISO2(s []byte) (Language, error) {
+ if !tag.FixCase("zz", s) {
+ return 0, ErrSyntax
+ }
+ if i := lang.Index(s); i != -1 && lang.Elem(i)[3] != 0 {
+ return Language(i), nil
+ }
+ return 0, NewValueError(s)
+}
+
+const base = 'z' - 'a' + 1
+
+func strToInt(s []byte) uint {
+ v := uint(0)
+ for i := 0; i < len(s); i++ {
+ v *= base
+ v += uint(s[i] - 'a')
+ }
+ return v
+}
+
+// converts the given integer to the original ASCII string passed to strToInt.
+// len(s) must match the number of characters obtained.
+func intToStr(v uint, s []byte) {
+ for i := len(s) - 1; i >= 0; i-- {
+ s[i] = byte(v%base) + 'a'
+ v /= base
+ }
+}
+
+// getLangISO3 returns the langID for the given 3-letter ISO language code
+// or unknownLang if this does not exist.
+func getLangISO3(s []byte) (Language, error) {
+ if tag.FixCase("und", s) {
+ // first try to match canonical 3-letter entries
+ for i := lang.Index(s[:2]); i != -1; i = lang.Next(s[:2], i) {
+ if e := lang.Elem(i); e[3] == 0 && e[2] == s[2] {
+ // We treat "und" as special and always translate it to "unspecified".
+ // Note that ZZ and Zzzz are private use and are not treated as
+ // unspecified by default.
+ id := Language(i)
+ if id == nonCanonicalUnd {
+ return 0, nil
+ }
+ return id, nil
+ }
+ }
+ if i := altLangISO3.Index(s); i != -1 {
+ return Language(altLangIndex[altLangISO3.Elem(i)[3]]), nil
+ }
+ n := strToInt(s)
+ if langNoIndex[n/8]&(1<<(n%8)) != 0 {
+ return Language(n) + langNoIndexOffset, nil
+ }
+ // Check for non-canonical uses of ISO3.
+ for i := lang.Index(s[:1]); i != -1; i = lang.Next(s[:1], i) {
+ if e := lang.Elem(i); e[2] == s[1] && e[3] == s[2] {
+ return Language(i), nil
+ }
+ }
+ return 0, NewValueError(s)
+ }
+ return 0, ErrSyntax
+}
+
+// StringToBuf writes the string to b and returns the number of bytes
+// written. cap(b) must be >= 3.
+func (id Language) StringToBuf(b []byte) int {
+ if id >= langNoIndexOffset {
+ intToStr(uint(id)-langNoIndexOffset, b[:3])
+ return 3
+ } else if id == 0 {
+ return copy(b, "und")
+ }
+ l := lang[id<<2:]
+ if l[3] == 0 {
+ return copy(b, l[:3])
+ }
+ return copy(b, l[:2])
+}
+
+// String returns the BCP 47 representation of the langID.
+// Use b as variable name, instead of id, to ensure the variable
+// used is consistent with that of Base in which this type is embedded.
+func (b Language) String() string {
+ if b == 0 {
+ return "und"
+ } else if b >= langNoIndexOffset {
+ b -= langNoIndexOffset
+ buf := [3]byte{}
+ intToStr(uint(b), buf[:])
+ return string(buf[:])
+ }
+ l := lang.Elem(int(b))
+ if l[3] == 0 {
+ return l[:3]
+ }
+ return l[:2]
+}
+
+// ISO3 returns the ISO 639-3 language code.
+func (b Language) ISO3() string {
+ if b == 0 || b >= langNoIndexOffset {
+ return b.String()
+ }
+ l := lang.Elem(int(b))
+ if l[3] == 0 {
+ return l[:3]
+ } else if l[2] == 0 {
+ return altLangISO3.Elem(int(l[3]))[:3]
+ }
+ // This allocation will only happen for 3-letter ISO codes
+ // that are non-canonical BCP 47 language identifiers.
+ return l[0:1] + l[2:4]
+}
+
+// IsPrivateUse reports whether this language code is reserved for private use.
+func (b Language) IsPrivateUse() bool {
+ return langPrivateStart <= b && b <= langPrivateEnd
+}
+
+// SuppressScript returns the script marked as SuppressScript in the IANA
+// language tag repository, or 0 if there is no such script.
+func (b Language) SuppressScript() Script {
+ if b < langNoIndexOffset {
+ return Script(suppressScript[b])
+ }
+ return 0
+}
+
+type Region uint16
+
+// getRegionID returns the region id for s if s is a valid 2-letter region code
+// or unknownRegion.
+func getRegionID(s []byte) (Region, error) {
+ if len(s) == 3 {
+ if isAlpha(s[0]) {
+ return getRegionISO3(s)
+ }
+ if i, err := strconv.ParseUint(string(s), 10, 10); err == nil {
+ return getRegionM49(int(i))
+ }
+ }
+ return getRegionISO2(s)
+}
+
+// getRegionISO2 returns the regionID for the given 2-letter ISO country code
+// or unknownRegion if this does not exist.
+func getRegionISO2(s []byte) (Region, error) {
+ i, err := findIndex(regionISO, s, "ZZ")
+ if err != nil {
+ return 0, err
+ }
+ return Region(i) + isoRegionOffset, nil
+}
+
+// getRegionISO3 returns the regionID for the given 3-letter ISO country code
+// or unknownRegion if this does not exist.
+func getRegionISO3(s []byte) (Region, error) {
+ if tag.FixCase("ZZZ", s) {
+ for i := regionISO.Index(s[:1]); i != -1; i = regionISO.Next(s[:1], i) {
+ if e := regionISO.Elem(i); e[2] == s[1] && e[3] == s[2] {
+ return Region(i) + isoRegionOffset, nil
+ }
+ }
+ for i := 0; i < len(altRegionISO3); i += 3 {
+ if tag.Compare(altRegionISO3[i:i+3], s) == 0 {
+ return Region(altRegionIDs[i/3]), nil
+ }
+ }
+ return 0, NewValueError(s)
+ }
+ return 0, ErrSyntax
+}
+
+func getRegionM49(n int) (Region, error) {
+ if 0 < n && n <= 999 {
+ const (
+ searchBits = 7
+ regionBits = 9
+ regionMask = 1<<regionBits - 1
+ )
+ idx := n >> searchBits
+ buf := fromM49[m49Index[idx]:m49Index[idx+1]]
+ val := uint16(n) << regionBits // we rely on bits shifting out
+ i := sort.Search(len(buf), func(i int) bool {
+ return buf[i] >= val
+ })
+ if r := fromM49[int(m49Index[idx])+i]; r&^regionMask == val {
+ return Region(r & regionMask), nil
+ }
+ }
+ var e ValueError
+ fmt.Fprint(bytes.NewBuffer([]byte(e.v[:])), n)
+ return 0, e
+}
+
+// normRegion returns a region if r is deprecated or 0 otherwise.
+// TODO: consider supporting BYS (-> BLR), CSK (-> 200 or CZ), PHI (-> PHL) and AFI (-> DJ).
+// TODO: consider mapping split up regions to new most populous one (like CLDR).
+func normRegion(r Region) Region {
+ m := regionOldMap
+ k := sort.Search(len(m), func(i int) bool {
+ return m[i].From >= uint16(r)
+ })
+ if k < len(m) && m[k].From == uint16(r) {
+ return Region(m[k].To)
+ }
+ return 0
+}
+
+const (
+ iso3166UserAssigned = 1 << iota
+ ccTLD
+ bcp47Region
+)
+
+func (r Region) typ() byte {
+ return regionTypes[r]
+}
+
+// String returns the BCP 47 representation for the region.
+// It returns "ZZ" for an unspecified region.
+func (r Region) String() string {
+ if r < isoRegionOffset {
+ if r == 0 {
+ return "ZZ"
+ }
+ return fmt.Sprintf("%03d", r.M49())
+ }
+ r -= isoRegionOffset
+ return regionISO.Elem(int(r))[:2]
+}
+
+// ISO3 returns the 3-letter ISO code of r.
+// Note that not all regions have a 3-letter ISO code.
+// In such cases this method returns "ZZZ".
+func (r Region) ISO3() string {
+ if r < isoRegionOffset {
+ return "ZZZ"
+ }
+ r -= isoRegionOffset
+ reg := regionISO.Elem(int(r))
+ switch reg[2] {
+ case 0:
+ return altRegionISO3[reg[3]:][:3]
+ case ' ':
+ return "ZZZ"
+ }
+ return reg[0:1] + reg[2:4]
+}
+
+// M49 returns the UN M.49 encoding of r, or 0 if this encoding
+// is not defined for r.
+func (r Region) M49() int {
+ return int(m49[r])
+}
+
+// IsPrivateUse reports whether r has the ISO 3166 User-assigned status. This
+// may include private-use tags that are assigned by CLDR and used in this
+// implementation. So IsPrivateUse and IsCountry can be simultaneously true.
+func (r Region) IsPrivateUse() bool {
+ return r.typ()&iso3166UserAssigned != 0
+}
+
+type Script uint8
+
+// getScriptID returns the script id for string s. It assumes that s
+// is of the format [A-Z][a-z]{3}.
+func getScriptID(idx tag.Index, s []byte) (Script, error) {
+ i, err := findIndex(idx, s, "Zzzz")
+ return Script(i), err
+}
+
+// String returns the script code in title case.
+// It returns "Zzzz" for an unspecified script.
+func (s Script) String() string {
+ if s == 0 {
+ return "Zzzz"
+ }
+ return script.Elem(int(s))
+}
+
+// IsPrivateUse reports whether this script code is reserved for private use.
+func (s Script) IsPrivateUse() bool {
+ return _Qaaa <= s && s <= _Qabx
+}
+
+const (
+ maxAltTaglen = len("en-US-POSIX")
+ maxLen = maxAltTaglen
+)
+
+var (
+ // grandfatheredMap holds a mapping from legacy and grandfathered tags to
+ // their base language or index to more elaborate tag.
+ grandfatheredMap = map[[maxLen]byte]int16{
+ [maxLen]byte{'a', 'r', 't', '-', 'l', 'o', 'j', 'b', 'a', 'n'}: _jbo, // art-lojban
+ [maxLen]byte{'i', '-', 'a', 'm', 'i'}: _ami, // i-ami
+ [maxLen]byte{'i', '-', 'b', 'n', 'n'}: _bnn, // i-bnn
+ [maxLen]byte{'i', '-', 'h', 'a', 'k'}: _hak, // i-hak
+ [maxLen]byte{'i', '-', 'k', 'l', 'i', 'n', 'g', 'o', 'n'}: _tlh, // i-klingon
+ [maxLen]byte{'i', '-', 'l', 'u', 'x'}: _lb, // i-lux
+ [maxLen]byte{'i', '-', 'n', 'a', 'v', 'a', 'j', 'o'}: _nv, // i-navajo
+ [maxLen]byte{'i', '-', 'p', 'w', 'n'}: _pwn, // i-pwn
+ [maxLen]byte{'i', '-', 't', 'a', 'o'}: _tao, // i-tao
+ [maxLen]byte{'i', '-', 't', 'a', 'y'}: _tay, // i-tay
+ [maxLen]byte{'i', '-', 't', 's', 'u'}: _tsu, // i-tsu
+ [maxLen]byte{'n', 'o', '-', 'b', 'o', 'k'}: _nb, // no-bok
+ [maxLen]byte{'n', 'o', '-', 'n', 'y', 'n'}: _nn, // no-nyn
+ [maxLen]byte{'s', 'g', 'n', '-', 'b', 'e', '-', 'f', 'r'}: _sfb, // sgn-BE-FR
+ [maxLen]byte{'s', 'g', 'n', '-', 'b', 'e', '-', 'n', 'l'}: _vgt, // sgn-BE-NL
+ [maxLen]byte{'s', 'g', 'n', '-', 'c', 'h', '-', 'd', 'e'}: _sgg, // sgn-CH-DE
+ [maxLen]byte{'z', 'h', '-', 'g', 'u', 'o', 'y', 'u'}: _cmn, // zh-guoyu
+ [maxLen]byte{'z', 'h', '-', 'h', 'a', 'k', 'k', 'a'}: _hak, // zh-hakka
+ [maxLen]byte{'z', 'h', '-', 'm', 'i', 'n', '-', 'n', 'a', 'n'}: _nan, // zh-min-nan
+ [maxLen]byte{'z', 'h', '-', 'x', 'i', 'a', 'n', 'g'}: _hsn, // zh-xiang
+
+ // Grandfathered tags with no modern replacement will be converted as
+ // follows:
+ [maxLen]byte{'c', 'e', 'l', '-', 'g', 'a', 'u', 'l', 'i', 's', 'h'}: -1, // cel-gaulish
+ [maxLen]byte{'e', 'n', '-', 'g', 'b', '-', 'o', 'e', 'd'}: -2, // en-GB-oed
+ [maxLen]byte{'i', '-', 'd', 'e', 'f', 'a', 'u', 'l', 't'}: -3, // i-default
+ [maxLen]byte{'i', '-', 'e', 'n', 'o', 'c', 'h', 'i', 'a', 'n'}: -4, // i-enochian
+ [maxLen]byte{'i', '-', 'm', 'i', 'n', 'g', 'o'}: -5, // i-mingo
+ [maxLen]byte{'z', 'h', '-', 'm', 'i', 'n'}: -6, // zh-min
+
+ // CLDR-specific tag.
+ [maxLen]byte{'r', 'o', 'o', 't'}: 0, // root
+ [maxLen]byte{'e', 'n', '-', 'u', 's', '-', 'p', 'o', 's', 'i', 'x'}: -7, // en_US_POSIX"
+ }
+
+ altTagIndex = [...]uint8{0, 17, 31, 45, 61, 74, 86, 102}
+
+ altTags = "xtg-x-cel-gaulishen-GB-oxendicten-x-i-defaultund-x-i-enochiansee-x-i-mingonan-x-zh-minen-US-u-va-posix"
+)
+
+func grandfathered(s [maxAltTaglen]byte) (t Tag, ok bool) {
+ if v, ok := grandfatheredMap[s]; ok {
+ if v < 0 {
+ return Make(altTags[altTagIndex[-v-1]:altTagIndex[-v]]), true
+ }
+ t.LangID = Language(v)
+ return t, true
+ }
+ return t, false
+}
diff --git a/vendor/golang.org/x/text/internal/language/lookup_test.go b/vendor/golang.org/x/text/internal/language/lookup_test.go
new file mode 100644
index 0000000..5b93acb
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/lookup_test.go
@@ -0,0 +1,457 @@
+// Copyright 2013 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 language
+
+import (
+ "testing"
+
+ "golang.org/x/text/internal/tag"
+)
+
+func b(s string) []byte {
+ return []byte(s)
+}
+
+func TestLangID(t *testing.T) {
+ tests := []struct {
+ id, bcp47, iso3, norm string
+ err error
+ }{
+ {id: "", bcp47: "und", iso3: "und", err: ErrSyntax},
+ {id: " ", bcp47: "und", iso3: "und", err: ErrSyntax},
+ {id: " ", bcp47: "und", iso3: "und", err: ErrSyntax},
+ {id: " ", bcp47: "und", iso3: "und", err: ErrSyntax},
+ {id: "xxx", bcp47: "und", iso3: "und", err: NewValueError([]byte("xxx"))},
+ {id: "und", bcp47: "und", iso3: "und"},
+ {id: "aju", bcp47: "aju", iso3: "aju", norm: "jrb"},
+ {id: "jrb", bcp47: "jrb", iso3: "jrb"},
+ {id: "es", bcp47: "es", iso3: "spa"},
+ {id: "spa", bcp47: "es", iso3: "spa"},
+ {id: "ji", bcp47: "ji", iso3: "yid-", norm: "yi"},
+ {id: "jw", bcp47: "jw", iso3: "jav-", norm: "jv"},
+ {id: "ar", bcp47: "ar", iso3: "ara"},
+ {id: "kw", bcp47: "kw", iso3: "cor"},
+ {id: "arb", bcp47: "arb", iso3: "arb", norm: "ar"},
+ {id: "ar", bcp47: "ar", iso3: "ara"},
+ {id: "kur", bcp47: "ku", iso3: "kur"},
+ {id: "nl", bcp47: "nl", iso3: "nld"},
+ {id: "NL", bcp47: "nl", iso3: "nld"},
+ {id: "gsw", bcp47: "gsw", iso3: "gsw"},
+ {id: "gSW", bcp47: "gsw", iso3: "gsw"},
+ {id: "und", bcp47: "und", iso3: "und"},
+ {id: "sh", bcp47: "sh", iso3: "hbs", norm: "sr"},
+ {id: "hbs", bcp47: "sh", iso3: "hbs", norm: "sr"},
+ {id: "no", bcp47: "no", iso3: "nor", norm: "no"},
+ {id: "nor", bcp47: "no", iso3: "nor", norm: "no"},
+ {id: "cmn", bcp47: "cmn", iso3: "cmn", norm: "zh"},
+ }
+ for i, tt := range tests {
+ want, err := getLangID(b(tt.id))
+ if err != tt.err {
+ t.Errorf("%d:err(%s): found %q; want %q", i, tt.id, err, tt.err)
+ }
+ if err != nil {
+ continue
+ }
+ if id, _ := getLangISO2(b(tt.bcp47)); len(tt.bcp47) == 2 && want != id {
+ t.Errorf("%d:getISO2(%s): found %v; want %v", i, tt.bcp47, id, want)
+ }
+ if len(tt.iso3) == 3 {
+ if id, _ := getLangISO3(b(tt.iso3)); want != id {
+ t.Errorf("%d:getISO3(%s): found %q; want %q", i, tt.iso3, id, want)
+ }
+ if id, _ := getLangID(b(tt.iso3)); want != id {
+ t.Errorf("%d:getID3(%s): found %v; want %v", i, tt.iso3, id, want)
+ }
+ }
+ norm := want
+ if tt.norm != "" {
+ norm, _ = getLangID(b(tt.norm))
+ }
+ id, _ := normLang(want)
+ if id != norm {
+ t.Errorf("%d:norm(%s): found %v; want %v", i, tt.id, id, norm)
+ }
+ if id := want.String(); tt.bcp47 != id {
+ t.Errorf("%d:String(): found %s; want %s", i, id, tt.bcp47)
+ }
+ if id := want.ISO3(); tt.iso3[:3] != id {
+ t.Errorf("%d:iso3(): found %s; want %s", i, id, tt.iso3[:3])
+ }
+ }
+}
+
+func TestGrandfathered(t *testing.T) {
+ for _, tt := range []struct{ in, out string }{
+ {"art-lojban", "jbo"},
+ {"i-ami", "ami"},
+ {"i-bnn", "bnn"},
+ {"i-hak", "hak"},
+ {"i-klingon", "tlh"},
+ {"i-lux", "lb"},
+ {"i-navajo", "nv"},
+ {"i-pwn", "pwn"},
+ {"i-tao", "tao"},
+ {"i-tay", "tay"},
+ {"i-tsu", "tsu"},
+ {"no-bok", "nb"},
+ {"no-nyn", "nn"},
+ {"sgn-BE-FR", "sfb"},
+ {"sgn-BE-NL", "vgt"},
+ {"sgn-CH-DE", "sgg"},
+ {"sgn-ch-de", "sgg"},
+ {"zh-guoyu", "cmn"},
+ {"zh-hakka", "hak"},
+ {"zh-min-nan", "nan"},
+ {"zh-xiang", "hsn"},
+
+ // Grandfathered tags with no modern replacement will be converted as follows:
+ {"cel-gaulish", "xtg-x-cel-gaulish"},
+ {"en-GB-oed", "en-GB-oxendict"},
+ {"en-gb-oed", "en-GB-oxendict"},
+ {"i-default", "en-x-i-default"},
+ {"i-enochian", "und-x-i-enochian"},
+ {"i-mingo", "see-x-i-mingo"},
+ {"zh-min", "nan-x-zh-min"},
+
+ {"root", "und"},
+ {"en_US_POSIX", "en-US-u-va-posix"},
+ {"en_us_posix", "en-US-u-va-posix"},
+ {"en-us-posix", "en-US-u-va-posix"},
+ } {
+ got := Make(tt.in)
+ want := MustParse(tt.out)
+ if got != want {
+ t.Errorf("%s: got %q; want %q", tt.in, got, want)
+ }
+ }
+}
+
+func TestRegionID(t *testing.T) {
+ tests := []struct {
+ in, out string
+ }{
+ {"_ ", ""},
+ {"_000", ""},
+ {"419", "419"},
+ {"AA", "AA"},
+ {"ATF", "TF"},
+ {"HV", "HV"},
+ {"CT", "CT"},
+ {"DY", "DY"},
+ {"IC", "IC"},
+ {"FQ", "FQ"},
+ {"JT", "JT"},
+ {"ZZ", "ZZ"},
+ {"EU", "EU"},
+ {"QO", "QO"},
+ {"FX", "FX"},
+ }
+ for i, tt := range tests {
+ if tt.in[0] == '_' {
+ id := tt.in[1:]
+ if _, err := getRegionID(b(id)); err == nil {
+ t.Errorf("%d:err(%s): found nil; want error", i, id)
+ }
+ continue
+ }
+ want, _ := getRegionID(b(tt.in))
+ if s := want.String(); s != tt.out {
+ t.Errorf("%d:%s: found %q; want %q", i, tt.in, s, tt.out)
+ }
+ if len(tt.in) == 2 {
+ want, _ := getRegionISO2(b(tt.in))
+ if s := want.String(); s != tt.out {
+ t.Errorf("%d:getISO2(%s): found %q; want %q", i, tt.in, s, tt.out)
+ }
+ }
+ }
+}
+
+func TestRegionType(t *testing.T) {
+ for _, tt := range []struct {
+ r string
+ t byte
+ }{
+ {"NL", bcp47Region | ccTLD},
+ {"EU", bcp47Region | ccTLD}, // exceptionally reserved
+ {"AN", bcp47Region | ccTLD}, // transitionally reserved
+
+ {"DD", bcp47Region}, // deleted in ISO, deprecated in BCP 47
+ {"NT", bcp47Region}, // transitionally reserved, deprecated in BCP 47
+
+ {"XA", iso3166UserAssigned | bcp47Region},
+ {"ZZ", iso3166UserAssigned | bcp47Region},
+ {"AA", iso3166UserAssigned | bcp47Region},
+ {"QO", iso3166UserAssigned | bcp47Region},
+ {"QM", iso3166UserAssigned | bcp47Region},
+ {"XK", iso3166UserAssigned | bcp47Region},
+
+ {"CT", 0}, // deleted in ISO, not in BCP 47, canonicalized in CLDR
+ } {
+ r := MustParseRegion(tt.r)
+ if tp := r.typ(); tp != tt.t {
+ t.Errorf("Type(%s): got %x; want %x", tt.r, tp, tt.t)
+ }
+ }
+}
+
+func TestRegionISO3(t *testing.T) {
+ tests := []struct {
+ from, iso3, to string
+ }{
+ {" ", "ZZZ", "ZZ"},
+ {"000", "ZZZ", "ZZ"},
+ {"AA", "AAA", ""},
+ {"CT", "CTE", ""},
+ {"DY", "DHY", ""},
+ {"EU", "QUU", ""},
+ {"HV", "HVO", ""},
+ {"IC", "ZZZ", "ZZ"},
+ {"JT", "JTN", ""},
+ {"PZ", "PCZ", ""},
+ {"QU", "QUU", "EU"},
+ {"QO", "QOO", ""},
+ {"YD", "YMD", ""},
+ {"FQ", "ATF", "TF"},
+ {"TF", "ATF", ""},
+ {"FX", "FXX", ""},
+ {"ZZ", "ZZZ", ""},
+ {"419", "ZZZ", "ZZ"},
+ }
+ for _, tt := range tests {
+ r, _ := getRegionID(b(tt.from))
+ if s := r.ISO3(); s != tt.iso3 {
+ t.Errorf("iso3(%q): found %q; want %q", tt.from, s, tt.iso3)
+ }
+ if tt.iso3 == "" {
+ continue
+ }
+ want := tt.to
+ if tt.to == "" {
+ want = tt.from
+ }
+ r, _ = getRegionID(b(want))
+ if id, _ := getRegionISO3(b(tt.iso3)); id != r {
+ t.Errorf("%s: found %q; want %q", tt.iso3, id, want)
+ }
+ }
+}
+
+func TestRegionM49(t *testing.T) {
+ fromTests := []struct {
+ m49 int
+ id string
+ }{
+ {0, ""},
+ {-1, ""},
+ {1000, ""},
+ {10000, ""},
+
+ {001, "001"},
+ {104, "MM"},
+ {180, "CD"},
+ {230, "ET"},
+ {231, "ET"},
+ {249, "FX"},
+ {250, "FR"},
+ {276, "DE"},
+ {278, "DD"},
+ {280, "DE"},
+ {419, "419"},
+ {626, "TL"},
+ {736, "SD"},
+ {840, "US"},
+ {854, "BF"},
+ {891, "CS"},
+ {899, ""},
+ {958, "AA"},
+ {966, "QT"},
+ {967, "EU"},
+ {999, "ZZ"},
+ }
+ for _, tt := range fromTests {
+ id, err := getRegionM49(tt.m49)
+ if want, have := err != nil, tt.id == ""; want != have {
+ t.Errorf("error(%d): have %v; want %v", tt.m49, have, want)
+ continue
+ }
+ r, _ := getRegionID(b(tt.id))
+ if r != id {
+ t.Errorf("region(%d): have %s; want %s", tt.m49, id, r)
+ }
+ }
+
+ toTests := []struct {
+ m49 int
+ id string
+ }{
+ {0, "000"},
+ {0, "IC"}, // Some codes don't have an ID
+
+ {001, "001"},
+ {104, "MM"},
+ {104, "BU"},
+ {180, "CD"},
+ {180, "ZR"},
+ {231, "ET"},
+ {250, "FR"},
+ {249, "FX"},
+ {276, "DE"},
+ {278, "DD"},
+ {419, "419"},
+ {626, "TL"},
+ {626, "TP"},
+ {729, "SD"},
+ {826, "GB"},
+ {840, "US"},
+ {854, "BF"},
+ {891, "YU"},
+ {891, "CS"},
+ {958, "AA"},
+ {966, "QT"},
+ {967, "EU"},
+ {967, "QU"},
+ {999, "ZZ"},
+ // For codes that don't have an M49 code use the replacement value,
+ // if available.
+ {854, "HV"}, // maps to Burkino Faso
+ }
+ for _, tt := range toTests {
+ r, _ := getRegionID(b(tt.id))
+ if r.M49() != tt.m49 {
+ t.Errorf("m49(%q): have %d; want %d", tt.id, r.M49(), tt.m49)
+ }
+ }
+}
+
+func TestRegionDeprecation(t *testing.T) {
+ tests := []struct{ in, out string }{
+ {"BU", "MM"},
+ {"BUR", "MM"},
+ {"CT", "KI"},
+ {"DD", "DE"},
+ {"DDR", "DE"},
+ {"DY", "BJ"},
+ {"FX", "FR"},
+ {"HV", "BF"},
+ {"JT", "UM"},
+ {"MI", "UM"},
+ {"NH", "VU"},
+ {"NQ", "AQ"},
+ {"PU", "UM"},
+ {"PZ", "PA"},
+ {"QU", "EU"},
+ {"RH", "ZW"},
+ {"TP", "TL"},
+ {"UK", "GB"},
+ {"VD", "VN"},
+ {"WK", "UM"},
+ {"YD", "YE"},
+ {"NL", "NL"},
+ }
+ for _, tt := range tests {
+ rIn, _ := getRegionID([]byte(tt.in))
+ rOut, _ := getRegionISO2([]byte(tt.out))
+ r := normRegion(rIn)
+ if rOut == rIn && r != 0 {
+ t.Errorf("%s: was %q; want %q", tt.in, r, tt.in)
+ }
+ if rOut != rIn && r != rOut {
+ t.Errorf("%s: was %q; want %q", tt.in, r, tt.out)
+ }
+
+ }
+}
+
+func TestGetScriptID(t *testing.T) {
+ idx := tag.Index("0000BbbbDdddEeeeZzzz\xff\xff\xff\xff")
+ tests := []struct {
+ in string
+ out Script
+ }{
+ {" ", 0},
+ {" ", 0},
+ {" ", 0},
+ {"", 0},
+ {"Aaaa", 0},
+ {"Bbbb", 1},
+ {"Dddd", 2},
+ {"dddd", 2},
+ {"dDDD", 2},
+ {"Eeee", 3},
+ {"Zzzz", 4},
+ }
+ for i, tt := range tests {
+ if id, err := getScriptID(idx, b(tt.in)); id != tt.out {
+ t.Errorf("%d:%s: found %d; want %d", i, tt.in, id, tt.out)
+ } else if id == 0 && err == nil {
+ t.Errorf("%d:%s: no error; expected one", i, tt.in)
+ }
+ }
+}
+
+func TestIsPrivateUse(t *testing.T) {
+ type test struct {
+ s string
+ private bool
+ }
+ tests := []test{
+ {"en", false},
+ {"und", false},
+ {"pzn", false},
+ {"qaa", true},
+ {"qtz", true},
+ {"qua", false},
+ }
+ for i, tt := range tests {
+ x, _ := getLangID([]byte(tt.s))
+ if b := x.IsPrivateUse(); b != tt.private {
+ t.Errorf("%d: langID.IsPrivateUse(%s) was %v; want %v", i, tt.s, b, tt.private)
+ }
+ }
+ tests = []test{
+ {"001", false},
+ {"419", false},
+ {"899", false},
+ {"900", false},
+ {"957", false},
+ {"958", true},
+ {"AA", true},
+ {"AC", false},
+ {"EU", false}, // CLDR grouping, exceptionally reserved in ISO.
+ {"QU", true}, // Canonicalizes to EU, User-assigned in ISO.
+ {"QO", true}, // CLDR grouping, User-assigned in ISO.
+ {"QA", false},
+ {"QM", true},
+ {"QZ", true},
+ {"XA", true},
+ {"XK", true}, // Assigned to Kosovo in CLDR, User-assigned in ISO.
+ {"XZ", true},
+ {"ZW", false},
+ {"ZZ", true},
+ }
+ for i, tt := range tests {
+ x, _ := getRegionID([]byte(tt.s))
+ if b := x.IsPrivateUse(); b != tt.private {
+ t.Errorf("%d: regionID.IsPrivateUse(%s) was %v; want %v", i, tt.s, b, tt.private)
+ }
+ }
+ tests = []test{
+ {"Latn", false},
+ {"Laaa", false}, // invalid
+ {"Qaaa", true},
+ {"Qabx", true},
+ {"Qaby", false},
+ {"Zyyy", false},
+ {"Zzzz", false},
+ }
+ for i, tt := range tests {
+ x, _ := getScriptID(script, []byte(tt.s))
+ if b := x.IsPrivateUse(); b != tt.private {
+ t.Errorf("%d: scriptID.IsPrivateUse(%s) was %v; want %v", i, tt.s, b, tt.private)
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/language/match.go b/vendor/golang.org/x/text/internal/language/match.go
new file mode 100644
index 0000000..75a2dbc
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/match.go
@@ -0,0 +1,226 @@
+// Copyright 2013 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 language
+
+import "errors"
+
+type scriptRegionFlags uint8
+
+const (
+ isList = 1 << iota
+ scriptInFrom
+ regionInFrom
+)
+
+func (t *Tag) setUndefinedLang(id Language) {
+ if t.LangID == 0 {
+ t.LangID = id
+ }
+}
+
+func (t *Tag) setUndefinedScript(id Script) {
+ if t.ScriptID == 0 {
+ t.ScriptID = id
+ }
+}
+
+func (t *Tag) setUndefinedRegion(id Region) {
+ if t.RegionID == 0 || t.RegionID.Contains(id) {
+ t.RegionID = id
+ }
+}
+
+// ErrMissingLikelyTagsData indicates no information was available
+// to compute likely values of missing tags.
+var ErrMissingLikelyTagsData = errors.New("missing likely tags data")
+
+// addLikelySubtags sets subtags to their most likely value, given the locale.
+// In most cases this means setting fields for unknown values, but in some
+// cases it may alter a value. It returns an ErrMissingLikelyTagsData error
+// if the given locale cannot be expanded.
+func (t Tag) addLikelySubtags() (Tag, error) {
+ id, err := addTags(t)
+ if err != nil {
+ return t, err
+ } else if id.equalTags(t) {
+ return t, nil
+ }
+ id.RemakeString()
+ return id, nil
+}
+
+// specializeRegion attempts to specialize a group region.
+func specializeRegion(t *Tag) bool {
+ if i := regionInclusion[t.RegionID]; i < nRegionGroups {
+ x := likelyRegionGroup[i]
+ if Language(x.lang) == t.LangID && Script(x.script) == t.ScriptID {
+ t.RegionID = Region(x.region)
+ }
+ return true
+ }
+ return false
+}
+
+// Maximize returns a new tag with missing tags filled in.
+func (t Tag) Maximize() (Tag, error) {
+ return addTags(t)
+}
+
+func addTags(t Tag) (Tag, error) {
+ // We leave private use identifiers alone.
+ if t.IsPrivateUse() {
+ return t, nil
+ }
+ if t.ScriptID != 0 && t.RegionID != 0 {
+ if t.LangID != 0 {
+ // already fully specified
+ specializeRegion(&t)
+ return t, nil
+ }
+ // Search matches for und-script-region. Note that for these cases
+ // region will never be a group so there is no need to check for this.
+ list := likelyRegion[t.RegionID : t.RegionID+1]
+ if x := list[0]; x.flags&isList != 0 {
+ list = likelyRegionList[x.lang : x.lang+uint16(x.script)]
+ }
+ for _, x := range list {
+ // Deviating from the spec. See match_test.go for details.
+ if Script(x.script) == t.ScriptID {
+ t.setUndefinedLang(Language(x.lang))
+ return t, nil
+ }
+ }
+ }
+ if t.LangID != 0 {
+ // Search matches for lang-script and lang-region, where lang != und.
+ if t.LangID < langNoIndexOffset {
+ x := likelyLang[t.LangID]
+ if x.flags&isList != 0 {
+ list := likelyLangList[x.region : x.region+uint16(x.script)]
+ if t.ScriptID != 0 {
+ for _, x := range list {
+ if Script(x.script) == t.ScriptID && x.flags&scriptInFrom != 0 {
+ t.setUndefinedRegion(Region(x.region))
+ return t, nil
+ }
+ }
+ } else if t.RegionID != 0 {
+ count := 0
+ goodScript := true
+ tt := t
+ for _, x := range list {
+ // We visit all entries for which the script was not
+ // defined, including the ones where the region was not
+ // defined. This allows for proper disambiguation within
+ // regions.
+ if x.flags&scriptInFrom == 0 && t.RegionID.Contains(Region(x.region)) {
+ tt.RegionID = Region(x.region)
+ tt.setUndefinedScript(Script(x.script))
+ goodScript = goodScript && tt.ScriptID == Script(x.script)
+ count++
+ }
+ }
+ if count == 1 {
+ return tt, nil
+ }
+ // Even if we fail to find a unique Region, we might have
+ // an unambiguous script.
+ if goodScript {
+ t.ScriptID = tt.ScriptID
+ }
+ }
+ }
+ }
+ } else {
+ // Search matches for und-script.
+ if t.ScriptID != 0 {
+ x := likelyScript[t.ScriptID]
+ if x.region != 0 {
+ t.setUndefinedRegion(Region(x.region))
+ t.setUndefinedLang(Language(x.lang))
+ return t, nil
+ }
+ }
+ // Search matches for und-region. If und-script-region exists, it would
+ // have been found earlier.
+ if t.RegionID != 0 {
+ if i := regionInclusion[t.RegionID]; i < nRegionGroups {
+ x := likelyRegionGroup[i]
+ if x.region != 0 {
+ t.setUndefinedLang(Language(x.lang))
+ t.setUndefinedScript(Script(x.script))
+ t.RegionID = Region(x.region)
+ }
+ } else {
+ x := likelyRegion[t.RegionID]
+ if x.flags&isList != 0 {
+ x = likelyRegionList[x.lang]
+ }
+ if x.script != 0 && x.flags != scriptInFrom {
+ t.setUndefinedLang(Language(x.lang))
+ t.setUndefinedScript(Script(x.script))
+ return t, nil
+ }
+ }
+ }
+ }
+
+ // Search matches for lang.
+ if t.LangID < langNoIndexOffset {
+ x := likelyLang[t.LangID]
+ if x.flags&isList != 0 {
+ x = likelyLangList[x.region]
+ }
+ if x.region != 0 {
+ t.setUndefinedScript(Script(x.script))
+ t.setUndefinedRegion(Region(x.region))
+ }
+ specializeRegion(&t)
+ if t.LangID == 0 {
+ t.LangID = _en // default language
+ }
+ return t, nil
+ }
+ return t, ErrMissingLikelyTagsData
+}
+
+func (t *Tag) setTagsFrom(id Tag) {
+ t.LangID = id.LangID
+ t.ScriptID = id.ScriptID
+ t.RegionID = id.RegionID
+}
+
+// minimize removes the region or script subtags from t such that
+// t.addLikelySubtags() == t.minimize().addLikelySubtags().
+func (t Tag) minimize() (Tag, error) {
+ t, err := minimizeTags(t)
+ if err != nil {
+ return t, err
+ }
+ t.RemakeString()
+ return t, nil
+}
+
+// minimizeTags mimics the behavior of the ICU 51 C implementation.
+func minimizeTags(t Tag) (Tag, error) {
+ if t.equalTags(Und) {
+ return t, nil
+ }
+ max, err := addTags(t)
+ if err != nil {
+ return t, err
+ }
+ for _, id := range [...]Tag{
+ {LangID: t.LangID},
+ {LangID: t.LangID, RegionID: t.RegionID},
+ {LangID: t.LangID, ScriptID: t.ScriptID},
+ } {
+ if x, err := addTags(id); err == nil && max.equalTags(x) {
+ t.setTagsFrom(id)
+ break
+ }
+ }
+ return t, nil
+}
diff --git a/vendor/golang.org/x/text/internal/language/match_test.go b/vendor/golang.org/x/text/internal/language/match_test.go
new file mode 100644
index 0000000..e4f117f
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/match_test.go
@@ -0,0 +1,161 @@
+// Copyright 2013 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 language
+
+import (
+ "flag"
+ "testing"
+)
+
+var verbose = flag.Bool("verbose", false, "set to true to print the internal tables of matchers")
+
+func TestAddLikelySubtags(t *testing.T) {
+ tests := []struct{ in, out string }{
+ {"aa", "aa-Latn-ET"},
+ {"aa-Latn", "aa-Latn-ET"},
+ {"aa-Arab", "aa-Arab-ET"},
+ {"aa-Arab-ER", "aa-Arab-ER"},
+ {"kk", "kk-Cyrl-KZ"},
+ {"kk-CN", "kk-Arab-CN"},
+ {"cmn", "cmn"},
+ {"zh-AU", "zh-Hant-AU"},
+ {"zh-VN", "zh-Hant-VN"},
+ {"zh-SG", "zh-Hans-SG"},
+ {"zh-Hant", "zh-Hant-TW"},
+ {"zh-Hani", "zh-Hani-CN"},
+ {"und-Hani", "zh-Hani-CN"},
+ {"und", "en-Latn-US"},
+ {"und-GB", "en-Latn-GB"},
+ {"und-CW", "pap-Latn-CW"},
+ {"und-YT", "fr-Latn-YT"},
+ {"und-Arab", "ar-Arab-EG"},
+ {"und-AM", "hy-Armn-AM"},
+ {"und-TW", "zh-Hant-TW"},
+ {"und-002", "en-Latn-NG"},
+ {"und-Latn-002", "en-Latn-NG"},
+ {"en-Latn-002", "en-Latn-NG"},
+ {"en-002", "en-Latn-NG"},
+ {"en-001", "en-Latn-US"},
+ {"und-003", "en-Latn-US"},
+ {"und-GB", "en-Latn-GB"},
+ {"Latn-001", "en-Latn-US"},
+ {"en-001", "en-Latn-US"},
+ {"es-419", "es-Latn-419"},
+ {"he-145", "he-Hebr-IL"},
+ {"ky-145", "ky-Latn-TR"},
+ {"kk", "kk-Cyrl-KZ"},
+ // Don't specialize duplicate and ambiguous matches.
+ {"kk-034", "kk-Arab-034"}, // Matches IR and AF. Both are Arab.
+ {"ku-145", "ku-Latn-TR"}, // Matches IQ, TR, and LB, but kk -> TR.
+ {"und-Arab-CC", "ms-Arab-CC"},
+ {"und-Arab-GB", "ks-Arab-GB"},
+ {"und-Hans-CC", "zh-Hans-CC"},
+ {"und-CC", "en-Latn-CC"},
+ {"sr", "sr-Cyrl-RS"},
+ {"sr-151", "sr-Latn-151"}, // Matches RO and RU.
+ // We would like addLikelySubtags to generate the same results if the input
+ // only changes by adding tags that would otherwise have been added
+ // by the expansion.
+ // In other words:
+ // und-AA -> xx-Scrp-AA implies und-Scrp-AA -> xx-Scrp-AA
+ // und-AA -> xx-Scrp-AA implies xx-AA -> xx-Scrp-AA
+ // und-Scrp -> xx-Scrp-AA implies und-Scrp-AA -> xx-Scrp-AA
+ // und-Scrp -> xx-Scrp-AA implies xx-Scrp -> xx-Scrp-AA
+ // xx -> xx-Scrp-AA implies xx-Scrp -> xx-Scrp-AA
+ // xx -> xx-Scrp-AA implies xx-AA -> xx-Scrp-AA
+ //
+ // The algorithm specified in
+ // https://unicode.org/reports/tr35/tr35-9.html#Supplemental_Data,
+ // Section C.10, does not handle the first case. For example,
+ // the CLDR data contains an entry und-BJ -> fr-Latn-BJ, but not
+ // there is no rule for und-Latn-BJ. According to spec, und-Latn-BJ
+ // would expand to en-Latn-BJ, violating the aforementioned principle.
+ // We deviate from the spec by letting und-Scrp-AA expand to xx-Scrp-AA
+ // if a rule of the form und-AA -> xx-Scrp-AA is defined.
+ // Note that as of version 23, CLDR has some explicitly specified
+ // entries that do not conform to these rules. The implementation
+ // will not correct these explicit inconsistencies. A later versions of CLDR
+ // is supposed to fix this.
+ {"und-Latn-BJ", "fr-Latn-BJ"},
+ {"und-Bugi-ID", "bug-Bugi-ID"},
+ // regions, scripts and languages without definitions
+ {"und-Arab-AA", "ar-Arab-AA"},
+ {"und-Afak-RE", "fr-Afak-RE"},
+ {"und-Arab-GB", "ks-Arab-GB"},
+ {"abp-Arab-GB", "abp-Arab-GB"},
+ // script has preference over region
+ {"und-Arab-NL", "ar-Arab-NL"},
+ {"zza", "zza-Latn-TR"},
+ // preserve variants and extensions
+ {"de-1901", "de-Latn-DE-1901"},
+ {"de-x-abc", "de-Latn-DE-x-abc"},
+ {"de-1901-x-abc", "de-Latn-DE-1901-x-abc"},
+ {"x-abc", "x-abc"}, // TODO: is this the desired behavior?
+ }
+ for i, tt := range tests {
+ in, _ := Parse(tt.in)
+ out, _ := Parse(tt.out)
+ in, _ = in.addLikelySubtags()
+ if in.String() != out.String() {
+ t.Errorf("%d: add(%s) was %s; want %s", i, tt.in, in, tt.out)
+ }
+ }
+}
+func TestMinimize(t *testing.T) {
+ tests := []struct{ in, out string }{
+ {"aa", "aa"},
+ {"aa-Latn", "aa"},
+ {"aa-Latn-ET", "aa"},
+ {"aa-ET", "aa"},
+ {"aa-Arab", "aa-Arab"},
+ {"aa-Arab-ER", "aa-Arab-ER"},
+ {"aa-Arab-ET", "aa-Arab"},
+ {"und", "und"},
+ {"und-Latn", "und"},
+ {"und-Latn-US", "und"},
+ {"en-Latn-US", "en"},
+ {"cmn", "cmn"},
+ {"cmn-Hans", "cmn-Hans"},
+ {"cmn-Hant", "cmn-Hant"},
+ {"zh-AU", "zh-AU"},
+ {"zh-VN", "zh-VN"},
+ {"zh-SG", "zh-SG"},
+ {"zh-Hant", "zh-Hant"},
+ {"zh-Hant-TW", "zh-TW"},
+ {"zh-Hans", "zh"},
+ {"zh-Hani", "zh-Hani"},
+ {"und-Hans", "und-Hans"},
+ {"und-Hani", "und-Hani"},
+
+ {"und-CW", "und-CW"},
+ {"und-YT", "und-YT"},
+ {"und-Arab", "und-Arab"},
+ {"und-AM", "und-AM"},
+ {"und-Arab-CC", "und-Arab-CC"},
+ {"und-CC", "und-CC"},
+ {"und-Latn-BJ", "und-BJ"},
+ {"und-Bugi-ID", "und-Bugi"},
+ {"bug-Bugi-ID", "bug-Bugi"},
+ // regions, scripts and languages without definitions
+ {"und-Arab-AA", "und-Arab-AA"},
+ // preserve variants and extensions
+ {"de-Latn-1901", "de-1901"},
+ {"de-Latn-x-abc", "de-x-abc"},
+ {"de-DE-1901-x-abc", "de-1901-x-abc"},
+ {"x-abc", "x-abc"}, // TODO: is this the desired behavior?
+ }
+ for i, tt := range tests {
+ in, _ := Parse(tt.in)
+ out, _ := Parse(tt.out)
+ min, _ := in.minimize()
+ if min.String() != out.String() {
+ t.Errorf("%d: min(%s) was %s; want %s", i, tt.in, min, tt.out)
+ }
+ max, _ := min.addLikelySubtags()
+ if x, _ := in.addLikelySubtags(); x.String() != max.String() {
+ t.Errorf("%d: max(min(%s)) = %s; want %s", i, tt.in, max, x)
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/language/parse.go b/vendor/golang.org/x/text/internal/language/parse.go
new file mode 100644
index 0000000..2be83e1
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/parse.go
@@ -0,0 +1,594 @@
+// Copyright 2013 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 language
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "sort"
+
+ "golang.org/x/text/internal/tag"
+)
+
+// isAlpha returns true if the byte is not a digit.
+// b must be an ASCII letter or digit.
+func isAlpha(b byte) bool {
+ return b > '9'
+}
+
+// isAlphaNum returns true if the string contains only ASCII letters or digits.
+func isAlphaNum(s []byte) bool {
+ for _, c := range s {
+ if !('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c && c <= '9') {
+ return false
+ }
+ }
+ return true
+}
+
+// ErrSyntax is returned by any of the parsing functions when the
+// input is not well-formed, according to BCP 47.
+// TODO: return the position at which the syntax error occurred?
+var ErrSyntax = errors.New("language: tag is not well-formed")
+
+// ErrDuplicateKey is returned when a tag contains the same key twice with
+// different values in the -u section.
+var ErrDuplicateKey = errors.New("language: different values for same key in -u extension")
+
+// ValueError is returned by any of the parsing functions when the
+// input is well-formed but the respective subtag is not recognized
+// as a valid value.
+type ValueError struct {
+ v [8]byte
+}
+
+// NewValueError creates a new ValueError.
+func NewValueError(tag []byte) ValueError {
+ var e ValueError
+ copy(e.v[:], tag)
+ return e
+}
+
+func (e ValueError) tag() []byte {
+ n := bytes.IndexByte(e.v[:], 0)
+ if n == -1 {
+ n = 8
+ }
+ return e.v[:n]
+}
+
+// Error implements the error interface.
+func (e ValueError) Error() string {
+ return fmt.Sprintf("language: subtag %q is well-formed but unknown", e.tag())
+}
+
+// Subtag returns the subtag for which the error occurred.
+func (e ValueError) Subtag() string {
+ return string(e.tag())
+}
+
+// scanner is used to scan BCP 47 tokens, which are separated by _ or -.
+type scanner struct {
+ b []byte
+ bytes [max99thPercentileSize]byte
+ token []byte
+ start int // start position of the current token
+ end int // end position of the current token
+ next int // next point for scan
+ err error
+ done bool
+}
+
+func makeScannerString(s string) scanner {
+ scan := scanner{}
+ if len(s) <= len(scan.bytes) {
+ scan.b = scan.bytes[:copy(scan.bytes[:], s)]
+ } else {
+ scan.b = []byte(s)
+ }
+ scan.init()
+ return scan
+}
+
+// makeScanner returns a scanner using b as the input buffer.
+// b is not copied and may be modified by the scanner routines.
+func makeScanner(b []byte) scanner {
+ scan := scanner{b: b}
+ scan.init()
+ return scan
+}
+
+func (s *scanner) init() {
+ for i, c := range s.b {
+ if c == '_' {
+ s.b[i] = '-'
+ }
+ }
+ s.scan()
+}
+
+// restToLower converts the string between start and end to lower case.
+func (s *scanner) toLower(start, end int) {
+ for i := start; i < end; i++ {
+ c := s.b[i]
+ if 'A' <= c && c <= 'Z' {
+ s.b[i] += 'a' - 'A'
+ }
+ }
+}
+
+func (s *scanner) setError(e error) {
+ if s.err == nil || (e == ErrSyntax && s.err != ErrSyntax) {
+ s.err = e
+ }
+}
+
+// resizeRange shrinks or grows the array at position oldStart such that
+// a new string of size newSize can fit between oldStart and oldEnd.
+// Sets the scan point to after the resized range.
+func (s *scanner) resizeRange(oldStart, oldEnd, newSize int) {
+ s.start = oldStart
+ if end := oldStart + newSize; end != oldEnd {
+ diff := end - oldEnd
+ if end < cap(s.b) {
+ b := make([]byte, len(s.b)+diff)
+ copy(b, s.b[:oldStart])
+ copy(b[end:], s.b[oldEnd:])
+ s.b = b
+ } else {
+ s.b = append(s.b[end:], s.b[oldEnd:]...)
+ }
+ s.next = end + (s.next - s.end)
+ s.end = end
+ }
+}
+
+// replace replaces the current token with repl.
+func (s *scanner) replace(repl string) {
+ s.resizeRange(s.start, s.end, len(repl))
+ copy(s.b[s.start:], repl)
+}
+
+// gobble removes the current token from the input.
+// Caller must call scan after calling gobble.
+func (s *scanner) gobble(e error) {
+ s.setError(e)
+ if s.start == 0 {
+ s.b = s.b[:+copy(s.b, s.b[s.next:])]
+ s.end = 0
+ } else {
+ s.b = s.b[:s.start-1+copy(s.b[s.start-1:], s.b[s.end:])]
+ s.end = s.start - 1
+ }
+ s.next = s.start
+}
+
+// deleteRange removes the given range from s.b before the current token.
+func (s *scanner) deleteRange(start, end int) {
+ s.b = s.b[:start+copy(s.b[start:], s.b[end:])]
+ diff := end - start
+ s.next -= diff
+ s.start -= diff
+ s.end -= diff
+}
+
+// scan parses the next token of a BCP 47 string. Tokens that are larger
+// than 8 characters or include non-alphanumeric characters result in an error
+// and are gobbled and removed from the output.
+// It returns the end position of the last token consumed.
+func (s *scanner) scan() (end int) {
+ end = s.end
+ s.token = nil
+ for s.start = s.next; s.next < len(s.b); {
+ i := bytes.IndexByte(s.b[s.next:], '-')
+ if i == -1 {
+ s.end = len(s.b)
+ s.next = len(s.b)
+ i = s.end - s.start
+ } else {
+ s.end = s.next + i
+ s.next = s.end + 1
+ }
+ token := s.b[s.start:s.end]
+ if i < 1 || i > 8 || !isAlphaNum(token) {
+ s.gobble(ErrSyntax)
+ continue
+ }
+ s.token = token
+ return end
+ }
+ if n := len(s.b); n > 0 && s.b[n-1] == '-' {
+ s.setError(ErrSyntax)
+ s.b = s.b[:len(s.b)-1]
+ }
+ s.done = true
+ return end
+}
+
+// acceptMinSize parses multiple tokens of the given size or greater.
+// It returns the end position of the last token consumed.
+func (s *scanner) acceptMinSize(min int) (end int) {
+ end = s.end
+ s.scan()
+ for ; len(s.token) >= min; s.scan() {
+ end = s.end
+ }
+ return end
+}
+
+// Parse parses the given BCP 47 string and returns a valid Tag. If parsing
+// failed it returns an error and any part of the tag that could be parsed.
+// If parsing succeeded but an unknown value was found, it returns
+// ValueError. The Tag returned in this case is just stripped of the unknown
+// value. All other values are preserved. It accepts tags in the BCP 47 format
+// and extensions to this standard defined in
+// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers.
+func Parse(s string) (t Tag, err error) {
+ // TODO: consider supporting old-style locale key-value pairs.
+ if s == "" {
+ return Und, ErrSyntax
+ }
+ if len(s) <= maxAltTaglen {
+ b := [maxAltTaglen]byte{}
+ for i, c := range s {
+ // Generating invalid UTF-8 is okay as it won't match.
+ if 'A' <= c && c <= 'Z' {
+ c += 'a' - 'A'
+ } else if c == '_' {
+ c = '-'
+ }
+ b[i] = byte(c)
+ }
+ if t, ok := grandfathered(b); ok {
+ return t, nil
+ }
+ }
+ scan := makeScannerString(s)
+ return parse(&scan, s)
+}
+
+func parse(scan *scanner, s string) (t Tag, err error) {
+ t = Und
+ var end int
+ if n := len(scan.token); n <= 1 {
+ scan.toLower(0, len(scan.b))
+ if n == 0 || scan.token[0] != 'x' {
+ return t, ErrSyntax
+ }
+ end = parseExtensions(scan)
+ } else if n >= 4 {
+ return Und, ErrSyntax
+ } else { // the usual case
+ t, end = parseTag(scan)
+ if n := len(scan.token); n == 1 {
+ t.pExt = uint16(end)
+ end = parseExtensions(scan)
+ } else if end < len(scan.b) {
+ scan.setError(ErrSyntax)
+ scan.b = scan.b[:end]
+ }
+ }
+ if int(t.pVariant) < len(scan.b) {
+ if end < len(s) {
+ s = s[:end]
+ }
+ if len(s) > 0 && tag.Compare(s, scan.b) == 0 {
+ t.str = s
+ } else {
+ t.str = string(scan.b)
+ }
+ } else {
+ t.pVariant, t.pExt = 0, 0
+ }
+ return t, scan.err
+}
+
+// parseTag parses language, script, region and variants.
+// It returns a Tag and the end position in the input that was parsed.
+func parseTag(scan *scanner) (t Tag, end int) {
+ var e error
+ // TODO: set an error if an unknown lang, script or region is encountered.
+ t.LangID, e = getLangID(scan.token)
+ scan.setError(e)
+ scan.replace(t.LangID.String())
+ langStart := scan.start
+ end = scan.scan()
+ for len(scan.token) == 3 && isAlpha(scan.token[0]) {
+ // From http://tools.ietf.org/html/bcp47, <lang>-<extlang> tags are equivalent
+ // to a tag of the form <extlang>.
+ lang, e := getLangID(scan.token)
+ if lang != 0 {
+ t.LangID = lang
+ copy(scan.b[langStart:], lang.String())
+ scan.b[langStart+3] = '-'
+ scan.start = langStart + 4
+ }
+ scan.gobble(e)
+ end = scan.scan()
+ }
+ if len(scan.token) == 4 && isAlpha(scan.token[0]) {
+ t.ScriptID, e = getScriptID(script, scan.token)
+ if t.ScriptID == 0 {
+ scan.gobble(e)
+ }
+ end = scan.scan()
+ }
+ if n := len(scan.token); n >= 2 && n <= 3 {
+ t.RegionID, e = getRegionID(scan.token)
+ if t.RegionID == 0 {
+ scan.gobble(e)
+ } else {
+ scan.replace(t.RegionID.String())
+ }
+ end = scan.scan()
+ }
+ scan.toLower(scan.start, len(scan.b))
+ t.pVariant = byte(end)
+ end = parseVariants(scan, end, t)
+ t.pExt = uint16(end)
+ return t, end
+}
+
+var separator = []byte{'-'}
+
+// parseVariants scans tokens as long as each token is a valid variant string.
+// Duplicate variants are removed.
+func parseVariants(scan *scanner, end int, t Tag) int {
+ start := scan.start
+ varIDBuf := [4]uint8{}
+ variantBuf := [4][]byte{}
+ varID := varIDBuf[:0]
+ variant := variantBuf[:0]
+ last := -1
+ needSort := false
+ for ; len(scan.token) >= 4; scan.scan() {
+ // TODO: measure the impact of needing this conversion and redesign
+ // the data structure if there is an issue.
+ v, ok := variantIndex[string(scan.token)]
+ if !ok {
+ // unknown variant
+ // TODO: allow user-defined variants?
+ scan.gobble(NewValueError(scan.token))
+ continue
+ }
+ varID = append(varID, v)
+ variant = append(variant, scan.token)
+ if !needSort {
+ if last < int(v) {
+ last = int(v)
+ } else {
+ needSort = true
+ // There is no legal combinations of more than 7 variants
+ // (and this is by no means a useful sequence).
+ const maxVariants = 8
+ if len(varID) > maxVariants {
+ break
+ }
+ }
+ }
+ end = scan.end
+ }
+ if needSort {
+ sort.Sort(variantsSort{varID, variant})
+ k, l := 0, -1
+ for i, v := range varID {
+ w := int(v)
+ if l == w {
+ // Remove duplicates.
+ continue
+ }
+ varID[k] = varID[i]
+ variant[k] = variant[i]
+ k++
+ l = w
+ }
+ if str := bytes.Join(variant[:k], separator); len(str) == 0 {
+ end = start - 1
+ } else {
+ scan.resizeRange(start, end, len(str))
+ copy(scan.b[scan.start:], str)
+ end = scan.end
+ }
+ }
+ return end
+}
+
+type variantsSort struct {
+ i []uint8
+ v [][]byte
+}
+
+func (s variantsSort) Len() int {
+ return len(s.i)
+}
+
+func (s variantsSort) Swap(i, j int) {
+ s.i[i], s.i[j] = s.i[j], s.i[i]
+ s.v[i], s.v[j] = s.v[j], s.v[i]
+}
+
+func (s variantsSort) Less(i, j int) bool {
+ return s.i[i] < s.i[j]
+}
+
+type bytesSort struct {
+ b [][]byte
+ n int // first n bytes to compare
+}
+
+func (b bytesSort) Len() int {
+ return len(b.b)
+}
+
+func (b bytesSort) Swap(i, j int) {
+ b.b[i], b.b[j] = b.b[j], b.b[i]
+}
+
+func (b bytesSort) Less(i, j int) bool {
+ for k := 0; k < b.n; k++ {
+ if b.b[i][k] == b.b[j][k] {
+ continue
+ }
+ return b.b[i][k] < b.b[j][k]
+ }
+ return false
+}
+
+// parseExtensions parses and normalizes the extensions in the buffer.
+// It returns the last position of scan.b that is part of any extension.
+// It also trims scan.b to remove excess parts accordingly.
+func parseExtensions(scan *scanner) int {
+ start := scan.start
+ exts := [][]byte{}
+ private := []byte{}
+ end := scan.end
+ for len(scan.token) == 1 {
+ extStart := scan.start
+ ext := scan.token[0]
+ end = parseExtension(scan)
+ extension := scan.b[extStart:end]
+ if len(extension) < 3 || (ext != 'x' && len(extension) < 4) {
+ scan.setError(ErrSyntax)
+ end = extStart
+ continue
+ } else if start == extStart && (ext == 'x' || scan.start == len(scan.b)) {
+ scan.b = scan.b[:end]
+ return end
+ } else if ext == 'x' {
+ private = extension
+ break
+ }
+ exts = append(exts, extension)
+ }
+ sort.Sort(bytesSort{exts, 1})
+ if len(private) > 0 {
+ exts = append(exts, private)
+ }
+ scan.b = scan.b[:start]
+ if len(exts) > 0 {
+ scan.b = append(scan.b, bytes.Join(exts, separator)...)
+ } else if start > 0 {
+ // Strip trailing '-'.
+ scan.b = scan.b[:start-1]
+ }
+ return end
+}
+
+// parseExtension parses a single extension and returns the position of
+// the extension end.
+func parseExtension(scan *scanner) int {
+ start, end := scan.start, scan.end
+ switch scan.token[0] {
+ case 'u':
+ attrStart := end
+ scan.scan()
+ for last := []byte{}; len(scan.token) > 2; scan.scan() {
+ if bytes.Compare(scan.token, last) != -1 {
+ // Attributes are unsorted. Start over from scratch.
+ p := attrStart + 1
+ scan.next = p
+ attrs := [][]byte{}
+ for scan.scan(); len(scan.token) > 2; scan.scan() {
+ attrs = append(attrs, scan.token)
+ end = scan.end
+ }
+ sort.Sort(bytesSort{attrs, 3})
+ copy(scan.b[p:], bytes.Join(attrs, separator))
+ break
+ }
+ last = scan.token
+ end = scan.end
+ }
+ var last, key []byte
+ for attrEnd := end; len(scan.token) == 2; last = key {
+ key = scan.token
+ keyEnd := scan.end
+ end = scan.acceptMinSize(3)
+ // TODO: check key value validity
+ if keyEnd == end || bytes.Compare(key, last) != 1 {
+ // We have an invalid key or the keys are not sorted.
+ // Start scanning keys from scratch and reorder.
+ p := attrEnd + 1
+ scan.next = p
+ keys := [][]byte{}
+ for scan.scan(); len(scan.token) == 2; {
+ keyStart, keyEnd := scan.start, scan.end
+ end = scan.acceptMinSize(3)
+ if keyEnd != end {
+ keys = append(keys, scan.b[keyStart:end])
+ } else {
+ scan.setError(ErrSyntax)
+ end = keyStart
+ }
+ }
+ sort.Stable(bytesSort{keys, 2})
+ if n := len(keys); n > 0 {
+ k := 0
+ for i := 1; i < n; i++ {
+ if !bytes.Equal(keys[k][:2], keys[i][:2]) {
+ k++
+ keys[k] = keys[i]
+ } else if !bytes.Equal(keys[k], keys[i]) {
+ scan.setError(ErrDuplicateKey)
+ }
+ }
+ keys = keys[:k+1]
+ }
+ reordered := bytes.Join(keys, separator)
+ if e := p + len(reordered); e < end {
+ scan.deleteRange(e, end)
+ end = e
+ }
+ copy(scan.b[p:], reordered)
+ break
+ }
+ }
+ case 't':
+ scan.scan()
+ if n := len(scan.token); n >= 2 && n <= 3 && isAlpha(scan.token[1]) {
+ _, end = parseTag(scan)
+ scan.toLower(start, end)
+ }
+ for len(scan.token) == 2 && !isAlpha(scan.token[1]) {
+ end = scan.acceptMinSize(3)
+ }
+ case 'x':
+ end = scan.acceptMinSize(1)
+ default:
+ end = scan.acceptMinSize(2)
+ }
+ return end
+}
+
+// getExtension returns the name, body and end position of the extension.
+func getExtension(s string, p int) (end int, ext string) {
+ if s[p] == '-' {
+ p++
+ }
+ if s[p] == 'x' {
+ return len(s), s[p:]
+ }
+ end = nextExtension(s, p)
+ return end, s[p:end]
+}
+
+// nextExtension finds the next extension within the string, searching
+// for the -<char>- pattern from position p.
+// In the fast majority of cases, language tags will have at most
+// one extension and extensions tend to be small.
+func nextExtension(s string, p int) int {
+ for n := len(s) - 3; p < n; {
+ if s[p] == '-' {
+ if s[p+2] == '-' {
+ return p
+ }
+ p += 3
+ } else {
+ p++
+ }
+ }
+ return len(s)
+}
diff --git a/vendor/golang.org/x/text/internal/language/parse_test.go b/vendor/golang.org/x/text/internal/language/parse_test.go
new file mode 100644
index 0000000..0cc97d7
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/parse_test.go
@@ -0,0 +1,364 @@
+// Copyright 2013 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 language
+
+import (
+ "bytes"
+ "strings"
+ "testing"
+
+ "golang.org/x/text/internal/tag"
+)
+
+type scanTest struct {
+ ok bool // true if scanning does not result in an error
+ in string
+ tok []string // the expected tokens
+}
+
+var tests = []scanTest{
+ {true, "", []string{}},
+ {true, "1", []string{"1"}},
+ {true, "en", []string{"en"}},
+ {true, "root", []string{"root"}},
+ {true, "maxchars", []string{"maxchars"}},
+ {false, "bad/", []string{}},
+ {false, "morethan8", []string{}},
+ {false, "-", []string{}},
+ {false, "----", []string{}},
+ {false, "_", []string{}},
+ {true, "en-US", []string{"en", "US"}},
+ {true, "en_US", []string{"en", "US"}},
+ {false, "en-US-", []string{"en", "US"}},
+ {false, "en-US--", []string{"en", "US"}},
+ {false, "en-US---", []string{"en", "US"}},
+ {false, "en--US", []string{"en", "US"}},
+ {false, "-en-US", []string{"en", "US"}},
+ {false, "-en--US-", []string{"en", "US"}},
+ {false, "-en--US-", []string{"en", "US"}},
+ {false, "en-.-US", []string{"en", "US"}},
+ {false, ".-en--US-.", []string{"en", "US"}},
+ {false, "en-u.-US", []string{"en", "US"}},
+ {true, "en-u1-US", []string{"en", "u1", "US"}},
+ {true, "maxchar1_maxchar2-maxchar3", []string{"maxchar1", "maxchar2", "maxchar3"}},
+ {false, "moreThan8-moreThan8-e", []string{"e"}},
+}
+
+func TestScan(t *testing.T) {
+ for i, tt := range tests {
+ scan := makeScannerString(tt.in)
+ for j := 0; !scan.done; j++ {
+ if j >= len(tt.tok) {
+ t.Errorf("%d: extra token %q", i, scan.token)
+ } else if tag.Compare(tt.tok[j], scan.token) != 0 {
+ t.Errorf("%d: token %d: found %q; want %q", i, j, scan.token, tt.tok[j])
+ break
+ }
+ scan.scan()
+ }
+ if s := strings.Join(tt.tok, "-"); tag.Compare(s, bytes.Replace(scan.b, b("_"), b("-"), -1)) != 0 {
+ t.Errorf("%d: input: found %q; want %q", i, scan.b, s)
+ }
+ if (scan.err == nil) != tt.ok {
+ t.Errorf("%d: ok: found %v; want %v", i, scan.err == nil, tt.ok)
+ }
+ }
+}
+
+func TestAcceptMinSize(t *testing.T) {
+ for i, tt := range tests {
+ // count number of successive tokens with a minimum size.
+ for sz := 1; sz <= 8; sz++ {
+ scan := makeScannerString(tt.in)
+ scan.end, scan.next = 0, 0
+ end := scan.acceptMinSize(sz)
+ n := 0
+ for i := 0; i < len(tt.tok) && len(tt.tok[i]) >= sz; i++ {
+ n += len(tt.tok[i])
+ if i > 0 {
+ n++
+ }
+ }
+ if end != n {
+ t.Errorf("%d:%d: found len %d; want %d", i, sz, end, n)
+ }
+ }
+ }
+}
+
+type parseTest struct {
+ i int // the index of this test
+ in string
+ lang, script, region string
+ variants, ext string
+ extList []string // only used when more than one extension is present
+ invalid bool
+ rewrite bool // special rewrite not handled by parseTag
+ changed bool // string needed to be reformatted
+}
+
+func parseTests() []parseTest {
+ tests := []parseTest{
+ {in: "root", lang: "und"},
+ {in: "und", lang: "und"},
+ {in: "en", lang: "en"},
+ {in: "xy", lang: "und", invalid: true},
+ {in: "en-ZY", lang: "en", invalid: true},
+ {in: "gsw", lang: "gsw"},
+ {in: "sr_Latn", lang: "sr", script: "Latn"},
+ {in: "af-Arab", lang: "af", script: "Arab"},
+ {in: "nl-BE", lang: "nl", region: "BE"},
+ {in: "es-419", lang: "es", region: "419"},
+ {in: "und-001", lang: "und", region: "001"},
+ {in: "de-latn-be", lang: "de", script: "Latn", region: "BE"},
+ // Variants
+ {in: "de-1901", lang: "de", variants: "1901"},
+ // Accept with unsuppressed script.
+ {in: "de-Latn-1901", lang: "de", script: "Latn", variants: "1901"},
+ // Specialized.
+ {in: "sl-rozaj", lang: "sl", variants: "rozaj"},
+ {in: "sl-rozaj-lipaw", lang: "sl", variants: "rozaj-lipaw"},
+ {in: "sl-rozaj-biske", lang: "sl", variants: "rozaj-biske"},
+ {in: "sl-rozaj-biske-1994", lang: "sl", variants: "rozaj-biske-1994"},
+ {in: "sl-rozaj-1994", lang: "sl", variants: "rozaj-1994"},
+ // Maximum number of variants while adhering to prefix rules.
+ {in: "sl-rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp", lang: "sl", variants: "rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp"},
+
+ // Sorting.
+ {in: "sl-1994-biske-rozaj", lang: "sl", variants: "rozaj-biske-1994", changed: true},
+ {in: "sl-rozaj-biske-1994-alalc97-fonupa-fonipa-fonxsamp", lang: "sl", variants: "rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp", changed: true},
+ {in: "nl-fonxsamp-alalc97-fonipa-fonupa", lang: "nl", variants: "alalc97-fonipa-fonupa-fonxsamp", changed: true},
+
+ // Duplicates variants are removed, but not an error.
+ {in: "nl-fonupa-fonupa", lang: "nl", variants: "fonupa"},
+
+ // Variants that do not have correct prefixes. We still accept these.
+ {in: "de-Cyrl-1901", lang: "de", script: "Cyrl", variants: "1901"},
+ {in: "sl-rozaj-lipaw-1994", lang: "sl", variants: "rozaj-lipaw-1994"},
+ {in: "sl-1994-biske-rozaj-1994-biske-rozaj", lang: "sl", variants: "rozaj-biske-1994", changed: true},
+ {in: "de-Cyrl-1901", lang: "de", script: "Cyrl", variants: "1901"},
+
+ // Invalid variant.
+ {in: "de-1902", lang: "de", variants: "", invalid: true},
+
+ {in: "EN_CYRL", lang: "en", script: "Cyrl"},
+ // private use and extensions
+ {in: "x-a-b-c-d", ext: "x-a-b-c-d"},
+ {in: "x_A.-B-C_D", ext: "x-b-c-d", invalid: true, changed: true},
+ {in: "x-aa-bbbb-cccccccc-d", ext: "x-aa-bbbb-cccccccc-d"},
+ {in: "en-c_cc-b-bbb-a-aaa", lang: "en", changed: true, extList: []string{"a-aaa", "b-bbb", "c-cc"}},
+ {in: "en-x_cc-b-bbb-a-aaa", lang: "en", ext: "x-cc-b-bbb-a-aaa", changed: true},
+ {in: "en-c_cc-b-bbb-a-aaa-x-x", lang: "en", changed: true, extList: []string{"a-aaa", "b-bbb", "c-cc", "x-x"}},
+ {in: "en-v-c", lang: "en", ext: "", invalid: true},
+ {in: "en-v-abcdefghi", lang: "en", ext: "", invalid: true},
+ {in: "en-v-abc-x", lang: "en", ext: "v-abc", invalid: true},
+ {in: "en-v-abc-x-", lang: "en", ext: "v-abc", invalid: true},
+ {in: "en-v-abc-w-x-xx", lang: "en", extList: []string{"v-abc", "x-xx"}, invalid: true, changed: true},
+ {in: "en-v-abc-w-y-yx", lang: "en", extList: []string{"v-abc", "y-yx"}, invalid: true, changed: true},
+ {in: "en-v-c-abc", lang: "en", ext: "c-abc", invalid: true, changed: true},
+ {in: "en-v-w-abc", lang: "en", ext: "w-abc", invalid: true, changed: true},
+ {in: "en-v-x-abc", lang: "en", ext: "x-abc", invalid: true, changed: true},
+ {in: "en-v-x-a", lang: "en", ext: "x-a", invalid: true, changed: true},
+ {in: "en-9-aa-0-aa-z-bb-x-a", lang: "en", extList: []string{"0-aa", "9-aa", "z-bb", "x-a"}, changed: true},
+ {in: "en-u-c", lang: "en", ext: "", invalid: true},
+ {in: "en-u-co-phonebk", lang: "en", ext: "u-co-phonebk"},
+ {in: "en-u-co-phonebk-ca", lang: "en", ext: "u-co-phonebk", invalid: true},
+ {in: "en-u-nu-arabic-co-phonebk-ca", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
+ {in: "en-u-nu-arabic-co-phonebk-ca-x", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
+ {in: "en-u-nu-arabic-co-phonebk-ca-s", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
+ {in: "en-u-nu-arabic-co-phonebk-ca-a12345678", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
+ {in: "en-u-co-phonebook", lang: "en", ext: "", invalid: true},
+ {in: "en-u-co-phonebook-cu-xau", lang: "en", ext: "u-cu-xau", invalid: true, changed: true},
+ {in: "en-Cyrl-u-co-phonebk", lang: "en", script: "Cyrl", ext: "u-co-phonebk"},
+ {in: "en-US-u-co-phonebk", lang: "en", region: "US", ext: "u-co-phonebk"},
+ {in: "en-US-u-co-phonebk-cu-xau", lang: "en", region: "US", ext: "u-co-phonebk-cu-xau"},
+ {in: "en-scotland-u-co-phonebk", lang: "en", variants: "scotland", ext: "u-co-phonebk"},
+ {in: "en-u-cu-xua-co-phonebk", lang: "en", ext: "u-co-phonebk-cu-xua", changed: true},
+ {in: "en-u-def-abc-cu-xua-co-phonebk", lang: "en", ext: "u-abc-def-co-phonebk-cu-xua", changed: true},
+ {in: "en-u-def-abc", lang: "en", ext: "u-abc-def", changed: true},
+ {in: "en-u-cu-xua-co-phonebk-a-cd", lang: "en", extList: []string{"a-cd", "u-co-phonebk-cu-xua"}, changed: true},
+ // Invalid "u" extension. Drop invalid parts.
+ {in: "en-u-cu-co-phonebk", lang: "en", extList: []string{"u-co-phonebk"}, invalid: true, changed: true},
+ {in: "en-u-cu-xau-co", lang: "en", extList: []string{"u-cu-xau"}, invalid: true},
+ // LDML spec is not specific about it, but remove duplicates and return an error if the values differ.
+ {in: "en-u-cu-xau-co-phonebk-cu-xau", lang: "en", ext: "u-co-phonebk-cu-xau", changed: true},
+ // No change as the result is a substring of the original!
+ {in: "en-US-u-cu-xau-cu-eur", lang: "en", region: "US", ext: "u-cu-xau", invalid: true, changed: false},
+ {in: "en-t-en-Cyrl-NL-fonipa", lang: "en", ext: "t-en-cyrl-nl-fonipa", changed: true},
+ {in: "en-t-en-Cyrl-NL-fonipa-t0-abc-def", lang: "en", ext: "t-en-cyrl-nl-fonipa-t0-abc-def", changed: true},
+ {in: "en-t-t0-abcd", lang: "en", ext: "t-t0-abcd"},
+ // Not necessary to have changed here.
+ {in: "en-t-nl-abcd", lang: "en", ext: "t-nl", invalid: true},
+ {in: "en-t-nl-latn", lang: "en", ext: "t-nl-latn"},
+ {in: "en-t-t0-abcd-x-a", lang: "en", extList: []string{"t-t0-abcd", "x-a"}},
+ // invalid
+ {in: "", lang: "und", invalid: true},
+ {in: "-", lang: "und", invalid: true},
+ {in: "x", lang: "und", invalid: true},
+ {in: "x-", lang: "und", invalid: true},
+ {in: "x--", lang: "und", invalid: true},
+ {in: "a-a-b-c-d", lang: "und", invalid: true},
+ {in: "en-", lang: "en", invalid: true},
+ {in: "enne-", lang: "und", invalid: true},
+ {in: "en.", lang: "und", invalid: true},
+ {in: "en.-latn", lang: "und", invalid: true},
+ {in: "en.-en", lang: "en", invalid: true},
+ {in: "x-a-tooManyChars-c-d", ext: "x-a-c-d", invalid: true, changed: true},
+ {in: "a-tooManyChars-c-d", lang: "und", invalid: true},
+ // TODO: check key-value validity
+ // { in: "en-u-cu-xd", lang: "en", ext: "u-cu-xd", invalid: true },
+ {in: "en-t-abcd", lang: "en", invalid: true},
+ {in: "en-Latn-US-en", lang: "en", script: "Latn", region: "US", invalid: true},
+ // rewrites (more tests in TestGrandfathered)
+ {in: "zh-min-nan", lang: "nan"},
+ {in: "zh-yue", lang: "yue"},
+ {in: "zh-xiang", lang: "hsn", rewrite: true},
+ {in: "zh-guoyu", lang: "cmn", rewrite: true},
+ {in: "iw", lang: "iw"},
+ {in: "sgn-BE-FR", lang: "sfb", rewrite: true},
+ {in: "i-klingon", lang: "tlh", rewrite: true},
+ }
+ for i, tt := range tests {
+ tests[i].i = i
+ if tt.extList != nil {
+ tests[i].ext = strings.Join(tt.extList, "-")
+ }
+ if tt.ext != "" && tt.extList == nil {
+ tests[i].extList = []string{tt.ext}
+ }
+ }
+ return tests
+}
+
+func TestParseExtensions(t *testing.T) {
+ for i, tt := range parseTests() {
+ if tt.ext == "" || tt.rewrite {
+ continue
+ }
+ scan := makeScannerString(tt.in)
+ if len(scan.b) > 1 && scan.b[1] != '-' {
+ scan.end = nextExtension(string(scan.b), 0)
+ scan.next = scan.end + 1
+ scan.scan()
+ }
+ start := scan.start
+ scan.toLower(start, len(scan.b))
+ parseExtensions(&scan)
+ ext := string(scan.b[start:])
+ if ext != tt.ext {
+ t.Errorf("%d(%s): ext was %v; want %v", i, tt.in, ext, tt.ext)
+ }
+ if changed := !strings.HasPrefix(tt.in[start:], ext); changed != tt.changed {
+ t.Errorf("%d(%s): changed was %v; want %v", i, tt.in, changed, tt.changed)
+ }
+ }
+}
+
+// partChecks runs checks for each part by calling the function returned by f.
+func partChecks(t *testing.T, f func(*testing.T, *parseTest) (Tag, bool)) {
+ for i, tt := range parseTests() {
+ t.Run(tt.in, func(t *testing.T) {
+ tag, skip := f(t, &tt)
+ if skip {
+ return
+ }
+ if l, _ := getLangID(b(tt.lang)); l != tag.LangID {
+ t.Errorf("%d: lang was %q; want %q", i, tag.LangID, l)
+ }
+ if sc, _ := getScriptID(script, b(tt.script)); sc != tag.ScriptID {
+ t.Errorf("%d: script was %q; want %q", i, tag.ScriptID, sc)
+ }
+ if r, _ := getRegionID(b(tt.region)); r != tag.RegionID {
+ t.Errorf("%d: region was %q; want %q", i, tag.RegionID, r)
+ }
+ if tag.str == "" {
+ return
+ }
+ p := int(tag.pVariant)
+ if p < int(tag.pExt) {
+ p++
+ }
+ if s, g := tag.str[p:tag.pExt], tt.variants; s != g {
+ t.Errorf("%d: variants was %q; want %q", i, s, g)
+ }
+ p = int(tag.pExt)
+ if p > 0 && p < len(tag.str) {
+ p++
+ }
+ if s, g := (tag.str)[p:], tt.ext; s != g {
+ t.Errorf("%d: extensions were %q; want %q", i, s, g)
+ }
+ })
+ }
+}
+
+func TestParseTag(t *testing.T) {
+ partChecks(t, func(t *testing.T, tt *parseTest) (id Tag, skip bool) {
+ if strings.HasPrefix(tt.in, "x-") || tt.rewrite {
+ return Tag{}, true
+ }
+ scan := makeScannerString(tt.in)
+ id, end := parseTag(&scan)
+ id.str = string(scan.b[:end])
+ tt.ext = ""
+ tt.extList = []string{}
+ return id, false
+ })
+}
+
+func TestParse(t *testing.T) {
+ partChecks(t, func(t *testing.T, tt *parseTest) (id Tag, skip bool) {
+ id, err := Parse(tt.in)
+ ext := ""
+ if id.str != "" {
+ if strings.HasPrefix(id.str, "x-") {
+ ext = id.str
+ } else if int(id.pExt) < len(id.str) && id.pExt > 0 {
+ ext = id.str[id.pExt+1:]
+ }
+ }
+ if tag, _ := Parse(id.String()); tag.String() != id.String() {
+ t.Errorf("%d:%s: reparse was %q; want %q", tt.i, tt.in, id.String(), tag.String())
+ }
+ if ext != tt.ext {
+ t.Errorf("%d:%s: ext was %q; want %q", tt.i, tt.in, ext, tt.ext)
+ }
+ changed := id.str != "" && !strings.HasPrefix(tt.in, id.str)
+ if changed != tt.changed {
+ t.Errorf("%d:%s: changed was %v; want %v", tt.i, tt.in, changed, tt.changed)
+ }
+ if (err != nil) != tt.invalid {
+ t.Errorf("%d:%s: invalid was %v; want %v. Error: %v", tt.i, tt.in, err != nil, tt.invalid, err)
+ }
+ return id, false
+ })
+}
+
+func TestErrors(t *testing.T) {
+ mkInvalid := func(s string) error {
+ return NewValueError([]byte(s))
+ }
+ tests := []struct {
+ in string
+ out error
+ }{
+ // invalid subtags.
+ {"ac", mkInvalid("ac")},
+ {"AC", mkInvalid("ac")},
+ {"aa-Uuuu", mkInvalid("Uuuu")},
+ {"aa-AB", mkInvalid("AB")},
+ // ill-formed wins over invalid.
+ {"ac-u", ErrSyntax},
+ {"ac-u-ca", ErrSyntax},
+ {"ac-u-ca-co-pinyin", ErrSyntax},
+ {"noob", ErrSyntax},
+ }
+ for _, tt := range tests {
+ _, err := Parse(tt.in)
+ if err != tt.out {
+ t.Errorf("%s: was %q; want %q", tt.in, err, tt.out)
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/language/tables.go b/vendor/golang.org/x/text/internal/language/tables.go
new file mode 100644
index 0000000..239e2d2
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/tables.go
@@ -0,0 +1,3431 @@
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+package language
+
+import "golang.org/x/text/internal/tag"
+
+// CLDRVersion is the CLDR version from which the tables in this package are derived.
+const CLDRVersion = "32"
+
+const NumLanguages = 8665
+
+const NumScripts = 242
+
+const NumRegions = 357
+
+type FromTo struct {
+ From uint16
+ To uint16
+}
+
+const nonCanonicalUnd = 1201
+const (
+ _af = 22
+ _am = 39
+ _ar = 58
+ _az = 88
+ _bg = 126
+ _bn = 165
+ _ca = 215
+ _cs = 250
+ _da = 257
+ _de = 269
+ _el = 310
+ _en = 313
+ _es = 318
+ _et = 320
+ _fa = 328
+ _fi = 337
+ _fil = 339
+ _fr = 350
+ _gu = 420
+ _he = 444
+ _hi = 446
+ _hr = 465
+ _hu = 469
+ _hy = 471
+ _id = 481
+ _is = 504
+ _it = 505
+ _ja = 512
+ _ka = 528
+ _kk = 578
+ _km = 586
+ _kn = 593
+ _ko = 596
+ _ky = 650
+ _lo = 696
+ _lt = 704
+ _lv = 711
+ _mk = 767
+ _ml = 772
+ _mn = 779
+ _mo = 784
+ _mr = 795
+ _ms = 799
+ _mul = 806
+ _my = 817
+ _nb = 839
+ _ne = 849
+ _nl = 871
+ _no = 879
+ _pa = 925
+ _pl = 947
+ _pt = 960
+ _ro = 988
+ _ru = 994
+ _sh = 1031
+ _si = 1036
+ _sk = 1042
+ _sl = 1046
+ _sq = 1073
+ _sr = 1074
+ _sv = 1092
+ _sw = 1093
+ _ta = 1104
+ _te = 1121
+ _th = 1131
+ _tl = 1146
+ _tn = 1152
+ _tr = 1162
+ _uk = 1198
+ _ur = 1204
+ _uz = 1212
+ _vi = 1219
+ _zh = 1321
+ _zu = 1327
+ _jbo = 515
+ _ami = 1650
+ _bnn = 2357
+ _hak = 438
+ _tlh = 14467
+ _lb = 661
+ _nv = 899
+ _pwn = 12055
+ _tao = 14188
+ _tay = 14198
+ _tsu = 14662
+ _nn = 874
+ _sfb = 13629
+ _vgt = 15701
+ _sgg = 13660
+ _cmn = 3007
+ _nan = 835
+ _hsn = 467
+)
+
+const langPrivateStart = 0x2f72
+
+const langPrivateEnd = 0x3179
+
+// lang holds an alphabetically sorted list of ISO-639 language identifiers.
+// All entries are 4 bytes. The index of the identifier (divided by 4) is the language tag.
+// For 2-byte language identifiers, the two successive bytes have the following meaning:
+// - if the first letter of the 2- and 3-letter ISO codes are the same:
+// the second and third letter of the 3-letter ISO code.
+// - otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3.
+// For 3-byte language identifiers the 4th byte is 0.
+const lang tag.Index = "" + // Size: 5324 bytes
+ "---\x00aaaraai\x00aak\x00aau\x00abbkabi\x00abq\x00abr\x00abt\x00aby\x00a" +
+ "cd\x00ace\x00ach\x00ada\x00ade\x00adj\x00ady\x00adz\x00aeveaeb\x00aey" +
+ "\x00affragc\x00agd\x00agg\x00agm\x00ago\x00agq\x00aha\x00ahl\x00aho\x00a" +
+ "jg\x00akkaakk\x00ala\x00ali\x00aln\x00alt\x00ammhamm\x00amn\x00amo\x00am" +
+ "p\x00anrganc\x00ank\x00ann\x00any\x00aoj\x00aom\x00aoz\x00apc\x00apd\x00" +
+ "ape\x00apr\x00aps\x00apz\x00arraarc\x00arh\x00arn\x00aro\x00arq\x00ars" +
+ "\x00ary\x00arz\x00assmasa\x00ase\x00asg\x00aso\x00ast\x00ata\x00atg\x00a" +
+ "tj\x00auy\x00avvaavl\x00avn\x00avt\x00avu\x00awa\x00awb\x00awo\x00awx" +
+ "\x00ayymayb\x00azzebaakbal\x00ban\x00bap\x00bar\x00bas\x00bav\x00bax\x00" +
+ "bba\x00bbb\x00bbc\x00bbd\x00bbj\x00bbp\x00bbr\x00bcf\x00bch\x00bci\x00bc" +
+ "m\x00bcn\x00bco\x00bcq\x00bcu\x00bdd\x00beelbef\x00beh\x00bej\x00bem\x00" +
+ "bet\x00bew\x00bex\x00bez\x00bfd\x00bfq\x00bft\x00bfy\x00bgulbgc\x00bgn" +
+ "\x00bgx\x00bhihbhb\x00bhg\x00bhi\x00bhk\x00bhl\x00bho\x00bhy\x00biisbib" +
+ "\x00big\x00bik\x00bim\x00bin\x00bio\x00biq\x00bjh\x00bji\x00bjj\x00bjn" +
+ "\x00bjo\x00bjr\x00bjt\x00bjz\x00bkc\x00bkm\x00bkq\x00bku\x00bkv\x00blt" +
+ "\x00bmambmh\x00bmk\x00bmq\x00bmu\x00bnenbng\x00bnm\x00bnp\x00boodboj\x00" +
+ "bom\x00bon\x00bpy\x00bqc\x00bqi\x00bqp\x00bqv\x00brrebra\x00brh\x00brx" +
+ "\x00brz\x00bsosbsj\x00bsq\x00bss\x00bst\x00bto\x00btt\x00btv\x00bua\x00b" +
+ "uc\x00bud\x00bug\x00buk\x00bum\x00buo\x00bus\x00buu\x00bvb\x00bwd\x00bwr" +
+ "\x00bxh\x00bye\x00byn\x00byr\x00bys\x00byv\x00byx\x00bza\x00bze\x00bzf" +
+ "\x00bzh\x00bzw\x00caatcan\x00cbj\x00cch\x00ccp\x00ceheceb\x00cfa\x00cgg" +
+ "\x00chhachk\x00chm\x00cho\x00chp\x00chr\x00cja\x00cjm\x00cjv\x00ckb\x00c" +
+ "kl\x00cko\x00cky\x00cla\x00cme\x00cmg\x00cooscop\x00cps\x00crrecrh\x00cr" +
+ "j\x00crk\x00crl\x00crm\x00crs\x00csescsb\x00csw\x00ctd\x00cuhucvhvcyymda" +
+ "andad\x00daf\x00dag\x00dah\x00dak\x00dar\x00dav\x00dbd\x00dbq\x00dcc\x00" +
+ "ddn\x00deeuded\x00den\x00dga\x00dgh\x00dgi\x00dgl\x00dgr\x00dgz\x00dia" +
+ "\x00dje\x00dnj\x00dob\x00doi\x00dop\x00dow\x00dri\x00drs\x00dsb\x00dtm" +
+ "\x00dtp\x00dts\x00dty\x00dua\x00duc\x00dud\x00dug\x00dvivdva\x00dww\x00d" +
+ "yo\x00dyu\x00dzzodzg\x00ebu\x00eeweefi\x00egl\x00egy\x00eka\x00eky\x00el" +
+ "llema\x00emi\x00enngenn\x00enq\x00eopoeri\x00es\x00\x05esu\x00etstetr" +
+ "\x00ett\x00etu\x00etx\x00euusewo\x00ext\x00faasfaa\x00fab\x00fag\x00fai" +
+ "\x00fan\x00ffulffi\x00ffm\x00fiinfia\x00fil\x00fit\x00fjijflr\x00fmp\x00" +
+ "foaofod\x00fon\x00for\x00fpe\x00fqs\x00frrafrc\x00frp\x00frr\x00frs\x00f" +
+ "ub\x00fud\x00fue\x00fuf\x00fuh\x00fuq\x00fur\x00fuv\x00fuy\x00fvr\x00fyr" +
+ "ygalegaa\x00gaf\x00gag\x00gah\x00gaj\x00gam\x00gan\x00gaw\x00gay\x00gba" +
+ "\x00gbf\x00gbm\x00gby\x00gbz\x00gcr\x00gdlagde\x00gdn\x00gdr\x00geb\x00g" +
+ "ej\x00gel\x00gez\x00gfk\x00ggn\x00ghs\x00gil\x00gim\x00gjk\x00gjn\x00gju" +
+ "\x00gkn\x00gkp\x00gllgglk\x00gmm\x00gmv\x00gnrngnd\x00gng\x00god\x00gof" +
+ "\x00goi\x00gom\x00gon\x00gor\x00gos\x00got\x00grb\x00grc\x00grt\x00grw" +
+ "\x00gsw\x00guujgub\x00guc\x00gud\x00gur\x00guw\x00gux\x00guz\x00gvlvgvf" +
+ "\x00gvr\x00gvs\x00gwc\x00gwi\x00gwt\x00gyi\x00haauhag\x00hak\x00ham\x00h" +
+ "aw\x00haz\x00hbb\x00hdy\x00heebhhy\x00hiinhia\x00hif\x00hig\x00hih\x00hi" +
+ "l\x00hla\x00hlu\x00hmd\x00hmt\x00hnd\x00hne\x00hnj\x00hnn\x00hno\x00homo" +
+ "hoc\x00hoj\x00hot\x00hrrvhsb\x00hsn\x00htathuunhui\x00hyyehzerianaian" +
+ "\x00iar\x00iba\x00ibb\x00iby\x00ica\x00ich\x00idndidd\x00idi\x00idu\x00i" +
+ "eleife\x00igboigb\x00ige\x00iiiiijj\x00ikpkikk\x00ikt\x00ikw\x00ikx\x00i" +
+ "lo\x00imo\x00inndinh\x00iodoiou\x00iri\x00isslittaiukuiw\x00\x03iwm\x00i" +
+ "ws\x00izh\x00izi\x00japnjab\x00jam\x00jbo\x00jbu\x00jen\x00jgk\x00jgo" +
+ "\x00ji\x00\x06jib\x00jmc\x00jml\x00jra\x00jut\x00jvavjwavkaatkaa\x00kab" +
+ "\x00kac\x00kad\x00kai\x00kaj\x00kam\x00kao\x00kbd\x00kbm\x00kbp\x00kbq" +
+ "\x00kbx\x00kby\x00kcg\x00kck\x00kcl\x00kct\x00kde\x00kdh\x00kdl\x00kdt" +
+ "\x00kea\x00ken\x00kez\x00kfo\x00kfr\x00kfy\x00kgonkge\x00kgf\x00kgp\x00k" +
+ "ha\x00khb\x00khn\x00khq\x00khs\x00kht\x00khw\x00khz\x00kiikkij\x00kiu" +
+ "\x00kiw\x00kjuakjd\x00kjg\x00kjs\x00kjy\x00kkazkkc\x00kkj\x00klalkln\x00" +
+ "klq\x00klt\x00klx\x00kmhmkmb\x00kmh\x00kmo\x00kms\x00kmu\x00kmw\x00knank" +
+ "nf\x00knp\x00koorkoi\x00kok\x00kol\x00kos\x00koz\x00kpe\x00kpf\x00kpo" +
+ "\x00kpr\x00kpx\x00kqb\x00kqf\x00kqs\x00kqy\x00kraukrc\x00kri\x00krj\x00k" +
+ "rl\x00krs\x00kru\x00ksasksb\x00ksd\x00ksf\x00ksh\x00ksj\x00ksr\x00ktb" +
+ "\x00ktm\x00kto\x00kuurkub\x00kud\x00kue\x00kuj\x00kum\x00kun\x00kup\x00k" +
+ "us\x00kvomkvg\x00kvr\x00kvx\x00kw\x00\x01kwj\x00kwo\x00kxa\x00kxc\x00kxm" +
+ "\x00kxp\x00kxw\x00kxz\x00kyirkye\x00kyx\x00kzr\x00laatlab\x00lad\x00lag" +
+ "\x00lah\x00laj\x00las\x00lbtzlbe\x00lbu\x00lbw\x00lcm\x00lcp\x00ldb\x00l" +
+ "ed\x00lee\x00lem\x00lep\x00leq\x00leu\x00lez\x00lguglgg\x00liimlia\x00li" +
+ "d\x00lif\x00lig\x00lih\x00lij\x00lis\x00ljp\x00lki\x00lkt\x00lle\x00lln" +
+ "\x00lmn\x00lmo\x00lmp\x00lninlns\x00lnu\x00loaoloj\x00lok\x00lol\x00lor" +
+ "\x00los\x00loz\x00lrc\x00ltitltg\x00luublua\x00luo\x00luy\x00luz\x00lvav" +
+ "lwl\x00lzh\x00lzz\x00mad\x00maf\x00mag\x00mai\x00mak\x00man\x00mas\x00ma" +
+ "w\x00maz\x00mbh\x00mbo\x00mbq\x00mbu\x00mbw\x00mci\x00mcp\x00mcq\x00mcr" +
+ "\x00mcu\x00mda\x00mde\x00mdf\x00mdh\x00mdj\x00mdr\x00mdx\x00med\x00mee" +
+ "\x00mek\x00men\x00mer\x00met\x00meu\x00mfa\x00mfe\x00mfn\x00mfo\x00mfq" +
+ "\x00mglgmgh\x00mgl\x00mgo\x00mgp\x00mgy\x00mhahmhi\x00mhl\x00mirimif\x00" +
+ "min\x00mis\x00miw\x00mkkdmki\x00mkl\x00mkp\x00mkw\x00mlalmle\x00mlp\x00m" +
+ "ls\x00mmo\x00mmu\x00mmx\x00mnonmna\x00mnf\x00mni\x00mnw\x00moolmoa\x00mo" +
+ "e\x00moh\x00mos\x00mox\x00mpp\x00mps\x00mpt\x00mpx\x00mql\x00mrarmrd\x00" +
+ "mrj\x00mro\x00mssamtltmtc\x00mtf\x00mti\x00mtr\x00mua\x00mul\x00mur\x00m" +
+ "us\x00mva\x00mvn\x00mvy\x00mwk\x00mwr\x00mwv\x00mxc\x00mxm\x00myyamyk" +
+ "\x00mym\x00myv\x00myw\x00myx\x00myz\x00mzk\x00mzm\x00mzn\x00mzp\x00mzw" +
+ "\x00mzz\x00naaunac\x00naf\x00nah\x00nak\x00nan\x00nap\x00naq\x00nas\x00n" +
+ "bobnca\x00nce\x00ncf\x00nch\x00nco\x00ncu\x00nddendc\x00nds\x00neepneb" +
+ "\x00new\x00nex\x00nfr\x00ngdonga\x00ngb\x00ngl\x00nhb\x00nhe\x00nhw\x00n" +
+ "if\x00nii\x00nij\x00nin\x00niu\x00niy\x00niz\x00njo\x00nkg\x00nko\x00nll" +
+ "dnmg\x00nmz\x00nnnonnf\x00nnh\x00nnk\x00nnm\x00noornod\x00noe\x00non\x00" +
+ "nop\x00nou\x00nqo\x00nrblnrb\x00nsk\x00nsn\x00nso\x00nss\x00ntm\x00ntr" +
+ "\x00nui\x00nup\x00nus\x00nuv\x00nux\x00nvavnwb\x00nxq\x00nxr\x00nyyanym" +
+ "\x00nyn\x00nzi\x00occiogc\x00ojjiokr\x00okv\x00omrmong\x00onn\x00ons\x00" +
+ "opm\x00orrioro\x00oru\x00osssosa\x00ota\x00otk\x00ozm\x00paanpag\x00pal" +
+ "\x00pam\x00pap\x00pau\x00pbi\x00pcd\x00pcm\x00pdc\x00pdt\x00ped\x00peo" +
+ "\x00pex\x00pfl\x00phl\x00phn\x00pilipil\x00pip\x00pka\x00pko\x00plolpla" +
+ "\x00pms\x00png\x00pnn\x00pnt\x00pon\x00ppo\x00pra\x00prd\x00prg\x00psusp" +
+ "ss\x00ptorptp\x00puu\x00pwa\x00quuequc\x00qug\x00rai\x00raj\x00rao\x00rc" +
+ "f\x00rej\x00rel\x00res\x00rgn\x00rhg\x00ria\x00rif\x00rjs\x00rkt\x00rmoh" +
+ "rmf\x00rmo\x00rmt\x00rmu\x00rnunrna\x00rng\x00roonrob\x00rof\x00roo\x00r" +
+ "ro\x00rtm\x00ruusrue\x00rug\x00rw\x00\x04rwk\x00rwo\x00ryu\x00saansaf" +
+ "\x00sah\x00saq\x00sas\x00sat\x00sav\x00saz\x00sba\x00sbe\x00sbp\x00scrds" +
+ "ck\x00scl\x00scn\x00sco\x00scs\x00sdndsdc\x00sdh\x00semesef\x00seh\x00se" +
+ "i\x00ses\x00sgagsga\x00sgs\x00sgw\x00sgz\x00sh\x00\x02shi\x00shk\x00shn" +
+ "\x00shu\x00siinsid\x00sig\x00sil\x00sim\x00sjr\x00sklkskc\x00skr\x00sks" +
+ "\x00sllvsld\x00sli\x00sll\x00sly\x00smmosma\x00smi\x00smj\x00smn\x00smp" +
+ "\x00smq\x00sms\x00snnasnc\x00snk\x00snp\x00snx\x00sny\x00soomsok\x00soq" +
+ "\x00sou\x00soy\x00spd\x00spl\x00sps\x00sqqisrrpsrb\x00srn\x00srr\x00srx" +
+ "\x00ssswssd\x00ssg\x00ssy\x00stotstk\x00stq\x00suunsua\x00sue\x00suk\x00" +
+ "sur\x00sus\x00svweswwaswb\x00swc\x00swg\x00swp\x00swv\x00sxn\x00sxw\x00s" +
+ "yl\x00syr\x00szl\x00taamtaj\x00tal\x00tan\x00taq\x00tbc\x00tbd\x00tbf" +
+ "\x00tbg\x00tbo\x00tbw\x00tbz\x00tci\x00tcy\x00tdd\x00tdg\x00tdh\x00teelt" +
+ "ed\x00tem\x00teo\x00tet\x00tfi\x00tggktgc\x00tgo\x00tgu\x00thhathl\x00th" +
+ "q\x00thr\x00tiirtif\x00tig\x00tik\x00tim\x00tio\x00tiv\x00tkuktkl\x00tkr" +
+ "\x00tkt\x00tlgltlf\x00tlx\x00tly\x00tmh\x00tmy\x00tnsntnh\x00toontof\x00" +
+ "tog\x00toq\x00tpi\x00tpm\x00tpz\x00tqo\x00trurtru\x00trv\x00trw\x00tssot" +
+ "sd\x00tsf\x00tsg\x00tsj\x00tsw\x00ttatttd\x00tte\x00ttj\x00ttr\x00tts" +
+ "\x00ttt\x00tuh\x00tul\x00tum\x00tuq\x00tvd\x00tvl\x00tvu\x00twwitwh\x00t" +
+ "wq\x00txg\x00tyahtya\x00tyv\x00tzm\x00ubu\x00udm\x00ugiguga\x00ukkruli" +
+ "\x00umb\x00und\x00unr\x00unx\x00urrduri\x00urt\x00urw\x00usa\x00utr\x00u" +
+ "vh\x00uvl\x00uzzbvag\x00vai\x00van\x00veenvec\x00vep\x00viievic\x00viv" +
+ "\x00vls\x00vmf\x00vmw\x00voolvot\x00vro\x00vun\x00vut\x00walnwae\x00waj" +
+ "\x00wal\x00wan\x00war\x00wbp\x00wbq\x00wbr\x00wci\x00wer\x00wgi\x00whg" +
+ "\x00wib\x00wiu\x00wiv\x00wja\x00wji\x00wls\x00wmo\x00wnc\x00wni\x00wnu" +
+ "\x00woolwob\x00wos\x00wrs\x00wsk\x00wtm\x00wuu\x00wuv\x00wwa\x00xav\x00x" +
+ "bi\x00xcr\x00xes\x00xhhoxla\x00xlc\x00xld\x00xmf\x00xmn\x00xmr\x00xna" +
+ "\x00xnr\x00xog\x00xon\x00xpr\x00xrb\x00xsa\x00xsi\x00xsm\x00xsr\x00xwe" +
+ "\x00yam\x00yao\x00yap\x00yas\x00yat\x00yav\x00yay\x00yaz\x00yba\x00ybb" +
+ "\x00yby\x00yer\x00ygr\x00ygw\x00yiidyko\x00yle\x00ylg\x00yll\x00yml\x00y" +
+ "ooryon\x00yrb\x00yre\x00yrl\x00yss\x00yua\x00yue\x00yuj\x00yut\x00yuw" +
+ "\x00zahazag\x00zbl\x00zdj\x00zea\x00zgh\x00zhhozhx\x00zia\x00zlm\x00zmi" +
+ "\x00zne\x00zuulzxx\x00zza\x00\xff\xff\xff\xff"
+
+const langNoIndexOffset = 1330
+
+// langNoIndex is a bit vector of all 3-letter language codes that are not used as an index
+// in lookup tables. The language ids for these language codes are derived directly
+// from the letters and are not consecutive.
+// Size: 2197 bytes, 2197 elements
+var langNoIndex = [2197]uint8{
+ // Entry 0 - 3F
+ 0xff, 0xf8, 0xed, 0xfe, 0xeb, 0xd3, 0x3b, 0xd2,
+ 0xfb, 0xbf, 0x7a, 0xfa, 0x37, 0x1d, 0x3c, 0x57,
+ 0x6e, 0x97, 0x73, 0x38, 0xfb, 0xea, 0xbf, 0x70,
+ 0xad, 0x03, 0xff, 0xff, 0xcf, 0x05, 0x84, 0x62,
+ 0xe9, 0xbf, 0xfd, 0xbf, 0xbf, 0xf7, 0xfd, 0x77,
+ 0x0f, 0xff, 0xef, 0x6f, 0xff, 0xfb, 0xdf, 0xe2,
+ 0xc9, 0xf8, 0x7f, 0x7e, 0x4d, 0xb8, 0x0a, 0x6a,
+ 0x7c, 0xea, 0xe3, 0xfa, 0x7a, 0xbf, 0x67, 0xff,
+ // Entry 40 - 7F
+ 0xff, 0xff, 0xff, 0xdf, 0x2a, 0x54, 0x91, 0xc0,
+ 0x5d, 0xe3, 0x97, 0x14, 0x07, 0x20, 0xdd, 0xed,
+ 0x9f, 0x3f, 0xc9, 0x21, 0xf8, 0x3f, 0x94, 0x35,
+ 0x7c, 0x5f, 0xff, 0x5f, 0x8e, 0x6e, 0xdf, 0xff,
+ 0xff, 0xff, 0x55, 0x7c, 0xd3, 0xfd, 0xbf, 0xb5,
+ 0x7b, 0xdf, 0x7f, 0xf7, 0xca, 0xfe, 0xdb, 0xa3,
+ 0xa8, 0xff, 0x1f, 0x67, 0x7d, 0xeb, 0xef, 0xce,
+ 0xff, 0xff, 0x9f, 0xff, 0xb7, 0xef, 0xfe, 0xcf,
+ // Entry 80 - BF
+ 0xdb, 0xff, 0xf3, 0xcd, 0xfb, 0x2f, 0xff, 0xff,
+ 0xbb, 0xee, 0xf7, 0xbd, 0xdb, 0xff, 0x5f, 0xf7,
+ 0xfd, 0xf2, 0xfd, 0xff, 0x5e, 0x2f, 0x3b, 0xba,
+ 0x7e, 0xff, 0xff, 0xfe, 0xf7, 0xff, 0xdd, 0xff,
+ 0xfd, 0xdf, 0xfb, 0xfe, 0x9d, 0xb4, 0xd3, 0xff,
+ 0xef, 0xff, 0xdf, 0xf7, 0x7f, 0xb7, 0xfd, 0xd5,
+ 0xa5, 0x77, 0x40, 0xff, 0x9c, 0xc1, 0x41, 0x2c,
+ 0x08, 0x20, 0x41, 0x00, 0x50, 0x40, 0x00, 0x80,
+ // Entry C0 - FF
+ 0xfb, 0x4a, 0xf2, 0x9f, 0xb4, 0x42, 0x41, 0x96,
+ 0x1b, 0x14, 0x08, 0xf2, 0x2b, 0xe7, 0x17, 0x56,
+ 0x05, 0x7d, 0x0e, 0x1c, 0x37, 0x71, 0xf3, 0xef,
+ 0x97, 0xff, 0x5d, 0x38, 0x64, 0x08, 0x00, 0x10,
+ 0xbc, 0x85, 0xaf, 0xdf, 0xff, 0xf7, 0x73, 0x35,
+ 0x3e, 0x87, 0xc7, 0xdf, 0xff, 0x00, 0x81, 0x00,
+ 0xb0, 0x05, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03,
+ 0x40, 0x00, 0x40, 0x92, 0x21, 0x50, 0xb1, 0x5d,
+ // Entry 100 - 13F
+ 0xfd, 0xdc, 0xbe, 0x5e, 0x00, 0x00, 0x02, 0x64,
+ 0x0d, 0x19, 0x41, 0xdf, 0x79, 0x22, 0x00, 0x00,
+ 0x00, 0x5e, 0x64, 0xdc, 0x24, 0xe5, 0xd9, 0xe3,
+ 0xfe, 0xff, 0xfd, 0xcb, 0x9f, 0x14, 0x01, 0x0c,
+ 0x86, 0x00, 0xd1, 0x00, 0xf0, 0xc5, 0x67, 0x5f,
+ 0x56, 0x89, 0x5e, 0xb5, 0x6c, 0xaf, 0x03, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0xc0, 0x37, 0xda, 0x56,
+ 0x90, 0x69, 0x01, 0x2c, 0x96, 0x69, 0x20, 0xfb,
+ // Entry 140 - 17F
+ 0xff, 0x3f, 0x00, 0x00, 0x00, 0x01, 0x08, 0x16,
+ 0x01, 0x00, 0x00, 0xb0, 0x14, 0x03, 0x50, 0x06,
+ 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x09,
+ 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x10,
+ 0x00, 0x00, 0x44, 0x00, 0x00, 0x10, 0x00, 0x04,
+ 0x08, 0x00, 0x00, 0x04, 0x00, 0x80, 0x28, 0x04,
+ 0x00, 0x00, 0x40, 0xd5, 0x2d, 0x00, 0x64, 0x35,
+ 0x24, 0x52, 0xf4, 0xd4, 0xbd, 0x62, 0xc9, 0x03,
+ // Entry 180 - 1BF
+ 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x04, 0x13, 0x39, 0x01, 0xdd, 0x57, 0x98,
+ 0x21, 0x18, 0x81, 0x00, 0x00, 0x01, 0x40, 0x82,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x40, 0x00, 0x44, 0x00, 0x00, 0x80, 0xea,
+ 0xa9, 0x39, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ // Entry 1C0 - 1FF
+ 0x00, 0x01, 0x28, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x20, 0x04, 0xa6, 0x00, 0x04, 0x00, 0x00,
+ 0x81, 0x50, 0x00, 0x00, 0x00, 0x11, 0x84, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x55,
+ 0x02, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x40,
+ 0x30, 0x83, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x1e, 0xcd, 0xbf, 0x7a, 0xbf,
+ // Entry 200 - 23F
+ 0xdf, 0xc3, 0x83, 0x82, 0xc0, 0xfb, 0x57, 0x27,
+ 0xcd, 0x55, 0xe7, 0x01, 0x00, 0x20, 0xb2, 0xc5,
+ 0xa4, 0x45, 0x25, 0x9b, 0x02, 0xdf, 0xe0, 0xdf,
+ 0x03, 0x44, 0x08, 0x10, 0x01, 0x04, 0x01, 0xe3,
+ 0x92, 0x54, 0xdb, 0x28, 0xd1, 0x5f, 0xf6, 0x6d,
+ 0x79, 0xed, 0x1c, 0x7d, 0x04, 0x08, 0x00, 0x01,
+ 0x21, 0x12, 0x64, 0x5f, 0xdd, 0x0e, 0x85, 0x4f,
+ 0x40, 0x40, 0x00, 0x04, 0xf1, 0xfd, 0x3d, 0x54,
+ // Entry 240 - 27F
+ 0xe8, 0x03, 0xb4, 0x27, 0x23, 0x0d, 0x00, 0x00,
+ 0x20, 0x7b, 0x38, 0x02, 0x05, 0x84, 0x00, 0xf0,
+ 0xbb, 0x7e, 0x5a, 0x00, 0x18, 0x04, 0x81, 0x00,
+ 0x00, 0x00, 0x80, 0x10, 0x90, 0x1c, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x04,
+ 0x08, 0xa0, 0x70, 0xa5, 0x0c, 0x40, 0x00, 0x00,
+ 0x11, 0x04, 0x04, 0x68, 0x00, 0x20, 0x70, 0xff,
+ 0x7b, 0x7f, 0x60, 0x00, 0x05, 0x9b, 0xdd, 0x66,
+ // Entry 280 - 2BF
+ 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, 0x40, 0x05,
+ 0xb5, 0xb6, 0x80, 0x08, 0x04, 0x00, 0x04, 0x51,
+ 0xe2, 0xef, 0xfd, 0x3f, 0x05, 0x09, 0x08, 0x05,
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x60,
+ 0xe7, 0x48, 0x00, 0x81, 0x20, 0xc0, 0x05, 0x80,
+ 0x03, 0x00, 0x00, 0x00, 0x8c, 0x50, 0x40, 0x04,
+ 0x84, 0x47, 0x84, 0x40, 0x20, 0x10, 0x00, 0x20,
+ // Entry 2C0 - 2FF
+ 0x02, 0x50, 0x80, 0x11, 0x00, 0x91, 0x6c, 0xe2,
+ 0x50, 0x27, 0x1d, 0x11, 0x29, 0x06, 0x59, 0xe9,
+ 0x33, 0x08, 0x00, 0x20, 0x04, 0x40, 0x10, 0x00,
+ 0x00, 0x00, 0x50, 0x44, 0x92, 0x49, 0xd6, 0x5d,
+ 0xa7, 0x81, 0x47, 0x97, 0xfb, 0x00, 0x10, 0x00,
+ 0x08, 0x00, 0x80, 0x00, 0x40, 0x04, 0x00, 0x01,
+ 0x02, 0x00, 0x01, 0x40, 0x80, 0x00, 0x00, 0x08,
+ 0xd8, 0xeb, 0xf6, 0x39, 0xc4, 0x89, 0x12, 0x00,
+ // Entry 300 - 33F
+ 0x00, 0x0c, 0x04, 0x01, 0x20, 0x20, 0xdd, 0xa0,
+ 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
+ 0x04, 0x10, 0xd0, 0x9d, 0x95, 0x13, 0x04, 0x80,
+ 0x00, 0x01, 0xd0, 0x12, 0x40, 0x00, 0x10, 0xb0,
+ 0x10, 0x62, 0x4c, 0xd2, 0x02, 0x01, 0x4a, 0x00,
+ 0x46, 0x04, 0x00, 0x08, 0x02, 0x00, 0x20, 0x80,
+ 0x00, 0x80, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0xf0, 0xd8, 0x6f, 0x15, 0x02, 0x08, 0x00,
+ // Entry 340 - 37F
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01,
+ 0x00, 0x10, 0x00, 0x00, 0x00, 0xf0, 0x84, 0xe3,
+ 0xdd, 0xbf, 0xf9, 0xf9, 0x3b, 0x7f, 0x7f, 0xdb,
+ 0xfd, 0xfc, 0xfe, 0xdf, 0xff, 0xfd, 0xff, 0xf6,
+ 0xfb, 0xfc, 0xf7, 0x1f, 0xff, 0xb3, 0x6c, 0xff,
+ 0xd9, 0xad, 0xdf, 0xfe, 0xef, 0xba, 0xdf, 0xff,
+ 0xff, 0xff, 0xb7, 0xdd, 0x7d, 0xbf, 0xab, 0x7f,
+ 0xfd, 0xfd, 0xdf, 0x2f, 0x9c, 0xdf, 0xf3, 0x6f,
+ // Entry 380 - 3BF
+ 0xdf, 0xdd, 0xff, 0xfb, 0xee, 0xd2, 0xab, 0x5f,
+ 0xd5, 0xdf, 0x7f, 0xff, 0xeb, 0xff, 0xe4, 0x4d,
+ 0xf9, 0xff, 0xfe, 0xf7, 0xfd, 0xdf, 0xfb, 0xbf,
+ 0xee, 0xdb, 0x6f, 0xef, 0xff, 0x7f, 0xff, 0xff,
+ 0xf7, 0x5f, 0xd3, 0x3b, 0xfd, 0xd9, 0xdf, 0xeb,
+ 0xbc, 0x08, 0x05, 0x24, 0xff, 0x07, 0x70, 0xfe,
+ 0xe6, 0x5e, 0x00, 0x08, 0x00, 0x83, 0x3d, 0x1b,
+ 0x06, 0xe6, 0x72, 0x60, 0xd1, 0x3c, 0x7f, 0x44,
+ // Entry 3C0 - 3FF
+ 0x02, 0x30, 0x9f, 0x7a, 0x16, 0xbd, 0x7f, 0x57,
+ 0xf2, 0xff, 0x31, 0xff, 0xf2, 0x1e, 0x90, 0xf7,
+ 0xf1, 0xf9, 0x45, 0x80, 0x01, 0x02, 0x00, 0x00,
+ 0x40, 0x54, 0x9f, 0x8a, 0xd9, 0xd9, 0x0e, 0x11,
+ 0x86, 0x51, 0xc0, 0xf3, 0xfb, 0x47, 0x00, 0x01,
+ 0x05, 0xd1, 0x50, 0x58, 0x00, 0x00, 0x00, 0x10,
+ 0x04, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x17, 0xd2,
+ 0xb9, 0xfd, 0xfc, 0xba, 0xfe, 0xef, 0xc7, 0xbe,
+ // Entry 400 - 43F
+ 0x53, 0x6f, 0xdf, 0xe7, 0xdb, 0x65, 0xbb, 0x7f,
+ 0xfa, 0xff, 0x77, 0xf3, 0xef, 0xbf, 0xfd, 0xf7,
+ 0xdf, 0xdf, 0x9b, 0x7f, 0xff, 0xff, 0x7f, 0x6f,
+ 0xf7, 0xfb, 0xeb, 0xdf, 0xbc, 0xff, 0xbf, 0x6b,
+ 0x7b, 0xfb, 0xff, 0xce, 0x76, 0xbd, 0xf7, 0xf7,
+ 0xdf, 0xdc, 0xf7, 0xf7, 0xff, 0xdf, 0xf3, 0xfe,
+ 0xef, 0xff, 0xff, 0xff, 0xb6, 0x7f, 0x7f, 0xde,
+ 0xf7, 0xb9, 0xeb, 0x77, 0xff, 0xfb, 0xbf, 0xdf,
+ // Entry 440 - 47F
+ 0xfd, 0xfe, 0xfb, 0xff, 0xfe, 0xeb, 0x1f, 0x7d,
+ 0x2f, 0xfd, 0xb6, 0xb5, 0xa5, 0xfc, 0xff, 0xfd,
+ 0x7f, 0x4e, 0xbf, 0x8f, 0xae, 0xff, 0xee, 0xdf,
+ 0x7f, 0xf7, 0x73, 0x02, 0x02, 0x04, 0xfc, 0xf7,
+ 0xff, 0xb7, 0xd7, 0xef, 0xfe, 0xcd, 0xf5, 0xce,
+ 0xe2, 0x8e, 0xe7, 0xbf, 0xb7, 0xff, 0x56, 0xbd,
+ 0xcd, 0xff, 0xfb, 0xff, 0xdf, 0xd7, 0xea, 0xff,
+ 0xe5, 0x5f, 0x6d, 0x0f, 0xa7, 0x51, 0x06, 0xc4,
+ // Entry 480 - 4BF
+ 0x13, 0x50, 0x5d, 0xaf, 0xa6, 0xfd, 0x99, 0xfb,
+ 0x63, 0x1d, 0x53, 0xff, 0xef, 0xb7, 0x35, 0x20,
+ 0x14, 0x00, 0x55, 0x51, 0x82, 0x65, 0xf5, 0x41,
+ 0xe2, 0xff, 0xfc, 0xdf, 0x00, 0x05, 0xc5, 0x05,
+ 0x00, 0x22, 0x00, 0x74, 0x69, 0x10, 0x08, 0x04,
+ 0x41, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x51, 0x20, 0x05, 0x04, 0x01, 0x00, 0x00,
+ 0x06, 0x01, 0x20, 0x00, 0x18, 0x01, 0x92, 0xb1,
+ // Entry 4C0 - 4FF
+ 0xfd, 0x47, 0x49, 0x06, 0x95, 0x06, 0x57, 0xed,
+ 0xfb, 0x4c, 0x1c, 0x6b, 0x83, 0x04, 0x62, 0x40,
+ 0x00, 0x11, 0x42, 0x00, 0x00, 0x00, 0x54, 0x83,
+ 0xb8, 0x4f, 0x10, 0x8c, 0x89, 0x46, 0xde, 0xf7,
+ 0x13, 0x31, 0x00, 0x20, 0x00, 0x00, 0x00, 0x90,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x00,
+ 0x01, 0x00, 0x00, 0xf0, 0x5b, 0xf4, 0xbe, 0x3d,
+ 0xba, 0xcf, 0xf7, 0xaf, 0x42, 0x04, 0x84, 0x41,
+ // Entry 500 - 53F
+ 0x30, 0xff, 0x79, 0x72, 0x04, 0x00, 0x00, 0x49,
+ 0x2d, 0x14, 0x27, 0x57, 0xed, 0xf1, 0x3f, 0xe7,
+ 0x3f, 0x00, 0x00, 0x02, 0xc6, 0xa0, 0x1e, 0xf8,
+ 0xbb, 0xff, 0xfd, 0xfb, 0xb7, 0xfd, 0xe5, 0xf7,
+ 0xfd, 0xfc, 0xd5, 0xed, 0x47, 0xf4, 0x7e, 0x10,
+ 0x01, 0x01, 0x84, 0x6d, 0xff, 0xf7, 0xdd, 0xf9,
+ 0x5b, 0x05, 0x86, 0xed, 0xf5, 0x77, 0xbd, 0x3c,
+ 0x00, 0x00, 0x00, 0x42, 0x71, 0x42, 0x00, 0x40,
+ // Entry 540 - 57F
+ 0x00, 0x00, 0x01, 0x43, 0x19, 0x00, 0x08, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ // Entry 580 - 5BF
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xab, 0xbd, 0xe7, 0x57, 0xee, 0x13, 0x5d,
+ 0x09, 0xc1, 0x40, 0x21, 0xfa, 0x17, 0x01, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0xf0, 0xce, 0xfb, 0xbf,
+ 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
+ 0x00, 0x30, 0x15, 0xa3, 0x10, 0x00, 0x00, 0x00,
+ 0x11, 0x04, 0x16, 0x00, 0x00, 0x02, 0x00, 0x81,
+ 0xa3, 0x01, 0x50, 0x00, 0x00, 0x83, 0x11, 0x40,
+ // Entry 5C0 - 5FF
+ 0x00, 0x00, 0x00, 0xf0, 0xdd, 0x7b, 0x3e, 0x02,
+ 0xaa, 0x10, 0x5d, 0x98, 0x52, 0x00, 0x80, 0x20,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x02,
+ 0x19, 0x00, 0x10, 0x02, 0x10, 0x61, 0x5a, 0x9d,
+ 0x31, 0x00, 0x00, 0x00, 0x01, 0x10, 0x02, 0x20,
+ 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x20, 0x00,
+ 0x00, 0x1f, 0xdf, 0xd2, 0xb9, 0xff, 0xfd, 0x3f,
+ 0x1f, 0x98, 0xcf, 0x9c, 0xbf, 0xaf, 0x5f, 0xfe,
+ // Entry 600 - 63F
+ 0x7b, 0x4b, 0x40, 0x10, 0xe1, 0xfd, 0xaf, 0xd9,
+ 0xb7, 0xf6, 0xfb, 0xb3, 0xc7, 0xff, 0x6f, 0xf1,
+ 0x73, 0xb1, 0x7f, 0x9f, 0x7f, 0xbd, 0xfc, 0xb7,
+ 0xee, 0x1c, 0xfa, 0xcb, 0xef, 0xdd, 0xf9, 0xbd,
+ 0x6e, 0xae, 0x55, 0xfd, 0x6e, 0x81, 0x76, 0x1f,
+ 0xd4, 0x77, 0xf5, 0x7d, 0xfb, 0xff, 0xeb, 0xfe,
+ 0xbe, 0x5f, 0x46, 0x1b, 0xe9, 0x5f, 0x50, 0x18,
+ 0x02, 0xfa, 0xf7, 0x9d, 0x15, 0x97, 0x05, 0x0f,
+ // Entry 640 - 67F
+ 0x75, 0xc4, 0x7d, 0x81, 0x92, 0xf1, 0x57, 0x6c,
+ 0xff, 0xe4, 0xef, 0x6f, 0xff, 0xfc, 0xdd, 0xde,
+ 0xfc, 0xfd, 0x76, 0x5f, 0x7a, 0x1f, 0x00, 0x98,
+ 0x02, 0xfb, 0xa3, 0xef, 0xf3, 0xd6, 0xf2, 0xff,
+ 0xb9, 0xda, 0x7d, 0x50, 0x1e, 0x15, 0x7b, 0xb4,
+ 0xf5, 0x3e, 0xff, 0xff, 0xf1, 0xf7, 0xff, 0xe7,
+ 0x5f, 0xff, 0xff, 0x9e, 0xdb, 0xf6, 0xd7, 0xb9,
+ 0xef, 0x27, 0x80, 0xbb, 0xc5, 0xff, 0xff, 0xe3,
+ // Entry 680 - 6BF
+ 0x97, 0x9d, 0xbf, 0x9f, 0xf7, 0xc7, 0xfd, 0x37,
+ 0xce, 0x7f, 0x04, 0x1d, 0x53, 0x7f, 0xf8, 0xda,
+ 0x5d, 0xce, 0x7d, 0x06, 0xb9, 0xea, 0x69, 0xa0,
+ 0x1a, 0x20, 0x00, 0x30, 0x02, 0x04, 0x24, 0x08,
+ 0x04, 0x00, 0x00, 0x40, 0xd4, 0x02, 0x04, 0x00,
+ 0x00, 0x04, 0x00, 0x04, 0x00, 0x20, 0x01, 0x06,
+ 0x50, 0x00, 0x08, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x04, 0x00, 0x10, 0xcc, 0x58, 0xd5, 0x0d, 0x0f,
+ // Entry 6C0 - 6FF
+ 0x14, 0x4d, 0xf1, 0x16, 0x44, 0xd1, 0x42, 0x08,
+ 0x40, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0xdc, 0xfb, 0xcb, 0x0e, 0x58, 0x08, 0x41,
+ 0x04, 0x20, 0x04, 0x00, 0x30, 0x12, 0x40, 0x00,
+ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x80, 0x10, 0x10, 0xab,
+ 0x6d, 0x93, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x80, 0x25, 0x00, 0x00,
+ // Entry 700 - 73F
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+ 0x80, 0x86, 0xc2, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0xdf, 0x18, 0x00, 0x00, 0x02, 0xf0, 0xfd, 0x79,
+ 0x3b, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
+ 0x03, 0x00, 0x09, 0x20, 0x00, 0x00, 0x01, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 740 - 77F
+ 0x00, 0x00, 0x00, 0xef, 0xd5, 0xfd, 0xcf, 0x7e,
+ 0xb0, 0x11, 0x00, 0x00, 0x00, 0x92, 0x01, 0x44,
+ 0xcd, 0xf9, 0x5c, 0x00, 0x01, 0x00, 0x30, 0x04,
+ 0x04, 0x55, 0x00, 0x01, 0x04, 0xf4, 0x3f, 0x4a,
+ 0x01, 0x00, 0x00, 0xb0, 0x80, 0x00, 0x55, 0x55,
+ 0x97, 0x7c, 0x9f, 0x31, 0xcc, 0x68, 0xd1, 0x03,
+ 0xd5, 0x57, 0x27, 0x14, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x2c, 0xf7, 0xcb, 0x1f, 0x14, 0x60,
+ // Entry 780 - 7BF
+ 0x03, 0x68, 0x01, 0x10, 0x8b, 0x38, 0x8a, 0x01,
+ 0x00, 0x00, 0x20, 0x00, 0x24, 0x44, 0x00, 0x00,
+ 0x10, 0x03, 0x11, 0x02, 0x01, 0x00, 0x00, 0xf0,
+ 0xf5, 0xff, 0xd5, 0x97, 0xbc, 0x70, 0xd6, 0x78,
+ 0x78, 0x15, 0x50, 0x01, 0xa4, 0x84, 0xa9, 0x41,
+ 0x00, 0x00, 0x00, 0x6b, 0x39, 0x52, 0x74, 0x00,
+ 0xe8, 0x30, 0x90, 0x6a, 0x92, 0x00, 0x00, 0x02,
+ 0xff, 0xef, 0xff, 0x4b, 0x85, 0x53, 0xf4, 0xed,
+ // Entry 7C0 - 7FF
+ 0xdd, 0xbf, 0x72, 0x19, 0xc7, 0x0c, 0xd5, 0x42,
+ 0x54, 0xdd, 0x77, 0x14, 0x00, 0x80, 0x40, 0x56,
+ 0xcc, 0x16, 0x9e, 0xea, 0x35, 0x7d, 0xef, 0xff,
+ 0xbd, 0xa4, 0xaf, 0x01, 0x44, 0x18, 0x01, 0x4d,
+ 0x4e, 0x4a, 0x08, 0x50, 0x28, 0x30, 0xe0, 0x80,
+ 0x10, 0x20, 0x24, 0x00, 0xff, 0x2f, 0xd3, 0x60,
+ 0xfe, 0x01, 0x02, 0x88, 0x0a, 0x40, 0x16, 0x01,
+ 0x01, 0x15, 0x2b, 0x3c, 0x01, 0x00, 0x00, 0x10,
+ // Entry 800 - 83F
+ 0x90, 0x49, 0x41, 0x02, 0x02, 0x01, 0xe1, 0xbf,
+ 0xbf, 0x03, 0x00, 0x00, 0x10, 0xd4, 0xa3, 0xd1,
+ 0x40, 0x9c, 0x44, 0xdf, 0xf5, 0x8f, 0x66, 0xb3,
+ 0x55, 0x20, 0xd4, 0xc1, 0xd8, 0x30, 0x3d, 0x80,
+ 0x00, 0x00, 0x00, 0x04, 0xd4, 0x11, 0xc5, 0x84,
+ 0x2e, 0x50, 0x00, 0x22, 0x50, 0x6e, 0xbd, 0x93,
+ 0x07, 0x00, 0x20, 0x10, 0x84, 0xb2, 0x45, 0x10,
+ 0x06, 0x44, 0x00, 0x00, 0x12, 0x02, 0x11, 0x00,
+ // Entry 840 - 87F
+ 0xf0, 0xfb, 0xfd, 0x3f, 0x05, 0x00, 0x12, 0x81,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x02, 0x28,
+ 0x84, 0x00, 0x21, 0xc0, 0x23, 0x24, 0x00, 0x00,
+ 0x00, 0xcb, 0xe4, 0x3a, 0x42, 0x88, 0x14, 0xf1,
+ 0xef, 0xff, 0x7f, 0x12, 0x01, 0x01, 0x84, 0x50,
+ 0x07, 0xfc, 0xff, 0xff, 0x0f, 0x01, 0x00, 0x40,
+ 0x10, 0x38, 0x01, 0x01, 0x1c, 0x12, 0x40, 0xe1,
+ // Entry 880 - 8BF
+ 0x76, 0x16, 0x08, 0x03, 0x10, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x24,
+ 0x0a, 0x00, 0x80, 0x00, 0x00,
+}
+
+// altLangISO3 holds an alphabetically sorted list of 3-letter language code alternatives
+// to 2-letter language codes that cannot be derived using the method described above.
+// Each 3-letter code is followed by its 1-byte langID.
+const altLangISO3 tag.Index = "---\x00cor\x00hbs\x01heb\x02kin\x03spa\x04yid\x05\xff\xff\xff\xff"
+
+// altLangIndex is used to convert indexes in altLangISO3 to langIDs.
+// Size: 12 bytes, 6 elements
+var altLangIndex = [6]uint16{
+ 0x0281, 0x0407, 0x01fb, 0x03e5, 0x013e, 0x0208,
+}
+
+// AliasMap maps langIDs to their suggested replacements.
+// Size: 656 bytes, 164 elements
+var AliasMap = [164]FromTo{
+ 0: {From: 0x82, To: 0x88},
+ 1: {From: 0x187, To: 0x1ae},
+ 2: {From: 0x1f3, To: 0x1e1},
+ 3: {From: 0x1fb, To: 0x1bc},
+ 4: {From: 0x208, To: 0x512},
+ 5: {From: 0x20f, To: 0x20e},
+ 6: {From: 0x310, To: 0x3dc},
+ 7: {From: 0x347, To: 0x36f},
+ 8: {From: 0x407, To: 0x432},
+ 9: {From: 0x47a, To: 0x153},
+ 10: {From: 0x490, To: 0x451},
+ 11: {From: 0x4a2, To: 0x21},
+ 12: {From: 0x53e, To: 0x544},
+ 13: {From: 0x58f, To: 0x12d},
+ 14: {From: 0x630, To: 0x1eb1},
+ 15: {From: 0x651, To: 0x431},
+ 16: {From: 0x662, To: 0x431},
+ 17: {From: 0x6ed, To: 0x3a},
+ 18: {From: 0x6f8, To: 0x1d7},
+ 19: {From: 0x73e, To: 0x21a1},
+ 20: {From: 0x7b3, To: 0x56},
+ 21: {From: 0x7b9, To: 0x299b},
+ 22: {From: 0x7c5, To: 0x58},
+ 23: {From: 0x7e6, To: 0x145},
+ 24: {From: 0x80c, To: 0x5a},
+ 25: {From: 0x815, To: 0x8d},
+ 26: {From: 0x87e, To: 0x810},
+ 27: {From: 0x8c3, To: 0xee3},
+ 28: {From: 0x9ef, To: 0x331},
+ 29: {From: 0xa36, To: 0x2c5},
+ 30: {From: 0xa3d, To: 0xbf},
+ 31: {From: 0xabe, To: 0x3322},
+ 32: {From: 0xb38, To: 0x529},
+ 33: {From: 0xb75, To: 0x265a},
+ 34: {From: 0xb7e, To: 0xbc3},
+ 35: {From: 0xb9b, To: 0x44e},
+ 36: {From: 0xbbc, To: 0x4229},
+ 37: {From: 0xbbf, To: 0x529},
+ 38: {From: 0xbfe, To: 0x2da7},
+ 39: {From: 0xc2e, To: 0x3181},
+ 40: {From: 0xcb9, To: 0xf3},
+ 41: {From: 0xd08, To: 0xfa},
+ 42: {From: 0xdc8, To: 0x11a},
+ 43: {From: 0xdd7, To: 0x32d},
+ 44: {From: 0xdf8, To: 0xdfb},
+ 45: {From: 0xdfe, To: 0x531},
+ 46: {From: 0xedf, To: 0x205a},
+ 47: {From: 0xeee, To: 0x2e9a},
+ 48: {From: 0xf39, To: 0x367},
+ 49: {From: 0x10d0, To: 0x140},
+ 50: {From: 0x1104, To: 0x2d0},
+ 51: {From: 0x11a0, To: 0x1ec},
+ 52: {From: 0x1279, To: 0x21},
+ 53: {From: 0x1424, To: 0x15e},
+ 54: {From: 0x1470, To: 0x14e},
+ 55: {From: 0x151f, To: 0xd9b},
+ 56: {From: 0x1523, To: 0x390},
+ 57: {From: 0x1532, To: 0x19f},
+ 58: {From: 0x1580, To: 0x210},
+ 59: {From: 0x1583, To: 0x10d},
+ 60: {From: 0x15a3, To: 0x3caf},
+ 61: {From: 0x166a, To: 0x19b},
+ 62: {From: 0x16c8, To: 0x136},
+ 63: {From: 0x1700, To: 0x29f8},
+ 64: {From: 0x1718, To: 0x194},
+ 65: {From: 0x1727, To: 0xf3f},
+ 66: {From: 0x177a, To: 0x178},
+ 67: {From: 0x1809, To: 0x17b6},
+ 68: {From: 0x1816, To: 0x18f3},
+ 69: {From: 0x188a, To: 0x436},
+ 70: {From: 0x1979, To: 0x1d01},
+ 71: {From: 0x1a74, To: 0x2bb0},
+ 72: {From: 0x1a8a, To: 0x1f8},
+ 73: {From: 0x1b5a, To: 0x1fa},
+ 74: {From: 0x1b86, To: 0x1515},
+ 75: {From: 0x1d64, To: 0x2c9b},
+ 76: {From: 0x2038, To: 0x37b1},
+ 77: {From: 0x203d, To: 0x20dd},
+ 78: {From: 0x205a, To: 0x30b},
+ 79: {From: 0x20e3, To: 0x274},
+ 80: {From: 0x20ee, To: 0x263},
+ 81: {From: 0x20f2, To: 0x22d},
+ 82: {From: 0x20f9, To: 0x256},
+ 83: {From: 0x210f, To: 0x21eb},
+ 84: {From: 0x2135, To: 0x27d},
+ 85: {From: 0x2160, To: 0x913},
+ 86: {From: 0x2199, To: 0x121},
+ 87: {From: 0x21ce, To: 0x1561},
+ 88: {From: 0x21e6, To: 0x504},
+ 89: {From: 0x21f4, To: 0x49f},
+ 90: {From: 0x222d, To: 0x121},
+ 91: {From: 0x2237, To: 0x121},
+ 92: {From: 0x2262, To: 0x92a},
+ 93: {From: 0x2316, To: 0x3226},
+ 94: {From: 0x2382, To: 0x3365},
+ 95: {From: 0x2472, To: 0x2c7},
+ 96: {From: 0x24e4, To: 0x2ff},
+ 97: {From: 0x24f0, To: 0x2fa},
+ 98: {From: 0x24fa, To: 0x31f},
+ 99: {From: 0x2550, To: 0xb5b},
+ 100: {From: 0x25a9, To: 0xe2},
+ 101: {From: 0x263e, To: 0x2d0},
+ 102: {From: 0x26c9, To: 0x26b4},
+ 103: {From: 0x26f9, To: 0x3c8},
+ 104: {From: 0x2727, To: 0x3caf},
+ 105: {From: 0x2765, To: 0x26b4},
+ 106: {From: 0x2789, To: 0x4358},
+ 107: {From: 0x28ef, To: 0x2837},
+ 108: {From: 0x2914, To: 0x351},
+ 109: {From: 0x2986, To: 0x2da7},
+ 110: {From: 0x2b1a, To: 0x38d},
+ 111: {From: 0x2bfc, To: 0x395},
+ 112: {From: 0x2c3f, To: 0x3caf},
+ 113: {From: 0x2cfc, To: 0x3be},
+ 114: {From: 0x2d13, To: 0x597},
+ 115: {From: 0x2d47, To: 0x148},
+ 116: {From: 0x2d48, To: 0x148},
+ 117: {From: 0x2dff, To: 0x2f1},
+ 118: {From: 0x2e08, To: 0x19cc},
+ 119: {From: 0x2e1a, To: 0x2d95},
+ 120: {From: 0x2e21, To: 0x292},
+ 121: {From: 0x2e54, To: 0x7d},
+ 122: {From: 0x2e65, To: 0x2282},
+ 123: {From: 0x2ea0, To: 0x2e9b},
+ 124: {From: 0x2eef, To: 0x2ed7},
+ 125: {From: 0x3193, To: 0x3c4},
+ 126: {From: 0x3366, To: 0x338e},
+ 127: {From: 0x342a, To: 0x3dc},
+ 128: {From: 0x34ee, To: 0x18d0},
+ 129: {From: 0x35c8, To: 0x2c9b},
+ 130: {From: 0x35e6, To: 0x412},
+ 131: {From: 0x3658, To: 0x246},
+ 132: {From: 0x3676, To: 0x3f4},
+ 133: {From: 0x36fd, To: 0x445},
+ 134: {From: 0x37c0, To: 0x121},
+ 135: {From: 0x3816, To: 0x38f2},
+ 136: {From: 0x382b, To: 0x2c9b},
+ 137: {From: 0x382f, To: 0xa9},
+ 138: {From: 0x3832, To: 0x3228},
+ 139: {From: 0x386c, To: 0x39a6},
+ 140: {From: 0x3892, To: 0x3fc0},
+ 141: {From: 0x38a5, To: 0x39d7},
+ 142: {From: 0x38b4, To: 0x1fa4},
+ 143: {From: 0x38b5, To: 0x2e9a},
+ 144: {From: 0x395c, To: 0x47e},
+ 145: {From: 0x3b4e, To: 0xd91},
+ 146: {From: 0x3b78, To: 0x137},
+ 147: {From: 0x3c99, To: 0x4bc},
+ 148: {From: 0x3fbd, To: 0x100},
+ 149: {From: 0x4208, To: 0xa91},
+ 150: {From: 0x42be, To: 0x573},
+ 151: {From: 0x42f9, To: 0x3f60},
+ 152: {From: 0x4378, To: 0x25a},
+ 153: {From: 0x43cb, To: 0x36cb},
+ 154: {From: 0x43cd, To: 0x10f},
+ 155: {From: 0x44af, To: 0x3322},
+ 156: {From: 0x44e3, To: 0x512},
+ 157: {From: 0x45ca, To: 0x2409},
+ 158: {From: 0x45dd, To: 0x26dc},
+ 159: {From: 0x4610, To: 0x48ae},
+ 160: {From: 0x46ae, To: 0x46a0},
+ 161: {From: 0x473e, To: 0x4745},
+ 162: {From: 0x4916, To: 0x31f},
+ 163: {From: 0x49a7, To: 0x523},
+}
+
+// Size: 164 bytes, 164 elements
+var AliasTypes = [164]AliasType{
+ // Entry 0 - 3F
+ 1, 0, 0, 0, 0, 0, 0, 1, 2, 2, 0, 1, 0, 0, 1, 2,
+ 1, 1, 2, 0, 1, 0, 1, 2, 1, 1, 0, 0, 2, 1, 1, 0,
+ 2, 0, 0, 1, 0, 1, 0, 0, 1, 2, 1, 1, 1, 1, 0, 0,
+ 2, 1, 1, 1, 1, 2, 1, 0, 1, 1, 2, 2, 0, 1, 2, 0,
+ // Entry 40 - 7F
+ 1, 0, 1, 1, 1, 1, 0, 0, 2, 1, 0, 0, 0, 0, 1, 1,
+ 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1,
+ 2, 2, 2, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1,
+ 0, 1, 0, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 2,
+ // Entry 80 - BF
+ 0, 0, 2, 1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 1, 1, 0, 1, 2, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0,
+ 0, 1, 1, 1,
+}
+
+const (
+ _Latn = 87
+ _Hani = 54
+ _Hans = 56
+ _Hant = 57
+ _Qaaa = 139
+ _Qaai = 147
+ _Qabx = 188
+ _Zinh = 236
+ _Zyyy = 241
+ _Zzzz = 242
+)
+
+// script is an alphabetically sorted list of ISO 15924 codes. The index
+// of the script in the string, divided by 4, is the internal scriptID.
+const script tag.Index = "" + // Size: 976 bytes
+ "----AdlmAfakAghbAhomArabAranArmiArmnAvstBaliBamuBassBatkBengBhksBlisBopo" +
+ "BrahBraiBugiBuhdCakmCansCariChamCherCirtCoptCpmnCprtCyrlCyrsDevaDogrDsrt" +
+ "DuplEgydEgyhEgypElbaEthiGeokGeorGlagGongGonmGothGranGrekGujrGuruHanbHang" +
+ "HaniHanoHansHantHatrHebrHiraHluwHmngHmnpHrktHungIndsItalJamoJavaJpanJurc" +
+ "KaliKanaKharKhmrKhojKitlKitsKndaKoreKpelKthiLanaLaooLatfLatgLatnLekeLepc" +
+ "LimbLinaLinbLisuLomaLyciLydiMahjMakaMandManiMarcMayaMedfMendMercMeroMlym" +
+ "ModiMongMoonMrooMteiMultMymrNarbNbatNewaNkdbNkgbNkooNshuOgamOlckOrkhOrya" +
+ "OsgeOsmaPalmPaucPermPhagPhliPhlpPhlvPhnxPiqdPlrdPrtiQaaaQaabQaacQaadQaae" +
+ "QaafQaagQaahQaaiQaajQaakQaalQaamQaanQaaoQaapQaaqQaarQaasQaatQaauQaavQaaw" +
+ "QaaxQaayQaazQabaQabbQabcQabdQabeQabfQabgQabhQabiQabjQabkQablQabmQabnQabo" +
+ "QabpQabqQabrQabsQabtQabuQabvQabwQabxRjngRoroRunrSamrSaraSarbSaurSgnwShaw" +
+ "ShrdShuiSiddSindSinhSoraSoyoSundSyloSyrcSyreSyrjSyrnTagbTakrTaleTaluTaml" +
+ "TangTavtTeluTengTfngTglgThaaThaiTibtTirhUgarVaiiVispWaraWchoWoleXpeoXsux" +
+ "YiiiZanbZinhZmthZsyeZsymZxxxZyyyZzzz\xff\xff\xff\xff"
+
+// suppressScript is an index from langID to the dominant script for that language,
+// if it exists. If a script is given, it should be suppressed from the language tag.
+// Size: 1330 bytes, 1330 elements
+var suppressScript = [1330]uint8{
+ // Entry 0 - 3F
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 40 - 7F
+ 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 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, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00,
+ // Entry 80 - BF
+ 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, 0x0e, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry C0 - FF
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x57, 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, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 100 - 13F
+ 0x57, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xde, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00,
+ 0x00, 0x57, 0x00, 0x00, 0x57, 0x00, 0x57, 0x00,
+ // Entry 140 - 17F
+ 0x57, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00,
+ 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00,
+ 0x00, 0x57, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x57, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 180 - 1BF
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x57, 0x32, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x21, 0x00,
+ // Entry 1C0 - 1FF
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x57, 0x57, 0x00, 0x57, 0x57, 0x00, 0x08,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00,
+ 0x57, 0x57, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00,
+ // Entry 200 - 23F
+ 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x2b, 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, 0x1f, 0x00, 0x00, 0x57, 0x00, 0x00,
+ 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x4f, 0x00, 0x00, 0x50, 0x00, 0x21, 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 280 - 2BF
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 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, 0x57, 0x00, 0x00,
+ 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 2C0 - 2FF
+ 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 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,
+ 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
+ // Entry 300 - 33F
+ 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x57,
+ 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00,
+ // Entry 340 - 37F
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00,
+ 0x57, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x57, 0x00,
+ 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 380 - 3BF
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x57, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00,
+ // Entry 3C0 - 3FF
+ 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00,
+ 0x00, 0x57, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x1f, 0x00, 0x00, 0x57, 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 400 - 43F
+ 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00,
+ 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00,
+ // Entry 440 - 47F
+ 0x00, 0x00, 0x00, 0x00, 0x57, 0x57, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xd7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xda, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x29,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00,
+ // Entry 480 - 4BF
+ 0x57, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00,
+ 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 4C0 - 4FF
+ 0x57, 0x00, 0x00, 0x57, 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, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // Entry 500 - 53F
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57,
+ 0x00, 0x00,
+}
+
+const (
+ _001 = 1
+ _419 = 31
+ _BR = 65
+ _CA = 73
+ _ES = 110
+ _GB = 123
+ _MD = 188
+ _PT = 238
+ _UK = 306
+ _US = 309
+ _ZZ = 357
+ _XA = 323
+ _XC = 325
+ _XK = 333
+)
+
+// isoRegionOffset needs to be added to the index of regionISO to obtain the regionID
+// for 2-letter ISO codes. (The first isoRegionOffset regionIDs are reserved for
+// the UN.M49 codes used for groups.)
+const isoRegionOffset = 32
+
+// regionTypes defines the status of a region for various standards.
+// Size: 358 bytes, 358 elements
+var regionTypes = [358]uint8{
+ // Entry 0 - 3F
+ 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,
+ 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ // Entry 40 - 7F
+ 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, 0x04,
+ 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04,
+ 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06,
+ 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00,
+ 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ // Entry 80 - BF
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x00, 0x04, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ // Entry C0 - FF
+ 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00,
+ 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x04, 0x06,
+ 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00,
+ 0x06, 0x06, 0x00, 0x06, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ // Entry 100 - 13F
+ 0x05, 0x05, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x02, 0x06, 0x04, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06,
+ // Entry 140 - 17F
+ 0x06, 0x00, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x06, 0x06,
+ 0x04, 0x06, 0x06, 0x04, 0x06, 0x05,
+}
+
+// regionISO holds a list of alphabetically sorted 2-letter ISO region codes.
+// Each 2-letter codes is followed by two bytes with the following meaning:
+// - [A-Z}{2}: the first letter of the 2-letter code plus these two
+// letters form the 3-letter ISO code.
+// - 0, n: index into altRegionISO3.
+const regionISO tag.Index = "" + // Size: 1308 bytes
+ "AAAAACSCADNDAEREAFFGAGTGAIIAALLBAMRMANNTAOGOAQTAARRGASSMATUTAUUSAWBWAXLA" +
+ "AZZEBAIHBBRBBDGDBEELBFFABGGRBHHRBIDIBJENBLLMBMMUBNRNBOOLBQESBRRABSHSBTTN" +
+ "BUURBVVTBWWABYLRBZLZCAANCCCKCDODCFAFCGOGCHHECIIVCKOKCLHLCMMRCNHNCOOLCPPT" +
+ "CRRICS\x00\x00CTTECUUBCVPVCWUWCXXRCYYPCZZEDDDRDEEUDGGADJJIDKNKDMMADOOMDY" +
+ "HYDZZAEA ECCUEESTEGGYEHSHERRIESSPETTHEU\x00\x03EZ FIINFJJIFKLKFMSMFORO" +
+ "FQ\x00\x18FRRAFXXXGAABGBBRGDRDGEEOGFUFGGGYGHHAGIIBGLRLGMMBGNINGPLPGQNQGR" +
+ "RCGS\x00\x06GTTMGUUMGWNBGYUYHKKGHMMDHNNDHRRVHTTIHUUNHVVOIC IDDNIERLILSR" +
+ "IMMNINNDIOOTIQRQIRRNISSLITTAJEEYJMAMJOORJPPNJTTNKEENKGGZKHHMKIIRKM\x00" +
+ "\x09KNNAKP\x00\x0cKRORKWWTKY\x00\x0fKZAZLAAOLBBNLCCALIIELKKALRBRLSSOLTTU" +
+ "LUUXLVVALYBYMAARMCCOMDDAMENEMFAFMGDGMHHLMIIDMKKDMLLIMMMRMNNGMOACMPNPMQTQ" +
+ "MRRTMSSRMTLTMUUSMVDVMWWIMXEXMYYSMZOZNAAMNCCLNEERNFFKNGGANHHBNIICNLLDNOOR" +
+ "NPPLNQ\x00\x1eNRRUNTTZNUIUNZZLOMMNPAANPCCIPEERPFYFPGNGPHHLPKAKPLOLPM\x00" +
+ "\x12PNCNPRRIPSSEPTRTPUUSPWLWPYRYPZCZQAATQMMMQNNNQOOOQPPPQQQQQRRRQSSSQTTT" +
+ "QU\x00\x03QVVVQWWWQXXXQYYYQZZZREEURHHOROOURS\x00\x15RUUSRWWASAAUSBLBSCYC" +
+ "SDDNSEWESGGPSHHNSIVNSJJMSKVKSLLESMMRSNENSOOMSRURSSSDSTTPSUUNSVLVSXXMSYYR" +
+ "SZWZTAAATCCATDCDTF\x00\x18TGGOTHHATJJKTKKLTLLSTMKMTNUNTOONTPMPTRURTTTOTV" +
+ "UVTWWNTZZAUAKRUGGAUK UMMIUN USSAUYRYUZZBVAATVCCTVDDRVEENVGGBVIIRVNNMVU" +
+ "UTWFLFWKAKWSSMXAAAXBBBXCCCXDDDXEEEXFFFXGGGXHHHXIIIXJJJXKKKXLLLXMMMXNNNXO" +
+ "OOXPPPXQQQXRRRXSSSXTTTXUUUXVVVXWWWXXXXXYYYXZZZYDMDYEEMYT\x00\x1bYUUGZAAF" +
+ "ZMMBZRARZWWEZZZZ\xff\xff\xff\xff"
+
+// altRegionISO3 holds a list of 3-letter region codes that cannot be
+// mapped to 2-letter codes using the default algorithm. This is a short list.
+const altRegionISO3 string = "SCGQUUSGSCOMPRKCYMSPMSRBATFMYTATN"
+
+// altRegionIDs holds a list of regionIDs the positions of which match those
+// of the 3-letter ISO codes in altRegionISO3.
+// Size: 22 bytes, 11 elements
+var altRegionIDs = [11]uint16{
+ 0x0057, 0x0070, 0x0088, 0x00a8, 0x00aa, 0x00ad, 0x00ea, 0x0105,
+ 0x0121, 0x015f, 0x00dc,
+}
+
+// Size: 80 bytes, 20 elements
+var regionOldMap = [20]FromTo{
+ 0: {From: 0x44, To: 0xc4},
+ 1: {From: 0x58, To: 0xa7},
+ 2: {From: 0x5f, To: 0x60},
+ 3: {From: 0x66, To: 0x3b},
+ 4: {From: 0x79, To: 0x78},
+ 5: {From: 0x93, To: 0x37},
+ 6: {From: 0xa3, To: 0x133},
+ 7: {From: 0xc1, To: 0x133},
+ 8: {From: 0xd7, To: 0x13f},
+ 9: {From: 0xdc, To: 0x2b},
+ 10: {From: 0xef, To: 0x133},
+ 11: {From: 0xf2, To: 0xe2},
+ 12: {From: 0xfc, To: 0x70},
+ 13: {From: 0x103, To: 0x164},
+ 14: {From: 0x12a, To: 0x126},
+ 15: {From: 0x132, To: 0x7b},
+ 16: {From: 0x13a, To: 0x13e},
+ 17: {From: 0x141, To: 0x133},
+ 18: {From: 0x15d, To: 0x15e},
+ 19: {From: 0x163, To: 0x4b},
+}
+
+// m49 maps regionIDs to UN.M49 codes. The first isoRegionOffset entries are
+// codes indicating collections of regions.
+// Size: 716 bytes, 358 elements
+var m49 = [358]int16{
+ // Entry 0 - 3F
+ 0, 1, 2, 3, 5, 9, 11, 13,
+ 14, 15, 17, 18, 19, 21, 29, 30,
+ 34, 35, 39, 53, 54, 57, 61, 142,
+ 143, 145, 150, 151, 154, 155, 202, 419,
+ 958, 0, 20, 784, 4, 28, 660, 8,
+ 51, 530, 24, 10, 32, 16, 40, 36,
+ 533, 248, 31, 70, 52, 50, 56, 854,
+ 100, 48, 108, 204, 652, 60, 96, 68,
+ // Entry 40 - 7F
+ 535, 76, 44, 64, 104, 74, 72, 112,
+ 84, 124, 166, 180, 140, 178, 756, 384,
+ 184, 152, 120, 156, 170, 0, 188, 891,
+ 296, 192, 132, 531, 162, 196, 203, 278,
+ 276, 0, 262, 208, 212, 214, 204, 12,
+ 0, 218, 233, 818, 732, 232, 724, 231,
+ 967, 0, 246, 242, 238, 583, 234, 0,
+ 250, 249, 266, 826, 308, 268, 254, 831,
+ // Entry 80 - BF
+ 288, 292, 304, 270, 324, 312, 226, 300,
+ 239, 320, 316, 624, 328, 344, 334, 340,
+ 191, 332, 348, 854, 0, 360, 372, 376,
+ 833, 356, 86, 368, 364, 352, 380, 832,
+ 388, 400, 392, 581, 404, 417, 116, 296,
+ 174, 659, 408, 410, 414, 136, 398, 418,
+ 422, 662, 438, 144, 430, 426, 440, 442,
+ 428, 434, 504, 492, 498, 499, 663, 450,
+ // Entry C0 - FF
+ 584, 581, 807, 466, 104, 496, 446, 580,
+ 474, 478, 500, 470, 480, 462, 454, 484,
+ 458, 508, 516, 540, 562, 574, 566, 548,
+ 558, 528, 578, 524, 10, 520, 536, 570,
+ 554, 512, 591, 0, 604, 258, 598, 608,
+ 586, 616, 666, 612, 630, 275, 620, 581,
+ 585, 600, 591, 634, 959, 960, 961, 962,
+ 963, 964, 965, 966, 967, 968, 969, 970,
+ // Entry 100 - 13F
+ 971, 972, 638, 716, 642, 688, 643, 646,
+ 682, 90, 690, 729, 752, 702, 654, 705,
+ 744, 703, 694, 674, 686, 706, 740, 728,
+ 678, 810, 222, 534, 760, 748, 0, 796,
+ 148, 260, 768, 764, 762, 772, 626, 795,
+ 788, 776, 626, 792, 780, 798, 158, 834,
+ 804, 800, 826, 581, 0, 840, 858, 860,
+ 336, 670, 704, 862, 92, 850, 704, 548,
+ // Entry 140 - 17F
+ 876, 581, 882, 973, 974, 975, 976, 977,
+ 978, 979, 980, 981, 982, 983, 984, 985,
+ 986, 987, 988, 989, 990, 991, 992, 993,
+ 994, 995, 996, 997, 998, 720, 887, 175,
+ 891, 710, 894, 180, 716, 999,
+}
+
+// m49Index gives indexes into fromM49 based on the three most significant bits
+// of a 10-bit UN.M49 code. To search an UN.M49 code in fromM49, search in
+// fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]]
+// for an entry where the first 7 bits match the 7 lsb of the UN.M49 code.
+// The region code is stored in the 9 lsb of the indexed value.
+// Size: 18 bytes, 9 elements
+var m49Index = [9]int16{
+ 0, 59, 108, 143, 181, 220, 259, 291,
+ 333,
+}
+
+// fromM49 contains entries to map UN.M49 codes to regions. See m49Index for details.
+// Size: 666 bytes, 333 elements
+var fromM49 = [333]uint16{
+ // Entry 0 - 3F
+ 0x0201, 0x0402, 0x0603, 0x0824, 0x0a04, 0x1027, 0x1205, 0x142b,
+ 0x1606, 0x1867, 0x1a07, 0x1c08, 0x1e09, 0x202d, 0x220a, 0x240b,
+ 0x260c, 0x2822, 0x2a0d, 0x302a, 0x3825, 0x3a0e, 0x3c0f, 0x3e32,
+ 0x402c, 0x4410, 0x4611, 0x482f, 0x4e12, 0x502e, 0x5842, 0x6039,
+ 0x6435, 0x6628, 0x6834, 0x6a13, 0x6c14, 0x7036, 0x7215, 0x783d,
+ 0x7a16, 0x8043, 0x883f, 0x8c33, 0x9046, 0x9445, 0x9841, 0xa848,
+ 0xac9a, 0xb509, 0xb93c, 0xc03e, 0xc838, 0xd0c4, 0xd83a, 0xe047,
+ 0xe8a6, 0xf052, 0xf849, 0x085a, 0x10ad, 0x184c, 0x1c17, 0x1e18,
+ // Entry 40 - 7F
+ 0x20b3, 0x2219, 0x2920, 0x2c1a, 0x2e1b, 0x3051, 0x341c, 0x361d,
+ 0x3853, 0x3d2e, 0x445c, 0x4c4a, 0x5454, 0x5ca8, 0x5f5f, 0x644d,
+ 0x684b, 0x7050, 0x7856, 0x7e90, 0x8059, 0x885d, 0x941e, 0x965e,
+ 0x983b, 0xa063, 0xa864, 0xac65, 0xb469, 0xbd1a, 0xc486, 0xcc6f,
+ 0xce6f, 0xd06d, 0xd26a, 0xd476, 0xdc74, 0xde88, 0xe473, 0xec72,
+ 0xf031, 0xf279, 0xf478, 0xfc7e, 0x04e5, 0x0921, 0x0c62, 0x147a,
+ 0x187d, 0x1c83, 0x26ed, 0x2860, 0x2c5f, 0x3060, 0x4080, 0x4881,
+ 0x50a7, 0x5887, 0x6082, 0x687c, 0x7085, 0x788a, 0x8089, 0x8884,
+ // Entry 80 - BF
+ 0x908c, 0x9891, 0x9c8e, 0xa138, 0xa88f, 0xb08d, 0xb892, 0xc09d,
+ 0xc899, 0xd095, 0xd89c, 0xe09b, 0xe896, 0xf097, 0xf89e, 0x004f,
+ 0x08a0, 0x10a2, 0x1cae, 0x20a1, 0x28a4, 0x30aa, 0x34ab, 0x3cac,
+ 0x42a5, 0x44af, 0x461f, 0x4cb0, 0x54b5, 0x58b8, 0x5cb4, 0x64b9,
+ 0x6cb2, 0x70b6, 0x74b7, 0x7cc6, 0x84bf, 0x8cce, 0x94d0, 0x9ccd,
+ 0xa4c3, 0xaccb, 0xb4c8, 0xbcc9, 0xc0cc, 0xc8cf, 0xd8bb, 0xe0c5,
+ 0xe4bc, 0xe6bd, 0xe8ca, 0xf0ba, 0xf8d1, 0x00e1, 0x08d2, 0x10dd,
+ 0x18db, 0x20d9, 0x2429, 0x265b, 0x2a30, 0x2d1b, 0x2e40, 0x30de,
+ // Entry C0 - FF
+ 0x38d3, 0x493f, 0x54e0, 0x5cd8, 0x64d4, 0x6cd6, 0x74df, 0x7cd5,
+ 0x84da, 0x88c7, 0x8b33, 0x8e75, 0x90c0, 0x92f0, 0x94e8, 0x9ee2,
+ 0xace6, 0xb0f1, 0xb8e4, 0xc0e7, 0xc8eb, 0xd0e9, 0xd8ee, 0xe08b,
+ 0xe526, 0xecec, 0xf4f3, 0xfd02, 0x0504, 0x0706, 0x0d07, 0x183c,
+ 0x1d0e, 0x26a9, 0x2826, 0x2cb1, 0x2ebe, 0x34ea, 0x3d39, 0x4513,
+ 0x4d18, 0x5508, 0x5d14, 0x6105, 0x650a, 0x6d12, 0x7d0d, 0x7f11,
+ 0x813e, 0x830f, 0x8515, 0x8d61, 0x9964, 0xa15d, 0xa86e, 0xb117,
+ 0xb30b, 0xb86c, 0xc10b, 0xc916, 0xd110, 0xd91d, 0xe10c, 0xe84e,
+ // Entry 100 - 13F
+ 0xf11c, 0xf524, 0xf923, 0x0122, 0x0925, 0x1129, 0x192c, 0x2023,
+ 0x2928, 0x312b, 0x3727, 0x391f, 0x3d2d, 0x4131, 0x4930, 0x4ec2,
+ 0x5519, 0x646b, 0x747b, 0x7e7f, 0x809f, 0x8298, 0x852f, 0x9135,
+ 0xa53d, 0xac37, 0xb536, 0xb937, 0xbd3b, 0xd940, 0xe542, 0xed5e,
+ 0xef5e, 0xf657, 0xfd62, 0x7c20, 0x7ef4, 0x80f5, 0x82f6, 0x84f7,
+ 0x86f8, 0x88f9, 0x8afa, 0x8cfb, 0x8e70, 0x90fd, 0x92fe, 0x94ff,
+ 0x9700, 0x9901, 0x9b43, 0x9d44, 0x9f45, 0xa146, 0xa347, 0xa548,
+ 0xa749, 0xa94a, 0xab4b, 0xad4c, 0xaf4d, 0xb14e, 0xb34f, 0xb550,
+ // Entry 140 - 17F
+ 0xb751, 0xb952, 0xbb53, 0xbd54, 0xbf55, 0xc156, 0xc357, 0xc558,
+ 0xc759, 0xc95a, 0xcb5b, 0xcd5c, 0xcf65,
+}
+
+// Size: 1615 bytes
+var variantIndex = map[string]uint8{
+ "1606nict": 0x0,
+ "1694acad": 0x1,
+ "1901": 0x2,
+ "1959acad": 0x3,
+ "1994": 0x4d,
+ "1996": 0x4,
+ "abl1943": 0x5,
+ "akuapem": 0x6,
+ "alalc97": 0x4f,
+ "aluku": 0x7,
+ "ao1990": 0x8,
+ "arevela": 0x9,
+ "arevmda": 0xa,
+ "asante": 0xb,
+ "baku1926": 0xc,
+ "balanka": 0xd,
+ "barla": 0xe,
+ "basiceng": 0xf,
+ "bauddha": 0x10,
+ "biscayan": 0x11,
+ "biske": 0x48,
+ "bohoric": 0x12,
+ "boont": 0x13,
+ "colb1945": 0x14,
+ "cornu": 0x15,
+ "dajnko": 0x16,
+ "ekavsk": 0x17,
+ "emodeng": 0x18,
+ "fonipa": 0x50,
+ "fonnapa": 0x51,
+ "fonupa": 0x52,
+ "fonxsamp": 0x53,
+ "hepburn": 0x19,
+ "heploc": 0x4e,
+ "hognorsk": 0x1a,
+ "hsistemo": 0x1b,
+ "ijekavsk": 0x1c,
+ "itihasa": 0x1d,
+ "jauer": 0x1e,
+ "jyutping": 0x1f,
+ "kkcor": 0x20,
+ "kociewie": 0x21,
+ "kscor": 0x22,
+ "laukika": 0x23,
+ "lipaw": 0x49,
+ "luna1918": 0x24,
+ "metelko": 0x25,
+ "monoton": 0x26,
+ "ndyuka": 0x27,
+ "nedis": 0x28,
+ "newfound": 0x29,
+ "njiva": 0x4a,
+ "nulik": 0x2a,
+ "osojs": 0x4b,
+ "oxendict": 0x2b,
+ "pahawh2": 0x2c,
+ "pahawh3": 0x2d,
+ "pahawh4": 0x2e,
+ "pamaka": 0x2f,
+ "petr1708": 0x30,
+ "pinyin": 0x31,
+ "polyton": 0x32,
+ "puter": 0x33,
+ "rigik": 0x34,
+ "rozaj": 0x35,
+ "rumgr": 0x36,
+ "scotland": 0x37,
+ "scouse": 0x38,
+ "simple": 0x54,
+ "solba": 0x4c,
+ "sotav": 0x39,
+ "spanglis": 0x3a,
+ "surmiran": 0x3b,
+ "sursilv": 0x3c,
+ "sutsilv": 0x3d,
+ "tarask": 0x3e,
+ "uccor": 0x3f,
+ "ucrcor": 0x40,
+ "ulster": 0x41,
+ "unifon": 0x42,
+ "vaidika": 0x43,
+ "valencia": 0x44,
+ "vallader": 0x45,
+ "wadegile": 0x46,
+ "xsistemo": 0x47,
+}
+
+// variantNumSpecialized is the number of specialized variants in variants.
+const variantNumSpecialized = 79
+
+// nRegionGroups is the number of region groups.
+const nRegionGroups = 33
+
+type likelyLangRegion struct {
+ lang uint16
+ region uint16
+}
+
+// likelyScript is a lookup table, indexed by scriptID, for the most likely
+// languages and regions given a script.
+// Size: 976 bytes, 244 elements
+var likelyScript = [244]likelyLangRegion{
+ 1: {lang: 0x14e, region: 0x84},
+ 3: {lang: 0x2a2, region: 0x106},
+ 4: {lang: 0x1f, region: 0x99},
+ 5: {lang: 0x3a, region: 0x6b},
+ 7: {lang: 0x3b, region: 0x9c},
+ 8: {lang: 0x1d7, region: 0x28},
+ 9: {lang: 0x13, region: 0x9c},
+ 10: {lang: 0x5b, region: 0x95},
+ 11: {lang: 0x60, region: 0x52},
+ 12: {lang: 0xb9, region: 0xb4},
+ 13: {lang: 0x63, region: 0x95},
+ 14: {lang: 0xa5, region: 0x35},
+ 15: {lang: 0x3e9, region: 0x99},
+ 17: {lang: 0x529, region: 0x12e},
+ 18: {lang: 0x3b1, region: 0x99},
+ 19: {lang: 0x15e, region: 0x78},
+ 20: {lang: 0xc2, region: 0x95},
+ 21: {lang: 0x9d, region: 0xe7},
+ 22: {lang: 0xdb, region: 0x35},
+ 23: {lang: 0xf3, region: 0x49},
+ 24: {lang: 0x4f0, region: 0x12b},
+ 25: {lang: 0xe7, region: 0x13e},
+ 26: {lang: 0xe5, region: 0x135},
+ 28: {lang: 0xf1, region: 0x6b},
+ 30: {lang: 0x1a0, region: 0x5d},
+ 31: {lang: 0x3e2, region: 0x106},
+ 33: {lang: 0x1be, region: 0x99},
+ 36: {lang: 0x15e, region: 0x78},
+ 39: {lang: 0x133, region: 0x6b},
+ 40: {lang: 0x431, region: 0x27},
+ 41: {lang: 0x27, region: 0x6f},
+ 43: {lang: 0x210, region: 0x7d},
+ 44: {lang: 0xfe, region: 0x38},
+ 46: {lang: 0x19b, region: 0x99},
+ 47: {lang: 0x19e, region: 0x130},
+ 48: {lang: 0x3e9, region: 0x99},
+ 49: {lang: 0x136, region: 0x87},
+ 50: {lang: 0x1a4, region: 0x99},
+ 51: {lang: 0x39d, region: 0x99},
+ 52: {lang: 0x529, region: 0x12e},
+ 53: {lang: 0x254, region: 0xab},
+ 54: {lang: 0x529, region: 0x53},
+ 55: {lang: 0x1cb, region: 0xe7},
+ 56: {lang: 0x529, region: 0x53},
+ 57: {lang: 0x529, region: 0x12e},
+ 58: {lang: 0x2fd, region: 0x9b},
+ 59: {lang: 0x1bc, region: 0x97},
+ 60: {lang: 0x200, region: 0xa2},
+ 61: {lang: 0x1c5, region: 0x12b},
+ 62: {lang: 0x1ca, region: 0xaf},
+ 65: {lang: 0x1d5, region: 0x92},
+ 67: {lang: 0x142, region: 0x9e},
+ 68: {lang: 0x254, region: 0xab},
+ 69: {lang: 0x20e, region: 0x95},
+ 70: {lang: 0x200, region: 0xa2},
+ 72: {lang: 0x135, region: 0xc4},
+ 73: {lang: 0x200, region: 0xa2},
+ 74: {lang: 0x3bb, region: 0xe8},
+ 75: {lang: 0x24a, region: 0xa6},
+ 76: {lang: 0x3fa, region: 0x99},
+ 79: {lang: 0x251, region: 0x99},
+ 80: {lang: 0x254, region: 0xab},
+ 82: {lang: 0x88, region: 0x99},
+ 83: {lang: 0x370, region: 0x123},
+ 84: {lang: 0x2b8, region: 0xaf},
+ 89: {lang: 0x29f, region: 0x99},
+ 90: {lang: 0x2a8, region: 0x99},
+ 91: {lang: 0x28f, region: 0x87},
+ 92: {lang: 0x1a0, region: 0x87},
+ 93: {lang: 0x2ac, region: 0x53},
+ 95: {lang: 0x4f4, region: 0x12b},
+ 96: {lang: 0x4f5, region: 0x12b},
+ 97: {lang: 0x1be, region: 0x99},
+ 99: {lang: 0x337, region: 0x9c},
+ 100: {lang: 0x4f7, region: 0x53},
+ 101: {lang: 0xa9, region: 0x53},
+ 104: {lang: 0x2e8, region: 0x112},
+ 105: {lang: 0x4f8, region: 0x10b},
+ 106: {lang: 0x4f8, region: 0x10b},
+ 107: {lang: 0x304, region: 0x99},
+ 108: {lang: 0x31b, region: 0x99},
+ 109: {lang: 0x30b, region: 0x53},
+ 111: {lang: 0x31e, region: 0x35},
+ 112: {lang: 0x30e, region: 0x99},
+ 113: {lang: 0x414, region: 0xe8},
+ 114: {lang: 0x331, region: 0xc4},
+ 115: {lang: 0x4f9, region: 0x108},
+ 116: {lang: 0x3b, region: 0xa1},
+ 117: {lang: 0x353, region: 0xdb},
+ 120: {lang: 0x2d0, region: 0x84},
+ 121: {lang: 0x52a, region: 0x53},
+ 122: {lang: 0x403, region: 0x96},
+ 123: {lang: 0x3ee, region: 0x99},
+ 124: {lang: 0x39b, region: 0xc5},
+ 125: {lang: 0x395, region: 0x99},
+ 126: {lang: 0x399, region: 0x135},
+ 127: {lang: 0x429, region: 0x115},
+ 128: {lang: 0x3b, region: 0x11c},
+ 129: {lang: 0xfd, region: 0xc4},
+ 130: {lang: 0x27d, region: 0x106},
+ 131: {lang: 0x2c9, region: 0x53},
+ 132: {lang: 0x39f, region: 0x9c},
+ 133: {lang: 0x39f, region: 0x53},
+ 135: {lang: 0x3ad, region: 0xb0},
+ 137: {lang: 0x1c6, region: 0x53},
+ 138: {lang: 0x4fd, region: 0x9c},
+ 189: {lang: 0x3cb, region: 0x95},
+ 191: {lang: 0x372, region: 0x10c},
+ 192: {lang: 0x420, region: 0x97},
+ 194: {lang: 0x4ff, region: 0x15e},
+ 195: {lang: 0x3f0, region: 0x99},
+ 196: {lang: 0x45, region: 0x135},
+ 197: {lang: 0x139, region: 0x7b},
+ 198: {lang: 0x3e9, region: 0x99},
+ 200: {lang: 0x3e9, region: 0x99},
+ 201: {lang: 0x3fa, region: 0x99},
+ 202: {lang: 0x40c, region: 0xb3},
+ 203: {lang: 0x433, region: 0x99},
+ 204: {lang: 0xef, region: 0xc5},
+ 205: {lang: 0x43e, region: 0x95},
+ 206: {lang: 0x44d, region: 0x35},
+ 207: {lang: 0x44e, region: 0x9b},
+ 211: {lang: 0x45a, region: 0xe7},
+ 212: {lang: 0x11a, region: 0x99},
+ 213: {lang: 0x45e, region: 0x53},
+ 214: {lang: 0x232, region: 0x53},
+ 215: {lang: 0x450, region: 0x99},
+ 216: {lang: 0x4a5, region: 0x53},
+ 217: {lang: 0x9f, region: 0x13e},
+ 218: {lang: 0x461, region: 0x99},
+ 220: {lang: 0x528, region: 0xba},
+ 221: {lang: 0x153, region: 0xe7},
+ 222: {lang: 0x128, region: 0xcd},
+ 223: {lang: 0x46b, region: 0x123},
+ 224: {lang: 0xa9, region: 0x53},
+ 225: {lang: 0x2ce, region: 0x99},
+ 226: {lang: 0x4ad, region: 0x11c},
+ 227: {lang: 0x4be, region: 0xb4},
+ 229: {lang: 0x1ce, region: 0x99},
+ 232: {lang: 0x3a9, region: 0x9c},
+ 233: {lang: 0x22, region: 0x9b},
+ 234: {lang: 0x1ea, region: 0x53},
+ 235: {lang: 0xef, region: 0xc5},
+}
+
+type likelyScriptRegion struct {
+ region uint16
+ script uint8
+ flags uint8
+}
+
+// likelyLang is a lookup table, indexed by langID, for the most likely
+// scripts and regions given incomplete information. If more entries exist for a
+// given language, region and script are the index and size respectively
+// of the list in likelyLangList.
+// Size: 5320 bytes, 1330 elements
+var likelyLang = [1330]likelyScriptRegion{
+ 0: {region: 0x135, script: 0x57, flags: 0x0},
+ 1: {region: 0x6f, script: 0x57, flags: 0x0},
+ 2: {region: 0x165, script: 0x57, flags: 0x0},
+ 3: {region: 0x165, script: 0x57, flags: 0x0},
+ 4: {region: 0x165, script: 0x57, flags: 0x0},
+ 5: {region: 0x7d, script: 0x1f, flags: 0x0},
+ 6: {region: 0x165, script: 0x57, flags: 0x0},
+ 7: {region: 0x165, script: 0x1f, flags: 0x0},
+ 8: {region: 0x80, script: 0x57, flags: 0x0},
+ 9: {region: 0x165, script: 0x57, flags: 0x0},
+ 10: {region: 0x165, script: 0x57, flags: 0x0},
+ 11: {region: 0x165, script: 0x57, flags: 0x0},
+ 12: {region: 0x95, script: 0x57, flags: 0x0},
+ 13: {region: 0x131, script: 0x57, flags: 0x0},
+ 14: {region: 0x80, script: 0x57, flags: 0x0},
+ 15: {region: 0x165, script: 0x57, flags: 0x0},
+ 16: {region: 0x165, script: 0x57, flags: 0x0},
+ 17: {region: 0x106, script: 0x1f, flags: 0x0},
+ 18: {region: 0x165, script: 0x57, flags: 0x0},
+ 19: {region: 0x9c, script: 0x9, flags: 0x0},
+ 20: {region: 0x128, script: 0x5, flags: 0x0},
+ 21: {region: 0x165, script: 0x57, flags: 0x0},
+ 22: {region: 0x161, script: 0x57, flags: 0x0},
+ 23: {region: 0x165, script: 0x57, flags: 0x0},
+ 24: {region: 0x165, script: 0x57, flags: 0x0},
+ 25: {region: 0x165, script: 0x57, flags: 0x0},
+ 26: {region: 0x165, script: 0x57, flags: 0x0},
+ 27: {region: 0x165, script: 0x57, flags: 0x0},
+ 28: {region: 0x52, script: 0x57, flags: 0x0},
+ 29: {region: 0x165, script: 0x57, flags: 0x0},
+ 30: {region: 0x165, script: 0x57, flags: 0x0},
+ 31: {region: 0x99, script: 0x4, flags: 0x0},
+ 32: {region: 0x165, script: 0x57, flags: 0x0},
+ 33: {region: 0x80, script: 0x57, flags: 0x0},
+ 34: {region: 0x9b, script: 0xe9, flags: 0x0},
+ 35: {region: 0x165, script: 0x57, flags: 0x0},
+ 36: {region: 0x165, script: 0x57, flags: 0x0},
+ 37: {region: 0x14d, script: 0x57, flags: 0x0},
+ 38: {region: 0x106, script: 0x1f, flags: 0x0},
+ 39: {region: 0x6f, script: 0x29, flags: 0x0},
+ 40: {region: 0x165, script: 0x57, flags: 0x0},
+ 41: {region: 0x165, script: 0x57, flags: 0x0},
+ 42: {region: 0xd6, script: 0x57, flags: 0x0},
+ 43: {region: 0x165, script: 0x57, flags: 0x0},
+ 45: {region: 0x165, script: 0x57, flags: 0x0},
+ 46: {region: 0x165, script: 0x57, flags: 0x0},
+ 47: {region: 0x165, script: 0x57, flags: 0x0},
+ 48: {region: 0x165, script: 0x57, flags: 0x0},
+ 49: {region: 0x165, script: 0x57, flags: 0x0},
+ 50: {region: 0x165, script: 0x57, flags: 0x0},
+ 51: {region: 0x95, script: 0x57, flags: 0x0},
+ 52: {region: 0x165, script: 0x5, flags: 0x0},
+ 53: {region: 0x122, script: 0x5, flags: 0x0},
+ 54: {region: 0x165, script: 0x57, flags: 0x0},
+ 55: {region: 0x165, script: 0x57, flags: 0x0},
+ 56: {region: 0x165, script: 0x57, flags: 0x0},
+ 57: {region: 0x165, script: 0x57, flags: 0x0},
+ 58: {region: 0x6b, script: 0x5, flags: 0x0},
+ 59: {region: 0x0, script: 0x3, flags: 0x1},
+ 60: {region: 0x165, script: 0x57, flags: 0x0},
+ 61: {region: 0x51, script: 0x57, flags: 0x0},
+ 62: {region: 0x3f, script: 0x57, flags: 0x0},
+ 63: {region: 0x67, script: 0x5, flags: 0x0},
+ 65: {region: 0xba, script: 0x5, flags: 0x0},
+ 66: {region: 0x6b, script: 0x5, flags: 0x0},
+ 67: {region: 0x99, script: 0xe, flags: 0x0},
+ 68: {region: 0x12f, script: 0x57, flags: 0x0},
+ 69: {region: 0x135, script: 0xc4, flags: 0x0},
+ 70: {region: 0x165, script: 0x57, flags: 0x0},
+ 71: {region: 0x165, script: 0x57, flags: 0x0},
+ 72: {region: 0x6e, script: 0x57, flags: 0x0},
+ 73: {region: 0x165, script: 0x57, flags: 0x0},
+ 74: {region: 0x165, script: 0x57, flags: 0x0},
+ 75: {region: 0x49, script: 0x57, flags: 0x0},
+ 76: {region: 0x165, script: 0x57, flags: 0x0},
+ 77: {region: 0x106, script: 0x1f, flags: 0x0},
+ 78: {region: 0x165, script: 0x5, flags: 0x0},
+ 79: {region: 0x165, script: 0x57, flags: 0x0},
+ 80: {region: 0x165, script: 0x57, flags: 0x0},
+ 81: {region: 0x165, script: 0x57, flags: 0x0},
+ 82: {region: 0x99, script: 0x21, flags: 0x0},
+ 83: {region: 0x165, script: 0x57, flags: 0x0},
+ 84: {region: 0x165, script: 0x57, flags: 0x0},
+ 85: {region: 0x165, script: 0x57, flags: 0x0},
+ 86: {region: 0x3f, script: 0x57, flags: 0x0},
+ 87: {region: 0x165, script: 0x57, flags: 0x0},
+ 88: {region: 0x3, script: 0x5, flags: 0x1},
+ 89: {region: 0x106, script: 0x1f, flags: 0x0},
+ 90: {region: 0xe8, script: 0x5, flags: 0x0},
+ 91: {region: 0x95, script: 0x57, flags: 0x0},
+ 92: {region: 0xdb, script: 0x21, flags: 0x0},
+ 93: {region: 0x2e, script: 0x57, flags: 0x0},
+ 94: {region: 0x52, script: 0x57, flags: 0x0},
+ 95: {region: 0x165, script: 0x57, flags: 0x0},
+ 96: {region: 0x52, script: 0xb, flags: 0x0},
+ 97: {region: 0x165, script: 0x57, flags: 0x0},
+ 98: {region: 0x165, script: 0x57, flags: 0x0},
+ 99: {region: 0x95, script: 0x57, flags: 0x0},
+ 100: {region: 0x165, script: 0x57, flags: 0x0},
+ 101: {region: 0x52, script: 0x57, flags: 0x0},
+ 102: {region: 0x165, script: 0x57, flags: 0x0},
+ 103: {region: 0x165, script: 0x57, flags: 0x0},
+ 104: {region: 0x165, script: 0x57, flags: 0x0},
+ 105: {region: 0x165, script: 0x57, flags: 0x0},
+ 106: {region: 0x4f, script: 0x57, flags: 0x0},
+ 107: {region: 0x165, script: 0x57, flags: 0x0},
+ 108: {region: 0x165, script: 0x57, flags: 0x0},
+ 109: {region: 0x165, script: 0x57, flags: 0x0},
+ 110: {region: 0x165, script: 0x29, flags: 0x0},
+ 111: {region: 0x165, script: 0x57, flags: 0x0},
+ 112: {region: 0x165, script: 0x57, flags: 0x0},
+ 113: {region: 0x47, script: 0x1f, flags: 0x0},
+ 114: {region: 0x165, script: 0x57, flags: 0x0},
+ 115: {region: 0x165, script: 0x57, flags: 0x0},
+ 116: {region: 0x10b, script: 0x5, flags: 0x0},
+ 117: {region: 0x162, script: 0x57, flags: 0x0},
+ 118: {region: 0x165, script: 0x57, flags: 0x0},
+ 119: {region: 0x95, script: 0x57, flags: 0x0},
+ 120: {region: 0x165, script: 0x57, flags: 0x0},
+ 121: {region: 0x12f, script: 0x57, flags: 0x0},
+ 122: {region: 0x52, script: 0x57, flags: 0x0},
+ 123: {region: 0x99, script: 0xd7, flags: 0x0},
+ 124: {region: 0xe8, script: 0x5, flags: 0x0},
+ 125: {region: 0x99, script: 0x21, flags: 0x0},
+ 126: {region: 0x38, script: 0x1f, flags: 0x0},
+ 127: {region: 0x99, script: 0x21, flags: 0x0},
+ 128: {region: 0xe8, script: 0x5, flags: 0x0},
+ 129: {region: 0x12b, script: 0x31, flags: 0x0},
+ 131: {region: 0x99, script: 0x21, flags: 0x0},
+ 132: {region: 0x165, script: 0x57, flags: 0x0},
+ 133: {region: 0x99, script: 0x21, flags: 0x0},
+ 134: {region: 0xe7, script: 0x57, flags: 0x0},
+ 135: {region: 0x165, script: 0x57, flags: 0x0},
+ 136: {region: 0x99, script: 0x21, flags: 0x0},
+ 137: {region: 0x165, script: 0x57, flags: 0x0},
+ 138: {region: 0x13f, script: 0x57, flags: 0x0},
+ 139: {region: 0x165, script: 0x57, flags: 0x0},
+ 140: {region: 0x165, script: 0x57, flags: 0x0},
+ 141: {region: 0xe7, script: 0x57, flags: 0x0},
+ 142: {region: 0x165, script: 0x57, flags: 0x0},
+ 143: {region: 0xd6, script: 0x57, flags: 0x0},
+ 144: {region: 0x165, script: 0x57, flags: 0x0},
+ 145: {region: 0x165, script: 0x57, flags: 0x0},
+ 146: {region: 0x165, script: 0x57, flags: 0x0},
+ 147: {region: 0x165, script: 0x29, flags: 0x0},
+ 148: {region: 0x99, script: 0x21, flags: 0x0},
+ 149: {region: 0x95, script: 0x57, flags: 0x0},
+ 150: {region: 0x165, script: 0x57, flags: 0x0},
+ 151: {region: 0x165, script: 0x57, flags: 0x0},
+ 152: {region: 0x114, script: 0x57, flags: 0x0},
+ 153: {region: 0x165, script: 0x57, flags: 0x0},
+ 154: {region: 0x165, script: 0x57, flags: 0x0},
+ 155: {region: 0x52, script: 0x57, flags: 0x0},
+ 156: {region: 0x165, script: 0x57, flags: 0x0},
+ 157: {region: 0xe7, script: 0x57, flags: 0x0},
+ 158: {region: 0x165, script: 0x57, flags: 0x0},
+ 159: {region: 0x13e, script: 0xd9, flags: 0x0},
+ 160: {region: 0xc3, script: 0x57, flags: 0x0},
+ 161: {region: 0x165, script: 0x57, flags: 0x0},
+ 162: {region: 0x165, script: 0x57, flags: 0x0},
+ 163: {region: 0xc3, script: 0x57, flags: 0x0},
+ 164: {region: 0x165, script: 0x57, flags: 0x0},
+ 165: {region: 0x35, script: 0xe, flags: 0x0},
+ 166: {region: 0x165, script: 0x57, flags: 0x0},
+ 167: {region: 0x165, script: 0x57, flags: 0x0},
+ 168: {region: 0x165, script: 0x57, flags: 0x0},
+ 169: {region: 0x53, script: 0xe0, flags: 0x0},
+ 170: {region: 0x165, script: 0x57, flags: 0x0},
+ 171: {region: 0x165, script: 0x57, flags: 0x0},
+ 172: {region: 0x165, script: 0x57, flags: 0x0},
+ 173: {region: 0x99, script: 0xe, flags: 0x0},
+ 174: {region: 0x165, script: 0x57, flags: 0x0},
+ 175: {region: 0x9c, script: 0x5, flags: 0x0},
+ 176: {region: 0x165, script: 0x57, flags: 0x0},
+ 177: {region: 0x4f, script: 0x57, flags: 0x0},
+ 178: {region: 0x78, script: 0x57, flags: 0x0},
+ 179: {region: 0x99, script: 0x21, flags: 0x0},
+ 180: {region: 0xe8, script: 0x5, flags: 0x0},
+ 181: {region: 0x99, script: 0x21, flags: 0x0},
+ 182: {region: 0x165, script: 0x57, flags: 0x0},
+ 183: {region: 0x33, script: 0x57, flags: 0x0},
+ 184: {region: 0x165, script: 0x57, flags: 0x0},
+ 185: {region: 0xb4, script: 0xc, flags: 0x0},
+ 186: {region: 0x52, script: 0x57, flags: 0x0},
+ 187: {region: 0x165, script: 0x29, flags: 0x0},
+ 188: {region: 0xe7, script: 0x57, flags: 0x0},
+ 189: {region: 0x165, script: 0x57, flags: 0x0},
+ 190: {region: 0xe8, script: 0x21, flags: 0x0},
+ 191: {region: 0x106, script: 0x1f, flags: 0x0},
+ 192: {region: 0x15f, script: 0x57, flags: 0x0},
+ 193: {region: 0x165, script: 0x57, flags: 0x0},
+ 194: {region: 0x95, script: 0x57, flags: 0x0},
+ 195: {region: 0x165, script: 0x57, flags: 0x0},
+ 196: {region: 0x52, script: 0x57, flags: 0x0},
+ 197: {region: 0x165, script: 0x57, flags: 0x0},
+ 198: {region: 0x165, script: 0x57, flags: 0x0},
+ 199: {region: 0x165, script: 0x57, flags: 0x0},
+ 200: {region: 0x86, script: 0x57, flags: 0x0},
+ 201: {region: 0x165, script: 0x57, flags: 0x0},
+ 202: {region: 0x165, script: 0x57, flags: 0x0},
+ 203: {region: 0x165, script: 0x57, flags: 0x0},
+ 204: {region: 0x165, script: 0x57, flags: 0x0},
+ 205: {region: 0x6d, script: 0x29, flags: 0x0},
+ 206: {region: 0x165, script: 0x57, flags: 0x0},
+ 207: {region: 0x165, script: 0x57, flags: 0x0},
+ 208: {region: 0x52, script: 0x57, flags: 0x0},
+ 209: {region: 0x165, script: 0x57, flags: 0x0},
+ 210: {region: 0x165, script: 0x57, flags: 0x0},
+ 211: {region: 0xc3, script: 0x57, flags: 0x0},
+ 212: {region: 0x165, script: 0x57, flags: 0x0},
+ 213: {region: 0x165, script: 0x57, flags: 0x0},
+ 214: {region: 0x165, script: 0x57, flags: 0x0},
+ 215: {region: 0x6e, script: 0x57, flags: 0x0},
+ 216: {region: 0x165, script: 0x57, flags: 0x0},
+ 217: {region: 0x165, script: 0x57, flags: 0x0},
+ 218: {region: 0xd6, script: 0x57, flags: 0x0},
+ 219: {region: 0x35, script: 0x16, flags: 0x0},
+ 220: {region: 0x106, script: 0x1f, flags: 0x0},
+ 221: {region: 0xe7, script: 0x57, flags: 0x0},
+ 222: {region: 0x165, script: 0x57, flags: 0x0},
+ 223: {region: 0x131, script: 0x57, flags: 0x0},
+ 224: {region: 0x8a, script: 0x57, flags: 0x0},
+ 225: {region: 0x75, script: 0x57, flags: 0x0},
+ 226: {region: 0x106, script: 0x1f, flags: 0x0},
+ 227: {region: 0x135, script: 0x57, flags: 0x0},
+ 228: {region: 0x49, script: 0x57, flags: 0x0},
+ 229: {region: 0x135, script: 0x1a, flags: 0x0},
+ 230: {region: 0xa6, script: 0x5, flags: 0x0},
+ 231: {region: 0x13e, script: 0x19, flags: 0x0},
+ 232: {region: 0x165, script: 0x57, flags: 0x0},
+ 233: {region: 0x9b, script: 0x5, flags: 0x0},
+ 234: {region: 0x165, script: 0x57, flags: 0x0},
+ 235: {region: 0x165, script: 0x57, flags: 0x0},
+ 236: {region: 0x165, script: 0x57, flags: 0x0},
+ 237: {region: 0x165, script: 0x57, flags: 0x0},
+ 238: {region: 0x165, script: 0x57, flags: 0x0},
+ 239: {region: 0xc5, script: 0xcc, flags: 0x0},
+ 240: {region: 0x78, script: 0x57, flags: 0x0},
+ 241: {region: 0x6b, script: 0x1c, flags: 0x0},
+ 242: {region: 0xe7, script: 0x57, flags: 0x0},
+ 243: {region: 0x49, script: 0x17, flags: 0x0},
+ 244: {region: 0x130, script: 0x1f, flags: 0x0},
+ 245: {region: 0x49, script: 0x17, flags: 0x0},
+ 246: {region: 0x49, script: 0x17, flags: 0x0},
+ 247: {region: 0x49, script: 0x17, flags: 0x0},
+ 248: {region: 0x49, script: 0x17, flags: 0x0},
+ 249: {region: 0x10a, script: 0x57, flags: 0x0},
+ 250: {region: 0x5e, script: 0x57, flags: 0x0},
+ 251: {region: 0xe9, script: 0x57, flags: 0x0},
+ 252: {region: 0x49, script: 0x17, flags: 0x0},
+ 253: {region: 0xc4, script: 0x81, flags: 0x0},
+ 254: {region: 0x8, script: 0x2, flags: 0x1},
+ 255: {region: 0x106, script: 0x1f, flags: 0x0},
+ 256: {region: 0x7b, script: 0x57, flags: 0x0},
+ 257: {region: 0x63, script: 0x57, flags: 0x0},
+ 258: {region: 0x165, script: 0x57, flags: 0x0},
+ 259: {region: 0x165, script: 0x57, flags: 0x0},
+ 260: {region: 0x165, script: 0x57, flags: 0x0},
+ 261: {region: 0x165, script: 0x57, flags: 0x0},
+ 262: {region: 0x135, script: 0x57, flags: 0x0},
+ 263: {region: 0x106, script: 0x1f, flags: 0x0},
+ 264: {region: 0xa4, script: 0x57, flags: 0x0},
+ 265: {region: 0x165, script: 0x57, flags: 0x0},
+ 266: {region: 0x165, script: 0x57, flags: 0x0},
+ 267: {region: 0x99, script: 0x5, flags: 0x0},
+ 268: {region: 0x165, script: 0x57, flags: 0x0},
+ 269: {region: 0x60, script: 0x57, flags: 0x0},
+ 270: {region: 0x165, script: 0x57, flags: 0x0},
+ 271: {region: 0x49, script: 0x57, flags: 0x0},
+ 272: {region: 0x165, script: 0x57, flags: 0x0},
+ 273: {region: 0x165, script: 0x57, flags: 0x0},
+ 274: {region: 0x165, script: 0x57, flags: 0x0},
+ 275: {region: 0x165, script: 0x5, flags: 0x0},
+ 276: {region: 0x49, script: 0x57, flags: 0x0},
+ 277: {region: 0x165, script: 0x57, flags: 0x0},
+ 278: {region: 0x165, script: 0x57, flags: 0x0},
+ 279: {region: 0xd4, script: 0x57, flags: 0x0},
+ 280: {region: 0x4f, script: 0x57, flags: 0x0},
+ 281: {region: 0x165, script: 0x57, flags: 0x0},
+ 282: {region: 0x99, script: 0x5, flags: 0x0},
+ 283: {region: 0x165, script: 0x57, flags: 0x0},
+ 284: {region: 0x165, script: 0x57, flags: 0x0},
+ 285: {region: 0x165, script: 0x57, flags: 0x0},
+ 286: {region: 0x165, script: 0x29, flags: 0x0},
+ 287: {region: 0x60, script: 0x57, flags: 0x0},
+ 288: {region: 0xc3, script: 0x57, flags: 0x0},
+ 289: {region: 0xd0, script: 0x57, flags: 0x0},
+ 290: {region: 0x165, script: 0x57, flags: 0x0},
+ 291: {region: 0xdb, script: 0x21, flags: 0x0},
+ 292: {region: 0x52, script: 0x57, flags: 0x0},
+ 293: {region: 0x165, script: 0x57, flags: 0x0},
+ 294: {region: 0x165, script: 0x57, flags: 0x0},
+ 295: {region: 0x165, script: 0x57, flags: 0x0},
+ 296: {region: 0xcd, script: 0xde, flags: 0x0},
+ 297: {region: 0x165, script: 0x57, flags: 0x0},
+ 298: {region: 0x165, script: 0x57, flags: 0x0},
+ 299: {region: 0x114, script: 0x57, flags: 0x0},
+ 300: {region: 0x37, script: 0x57, flags: 0x0},
+ 301: {region: 0x43, script: 0xe0, flags: 0x0},
+ 302: {region: 0x165, script: 0x57, flags: 0x0},
+ 303: {region: 0xa4, script: 0x57, flags: 0x0},
+ 304: {region: 0x80, script: 0x57, flags: 0x0},
+ 305: {region: 0xd6, script: 0x57, flags: 0x0},
+ 306: {region: 0x9e, script: 0x57, flags: 0x0},
+ 307: {region: 0x6b, script: 0x27, flags: 0x0},
+ 308: {region: 0x165, script: 0x57, flags: 0x0},
+ 309: {region: 0xc4, script: 0x48, flags: 0x0},
+ 310: {region: 0x87, script: 0x31, flags: 0x0},
+ 311: {region: 0x165, script: 0x57, flags: 0x0},
+ 312: {region: 0x165, script: 0x57, flags: 0x0},
+ 313: {region: 0xa, script: 0x2, flags: 0x1},
+ 314: {region: 0x165, script: 0x57, flags: 0x0},
+ 315: {region: 0x165, script: 0x57, flags: 0x0},
+ 316: {region: 0x1, script: 0x57, flags: 0x0},
+ 317: {region: 0x165, script: 0x57, flags: 0x0},
+ 318: {region: 0x6e, script: 0x57, flags: 0x0},
+ 319: {region: 0x135, script: 0x57, flags: 0x0},
+ 320: {region: 0x6a, script: 0x57, flags: 0x0},
+ 321: {region: 0x165, script: 0x57, flags: 0x0},
+ 322: {region: 0x9e, script: 0x43, flags: 0x0},
+ 323: {region: 0x165, script: 0x57, flags: 0x0},
+ 324: {region: 0x165, script: 0x57, flags: 0x0},
+ 325: {region: 0x6e, script: 0x57, flags: 0x0},
+ 326: {region: 0x52, script: 0x57, flags: 0x0},
+ 327: {region: 0x6e, script: 0x57, flags: 0x0},
+ 328: {region: 0x9c, script: 0x5, flags: 0x0},
+ 329: {region: 0x165, script: 0x57, flags: 0x0},
+ 330: {region: 0x165, script: 0x57, flags: 0x0},
+ 331: {region: 0x165, script: 0x57, flags: 0x0},
+ 332: {region: 0x165, script: 0x57, flags: 0x0},
+ 333: {region: 0x86, script: 0x57, flags: 0x0},
+ 334: {region: 0xc, script: 0x2, flags: 0x1},
+ 335: {region: 0x165, script: 0x57, flags: 0x0},
+ 336: {region: 0xc3, script: 0x57, flags: 0x0},
+ 337: {region: 0x72, script: 0x57, flags: 0x0},
+ 338: {region: 0x10b, script: 0x5, flags: 0x0},
+ 339: {region: 0xe7, script: 0x57, flags: 0x0},
+ 340: {region: 0x10c, script: 0x57, flags: 0x0},
+ 341: {region: 0x73, script: 0x57, flags: 0x0},
+ 342: {region: 0x165, script: 0x57, flags: 0x0},
+ 343: {region: 0x165, script: 0x57, flags: 0x0},
+ 344: {region: 0x76, script: 0x57, flags: 0x0},
+ 345: {region: 0x165, script: 0x57, flags: 0x0},
+ 346: {region: 0x3b, script: 0x57, flags: 0x0},
+ 347: {region: 0x165, script: 0x57, flags: 0x0},
+ 348: {region: 0x165, script: 0x57, flags: 0x0},
+ 349: {region: 0x165, script: 0x57, flags: 0x0},
+ 350: {region: 0x78, script: 0x57, flags: 0x0},
+ 351: {region: 0x135, script: 0x57, flags: 0x0},
+ 352: {region: 0x78, script: 0x57, flags: 0x0},
+ 353: {region: 0x60, script: 0x57, flags: 0x0},
+ 354: {region: 0x60, script: 0x57, flags: 0x0},
+ 355: {region: 0x52, script: 0x5, flags: 0x0},
+ 356: {region: 0x140, script: 0x57, flags: 0x0},
+ 357: {region: 0x165, script: 0x57, flags: 0x0},
+ 358: {region: 0x84, script: 0x57, flags: 0x0},
+ 359: {region: 0x165, script: 0x57, flags: 0x0},
+ 360: {region: 0xd4, script: 0x57, flags: 0x0},
+ 361: {region: 0x9e, script: 0x57, flags: 0x0},
+ 362: {region: 0xd6, script: 0x57, flags: 0x0},
+ 363: {region: 0x165, script: 0x57, flags: 0x0},
+ 364: {region: 0x10b, script: 0x57, flags: 0x0},
+ 365: {region: 0xd9, script: 0x57, flags: 0x0},
+ 366: {region: 0x96, script: 0x57, flags: 0x0},
+ 367: {region: 0x80, script: 0x57, flags: 0x0},
+ 368: {region: 0x165, script: 0x57, flags: 0x0},
+ 369: {region: 0xbc, script: 0x57, flags: 0x0},
+ 370: {region: 0x165, script: 0x57, flags: 0x0},
+ 371: {region: 0x165, script: 0x57, flags: 0x0},
+ 372: {region: 0x165, script: 0x57, flags: 0x0},
+ 373: {region: 0x53, script: 0x38, flags: 0x0},
+ 374: {region: 0x165, script: 0x57, flags: 0x0},
+ 375: {region: 0x95, script: 0x57, flags: 0x0},
+ 376: {region: 0x165, script: 0x57, flags: 0x0},
+ 377: {region: 0x165, script: 0x57, flags: 0x0},
+ 378: {region: 0x99, script: 0x21, flags: 0x0},
+ 379: {region: 0x165, script: 0x57, flags: 0x0},
+ 380: {region: 0x9c, script: 0x5, flags: 0x0},
+ 381: {region: 0x7e, script: 0x57, flags: 0x0},
+ 382: {region: 0x7b, script: 0x57, flags: 0x0},
+ 383: {region: 0x165, script: 0x57, flags: 0x0},
+ 384: {region: 0x165, script: 0x57, flags: 0x0},
+ 385: {region: 0x165, script: 0x57, flags: 0x0},
+ 386: {region: 0x165, script: 0x57, flags: 0x0},
+ 387: {region: 0x165, script: 0x57, flags: 0x0},
+ 388: {region: 0x165, script: 0x57, flags: 0x0},
+ 389: {region: 0x6f, script: 0x29, flags: 0x0},
+ 390: {region: 0x165, script: 0x57, flags: 0x0},
+ 391: {region: 0xdb, script: 0x21, flags: 0x0},
+ 392: {region: 0x165, script: 0x57, flags: 0x0},
+ 393: {region: 0xa7, script: 0x57, flags: 0x0},
+ 394: {region: 0x165, script: 0x57, flags: 0x0},
+ 395: {region: 0xe8, script: 0x5, flags: 0x0},
+ 396: {region: 0x165, script: 0x57, flags: 0x0},
+ 397: {region: 0xe8, script: 0x5, flags: 0x0},
+ 398: {region: 0x165, script: 0x57, flags: 0x0},
+ 399: {region: 0x165, script: 0x57, flags: 0x0},
+ 400: {region: 0x6e, script: 0x57, flags: 0x0},
+ 401: {region: 0x9c, script: 0x5, flags: 0x0},
+ 402: {region: 0x165, script: 0x57, flags: 0x0},
+ 403: {region: 0x165, script: 0x29, flags: 0x0},
+ 404: {region: 0xf1, script: 0x57, flags: 0x0},
+ 405: {region: 0x165, script: 0x57, flags: 0x0},
+ 406: {region: 0x165, script: 0x57, flags: 0x0},
+ 407: {region: 0x165, script: 0x57, flags: 0x0},
+ 408: {region: 0x165, script: 0x29, flags: 0x0},
+ 409: {region: 0x165, script: 0x57, flags: 0x0},
+ 410: {region: 0x99, script: 0x21, flags: 0x0},
+ 411: {region: 0x99, script: 0xda, flags: 0x0},
+ 412: {region: 0x95, script: 0x57, flags: 0x0},
+ 413: {region: 0xd9, script: 0x57, flags: 0x0},
+ 414: {region: 0x130, script: 0x2f, flags: 0x0},
+ 415: {region: 0x165, script: 0x57, flags: 0x0},
+ 416: {region: 0xe, script: 0x2, flags: 0x1},
+ 417: {region: 0x99, script: 0xe, flags: 0x0},
+ 418: {region: 0x165, script: 0x57, flags: 0x0},
+ 419: {region: 0x4e, script: 0x57, flags: 0x0},
+ 420: {region: 0x99, script: 0x32, flags: 0x0},
+ 421: {region: 0x41, script: 0x57, flags: 0x0},
+ 422: {region: 0x54, script: 0x57, flags: 0x0},
+ 423: {region: 0x165, script: 0x57, flags: 0x0},
+ 424: {region: 0x80, script: 0x57, flags: 0x0},
+ 425: {region: 0x165, script: 0x57, flags: 0x0},
+ 426: {region: 0x165, script: 0x57, flags: 0x0},
+ 427: {region: 0xa4, script: 0x57, flags: 0x0},
+ 428: {region: 0x98, script: 0x57, flags: 0x0},
+ 429: {region: 0x165, script: 0x57, flags: 0x0},
+ 430: {region: 0xdb, script: 0x21, flags: 0x0},
+ 431: {region: 0x165, script: 0x57, flags: 0x0},
+ 432: {region: 0x165, script: 0x5, flags: 0x0},
+ 433: {region: 0x49, script: 0x57, flags: 0x0},
+ 434: {region: 0x165, script: 0x5, flags: 0x0},
+ 435: {region: 0x165, script: 0x57, flags: 0x0},
+ 436: {region: 0x10, script: 0x3, flags: 0x1},
+ 437: {region: 0x165, script: 0x57, flags: 0x0},
+ 438: {region: 0x53, script: 0x38, flags: 0x0},
+ 439: {region: 0x165, script: 0x57, flags: 0x0},
+ 440: {region: 0x135, script: 0x57, flags: 0x0},
+ 441: {region: 0x24, script: 0x5, flags: 0x0},
+ 442: {region: 0x165, script: 0x57, flags: 0x0},
+ 443: {region: 0x165, script: 0x29, flags: 0x0},
+ 444: {region: 0x97, script: 0x3b, flags: 0x0},
+ 445: {region: 0x165, script: 0x57, flags: 0x0},
+ 446: {region: 0x99, script: 0x21, flags: 0x0},
+ 447: {region: 0x165, script: 0x57, flags: 0x0},
+ 448: {region: 0x73, script: 0x57, flags: 0x0},
+ 449: {region: 0x165, script: 0x57, flags: 0x0},
+ 450: {region: 0x165, script: 0x57, flags: 0x0},
+ 451: {region: 0xe7, script: 0x57, flags: 0x0},
+ 452: {region: 0x165, script: 0x57, flags: 0x0},
+ 453: {region: 0x12b, script: 0x3d, flags: 0x0},
+ 454: {region: 0x53, script: 0x89, flags: 0x0},
+ 455: {region: 0x165, script: 0x57, flags: 0x0},
+ 456: {region: 0xe8, script: 0x5, flags: 0x0},
+ 457: {region: 0x99, script: 0x21, flags: 0x0},
+ 458: {region: 0xaf, script: 0x3e, flags: 0x0},
+ 459: {region: 0xe7, script: 0x57, flags: 0x0},
+ 460: {region: 0xe8, script: 0x5, flags: 0x0},
+ 461: {region: 0xe6, script: 0x57, flags: 0x0},
+ 462: {region: 0x99, script: 0x21, flags: 0x0},
+ 463: {region: 0x99, script: 0x21, flags: 0x0},
+ 464: {region: 0x165, script: 0x57, flags: 0x0},
+ 465: {region: 0x90, script: 0x57, flags: 0x0},
+ 466: {region: 0x60, script: 0x57, flags: 0x0},
+ 467: {region: 0x53, script: 0x38, flags: 0x0},
+ 468: {region: 0x91, script: 0x57, flags: 0x0},
+ 469: {region: 0x92, script: 0x57, flags: 0x0},
+ 470: {region: 0x165, script: 0x57, flags: 0x0},
+ 471: {region: 0x28, script: 0x8, flags: 0x0},
+ 472: {region: 0xd2, script: 0x57, flags: 0x0},
+ 473: {region: 0x78, script: 0x57, flags: 0x0},
+ 474: {region: 0x165, script: 0x57, flags: 0x0},
+ 475: {region: 0x165, script: 0x57, flags: 0x0},
+ 476: {region: 0xd0, script: 0x57, flags: 0x0},
+ 477: {region: 0xd6, script: 0x57, flags: 0x0},
+ 478: {region: 0x165, script: 0x57, flags: 0x0},
+ 479: {region: 0x165, script: 0x57, flags: 0x0},
+ 480: {region: 0x165, script: 0x57, flags: 0x0},
+ 481: {region: 0x95, script: 0x57, flags: 0x0},
+ 482: {region: 0x165, script: 0x57, flags: 0x0},
+ 483: {region: 0x165, script: 0x57, flags: 0x0},
+ 484: {region: 0x165, script: 0x57, flags: 0x0},
+ 486: {region: 0x122, script: 0x57, flags: 0x0},
+ 487: {region: 0xd6, script: 0x57, flags: 0x0},
+ 488: {region: 0x165, script: 0x57, flags: 0x0},
+ 489: {region: 0x165, script: 0x57, flags: 0x0},
+ 490: {region: 0x53, script: 0xea, flags: 0x0},
+ 491: {region: 0x165, script: 0x57, flags: 0x0},
+ 492: {region: 0x135, script: 0x57, flags: 0x0},
+ 493: {region: 0x165, script: 0x57, flags: 0x0},
+ 494: {region: 0x49, script: 0x57, flags: 0x0},
+ 495: {region: 0x165, script: 0x57, flags: 0x0},
+ 496: {region: 0x165, script: 0x57, flags: 0x0},
+ 497: {region: 0xe7, script: 0x57, flags: 0x0},
+ 498: {region: 0x165, script: 0x57, flags: 0x0},
+ 499: {region: 0x95, script: 0x57, flags: 0x0},
+ 500: {region: 0x106, script: 0x1f, flags: 0x0},
+ 501: {region: 0x1, script: 0x57, flags: 0x0},
+ 502: {region: 0x165, script: 0x57, flags: 0x0},
+ 503: {region: 0x165, script: 0x57, flags: 0x0},
+ 504: {region: 0x9d, script: 0x57, flags: 0x0},
+ 505: {region: 0x9e, script: 0x57, flags: 0x0},
+ 506: {region: 0x49, script: 0x17, flags: 0x0},
+ 507: {region: 0x97, script: 0x3b, flags: 0x0},
+ 508: {region: 0x165, script: 0x57, flags: 0x0},
+ 509: {region: 0x165, script: 0x57, flags: 0x0},
+ 510: {region: 0x106, script: 0x57, flags: 0x0},
+ 511: {region: 0x165, script: 0x57, flags: 0x0},
+ 512: {region: 0xa2, script: 0x46, flags: 0x0},
+ 513: {region: 0x165, script: 0x57, flags: 0x0},
+ 514: {region: 0xa0, script: 0x57, flags: 0x0},
+ 515: {region: 0x1, script: 0x57, flags: 0x0},
+ 516: {region: 0x165, script: 0x57, flags: 0x0},
+ 517: {region: 0x165, script: 0x57, flags: 0x0},
+ 518: {region: 0x165, script: 0x57, flags: 0x0},
+ 519: {region: 0x52, script: 0x57, flags: 0x0},
+ 520: {region: 0x130, script: 0x3b, flags: 0x0},
+ 521: {region: 0x165, script: 0x57, flags: 0x0},
+ 522: {region: 0x12f, script: 0x57, flags: 0x0},
+ 523: {region: 0xdb, script: 0x21, flags: 0x0},
+ 524: {region: 0x165, script: 0x57, flags: 0x0},
+ 525: {region: 0x63, script: 0x57, flags: 0x0},
+ 526: {region: 0x95, script: 0x57, flags: 0x0},
+ 527: {region: 0x95, script: 0x57, flags: 0x0},
+ 528: {region: 0x7d, script: 0x2b, flags: 0x0},
+ 529: {region: 0x137, script: 0x1f, flags: 0x0},
+ 530: {region: 0x67, script: 0x57, flags: 0x0},
+ 531: {region: 0xc4, script: 0x57, flags: 0x0},
+ 532: {region: 0x165, script: 0x57, flags: 0x0},
+ 533: {region: 0x165, script: 0x57, flags: 0x0},
+ 534: {region: 0xd6, script: 0x57, flags: 0x0},
+ 535: {region: 0xa4, script: 0x57, flags: 0x0},
+ 536: {region: 0xc3, script: 0x57, flags: 0x0},
+ 537: {region: 0x106, script: 0x1f, flags: 0x0},
+ 538: {region: 0x165, script: 0x57, flags: 0x0},
+ 539: {region: 0x165, script: 0x57, flags: 0x0},
+ 540: {region: 0x165, script: 0x57, flags: 0x0},
+ 541: {region: 0x165, script: 0x57, flags: 0x0},
+ 542: {region: 0xd4, script: 0x5, flags: 0x0},
+ 543: {region: 0xd6, script: 0x57, flags: 0x0},
+ 544: {region: 0x164, script: 0x57, flags: 0x0},
+ 545: {region: 0x165, script: 0x57, flags: 0x0},
+ 546: {region: 0x165, script: 0x57, flags: 0x0},
+ 547: {region: 0x12f, script: 0x57, flags: 0x0},
+ 548: {region: 0x122, script: 0x5, flags: 0x0},
+ 549: {region: 0x165, script: 0x57, flags: 0x0},
+ 550: {region: 0x123, script: 0xdf, flags: 0x0},
+ 551: {region: 0x5a, script: 0x57, flags: 0x0},
+ 552: {region: 0x52, script: 0x57, flags: 0x0},
+ 553: {region: 0x165, script: 0x57, flags: 0x0},
+ 554: {region: 0x4f, script: 0x57, flags: 0x0},
+ 555: {region: 0x99, script: 0x21, flags: 0x0},
+ 556: {region: 0x99, script: 0x21, flags: 0x0},
+ 557: {region: 0x4b, script: 0x57, flags: 0x0},
+ 558: {region: 0x95, script: 0x57, flags: 0x0},
+ 559: {region: 0x165, script: 0x57, flags: 0x0},
+ 560: {region: 0x41, script: 0x57, flags: 0x0},
+ 561: {region: 0x99, script: 0x57, flags: 0x0},
+ 562: {region: 0x53, script: 0xd6, flags: 0x0},
+ 563: {region: 0x99, script: 0x21, flags: 0x0},
+ 564: {region: 0xc3, script: 0x57, flags: 0x0},
+ 565: {region: 0x165, script: 0x57, flags: 0x0},
+ 566: {region: 0x99, script: 0x72, flags: 0x0},
+ 567: {region: 0xe8, script: 0x5, flags: 0x0},
+ 568: {region: 0x165, script: 0x57, flags: 0x0},
+ 569: {region: 0xa4, script: 0x57, flags: 0x0},
+ 570: {region: 0x165, script: 0x57, flags: 0x0},
+ 571: {region: 0x12b, script: 0x57, flags: 0x0},
+ 572: {region: 0x165, script: 0x57, flags: 0x0},
+ 573: {region: 0xd2, script: 0x57, flags: 0x0},
+ 574: {region: 0x165, script: 0x57, flags: 0x0},
+ 575: {region: 0xaf, script: 0x54, flags: 0x0},
+ 576: {region: 0x165, script: 0x57, flags: 0x0},
+ 577: {region: 0x165, script: 0x57, flags: 0x0},
+ 578: {region: 0x13, script: 0x6, flags: 0x1},
+ 579: {region: 0x165, script: 0x57, flags: 0x0},
+ 580: {region: 0x52, script: 0x57, flags: 0x0},
+ 581: {region: 0x82, script: 0x57, flags: 0x0},
+ 582: {region: 0xa4, script: 0x57, flags: 0x0},
+ 583: {region: 0x165, script: 0x57, flags: 0x0},
+ 584: {region: 0x165, script: 0x57, flags: 0x0},
+ 585: {region: 0x165, script: 0x57, flags: 0x0},
+ 586: {region: 0xa6, script: 0x4b, flags: 0x0},
+ 587: {region: 0x2a, script: 0x57, flags: 0x0},
+ 588: {region: 0x165, script: 0x57, flags: 0x0},
+ 589: {region: 0x165, script: 0x57, flags: 0x0},
+ 590: {region: 0x165, script: 0x57, flags: 0x0},
+ 591: {region: 0x165, script: 0x57, flags: 0x0},
+ 592: {region: 0x165, script: 0x57, flags: 0x0},
+ 593: {region: 0x99, script: 0x4f, flags: 0x0},
+ 594: {region: 0x8b, script: 0x57, flags: 0x0},
+ 595: {region: 0x165, script: 0x57, flags: 0x0},
+ 596: {region: 0xab, script: 0x50, flags: 0x0},
+ 597: {region: 0x106, script: 0x1f, flags: 0x0},
+ 598: {region: 0x99, script: 0x21, flags: 0x0},
+ 599: {region: 0x165, script: 0x57, flags: 0x0},
+ 600: {region: 0x75, script: 0x57, flags: 0x0},
+ 601: {region: 0x165, script: 0x57, flags: 0x0},
+ 602: {region: 0xb4, script: 0x57, flags: 0x0},
+ 603: {region: 0x165, script: 0x57, flags: 0x0},
+ 604: {region: 0x165, script: 0x57, flags: 0x0},
+ 605: {region: 0x165, script: 0x57, flags: 0x0},
+ 606: {region: 0x165, script: 0x57, flags: 0x0},
+ 607: {region: 0x165, script: 0x57, flags: 0x0},
+ 608: {region: 0x165, script: 0x57, flags: 0x0},
+ 609: {region: 0x165, script: 0x57, flags: 0x0},
+ 610: {region: 0x165, script: 0x29, flags: 0x0},
+ 611: {region: 0x165, script: 0x57, flags: 0x0},
+ 612: {region: 0x106, script: 0x1f, flags: 0x0},
+ 613: {region: 0x112, script: 0x57, flags: 0x0},
+ 614: {region: 0xe7, script: 0x57, flags: 0x0},
+ 615: {region: 0x106, script: 0x57, flags: 0x0},
+ 616: {region: 0x165, script: 0x57, flags: 0x0},
+ 617: {region: 0x99, script: 0x21, flags: 0x0},
+ 618: {region: 0x99, script: 0x5, flags: 0x0},
+ 619: {region: 0x12f, script: 0x57, flags: 0x0},
+ 620: {region: 0x165, script: 0x57, flags: 0x0},
+ 621: {region: 0x52, script: 0x57, flags: 0x0},
+ 622: {region: 0x60, script: 0x57, flags: 0x0},
+ 623: {region: 0x165, script: 0x57, flags: 0x0},
+ 624: {region: 0x165, script: 0x57, flags: 0x0},
+ 625: {region: 0x165, script: 0x29, flags: 0x0},
+ 626: {region: 0x165, script: 0x57, flags: 0x0},
+ 627: {region: 0x165, script: 0x57, flags: 0x0},
+ 628: {region: 0x19, script: 0x3, flags: 0x1},
+ 629: {region: 0x165, script: 0x57, flags: 0x0},
+ 630: {region: 0x165, script: 0x57, flags: 0x0},
+ 631: {region: 0x165, script: 0x57, flags: 0x0},
+ 632: {region: 0x165, script: 0x57, flags: 0x0},
+ 633: {region: 0x106, script: 0x1f, flags: 0x0},
+ 634: {region: 0x165, script: 0x57, flags: 0x0},
+ 635: {region: 0x165, script: 0x57, flags: 0x0},
+ 636: {region: 0x165, script: 0x57, flags: 0x0},
+ 637: {region: 0x106, script: 0x1f, flags: 0x0},
+ 638: {region: 0x165, script: 0x57, flags: 0x0},
+ 639: {region: 0x95, script: 0x57, flags: 0x0},
+ 640: {region: 0xe8, script: 0x5, flags: 0x0},
+ 641: {region: 0x7b, script: 0x57, flags: 0x0},
+ 642: {region: 0x165, script: 0x57, flags: 0x0},
+ 643: {region: 0x165, script: 0x57, flags: 0x0},
+ 644: {region: 0x165, script: 0x57, flags: 0x0},
+ 645: {region: 0x165, script: 0x29, flags: 0x0},
+ 646: {region: 0x123, script: 0xdf, flags: 0x0},
+ 647: {region: 0xe8, script: 0x5, flags: 0x0},
+ 648: {region: 0x165, script: 0x57, flags: 0x0},
+ 649: {region: 0x165, script: 0x57, flags: 0x0},
+ 650: {region: 0x1c, script: 0x5, flags: 0x1},
+ 651: {region: 0x165, script: 0x57, flags: 0x0},
+ 652: {region: 0x165, script: 0x57, flags: 0x0},
+ 653: {region: 0x165, script: 0x57, flags: 0x0},
+ 654: {region: 0x138, script: 0x57, flags: 0x0},
+ 655: {region: 0x87, script: 0x5b, flags: 0x0},
+ 656: {region: 0x97, script: 0x3b, flags: 0x0},
+ 657: {region: 0x12f, script: 0x57, flags: 0x0},
+ 658: {region: 0xe8, script: 0x5, flags: 0x0},
+ 659: {region: 0x131, script: 0x57, flags: 0x0},
+ 660: {region: 0x165, script: 0x57, flags: 0x0},
+ 661: {region: 0xb7, script: 0x57, flags: 0x0},
+ 662: {region: 0x106, script: 0x1f, flags: 0x0},
+ 663: {region: 0x165, script: 0x57, flags: 0x0},
+ 664: {region: 0x95, script: 0x57, flags: 0x0},
+ 665: {region: 0x165, script: 0x57, flags: 0x0},
+ 666: {region: 0x53, script: 0xdf, flags: 0x0},
+ 667: {region: 0x165, script: 0x57, flags: 0x0},
+ 668: {region: 0x165, script: 0x57, flags: 0x0},
+ 669: {region: 0x165, script: 0x57, flags: 0x0},
+ 670: {region: 0x165, script: 0x57, flags: 0x0},
+ 671: {region: 0x99, script: 0x59, flags: 0x0},
+ 672: {region: 0x165, script: 0x57, flags: 0x0},
+ 673: {region: 0x165, script: 0x57, flags: 0x0},
+ 674: {region: 0x106, script: 0x1f, flags: 0x0},
+ 675: {region: 0x131, script: 0x57, flags: 0x0},
+ 676: {region: 0x165, script: 0x57, flags: 0x0},
+ 677: {region: 0xd9, script: 0x57, flags: 0x0},
+ 678: {region: 0x165, script: 0x57, flags: 0x0},
+ 679: {region: 0x165, script: 0x57, flags: 0x0},
+ 680: {region: 0x21, script: 0x2, flags: 0x1},
+ 681: {region: 0x165, script: 0x57, flags: 0x0},
+ 682: {region: 0x165, script: 0x57, flags: 0x0},
+ 683: {region: 0x9e, script: 0x57, flags: 0x0},
+ 684: {region: 0x53, script: 0x5d, flags: 0x0},
+ 685: {region: 0x95, script: 0x57, flags: 0x0},
+ 686: {region: 0x9c, script: 0x5, flags: 0x0},
+ 687: {region: 0x135, script: 0x57, flags: 0x0},
+ 688: {region: 0x165, script: 0x57, flags: 0x0},
+ 689: {region: 0x165, script: 0x57, flags: 0x0},
+ 690: {region: 0x99, script: 0xda, flags: 0x0},
+ 691: {region: 0x9e, script: 0x57, flags: 0x0},
+ 692: {region: 0x165, script: 0x57, flags: 0x0},
+ 693: {region: 0x4b, script: 0x57, flags: 0x0},
+ 694: {region: 0x165, script: 0x57, flags: 0x0},
+ 695: {region: 0x165, script: 0x57, flags: 0x0},
+ 696: {region: 0xaf, script: 0x54, flags: 0x0},
+ 697: {region: 0x165, script: 0x57, flags: 0x0},
+ 698: {region: 0x165, script: 0x57, flags: 0x0},
+ 699: {region: 0x4b, script: 0x57, flags: 0x0},
+ 700: {region: 0x165, script: 0x57, flags: 0x0},
+ 701: {region: 0x165, script: 0x57, flags: 0x0},
+ 702: {region: 0x162, script: 0x57, flags: 0x0},
+ 703: {region: 0x9c, script: 0x5, flags: 0x0},
+ 704: {region: 0xb6, script: 0x57, flags: 0x0},
+ 705: {region: 0xb8, script: 0x57, flags: 0x0},
+ 706: {region: 0x4b, script: 0x57, flags: 0x0},
+ 707: {region: 0x4b, script: 0x57, flags: 0x0},
+ 708: {region: 0xa4, script: 0x57, flags: 0x0},
+ 709: {region: 0xa4, script: 0x57, flags: 0x0},
+ 710: {region: 0x9c, script: 0x5, flags: 0x0},
+ 711: {region: 0xb8, script: 0x57, flags: 0x0},
+ 712: {region: 0x123, script: 0xdf, flags: 0x0},
+ 713: {region: 0x53, script: 0x38, flags: 0x0},
+ 714: {region: 0x12b, script: 0x57, flags: 0x0},
+ 715: {region: 0x95, script: 0x57, flags: 0x0},
+ 716: {region: 0x52, script: 0x57, flags: 0x0},
+ 717: {region: 0x99, script: 0x21, flags: 0x0},
+ 718: {region: 0x99, script: 0x21, flags: 0x0},
+ 719: {region: 0x95, script: 0x57, flags: 0x0},
+ 720: {region: 0x23, script: 0x3, flags: 0x1},
+ 721: {region: 0xa4, script: 0x57, flags: 0x0},
+ 722: {region: 0x165, script: 0x57, flags: 0x0},
+ 723: {region: 0xcf, script: 0x57, flags: 0x0},
+ 724: {region: 0x165, script: 0x57, flags: 0x0},
+ 725: {region: 0x165, script: 0x57, flags: 0x0},
+ 726: {region: 0x165, script: 0x57, flags: 0x0},
+ 727: {region: 0x165, script: 0x57, flags: 0x0},
+ 728: {region: 0x165, script: 0x57, flags: 0x0},
+ 729: {region: 0x165, script: 0x57, flags: 0x0},
+ 730: {region: 0x165, script: 0x57, flags: 0x0},
+ 731: {region: 0x165, script: 0x57, flags: 0x0},
+ 732: {region: 0x165, script: 0x57, flags: 0x0},
+ 733: {region: 0x165, script: 0x57, flags: 0x0},
+ 734: {region: 0x165, script: 0x57, flags: 0x0},
+ 735: {region: 0x165, script: 0x5, flags: 0x0},
+ 736: {region: 0x106, script: 0x1f, flags: 0x0},
+ 737: {region: 0xe7, script: 0x57, flags: 0x0},
+ 738: {region: 0x165, script: 0x57, flags: 0x0},
+ 739: {region: 0x95, script: 0x57, flags: 0x0},
+ 740: {region: 0x165, script: 0x29, flags: 0x0},
+ 741: {region: 0x165, script: 0x57, flags: 0x0},
+ 742: {region: 0x165, script: 0x57, flags: 0x0},
+ 743: {region: 0x165, script: 0x57, flags: 0x0},
+ 744: {region: 0x112, script: 0x57, flags: 0x0},
+ 745: {region: 0xa4, script: 0x57, flags: 0x0},
+ 746: {region: 0x165, script: 0x57, flags: 0x0},
+ 747: {region: 0x165, script: 0x57, flags: 0x0},
+ 748: {region: 0x123, script: 0x5, flags: 0x0},
+ 749: {region: 0xcc, script: 0x57, flags: 0x0},
+ 750: {region: 0x165, script: 0x57, flags: 0x0},
+ 751: {region: 0x165, script: 0x57, flags: 0x0},
+ 752: {region: 0x165, script: 0x57, flags: 0x0},
+ 753: {region: 0xbf, script: 0x57, flags: 0x0},
+ 754: {region: 0xd1, script: 0x57, flags: 0x0},
+ 755: {region: 0x165, script: 0x57, flags: 0x0},
+ 756: {region: 0x52, script: 0x57, flags: 0x0},
+ 757: {region: 0xdb, script: 0x21, flags: 0x0},
+ 758: {region: 0x12f, script: 0x57, flags: 0x0},
+ 759: {region: 0xc0, script: 0x57, flags: 0x0},
+ 760: {region: 0x165, script: 0x57, flags: 0x0},
+ 761: {region: 0x165, script: 0x57, flags: 0x0},
+ 762: {region: 0xe0, script: 0x57, flags: 0x0},
+ 763: {region: 0x165, script: 0x57, flags: 0x0},
+ 764: {region: 0x95, script: 0x57, flags: 0x0},
+ 765: {region: 0x9b, script: 0x3a, flags: 0x0},
+ 766: {region: 0x165, script: 0x57, flags: 0x0},
+ 767: {region: 0xc2, script: 0x1f, flags: 0x0},
+ 768: {region: 0x165, script: 0x5, flags: 0x0},
+ 769: {region: 0x165, script: 0x57, flags: 0x0},
+ 770: {region: 0x165, script: 0x57, flags: 0x0},
+ 771: {region: 0x165, script: 0x57, flags: 0x0},
+ 772: {region: 0x99, script: 0x6b, flags: 0x0},
+ 773: {region: 0x165, script: 0x57, flags: 0x0},
+ 774: {region: 0x165, script: 0x57, flags: 0x0},
+ 775: {region: 0x10b, script: 0x57, flags: 0x0},
+ 776: {region: 0x165, script: 0x57, flags: 0x0},
+ 777: {region: 0x165, script: 0x57, flags: 0x0},
+ 778: {region: 0x165, script: 0x57, flags: 0x0},
+ 779: {region: 0x26, script: 0x3, flags: 0x1},
+ 780: {region: 0x165, script: 0x57, flags: 0x0},
+ 781: {region: 0x165, script: 0x57, flags: 0x0},
+ 782: {region: 0x99, script: 0xe, flags: 0x0},
+ 783: {region: 0xc4, script: 0x72, flags: 0x0},
+ 785: {region: 0x165, script: 0x57, flags: 0x0},
+ 786: {region: 0x49, script: 0x57, flags: 0x0},
+ 787: {region: 0x49, script: 0x57, flags: 0x0},
+ 788: {region: 0x37, script: 0x57, flags: 0x0},
+ 789: {region: 0x165, script: 0x57, flags: 0x0},
+ 790: {region: 0x165, script: 0x57, flags: 0x0},
+ 791: {region: 0x165, script: 0x57, flags: 0x0},
+ 792: {region: 0x165, script: 0x57, flags: 0x0},
+ 793: {region: 0x165, script: 0x57, flags: 0x0},
+ 794: {region: 0x165, script: 0x57, flags: 0x0},
+ 795: {region: 0x99, script: 0x21, flags: 0x0},
+ 796: {region: 0xdb, script: 0x21, flags: 0x0},
+ 797: {region: 0x106, script: 0x1f, flags: 0x0},
+ 798: {region: 0x35, script: 0x6f, flags: 0x0},
+ 799: {region: 0x29, script: 0x3, flags: 0x1},
+ 800: {region: 0xcb, script: 0x57, flags: 0x0},
+ 801: {region: 0x165, script: 0x57, flags: 0x0},
+ 802: {region: 0x165, script: 0x57, flags: 0x0},
+ 803: {region: 0x165, script: 0x57, flags: 0x0},
+ 804: {region: 0x99, script: 0x21, flags: 0x0},
+ 805: {region: 0x52, script: 0x57, flags: 0x0},
+ 807: {region: 0x165, script: 0x57, flags: 0x0},
+ 808: {region: 0x135, script: 0x57, flags: 0x0},
+ 809: {region: 0x165, script: 0x57, flags: 0x0},
+ 810: {region: 0x165, script: 0x57, flags: 0x0},
+ 811: {region: 0xe8, script: 0x5, flags: 0x0},
+ 812: {region: 0xc3, script: 0x57, flags: 0x0},
+ 813: {region: 0x99, script: 0x21, flags: 0x0},
+ 814: {region: 0x95, script: 0x57, flags: 0x0},
+ 815: {region: 0x164, script: 0x57, flags: 0x0},
+ 816: {region: 0x165, script: 0x57, flags: 0x0},
+ 817: {region: 0xc4, script: 0x72, flags: 0x0},
+ 818: {region: 0x165, script: 0x57, flags: 0x0},
+ 819: {region: 0x165, script: 0x29, flags: 0x0},
+ 820: {region: 0x106, script: 0x1f, flags: 0x0},
+ 821: {region: 0x165, script: 0x57, flags: 0x0},
+ 822: {region: 0x131, script: 0x57, flags: 0x0},
+ 823: {region: 0x9c, script: 0x63, flags: 0x0},
+ 824: {region: 0x165, script: 0x57, flags: 0x0},
+ 825: {region: 0x165, script: 0x57, flags: 0x0},
+ 826: {region: 0x9c, script: 0x5, flags: 0x0},
+ 827: {region: 0x165, script: 0x57, flags: 0x0},
+ 828: {region: 0x165, script: 0x57, flags: 0x0},
+ 829: {region: 0x165, script: 0x57, flags: 0x0},
+ 830: {region: 0xdd, script: 0x57, flags: 0x0},
+ 831: {region: 0x165, script: 0x57, flags: 0x0},
+ 832: {region: 0x165, script: 0x57, flags: 0x0},
+ 834: {region: 0x165, script: 0x57, flags: 0x0},
+ 835: {region: 0x53, script: 0x38, flags: 0x0},
+ 836: {region: 0x9e, script: 0x57, flags: 0x0},
+ 837: {region: 0xd2, script: 0x57, flags: 0x0},
+ 838: {region: 0x165, script: 0x57, flags: 0x0},
+ 839: {region: 0xda, script: 0x57, flags: 0x0},
+ 840: {region: 0x165, script: 0x57, flags: 0x0},
+ 841: {region: 0x165, script: 0x57, flags: 0x0},
+ 842: {region: 0x165, script: 0x57, flags: 0x0},
+ 843: {region: 0xcf, script: 0x57, flags: 0x0},
+ 844: {region: 0x165, script: 0x57, flags: 0x0},
+ 845: {region: 0x165, script: 0x57, flags: 0x0},
+ 846: {region: 0x164, script: 0x57, flags: 0x0},
+ 847: {region: 0xd1, script: 0x57, flags: 0x0},
+ 848: {region: 0x60, script: 0x57, flags: 0x0},
+ 849: {region: 0xdb, script: 0x21, flags: 0x0},
+ 850: {region: 0x165, script: 0x57, flags: 0x0},
+ 851: {region: 0xdb, script: 0x21, flags: 0x0},
+ 852: {region: 0x165, script: 0x57, flags: 0x0},
+ 853: {region: 0x165, script: 0x57, flags: 0x0},
+ 854: {region: 0xd2, script: 0x57, flags: 0x0},
+ 855: {region: 0x165, script: 0x57, flags: 0x0},
+ 856: {region: 0x165, script: 0x57, flags: 0x0},
+ 857: {region: 0xd1, script: 0x57, flags: 0x0},
+ 858: {region: 0x165, script: 0x57, flags: 0x0},
+ 859: {region: 0xcf, script: 0x57, flags: 0x0},
+ 860: {region: 0xcf, script: 0x57, flags: 0x0},
+ 861: {region: 0x165, script: 0x57, flags: 0x0},
+ 862: {region: 0x165, script: 0x57, flags: 0x0},
+ 863: {region: 0x95, script: 0x57, flags: 0x0},
+ 864: {region: 0x165, script: 0x57, flags: 0x0},
+ 865: {region: 0xdf, script: 0x57, flags: 0x0},
+ 866: {region: 0x165, script: 0x57, flags: 0x0},
+ 867: {region: 0x165, script: 0x57, flags: 0x0},
+ 868: {region: 0x99, script: 0x57, flags: 0x0},
+ 869: {region: 0x165, script: 0x57, flags: 0x0},
+ 870: {region: 0x165, script: 0x57, flags: 0x0},
+ 871: {region: 0xd9, script: 0x57, flags: 0x0},
+ 872: {region: 0x52, script: 0x57, flags: 0x0},
+ 873: {region: 0x165, script: 0x57, flags: 0x0},
+ 874: {region: 0xda, script: 0x57, flags: 0x0},
+ 875: {region: 0x165, script: 0x57, flags: 0x0},
+ 876: {region: 0x52, script: 0x57, flags: 0x0},
+ 877: {region: 0x165, script: 0x57, flags: 0x0},
+ 878: {region: 0x165, script: 0x57, flags: 0x0},
+ 879: {region: 0xda, script: 0x57, flags: 0x0},
+ 880: {region: 0x123, script: 0x53, flags: 0x0},
+ 881: {region: 0x99, script: 0x21, flags: 0x0},
+ 882: {region: 0x10c, script: 0xbf, flags: 0x0},
+ 883: {region: 0x165, script: 0x57, flags: 0x0},
+ 884: {region: 0x165, script: 0x57, flags: 0x0},
+ 885: {region: 0x84, script: 0x78, flags: 0x0},
+ 886: {region: 0x161, script: 0x57, flags: 0x0},
+ 887: {region: 0x165, script: 0x57, flags: 0x0},
+ 888: {region: 0x49, script: 0x17, flags: 0x0},
+ 889: {region: 0x165, script: 0x57, flags: 0x0},
+ 890: {region: 0x161, script: 0x57, flags: 0x0},
+ 891: {region: 0x165, script: 0x57, flags: 0x0},
+ 892: {region: 0x165, script: 0x57, flags: 0x0},
+ 893: {region: 0x165, script: 0x57, flags: 0x0},
+ 894: {region: 0x165, script: 0x57, flags: 0x0},
+ 895: {region: 0x165, script: 0x57, flags: 0x0},
+ 896: {region: 0x117, script: 0x57, flags: 0x0},
+ 897: {region: 0x165, script: 0x57, flags: 0x0},
+ 898: {region: 0x165, script: 0x57, flags: 0x0},
+ 899: {region: 0x135, script: 0x57, flags: 0x0},
+ 900: {region: 0x165, script: 0x57, flags: 0x0},
+ 901: {region: 0x53, script: 0x57, flags: 0x0},
+ 902: {region: 0x165, script: 0x57, flags: 0x0},
+ 903: {region: 0xce, script: 0x57, flags: 0x0},
+ 904: {region: 0x12f, script: 0x57, flags: 0x0},
+ 905: {region: 0x131, script: 0x57, flags: 0x0},
+ 906: {region: 0x80, script: 0x57, flags: 0x0},
+ 907: {region: 0x78, script: 0x57, flags: 0x0},
+ 908: {region: 0x165, script: 0x57, flags: 0x0},
+ 910: {region: 0x165, script: 0x57, flags: 0x0},
+ 911: {region: 0x165, script: 0x57, flags: 0x0},
+ 912: {region: 0x6f, script: 0x57, flags: 0x0},
+ 913: {region: 0x165, script: 0x57, flags: 0x0},
+ 914: {region: 0x165, script: 0x57, flags: 0x0},
+ 915: {region: 0x165, script: 0x57, flags: 0x0},
+ 916: {region: 0x165, script: 0x57, flags: 0x0},
+ 917: {region: 0x99, script: 0x7d, flags: 0x0},
+ 918: {region: 0x165, script: 0x57, flags: 0x0},
+ 919: {region: 0x165, script: 0x5, flags: 0x0},
+ 920: {region: 0x7d, script: 0x1f, flags: 0x0},
+ 921: {region: 0x135, script: 0x7e, flags: 0x0},
+ 922: {region: 0x165, script: 0x5, flags: 0x0},
+ 923: {region: 0xc5, script: 0x7c, flags: 0x0},
+ 924: {region: 0x165, script: 0x57, flags: 0x0},
+ 925: {region: 0x2c, script: 0x3, flags: 0x1},
+ 926: {region: 0xe7, script: 0x57, flags: 0x0},
+ 927: {region: 0x2f, script: 0x2, flags: 0x1},
+ 928: {region: 0xe7, script: 0x57, flags: 0x0},
+ 929: {region: 0x30, script: 0x57, flags: 0x0},
+ 930: {region: 0xf0, script: 0x57, flags: 0x0},
+ 931: {region: 0x165, script: 0x57, flags: 0x0},
+ 932: {region: 0x78, script: 0x57, flags: 0x0},
+ 933: {region: 0xd6, script: 0x57, flags: 0x0},
+ 934: {region: 0x135, script: 0x57, flags: 0x0},
+ 935: {region: 0x49, script: 0x57, flags: 0x0},
+ 936: {region: 0x165, script: 0x57, flags: 0x0},
+ 937: {region: 0x9c, script: 0xe8, flags: 0x0},
+ 938: {region: 0x165, script: 0x57, flags: 0x0},
+ 939: {region: 0x60, script: 0x57, flags: 0x0},
+ 940: {region: 0x165, script: 0x5, flags: 0x0},
+ 941: {region: 0xb0, script: 0x87, flags: 0x0},
+ 943: {region: 0x165, script: 0x57, flags: 0x0},
+ 944: {region: 0x165, script: 0x57, flags: 0x0},
+ 945: {region: 0x99, script: 0x12, flags: 0x0},
+ 946: {region: 0xa4, script: 0x57, flags: 0x0},
+ 947: {region: 0xe9, script: 0x57, flags: 0x0},
+ 948: {region: 0x165, script: 0x57, flags: 0x0},
+ 949: {region: 0x9e, script: 0x57, flags: 0x0},
+ 950: {region: 0x165, script: 0x57, flags: 0x0},
+ 951: {region: 0x165, script: 0x57, flags: 0x0},
+ 952: {region: 0x87, script: 0x31, flags: 0x0},
+ 953: {region: 0x75, script: 0x57, flags: 0x0},
+ 954: {region: 0x165, script: 0x57, flags: 0x0},
+ 955: {region: 0xe8, script: 0x4a, flags: 0x0},
+ 956: {region: 0x9c, script: 0x5, flags: 0x0},
+ 957: {region: 0x1, script: 0x57, flags: 0x0},
+ 958: {region: 0x24, script: 0x5, flags: 0x0},
+ 959: {region: 0x165, script: 0x57, flags: 0x0},
+ 960: {region: 0x41, script: 0x57, flags: 0x0},
+ 961: {region: 0x165, script: 0x57, flags: 0x0},
+ 962: {region: 0x7a, script: 0x57, flags: 0x0},
+ 963: {region: 0x165, script: 0x57, flags: 0x0},
+ 964: {region: 0xe4, script: 0x57, flags: 0x0},
+ 965: {region: 0x89, script: 0x57, flags: 0x0},
+ 966: {region: 0x69, script: 0x57, flags: 0x0},
+ 967: {region: 0x165, script: 0x57, flags: 0x0},
+ 968: {region: 0x99, script: 0x21, flags: 0x0},
+ 969: {region: 0x165, script: 0x57, flags: 0x0},
+ 970: {region: 0x102, script: 0x57, flags: 0x0},
+ 971: {region: 0x95, script: 0x57, flags: 0x0},
+ 972: {region: 0x165, script: 0x57, flags: 0x0},
+ 973: {region: 0x165, script: 0x57, flags: 0x0},
+ 974: {region: 0x9e, script: 0x57, flags: 0x0},
+ 975: {region: 0x165, script: 0x5, flags: 0x0},
+ 976: {region: 0x99, script: 0x57, flags: 0x0},
+ 977: {region: 0x31, script: 0x2, flags: 0x1},
+ 978: {region: 0xdb, script: 0x21, flags: 0x0},
+ 979: {region: 0x35, script: 0xe, flags: 0x0},
+ 980: {region: 0x4e, script: 0x57, flags: 0x0},
+ 981: {region: 0x72, script: 0x57, flags: 0x0},
+ 982: {region: 0x4e, script: 0x57, flags: 0x0},
+ 983: {region: 0x9c, script: 0x5, flags: 0x0},
+ 984: {region: 0x10c, script: 0x57, flags: 0x0},
+ 985: {region: 0x3a, script: 0x57, flags: 0x0},
+ 986: {region: 0x165, script: 0x57, flags: 0x0},
+ 987: {region: 0xd1, script: 0x57, flags: 0x0},
+ 988: {region: 0x104, script: 0x57, flags: 0x0},
+ 989: {region: 0x95, script: 0x57, flags: 0x0},
+ 990: {region: 0x12f, script: 0x57, flags: 0x0},
+ 991: {region: 0x165, script: 0x57, flags: 0x0},
+ 992: {region: 0x165, script: 0x57, flags: 0x0},
+ 993: {region: 0x73, script: 0x57, flags: 0x0},
+ 994: {region: 0x106, script: 0x1f, flags: 0x0},
+ 995: {region: 0x130, script: 0x1f, flags: 0x0},
+ 996: {region: 0x109, script: 0x57, flags: 0x0},
+ 997: {region: 0x107, script: 0x57, flags: 0x0},
+ 998: {region: 0x12f, script: 0x57, flags: 0x0},
+ 999: {region: 0x165, script: 0x57, flags: 0x0},
+ 1000: {region: 0xa2, script: 0x49, flags: 0x0},
+ 1001: {region: 0x99, script: 0x21, flags: 0x0},
+ 1002: {region: 0x80, script: 0x57, flags: 0x0},
+ 1003: {region: 0x106, script: 0x1f, flags: 0x0},
+ 1004: {region: 0xa4, script: 0x57, flags: 0x0},
+ 1005: {region: 0x95, script: 0x57, flags: 0x0},
+ 1006: {region: 0x99, script: 0x57, flags: 0x0},
+ 1007: {region: 0x114, script: 0x57, flags: 0x0},
+ 1008: {region: 0x99, script: 0xc3, flags: 0x0},
+ 1009: {region: 0x165, script: 0x57, flags: 0x0},
+ 1010: {region: 0x165, script: 0x57, flags: 0x0},
+ 1011: {region: 0x12f, script: 0x57, flags: 0x0},
+ 1012: {region: 0x9e, script: 0x57, flags: 0x0},
+ 1013: {region: 0x99, script: 0x21, flags: 0x0},
+ 1014: {region: 0x165, script: 0x5, flags: 0x0},
+ 1015: {region: 0x9e, script: 0x57, flags: 0x0},
+ 1016: {region: 0x7b, script: 0x57, flags: 0x0},
+ 1017: {region: 0x49, script: 0x57, flags: 0x0},
+ 1018: {region: 0x33, script: 0x4, flags: 0x1},
+ 1019: {region: 0x9e, script: 0x57, flags: 0x0},
+ 1020: {region: 0x9c, script: 0x5, flags: 0x0},
+ 1021: {region: 0xda, script: 0x57, flags: 0x0},
+ 1022: {region: 0x4f, script: 0x57, flags: 0x0},
+ 1023: {region: 0xd1, script: 0x57, flags: 0x0},
+ 1024: {region: 0xcf, script: 0x57, flags: 0x0},
+ 1025: {region: 0xc3, script: 0x57, flags: 0x0},
+ 1026: {region: 0x4c, script: 0x57, flags: 0x0},
+ 1027: {region: 0x96, script: 0x7a, flags: 0x0},
+ 1028: {region: 0xb6, script: 0x57, flags: 0x0},
+ 1029: {region: 0x165, script: 0x29, flags: 0x0},
+ 1030: {region: 0x165, script: 0x57, flags: 0x0},
+ 1032: {region: 0xba, script: 0xdc, flags: 0x0},
+ 1033: {region: 0x165, script: 0x57, flags: 0x0},
+ 1034: {region: 0xc4, script: 0x72, flags: 0x0},
+ 1035: {region: 0x165, script: 0x5, flags: 0x0},
+ 1036: {region: 0xb3, script: 0xca, flags: 0x0},
+ 1037: {region: 0x6f, script: 0x57, flags: 0x0},
+ 1038: {region: 0x165, script: 0x57, flags: 0x0},
+ 1039: {region: 0x165, script: 0x57, flags: 0x0},
+ 1040: {region: 0x165, script: 0x57, flags: 0x0},
+ 1041: {region: 0x165, script: 0x57, flags: 0x0},
+ 1042: {region: 0x111, script: 0x57, flags: 0x0},
+ 1043: {region: 0x165, script: 0x57, flags: 0x0},
+ 1044: {region: 0xe8, script: 0x5, flags: 0x0},
+ 1045: {region: 0x165, script: 0x57, flags: 0x0},
+ 1046: {region: 0x10f, script: 0x57, flags: 0x0},
+ 1047: {region: 0x165, script: 0x57, flags: 0x0},
+ 1048: {region: 0xe9, script: 0x57, flags: 0x0},
+ 1049: {region: 0x165, script: 0x57, flags: 0x0},
+ 1050: {region: 0x95, script: 0x57, flags: 0x0},
+ 1051: {region: 0x142, script: 0x57, flags: 0x0},
+ 1052: {region: 0x10c, script: 0x57, flags: 0x0},
+ 1054: {region: 0x10c, script: 0x57, flags: 0x0},
+ 1055: {region: 0x72, script: 0x57, flags: 0x0},
+ 1056: {region: 0x97, script: 0xc0, flags: 0x0},
+ 1057: {region: 0x165, script: 0x57, flags: 0x0},
+ 1058: {region: 0x72, script: 0x57, flags: 0x0},
+ 1059: {region: 0x164, script: 0x57, flags: 0x0},
+ 1060: {region: 0x165, script: 0x57, flags: 0x0},
+ 1061: {region: 0xc3, script: 0x57, flags: 0x0},
+ 1062: {region: 0x165, script: 0x57, flags: 0x0},
+ 1063: {region: 0x165, script: 0x57, flags: 0x0},
+ 1064: {region: 0x165, script: 0x57, flags: 0x0},
+ 1065: {region: 0x115, script: 0x57, flags: 0x0},
+ 1066: {region: 0x165, script: 0x57, flags: 0x0},
+ 1067: {region: 0x165, script: 0x57, flags: 0x0},
+ 1068: {region: 0x123, script: 0xdf, flags: 0x0},
+ 1069: {region: 0x165, script: 0x57, flags: 0x0},
+ 1070: {region: 0x165, script: 0x57, flags: 0x0},
+ 1071: {region: 0x165, script: 0x57, flags: 0x0},
+ 1072: {region: 0x165, script: 0x57, flags: 0x0},
+ 1073: {region: 0x27, script: 0x57, flags: 0x0},
+ 1074: {region: 0x37, script: 0x5, flags: 0x1},
+ 1075: {region: 0x99, script: 0xcb, flags: 0x0},
+ 1076: {region: 0x116, script: 0x57, flags: 0x0},
+ 1077: {region: 0x114, script: 0x57, flags: 0x0},
+ 1078: {region: 0x99, script: 0x21, flags: 0x0},
+ 1079: {region: 0x161, script: 0x57, flags: 0x0},
+ 1080: {region: 0x165, script: 0x57, flags: 0x0},
+ 1081: {region: 0x165, script: 0x57, flags: 0x0},
+ 1082: {region: 0x6d, script: 0x57, flags: 0x0},
+ 1083: {region: 0x161, script: 0x57, flags: 0x0},
+ 1084: {region: 0x165, script: 0x57, flags: 0x0},
+ 1085: {region: 0x60, script: 0x57, flags: 0x0},
+ 1086: {region: 0x95, script: 0x57, flags: 0x0},
+ 1087: {region: 0x165, script: 0x57, flags: 0x0},
+ 1088: {region: 0x165, script: 0x57, flags: 0x0},
+ 1089: {region: 0x12f, script: 0x57, flags: 0x0},
+ 1090: {region: 0x165, script: 0x57, flags: 0x0},
+ 1091: {region: 0x84, script: 0x57, flags: 0x0},
+ 1092: {region: 0x10c, script: 0x57, flags: 0x0},
+ 1093: {region: 0x12f, script: 0x57, flags: 0x0},
+ 1094: {region: 0x15f, script: 0x5, flags: 0x0},
+ 1095: {region: 0x4b, script: 0x57, flags: 0x0},
+ 1096: {region: 0x60, script: 0x57, flags: 0x0},
+ 1097: {region: 0x165, script: 0x57, flags: 0x0},
+ 1098: {region: 0x99, script: 0x21, flags: 0x0},
+ 1099: {region: 0x95, script: 0x57, flags: 0x0},
+ 1100: {region: 0x165, script: 0x57, flags: 0x0},
+ 1101: {region: 0x35, script: 0xe, flags: 0x0},
+ 1102: {region: 0x9b, script: 0xcf, flags: 0x0},
+ 1103: {region: 0xe9, script: 0x57, flags: 0x0},
+ 1104: {region: 0x99, script: 0xd7, flags: 0x0},
+ 1105: {region: 0xdb, script: 0x21, flags: 0x0},
+ 1106: {region: 0x165, script: 0x57, flags: 0x0},
+ 1107: {region: 0x165, script: 0x57, flags: 0x0},
+ 1108: {region: 0x165, script: 0x57, flags: 0x0},
+ 1109: {region: 0x165, script: 0x57, flags: 0x0},
+ 1110: {region: 0x165, script: 0x57, flags: 0x0},
+ 1111: {region: 0x165, script: 0x57, flags: 0x0},
+ 1112: {region: 0x165, script: 0x57, flags: 0x0},
+ 1113: {region: 0x165, script: 0x57, flags: 0x0},
+ 1114: {region: 0xe7, script: 0x57, flags: 0x0},
+ 1115: {region: 0x165, script: 0x57, flags: 0x0},
+ 1116: {region: 0x165, script: 0x57, flags: 0x0},
+ 1117: {region: 0x99, script: 0x4f, flags: 0x0},
+ 1118: {region: 0x53, script: 0xd5, flags: 0x0},
+ 1119: {region: 0xdb, script: 0x21, flags: 0x0},
+ 1120: {region: 0xdb, script: 0x21, flags: 0x0},
+ 1121: {region: 0x99, script: 0xda, flags: 0x0},
+ 1122: {region: 0x165, script: 0x57, flags: 0x0},
+ 1123: {region: 0x112, script: 0x57, flags: 0x0},
+ 1124: {region: 0x131, script: 0x57, flags: 0x0},
+ 1125: {region: 0x126, script: 0x57, flags: 0x0},
+ 1126: {region: 0x165, script: 0x57, flags: 0x0},
+ 1127: {region: 0x3c, script: 0x3, flags: 0x1},
+ 1128: {region: 0x165, script: 0x57, flags: 0x0},
+ 1129: {region: 0x165, script: 0x57, flags: 0x0},
+ 1130: {region: 0x165, script: 0x57, flags: 0x0},
+ 1131: {region: 0x123, script: 0xdf, flags: 0x0},
+ 1132: {region: 0xdb, script: 0x21, flags: 0x0},
+ 1133: {region: 0xdb, script: 0x21, flags: 0x0},
+ 1134: {region: 0xdb, script: 0x21, flags: 0x0},
+ 1135: {region: 0x6f, script: 0x29, flags: 0x0},
+ 1136: {region: 0x165, script: 0x57, flags: 0x0},
+ 1137: {region: 0x6d, script: 0x29, flags: 0x0},
+ 1138: {region: 0x165, script: 0x57, flags: 0x0},
+ 1139: {region: 0x165, script: 0x57, flags: 0x0},
+ 1140: {region: 0x165, script: 0x57, flags: 0x0},
+ 1141: {region: 0xd6, script: 0x57, flags: 0x0},
+ 1142: {region: 0x127, script: 0x57, flags: 0x0},
+ 1143: {region: 0x125, script: 0x57, flags: 0x0},
+ 1144: {region: 0x32, script: 0x57, flags: 0x0},
+ 1145: {region: 0xdb, script: 0x21, flags: 0x0},
+ 1146: {region: 0xe7, script: 0x57, flags: 0x0},
+ 1147: {region: 0x165, script: 0x57, flags: 0x0},
+ 1148: {region: 0x165, script: 0x57, flags: 0x0},
+ 1149: {region: 0x32, script: 0x57, flags: 0x0},
+ 1150: {region: 0xd4, script: 0x57, flags: 0x0},
+ 1151: {region: 0x165, script: 0x57, flags: 0x0},
+ 1152: {region: 0x161, script: 0x57, flags: 0x0},
+ 1153: {region: 0x165, script: 0x57, flags: 0x0},
+ 1154: {region: 0x129, script: 0x57, flags: 0x0},
+ 1155: {region: 0x165, script: 0x57, flags: 0x0},
+ 1156: {region: 0xce, script: 0x57, flags: 0x0},
+ 1157: {region: 0x165, script: 0x57, flags: 0x0},
+ 1158: {region: 0xe6, script: 0x57, flags: 0x0},
+ 1159: {region: 0x165, script: 0x57, flags: 0x0},
+ 1160: {region: 0x165, script: 0x57, flags: 0x0},
+ 1161: {region: 0x165, script: 0x57, flags: 0x0},
+ 1162: {region: 0x12b, script: 0x57, flags: 0x0},
+ 1163: {region: 0x12b, script: 0x57, flags: 0x0},
+ 1164: {region: 0x12e, script: 0x57, flags: 0x0},
+ 1165: {region: 0x165, script: 0x5, flags: 0x0},
+ 1166: {region: 0x161, script: 0x57, flags: 0x0},
+ 1167: {region: 0x87, script: 0x31, flags: 0x0},
+ 1168: {region: 0xdb, script: 0x21, flags: 0x0},
+ 1169: {region: 0xe7, script: 0x57, flags: 0x0},
+ 1170: {region: 0x43, script: 0xe0, flags: 0x0},
+ 1171: {region: 0x165, script: 0x57, flags: 0x0},
+ 1172: {region: 0x106, script: 0x1f, flags: 0x0},
+ 1173: {region: 0x165, script: 0x57, flags: 0x0},
+ 1174: {region: 0x165, script: 0x57, flags: 0x0},
+ 1175: {region: 0x131, script: 0x57, flags: 0x0},
+ 1176: {region: 0x165, script: 0x57, flags: 0x0},
+ 1177: {region: 0x123, script: 0xdf, flags: 0x0},
+ 1178: {region: 0x32, script: 0x57, flags: 0x0},
+ 1179: {region: 0x165, script: 0x57, flags: 0x0},
+ 1180: {region: 0x165, script: 0x57, flags: 0x0},
+ 1181: {region: 0xce, script: 0x57, flags: 0x0},
+ 1182: {region: 0x165, script: 0x57, flags: 0x0},
+ 1183: {region: 0x165, script: 0x57, flags: 0x0},
+ 1184: {region: 0x12d, script: 0x57, flags: 0x0},
+ 1185: {region: 0x165, script: 0x57, flags: 0x0},
+ 1187: {region: 0x165, script: 0x57, flags: 0x0},
+ 1188: {region: 0xd4, script: 0x57, flags: 0x0},
+ 1189: {region: 0x53, script: 0xd8, flags: 0x0},
+ 1190: {region: 0xe5, script: 0x57, flags: 0x0},
+ 1191: {region: 0x165, script: 0x57, flags: 0x0},
+ 1192: {region: 0x106, script: 0x1f, flags: 0x0},
+ 1193: {region: 0xba, script: 0x57, flags: 0x0},
+ 1194: {region: 0x165, script: 0x57, flags: 0x0},
+ 1195: {region: 0x106, script: 0x1f, flags: 0x0},
+ 1196: {region: 0x3f, script: 0x4, flags: 0x1},
+ 1197: {region: 0x11c, script: 0xe2, flags: 0x0},
+ 1198: {region: 0x130, script: 0x1f, flags: 0x0},
+ 1199: {region: 0x75, script: 0x57, flags: 0x0},
+ 1200: {region: 0x2a, script: 0x57, flags: 0x0},
+ 1202: {region: 0x43, script: 0x3, flags: 0x1},
+ 1203: {region: 0x99, script: 0xe, flags: 0x0},
+ 1204: {region: 0xe8, script: 0x5, flags: 0x0},
+ 1205: {region: 0x165, script: 0x57, flags: 0x0},
+ 1206: {region: 0x165, script: 0x57, flags: 0x0},
+ 1207: {region: 0x165, script: 0x57, flags: 0x0},
+ 1208: {region: 0x165, script: 0x57, flags: 0x0},
+ 1209: {region: 0x165, script: 0x57, flags: 0x0},
+ 1210: {region: 0x165, script: 0x57, flags: 0x0},
+ 1211: {region: 0x165, script: 0x57, flags: 0x0},
+ 1212: {region: 0x46, script: 0x4, flags: 0x1},
+ 1213: {region: 0x165, script: 0x57, flags: 0x0},
+ 1214: {region: 0xb4, script: 0xe3, flags: 0x0},
+ 1215: {region: 0x165, script: 0x57, flags: 0x0},
+ 1216: {region: 0x161, script: 0x57, flags: 0x0},
+ 1217: {region: 0x9e, script: 0x57, flags: 0x0},
+ 1218: {region: 0x106, script: 0x57, flags: 0x0},
+ 1219: {region: 0x13e, script: 0x57, flags: 0x0},
+ 1220: {region: 0x11b, script: 0x57, flags: 0x0},
+ 1221: {region: 0x165, script: 0x57, flags: 0x0},
+ 1222: {region: 0x36, script: 0x57, flags: 0x0},
+ 1223: {region: 0x60, script: 0x57, flags: 0x0},
+ 1224: {region: 0xd1, script: 0x57, flags: 0x0},
+ 1225: {region: 0x1, script: 0x57, flags: 0x0},
+ 1226: {region: 0x106, script: 0x57, flags: 0x0},
+ 1227: {region: 0x6a, script: 0x57, flags: 0x0},
+ 1228: {region: 0x12f, script: 0x57, flags: 0x0},
+ 1229: {region: 0x165, script: 0x57, flags: 0x0},
+ 1230: {region: 0x36, script: 0x57, flags: 0x0},
+ 1231: {region: 0x4e, script: 0x57, flags: 0x0},
+ 1232: {region: 0x165, script: 0x57, flags: 0x0},
+ 1233: {region: 0x6f, script: 0x29, flags: 0x0},
+ 1234: {region: 0x165, script: 0x57, flags: 0x0},
+ 1235: {region: 0xe7, script: 0x57, flags: 0x0},
+ 1236: {region: 0x2f, script: 0x57, flags: 0x0},
+ 1237: {region: 0x99, script: 0xda, flags: 0x0},
+ 1238: {region: 0x99, script: 0x21, flags: 0x0},
+ 1239: {region: 0x165, script: 0x57, flags: 0x0},
+ 1240: {region: 0x165, script: 0x57, flags: 0x0},
+ 1241: {region: 0x165, script: 0x57, flags: 0x0},
+ 1242: {region: 0x165, script: 0x57, flags: 0x0},
+ 1243: {region: 0x165, script: 0x57, flags: 0x0},
+ 1244: {region: 0x165, script: 0x57, flags: 0x0},
+ 1245: {region: 0x165, script: 0x57, flags: 0x0},
+ 1246: {region: 0x165, script: 0x57, flags: 0x0},
+ 1247: {region: 0x165, script: 0x57, flags: 0x0},
+ 1248: {region: 0x140, script: 0x57, flags: 0x0},
+ 1249: {region: 0x165, script: 0x57, flags: 0x0},
+ 1250: {region: 0x165, script: 0x57, flags: 0x0},
+ 1251: {region: 0xa8, script: 0x5, flags: 0x0},
+ 1252: {region: 0x165, script: 0x57, flags: 0x0},
+ 1253: {region: 0x114, script: 0x57, flags: 0x0},
+ 1254: {region: 0x165, script: 0x57, flags: 0x0},
+ 1255: {region: 0x165, script: 0x57, flags: 0x0},
+ 1256: {region: 0x165, script: 0x57, flags: 0x0},
+ 1257: {region: 0x165, script: 0x57, flags: 0x0},
+ 1258: {region: 0x99, script: 0x21, flags: 0x0},
+ 1259: {region: 0x53, script: 0x38, flags: 0x0},
+ 1260: {region: 0x165, script: 0x57, flags: 0x0},
+ 1261: {region: 0x165, script: 0x57, flags: 0x0},
+ 1262: {region: 0x41, script: 0x57, flags: 0x0},
+ 1263: {region: 0x165, script: 0x57, flags: 0x0},
+ 1264: {region: 0x12b, script: 0x18, flags: 0x0},
+ 1265: {region: 0x165, script: 0x57, flags: 0x0},
+ 1266: {region: 0x161, script: 0x57, flags: 0x0},
+ 1267: {region: 0x165, script: 0x57, flags: 0x0},
+ 1268: {region: 0x12b, script: 0x5f, flags: 0x0},
+ 1269: {region: 0x12b, script: 0x60, flags: 0x0},
+ 1270: {region: 0x7d, script: 0x2b, flags: 0x0},
+ 1271: {region: 0x53, script: 0x64, flags: 0x0},
+ 1272: {region: 0x10b, script: 0x69, flags: 0x0},
+ 1273: {region: 0x108, script: 0x73, flags: 0x0},
+ 1274: {region: 0x99, script: 0x21, flags: 0x0},
+ 1275: {region: 0x131, script: 0x57, flags: 0x0},
+ 1276: {region: 0x165, script: 0x57, flags: 0x0},
+ 1277: {region: 0x9c, script: 0x8a, flags: 0x0},
+ 1278: {region: 0x165, script: 0x57, flags: 0x0},
+ 1279: {region: 0x15e, script: 0xc2, flags: 0x0},
+ 1280: {region: 0x165, script: 0x57, flags: 0x0},
+ 1281: {region: 0x165, script: 0x57, flags: 0x0},
+ 1282: {region: 0xdb, script: 0x21, flags: 0x0},
+ 1283: {region: 0x165, script: 0x57, flags: 0x0},
+ 1284: {region: 0x165, script: 0x57, flags: 0x0},
+ 1285: {region: 0xd1, script: 0x57, flags: 0x0},
+ 1286: {region: 0x75, script: 0x57, flags: 0x0},
+ 1287: {region: 0x165, script: 0x57, flags: 0x0},
+ 1288: {region: 0x165, script: 0x57, flags: 0x0},
+ 1289: {region: 0x52, script: 0x57, flags: 0x0},
+ 1290: {region: 0x165, script: 0x57, flags: 0x0},
+ 1291: {region: 0x165, script: 0x57, flags: 0x0},
+ 1292: {region: 0x165, script: 0x57, flags: 0x0},
+ 1293: {region: 0x52, script: 0x57, flags: 0x0},
+ 1294: {region: 0x165, script: 0x57, flags: 0x0},
+ 1295: {region: 0x165, script: 0x57, flags: 0x0},
+ 1296: {region: 0x165, script: 0x57, flags: 0x0},
+ 1297: {region: 0x165, script: 0x57, flags: 0x0},
+ 1298: {region: 0x1, script: 0x3b, flags: 0x0},
+ 1299: {region: 0x165, script: 0x57, flags: 0x0},
+ 1300: {region: 0x165, script: 0x57, flags: 0x0},
+ 1301: {region: 0x165, script: 0x57, flags: 0x0},
+ 1302: {region: 0x165, script: 0x57, flags: 0x0},
+ 1303: {region: 0x165, script: 0x57, flags: 0x0},
+ 1304: {region: 0xd6, script: 0x57, flags: 0x0},
+ 1305: {region: 0x165, script: 0x57, flags: 0x0},
+ 1306: {region: 0x165, script: 0x57, flags: 0x0},
+ 1307: {region: 0x165, script: 0x57, flags: 0x0},
+ 1308: {region: 0x41, script: 0x57, flags: 0x0},
+ 1309: {region: 0x165, script: 0x57, flags: 0x0},
+ 1310: {region: 0xcf, script: 0x57, flags: 0x0},
+ 1311: {region: 0x4a, script: 0x3, flags: 0x1},
+ 1312: {region: 0x165, script: 0x57, flags: 0x0},
+ 1313: {region: 0x165, script: 0x57, flags: 0x0},
+ 1314: {region: 0x165, script: 0x57, flags: 0x0},
+ 1315: {region: 0x53, script: 0x57, flags: 0x0},
+ 1316: {region: 0x10b, script: 0x57, flags: 0x0},
+ 1318: {region: 0xa8, script: 0x5, flags: 0x0},
+ 1319: {region: 0xd9, script: 0x57, flags: 0x0},
+ 1320: {region: 0xba, script: 0xdc, flags: 0x0},
+ 1321: {region: 0x4d, script: 0x14, flags: 0x1},
+ 1322: {region: 0x53, script: 0x79, flags: 0x0},
+ 1323: {region: 0x165, script: 0x57, flags: 0x0},
+ 1324: {region: 0x122, script: 0x57, flags: 0x0},
+ 1325: {region: 0xd0, script: 0x57, flags: 0x0},
+ 1326: {region: 0x165, script: 0x57, flags: 0x0},
+ 1327: {region: 0x161, script: 0x57, flags: 0x0},
+ 1329: {region: 0x12b, script: 0x57, flags: 0x0},
+}
+
+// likelyLangList holds lists info associated with likelyLang.
+// Size: 388 bytes, 97 elements
+var likelyLangList = [97]likelyScriptRegion{
+ 0: {region: 0x9c, script: 0x7, flags: 0x0},
+ 1: {region: 0xa1, script: 0x74, flags: 0x2},
+ 2: {region: 0x11c, script: 0x80, flags: 0x2},
+ 3: {region: 0x32, script: 0x57, flags: 0x0},
+ 4: {region: 0x9b, script: 0x5, flags: 0x4},
+ 5: {region: 0x9c, script: 0x5, flags: 0x4},
+ 6: {region: 0x106, script: 0x1f, flags: 0x4},
+ 7: {region: 0x9c, script: 0x5, flags: 0x2},
+ 8: {region: 0x106, script: 0x1f, flags: 0x0},
+ 9: {region: 0x38, script: 0x2c, flags: 0x2},
+ 10: {region: 0x135, script: 0x57, flags: 0x0},
+ 11: {region: 0x7b, script: 0xc5, flags: 0x2},
+ 12: {region: 0x114, script: 0x57, flags: 0x0},
+ 13: {region: 0x84, script: 0x1, flags: 0x2},
+ 14: {region: 0x5d, script: 0x1e, flags: 0x0},
+ 15: {region: 0x87, script: 0x5c, flags: 0x2},
+ 16: {region: 0xd6, script: 0x57, flags: 0x0},
+ 17: {region: 0x52, script: 0x5, flags: 0x4},
+ 18: {region: 0x10b, script: 0x5, flags: 0x4},
+ 19: {region: 0xae, script: 0x1f, flags: 0x0},
+ 20: {region: 0x24, script: 0x5, flags: 0x4},
+ 21: {region: 0x53, script: 0x5, flags: 0x4},
+ 22: {region: 0x9c, script: 0x5, flags: 0x4},
+ 23: {region: 0xc5, script: 0x5, flags: 0x4},
+ 24: {region: 0x53, script: 0x5, flags: 0x2},
+ 25: {region: 0x12b, script: 0x57, flags: 0x0},
+ 26: {region: 0xb0, script: 0x5, flags: 0x4},
+ 27: {region: 0x9b, script: 0x5, flags: 0x2},
+ 28: {region: 0xa5, script: 0x1f, flags: 0x0},
+ 29: {region: 0x53, script: 0x5, flags: 0x4},
+ 30: {region: 0x12b, script: 0x57, flags: 0x4},
+ 31: {region: 0x53, script: 0x5, flags: 0x2},
+ 32: {region: 0x12b, script: 0x57, flags: 0x2},
+ 33: {region: 0xdb, script: 0x21, flags: 0x0},
+ 34: {region: 0x99, script: 0x5a, flags: 0x2},
+ 35: {region: 0x83, script: 0x57, flags: 0x0},
+ 36: {region: 0x84, script: 0x78, flags: 0x4},
+ 37: {region: 0x84, script: 0x78, flags: 0x2},
+ 38: {region: 0xc5, script: 0x1f, flags: 0x0},
+ 39: {region: 0x53, script: 0x6d, flags: 0x4},
+ 40: {region: 0x53, script: 0x6d, flags: 0x2},
+ 41: {region: 0xd0, script: 0x57, flags: 0x0},
+ 42: {region: 0x4a, script: 0x5, flags: 0x4},
+ 43: {region: 0x95, script: 0x5, flags: 0x4},
+ 44: {region: 0x99, script: 0x33, flags: 0x0},
+ 45: {region: 0xe8, script: 0x5, flags: 0x4},
+ 46: {region: 0xe8, script: 0x5, flags: 0x2},
+ 47: {region: 0x9c, script: 0x84, flags: 0x0},
+ 48: {region: 0x53, script: 0x85, flags: 0x2},
+ 49: {region: 0xba, script: 0xdc, flags: 0x0},
+ 50: {region: 0xd9, script: 0x57, flags: 0x4},
+ 51: {region: 0xe8, script: 0x5, flags: 0x0},
+ 52: {region: 0x99, script: 0x21, flags: 0x2},
+ 53: {region: 0x99, script: 0x4c, flags: 0x2},
+ 54: {region: 0x99, script: 0xc9, flags: 0x2},
+ 55: {region: 0x105, script: 0x1f, flags: 0x0},
+ 56: {region: 0xbd, script: 0x57, flags: 0x4},
+ 57: {region: 0x104, script: 0x57, flags: 0x4},
+ 58: {region: 0x106, script: 0x57, flags: 0x4},
+ 59: {region: 0x12b, script: 0x57, flags: 0x4},
+ 60: {region: 0x124, script: 0x1f, flags: 0x0},
+ 61: {region: 0xe8, script: 0x5, flags: 0x4},
+ 62: {region: 0xe8, script: 0x5, flags: 0x2},
+ 63: {region: 0x53, script: 0x5, flags: 0x0},
+ 64: {region: 0xae, script: 0x1f, flags: 0x4},
+ 65: {region: 0xc5, script: 0x1f, flags: 0x4},
+ 66: {region: 0xae, script: 0x1f, flags: 0x2},
+ 67: {region: 0x99, script: 0xe, flags: 0x0},
+ 68: {region: 0xdb, script: 0x21, flags: 0x4},
+ 69: {region: 0xdb, script: 0x21, flags: 0x2},
+ 70: {region: 0x137, script: 0x57, flags: 0x0},
+ 71: {region: 0x24, script: 0x5, flags: 0x4},
+ 72: {region: 0x53, script: 0x1f, flags: 0x4},
+ 73: {region: 0x24, script: 0x5, flags: 0x2},
+ 74: {region: 0x8d, script: 0x39, flags: 0x0},
+ 75: {region: 0x53, script: 0x38, flags: 0x4},
+ 76: {region: 0x53, script: 0x38, flags: 0x2},
+ 77: {region: 0x53, script: 0x38, flags: 0x0},
+ 78: {region: 0x2f, script: 0x39, flags: 0x4},
+ 79: {region: 0x3e, script: 0x39, flags: 0x4},
+ 80: {region: 0x7b, script: 0x39, flags: 0x4},
+ 81: {region: 0x7e, script: 0x39, flags: 0x4},
+ 82: {region: 0x8d, script: 0x39, flags: 0x4},
+ 83: {region: 0x95, script: 0x39, flags: 0x4},
+ 84: {region: 0xc6, script: 0x39, flags: 0x4},
+ 85: {region: 0xd0, script: 0x39, flags: 0x4},
+ 86: {region: 0xe2, script: 0x39, flags: 0x4},
+ 87: {region: 0xe5, script: 0x39, flags: 0x4},
+ 88: {region: 0xe7, script: 0x39, flags: 0x4},
+ 89: {region: 0x116, script: 0x39, flags: 0x4},
+ 90: {region: 0x123, script: 0x39, flags: 0x4},
+ 91: {region: 0x12e, script: 0x39, flags: 0x4},
+ 92: {region: 0x135, script: 0x39, flags: 0x4},
+ 93: {region: 0x13e, script: 0x39, flags: 0x4},
+ 94: {region: 0x12e, script: 0x11, flags: 0x2},
+ 95: {region: 0x12e, script: 0x34, flags: 0x2},
+ 96: {region: 0x12e, script: 0x39, flags: 0x2},
+}
+
+type likelyLangScript struct {
+ lang uint16
+ script uint8
+ flags uint8
+}
+
+// likelyRegion is a lookup table, indexed by regionID, for the most likely
+// languages and scripts given incomplete information. If more entries exist
+// for a given regionID, lang and script are the index and size respectively
+// of the list in likelyRegionList.
+// TODO: exclude containers and user-definable regions from the list.
+// Size: 1432 bytes, 358 elements
+var likelyRegion = [358]likelyLangScript{
+ 34: {lang: 0xd7, script: 0x57, flags: 0x0},
+ 35: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 36: {lang: 0x0, script: 0x2, flags: 0x1},
+ 39: {lang: 0x2, script: 0x2, flags: 0x1},
+ 40: {lang: 0x4, script: 0x2, flags: 0x1},
+ 42: {lang: 0x3c0, script: 0x57, flags: 0x0},
+ 43: {lang: 0x0, script: 0x57, flags: 0x0},
+ 44: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 45: {lang: 0x41b, script: 0x57, flags: 0x0},
+ 46: {lang: 0x10d, script: 0x57, flags: 0x0},
+ 48: {lang: 0x367, script: 0x57, flags: 0x0},
+ 49: {lang: 0x444, script: 0x57, flags: 0x0},
+ 50: {lang: 0x58, script: 0x57, flags: 0x0},
+ 51: {lang: 0x6, script: 0x2, flags: 0x1},
+ 53: {lang: 0xa5, script: 0xe, flags: 0x0},
+ 54: {lang: 0x367, script: 0x57, flags: 0x0},
+ 55: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 56: {lang: 0x7e, script: 0x1f, flags: 0x0},
+ 57: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 58: {lang: 0x3d9, script: 0x57, flags: 0x0},
+ 59: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 60: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 62: {lang: 0x31f, script: 0x57, flags: 0x0},
+ 63: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 64: {lang: 0x3a1, script: 0x57, flags: 0x0},
+ 65: {lang: 0x3c0, script: 0x57, flags: 0x0},
+ 67: {lang: 0x8, script: 0x2, flags: 0x1},
+ 69: {lang: 0x0, script: 0x57, flags: 0x0},
+ 71: {lang: 0x71, script: 0x1f, flags: 0x0},
+ 73: {lang: 0x512, script: 0x3b, flags: 0x2},
+ 74: {lang: 0x31f, script: 0x5, flags: 0x2},
+ 75: {lang: 0x445, script: 0x57, flags: 0x0},
+ 76: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 77: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 78: {lang: 0x10d, script: 0x57, flags: 0x0},
+ 79: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 81: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 82: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 83: {lang: 0xa, script: 0x4, flags: 0x1},
+ 84: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 85: {lang: 0x0, script: 0x57, flags: 0x0},
+ 86: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 89: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 90: {lang: 0x3c0, script: 0x57, flags: 0x0},
+ 91: {lang: 0x3a1, script: 0x57, flags: 0x0},
+ 93: {lang: 0xe, script: 0x2, flags: 0x1},
+ 94: {lang: 0xfa, script: 0x57, flags: 0x0},
+ 96: {lang: 0x10d, script: 0x57, flags: 0x0},
+ 98: {lang: 0x1, script: 0x57, flags: 0x0},
+ 99: {lang: 0x101, script: 0x57, flags: 0x0},
+ 101: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 103: {lang: 0x10, script: 0x2, flags: 0x1},
+ 104: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 105: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 106: {lang: 0x140, script: 0x57, flags: 0x0},
+ 107: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 108: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 109: {lang: 0x46f, script: 0x29, flags: 0x0},
+ 110: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 111: {lang: 0x12, script: 0x2, flags: 0x1},
+ 113: {lang: 0x10d, script: 0x57, flags: 0x0},
+ 114: {lang: 0x151, script: 0x57, flags: 0x0},
+ 115: {lang: 0x1c0, script: 0x21, flags: 0x2},
+ 118: {lang: 0x158, script: 0x57, flags: 0x0},
+ 120: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 122: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 123: {lang: 0x14, script: 0x2, flags: 0x1},
+ 125: {lang: 0x16, script: 0x3, flags: 0x1},
+ 126: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 128: {lang: 0x21, script: 0x57, flags: 0x0},
+ 130: {lang: 0x245, script: 0x57, flags: 0x0},
+ 132: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 133: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 134: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 135: {lang: 0x19, script: 0x2, flags: 0x1},
+ 136: {lang: 0x0, script: 0x57, flags: 0x0},
+ 137: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 139: {lang: 0x3c0, script: 0x57, flags: 0x0},
+ 141: {lang: 0x529, script: 0x39, flags: 0x0},
+ 142: {lang: 0x0, script: 0x57, flags: 0x0},
+ 143: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 144: {lang: 0x1d1, script: 0x57, flags: 0x0},
+ 145: {lang: 0x1d4, script: 0x57, flags: 0x0},
+ 146: {lang: 0x1d5, script: 0x57, flags: 0x0},
+ 148: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 149: {lang: 0x1b, script: 0x2, flags: 0x1},
+ 151: {lang: 0x1bc, script: 0x3b, flags: 0x0},
+ 153: {lang: 0x1d, script: 0x3, flags: 0x1},
+ 155: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 156: {lang: 0x20, script: 0x2, flags: 0x1},
+ 157: {lang: 0x1f8, script: 0x57, flags: 0x0},
+ 158: {lang: 0x1f9, script: 0x57, flags: 0x0},
+ 161: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 162: {lang: 0x200, script: 0x46, flags: 0x0},
+ 164: {lang: 0x445, script: 0x57, flags: 0x0},
+ 165: {lang: 0x28a, script: 0x1f, flags: 0x0},
+ 166: {lang: 0x22, script: 0x3, flags: 0x1},
+ 168: {lang: 0x25, script: 0x2, flags: 0x1},
+ 170: {lang: 0x254, script: 0x50, flags: 0x0},
+ 171: {lang: 0x254, script: 0x50, flags: 0x0},
+ 172: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 174: {lang: 0x3e2, script: 0x1f, flags: 0x0},
+ 175: {lang: 0x27, script: 0x2, flags: 0x1},
+ 176: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 178: {lang: 0x10d, script: 0x57, flags: 0x0},
+ 179: {lang: 0x40c, script: 0xca, flags: 0x0},
+ 181: {lang: 0x43b, script: 0x57, flags: 0x0},
+ 182: {lang: 0x2c0, script: 0x57, flags: 0x0},
+ 183: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 184: {lang: 0x2c7, script: 0x57, flags: 0x0},
+ 185: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 186: {lang: 0x29, script: 0x2, flags: 0x1},
+ 187: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 188: {lang: 0x2b, script: 0x2, flags: 0x1},
+ 189: {lang: 0x432, script: 0x57, flags: 0x0},
+ 190: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 191: {lang: 0x2f1, script: 0x57, flags: 0x0},
+ 194: {lang: 0x2d, script: 0x2, flags: 0x1},
+ 195: {lang: 0xa0, script: 0x57, flags: 0x0},
+ 196: {lang: 0x2f, script: 0x2, flags: 0x1},
+ 197: {lang: 0x31, script: 0x2, flags: 0x1},
+ 198: {lang: 0x33, script: 0x2, flags: 0x1},
+ 200: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 201: {lang: 0x35, script: 0x2, flags: 0x1},
+ 203: {lang: 0x320, script: 0x57, flags: 0x0},
+ 204: {lang: 0x37, script: 0x3, flags: 0x1},
+ 205: {lang: 0x128, script: 0xde, flags: 0x0},
+ 207: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 208: {lang: 0x31f, script: 0x57, flags: 0x0},
+ 209: {lang: 0x3c0, script: 0x57, flags: 0x0},
+ 210: {lang: 0x16, script: 0x57, flags: 0x0},
+ 211: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 212: {lang: 0x1b4, script: 0x57, flags: 0x0},
+ 214: {lang: 0x1b4, script: 0x5, flags: 0x2},
+ 216: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 217: {lang: 0x367, script: 0x57, flags: 0x0},
+ 218: {lang: 0x347, script: 0x57, flags: 0x0},
+ 219: {lang: 0x351, script: 0x21, flags: 0x0},
+ 225: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 226: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 228: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 229: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 230: {lang: 0x486, script: 0x57, flags: 0x0},
+ 231: {lang: 0x153, script: 0x57, flags: 0x0},
+ 232: {lang: 0x3a, script: 0x3, flags: 0x1},
+ 233: {lang: 0x3b3, script: 0x57, flags: 0x0},
+ 234: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 236: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 237: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 238: {lang: 0x3c0, script: 0x57, flags: 0x0},
+ 240: {lang: 0x3a2, script: 0x57, flags: 0x0},
+ 241: {lang: 0x194, script: 0x57, flags: 0x0},
+ 243: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 258: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 260: {lang: 0x3d, script: 0x2, flags: 0x1},
+ 261: {lang: 0x432, script: 0x1f, flags: 0x0},
+ 262: {lang: 0x3f, script: 0x2, flags: 0x1},
+ 263: {lang: 0x3e5, script: 0x57, flags: 0x0},
+ 264: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 266: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 267: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 268: {lang: 0x41, script: 0x2, flags: 0x1},
+ 271: {lang: 0x416, script: 0x57, flags: 0x0},
+ 272: {lang: 0x347, script: 0x57, flags: 0x0},
+ 273: {lang: 0x43, script: 0x2, flags: 0x1},
+ 275: {lang: 0x1f9, script: 0x57, flags: 0x0},
+ 276: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 277: {lang: 0x429, script: 0x57, flags: 0x0},
+ 278: {lang: 0x367, script: 0x57, flags: 0x0},
+ 280: {lang: 0x3c0, script: 0x57, flags: 0x0},
+ 282: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 284: {lang: 0x45, script: 0x2, flags: 0x1},
+ 288: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 289: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 290: {lang: 0x47, script: 0x2, flags: 0x1},
+ 291: {lang: 0x49, script: 0x3, flags: 0x1},
+ 292: {lang: 0x4c, script: 0x2, flags: 0x1},
+ 293: {lang: 0x477, script: 0x57, flags: 0x0},
+ 294: {lang: 0x3c0, script: 0x57, flags: 0x0},
+ 295: {lang: 0x476, script: 0x57, flags: 0x0},
+ 296: {lang: 0x4e, script: 0x2, flags: 0x1},
+ 297: {lang: 0x482, script: 0x57, flags: 0x0},
+ 299: {lang: 0x50, script: 0x4, flags: 0x1},
+ 301: {lang: 0x4a0, script: 0x57, flags: 0x0},
+ 302: {lang: 0x54, script: 0x2, flags: 0x1},
+ 303: {lang: 0x445, script: 0x57, flags: 0x0},
+ 304: {lang: 0x56, script: 0x3, flags: 0x1},
+ 305: {lang: 0x445, script: 0x57, flags: 0x0},
+ 309: {lang: 0x512, script: 0x3b, flags: 0x2},
+ 310: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 311: {lang: 0x4bc, script: 0x57, flags: 0x0},
+ 312: {lang: 0x1f9, script: 0x57, flags: 0x0},
+ 315: {lang: 0x13e, script: 0x57, flags: 0x0},
+ 318: {lang: 0x4c3, script: 0x57, flags: 0x0},
+ 319: {lang: 0x8a, script: 0x57, flags: 0x0},
+ 320: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 322: {lang: 0x41b, script: 0x57, flags: 0x0},
+ 333: {lang: 0x59, script: 0x2, flags: 0x1},
+ 350: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 351: {lang: 0x5b, script: 0x2, flags: 0x1},
+ 356: {lang: 0x423, script: 0x57, flags: 0x0},
+}
+
+// likelyRegionList holds lists info associated with likelyRegion.
+// Size: 372 bytes, 93 elements
+var likelyRegionList = [93]likelyLangScript{
+ 0: {lang: 0x148, script: 0x5, flags: 0x0},
+ 1: {lang: 0x476, script: 0x57, flags: 0x0},
+ 2: {lang: 0x431, script: 0x57, flags: 0x0},
+ 3: {lang: 0x2ff, script: 0x1f, flags: 0x0},
+ 4: {lang: 0x1d7, script: 0x8, flags: 0x0},
+ 5: {lang: 0x274, script: 0x57, flags: 0x0},
+ 6: {lang: 0xb7, script: 0x57, flags: 0x0},
+ 7: {lang: 0x432, script: 0x1f, flags: 0x0},
+ 8: {lang: 0x12d, script: 0xe0, flags: 0x0},
+ 9: {lang: 0x351, script: 0x21, flags: 0x0},
+ 10: {lang: 0x529, script: 0x38, flags: 0x0},
+ 11: {lang: 0x4ac, script: 0x5, flags: 0x0},
+ 12: {lang: 0x523, script: 0x57, flags: 0x0},
+ 13: {lang: 0x29a, script: 0xdf, flags: 0x0},
+ 14: {lang: 0x136, script: 0x31, flags: 0x0},
+ 15: {lang: 0x48a, script: 0x57, flags: 0x0},
+ 16: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 17: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 18: {lang: 0x27, script: 0x29, flags: 0x0},
+ 19: {lang: 0x139, script: 0x57, flags: 0x0},
+ 20: {lang: 0x26a, script: 0x5, flags: 0x2},
+ 21: {lang: 0x512, script: 0x3b, flags: 0x2},
+ 22: {lang: 0x210, script: 0x2b, flags: 0x0},
+ 23: {lang: 0x5, script: 0x1f, flags: 0x0},
+ 24: {lang: 0x274, script: 0x57, flags: 0x0},
+ 25: {lang: 0x136, script: 0x31, flags: 0x0},
+ 26: {lang: 0x2ff, script: 0x1f, flags: 0x0},
+ 27: {lang: 0x1e1, script: 0x57, flags: 0x0},
+ 28: {lang: 0x31f, script: 0x5, flags: 0x0},
+ 29: {lang: 0x1be, script: 0x21, flags: 0x0},
+ 30: {lang: 0x4b4, script: 0x5, flags: 0x0},
+ 31: {lang: 0x236, script: 0x72, flags: 0x0},
+ 32: {lang: 0x148, script: 0x5, flags: 0x0},
+ 33: {lang: 0x476, script: 0x57, flags: 0x0},
+ 34: {lang: 0x24a, script: 0x4b, flags: 0x0},
+ 35: {lang: 0xe6, script: 0x5, flags: 0x0},
+ 36: {lang: 0x226, script: 0xdf, flags: 0x0},
+ 37: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 38: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 39: {lang: 0x2b8, script: 0x54, flags: 0x0},
+ 40: {lang: 0x226, script: 0xdf, flags: 0x0},
+ 41: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 42: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 43: {lang: 0x3dc, script: 0x57, flags: 0x0},
+ 44: {lang: 0x4ae, script: 0x1f, flags: 0x0},
+ 45: {lang: 0x2ff, script: 0x1f, flags: 0x0},
+ 46: {lang: 0x431, script: 0x57, flags: 0x0},
+ 47: {lang: 0x331, script: 0x72, flags: 0x0},
+ 48: {lang: 0x213, script: 0x57, flags: 0x0},
+ 49: {lang: 0x30b, script: 0x1f, flags: 0x0},
+ 50: {lang: 0x242, script: 0x5, flags: 0x0},
+ 51: {lang: 0x529, script: 0x39, flags: 0x0},
+ 52: {lang: 0x3c0, script: 0x57, flags: 0x0},
+ 53: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 54: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 55: {lang: 0x2ed, script: 0x57, flags: 0x0},
+ 56: {lang: 0x4b4, script: 0x5, flags: 0x0},
+ 57: {lang: 0x88, script: 0x21, flags: 0x0},
+ 58: {lang: 0x4b4, script: 0x5, flags: 0x0},
+ 59: {lang: 0x4b4, script: 0x5, flags: 0x0},
+ 60: {lang: 0xbe, script: 0x21, flags: 0x0},
+ 61: {lang: 0x3dc, script: 0x57, flags: 0x0},
+ 62: {lang: 0x7e, script: 0x1f, flags: 0x0},
+ 63: {lang: 0x3e2, script: 0x1f, flags: 0x0},
+ 64: {lang: 0x267, script: 0x57, flags: 0x0},
+ 65: {lang: 0x444, script: 0x57, flags: 0x0},
+ 66: {lang: 0x512, script: 0x3b, flags: 0x0},
+ 67: {lang: 0x412, script: 0x57, flags: 0x0},
+ 68: {lang: 0x4ae, script: 0x1f, flags: 0x0},
+ 69: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 70: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 71: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 72: {lang: 0x35, script: 0x5, flags: 0x0},
+ 73: {lang: 0x46b, script: 0xdf, flags: 0x0},
+ 74: {lang: 0x2ec, script: 0x5, flags: 0x0},
+ 75: {lang: 0x30f, script: 0x72, flags: 0x0},
+ 76: {lang: 0x467, script: 0x1f, flags: 0x0},
+ 77: {lang: 0x148, script: 0x5, flags: 0x0},
+ 78: {lang: 0x3a, script: 0x5, flags: 0x0},
+ 79: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 80: {lang: 0x48a, script: 0x57, flags: 0x0},
+ 81: {lang: 0x58, script: 0x5, flags: 0x0},
+ 82: {lang: 0x219, script: 0x1f, flags: 0x0},
+ 83: {lang: 0x81, script: 0x31, flags: 0x0},
+ 84: {lang: 0x529, script: 0x39, flags: 0x0},
+ 85: {lang: 0x48c, script: 0x57, flags: 0x0},
+ 86: {lang: 0x4ae, script: 0x1f, flags: 0x0},
+ 87: {lang: 0x512, script: 0x3b, flags: 0x0},
+ 88: {lang: 0x3b3, script: 0x57, flags: 0x0},
+ 89: {lang: 0x431, script: 0x57, flags: 0x0},
+ 90: {lang: 0x432, script: 0x1f, flags: 0x0},
+ 91: {lang: 0x15e, script: 0x57, flags: 0x0},
+ 92: {lang: 0x446, script: 0x5, flags: 0x0},
+}
+
+type likelyTag struct {
+ lang uint16
+ region uint16
+ script uint8
+}
+
+// Size: 198 bytes, 33 elements
+var likelyRegionGroup = [33]likelyTag{
+ 1: {lang: 0x139, region: 0xd6, script: 0x57},
+ 2: {lang: 0x139, region: 0x135, script: 0x57},
+ 3: {lang: 0x3c0, region: 0x41, script: 0x57},
+ 4: {lang: 0x139, region: 0x2f, script: 0x57},
+ 5: {lang: 0x139, region: 0xd6, script: 0x57},
+ 6: {lang: 0x13e, region: 0xcf, script: 0x57},
+ 7: {lang: 0x445, region: 0x12f, script: 0x57},
+ 8: {lang: 0x3a, region: 0x6b, script: 0x5},
+ 9: {lang: 0x445, region: 0x4b, script: 0x57},
+ 10: {lang: 0x139, region: 0x161, script: 0x57},
+ 11: {lang: 0x139, region: 0x135, script: 0x57},
+ 12: {lang: 0x139, region: 0x135, script: 0x57},
+ 13: {lang: 0x13e, region: 0x59, script: 0x57},
+ 14: {lang: 0x529, region: 0x53, script: 0x38},
+ 15: {lang: 0x1be, region: 0x99, script: 0x21},
+ 16: {lang: 0x1e1, region: 0x95, script: 0x57},
+ 17: {lang: 0x1f9, region: 0x9e, script: 0x57},
+ 18: {lang: 0x139, region: 0x2f, script: 0x57},
+ 19: {lang: 0x139, region: 0xe6, script: 0x57},
+ 20: {lang: 0x139, region: 0x8a, script: 0x57},
+ 21: {lang: 0x41b, region: 0x142, script: 0x57},
+ 22: {lang: 0x529, region: 0x53, script: 0x38},
+ 23: {lang: 0x4bc, region: 0x137, script: 0x57},
+ 24: {lang: 0x3a, region: 0x108, script: 0x5},
+ 25: {lang: 0x3e2, region: 0x106, script: 0x1f},
+ 26: {lang: 0x3e2, region: 0x106, script: 0x1f},
+ 27: {lang: 0x139, region: 0x7b, script: 0x57},
+ 28: {lang: 0x10d, region: 0x60, script: 0x57},
+ 29: {lang: 0x139, region: 0xd6, script: 0x57},
+ 30: {lang: 0x13e, region: 0x1f, script: 0x57},
+ 31: {lang: 0x139, region: 0x9a, script: 0x57},
+ 32: {lang: 0x139, region: 0x7b, script: 0x57},
+}
+
+// Size: 264 bytes, 33 elements
+var regionContainment = [33]uint64{
+ // Entry 0 - 1F
+ 0x00000001ffffffff, 0x00000000200007a2, 0x0000000000003044, 0x0000000000000008,
+ 0x00000000803c0010, 0x0000000000000020, 0x0000000000000040, 0x0000000000000080,
+ 0x0000000000000100, 0x0000000000000200, 0x0000000000000400, 0x000000004000384c,
+ 0x0000000000001000, 0x0000000000002000, 0x0000000000004000, 0x0000000000008000,
+ 0x0000000000010000, 0x0000000000020000, 0x0000000000040000, 0x0000000000080000,
+ 0x0000000000100000, 0x0000000000200000, 0x0000000001c1c000, 0x0000000000800000,
+ 0x0000000001000000, 0x000000001e020000, 0x0000000004000000, 0x0000000008000000,
+ 0x0000000010000000, 0x00000000200006a0, 0x0000000040002048, 0x0000000080000000,
+ // Entry 20 - 3F
+ 0x0000000100000000,
+}
+
+// regionInclusion maps region identifiers to sets of regions in regionInclusionBits,
+// where each set holds all groupings that are directly connected in a region
+// containment graph.
+// Size: 358 bytes, 358 elements
+var regionInclusion = [358]uint8{
+ // Entry 0 - 3F
+ 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
+ 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
+ 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+ 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e,
+ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x26, 0x23,
+ 0x24, 0x26, 0x27, 0x22, 0x28, 0x29, 0x2a, 0x2b,
+ 0x26, 0x2c, 0x24, 0x23, 0x26, 0x25, 0x2a, 0x2d,
+ 0x2e, 0x24, 0x2f, 0x2d, 0x26, 0x30, 0x31, 0x28,
+ // Entry 40 - 7F
+ 0x26, 0x28, 0x26, 0x25, 0x31, 0x22, 0x32, 0x33,
+ 0x34, 0x30, 0x22, 0x27, 0x27, 0x27, 0x35, 0x2d,
+ 0x29, 0x28, 0x27, 0x36, 0x28, 0x22, 0x34, 0x23,
+ 0x21, 0x26, 0x2d, 0x26, 0x22, 0x37, 0x2e, 0x35,
+ 0x2a, 0x22, 0x2f, 0x38, 0x26, 0x26, 0x21, 0x39,
+ 0x39, 0x28, 0x38, 0x39, 0x39, 0x2f, 0x3a, 0x2f,
+ 0x20, 0x21, 0x38, 0x3b, 0x28, 0x3c, 0x2c, 0x21,
+ 0x2a, 0x35, 0x27, 0x38, 0x26, 0x24, 0x28, 0x2c,
+ // Entry 80 - BF
+ 0x2d, 0x23, 0x30, 0x2d, 0x2d, 0x26, 0x27, 0x3a,
+ 0x22, 0x34, 0x3c, 0x2d, 0x28, 0x36, 0x22, 0x34,
+ 0x3a, 0x26, 0x2e, 0x21, 0x39, 0x31, 0x38, 0x24,
+ 0x2c, 0x25, 0x22, 0x24, 0x25, 0x2c, 0x3a, 0x2c,
+ 0x26, 0x24, 0x36, 0x21, 0x2f, 0x3d, 0x31, 0x3c,
+ 0x2f, 0x26, 0x36, 0x36, 0x24, 0x26, 0x3d, 0x31,
+ 0x24, 0x26, 0x35, 0x25, 0x2d, 0x32, 0x38, 0x2a,
+ 0x38, 0x39, 0x39, 0x35, 0x33, 0x23, 0x26, 0x2f,
+ // Entry C0 - FF
+ 0x3c, 0x21, 0x23, 0x2d, 0x31, 0x36, 0x36, 0x3c,
+ 0x26, 0x2d, 0x26, 0x3a, 0x2f, 0x25, 0x2f, 0x34,
+ 0x31, 0x2f, 0x32, 0x3b, 0x2d, 0x2b, 0x2d, 0x21,
+ 0x34, 0x2a, 0x2c, 0x25, 0x21, 0x3c, 0x24, 0x29,
+ 0x2b, 0x24, 0x34, 0x21, 0x28, 0x29, 0x3b, 0x31,
+ 0x25, 0x2e, 0x30, 0x29, 0x26, 0x24, 0x3a, 0x21,
+ 0x3c, 0x28, 0x21, 0x24, 0x21, 0x21, 0x1f, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ // Entry 100 - 13F
+ 0x21, 0x21, 0x2f, 0x21, 0x2e, 0x23, 0x33, 0x2f,
+ 0x24, 0x3b, 0x2f, 0x39, 0x38, 0x31, 0x2d, 0x3a,
+ 0x2c, 0x2e, 0x2d, 0x23, 0x2d, 0x2f, 0x28, 0x2f,
+ 0x27, 0x33, 0x34, 0x26, 0x24, 0x32, 0x22, 0x26,
+ 0x27, 0x22, 0x2d, 0x31, 0x3d, 0x29, 0x31, 0x3d,
+ 0x39, 0x29, 0x31, 0x24, 0x26, 0x29, 0x36, 0x2f,
+ 0x33, 0x2f, 0x21, 0x22, 0x21, 0x30, 0x28, 0x3d,
+ 0x23, 0x26, 0x21, 0x28, 0x26, 0x26, 0x31, 0x3b,
+ // Entry 140 - 17F
+ 0x29, 0x21, 0x29, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x23, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x2f,
+ 0x23, 0x32, 0x2f, 0x27, 0x2f, 0x21,
+}
+
+// regionInclusionBits is an array of bit vectors where every vector represents
+// a set of region groupings. These sets are used to compute the distance
+// between two regions for the purpose of language matching.
+// Size: 584 bytes, 73 elements
+var regionInclusionBits = [73]uint64{
+ // Entry 0 - 1F
+ 0x0000000102400813, 0x00000000200007a3, 0x0000000000003844, 0x0000000040000808,
+ 0x00000000803c0011, 0x0000000020000022, 0x0000000040000844, 0x0000000020000082,
+ 0x0000000000000102, 0x0000000020000202, 0x0000000020000402, 0x000000004000384d,
+ 0x0000000000001804, 0x0000000040002804, 0x0000000000404000, 0x0000000000408000,
+ 0x0000000000410000, 0x0000000002020000, 0x0000000000040010, 0x0000000000080010,
+ 0x0000000000100010, 0x0000000000200010, 0x0000000001c1c001, 0x0000000000c00000,
+ 0x0000000001400000, 0x000000001e020001, 0x0000000006000000, 0x000000000a000000,
+ 0x0000000012000000, 0x00000000200006a2, 0x0000000040002848, 0x0000000080000010,
+ // Entry 20 - 3F
+ 0x0000000100000001, 0x0000000000000001, 0x0000000080000000, 0x0000000000020000,
+ 0x0000000001000000, 0x0000000000008000, 0x0000000000002000, 0x0000000000000200,
+ 0x0000000000000008, 0x0000000000200000, 0x0000000110000000, 0x0000000000040000,
+ 0x0000000008000000, 0x0000000000000020, 0x0000000104000000, 0x0000000000000080,
+ 0x0000000000001000, 0x0000000000010000, 0x0000000000000400, 0x0000000004000000,
+ 0x0000000000000040, 0x0000000010000000, 0x0000000000004000, 0x0000000101000000,
+ 0x0000000108000000, 0x0000000000000100, 0x0000000100020000, 0x0000000000080000,
+ 0x0000000000100000, 0x0000000000800000, 0x00000001ffffffff, 0x0000000122400fb3,
+ // Entry 40 - 5F
+ 0x00000001827c0813, 0x000000014240385f, 0x0000000103c1c813, 0x000000011e420813,
+ 0x0000000112000001, 0x0000000106000001, 0x0000000101400001, 0x000000010a000001,
+ 0x0000000102020001,
+}
+
+// regionInclusionNext marks, for each entry in regionInclusionBits, the set of
+// all groups that are reachable from the groups set in the respective entry.
+// Size: 73 bytes, 73 elements
+var regionInclusionNext = [73]uint8{
+ // Entry 0 - 3F
+ 0x3e, 0x3f, 0x0b, 0x0b, 0x40, 0x01, 0x0b, 0x01,
+ 0x01, 0x01, 0x01, 0x41, 0x0b, 0x0b, 0x16, 0x16,
+ 0x16, 0x19, 0x04, 0x04, 0x04, 0x04, 0x42, 0x16,
+ 0x16, 0x43, 0x19, 0x19, 0x19, 0x01, 0x0b, 0x04,
+ 0x00, 0x00, 0x1f, 0x11, 0x18, 0x0f, 0x0d, 0x09,
+ 0x03, 0x15, 0x44, 0x12, 0x1b, 0x05, 0x45, 0x07,
+ 0x0c, 0x10, 0x0a, 0x1a, 0x06, 0x1c, 0x0e, 0x46,
+ 0x47, 0x08, 0x48, 0x13, 0x14, 0x17, 0x3e, 0x3e,
+ // Entry 40 - 7F
+ 0x3e, 0x3e, 0x3e, 0x3e, 0x43, 0x43, 0x42, 0x43,
+ 0x43,
+}
+
+type parentRel struct {
+ lang uint16
+ script uint8
+ maxScript uint8
+ toRegion uint16
+ fromRegion []uint16
+}
+
+// Size: 414 bytes, 5 elements
+var parents = [5]parentRel{
+ 0: {lang: 0x139, script: 0x0, maxScript: 0x57, toRegion: 0x1, fromRegion: []uint16{0x1a, 0x25, 0x26, 0x2f, 0x34, 0x36, 0x3d, 0x42, 0x46, 0x48, 0x49, 0x4a, 0x50, 0x52, 0x5c, 0x5d, 0x61, 0x64, 0x6d, 0x73, 0x74, 0x75, 0x7b, 0x7c, 0x7f, 0x80, 0x81, 0x83, 0x8c, 0x8d, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9f, 0xa0, 0xa4, 0xa7, 0xa9, 0xad, 0xb1, 0xb4, 0xb5, 0xbf, 0xc6, 0xca, 0xcb, 0xcc, 0xce, 0xd0, 0xd2, 0xd5, 0xd6, 0xdd, 0xdf, 0xe0, 0xe6, 0xe7, 0xe8, 0xeb, 0xf0, 0x107, 0x109, 0x10a, 0x10b, 0x10d, 0x10e, 0x112, 0x117, 0x11b, 0x11d, 0x11f, 0x125, 0x129, 0x12c, 0x12d, 0x12f, 0x131, 0x139, 0x13c, 0x13f, 0x142, 0x161, 0x162, 0x164}},
+ 1: {lang: 0x139, script: 0x0, maxScript: 0x57, toRegion: 0x1a, fromRegion: []uint16{0x2e, 0x4e, 0x60, 0x63, 0x72, 0xd9, 0x10c, 0x10f}},
+ 2: {lang: 0x13e, script: 0x0, maxScript: 0x57, toRegion: 0x1f, fromRegion: []uint16{0x2c, 0x3f, 0x41, 0x48, 0x51, 0x54, 0x56, 0x59, 0x65, 0x69, 0x89, 0x8f, 0xcf, 0xd8, 0xe2, 0xe4, 0xec, 0xf1, 0x11a, 0x135, 0x136, 0x13b}},
+ 3: {lang: 0x3c0, script: 0x0, maxScript: 0x57, toRegion: 0xee, fromRegion: []uint16{0x2a, 0x4e, 0x5a, 0x86, 0x8b, 0xb7, 0xc6, 0xd1, 0x118, 0x126}},
+ 4: {lang: 0x529, script: 0x39, maxScript: 0x39, toRegion: 0x8d, fromRegion: []uint16{0xc6}},
+}
+
+// Total table size 25886 bytes (25KiB); checksum: 50D3D57D
diff --git a/vendor/golang.org/x/text/internal/language/tags.go b/vendor/golang.org/x/text/internal/language/tags.go
new file mode 100644
index 0000000..e7afd31
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/language/tags.go
@@ -0,0 +1,48 @@
+// Copyright 2013 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 language
+
+// MustParse is like Parse, but panics if the given BCP 47 tag cannot be parsed.
+// It simplifies safe initialization of Tag values.
+func MustParse(s string) Tag {
+ t, err := Parse(s)
+ if err != nil {
+ panic(err)
+ }
+ return t
+}
+
+// MustParseBase is like ParseBase, but panics if the given base cannot be parsed.
+// It simplifies safe initialization of Base values.
+func MustParseBase(s string) Language {
+ b, err := ParseBase(s)
+ if err != nil {
+ panic(err)
+ }
+ return b
+}
+
+// MustParseScript is like ParseScript, but panics if the given script cannot be
+// parsed. It simplifies safe initialization of Script values.
+func MustParseScript(s string) Script {
+ scr, err := ParseScript(s)
+ if err != nil {
+ panic(err)
+ }
+ return scr
+}
+
+// MustParseRegion is like ParseRegion, but panics if the given region cannot be
+// parsed. It simplifies safe initialization of Region values.
+func MustParseRegion(s string) Region {
+ r, err := ParseRegion(s)
+ if err != nil {
+ panic(err)
+ }
+ return r
+}
+
+// Und is the root language.
+var Und Tag
diff --git a/vendor/golang.org/x/text/internal/match.go b/vendor/golang.org/x/text/internal/match.go
new file mode 100644
index 0000000..1cc004a
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/match.go
@@ -0,0 +1,67 @@
+// Copyright 2015 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 internal
+
+// This file contains matchers that implement CLDR inheritance.
+//
+// See https://unicode.org/reports/tr35/#Locale_Inheritance.
+//
+// Some of the inheritance described in this document is already handled by
+// the cldr package.
+
+import (
+ "golang.org/x/text/language"
+)
+
+// TODO: consider if (some of the) matching algorithm needs to be public after
+// getting some feel about what is generic and what is specific.
+
+// NewInheritanceMatcher returns a matcher that matches based on the inheritance
+// chain.
+//
+// The matcher uses canonicalization and the parent relationship to find a
+// match. The resulting match will always be either Und or a language with the
+// same language and script as the requested language. It will not match
+// languages for which there is understood to be mutual or one-directional
+// intelligibility.
+//
+// A Match will indicate an Exact match if the language matches after
+// canonicalization and High if the matched tag is a parent.
+func NewInheritanceMatcher(t []language.Tag) *InheritanceMatcher {
+ tags := &InheritanceMatcher{make(map[language.Tag]int)}
+ for i, tag := range t {
+ ct, err := language.All.Canonicalize(tag)
+ if err != nil {
+ ct = tag
+ }
+ tags.index[ct] = i
+ }
+ return tags
+}
+
+type InheritanceMatcher struct {
+ index map[language.Tag]int
+}
+
+func (m InheritanceMatcher) Match(want ...language.Tag) (language.Tag, int, language.Confidence) {
+ for _, t := range want {
+ ct, err := language.All.Canonicalize(t)
+ if err != nil {
+ ct = t
+ }
+ conf := language.Exact
+ for {
+ if index, ok := m.index[ct]; ok {
+ return ct, index, conf
+ }
+ if ct == language.Und {
+ break
+ }
+ ct = ct.Parent()
+ conf = language.High
+ }
+ }
+ return language.Und, 0, language.No
+}
diff --git a/vendor/golang.org/x/text/internal/match_test.go b/vendor/golang.org/x/text/internal/match_test.go
new file mode 100644
index 0000000..8a3fe65
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/match_test.go
@@ -0,0 +1,56 @@
+// Copyright 2015 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 internal
+
+import (
+ "strings"
+ "testing"
+
+ "golang.org/x/text/language"
+)
+
+func TestInheritanceMatcher(t *testing.T) {
+ for i, tt := range []struct {
+ haveTags string
+ wantTags string
+ match string
+ conf language.Confidence
+ }{
+ {"und,en,en-US", "en-US", "en-US", language.Exact}, // most specific match
+ {"zh-Hant,zh", "zh-TW", "zh-Hant", language.High}, // zh-TW implies Hant.
+ {"und,zh", "zh-TW", "und", language.High}, // zh-TW does not match zh.
+ {"zh", "zh-TW", "und", language.No}, // zh-TW does not match zh.
+ {"iw,en,nl", "he", "he", language.Exact}, // matches after canonicalization
+ {"he,en,nl", "iw", "he", language.Exact}, // matches after canonicalization
+ // Prefer first match over more specific match for various reasons:
+ // a) consistency of user interface is more important than an exact match,
+ // b) _if_ und is specified, it should be considered a correct and useful match,
+ // Note that a call to this Match will almost always be with a single tag.
+ {"und,en,en-US", "he,en-US", "und", language.High},
+ } {
+ have := parseTags(tt.haveTags)
+ m := NewInheritanceMatcher(have)
+ tag, index, conf := m.Match(parseTags(tt.wantTags)...)
+ want := language.Raw.Make(tt.match)
+ if tag != want {
+ t.Errorf("%d:tag: got %q; want %q", i, tag, want)
+ }
+ if conf != language.No {
+ if got, _ := language.All.Canonicalize(have[index]); got != want {
+ t.Errorf("%d:index: got %q; want %q ", i, got, want)
+ }
+ }
+ if conf != tt.conf {
+ t.Errorf("%d:conf: got %v; want %v", i, conf, tt.conf)
+ }
+ }
+}
+
+func parseTags(list string) (out []language.Tag) {
+ for _, s := range strings.Split(list, ",") {
+ out = append(out, language.Raw.Make(strings.TrimSpace(s)))
+ }
+ return out
+}
diff --git a/vendor/golang.org/x/text/internal/number/common.go b/vendor/golang.org/x/text/internal/number/common.go
new file mode 100644
index 0000000..a6e9c8e
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/common.go
@@ -0,0 +1,55 @@
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+package number
+
+import (
+ "unicode/utf8"
+
+ "golang.org/x/text/internal/language/compact"
+)
+
+// A system identifies a CLDR numbering system.
+type system byte
+
+type systemData struct {
+ id system
+ digitSize byte // number of UTF-8 bytes per digit
+ zero [utf8.UTFMax]byte // UTF-8 sequence of zero digit.
+}
+
+// A SymbolType identifies a symbol of a specific kind.
+type SymbolType int
+
+const (
+ SymDecimal SymbolType = iota
+ SymGroup
+ SymList
+ SymPercentSign
+ SymPlusSign
+ SymMinusSign
+ SymExponential
+ SymSuperscriptingExponent
+ SymPerMille
+ SymInfinity
+ SymNan
+ SymTimeSeparator
+
+ NumSymbolTypes
+)
+
+const hasNonLatnMask = 0x8000
+
+// symOffset is an offset into altSymData if the bit indicated by hasNonLatnMask
+// is not 0 (with this bit masked out), and an offset into symIndex otherwise.
+//
+// TODO: this type can be a byte again if we use an indirection into altsymData
+// and introduce an alt -> offset slice (the length of this will be number of
+// alternatives plus 1). This also allows getting rid of the compactTag field
+// in altSymData. In total this will save about 1K.
+type symOffset uint16
+
+type altSymData struct {
+ compactTag compact.ID
+ symIndex symOffset
+ system system
+}
diff --git a/vendor/golang.org/x/text/internal/number/decimal.go b/vendor/golang.org/x/text/internal/number/decimal.go
new file mode 100644
index 0000000..9b4035e
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/decimal.go
@@ -0,0 +1,498 @@
+// 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.
+
+//go:generate stringer -type RoundingMode
+
+package number
+
+import (
+ "math"
+ "strconv"
+)
+
+// RoundingMode determines how a number is rounded to the desired precision.
+type RoundingMode byte
+
+const (
+ ToNearestEven RoundingMode = iota // towards the nearest integer, or towards an even number if equidistant.
+ ToNearestZero // towards the nearest integer, or towards zero if equidistant.
+ ToNearestAway // towards the nearest integer, or away from zero if equidistant.
+ ToPositiveInf // towards infinity
+ ToNegativeInf // towards negative infinity
+ ToZero // towards zero
+ AwayFromZero // away from zero
+ numModes
+)
+
+const maxIntDigits = 20
+
+// A Decimal represents a floating point number in decimal format.
+// Digits represents a number [0, 1.0), and the absolute value represented by
+// Decimal is Digits * 10^Exp. Leading and trailing zeros may be omitted and Exp
+// may point outside a valid position in Digits.
+//
+// Examples:
+// Number Decimal
+// 12345 Digits: [1, 2, 3, 4, 5], Exp: 5
+// 12.345 Digits: [1, 2, 3, 4, 5], Exp: 2
+// 12000 Digits: [1, 2], Exp: 5
+// 12000.00 Digits: [1, 2], Exp: 5
+// 0.00123 Digits: [1, 2, 3], Exp: -2
+// 0 Digits: [], Exp: 0
+type Decimal struct {
+ digits
+
+ buf [maxIntDigits]byte
+}
+
+type digits struct {
+ Digits []byte // mantissa digits, big-endian
+ Exp int32 // exponent
+ Neg bool
+ Inf bool // Takes precedence over Digits and Exp.
+ NaN bool // Takes precedence over Inf.
+}
+
+// Digits represents a floating point number represented in digits of the
+// base in which a number is to be displayed. It is similar to Decimal, but
+// keeps track of trailing fraction zeros and the comma placement for
+// engineering notation. Digits must have at least one digit.
+//
+// Examples:
+// Number Decimal
+// decimal
+// 12345 Digits: [1, 2, 3, 4, 5], Exp: 5 End: 5
+// 12.345 Digits: [1, 2, 3, 4, 5], Exp: 2 End: 5
+// 12000 Digits: [1, 2], Exp: 5 End: 5
+// 12000.00 Digits: [1, 2], Exp: 5 End: 7
+// 0.00123 Digits: [1, 2, 3], Exp: -2 End: 3
+// 0 Digits: [], Exp: 0 End: 1
+// scientific (actual exp is Exp - Comma)
+// 0e0 Digits: [0], Exp: 1, End: 1, Comma: 1
+// .0e0 Digits: [0], Exp: 0, End: 1, Comma: 0
+// 0.0e0 Digits: [0], Exp: 1, End: 2, Comma: 1
+// 1.23e4 Digits: [1, 2, 3], Exp: 5, End: 3, Comma: 1
+// .123e5 Digits: [1, 2, 3], Exp: 5, End: 3, Comma: 0
+// engineering
+// 12.3e3 Digits: [1, 2, 3], Exp: 5, End: 3, Comma: 2
+type Digits struct {
+ digits
+ // End indicates the end position of the number.
+ End int32 // For decimals Exp <= End. For scientific len(Digits) <= End.
+ // Comma is used for the comma position for scientific (always 0 or 1) and
+ // engineering notation (always 0, 1, 2, or 3).
+ Comma uint8
+ // IsScientific indicates whether this number is to be rendered as a
+ // scientific number.
+ IsScientific bool
+}
+
+func (d *Digits) NumFracDigits() int {
+ if d.Exp >= d.End {
+ return 0
+ }
+ return int(d.End - d.Exp)
+}
+
+// normalize returns a new Decimal with leading and trailing zeros removed.
+func (d *Decimal) normalize() (n Decimal) {
+ n = *d
+ b := n.Digits
+ // Strip leading zeros. Resulting number of digits is significant digits.
+ for len(b) > 0 && b[0] == 0 {
+ b = b[1:]
+ n.Exp--
+ }
+ // Strip trailing zeros
+ for len(b) > 0 && b[len(b)-1] == 0 {
+ b = b[:len(b)-1]
+ }
+ if len(b) == 0 {
+ n.Exp = 0
+ }
+ n.Digits = b
+ return n
+}
+
+func (d *Decimal) clear() {
+ b := d.Digits
+ if b == nil {
+ b = d.buf[:0]
+ }
+ *d = Decimal{}
+ d.Digits = b[:0]
+}
+
+func (x *Decimal) String() string {
+ if x.NaN {
+ return "NaN"
+ }
+ var buf []byte
+ if x.Neg {
+ buf = append(buf, '-')
+ }
+ if x.Inf {
+ buf = append(buf, "Inf"...)
+ return string(buf)
+ }
+ switch {
+ case len(x.Digits) == 0:
+ buf = append(buf, '0')
+ case x.Exp <= 0:
+ // 0.00ddd
+ buf = append(buf, "0."...)
+ buf = appendZeros(buf, -int(x.Exp))
+ buf = appendDigits(buf, x.Digits)
+
+ case /* 0 < */ int(x.Exp) < len(x.Digits):
+ // dd.ddd
+ buf = appendDigits(buf, x.Digits[:x.Exp])
+ buf = append(buf, '.')
+ buf = appendDigits(buf, x.Digits[x.Exp:])
+
+ default: // len(x.Digits) <= x.Exp
+ // ddd00
+ buf = appendDigits(buf, x.Digits)
+ buf = appendZeros(buf, int(x.Exp)-len(x.Digits))
+ }
+ return string(buf)
+}
+
+func appendDigits(buf []byte, digits []byte) []byte {
+ for _, c := range digits {
+ buf = append(buf, c+'0')
+ }
+ return buf
+}
+
+// appendZeros appends n 0 digits to buf and returns buf.
+func appendZeros(buf []byte, n int) []byte {
+ for ; n > 0; n-- {
+ buf = append(buf, '0')
+ }
+ return buf
+}
+
+func (d *digits) round(mode RoundingMode, n int) {
+ if n >= len(d.Digits) {
+ return
+ }
+ // Make rounding decision: The result mantissa is truncated ("rounded down")
+ // by default. Decide if we need to increment, or "round up", the (unsigned)
+ // mantissa.
+ inc := false
+ switch mode {
+ case ToNegativeInf:
+ inc = d.Neg
+ case ToPositiveInf:
+ inc = !d.Neg
+ case ToZero:
+ // nothing to do
+ case AwayFromZero:
+ inc = true
+ case ToNearestEven:
+ inc = d.Digits[n] > 5 || d.Digits[n] == 5 &&
+ (len(d.Digits) > n+1 || n == 0 || d.Digits[n-1]&1 != 0)
+ case ToNearestAway:
+ inc = d.Digits[n] >= 5
+ case ToNearestZero:
+ inc = d.Digits[n] > 5 || d.Digits[n] == 5 && len(d.Digits) > n+1
+ default:
+ panic("unreachable")
+ }
+ if inc {
+ d.roundUp(n)
+ } else {
+ d.roundDown(n)
+ }
+}
+
+// roundFloat rounds a floating point number.
+func (r RoundingMode) roundFloat(x float64) float64 {
+ // Make rounding decision: The result mantissa is truncated ("rounded down")
+ // by default. Decide if we need to increment, or "round up", the (unsigned)
+ // mantissa.
+ abs := x
+ if x < 0 {
+ abs = -x
+ }
+ i, f := math.Modf(abs)
+ if f == 0.0 {
+ return x
+ }
+ inc := false
+ switch r {
+ case ToNegativeInf:
+ inc = x < 0
+ case ToPositiveInf:
+ inc = x >= 0
+ case ToZero:
+ // nothing to do
+ case AwayFromZero:
+ inc = true
+ case ToNearestEven:
+ // TODO: check overflow
+ inc = f > 0.5 || f == 0.5 && int64(i)&1 != 0
+ case ToNearestAway:
+ inc = f >= 0.5
+ case ToNearestZero:
+ inc = f > 0.5
+ default:
+ panic("unreachable")
+ }
+ if inc {
+ i += 1
+ }
+ if abs != x {
+ i = -i
+ }
+ return i
+}
+
+func (x *digits) roundUp(n int) {
+ if n < 0 || n >= len(x.Digits) {
+ return // nothing to do
+ }
+ // find first digit < 9
+ for n > 0 && x.Digits[n-1] >= 9 {
+ n--
+ }
+
+ if n == 0 {
+ // all digits are 9s => round up to 1 and update exponent
+ x.Digits[0] = 1 // ok since len(x.Digits) > n
+ x.Digits = x.Digits[:1]
+ x.Exp++
+ return
+ }
+ x.Digits[n-1]++
+ x.Digits = x.Digits[:n]
+ // x already trimmed
+}
+
+func (x *digits) roundDown(n int) {
+ if n < 0 || n >= len(x.Digits) {
+ return // nothing to do
+ }
+ x.Digits = x.Digits[:n]
+ trim(x)
+}
+
+// trim cuts off any trailing zeros from x's mantissa;
+// they are meaningless for the value of x.
+func trim(x *digits) {
+ i := len(x.Digits)
+ for i > 0 && x.Digits[i-1] == 0 {
+ i--
+ }
+ x.Digits = x.Digits[:i]
+ if i == 0 {
+ x.Exp = 0
+ }
+}
+
+// A Converter converts a number into decimals according to the given rounding
+// criteria.
+type Converter interface {
+ Convert(d *Decimal, r RoundingContext)
+}
+
+const (
+ signed = true
+ unsigned = false
+)
+
+// Convert converts the given number to the decimal representation using the
+// supplied RoundingContext.
+func (d *Decimal) Convert(r RoundingContext, number interface{}) {
+ switch f := number.(type) {
+ case Converter:
+ d.clear()
+ f.Convert(d, r)
+ case float32:
+ d.ConvertFloat(r, float64(f), 32)
+ case float64:
+ d.ConvertFloat(r, f, 64)
+ case int:
+ d.ConvertInt(r, signed, uint64(f))
+ case int8:
+ d.ConvertInt(r, signed, uint64(f))
+ case int16:
+ d.ConvertInt(r, signed, uint64(f))
+ case int32:
+ d.ConvertInt(r, signed, uint64(f))
+ case int64:
+ d.ConvertInt(r, signed, uint64(f))
+ case uint:
+ d.ConvertInt(r, unsigned, uint64(f))
+ case uint8:
+ d.ConvertInt(r, unsigned, uint64(f))
+ case uint16:
+ d.ConvertInt(r, unsigned, uint64(f))
+ case uint32:
+ d.ConvertInt(r, unsigned, uint64(f))
+ case uint64:
+ d.ConvertInt(r, unsigned, f)
+
+ default:
+ d.NaN = true
+ // TODO:
+ // case string: if produced by strconv, allows for easy arbitrary pos.
+ // case reflect.Value:
+ // case big.Float
+ // case big.Int
+ // case big.Rat?
+ // catch underlyings using reflect or will this already be done by the
+ // message package?
+ }
+}
+
+// ConvertInt converts an integer to decimals.
+func (d *Decimal) ConvertInt(r RoundingContext, signed bool, x uint64) {
+ if r.Increment > 0 {
+ // TODO: if uint64 is too large, fall back to float64
+ if signed {
+ d.ConvertFloat(r, float64(int64(x)), 64)
+ } else {
+ d.ConvertFloat(r, float64(x), 64)
+ }
+ return
+ }
+ d.clear()
+ if signed && int64(x) < 0 {
+ x = uint64(-int64(x))
+ d.Neg = true
+ }
+ d.fillIntDigits(x)
+ d.Exp = int32(len(d.Digits))
+}
+
+// ConvertFloat converts a floating point number to decimals.
+func (d *Decimal) ConvertFloat(r RoundingContext, x float64, size int) {
+ d.clear()
+ if math.IsNaN(x) {
+ d.NaN = true
+ return
+ }
+ // Simple case: decimal notation
+ if r.Increment > 0 {
+ scale := int(r.IncrementScale)
+ mult := 1.0
+ if scale > len(scales) {
+ mult = math.Pow(10, float64(scale))
+ } else {
+ mult = scales[scale]
+ }
+ // We multiply x instead of dividing inc as it gives less rounding
+ // issues.
+ x *= mult
+ x /= float64(r.Increment)
+ x = r.Mode.roundFloat(x)
+ x *= float64(r.Increment)
+ x /= mult
+ }
+
+ abs := x
+ if x < 0 {
+ d.Neg = true
+ abs = -x
+ }
+ if math.IsInf(abs, 1) {
+ d.Inf = true
+ return
+ }
+
+ // By default we get the exact decimal representation.
+ verb := byte('g')
+ prec := -1
+ // As the strconv API does not return the rounding accuracy, we can only
+ // round using ToNearestEven.
+ if r.Mode == ToNearestEven {
+ if n := r.RoundSignificantDigits(); n >= 0 {
+ prec = n
+ } else if n = r.RoundFractionDigits(); n >= 0 {
+ prec = n
+ verb = 'f'
+ }
+ } else {
+ // TODO: At this point strconv's rounding is imprecise to the point that
+ // it is not useable for this purpose.
+ // See https://github.com/golang/go/issues/21714
+ // If rounding is requested, we ask for a large number of digits and
+ // round from there to simulate rounding only once.
+ // Ideally we would have strconv export an AppendDigits that would take
+ // a rounding mode and/or return an accuracy. Something like this would
+ // work:
+ // AppendDigits(dst []byte, x float64, base, size, prec int) (digits []byte, exp, accuracy int)
+ hasPrec := r.RoundSignificantDigits() >= 0
+ hasScale := r.RoundFractionDigits() >= 0
+ if hasPrec || hasScale {
+ // prec is the number of mantissa bits plus some extra for safety.
+ // We need at least the number of mantissa bits as decimals to
+ // accurately represent the floating point without rounding, as each
+ // bit requires one more decimal to represent: 0.5, 0.25, 0.125, ...
+ prec = 60
+ }
+ }
+
+ b := strconv.AppendFloat(d.Digits[:0], abs, verb, prec, size)
+ i := 0
+ k := 0
+ beforeDot := 1
+ for i < len(b) {
+ if c := b[i]; '0' <= c && c <= '9' {
+ b[k] = c - '0'
+ k++
+ d.Exp += int32(beforeDot)
+ } else if c == '.' {
+ beforeDot = 0
+ d.Exp = int32(k)
+ } else {
+ break
+ }
+ i++
+ }
+ d.Digits = b[:k]
+ if i != len(b) {
+ i += len("e")
+ pSign := i
+ exp := 0
+ for i++; i < len(b); i++ {
+ exp *= 10
+ exp += int(b[i] - '0')
+ }
+ if b[pSign] == '-' {
+ exp = -exp
+ }
+ d.Exp = int32(exp) + 1
+ }
+}
+
+func (d *Decimal) fillIntDigits(x uint64) {
+ if cap(d.Digits) < maxIntDigits {
+ d.Digits = d.buf[:]
+ } else {
+ d.Digits = d.buf[:maxIntDigits]
+ }
+ i := 0
+ for ; x > 0; x /= 10 {
+ d.Digits[i] = byte(x % 10)
+ i++
+ }
+ d.Digits = d.Digits[:i]
+ for p := 0; p < i; p++ {
+ i--
+ d.Digits[p], d.Digits[i] = d.Digits[i], d.Digits[p]
+ }
+}
+
+var scales [70]float64
+
+func init() {
+ x := 1.0
+ for i := range scales {
+ scales[i] = x
+ x *= 10
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/number/decimal_test.go b/vendor/golang.org/x/text/internal/number/decimal_test.go
new file mode 100644
index 0000000..97c7e25
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/decimal_test.go
@@ -0,0 +1,329 @@
+// 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 number
+
+import (
+ "fmt"
+ "math"
+ "strconv"
+ "strings"
+ "testing"
+)
+
+func mkfloat(num string) float64 {
+ u, _ := strconv.ParseUint(num, 10, 32)
+ return float64(u)
+}
+
+// mkdec creates a decimal from a string. All ASCII digits are converted to
+// digits in the decimal. The dot is used to indicate the scale by which the
+// digits are shifted. Numbers may have an additional exponent or be the special
+// value NaN, Inf, or -Inf.
+func mkdec(num string) (d Decimal) {
+ var r RoundingContext
+ d.Convert(r, dec(num))
+ return
+}
+
+type dec string
+
+func (s dec) Convert(d *Decimal, _ RoundingContext) {
+ num := string(s)
+ if num[0] == '-' {
+ d.Neg = true
+ num = num[1:]
+ }
+ switch num {
+ case "NaN":
+ d.NaN = true
+ return
+ case "Inf":
+ d.Inf = true
+ return
+ }
+ if p := strings.IndexAny(num, "eE"); p != -1 {
+ i64, err := strconv.ParseInt(num[p+1:], 10, 32)
+ if err != nil {
+ panic(err)
+ }
+ d.Exp = int32(i64)
+ num = num[:p]
+ }
+ if p := strings.IndexByte(num, '.'); p != -1 {
+ d.Exp += int32(p)
+ num = num[:p] + num[p+1:]
+ } else {
+ d.Exp += int32(len(num))
+ }
+ d.Digits = []byte(num)
+ for i := range d.Digits {
+ d.Digits[i] -= '0'
+ }
+ *d = d.normalize()
+}
+
+func byteNum(s string) []byte {
+ b := make([]byte, len(s))
+ for i := 0; i < len(s); i++ {
+ if c := s[i]; '0' <= c && c <= '9' {
+ b[i] = s[i] - '0'
+ } else {
+ b[i] = s[i] - 'a' + 10
+ }
+ }
+ return b
+}
+
+func strNum(s string) string {
+ return string(byteNum(s))
+}
+
+func TestDecimalString(t *testing.T) {
+ for _, test := range []struct {
+ x Decimal
+ want string
+ }{
+ {want: "0"},
+ {Decimal{digits: digits{Digits: nil, Exp: 1000}}, "0"}, // exponent of 1000 is ignored
+ {Decimal{digits: digits{Digits: byteNum("12345"), Exp: 0}}, "0.12345"},
+ {Decimal{digits: digits{Digits: byteNum("12345"), Exp: -3}}, "0.00012345"},
+ {Decimal{digits: digits{Digits: byteNum("12345"), Exp: +3}}, "123.45"},
+ {Decimal{digits: digits{Digits: byteNum("12345"), Exp: +10}}, "1234500000"},
+ } {
+ if got := test.x.String(); got != test.want {
+ t.Errorf("%v == %q; want %q", test.x, got, test.want)
+ }
+ }
+}
+
+func TestRounding(t *testing.T) {
+ testCases := []struct {
+ x string
+ n int
+ // modes is the result for modes. Signs are left out of the result.
+ // The results are stored in the following order:
+ // zero, negInf
+ // nearZero, nearEven, nearAway
+ // away, posInf
+ modes [numModes]string
+ }{
+ {"0", 1, [numModes]string{
+ "0", "0",
+ "0", "0", "0",
+ "0", "0"}},
+ {"1", 1, [numModes]string{
+ "1", "1",
+ "1", "1", "1",
+ "1", "1"}},
+ {"5", 1, [numModes]string{
+ "5", "5",
+ "5", "5", "5",
+ "5", "5"}},
+ {"15", 1, [numModes]string{
+ "10", "10",
+ "10", "20", "20",
+ "20", "20"}},
+ {"45", 1, [numModes]string{
+ "40", "40",
+ "40", "40", "50",
+ "50", "50"}},
+ {"95", 1, [numModes]string{
+ "90", "90",
+ "90", "100", "100",
+ "100", "100"}},
+
+ {"12344999", 4, [numModes]string{
+ "12340000", "12340000",
+ "12340000", "12340000", "12340000",
+ "12350000", "12350000"}},
+ {"12345000", 4, [numModes]string{
+ "12340000", "12340000",
+ "12340000", "12340000", "12350000",
+ "12350000", "12350000"}},
+ {"12345001", 4, [numModes]string{
+ "12340000", "12340000",
+ "12350000", "12350000", "12350000",
+ "12350000", "12350000"}},
+ {"12345100", 4, [numModes]string{
+ "12340000", "12340000",
+ "12350000", "12350000", "12350000",
+ "12350000", "12350000"}},
+ {"23454999", 4, [numModes]string{
+ "23450000", "23450000",
+ "23450000", "23450000", "23450000",
+ "23460000", "23460000"}},
+ {"23455000", 4, [numModes]string{
+ "23450000", "23450000",
+ "23450000", "23460000", "23460000",
+ "23460000", "23460000"}},
+ {"23455001", 4, [numModes]string{
+ "23450000", "23450000",
+ "23460000", "23460000", "23460000",
+ "23460000", "23460000"}},
+ {"23455100", 4, [numModes]string{
+ "23450000", "23450000",
+ "23460000", "23460000", "23460000",
+ "23460000", "23460000"}},
+
+ {"99994999", 4, [numModes]string{
+ "99990000", "99990000",
+ "99990000", "99990000", "99990000",
+ "100000000", "100000000"}},
+ {"99995000", 4, [numModes]string{
+ "99990000", "99990000",
+ "99990000", "100000000", "100000000",
+ "100000000", "100000000"}},
+ {"99999999", 4, [numModes]string{
+ "99990000", "99990000",
+ "100000000", "100000000", "100000000",
+ "100000000", "100000000"}},
+
+ {"12994999", 4, [numModes]string{
+ "12990000", "12990000",
+ "12990000", "12990000", "12990000",
+ "13000000", "13000000"}},
+ {"12995000", 4, [numModes]string{
+ "12990000", "12990000",
+ "12990000", "13000000", "13000000",
+ "13000000", "13000000"}},
+ {"12999999", 4, [numModes]string{
+ "12990000", "12990000",
+ "13000000", "13000000", "13000000",
+ "13000000", "13000000"}},
+ }
+ modes := []RoundingMode{
+ ToZero, ToNegativeInf,
+ ToNearestZero, ToNearestEven, ToNearestAway,
+ AwayFromZero, ToPositiveInf,
+ }
+ for _, tc := range testCases {
+ // Create negative counterpart tests: the sign is reversed and
+ // ToPositiveInf and ToNegativeInf swapped.
+ negModes := tc.modes
+ negModes[1], negModes[6] = negModes[6], negModes[1]
+ for i, res := range negModes {
+ negModes[i] = "-" + res
+ }
+ for i, m := range modes {
+ t.Run(fmt.Sprintf("x:%s/n:%d/%s", tc.x, tc.n, m), func(t *testing.T) {
+ d := mkdec(tc.x)
+ d.round(m, tc.n)
+ if got := d.String(); got != tc.modes[i] {
+ t.Errorf("pos decimal: got %q; want %q", d.String(), tc.modes[i])
+ }
+
+ mult := math.Pow(10, float64(len(tc.x)-tc.n))
+ f := mkfloat(tc.x)
+ f = m.roundFloat(f/mult) * mult
+ if got := fmt.Sprintf("%.0f", f); got != tc.modes[i] {
+ t.Errorf("pos float: got %q; want %q", got, tc.modes[i])
+ }
+
+ // Test the negative case. This is the same as the positive
+ // case, but with ToPositiveInf and ToNegativeInf swapped.
+ d = mkdec(tc.x)
+ d.Neg = true
+ d.round(m, tc.n)
+ if got, want := d.String(), negModes[i]; got != want {
+ t.Errorf("neg decimal: got %q; want %q", d.String(), want)
+ }
+
+ f = -mkfloat(tc.x)
+ f = m.roundFloat(f/mult) * mult
+ if got := fmt.Sprintf("%.0f", f); got != negModes[i] {
+ t.Errorf("neg float: got %q; want %q", got, negModes[i])
+ }
+ })
+ }
+ }
+}
+
+func TestConvert(t *testing.T) {
+ scale2 := RoundingContext{}
+ scale2.SetScale(2)
+ scale2away := RoundingContext{Mode: AwayFromZero}
+ scale2away.SetScale(2)
+ inc0_05 := RoundingContext{Increment: 5, IncrementScale: 2}
+ inc0_05.SetScale(2)
+ inc50 := RoundingContext{Increment: 50}
+ prec3 := RoundingContext{}
+ prec3.SetPrecision(3)
+ roundShift := RoundingContext{DigitShift: 2, MaxFractionDigits: 2}
+ testCases := []struct {
+ x interface{}
+ rc RoundingContext
+ out string
+ }{
+ {-0.001, scale2, "-0.00"},
+ {0.1234, prec3, "0.123"},
+ {1234.0, prec3, "1230"},
+ {1.2345e10, prec3, "12300000000"},
+
+ {int8(-34), scale2, "-34"},
+ {int16(-234), scale2, "-234"},
+ {int32(-234), scale2, "-234"},
+ {int64(-234), scale2, "-234"},
+ {int(-234), scale2, "-234"},
+ {uint8(234), scale2, "234"},
+ {uint16(234), scale2, "234"},
+ {uint32(234), scale2, "234"},
+ {uint64(234), scale2, "234"},
+ {uint(234), scale2, "234"},
+ {-1e9, scale2, "-1000000000.00"},
+ // The following two causes this result to have a lot of digits:
+ // 1) 0.234 cannot be accurately represented as a float64, and
+ // 2) as strconv does not support the rounding AwayFromZero, Convert
+ // leaves the rounding to caller.
+ {0.234, scale2away,
+ "0.2340000000000000135447209004269097931683063507080078125"},
+
+ {0.0249, inc0_05, "0.00"},
+ {0.025, inc0_05, "0.00"},
+ {0.0251, inc0_05, "0.05"},
+ {0.03, inc0_05, "0.05"},
+ {0.049, inc0_05, "0.05"},
+ {0.05, inc0_05, "0.05"},
+ {0.051, inc0_05, "0.05"},
+ {0.0749, inc0_05, "0.05"},
+ {0.075, inc0_05, "0.10"},
+ {0.0751, inc0_05, "0.10"},
+ {324, inc50, "300"},
+ {325, inc50, "300"},
+ {326, inc50, "350"},
+ {349, inc50, "350"},
+ {350, inc50, "350"},
+ {351, inc50, "350"},
+ {374, inc50, "350"},
+ {375, inc50, "400"},
+ {376, inc50, "400"},
+
+ // Here the scale is 2, but the digits get shifted left. As we use
+ // AppendFloat to do the rounding an exta 0 gets added.
+ {0.123, roundShift, "0.1230"},
+
+ {converter(3), scale2, "100"},
+
+ {math.Inf(1), inc50, "Inf"},
+ {math.Inf(-1), inc50, "-Inf"},
+ {math.NaN(), inc50, "NaN"},
+ {"clearly not a number", scale2, "NaN"},
+ }
+ for _, tc := range testCases {
+ var d Decimal
+ t.Run(fmt.Sprintf("%T:%v-%v", tc.x, tc.x, tc.rc), func(t *testing.T) {
+ d.Convert(tc.rc, tc.x)
+ if got := d.String(); got != tc.out {
+ t.Errorf("got %q; want %q", got, tc.out)
+ }
+ })
+ }
+}
+
+type converter int
+
+func (c converter) Convert(d *Decimal, r RoundingContext) {
+ d.Digits = append(d.Digits, 1, 0, 0)
+ d.Exp = 3
+}
diff --git a/vendor/golang.org/x/text/internal/number/format.go b/vendor/golang.org/x/text/internal/number/format.go
new file mode 100644
index 0000000..cd94c5d
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/format.go
@@ -0,0 +1,535 @@
+// 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 number
+
+import (
+ "strconv"
+ "unicode/utf8"
+
+ "golang.org/x/text/language"
+)
+
+// TODO:
+// - grouping of fractions
+// - allow user-defined superscript notation (such as <sup>4</sup>)
+// - same for non-breaking spaces, like &nbsp;
+
+// A VisibleDigits computes digits, comma placement and trailing zeros as they
+// will be shown to the user.
+type VisibleDigits interface {
+ Digits(buf []byte, t language.Tag, scale int) Digits
+ // TODO: Do we also need to add the verb or pass a format.State?
+}
+
+// Formatting proceeds along the following lines:
+// 0) Compose rounding information from format and context.
+// 1) Convert a number into a Decimal.
+// 2) Sanitize Decimal by adding trailing zeros, removing leading digits, and
+// (non-increment) rounding. The Decimal that results from this is suitable
+// for determining the plural form.
+// 3) Render the Decimal in the localized form.
+
+// Formatter contains all the information needed to render a number.
+type Formatter struct {
+ Pattern
+ Info
+}
+
+func (f *Formatter) init(t language.Tag, index []uint8) {
+ f.Info = InfoFromTag(t)
+ f.Pattern = formats[index[tagToID(t)]]
+}
+
+// InitPattern initializes a Formatter for the given Pattern.
+func (f *Formatter) InitPattern(t language.Tag, pat *Pattern) {
+ f.Info = InfoFromTag(t)
+ f.Pattern = *pat
+}
+
+// InitDecimal initializes a Formatter using the default Pattern for the given
+// language.
+func (f *Formatter) InitDecimal(t language.Tag) {
+ f.init(t, tagToDecimal)
+}
+
+// InitScientific initializes a Formatter using the default Pattern for the
+// given language.
+func (f *Formatter) InitScientific(t language.Tag) {
+ f.init(t, tagToScientific)
+ f.Pattern.MinFractionDigits = 0
+ f.Pattern.MaxFractionDigits = -1
+}
+
+// InitEngineering initializes a Formatter using the default Pattern for the
+// given language.
+func (f *Formatter) InitEngineering(t language.Tag) {
+ f.init(t, tagToScientific)
+ f.Pattern.MinFractionDigits = 0
+ f.Pattern.MaxFractionDigits = -1
+ f.Pattern.MaxIntegerDigits = 3
+ f.Pattern.MinIntegerDigits = 1
+}
+
+// InitPercent initializes a Formatter using the default Pattern for the given
+// language.
+func (f *Formatter) InitPercent(t language.Tag) {
+ f.init(t, tagToPercent)
+}
+
+// InitPerMille initializes a Formatter using the default Pattern for the given
+// language.
+func (f *Formatter) InitPerMille(t language.Tag) {
+ f.init(t, tagToPercent)
+ f.Pattern.DigitShift = 3
+}
+
+func (f *Formatter) Append(dst []byte, x interface{}) []byte {
+ var d Decimal
+ r := f.RoundingContext
+ d.Convert(r, x)
+ return f.Render(dst, FormatDigits(&d, r))
+}
+
+func FormatDigits(d *Decimal, r RoundingContext) Digits {
+ if r.isScientific() {
+ return scientificVisibleDigits(r, d)
+ }
+ return decimalVisibleDigits(r, d)
+}
+
+func (f *Formatter) Format(dst []byte, d *Decimal) []byte {
+ return f.Render(dst, FormatDigits(d, f.RoundingContext))
+}
+
+func (f *Formatter) Render(dst []byte, d Digits) []byte {
+ var result []byte
+ var postPrefix, preSuffix int
+ if d.IsScientific {
+ result, postPrefix, preSuffix = appendScientific(dst, f, &d)
+ } else {
+ result, postPrefix, preSuffix = appendDecimal(dst, f, &d)
+ }
+ if f.PadRune == 0 {
+ return result
+ }
+ width := int(f.FormatWidth)
+ if count := utf8.RuneCount(result); count < width {
+ insertPos := 0
+ switch f.Flags & PadMask {
+ case PadAfterPrefix:
+ insertPos = postPrefix
+ case PadBeforeSuffix:
+ insertPos = preSuffix
+ case PadAfterSuffix:
+ insertPos = len(result)
+ }
+ num := width - count
+ pad := [utf8.UTFMax]byte{' '}
+ sz := 1
+ if r := f.PadRune; r != 0 {
+ sz = utf8.EncodeRune(pad[:], r)
+ }
+ extra := sz * num
+ if n := len(result) + extra; n < cap(result) {
+ result = result[:n]
+ copy(result[insertPos+extra:], result[insertPos:])
+ } else {
+ buf := make([]byte, n)
+ copy(buf, result[:insertPos])
+ copy(buf[insertPos+extra:], result[insertPos:])
+ result = buf
+ }
+ for ; num > 0; num-- {
+ insertPos += copy(result[insertPos:], pad[:sz])
+ }
+ }
+ return result
+}
+
+// decimalVisibleDigits converts d according to the RoundingContext. Note that
+// the exponent may change as a result of this operation.
+func decimalVisibleDigits(r RoundingContext, d *Decimal) Digits {
+ if d.NaN || d.Inf {
+ return Digits{digits: digits{Neg: d.Neg, NaN: d.NaN, Inf: d.Inf}}
+ }
+ n := Digits{digits: d.normalize().digits}
+
+ exp := n.Exp
+ exp += int32(r.DigitShift)
+
+ // Cap integer digits. Remove *most-significant* digits.
+ if r.MaxIntegerDigits > 0 {
+ if p := int(exp) - int(r.MaxIntegerDigits); p > 0 {
+ if p > len(n.Digits) {
+ p = len(n.Digits)
+ }
+ if n.Digits = n.Digits[p:]; len(n.Digits) == 0 {
+ exp = 0
+ } else {
+ exp -= int32(p)
+ }
+ // Strip leading zeros.
+ for len(n.Digits) > 0 && n.Digits[0] == 0 {
+ n.Digits = n.Digits[1:]
+ exp--
+ }
+ }
+ }
+
+ // Rounding if not already done by Convert.
+ p := len(n.Digits)
+ if maxSig := int(r.MaxSignificantDigits); maxSig > 0 {
+ p = maxSig
+ }
+ if maxFrac := int(r.MaxFractionDigits); maxFrac >= 0 {
+ if cap := int(exp) + maxFrac; cap < p {
+ p = int(exp) + maxFrac
+ }
+ if p < 0 {
+ p = 0
+ }
+ }
+ n.round(r.Mode, p)
+
+ // set End (trailing zeros)
+ n.End = int32(len(n.Digits))
+ if n.End == 0 {
+ exp = 0
+ if r.MinFractionDigits > 0 {
+ n.End = int32(r.MinFractionDigits)
+ }
+ if p := int32(r.MinSignificantDigits) - 1; p > n.End {
+ n.End = p
+ }
+ } else {
+ if end := exp + int32(r.MinFractionDigits); end > n.End {
+ n.End = end
+ }
+ if n.End < int32(r.MinSignificantDigits) {
+ n.End = int32(r.MinSignificantDigits)
+ }
+ }
+ n.Exp = exp
+ return n
+}
+
+// appendDecimal appends a formatted number to dst. It returns two possible
+// insertion points for padding.
+func appendDecimal(dst []byte, f *Formatter, n *Digits) (b []byte, postPre, preSuf int) {
+ if dst, ok := f.renderSpecial(dst, n); ok {
+ return dst, 0, len(dst)
+ }
+ digits := n.Digits
+ exp := n.Exp
+
+ // Split in integer and fraction part.
+ var intDigits, fracDigits []byte
+ numInt := 0
+ numFrac := int(n.End - n.Exp)
+ if exp > 0 {
+ numInt = int(exp)
+ if int(exp) >= len(digits) { // ddddd | ddddd00
+ intDigits = digits
+ } else { // ddd.dd
+ intDigits = digits[:exp]
+ fracDigits = digits[exp:]
+ }
+ } else {
+ fracDigits = digits
+ }
+
+ neg := n.Neg
+ affix, suffix := f.getAffixes(neg)
+ dst = appendAffix(dst, f, affix, neg)
+ savedLen := len(dst)
+
+ minInt := int(f.MinIntegerDigits)
+ if minInt == 0 && f.MinSignificantDigits > 0 {
+ minInt = 1
+ }
+ // add leading zeros
+ for i := minInt; i > numInt; i-- {
+ dst = f.AppendDigit(dst, 0)
+ if f.needsSep(i) {
+ dst = append(dst, f.Symbol(SymGroup)...)
+ }
+ }
+ i := 0
+ for ; i < len(intDigits); i++ {
+ dst = f.AppendDigit(dst, intDigits[i])
+ if f.needsSep(numInt - i) {
+ dst = append(dst, f.Symbol(SymGroup)...)
+ }
+ }
+ for ; i < numInt; i++ {
+ dst = f.AppendDigit(dst, 0)
+ if f.needsSep(numInt - i) {
+ dst = append(dst, f.Symbol(SymGroup)...)
+ }
+ }
+
+ if numFrac > 0 || f.Flags&AlwaysDecimalSeparator != 0 {
+ dst = append(dst, f.Symbol(SymDecimal)...)
+ }
+ // Add trailing zeros
+ i = 0
+ for n := -int(n.Exp); i < n; i++ {
+ dst = f.AppendDigit(dst, 0)
+ }
+ for _, d := range fracDigits {
+ i++
+ dst = f.AppendDigit(dst, d)
+ }
+ for ; i < numFrac; i++ {
+ dst = f.AppendDigit(dst, 0)
+ }
+ return appendAffix(dst, f, suffix, neg), savedLen, len(dst)
+}
+
+func scientificVisibleDigits(r RoundingContext, d *Decimal) Digits {
+ if d.NaN || d.Inf {
+ return Digits{digits: digits{Neg: d.Neg, NaN: d.NaN, Inf: d.Inf}}
+ }
+ n := Digits{digits: d.normalize().digits, IsScientific: true}
+
+ // Normalize to have at least one digit. This simplifies engineering
+ // notation.
+ if len(n.Digits) == 0 {
+ n.Digits = append(n.Digits, 0)
+ n.Exp = 1
+ }
+
+ // Significant digits are transformed by the parser for scientific notation
+ // and do not need to be handled here.
+ maxInt, numInt := int(r.MaxIntegerDigits), int(r.MinIntegerDigits)
+ if numInt == 0 {
+ numInt = 1
+ }
+
+ // If a maximum number of integers is specified, the minimum must be 1
+ // and the exponent is grouped by this number (e.g. for engineering)
+ if maxInt > numInt {
+ // Correct the exponent to reflect a single integer digit.
+ numInt = 1
+ // engineering
+ // 0.01234 ([12345]e-1) -> 1.2345e-2 12.345e-3
+ // 12345 ([12345]e+5) -> 1.2345e4 12.345e3
+ d := int(n.Exp-1) % maxInt
+ if d < 0 {
+ d += maxInt
+ }
+ numInt += d
+ }
+
+ p := len(n.Digits)
+ if maxSig := int(r.MaxSignificantDigits); maxSig > 0 {
+ p = maxSig
+ }
+ if maxFrac := int(r.MaxFractionDigits); maxFrac >= 0 && numInt+maxFrac < p {
+ p = numInt + maxFrac
+ }
+ n.round(r.Mode, p)
+
+ n.Comma = uint8(numInt)
+ n.End = int32(len(n.Digits))
+ if minSig := int32(r.MinFractionDigits) + int32(numInt); n.End < minSig {
+ n.End = minSig
+ }
+ return n
+}
+
+// appendScientific appends a formatted number to dst. It returns two possible
+// insertion points for padding.
+func appendScientific(dst []byte, f *Formatter, n *Digits) (b []byte, postPre, preSuf int) {
+ if dst, ok := f.renderSpecial(dst, n); ok {
+ return dst, 0, 0
+ }
+ digits := n.Digits
+ numInt := int(n.Comma)
+ numFrac := int(n.End) - int(n.Comma)
+
+ var intDigits, fracDigits []byte
+ if numInt <= len(digits) {
+ intDigits = digits[:numInt]
+ fracDigits = digits[numInt:]
+ } else {
+ intDigits = digits
+ }
+ neg := n.Neg
+ affix, suffix := f.getAffixes(neg)
+ dst = appendAffix(dst, f, affix, neg)
+ savedLen := len(dst)
+
+ i := 0
+ for ; i < len(intDigits); i++ {
+ dst = f.AppendDigit(dst, intDigits[i])
+ if f.needsSep(numInt - i) {
+ dst = append(dst, f.Symbol(SymGroup)...)
+ }
+ }
+ for ; i < numInt; i++ {
+ dst = f.AppendDigit(dst, 0)
+ if f.needsSep(numInt - i) {
+ dst = append(dst, f.Symbol(SymGroup)...)
+ }
+ }
+
+ if numFrac > 0 || f.Flags&AlwaysDecimalSeparator != 0 {
+ dst = append(dst, f.Symbol(SymDecimal)...)
+ }
+ i = 0
+ for ; i < len(fracDigits); i++ {
+ dst = f.AppendDigit(dst, fracDigits[i])
+ }
+ for ; i < numFrac; i++ {
+ dst = f.AppendDigit(dst, 0)
+ }
+
+ // exp
+ buf := [12]byte{}
+ // TODO: use exponential if superscripting is not available (no Latin
+ // numbers or no tags) and use exponential in all other cases.
+ exp := n.Exp - int32(n.Comma)
+ exponential := f.Symbol(SymExponential)
+ if exponential == "E" {
+ dst = append(dst, "\u202f"...) // NARROW NO-BREAK SPACE
+ dst = append(dst, f.Symbol(SymSuperscriptingExponent)...)
+ dst = append(dst, "\u202f"...) // NARROW NO-BREAK SPACE
+ dst = f.AppendDigit(dst, 1)
+ dst = f.AppendDigit(dst, 0)
+ switch {
+ case exp < 0:
+ dst = append(dst, superMinus...)
+ exp = -exp
+ case f.Flags&AlwaysExpSign != 0:
+ dst = append(dst, superPlus...)
+ }
+ b = strconv.AppendUint(buf[:0], uint64(exp), 10)
+ for i := len(b); i < int(f.MinExponentDigits); i++ {
+ dst = append(dst, superDigits[0]...)
+ }
+ for _, c := range b {
+ dst = append(dst, superDigits[c-'0']...)
+ }
+ } else {
+ dst = append(dst, exponential...)
+ switch {
+ case exp < 0:
+ dst = append(dst, f.Symbol(SymMinusSign)...)
+ exp = -exp
+ case f.Flags&AlwaysExpSign != 0:
+ dst = append(dst, f.Symbol(SymPlusSign)...)
+ }
+ b = strconv.AppendUint(buf[:0], uint64(exp), 10)
+ for i := len(b); i < int(f.MinExponentDigits); i++ {
+ dst = f.AppendDigit(dst, 0)
+ }
+ for _, c := range b {
+ dst = f.AppendDigit(dst, c-'0')
+ }
+ }
+ return appendAffix(dst, f, suffix, neg), savedLen, len(dst)
+}
+
+const (
+ superMinus = "\u207B" // SUPERSCRIPT HYPHEN-MINUS
+ superPlus = "\u207A" // SUPERSCRIPT PLUS SIGN
+)
+
+var (
+ // Note: the digits are not sequential!!!
+ superDigits = []string{
+ "\u2070", // SUPERSCRIPT DIGIT ZERO
+ "\u00B9", // SUPERSCRIPT DIGIT ONE
+ "\u00B2", // SUPERSCRIPT DIGIT TWO
+ "\u00B3", // SUPERSCRIPT DIGIT THREE
+ "\u2074", // SUPERSCRIPT DIGIT FOUR
+ "\u2075", // SUPERSCRIPT DIGIT FIVE
+ "\u2076", // SUPERSCRIPT DIGIT SIX
+ "\u2077", // SUPERSCRIPT DIGIT SEVEN
+ "\u2078", // SUPERSCRIPT DIGIT EIGHT
+ "\u2079", // SUPERSCRIPT DIGIT NINE
+ }
+)
+
+func (f *Formatter) getAffixes(neg bool) (affix, suffix string) {
+ str := f.Affix
+ if str != "" {
+ if f.NegOffset > 0 {
+ if neg {
+ str = str[f.NegOffset:]
+ } else {
+ str = str[:f.NegOffset]
+ }
+ }
+ sufStart := 1 + str[0]
+ affix = str[1:sufStart]
+ suffix = str[sufStart+1:]
+ }
+ // TODO: introduce a NeedNeg sign to indicate if the left pattern already
+ // has a sign marked?
+ if f.NegOffset == 0 && (neg || f.Flags&AlwaysSign != 0) {
+ affix = "-" + affix
+ }
+ return affix, suffix
+}
+
+func (f *Formatter) renderSpecial(dst []byte, d *Digits) (b []byte, ok bool) {
+ if d.NaN {
+ return fmtNaN(dst, f), true
+ }
+ if d.Inf {
+ return fmtInfinite(dst, f, d), true
+ }
+ return dst, false
+}
+
+func fmtNaN(dst []byte, f *Formatter) []byte {
+ return append(dst, f.Symbol(SymNan)...)
+}
+
+func fmtInfinite(dst []byte, f *Formatter, d *Digits) []byte {
+ affix, suffix := f.getAffixes(d.Neg)
+ dst = appendAffix(dst, f, affix, d.Neg)
+ dst = append(dst, f.Symbol(SymInfinity)...)
+ dst = appendAffix(dst, f, suffix, d.Neg)
+ return dst
+}
+
+func appendAffix(dst []byte, f *Formatter, affix string, neg bool) []byte {
+ quoting := false
+ escaping := false
+ for _, r := range affix {
+ switch {
+ case escaping:
+ // escaping occurs both inside and outside of quotes
+ dst = append(dst, string(r)...)
+ escaping = false
+ case r == '\\':
+ escaping = true
+ case r == '\'':
+ quoting = !quoting
+ case quoting:
+ dst = append(dst, string(r)...)
+ case r == '%':
+ if f.DigitShift == 3 {
+ dst = append(dst, f.Symbol(SymPerMille)...)
+ } else {
+ dst = append(dst, f.Symbol(SymPercentSign)...)
+ }
+ case r == '-' || r == '+':
+ if neg {
+ dst = append(dst, f.Symbol(SymMinusSign)...)
+ } else if f.Flags&ElideSign == 0 {
+ dst = append(dst, f.Symbol(SymPlusSign)...)
+ } else {
+ dst = append(dst, ' ')
+ }
+ default:
+ dst = append(dst, string(r)...)
+ }
+ }
+ return dst
+}
diff --git a/vendor/golang.org/x/text/internal/number/format_test.go b/vendor/golang.org/x/text/internal/number/format_test.go
new file mode 100644
index 0000000..01a0894
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/format_test.go
@@ -0,0 +1,522 @@
+// 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 number
+
+import (
+ "fmt"
+ "log"
+ "testing"
+
+ "golang.org/x/text/language"
+)
+
+func TestAppendDecimal(t *testing.T) {
+ type pairs map[string]string // alternates with decimal input and result
+
+ testCases := []struct {
+ pattern string
+ // We want to be able to test some forms of patterns that cannot be
+ // represented as a string.
+ pat *Pattern
+
+ test pairs
+ }{{
+ pattern: "0",
+ test: pairs{
+ "0": "0",
+ "1": "1",
+ "-1": "-1",
+ ".00": "0",
+ "10.": "10",
+ "12": "12",
+ "1.2": "1",
+ "NaN": "NaN",
+ "-Inf": "-∞",
+ },
+ }, {
+ pattern: "+0;+0",
+ test: pairs{
+ "0": "+0",
+ "1": "+1",
+ "-1": "-1",
+ ".00": "+0",
+ "10.": "+10",
+ "12": "+12",
+ "1.2": "+1",
+ "NaN": "NaN",
+ "-Inf": "-∞",
+ "Inf": "+∞",
+ },
+ }, {
+ pattern: "0 +;0 +",
+ test: pairs{
+ "0": "0 +",
+ "1": "1 +",
+ "-1": "1 -",
+ ".00": "0 +",
+ },
+ }, {
+ pattern: "0;0-",
+ test: pairs{
+ "-1": "1-",
+ "NaN": "NaN",
+ "-Inf": "∞-",
+ "Inf": "∞",
+ },
+ }, {
+ pattern: "0000",
+ test: pairs{
+ "0": "0000",
+ "1": "0001",
+ "12": "0012",
+ "12345": "12345",
+ },
+ }, {
+ pattern: ".0",
+ test: pairs{
+ "0": ".0",
+ "1": "1.0",
+ "1.2": "1.2",
+ "1.2345": "1.2",
+ },
+ }, {
+ pattern: "#.0",
+ test: pairs{
+ "0": ".0",
+ },
+ }, {
+ pattern: "#.0#",
+ test: pairs{
+ "0": ".0",
+ "1": "1.0",
+ },
+ }, {
+ pattern: "0.0#",
+ test: pairs{
+ "0": "0.0",
+ },
+ }, {
+ pattern: "#0.###",
+ test: pairs{
+ "0": "0",
+ "1": "1",
+ "1.2": "1.2",
+ "1.2345": "1.234", // rounding should have been done earlier
+ "1234.5": "1234.5",
+ "1234.567": "1234.567",
+ },
+ }, {
+ pattern: "#0.######",
+ test: pairs{
+ "0": "0",
+ "1234.5678": "1234.5678",
+ "0.123456789": "0.123457",
+ "NaN": "NaN",
+ "Inf": "∞",
+ },
+
+ // Test separators.
+ }, {
+ pattern: "#,#.00",
+ test: pairs{
+ "100": "1,0,0.00",
+ },
+ }, {
+ pattern: "#,0.##",
+ test: pairs{
+ "10": "1,0",
+ },
+ }, {
+ pattern: "#,0",
+ test: pairs{
+ "10": "1,0",
+ },
+ }, {
+ pattern: "#,##,#.00",
+ test: pairs{
+ "1000": "1,00,0.00",
+ },
+ }, {
+ pattern: "#,##0.###",
+ test: pairs{
+ "0": "0",
+ "1234.5678": "1,234.568",
+ "0.123456789": "0.123",
+ },
+ }, {
+ pattern: "#,##,##0.###",
+ test: pairs{
+ "0": "0",
+ "123456789012": "1,23,45,67,89,012",
+ "0.123456789": "0.123",
+ },
+ }, {
+ pattern: "0,00,000.###",
+ test: pairs{
+ "0": "0,00,000",
+ "123456789012": "1,23,45,67,89,012",
+ "12.3456789": "0,00,012.346",
+ "0.123456789": "0,00,000.123",
+ },
+
+ // Support for ill-formed patterns.
+ }, {
+ pattern: "#",
+ test: pairs{
+ ".00": "", // This is the behavior of fmt.
+ "0": "", // This is the behavior of fmt.
+ "1": "1",
+ "10.": "10",
+ },
+ }, {
+ pattern: ".#",
+ test: pairs{
+ "0": "", // This is the behavior of fmt.
+ "1": "1",
+ "1.2": "1.2",
+ "1.2345": "1.2",
+ },
+ }, {
+ pattern: "#,#.##",
+ test: pairs{
+ "10": "1,0",
+ },
+ }, {
+ pattern: "#,#",
+ test: pairs{
+ "10": "1,0",
+ },
+
+ // Special patterns
+ }, {
+ pattern: "#,max_int=2",
+ pat: &Pattern{
+ RoundingContext: RoundingContext{
+ MaxIntegerDigits: 2,
+ },
+ },
+ test: pairs{
+ "2017": "17",
+ },
+ }, {
+ pattern: "0,max_int=2",
+ pat: &Pattern{
+ RoundingContext: RoundingContext{
+ MaxIntegerDigits: 2,
+ MinIntegerDigits: 1,
+ },
+ },
+ test: pairs{
+ "2000": "0",
+ "2001": "1",
+ "2017": "17",
+ },
+ }, {
+ pattern: "00,max_int=2",
+ pat: &Pattern{
+ RoundingContext: RoundingContext{
+ MaxIntegerDigits: 2,
+ MinIntegerDigits: 2,
+ },
+ },
+ test: pairs{
+ "2000": "00",
+ "2001": "01",
+ "2017": "17",
+ },
+ }, {
+ pattern: "@@@@,max_int=2",
+ pat: &Pattern{
+ RoundingContext: RoundingContext{
+ MaxIntegerDigits: 2,
+ MinSignificantDigits: 4,
+ },
+ },
+ test: pairs{
+ "2017": "17.00",
+ "2000": "0.000",
+ "2001": "1.000",
+ },
+
+ // Significant digits
+ }, {
+ pattern: "@@##",
+ test: pairs{
+ "1": "1.0",
+ "0.1": "0.10", // leading zero does not count as significant digit
+ "123": "123",
+ "1234": "1234",
+ "12345": "12340",
+ },
+ }, {
+ pattern: "@@@@",
+ test: pairs{
+ "1": "1.000",
+ ".1": "0.1000",
+ ".001": "0.001000",
+ "123": "123.0",
+ "1234": "1234",
+ "12345": "12340", // rounding down
+ "NaN": "NaN",
+ "-Inf": "-∞",
+ },
+
+ // TODO: rounding
+ // {"@@@@": "23456": "23460"}, // rounding up
+ // TODO: padding
+
+ // Scientific and Engineering notation
+ }, {
+ pattern: "#E0",
+ test: pairs{
+ "0": "0\u202f×\u202f10⁰",
+ "1": "1\u202f×\u202f10⁰",
+ "123.456": "1\u202f×\u202f10²",
+ },
+ }, {
+ pattern: "#E+0",
+ test: pairs{
+ "0": "0\u202f×\u202f10⁺⁰",
+ "1000": "1\u202f×\u202f10⁺³",
+ "1E100": "1\u202f×\u202f10⁺¹⁰⁰",
+ "1E-100": "1\u202f×\u202f10⁻¹⁰⁰",
+ "NaN": "NaN",
+ "-Inf": "-∞",
+ },
+ }, {
+ pattern: "##0E00",
+ test: pairs{
+ "100": "100\u202f×\u202f10⁰⁰",
+ "12345": "12\u202f×\u202f10⁰³",
+ "123.456": "123\u202f×\u202f10⁰⁰",
+ },
+ }, {
+ pattern: "##0.###E00",
+ test: pairs{
+ "100": "100\u202f×\u202f10⁰⁰",
+ "12345": "12.345\u202f×\u202f10⁰³",
+ "123456": "123.456\u202f×\u202f10⁰³",
+ "123.456": "123.456\u202f×\u202f10⁰⁰",
+ "123.4567": "123.457\u202f×\u202f10⁰⁰",
+ },
+ }, {
+ pattern: "##0.000E00",
+ test: pairs{
+ "100": "100.000\u202f×\u202f10⁰⁰",
+ "12345": "12.345\u202f×\u202f10⁰³",
+ "123.456": "123.456\u202f×\u202f10⁰⁰",
+ "12.3456": "12.346\u202f×\u202f10⁰⁰",
+ },
+ }, {
+ pattern: "@@E0",
+ test: pairs{
+ "0": "0.0\u202f×\u202f10⁰",
+ "99": "9.9\u202f×\u202f10¹",
+ "0.99": "9.9\u202f×\u202f10⁻¹",
+ },
+ }, {
+ pattern: "@###E00",
+ test: pairs{
+ "0": "0\u202f×\u202f10⁰⁰",
+ "1": "1\u202f×\u202f10⁰⁰",
+ "11": "1.1\u202f×\u202f10⁰¹",
+ "111": "1.11\u202f×\u202f10⁰²",
+ "1111": "1.111\u202f×\u202f10⁰³",
+ "11111": "1.111\u202f×\u202f10⁰⁴",
+ "0.1": "1\u202f×\u202f10⁻⁰¹",
+ "0.11": "1.1\u202f×\u202f10⁻⁰¹",
+ "0.001": "1\u202f×\u202f10⁻⁰³",
+ },
+ }, {
+ pattern: "*x##0",
+ test: pairs{
+ "0": "xx0",
+ "10": "x10",
+ "100": "100",
+ "1000": "1000",
+ },
+ }, {
+ pattern: "##0*x",
+ test: pairs{
+ "0": "0xx",
+ "10": "10x",
+ "100": "100",
+ "1000": "1000",
+ },
+ }, {
+ pattern: "* ###0.000",
+ test: pairs{
+ "0": " 0.000",
+ "123": " 123.000",
+ "123.456": " 123.456",
+ "1234.567": "1234.567",
+ },
+ }, {
+ pattern: "**0.0#######E00",
+ test: pairs{
+ "0": "***0.0\u202f×\u202f10⁰⁰",
+ "10": "***1.0\u202f×\u202f10⁰¹",
+ "11": "***1.1\u202f×\u202f10⁰¹",
+ "111": "**1.11\u202f×\u202f10⁰²",
+ "1111": "*1.111\u202f×\u202f10⁰³",
+ "11111": "1.1111\u202f×\u202f10⁰⁴",
+ "11110": "*1.111\u202f×\u202f10⁰⁴",
+ "11100": "**1.11\u202f×\u202f10⁰⁴",
+ "11000": "***1.1\u202f×\u202f10⁰⁴",
+ "10000": "***1.0\u202f×\u202f10⁰⁴",
+ },
+ }, {
+ pattern: "*xpre0suf",
+ test: pairs{
+ "0": "pre0suf",
+ "10": "pre10suf",
+ },
+ }, {
+ pattern: "*∞ pre ###0 suf",
+ test: pairs{
+ "0": "∞∞∞ pre 0 suf",
+ "10": "∞∞ pre 10 suf",
+ "100": "∞ pre 100 suf",
+ "1000": " pre 1000 suf",
+ },
+ }, {
+ pattern: "pre *∞###0 suf",
+ test: pairs{
+ "0": "pre ∞∞∞0 suf",
+ "10": "pre ∞∞10 suf",
+ "100": "pre ∞100 suf",
+ "1000": "pre 1000 suf",
+ },
+ }, {
+ pattern: "pre ###0*∞ suf",
+ test: pairs{
+ "0": "pre 0∞∞∞ suf",
+ "10": "pre 10∞∞ suf",
+ "100": "pre 100∞ suf",
+ "1000": "pre 1000 suf",
+ },
+ }, {
+ pattern: "pre ###0 suf *∞",
+ test: pairs{
+ "0": "pre 0 suf ∞∞∞",
+ "10": "pre 10 suf ∞∞",
+ "100": "pre 100 suf ∞",
+ "1000": "pre 1000 suf ",
+ },
+ }, {
+ // Take width of positive pattern.
+ pattern: "**###0;**-#####0x",
+ test: pairs{
+ "0": "***0",
+ "-1": "*-1x",
+ },
+ }, {
+ pattern: "0.00%",
+ test: pairs{
+ "0.1": "10.00%",
+ },
+ }, {
+ pattern: "0.##%",
+ test: pairs{
+ "0.1": "10%",
+ "0.11": "11%",
+ "0.111": "11.1%",
+ "0.1111": "11.11%",
+ "0.11111": "11.11%",
+ },
+ }, {
+ pattern: "‰ 0.0#",
+ test: pairs{
+ "0.1": "‰ 100.0",
+ "0.11": "‰ 110.0",
+ "0.111": "‰ 111.0",
+ "0.1111": "‰ 111.1",
+ "0.11111": "‰ 111.11",
+ "0.111111": "‰ 111.11",
+ },
+ }}
+
+ // TODO:
+ // "#,##0.00¤",
+ // "#,##0.00 ¤;(#,##0.00 ¤)",
+
+ for _, tc := range testCases {
+ pat := tc.pat
+ if pat == nil {
+ var err error
+ if pat, err = ParsePattern(tc.pattern); err != nil {
+ log.Fatal(err)
+ }
+ }
+ var f Formatter
+ f.InitPattern(language.English, pat)
+ for num, want := range tc.test {
+ buf := make([]byte, 100)
+ t.Run(tc.pattern+"/"+num, func(t *testing.T) {
+ var d Decimal
+ d.Convert(f.RoundingContext, dec(num))
+ buf = f.Format(buf[:0], &d)
+ if got := string(buf); got != want {
+ t.Errorf("\n got %[1]q (%[1]s)\nwant %[2]q (%[2]s)", got, want)
+ }
+ })
+ }
+ }
+}
+
+func TestLocales(t *testing.T) {
+ testCases := []struct {
+ tag language.Tag
+ num string
+ want string
+ }{
+ {language.Make("en"), "123456.78", "123,456.78"},
+ {language.Make("de"), "123456.78", "123.456,78"},
+ {language.Make("de-CH"), "123456.78", "123’456.78"},
+ {language.Make("fr"), "123456.78", "123 456,78"},
+ {language.Make("bn"), "123456.78", "১,২৩,৪৫৬.৭৮"},
+ }
+ for _, tc := range testCases {
+ t.Run(fmt.Sprint(tc.tag, "/", tc.num), func(t *testing.T) {
+ var f Formatter
+ f.InitDecimal(tc.tag)
+ var d Decimal
+ d.Convert(f.RoundingContext, dec(tc.num))
+ b := f.Format(nil, &d)
+ if got := string(b); got != tc.want {
+ t.Errorf("got %[1]q (%[1]s); want %[2]q (%[2]s)", got, tc.want)
+ }
+ })
+ }
+}
+
+func TestFormatters(t *testing.T) {
+ var f Formatter
+ testCases := []struct {
+ init func(t language.Tag)
+ num string
+ want string
+ }{
+ {f.InitDecimal, "123456.78", "123,456.78"},
+ {f.InitScientific, "123456.78", "1.23\u202f×\u202f10⁵"},
+ {f.InitEngineering, "123456.78", "123.46\u202f×\u202f10³"},
+ {f.InitEngineering, "1234", "1.23\u202f×\u202f10³"},
+
+ {f.InitPercent, "0.1234", "12.34%"},
+ {f.InitPerMille, "0.1234", "123.40‰"},
+ }
+ for i, tc := range testCases {
+ t.Run(fmt.Sprint(i, "/", tc.num), func(t *testing.T) {
+ tc.init(language.English)
+ f.SetScale(2)
+ var d Decimal
+ d.Convert(f.RoundingContext, dec(tc.num))
+ b := f.Format(nil, &d)
+ if got := string(b); got != tc.want {
+ t.Errorf("got %[1]q (%[1]s); want %[2]q (%[2]s)", got, tc.want)
+ }
+ })
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/number/gen.go b/vendor/golang.org/x/text/internal/number/gen.go
new file mode 100644
index 0000000..c836221
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/gen.go
@@ -0,0 +1,458 @@
+// 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
+
+import (
+ "flag"
+ "fmt"
+ "log"
+ "reflect"
+ "strings"
+ "unicode/utf8"
+
+ "golang.org/x/text/internal/gen"
+ "golang.org/x/text/internal/language"
+ "golang.org/x/text/internal/language/compact"
+ "golang.org/x/text/internal/number"
+ "golang.org/x/text/internal/stringset"
+ "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 = "number"
+
+ 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", "numberingSystem")
+ data, err := d.DecodeZip(r)
+ if err != nil {
+ log.Fatalf("DecodeZip: %v", err)
+ }
+
+ w := gen.NewCodeWriter()
+ defer w.WriteGoFile(*outputFile, pkg)
+
+ fmt.Fprintln(w, `import "golang.org/x/text/internal/stringset"`)
+
+ gen.WriteCLDRVersion(w)
+
+ genNumSystem(w, data)
+ genSymbols(w, data)
+ genFormats(w, data)
+}
+
+var systemMap = map[string]system{"latn": 0}
+
+func getNumberSystem(str string) system {
+ ns, ok := systemMap[str]
+ if !ok {
+ log.Fatalf("No index for numbering system %q", str)
+ }
+ return ns
+}
+
+func genNumSystem(w *gen.CodeWriter, data *cldr.CLDR) {
+ numSysData := []systemData{
+ {digitSize: 1, zero: [4]byte{'0'}},
+ }
+
+ for _, ns := range data.Supplemental().NumberingSystems.NumberingSystem {
+ if len(ns.Digits) == 0 {
+ continue
+ }
+ switch ns.Id {
+ case "latn":
+ // hard-wired
+ continue
+ case "hanidec":
+ // non-consecutive digits: treat as "algorithmic"
+ continue
+ }
+
+ zero, sz := utf8.DecodeRuneInString(ns.Digits)
+ if ns.Digits[sz-1]+9 > 0xBF { // 1011 1111: highest continuation byte
+ log.Fatalf("Last byte of zero value overflows for %s", ns.Id)
+ }
+
+ i := rune(0)
+ for _, r := range ns.Digits {
+ // Verify that we can do simple math on the UTF-8 byte sequence
+ // of zero to get the digit.
+ if zero+i != r {
+ // Runes not consecutive.
+ log.Fatalf("Digit %d of %s (%U) is not offset correctly from zero value", i, ns.Id, r)
+ }
+ i++
+ }
+ var x [utf8.UTFMax]byte
+ utf8.EncodeRune(x[:], zero)
+ id := system(len(numSysData))
+ systemMap[ns.Id] = id
+ numSysData = append(numSysData, systemData{
+ id: id,
+ digitSize: byte(sz),
+ zero: x,
+ })
+ }
+ w.WriteVar("numSysData", numSysData)
+
+ algoID := system(len(numSysData))
+ fmt.Fprintln(w, "const (")
+ for _, ns := range data.Supplemental().NumberingSystems.NumberingSystem {
+ id, ok := systemMap[ns.Id]
+ if !ok {
+ id = algoID
+ systemMap[ns.Id] = id
+ algoID++
+ }
+ fmt.Fprintf(w, "num%s = %#x\n", strings.Title(ns.Id), id)
+ }
+ fmt.Fprintln(w, "numNumberSystems")
+ fmt.Fprintln(w, ")")
+
+ fmt.Fprintln(w, "var systemMap = map[string]system{")
+ for _, ns := range data.Supplemental().NumberingSystems.NumberingSystem {
+ fmt.Fprintf(w, "%q: num%s,\n", ns.Id, strings.Title(ns.Id))
+ w.Size += len(ns.Id) + 16 + 1 // very coarse approximation
+ }
+ fmt.Fprintln(w, "}")
+}
+
+func genSymbols(w *gen.CodeWriter, data *cldr.CLDR) {
+ d, err := cldr.ParseDraft(*draft)
+ if err != nil {
+ log.Fatalf("invalid draft level: %v", err)
+ }
+
+ nNumberSystems := system(len(systemMap))
+
+ type symbols [NumSymbolTypes]string
+
+ type key struct {
+ tag compact.ID
+ system system
+ }
+ symbolMap := map[key]*symbols{}
+
+ defaults := map[compact.ID]system{}
+
+ for _, lang := range data.Locales() {
+ ldml := data.RawLDML(lang)
+ if ldml.Numbers == nil {
+ continue
+ }
+ langIndex, ok := compact.FromTag(language.MustParse(lang))
+ if !ok {
+ log.Fatalf("No compact index for language %s", lang)
+ }
+ if d := ldml.Numbers.DefaultNumberingSystem; len(d) > 0 {
+ defaults[langIndex] = getNumberSystem(d[0].Data())
+ }
+
+ syms := cldr.MakeSlice(&ldml.Numbers.Symbols)
+ syms.SelectDraft(d)
+
+ getFirst := func(name string, x interface{}) string {
+ v := reflect.ValueOf(x)
+ slice := cldr.MakeSlice(x)
+ slice.SelectAnyOf("alt", "", "alt")
+ if reflect.Indirect(v).Len() == 0 {
+ return ""
+ } else if reflect.Indirect(v).Len() > 1 {
+ log.Fatalf("%s: multiple values of %q within single symbol not supported.", lang, name)
+ }
+ return reflect.Indirect(v).Index(0).MethodByName("Data").Call(nil)[0].String()
+ }
+
+ for _, sym := range ldml.Numbers.Symbols {
+ if sym.NumberSystem == "" {
+ // This is just linking the default of root to "latn".
+ continue
+ }
+ symbolMap[key{langIndex, getNumberSystem(sym.NumberSystem)}] = &symbols{
+ SymDecimal: getFirst("decimal", &sym.Decimal),
+ SymGroup: getFirst("group", &sym.Group),
+ SymList: getFirst("list", &sym.List),
+ SymPercentSign: getFirst("percentSign", &sym.PercentSign),
+ SymPlusSign: getFirst("plusSign", &sym.PlusSign),
+ SymMinusSign: getFirst("minusSign", &sym.MinusSign),
+ SymExponential: getFirst("exponential", &sym.Exponential),
+ SymSuperscriptingExponent: getFirst("superscriptingExponent", &sym.SuperscriptingExponent),
+ SymPerMille: getFirst("perMille", &sym.PerMille),
+ SymInfinity: getFirst("infinity", &sym.Infinity),
+ SymNan: getFirst("nan", &sym.Nan),
+ SymTimeSeparator: getFirst("timeSeparator", &sym.TimeSeparator),
+ }
+ }
+ }
+
+ // Expand all values.
+ for k, syms := range symbolMap {
+ for t := SymDecimal; t < NumSymbolTypes; t++ {
+ p := k.tag
+ for syms[t] == "" {
+ p = p.Parent()
+ if pSyms, ok := symbolMap[key{p, k.system}]; ok && (*pSyms)[t] != "" {
+ syms[t] = (*pSyms)[t]
+ break
+ }
+ if p == 0 /* und */ {
+ // Default to root, latn.
+ syms[t] = (*symbolMap[key{}])[t]
+ }
+ }
+ }
+ }
+
+ // Unique the symbol sets and write the string data.
+ m := map[symbols]int{}
+ sb := stringset.NewBuilder()
+
+ symIndex := [][NumSymbolTypes]byte{}
+
+ for ns := system(0); ns < nNumberSystems; ns++ {
+ for _, l := range data.Locales() {
+ langIndex, _ := compact.FromTag(language.MustParse(l))
+ s := symbolMap[key{langIndex, ns}]
+ if s == nil {
+ continue
+ }
+ if _, ok := m[*s]; !ok {
+ m[*s] = len(symIndex)
+ sb.Add(s[:]...)
+ var x [NumSymbolTypes]byte
+ for i := SymDecimal; i < NumSymbolTypes; i++ {
+ x[i] = byte(sb.Index((*s)[i]))
+ }
+ symIndex = append(symIndex, x)
+ }
+ }
+ }
+ w.WriteVar("symIndex", symIndex)
+ w.WriteVar("symData", sb.Set())
+
+ // resolveSymbolIndex gets the index from the closest matching locale,
+ // including the locale itself.
+ resolveSymbolIndex := func(langIndex compact.ID, ns system) symOffset {
+ for {
+ if sym := symbolMap[key{langIndex, ns}]; sym != nil {
+ return symOffset(m[*sym])
+ }
+ if langIndex == 0 {
+ return 0 // und, latn
+ }
+ langIndex = langIndex.Parent()
+ }
+ }
+
+ // Create an index with the symbols for each locale for the latn numbering
+ // system. If this is not the default, or the only one, for a locale, we
+ // will overwrite the value later.
+ var langToDefaults [compact.NumCompactTags]symOffset
+ for _, l := range data.Locales() {
+ langIndex, _ := compact.FromTag(language.MustParse(l))
+ langToDefaults[langIndex] = resolveSymbolIndex(langIndex, 0)
+ }
+
+ // Delete redundant entries.
+ for _, l := range data.Locales() {
+ langIndex, _ := compact.FromTag(language.MustParse(l))
+ def := defaults[langIndex]
+ syms := symbolMap[key{langIndex, def}]
+ if syms == nil {
+ continue
+ }
+ for ns := system(0); ns < nNumberSystems; ns++ {
+ if ns == def {
+ continue
+ }
+ if altSyms, ok := symbolMap[key{langIndex, ns}]; ok && *altSyms == *syms {
+ delete(symbolMap, key{langIndex, ns})
+ }
+ }
+ }
+
+ // Create a sorted list of alternatives per language. This will only need to
+ // be referenced if a user specified an alternative numbering system.
+ var langToAlt []altSymData
+ for _, l := range data.Locales() {
+ langIndex, _ := compact.FromTag(language.MustParse(l))
+ start := len(langToAlt)
+ if start >= hasNonLatnMask {
+ log.Fatalf("Number of alternative assignments >= %x", hasNonLatnMask)
+ }
+ // Create the entry for the default value.
+ def := defaults[langIndex]
+ langToAlt = append(langToAlt, altSymData{
+ compactTag: langIndex,
+ system: def,
+ symIndex: resolveSymbolIndex(langIndex, def),
+ })
+
+ for ns := system(0); ns < nNumberSystems; ns++ {
+ if def == ns {
+ continue
+ }
+ if sym := symbolMap[key{langIndex, ns}]; sym != nil {
+ langToAlt = append(langToAlt, altSymData{
+ compactTag: langIndex,
+ system: ns,
+ symIndex: resolveSymbolIndex(langIndex, ns),
+ })
+ }
+ }
+ if def == 0 && len(langToAlt) == start+1 {
+ // No additional data: erase the entry.
+ langToAlt = langToAlt[:start]
+ } else {
+ // Overwrite the entry in langToDefaults.
+ langToDefaults[langIndex] = hasNonLatnMask | symOffset(start)
+ }
+ }
+ w.WriteComment(`
+langToDefaults maps a compact language index to the default numbering system
+and default symbol set`)
+ w.WriteVar("langToDefaults", langToDefaults)
+
+ w.WriteComment(`
+langToAlt is a list of numbering system and symbol set pairs, sorted and
+marked by compact language index.`)
+ w.WriteVar("langToAlt", langToAlt)
+}
+
+// genFormats generates the lookup table for decimal, scientific and percent
+// patterns.
+//
+// CLDR allows for patterns to be different per language for different numbering
+// systems. In practice the patterns are set to be consistent for a language
+// independent of the numbering system. genFormats verifies that no language
+// deviates from this.
+func genFormats(w *gen.CodeWriter, data *cldr.CLDR) {
+ d, err := cldr.ParseDraft(*draft)
+ if err != nil {
+ log.Fatalf("invalid draft level: %v", err)
+ }
+
+ // Fill the first slot with a dummy so we can identify unspecified tags.
+ formats := []number.Pattern{{}}
+ patterns := map[string]int{}
+
+ // TODO: It would be possible to eliminate two of these slices by having
+ // another indirection and store a reference to the combination of patterns.
+ decimal := make([]byte, compact.NumCompactTags)
+ scientific := make([]byte, compact.NumCompactTags)
+ percent := make([]byte, compact.NumCompactTags)
+
+ for _, lang := range data.Locales() {
+ ldml := data.RawLDML(lang)
+ if ldml.Numbers == nil {
+ continue
+ }
+ langIndex, ok := compact.FromTag(language.MustParse(lang))
+ if !ok {
+ log.Fatalf("No compact index for language %s", lang)
+ }
+ type patternSlice []*struct {
+ cldr.Common
+ Numbers string `xml:"numbers,attr"`
+ Count string `xml:"count,attr"`
+ }
+
+ add := func(name string, tags []byte, ps patternSlice) {
+ sl := cldr.MakeSlice(&ps)
+ sl.SelectDraft(d)
+ if len(ps) == 0 {
+ return
+ }
+ if len(ps) > 2 || len(ps) == 2 && ps[0] != ps[1] {
+ log.Fatalf("Inconsistent %d patterns for language %s", name, lang)
+ }
+ s := ps[0].Data()
+
+ index, ok := patterns[s]
+ if !ok {
+ nf, err := number.ParsePattern(s)
+ if err != nil {
+ log.Fatal(err)
+ }
+ index = len(formats)
+ patterns[s] = index
+ formats = append(formats, *nf)
+ }
+ tags[langIndex] = byte(index)
+ }
+
+ for _, df := range ldml.Numbers.DecimalFormats {
+ for _, l := range df.DecimalFormatLength {
+ if l.Type != "" {
+ continue
+ }
+ for _, f := range l.DecimalFormat {
+ add("decimal", decimal, f.Pattern)
+ }
+ }
+ }
+ for _, df := range ldml.Numbers.ScientificFormats {
+ for _, l := range df.ScientificFormatLength {
+ if l.Type != "" {
+ continue
+ }
+ for _, f := range l.ScientificFormat {
+ add("scientific", scientific, f.Pattern)
+ }
+ }
+ }
+ for _, df := range ldml.Numbers.PercentFormats {
+ for _, l := range df.PercentFormatLength {
+ if l.Type != "" {
+ continue
+ }
+ for _, f := range l.PercentFormat {
+ add("percent", percent, f.Pattern)
+ }
+ }
+ }
+ }
+
+ // Complete the parent tag array to reflect inheritance. An index of 0
+ // indicates an unspecified value.
+ for _, data := range [][]byte{decimal, scientific, percent} {
+ for i := range data {
+ p := compact.ID(i)
+ for ; data[p] == 0; p = p.Parent() {
+ }
+ data[i] = data[p]
+ }
+ }
+ w.WriteVar("tagToDecimal", decimal)
+ w.WriteVar("tagToScientific", scientific)
+ w.WriteVar("tagToPercent", percent)
+
+ value := strings.Replace(fmt.Sprintf("%#v", formats), "number.", "", -1)
+ // Break up the lines. This won't give ideal perfect formatting, but it is
+ // better than one huge line.
+ value = strings.Replace(value, ", ", ",\n", -1)
+ fmt.Fprintf(w, "var formats = %s\n", value)
+}
diff --git a/vendor/golang.org/x/text/internal/number/gen_common.go b/vendor/golang.org/x/text/internal/number/gen_common.go
new file mode 100644
index 0000000..b1b41a7
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/gen_common.go
@@ -0,0 +1,59 @@
+// 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
+
+import (
+ "unicode/utf8"
+
+ "golang.org/x/text/internal/language/compact"
+)
+
+// A system identifies a CLDR numbering system.
+type system byte
+
+type systemData struct {
+ id system
+ digitSize byte // number of UTF-8 bytes per digit
+ zero [utf8.UTFMax]byte // UTF-8 sequence of zero digit.
+}
+
+// A SymbolType identifies a symbol of a specific kind.
+type SymbolType int
+
+const (
+ SymDecimal SymbolType = iota
+ SymGroup
+ SymList
+ SymPercentSign
+ SymPlusSign
+ SymMinusSign
+ SymExponential
+ SymSuperscriptingExponent
+ SymPerMille
+ SymInfinity
+ SymNan
+ SymTimeSeparator
+
+ NumSymbolTypes
+)
+
+const hasNonLatnMask = 0x8000
+
+// symOffset is an offset into altSymData if the bit indicated by hasNonLatnMask
+// is not 0 (with this bit masked out), and an offset into symIndex otherwise.
+//
+// TODO: this type can be a byte again if we use an indirection into altsymData
+// and introduce an alt -> offset slice (the length of this will be number of
+// alternatives plus 1). This also allows getting rid of the compactTag field
+// in altSymData. In total this will save about 1K.
+type symOffset uint16
+
+type altSymData struct {
+ compactTag compact.ID
+ symIndex symOffset
+ system system
+}
diff --git a/vendor/golang.org/x/text/internal/number/number.go b/vendor/golang.org/x/text/internal/number/number.go
new file mode 100644
index 0000000..e1d933c
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/number.go
@@ -0,0 +1,152 @@
+// 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 number contains tools and data for formatting numbers.
+package number
+
+import (
+ "unicode/utf8"
+
+ "golang.org/x/text/internal/language/compact"
+ "golang.org/x/text/language"
+)
+
+// Info holds number formatting configuration data.
+type Info struct {
+ system systemData // numbering system information
+ symIndex symOffset // index to symbols
+}
+
+// InfoFromLangID returns a Info for the given compact language identifier and
+// numbering system identifier. If system is the empty string, the default
+// numbering system will be taken for that language.
+func InfoFromLangID(compactIndex compact.ID, numberSystem string) Info {
+ p := langToDefaults[compactIndex]
+ // Lookup the entry for the language.
+ pSymIndex := symOffset(0) // Default: Latin, default symbols
+ system, ok := systemMap[numberSystem]
+ if !ok {
+ // Take the value for the default numbering system. This is by far the
+ // most common case as an alternative numbering system is hardly used.
+ if p&hasNonLatnMask == 0 { // Latn digits.
+ pSymIndex = p
+ } else { // Non-Latn or multiple numbering systems.
+ // Take the first entry from the alternatives list.
+ data := langToAlt[p&^hasNonLatnMask]
+ pSymIndex = data.symIndex
+ system = data.system
+ }
+ } else {
+ langIndex := compactIndex
+ ns := system
+ outerLoop:
+ for ; ; p = langToDefaults[langIndex] {
+ if p&hasNonLatnMask == 0 {
+ if ns == 0 {
+ // The index directly points to the symbol data.
+ pSymIndex = p
+ break
+ }
+ // Move to the parent and retry.
+ langIndex = langIndex.Parent()
+ } else {
+ // The index points to a list of symbol data indexes.
+ for _, e := range langToAlt[p&^hasNonLatnMask:] {
+ if e.compactTag != langIndex {
+ if langIndex == 0 {
+ // The CLDR root defines full symbol information for
+ // all numbering systems (even though mostly by
+ // means of aliases). Fall back to the default entry
+ // for Latn if there is no data for the numbering
+ // system of this language.
+ if ns == 0 {
+ break
+ }
+ // Fall back to Latin and start from the original
+ // language. See
+ // https://unicode.org/reports/tr35/#Locale_Inheritance.
+ ns = numLatn
+ langIndex = compactIndex
+ continue outerLoop
+ }
+ // Fall back to parent.
+ langIndex = langIndex.Parent()
+ } else if e.system == ns {
+ pSymIndex = e.symIndex
+ break outerLoop
+ }
+ }
+ }
+ }
+ }
+ if int(system) >= len(numSysData) { // algorithmic
+ // Will generate ASCII digits in case the user inadvertently calls
+ // WriteDigit or Digit on it.
+ d := numSysData[0]
+ d.id = system
+ return Info{
+ system: d,
+ symIndex: pSymIndex,
+ }
+ }
+ return Info{
+ system: numSysData[system],
+ symIndex: pSymIndex,
+ }
+}
+
+// InfoFromTag returns a Info for the given language tag.
+func InfoFromTag(t language.Tag) Info {
+ return InfoFromLangID(tagToID(t), t.TypeForKey("nu"))
+}
+
+// IsDecimal reports if the numbering system can convert decimal to native
+// symbols one-to-one.
+func (n Info) IsDecimal() bool {
+ return int(n.system.id) < len(numSysData)
+}
+
+// WriteDigit writes the UTF-8 sequence for n corresponding to the given ASCII
+// digit to dst and reports the number of bytes written. dst must be large
+// enough to hold the rune (can be up to utf8.UTFMax bytes).
+func (n Info) WriteDigit(dst []byte, asciiDigit rune) int {
+ copy(dst, n.system.zero[:n.system.digitSize])
+ dst[n.system.digitSize-1] += byte(asciiDigit - '0')
+ return int(n.system.digitSize)
+}
+
+// AppendDigit appends the UTF-8 sequence for n corresponding to the given digit
+// to dst and reports the number of bytes written. dst must be large enough to
+// hold the rune (can be up to utf8.UTFMax bytes).
+func (n Info) AppendDigit(dst []byte, digit byte) []byte {
+ dst = append(dst, n.system.zero[:n.system.digitSize]...)
+ dst[len(dst)-1] += digit
+ return dst
+}
+
+// Digit returns the digit for the numbering system for the corresponding ASCII
+// value. For example, ni.Digit('3') could return '三'. Note that the argument
+// is the rune constant '3', which equals 51, not the integer constant 3.
+func (n Info) Digit(asciiDigit rune) rune {
+ var x [utf8.UTFMax]byte
+ n.WriteDigit(x[:], asciiDigit)
+ r, _ := utf8.DecodeRune(x[:])
+ return r
+}
+
+// Symbol returns the string for the given symbol type.
+func (n Info) Symbol(t SymbolType) string {
+ return symData.Elem(int(symIndex[n.symIndex][t]))
+}
+
+func formatForLang(t language.Tag, index []byte) *Pattern {
+ return &formats[index[tagToID(t)]]
+}
+
+func tagToID(t language.Tag) compact.ID {
+ id, _ := compact.RegionalID(compact.Tag(t))
+ return id
+}
diff --git a/vendor/golang.org/x/text/internal/number/number_test.go b/vendor/golang.org/x/text/internal/number/number_test.go
new file mode 100644
index 0000000..cbc28ab
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/number_test.go
@@ -0,0 +1,104 @@
+// 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 (
+ "fmt"
+ "testing"
+
+ "golang.org/x/text/internal/testtext"
+ "golang.org/x/text/language"
+)
+
+func TestInfo(t *testing.T) {
+ testCases := []struct {
+ lang string
+ sym SymbolType
+ wantSym string
+ wantNine rune
+ }{
+ {"und", SymDecimal, ".", '9'},
+ {"de", SymGroup, ".", '9'},
+ {"de-BE", SymGroup, ".", '9'}, // inherits from de (no number data in CLDR)
+ {"de-BE-oxendict", SymGroup, ".", '9'}, // inherits from de (no compact index)
+
+ // U+096F DEVANAGARI DIGIT NINE ('९')
+ {"de-BE-u-nu-deva", SymGroup, ".", '\u096f'}, // miss -> latn -> de
+ {"de-Cyrl-BE", SymGroup, ",", '9'}, // inherits from root
+ {"de-CH", SymGroup, "’", '9'}, // overrides values in de
+ {"de-CH-oxendict", SymGroup, "’", '9'}, // inherits from de-CH (no compact index)
+ {"de-CH-u-nu-deva", SymGroup, "’", '\u096f'}, // miss -> latn -> de-CH
+
+ {"bn-u-nu-beng", SymGroup, ",", '\u09ef'},
+ {"bn-u-nu-deva", SymGroup, ",", '\u096f'},
+ {"bn-u-nu-latn", SymGroup, ",", '9'},
+
+ {"pa", SymExponential, "E", '9'},
+
+ // "×۱۰^" -> U+00d7 U+06f1 U+06f0^"
+ // U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO
+ // U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE
+ // U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE
+ {"pa-u-nu-arabext", SymExponential, "\u00d7\u06f1\u06f0^", '\u06f9'},
+
+ // "གྲངས་མེད" - > U+0f42 U+0fb2 U+0f44 U+0f66 U+0f0b U+0f58 U+0f7a U+0f51
+ // Examples:
+ // U+0F29 TIBETAN DIGIT NINE (༩)
+ {"dz", SymInfinity, "\u0f42\u0fb2\u0f44\u0f66\u0f0b\u0f58\u0f7a\u0f51", '\u0f29'}, // defaults to tibt
+ {"dz-u-nu-latn", SymInfinity, "∞", '9'}, // select alternative
+ {"dz-u-nu-tibt", SymInfinity, "\u0f42\u0fb2\u0f44\u0f66\u0f0b\u0f58\u0f7a\u0f51", '\u0f29'},
+ {"en-u-nu-tibt", SymInfinity, "∞", '\u0f29'},
+
+ // algorithmic number systems fall back to ASCII if Digits is used.
+ {"en-u-nu-hanidec", SymPlusSign, "+", '9'},
+ {"en-u-nu-roman", SymPlusSign, "+", '9'},
+ }
+ for _, tc := range testCases {
+ t.Run(fmt.Sprintf("%s:%v", tc.lang, tc.sym), func(t *testing.T) {
+ info := InfoFromTag(language.MustParse(tc.lang))
+ if got := info.Symbol(tc.sym); got != tc.wantSym {
+ t.Errorf("sym: got %q; want %q", got, tc.wantSym)
+ }
+ if got := info.Digit('9'); got != tc.wantNine {
+ t.Errorf("Digit(9): got %+q; want %+q", got, tc.wantNine)
+ }
+ var buf [4]byte
+ if got := string(buf[:info.WriteDigit(buf[:], '9')]); got != string(tc.wantNine) {
+ t.Errorf("WriteDigit(9): got %+q; want %+q", got, tc.wantNine)
+ }
+ if got := string(info.AppendDigit([]byte{}, 9)); got != string(tc.wantNine) {
+ t.Errorf("AppendDigit(9): got %+q; want %+q", got, tc.wantNine)
+ }
+ })
+ }
+}
+
+func TestFormats(t *testing.T) {
+ testCases := []struct {
+ lang string
+ pattern string
+ index []byte
+ }{
+ {"en", "#,##0.###", tagToDecimal},
+ {"de", "#,##0.###", tagToDecimal},
+ {"de-CH", "#,##0.###", tagToDecimal},
+ {"pa", "#,##,##0.###", tagToDecimal},
+ {"pa-Arab", "#,##0.###", tagToDecimal}, // Does NOT inherit from pa!
+ {"mr", "#,##,##0.###", tagToDecimal},
+ {"mr-IN", "#,##,##0.###", tagToDecimal}, // Inherits from mr.
+ {"nl", "#E0", tagToScientific},
+ {"nl-MX", "#E0", tagToScientific}, // Inherits through Tag.Parent.
+ {"zgh", "#,##0 %", tagToPercent},
+ }
+ for _, tc := range testCases {
+ testtext.Run(t, tc.lang, func(t *testing.T) {
+ got := formatForLang(language.MustParse(tc.lang), tc.index)
+ want, _ := ParsePattern(tc.pattern)
+ if *got != *want {
+ t.Errorf("\ngot %#v;\nwant %#v", got, want)
+ }
+ })
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/number/pattern.go b/vendor/golang.org/x/text/internal/number/pattern.go
new file mode 100644
index 0000000..06e5955
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/pattern.go
@@ -0,0 +1,485 @@
+// Copyright 2015 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 (
+ "errors"
+ "unicode/utf8"
+)
+
+// This file contains a parser for the CLDR number patterns as described in
+// https://unicode.org/reports/tr35/tr35-numbers.html#Number_Format_Patterns.
+//
+// The following BNF is derived from this standard.
+//
+// pattern := subpattern (';' subpattern)?
+// subpattern := affix? number exponent? affix?
+// number := decimal | sigDigits
+// decimal := '#'* '0'* ('.' fraction)? | '#' | '0'
+// fraction := '0'* '#'*
+// sigDigits := '#'* '@' '@'* '#'*
+// exponent := 'E' '+'? '0'* '0'
+// padSpec := '*' \L
+//
+// Notes:
+// - An affix pattern may contain any runes, but runes with special meaning
+// should be escaped.
+// - Sequences of digits, '#', and '@' in decimal and sigDigits may have
+// interstitial commas.
+
+// TODO: replace special characters in affixes (-, +, ¤) with control codes.
+
+// Pattern holds information for formatting numbers. It is designed to hold
+// information from CLDR number patterns.
+//
+// This pattern is precompiled for all patterns for all languages. Even though
+// the number of patterns is not very large, we want to keep this small.
+//
+// This type is only intended for internal use.
+type Pattern struct {
+ RoundingContext
+
+ Affix string // includes prefix and suffix. First byte is prefix length.
+ Offset uint16 // Offset into Affix for prefix and suffix
+ NegOffset uint16 // Offset into Affix for negative prefix and suffix or 0.
+ PadRune rune
+ FormatWidth uint16
+
+ GroupingSize [2]uint8
+ Flags PatternFlag
+}
+
+// A RoundingContext indicates how a number should be converted to digits.
+// It contains all information needed to determine the "visible digits" as
+// required by the pluralization rules.
+type RoundingContext struct {
+ // TODO: unify these two fields so that there is a more unambiguous meaning
+ // of how precision is handled.
+ MaxSignificantDigits int16 // -1 is unlimited
+ MaxFractionDigits int16 // -1 is unlimited
+
+ Increment uint32
+ IncrementScale uint8 // May differ from printed scale.
+
+ Mode RoundingMode
+
+ DigitShift uint8 // Number of decimals to shift. Used for % and ‰.
+
+ // Number of digits.
+ MinIntegerDigits uint8
+
+ MaxIntegerDigits uint8
+ MinFractionDigits uint8
+ MinSignificantDigits uint8
+
+ MinExponentDigits uint8
+}
+
+// RoundSignificantDigits returns the number of significant digits an
+// implementation of Convert may round to or n < 0 if there is no maximum or
+// a maximum is not recommended.
+func (r *RoundingContext) RoundSignificantDigits() (n int) {
+ if r.MaxFractionDigits == 0 && r.MaxSignificantDigits > 0 {
+ return int(r.MaxSignificantDigits)
+ } else if r.isScientific() && r.MaxIntegerDigits == 1 {
+ if r.MaxSignificantDigits == 0 ||
+ int(r.MaxFractionDigits+1) == int(r.MaxSignificantDigits) {
+ // Note: don't add DigitShift: it is only used for decimals.
+ return int(r.MaxFractionDigits) + 1
+ }
+ }
+ return -1
+}
+
+// RoundFractionDigits returns the number of fraction digits an implementation
+// of Convert may round to or n < 0 if there is no maximum or a maximum is not
+// recommended.
+func (r *RoundingContext) RoundFractionDigits() (n int) {
+ if r.MinExponentDigits == 0 &&
+ r.MaxSignificantDigits == 0 &&
+ r.MaxFractionDigits >= 0 {
+ return int(r.MaxFractionDigits) + int(r.DigitShift)
+ }
+ return -1
+}
+
+// SetScale fixes the RoundingContext to a fixed number of fraction digits.
+func (r *RoundingContext) SetScale(scale int) {
+ r.MinFractionDigits = uint8(scale)
+ r.MaxFractionDigits = int16(scale)
+}
+
+func (r *RoundingContext) SetPrecision(prec int) {
+ r.MaxSignificantDigits = int16(prec)
+}
+
+func (r *RoundingContext) isScientific() bool {
+ return r.MinExponentDigits > 0
+}
+
+func (f *Pattern) needsSep(pos int) bool {
+ p := pos - 1
+ size := int(f.GroupingSize[0])
+ if size == 0 || p == 0 {
+ return false
+ }
+ if p == size {
+ return true
+ }
+ if p -= size; p < 0 {
+ return false
+ }
+ // TODO: make second groupingsize the same as first if 0 so that we can
+ // avoid this check.
+ if x := int(f.GroupingSize[1]); x != 0 {
+ size = x
+ }
+ return p%size == 0
+}
+
+// A PatternFlag is a bit mask for the flag field of a Pattern.
+type PatternFlag uint8
+
+const (
+ AlwaysSign PatternFlag = 1 << iota
+ ElideSign // Use space instead of plus sign. AlwaysSign must be true.
+ AlwaysExpSign
+ AlwaysDecimalSeparator
+ ParenthesisForNegative // Common pattern. Saves space.
+
+ PadAfterNumber
+ PadAfterAffix
+
+ PadBeforePrefix = 0 // Default
+ PadAfterPrefix = PadAfterAffix
+ PadBeforeSuffix = PadAfterNumber
+ PadAfterSuffix = PadAfterNumber | PadAfterAffix
+ PadMask = PadAfterNumber | PadAfterAffix
+)
+
+type parser struct {
+ *Pattern
+
+ leadingSharps int
+
+ pos int
+ err error
+ doNotTerminate bool
+ groupingCount uint
+ hasGroup bool
+ buf []byte
+}
+
+func (p *parser) setError(err error) {
+ if p.err == nil {
+ p.err = err
+ }
+}
+
+func (p *parser) updateGrouping() {
+ if p.hasGroup &&
+ 0 < p.groupingCount && p.groupingCount < 255 {
+ p.GroupingSize[1] = p.GroupingSize[0]
+ p.GroupingSize[0] = uint8(p.groupingCount)
+ }
+ p.groupingCount = 0
+ p.hasGroup = true
+}
+
+var (
+ // TODO: more sensible and localizeable error messages.
+ errMultiplePadSpecifiers = errors.New("format: pattern has multiple pad specifiers")
+ errInvalidPadSpecifier = errors.New("format: invalid pad specifier")
+ errInvalidQuote = errors.New("format: invalid quote")
+ errAffixTooLarge = errors.New("format: prefix or suffix exceeds maximum UTF-8 length of 256 bytes")
+ errDuplicatePercentSign = errors.New("format: duplicate percent sign")
+ errDuplicatePermilleSign = errors.New("format: duplicate permille sign")
+ errUnexpectedEnd = errors.New("format: unexpected end of pattern")
+)
+
+// ParsePattern extracts formatting information from a CLDR number pattern.
+//
+// See https://unicode.org/reports/tr35/tr35-numbers.html#Number_Format_Patterns.
+func ParsePattern(s string) (f *Pattern, err error) {
+ p := parser{Pattern: &Pattern{}}
+
+ s = p.parseSubPattern(s)
+
+ if s != "" {
+ // Parse negative sub pattern.
+ if s[0] != ';' {
+ p.setError(errors.New("format: error parsing first sub pattern"))
+ return nil, p.err
+ }
+ neg := parser{Pattern: &Pattern{}} // just for extracting the affixes.
+ s = neg.parseSubPattern(s[len(";"):])
+ p.NegOffset = uint16(len(p.buf))
+ p.buf = append(p.buf, neg.buf...)
+ }
+ if s != "" {
+ p.setError(errors.New("format: spurious characters at end of pattern"))
+ }
+ if p.err != nil {
+ return nil, p.err
+ }
+ if affix := string(p.buf); affix == "\x00\x00" || affix == "\x00\x00\x00\x00" {
+ // No prefix or suffixes.
+ p.NegOffset = 0
+ } else {
+ p.Affix = affix
+ }
+ if p.Increment == 0 {
+ p.IncrementScale = 0
+ }
+ return p.Pattern, nil
+}
+
+func (p *parser) parseSubPattern(s string) string {
+ s = p.parsePad(s, PadBeforePrefix)
+ s = p.parseAffix(s)
+ s = p.parsePad(s, PadAfterPrefix)
+
+ s = p.parse(p.number, s)
+ p.updateGrouping()
+
+ s = p.parsePad(s, PadBeforeSuffix)
+ s = p.parseAffix(s)
+ s = p.parsePad(s, PadAfterSuffix)
+ return s
+}
+
+func (p *parser) parsePad(s string, f PatternFlag) (tail string) {
+ if len(s) >= 2 && s[0] == '*' {
+ r, sz := utf8.DecodeRuneInString(s[1:])
+ if p.PadRune != 0 {
+ p.err = errMultiplePadSpecifiers
+ } else {
+ p.Flags |= f
+ p.PadRune = r
+ }
+ return s[1+sz:]
+ }
+ return s
+}
+
+func (p *parser) parseAffix(s string) string {
+ x := len(p.buf)
+ p.buf = append(p.buf, 0) // placeholder for affix length
+
+ s = p.parse(p.affix, s)
+
+ n := len(p.buf) - x - 1
+ if n > 0xFF {
+ p.setError(errAffixTooLarge)
+ }
+ p.buf[x] = uint8(n)
+ return s
+}
+
+// state implements a state transition. It returns the new state. A state
+// function may set an error on the parser or may simply return on an incorrect
+// token and let the next phase fail.
+type state func(r rune) state
+
+// parse repeatedly applies a state function on the given string until a
+// termination condition is reached.
+func (p *parser) parse(fn state, s string) (tail string) {
+ for i, r := range s {
+ p.doNotTerminate = false
+ if fn = fn(r); fn == nil || p.err != nil {
+ return s[i:]
+ }
+ p.FormatWidth++
+ }
+ if p.doNotTerminate {
+ p.setError(errUnexpectedEnd)
+ }
+ return ""
+}
+
+func (p *parser) affix(r rune) state {
+ switch r {
+ case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '#', '@', '.', '*', ',', ';':
+ return nil
+ case '\'':
+ p.FormatWidth--
+ return p.escapeFirst
+ case '%':
+ if p.DigitShift != 0 {
+ p.setError(errDuplicatePercentSign)
+ }
+ p.DigitShift = 2
+ case '\u2030': // ‰ Per mille
+ if p.DigitShift != 0 {
+ p.setError(errDuplicatePermilleSign)
+ }
+ p.DigitShift = 3
+ // TODO: handle currency somehow: ¤, ¤¤, ¤¤¤, ¤¤¤¤
+ }
+ p.buf = append(p.buf, string(r)...)
+ return p.affix
+}
+
+func (p *parser) escapeFirst(r rune) state {
+ switch r {
+ case '\'':
+ p.buf = append(p.buf, "\\'"...)
+ return p.affix
+ default:
+ p.buf = append(p.buf, '\'')
+ p.buf = append(p.buf, string(r)...)
+ }
+ return p.escape
+}
+
+func (p *parser) escape(r rune) state {
+ switch r {
+ case '\'':
+ p.FormatWidth--
+ p.buf = append(p.buf, '\'')
+ return p.affix
+ default:
+ p.buf = append(p.buf, string(r)...)
+ }
+ return p.escape
+}
+
+// number parses a number. The BNF says the integer part should always have
+// a '0', but that does not appear to be the case according to the rest of the
+// documentation. We will allow having only '#' numbers.
+func (p *parser) number(r rune) state {
+ switch r {
+ case '#':
+ p.groupingCount++
+ p.leadingSharps++
+ case '@':
+ p.groupingCount++
+ p.leadingSharps = 0
+ p.MaxFractionDigits = -1
+ return p.sigDigits(r)
+ case ',':
+ if p.leadingSharps == 0 { // no leading commas
+ return nil
+ }
+ p.updateGrouping()
+ case 'E':
+ p.MaxIntegerDigits = uint8(p.leadingSharps)
+ return p.exponent
+ case '.': // allow ".##" etc.
+ p.updateGrouping()
+ return p.fraction
+ case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
+ return p.integer(r)
+ default:
+ return nil
+ }
+ return p.number
+}
+
+func (p *parser) integer(r rune) state {
+ if !('0' <= r && r <= '9') {
+ var next state
+ switch r {
+ case 'E':
+ if p.leadingSharps > 0 {
+ p.MaxIntegerDigits = uint8(p.leadingSharps) + p.MinIntegerDigits
+ }
+ next = p.exponent
+ case '.':
+ next = p.fraction
+ case ',':
+ next = p.integer
+ }
+ p.updateGrouping()
+ return next
+ }
+ p.Increment = p.Increment*10 + uint32(r-'0')
+ p.groupingCount++
+ p.MinIntegerDigits++
+ return p.integer
+}
+
+func (p *parser) sigDigits(r rune) state {
+ switch r {
+ case '@':
+ p.groupingCount++
+ p.MaxSignificantDigits++
+ p.MinSignificantDigits++
+ case '#':
+ return p.sigDigitsFinal(r)
+ case 'E':
+ p.updateGrouping()
+ return p.normalizeSigDigitsWithExponent()
+ default:
+ p.updateGrouping()
+ return nil
+ }
+ return p.sigDigits
+}
+
+func (p *parser) sigDigitsFinal(r rune) state {
+ switch r {
+ case '#':
+ p.groupingCount++
+ p.MaxSignificantDigits++
+ case 'E':
+ p.updateGrouping()
+ return p.normalizeSigDigitsWithExponent()
+ default:
+ p.updateGrouping()
+ return nil
+ }
+ return p.sigDigitsFinal
+}
+
+func (p *parser) normalizeSigDigitsWithExponent() state {
+ p.MinIntegerDigits, p.MaxIntegerDigits = 1, 1
+ p.MinFractionDigits = p.MinSignificantDigits - 1
+ p.MaxFractionDigits = p.MaxSignificantDigits - 1
+ p.MinSignificantDigits, p.MaxSignificantDigits = 0, 0
+ return p.exponent
+}
+
+func (p *parser) fraction(r rune) state {
+ switch r {
+ case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
+ p.Increment = p.Increment*10 + uint32(r-'0')
+ p.IncrementScale++
+ p.MinFractionDigits++
+ p.MaxFractionDigits++
+ case '#':
+ p.MaxFractionDigits++
+ case 'E':
+ if p.leadingSharps > 0 {
+ p.MaxIntegerDigits = uint8(p.leadingSharps) + p.MinIntegerDigits
+ }
+ return p.exponent
+ default:
+ return nil
+ }
+ return p.fraction
+}
+
+func (p *parser) exponent(r rune) state {
+ switch r {
+ case '+':
+ // Set mode and check it wasn't already set.
+ if p.Flags&AlwaysExpSign != 0 || p.MinExponentDigits > 0 {
+ break
+ }
+ p.Flags |= AlwaysExpSign
+ p.doNotTerminate = true
+ return p.exponent
+ case '0':
+ p.MinExponentDigits++
+ return p.exponent
+ }
+ // termination condition
+ if p.MinExponentDigits == 0 {
+ p.setError(errors.New("format: need at least one digit"))
+ }
+ return nil
+}
diff --git a/vendor/golang.org/x/text/internal/number/pattern_test.go b/vendor/golang.org/x/text/internal/number/pattern_test.go
new file mode 100644
index 0000000..a7517d0
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/pattern_test.go
@@ -0,0 +1,438 @@
+// Copyright 2015 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 (
+ "reflect"
+ "testing"
+ "unsafe"
+)
+
+var testCases = []struct {
+ pat string
+ want *Pattern
+}{{
+ "#",
+ &Pattern{
+ FormatWidth: 1,
+ // TODO: Should MinIntegerDigits be 1?
+ },
+}, {
+ "0",
+ &Pattern{
+ FormatWidth: 1,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ },
+ },
+}, {
+ "+0",
+ &Pattern{
+ Affix: "\x01+\x00",
+ FormatWidth: 2,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ },
+ },
+}, {
+ "0+",
+ &Pattern{
+ Affix: "\x00\x01+",
+ FormatWidth: 2,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ },
+ },
+}, {
+ "0000",
+ &Pattern{
+ FormatWidth: 4,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 4,
+ },
+ },
+}, {
+ ".#",
+ &Pattern{
+ FormatWidth: 2,
+ RoundingContext: RoundingContext{
+ MaxFractionDigits: 1,
+ },
+ },
+}, {
+ "#0.###",
+ &Pattern{
+ FormatWidth: 6,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MaxFractionDigits: 3,
+ },
+ },
+}, {
+ "#0.######",
+ &Pattern{
+ FormatWidth: 9,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MaxFractionDigits: 6,
+ },
+ },
+}, {
+ "#,0",
+ &Pattern{
+ FormatWidth: 3,
+ GroupingSize: [2]uint8{1, 0},
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ },
+ },
+}, {
+ "#,0.00",
+ &Pattern{
+ FormatWidth: 6,
+ GroupingSize: [2]uint8{1, 0},
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MinFractionDigits: 2,
+ MaxFractionDigits: 2,
+ },
+ },
+}, {
+ "#,##0.###",
+ &Pattern{
+ FormatWidth: 9,
+ GroupingSize: [2]uint8{3, 0},
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MaxFractionDigits: 3,
+ },
+ },
+}, {
+ "#,##,##0.###",
+ &Pattern{
+ FormatWidth: 12,
+ GroupingSize: [2]uint8{3, 2},
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MaxFractionDigits: 3,
+ },
+ },
+}, {
+ // Ignore additional separators.
+ "#,####,##,##0.###",
+ &Pattern{
+ FormatWidth: 17,
+ GroupingSize: [2]uint8{3, 2},
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MaxFractionDigits: 3,
+ },
+ },
+}, {
+ "#E0",
+ &Pattern{
+ FormatWidth: 3,
+ RoundingContext: RoundingContext{
+ MaxIntegerDigits: 1,
+ MinExponentDigits: 1,
+ },
+ },
+}, {
+ // At least one exponent digit is required. As long as this is true, one can
+ // determine that scientific rendering is needed if MinExponentDigits > 0.
+ "#E#",
+ nil,
+}, {
+ "0E0",
+ &Pattern{
+ FormatWidth: 3,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MinExponentDigits: 1,
+ },
+ },
+}, {
+ "##0.###E00",
+ &Pattern{
+ FormatWidth: 10,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MaxIntegerDigits: 3,
+ MaxFractionDigits: 3,
+ MinExponentDigits: 2,
+ },
+ },
+}, {
+ "##00.0#E0",
+ &Pattern{
+ FormatWidth: 9,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 2,
+ MaxIntegerDigits: 4,
+ MinFractionDigits: 1,
+ MaxFractionDigits: 2,
+ MinExponentDigits: 1,
+ },
+ },
+}, {
+ "#00.0E+0",
+ &Pattern{
+ FormatWidth: 8,
+ Flags: AlwaysExpSign,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 2,
+ MaxIntegerDigits: 3,
+ MinFractionDigits: 1,
+ MaxFractionDigits: 1,
+ MinExponentDigits: 1,
+ },
+ },
+}, {
+ "0.0E++0",
+ nil,
+}, {
+ "#0E+",
+ nil,
+}, {
+ // significant digits
+ "@",
+ &Pattern{
+ FormatWidth: 1,
+ RoundingContext: RoundingContext{
+ MinSignificantDigits: 1,
+ MaxSignificantDigits: 1,
+ MaxFractionDigits: -1,
+ },
+ },
+}, {
+ // significant digits
+ "@@@@",
+ &Pattern{
+ FormatWidth: 4,
+ RoundingContext: RoundingContext{
+ MinSignificantDigits: 4,
+ MaxSignificantDigits: 4,
+ MaxFractionDigits: -1,
+ },
+ },
+}, {
+ "@###",
+ &Pattern{
+ FormatWidth: 4,
+ RoundingContext: RoundingContext{
+ MinSignificantDigits: 1,
+ MaxSignificantDigits: 4,
+ MaxFractionDigits: -1,
+ },
+ },
+}, {
+ // Exponents in significant digits mode gets normalized.
+ "@@E0",
+ &Pattern{
+ FormatWidth: 4,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MaxIntegerDigits: 1,
+ MinFractionDigits: 1,
+ MaxFractionDigits: 1,
+ MinExponentDigits: 1,
+ },
+ },
+}, {
+ "@###E00",
+ &Pattern{
+ FormatWidth: 7,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MaxIntegerDigits: 1,
+ MinFractionDigits: 0,
+ MaxFractionDigits: 3,
+ MinExponentDigits: 2,
+ },
+ },
+}, {
+ // The significant digits mode does not allow fractions.
+ "@###.#E0",
+ nil,
+}, {
+ //alternative negative pattern
+ "#0.###;(#0.###)",
+ &Pattern{
+ Affix: "\x00\x00\x01(\x01)",
+ NegOffset: 2,
+ FormatWidth: 6,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MaxFractionDigits: 3,
+ },
+ },
+}, {
+ // Rounding increment
+ "1.05",
+ &Pattern{
+ FormatWidth: 4,
+ RoundingContext: RoundingContext{
+ Increment: 105,
+ IncrementScale: 2,
+ MinIntegerDigits: 1,
+ MinFractionDigits: 2,
+ MaxFractionDigits: 2,
+ },
+ },
+}, {
+ // Rounding increment with grouping
+ "1,05",
+ &Pattern{
+ FormatWidth: 4,
+ GroupingSize: [2]uint8{2, 0},
+ RoundingContext: RoundingContext{
+ Increment: 105,
+ IncrementScale: 0,
+ MinIntegerDigits: 3,
+ MinFractionDigits: 0,
+ MaxFractionDigits: 0,
+ },
+ },
+}, {
+ "0.0%",
+ &Pattern{
+ Affix: "\x00\x01%",
+ FormatWidth: 4,
+ RoundingContext: RoundingContext{
+ DigitShift: 2,
+ MinIntegerDigits: 1,
+ MinFractionDigits: 1,
+ MaxFractionDigits: 1,
+ },
+ },
+}, {
+ "0.0‰",
+ &Pattern{
+ Affix: "\x00\x03‰",
+ FormatWidth: 4,
+ RoundingContext: RoundingContext{
+ DigitShift: 3,
+ MinIntegerDigits: 1,
+ MinFractionDigits: 1,
+ MaxFractionDigits: 1,
+ },
+ },
+}, {
+ "#,##0.00¤",
+ &Pattern{
+ Affix: "\x00\x02¤",
+ FormatWidth: 9,
+ GroupingSize: [2]uint8{3, 0},
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 1,
+ MinFractionDigits: 2,
+ MaxFractionDigits: 2,
+ },
+ },
+}, {
+ "#,##0.00 ¤;(#,##0.00 ¤)",
+ &Pattern{Affix: "\x00\x04\u00a0¤\x01(\x05\u00a0¤)",
+ NegOffset: 6,
+ FormatWidth: 10,
+ GroupingSize: [2]uint8{3, 0},
+ RoundingContext: RoundingContext{
+ DigitShift: 0,
+ MinIntegerDigits: 1,
+ MinFractionDigits: 2,
+ MaxFractionDigits: 2,
+ },
+ },
+}, {
+ // padding
+ "*x#",
+ &Pattern{
+ PadRune: 'x',
+ FormatWidth: 1,
+ },
+}, {
+ // padding
+ "#*x",
+ &Pattern{
+ PadRune: 'x',
+ FormatWidth: 1,
+ Flags: PadBeforeSuffix,
+ },
+}, {
+ "*xpre#suf",
+ &Pattern{
+ Affix: "\x03pre\x03suf",
+ PadRune: 'x',
+ FormatWidth: 7,
+ },
+}, {
+ "pre*x#suf",
+ &Pattern{
+ Affix: "\x03pre\x03suf",
+ PadRune: 'x',
+ FormatWidth: 7,
+ Flags: PadAfterPrefix,
+ },
+}, {
+ "pre#*xsuf",
+ &Pattern{
+ Affix: "\x03pre\x03suf",
+ PadRune: 'x',
+ FormatWidth: 7,
+ Flags: PadBeforeSuffix,
+ },
+}, {
+ "pre#suf*x",
+ &Pattern{
+ Affix: "\x03pre\x03suf",
+ PadRune: 'x',
+ FormatWidth: 7,
+ Flags: PadAfterSuffix,
+ },
+}, {
+ `* #0 o''clock`,
+ &Pattern{Affix: "\x00\x09 o\\'clock",
+ FormatWidth: 10,
+ PadRune: 32,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 0x1,
+ },
+ },
+}, {
+ `'123'* #0'456'`,
+ &Pattern{Affix: "\x05'123'\x05'456'",
+ FormatWidth: 8,
+ PadRune: 32,
+ RoundingContext: RoundingContext{
+ MinIntegerDigits: 0x1,
+ },
+ Flags: PadAfterPrefix},
+}, {
+ // no duplicate padding
+ "*xpre#suf*x", nil,
+}, {
+ // no duplicate padding
+ "*xpre#suf*x", nil,
+}}
+
+func TestParsePattern(t *testing.T) {
+ for i, tc := range testCases {
+ t.Run(tc.pat, func(t *testing.T) {
+ f, err := ParsePattern(tc.pat)
+ if !reflect.DeepEqual(f, tc.want) {
+ t.Errorf("%d:%s:\ngot %#v;\nwant %#v", i, tc.pat, f, tc.want)
+ }
+ if got, want := err != nil, tc.want == nil; got != want {
+ t.Errorf("%d:%s:error: got %v; want %v", i, tc.pat, err, want)
+ }
+ })
+ }
+}
+
+func TestPatternSize(t *testing.T) {
+ if sz := unsafe.Sizeof(Pattern{}); sz > 56 {
+ t.Errorf("got %d; want <= 56", sz)
+ }
+
+}
diff --git a/vendor/golang.org/x/text/internal/number/roundingmode_string.go b/vendor/golang.org/x/text/internal/number/roundingmode_string.go
new file mode 100644
index 0000000..f5cc574
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/roundingmode_string.go
@@ -0,0 +1,16 @@
+// Code generated by "stringer -type RoundingMode"; DO NOT EDIT.
+
+package number
+
+import "strconv"
+
+const _RoundingMode_name = "ToNearestEvenToNearestZeroToNearestAwayToPositiveInfToNegativeInfToZeroAwayFromZeronumModes"
+
+var _RoundingMode_index = [...]uint8{0, 13, 26, 39, 52, 65, 71, 83, 91}
+
+func (i RoundingMode) String() string {
+ if i >= RoundingMode(len(_RoundingMode_index)-1) {
+ return "RoundingMode(" + strconv.FormatInt(int64(i), 10) + ")"
+ }
+ return _RoundingMode_name[_RoundingMode_index[i]:_RoundingMode_index[i+1]]
+}
diff --git a/vendor/golang.org/x/text/internal/number/tables.go b/vendor/golang.org/x/text/internal/number/tables.go
new file mode 100644
index 0000000..0668a37
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/tables.go
@@ -0,0 +1,1219 @@
+// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
+
+package number
+
+import "golang.org/x/text/internal/stringset"
+
+// CLDRVersion is the CLDR version from which the tables in this package are derived.
+const CLDRVersion = "32"
+
+var numSysData = []systemData{ // 59 elements
+ 0: {id: 0x0, digitSize: 0x1, zero: [4]uint8{0x30, 0x0, 0x0, 0x0}},
+ 1: {id: 0x1, digitSize: 0x4, zero: [4]uint8{0xf0, 0x9e, 0xa5, 0x90}},
+ 2: {id: 0x2, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0x9c, 0xb0}},
+ 3: {id: 0x3, digitSize: 0x2, zero: [4]uint8{0xd9, 0xa0, 0x0, 0x0}},
+ 4: {id: 0x4, digitSize: 0x2, zero: [4]uint8{0xdb, 0xb0, 0x0, 0x0}},
+ 5: {id: 0x5, digitSize: 0x3, zero: [4]uint8{0xe1, 0xad, 0x90, 0x0}},
+ 6: {id: 0x6, digitSize: 0x3, zero: [4]uint8{0xe0, 0xa7, 0xa6, 0x0}},
+ 7: {id: 0x7, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0xb1, 0x90}},
+ 8: {id: 0x8, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0x81, 0xa6}},
+ 9: {id: 0x9, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0x84, 0xb6}},
+ 10: {id: 0xa, digitSize: 0x3, zero: [4]uint8{0xea, 0xa9, 0x90, 0x0}},
+ 11: {id: 0xb, digitSize: 0x3, zero: [4]uint8{0xe0, 0xa5, 0xa6, 0x0}},
+ 12: {id: 0xc, digitSize: 0x3, zero: [4]uint8{0xef, 0xbc, 0x90, 0x0}},
+ 13: {id: 0xd, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0xb5, 0x90}},
+ 14: {id: 0xe, digitSize: 0x3, zero: [4]uint8{0xe0, 0xab, 0xa6, 0x0}},
+ 15: {id: 0xf, digitSize: 0x3, zero: [4]uint8{0xe0, 0xa9, 0xa6, 0x0}},
+ 16: {id: 0x10, digitSize: 0x4, zero: [4]uint8{0xf0, 0x96, 0xad, 0x90}},
+ 17: {id: 0x11, digitSize: 0x3, zero: [4]uint8{0xea, 0xa7, 0x90, 0x0}},
+ 18: {id: 0x12, digitSize: 0x3, zero: [4]uint8{0xea, 0xa4, 0x80, 0x0}},
+ 19: {id: 0x13, digitSize: 0x3, zero: [4]uint8{0xe1, 0x9f, 0xa0, 0x0}},
+ 20: {id: 0x14, digitSize: 0x3, zero: [4]uint8{0xe0, 0xb3, 0xa6, 0x0}},
+ 21: {id: 0x15, digitSize: 0x3, zero: [4]uint8{0xe1, 0xaa, 0x80, 0x0}},
+ 22: {id: 0x16, digitSize: 0x3, zero: [4]uint8{0xe1, 0xaa, 0x90, 0x0}},
+ 23: {id: 0x17, digitSize: 0x3, zero: [4]uint8{0xe0, 0xbb, 0x90, 0x0}},
+ 24: {id: 0x18, digitSize: 0x3, zero: [4]uint8{0xe1, 0xb1, 0x80, 0x0}},
+ 25: {id: 0x19, digitSize: 0x3, zero: [4]uint8{0xe1, 0xa5, 0x86, 0x0}},
+ 26: {id: 0x1a, digitSize: 0x4, zero: [4]uint8{0xf0, 0x9d, 0x9f, 0x8e}},
+ 27: {id: 0x1b, digitSize: 0x4, zero: [4]uint8{0xf0, 0x9d, 0x9f, 0x98}},
+ 28: {id: 0x1c, digitSize: 0x4, zero: [4]uint8{0xf0, 0x9d, 0x9f, 0xb6}},
+ 29: {id: 0x1d, digitSize: 0x4, zero: [4]uint8{0xf0, 0x9d, 0x9f, 0xac}},
+ 30: {id: 0x1e, digitSize: 0x4, zero: [4]uint8{0xf0, 0x9d, 0x9f, 0xa2}},
+ 31: {id: 0x1f, digitSize: 0x3, zero: [4]uint8{0xe0, 0xb5, 0xa6, 0x0}},
+ 32: {id: 0x20, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0x99, 0x90}},
+ 33: {id: 0x21, digitSize: 0x3, zero: [4]uint8{0xe1, 0xa0, 0x90, 0x0}},
+ 34: {id: 0x22, digitSize: 0x4, zero: [4]uint8{0xf0, 0x96, 0xa9, 0xa0}},
+ 35: {id: 0x23, digitSize: 0x3, zero: [4]uint8{0xea, 0xaf, 0xb0, 0x0}},
+ 36: {id: 0x24, digitSize: 0x3, zero: [4]uint8{0xe1, 0x81, 0x80, 0x0}},
+ 37: {id: 0x25, digitSize: 0x3, zero: [4]uint8{0xe1, 0x82, 0x90, 0x0}},
+ 38: {id: 0x26, digitSize: 0x3, zero: [4]uint8{0xea, 0xa7, 0xb0, 0x0}},
+ 39: {id: 0x27, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0x91, 0x90}},
+ 40: {id: 0x28, digitSize: 0x2, zero: [4]uint8{0xdf, 0x80, 0x0, 0x0}},
+ 41: {id: 0x29, digitSize: 0x3, zero: [4]uint8{0xe1, 0xb1, 0x90, 0x0}},
+ 42: {id: 0x2a, digitSize: 0x3, zero: [4]uint8{0xe0, 0xad, 0xa6, 0x0}},
+ 43: {id: 0x2b, digitSize: 0x4, zero: [4]uint8{0xf0, 0x90, 0x92, 0xa0}},
+ 44: {id: 0x2c, digitSize: 0x3, zero: [4]uint8{0xea, 0xa3, 0x90, 0x0}},
+ 45: {id: 0x2d, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0x87, 0x90}},
+ 46: {id: 0x2e, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0x8b, 0xb0}},
+ 47: {id: 0x2f, digitSize: 0x3, zero: [4]uint8{0xe0, 0xb7, 0xa6, 0x0}},
+ 48: {id: 0x30, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0x83, 0xb0}},
+ 49: {id: 0x31, digitSize: 0x3, zero: [4]uint8{0xe1, 0xae, 0xb0, 0x0}},
+ 50: {id: 0x32, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0x9b, 0x80}},
+ 51: {id: 0x33, digitSize: 0x3, zero: [4]uint8{0xe1, 0xa7, 0x90, 0x0}},
+ 52: {id: 0x34, digitSize: 0x3, zero: [4]uint8{0xe0, 0xaf, 0xa6, 0x0}},
+ 53: {id: 0x35, digitSize: 0x3, zero: [4]uint8{0xe0, 0xb1, 0xa6, 0x0}},
+ 54: {id: 0x36, digitSize: 0x3, zero: [4]uint8{0xe0, 0xb9, 0x90, 0x0}},
+ 55: {id: 0x37, digitSize: 0x3, zero: [4]uint8{0xe0, 0xbc, 0xa0, 0x0}},
+ 56: {id: 0x38, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0x93, 0x90}},
+ 57: {id: 0x39, digitSize: 0x3, zero: [4]uint8{0xea, 0x98, 0xa0, 0x0}},
+ 58: {id: 0x3a, digitSize: 0x4, zero: [4]uint8{0xf0, 0x91, 0xa3, 0xa0}},
+} // Size: 378 bytes
+
+const (
+ numAdlm = 0x1
+ numAhom = 0x2
+ numArab = 0x3
+ numArabext = 0x4
+ numArmn = 0x3b
+ numArmnlow = 0x3c
+ numBali = 0x5
+ numBeng = 0x6
+ numBhks = 0x7
+ numBrah = 0x8
+ numCakm = 0x9
+ numCham = 0xa
+ numCyrl = 0x3d
+ numDeva = 0xb
+ numEthi = 0x3e
+ numFullwide = 0xc
+ numGeor = 0x3f
+ numGonm = 0xd
+ numGrek = 0x40
+ numGreklow = 0x41
+ numGujr = 0xe
+ numGuru = 0xf
+ numHanidays = 0x42
+ numHanidec = 0x43
+ numHans = 0x44
+ numHansfin = 0x45
+ numHant = 0x46
+ numHantfin = 0x47
+ numHebr = 0x48
+ numHmng = 0x10
+ numJava = 0x11
+ numJpan = 0x49
+ numJpanfin = 0x4a
+ numKali = 0x12
+ numKhmr = 0x13
+ numKnda = 0x14
+ numLana = 0x15
+ numLanatham = 0x16
+ numLaoo = 0x17
+ numLatn = 0x0
+ numLepc = 0x18
+ numLimb = 0x19
+ numMathbold = 0x1a
+ numMathdbl = 0x1b
+ numMathmono = 0x1c
+ numMathsanb = 0x1d
+ numMathsans = 0x1e
+ numMlym = 0x1f
+ numModi = 0x20
+ numMong = 0x21
+ numMroo = 0x22
+ numMtei = 0x23
+ numMymr = 0x24
+ numMymrshan = 0x25
+ numMymrtlng = 0x26
+ numNewa = 0x27
+ numNkoo = 0x28
+ numOlck = 0x29
+ numOrya = 0x2a
+ numOsma = 0x2b
+ numRoman = 0x4b
+ numRomanlow = 0x4c
+ numSaur = 0x2c
+ numShrd = 0x2d
+ numSind = 0x2e
+ numSinh = 0x2f
+ numSora = 0x30
+ numSund = 0x31
+ numTakr = 0x32
+ numTalu = 0x33
+ numTaml = 0x4d
+ numTamldec = 0x34
+ numTelu = 0x35
+ numThai = 0x36
+ numTibt = 0x37
+ numTirh = 0x38
+ numVaii = 0x39
+ numWara = 0x3a
+ numNumberSystems
+)
+
+var systemMap = map[string]system{
+ "adlm": numAdlm,
+ "ahom": numAhom,
+ "arab": numArab,
+ "arabext": numArabext,
+ "armn": numArmn,
+ "armnlow": numArmnlow,
+ "bali": numBali,
+ "beng": numBeng,
+ "bhks": numBhks,
+ "brah": numBrah,
+ "cakm": numCakm,
+ "cham": numCham,
+ "cyrl": numCyrl,
+ "deva": numDeva,
+ "ethi": numEthi,
+ "fullwide": numFullwide,
+ "geor": numGeor,
+ "gonm": numGonm,
+ "grek": numGrek,
+ "greklow": numGreklow,
+ "gujr": numGujr,
+ "guru": numGuru,
+ "hanidays": numHanidays,
+ "hanidec": numHanidec,
+ "hans": numHans,
+ "hansfin": numHansfin,
+ "hant": numHant,
+ "hantfin": numHantfin,
+ "hebr": numHebr,
+ "hmng": numHmng,
+ "java": numJava,
+ "jpan": numJpan,
+ "jpanfin": numJpanfin,
+ "kali": numKali,
+ "khmr": numKhmr,
+ "knda": numKnda,
+ "lana": numLana,
+ "lanatham": numLanatham,
+ "laoo": numLaoo,
+ "latn": numLatn,
+ "lepc": numLepc,
+ "limb": numLimb,
+ "mathbold": numMathbold,
+ "mathdbl": numMathdbl,
+ "mathmono": numMathmono,
+ "mathsanb": numMathsanb,
+ "mathsans": numMathsans,
+ "mlym": numMlym,
+ "modi": numModi,
+ "mong": numMong,
+ "mroo": numMroo,
+ "mtei": numMtei,
+ "mymr": numMymr,
+ "mymrshan": numMymrshan,
+ "mymrtlng": numMymrtlng,
+ "newa": numNewa,
+ "nkoo": numNkoo,
+ "olck": numOlck,
+ "orya": numOrya,
+ "osma": numOsma,
+ "roman": numRoman,
+ "romanlow": numRomanlow,
+ "saur": numSaur,
+ "shrd": numShrd,
+ "sind": numSind,
+ "sinh": numSinh,
+ "sora": numSora,
+ "sund": numSund,
+ "takr": numTakr,
+ "talu": numTalu,
+ "taml": numTaml,
+ "tamldec": numTamldec,
+ "telu": numTelu,
+ "thai": numThai,
+ "tibt": numTibt,
+ "tirh": numTirh,
+ "vaii": numVaii,
+ "wara": numWara,
+}
+
+var symIndex = [][12]uint8{ // 81 elements
+ 0: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 1: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 2: [12]uint8{0x0, 0x1, 0x2, 0xd, 0xe, 0xf, 0x6, 0x7, 0x8, 0x9, 0x10, 0xb},
+ 3: [12]uint8{0x1, 0x0, 0x2, 0xd, 0xe, 0xf, 0x6, 0x7, 0x8, 0x9, 0x10, 0xb},
+ 4: [12]uint8{0x0, 0x1, 0x2, 0x11, 0xe, 0xf, 0x6, 0x7, 0x8, 0x9, 0x10, 0xb},
+ 5: [12]uint8{0x1, 0x0, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x12, 0xb},
+ 6: [12]uint8{0x1, 0x0, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 7: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x13, 0xb},
+ 8: [12]uint8{0x0, 0x1, 0x2, 0x3, 0xe, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 9: [12]uint8{0x1, 0x0, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0x0},
+ 10: [12]uint8{0x1, 0x0, 0x2, 0x3, 0x4, 0x5, 0x6, 0x14, 0x8, 0x9, 0xa, 0xb},
+ 11: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x14, 0x8, 0x9, 0xa, 0xb},
+ 12: [12]uint8{0x0, 0x15, 0x2, 0x3, 0x4, 0x5, 0x6, 0x14, 0x8, 0x9, 0xa, 0xb},
+ 13: [12]uint8{0x0, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 14: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x16, 0xb},
+ 15: [12]uint8{0x1, 0x0, 0x2, 0x3, 0x4, 0x5, 0x17, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 16: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x17, 0x7, 0x8, 0x9, 0xa, 0x0},
+ 17: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x17, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 18: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0x0},
+ 19: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x18, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 20: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x19, 0x1a, 0xa, 0xb},
+ 21: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x1b, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 22: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x1b, 0x18, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 23: [12]uint8{0x1, 0x0, 0x2, 0x3, 0x4, 0x1b, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 24: [12]uint8{0x0, 0x1, 0x2, 0x3, 0xe, 0x1c, 0x6, 0x7, 0x8, 0x9, 0x1d, 0xb},
+ 25: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x1b, 0x6, 0x7, 0x8, 0x9, 0x1e, 0x0},
+ 26: [12]uint8{0x0, 0x15, 0x2, 0x3, 0x4, 0x1b, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 27: [12]uint8{0x0, 0x1, 0x2, 0x3, 0xe, 0xf, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 28: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x1f, 0xb},
+ 29: [12]uint8{0x0, 0x15, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 30: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x20, 0xb},
+ 31: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x21, 0x7, 0x8, 0x9, 0x22, 0xb},
+ 32: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x23, 0xb},
+ 33: [12]uint8{0x1, 0x0, 0x2, 0x3, 0x4, 0x1b, 0x18, 0x14, 0x8, 0x9, 0x24, 0xb},
+ 34: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x1b, 0x18, 0x7, 0x8, 0x9, 0x24, 0xb},
+ 35: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x25, 0xb},
+ 36: [12]uint8{0x1, 0x0, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x26, 0xb},
+ 37: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x27, 0xb},
+ 38: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x28, 0xb},
+ 39: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x29, 0xb},
+ 40: [12]uint8{0x1, 0x0, 0x2, 0x3, 0xe, 0x1c, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 41: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x2a, 0xb},
+ 42: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x2b, 0xb},
+ 43: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x1b, 0x2c, 0x14, 0x8, 0x9, 0x24, 0xb},
+ 44: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0x0},
+ 45: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x17, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 46: [12]uint8{0x1, 0x0, 0x2, 0x3, 0x4, 0x1b, 0x17, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 47: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x2d, 0x0},
+ 48: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x2e, 0xb},
+ 49: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x2f, 0xb},
+ 50: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x30, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 51: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x31, 0xb},
+ 52: [12]uint8{0x1, 0xc, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x32, 0xb},
+ 53: [12]uint8{0x1, 0x15, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb},
+ 54: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x33, 0xb},
+ 55: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x34, 0xb},
+ 56: [12]uint8{0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x7, 0x3c, 0x9, 0xa, 0xb},
+ 57: [12]uint8{0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x7, 0x3c, 0x9, 0x3d, 0xb},
+ 58: [12]uint8{0x35, 0x36, 0x37, 0x11, 0x3e, 0x3f, 0x3b, 0x7, 0x3c, 0x9, 0xa, 0xb},
+ 59: [12]uint8{0x35, 0x36, 0x37, 0x11, 0x39, 0x3a, 0x3b, 0x7, 0x3c, 0x9, 0xa, 0xb},
+ 60: [12]uint8{0x35, 0x36, 0x37, 0x11, 0x39, 0x40, 0x3b, 0x7, 0x3c, 0x9, 0xa, 0xb},
+ 61: [12]uint8{0x35, 0x36, 0x37, 0x41, 0x3e, 0x3f, 0x3b, 0x7, 0x3c, 0x9, 0xa, 0xb},
+ 62: [12]uint8{0x35, 0x36, 0x37, 0x38, 0x3e, 0x3f, 0x3b, 0x7, 0x3c, 0x9, 0xa, 0xb},
+ 63: [12]uint8{0x35, 0xc, 0x37, 0x38, 0x39, 0x42, 0x3b, 0x7, 0x3c, 0x9, 0xa, 0x0},
+ 64: [12]uint8{0x35, 0xc, 0x37, 0x38, 0x39, 0x42, 0x43, 0x7, 0x44, 0x9, 0x24, 0xb},
+ 65: [12]uint8{0x35, 0x36, 0x37, 0x38, 0x39, 0x5, 0x3b, 0x7, 0x3c, 0x9, 0x33, 0xb},
+ 66: [12]uint8{0x35, 0x36, 0x37, 0x11, 0x45, 0x46, 0x43, 0x7, 0x3c, 0x9, 0xa, 0x35},
+ 67: [12]uint8{0x35, 0x36, 0x37, 0x11, 0xe, 0x1c, 0x43, 0x7, 0x3c, 0x9, 0x1d, 0xb},
+ 68: [12]uint8{0x35, 0x36, 0x37, 0x11, 0xe, 0x1c, 0x43, 0x7, 0x3c, 0x9, 0xa, 0x35},
+ 69: [12]uint8{0x35, 0x36, 0x37, 0x11, 0x45, 0x5, 0x43, 0x7, 0x3c, 0x9, 0xa, 0x35},
+ 70: [12]uint8{0x1, 0xc, 0x37, 0x11, 0x45, 0x47, 0x43, 0x7, 0x3c, 0x9, 0xa, 0x0},
+ 71: [12]uint8{0x35, 0x1, 0x37, 0x11, 0x4, 0x5, 0x43, 0x7, 0x3c, 0x9, 0xa, 0x35},
+ 72: [12]uint8{0x1, 0xc, 0x37, 0x11, 0x45, 0x47, 0x43, 0x7, 0x3c, 0x9, 0x24, 0xb},
+ 73: [12]uint8{0x35, 0x36, 0x2, 0x3, 0x45, 0x46, 0x43, 0x7, 0x8, 0x9, 0xa, 0x35},
+ 74: [12]uint8{0x35, 0x36, 0x37, 0x11, 0x4, 0x5, 0x43, 0x7, 0x3c, 0x9, 0x31, 0x35},
+ 75: [12]uint8{0x35, 0x36, 0x37, 0x11, 0x4, 0x5, 0x43, 0x7, 0x3c, 0x9, 0x32, 0x35},
+ 76: [12]uint8{0x35, 0x36, 0x37, 0x11, 0x48, 0x46, 0x43, 0x7, 0x3c, 0x9, 0x33, 0x35},
+ 77: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0x49},
+ 78: [12]uint8{0x0, 0x1, 0x4a, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x28, 0xb},
+ 79: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x4b, 0xb},
+ 80: [12]uint8{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x4c, 0x4d, 0xb},
+} // Size: 996 bytes
+
+var symData = stringset.Set{
+ Data: "" + // Size: 599 bytes
+ ".,;%+-E׉∞NaN:\u00a0\u200e%\u200e\u200e+\u200e-ليس\u00a0رقمًا٪NDТерхьаш" +
+ "\u00a0дац·’mnne×10^0/00INF−\u200e−ناعددepälukuՈչԹარ\u00a0არის\u00a0რიცხვ" +
+ "იZMdMсан\u00a0емес¤¤¤сан\u00a0эмесບໍ່\u200bແມ່ນ\u200bໂຕ\u200bເລກNSဂဏန်" +
+ "းမဟုတ်သောННне\u00a0числочыыһыла\u00a0буотах·10^epilohosan\u00a0dälTFЕs" +
+ "on\u00a0emasҳақиқий\u00a0сон\u00a0эмас非數值非数值٫٬؛٪\u061c\u061c+\u061c-اس؉ل" +
+ "يس\u00a0رقم\u200f+\u200f-\u200f−٪\u200f\u061c−×۱۰^؉\u200f\u200e+\u200e" +
+ "\u200e-\u200e\u200e−\u200e+\u200e:၊ཨང་མེན་གྲངས་མེདཨང་མད",
+ Index: []uint16{ // 79 elements
+ // Entry 0 - 3F
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
+ 0x0009, 0x000c, 0x000f, 0x0012, 0x0013, 0x0015, 0x001c, 0x0020,
+ 0x0024, 0x0036, 0x0038, 0x003a, 0x0050, 0x0052, 0x0055, 0x0058,
+ 0x0059, 0x005e, 0x0062, 0x0065, 0x0068, 0x006e, 0x0078, 0x0080,
+ 0x0086, 0x00ae, 0x00af, 0x00b2, 0x00c2, 0x00c8, 0x00d8, 0x0105,
+ 0x0107, 0x012e, 0x0132, 0x0142, 0x015e, 0x0163, 0x016a, 0x0173,
+ 0x0175, 0x0177, 0x0180, 0x01a0, 0x01a9, 0x01b2, 0x01b4, 0x01b6,
+ 0x01b8, 0x01bc, 0x01bf, 0x01c2, 0x01c6, 0x01c8, 0x01d6, 0x01da,
+ // Entry 40 - 7F
+ 0x01de, 0x01e4, 0x01e9, 0x01ee, 0x01f5, 0x01fa, 0x0201, 0x0208,
+ 0x0211, 0x0215, 0x0218, 0x021b, 0x0230, 0x0248, 0x0257,
+ },
+} // Size: 797 bytes
+
+// langToDefaults maps a compact language index to the default numbering system
+// and default symbol set
+var langToDefaults = [775]symOffset{
+ // Entry 0 - 3F
+ 0x8000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x8003, 0x0002, 0x0002, 0x0002, 0x0002, 0x0003,
+ 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
+ 0x0003, 0x0003, 0x0003, 0x0003, 0x0002, 0x0002, 0x0002, 0x0004,
+ 0x0002, 0x0004, 0x0002, 0x0002, 0x0002, 0x0003, 0x0002, 0x0000,
+ 0x8005, 0x0000, 0x0000, 0x0000, 0x8006, 0x0005, 0x0006, 0x0006,
+ 0x0006, 0x0006, 0x0006, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000,
+ // Entry 40 - 7F
+ 0x8009, 0x0000, 0x0000, 0x800a, 0x0000, 0x0000, 0x800c, 0x0001,
+ 0x0000, 0x0000, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006,
+ 0x0006, 0x0006, 0x0006, 0x0006, 0x800e, 0x0000, 0x0000, 0x0007,
+ 0x0007, 0x0000, 0x0000, 0x0000, 0x0000, 0x800f, 0x0008, 0x0008,
+ 0x8011, 0x0001, 0x0001, 0x0001, 0x803c, 0x0000, 0x0009, 0x0009,
+ 0x0009, 0x0000, 0x0000, 0x000a, 0x000b, 0x000a, 0x000c, 0x000a,
+ 0x000a, 0x000c, 0x000a, 0x000d, 0x000d, 0x000a, 0x000a, 0x0001,
+ 0x0001, 0x0000, 0x0001, 0x0001, 0x803f, 0x0000, 0x0000, 0x0000,
+ // Entry 80 - BF
+ 0x000e, 0x000e, 0x000e, 0x000f, 0x000f, 0x000f, 0x0000, 0x0000,
+ 0x0006, 0x0000, 0x0000, 0x0000, 0x000a, 0x0010, 0x0000, 0x0006,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0011, 0x0000, 0x000a,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x000a, 0x0000, 0x0009, 0x0000,
+ 0x0000, 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ // Entry C0 - FF
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0013, 0x0000,
+ 0x0000, 0x000f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0x0015,
+ 0x0015, 0x0006, 0x0000, 0x0006, 0x0006, 0x0000, 0x0000, 0x0006,
+ 0x0006, 0x0001, 0x0000, 0x0000, 0x0006, 0x0006, 0x0006, 0x0006,
+ // Entry 100 - 13F
+ 0x0000, 0x0000, 0x0006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0006,
+ 0x0000, 0x0006, 0x0000, 0x0000, 0x0006, 0x0006, 0x0016, 0x0016,
+ 0x0017, 0x0017, 0x0001, 0x0001, 0x8041, 0x0018, 0x0018, 0x0001,
+ 0x0001, 0x0001, 0x0001, 0x0001, 0x0019, 0x0019, 0x0000, 0x0000,
+ 0x0017, 0x0017, 0x0017, 0x8044, 0x0001, 0x0001, 0x0001, 0x0001,
+ 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
+ 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
+ 0x0001, 0x0001, 0x0006, 0x0006, 0x0001, 0x0001, 0x0001, 0x0001,
+ // Entry 140 - 17F
+ 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
+ 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
+ 0x0001, 0x0001, 0x0006, 0x0006, 0x0006, 0x0006, 0x0000, 0x0000,
+ 0x8047, 0x0000, 0x0006, 0x0006, 0x001a, 0x001a, 0x001a, 0x001a,
+ 0x804a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x804c, 0x001b, 0x0000,
+ 0x0000, 0x0006, 0x0006, 0x0006, 0x000a, 0x000a, 0x0001, 0x0001,
+ 0x001c, 0x001c, 0x0009, 0x0009, 0x804f, 0x0000, 0x0000, 0x0000,
+ // Entry 180 - 1BF
+ 0x0000, 0x0000, 0x8052, 0x0006, 0x0006, 0x001d, 0x0006, 0x0006,
+ 0x0006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0006, 0x0006,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x001e, 0x001e, 0x001f,
+ 0x001f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001,
+ 0x0001, 0x000d, 0x000d, 0x0000, 0x0000, 0x0020, 0x0020, 0x0006,
+ 0x0006, 0x0021, 0x0021, 0x0000, 0x0000, 0x0006, 0x0006, 0x0000,
+ 0x0000, 0x8054, 0x0000, 0x0000, 0x0000, 0x0000, 0x8056, 0x001b,
+ 0x0000, 0x0000, 0x0001, 0x0001, 0x0022, 0x0022, 0x0000, 0x0000,
+ // Entry 1C0 - 1FF
+ 0x0000, 0x0023, 0x0023, 0x0000, 0x0000, 0x0006, 0x0006, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006,
+ 0x0024, 0x0024, 0x8058, 0x0000, 0x0000, 0x0016, 0x0016, 0x0006,
+ 0x0006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0025, 0x0025, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x000d, 0x000d, 0x0000, 0x0000,
+ 0x0006, 0x0006, 0x0000, 0x0000, 0x0006, 0x0006, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x805a, 0x0000, 0x0000, 0x0006, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0006, 0x0006, 0x805b, 0x0026, 0x805d,
+ // Entry 200 - 23F
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x805e, 0x0015, 0x0015, 0x0000,
+ 0x0000, 0x0006, 0x0006, 0x0006, 0x8061, 0x0000, 0x0000, 0x8062,
+ 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0001,
+ 0x0001, 0x0015, 0x0015, 0x0006, 0x0006, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0027, 0x0027, 0x0027, 0x8065, 0x8067,
+ 0x001b, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001,
+ 0x8069, 0x0028, 0x0006, 0x0001, 0x0006, 0x0001, 0x0001, 0x0001,
+ // Entry 240 - 27F
+ 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000,
+ 0x0006, 0x0000, 0x0000, 0x001a, 0x001a, 0x0006, 0x0006, 0x0006,
+ 0x0006, 0x0006, 0x0000, 0x0000, 0x0029, 0x0029, 0x0029, 0x0029,
+ 0x0029, 0x0029, 0x0029, 0x0006, 0x0006, 0x0000, 0x0000, 0x002a,
+ 0x002a, 0x0000, 0x0000, 0x0000, 0x0000, 0x806b, 0x0000, 0x0000,
+ 0x002b, 0x002b, 0x002b, 0x002b, 0x0006, 0x0006, 0x000d, 0x000d,
+ 0x0006, 0x0006, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
+ 0x002c, 0x002c, 0x002d, 0x002d, 0x002e, 0x002e, 0x0000, 0x0000,
+ // Entry 280 - 2BF
+ 0x0000, 0x002f, 0x002f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0006,
+ 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006,
+ 0x0006, 0x0006, 0x0000, 0x0000, 0x0000, 0x806d, 0x0022, 0x0022,
+ 0x0022, 0x0000, 0x0006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0030, 0x0030, 0x0000, 0x0000, 0x8071, 0x0031, 0x0006,
+ // Entry 2C0 - 2FF
+ 0x0006, 0x0006, 0x0000, 0x0001, 0x0001, 0x000d, 0x000d, 0x0001,
+ 0x0001, 0x0000, 0x0000, 0x0032, 0x0032, 0x8074, 0x8076, 0x001b,
+ 0x8077, 0x8079, 0x0028, 0x807b, 0x0034, 0x0033, 0x0033, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0006, 0x0006, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0035, 0x0035, 0x0006, 0x0006,
+ 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0036, 0x0037, 0x0037, 0x0036, 0x0036, 0x0001,
+ 0x0001, 0x807d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8080,
+ // Entry 300 - 33F
+ 0x0036, 0x0036, 0x0036, 0x0000, 0x0000, 0x0006, 0x0014,
+} // Size: 1550 bytes
+
+// langToAlt is a list of numbering system and symbol set pairs, sorted and
+// marked by compact language index.
+var langToAlt = []altSymData{ // 131 elements
+ 1: {compactTag: 0x0, symIndex: 0x38, system: 0x3},
+ 2: {compactTag: 0x0, symIndex: 0x42, system: 0x4},
+ 3: {compactTag: 0xa, symIndex: 0x39, system: 0x3},
+ 4: {compactTag: 0xa, symIndex: 0x2, system: 0x0},
+ 5: {compactTag: 0x28, symIndex: 0x0, system: 0x6},
+ 6: {compactTag: 0x2c, symIndex: 0x5, system: 0x0},
+ 7: {compactTag: 0x2c, symIndex: 0x3a, system: 0x3},
+ 8: {compactTag: 0x2c, symIndex: 0x42, system: 0x4},
+ 9: {compactTag: 0x40, symIndex: 0x0, system: 0x6},
+ 10: {compactTag: 0x43, symIndex: 0x0, system: 0x0},
+ 11: {compactTag: 0x43, symIndex: 0x4f, system: 0x37},
+ 12: {compactTag: 0x46, symIndex: 0x1, system: 0x0},
+ 13: {compactTag: 0x46, symIndex: 0x38, system: 0x3},
+ 14: {compactTag: 0x54, symIndex: 0x0, system: 0x9},
+ 15: {compactTag: 0x5d, symIndex: 0x3a, system: 0x3},
+ 16: {compactTag: 0x5d, symIndex: 0x8, system: 0x0},
+ 17: {compactTag: 0x60, symIndex: 0x1, system: 0x0},
+ 18: {compactTag: 0x60, symIndex: 0x38, system: 0x3},
+ 19: {compactTag: 0x60, symIndex: 0x42, system: 0x4},
+ 20: {compactTag: 0x60, symIndex: 0x0, system: 0x5},
+ 21: {compactTag: 0x60, symIndex: 0x0, system: 0x6},
+ 22: {compactTag: 0x60, symIndex: 0x0, system: 0x8},
+ 23: {compactTag: 0x60, symIndex: 0x0, system: 0x9},
+ 24: {compactTag: 0x60, symIndex: 0x0, system: 0xa},
+ 25: {compactTag: 0x60, symIndex: 0x0, system: 0xb},
+ 26: {compactTag: 0x60, symIndex: 0x0, system: 0xc},
+ 27: {compactTag: 0x60, symIndex: 0x0, system: 0xd},
+ 28: {compactTag: 0x60, symIndex: 0x0, system: 0xe},
+ 29: {compactTag: 0x60, symIndex: 0x0, system: 0xf},
+ 30: {compactTag: 0x60, symIndex: 0x0, system: 0x11},
+ 31: {compactTag: 0x60, symIndex: 0x0, system: 0x12},
+ 32: {compactTag: 0x60, symIndex: 0x0, system: 0x13},
+ 33: {compactTag: 0x60, symIndex: 0x0, system: 0x14},
+ 34: {compactTag: 0x60, symIndex: 0x0, system: 0x15},
+ 35: {compactTag: 0x60, symIndex: 0x0, system: 0x16},
+ 36: {compactTag: 0x60, symIndex: 0x0, system: 0x17},
+ 37: {compactTag: 0x60, symIndex: 0x0, system: 0x18},
+ 38: {compactTag: 0x60, symIndex: 0x0, system: 0x19},
+ 39: {compactTag: 0x60, symIndex: 0x0, system: 0x1f},
+ 40: {compactTag: 0x60, symIndex: 0x0, system: 0x21},
+ 41: {compactTag: 0x60, symIndex: 0x0, system: 0x23},
+ 42: {compactTag: 0x60, symIndex: 0x0, system: 0x24},
+ 43: {compactTag: 0x60, symIndex: 0x0, system: 0x25},
+ 44: {compactTag: 0x60, symIndex: 0x0, system: 0x28},
+ 45: {compactTag: 0x60, symIndex: 0x0, system: 0x29},
+ 46: {compactTag: 0x60, symIndex: 0x0, system: 0x2a},
+ 47: {compactTag: 0x60, symIndex: 0x0, system: 0x2b},
+ 48: {compactTag: 0x60, symIndex: 0x0, system: 0x2c},
+ 49: {compactTag: 0x60, symIndex: 0x0, system: 0x2d},
+ 50: {compactTag: 0x60, symIndex: 0x0, system: 0x30},
+ 51: {compactTag: 0x60, symIndex: 0x0, system: 0x31},
+ 52: {compactTag: 0x60, symIndex: 0x0, system: 0x32},
+ 53: {compactTag: 0x60, symIndex: 0x0, system: 0x33},
+ 54: {compactTag: 0x60, symIndex: 0x0, system: 0x34},
+ 55: {compactTag: 0x60, symIndex: 0x0, system: 0x35},
+ 56: {compactTag: 0x60, symIndex: 0x0, system: 0x36},
+ 57: {compactTag: 0x60, symIndex: 0x0, system: 0x37},
+ 58: {compactTag: 0x60, symIndex: 0x0, system: 0x39},
+ 59: {compactTag: 0x60, symIndex: 0x0, system: 0x43},
+ 60: {compactTag: 0x64, symIndex: 0x0, system: 0x0},
+ 61: {compactTag: 0x64, symIndex: 0x38, system: 0x3},
+ 62: {compactTag: 0x64, symIndex: 0x42, system: 0x4},
+ 63: {compactTag: 0x7c, symIndex: 0x50, system: 0x37},
+ 64: {compactTag: 0x7c, symIndex: 0x0, system: 0x0},
+ 65: {compactTag: 0x114, symIndex: 0x43, system: 0x4},
+ 66: {compactTag: 0x114, symIndex: 0x18, system: 0x0},
+ 67: {compactTag: 0x114, symIndex: 0x3b, system: 0x3},
+ 68: {compactTag: 0x123, symIndex: 0x1, system: 0x0},
+ 69: {compactTag: 0x123, symIndex: 0x3c, system: 0x3},
+ 70: {compactTag: 0x123, symIndex: 0x44, system: 0x4},
+ 71: {compactTag: 0x158, symIndex: 0x0, system: 0x0},
+ 72: {compactTag: 0x158, symIndex: 0x3b, system: 0x3},
+ 73: {compactTag: 0x158, symIndex: 0x45, system: 0x4},
+ 74: {compactTag: 0x160, symIndex: 0x0, system: 0x0},
+ 75: {compactTag: 0x160, symIndex: 0x38, system: 0x3},
+ 76: {compactTag: 0x16d, symIndex: 0x1b, system: 0x0},
+ 77: {compactTag: 0x16d, symIndex: 0x0, system: 0x9},
+ 78: {compactTag: 0x16d, symIndex: 0x0, system: 0xa},
+ 79: {compactTag: 0x17c, symIndex: 0x0, system: 0x0},
+ 80: {compactTag: 0x17c, symIndex: 0x3d, system: 0x3},
+ 81: {compactTag: 0x17c, symIndex: 0x42, system: 0x4},
+ 82: {compactTag: 0x182, symIndex: 0x6, system: 0x0},
+ 83: {compactTag: 0x182, symIndex: 0x38, system: 0x3},
+ 84: {compactTag: 0x1b1, symIndex: 0x0, system: 0x0},
+ 85: {compactTag: 0x1b1, symIndex: 0x3e, system: 0x3},
+ 86: {compactTag: 0x1b6, symIndex: 0x42, system: 0x4},
+ 87: {compactTag: 0x1b6, symIndex: 0x1b, system: 0x0},
+ 88: {compactTag: 0x1d2, symIndex: 0x42, system: 0x4},
+ 89: {compactTag: 0x1d2, symIndex: 0x0, system: 0x0},
+ 90: {compactTag: 0x1f3, symIndex: 0x0, system: 0xb},
+ 91: {compactTag: 0x1fd, symIndex: 0x4e, system: 0x24},
+ 92: {compactTag: 0x1fd, symIndex: 0x26, system: 0x0},
+ 93: {compactTag: 0x1ff, symIndex: 0x42, system: 0x4},
+ 94: {compactTag: 0x204, symIndex: 0x15, system: 0x0},
+ 95: {compactTag: 0x204, symIndex: 0x3f, system: 0x3},
+ 96: {compactTag: 0x204, symIndex: 0x46, system: 0x4},
+ 97: {compactTag: 0x20c, symIndex: 0x0, system: 0xb},
+ 98: {compactTag: 0x20f, symIndex: 0x6, system: 0x0},
+ 99: {compactTag: 0x20f, symIndex: 0x38, system: 0x3},
+ 100: {compactTag: 0x20f, symIndex: 0x42, system: 0x4},
+ 101: {compactTag: 0x22e, symIndex: 0x0, system: 0x0},
+ 102: {compactTag: 0x22e, symIndex: 0x47, system: 0x4},
+ 103: {compactTag: 0x22f, symIndex: 0x42, system: 0x4},
+ 104: {compactTag: 0x22f, symIndex: 0x1b, system: 0x0},
+ 105: {compactTag: 0x238, symIndex: 0x42, system: 0x4},
+ 106: {compactTag: 0x238, symIndex: 0x28, system: 0x0},
+ 107: {compactTag: 0x265, symIndex: 0x38, system: 0x3},
+ 108: {compactTag: 0x265, symIndex: 0x0, system: 0x0},
+ 109: {compactTag: 0x29d, symIndex: 0x22, system: 0x0},
+ 110: {compactTag: 0x29d, symIndex: 0x40, system: 0x3},
+ 111: {compactTag: 0x29d, symIndex: 0x48, system: 0x4},
+ 112: {compactTag: 0x29d, symIndex: 0x4d, system: 0xc},
+ 113: {compactTag: 0x2bd, symIndex: 0x31, system: 0x0},
+ 114: {compactTag: 0x2bd, symIndex: 0x3e, system: 0x3},
+ 115: {compactTag: 0x2bd, symIndex: 0x42, system: 0x4},
+ 116: {compactTag: 0x2cd, symIndex: 0x1b, system: 0x0},
+ 117: {compactTag: 0x2cd, symIndex: 0x49, system: 0x4},
+ 118: {compactTag: 0x2ce, symIndex: 0x49, system: 0x4},
+ 119: {compactTag: 0x2d0, symIndex: 0x33, system: 0x0},
+ 120: {compactTag: 0x2d0, symIndex: 0x4a, system: 0x4},
+ 121: {compactTag: 0x2d1, symIndex: 0x42, system: 0x4},
+ 122: {compactTag: 0x2d1, symIndex: 0x28, system: 0x0},
+ 123: {compactTag: 0x2d3, symIndex: 0x34, system: 0x0},
+ 124: {compactTag: 0x2d3, symIndex: 0x4b, system: 0x4},
+ 125: {compactTag: 0x2f9, symIndex: 0x0, system: 0x0},
+ 126: {compactTag: 0x2f9, symIndex: 0x38, system: 0x3},
+ 127: {compactTag: 0x2f9, symIndex: 0x42, system: 0x4},
+ 128: {compactTag: 0x2ff, symIndex: 0x36, system: 0x0},
+ 129: {compactTag: 0x2ff, symIndex: 0x41, system: 0x3},
+ 130: {compactTag: 0x2ff, symIndex: 0x4c, system: 0x4},
+} // Size: 810 bytes
+
+var tagToDecimal = []uint8{ // 775 elements
+ // Entry 0 - 3F
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x05, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // Entry 40 - 7F
+ 0x05, 0x05, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x05, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x05, 0x05, 0x05, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x05, 0x05, 0x01, 0x01,
+ // Entry 80 - BF
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // Entry C0 - FF
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // Entry 100 - 13F
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // Entry 140 - 17F
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x05, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x05,
+ 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // Entry 180 - 1BF
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x05, 0x05, 0x05, 0x05,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // Entry 1C0 - 1FF
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x05, 0x05,
+ 0x01, 0x01, 0x01, 0x05, 0x05, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // Entry 200 - 23F
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x05, 0x05, 0x01, 0x01, 0x01, 0x05, 0x01,
+ 0x01, 0x05, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // Entry 240 - 27F
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // Entry 280 - 2BF
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x05,
+ 0x05, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // Entry 2C0 - 2FF
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ // Entry 300 - 33F
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08,
+} // Size: 799 bytes
+
+var tagToScientific = []uint8{ // 775 elements
+ // Entry 0 - 3F
+ 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, 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, 0x02, 0x02,
+ // Entry 40 - 7F
+ 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, 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, 0x02, 0x02,
+ // Entry 80 - BF
+ 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, 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, 0x02, 0x02,
+ // Entry C0 - FF
+ 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, 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, 0x02, 0x02,
+ // Entry 100 - 13F
+ 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, 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, 0x02, 0x02,
+ // Entry 140 - 17F
+ 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, 0x02,
+ 0x0c, 0x0c, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0c,
+ 0x0c, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ // Entry 180 - 1BF
+ 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, 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, 0x02, 0x02,
+ // Entry 1C0 - 1FF
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x0d, 0x0d, 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, 0x02, 0x02, 0x0c, 0x0c, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ // Entry 200 - 23F
+ 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, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0c, 0x02,
+ 0x02, 0x0c, 0x0c, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ // Entry 240 - 27F
+ 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, 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,
+ 0x0d, 0x0d, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ // Entry 280 - 2BF
+ 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, 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, 0x02, 0x02,
+ // Entry 2C0 - 2FF
+ 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, 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, 0x02, 0x02,
+ // Entry 300 - 33F
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x09,
+} // Size: 799 bytes
+
+var tagToPercent = []uint8{ // 775 elements
+ // Entry 0 - 3F
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x06, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ // Entry 40 - 7F
+ 0x06, 0x06, 0x06, 0x04, 0x04, 0x04, 0x03, 0x03,
+ 0x06, 0x06, 0x03, 0x04, 0x04, 0x03, 0x03, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x06, 0x06, 0x06, 0x03,
+ 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03,
+ 0x03, 0x04, 0x04, 0x03, 0x03, 0x03, 0x04, 0x03,
+ 0x03, 0x04, 0x03, 0x04, 0x04, 0x03, 0x03, 0x03,
+ 0x03, 0x04, 0x04, 0x04, 0x07, 0x07, 0x04, 0x04,
+ // Entry 80 - BF
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x03, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x03, 0x04, 0x03, 0x04,
+ 0x04, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ // Entry C0 - FF
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ // Entry 100 - 13F
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04,
+ 0x0b, 0x0b, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x04, 0x04,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ // Entry 140 - 17F
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x06, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06,
+ 0x06, 0x04, 0x04, 0x04, 0x03, 0x03, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ // Entry 180 - 1BF
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x06, 0x06, 0x06, 0x06,
+ 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x04, 0x04,
+ // Entry 1C0 - 1FF
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ // Entry 200 - 23F
+ 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x06, 0x06, 0x04, 0x04, 0x04, 0x06, 0x04,
+ 0x04, 0x06, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ // Entry 240 - 27F
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04,
+ // Entry 280 - 2BF
+ 0x04, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03,
+ 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06,
+ 0x06, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x0e,
+ // Entry 2C0 - 2FF
+ 0x0e, 0x0e, 0x04, 0x03, 0x03, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03,
+ 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ // Entry 300 - 33F
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0a,
+} // Size: 799 bytes
+
+var formats = []Pattern{Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 0,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x0,
+ MinIntegerDigits: 0x0,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x0,
+ GroupingSize: [2]uint8{0x0,
+ 0x0},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 3,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x0,
+ MinIntegerDigits: 0x1,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x9,
+ GroupingSize: [2]uint8{0x3,
+ 0x0},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 0,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x0,
+ MinIntegerDigits: 0x0,
+ MaxIntegerDigits: 0x1,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x1},
+ Affix: "",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x3,
+ GroupingSize: [2]uint8{0x0,
+ 0x0},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 0,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x2,
+ MinIntegerDigits: 0x1,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "\x00\x03\u00a0%",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x7,
+ GroupingSize: [2]uint8{0x3,
+ 0x0},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 0,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x2,
+ MinIntegerDigits: 0x1,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "\x00\x01%",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x6,
+ GroupingSize: [2]uint8{0x3,
+ 0x0},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 3,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x0,
+ MinIntegerDigits: 0x1,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0xc,
+ GroupingSize: [2]uint8{0x3,
+ 0x2},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 0,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x2,
+ MinIntegerDigits: 0x1,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "\x00\x01%",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x9,
+ GroupingSize: [2]uint8{0x3,
+ 0x2},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 0,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x2,
+ MinIntegerDigits: 0x1,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "\x00\x03\u00a0%",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0xa,
+ GroupingSize: [2]uint8{0x3,
+ 0x2},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 6,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x0,
+ MinIntegerDigits: 0x1,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x8,
+ GroupingSize: [2]uint8{0x0,
+ 0x0},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 6,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x0,
+ MinIntegerDigits: 0x1,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x6,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x3},
+ Affix: "",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0xd,
+ GroupingSize: [2]uint8{0x0,
+ 0x0},
+ Flags: 0x4},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 0,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x2,
+ MinIntegerDigits: 0x1,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "\x00\x01%",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x2,
+ GroupingSize: [2]uint8{0x0,
+ 0x0},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 0,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x2,
+ MinIntegerDigits: 0x1,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "\x03%\u00a0\x00",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x7,
+ GroupingSize: [2]uint8{0x3,
+ 0x0},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 0,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x0,
+ MinIntegerDigits: 0x0,
+ MaxIntegerDigits: 0x1,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x1},
+ Affix: "\x01[\x01]",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x5,
+ GroupingSize: [2]uint8{0x0,
+ 0x0},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 0,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x0,
+ MinIntegerDigits: 0x0,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x1,
+ GroupingSize: [2]uint8{0x0,
+ 0x0},
+ Flags: 0x0},
+ Pattern{RoundingContext: RoundingContext{MaxSignificantDigits: 0,
+ MaxFractionDigits: 0,
+ Increment: 0x0,
+ IncrementScale: 0x0,
+ Mode: 0x0,
+ DigitShift: 0x2,
+ MinIntegerDigits: 0x1,
+ MaxIntegerDigits: 0x0,
+ MinFractionDigits: 0x0,
+ MinSignificantDigits: 0x0,
+ MinExponentDigits: 0x0},
+ Affix: "\x01%\x00",
+ Offset: 0x0,
+ NegOffset: 0x0,
+ PadRune: 0,
+ FormatWidth: 0x6,
+ GroupingSize: [2]uint8{0x3,
+ 0x0},
+ Flags: 0x0}}
+
+// Total table size 8634 bytes (8KiB); checksum: BE6D4A33
diff --git a/vendor/golang.org/x/text/internal/number/tables_test.go b/vendor/golang.org/x/text/internal/number/tables_test.go
new file mode 100644
index 0000000..f1e542a
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/number/tables_test.go
@@ -0,0 +1,126 @@
+// 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 (
+ "flag"
+ "log"
+ "reflect"
+ "testing"
+
+ "golang.org/x/text/internal/gen"
+ "golang.org/x/text/internal/language"
+ "golang.org/x/text/internal/language/compact"
+ "golang.org/x/text/internal/testtext"
+ "golang.org/x/text/unicode/cldr"
+)
+
+var draft = flag.String("draft",
+ "contributed",
+ `Minimal draft requirements (approved, contributed, provisional, unconfirmed).`)
+
+func TestNumberSystems(t *testing.T) {
+ testtext.SkipIfNotLong(t)
+
+ r := gen.OpenCLDRCoreZip()
+ defer r.Close()
+
+ d := &cldr.Decoder{}
+ d.SetDirFilter("supplemental")
+ d.SetSectionFilter("numberingSystem")
+ data, err := d.DecodeZip(r)
+ if err != nil {
+ t.Fatalf("DecodeZip: %v", err)
+ }
+
+ for _, ns := range data.Supplemental().NumberingSystems.NumberingSystem {
+ n := systemMap[ns.Id]
+ if int(n) >= len(numSysData) {
+ continue
+ }
+ info := InfoFromLangID(0, ns.Id)
+ val := '0'
+ for _, rWant := range ns.Digits {
+ if rGot := info.Digit(val); rGot != rWant {
+ t.Errorf("%s:%d: got %U; want %U", ns.Id, val, rGot, rWant)
+ }
+ val++
+ }
+ }
+}
+
+func TestSymbols(t *testing.T) {
+ testtext.SkipIfNotLong(t)
+
+ draft, err := cldr.ParseDraft(*draft)
+ if err != nil {
+ log.Fatalf("invalid draft level: %v", err)
+ }
+
+ r := gen.OpenCLDRCoreZip()
+ defer r.Close()
+
+ d := &cldr.Decoder{}
+ d.SetDirFilter("main")
+ d.SetSectionFilter("numbers")
+ data, err := d.DecodeZip(r)
+ if err != nil {
+ t.Fatalf("DecodeZip: %v", err)
+ }
+
+ for _, lang := range data.Locales() {
+ ldml := data.RawLDML(lang)
+ if ldml.Numbers == nil {
+ continue
+ }
+ langIndex, ok := compact.FromTag(language.MustParse(lang))
+ if !ok {
+ t.Fatalf("No compact index for language %s", lang)
+ }
+
+ syms := cldr.MakeSlice(&ldml.Numbers.Symbols)
+ syms.SelectDraft(draft)
+
+ for _, sym := range ldml.Numbers.Symbols {
+ if sym.NumberSystem == "" {
+ continue
+ }
+ testCases := []struct {
+ name string
+ st SymbolType
+ x interface{}
+ }{
+ {"Decimal", SymDecimal, sym.Decimal},
+ {"Group", SymGroup, sym.Group},
+ {"List", SymList, sym.List},
+ {"PercentSign", SymPercentSign, sym.PercentSign},
+ {"PlusSign", SymPlusSign, sym.PlusSign},
+ {"MinusSign", SymMinusSign, sym.MinusSign},
+ {"Exponential", SymExponential, sym.Exponential},
+ {"SuperscriptingExponent", SymSuperscriptingExponent, sym.SuperscriptingExponent},
+ {"PerMille", SymPerMille, sym.PerMille},
+ {"Infinity", SymInfinity, sym.Infinity},
+ {"NaN", SymNan, sym.Nan},
+ {"TimeSeparator", SymTimeSeparator, sym.TimeSeparator},
+ }
+ info := InfoFromLangID(langIndex, sym.NumberSystem)
+ for _, tc := range testCases {
+ // Extract the wanted value.
+ v := reflect.ValueOf(tc.x)
+ if v.Len() == 0 {
+ return
+ }
+ if v.Len() > 1 {
+ t.Fatalf("Multiple values of %q within single symbol not supported.", tc.name)
+ }
+ want := v.Index(0).MethodByName("Data").Call(nil)[0].String()
+ got := info.Symbol(tc.st)
+ if got != want {
+ t.Errorf("%s:%s:%s: got %q; want %q", lang, sym.NumberSystem, tc.name, got, want)
+ }
+ }
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/stringset/set.go b/vendor/golang.org/x/text/internal/stringset/set.go
new file mode 100644
index 0000000..bb2fffb
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/stringset/set.go
@@ -0,0 +1,86 @@
+// 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 stringset provides a way to represent a collection of strings
+// compactly.
+package stringset
+
+import "sort"
+
+// A Set holds a collection of strings that can be looked up by an index number.
+type Set struct {
+ // These fields are exported to allow for code generation.
+
+ Data string
+ Index []uint16
+}
+
+// Elem returns the string with index i. It panics if i is out of range.
+func (s *Set) Elem(i int) string {
+ return s.Data[s.Index[i]:s.Index[i+1]]
+}
+
+// Len returns the number of strings in the set.
+func (s *Set) Len() int {
+ return len(s.Index) - 1
+}
+
+// Search returns the index of the given string or -1 if it is not in the set.
+// The Set must have been created with strings in sorted order.
+func Search(s *Set, str string) int {
+ // TODO: optimize this if it gets used a lot.
+ n := len(s.Index) - 1
+ p := sort.Search(n, func(i int) bool {
+ return s.Elem(i) >= str
+ })
+ if p == n || str != s.Elem(p) {
+ return -1
+ }
+ return p
+}
+
+// A Builder constructs Sets.
+type Builder struct {
+ set Set
+ index map[string]int
+}
+
+// NewBuilder returns a new and initialized Builder.
+func NewBuilder() *Builder {
+ return &Builder{
+ set: Set{
+ Index: []uint16{0},
+ },
+ index: map[string]int{},
+ }
+}
+
+// Set creates the set created so far.
+func (b *Builder) Set() Set {
+ return b.set
+}
+
+// Index returns the index for the given string, which must have been added
+// before.
+func (b *Builder) Index(s string) int {
+ return b.index[s]
+}
+
+// Add adds a string to the index. Strings that are added by a single Add will
+// be stored together, unless they match an existing string.
+func (b *Builder) Add(ss ...string) {
+ // First check if the string already exists.
+ for _, s := range ss {
+ if _, ok := b.index[s]; ok {
+ continue
+ }
+ b.index[s] = len(b.set.Index) - 1
+ b.set.Data += s
+ x := len(b.set.Data)
+ if x > 0xFFFF {
+ panic("Index too > 0xFFFF")
+ }
+ b.set.Index = append(b.set.Index, uint16(x))
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/stringset/set_test.go b/vendor/golang.org/x/text/internal/stringset/set_test.go
new file mode 100644
index 0000000..97b9e58
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/stringset/set_test.go
@@ -0,0 +1,53 @@
+// 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 stringset
+
+import "testing"
+
+func TestStringSet(t *testing.T) {
+ testCases := [][]string{
+ {""},
+ {"∫"},
+ {"a", "b", "c"},
+ {"", "a", "bb", "ccc"},
+ {" ", "aaa", "bb", "c"},
+ }
+ test := func(tc int, b *Builder) {
+ set := b.Set()
+ if set.Len() != len(testCases[tc]) {
+ t.Errorf("%d:Len() = %d; want %d", tc, set.Len(), len(testCases[tc]))
+ }
+ for i, s := range testCases[tc] {
+ if x := b.Index(s); x != i {
+ t.Errorf("%d:Index(%q) = %d; want %d", tc, s, x, i)
+ }
+ if p := Search(&set, s); p != i {
+ t.Errorf("%d:Search(%q) = %d; want %d", tc, s, p, i)
+ }
+ if set.Elem(i) != s {
+ t.Errorf("%d:Elem(%d) = %s; want %s", tc, i, set.Elem(i), s)
+ }
+ }
+ if p := Search(&set, "apple"); p != -1 {
+ t.Errorf(`%d:Search("apple") = %d; want -1`, tc, p)
+ }
+ }
+ for i, tc := range testCases {
+ b := NewBuilder()
+ for _, s := range tc {
+ b.Add(s)
+ }
+ b.Add(tc...)
+ test(i, b)
+ }
+ for i, tc := range testCases {
+ b := NewBuilder()
+ b.Add(tc...)
+ for _, s := range tc {
+ b.Add(s)
+ }
+ test(i, b)
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/tag/tag.go b/vendor/golang.org/x/text/internal/tag/tag.go
new file mode 100644
index 0000000..b5d3488
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/tag/tag.go
@@ -0,0 +1,100 @@
+// Copyright 2015 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 tag contains functionality handling tags and related data.
+package tag // import "golang.org/x/text/internal/tag"
+
+import "sort"
+
+// An Index converts tags to a compact numeric value.
+//
+// All elements are of size 4. Tags may be up to 4 bytes long. Excess bytes can
+// be used to store additional information about the tag.
+type Index string
+
+// Elem returns the element data at the given index.
+func (s Index) Elem(x int) string {
+ return string(s[x*4 : x*4+4])
+}
+
+// Index reports the index of the given key or -1 if it could not be found.
+// Only the first len(key) bytes from the start of the 4-byte entries will be
+// considered for the search and the first match in Index will be returned.
+func (s Index) Index(key []byte) int {
+ n := len(key)
+ // search the index of the first entry with an equal or higher value than
+ // key in s.
+ index := sort.Search(len(s)/4, func(i int) bool {
+ return cmp(s[i*4:i*4+n], key) != -1
+ })
+ i := index * 4
+ if cmp(s[i:i+len(key)], key) != 0 {
+ return -1
+ }
+ return index
+}
+
+// Next finds the next occurrence of key after index x, which must have been
+// obtained from a call to Index using the same key. It returns x+1 or -1.
+func (s Index) Next(key []byte, x int) int {
+ if x++; x*4 < len(s) && cmp(s[x*4:x*4+len(key)], key) == 0 {
+ return x
+ }
+ return -1
+}
+
+// cmp returns an integer comparing a and b lexicographically.
+func cmp(a Index, b []byte) int {
+ n := len(a)
+ if len(b) < n {
+ n = len(b)
+ }
+ for i, c := range b[:n] {
+ switch {
+ case a[i] > c:
+ return 1
+ case a[i] < c:
+ return -1
+ }
+ }
+ switch {
+ case len(a) < len(b):
+ return -1
+ case len(a) > len(b):
+ return 1
+ }
+ return 0
+}
+
+// Compare returns an integer comparing a and b lexicographically.
+func Compare(a string, b []byte) int {
+ return cmp(Index(a), b)
+}
+
+// FixCase reformats b to the same pattern of cases as form.
+// If returns false if string b is malformed.
+func FixCase(form string, b []byte) bool {
+ if len(form) != len(b) {
+ return false
+ }
+ for i, c := range b {
+ if form[i] <= 'Z' {
+ if c >= 'a' {
+ c -= 'z' - 'Z'
+ }
+ if c < 'A' || 'Z' < c {
+ return false
+ }
+ } else {
+ if c <= 'Z' {
+ c += 'z' - 'Z'
+ }
+ if c < 'a' || 'z' < c {
+ return false
+ }
+ }
+ b[i] = c
+ }
+ return true
+}
diff --git a/vendor/golang.org/x/text/internal/tag/tag_test.go b/vendor/golang.org/x/text/internal/tag/tag_test.go
new file mode 100644
index 0000000..da174a2
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/tag/tag_test.go
@@ -0,0 +1,67 @@
+// Copyright 2015 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 tag
+
+import (
+ "strings"
+ "testing"
+)
+
+var strdata = []string{
+ "aa ",
+ "aaa ",
+ "aaaa",
+ "aaab",
+ "aab ",
+ "ab ",
+ "ba ",
+ "xxxx",
+ "\xff\xff\xff\xff",
+}
+
+var testCases = map[string]int{
+ "a": 0,
+ "aa": 0,
+ "aaa": 1,
+ "aa ": 0,
+ "aaaa": 2,
+ "aaab": 3,
+ "b": 6,
+ "ba": 6,
+ " ": -1,
+ "aaax": -1,
+ "bbbb": -1,
+ "zzzz": -1,
+}
+
+func TestIndex(t *testing.T) {
+ index := Index(strings.Join(strdata, ""))
+ for k, v := range testCases {
+ if i := index.Index([]byte(k)); i != v {
+ t.Errorf("%s: got %d; want %d", k, i, v)
+ }
+ }
+}
+
+func TestFixCase(t *testing.T) {
+ tests := []string{
+ "aaaa", "AbCD", "abcd",
+ "Zzzz", "AbCD", "Abcd",
+ "Zzzz", "AbC", "",
+ "XXX", "ab ", "",
+ "XXX", "usd", "USD",
+ "cmn", "AB ", "",
+ "gsw", "CMN", "cmn",
+ }
+ for tc := tests; len(tc) > 0; tc = tc[3:] {
+ b := []byte(tc[1])
+ if !FixCase(tc[0], b) {
+ b = nil
+ }
+ if string(b) != tc[2] {
+ t.Errorf("FixCase(%q, %q) = %q; want %q", tc[0], tc[1], b, tc[2])
+ }
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/testtext/codesize.go b/vendor/golang.org/x/text/internal/testtext/codesize.go
new file mode 100644
index 0000000..5fc5eae
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/testtext/codesize.go
@@ -0,0 +1,53 @@
+// Copyright 2015 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 testtext
+
+import (
+ "bytes"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "runtime"
+)
+
+// CodeSize builds the given code sample and returns the binary size or en error
+// if an error occurred. The code sample typically will look like this:
+// package main
+// import "golang.org/x/text/somepackage"
+// func main() {
+// somepackage.Func() // reference Func to cause it to be linked in.
+// }
+// See dict_test.go in the display package for an example.
+func CodeSize(s string) (int, error) {
+ // Write the file.
+ tmpdir, err := ioutil.TempDir(os.TempDir(), "testtext")
+ if err != nil {
+ return 0, fmt.Errorf("testtext: failed to create tmpdir: %v", err)
+ }
+ defer os.RemoveAll(tmpdir)
+ filename := filepath.Join(tmpdir, "main.go")
+ if err := ioutil.WriteFile(filename, []byte(s), 0644); err != nil {
+ return 0, fmt.Errorf("testtext: failed to write main.go: %v", err)
+ }
+
+ // Build the binary.
+ w := &bytes.Buffer{}
+ cmd := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), "build", "-o", "main")
+ cmd.Dir = tmpdir
+ cmd.Stderr = w
+ cmd.Stdout = w
+ if err := cmd.Run(); err != nil {
+ return 0, fmt.Errorf("testtext: failed to execute command: %v\nmain.go:\n%vErrors:%s", err, s, w)
+ }
+
+ // Determine the size.
+ fi, err := os.Stat(filepath.Join(tmpdir, "main"))
+ if err != nil {
+ return 0, fmt.Errorf("testtext: failed to get file info: %v", err)
+ }
+ return int(fi.Size()), nil
+}
diff --git a/vendor/golang.org/x/text/internal/testtext/flag.go b/vendor/golang.org/x/text/internal/testtext/flag.go
new file mode 100644
index 0000000..45b32b2
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/testtext/flag.go
@@ -0,0 +1,22 @@
+// Copyright 2015 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 testtext
+
+import (
+ "flag"
+ "testing"
+
+ "golang.org/x/text/internal/gen"
+)
+
+var long = flag.Bool("long", false,
+ "run tests that require fetching data online")
+
+// SkipIfNotLong returns whether long tests should be performed.
+func SkipIfNotLong(t *testing.T) {
+ if testing.Short() || !(gen.IsLocal() || *long) {
+ t.Skip("skipping test to prevent downloading; to run use -long or use -local or UNICODE_DIR to specify a local source")
+ }
+}
diff --git a/vendor/golang.org/x/text/internal/testtext/gc.go b/vendor/golang.org/x/text/internal/testtext/gc.go
new file mode 100644
index 0000000..a54e1bc
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/testtext/gc.go
@@ -0,0 +1,14 @@
+// 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 !gccgo
+
+package testtext
+
+import "testing"
+
+// AllocsPerRun wraps testing.AllocsPerRun.
+func AllocsPerRun(runs int, f func()) (avg float64) {
+ return testing.AllocsPerRun(runs, f)
+}
diff --git a/vendor/golang.org/x/text/internal/testtext/gccgo.go b/vendor/golang.org/x/text/internal/testtext/gccgo.go
new file mode 100644
index 0000000..30e98ef
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/testtext/gccgo.go
@@ -0,0 +1,11 @@
+// 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 gccgo
+
+package testtext
+
+// AllocsPerRun always returns 0 for gccgo until gccgo implements escape
+// analysis equal or better to that of gc.
+func AllocsPerRun(runs int, f func()) (avg float64) { return 0 }
diff --git a/vendor/golang.org/x/text/internal/testtext/go1_6.go b/vendor/golang.org/x/text/internal/testtext/go1_6.go
new file mode 100644
index 0000000..7b23847
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/testtext/go1_6.go
@@ -0,0 +1,23 @@
+// 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 !go1.7
+
+package testtext
+
+import "testing"
+
+func Run(t *testing.T, name string, fn func(t *testing.T)) bool {
+ t.Logf("Running %s...", name)
+ fn(t)
+ return t.Failed()
+}
+
+// Bench runs the given benchmark function. This pre-1.7 implementation renders
+// the measurement useless, but allows the code to be compiled at least.
+func Bench(b *testing.B, name string, fn func(b *testing.B)) bool {
+ b.Logf("Running %s...", name)
+ fn(b)
+ return b.Failed()
+}
diff --git a/vendor/golang.org/x/text/internal/testtext/go1_7.go b/vendor/golang.org/x/text/internal/testtext/go1_7.go
new file mode 100644
index 0000000..66f9cf7
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/testtext/go1_7.go
@@ -0,0 +1,17 @@
+// 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 go1.7
+
+package testtext
+
+import "testing"
+
+func Run(t *testing.T, name string, fn func(t *testing.T)) bool {
+ return t.Run(name, fn)
+}
+
+func Bench(b *testing.B, name string, fn func(b *testing.B)) bool {
+ return b.Run(name, fn)
+}
diff --git a/vendor/golang.org/x/text/internal/testtext/text.go b/vendor/golang.org/x/text/internal/testtext/text.go
new file mode 100644
index 0000000..ce40d7e
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/testtext/text.go
@@ -0,0 +1,105 @@
+// Copyright 2015 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 testtext contains test data that is of common use to the text
+// repository.
+package testtext // import "golang.org/x/text/internal/testtext"
+
+const (
+
+ // ASCII is an ASCII string containing all letters in the English alphabet.
+ ASCII = "The quick brown fox jumps over the lazy dog. " +
+ "The quick brown fox jumps over the lazy dog. " +
+ "The quick brown fox jumps over the lazy dog. " +
+ "The quick brown fox jumps over the lazy dog. " +
+ "The quick brown fox jumps over the lazy dog. " +
+ "The quick brown fox jumps over the lazy dog. " +
+ "The quick brown fox jumps over the lazy dog. " +
+ "The quick brown fox jumps over the lazy dog. " +
+ "The quick brown fox jumps over the lazy dog. " +
+ "The quick brown fox jumps over the lazy dog. "
+
+ // Vietnamese is a snippet from http://creativecommons.org/licenses/by-sa/3.0/vn/
+ Vietnamese = `Với các điều kiện sau: Ghi nhận công của tác giả.
+Nếu bạn sử dụng, chuyển đổi, hoặc xây dựng dự án từ
+nội dung được chia sẻ này, bạn phải áp dụng giấy phép này hoặc
+một giấy phép khác có các điều khoản tương tự như giấy phép này
+cho dự án của bạn. Hiểu rằng: Miễn — Bất kỳ các điều kiện nào
+trên đây cũng có thể được miễn bỏ nếu bạn được sự cho phép của
+người sở hữu bản quyền. Phạm vi công chúng — Khi tác phẩm hoặc
+bất kỳ chương nào của tác phẩm đã trong vùng dành cho công
+chúng theo quy định của pháp luật thì tình trạng của nó không
+bị ảnh hưởng bởi giấy phép trong bất kỳ trường hợp nào.`
+
+ // Russian is a snippet from http://creativecommons.org/licenses/by-sa/1.0/deed.ru
+ Russian = `При обязательном соблюдении следующих условий:
+Attribution — Вы должны атрибутировать произведение (указывать
+автора и источник) в порядке, предусмотренном автором или
+лицензиаром (но только так, чтобы никоим образом не подразумевалось,
+что они поддерживают вас или использование вами данного произведения).
+Υπό τις ακόλουθες προϋποθέσεις:`
+
+ // Greek is a snippet from http://creativecommons.org/licenses/by-sa/3.0/gr/
+ Greek = `Αναφορά Δημιουργού — Θα πρέπει να κάνετε την αναφορά στο έργο με τον
+τρόπο που έχει οριστεί από το δημιουργό ή το χορηγούντο την άδεια
+(χωρίς όμως να εννοείται με οποιονδήποτε τρόπο ότι εγκρίνουν εσάς ή
+τη χρήση του έργου από εσάς). Παρόμοια Διανομή — Εάν αλλοιώσετε,
+τροποποιήσετε ή δημιουργήσετε περαιτέρω βασισμένοι στο έργο θα
+μπορείτε να διανέμετε το έργο που θα προκύψει μόνο με την ίδια ή
+παρόμοια άδεια.`
+
+ // Arabic is a snippet from http://creativecommons.org/licenses/by-sa/3.0/deed.ar
+ Arabic = `بموجب الشروط التالية نسب المصنف — يجب عليك أن
+تنسب العمل بالطريقة التي تحددها المؤلف أو المرخص (ولكن ليس بأي حال من
+الأحوال أن توحي وتقترح بتحول أو استخدامك للعمل).
+المشاركة على قدم المساواة — إذا كنت يعدل ، والتغيير ، أو الاستفادة
+من هذا العمل ، قد ينتج عن توزيع العمل إلا في ظل تشابه او تطابق فى واحد
+لهذا الترخيص.`
+
+ // Hebrew is a snippet from http://creativecommons.org/licenses/by-sa/1.0/il/
+ Hebrew = `בכפוף לתנאים הבאים: ייחוס — עליך לייחס את היצירה (לתת קרדיט) באופן
+המצויין על-ידי היוצר או מעניק הרישיון (אך לא בשום אופן המרמז על כך
+שהם תומכים בך או בשימוש שלך ביצירה). שיתוף זהה — אם תחליט/י לשנות,
+לעבד או ליצור יצירה נגזרת בהסתמך על יצירה זו, תוכל/י להפיץ את יצירתך
+החדשה רק תחת אותו הרישיון או רישיון דומה לרישיון זה.`
+
+ TwoByteUTF8 = Russian + Greek + Arabic + Hebrew
+
+ // Thai is a snippet from http://creativecommons.org/licenses/by-sa/3.0/th/
+ Thai = `ภายใต้เงื่อนไข ดังต่อไปนี้ : แสดงที่มา — คุณต้องแสดงที่
+มาของงานดังกล่าว ตามรูปแบบที่ผู้สร้างสรรค์หรือผู้อนุญาตกำหนด (แต่
+ไม่ใช่ในลักษณะที่ว่า พวกเขาสนับสนุนคุณหรือสนับสนุนการที่
+คุณนำงานไปใช้) อนุญาตแบบเดียวกัน — หากคุณดัดแปลง เปลี่ยนรูป หรื
+อต่อเติมงานนี้ คุณต้องใช้สัญญาอนุญาตแบบเดียวกันหรือแบบที่เหมื
+อนกับสัญญาอนุญาตที่ใช้กับงานนี้เท่านั้น`
+
+ ThreeByteUTF8 = Thai
+
+ // Japanese is a snippet from http://creativecommons.org/licenses/by-sa/2.0/jp/
+ Japanese = `あなたの従うべき条件は以下の通りです。
+表示 — あなたは原著作者のクレジットを表示しなければなりません。
+継承 — もしあなたがこの作品を改変、変形または加工した場合、
+あなたはその結果生じた作品をこの作品と同一の許諾条件の下でのみ
+頒布することができます。`
+
+ // Chinese is a snippet from http://creativecommons.org/licenses/by-sa/2.5/cn/
+ Chinese = `您可以自由: 复制、发行、展览、表演、放映、
+广播或通过信息网络传播本作品 创作演绎作品
+对本作品进行商业性使用 惟须遵守下列条件:
+署名 — 您必须按照作者或者许可人指定的方式对作品进行署名。
+相同方式共享 — 如果您改变、转换本作品或者以本作品为基础进行创作,
+您只能采用与本协议相同的许可协议发布基于本作品的演绎作品。`
+
+ // Korean is a snippet from http://creativecommons.org/licenses/by-sa/2.0/kr/
+ Korean = `다음과 같은 조건을 따라야 합니다: 저작자표시
+— 저작자나 이용허락자가 정한 방법으로 저작물의
+원저작자를 표시하여야 합니다(그러나 원저작자가 이용자나 이용자의
+이용을 보증하거나 추천한다는 의미로 표시해서는 안됩니다).
+동일조건변경허락 — 이 저작물을 이용하여 만든 이차적 저작물에는 본
+라이선스와 동일한 라이선스를 적용해야 합니다.`
+
+ CJK = Chinese + Japanese + Korean
+
+ All = ASCII + Vietnamese + TwoByteUTF8 + ThreeByteUTF8 + CJK
+)
diff --git a/vendor/golang.org/x/text/internal/ucd/example_test.go b/vendor/golang.org/x/text/internal/ucd/example_test.go
new file mode 100644
index 0000000..338a50d
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/ucd/example_test.go
@@ -0,0 +1,81 @@
+// Copyright 2014 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 ucd_test
+
+import (
+ "fmt"
+ "strings"
+
+ "golang.org/x/text/internal/ucd"
+)
+
+func Example() {
+ // Read rune-by-rune from UnicodeData.
+ var count int
+ p := ucd.New(strings.NewReader(unicodeData))
+ for p.Next() {
+ count++
+ if lower := p.Runes(ucd.SimpleLowercaseMapping); lower != nil {
+ fmt.Printf("lower(%U) -> %U\n", p.Rune(0), lower[0])
+ }
+ }
+ if err := p.Err(); err != nil {
+ fmt.Println(err)
+ }
+ fmt.Println("Number of runes visited:", count)
+
+ // Read raw ranges from Scripts.
+ p = ucd.New(strings.NewReader(scripts), ucd.KeepRanges)
+ for p.Next() {
+ start, end := p.Range(0)
+ fmt.Printf("%04X..%04X: %s\n", start, end, p.String(1))
+ }
+ if err := p.Err(); err != nil {
+ fmt.Println(err)
+ }
+
+ // Output:
+ // lower(U+00C0) -> U+00E0
+ // lower(U+00C1) -> U+00E1
+ // lower(U+00C2) -> U+00E2
+ // lower(U+00C3) -> U+00E3
+ // lower(U+00C4) -> U+00E4
+ // Number of runes visited: 6594
+ // 0000..001F: Common
+ // 0020..0020: Common
+ // 0021..0023: Common
+ // 0024..0024: Common
+}
+
+// Excerpt from UnicodeData.txt
+const unicodeData = `
+00B9;SUPERSCRIPT ONE;No;0;EN;<super> 0031;;1;1;N;SUPERSCRIPT DIGIT ONE;;;;
+00BA;MASCULINE ORDINAL INDICATOR;Lo;0;L;<super> 006F;;;;N;;;;;
+00BB;RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK;Pf;0;ON;;;;;Y;RIGHT POINTING GUILLEMET;;;;
+00BC;VULGAR FRACTION ONE QUARTER;No;0;ON;<fraction> 0031 2044 0034;;;1/4;N;FRACTION ONE QUARTER;;;;
+00BD;VULGAR FRACTION ONE HALF;No;0;ON;<fraction> 0031 2044 0032;;;1/2;N;FRACTION ONE HALF;;;;
+00BE;VULGAR FRACTION THREE QUARTERS;No;0;ON;<fraction> 0033 2044 0034;;;3/4;N;FRACTION THREE QUARTERS;;;;
+00BF;INVERTED QUESTION MARK;Po;0;ON;;;;;N;;;;;
+00C0;LATIN CAPITAL LETTER A WITH GRAVE;Lu;0;L;0041 0300;;;;N;LATIN CAPITAL LETTER A GRAVE;;;00E0;
+00C1;LATIN CAPITAL LETTER A WITH ACUTE;Lu;0;L;0041 0301;;;;N;LATIN CAPITAL LETTER A ACUTE;;;00E1;
+00C2;LATIN CAPITAL LETTER A WITH CIRCUMFLEX;Lu;0;L;0041 0302;;;;N;LATIN CAPITAL LETTER A CIRCUMFLEX;;;00E2;
+00C3;LATIN CAPITAL LETTER A WITH TILDE;Lu;0;L;0041 0303;;;;N;LATIN CAPITAL LETTER A TILDE;;;00E3;
+00C4;LATIN CAPITAL LETTER A WITH DIAERESIS;Lu;0;L;0041 0308;;;;N;LATIN CAPITAL LETTER A DIAERESIS;;;00E4;
+
+# A legacy rune range.
+3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
+4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;
+`
+
+// Excerpt from Scripts.txt
+const scripts = `
+# Property: Script
+# ================================================
+
+0000..001F ; Common # Cc [32] <control-0000>..<control-001F>
+0020 ; Common # Zs SPACE
+0021..0023 ; Common # Po [3] EXCLAMATION MARK..NUMBER SIGN
+0024 ; Common # Sc DOLLAR SIGN
+`
diff --git a/vendor/golang.org/x/text/internal/ucd/ucd.go b/vendor/golang.org/x/text/internal/ucd/ucd.go
new file mode 100644
index 0000000..0879bc8
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/ucd/ucd.go
@@ -0,0 +1,371 @@
+// Copyright 2014 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 ucd provides a parser for Unicode Character Database files, the
+// format of which is defined in https://www.unicode.org/reports/tr44/. See
+// https://www.unicode.org/Public/UCD/latest/ucd/ for example files.
+//
+// It currently does not support substitutions of missing fields.
+package ucd // import "golang.org/x/text/internal/ucd"
+
+import (
+ "bufio"
+ "errors"
+ "fmt"
+ "io"
+ "log"
+ "regexp"
+ "strconv"
+ "strings"
+)
+
+// UnicodeData.txt fields.
+const (
+ CodePoint = iota
+ Name
+ GeneralCategory
+ CanonicalCombiningClass
+ BidiClass
+ DecompMapping
+ DecimalValue
+ DigitValue
+ NumericValue
+ BidiMirrored
+ Unicode1Name
+ ISOComment
+ SimpleUppercaseMapping
+ SimpleLowercaseMapping
+ SimpleTitlecaseMapping
+)
+
+// Parse calls f for each entry in the given reader of a UCD file. It will close
+// the reader upon return. It will call log.Fatal if any error occurred.
+//
+// This implements the most common usage pattern of using Parser.
+func Parse(r io.ReadCloser, f func(p *Parser)) {
+ defer r.Close()
+
+ p := New(r)
+ for p.Next() {
+ f(p)
+ }
+ if err := p.Err(); err != nil {
+ r.Close() // os.Exit will cause defers not to be called.
+ log.Fatal(err)
+ }
+}
+
+// An Option is used to configure a Parser.
+type Option func(p *Parser)
+
+func keepRanges(p *Parser) {
+ p.keepRanges = true
+}
+
+var (
+ // KeepRanges prevents the expansion of ranges. The raw ranges can be
+ // obtained by calling Range(0) on the parser.
+ KeepRanges Option = keepRanges
+)
+
+// The Part option register a handler for lines starting with a '@'. The text
+// after a '@' is available as the first field. Comments are handled as usual.
+func Part(f func(p *Parser)) Option {
+ return func(p *Parser) {
+ p.partHandler = f
+ }
+}
+
+// The CommentHandler option passes comments that are on a line by itself to
+// a given handler.
+func CommentHandler(f func(s string)) Option {
+ return func(p *Parser) {
+ p.commentHandler = f
+ }
+}
+
+// A Parser parses Unicode Character Database (UCD) files.
+type Parser struct {
+ scanner *bufio.Scanner
+
+ keepRanges bool // Don't expand rune ranges in field 0.
+
+ err error
+ comment string
+ field []string
+ // parsedRange is needed in case Range(0) is called more than once for one
+ // field. In some cases this requires scanning ahead.
+ line int
+ parsedRange bool
+ rangeStart, rangeEnd rune
+
+ partHandler func(p *Parser)
+ commentHandler func(s string)
+}
+
+func (p *Parser) setError(err error, msg string) {
+ if p.err == nil && err != nil {
+ if msg == "" {
+ p.err = fmt.Errorf("ucd:line:%d: %v", p.line, err)
+ } else {
+ p.err = fmt.Errorf("ucd:line:%d:%s: %v", p.line, msg, err)
+ }
+ }
+}
+
+func (p *Parser) getField(i int) string {
+ if i >= len(p.field) {
+ return ""
+ }
+ return p.field[i]
+}
+
+// Err returns a non-nil error if any error occurred during parsing.
+func (p *Parser) Err() error {
+ return p.err
+}
+
+// New returns a Parser for the given Reader.
+func New(r io.Reader, o ...Option) *Parser {
+ p := &Parser{
+ scanner: bufio.NewScanner(r),
+ }
+ for _, f := range o {
+ f(p)
+ }
+ return p
+}
+
+// Next parses the next line in the file. It returns true if a line was parsed
+// and false if it reached the end of the file.
+func (p *Parser) Next() bool {
+ if !p.keepRanges && p.rangeStart < p.rangeEnd {
+ p.rangeStart++
+ return true
+ }
+ p.comment = ""
+ p.field = p.field[:0]
+ p.parsedRange = false
+
+ for p.scanner.Scan() && p.err == nil {
+ p.line++
+ s := p.scanner.Text()
+ if s == "" {
+ continue
+ }
+ if s[0] == '#' {
+ if p.commentHandler != nil {
+ p.commentHandler(strings.TrimSpace(s[1:]))
+ }
+ continue
+ }
+
+ // Parse line
+ if i := strings.IndexByte(s, '#'); i != -1 {
+ p.comment = strings.TrimSpace(s[i+1:])
+ s = s[:i]
+ }
+ if s[0] == '@' {
+ if p.partHandler != nil {
+ p.field = append(p.field, strings.TrimSpace(s[1:]))
+ p.partHandler(p)
+ p.field = p.field[:0]
+ }
+ p.comment = ""
+ continue
+ }
+ for {
+ i := strings.IndexByte(s, ';')
+ if i == -1 {
+ p.field = append(p.field, strings.TrimSpace(s))
+ break
+ }
+ p.field = append(p.field, strings.TrimSpace(s[:i]))
+ s = s[i+1:]
+ }
+ if !p.keepRanges {
+ p.rangeStart, p.rangeEnd = p.getRange(0)
+ }
+ return true
+ }
+ p.setError(p.scanner.Err(), "scanner failed")
+ return false
+}
+
+func parseRune(b string) (rune, error) {
+ if len(b) > 2 && b[0] == 'U' && b[1] == '+' {
+ b = b[2:]
+ }
+ x, err := strconv.ParseUint(b, 16, 32)
+ return rune(x), err
+}
+
+func (p *Parser) parseRune(s string) rune {
+ x, err := parseRune(s)
+ p.setError(err, "failed to parse rune")
+ return x
+}
+
+// Rune parses and returns field i as a rune.
+func (p *Parser) Rune(i int) rune {
+ if i > 0 || p.keepRanges {
+ return p.parseRune(p.getField(i))
+ }
+ return p.rangeStart
+}
+
+// Runes interprets and returns field i as a sequence of runes.
+func (p *Parser) Runes(i int) (runes []rune) {
+ add := func(s string) {
+ if s = strings.TrimSpace(s); len(s) > 0 {
+ runes = append(runes, p.parseRune(s))
+ }
+ }
+ for b := p.getField(i); ; {
+ i := strings.IndexByte(b, ' ')
+ if i == -1 {
+ add(b)
+ break
+ }
+ add(b[:i])
+ b = b[i+1:]
+ }
+ return
+}
+
+var (
+ errIncorrectLegacyRange = errors.New("ucd: unmatched <* First>")
+
+ // reRange matches one line of a legacy rune range.
+ reRange = regexp.MustCompile("^([0-9A-F]*);<([^,]*), ([^>]*)>(.*)$")
+)
+
+// Range parses and returns field i as a rune range. A range is inclusive at
+// both ends. If the field only has one rune, first and last will be identical.
+// It supports the legacy format for ranges used in UnicodeData.txt.
+func (p *Parser) Range(i int) (first, last rune) {
+ if !p.keepRanges {
+ return p.rangeStart, p.rangeStart
+ }
+ return p.getRange(i)
+}
+
+func (p *Parser) getRange(i int) (first, last rune) {
+ b := p.getField(i)
+ if k := strings.Index(b, ".."); k != -1 {
+ return p.parseRune(b[:k]), p.parseRune(b[k+2:])
+ }
+ // The first field may not be a rune, in which case we may ignore any error
+ // and set the range as 0..0.
+ x, err := parseRune(b)
+ if err != nil {
+ // Disable range parsing henceforth. This ensures that an error will be
+ // returned if the user subsequently will try to parse this field as
+ // a Rune.
+ p.keepRanges = true
+ }
+ // Special case for UnicodeData that was retained for backwards compatibility.
+ if i == 0 && len(p.field) > 1 && strings.HasSuffix(p.field[1], "First>") {
+ if p.parsedRange {
+ return p.rangeStart, p.rangeEnd
+ }
+ mf := reRange.FindStringSubmatch(p.scanner.Text())
+ p.line++
+ if mf == nil || !p.scanner.Scan() {
+ p.setError(errIncorrectLegacyRange, "")
+ return x, x
+ }
+ // Using Bytes would be more efficient here, but Text is a lot easier
+ // and this is not a frequent case.
+ ml := reRange.FindStringSubmatch(p.scanner.Text())
+ if ml == nil || mf[2] != ml[2] || ml[3] != "Last" || mf[4] != ml[4] {
+ p.setError(errIncorrectLegacyRange, "")
+ return x, x
+ }
+ p.rangeStart, p.rangeEnd = x, p.parseRune(p.scanner.Text()[:len(ml[1])])
+ p.parsedRange = true
+ return p.rangeStart, p.rangeEnd
+ }
+ return x, x
+}
+
+// bools recognizes all valid UCD boolean values.
+var bools = map[string]bool{
+ "": false,
+ "N": false,
+ "No": false,
+ "F": false,
+ "False": false,
+ "Y": true,
+ "Yes": true,
+ "T": true,
+ "True": true,
+}
+
+// Bool parses and returns field i as a boolean value.
+func (p *Parser) Bool(i int) bool {
+ f := p.getField(i)
+ for s, v := range bools {
+ if f == s {
+ return v
+ }
+ }
+ p.setError(strconv.ErrSyntax, "error parsing bool")
+ return false
+}
+
+// Int parses and returns field i as an integer value.
+func (p *Parser) Int(i int) int {
+ x, err := strconv.ParseInt(string(p.getField(i)), 10, 64)
+ p.setError(err, "error parsing int")
+ return int(x)
+}
+
+// Uint parses and returns field i as an unsigned integer value.
+func (p *Parser) Uint(i int) uint {
+ x, err := strconv.ParseUint(string(p.getField(i)), 10, 64)
+ p.setError(err, "error parsing uint")
+ return uint(x)
+}
+
+// Float parses and returns field i as a decimal value.
+func (p *Parser) Float(i int) float64 {
+ x, err := strconv.ParseFloat(string(p.getField(i)), 64)
+ p.setError(err, "error parsing float")
+ return x
+}
+
+// String parses and returns field i as a string value.
+func (p *Parser) String(i int) string {
+ return string(p.getField(i))
+}
+
+// Strings parses and returns field i as a space-separated list of strings.
+func (p *Parser) Strings(i int) []string {
+ ss := strings.Split(string(p.getField(i)), " ")
+ for i, s := range ss {
+ ss[i] = strings.TrimSpace(s)
+ }
+ return ss
+}
+
+// Comment returns the comments for the current line.
+func (p *Parser) Comment() string {
+ return string(p.comment)
+}
+
+var errUndefinedEnum = errors.New("ucd: undefined enum value")
+
+// Enum interprets and returns field i as a value that must be one of the values
+// in enum.
+func (p *Parser) Enum(i int, enum ...string) string {
+ f := p.getField(i)
+ for _, s := range enum {
+ if f == s {
+ return s
+ }
+ }
+ p.setError(errUndefinedEnum, "error parsing enum")
+ return ""
+}
diff --git a/vendor/golang.org/x/text/internal/ucd/ucd_test.go b/vendor/golang.org/x/text/internal/ucd/ucd_test.go
new file mode 100644
index 0000000..70ca541
--- /dev/null
+++ b/vendor/golang.org/x/text/internal/ucd/ucd_test.go
@@ -0,0 +1,105 @@
+package ucd
+
+import (
+ "strings"
+ "testing"
+)
+
+const file = `
+# Comments should be skipped
+# rune; bool; uint; int; float; runes; # Y
+0..0005; Y; 0; 2; -5.25 ; 0 1 2 3 4 5;
+6..0007; Yes ; 6; 1; -4.25 ; 0006 0007;
+8; T ; 8 ; 0 ;-3.25 ;;# T
+9; True ;9 ; -1;-2.25 ; 0009;
+
+# more comments to be ignored
+@Part0
+
+A; N; 10 ; -2; -1.25; ;# N
+B; No; 11 ; -3; -0.25;
+C; False;12; -4; 0.75;
+D; ;13;-5;1.75;
+
+@Part1 # Another part.
+# We test part comments get removed by not commenting the next line.
+E..10FFFF; F; 14 ; -6; 2.75;
+`
+
+var want = []struct {
+ start, end rune
+}{
+ {0x00, 0x05},
+ {0x06, 0x07},
+ {0x08, 0x08},
+ {0x09, 0x09},
+ {0x0A, 0x0A},
+ {0x0B, 0x0B},
+ {0x0C, 0x0C},
+ {0x0D, 0x0D},
+ {0x0E, 0x10FFFF},
+}
+
+func TestGetters(t *testing.T) {
+ parts := [][2]string{
+ {"Part0", ""},
+ {"Part1", "Another part."},
+ }
+ handler := func(p *Parser) {
+ if len(parts) == 0 {
+ t.Error("Part handler invoked too many times.")
+ return
+ }
+ want := parts[0]
+ parts = parts[1:]
+ if got0, got1 := p.String(0), p.Comment(); got0 != want[0] || got1 != want[1] {
+ t.Errorf(`part: got %q, %q; want %q"`, got0, got1, want)
+ }
+ }
+
+ p := New(strings.NewReader(file), KeepRanges, Part(handler))
+ for i := 0; p.Next(); i++ {
+ start, end := p.Range(0)
+ w := want[i]
+ if start != w.start || end != w.end {
+ t.Fatalf("%d:Range(0); got %#x..%#x; want %#x..%#x", i, start, end, w.start, w.end)
+ }
+ if w.start == w.end && p.Rune(0) != w.start {
+ t.Errorf("%d:Range(0).start: got %U; want %U", i, p.Rune(0), w.start)
+ }
+ if got, want := p.Bool(1), w.start <= 9; got != want {
+ t.Errorf("%d:Bool(1): got %v; want %v", i, got, want)
+ }
+ if got := p.Rune(4); got != 0 || p.Err() == nil {
+ t.Errorf("%d:Rune(%q): got no error; want error", i, p.String(1))
+ }
+ p.err = nil
+ if got := p.Uint(2); rune(got) != start {
+ t.Errorf("%d:Uint(2): got %v; want %v", i, got, start)
+ }
+ if got, want := p.Int(3), 2-i; got != want {
+ t.Errorf("%d:Int(3): got %v; want %v", i, got, want)
+ }
+ if got, want := p.Float(4), -5.25+float64(i); got != want {
+ t.Errorf("%d:Int(3): got %v; want %v", i, got, want)
+ }
+ if got := p.Runes(5); got == nil {
+ if p.String(5) != "" {
+ t.Errorf("%d:Runes(5): expected non-empty list", i)
+ }
+ } else {
+ if got[0] != start || got[len(got)-1] != end {
+ t.Errorf("%d:Runes(5): got %#x; want %#x..%#x", i, got, start, end)
+ }
+ }
+ if got := p.Comment(); got != "" && got != p.String(1) {
+ t.Errorf("%d:Comment(): got %v; want %v", i, got, p.String(1))
+ }
+ }
+ if err := p.Err(); err != nil {
+ t.Errorf("Parser error: %v", err)
+ }
+ if len(parts) != 0 {
+ t.Errorf("expected %d more invocations of part handler", len(parts))
+ }
+}