forked from lug/matterbridge
		
	Update vendor
This commit is contained in:
		
							
								
								
									
										137
									
								
								vendor/golang.org/x/text/encoding/internal/identifier/gen.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										137
									
								
								vendor/golang.org/x/text/encoding/internal/identifier/gen.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,137 @@ | ||||
| // 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 | ||||
|  | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"encoding/xml" | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"log" | ||||
| 	"strings" | ||||
|  | ||||
| 	"golang.org/x/text/internal/gen" | ||||
| ) | ||||
|  | ||||
| type registry struct { | ||||
| 	XMLName  xml.Name `xml:"registry"` | ||||
| 	Updated  string   `xml:"updated"` | ||||
| 	Registry []struct { | ||||
| 		ID     string `xml:"id,attr"` | ||||
| 		Record []struct { | ||||
| 			Name string `xml:"name"` | ||||
| 			Xref []struct { | ||||
| 				Type string `xml:"type,attr"` | ||||
| 				Data string `xml:"data,attr"` | ||||
| 			} `xml:"xref"` | ||||
| 			Desc struct { | ||||
| 				Data string `xml:",innerxml"` | ||||
| 				// Any []struct { | ||||
| 				// 	Data string `xml:",chardata"` | ||||
| 				// } `xml:",any"` | ||||
| 				// Data string `xml:",chardata"` | ||||
| 			} `xml:"description,"` | ||||
| 			MIB   string   `xml:"value"` | ||||
| 			Alias []string `xml:"alias"` | ||||
| 			MIME  string   `xml:"preferred_alias"` | ||||
| 		} `xml:"record"` | ||||
| 	} `xml:"registry"` | ||||
| } | ||||
|  | ||||
| func main() { | ||||
| 	r := gen.OpenIANAFile("assignments/character-sets/character-sets.xml") | ||||
| 	reg := ®istry{} | ||||
| 	if err := xml.NewDecoder(r).Decode(®); err != nil && err != io.EOF { | ||||
| 		log.Fatalf("Error decoding charset registry: %v", err) | ||||
| 	} | ||||
| 	if len(reg.Registry) == 0 || reg.Registry[0].ID != "character-sets-1" { | ||||
| 		log.Fatalf("Unexpected ID %s", reg.Registry[0].ID) | ||||
| 	} | ||||
|  | ||||
| 	w := &bytes.Buffer{} | ||||
| 	fmt.Fprintf(w, "const (\n") | ||||
| 	for _, rec := range reg.Registry[0].Record { | ||||
| 		constName := "" | ||||
| 		for _, a := range rec.Alias { | ||||
| 			if strings.HasPrefix(a, "cs") && strings.IndexByte(a, '-') == -1 { | ||||
| 				// Some of the constant definitions have comments in them. Strip those. | ||||
| 				constName = strings.Title(strings.SplitN(a[2:], "\n", 2)[0]) | ||||
| 			} | ||||
| 		} | ||||
| 		if constName == "" { | ||||
| 			switch rec.MIB { | ||||
| 			case "2085": | ||||
| 				constName = "HZGB2312" // Not listed as alias for some reason. | ||||
| 			default: | ||||
| 				log.Fatalf("No cs alias defined for %s.", rec.MIB) | ||||
| 			} | ||||
| 		} | ||||
| 		if rec.MIME != "" { | ||||
| 			rec.MIME = fmt.Sprintf(" (MIME: %s)", rec.MIME) | ||||
| 		} | ||||
| 		fmt.Fprintf(w, "// %s is the MIB identifier with IANA name %s%s.\n//\n", constName, rec.Name, rec.MIME) | ||||
| 		if len(rec.Desc.Data) > 0 { | ||||
| 			fmt.Fprint(w, "// ") | ||||
| 			d := xml.NewDecoder(strings.NewReader(rec.Desc.Data)) | ||||
| 			inElem := true | ||||
| 			attr := "" | ||||
| 			for { | ||||
| 				t, err := d.Token() | ||||
| 				if err != nil { | ||||
| 					if err != io.EOF { | ||||
| 						log.Fatal(err) | ||||
| 					} | ||||
| 					break | ||||
| 				} | ||||
| 				switch x := t.(type) { | ||||
| 				case xml.CharData: | ||||
| 					attr = "" // Don't need attribute info. | ||||
| 					a := bytes.Split([]byte(x), []byte("\n")) | ||||
| 					for i, b := range a { | ||||
| 						if b = bytes.TrimSpace(b); len(b) != 0 { | ||||
| 							if !inElem && i > 0 { | ||||
| 								fmt.Fprint(w, "\n// ") | ||||
| 							} | ||||
| 							inElem = false | ||||
| 							fmt.Fprintf(w, "%s ", string(b)) | ||||
| 						} | ||||
| 					} | ||||
| 				case xml.StartElement: | ||||
| 					if x.Name.Local == "xref" { | ||||
| 						inElem = true | ||||
| 						use := false | ||||
| 						for _, a := range x.Attr { | ||||
| 							if a.Name.Local == "type" { | ||||
| 								use = use || a.Value != "person" | ||||
| 							} | ||||
| 							if a.Name.Local == "data" && use { | ||||
| 								attr = a.Value + " " | ||||
| 							} | ||||
| 						} | ||||
| 					} | ||||
| 				case xml.EndElement: | ||||
| 					inElem = false | ||||
| 					fmt.Fprint(w, attr) | ||||
| 				} | ||||
| 			} | ||||
| 			fmt.Fprint(w, "\n") | ||||
| 		} | ||||
| 		for _, x := range rec.Xref { | ||||
| 			switch x.Type { | ||||
| 			case "rfc": | ||||
| 				fmt.Fprintf(w, "// Reference: %s\n", strings.ToUpper(x.Data)) | ||||
| 			case "uri": | ||||
| 				fmt.Fprintf(w, "// Reference: %s\n", x.Data) | ||||
| 			} | ||||
| 		} | ||||
| 		fmt.Fprintf(w, "%s MIB = %s\n", constName, rec.MIB) | ||||
| 		fmt.Fprintln(w) | ||||
| 	} | ||||
| 	fmt.Fprintln(w, ")") | ||||
|  | ||||
| 	gen.WriteGoFile("mib.go", "identifier", w.Bytes()) | ||||
| } | ||||
							
								
								
									
										81
									
								
								vendor/golang.org/x/text/encoding/internal/identifier/identifier.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								vendor/golang.org/x/text/encoding/internal/identifier/identifier.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,81 @@ | ||||
| // 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. | ||||
|  | ||||
| //go:generate go run gen.go | ||||
|  | ||||
| // Package identifier defines the contract between implementations of Encoding | ||||
| // and Index by defining identifiers that uniquely identify standardized coded | ||||
| // character sets (CCS) and character encoding schemes (CES), which we will | ||||
| // together refer to as encodings, for which Encoding implementations provide | ||||
| // converters to and from UTF-8. This package is typically only of concern to | ||||
| // implementers of Indexes and Encodings. | ||||
| // | ||||
| // One part of the identifier is the MIB code, which is defined by IANA and | ||||
| // uniquely identifies a CCS or CES. Each code is associated with data that | ||||
| // references authorities, official documentation as well as aliases and MIME | ||||
| // names. | ||||
| // | ||||
| // Not all CESs are covered by the IANA registry. The "other" string that is | ||||
| // returned by ID can be used to identify other character sets or versions of | ||||
| // existing ones. | ||||
| // | ||||
| // It is recommended that each package that provides a set of Encodings provide | ||||
| // the All and Common variables to reference all supported encodings and | ||||
| // commonly used subset. This allows Index implementations to include all | ||||
| // available encodings without explicitly referencing or knowing about them. | ||||
| package identifier | ||||
|  | ||||
| // Note: this package is internal, but could be made public if there is a need | ||||
| // for writing third-party Indexes and Encodings. | ||||
|  | ||||
| // References: | ||||
| // - http://source.icu-project.org/repos/icu/icu/trunk/source/data/mappings/convrtrs.txt | ||||
| // - http://www.iana.org/assignments/character-sets/character-sets.xhtml | ||||
| // - http://www.iana.org/assignments/ianacharset-mib/ianacharset-mib | ||||
| // - http://www.ietf.org/rfc/rfc2978.txt | ||||
| // - http://www.unicode.org/reports/tr22/ | ||||
| // - http://www.w3.org/TR/encoding/ | ||||
| // - https://encoding.spec.whatwg.org/ | ||||
| // - https://encoding.spec.whatwg.org/encodings.json | ||||
| // - https://tools.ietf.org/html/rfc6657#section-5 | ||||
|  | ||||
| // Interface can be implemented by Encodings to define the CCS or CES for which | ||||
| // it implements conversions. | ||||
| type Interface interface { | ||||
| 	// ID returns an encoding identifier. Exactly one of the mib and other | ||||
| 	// values should be non-zero. | ||||
| 	// | ||||
| 	// In the usual case it is only necessary to indicate the MIB code. The | ||||
| 	// other string can be used to specify encodings for which there is no MIB, | ||||
| 	// such as "x-mac-dingbat". | ||||
| 	// | ||||
| 	// The other string may only contain the characters a-z, A-Z, 0-9, - and _. | ||||
| 	ID() (mib MIB, other string) | ||||
|  | ||||
| 	// NOTE: the restrictions on the encoding are to allow extending the syntax | ||||
| 	// with additional information such as versions, vendors and other variants. | ||||
| } | ||||
|  | ||||
| // A MIB identifies an encoding. It is derived from the IANA MIB codes and adds | ||||
| // some identifiers for some encodings that are not covered by the IANA | ||||
| // standard. | ||||
| // | ||||
| // See http://www.iana.org/assignments/ianacharset-mib. | ||||
| type MIB uint16 | ||||
|  | ||||
| // These additional MIB types are not defined in IANA. They are added because | ||||
| // they are common and defined within the text repo. | ||||
| const ( | ||||
| 	// Unofficial marks the start of encodings not registered by IANA. | ||||
| 	Unofficial MIB = 10000 + iota | ||||
|  | ||||
| 	// Replacement is the WhatWG replacement encoding. | ||||
| 	Replacement | ||||
|  | ||||
| 	// XUserDefined is the code for x-user-defined. | ||||
| 	XUserDefined | ||||
|  | ||||
| 	// MacintoshCyrillic is the code for x-mac-cyrillic. | ||||
| 	MacintoshCyrillic | ||||
| ) | ||||
							
								
								
									
										1621
									
								
								vendor/golang.org/x/text/encoding/internal/identifier/mib.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1621
									
								
								vendor/golang.org/x/text/encoding/internal/identifier/mib.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user
	 Wim
					Wim