diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 1963a1a7f859b..84e734f8d2765 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -201,8 +201,6 @@ func init() { copydbCommand, removedbCommand, dumpCommand, - // See monitorcmd.go: - monitorCommand, // See accountcmd.go: accountCommand, walletCommand, diff --git a/cmd/geth/monitorcmd.go b/cmd/geth/monitorcmd.go deleted file mode 100644 index 34e090e1ec4b7..0000000000000 --- a/cmd/geth/monitorcmd.go +++ /dev/null @@ -1,351 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. -// -// go-ethereum is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// go-ethereum is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . - -package main - -import ( - "fmt" - "math" - "reflect" - "runtime" - "sort" - "strings" - "time" - - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/rpc" - "github.com/gizak/termui" - "gopkg.in/urfave/cli.v1" -) - -var ( - monitorCommandAttachFlag = cli.StringFlag{ - Name: "attach", - Value: node.DefaultIPCEndpoint(clientIdentifier), - Usage: "API endpoint to attach to", - } - monitorCommandRowsFlag = cli.IntFlag{ - Name: "rows", - Value: 5, - Usage: "Maximum rows in the chart grid", - } - monitorCommandRefreshFlag = cli.IntFlag{ - Name: "refresh", - Value: 3, - Usage: "Refresh interval in seconds", - } - monitorCommand = cli.Command{ - Action: utils.MigrateFlags(monitor), // keep track of migration progress - Name: "monitor", - Usage: "Monitor and visualize node metrics", - ArgsUsage: " ", - Category: "MONITOR COMMANDS", - Description: ` -The Geth monitor is a tool to collect and visualize various internal metrics -gathered by the node, supporting different chart types as well as the capacity -to display multiple metrics simultaneously. -`, - Flags: []cli.Flag{ - monitorCommandAttachFlag, - monitorCommandRowsFlag, - monitorCommandRefreshFlag, - }, - } -) - -// monitor starts a terminal UI based monitoring tool for the requested metrics. -func monitor(ctx *cli.Context) error { - var ( - client *rpc.Client - err error - ) - // Attach to an Ethereum node over IPC or RPC - endpoint := ctx.String(monitorCommandAttachFlag.Name) - if client, err = dialRPC(endpoint); err != nil { - utils.Fatalf("Unable to attach to geth node: %v", err) - } - defer client.Close() - - // Retrieve all the available metrics and resolve the user pattens - metrics, err := retrieveMetrics(client) - if err != nil { - utils.Fatalf("Failed to retrieve system metrics: %v", err) - } - monitored := resolveMetrics(metrics, ctx.Args()) - if len(monitored) == 0 { - list := expandMetrics(metrics, "") - sort.Strings(list) - - if len(list) > 0 { - utils.Fatalf("No metrics specified.\n\nAvailable:\n - %s", strings.Join(list, "\n - ")) - } else { - utils.Fatalf("No metrics collected by geth (--%s).\n", utils.MetricsEnabledFlag.Name) - } - } - sort.Strings(monitored) - if cols := len(monitored) / ctx.Int(monitorCommandRowsFlag.Name); cols > 6 { - utils.Fatalf("Requested metrics (%d) spans more that 6 columns:\n - %s", len(monitored), strings.Join(monitored, "\n - ")) - } - // Create and configure the chart UI defaults - if err := termui.Init(); err != nil { - utils.Fatalf("Unable to initialize terminal UI: %v", err) - } - defer termui.Close() - - rows := len(monitored) - if max := ctx.Int(monitorCommandRowsFlag.Name); rows > max { - rows = max - } - cols := (len(monitored) + rows - 1) / rows - for i := 0; i < rows; i++ { - termui.Body.AddRows(termui.NewRow()) - } - // Create each individual data chart - footer := termui.NewPar("") - footer.Block.Border = true - footer.Height = 3 - - charts := make([]*termui.LineChart, len(monitored)) - units := make([]int, len(monitored)) - data := make([][]float64, len(monitored)) - for i := 0; i < len(monitored); i++ { - charts[i] = createChart((termui.TermHeight() - footer.Height) / rows) - row := termui.Body.Rows[i%rows] - row.Cols = append(row.Cols, termui.NewCol(12/cols, 0, charts[i])) - } - termui.Body.AddRows(termui.NewRow(termui.NewCol(12, 0, footer))) - - refreshCharts(client, monitored, data, units, charts, ctx, footer) - termui.Body.Align() - termui.Render(termui.Body) - - // Watch for various system events, and periodically refresh the charts - termui.Handle("/sys/kbd/C-c", func(termui.Event) { - termui.StopLoop() - }) - termui.Handle("/sys/wnd/resize", func(termui.Event) { - termui.Body.Width = termui.TermWidth() - for _, chart := range charts { - chart.Height = (termui.TermHeight() - footer.Height) / rows - } - termui.Body.Align() - termui.Render(termui.Body) - }) - go func() { - tick := time.NewTicker(time.Duration(ctx.Int(monitorCommandRefreshFlag.Name)) * time.Second) - for range tick.C { - if refreshCharts(client, monitored, data, units, charts, ctx, footer) { - termui.Body.Align() - } - termui.Render(termui.Body) - } - }() - termui.Loop() - return nil -} - -// retrieveMetrics contacts the attached geth node and retrieves the entire set -// of collected system metrics. -func retrieveMetrics(client *rpc.Client) (map[string]interface{}, error) { - var metrics map[string]interface{} - err := client.Call(&metrics, "debug_metrics", true) - return metrics, err -} - -// resolveMetrics takes a list of input metric patterns, and resolves each to one -// or more canonical metric names. -func resolveMetrics(metrics map[string]interface{}, patterns []string) []string { - var res []string - for _, pattern := range patterns { - res = append(res, resolveMetric(metrics, pattern, "")...) - } - return res -} - -// resolveMetrics takes a single of input metric pattern, and resolves it to one -// or more canonical metric names. -func resolveMetric(metrics map[string]interface{}, pattern string, path string) []string { - var results []string - - // If a nested metric was requested, recurse optionally branching (via comma) - parts := strings.SplitN(pattern, "/", 2) - if len(parts) > 1 { - for _, variation := range strings.Split(parts[0], ",") { - submetrics, ok := metrics[variation].(map[string]interface{}) - if !ok { - utils.Fatalf("Failed to retrieve system metrics: %s", path+variation) - return nil - } - results = append(results, resolveMetric(submetrics, parts[1], path+variation+"/")...) - } - return results - } - // Depending what the last link is, return or expand - for _, variation := range strings.Split(pattern, ",") { - switch metric := metrics[variation].(type) { - case float64: - // Final metric value found, return as singleton - results = append(results, path+variation) - - case map[string]interface{}: - results = append(results, expandMetrics(metric, path+variation+"/")...) - - default: - utils.Fatalf("Metric pattern resolved to unexpected type: %v", reflect.TypeOf(metric)) - return nil - } - } - return results -} - -// expandMetrics expands the entire tree of metrics into a flat list of paths. -func expandMetrics(metrics map[string]interface{}, path string) []string { - // Iterate over all fields and expand individually - var list []string - for name, metric := range metrics { - switch metric := metric.(type) { - case float64: - // Final metric value found, append to list - list = append(list, path+name) - - case map[string]interface{}: - // Tree of metrics found, expand recursively - list = append(list, expandMetrics(metric, path+name+"/")...) - - default: - utils.Fatalf("Metric pattern %s resolved to unexpected type: %v", path+name, reflect.TypeOf(metric)) - return nil - } - } - return list -} - -// fetchMetric iterates over the metrics map and retrieves a specific one. -func fetchMetric(metrics map[string]interface{}, metric string) float64 { - parts := strings.Split(metric, "/") - for _, part := range parts[:len(parts)-1] { - var found bool - metrics, found = metrics[part].(map[string]interface{}) - if !found { - return 0 - } - } - if v, ok := metrics[parts[len(parts)-1]].(float64); ok { - return v - } - return 0 -} - -// refreshCharts retrieves a next batch of metrics, and inserts all the new -// values into the active datasets and charts -func refreshCharts(client *rpc.Client, metrics []string, data [][]float64, units []int, charts []*termui.LineChart, ctx *cli.Context, footer *termui.Par) (realign bool) { - values, err := retrieveMetrics(client) - for i, metric := range metrics { - if len(data) < 512 { - data[i] = append([]float64{fetchMetric(values, metric)}, data[i]...) - } else { - data[i] = append([]float64{fetchMetric(values, metric)}, data[i][:len(data[i])-1]...) - } - if updateChart(metric, data[i], &units[i], charts[i], err) { - realign = true - } - } - updateFooter(ctx, err, footer) - return -} - -// updateChart inserts a dataset into a line chart, scaling appropriately as to -// not display weird labels, also updating the chart label accordingly. -func updateChart(metric string, data []float64, base *int, chart *termui.LineChart, err error) (realign bool) { - dataUnits := []string{"", "K", "M", "G", "T", "E"} - timeUnits := []string{"ns", "µs", "ms", "s", "ks", "ms"} - colors := []termui.Attribute{termui.ColorBlue, termui.ColorCyan, termui.ColorGreen, termui.ColorYellow, termui.ColorRed, termui.ColorRed} - - // Extract only part of the data that's actually visible - if chart.Width*2 < len(data) { - data = data[:chart.Width*2] - } - // Find the maximum value and scale under 1K - high := 0.0 - if len(data) > 0 { - high = data[0] - for _, value := range data[1:] { - high = math.Max(high, value) - } - } - unit, scale := 0, 1.0 - for high >= 1000 && unit+1 < len(dataUnits) { - high, unit, scale = high/1000, unit+1, scale*1000 - } - // If the unit changes, re-create the chart (hack to set max height...) - if unit != *base { - realign, *base, *chart = true, unit, *createChart(chart.Height) - } - // Update the chart's data points with the scaled values - if cap(chart.Data) < len(data) { - chart.Data = make([]float64, len(data)) - } - chart.Data = chart.Data[:len(data)] - for i, value := range data { - chart.Data[i] = value / scale - } - // Update the chart's label with the scale units - units := dataUnits - if strings.Contains(metric, "/Percentiles/") || strings.Contains(metric, "/pauses/") || strings.Contains(metric, "/time/") { - units = timeUnits - } - chart.BorderLabel = metric - if len(units[unit]) > 0 { - chart.BorderLabel += " [" + units[unit] + "]" - } - chart.LineColor = colors[unit] | termui.AttrBold - if err != nil { - chart.LineColor = termui.ColorRed | termui.AttrBold - } - return -} - -// createChart creates an empty line chart with the default configs. -func createChart(height int) *termui.LineChart { - chart := termui.NewLineChart() - if runtime.GOOS == "windows" { - chart.Mode = "dot" - } - chart.DataLabels = []string{""} - chart.Height = height - chart.AxesColor = termui.ColorWhite - chart.PaddingBottom = -2 - - chart.BorderLabelFg = chart.BorderFg | termui.AttrBold - chart.BorderFg = chart.BorderBg - - return chart -} - -// updateFooter updates the footer contents based on any encountered errors. -func updateFooter(ctx *cli.Context, err error, footer *termui.Par) { - // Generate the basic footer - refresh := time.Duration(ctx.Int(monitorCommandRefreshFlag.Name)) * time.Second - footer.Text = fmt.Sprintf("Press Ctrl+C to quit. Refresh interval: %v.", refresh) - footer.TextFgColor = termui.ThemeAttr("par.fg") | termui.AttrBold - - // Append any encountered errors - if err != nil { - footer.Text = fmt.Sprintf("Error: %v.", err) - footer.TextFgColor = termui.ColorRed | termui.AttrBold - } -} diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index e1577fe2f869b..36fde166b8a63 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -234,7 +234,7 @@ web3._extend({ new web3._extend.Method({ name: 'testSignCliqueBlock', call: 'debug_testSignCliqueBlock', - params: 2, + params: 2, inputFormatters: [web3._extend.formatters.inputAddressFormatter, null], }), new web3._extend.Method({ @@ -262,11 +262,6 @@ web3._extend({ name: 'chaindbCompact', call: 'debug_chaindbCompact', }), - new web3._extend.Method({ - name: 'metrics', - call: 'debug_metrics', - params: 1 - }), new web3._extend.Method({ name: 'verbosity', call: 'debug_verbosity', diff --git a/node/api.go b/node/api.go index 6e36e505d12f4..cc80efabec50f 100644 --- a/node/api.go +++ b/node/api.go @@ -20,11 +20,9 @@ import ( "context" "fmt" "strings" - "time" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/rpc" @@ -297,151 +295,6 @@ func (api *PublicAdminAPI) Datadir() string { return api.node.DataDir() } -// PublicDebugAPI is the collection of debugging related API methods exposed over -// both secure and unsecure RPC channels. -type PublicDebugAPI struct { - node *Node // Node interfaced by this API -} - -// NewPublicDebugAPI creates a new API definition for the public debug methods -// of the node itself. -func NewPublicDebugAPI(node *Node) *PublicDebugAPI { - return &PublicDebugAPI{node: node} -} - -// Metrics retrieves all the known system metric collected by the node. -func (api *PublicDebugAPI) Metrics(raw bool) (map[string]interface{}, error) { - // Create a rate formatter - units := []string{"", "K", "M", "G", "T", "E", "P"} - round := func(value float64, prec int) string { - unit := 0 - for value >= 1000 { - unit, value, prec = unit+1, value/1000, 2 - } - return fmt.Sprintf(fmt.Sprintf("%%.%df%s", prec, units[unit]), value) - } - format := func(total float64, rate float64) string { - return fmt.Sprintf("%s (%s/s)", round(total, 0), round(rate, 2)) - } - // Iterate over all the metrics, and just dump for now - counters := make(map[string]interface{}) - metrics.DefaultRegistry.Each(func(name string, metric interface{}) { - // Create or retrieve the counter hierarchy for this metric - root, parts := counters, strings.Split(name, "/") - for _, part := range parts[:len(parts)-1] { - if _, ok := root[part]; !ok { - root[part] = make(map[string]interface{}) - } - root = root[part].(map[string]interface{}) - } - name = parts[len(parts)-1] - - // Fill the counter with the metric details, formatting if requested - if raw { - switch metric := metric.(type) { - case metrics.Counter: - root[name] = map[string]interface{}{ - "Overall": float64(metric.Count()), - } - - case metrics.Meter: - root[name] = map[string]interface{}{ - "AvgRate01Min": metric.Rate1(), - "AvgRate05Min": metric.Rate5(), - "AvgRate15Min": metric.Rate15(), - "MeanRate": metric.RateMean(), - "Overall": float64(metric.Count()), - } - - case metrics.Timer: - root[name] = map[string]interface{}{ - "AvgRate01Min": metric.Rate1(), - "AvgRate05Min": metric.Rate5(), - "AvgRate15Min": metric.Rate15(), - "MeanRate": metric.RateMean(), - "Overall": float64(metric.Count()), - "Percentiles": map[string]interface{}{ - "5": metric.Percentile(0.05), - "20": metric.Percentile(0.2), - "50": metric.Percentile(0.5), - "80": metric.Percentile(0.8), - "95": metric.Percentile(0.95), - }, - } - - case metrics.ResettingTimer: - t := metric.Snapshot() - ps := t.Percentiles([]float64{5, 20, 50, 80, 95}) - root[name] = map[string]interface{}{ - "Measurements": len(t.Values()), - "Mean": t.Mean(), - "Percentiles": map[string]interface{}{ - "5": ps[0], - "20": ps[1], - "50": ps[2], - "80": ps[3], - "95": ps[4], - }, - } - - default: - root[name] = "Unknown metric type" - } - } else { - switch metric := metric.(type) { - case metrics.Counter: - root[name] = map[string]interface{}{ - "Overall": float64(metric.Count()), - } - - case metrics.Meter: - root[name] = map[string]interface{}{ - "Avg01Min": format(metric.Rate1()*60, metric.Rate1()), - "Avg05Min": format(metric.Rate5()*300, metric.Rate5()), - "Avg15Min": format(metric.Rate15()*900, metric.Rate15()), - "Overall": format(float64(metric.Count()), metric.RateMean()), - } - - case metrics.Timer: - root[name] = map[string]interface{}{ - "Avg01Min": format(metric.Rate1()*60, metric.Rate1()), - "Avg05Min": format(metric.Rate5()*300, metric.Rate5()), - "Avg15Min": format(metric.Rate15()*900, metric.Rate15()), - "Overall": format(float64(metric.Count()), metric.RateMean()), - "Maximum": time.Duration(metric.Max()).String(), - "Minimum": time.Duration(metric.Min()).String(), - "Percentiles": map[string]interface{}{ - "5": time.Duration(metric.Percentile(0.05)).String(), - "20": time.Duration(metric.Percentile(0.2)).String(), - "50": time.Duration(metric.Percentile(0.5)).String(), - "80": time.Duration(metric.Percentile(0.8)).String(), - "95": time.Duration(metric.Percentile(0.95)).String(), - }, - } - - case metrics.ResettingTimer: - t := metric.Snapshot() - ps := t.Percentiles([]float64{5, 20, 50, 80, 95}) - root[name] = map[string]interface{}{ - "Measurements": len(t.Values()), - "Mean": time.Duration(t.Mean()).String(), - "Percentiles": map[string]interface{}{ - "5": time.Duration(ps[0]).String(), - "20": time.Duration(ps[1]).String(), - "50": time.Duration(ps[2]).String(), - "80": time.Duration(ps[3]).String(), - "95": time.Duration(ps[4]).String(), - }, - } - - default: - root[name] = "Unknown metric type" - } - } - }) - return counters, nil -} - // PublicWeb3API offers helper utils type PublicWeb3API struct { stack *Node diff --git a/node/node.go b/node/node.go index ff2244503fef1..78bb492f00eb9 100644 --- a/node/node.go +++ b/node/node.go @@ -635,11 +635,6 @@ func (n *Node) apis() []rpc.API { Namespace: "debug", Version: "1.0", Service: debug.Handler, - }, { - Namespace: "debug", - Version: "1.0", - Service: NewPublicDebugAPI(n), - Public: true, }, { Namespace: "web3", Version: "1.0", diff --git a/vendor/github.com/dgrijalva/jwt-go/LICENSE b/vendor/github.com/dgrijalva/jwt-go/LICENSE deleted file mode 100644 index df83a9c2f0192..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/LICENSE +++ /dev/null @@ -1,8 +0,0 @@ -Copyright (c) 2012 Dave Grijalva - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md b/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md deleted file mode 100644 index 7fc1f793cbc4e..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md +++ /dev/null @@ -1,97 +0,0 @@ -## Migration Guide from v2 -> v3 - -Version 3 adds several new, frequently requested features. To do so, it introduces a few breaking changes. We've worked to keep these as minimal as possible. This guide explains the breaking changes and how you can quickly update your code. - -### `Token.Claims` is now an interface type - -The most requested feature from the 2.0 verison of this library was the ability to provide a custom type to the JSON parser for claims. This was implemented by introducing a new interface, `Claims`, to replace `map[string]interface{}`. We also included two concrete implementations of `Claims`: `MapClaims` and `StandardClaims`. - -`MapClaims` is an alias for `map[string]interface{}` with built in validation behavior. It is the default claims type when using `Parse`. The usage is unchanged except you must type cast the claims property. - -The old example for parsing a token looked like this.. - -```go - if token, err := jwt.Parse(tokenString, keyLookupFunc); err == nil { - fmt.Printf("Token for user %v expires %v", token.Claims["user"], token.Claims["exp"]) - } -``` - -is now directly mapped to... - -```go - if token, err := jwt.Parse(tokenString, keyLookupFunc); err == nil { - claims := token.Claims.(jwt.MapClaims) - fmt.Printf("Token for user %v expires %v", claims["user"], claims["exp"]) - } -``` - -`StandardClaims` is designed to be embedded in your custom type. You can supply a custom claims type with the new `ParseWithClaims` function. Here's an example of using a custom claims type. - -```go - type MyCustomClaims struct { - User string - *StandardClaims - } - - if token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, keyLookupFunc); err == nil { - claims := token.Claims.(*MyCustomClaims) - fmt.Printf("Token for user %v expires %v", claims.User, claims.StandardClaims.ExpiresAt) - } -``` - -### `ParseFromRequest` has been moved - -To keep this library focused on the tokens without becoming overburdened with complex request processing logic, `ParseFromRequest` and its new companion `ParseFromRequestWithClaims` have been moved to a subpackage, `request`. The method signatues have also been augmented to receive a new argument: `Extractor`. - -`Extractors` do the work of picking the token string out of a request. The interface is simple and composable. - -This simple parsing example: - -```go - if token, err := jwt.ParseFromRequest(tokenString, req, keyLookupFunc); err == nil { - fmt.Printf("Token for user %v expires %v", token.Claims["user"], token.Claims["exp"]) - } -``` - -is directly mapped to: - -```go - if token, err := request.ParseFromRequest(req, request.OAuth2Extractor, keyLookupFunc); err == nil { - claims := token.Claims.(jwt.MapClaims) - fmt.Printf("Token for user %v expires %v", claims["user"], claims["exp"]) - } -``` - -There are several concrete `Extractor` types provided for your convenience: - -* `HeaderExtractor` will search a list of headers until one contains content. -* `ArgumentExtractor` will search a list of keys in request query and form arguments until one contains content. -* `MultiExtractor` will try a list of `Extractors` in order until one returns content. -* `AuthorizationHeaderExtractor` will look in the `Authorization` header for a `Bearer` token. -* `OAuth2Extractor` searches the places an OAuth2 token would be specified (per the spec): `Authorization` header and `access_token` argument -* `PostExtractionFilter` wraps an `Extractor`, allowing you to process the content before it's parsed. A simple example is stripping the `Bearer ` text from a header - - -### RSA signing methods no longer accept `[]byte` keys - -Due to a [critical vulnerability](https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/), we've decided the convenience of accepting `[]byte` instead of `rsa.PublicKey` or `rsa.PrivateKey` isn't worth the risk of misuse. - -To replace this behavior, we've added two helper methods: `ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)` and `ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error)`. These are just simple helpers for unpacking PEM encoded PKCS1 and PKCS8 keys. If your keys are encoded any other way, all you need to do is convert them to the `crypto/rsa` package's types. - -```go - func keyLookupFunc(*Token) (interface{}, error) { - // Don't forget to validate the alg is what you expect: - if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok { - return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"]) - } - - // Look up key - key, err := lookupPublicKey(token.Header["kid"]) - if err != nil { - return nil, err - } - - // Unpack key from PEM encoded PKCS8 - return jwt.ParseRSAPublicKeyFromPEM(key) - } -``` diff --git a/vendor/github.com/dgrijalva/jwt-go/README.md b/vendor/github.com/dgrijalva/jwt-go/README.md deleted file mode 100644 index f48365fafbfda..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/README.md +++ /dev/null @@ -1,85 +0,0 @@ -A [go](http://www.golang.org) (or 'golang' for search engine friendliness) implementation of [JSON Web Tokens](http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html) - -[![Build Status](https://travis-ci.org/dgrijalva/jwt-go.svg?branch=master)](https://travis-ci.org/dgrijalva/jwt-go) - -**BREAKING CHANGES:*** Version 3.0.0 is here. It includes _a lot_ of changes including a few that break the API. We've tried to break as few things as possible, so there should just be a few type signature changes. A full list of breaking changes is available in `VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating your code. - -**NOTICE:** A vulnerability in JWT was [recently published](https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/). As this library doesn't force users to validate the `alg` is what they expected, it's possible your usage is effected. There will be an update soon to remedy this, and it will likey require backwards-incompatible changes to the API. In the short term, please make sure your implementation verifies the `alg` is what you expect. - - -## What the heck is a JWT? - -JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens. - -In short, it's a signed JSON object that does something useful (for example, authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is made of three parts, separated by `.`'s. The first two parts are JSON objects, that have been [base64url](http://tools.ietf.org/html/rfc4648) encoded. The last part is the signature, encoded the same way. - -The first part is called the header. It contains the necessary information for verifying the last part, the signature. For example, which encryption method was used for signing and what key was used. - -The part in the middle is the interesting bit. It's called the Claims and contains the actual stuff you care about. Refer to [the RFC](http://self-issued.info/docs/draft-jones-json-web-token.html) for information about reserved keys and the proper way to add your own. - -## What's in the box? - -This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own. - -## Examples - -See [the project documentation](https://godoc.org/github.com/dgrijalva/jwt-go) for examples of usage: - -* [Simple example of parsing and validating a token](https://godoc.org/github.com/dgrijalva/jwt-go#example-Parse--Hmac) -* [Simple example of building and signing a token](https://godoc.org/github.com/dgrijalva/jwt-go#example-New--Hmac) -* [Directory of Examples](https://godoc.org/github.com/dgrijalva/jwt-go#pkg-examples) - -## Extensions - -This library publishes all the necessary components for adding your own signing methods. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod`. - -Here's an example of an extension that integrates with the Google App Engine signing tools: https://github.com/someone1/gcp-jwt-go - -## Compliance - -This library was last reviewed to comply with [RTF 7519](http://www.rfc-editor.org/info/rfc7519) dated May 2015 with a few notable differences: - -* In order to protect against accidental use of [Unsecured JWTs](http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#UnsecuredJWT), tokens using `alg=none` will only be accepted if the constant `jwt.UnsafeAllowNoneSignatureType` is provided as the key. - -## Project Status & Versioning - -This library is considered production ready. Feedback and feature requests are appreciated. The API should be considered stable. There should be very few backwards-incompatible changes outside of major version updates (and only with good reason). - -This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull requests will land on `master`. Periodically, versions will be tagged from `master`. You can find all the releases on [the project releases page](https://github.com/dgrijalva/jwt-go/releases). - -While we try to make it obvious when we make breaking changes, there isn't a great mechanism for pushing announcements out to users. You may want to use this alternative package include: `gopkg.in/dgrijalva/jwt-go.v2`. It will do the right thing WRT semantic versioning. - -## Usage Tips - -### Signing vs Encryption - -A token is simply a JSON object that is signed by its author. this tells you exactly two things about the data: - -* The author of the token was in the possession of the signing secret -* The data has not been modified since it was signed - -It's important to know that JWT does not provide encryption, which means anyone who has access to the token can read its contents. If you need to protect (encrypt) the data, there is a companion spec, `JWE`, that provides this functionality. JWE is currently outside the scope of this library. - -### Choosing a Signing Method - -There are several signing methods available, and you should probably take the time to learn about the various options before choosing one. The principal design decision is most likely going to be symmetric vs asymmetric. - -Symmetric signing methods, such as HSA, use only a single secret. This is probably the simplest signing method to use since any `[]byte` can be used as a valid secret. They are also slightly computationally faster to use, though this rarely is enough to matter. Symmetric signing methods work the best when both producers and consumers of tokens are trusted, or even the same system. Since the same secret is used to both sign and validate tokens, you can't easily distribute the key for validation. - -Asymmetric signing methods, such as RSA, use different keys for signing and verifying tokens. This makes it possible to produce tokens with a private key, and allow any consumer to access the public key for verification. - -### JWT and OAuth - -It's worth mentioning that OAuth and JWT are not the same thing. A JWT token is simply a signed JSON object. It can be used anywhere such a thing is useful. There is some confusion, though, as JWT is the most common type of bearer token used in OAuth2 authentication. - -Without going too far down the rabbit hole, here's a description of the interaction of these technologies: - -* OAuth is a protocol for allowing an identity provider to be separate from the service a user is logging in to. For example, whenever you use Facebook to log into a different service (Yelp, Spotify, etc), you are using OAuth. -* OAuth defines several options for passing around authentication data. One popular method is called a "bearer token". A bearer token is simply a string that _should_ only be held by an authenticated user. Thus, simply presenting this token proves your identity. You can probably derive from here why a JWT might make a good bearer token. -* Because bearer tokens are used for authentication, it's important they're kept secret. This is why transactions that use bearer tokens typically happen over SSL. - -## More - -Documentation can be found [on godoc.org](http://godoc.org/github.com/dgrijalva/jwt-go). - -The command line utility included in this project (cmd/jwt) provides a straightforward example of token creation and parsing as well as a useful tool for debugging your own integration. You'll also find several implementation examples in to documentation. diff --git a/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md b/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md deleted file mode 100644 index b605b45093095..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md +++ /dev/null @@ -1,105 +0,0 @@ -## `jwt-go` Version History - -#### 3.0.0 - -* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code - * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods. - * `ParseFromRequest` has been moved to `request` subpackage and usage has changed - * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims. -* Other Additions and Changes - * Added `Claims` interface type to allow users to decode the claims into a custom type - * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into. - * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage - * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims` - * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`. - * Added several new, more specific, validation errors to error type bitmask - * Moved examples from README to executable example files - * Signing method registry is now thread safe - * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser) - -#### 2.7.0 - -This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes. - -* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying -* Error text for expired tokens includes how long it's been expired -* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM` -* Documentation updates - -#### 2.6.0 - -* Exposed inner error within ValidationError -* Fixed validation errors when using UseJSONNumber flag -* Added several unit tests - -#### 2.5.0 - -* Added support for signing method none. You shouldn't use this. The API tries to make this clear. -* Updated/fixed some documentation -* Added more helpful error message when trying to parse tokens that begin with `BEARER ` - -#### 2.4.0 - -* Added new type, Parser, to allow for configuration of various parsing parameters - * You can now specify a list of valid signing methods. Anything outside this set will be rejected. - * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON -* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go) -* Fixed some bugs with ECDSA parsing - -#### 2.3.0 - -* Added support for ECDSA signing methods -* Added support for RSA PSS signing methods (requires go v1.4) - -#### 2.2.0 - -* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic. - -#### 2.1.0 - -Backwards compatible API change that was missed in 2.0.0. - -* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte` - -#### 2.0.0 - -There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change. - -The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`. - -It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`. - -* **Compatibility Breaking Changes** - * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct` - * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct` - * `KeyFunc` now returns `interface{}` instead of `[]byte` - * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key - * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key -* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type. - * Added public package global `SigningMethodHS256` - * Added public package global `SigningMethodHS384` - * Added public package global `SigningMethodHS512` -* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type. - * Added public package global `SigningMethodRS256` - * Added public package global `SigningMethodRS384` - * Added public package global `SigningMethodRS512` -* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged. -* Refactored the RSA implementation to be easier to read -* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM` - -#### 1.0.2 - -* Fixed bug in parsing public keys from certificates -* Added more tests around the parsing of keys for RS256 -* Code refactoring in RS256 implementation. No functional changes - -#### 1.0.1 - -* Fixed panic if RS256 signing method was passed an invalid key - -#### 1.0.0 - -* First versioned release -* API stabilized -* Supports creating, signing, parsing, and validating JWT tokens -* Supports RS256 and HS256 signing methods \ No newline at end of file diff --git a/vendor/github.com/dgrijalva/jwt-go/claims.go b/vendor/github.com/dgrijalva/jwt-go/claims.go deleted file mode 100644 index f0228f02e0337..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/claims.go +++ /dev/null @@ -1,134 +0,0 @@ -package jwt - -import ( - "crypto/subtle" - "fmt" - "time" -) - -// For a type to be a Claims object, it must just have a Valid method that determines -// if the token is invalid for any supported reason -type Claims interface { - Valid() error -} - -// Structured version of Claims Section, as referenced at -// https://tools.ietf.org/html/rfc7519#section-4.1 -// See examples for how to use this with your own claim types -type StandardClaims struct { - Audience string `json:"aud,omitempty"` - ExpiresAt int64 `json:"exp,omitempty"` - Id string `json:"jti,omitempty"` - IssuedAt int64 `json:"iat,omitempty"` - Issuer string `json:"iss,omitempty"` - NotBefore int64 `json:"nbf,omitempty"` - Subject string `json:"sub,omitempty"` -} - -// Validates time based claims "exp, iat, nbf". -// There is no accounting for clock skew. -// As well, if any of the above claims are not in the token, it will still -// be considered a valid claim. -func (c StandardClaims) Valid() error { - vErr := new(ValidationError) - now := TimeFunc().Unix() - - // The claims below are optional, by default, so if they are set to the - // default value in Go, let's not fail the verification for them. - if c.VerifyExpiresAt(now, false) == false { - delta := time.Unix(now, 0).Sub(time.Unix(c.ExpiresAt, 0)) - vErr.Inner = fmt.Errorf("token is expired by %v", delta) - vErr.Errors |= ValidationErrorExpired - } - - if c.VerifyIssuedAt(now, false) == false { - vErr.Inner = fmt.Errorf("Token used before issued") - vErr.Errors |= ValidationErrorIssuedAt - } - - if c.VerifyNotBefore(now, false) == false { - vErr.Inner = fmt.Errorf("token is not valid yet") - vErr.Errors |= ValidationErrorNotValidYet - } - - if vErr.valid() { - return nil - } - - return vErr -} - -// Compares the aud claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyAudience(cmp string, req bool) bool { - return verifyAud(c.Audience, cmp, req) -} - -// Compares the exp claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool { - return verifyExp(c.ExpiresAt, cmp, req) -} - -// Compares the iat claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool { - return verifyIat(c.IssuedAt, cmp, req) -} - -// Compares the iss claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyIssuer(cmp string, req bool) bool { - return verifyIss(c.Issuer, cmp, req) -} - -// Compares the nbf claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool { - return verifyNbf(c.NotBefore, cmp, req) -} - -// ----- helpers - -func verifyAud(aud string, cmp string, required bool) bool { - if aud == "" { - return !required - } - if subtle.ConstantTimeCompare([]byte(aud), []byte(cmp)) != 0 { - return true - } else { - return false - } -} - -func verifyExp(exp int64, now int64, required bool) bool { - if exp == 0 { - return !required - } - return now <= exp -} - -func verifyIat(iat int64, now int64, required bool) bool { - if iat == 0 { - return !required - } - return now >= iat -} - -func verifyIss(iss string, cmp string, required bool) bool { - if iss == "" { - return !required - } - if subtle.ConstantTimeCompare([]byte(iss), []byte(cmp)) != 0 { - return true - } else { - return false - } -} - -func verifyNbf(nbf int64, now int64, required bool) bool { - if nbf == 0 { - return !required - } - return now >= nbf -} diff --git a/vendor/github.com/dgrijalva/jwt-go/doc.go b/vendor/github.com/dgrijalva/jwt-go/doc.go deleted file mode 100644 index a86dc1a3b348c..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html -// -// See README.md for more info. -package jwt diff --git a/vendor/github.com/dgrijalva/jwt-go/ecdsa.go b/vendor/github.com/dgrijalva/jwt-go/ecdsa.go deleted file mode 100644 index 2f59a22236383..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/ecdsa.go +++ /dev/null @@ -1,147 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/ecdsa" - "crypto/rand" - "errors" - "math/big" -) - -var ( - // Sadly this is missing from crypto/ecdsa compared to crypto/rsa - ErrECDSAVerification = errors.New("crypto/ecdsa: verification error") -) - -// Implements the ECDSA family of signing methods signing methods -type SigningMethodECDSA struct { - Name string - Hash crypto.Hash - KeySize int - CurveBits int -} - -// Specific instances for EC256 and company -var ( - SigningMethodES256 *SigningMethodECDSA - SigningMethodES384 *SigningMethodECDSA - SigningMethodES512 *SigningMethodECDSA -) - -func init() { - // ES256 - SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256} - RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod { - return SigningMethodES256 - }) - - // ES384 - SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384} - RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod { - return SigningMethodES384 - }) - - // ES512 - SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521} - RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod { - return SigningMethodES512 - }) -} - -func (m *SigningMethodECDSA) Alg() string { - return m.Name -} - -// Implements the Verify method from SigningMethod -// For this verify method, key must be an ecdsa.PublicKey struct -func (m *SigningMethodECDSA) Verify(signingString, signature string, key interface{}) error { - var err error - - // Decode the signature - var sig []byte - if sig, err = DecodeSegment(signature); err != nil { - return err - } - - // Get the key - var ecdsaKey *ecdsa.PublicKey - switch k := key.(type) { - case *ecdsa.PublicKey: - ecdsaKey = k - default: - return ErrInvalidKeyType - } - - if len(sig) != 2*m.KeySize { - return ErrECDSAVerification - } - - r := big.NewInt(0).SetBytes(sig[:m.KeySize]) - s := big.NewInt(0).SetBytes(sig[m.KeySize:]) - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Verify the signature - if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus == true { - return nil - } else { - return ErrECDSAVerification - } -} - -// Implements the Sign method from SigningMethod -// For this signing method, key must be an ecdsa.PrivateKey struct -func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) (string, error) { - // Get the key - var ecdsaKey *ecdsa.PrivateKey - switch k := key.(type) { - case *ecdsa.PrivateKey: - ecdsaKey = k - default: - return "", ErrInvalidKeyType - } - - // Create the hasher - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return r, s - if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil { - curveBits := ecdsaKey.Curve.Params().BitSize - - if m.CurveBits != curveBits { - return "", ErrInvalidKey - } - - keyBytes := curveBits / 8 - if curveBits%8 > 0 { - keyBytes += 1 - } - - // We serialize the outpus (r and s) into big-endian byte arrays and pad - // them with zeros on the left to make sure the sizes work out. Both arrays - // must be keyBytes long, and the output must be 2*keyBytes long. - rBytes := r.Bytes() - rBytesPadded := make([]byte, keyBytes) - copy(rBytesPadded[keyBytes-len(rBytes):], rBytes) - - sBytes := s.Bytes() - sBytesPadded := make([]byte, keyBytes) - copy(sBytesPadded[keyBytes-len(sBytes):], sBytes) - - out := append(rBytesPadded, sBytesPadded...) - - return EncodeSegment(out), nil - } else { - return "", err - } -} diff --git a/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go b/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go deleted file mode 100644 index d19624b7264fb..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go +++ /dev/null @@ -1,67 +0,0 @@ -package jwt - -import ( - "crypto/ecdsa" - "crypto/x509" - "encoding/pem" - "errors" -) - -var ( - ErrNotECPublicKey = errors.New("Key is not a valid ECDSA public key") - ErrNotECPrivateKey = errors.New("Key is not a valid ECDSA private key") -) - -// Parse PEM encoded Elliptic Curve Private Key Structure -func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey interface{} - if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { - return nil, err - } - - var pkey *ecdsa.PrivateKey - var ok bool - if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok { - return nil, ErrNotECPrivateKey - } - - return pkey, nil -} - -// Parse PEM encoded PKCS1 or PKCS8 public key -func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey interface{} - if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { - if cert, err := x509.ParseCertificate(block.Bytes); err == nil { - parsedKey = cert.PublicKey - } else { - return nil, err - } - } - - var pkey *ecdsa.PublicKey - var ok bool - if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok { - return nil, ErrNotECPublicKey - } - - return pkey, nil -} diff --git a/vendor/github.com/dgrijalva/jwt-go/errors.go b/vendor/github.com/dgrijalva/jwt-go/errors.go deleted file mode 100644 index 1c93024aad2ea..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/errors.go +++ /dev/null @@ -1,59 +0,0 @@ -package jwt - -import ( - "errors" -) - -// Error constants -var ( - ErrInvalidKey = errors.New("key is invalid") - ErrInvalidKeyType = errors.New("key is of invalid type") - ErrHashUnavailable = errors.New("the requested hash function is unavailable") -) - -// The errors that might occur when parsing and validating a token -const ( - ValidationErrorMalformed uint32 = 1 << iota // Token is malformed - ValidationErrorUnverifiable // Token could not be verified because of signing problems - ValidationErrorSignatureInvalid // Signature validation failed - - // Standard Claim validation errors - ValidationErrorAudience // AUD validation failed - ValidationErrorExpired // EXP validation failed - ValidationErrorIssuedAt // IAT validation failed - ValidationErrorIssuer // ISS validation failed - ValidationErrorNotValidYet // NBF validation failed - ValidationErrorId // JTI validation failed - ValidationErrorClaimsInvalid // Generic claims validation error -) - -// Helper for constructing a ValidationError with a string error message -func NewValidationError(errorText string, errorFlags uint32) *ValidationError { - return &ValidationError{ - text: errorText, - Errors: errorFlags, - } -} - -// The error from Parse if token is not valid -type ValidationError struct { - Inner error // stores the error returned by external dependencies, i.e.: KeyFunc - Errors uint32 // bitfield. see ValidationError... constants - text string // errors that do not have a valid error just have text -} - -// Validation error is an error type -func (e ValidationError) Error() string { - if e.Inner != nil { - return e.Inner.Error() - } else if e.text != "" { - return e.text - } else { - return "token is invalid" - } -} - -// No errors -func (e *ValidationError) valid() bool { - return e.Errors == 0 -} diff --git a/vendor/github.com/dgrijalva/jwt-go/hmac.go b/vendor/github.com/dgrijalva/jwt-go/hmac.go deleted file mode 100644 index c229919254556..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/hmac.go +++ /dev/null @@ -1,94 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/hmac" - "errors" -) - -// Implements the HMAC-SHA family of signing methods signing methods -type SigningMethodHMAC struct { - Name string - Hash crypto.Hash -} - -// Specific instances for HS256 and company -var ( - SigningMethodHS256 *SigningMethodHMAC - SigningMethodHS384 *SigningMethodHMAC - SigningMethodHS512 *SigningMethodHMAC - ErrSignatureInvalid = errors.New("signature is invalid") -) - -func init() { - // HS256 - SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256} - RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod { - return SigningMethodHS256 - }) - - // HS384 - SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384} - RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod { - return SigningMethodHS384 - }) - - // HS512 - SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512} - RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod { - return SigningMethodHS512 - }) -} - -func (m *SigningMethodHMAC) Alg() string { - return m.Name -} - -// Verify the signature of HSXXX tokens. Returns nil if the signature is valid. -func (m *SigningMethodHMAC) Verify(signingString, signature string, key interface{}) error { - // Verify the key is the right type - keyBytes, ok := key.([]byte) - if !ok { - return ErrInvalidKeyType - } - - // Decode signature, for comparison - sig, err := DecodeSegment(signature) - if err != nil { - return err - } - - // Can we use the specified hashing method? - if !m.Hash.Available() { - return ErrHashUnavailable - } - - // This signing method is symmetric, so we validate the signature - // by reproducing the signature from the signing string and key, then - // comparing that against the provided signature. - hasher := hmac.New(m.Hash.New, keyBytes) - hasher.Write([]byte(signingString)) - if !hmac.Equal(sig, hasher.Sum(nil)) { - return ErrSignatureInvalid - } - - // No validation errors. Signature is good. - return nil -} - -// Implements the Sign method from SigningMethod for this signing method. -// Key must be []byte -func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string, error) { - if keyBytes, ok := key.([]byte); ok { - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := hmac.New(m.Hash.New, keyBytes) - hasher.Write([]byte(signingString)) - - return EncodeSegment(hasher.Sum(nil)), nil - } - - return "", ErrInvalidKey -} diff --git a/vendor/github.com/dgrijalva/jwt-go/map_claims.go b/vendor/github.com/dgrijalva/jwt-go/map_claims.go deleted file mode 100644 index 291213c460d45..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/map_claims.go +++ /dev/null @@ -1,94 +0,0 @@ -package jwt - -import ( - "encoding/json" - "errors" - // "fmt" -) - -// Claims type that uses the map[string]interface{} for JSON decoding -// This is the default claims type if you don't supply one -type MapClaims map[string]interface{} - -// Compares the aud claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyAudience(cmp string, req bool) bool { - aud, _ := m["aud"].(string) - return verifyAud(aud, cmp, req) -} - -// Compares the exp claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool { - switch exp := m["exp"].(type) { - case float64: - return verifyExp(int64(exp), cmp, req) - case json.Number: - v, _ := exp.Int64() - return verifyExp(v, cmp, req) - } - return req == false -} - -// Compares the iat claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool { - switch iat := m["iat"].(type) { - case float64: - return verifyIat(int64(iat), cmp, req) - case json.Number: - v, _ := iat.Int64() - return verifyIat(v, cmp, req) - } - return req == false -} - -// Compares the iss claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyIssuer(cmp string, req bool) bool { - iss, _ := m["iss"].(string) - return verifyIss(iss, cmp, req) -} - -// Compares the nbf claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool { - switch nbf := m["nbf"].(type) { - case float64: - return verifyNbf(int64(nbf), cmp, req) - case json.Number: - v, _ := nbf.Int64() - return verifyNbf(v, cmp, req) - } - return req == false -} - -// Validates time based claims "exp, iat, nbf". -// There is no accounting for clock skew. -// As well, if any of the above claims are not in the token, it will still -// be considered a valid claim. -func (m MapClaims) Valid() error { - vErr := new(ValidationError) - now := TimeFunc().Unix() - - if m.VerifyExpiresAt(now, false) == false { - vErr.Inner = errors.New("Token is expired") - vErr.Errors |= ValidationErrorExpired - } - - if m.VerifyIssuedAt(now, false) == false { - vErr.Inner = errors.New("Token used before issued") - vErr.Errors |= ValidationErrorIssuedAt - } - - if m.VerifyNotBefore(now, false) == false { - vErr.Inner = errors.New("Token is not valid yet") - vErr.Errors |= ValidationErrorNotValidYet - } - - if vErr.valid() { - return nil - } - - return vErr -} diff --git a/vendor/github.com/dgrijalva/jwt-go/none.go b/vendor/github.com/dgrijalva/jwt-go/none.go deleted file mode 100644 index f04d189d067be..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/none.go +++ /dev/null @@ -1,52 +0,0 @@ -package jwt - -// Implements the none signing method. This is required by the spec -// but you probably should never use it. -var SigningMethodNone *signingMethodNone - -const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed" - -var NoneSignatureTypeDisallowedError error - -type signingMethodNone struct{} -type unsafeNoneMagicConstant string - -func init() { - SigningMethodNone = &signingMethodNone{} - NoneSignatureTypeDisallowedError = NewValidationError("'none' signature type is not allowed", ValidationErrorSignatureInvalid) - - RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod { - return SigningMethodNone - }) -} - -func (m *signingMethodNone) Alg() string { - return "none" -} - -// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key -func (m *signingMethodNone) Verify(signingString, signature string, key interface{}) (err error) { - // Key must be UnsafeAllowNoneSignatureType to prevent accidentally - // accepting 'none' signing method - if _, ok := key.(unsafeNoneMagicConstant); !ok { - return NoneSignatureTypeDisallowedError - } - // If signing method is none, signature must be an empty string - if signature != "" { - return NewValidationError( - "'none' signing method with non-empty signature", - ValidationErrorSignatureInvalid, - ) - } - - // Accept 'none' signing method. - return nil -} - -// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key -func (m *signingMethodNone) Sign(signingString string, key interface{}) (string, error) { - if _, ok := key.(unsafeNoneMagicConstant); ok { - return "", nil - } - return "", NoneSignatureTypeDisallowedError -} diff --git a/vendor/github.com/dgrijalva/jwt-go/parser.go b/vendor/github.com/dgrijalva/jwt-go/parser.go deleted file mode 100644 index 7bf1c4ea08422..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/parser.go +++ /dev/null @@ -1,131 +0,0 @@ -package jwt - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" -) - -type Parser struct { - ValidMethods []string // If populated, only these methods will be considered valid - UseJSONNumber bool // Use JSON Number format in JSON decoder - SkipClaimsValidation bool // Skip claims validation during token parsing -} - -// Parse, validate, and return a token. -// keyFunc will receive the parsed token and should return the key for validating. -// If everything is kosher, err will be nil -func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { - return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc) -} - -func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { - parts := strings.Split(tokenString, ".") - if len(parts) != 3 { - return nil, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed) - } - - var err error - token := &Token{Raw: tokenString} - - // parse Header - var headerBytes []byte - if headerBytes, err = DecodeSegment(parts[0]); err != nil { - if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") { - return token, NewValidationError("tokenstring should not contain 'bearer '", ValidationErrorMalformed) - } - return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - if err = json.Unmarshal(headerBytes, &token.Header); err != nil { - return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - - // parse Claims - var claimBytes []byte - token.Claims = claims - - if claimBytes, err = DecodeSegment(parts[1]); err != nil { - return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - dec := json.NewDecoder(bytes.NewBuffer(claimBytes)) - if p.UseJSONNumber { - dec.UseNumber() - } - // JSON Decode. Special case for map type to avoid weird pointer behavior - if c, ok := token.Claims.(MapClaims); ok { - err = dec.Decode(&c) - } else { - err = dec.Decode(&claims) - } - // Handle decode error - if err != nil { - return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - - // Lookup signature method - if method, ok := token.Header["alg"].(string); ok { - if token.Method = GetSigningMethod(method); token.Method == nil { - return token, NewValidationError("signing method (alg) is unavailable.", ValidationErrorUnverifiable) - } - } else { - return token, NewValidationError("signing method (alg) is unspecified.", ValidationErrorUnverifiable) - } - - // Verify signing method is in the required set - if p.ValidMethods != nil { - var signingMethodValid = false - var alg = token.Method.Alg() - for _, m := range p.ValidMethods { - if m == alg { - signingMethodValid = true - break - } - } - if !signingMethodValid { - // signing method is not in the listed set - return token, NewValidationError(fmt.Sprintf("signing method %v is invalid", alg), ValidationErrorSignatureInvalid) - } - } - - // Lookup key - var key interface{} - if keyFunc == nil { - // keyFunc was not provided. short circuiting validation - return token, NewValidationError("no Keyfunc was provided.", ValidationErrorUnverifiable) - } - if key, err = keyFunc(token); err != nil { - // keyFunc returned an error - return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable} - } - - vErr := &ValidationError{} - - // Validate Claims - if !p.SkipClaimsValidation { - if err := token.Claims.Valid(); err != nil { - - // If the Claims Valid returned an error, check if it is a validation error, - // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set - if e, ok := err.(*ValidationError); !ok { - vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid} - } else { - vErr = e - } - } - } - - // Perform validation - token.Signature = parts[2] - if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil { - vErr.Inner = err - vErr.Errors |= ValidationErrorSignatureInvalid - } - - if vErr.valid() { - token.Valid = true - return token, nil - } - - return token, vErr -} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa.go b/vendor/github.com/dgrijalva/jwt-go/rsa.go deleted file mode 100644 index 0ae0b1984e5ae..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/rsa.go +++ /dev/null @@ -1,100 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/rand" - "crypto/rsa" -) - -// Implements the RSA family of signing methods signing methods -type SigningMethodRSA struct { - Name string - Hash crypto.Hash -} - -// Specific instances for RS256 and company -var ( - SigningMethodRS256 *SigningMethodRSA - SigningMethodRS384 *SigningMethodRSA - SigningMethodRS512 *SigningMethodRSA -) - -func init() { - // RS256 - SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256} - RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod { - return SigningMethodRS256 - }) - - // RS384 - SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384} - RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod { - return SigningMethodRS384 - }) - - // RS512 - SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512} - RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod { - return SigningMethodRS512 - }) -} - -func (m *SigningMethodRSA) Alg() string { - return m.Name -} - -// Implements the Verify method from SigningMethod -// For this signing method, must be an rsa.PublicKey structure. -func (m *SigningMethodRSA) Verify(signingString, signature string, key interface{}) error { - var err error - - // Decode the signature - var sig []byte - if sig, err = DecodeSegment(signature); err != nil { - return err - } - - var rsaKey *rsa.PublicKey - var ok bool - - if rsaKey, ok = key.(*rsa.PublicKey); !ok { - return ErrInvalidKeyType - } - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Verify the signature - return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig) -} - -// Implements the Sign method from SigningMethod -// For this signing method, must be an rsa.PrivateKey structure. -func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) { - var rsaKey *rsa.PrivateKey - var ok bool - - // Validate type of key - if rsaKey, ok = key.(*rsa.PrivateKey); !ok { - return "", ErrInvalidKey - } - - // Create the hasher - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return the encoded bytes - if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil { - return EncodeSegment(sigBytes), nil - } else { - return "", err - } -} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go b/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go deleted file mode 100644 index 10ee9db8a4ed6..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go +++ /dev/null @@ -1,126 +0,0 @@ -// +build go1.4 - -package jwt - -import ( - "crypto" - "crypto/rand" - "crypto/rsa" -) - -// Implements the RSAPSS family of signing methods signing methods -type SigningMethodRSAPSS struct { - *SigningMethodRSA - Options *rsa.PSSOptions -} - -// Specific instances for RS/PS and company -var ( - SigningMethodPS256 *SigningMethodRSAPSS - SigningMethodPS384 *SigningMethodRSAPSS - SigningMethodPS512 *SigningMethodRSAPSS -) - -func init() { - // PS256 - SigningMethodPS256 = &SigningMethodRSAPSS{ - &SigningMethodRSA{ - Name: "PS256", - Hash: crypto.SHA256, - }, - &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - Hash: crypto.SHA256, - }, - } - RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod { - return SigningMethodPS256 - }) - - // PS384 - SigningMethodPS384 = &SigningMethodRSAPSS{ - &SigningMethodRSA{ - Name: "PS384", - Hash: crypto.SHA384, - }, - &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - Hash: crypto.SHA384, - }, - } - RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod { - return SigningMethodPS384 - }) - - // PS512 - SigningMethodPS512 = &SigningMethodRSAPSS{ - &SigningMethodRSA{ - Name: "PS512", - Hash: crypto.SHA512, - }, - &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - Hash: crypto.SHA512, - }, - } - RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod { - return SigningMethodPS512 - }) -} - -// Implements the Verify method from SigningMethod -// For this verify method, key must be an rsa.PublicKey struct -func (m *SigningMethodRSAPSS) Verify(signingString, signature string, key interface{}) error { - var err error - - // Decode the signature - var sig []byte - if sig, err = DecodeSegment(signature); err != nil { - return err - } - - var rsaKey *rsa.PublicKey - switch k := key.(type) { - case *rsa.PublicKey: - rsaKey = k - default: - return ErrInvalidKey - } - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, m.Options) -} - -// Implements the Sign method from SigningMethod -// For this signing method, key must be an rsa.PrivateKey struct -func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) (string, error) { - var rsaKey *rsa.PrivateKey - - switch k := key.(type) { - case *rsa.PrivateKey: - rsaKey = k - default: - return "", ErrInvalidKeyType - } - - // Create the hasher - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return the encoded bytes - if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil { - return EncodeSegment(sigBytes), nil - } else { - return "", err - } -} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go b/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go deleted file mode 100644 index 213a90dbbf8d5..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go +++ /dev/null @@ -1,69 +0,0 @@ -package jwt - -import ( - "crypto/rsa" - "crypto/x509" - "encoding/pem" - "errors" -) - -var ( - ErrKeyMustBePEMEncoded = errors.New("Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key") - ErrNotRSAPrivateKey = errors.New("Key is not a valid RSA private key") - ErrNotRSAPublicKey = errors.New("Key is not a valid RSA public key") -) - -// Parse PEM encoded PKCS1 or PKCS8 private key -func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - var parsedKey interface{} - if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { - if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { - return nil, err - } - } - - var pkey *rsa.PrivateKey - var ok bool - if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { - return nil, ErrNotRSAPrivateKey - } - - return pkey, nil -} - -// Parse PEM encoded PKCS1 or PKCS8 public key -func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey interface{} - if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { - if cert, err := x509.ParseCertificate(block.Bytes); err == nil { - parsedKey = cert.PublicKey - } else { - return nil, err - } - } - - var pkey *rsa.PublicKey - var ok bool - if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { - return nil, ErrNotRSAPublicKey - } - - return pkey, nil -} diff --git a/vendor/github.com/dgrijalva/jwt-go/signing_method.go b/vendor/github.com/dgrijalva/jwt-go/signing_method.go deleted file mode 100644 index ed1f212b21e1e..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/signing_method.go +++ /dev/null @@ -1,35 +0,0 @@ -package jwt - -import ( - "sync" -) - -var signingMethods = map[string]func() SigningMethod{} -var signingMethodLock = new(sync.RWMutex) - -// Implement SigningMethod to add new methods for signing or verifying tokens. -type SigningMethod interface { - Verify(signingString, signature string, key interface{}) error // Returns nil if signature is valid - Sign(signingString string, key interface{}) (string, error) // Returns encoded signature or error - Alg() string // returns the alg identifier for this method (example: 'HS256') -} - -// Register the "alg" name and a factory function for signing method. -// This is typically done during init() in the method's implementation -func RegisterSigningMethod(alg string, f func() SigningMethod) { - signingMethodLock.Lock() - defer signingMethodLock.Unlock() - - signingMethods[alg] = f -} - -// Get a signing method from an "alg" string -func GetSigningMethod(alg string) (method SigningMethod) { - signingMethodLock.RLock() - defer signingMethodLock.RUnlock() - - if methodF, ok := signingMethods[alg]; ok { - method = methodF() - } - return -} diff --git a/vendor/github.com/dgrijalva/jwt-go/token.go b/vendor/github.com/dgrijalva/jwt-go/token.go deleted file mode 100644 index d637e0867c65b..0000000000000 --- a/vendor/github.com/dgrijalva/jwt-go/token.go +++ /dev/null @@ -1,108 +0,0 @@ -package jwt - -import ( - "encoding/base64" - "encoding/json" - "strings" - "time" -) - -// TimeFunc provides the current time when parsing token to validate "exp" claim (expiration time). -// You can override it to use another time value. This is useful for testing or if your -// server uses a different time zone than your tokens. -var TimeFunc = time.Now - -// Parse methods use this callback function to supply -// the key for verification. The function receives the parsed, -// but unverified Token. This allows you to use properties in the -// Header of the token (such as `kid`) to identify which key to use. -type Keyfunc func(*Token) (interface{}, error) - -// A JWT Token. Different fields will be used depending on whether you're -// creating or parsing/verifying a token. -type Token struct { - Raw string // The raw token. Populated when you Parse a token - Method SigningMethod // The signing method used or to be used - Header map[string]interface{} // The first segment of the token - Claims Claims // The second segment of the token - Signature string // The third segment of the token. Populated when you Parse a token - Valid bool // Is the token valid? Populated when you Parse/Verify a token -} - -// Create a new Token. Takes a signing method -func New(method SigningMethod) *Token { - return NewWithClaims(method, MapClaims{}) -} - -func NewWithClaims(method SigningMethod, claims Claims) *Token { - return &Token{ - Header: map[string]interface{}{ - "typ": "JWT", - "alg": method.Alg(), - }, - Claims: claims, - Method: method, - } -} - -// Get the complete, signed token -func (t *Token) SignedString(key interface{}) (string, error) { - var sig, sstr string - var err error - if sstr, err = t.SigningString(); err != nil { - return "", err - } - if sig, err = t.Method.Sign(sstr, key); err != nil { - return "", err - } - return strings.Join([]string{sstr, sig}, "."), nil -} - -// Generate the signing string. This is the -// most expensive part of the whole deal. Unless you -// need this for something special, just go straight for -// the SignedString. -func (t *Token) SigningString() (string, error) { - var err error - parts := make([]string, 2) - for i, _ := range parts { - var jsonValue []byte - if i == 0 { - if jsonValue, err = json.Marshal(t.Header); err != nil { - return "", err - } - } else { - if jsonValue, err = json.Marshal(t.Claims); err != nil { - return "", err - } - } - - parts[i] = EncodeSegment(jsonValue) - } - return strings.Join(parts, "."), nil -} - -// Parse, validate, and return a token. -// keyFunc will receive the parsed token and should return the key for validating. -// If everything is kosher, err will be nil -func Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { - return new(Parser).Parse(tokenString, keyFunc) -} - -func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { - return new(Parser).ParseWithClaims(tokenString, claims, keyFunc) -} - -// Encode JWT specific base64url encoding with padding stripped -func EncodeSegment(seg []byte) string { - return strings.TrimRight(base64.URLEncoding.EncodeToString(seg), "=") -} - -// Decode JWT specific base64url encoding with padding stripped -func DecodeSegment(seg string) ([]byte, error) { - if l := len(seg) % 4; l > 0 { - seg += strings.Repeat("=", 4-l) - } - - return base64.URLEncoding.DecodeString(seg) -} diff --git a/vendor/github.com/gizak/termui/LICENSE b/vendor/github.com/gizak/termui/LICENSE deleted file mode 100644 index 311ccc74fbfe8..0000000000000 --- a/vendor/github.com/gizak/termui/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Zack Guo - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/vendor/github.com/gizak/termui/README.md b/vendor/github.com/gizak/termui/README.md deleted file mode 100644 index d5f3d9a8f1172..0000000000000 --- a/vendor/github.com/gizak/termui/README.md +++ /dev/null @@ -1,151 +0,0 @@ -# termui [![Build Status](https://travis-ci.org/gizak/termui.svg?branch=master)](https://travis-ci.org/gizak/termui) [![Doc Status](https://godoc.org/github.com/gizak/termui?status.png)](https://godoc.org/github.com/gizak/termui) - -demo cast under osx 10.10; Terminal.app; Menlo Regular 12pt.) - -`termui` is a cross-platform, easy-to-compile, and fully-customizable terminal dashboard. It is inspired by [blessed-contrib](https://github.com/yaronn/blessed-contrib), but purely in Go. - -Now version v2 has arrived! It brings new event system, new theme system, new `Buffer` interface and specific colour text rendering. (some docs are missing, but it will be completed soon!) - -## Installation - -`master` mirrors v2 branch, to install: - - go get -u github.com/gizak/termui - -It is recommanded to use locked deps by using [glide](https://glide.sh): move to `termui` src directory then run `glide up`. - -For the compatible reason, you can choose to install the legacy version of `termui`: - - go get gopkg.in/gizak/termui.v1 - -## Usage - -### Layout - -To use `termui`, the very first thing you may want to know is how to manage layout. `termui` offers two ways of doing this, known as absolute layout and grid layout. - -__Absolute layout__ - -Each widget has an underlying block structure which basically is a box model. It has border, label and padding properties. A border of a widget can be chosen to hide or display (with its border label), you can pick a different front/back colour for the border as well. To display such a widget at a specific location in terminal window, you need to assign `.X`, `.Y`, `.Height`, `.Width` values for each widget before sending it to `.Render`. Let's demonstrate these by a code snippet: - -`````go - import ui "github.com/gizak/termui" // <- ui shortcut, optional - - func main() { - err := ui.Init() - if err != nil { - panic(err) - } - defer ui.Close() - - p := ui.NewPar(":PRESS q TO QUIT DEMO") - p.Height = 3 - p.Width = 50 - p.TextFgColor = ui.ColorWhite - p.BorderLabel = "Text Box" - p.BorderFg = ui.ColorCyan - - g := ui.NewGauge() - g.Percent = 50 - g.Width = 50 - g.Height = 3 - g.Y = 11 - g.BorderLabel = "Gauge" - g.BarColor = ui.ColorRed - g.BorderFg = ui.ColorWhite - g.BorderLabelFg = ui.ColorCyan - - ui.Render(p, g) // feel free to call Render, it's async and non-block - - // event handler... - } -````` - -Note that components can be overlapped (I'd rather call this a feature...), `Render(rs ...Renderer)` renders its args from left to right (i.e. each component's weight is arising from left to right). - -__Grid layout:__ - -grid - -Grid layout uses [12 columns grid system](http://www.w3schools.com/bootstrap/bootstrap_grid_system.asp) with expressive syntax. To use `Grid`, all we need to do is build a widget tree consisting of `Row`s and `Col`s (Actually a `Col` is also a `Row` but with a widget endpoint attached). - -```go - import ui "github.com/gizak/termui" - // init and create widgets... - - // build - ui.Body.AddRows( - ui.NewRow( - ui.NewCol(6, 0, widget0), - ui.NewCol(6, 0, widget1)), - ui.NewRow( - ui.NewCol(3, 0, widget2), - ui.NewCol(3, 0, widget30, widget31, widget32), - ui.NewCol(6, 0, widget4))) - - // calculate layout - ui.Body.Align() - - ui.Render(ui.Body) -``` - -### Events - -`termui` ships with a http-like event mux handling system. All events are channeled up from different sources (typing, click, windows resize, custom event) and then encoded as universal `Event` object. `Event.Path` indicates the event type and `Event.Data` stores the event data struct. Add a handler to a certain event is easy as below: - -```go - // handle key q pressing - ui.Handle("/sys/kbd/q", func(ui.Event) { - // press q to quit - ui.StopLoop() - }) - - ui.Handle("/sys/kbd/C-x", func(ui.Event) { - // handle Ctrl + x combination - }) - - ui.Handle("/sys/kbd", func(ui.Event) { - // handle all other key pressing - }) - - // handle a 1s timer - ui.Handle("/timer/1s", func(e ui.Event) { - t := e.Data.(ui.EvtTimer) - // t is a EvtTimer - if t.Count%2 ==0 { - // do something - } - }) - - ui.Loop() // block until StopLoop is called -``` - -### Widgets - -Click image to see the corresponding demo codes. - -[par](https://github.com/gizak/termui/blob/master/_example/par.go) -[list](https://github.com/gizak/termui/blob/master/_example/list.go) -[gauge](https://github.com/gizak/termui/blob/master/_example/gauge.go) -[linechart](https://github.com/gizak/termui/blob/master/_example/linechart.go) -[barchart](https://github.com/gizak/termui/blob/master/_example/barchart.go) -[barchart](https://github.com/gizak/termui/blob/master/_example/mbarchart.go) -[sparklines](https://github.com/gizak/termui/blob/master/_example/sparklines.go) -[table](https://github.com/gizak/termui/blob/master/_example/table.go) - -## GoDoc - -[godoc](https://godoc.org/github.com/gizak/termui) - -## TODO - -- [x] Grid layout -- [x] Event system -- [x] Canvas widget -- [x] Refine APIs -- [ ] Focusable widgets - -## Changelog - -## License -This library is under the [MIT License](http://opensource.org/licenses/MIT) diff --git a/vendor/github.com/gizak/termui/barchart.go b/vendor/github.com/gizak/termui/barchart.go deleted file mode 100644 index 6560c8b14e462..0000000000000 --- a/vendor/github.com/gizak/termui/barchart.go +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import "fmt" - -// BarChart creates multiple bars in a widget: -/* - bc := termui.NewBarChart() - data := []int{3, 2, 5, 3, 9, 5} - bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"} - bc.BorderLabel = "Bar Chart" - bc.Data = data - bc.Width = 26 - bc.Height = 10 - bc.DataLabels = bclabels - bc.TextColor = termui.ColorGreen - bc.BarColor = termui.ColorRed - bc.NumColor = termui.ColorYellow -*/ -type BarChart struct { - Block - BarColor Attribute - TextColor Attribute - NumColor Attribute - Data []int - DataLabels []string - BarWidth int - BarGap int - CellChar rune - labels [][]rune - dataNum [][]rune - numBar int - scale float64 - max int -} - -// NewBarChart returns a new *BarChart with current theme. -func NewBarChart() *BarChart { - bc := &BarChart{Block: *NewBlock()} - bc.BarColor = ThemeAttr("barchart.bar.bg") - bc.NumColor = ThemeAttr("barchart.num.fg") - bc.TextColor = ThemeAttr("barchart.text.fg") - bc.BarGap = 1 - bc.BarWidth = 3 - bc.CellChar = ' ' - return bc -} - -func (bc *BarChart) layout() { - bc.numBar = bc.innerArea.Dx() / (bc.BarGap + bc.BarWidth) - bc.labels = make([][]rune, bc.numBar) - bc.dataNum = make([][]rune, len(bc.Data)) - - for i := 0; i < bc.numBar && i < len(bc.DataLabels) && i < len(bc.Data); i++ { - bc.labels[i] = trimStr2Runes(bc.DataLabels[i], bc.BarWidth) - n := bc.Data[i] - s := fmt.Sprint(n) - bc.dataNum[i] = trimStr2Runes(s, bc.BarWidth) - } - - //bc.max = bc.Data[0] // what if Data is nil? Sometimes when bar graph is nill it produces panic with panic: runtime error: index out of range - // Asign a negative value to get maxvalue auto-populates - if bc.max == 0 { - bc.max = -1 - } - for i := 0; i < len(bc.Data); i++ { - if bc.max < bc.Data[i] { - bc.max = bc.Data[i] - } - } - bc.scale = float64(bc.max) / float64(bc.innerArea.Dy()-1) -} - -func (bc *BarChart) SetMax(max int) { - - if max > 0 { - bc.max = max - } -} - -// Buffer implements Bufferer interface. -func (bc *BarChart) Buffer() Buffer { - buf := bc.Block.Buffer() - bc.layout() - - for i := 0; i < bc.numBar && i < len(bc.Data) && i < len(bc.DataLabels); i++ { - h := int(float64(bc.Data[i]) / bc.scale) - oftX := i * (bc.BarWidth + bc.BarGap) - - barBg := bc.Bg - barFg := bc.BarColor - - if bc.CellChar == ' ' { - barBg = bc.BarColor - barFg = ColorDefault - if bc.BarColor == ColorDefault { // the same as above - barBg |= AttrReverse - } - } - - // plot bar - for j := 0; j < bc.BarWidth; j++ { - for k := 0; k < h; k++ { - c := Cell{ - Ch: bc.CellChar, - Bg: barBg, - Fg: barFg, - } - - x := bc.innerArea.Min.X + i*(bc.BarWidth+bc.BarGap) + j - y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 2 - k - buf.Set(x, y, c) - } - } - // plot text - for j, k := 0, 0; j < len(bc.labels[i]); j++ { - w := charWidth(bc.labels[i][j]) - c := Cell{ - Ch: bc.labels[i][j], - Bg: bc.Bg, - Fg: bc.TextColor, - } - y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 1 - x := bc.innerArea.Min.X + oftX + k - buf.Set(x, y, c) - k += w - } - // plot num - for j := 0; j < len(bc.dataNum[i]); j++ { - c := Cell{ - Ch: bc.dataNum[i][j], - Fg: bc.NumColor, - Bg: barBg, - } - - if h == 0 { - c.Bg = bc.Bg - } - x := bc.innerArea.Min.X + oftX + (bc.BarWidth-len(bc.dataNum[i]))/2 + j - y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 2 - buf.Set(x, y, c) - } - } - - return buf -} diff --git a/vendor/github.com/gizak/termui/block.go b/vendor/github.com/gizak/termui/block.go deleted file mode 100644 index 3e8571bc23263..0000000000000 --- a/vendor/github.com/gizak/termui/block.go +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import "image" - -// Hline is a horizontal line. -type Hline struct { - X int - Y int - Len int - Fg Attribute - Bg Attribute -} - -// Vline is a vertical line. -type Vline struct { - X int - Y int - Len int - Fg Attribute - Bg Attribute -} - -// Buffer draws a horizontal line. -func (l Hline) Buffer() Buffer { - if l.Len <= 0 { - return NewBuffer() - } - return NewFilledBuffer(l.X, l.Y, l.X+l.Len, l.Y+1, HORIZONTAL_LINE, l.Fg, l.Bg) -} - -// Buffer draws a vertical line. -func (l Vline) Buffer() Buffer { - if l.Len <= 0 { - return NewBuffer() - } - return NewFilledBuffer(l.X, l.Y, l.X+1, l.Y+l.Len, VERTICAL_LINE, l.Fg, l.Bg) -} - -// Buffer draws a box border. -func (b Block) drawBorder(buf Buffer) { - if !b.Border { - return - } - - min := b.area.Min - max := b.area.Max - - x0 := min.X - y0 := min.Y - x1 := max.X - 1 - y1 := max.Y - 1 - - // draw lines - if b.BorderTop { - buf.Merge(Hline{x0, y0, x1 - x0, b.BorderFg, b.BorderBg}.Buffer()) - } - if b.BorderBottom { - buf.Merge(Hline{x0, y1, x1 - x0, b.BorderFg, b.BorderBg}.Buffer()) - } - if b.BorderLeft { - buf.Merge(Vline{x0, y0, y1 - y0, b.BorderFg, b.BorderBg}.Buffer()) - } - if b.BorderRight { - buf.Merge(Vline{x1, y0, y1 - y0, b.BorderFg, b.BorderBg}.Buffer()) - } - - // draw corners - if b.BorderTop && b.BorderLeft && b.area.Dx() > 0 && b.area.Dy() > 0 { - buf.Set(x0, y0, Cell{TOP_LEFT, b.BorderFg, b.BorderBg}) - } - if b.BorderTop && b.BorderRight && b.area.Dx() > 1 && b.area.Dy() > 0 { - buf.Set(x1, y0, Cell{TOP_RIGHT, b.BorderFg, b.BorderBg}) - } - if b.BorderBottom && b.BorderLeft && b.area.Dx() > 0 && b.area.Dy() > 1 { - buf.Set(x0, y1, Cell{BOTTOM_LEFT, b.BorderFg, b.BorderBg}) - } - if b.BorderBottom && b.BorderRight && b.area.Dx() > 1 && b.area.Dy() > 1 { - buf.Set(x1, y1, Cell{BOTTOM_RIGHT, b.BorderFg, b.BorderBg}) - } -} - -func (b Block) drawBorderLabel(buf Buffer) { - maxTxtW := b.area.Dx() - 2 - tx := DTrimTxCls(DefaultTxBuilder.Build(b.BorderLabel, b.BorderLabelFg, b.BorderLabelBg), maxTxtW) - - for i, w := 0, 0; i < len(tx); i++ { - buf.Set(b.area.Min.X+1+w, b.area.Min.Y, tx[i]) - w += tx[i].Width() - } -} - -// Block is a base struct for all other upper level widgets, -// consider it as css: display:block. -// Normally you do not need to create it manually. -type Block struct { - area image.Rectangle - innerArea image.Rectangle - X int - Y int - Border bool - BorderFg Attribute - BorderBg Attribute - BorderLeft bool - BorderRight bool - BorderTop bool - BorderBottom bool - BorderLabel string - BorderLabelFg Attribute - BorderLabelBg Attribute - Display bool - Bg Attribute - Width int - Height int - PaddingTop int - PaddingBottom int - PaddingLeft int - PaddingRight int - id string - Float Align -} - -// NewBlock returns a *Block which inherits styles from current theme. -func NewBlock() *Block { - b := Block{} - b.Display = true - b.Border = true - b.BorderLeft = true - b.BorderRight = true - b.BorderTop = true - b.BorderBottom = true - b.BorderBg = ThemeAttr("border.bg") - b.BorderFg = ThemeAttr("border.fg") - b.BorderLabelBg = ThemeAttr("label.bg") - b.BorderLabelFg = ThemeAttr("label.fg") - b.Bg = ThemeAttr("block.bg") - b.Width = 2 - b.Height = 2 - b.id = GenId() - b.Float = AlignNone - return &b -} - -func (b Block) Id() string { - return b.id -} - -// Align computes box model -func (b *Block) Align() { - // outer - b.area.Min.X = 0 - b.area.Min.Y = 0 - b.area.Max.X = b.Width - b.area.Max.Y = b.Height - - // float - b.area = AlignArea(TermRect(), b.area, b.Float) - b.area = MoveArea(b.area, b.X, b.Y) - - // inner - b.innerArea.Min.X = b.area.Min.X + b.PaddingLeft - b.innerArea.Min.Y = b.area.Min.Y + b.PaddingTop - b.innerArea.Max.X = b.area.Max.X - b.PaddingRight - b.innerArea.Max.Y = b.area.Max.Y - b.PaddingBottom - - if b.Border { - if b.BorderLeft { - b.innerArea.Min.X++ - } - if b.BorderRight { - b.innerArea.Max.X-- - } - if b.BorderTop { - b.innerArea.Min.Y++ - } - if b.BorderBottom { - b.innerArea.Max.Y-- - } - } -} - -// InnerBounds returns the internal bounds of the block after aligning and -// calculating the padding and border, if any. -func (b *Block) InnerBounds() image.Rectangle { - b.Align() - return b.innerArea -} - -// Buffer implements Bufferer interface. -// Draw background and border (if any). -func (b *Block) Buffer() Buffer { - b.Align() - - buf := NewBuffer() - buf.SetArea(b.area) - buf.Fill(' ', ColorDefault, b.Bg) - - b.drawBorder(buf) - b.drawBorderLabel(buf) - - return buf -} - -// GetHeight implements GridBufferer. -// It returns current height of the block. -func (b Block) GetHeight() int { - return b.Height -} - -// SetX implements GridBufferer interface, which sets block's x position. -func (b *Block) SetX(x int) { - b.X = x -} - -// SetY implements GridBufferer interface, it sets y position for block. -func (b *Block) SetY(y int) { - b.Y = y -} - -// SetWidth implements GridBuffer interface, it sets block's width. -func (b *Block) SetWidth(w int) { - b.Width = w -} - -func (b Block) InnerWidth() int { - return b.innerArea.Dx() -} - -func (b Block) InnerHeight() int { - return b.innerArea.Dy() -} - -func (b Block) InnerX() int { - return b.innerArea.Min.X -} - -func (b Block) InnerY() int { return b.innerArea.Min.Y } diff --git a/vendor/github.com/gizak/termui/block_common.go b/vendor/github.com/gizak/termui/block_common.go deleted file mode 100644 index 6438bf217dd7d..0000000000000 --- a/vendor/github.com/gizak/termui/block_common.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -// +build !windows - -package termui - -const TOP_RIGHT = '┐' -const VERTICAL_LINE = '│' -const HORIZONTAL_LINE = '─' -const TOP_LEFT = '┌' -const BOTTOM_RIGHT = '┘' -const BOTTOM_LEFT = '└' -const VERTICAL_LEFT = '┤' -const VERTICAL_RIGHT = '├' -const HORIZONTAL_DOWN = '┬' -const HORIZONTAL_UP = '┴' -const QUOTA_LEFT = '«' -const QUOTA_RIGHT = '»' diff --git a/vendor/github.com/gizak/termui/block_windows.go b/vendor/github.com/gizak/termui/block_windows.go deleted file mode 100644 index a4fba77d7c315..0000000000000 --- a/vendor/github.com/gizak/termui/block_windows.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -// +build windows - -package termui - -const TOP_RIGHT = '+' -const VERTICAL_LINE = '|' -const HORIZONTAL_LINE = '-' -const TOP_LEFT = '+' -const BOTTOM_RIGHT = '+' -const BOTTOM_LEFT = '+' diff --git a/vendor/github.com/gizak/termui/buffer.go b/vendor/github.com/gizak/termui/buffer.go deleted file mode 100644 index 9e3a97345d255..0000000000000 --- a/vendor/github.com/gizak/termui/buffer.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import "image" - -// Cell is a rune with assigned Fg and Bg -type Cell struct { - Ch rune - Fg Attribute - Bg Attribute -} - -// Buffer is a renderable rectangle cell data container. -type Buffer struct { - Area image.Rectangle // selected drawing area - CellMap map[image.Point]Cell -} - -// At returns the cell at (x,y). -func (b Buffer) At(x, y int) Cell { - return b.CellMap[image.Pt(x, y)] -} - -// Set assigns a char to (x,y) -func (b Buffer) Set(x, y int, c Cell) { - b.CellMap[image.Pt(x, y)] = c -} - -// Bounds returns the domain for which At can return non-zero color. -func (b Buffer) Bounds() image.Rectangle { - x0, y0, x1, y1 := 0, 0, 0, 0 - for p := range b.CellMap { - if p.X > x1 { - x1 = p.X - } - if p.X < x0 { - x0 = p.X - } - if p.Y > y1 { - y1 = p.Y - } - if p.Y < y0 { - y0 = p.Y - } - } - return image.Rect(x0, y0, x1+1, y1+1) -} - -// SetArea assigns a new rect area to Buffer b. -func (b *Buffer) SetArea(r image.Rectangle) { - b.Area.Max = r.Max - b.Area.Min = r.Min -} - -// Sync sets drawing area to the buffer's bound -func (b *Buffer) Sync() { - b.SetArea(b.Bounds()) -} - -// NewCell returns a new cell -func NewCell(ch rune, fg, bg Attribute) Cell { - return Cell{ch, fg, bg} -} - -// Merge merges bs Buffers onto b -func (b *Buffer) Merge(bs ...Buffer) { - for _, buf := range bs { - for p, v := range buf.CellMap { - b.Set(p.X, p.Y, v) - } - b.SetArea(b.Area.Union(buf.Area)) - } -} - -// NewBuffer returns a new Buffer -func NewBuffer() Buffer { - return Buffer{ - CellMap: make(map[image.Point]Cell), - Area: image.Rectangle{}} -} - -// Fill fills the Buffer b with ch,fg and bg. -func (b Buffer) Fill(ch rune, fg, bg Attribute) { - for x := b.Area.Min.X; x < b.Area.Max.X; x++ { - for y := b.Area.Min.Y; y < b.Area.Max.Y; y++ { - b.Set(x, y, Cell{ch, fg, bg}) - } - } -} - -// NewFilledBuffer returns a new Buffer filled with ch, fb and bg. -func NewFilledBuffer(x0, y0, x1, y1 int, ch rune, fg, bg Attribute) Buffer { - buf := NewBuffer() - buf.Area.Min = image.Pt(x0, y0) - buf.Area.Max = image.Pt(x1, y1) - - for x := buf.Area.Min.X; x < buf.Area.Max.X; x++ { - for y := buf.Area.Min.Y; y < buf.Area.Max.Y; y++ { - buf.Set(x, y, Cell{ch, fg, bg}) - } - } - return buf -} diff --git a/vendor/github.com/gizak/termui/canvas.go b/vendor/github.com/gizak/termui/canvas.go deleted file mode 100644 index 6d2513ebd4f15..0000000000000 --- a/vendor/github.com/gizak/termui/canvas.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -/* -dots: - ,___, - |1 4| - |2 5| - |3 6| - |7 8| - ````` -*/ - -var brailleBase = '\u2800' - -var brailleOftMap = [4][2]rune{ - {'\u0001', '\u0008'}, - {'\u0002', '\u0010'}, - {'\u0004', '\u0020'}, - {'\u0040', '\u0080'}} - -// Canvas contains drawing map: i,j -> rune -type Canvas map[[2]int]rune - -// NewCanvas returns an empty Canvas -func NewCanvas() Canvas { - return make(map[[2]int]rune) -} - -func chOft(x, y int) rune { - return brailleOftMap[y%4][x%2] -} - -func (c Canvas) rawCh(x, y int) rune { - if ch, ok := c[[2]int{x, y}]; ok { - return ch - } - return '\u0000' //brailleOffset -} - -// return coordinate in terminal -func chPos(x, y int) (int, int) { - return y / 4, x / 2 -} - -// Set sets a point (x,y) in the virtual coordinate -func (c Canvas) Set(x, y int) { - i, j := chPos(x, y) - ch := c.rawCh(i, j) - ch |= chOft(x, y) - c[[2]int{i, j}] = ch -} - -// Unset removes point (x,y) -func (c Canvas) Unset(x, y int) { - i, j := chPos(x, y) - ch := c.rawCh(i, j) - ch &= ^chOft(x, y) - c[[2]int{i, j}] = ch -} - -// Buffer returns un-styled points -func (c Canvas) Buffer() Buffer { - buf := NewBuffer() - for k, v := range c { - buf.Set(k[0], k[1], Cell{Ch: v + brailleBase}) - } - return buf -} diff --git a/vendor/github.com/gizak/termui/config.py b/vendor/github.com/gizak/termui/config.py deleted file mode 100644 index 30fadcf86897a..0000000000000 --- a/vendor/github.com/gizak/termui/config.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python3 - -import re -import os -import io - -copyright = """// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -""" - -exclude_dirs = [".git", "_docs"] -exclude_files = [] -include_dirs = [".", "debug", "extra", "test", "_example"] - - -def is_target(fpath): - if os.path.splitext(fpath)[-1] == ".go": - return True - return False - - -def update_copyright(fpath): - print("processing " + fpath) - f = io.open(fpath, 'r', encoding='utf-8') - fstr = f.read() - f.close() - - # remove old - m = re.search('^// Copyright .+?\r?\n\r?\n', fstr, re.MULTILINE|re.DOTALL) - if m: - fstr = fstr[m.end():] - - # add new - fstr = copyright + fstr - f = io.open(fpath, 'w',encoding='utf-8') - f.write(fstr) - f.close() - - -def main(): - for d in include_dirs: - files = [ - os.path.join(d, f) for f in os.listdir(d) - if os.path.isfile(os.path.join(d, f)) - ] - for f in files: - if is_target(f): - update_copyright(f) - - -if __name__ == '__main__': - main() diff --git a/vendor/github.com/gizak/termui/doc.go b/vendor/github.com/gizak/termui/doc.go deleted file mode 100644 index 13924eb1f7d73..0000000000000 --- a/vendor/github.com/gizak/termui/doc.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -/* -Package termui is a library designed for creating command line UI. For more info, goto http://github.com/gizak/termui - -A simplest example: - package main - - import ui "github.com/gizak/termui" - - func main() { - if err:=ui.Init(); err != nil { - panic(err) - } - defer ui.Close() - - g := ui.NewGauge() - g.Percent = 50 - g.Width = 50 - g.BorderLabel = "Gauge" - - ui.Render(g) - - ui.Loop() - } -*/ -package termui diff --git a/vendor/github.com/gizak/termui/events.go b/vendor/github.com/gizak/termui/events.go deleted file mode 100644 index 16d9bd9cc34ab..0000000000000 --- a/vendor/github.com/gizak/termui/events.go +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import ( - "path" - "strconv" - "sync" - "time" - - "github.com/nsf/termbox-go" -) - -type Event struct { - Type string - Path string - From string - To string - Data interface{} - Time int64 -} - -var sysEvtChs []chan Event - -type EvtKbd struct { - KeyStr string -} - -func evtKbd(e termbox.Event) EvtKbd { - ek := EvtKbd{} - - k := string(e.Ch) - pre := "" - mod := "" - - if e.Mod == termbox.ModAlt { - mod = "M-" - } - if e.Ch == 0 { - if e.Key > 0xFFFF-12 { - k = "" - } else if e.Key > 0xFFFF-25 { - ks := []string{"", "", "", "", "", "", "", "", "", ""} - k = ks[0xFFFF-int(e.Key)-12] - } - - if e.Key <= 0x7F { - pre = "C-" - k = string('a' - 1 + int(e.Key)) - kmap := map[termbox.Key][2]string{ - termbox.KeyCtrlSpace: {"C-", ""}, - termbox.KeyBackspace: {"", ""}, - termbox.KeyTab: {"", ""}, - termbox.KeyEnter: {"", ""}, - termbox.KeyEsc: {"", ""}, - termbox.KeyCtrlBackslash: {"C-", "\\"}, - termbox.KeyCtrlSlash: {"C-", "/"}, - termbox.KeySpace: {"", ""}, - termbox.KeyCtrl8: {"C-", "8"}, - } - if sk, ok := kmap[e.Key]; ok { - pre = sk[0] - k = sk[1] - } - } - } - - ek.KeyStr = pre + mod + k - return ek -} - -func crtTermboxEvt(e termbox.Event) Event { - systypemap := map[termbox.EventType]string{ - termbox.EventKey: "keyboard", - termbox.EventResize: "window", - termbox.EventMouse: "mouse", - termbox.EventError: "error", - termbox.EventInterrupt: "interrupt", - } - ne := Event{From: "/sys", Time: time.Now().Unix()} - typ := e.Type - ne.Type = systypemap[typ] - - switch typ { - case termbox.EventKey: - kbd := evtKbd(e) - ne.Path = "/sys/kbd/" + kbd.KeyStr - ne.Data = kbd - case termbox.EventResize: - wnd := EvtWnd{} - wnd.Width = e.Width - wnd.Height = e.Height - ne.Path = "/sys/wnd/resize" - ne.Data = wnd - case termbox.EventError: - err := EvtErr(e.Err) - ne.Path = "/sys/err" - ne.Data = err - case termbox.EventMouse: - m := EvtMouse{} - m.X = e.MouseX - m.Y = e.MouseY - ne.Path = "/sys/mouse" - ne.Data = m - } - return ne -} - -type EvtWnd struct { - Width int - Height int -} - -type EvtMouse struct { - X int - Y int - Press string -} - -type EvtErr error - -func hookTermboxEvt() { - for { - e := termbox.PollEvent() - - for _, c := range sysEvtChs { - go func(ch chan Event) { - ch <- crtTermboxEvt(e) - }(c) - } - } -} - -func NewSysEvtCh() chan Event { - ec := make(chan Event) - sysEvtChs = append(sysEvtChs, ec) - return ec -} - -var DefaultEvtStream = NewEvtStream() - -type EvtStream struct { - sync.RWMutex - srcMap map[string]chan Event - stream chan Event - wg sync.WaitGroup - sigStopLoop chan Event - Handlers map[string]func(Event) - hook func(Event) -} - -func NewEvtStream() *EvtStream { - return &EvtStream{ - srcMap: make(map[string]chan Event), - stream: make(chan Event), - Handlers: make(map[string]func(Event)), - sigStopLoop: make(chan Event), - } -} - -func (es *EvtStream) Init() { - es.Merge("internal", es.sigStopLoop) - go func() { - es.wg.Wait() - close(es.stream) - }() -} - -func cleanPath(p string) string { - if p == "" { - return "/" - } - if p[0] != '/' { - p = "/" + p - } - return path.Clean(p) -} - -func isPathMatch(pattern, path string) bool { - if len(pattern) == 0 { - return false - } - n := len(pattern) - return len(path) >= n && path[0:n] == pattern -} - -func (es *EvtStream) Merge(name string, ec chan Event) { - es.Lock() - defer es.Unlock() - - es.wg.Add(1) - es.srcMap[name] = ec - - go func(a chan Event) { - for n := range a { - n.From = name - es.stream <- n - } - es.wg.Done() - }(ec) -} - -func (es *EvtStream) Handle(path string, handler func(Event)) { - es.Handlers[cleanPath(path)] = handler -} - -func findMatch(mux map[string]func(Event), path string) string { - n := -1 - pattern := "" - for m := range mux { - if !isPathMatch(m, path) { - continue - } - if len(m) > n { - pattern = m - n = len(m) - } - } - return pattern - -} - -// Remove all existing defined Handlers from the map -func (es *EvtStream) ResetHandlers() { - for Path, _ := range es.Handlers { - delete(es.Handlers, Path) - } - return -} - -func (es *EvtStream) match(path string) string { - return findMatch(es.Handlers, path) -} - -func (es *EvtStream) Hook(f func(Event)) { - es.hook = f -} - -func (es *EvtStream) Loop() { - for e := range es.stream { - switch e.Path { - case "/sig/stoploop": - return - } - go func(a Event) { - es.RLock() - defer es.RUnlock() - if pattern := es.match(a.Path); pattern != "" { - es.Handlers[pattern](a) - } - }(e) - if es.hook != nil { - es.hook(e) - } - } -} - -func (es *EvtStream) StopLoop() { - go func() { - e := Event{ - Path: "/sig/stoploop", - } - es.sigStopLoop <- e - }() -} - -func Merge(name string, ec chan Event) { - DefaultEvtStream.Merge(name, ec) -} - -func Handle(path string, handler func(Event)) { - DefaultEvtStream.Handle(path, handler) -} - -func Loop() { - DefaultEvtStream.Loop() -} - -func StopLoop() { - DefaultEvtStream.StopLoop() -} - -type EvtTimer struct { - Duration time.Duration - Count uint64 -} - -func NewTimerCh(du time.Duration) chan Event { - t := make(chan Event) - - go func(a chan Event) { - n := uint64(0) - for { - n++ - time.Sleep(du) - e := Event{} - e.Type = "timer" - e.Path = "/timer/" + du.String() - e.Time = time.Now().Unix() - e.Data = EvtTimer{ - Duration: du, - Count: n, - } - t <- e - - } - }(t) - return t -} - -var DefaultHandler = func(e Event) { -} - -var usrEvtCh = make(chan Event) - -func SendCustomEvt(path string, data interface{}) { - e := Event{} - e.Path = path - e.Data = data - e.Time = time.Now().Unix() - usrEvtCh <- e -} diff --git a/vendor/github.com/gizak/termui/gauge.go b/vendor/github.com/gizak/termui/gauge.go deleted file mode 100644 index 9f6ce3a706c27..0000000000000 --- a/vendor/github.com/gizak/termui/gauge.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import ( - "strconv" - "strings" -) - -// Gauge is a progress bar like widget. -// A simple example: -/* - g := termui.NewGauge() - g.Percent = 40 - g.Width = 50 - g.Height = 3 - g.BorderLabel = "Slim Gauge" - g.BarColor = termui.ColorRed - g.PercentColor = termui.ColorBlue -*/ - -const ColorUndef Attribute = Attribute(^uint16(0)) - -type Gauge struct { - Block - Percent int - BarColor Attribute - PercentColor Attribute - PercentColorHighlighted Attribute - Label string - LabelAlign Align -} - -// NewGauge return a new gauge with current theme. -func NewGauge() *Gauge { - g := &Gauge{ - Block: *NewBlock(), - PercentColor: ThemeAttr("gauge.percent.fg"), - BarColor: ThemeAttr("gauge.bar.bg"), - Label: "{{percent}}%", - LabelAlign: AlignCenter, - PercentColorHighlighted: ColorUndef, - } - - g.Width = 12 - g.Height = 5 - return g -} - -// Buffer implements Bufferer interface. -func (g *Gauge) Buffer() Buffer { - buf := g.Block.Buffer() - - // plot bar - w := g.Percent * g.innerArea.Dx() / 100 - for i := 0; i < g.innerArea.Dy(); i++ { - for j := 0; j < w; j++ { - c := Cell{} - c.Ch = ' ' - c.Bg = g.BarColor - if c.Bg == ColorDefault { - c.Bg |= AttrReverse - } - buf.Set(g.innerArea.Min.X+j, g.innerArea.Min.Y+i, c) - } - } - - // plot percentage - s := strings.Replace(g.Label, "{{percent}}", strconv.Itoa(g.Percent), -1) - pry := g.innerArea.Min.Y + g.innerArea.Dy()/2 - rs := str2runes(s) - var pos int - switch g.LabelAlign { - case AlignLeft: - pos = 0 - - case AlignCenter: - pos = (g.innerArea.Dx() - strWidth(s)) / 2 - - case AlignRight: - pos = g.innerArea.Dx() - strWidth(s) - 1 - } - pos += g.innerArea.Min.X - - for i, v := range rs { - c := Cell{ - Ch: v, - Fg: g.PercentColor, - } - - if w+g.innerArea.Min.X > pos+i { - c.Bg = g.BarColor - if c.Bg == ColorDefault { - c.Bg |= AttrReverse - } - - if g.PercentColorHighlighted != ColorUndef { - c.Fg = g.PercentColorHighlighted - } - } else { - c.Bg = g.Block.Bg - } - - buf.Set(1+pos+i, pry, c) - } - return buf -} diff --git a/vendor/github.com/gizak/termui/glide.lock b/vendor/github.com/gizak/termui/glide.lock deleted file mode 100644 index be5952d4666df..0000000000000 --- a/vendor/github.com/gizak/termui/glide.lock +++ /dev/null @@ -1,30 +0,0 @@ -hash: 7a754ba100256404a978b2fc8738aee337beb822458e4b6060399fb89ebd215c -updated: 2016-11-03T17:39:24.323773674-04:00 -imports: -- name: github.com/maruel/panicparse - version: ad661195ed0e88491e0f14be6613304e3b1141d6 - subpackages: - - stack -- name: github.com/mattn/go-runewidth - version: 737072b4e32b7a5018b4a7125da8d12de90e8045 -- name: github.com/mitchellh/go-wordwrap - version: ad45545899c7b13c020ea92b2072220eefad42b8 -- name: github.com/nsf/termbox-go - version: b6acae516ace002cb8105a89024544a1480655a5 -- name: golang.org/x/net - version: 569280fa63be4e201b975e5411e30a92178f0118 - subpackages: - - websocket -testImports: -- name: github.com/davecgh/go-spew - version: 346938d642f2ec3594ed81d874461961cd0faa76 - subpackages: - - spew -- name: github.com/pmezard/go-difflib - version: d8ed2627bdf02c080bf22230dbb337003b7aba2d - subpackages: - - difflib -- name: github.com/stretchr/testify - version: 976c720a22c8eb4eb6a0b4348ad85ad12491a506 - subpackages: - - assert diff --git a/vendor/github.com/gizak/termui/glide.yaml b/vendor/github.com/gizak/termui/glide.yaml deleted file mode 100644 index a6812317f7a6a..0000000000000 --- a/vendor/github.com/gizak/termui/glide.yaml +++ /dev/null @@ -1,9 +0,0 @@ -package: github.com/gizak/termui -import: -- package: github.com/mattn/go-runewidth -- package: github.com/mitchellh/go-wordwrap -- package: github.com/nsf/termbox-go -- package: golang.org/x/net - subpackages: - - websocket -- package: github.com/maruel/panicparse diff --git a/vendor/github.com/gizak/termui/grid.go b/vendor/github.com/gizak/termui/grid.go deleted file mode 100644 index a9502322535a0..0000000000000 --- a/vendor/github.com/gizak/termui/grid.go +++ /dev/null @@ -1,279 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -// GridBufferer introduces a Bufferer that can be manipulated by Grid. -type GridBufferer interface { - Bufferer - GetHeight() int - SetWidth(int) - SetX(int) - SetY(int) -} - -// Row builds a layout tree -type Row struct { - Cols []*Row //children - Widget GridBufferer // root - X int - Y int - Width int - Height int - Span int - Offset int -} - -// calculate and set the underlying layout tree's x, y, height and width. -func (r *Row) calcLayout() { - r.assignWidth(r.Width) - r.Height = r.solveHeight() - r.assignX(r.X) - r.assignY(r.Y) -} - -// tell if the node is leaf in the tree. -func (r *Row) isLeaf() bool { - return r.Cols == nil || len(r.Cols) == 0 -} - -func (r *Row) isRenderableLeaf() bool { - return r.isLeaf() && r.Widget != nil -} - -// assign widgets' (and their parent rows') width recursively. -func (r *Row) assignWidth(w int) { - r.SetWidth(w) - - accW := 0 // acc span and offset - calcW := make([]int, len(r.Cols)) // calculated width - calcOftX := make([]int, len(r.Cols)) // computated start position of x - - for i, c := range r.Cols { - accW += c.Span + c.Offset - cw := int(float64(c.Span*r.Width) / 12.0) - - if i >= 1 { - calcOftX[i] = calcOftX[i-1] + - calcW[i-1] + - int(float64(r.Cols[i-1].Offset*r.Width)/12.0) - } - - // use up the space if it is the last col - if i == len(r.Cols)-1 && accW == 12 { - cw = r.Width - calcOftX[i] - } - calcW[i] = cw - r.Cols[i].assignWidth(cw) - } -} - -// bottom up calc and set rows' (and their widgets') height, -// return r's total height. -func (r *Row) solveHeight() int { - if r.isRenderableLeaf() { - r.Height = r.Widget.GetHeight() - return r.Widget.GetHeight() - } - - maxh := 0 - if !r.isLeaf() { - for _, c := range r.Cols { - nh := c.solveHeight() - // when embed rows in Cols, row widgets stack up - if r.Widget != nil { - nh += r.Widget.GetHeight() - } - if nh > maxh { - maxh = nh - } - } - } - - r.Height = maxh - return maxh -} - -// recursively assign x position for r tree. -func (r *Row) assignX(x int) { - r.SetX(x) - - if !r.isLeaf() { - acc := 0 - for i, c := range r.Cols { - if c.Offset != 0 { - acc += int(float64(c.Offset*r.Width) / 12.0) - } - r.Cols[i].assignX(x + acc) - acc += c.Width - } - } -} - -// recursively assign y position to r. -func (r *Row) assignY(y int) { - r.SetY(y) - - if r.isLeaf() { - return - } - - for i := range r.Cols { - acc := 0 - if r.Widget != nil { - acc = r.Widget.GetHeight() - } - r.Cols[i].assignY(y + acc) - } - -} - -// GetHeight implements GridBufferer interface. -func (r Row) GetHeight() int { - return r.Height -} - -// SetX implements GridBufferer interface. -func (r *Row) SetX(x int) { - r.X = x - if r.Widget != nil { - r.Widget.SetX(x) - } -} - -// SetY implements GridBufferer interface. -func (r *Row) SetY(y int) { - r.Y = y - if r.Widget != nil { - r.Widget.SetY(y) - } -} - -// SetWidth implements GridBufferer interface. -func (r *Row) SetWidth(w int) { - r.Width = w - if r.Widget != nil { - r.Widget.SetWidth(w) - } -} - -// Buffer implements Bufferer interface, -// recursively merge all widgets buffer -func (r *Row) Buffer() Buffer { - merged := NewBuffer() - - if r.isRenderableLeaf() { - return r.Widget.Buffer() - } - - // for those are not leaves but have a renderable widget - if r.Widget != nil { - merged.Merge(r.Widget.Buffer()) - } - - // collect buffer from children - if !r.isLeaf() { - for _, c := range r.Cols { - merged.Merge(c.Buffer()) - } - } - - return merged -} - -// Grid implements 12 columns system. -// A simple example: -/* - import ui "github.com/gizak/termui" - // init and create widgets... - - // build - ui.Body.AddRows( - ui.NewRow( - ui.NewCol(6, 0, widget0), - ui.NewCol(6, 0, widget1)), - ui.NewRow( - ui.NewCol(3, 0, widget2), - ui.NewCol(3, 0, widget30, widget31, widget32), - ui.NewCol(6, 0, widget4))) - - // calculate layout - ui.Body.Align() - - ui.Render(ui.Body) -*/ -type Grid struct { - Rows []*Row - Width int - X int - Y int - BgColor Attribute -} - -// NewGrid returns *Grid with given rows. -func NewGrid(rows ...*Row) *Grid { - return &Grid{Rows: rows} -} - -// AddRows appends given rows to Grid. -func (g *Grid) AddRows(rs ...*Row) { - g.Rows = append(g.Rows, rs...) -} - -// NewRow creates a new row out of given columns. -func NewRow(cols ...*Row) *Row { - rs := &Row{Span: 12, Cols: cols} - return rs -} - -// NewCol accepts: widgets are LayoutBufferer or widgets is A NewRow. -// Note that if multiple widgets are provided, they will stack up in the col. -func NewCol(span, offset int, widgets ...GridBufferer) *Row { - r := &Row{Span: span, Offset: offset} - - if widgets != nil && len(widgets) == 1 { - wgt := widgets[0] - nw, isRow := wgt.(*Row) - if isRow { - r.Cols = nw.Cols - } else { - r.Widget = wgt - } - return r - } - - r.Cols = []*Row{} - ir := r - for _, w := range widgets { - nr := &Row{Span: 12, Widget: w} - ir.Cols = []*Row{nr} - ir = nr - } - - return r -} - -// Align calculate each rows' layout. -func (g *Grid) Align() { - h := 0 - for _, r := range g.Rows { - r.SetWidth(g.Width) - r.SetX(g.X) - r.SetY(g.Y + h) - r.calcLayout() - h += r.GetHeight() - } -} - -// Buffer implments Bufferer interface. -func (g Grid) Buffer() Buffer { - buf := NewBuffer() - - for _, r := range g.Rows { - buf.Merge(r.Buffer()) - } - return buf -} - -var Body *Grid diff --git a/vendor/github.com/gizak/termui/helper.go b/vendor/github.com/gizak/termui/helper.go deleted file mode 100644 index 18a6770435772..0000000000000 --- a/vendor/github.com/gizak/termui/helper.go +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import ( - "regexp" - "strings" - - tm "github.com/nsf/termbox-go" -) -import rw "github.com/mattn/go-runewidth" - -/* ---------------Port from termbox-go --------------------- */ - -// Attribute is printable cell's color and style. -type Attribute uint16 - -// 8 basic clolrs -const ( - ColorDefault Attribute = iota - ColorBlack - ColorRed - ColorGreen - ColorYellow - ColorBlue - ColorMagenta - ColorCyan - ColorWhite -) - -//Have a constant that defines number of colors -const NumberofColors = 8 - -// Text style -const ( - AttrBold Attribute = 1 << (iota + 9) - AttrUnderline - AttrReverse -) - -var ( - dot = "…" - dotw = rw.StringWidth(dot) -) - -/* ----------------------- End ----------------------------- */ - -func toTmAttr(x Attribute) tm.Attribute { - return tm.Attribute(x) -} - -func str2runes(s string) []rune { - return []rune(s) -} - -// Here for backwards-compatibility. -func trimStr2Runes(s string, w int) []rune { - return TrimStr2Runes(s, w) -} - -// TrimStr2Runes trims string to w[-1 rune], appends …, and returns the runes -// of that string if string is grather then n. If string is small then w, -// return the runes. -func TrimStr2Runes(s string, w int) []rune { - if w <= 0 { - return []rune{} - } - - sw := rw.StringWidth(s) - if sw > w { - return []rune(rw.Truncate(s, w, dot)) - } - return str2runes(s) -} - -// TrimStrIfAppropriate trim string to "s[:-1] + …" -// if string > width otherwise return string -func TrimStrIfAppropriate(s string, w int) string { - if w <= 0 { - return "" - } - - sw := rw.StringWidth(s) - if sw > w { - return rw.Truncate(s, w, dot) - } - - return s -} - -func strWidth(s string) int { - return rw.StringWidth(s) -} - -func charWidth(ch rune) int { - return rw.RuneWidth(ch) -} - -var whiteSpaceRegex = regexp.MustCompile(`\s`) - -// StringToAttribute converts text to a termui attribute. You may specifiy more -// then one attribute like that: "BLACK, BOLD, ...". All whitespaces -// are ignored. -func StringToAttribute(text string) Attribute { - text = whiteSpaceRegex.ReplaceAllString(strings.ToLower(text), "") - attributes := strings.Split(text, ",") - result := Attribute(0) - - for _, theAttribute := range attributes { - var match Attribute - switch theAttribute { - case "reset", "default": - match = ColorDefault - - case "black": - match = ColorBlack - - case "red": - match = ColorRed - - case "green": - match = ColorGreen - - case "yellow": - match = ColorYellow - - case "blue": - match = ColorBlue - - case "magenta": - match = ColorMagenta - - case "cyan": - match = ColorCyan - - case "white": - match = ColorWhite - - case "bold": - match = AttrBold - - case "underline": - match = AttrUnderline - - case "reverse": - match = AttrReverse - } - - result |= match - } - - return result -} - -// TextCells returns a coloured text cells []Cell -func TextCells(s string, fg, bg Attribute) []Cell { - cs := make([]Cell, 0, len(s)) - - // sequence := MarkdownTextRendererFactory{}.TextRenderer(s).Render(fg, bg) - // runes := []rune(sequence.NormalizedText) - runes := str2runes(s) - - for n := range runes { - // point, _ := sequence.PointAt(n, 0, 0) - // cs = append(cs, Cell{point.Ch, point.Fg, point.Bg}) - cs = append(cs, Cell{runes[n], fg, bg}) - } - return cs -} - -// Width returns the actual screen space the cell takes (usually 1 or 2). -func (c Cell) Width() int { - return charWidth(c.Ch) -} - -// Copy return a copy of c -func (c Cell) Copy() Cell { - return c -} - -// TrimTxCells trims the overflowed text cells sequence. -func TrimTxCells(cs []Cell, w int) []Cell { - if len(cs) <= w { - return cs - } - return cs[:w] -} - -// DTrimTxCls trims the overflowed text cells sequence and append dots at the end. -func DTrimTxCls(cs []Cell, w int) []Cell { - l := len(cs) - if l <= 0 { - return []Cell{} - } - - rt := make([]Cell, 0, w) - csw := 0 - for i := 0; i < l && csw <= w; i++ { - c := cs[i] - cw := c.Width() - - if cw+csw < w { - rt = append(rt, c) - csw += cw - } else { - rt = append(rt, Cell{'…', c.Fg, c.Bg}) - break - } - } - - return rt -} - -func CellsToStr(cs []Cell) string { - str := "" - for _, c := range cs { - str += string(c.Ch) - } - return str -} diff --git a/vendor/github.com/gizak/termui/linechart.go b/vendor/github.com/gizak/termui/linechart.go deleted file mode 100644 index f7eea28bbe45d..0000000000000 --- a/vendor/github.com/gizak/termui/linechart.go +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import ( - "fmt" - "math" -) - -// only 16 possible combinations, why bother -var braillePatterns = map[[2]int]rune{ - [2]int{0, 0}: '⣀', - [2]int{0, 1}: '⡠', - [2]int{0, 2}: '⡐', - [2]int{0, 3}: '⡈', - - [2]int{1, 0}: '⢄', - [2]int{1, 1}: '⠤', - [2]int{1, 2}: '⠔', - [2]int{1, 3}: '⠌', - - [2]int{2, 0}: '⢂', - [2]int{2, 1}: '⠢', - [2]int{2, 2}: '⠒', - [2]int{2, 3}: '⠊', - - [2]int{3, 0}: '⢁', - [2]int{3, 1}: '⠡', - [2]int{3, 2}: '⠑', - [2]int{3, 3}: '⠉', -} - -var lSingleBraille = [4]rune{'\u2840', '⠄', '⠂', '⠁'} -var rSingleBraille = [4]rune{'\u2880', '⠠', '⠐', '⠈'} - -// LineChart has two modes: braille(default) and dot. Using braille gives 2x capicity as dot mode, -// because one braille char can represent two data points. -/* - lc := termui.NewLineChart() - lc.BorderLabel = "braille-mode Line Chart" - lc.Data = [1.2, 1.3, 1.5, 1.7, 1.5, 1.6, 1.8, 2.0] - lc.Width = 50 - lc.Height = 12 - lc.AxesColor = termui.ColorWhite - lc.LineColor = termui.ColorGreen | termui.AttrBold - // termui.Render(lc)... -*/ -type LineChart struct { - Block - Data []float64 - DataLabels []string // if unset, the data indices will be used - Mode string // braille | dot - DotStyle rune - LineColor Attribute - scale float64 // data span per cell on y-axis - AxesColor Attribute - drawingX int - drawingY int - axisYHeight int - axisXWidth int - axisYLabelGap int - axisXLabelGap int - topValue float64 - bottomValue float64 - labelX [][]rune - labelY [][]rune - labelYSpace int - maxY float64 - minY float64 - autoLabels bool -} - -// NewLineChart returns a new LineChart with current theme. -func NewLineChart() *LineChart { - lc := &LineChart{Block: *NewBlock()} - lc.AxesColor = ThemeAttr("linechart.axes.fg") - lc.LineColor = ThemeAttr("linechart.line.fg") - lc.Mode = "braille" - lc.DotStyle = '•' - lc.axisXLabelGap = 2 - lc.axisYLabelGap = 1 - lc.bottomValue = math.Inf(1) - lc.topValue = math.Inf(-1) - return lc -} - -// one cell contains two data points -// so the capicity is 2x as dot-mode -func (lc *LineChart) renderBraille() Buffer { - buf := NewBuffer() - - // return: b -> which cell should the point be in - // m -> in the cell, divided into 4 equal height levels, which subcell? - getPos := func(d float64) (b, m int) { - cnt4 := int((d-lc.bottomValue)/(lc.scale/4) + 0.5) - b = cnt4 / 4 - m = cnt4 % 4 - return - } - // plot points - for i := 0; 2*i+1 < len(lc.Data) && i < lc.axisXWidth; i++ { - b0, m0 := getPos(lc.Data[2*i]) - b1, m1 := getPos(lc.Data[2*i+1]) - - if b0 == b1 { - c := Cell{ - Ch: braillePatterns[[2]int{m0, m1}], - Bg: lc.Bg, - Fg: lc.LineColor, - } - y := lc.innerArea.Min.Y + lc.innerArea.Dy() - 3 - b0 - x := lc.innerArea.Min.X + lc.labelYSpace + 1 + i - buf.Set(x, y, c) - } else { - c0 := Cell{Ch: lSingleBraille[m0], - Fg: lc.LineColor, - Bg: lc.Bg} - x0 := lc.innerArea.Min.X + lc.labelYSpace + 1 + i - y0 := lc.innerArea.Min.Y + lc.innerArea.Dy() - 3 - b0 - buf.Set(x0, y0, c0) - - c1 := Cell{Ch: rSingleBraille[m1], - Fg: lc.LineColor, - Bg: lc.Bg} - x1 := lc.innerArea.Min.X + lc.labelYSpace + 1 + i - y1 := lc.innerArea.Min.Y + lc.innerArea.Dy() - 3 - b1 - buf.Set(x1, y1, c1) - } - - } - return buf -} - -func (lc *LineChart) renderDot() Buffer { - buf := NewBuffer() - for i := 0; i < len(lc.Data) && i < lc.axisXWidth; i++ { - c := Cell{ - Ch: lc.DotStyle, - Fg: lc.LineColor, - Bg: lc.Bg, - } - x := lc.innerArea.Min.X + lc.labelYSpace + 1 + i - y := lc.innerArea.Min.Y + lc.innerArea.Dy() - 3 - int((lc.Data[i]-lc.bottomValue)/lc.scale+0.5) - buf.Set(x, y, c) - } - - return buf -} - -func (lc *LineChart) calcLabelX() { - lc.labelX = [][]rune{} - - for i, l := 0, 0; i < len(lc.DataLabels) && l < lc.axisXWidth; i++ { - if lc.Mode == "dot" { - if l >= len(lc.DataLabels) { - break - } - - s := str2runes(lc.DataLabels[l]) - w := strWidth(lc.DataLabels[l]) - if l+w <= lc.axisXWidth { - lc.labelX = append(lc.labelX, s) - } - l += w + lc.axisXLabelGap - } else { // braille - if 2*l >= len(lc.DataLabels) { - break - } - - s := str2runes(lc.DataLabels[2*l]) - w := strWidth(lc.DataLabels[2*l]) - if l+w <= lc.axisXWidth { - lc.labelX = append(lc.labelX, s) - } - l += w + lc.axisXLabelGap - - } - } -} - -func shortenFloatVal(x float64) string { - s := fmt.Sprintf("%.2f", x) - if len(s)-3 > 3 { - s = fmt.Sprintf("%.2e", x) - } - - if x < 0 { - s = fmt.Sprintf("%.2f", x) - } - return s -} - -func (lc *LineChart) calcLabelY() { - span := lc.topValue - lc.bottomValue - lc.scale = span / float64(lc.axisYHeight) - - n := (1 + lc.axisYHeight) / (lc.axisYLabelGap + 1) - lc.labelY = make([][]rune, n) - maxLen := 0 - for i := 0; i < n; i++ { - s := str2runes(shortenFloatVal(lc.bottomValue + float64(i)*span/float64(n))) - if len(s) > maxLen { - maxLen = len(s) - } - lc.labelY[i] = s - } - - lc.labelYSpace = maxLen -} - -func (lc *LineChart) calcLayout() { - // set datalabels if it is not provided - if (lc.DataLabels == nil || len(lc.DataLabels) == 0) || lc.autoLabels { - lc.autoLabels = true - lc.DataLabels = make([]string, len(lc.Data)) - for i := range lc.Data { - lc.DataLabels[i] = fmt.Sprint(i) - } - } - - // lazy increase, to avoid y shaking frequently - // update bound Y when drawing is gonna overflow - lc.minY = lc.Data[0] - lc.maxY = lc.Data[0] - - // valid visible range - vrange := lc.innerArea.Dx() - if lc.Mode == "braille" { - vrange = 2 * lc.innerArea.Dx() - } - if vrange > len(lc.Data) { - vrange = len(lc.Data) - } - - for _, v := range lc.Data[:vrange] { - if v > lc.maxY { - lc.maxY = v - } - if v < lc.minY { - lc.minY = v - } - } - - span := lc.maxY - lc.minY - - if lc.minY < lc.bottomValue { - lc.bottomValue = lc.minY - 0.2*span - } - - if lc.maxY > lc.topValue { - lc.topValue = lc.maxY + 0.2*span - } - - lc.axisYHeight = lc.innerArea.Dy() - 2 - lc.calcLabelY() - - lc.axisXWidth = lc.innerArea.Dx() - 1 - lc.labelYSpace - lc.calcLabelX() - - lc.drawingX = lc.innerArea.Min.X + 1 + lc.labelYSpace - lc.drawingY = lc.innerArea.Min.Y -} - -func (lc *LineChart) plotAxes() Buffer { - buf := NewBuffer() - - origY := lc.innerArea.Min.Y + lc.innerArea.Dy() - 2 - origX := lc.innerArea.Min.X + lc.labelYSpace - - buf.Set(origX, origY, Cell{Ch: ORIGIN, Fg: lc.AxesColor, Bg: lc.Bg}) - - for x := origX + 1; x < origX+lc.axisXWidth; x++ { - buf.Set(x, origY, Cell{Ch: HDASH, Fg: lc.AxesColor, Bg: lc.Bg}) - } - - for dy := 1; dy <= lc.axisYHeight; dy++ { - buf.Set(origX, origY-dy, Cell{Ch: VDASH, Fg: lc.AxesColor, Bg: lc.Bg}) - } - - // x label - oft := 0 - for _, rs := range lc.labelX { - if oft+len(rs) > lc.axisXWidth { - break - } - for j, r := range rs { - c := Cell{ - Ch: r, - Fg: lc.AxesColor, - Bg: lc.Bg, - } - x := origX + oft + j - y := lc.innerArea.Min.Y + lc.innerArea.Dy() - 1 - buf.Set(x, y, c) - } - oft += len(rs) + lc.axisXLabelGap - } - - // y labels - for i, rs := range lc.labelY { - for j, r := range rs { - buf.Set( - lc.innerArea.Min.X+j, - origY-i*(lc.axisYLabelGap+1), - Cell{Ch: r, Fg: lc.AxesColor, Bg: lc.Bg}) - } - } - - return buf -} - -// Buffer implements Bufferer interface. -func (lc *LineChart) Buffer() Buffer { - buf := lc.Block.Buffer() - - if lc.Data == nil || len(lc.Data) == 0 { - return buf - } - lc.calcLayout() - buf.Merge(lc.plotAxes()) - - if lc.Mode == "dot" { - buf.Merge(lc.renderDot()) - } else { - buf.Merge(lc.renderBraille()) - } - - return buf -} diff --git a/vendor/github.com/gizak/termui/linechart_others.go b/vendor/github.com/gizak/termui/linechart_others.go deleted file mode 100644 index 14897ea0f8381..0000000000000 --- a/vendor/github.com/gizak/termui/linechart_others.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -// +build !windows - -package termui - -const VDASH = '┊' -const HDASH = '┈' -const ORIGIN = '└' diff --git a/vendor/github.com/gizak/termui/linechart_windows.go b/vendor/github.com/gizak/termui/linechart_windows.go deleted file mode 100644 index 994d3e590045e..0000000000000 --- a/vendor/github.com/gizak/termui/linechart_windows.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -// +build windows - -package termui - -const VDASH = '|' -const HDASH = '-' -const ORIGIN = '+' diff --git a/vendor/github.com/gizak/termui/list.go b/vendor/github.com/gizak/termui/list.go deleted file mode 100644 index ea6635eccc00e..0000000000000 --- a/vendor/github.com/gizak/termui/list.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import "strings" - -// List displays []string as its items, -// it has a Overflow option (default is "hidden"), when set to "hidden", -// the item exceeding List's width is truncated, but when set to "wrap", -// the overflowed text breaks into next line. -/* - strs := []string{ - "[0] github.com/gizak/termui", - "[1] editbox.go", - "[2] iterrupt.go", - "[3] keyboard.go", - "[4] output.go", - "[5] random_out.go", - "[6] dashboard.go", - "[7] nsf/termbox-go"} - - ls := termui.NewList() - ls.Items = strs - ls.ItemFgColor = termui.ColorYellow - ls.BorderLabel = "List" - ls.Height = 7 - ls.Width = 25 - ls.Y = 0 -*/ -type List struct { - Block - Items []string - Overflow string - ItemFgColor Attribute - ItemBgColor Attribute -} - -// NewList returns a new *List with current theme. -func NewList() *List { - l := &List{Block: *NewBlock()} - l.Overflow = "hidden" - l.ItemFgColor = ThemeAttr("list.item.fg") - l.ItemBgColor = ThemeAttr("list.item.bg") - return l -} - -// Buffer implements Bufferer interface. -func (l *List) Buffer() Buffer { - buf := l.Block.Buffer() - - switch l.Overflow { - case "wrap": - cs := DefaultTxBuilder.Build(strings.Join(l.Items, "\n"), l.ItemFgColor, l.ItemBgColor) - i, j, k := 0, 0, 0 - for i < l.innerArea.Dy() && k < len(cs) { - w := cs[k].Width() - if cs[k].Ch == '\n' || j+w > l.innerArea.Dx() { - i++ - j = 0 - if cs[k].Ch == '\n' { - k++ - } - continue - } - buf.Set(l.innerArea.Min.X+j, l.innerArea.Min.Y+i, cs[k]) - - k++ - j++ - } - - case "hidden": - trimItems := l.Items - if len(trimItems) > l.innerArea.Dy() { - trimItems = trimItems[:l.innerArea.Dy()] - } - for i, v := range trimItems { - cs := DTrimTxCls(DefaultTxBuilder.Build(v, l.ItemFgColor, l.ItemBgColor), l.innerArea.Dx()) - j := 0 - for _, vv := range cs { - w := vv.Width() - buf.Set(l.innerArea.Min.X+j, l.innerArea.Min.Y+i, vv) - j += w - } - } - } - return buf -} diff --git a/vendor/github.com/gizak/termui/mbarchart.go b/vendor/github.com/gizak/termui/mbarchart.go deleted file mode 100644 index 0f91e9713f345..0000000000000 --- a/vendor/github.com/gizak/termui/mbarchart.go +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import ( - "fmt" -) - -// This is the implemetation of multi-colored or stacked bar graph. This is different from default barGraph which is implemented in bar.go -// Multi-Colored-BarChart creates multiple bars in a widget: -/* - bc := termui.NewMBarChart() - data := make([][]int, 2) - data[0] := []int{3, 2, 5, 7, 9, 4} - data[1] := []int{7, 8, 5, 3, 1, 6} - bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"} - bc.BorderLabel = "Bar Chart" - bc.Data = data - bc.Width = 26 - bc.Height = 10 - bc.DataLabels = bclabels - bc.TextColor = termui.ColorGreen - bc.BarColor = termui.ColorRed - bc.NumColor = termui.ColorYellow -*/ -type MBarChart struct { - Block - BarColor [NumberofColors]Attribute - TextColor Attribute - NumColor [NumberofColors]Attribute - Data [NumberofColors][]int - DataLabels []string - BarWidth int - BarGap int - labels [][]rune - dataNum [NumberofColors][][]rune - numBar int - scale float64 - max int - minDataLen int - numStack int - ShowScale bool - maxScale []rune -} - -// NewBarChart returns a new *BarChart with current theme. -func NewMBarChart() *MBarChart { - bc := &MBarChart{Block: *NewBlock()} - bc.BarColor[0] = ThemeAttr("mbarchart.bar.bg") - bc.NumColor[0] = ThemeAttr("mbarchart.num.fg") - bc.TextColor = ThemeAttr("mbarchart.text.fg") - bc.BarGap = 1 - bc.BarWidth = 3 - return bc -} - -func (bc *MBarChart) layout() { - bc.numBar = bc.innerArea.Dx() / (bc.BarGap + bc.BarWidth) - bc.labels = make([][]rune, bc.numBar) - DataLen := 0 - LabelLen := len(bc.DataLabels) - bc.minDataLen = 9999 //Set this to some very hight value so that we find the minimum one We want to know which array among data[][] has got the least length - - // We need to know how many stack/data array data[0] , data[1] are there - for i := 0; i < len(bc.Data); i++ { - if bc.Data[i] == nil { - break - } - DataLen++ - } - bc.numStack = DataLen - - //We need to know what is the mimimum size of data array data[0] could have 10 elements data[1] could have only 5, so we plot only 5 bar graphs - - for i := 0; i < DataLen; i++ { - if bc.minDataLen > len(bc.Data[i]) { - bc.minDataLen = len(bc.Data[i]) - } - } - - if LabelLen > bc.minDataLen { - LabelLen = bc.minDataLen - } - - for i := 0; i < LabelLen && i < bc.numBar; i++ { - bc.labels[i] = trimStr2Runes(bc.DataLabels[i], bc.BarWidth) - } - - for i := 0; i < bc.numStack; i++ { - bc.dataNum[i] = make([][]rune, len(bc.Data[i])) - //For each stack of bar calcualte the rune - for j := 0; j < LabelLen && i < bc.numBar; j++ { - n := bc.Data[i][j] - s := fmt.Sprint(n) - bc.dataNum[i][j] = trimStr2Runes(s, bc.BarWidth) - } - //If color is not defined by default then populate a color that is different from the prevous bar - if bc.BarColor[i] == ColorDefault && bc.NumColor[i] == ColorDefault { - if i == 0 { - bc.BarColor[i] = ColorBlack - } else { - bc.BarColor[i] = bc.BarColor[i-1] + 1 - if bc.BarColor[i] > NumberofColors { - bc.BarColor[i] = ColorBlack - } - } - bc.NumColor[i] = (NumberofColors + 1) - bc.BarColor[i] //Make NumColor opposite of barColor for visibility - } - } - - //If Max value is not set then we have to populate, this time the max value will be max(sum(d1[0],d2[0],d3[0]) .... sum(d1[n], d2[n], d3[n])) - - if bc.max == 0 { - bc.max = -1 - } - for i := 0; i < bc.minDataLen && i < LabelLen; i++ { - var dsum int - for j := 0; j < bc.numStack; j++ { - dsum += bc.Data[j][i] - } - if dsum > bc.max { - bc.max = dsum - } - } - - //Finally Calculate max sale - if bc.ShowScale { - s := fmt.Sprintf("%d", bc.max) - bc.maxScale = trimStr2Runes(s, len(s)) - bc.scale = float64(bc.max) / float64(bc.innerArea.Dy()-2) - } else { - bc.scale = float64(bc.max) / float64(bc.innerArea.Dy()-1) - } - -} - -func (bc *MBarChart) SetMax(max int) { - - if max > 0 { - bc.max = max - } -} - -// Buffer implements Bufferer interface. -func (bc *MBarChart) Buffer() Buffer { - buf := bc.Block.Buffer() - bc.layout() - var oftX int - - for i := 0; i < bc.numBar && i < bc.minDataLen && i < len(bc.DataLabels); i++ { - ph := 0 //Previous Height to stack up - oftX = i * (bc.BarWidth + bc.BarGap) - for i1 := 0; i1 < bc.numStack; i1++ { - h := int(float64(bc.Data[i1][i]) / bc.scale) - // plot bars - for j := 0; j < bc.BarWidth; j++ { - for k := 0; k < h; k++ { - c := Cell{ - Ch: ' ', - Bg: bc.BarColor[i1], - } - if bc.BarColor[i1] == ColorDefault { // when color is default, space char treated as transparent! - c.Bg |= AttrReverse - } - x := bc.innerArea.Min.X + i*(bc.BarWidth+bc.BarGap) + j - y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 2 - k - ph - buf.Set(x, y, c) - - } - } - ph += h - } - // plot text - for j, k := 0, 0; j < len(bc.labels[i]); j++ { - w := charWidth(bc.labels[i][j]) - c := Cell{ - Ch: bc.labels[i][j], - Bg: bc.Bg, - Fg: bc.TextColor, - } - y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 1 - x := bc.innerArea.Max.X + oftX + ((bc.BarWidth - len(bc.labels[i])) / 2) + k - buf.Set(x, y, c) - k += w - } - // plot num - ph = 0 //re-initialize previous height - for i1 := 0; i1 < bc.numStack; i1++ { - h := int(float64(bc.Data[i1][i]) / bc.scale) - for j := 0; j < len(bc.dataNum[i1][i]) && h > 0; j++ { - c := Cell{ - Ch: bc.dataNum[i1][i][j], - Fg: bc.NumColor[i1], - Bg: bc.BarColor[i1], - } - if bc.BarColor[i1] == ColorDefault { // the same as above - c.Bg |= AttrReverse - } - if h == 0 { - c.Bg = bc.Bg - } - x := bc.innerArea.Min.X + oftX + (bc.BarWidth-len(bc.dataNum[i1][i]))/2 + j - y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 2 - ph - buf.Set(x, y, c) - } - ph += h - } - } - - if bc.ShowScale { - //Currently bar graph only supprts data range from 0 to MAX - //Plot 0 - c := Cell{ - Ch: '0', - Bg: bc.Bg, - Fg: bc.TextColor, - } - - y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 2 - x := bc.X - buf.Set(x, y, c) - - //Plot the maximum sacle value - for i := 0; i < len(bc.maxScale); i++ { - c := Cell{ - Ch: bc.maxScale[i], - Bg: bc.Bg, - Fg: bc.TextColor, - } - - y := bc.innerArea.Min.Y - x := bc.X + i - - buf.Set(x, y, c) - } - - } - - return buf -} diff --git a/vendor/github.com/gizak/termui/mkdocs.yml b/vendor/github.com/gizak/termui/mkdocs.yml deleted file mode 100644 index 2ab45f064b151..0000000000000 --- a/vendor/github.com/gizak/termui/mkdocs.yml +++ /dev/null @@ -1,28 +0,0 @@ -pages: -- Home: 'index.md' -- Quickstart: 'quickstart.md' -- Recipes: 'recipes.md' -- References: - - Layouts: 'layouts.md' - - Components: 'components.md' - - Events: 'events.md' - - Themes: 'themes.md' -- Versions: 'versions.md' -- About: 'about.md' - -site_name: termui -repo_url: https://github.com/gizak/termui/ -site_description: 'termui user guide' -site_author: gizak - -docs_dir: '_docs' - -theme: readthedocs - -markdown_extensions: - - smarty - - admonition - - toc - -extra: - version: 1.0 diff --git a/vendor/github.com/gizak/termui/par.go b/vendor/github.com/gizak/termui/par.go deleted file mode 100644 index 29b6d462f91bc..0000000000000 --- a/vendor/github.com/gizak/termui/par.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -// Par displays a paragraph. -/* - par := termui.NewPar("Simple Text") - par.Height = 3 - par.Width = 17 - par.BorderLabel = "Label" -*/ -type Par struct { - Block - Text string - TextFgColor Attribute - TextBgColor Attribute - WrapLength int // words wrap limit. Note it may not work properly with multi-width char -} - -// NewPar returns a new *Par with given text as its content. -func NewPar(s string) *Par { - return &Par{ - Block: *NewBlock(), - Text: s, - TextFgColor: ThemeAttr("par.text.fg"), - TextBgColor: ThemeAttr("par.text.bg"), - WrapLength: 0, - } -} - -// Buffer implements Bufferer interface. -func (p *Par) Buffer() Buffer { - buf := p.Block.Buffer() - - fg, bg := p.TextFgColor, p.TextBgColor - cs := DefaultTxBuilder.Build(p.Text, fg, bg) - - // wrap if WrapLength set - if p.WrapLength < 0 { - cs = wrapTx(cs, p.Width-2) - } else if p.WrapLength > 0 { - cs = wrapTx(cs, p.WrapLength) - } - - y, x, n := 0, 0, 0 - for y < p.innerArea.Dy() && n < len(cs) { - w := cs[n].Width() - if cs[n].Ch == '\n' || x+w > p.innerArea.Dx() { - y++ - x = 0 // set x = 0 - if cs[n].Ch == '\n' { - n++ - } - - if y >= p.innerArea.Dy() { - buf.Set(p.innerArea.Min.X+p.innerArea.Dx()-1, - p.innerArea.Min.Y+p.innerArea.Dy()-1, - Cell{Ch: '…', Fg: p.TextFgColor, Bg: p.TextBgColor}) - break - } - continue - } - - buf.Set(p.innerArea.Min.X+x, p.innerArea.Min.Y+y, cs[n]) - - n++ - x += w - } - - return buf -} diff --git a/vendor/github.com/gizak/termui/pos.go b/vendor/github.com/gizak/termui/pos.go deleted file mode 100644 index c7d647f31b787..0000000000000 --- a/vendor/github.com/gizak/termui/pos.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import "image" - -// Align is the position of the gauge's label. -type Align uint - -// All supported positions. -const ( - AlignNone Align = 0 - AlignLeft Align = 1 << iota - AlignRight - AlignBottom - AlignTop - AlignCenterVertical - AlignCenterHorizontal - AlignCenter = AlignCenterVertical | AlignCenterHorizontal -) - -func AlignArea(parent, child image.Rectangle, a Align) image.Rectangle { - w, h := child.Dx(), child.Dy() - - // parent center - pcx, pcy := parent.Min.X+parent.Dx()/2, parent.Min.Y+parent.Dy()/2 - // child center - ccx, ccy := child.Min.X+child.Dx()/2, child.Min.Y+child.Dy()/2 - - if a&AlignLeft == AlignLeft { - child.Min.X = parent.Min.X - child.Max.X = child.Min.X + w - } - - if a&AlignRight == AlignRight { - child.Max.X = parent.Max.X - child.Min.X = child.Max.X - w - } - - if a&AlignBottom == AlignBottom { - child.Max.Y = parent.Max.Y - child.Min.Y = child.Max.Y - h - } - - if a&AlignTop == AlignRight { - child.Min.Y = parent.Min.Y - child.Max.Y = child.Min.Y + h - } - - if a&AlignCenterHorizontal == AlignCenterHorizontal { - child.Min.X += pcx - ccx - child.Max.X = child.Min.X + w - } - - if a&AlignCenterVertical == AlignCenterVertical { - child.Min.Y += pcy - ccy - child.Max.Y = child.Min.Y + h - } - - return child -} - -func MoveArea(a image.Rectangle, dx, dy int) image.Rectangle { - a.Min.X += dx - a.Max.X += dx - a.Min.Y += dy - a.Max.Y += dy - return a -} - -var termWidth int -var termHeight int - -func TermRect() image.Rectangle { - return image.Rect(0, 0, termWidth, termHeight) -} diff --git a/vendor/github.com/gizak/termui/render.go b/vendor/github.com/gizak/termui/render.go deleted file mode 100644 index b9d37d93867fc..0000000000000 --- a/vendor/github.com/gizak/termui/render.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import ( - "image" - "io" - "sync" - "time" - - "fmt" - - "os" - - "runtime/debug" - - "bytes" - - "github.com/maruel/panicparse/stack" - tm "github.com/nsf/termbox-go" -) - -// Bufferer should be implemented by all renderable components. -type Bufferer interface { - Buffer() Buffer -} - -// Init initializes termui library. This function should be called before any others. -// After initialization, the library must be finalized by 'Close' function. -func Init() error { - if err := tm.Init(); err != nil { - return err - } - - sysEvtChs = make([]chan Event, 0) - go hookTermboxEvt() - - renderJobs = make(chan []Bufferer) - //renderLock = new(sync.RWMutex) - - Body = NewGrid() - Body.X = 0 - Body.Y = 0 - Body.BgColor = ThemeAttr("bg") - Body.Width = TermWidth() - - DefaultEvtStream.Init() - DefaultEvtStream.Merge("termbox", NewSysEvtCh()) - DefaultEvtStream.Merge("timer", NewTimerCh(time.Second)) - DefaultEvtStream.Merge("custom", usrEvtCh) - - DefaultEvtStream.Handle("/", DefaultHandler) - DefaultEvtStream.Handle("/sys/wnd/resize", func(e Event) { - w := e.Data.(EvtWnd) - Body.Width = w.Width - }) - - DefaultWgtMgr = NewWgtMgr() - DefaultEvtStream.Hook(DefaultWgtMgr.WgtHandlersHook()) - - go func() { - for bs := range renderJobs { - render(bs...) - } - }() - - return nil -} - -// Close finalizes termui library, -// should be called after successful initialization when termui's functionality isn't required anymore. -func Close() { - tm.Close() -} - -var renderLock sync.Mutex - -func termSync() { - renderLock.Lock() - tm.Sync() - termWidth, termHeight = tm.Size() - renderLock.Unlock() -} - -// TermWidth returns the current terminal's width. -func TermWidth() int { - termSync() - return termWidth -} - -// TermHeight returns the current terminal's height. -func TermHeight() int { - termSync() - return termHeight -} - -// Render renders all Bufferer in the given order from left to right, -// right could overlap on left ones. -func render(bs ...Bufferer) { - defer func() { - if e := recover(); e != nil { - Close() - fmt.Fprintf(os.Stderr, "Captured a panic(value=%v) when rendering Bufferer. Exit termui and clean terminal...\nPrint stack trace:\n\n", e) - //debug.PrintStack() - gs, err := stack.ParseDump(bytes.NewReader(debug.Stack()), os.Stderr) - if err != nil { - debug.PrintStack() - os.Exit(1) - } - p := &stack.Palette{} - buckets := stack.SortBuckets(stack.Bucketize(gs, stack.AnyValue)) - srcLen, pkgLen := stack.CalcLengths(buckets, false) - for _, bucket := range buckets { - io.WriteString(os.Stdout, p.BucketHeader(&bucket, false, len(buckets) > 1)) - io.WriteString(os.Stdout, p.StackLines(&bucket.Signature, srcLen, pkgLen, false)) - } - os.Exit(1) - } - }() - for _, b := range bs { - - buf := b.Buffer() - // set cels in buf - for p, c := range buf.CellMap { - if p.In(buf.Area) { - - tm.SetCell(p.X, p.Y, c.Ch, toTmAttr(c.Fg), toTmAttr(c.Bg)) - - } - } - - } - - renderLock.Lock() - // render - tm.Flush() - renderLock.Unlock() -} - -func Clear() { - tm.Clear(tm.ColorDefault, toTmAttr(ThemeAttr("bg"))) -} - -func clearArea(r image.Rectangle, bg Attribute) { - for i := r.Min.X; i < r.Max.X; i++ { - for j := r.Min.Y; j < r.Max.Y; j++ { - tm.SetCell(i, j, ' ', tm.ColorDefault, toTmAttr(bg)) - } - } -} - -func ClearArea(r image.Rectangle, bg Attribute) { - clearArea(r, bg) - tm.Flush() -} - -var renderJobs chan []Bufferer - -func Render(bs ...Bufferer) { - //go func() { renderJobs <- bs }() - renderJobs <- bs -} diff --git a/vendor/github.com/gizak/termui/sparkline.go b/vendor/github.com/gizak/termui/sparkline.go deleted file mode 100644 index d906e49dfca2b..0000000000000 --- a/vendor/github.com/gizak/termui/sparkline.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -// Sparkline is like: ▅▆▂▂▅▇▂▂▃▆▆▆▅▃. The data points should be non-negative integers. -/* - data := []int{4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1} - spl := termui.NewSparkline() - spl.Data = data - spl.Title = "Sparkline 0" - spl.LineColor = termui.ColorGreen -*/ -type Sparkline struct { - Data []int - Height int - Title string - TitleColor Attribute - LineColor Attribute - displayHeight int - scale float32 - max int -} - -// Sparklines is a renderable widget which groups together the given sparklines. -/* - spls := termui.NewSparklines(spl0,spl1,spl2) //... - spls.Height = 2 - spls.Width = 20 -*/ -type Sparklines struct { - Block - Lines []Sparkline - displayLines int - displayWidth int -} - -var sparks = []rune{'▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'} - -// Add appends a given Sparkline to s *Sparklines. -func (s *Sparklines) Add(sl Sparkline) { - s.Lines = append(s.Lines, sl) -} - -// NewSparkline returns a unrenderable single sparkline that intended to be added into Sparklines. -func NewSparkline() Sparkline { - return Sparkline{ - Height: 1, - TitleColor: ThemeAttr("sparkline.title.fg"), - LineColor: ThemeAttr("sparkline.line.fg")} -} - -// NewSparklines return a new *Spaklines with given Sparkline(s), you can always add a new Sparkline later. -func NewSparklines(ss ...Sparkline) *Sparklines { - s := &Sparklines{Block: *NewBlock(), Lines: ss} - return s -} - -func (sl *Sparklines) update() { - for i, v := range sl.Lines { - if v.Title == "" { - sl.Lines[i].displayHeight = v.Height - } else { - sl.Lines[i].displayHeight = v.Height + 1 - } - } - sl.displayWidth = sl.innerArea.Dx() - - // get how many lines gotta display - h := 0 - sl.displayLines = 0 - for _, v := range sl.Lines { - if h+v.displayHeight <= sl.innerArea.Dy() { - sl.displayLines++ - } else { - break - } - h += v.displayHeight - } - - for i := 0; i < sl.displayLines; i++ { - data := sl.Lines[i].Data - - max := 0 - for _, v := range data { - if max < v { - max = v - } - } - sl.Lines[i].max = max - if max != 0 { - sl.Lines[i].scale = float32(8*sl.Lines[i].Height) / float32(max) - } else { // when all negative - sl.Lines[i].scale = 0 - } - } -} - -// Buffer implements Bufferer interface. -func (sl *Sparklines) Buffer() Buffer { - buf := sl.Block.Buffer() - sl.update() - - oftY := 0 - for i := 0; i < sl.displayLines; i++ { - l := sl.Lines[i] - data := l.Data - - if len(data) > sl.innerArea.Dx() { - data = data[len(data)-sl.innerArea.Dx():] - } - - if l.Title != "" { - rs := trimStr2Runes(l.Title, sl.innerArea.Dx()) - oftX := 0 - for _, v := range rs { - w := charWidth(v) - c := Cell{ - Ch: v, - Fg: l.TitleColor, - Bg: sl.Bg, - } - x := sl.innerArea.Min.X + oftX - y := sl.innerArea.Min.Y + oftY - buf.Set(x, y, c) - oftX += w - } - } - - for j, v := range data { - // display height of the data point, zero when data is negative - h := int(float32(v)*l.scale + 0.5) - if v < 0 { - h = 0 - } - - barCnt := h / 8 - barMod := h % 8 - for jj := 0; jj < barCnt; jj++ { - c := Cell{ - Ch: ' ', // => sparks[7] - Bg: l.LineColor, - } - x := sl.innerArea.Min.X + j - y := sl.innerArea.Min.Y + oftY + l.Height - jj - - //p.Bg = sl.BgColor - buf.Set(x, y, c) - } - if barMod != 0 { - c := Cell{ - Ch: sparks[barMod-1], - Fg: l.LineColor, - Bg: sl.Bg, - } - x := sl.innerArea.Min.X + j - y := sl.innerArea.Min.Y + oftY + l.Height - barCnt - buf.Set(x, y, c) - } - } - - oftY += l.displayHeight - } - - return buf -} diff --git a/vendor/github.com/gizak/termui/table.go b/vendor/github.com/gizak/termui/table.go deleted file mode 100644 index e3d1bbf309a2a..0000000000000 --- a/vendor/github.com/gizak/termui/table.go +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import "strings" - -/* Table is like: - -┌Awesome Table ────────────────────────────────────────────────┐ -│ Col0 | Col1 | Col2 | Col3 | Col4 | Col5 | Col6 | -│──────────────────────────────────────────────────────────────│ -│ Some Item #1 | AAA | 123 | CCCCC | EEEEE | GGGGG | IIIII | -│──────────────────────────────────────────────────────────────│ -│ Some Item #2 | BBB | 456 | DDDDD | FFFFF | HHHHH | JJJJJ | -└──────────────────────────────────────────────────────────────┘ - -Datapoints are a two dimensional array of strings: [][]string - -Example: - data := [][]string{ - {"Col0", "Col1", "Col3", "Col4", "Col5", "Col6"}, - {"Some Item #1", "AAA", "123", "CCCCC", "EEEEE", "GGGGG", "IIIII"}, - {"Some Item #2", "BBB", "456", "DDDDD", "FFFFF", "HHHHH", "JJJJJ"}, - } - - table := termui.NewTable() - table.Rows = data // type [][]string - table.FgColor = termui.ColorWhite - table.BgColor = termui.ColorDefault - table.Height = 7 - table.Width = 62 - table.Y = 0 - table.X = 0 - table.Border = true -*/ - -// Table tracks all the attributes of a Table instance -type Table struct { - Block - Rows [][]string - CellWidth []int - FgColor Attribute - BgColor Attribute - FgColors []Attribute - BgColors []Attribute - Separator bool - TextAlign Align -} - -// NewTable returns a new Table instance -func NewTable() *Table { - table := &Table{Block: *NewBlock()} - table.FgColor = ColorWhite - table.BgColor = ColorDefault - table.Separator = true - return table -} - -// CellsWidth calculates the width of a cell array and returns an int -func cellsWidth(cells []Cell) int { - width := 0 - for _, c := range cells { - width += c.Width() - } - return width -} - -// Analysis generates and returns an array of []Cell that represent all columns in the Table -func (table *Table) Analysis() [][]Cell { - var rowCells [][]Cell - length := len(table.Rows) - if length < 1 { - return rowCells - } - - if len(table.FgColors) == 0 { - table.FgColors = make([]Attribute, len(table.Rows)) - } - if len(table.BgColors) == 0 { - table.BgColors = make([]Attribute, len(table.Rows)) - } - - cellWidths := make([]int, len(table.Rows[0])) - - for y, row := range table.Rows { - if table.FgColors[y] == 0 { - table.FgColors[y] = table.FgColor - } - if table.BgColors[y] == 0 { - table.BgColors[y] = table.BgColor - } - for x, str := range row { - cells := DefaultTxBuilder.Build(str, table.FgColors[y], table.BgColors[y]) - cw := cellsWidth(cells) - if cellWidths[x] < cw { - cellWidths[x] = cw - } - rowCells = append(rowCells, cells) - } - } - table.CellWidth = cellWidths - return rowCells -} - -// SetSize calculates the table size and sets the internal value -func (table *Table) SetSize() { - length := len(table.Rows) - if table.Separator { - table.Height = length*2 + 1 - } else { - table.Height = length + 2 - } - table.Width = 2 - if length != 0 { - for _, cellWidth := range table.CellWidth { - table.Width += cellWidth + 3 - } - } -} - -// CalculatePosition ... -func (table *Table) CalculatePosition(x int, y int, coordinateX *int, coordinateY *int, cellStart *int) { - if table.Separator { - *coordinateY = table.innerArea.Min.Y + y*2 - } else { - *coordinateY = table.innerArea.Min.Y + y - } - if x == 0 { - *cellStart = table.innerArea.Min.X - } else { - *cellStart += table.CellWidth[x-1] + 3 - } - - switch table.TextAlign { - case AlignRight: - *coordinateX = *cellStart + (table.CellWidth[x] - len(table.Rows[y][x])) + 2 - case AlignCenter: - *coordinateX = *cellStart + (table.CellWidth[x]-len(table.Rows[y][x]))/2 + 2 - default: - *coordinateX = *cellStart + 2 - } -} - -// Buffer ... -func (table *Table) Buffer() Buffer { - buffer := table.Block.Buffer() - rowCells := table.Analysis() - pointerX := table.innerArea.Min.X + 2 - pointerY := table.innerArea.Min.Y - borderPointerX := table.innerArea.Min.X - for y, row := range table.Rows { - for x := range row { - table.CalculatePosition(x, y, &pointerX, &pointerY, &borderPointerX) - background := DefaultTxBuilder.Build(strings.Repeat(" ", table.CellWidth[x]+3), table.BgColors[y], table.BgColors[y]) - cells := rowCells[y*len(row)+x] - for i, back := range background { - buffer.Set(borderPointerX+i, pointerY, back) - } - - coordinateX := pointerX - for _, printer := range cells { - buffer.Set(coordinateX, pointerY, printer) - coordinateX += printer.Width() - } - - if x != 0 { - dividors := DefaultTxBuilder.Build("|", table.FgColors[y], table.BgColors[y]) - for _, dividor := range dividors { - buffer.Set(borderPointerX, pointerY, dividor) - } - } - } - - if table.Separator { - border := DefaultTxBuilder.Build(strings.Repeat("─", table.Width-2), table.FgColor, table.BgColor) - for i, cell := range border { - buffer.Set(i+1, pointerY+1, cell) - } - } - } - - return buffer -} diff --git a/vendor/github.com/gizak/termui/textbuilder.go b/vendor/github.com/gizak/termui/textbuilder.go deleted file mode 100644 index 12e2055b5095f..0000000000000 --- a/vendor/github.com/gizak/termui/textbuilder.go +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import ( - "regexp" - "strings" - - "github.com/mitchellh/go-wordwrap" -) - -// TextBuilder is a minimal interface to produce text []Cell using specific syntax (markdown). -type TextBuilder interface { - Build(s string, fg, bg Attribute) []Cell -} - -// DefaultTxBuilder is set to be MarkdownTxBuilder. -var DefaultTxBuilder = NewMarkdownTxBuilder() - -// MarkdownTxBuilder implements TextBuilder interface, using markdown syntax. -type MarkdownTxBuilder struct { - baseFg Attribute - baseBg Attribute - plainTx []rune - markers []marker -} - -type marker struct { - st int - ed int - fg Attribute - bg Attribute -} - -var colorMap = map[string]Attribute{ - "red": ColorRed, - "blue": ColorBlue, - "black": ColorBlack, - "cyan": ColorCyan, - "yellow": ColorYellow, - "white": ColorWhite, - "default": ColorDefault, - "green": ColorGreen, - "magenta": ColorMagenta, -} - -var attrMap = map[string]Attribute{ - "bold": AttrBold, - "underline": AttrUnderline, - "reverse": AttrReverse, -} - -func rmSpc(s string) string { - reg := regexp.MustCompile(`\s+`) - return reg.ReplaceAllString(s, "") -} - -// readAttr translates strings like `fg-red,fg-bold,bg-white` to fg and bg Attribute -func (mtb MarkdownTxBuilder) readAttr(s string) (Attribute, Attribute) { - fg := mtb.baseFg - bg := mtb.baseBg - - updateAttr := func(a Attribute, attrs []string) Attribute { - for _, s := range attrs { - // replace the color - if c, ok := colorMap[s]; ok { - a &= 0xFF00 // erase clr 0 ~ 8 bits - a |= c // set clr - } - // add attrs - if c, ok := attrMap[s]; ok { - a |= c - } - } - return a - } - - ss := strings.Split(s, ",") - fgs := []string{} - bgs := []string{} - for _, v := range ss { - subs := strings.Split(v, "-") - if len(subs) > 1 { - if subs[0] == "fg" { - fgs = append(fgs, subs[1]) - } - if subs[0] == "bg" { - bgs = append(bgs, subs[1]) - } - } - } - - fg = updateAttr(fg, fgs) - bg = updateAttr(bg, bgs) - return fg, bg -} - -func (mtb *MarkdownTxBuilder) reset() { - mtb.plainTx = []rune{} - mtb.markers = []marker{} -} - -// parse streams and parses text into normalized text and render sequence. -func (mtb *MarkdownTxBuilder) parse(str string) { - rs := str2runes(str) - normTx := []rune{} - square := []rune{} - brackt := []rune{} - accSquare := false - accBrackt := false - cntSquare := 0 - - reset := func() { - square = []rune{} - brackt = []rune{} - accSquare = false - accBrackt = false - cntSquare = 0 - } - // pipe stacks into normTx and clear - rollback := func() { - normTx = append(normTx, square...) - normTx = append(normTx, brackt...) - reset() - } - // chop first and last - chop := func(s []rune) []rune { - return s[1 : len(s)-1] - } - - for i, r := range rs { - switch { - // stacking brackt - case accBrackt: - brackt = append(brackt, r) - if ')' == r { - fg, bg := mtb.readAttr(string(chop(brackt))) - st := len(normTx) - ed := len(normTx) + len(square) - 2 - mtb.markers = append(mtb.markers, marker{st, ed, fg, bg}) - normTx = append(normTx, chop(square)...) - reset() - } else if i+1 == len(rs) { - rollback() - } - // stacking square - case accSquare: - switch { - // squares closed and followed by a '(' - case cntSquare == 0 && '(' == r: - accBrackt = true - brackt = append(brackt, '(') - // squares closed but not followed by a '(' - case cntSquare == 0: - rollback() - if '[' == r { - accSquare = true - cntSquare = 1 - brackt = append(brackt, '[') - } else { - normTx = append(normTx, r) - } - // hit the end - case i+1 == len(rs): - square = append(square, r) - rollback() - case '[' == r: - cntSquare++ - square = append(square, '[') - case ']' == r: - cntSquare-- - square = append(square, ']') - // normal char - default: - square = append(square, r) - } - // stacking normTx - default: - if '[' == r { - accSquare = true - cntSquare = 1 - square = append(square, '[') - } else { - normTx = append(normTx, r) - } - } - } - - mtb.plainTx = normTx -} - -func wrapTx(cs []Cell, wl int) []Cell { - tmpCell := make([]Cell, len(cs)) - copy(tmpCell, cs) - - // get the plaintext - plain := CellsToStr(cs) - - // wrap - plainWrapped := wordwrap.WrapString(plain, uint(wl)) - - // find differences and insert - finalCell := tmpCell // finalcell will get the inserts and is what is returned - - plainRune := []rune(plain) - plainWrappedRune := []rune(plainWrapped) - trigger := "go" - plainRuneNew := plainRune - - for trigger != "stop" { - plainRune = plainRuneNew - for i := range plainRune { - if plainRune[i] == plainWrappedRune[i] { - trigger = "stop" - } else if plainRune[i] != plainWrappedRune[i] && plainWrappedRune[i] == 10 { - trigger = "go" - cell := Cell{10, 0, 0} - j := i - 0 - - // insert a cell into the []Cell in correct position - tmpCell[i] = cell - - // insert the newline into plain so we avoid indexing errors - plainRuneNew = append(plainRune, 10) - copy(plainRuneNew[j+1:], plainRuneNew[j:]) - plainRuneNew[j] = plainWrappedRune[j] - - // restart the inner for loop until plain and plain wrapped are - // the same; yeah, it's inefficient, but the text amounts - // should be small - break - - } else if plainRune[i] != plainWrappedRune[i] && - plainWrappedRune[i-1] == 10 && // if the prior rune is a newline - plainRune[i] == 32 { // and this rune is a space - trigger = "go" - // need to delete plainRune[i] because it gets rid of an extra - // space - plainRuneNew = append(plainRune[:i], plainRune[i+1:]...) - break - - } else { - trigger = "stop" // stops the outer for loop - } - } - } - - finalCell = tmpCell - - return finalCell -} - -// Build implements TextBuilder interface. -func (mtb MarkdownTxBuilder) Build(s string, fg, bg Attribute) []Cell { - mtb.baseFg = fg - mtb.baseBg = bg - mtb.reset() - mtb.parse(s) - cs := make([]Cell, len(mtb.plainTx)) - for i := range cs { - cs[i] = Cell{Ch: mtb.plainTx[i], Fg: fg, Bg: bg} - } - for _, mrk := range mtb.markers { - for i := mrk.st; i < mrk.ed; i++ { - cs[i].Fg = mrk.fg - cs[i].Bg = mrk.bg - } - } - - return cs -} - -// NewMarkdownTxBuilder returns a TextBuilder employing markdown syntax. -func NewMarkdownTxBuilder() TextBuilder { - return MarkdownTxBuilder{} -} diff --git a/vendor/github.com/gizak/termui/theme.go b/vendor/github.com/gizak/termui/theme.go deleted file mode 100644 index 21fb3bfb751a4..0000000000000 --- a/vendor/github.com/gizak/termui/theme.go +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import "strings" - -/* -// A ColorScheme represents the current look-and-feel of the dashboard. -type ColorScheme struct { - BodyBg Attribute - BlockBg Attribute - HasBorder bool - BorderFg Attribute - BorderBg Attribute - BorderLabelTextFg Attribute - BorderLabelTextBg Attribute - ParTextFg Attribute - ParTextBg Attribute - SparklineLine Attribute - SparklineTitle Attribute - GaugeBar Attribute - GaugePercent Attribute - LineChartLine Attribute - LineChartAxes Attribute - ListItemFg Attribute - ListItemBg Attribute - BarChartBar Attribute - BarChartText Attribute - BarChartNum Attribute - MBarChartBar Attribute - MBarChartText Attribute - MBarChartNum Attribute - TabActiveBg Attribute -} - -// default color scheme depends on the user's terminal setting. -var themeDefault = ColorScheme{HasBorder: true} - -var themeHelloWorld = ColorScheme{ - BodyBg: ColorBlack, - BlockBg: ColorBlack, - HasBorder: true, - BorderFg: ColorWhite, - BorderBg: ColorBlack, - BorderLabelTextBg: ColorBlack, - BorderLabelTextFg: ColorGreen, - ParTextBg: ColorBlack, - ParTextFg: ColorWhite, - SparklineLine: ColorMagenta, - SparklineTitle: ColorWhite, - GaugeBar: ColorRed, - GaugePercent: ColorWhite, - LineChartLine: ColorYellow | AttrBold, - LineChartAxes: ColorWhite, - ListItemBg: ColorBlack, - ListItemFg: ColorYellow, - BarChartBar: ColorRed, - BarChartNum: ColorWhite, - BarChartText: ColorCyan, - MBarChartBar: ColorRed, - MBarChartNum: ColorWhite, - MBarChartText: ColorCyan, - TabActiveBg: ColorMagenta, -} - -var theme = themeDefault // global dep - -// Theme returns the currently used theme. -func Theme() ColorScheme { - return theme -} - -// SetTheme sets a new, custom theme. -func SetTheme(newTheme ColorScheme) { - theme = newTheme -} - -// UseTheme sets a predefined scheme. Currently available: "hello-world" and -// "black-and-white". -func UseTheme(th string) { - switch th { - case "helloworld": - theme = themeHelloWorld - default: - theme = themeDefault - } -} -*/ - -var ColorMap = map[string]Attribute{ - "fg": ColorWhite, - "bg": ColorDefault, - "border.fg": ColorWhite, - "label.fg": ColorGreen, - "par.fg": ColorYellow, - "par.label.bg": ColorWhite, -} - -func ThemeAttr(name string) Attribute { - return lookUpAttr(ColorMap, name) -} - -func lookUpAttr(clrmap map[string]Attribute, name string) Attribute { - - a, ok := clrmap[name] - if ok { - return a - } - - ns := strings.Split(name, ".") - for i := range ns { - nn := strings.Join(ns[i:len(ns)], ".") - a, ok = ColorMap[nn] - if ok { - break - } - } - - return a -} - -// 0<=r,g,b <= 5 -func ColorRGB(r, g, b int) Attribute { - within := func(n int) int { - if n < 0 { - return 0 - } - - if n > 5 { - return 5 - } - - return n - } - - r, b, g = within(r), within(b), within(g) - return Attribute(0x0f + 36*r + 6*g + b) -} diff --git a/vendor/github.com/gizak/termui/widget.go b/vendor/github.com/gizak/termui/widget.go deleted file mode 100644 index 80276bf1f1816..0000000000000 --- a/vendor/github.com/gizak/termui/widget.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2017 Zack Guo . All rights reserved. -// Use of this source code is governed by a MIT license that can -// be found in the LICENSE file. - -package termui - -import ( - "fmt" - "sync" -) - -// event mixins -type WgtMgr map[string]WgtInfo - -type WgtInfo struct { - Handlers map[string]func(Event) - WgtRef Widget - Id string -} - -type Widget interface { - Id() string -} - -func NewWgtInfo(wgt Widget) WgtInfo { - return WgtInfo{ - Handlers: make(map[string]func(Event)), - WgtRef: wgt, - Id: wgt.Id(), - } -} - -func NewWgtMgr() WgtMgr { - wm := WgtMgr(make(map[string]WgtInfo)) - return wm - -} - -func (wm WgtMgr) AddWgt(wgt Widget) { - wm[wgt.Id()] = NewWgtInfo(wgt) -} - -func (wm WgtMgr) RmWgt(wgt Widget) { - wm.RmWgtById(wgt.Id()) -} - -func (wm WgtMgr) RmWgtById(id string) { - delete(wm, id) -} - -func (wm WgtMgr) AddWgtHandler(id, path string, h func(Event)) { - if w, ok := wm[id]; ok { - w.Handlers[path] = h - } -} - -func (wm WgtMgr) RmWgtHandler(id, path string) { - if w, ok := wm[id]; ok { - delete(w.Handlers, path) - } -} - -var counter struct { - sync.RWMutex - count int -} - -func GenId() string { - counter.Lock() - defer counter.Unlock() - - counter.count += 1 - return fmt.Sprintf("%d", counter.count) -} - -func (wm WgtMgr) WgtHandlersHook() func(Event) { - return func(e Event) { - for _, v := range wm { - if k := findMatch(v.Handlers, e.Path); k != "" { - v.Handlers[k](e) - } - } - } -} - -var DefaultWgtMgr WgtMgr - -func (b *Block) Handle(path string, handler func(Event)) { - if _, ok := DefaultWgtMgr[b.Id()]; !ok { - DefaultWgtMgr.AddWgt(b) - } - - DefaultWgtMgr.AddWgtHandler(b.Id(), path, handler) -} diff --git a/vendor/github.com/influxdata/influxdb/client/v2/client.go b/vendor/github.com/influxdata/influxdb/client/v2/client.go deleted file mode 100644 index 77d44f2b34fbc..0000000000000 --- a/vendor/github.com/influxdata/influxdb/client/v2/client.go +++ /dev/null @@ -1,635 +0,0 @@ -// Package client (v2) is the current official Go client for InfluxDB. -package client // import "github.com/influxdata/influxdb/client/v2" - -import ( - "bytes" - "crypto/tls" - "encoding/json" - "errors" - "fmt" - "io" - "io/ioutil" - "mime" - "net/http" - "net/url" - "strconv" - "strings" - "time" - - "github.com/influxdata/influxdb/models" -) - -// HTTPConfig is the config data needed to create an HTTP Client. -type HTTPConfig struct { - // Addr should be of the form "http://host:port" - // or "http://[ipv6-host%zone]:port". - Addr string - - // Username is the influxdb username, optional. - Username string - - // Password is the influxdb password, optional. - Password string - - // UserAgent is the http User Agent, defaults to "InfluxDBClient". - UserAgent string - - // Timeout for influxdb writes, defaults to no timeout. - Timeout time.Duration - - // InsecureSkipVerify gets passed to the http client, if true, it will - // skip https certificate verification. Defaults to false. - InsecureSkipVerify bool - - // TLSConfig allows the user to set their own TLS config for the HTTP - // Client. If set, this option overrides InsecureSkipVerify. - TLSConfig *tls.Config -} - -// BatchPointsConfig is the config data needed to create an instance of the BatchPoints struct. -type BatchPointsConfig struct { - // Precision is the write precision of the points, defaults to "ns". - Precision string - - // Database is the database to write points to. - Database string - - // RetentionPolicy is the retention policy of the points. - RetentionPolicy string - - // Write consistency is the number of servers required to confirm write. - WriteConsistency string -} - -// Client is a client interface for writing & querying the database. -type Client interface { - // Ping checks that status of cluster, and will always return 0 time and no - // error for UDP clients. - Ping(timeout time.Duration) (time.Duration, string, error) - - // Write takes a BatchPoints object and writes all Points to InfluxDB. - Write(bp BatchPoints) error - - // Query makes an InfluxDB Query on the database. This will fail if using - // the UDP client. - Query(q Query) (*Response, error) - - // Close releases any resources a Client may be using. - Close() error -} - -// NewHTTPClient returns a new Client from the provided config. -// Client is safe for concurrent use by multiple goroutines. -func NewHTTPClient(conf HTTPConfig) (Client, error) { - if conf.UserAgent == "" { - conf.UserAgent = "InfluxDBClient" - } - - u, err := url.Parse(conf.Addr) - if err != nil { - return nil, err - } else if u.Scheme != "http" && u.Scheme != "https" { - m := fmt.Sprintf("Unsupported protocol scheme: %s, your address"+ - " must start with http:// or https://", u.Scheme) - return nil, errors.New(m) - } - - tr := &http.Transport{ - TLSClientConfig: &tls.Config{ - InsecureSkipVerify: conf.InsecureSkipVerify, - }, - } - if conf.TLSConfig != nil { - tr.TLSClientConfig = conf.TLSConfig - } - return &client{ - url: *u, - username: conf.Username, - password: conf.Password, - useragent: conf.UserAgent, - httpClient: &http.Client{ - Timeout: conf.Timeout, - Transport: tr, - }, - transport: tr, - }, nil -} - -// Ping will check to see if the server is up with an optional timeout on waiting for leader. -// Ping returns how long the request took, the version of the server it connected to, and an error if one occurred. -func (c *client) Ping(timeout time.Duration) (time.Duration, string, error) { - now := time.Now() - u := c.url - u.Path = "ping" - - req, err := http.NewRequest("GET", u.String(), nil) - if err != nil { - return 0, "", err - } - - req.Header.Set("User-Agent", c.useragent) - - if c.username != "" { - req.SetBasicAuth(c.username, c.password) - } - - if timeout > 0 { - params := req.URL.Query() - params.Set("wait_for_leader", fmt.Sprintf("%.0fs", timeout.Seconds())) - req.URL.RawQuery = params.Encode() - } - - resp, err := c.httpClient.Do(req) - if err != nil { - return 0, "", err - } - defer resp.Body.Close() - - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return 0, "", err - } - - if resp.StatusCode != http.StatusNoContent { - var err = fmt.Errorf(string(body)) - return 0, "", err - } - - version := resp.Header.Get("X-Influxdb-Version") - return time.Since(now), version, nil -} - -// Close releases the client's resources. -func (c *client) Close() error { - c.transport.CloseIdleConnections() - return nil -} - -// client is safe for concurrent use as the fields are all read-only -// once the client is instantiated. -type client struct { - // N.B - if url.UserInfo is accessed in future modifications to the - // methods on client, you will need to syncronise access to url. - url url.URL - username string - password string - useragent string - httpClient *http.Client - transport *http.Transport -} - -// BatchPoints is an interface into a batched grouping of points to write into -// InfluxDB together. BatchPoints is NOT thread-safe, you must create a separate -// batch for each goroutine. -type BatchPoints interface { - // AddPoint adds the given point to the Batch of points. - AddPoint(p *Point) - // AddPoints adds the given points to the Batch of points. - AddPoints(ps []*Point) - // Points lists the points in the Batch. - Points() []*Point - - // Precision returns the currently set precision of this Batch. - Precision() string - // SetPrecision sets the precision of this batch. - SetPrecision(s string) error - - // Database returns the currently set database of this Batch. - Database() string - // SetDatabase sets the database of this Batch. - SetDatabase(s string) - - // WriteConsistency returns the currently set write consistency of this Batch. - WriteConsistency() string - // SetWriteConsistency sets the write consistency of this Batch. - SetWriteConsistency(s string) - - // RetentionPolicy returns the currently set retention policy of this Batch. - RetentionPolicy() string - // SetRetentionPolicy sets the retention policy of this Batch. - SetRetentionPolicy(s string) -} - -// NewBatchPoints returns a BatchPoints interface based on the given config. -func NewBatchPoints(conf BatchPointsConfig) (BatchPoints, error) { - if conf.Precision == "" { - conf.Precision = "ns" - } - if _, err := time.ParseDuration("1" + conf.Precision); err != nil { - return nil, err - } - bp := &batchpoints{ - database: conf.Database, - precision: conf.Precision, - retentionPolicy: conf.RetentionPolicy, - writeConsistency: conf.WriteConsistency, - } - return bp, nil -} - -type batchpoints struct { - points []*Point - database string - precision string - retentionPolicy string - writeConsistency string -} - -func (bp *batchpoints) AddPoint(p *Point) { - bp.points = append(bp.points, p) -} - -func (bp *batchpoints) AddPoints(ps []*Point) { - bp.points = append(bp.points, ps...) -} - -func (bp *batchpoints) Points() []*Point { - return bp.points -} - -func (bp *batchpoints) Precision() string { - return bp.precision -} - -func (bp *batchpoints) Database() string { - return bp.database -} - -func (bp *batchpoints) WriteConsistency() string { - return bp.writeConsistency -} - -func (bp *batchpoints) RetentionPolicy() string { - return bp.retentionPolicy -} - -func (bp *batchpoints) SetPrecision(p string) error { - if _, err := time.ParseDuration("1" + p); err != nil { - return err - } - bp.precision = p - return nil -} - -func (bp *batchpoints) SetDatabase(db string) { - bp.database = db -} - -func (bp *batchpoints) SetWriteConsistency(wc string) { - bp.writeConsistency = wc -} - -func (bp *batchpoints) SetRetentionPolicy(rp string) { - bp.retentionPolicy = rp -} - -// Point represents a single data point. -type Point struct { - pt models.Point -} - -// NewPoint returns a point with the given timestamp. If a timestamp is not -// given, then data is sent to the database without a timestamp, in which case -// the server will assign local time upon reception. NOTE: it is recommended to -// send data with a timestamp. -func NewPoint( - name string, - tags map[string]string, - fields map[string]interface{}, - t ...time.Time, -) (*Point, error) { - var T time.Time - if len(t) > 0 { - T = t[0] - } - - pt, err := models.NewPoint(name, models.NewTags(tags), fields, T) - if err != nil { - return nil, err - } - return &Point{ - pt: pt, - }, nil -} - -// String returns a line-protocol string of the Point. -func (p *Point) String() string { - return p.pt.String() -} - -// PrecisionString returns a line-protocol string of the Point, -// with the timestamp formatted for the given precision. -func (p *Point) PrecisionString(precison string) string { - return p.pt.PrecisionString(precison) -} - -// Name returns the measurement name of the point. -func (p *Point) Name() string { - return string(p.pt.Name()) -} - -// Tags returns the tags associated with the point. -func (p *Point) Tags() map[string]string { - return p.pt.Tags().Map() -} - -// Time return the timestamp for the point. -func (p *Point) Time() time.Time { - return p.pt.Time() -} - -// UnixNano returns timestamp of the point in nanoseconds since Unix epoch. -func (p *Point) UnixNano() int64 { - return p.pt.UnixNano() -} - -// Fields returns the fields for the point. -func (p *Point) Fields() (map[string]interface{}, error) { - return p.pt.Fields() -} - -// NewPointFrom returns a point from the provided models.Point. -func NewPointFrom(pt models.Point) *Point { - return &Point{pt: pt} -} - -func (c *client) Write(bp BatchPoints) error { - var b bytes.Buffer - - for _, p := range bp.Points() { - if _, err := b.WriteString(p.pt.PrecisionString(bp.Precision())); err != nil { - return err - } - - if err := b.WriteByte('\n'); err != nil { - return err - } - } - - u := c.url - u.Path = "write" - req, err := http.NewRequest("POST", u.String(), &b) - if err != nil { - return err - } - req.Header.Set("Content-Type", "") - req.Header.Set("User-Agent", c.useragent) - if c.username != "" { - req.SetBasicAuth(c.username, c.password) - } - - params := req.URL.Query() - params.Set("db", bp.Database()) - params.Set("rp", bp.RetentionPolicy()) - params.Set("precision", bp.Precision()) - params.Set("consistency", bp.WriteConsistency()) - req.URL.RawQuery = params.Encode() - - resp, err := c.httpClient.Do(req) - if err != nil { - return err - } - defer resp.Body.Close() - - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return err - } - - if resp.StatusCode != http.StatusNoContent && resp.StatusCode != http.StatusOK { - var err = fmt.Errorf(string(body)) - return err - } - - return nil -} - -// Query defines a query to send to the server. -type Query struct { - Command string - Database string - Precision string - Chunked bool - ChunkSize int - Parameters map[string]interface{} -} - -// NewQuery returns a query object. -// The database and precision arguments can be empty strings if they are not needed for the query. -func NewQuery(command, database, precision string) Query { - return Query{ - Command: command, - Database: database, - Precision: precision, - Parameters: make(map[string]interface{}), - } -} - -// NewQueryWithParameters returns a query object. -// The database and precision arguments can be empty strings if they are not needed for the query. -// parameters is a map of the parameter names used in the command to their values. -func NewQueryWithParameters(command, database, precision string, parameters map[string]interface{}) Query { - return Query{ - Command: command, - Database: database, - Precision: precision, - Parameters: parameters, - } -} - -// Response represents a list of statement results. -type Response struct { - Results []Result - Err string `json:"error,omitempty"` -} - -// Error returns the first error from any statement. -// It returns nil if no errors occurred on any statements. -func (r *Response) Error() error { - if r.Err != "" { - return fmt.Errorf(r.Err) - } - for _, result := range r.Results { - if result.Err != "" { - return fmt.Errorf(result.Err) - } - } - return nil -} - -// Message represents a user message. -type Message struct { - Level string - Text string -} - -// Result represents a resultset returned from a single statement. -type Result struct { - Series []models.Row - Messages []*Message - Err string `json:"error,omitempty"` -} - -// Query sends a command to the server and returns the Response. -func (c *client) Query(q Query) (*Response, error) { - u := c.url - u.Path = "query" - - jsonParameters, err := json.Marshal(q.Parameters) - - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", u.String(), nil) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Type", "") - req.Header.Set("User-Agent", c.useragent) - - if c.username != "" { - req.SetBasicAuth(c.username, c.password) - } - - params := req.URL.Query() - params.Set("q", q.Command) - params.Set("db", q.Database) - params.Set("params", string(jsonParameters)) - if q.Chunked { - params.Set("chunked", "true") - if q.ChunkSize > 0 { - params.Set("chunk_size", strconv.Itoa(q.ChunkSize)) - } - } - - if q.Precision != "" { - params.Set("epoch", q.Precision) - } - req.URL.RawQuery = params.Encode() - - resp, err := c.httpClient.Do(req) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - // If we lack a X-Influxdb-Version header, then we didn't get a response from influxdb - // but instead some other service. If the error code is also a 500+ code, then some - // downstream loadbalancer/proxy/etc had an issue and we should report that. - if resp.Header.Get("X-Influxdb-Version") == "" && resp.StatusCode >= http.StatusInternalServerError { - body, err := ioutil.ReadAll(resp.Body) - if err != nil || len(body) == 0 { - return nil, fmt.Errorf("received status code %d from downstream server", resp.StatusCode) - } - - return nil, fmt.Errorf("received status code %d from downstream server, with response body: %q", resp.StatusCode, body) - } - - // If we get an unexpected content type, then it is also not from influx direct and therefore - // we want to know what we received and what status code was returned for debugging purposes. - if cType, _, _ := mime.ParseMediaType(resp.Header.Get("Content-Type")); cType != "application/json" { - // Read up to 1kb of the body to help identify downstream errors and limit the impact of things - // like downstream serving a large file - body, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1024)) - if err != nil || len(body) == 0 { - return nil, fmt.Errorf("expected json response, got empty body, with status: %v", resp.StatusCode) - } - - return nil, fmt.Errorf("expected json response, got %q, with status: %v and response body: %q", cType, resp.StatusCode, body) - } - - var response Response - if q.Chunked { - cr := NewChunkedResponse(resp.Body) - for { - r, err := cr.NextResponse() - if err != nil { - // If we got an error while decoding the response, send that back. - return nil, err - } - - if r == nil { - break - } - - response.Results = append(response.Results, r.Results...) - if r.Err != "" { - response.Err = r.Err - break - } - } - } else { - dec := json.NewDecoder(resp.Body) - dec.UseNumber() - decErr := dec.Decode(&response) - - // ignore this error if we got an invalid status code - if decErr != nil && decErr.Error() == "EOF" && resp.StatusCode != http.StatusOK { - decErr = nil - } - // If we got a valid decode error, send that back - if decErr != nil { - return nil, fmt.Errorf("unable to decode json: received status code %d err: %s", resp.StatusCode, decErr) - } - } - - // If we don't have an error in our json response, and didn't get statusOK - // then send back an error - if resp.StatusCode != http.StatusOK && response.Error() == nil { - return &response, fmt.Errorf("received status code %d from server", resp.StatusCode) - } - return &response, nil -} - -// duplexReader reads responses and writes it to another writer while -// satisfying the reader interface. -type duplexReader struct { - r io.Reader - w io.Writer -} - -func (r *duplexReader) Read(p []byte) (n int, err error) { - n, err = r.r.Read(p) - if err == nil { - r.w.Write(p[:n]) - } - return n, err -} - -// ChunkedResponse represents a response from the server that -// uses chunking to stream the output. -type ChunkedResponse struct { - dec *json.Decoder - duplex *duplexReader - buf bytes.Buffer -} - -// NewChunkedResponse reads a stream and produces responses from the stream. -func NewChunkedResponse(r io.Reader) *ChunkedResponse { - resp := &ChunkedResponse{} - resp.duplex = &duplexReader{r: r, w: &resp.buf} - resp.dec = json.NewDecoder(resp.duplex) - resp.dec.UseNumber() - return resp -} - -// NextResponse reads the next line of the stream and returns a response. -func (r *ChunkedResponse) NextResponse() (*Response, error) { - var response Response - - if err := r.dec.Decode(&response); err != nil { - if err == io.EOF { - return nil, nil - } - // A decoding error happened. This probably means the server crashed - // and sent a last-ditch error message to us. Ensure we have read the - // entirety of the connection to get any remaining error text. - io.Copy(ioutil.Discard, r.duplex) - return nil, errors.New(strings.TrimSpace(r.buf.String())) - } - - r.buf.Reset() - return &response, nil -} diff --git a/vendor/github.com/influxdata/influxdb/client/v2/udp.go b/vendor/github.com/influxdata/influxdb/client/v2/udp.go deleted file mode 100644 index 779a28b33f347..0000000000000 --- a/vendor/github.com/influxdata/influxdb/client/v2/udp.go +++ /dev/null @@ -1,112 +0,0 @@ -package client - -import ( - "fmt" - "io" - "net" - "time" -) - -const ( - // UDPPayloadSize is a reasonable default payload size for UDP packets that - // could be travelling over the internet. - UDPPayloadSize = 512 -) - -// UDPConfig is the config data needed to create a UDP Client. -type UDPConfig struct { - // Addr should be of the form "host:port" - // or "[ipv6-host%zone]:port". - Addr string - - // PayloadSize is the maximum size of a UDP client message, optional - // Tune this based on your network. Defaults to UDPPayloadSize. - PayloadSize int -} - -// NewUDPClient returns a client interface for writing to an InfluxDB UDP -// service from the given config. -func NewUDPClient(conf UDPConfig) (Client, error) { - var udpAddr *net.UDPAddr - udpAddr, err := net.ResolveUDPAddr("udp", conf.Addr) - if err != nil { - return nil, err - } - - conn, err := net.DialUDP("udp", nil, udpAddr) - if err != nil { - return nil, err - } - - payloadSize := conf.PayloadSize - if payloadSize == 0 { - payloadSize = UDPPayloadSize - } - - return &udpclient{ - conn: conn, - payloadSize: payloadSize, - }, nil -} - -// Close releases the udpclient's resources. -func (uc *udpclient) Close() error { - return uc.conn.Close() -} - -type udpclient struct { - conn io.WriteCloser - payloadSize int -} - -func (uc *udpclient) Write(bp BatchPoints) error { - var b = make([]byte, 0, uc.payloadSize) // initial buffer size, it will grow as needed - var d, _ = time.ParseDuration("1" + bp.Precision()) - - var delayedError error - - var checkBuffer = func(n int) { - if len(b) > 0 && len(b)+n > uc.payloadSize { - if _, err := uc.conn.Write(b); err != nil { - delayedError = err - } - b = b[:0] - } - } - - for _, p := range bp.Points() { - p.pt.Round(d) - pointSize := p.pt.StringSize() + 1 // include newline in size - //point := p.pt.RoundedString(d) + "\n" - - checkBuffer(pointSize) - - if p.Time().IsZero() || pointSize <= uc.payloadSize { - b = p.pt.AppendString(b) - b = append(b, '\n') - continue - } - - points := p.pt.Split(uc.payloadSize - 1) // account for newline character - for _, sp := range points { - checkBuffer(sp.StringSize() + 1) - b = sp.AppendString(b) - b = append(b, '\n') - } - } - - if len(b) > 0 { - if _, err := uc.conn.Write(b); err != nil { - return err - } - } - return delayedError -} - -func (uc *udpclient) Query(q Query) (*Response, error) { - return nil, fmt.Errorf("Querying via UDP is not supported") -} - -func (uc *udpclient) Ping(timeout time.Duration) (time.Duration, string, error) { - return 0, "", nil -} diff --git a/vendor/github.com/maruel/panicparse/.travis.yml b/vendor/github.com/maruel/panicparse/.travis.yml deleted file mode 100644 index c6da8f0b8c00a..0000000000000 --- a/vendor/github.com/maruel/panicparse/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2014 Marc-Antoine Ruel. All rights reserved. -# Use of this source code is governed under the Apache License, Version 2.0 -# that can be found in the LICENSE file. - -sudo: false -language: go - -go: -- tip - -before_install: - - go get github.com/maruel/pre-commit-go/cmd/pcg - -script: - - pcg diff --git a/vendor/github.com/maruel/panicparse/LICENSE b/vendor/github.com/maruel/panicparse/LICENSE deleted file mode 100644 index b76840c258229..0000000000000 --- a/vendor/github.com/maruel/panicparse/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2015 Marc-Antoine Ruel - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/maruel/panicparse/README.md b/vendor/github.com/maruel/panicparse/README.md deleted file mode 100644 index 9fc039cd9ccc3..0000000000000 --- a/vendor/github.com/maruel/panicparse/README.md +++ /dev/null @@ -1,123 +0,0 @@ -panicparse -========== - -Parses panic stack traces, densifies and deduplicates goroutines with similar -stack traces. Helps debugging crashes and deadlocks in heavily parallelized -process. - -[![Build Status](https://travis-ci.org/maruel/panicparse.svg?branch=master)](https://travis-ci.org/maruel/panicparse) - -panicparse helps make sense of Go crash dumps: - -![Screencast](https://raw.githubusercontent.com/wiki/maruel/panicparse/parse.gif "Screencast") - - -Features --------- - - * >50% more compact output than original stack dump yet more readable. - * Exported symbols are bold, private symbols are darker. - * Stdlib is green, main is yellow, rest is red. - * Deduplicates redundant goroutine stacks. Useful for large server crashes. - * Arguments as pointer IDs instead of raw pointer values. - * Pushes stdlib-only stacks at the bottom to help focus on important code. - * Usable as a library! - [![GoDoc](https://godoc.org/github.com/maruel/panicparse/stack?status.svg)](https://godoc.org/github.com/maruel/panicparse/stack) - * Warning: please pin the version (e.g. vendor it). Breaking changes are - not planned but may happen. - * Parses the source files if available to augment the output. - * Works on Windows. - - -Installation ------------- - - go get github.com/maruel/panicparse/cmd/pp - - -Usage ------ - -### Piping a stack trace from another process - -#### TL;DR - - * Ubuntu (bash v4 or zsh): `|&` - * OSX, [install bash 4+](README.md#updating-bash-on-osx), then: `|&` - * Windows _or_ OSX with stock bash v3: `2>&1 |` - * [Fish](http://fishshell.com/) shell: `^|` - - -#### Longer version - -`pp` streams its stdin to stdout as long as it doesn't detect any panic. -`panic()` and Go's native deadlock detector [print to -stderr](https://golang.org/src/runtime/panic1.go) via the native [`print()` -function](https://golang.org/pkg/builtin/#print). - - -**Bash v4** or **zsh**: `|&` tells the shell to redirect stderr to stdout, -it's an alias for `2>&1 |` ([bash -v4](https://www.gnu.org/software/bash/manual/bash.html#Pipelines), -[zsh](http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Simple-Commands-_0026-Pipelines)): - - go test -v |&pp - - -**Windows or OSX native bash** [(which is -3.2.57)](http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/): They don't -have this shortcut, so use the long form: - - go test -v 2>&1 | pp - - -**Fish**: It uses [^ for stderr -redirection](http://fishshell.com/docs/current/tutorial.html#tut_pipes_and_redirections) -so the shortcut is `^|`: - - go test -v ^|pp - - -**PowerShell**: [It has broken `2>&1` redirection](https://connect.microsoft.com/PowerShell/feedback/details/765551/in-powershell-v3-you-cant-redirect-stderr-to-stdout-without-generating-error-records). The workaround is to shell out to cmd.exe. :( - - -### Investigate deadlock - -On POSIX, use `Ctrl-\` to send SIGQUIT to your process, `pp` will ignore -the signal and will parse the stack trace. - - -### Parsing from a file - -To dump to a file then parse, pass the file path of a stack trace - - go test 2> stack.txt - pp stack.txt - - -Tips ----- - -### GOTRACEBACK - -Starting with Go 1.6, [`GOTRACEBACK`](https://golang.org/pkg/runtime/) defaults -to `single` instead of `all` / `1` that was used in 1.5 and before. To get all -goroutines trace and not just the crashing one, set the environment variable: - - export GOTRACEBACK=all - -or `set GOTRACEBACK=all` on Windows. Probably worth to put it in your `.bashrc`. - - -### Updating bash on OSX - -Install bash v4+ on OSX via [homebrew](http://brew.sh) or -[macports](https://www.macports.org/). Your future self will appreciate having -done that. - - -### If you have `/usr/bin/pp` installed - -You may have the Perl PAR Packager installed. Use long name `panicparse` then; - - go get github.com/maruel/panicparse diff --git a/vendor/github.com/maruel/panicparse/stack/source.go b/vendor/github.com/maruel/panicparse/stack/source.go deleted file mode 100644 index f09e67336a097..0000000000000 --- a/vendor/github.com/maruel/panicparse/stack/source.go +++ /dev/null @@ -1,291 +0,0 @@ -// Copyright 2015 Marc-Antoine Ruel. All rights reserved. -// Use of this source code is governed under the Apache License, Version 2.0 -// that can be found in the LICENSE file. - -// This file contains the code to process sources, to be able to deduct the -// original types. - -package stack - -import ( - "bytes" - "fmt" - "go/ast" - "go/parser" - "go/token" - "io/ioutil" - "log" - "math" - "strings" -) - -// cache is a cache of sources on the file system. -type cache struct { - files map[string][]byte - parsed map[string]*parsedFile -} - -// Augment processes source files to improve calls to be more descriptive. -// -// It modifies goroutines in place. -func Augment(goroutines []Goroutine) { - c := &cache{} - for i := range goroutines { - c.augmentGoroutine(&goroutines[i]) - } -} - -// augmentGoroutine processes source files to improve call to be more -// descriptive. -// -// It modifies the routine. -func (c *cache) augmentGoroutine(goroutine *Goroutine) { - if c.files == nil { - c.files = map[string][]byte{} - } - if c.parsed == nil { - c.parsed = map[string]*parsedFile{} - } - // For each call site, look at the next call and populate it. Then we can - // walk back and reformat things. - for i := range goroutine.Stack.Calls { - c.load(goroutine.Stack.Calls[i].SourcePath) - } - - // Once all loaded, we can look at the next call when available. - for i := 1; i < len(goroutine.Stack.Calls); i++ { - // Get the AST from the previous call and process the call line with it. - if f := c.getFuncAST(&goroutine.Stack.Calls[i]); f != nil { - processCall(&goroutine.Stack.Calls[i], f) - } - } -} - -// Private stuff. - -// load loads a source file and parses the AST tree. Failures are ignored. -func (c *cache) load(fileName string) { - if _, ok := c.parsed[fileName]; ok { - return - } - c.parsed[fileName] = nil - if !strings.HasSuffix(fileName, ".go") { - // Ignore C and assembly. - c.files[fileName] = nil - return - } - log.Printf("load(%s)", fileName) - if _, ok := c.files[fileName]; !ok { - var err error - if c.files[fileName], err = ioutil.ReadFile(fileName); err != nil { - log.Printf("Failed to read %s: %s", fileName, err) - c.files[fileName] = nil - return - } - } - fset := token.NewFileSet() - src := c.files[fileName] - parsed, err := parser.ParseFile(fset, fileName, src, 0) - if err != nil { - log.Printf("Failed to parse %s: %s", fileName, err) - return - } - // Convert the line number into raw file offset. - offsets := []int{0, 0} - start := 0 - for l := 1; start < len(src); l++ { - start += bytes.IndexByte(src[start:], '\n') + 1 - offsets = append(offsets, start) - } - c.parsed[fileName] = &parsedFile{offsets, parsed} -} - -func (c *cache) getFuncAST(call *Call) *ast.FuncDecl { - if p := c.parsed[call.SourcePath]; p != nil { - return p.getFuncAST(call.Func.Name(), call.Line) - } - return nil -} - -type parsedFile struct { - lineToByteOffset []int - parsed *ast.File -} - -// getFuncAST gets the callee site function AST representation for the code -// inside the function f at line l. -func (p *parsedFile) getFuncAST(f string, l int) (d *ast.FuncDecl) { - // Walk the AST to find the lineToByteOffset that fits the line number. - var lastFunc *ast.FuncDecl - var found ast.Node - // Inspect() goes depth first. This means for example that a function like: - // func a() { - // b := func() {} - // c() - // } - // - // Were we are looking at the c() call can return confused values. It is - // important to look at the actual ast.Node hierarchy. - ast.Inspect(p.parsed, func(n ast.Node) bool { - if d != nil { - return false - } - if n == nil { - return true - } - if found != nil { - // We are walking up. - } - if int(n.Pos()) >= p.lineToByteOffset[l] { - // We are expecting a ast.CallExpr node. It can be harder to figure out - // when there are multiple calls on a single line, as the stack trace - // doesn't have file byte offset information, only line based. - // gofmt will always format to one function call per line but there can - // be edge cases, like: - // a = A{Foo(), Bar()} - d = lastFunc - //p.processNode(call, n) - return false - } else if f, ok := n.(*ast.FuncDecl); ok { - lastFunc = f - } - return true - }) - return -} - -func name(n ast.Node) string { - if _, ok := n.(*ast.InterfaceType); ok { - return "interface{}" - } - if i, ok := n.(*ast.Ident); ok { - return i.Name - } - if _, ok := n.(*ast.FuncType); ok { - return "func" - } - if s, ok := n.(*ast.SelectorExpr); ok { - return s.Sel.Name - } - // TODO(maruel): Implement anything missing. - return "" -} - -// fieldToType returns the type name and whether if it's an ellipsis. -func fieldToType(f *ast.Field) (string, bool) { - switch arg := f.Type.(type) { - case *ast.ArrayType: - return "[]" + name(arg.Elt), false - case *ast.Ellipsis: - return name(arg.Elt), true - case *ast.FuncType: - // Do not print the function signature to not overload the trace. - return "func", false - case *ast.Ident: - return arg.Name, false - case *ast.InterfaceType: - return "interface{}", false - case *ast.SelectorExpr: - return arg.Sel.Name, false - case *ast.StarExpr: - return "*" + name(arg.X), false - default: - // TODO(maruel): Implement anything missing. - return "", false - } -} - -// extractArgumentsType returns the name of the type of each input argument. -func extractArgumentsType(f *ast.FuncDecl) ([]string, bool) { - var fields []*ast.Field - if f.Recv != nil { - if len(f.Recv.List) != 1 { - panic("Expect only one receiver; please fix panicparse's code") - } - // If it is an object receiver (vs a pointer receiver), its address is not - // printed in the stack trace so it needs to be ignored. - if _, ok := f.Recv.List[0].Type.(*ast.StarExpr); ok { - fields = append(fields, f.Recv.List[0]) - } - } - var types []string - extra := false - for _, arg := range append(fields, f.Type.Params.List...) { - // Assert that extra is only set on the last item of fields? - var t string - t, extra = fieldToType(arg) - mult := len(arg.Names) - if mult == 0 { - mult = 1 - } - for i := 0; i < mult; i++ { - types = append(types, t) - } - } - return types, extra -} - -// processCall walks the function and populate call accordingly. -func processCall(call *Call, f *ast.FuncDecl) { - values := make([]uint64, len(call.Args.Values)) - for i := range call.Args.Values { - values[i] = call.Args.Values[i].Value - } - index := 0 - pop := func() uint64 { - if len(values) != 0 { - x := values[0] - values = values[1:] - index++ - return x - } - return 0 - } - popName := func() string { - n := call.Args.Values[index].Name - v := pop() - if len(n) == 0 { - return fmt.Sprintf("0x%x", v) - } - return n - } - - types, extra := extractArgumentsType(f) - for i := 0; len(values) != 0; i++ { - var t string - if i >= len(types) { - if !extra { - // These are unexpected value! Print them as hex. - call.Args.Processed = append(call.Args.Processed, popName()) - continue - } - t = types[len(types)-1] - } else { - t = types[i] - } - switch t { - case "float32": - call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%g", math.Float32frombits(uint32(pop())))) - case "float64": - call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%g", math.Float64frombits(pop()))) - case "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64": - call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%d", pop())) - case "string": - call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%s(%s, len=%d)", t, popName(), pop())) - default: - if strings.HasPrefix(t, "*") { - call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%s(%s)", t, popName())) - } else if strings.HasPrefix(t, "[]") { - call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%s(%s len=%d cap=%d)", t, popName(), pop(), pop())) - } else { - // Assumes it's an interface. For now, discard the object value, which - // is probably not a good idea. - call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%s(%s)", t, popName())) - pop() - } - } - if len(values) == 0 && call.Args.Elided { - return - } - } -} diff --git a/vendor/github.com/maruel/panicparse/stack/stack.go b/vendor/github.com/maruel/panicparse/stack/stack.go deleted file mode 100644 index cfb502e6639ad..0000000000000 --- a/vendor/github.com/maruel/panicparse/stack/stack.go +++ /dev/null @@ -1,832 +0,0 @@ -// Copyright 2015 Marc-Antoine Ruel. All rights reserved. -// Use of this source code is governed under the Apache License, Version 2.0 -// that can be found in the LICENSE file. - -// Package stack analyzes stack dump of Go processes and simplifies it. -// -// It is mostly useful on servers will large number of identical goroutines, -// making the crash dump harder to read than strictly necesary. -package stack - -import ( - "bufio" - "bytes" - "errors" - "fmt" - "io" - "math" - "net/url" - "os" - "path/filepath" - "regexp" - "runtime" - "sort" - "strconv" - "strings" - "unicode" - "unicode/utf8" -) - -const lockedToThread = "locked to thread" - -var ( - // TODO(maruel): Handle corrupted stack cases: - // - missed stack barrier - // - found next stack barrier at 0x123; expected - // - runtime: unexpected return pc for FUNC_NAME called from 0x123 - - reRoutineHeader = regexp.MustCompile("^goroutine (\\d+) \\[([^\\]]+)\\]\\:\n$") - reMinutes = regexp.MustCompile("^(\\d+) minutes$") - reUnavail = regexp.MustCompile("^(?:\t| +)goroutine running on other thread; stack unavailable") - // See gentraceback() in src/runtime/traceback.go for more information. - // - Sometimes the source file comes up as "". It is the - // compiler than generated these, not the runtime. - // - The tab may be replaced with spaces when a user copy-paste it, handle - // this transparently. - // - "runtime.gopanic" is explicitly replaced with "panic" by gentraceback(). - // - The +0x123 byte offset is printed when frame.pc > _func.entry. _func is - // generated by the linker. - // - The +0x123 byte offset is not included with generated code, e.g. unnamed - // functions "func·006()" which is generally go func() { ... }() - // statements. Since the _func is generated at runtime, it's probably why - // _func.entry is not set. - // - C calls may have fp=0x123 sp=0x123 appended. I think it normally happens - // when a signal is not correctly handled. It is printed with m.throwing>0. - // These are discarded. - // - For cgo, the source file may be "??". - reFile = regexp.MustCompile("^(?:\t| +)(\\?\\?|\\|.+\\.(?:c|go|s))\\:(\\d+)(?:| \\+0x[0-9a-f]+)(?:| fp=0x[0-9a-f]+ sp=0x[0-9a-f]+)\n$") - // Sadly, it doesn't note the goroutine number so we could cascade them per - // parenthood. - reCreated = regexp.MustCompile("^created by (.+)\n$") - reFunc = regexp.MustCompile("^(.+)\\((.*)\\)\n$") - reElided = regexp.MustCompile("^\\.\\.\\.additional frames elided\\.\\.\\.\n$") - // Include frequent GOROOT value on Windows, distro provided and user - // installed path. This simplifies the user's life when processing a trace - // generated on another VM. - // TODO(maruel): Guess the path automatically via traces containing the - // 'runtime' package, which is very frequent. This would be "less bad" than - // throwing up random values at the parser. - goroots = []string{runtime.GOROOT(), "c:/go", "/usr/lib/go", "/usr/local/go"} -) - -// Similarity is the level at which two call lines arguments must match to be -// considered similar enough to coalesce them. -type Similarity int - -const ( - // ExactFlags requires same bits (e.g. Locked). - ExactFlags Similarity = iota - // ExactLines requests the exact same arguments on the call line. - ExactLines - // AnyPointer considers different pointers a similar call line. - AnyPointer - // AnyValue accepts any value as similar call line. - AnyValue -) - -// Function is a function call. -// -// Go stack traces print a mangled function call, this wrapper unmangle the -// string before printing and adds other filtering methods. -type Function struct { - Raw string -} - -// String is the fully qualified function name. -// -// Sadly Go is a bit confused when the package name doesn't match the directory -// containing the source file and will use the directory name instead of the -// real package name. -func (f Function) String() string { - s, _ := url.QueryUnescape(f.Raw) - return s -} - -// Name is the naked function name. -func (f Function) Name() string { - parts := strings.SplitN(filepath.Base(f.Raw), ".", 2) - if len(parts) == 1 { - return parts[0] - } - return parts[1] -} - -// PkgName is the package name for this function reference. -func (f Function) PkgName() string { - parts := strings.SplitN(filepath.Base(f.Raw), ".", 2) - if len(parts) == 1 { - return "" - } - s, _ := url.QueryUnescape(parts[0]) - return s -} - -// PkgDotName returns "." format. -func (f Function) PkgDotName() string { - parts := strings.SplitN(filepath.Base(f.Raw), ".", 2) - s, _ := url.QueryUnescape(parts[0]) - if len(parts) == 1 { - return parts[0] - } - if s != "" || parts[1] != "" { - return s + "." + parts[1] - } - return "" -} - -// IsExported returns true if the function is exported. -func (f Function) IsExported() bool { - name := f.Name() - parts := strings.Split(name, ".") - r, _ := utf8.DecodeRuneInString(parts[len(parts)-1]) - if unicode.ToUpper(r) == r { - return true - } - return f.PkgName() == "main" && name == "main" -} - -// Arg is an argument on a Call. -type Arg struct { - Value uint64 // Value is the raw value as found in the stack trace - Name string // Name is a pseudo name given to the argument -} - -// IsPtr returns true if we guess it's a pointer. It's only a guess, it can be -// easily be confused by a bitmask. -func (a *Arg) IsPtr() bool { - // Assumes all pointers are above 16Mb and positive. - return a.Value > 16*1024*1024 && a.Value < math.MaxInt64 -} - -func (a Arg) String() string { - if a.Name != "" { - return a.Name - } - if a.Value == 0 { - return "0" - } - return fmt.Sprintf("0x%x", a.Value) -} - -// Args is a series of function call arguments. -type Args struct { - Values []Arg // Values is the arguments as shown on the stack trace. They are mangled via simplification. - Processed []string // Processed is the arguments generated from processing the source files. It can have a length lower than Values. - Elided bool // If set, it means there was a trailing ", ..." -} - -func (a Args) String() string { - var v []string - if len(a.Processed) != 0 { - v = make([]string, 0, len(a.Processed)) - for _, item := range a.Processed { - v = append(v, item) - } - } else { - v = make([]string, 0, len(a.Values)) - for _, item := range a.Values { - v = append(v, item.String()) - } - } - if a.Elided { - v = append(v, "...") - } - return strings.Join(v, ", ") -} - -// Equal returns true only if both arguments are exactly equal. -func (a *Args) Equal(r *Args) bool { - if a.Elided != r.Elided || len(a.Values) != len(r.Values) { - return false - } - for i, l := range a.Values { - if l != r.Values[i] { - return false - } - } - return true -} - -// Similar returns true if the two Args are equal or almost but not quite -// equal. -func (a *Args) Similar(r *Args, similar Similarity) bool { - if a.Elided != r.Elided || len(a.Values) != len(r.Values) { - return false - } - if similar == AnyValue { - return true - } - for i, l := range a.Values { - switch similar { - case ExactFlags, ExactLines: - if l != r.Values[i] { - return false - } - default: - if l.IsPtr() != r.Values[i].IsPtr() || (!l.IsPtr() && l != r.Values[i]) { - return false - } - } - } - return true -} - -// Merge merges two similar Args, zapping out differences. -func (a *Args) Merge(r *Args) Args { - out := Args{ - Values: make([]Arg, len(a.Values)), - Elided: a.Elided, - } - for i, l := range a.Values { - if l != r.Values[i] { - out.Values[i].Name = "*" - out.Values[i].Value = l.Value - } else { - out.Values[i] = l - } - } - return out -} - -// Call is an item in the stack trace. -type Call struct { - SourcePath string // Full path name of the source file - Line int // Line number - Func Function // Fully qualified function name (encoded). - Args Args // Call arguments -} - -// Equal returns true only if both calls are exactly equal. -func (c *Call) Equal(r *Call) bool { - return c.SourcePath == r.SourcePath && c.Line == r.Line && c.Func == r.Func && c.Args.Equal(&r.Args) -} - -// Similar returns true if the two Call are equal or almost but not quite -// equal. -func (c *Call) Similar(r *Call, similar Similarity) bool { - return c.SourcePath == r.SourcePath && c.Line == r.Line && c.Func == r.Func && c.Args.Similar(&r.Args, similar) -} - -// Merge merges two similar Call, zapping out differences. -func (c *Call) Merge(r *Call) Call { - return Call{ - SourcePath: c.SourcePath, - Line: c.Line, - Func: c.Func, - Args: c.Args.Merge(&r.Args), - } -} - -// SourceName returns the base file name of the source file. -func (c *Call) SourceName() string { - return filepath.Base(c.SourcePath) -} - -// SourceLine returns "source.go:line", including only the base file name. -func (c *Call) SourceLine() string { - return fmt.Sprintf("%s:%d", c.SourceName(), c.Line) -} - -// FullSourceLine returns "/path/to/source.go:line". -func (c *Call) FullSourceLine() string { - return fmt.Sprintf("%s:%d", c.SourcePath, c.Line) -} - -// PkgSource is one directory plus the file name of the source file. -func (c *Call) PkgSource() string { - return filepath.Join(filepath.Base(filepath.Dir(c.SourcePath)), c.SourceName()) -} - -const testMainSource = "_test" + string(os.PathSeparator) + "_testmain.go" - -// IsStdlib returns true if it is a Go standard library function. This includes -// the 'go test' generated main executable. -func (c *Call) IsStdlib() bool { - for _, goroot := range goroots { - if strings.HasPrefix(c.SourcePath, goroot) { - return true - } - } - // Consider _test/_testmain.go as stdlib since it's injected by "go test". - return c.PkgSource() == testMainSource -} - -// IsPkgMain returns true if it is in the main package. -func (c *Call) IsPkgMain() bool { - return c.Func.PkgName() == "main" -} - -// Stack is a call stack. -type Stack struct { - Calls []Call // Call stack. First is original function, last is leaf function. - Elided bool // Happens when there's >100 items in Stack, currently hardcoded in package runtime. -} - -// Equal returns true on if both call stacks are exactly equal. -func (s *Stack) Equal(r *Stack) bool { - if len(s.Calls) != len(r.Calls) || s.Elided != r.Elided { - return false - } - for i := range s.Calls { - if !s.Calls[i].Equal(&r.Calls[i]) { - return false - } - } - return true -} - -// Similar returns true if the two Stack are equal or almost but not quite -// equal. -func (s *Stack) Similar(r *Stack, similar Similarity) bool { - if len(s.Calls) != len(r.Calls) || s.Elided != r.Elided { - return false - } - for i := range s.Calls { - if !s.Calls[i].Similar(&r.Calls[i], similar) { - return false - } - } - return true -} - -// Merge merges two similar Stack, zapping out differences. -func (s *Stack) Merge(r *Stack) *Stack { - // Assumes similar stacks have the same length. - out := &Stack{ - Calls: make([]Call, len(s.Calls)), - Elided: s.Elided, - } - for i := range s.Calls { - out.Calls[i] = s.Calls[i].Merge(&r.Calls[i]) - } - return out -} - -// Less compares two Stack, where the ones that are less are more -// important, so they come up front. A Stack with more private functions is -// 'less' so it is at the top. Inversely, a Stack with only public -// functions is 'more' so it is at the bottom. -func (s *Stack) Less(r *Stack) bool { - lStdlib := 0 - lPrivate := 0 - for _, c := range s.Calls { - if c.IsStdlib() { - lStdlib++ - } else { - lPrivate++ - } - } - rStdlib := 0 - rPrivate := 0 - for _, s := range r.Calls { - if s.IsStdlib() { - rStdlib++ - } else { - rPrivate++ - } - } - if lPrivate > rPrivate { - return true - } - if lPrivate < rPrivate { - return false - } - if lStdlib > rStdlib { - return false - } - if lStdlib < rStdlib { - return true - } - - // Stack lengths are the same. - for x := range s.Calls { - if s.Calls[x].Func.Raw < r.Calls[x].Func.Raw { - return true - } - if s.Calls[x].Func.Raw > r.Calls[x].Func.Raw { - return true - } - if s.Calls[x].PkgSource() < r.Calls[x].PkgSource() { - return true - } - if s.Calls[x].PkgSource() > r.Calls[x].PkgSource() { - return true - } - if s.Calls[x].Line < r.Calls[x].Line { - return true - } - if s.Calls[x].Line > r.Calls[x].Line { - return true - } - } - return false -} - -// Signature represents the signature of one or multiple goroutines. -// -// It is effectively the stack trace plus the goroutine internal bits, like -// it's state, if it is thread locked, which call site created this goroutine, -// etc. -type Signature struct { - // Use git grep 'gopark(|unlock)\(' to find them all plus everything listed - // in runtime/traceback.go. Valid values includes: - // - chan send, chan receive, select - // - finalizer wait, mark wait (idle), - // - Concurrent GC wait, GC sweep wait, force gc (idle) - // - IO wait, panicwait - // - semacquire, semarelease - // - sleep, timer goroutine (idle) - // - trace reader (blocked) - // Stuck cases: - // - chan send (nil chan), chan receive (nil chan), select (no cases) - // Runnable states: - // - idle, runnable, running, syscall, waiting, dead, enqueue, copystack, - // Scan states: - // - scan, scanrunnable, scanrunning, scansyscall, scanwaiting, scandead, - // scanenqueue - State string - CreatedBy Call // Which other goroutine which created this one. - SleepMin int // Wait time in minutes, if applicable. - SleepMax int // Wait time in minutes, if applicable. - Stack Stack - Locked bool // Locked to an OS thread. -} - -// Equal returns true only if both signatures are exactly equal. -func (s *Signature) Equal(r *Signature) bool { - if s.State != r.State || !s.CreatedBy.Equal(&r.CreatedBy) || s.Locked != r.Locked || s.SleepMin != r.SleepMin || s.SleepMax != r.SleepMax { - return false - } - return s.Stack.Equal(&r.Stack) -} - -// Similar returns true if the two Signature are equal or almost but not quite -// equal. -func (s *Signature) Similar(r *Signature, similar Similarity) bool { - if s.State != r.State || !s.CreatedBy.Similar(&r.CreatedBy, similar) { - return false - } - if similar == ExactFlags && s.Locked != r.Locked { - return false - } - return s.Stack.Similar(&r.Stack, similar) -} - -// Merge merges two similar Signature, zapping out differences. -func (s *Signature) Merge(r *Signature) *Signature { - min := s.SleepMin - if r.SleepMin < min { - min = r.SleepMin - } - max := s.SleepMax - if r.SleepMax > max { - max = r.SleepMax - } - return &Signature{ - State: s.State, // Drop right side. - CreatedBy: s.CreatedBy, // Drop right side. - SleepMin: min, - SleepMax: max, - Stack: *s.Stack.Merge(&r.Stack), - Locked: s.Locked || r.Locked, // TODO(maruel): This is weirdo. - } -} - -// Less compares two Signature, where the ones that are less are more -// important, so they come up front. A Signature with more private functions is -// 'less' so it is at the top. Inversely, a Signature with only public -// functions is 'more' so it is at the bottom. -func (s *Signature) Less(r *Signature) bool { - if s.Stack.Less(&r.Stack) { - return true - } - if r.Stack.Less(&s.Stack) { - return false - } - if s.Locked && !r.Locked { - return true - } - if r.Locked && !s.Locked { - return false - } - if s.State < r.State { - return true - } - if s.State > r.State { - return false - } - return false -} - -// Goroutine represents the state of one goroutine, including the stack trace. -type Goroutine struct { - Signature // It's stack trace, internal bits, state, which call site created it, etc. - ID int // Goroutine ID. - First bool // First is the goroutine first printed, normally the one that crashed. -} - -// Bucketize returns the number of similar goroutines. -func Bucketize(goroutines []Goroutine, similar Similarity) map[*Signature][]Goroutine { - out := map[*Signature][]Goroutine{} - // O(n²). Fix eventually. - for _, routine := range goroutines { - found := false - for key := range out { - // When a match is found, this effectively drops the other goroutine ID. - if key.Similar(&routine.Signature, similar) { - found = true - if !key.Equal(&routine.Signature) { - // Almost but not quite equal. There's different pointers passed - // around but the same values. Zap out the different values. - newKey := key.Merge(&routine.Signature) - out[newKey] = append(out[key], routine) - delete(out, key) - } else { - out[key] = append(out[key], routine) - } - break - } - } - if !found { - key := &Signature{} - *key = routine.Signature - out[key] = []Goroutine{routine} - } - } - return out -} - -// Bucket is a stack trace signature and the list of goroutines that fits this -// signature. -type Bucket struct { - Signature - Routines []Goroutine -} - -// First returns true if it contains the first goroutine, e.g. the ones that -// likely generated the panic() call, if any. -func (b *Bucket) First() bool { - for _, r := range b.Routines { - if r.First { - return true - } - } - return false -} - -// Less does reverse sort. -func (b *Bucket) Less(r *Bucket) bool { - if b.First() { - return true - } - if r.First() { - return false - } - return b.Signature.Less(&r.Signature) -} - -// Buckets is a list of Bucket sorted by repeation count. -type Buckets []Bucket - -func (b Buckets) Len() int { - return len(b) -} - -func (b Buckets) Less(i, j int) bool { - return b[i].Less(&b[j]) -} - -func (b Buckets) Swap(i, j int) { - b[j], b[i] = b[i], b[j] -} - -// SortBuckets creates a list of Bucket from each goroutine stack trace count. -func SortBuckets(buckets map[*Signature][]Goroutine) Buckets { - out := make(Buckets, 0, len(buckets)) - for signature, count := range buckets { - out = append(out, Bucket{*signature, count}) - } - sort.Sort(out) - return out -} - -// scanLines is similar to bufio.ScanLines except that it: -// - doesn't drop '\n' -// - doesn't strip '\r' -// - returns when the data is bufio.MaxScanTokenSize bytes -func scanLines(data []byte, atEOF bool) (advance int, token []byte, err error) { - if atEOF && len(data) == 0 { - return 0, nil, nil - } - if i := bytes.IndexByte(data, '\n'); i >= 0 { - return i + 1, data[0 : i+1], nil - } - if atEOF { - return len(data), data, nil - } - if len(data) >= bufio.MaxScanTokenSize { - // Returns the line even if it is not at EOF nor has a '\n', otherwise the - // scanner will return bufio.ErrTooLong which is definitely not what we - // want. - return len(data), data, nil - } - return 0, nil, nil -} - -// ParseDump processes the output from runtime.Stack(). -// -// It supports piping from another command and assumes there is junk before the -// actual stack trace. The junk is streamed to out. -func ParseDump(r io.Reader, out io.Writer) ([]Goroutine, error) { - goroutines := make([]Goroutine, 0, 16) - var goroutine *Goroutine - scanner := bufio.NewScanner(r) - scanner.Split(scanLines) - // TODO(maruel): Use a formal state machine. Patterns follows: - // - reRoutineHeader - // Either: - // - reUnavail - // - reFunc + reFile in a loop - // - reElided - // Optionally ends with: - // - reCreated + reFile - // Between each goroutine stack dump: an empty line - created := false - // firstLine is the first line after the reRoutineHeader header line. - firstLine := false - for scanner.Scan() { - line := scanner.Text() - if line == "\n" { - if goroutine != nil { - goroutine = nil - continue - } - } else if line[len(line)-1] == '\n' { - if goroutine == nil { - if match := reRoutineHeader.FindStringSubmatch(line); match != nil { - if id, err := strconv.Atoi(match[1]); err == nil { - // See runtime/traceback.go. - // ", \d+ minutes, locked to thread" - items := strings.Split(match[2], ", ") - sleep := 0 - locked := false - for i := 1; i < len(items); i++ { - if items[i] == lockedToThread { - locked = true - continue - } - // Look for duration, if any. - if match2 := reMinutes.FindStringSubmatch(items[i]); match2 != nil { - sleep, _ = strconv.Atoi(match2[1]) - } - } - goroutines = append(goroutines, Goroutine{ - Signature: Signature{ - State: items[0], - SleepMin: sleep, - SleepMax: sleep, - Locked: locked, - }, - ID: id, - First: len(goroutines) == 0, - }) - goroutine = &goroutines[len(goroutines)-1] - firstLine = true - continue - } - } - } else { - if firstLine { - firstLine = false - if match := reUnavail.FindStringSubmatch(line); match != nil { - // Generate a fake stack entry. - goroutine.Stack.Calls = []Call{{SourcePath: ""}} - continue - } - } - - if match := reFile.FindStringSubmatch(line); match != nil { - // Triggers after a reFunc or a reCreated. - num, err := strconv.Atoi(match[2]) - if err != nil { - return goroutines, fmt.Errorf("failed to parse int on line: \"%s\"", line) - } - if created { - created = false - goroutine.CreatedBy.SourcePath = match[1] - goroutine.CreatedBy.Line = num - } else { - i := len(goroutine.Stack.Calls) - 1 - if i < 0 { - return goroutines, errors.New("unexpected order") - } - goroutine.Stack.Calls[i].SourcePath = match[1] - goroutine.Stack.Calls[i].Line = num - } - continue - } - - if match := reCreated.FindStringSubmatch(line); match != nil { - created = true - goroutine.CreatedBy.Func.Raw = match[1] - continue - } - - if match := reFunc.FindStringSubmatch(line); match != nil { - args := Args{} - for _, a := range strings.Split(match[2], ", ") { - if a == "..." { - args.Elided = true - continue - } - if a == "" { - // Remaining values were dropped. - break - } - v, err := strconv.ParseUint(a, 0, 64) - if err != nil { - return goroutines, fmt.Errorf("failed to parse int on line: \"%s\"", line) - } - args.Values = append(args.Values, Arg{Value: v}) - } - goroutine.Stack.Calls = append(goroutine.Stack.Calls, Call{Func: Function{match[1]}, Args: args}) - continue - } - - if match := reElided.FindStringSubmatch(line); match != nil { - goroutine.Stack.Elided = true - continue - } - } - } - _, _ = io.WriteString(out, line) - goroutine = nil - } - nameArguments(goroutines) - return goroutines, scanner.Err() -} - -// Private stuff. - -func nameArguments(goroutines []Goroutine) { - // Set a name for any pointer occuring more than once. - type object struct { - args []*Arg - inPrimary bool - id int - } - objects := map[uint64]object{} - // Enumerate all the arguments. - for i := range goroutines { - for j := range goroutines[i].Stack.Calls { - for k := range goroutines[i].Stack.Calls[j].Args.Values { - arg := goroutines[i].Stack.Calls[j].Args.Values[k] - if arg.IsPtr() { - objects[arg.Value] = object{ - args: append(objects[arg.Value].args, &goroutines[i].Stack.Calls[j].Args.Values[k]), - inPrimary: objects[arg.Value].inPrimary || i == 0, - } - } - } - } - // CreatedBy.Args is never set. - } - order := uint64Slice{} - for k, obj := range objects { - if len(obj.args) > 1 && obj.inPrimary { - order = append(order, k) - } - } - sort.Sort(order) - nextID := 1 - for _, k := range order { - for _, arg := range objects[k].args { - arg.Name = fmt.Sprintf("#%d", nextID) - } - nextID++ - } - - // Now do the rest. This is done so the output is deterministic. - order = uint64Slice{} - for k := range objects { - order = append(order, k) - } - sort.Sort(order) - for _, k := range order { - // Process the remaining pointers, they were not referenced by primary - // thread so will have higher IDs. - if objects[k].inPrimary { - continue - } - for _, arg := range objects[k].args { - arg.Name = fmt.Sprintf("#%d", nextID) - } - nextID++ - } -} - -type uint64Slice []uint64 - -func (a uint64Slice) Len() int { return len(a) } -func (a uint64Slice) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a uint64Slice) Less(i, j int) bool { return a[i] < a[j] } diff --git a/vendor/github.com/maruel/panicparse/stack/ui.go b/vendor/github.com/maruel/panicparse/stack/ui.go deleted file mode 100644 index b125fc9406879..0000000000000 --- a/vendor/github.com/maruel/panicparse/stack/ui.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2016 Marc-Antoine Ruel. All rights reserved. -// Use of this source code is governed under the Apache License, Version 2.0 -// that can be found in the LICENSE file. - -package stack - -import ( - "fmt" - "strings" -) - -// Palette defines the color used. -// -// An empty object Palette{} can be used to disable coloring. -type Palette struct { - EOLReset string - - // Routine header. - RoutineFirst string // The first routine printed. - Routine string // Following routines. - CreatedBy string - - // Call line. - Package string - SourceFile string - FunctionStdLib string - FunctionStdLibExported string - FunctionMain string - FunctionOther string - FunctionOtherExported string - Arguments string -} - -// CalcLengths returns the maximum length of the source lines and package names. -func CalcLengths(buckets Buckets, fullPath bool) (int, int) { - srcLen := 0 - pkgLen := 0 - for _, bucket := range buckets { - for _, line := range bucket.Signature.Stack.Calls { - l := 0 - if fullPath { - l = len(line.FullSourceLine()) - } else { - l = len(line.SourceLine()) - } - if l > srcLen { - srcLen = l - } - l = len(line.Func.PkgName()) - if l > pkgLen { - pkgLen = l - } - } - } - return srcLen, pkgLen -} - -// functionColor returns the color to be used for the function name based on -// the type of package the function is in. -func (p *Palette) functionColor(line *Call) string { - if line.IsStdlib() { - if line.Func.IsExported() { - return p.FunctionStdLibExported - } - return p.FunctionStdLib - } else if line.IsPkgMain() { - return p.FunctionMain - } else if line.Func.IsExported() { - return p.FunctionOtherExported - } - return p.FunctionOther -} - -// routineColor returns the color for the header of the goroutines bucket. -func (p *Palette) routineColor(bucket *Bucket, multipleBuckets bool) string { - if bucket.First() && multipleBuckets { - return p.RoutineFirst - } - return p.Routine -} - -// BucketHeader prints the header of a goroutine signature. -func (p *Palette) BucketHeader(bucket *Bucket, fullPath, multipleBuckets bool) string { - extra := "" - if bucket.SleepMax != 0 { - if bucket.SleepMin != bucket.SleepMax { - extra += fmt.Sprintf(" [%d~%d minutes]", bucket.SleepMin, bucket.SleepMax) - } else { - extra += fmt.Sprintf(" [%d minutes]", bucket.SleepMax) - } - } - if bucket.Locked { - extra += " [locked]" - } - created := bucket.CreatedBy.Func.PkgDotName() - if created != "" { - created += " @ " - if fullPath { - created += bucket.CreatedBy.FullSourceLine() - } else { - created += bucket.CreatedBy.SourceLine() - } - extra += p.CreatedBy + " [Created by " + created + "]" - } - return fmt.Sprintf( - "%s%d: %s%s%s\n", - p.routineColor(bucket, multipleBuckets), len(bucket.Routines), - bucket.State, extra, - p.EOLReset) -} - -// callLine prints one stack line. -func (p *Palette) callLine(line *Call, srcLen, pkgLen int, fullPath bool) string { - src := "" - if fullPath { - src = line.FullSourceLine() - } else { - src = line.SourceLine() - } - return fmt.Sprintf( - " %s%-*s %s%-*s %s%s%s(%s)%s", - p.Package, pkgLen, line.Func.PkgName(), - p.SourceFile, srcLen, src, - p.functionColor(line), line.Func.Name(), - p.Arguments, line.Args, - p.EOLReset) -} - -// StackLines prints one complete stack trace, without the header. -func (p *Palette) StackLines(signature *Signature, srcLen, pkgLen int, fullPath bool) string { - out := make([]string, len(signature.Stack.Calls)) - for i := range signature.Stack.Calls { - out[i] = p.callLine(&signature.Stack.Calls[i], srcLen, pkgLen, fullPath) - } - if signature.Stack.Elided { - out = append(out, " (...)") - } - return strings.Join(out, "\n") + "\n" -} diff --git a/vendor/github.com/maruel/panicparse/vendor.yml b/vendor/github.com/maruel/panicparse/vendor.yml deleted file mode 100644 index ff3d43f5f2d7a..0000000000000 --- a/vendor/github.com/maruel/panicparse/vendor.yml +++ /dev/null @@ -1,17 +0,0 @@ -vendors: -- path: github.com/kr/pretty - rev: 737b74a46c4bf788349f72cb256fed10aea4d0ac -- path: github.com/kr/text - rev: 7cafcd837844e784b526369c9bce262804aebc60 -- path: github.com/maruel/ut - rev: a9c9f15ccfa6f8b90182a53df32f4745586fbae3 -- path: github.com/mattn/go-colorable - rev: 9056b7a9f2d1f2d96498d6d146acd1f9d5ed3d59 -- path: github.com/mattn/go-isatty - rev: 56b76bdf51f7708750eac80fa38b952bb9f32639 -- path: github.com/mgutz/ansi - rev: c286dcecd19ff979eeb73ea444e479b903f2cfcb -- path: github.com/pmezard/go-difflib - rev: 792786c7400a136282c1664665ae0a8db921c6c2 -- path: golang.org/x/sys - rev: a646d33e2ee3172a661fc09bca23bb4889a41bc8 diff --git a/vendor/github.com/mitchellh/go-wordwrap/LICENSE.md b/vendor/github.com/mitchellh/go-wordwrap/LICENSE.md deleted file mode 100644 index 229851590442a..0000000000000 --- a/vendor/github.com/mitchellh/go-wordwrap/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Mitchell Hashimoto - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/mitchellh/go-wordwrap/README.md b/vendor/github.com/mitchellh/go-wordwrap/README.md deleted file mode 100644 index 60ae3117008d9..0000000000000 --- a/vendor/github.com/mitchellh/go-wordwrap/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# go-wordwrap - -`go-wordwrap` (Golang package: `wordwrap`) is a package for Go that -automatically wraps words into multiple lines. The primary use case for this -is in formatting CLI output, but of course word wrapping is a generally useful -thing to do. - -## Installation and Usage - -Install using `go get github.com/mitchellh/go-wordwrap`. - -Full documentation is available at -http://godoc.org/github.com/mitchellh/go-wordwrap - -Below is an example of its usage ignoring errors: - -```go -wrapped := wordwrap.WrapString("foo bar baz", 3) -fmt.Println(wrapped) -``` - -Would output: - -``` -foo -bar -baz -``` - -## Word Wrap Algorithm - -This library doesn't use any clever algorithm for word wrapping. The wrapping -is actually very naive: whenever there is whitespace or an explicit linebreak. -The goal of this library is for word wrapping CLI output, so the input is -typically pretty well controlled human language. Because of this, the naive -approach typically works just fine. - -In the future, we'd like to make the algorithm more advanced. We would do -so without breaking the API. diff --git a/vendor/github.com/mitchellh/go-wordwrap/wordwrap.go b/vendor/github.com/mitchellh/go-wordwrap/wordwrap.go deleted file mode 100644 index ac67205bc2e5e..0000000000000 --- a/vendor/github.com/mitchellh/go-wordwrap/wordwrap.go +++ /dev/null @@ -1,73 +0,0 @@ -package wordwrap - -import ( - "bytes" - "unicode" -) - -// WrapString wraps the given string within lim width in characters. -// -// Wrapping is currently naive and only happens at white-space. A future -// version of the library will implement smarter wrapping. This means that -// pathological cases can dramatically reach past the limit, such as a very -// long word. -func WrapString(s string, lim uint) string { - // Initialize a buffer with a slightly larger size to account for breaks - init := make([]byte, 0, len(s)) - buf := bytes.NewBuffer(init) - - var current uint - var wordBuf, spaceBuf bytes.Buffer - - for _, char := range s { - if char == '\n' { - if wordBuf.Len() == 0 { - if current+uint(spaceBuf.Len()) > lim { - current = 0 - } else { - current += uint(spaceBuf.Len()) - spaceBuf.WriteTo(buf) - } - spaceBuf.Reset() - } else { - current += uint(spaceBuf.Len() + wordBuf.Len()) - spaceBuf.WriteTo(buf) - spaceBuf.Reset() - wordBuf.WriteTo(buf) - wordBuf.Reset() - } - buf.WriteRune(char) - current = 0 - } else if unicode.IsSpace(char) { - if spaceBuf.Len() == 0 || wordBuf.Len() > 0 { - current += uint(spaceBuf.Len() + wordBuf.Len()) - spaceBuf.WriteTo(buf) - spaceBuf.Reset() - wordBuf.WriteTo(buf) - wordBuf.Reset() - } - - spaceBuf.WriteRune(char) - } else { - - wordBuf.WriteRune(char) - - if current+uint(spaceBuf.Len()+wordBuf.Len()) > lim && uint(wordBuf.Len()) < lim { - buf.WriteRune('\n') - current = 0 - spaceBuf.Reset() - } - } - } - - if wordBuf.Len() == 0 { - if current+uint(spaceBuf.Len()) <= lim { - spaceBuf.WriteTo(buf) - } - } else { - spaceBuf.WriteTo(buf) - wordBuf.WriteTo(buf) - } - - return buf.String() -} diff --git a/vendor/github.com/nsf/termbox-go/AUTHORS b/vendor/github.com/nsf/termbox-go/AUTHORS deleted file mode 100644 index fe26fb0fb058b..0000000000000 --- a/vendor/github.com/nsf/termbox-go/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -# Please keep this file sorted. - -Georg Reinke -nsf diff --git a/vendor/github.com/nsf/termbox-go/LICENSE b/vendor/github.com/nsf/termbox-go/LICENSE deleted file mode 100644 index d9bc068ce748e..0000000000000 --- a/vendor/github.com/nsf/termbox-go/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2012 termbox-go authors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/nsf/termbox-go/README.md b/vendor/github.com/nsf/termbox-go/README.md deleted file mode 100644 index 4b2e73ccc13a3..0000000000000 --- a/vendor/github.com/nsf/termbox-go/README.md +++ /dev/null @@ -1,31 +0,0 @@ -## Termbox -Termbox is a library that provides a minimalistic API which allows the programmer to write text-based user interfaces. The library is crossplatform and has both terminal-based implementations on *nix operating systems and a winapi console based implementation for windows operating systems. The basic idea is an abstraction of the greatest common subset of features available on all major terminals and other terminal-like APIs in a minimalistic fashion. Small API means it is easy to implement, test, maintain and learn it, that's what makes the termbox a distinct library in its area. - -### Installation -Install and update this go package with `go get -u github.com/nsf/termbox-go` - -### Examples -For examples of what can be done take a look at demos in the _demos directory. You can try them with go run: `go run _demos/keyboard.go` - -There are also some interesting projects using termbox-go: - - [godit](https://github.com/nsf/godit) is an emacsish lightweight text editor written using termbox. - - [gomatrix](https://github.com/GeertJohan/gomatrix) connects to The Matrix and displays its data streams in your terminal. - - [gotetris](https://github.com/jjinux/gotetris) is an implementation of Tetris. - - [sokoban-go](https://github.com/rn2dy/sokoban-go) is an implementation of sokoban game. - - [hecate](https://github.com/evanmiller/hecate) is a hex editor designed by Satan. - - [httopd](https://github.com/verdverm/httopd) is top for httpd logs. - - [mop](https://github.com/michaeldv/mop) is stock market tracker for hackers. - - [termui](https://github.com/gizak/termui) is a terminal dashboard. - - [termloop](https://github.com/JoelOtter/termloop) is a terminal game engine. - - [xterm-color-chart](https://github.com/kutuluk/xterm-color-chart) is a XTerm 256 color chart. - - [gocui](https://github.com/jroimartin/gocui) is a minimalist Go library aimed at creating console user interfaces. - - [dry](https://github.com/moncho/dry) is an interactive cli to manage Docker containers. - - [pxl](https://github.com/ichinaski/pxl) displays images in the terminal. - - [snake-game](https://github.com/DyegoCosta/snake-game) is an implementation of the Snake game. - - [gone](https://github.com/guillaumebreton/gone) is a CLI pomodoro® timer. - - [Spoof.go](https://github.com/sabey/spoofgo) controllable movement spoofing from the cli - - [lf](https://github.com/gokcehan/lf) is a terminal file manager - - [rat](https://github.com/ericfreese/rat) lets you compose shell commands to build terminal applications. - -### API reference -[godoc.org/github.com/nsf/termbox-go](http://godoc.org/github.com/nsf/termbox-go) diff --git a/vendor/github.com/nsf/termbox-go/api.go b/vendor/github.com/nsf/termbox-go/api.go deleted file mode 100644 index b242ddcf3a230..0000000000000 --- a/vendor/github.com/nsf/termbox-go/api.go +++ /dev/null @@ -1,457 +0,0 @@ -// +build !windows - -package termbox - -import "github.com/mattn/go-runewidth" -import "fmt" -import "os" -import "os/signal" -import "syscall" -import "runtime" - -// public API - -// Initializes termbox library. This function should be called before any other functions. -// After successful initialization, the library must be finalized using 'Close' function. -// -// Example usage: -// err := termbox.Init() -// if err != nil { -// panic(err) -// } -// defer termbox.Close() -func Init() error { - var err error - - out, err = os.OpenFile("/dev/tty", syscall.O_WRONLY, 0) - if err != nil { - return err - } - in, err = syscall.Open("/dev/tty", syscall.O_RDONLY, 0) - if err != nil { - return err - } - - err = setup_term() - if err != nil { - return fmt.Errorf("termbox: error while reading terminfo data: %v", err) - } - - signal.Notify(sigwinch, syscall.SIGWINCH) - signal.Notify(sigio, syscall.SIGIO) - - _, err = fcntl(in, syscall.F_SETFL, syscall.O_ASYNC|syscall.O_NONBLOCK) - if err != nil { - return err - } - _, err = fcntl(in, syscall.F_SETOWN, syscall.Getpid()) - if runtime.GOOS != "darwin" && err != nil { - return err - } - err = tcgetattr(out.Fd(), &orig_tios) - if err != nil { - return err - } - - tios := orig_tios - tios.Iflag &^= syscall_IGNBRK | syscall_BRKINT | syscall_PARMRK | - syscall_ISTRIP | syscall_INLCR | syscall_IGNCR | - syscall_ICRNL | syscall_IXON - tios.Lflag &^= syscall_ECHO | syscall_ECHONL | syscall_ICANON | - syscall_ISIG | syscall_IEXTEN - tios.Cflag &^= syscall_CSIZE | syscall_PARENB - tios.Cflag |= syscall_CS8 - tios.Cc[syscall_VMIN] = 1 - tios.Cc[syscall_VTIME] = 0 - - err = tcsetattr(out.Fd(), &tios) - if err != nil { - return err - } - - out.WriteString(funcs[t_enter_ca]) - out.WriteString(funcs[t_enter_keypad]) - out.WriteString(funcs[t_hide_cursor]) - out.WriteString(funcs[t_clear_screen]) - - termw, termh = get_term_size(out.Fd()) - back_buffer.init(termw, termh) - front_buffer.init(termw, termh) - back_buffer.clear() - front_buffer.clear() - - go func() { - buf := make([]byte, 128) - for { - select { - case <-sigio: - for { - n, err := syscall.Read(in, buf) - if err == syscall.EAGAIN || err == syscall.EWOULDBLOCK { - break - } - select { - case input_comm <- input_event{buf[:n], err}: - ie := <-input_comm - buf = ie.data[:128] - case <-quit: - return - } - } - case <-quit: - return - } - } - }() - - IsInit = true - return nil -} - -// Interrupt an in-progress call to PollEvent by causing it to return -// EventInterrupt. Note that this function will block until the PollEvent -// function has successfully been interrupted. -func Interrupt() { - interrupt_comm <- struct{}{} -} - -// Finalizes termbox library, should be called after successful initialization -// when termbox's functionality isn't required anymore. -func Close() { - quit <- 1 - out.WriteString(funcs[t_show_cursor]) - out.WriteString(funcs[t_sgr0]) - out.WriteString(funcs[t_clear_screen]) - out.WriteString(funcs[t_exit_ca]) - out.WriteString(funcs[t_exit_keypad]) - out.WriteString(funcs[t_exit_mouse]) - tcsetattr(out.Fd(), &orig_tios) - - out.Close() - syscall.Close(in) - - // reset the state, so that on next Init() it will work again - termw = 0 - termh = 0 - input_mode = InputEsc - out = nil - in = 0 - lastfg = attr_invalid - lastbg = attr_invalid - lastx = coord_invalid - lasty = coord_invalid - cursor_x = cursor_hidden - cursor_y = cursor_hidden - foreground = ColorDefault - background = ColorDefault - IsInit = false -} - -// Synchronizes the internal back buffer with the terminal. -func Flush() error { - // invalidate cursor position - lastx = coord_invalid - lasty = coord_invalid - - update_size_maybe() - - for y := 0; y < front_buffer.height; y++ { - line_offset := y * front_buffer.width - for x := 0; x < front_buffer.width; { - cell_offset := line_offset + x - back := &back_buffer.cells[cell_offset] - front := &front_buffer.cells[cell_offset] - if back.Ch < ' ' { - back.Ch = ' ' - } - w := runewidth.RuneWidth(back.Ch) - if w == 0 || w == 2 && runewidth.IsAmbiguousWidth(back.Ch) { - w = 1 - } - if *back == *front { - x += w - continue - } - *front = *back - send_attr(back.Fg, back.Bg) - - if w == 2 && x == front_buffer.width-1 { - // there's not enough space for 2-cells rune, - // let's just put a space in there - send_char(x, y, ' ') - } else { - send_char(x, y, back.Ch) - if w == 2 { - next := cell_offset + 1 - front_buffer.cells[next] = Cell{ - Ch: 0, - Fg: back.Fg, - Bg: back.Bg, - } - } - } - x += w - } - } - if !is_cursor_hidden(cursor_x, cursor_y) { - write_cursor(cursor_x, cursor_y) - } - return flush() -} - -// Sets the position of the cursor. See also HideCursor(). -func SetCursor(x, y int) { - if is_cursor_hidden(cursor_x, cursor_y) && !is_cursor_hidden(x, y) { - outbuf.WriteString(funcs[t_show_cursor]) - } - - if !is_cursor_hidden(cursor_x, cursor_y) && is_cursor_hidden(x, y) { - outbuf.WriteString(funcs[t_hide_cursor]) - } - - cursor_x, cursor_y = x, y - if !is_cursor_hidden(cursor_x, cursor_y) { - write_cursor(cursor_x, cursor_y) - } -} - -// The shortcut for SetCursor(-1, -1). -func HideCursor() { - SetCursor(cursor_hidden, cursor_hidden) -} - -// Changes cell's parameters in the internal back buffer at the specified -// position. -func SetCell(x, y int, ch rune, fg, bg Attribute) { - if x < 0 || x >= back_buffer.width { - return - } - if y < 0 || y >= back_buffer.height { - return - } - - back_buffer.cells[y*back_buffer.width+x] = Cell{ch, fg, bg} -} - -// Returns a slice into the termbox's back buffer. You can get its dimensions -// using 'Size' function. The slice remains valid as long as no 'Clear' or -// 'Flush' function calls were made after call to this function. -func CellBuffer() []Cell { - return back_buffer.cells -} - -// After getting a raw event from PollRawEvent function call, you can parse it -// again into an ordinary one using termbox logic. That is parse an event as -// termbox would do it. Returned event in addition to usual Event struct fields -// sets N field to the amount of bytes used within 'data' slice. If the length -// of 'data' slice is zero or event cannot be parsed for some other reason, the -// function will return a special event type: EventNone. -// -// IMPORTANT: EventNone may contain a non-zero N, which means you should skip -// these bytes, because termbox cannot recognize them. -// -// NOTE: This API is experimental and may change in future. -func ParseEvent(data []byte) Event { - event := Event{Type: EventKey} - ok := extract_event(data, &event) - if !ok { - return Event{Type: EventNone, N: event.N} - } - return event -} - -// Wait for an event and return it. This is a blocking function call. Instead -// of EventKey and EventMouse it returns EventRaw events. Raw event is written -// into `data` slice and Event's N field is set to the amount of bytes written. -// The minimum required length of the 'data' slice is 1. This requirement may -// vary on different platforms. -// -// NOTE: This API is experimental and may change in future. -func PollRawEvent(data []byte) Event { - if len(data) == 0 { - panic("len(data) >= 1 is a requirement") - } - - var event Event - if extract_raw_event(data, &event) { - return event - } - - for { - select { - case ev := <-input_comm: - if ev.err != nil { - return Event{Type: EventError, Err: ev.err} - } - - inbuf = append(inbuf, ev.data...) - input_comm <- ev - if extract_raw_event(data, &event) { - return event - } - case <-interrupt_comm: - event.Type = EventInterrupt - return event - - case <-sigwinch: - event.Type = EventResize - event.Width, event.Height = get_term_size(out.Fd()) - return event - } - } -} - -// Wait for an event and return it. This is a blocking function call. -func PollEvent() Event { - var event Event - - // try to extract event from input buffer, return on success - event.Type = EventKey - ok := extract_event(inbuf, &event) - if event.N != 0 { - copy(inbuf, inbuf[event.N:]) - inbuf = inbuf[:len(inbuf)-event.N] - } - if ok { - return event - } - - for { - select { - case ev := <-input_comm: - if ev.err != nil { - return Event{Type: EventError, Err: ev.err} - } - - inbuf = append(inbuf, ev.data...) - input_comm <- ev - ok := extract_event(inbuf, &event) - if event.N != 0 { - copy(inbuf, inbuf[event.N:]) - inbuf = inbuf[:len(inbuf)-event.N] - } - if ok { - return event - } - case <-interrupt_comm: - event.Type = EventInterrupt - return event - - case <-sigwinch: - event.Type = EventResize - event.Width, event.Height = get_term_size(out.Fd()) - return event - } - } -} - -// Returns the size of the internal back buffer (which is mostly the same as -// terminal's window size in characters). But it doesn't always match the size -// of the terminal window, after the terminal size has changed, the internal -// back buffer will get in sync only after Clear or Flush function calls. -func Size() (width int, height int) { - return termw, termh -} - -// Clears the internal back buffer. -func Clear(fg, bg Attribute) error { - foreground, background = fg, bg - err := update_size_maybe() - back_buffer.clear() - return err -} - -// Sets termbox input mode. Termbox has two input modes: -// -// 1. Esc input mode. When ESC sequence is in the buffer and it doesn't match -// any known sequence. ESC means KeyEsc. This is the default input mode. -// -// 2. Alt input mode. When ESC sequence is in the buffer and it doesn't match -// any known sequence. ESC enables ModAlt modifier for the next keyboard event. -// -// Both input modes can be OR'ed with Mouse mode. Setting Mouse mode bit up will -// enable mouse button press/release and drag events. -// -// If 'mode' is InputCurrent, returns the current input mode. See also Input* -// constants. -func SetInputMode(mode InputMode) InputMode { - if mode == InputCurrent { - return input_mode - } - if mode&(InputEsc|InputAlt) == 0 { - mode |= InputEsc - } - if mode&(InputEsc|InputAlt) == InputEsc|InputAlt { - mode &^= InputAlt - } - if mode&InputMouse != 0 { - out.WriteString(funcs[t_enter_mouse]) - } else { - out.WriteString(funcs[t_exit_mouse]) - } - - input_mode = mode - return input_mode -} - -// Sets the termbox output mode. Termbox has four output options: -// -// 1. OutputNormal => [1..8] -// This mode provides 8 different colors: -// black, red, green, yellow, blue, magenta, cyan, white -// Shortcut: ColorBlack, ColorRed, ... -// Attributes: AttrBold, AttrUnderline, AttrReverse -// -// Example usage: -// SetCell(x, y, '@', ColorBlack | AttrBold, ColorRed); -// -// 2. Output256 => [1..256] -// In this mode you can leverage the 256 terminal mode: -// 0x01 - 0x08: the 8 colors as in OutputNormal -// 0x09 - 0x10: Color* | AttrBold -// 0x11 - 0xe8: 216 different colors -// 0xe9 - 0x1ff: 24 different shades of grey -// -// Example usage: -// SetCell(x, y, '@', 184, 240); -// SetCell(x, y, '@', 0xb8, 0xf0); -// -// 3. Output216 => [1..216] -// This mode supports the 3rd range of the 256 mode only. -// But you dont need to provide an offset. -// -// 4. OutputGrayscale => [1..26] -// This mode supports the 4th range of the 256 mode -// and black and white colors from 3th range of the 256 mode -// But you dont need to provide an offset. -// -// In all modes, 0x00 represents the default color. -// -// `go run _demos/output.go` to see its impact on your terminal. -// -// If 'mode' is OutputCurrent, it returns the current output mode. -// -// Note that this may return a different OutputMode than the one requested, -// as the requested mode may not be available on the target platform. -func SetOutputMode(mode OutputMode) OutputMode { - if mode == OutputCurrent { - return output_mode - } - - output_mode = mode - return output_mode -} - -// Sync comes handy when something causes desync between termbox's understanding -// of a terminal buffer and the reality. Such as a third party process. Sync -// forces a complete resync between the termbox and a terminal, it may not be -// visually pretty though. -func Sync() error { - front_buffer.clear() - err := send_clear() - if err != nil { - return err - } - - return Flush() -} diff --git a/vendor/github.com/nsf/termbox-go/api_common.go b/vendor/github.com/nsf/termbox-go/api_common.go deleted file mode 100644 index 9f23661f561e2..0000000000000 --- a/vendor/github.com/nsf/termbox-go/api_common.go +++ /dev/null @@ -1,187 +0,0 @@ -// termbox is a library for creating cross-platform text-based interfaces -package termbox - -// public API, common OS agnostic part - -type ( - InputMode int - OutputMode int - EventType uint8 - Modifier uint8 - Key uint16 - Attribute uint16 -) - -// This type represents a termbox event. The 'Mod', 'Key' and 'Ch' fields are -// valid if 'Type' is EventKey. The 'Width' and 'Height' fields are valid if -// 'Type' is EventResize. The 'Err' field is valid if 'Type' is EventError. -type Event struct { - Type EventType // one of Event* constants - Mod Modifier // one of Mod* constants or 0 - Key Key // one of Key* constants, invalid if 'Ch' is not 0 - Ch rune // a unicode character - Width int // width of the screen - Height int // height of the screen - Err error // error in case if input failed - MouseX int // x coord of mouse - MouseY int // y coord of mouse - N int // number of bytes written when getting a raw event -} - -// A cell, single conceptual entity on the screen. The screen is basically a 2d -// array of cells. 'Ch' is a unicode character, 'Fg' and 'Bg' are foreground -// and background attributes respectively. -type Cell struct { - Ch rune - Fg Attribute - Bg Attribute -} - -// To know if termbox has been initialized or not -var ( - IsInit bool = false -) - -// Key constants, see Event.Key field. -const ( - KeyF1 Key = 0xFFFF - iota - KeyF2 - KeyF3 - KeyF4 - KeyF5 - KeyF6 - KeyF7 - KeyF8 - KeyF9 - KeyF10 - KeyF11 - KeyF12 - KeyInsert - KeyDelete - KeyHome - KeyEnd - KeyPgup - KeyPgdn - KeyArrowUp - KeyArrowDown - KeyArrowLeft - KeyArrowRight - key_min // see terminfo - MouseLeft - MouseMiddle - MouseRight - MouseRelease - MouseWheelUp - MouseWheelDown -) - -const ( - KeyCtrlTilde Key = 0x00 - KeyCtrl2 Key = 0x00 - KeyCtrlSpace Key = 0x00 - KeyCtrlA Key = 0x01 - KeyCtrlB Key = 0x02 - KeyCtrlC Key = 0x03 - KeyCtrlD Key = 0x04 - KeyCtrlE Key = 0x05 - KeyCtrlF Key = 0x06 - KeyCtrlG Key = 0x07 - KeyBackspace Key = 0x08 - KeyCtrlH Key = 0x08 - KeyTab Key = 0x09 - KeyCtrlI Key = 0x09 - KeyCtrlJ Key = 0x0A - KeyCtrlK Key = 0x0B - KeyCtrlL Key = 0x0C - KeyEnter Key = 0x0D - KeyCtrlM Key = 0x0D - KeyCtrlN Key = 0x0E - KeyCtrlO Key = 0x0F - KeyCtrlP Key = 0x10 - KeyCtrlQ Key = 0x11 - KeyCtrlR Key = 0x12 - KeyCtrlS Key = 0x13 - KeyCtrlT Key = 0x14 - KeyCtrlU Key = 0x15 - KeyCtrlV Key = 0x16 - KeyCtrlW Key = 0x17 - KeyCtrlX Key = 0x18 - KeyCtrlY Key = 0x19 - KeyCtrlZ Key = 0x1A - KeyEsc Key = 0x1B - KeyCtrlLsqBracket Key = 0x1B - KeyCtrl3 Key = 0x1B - KeyCtrl4 Key = 0x1C - KeyCtrlBackslash Key = 0x1C - KeyCtrl5 Key = 0x1D - KeyCtrlRsqBracket Key = 0x1D - KeyCtrl6 Key = 0x1E - KeyCtrl7 Key = 0x1F - KeyCtrlSlash Key = 0x1F - KeyCtrlUnderscore Key = 0x1F - KeySpace Key = 0x20 - KeyBackspace2 Key = 0x7F - KeyCtrl8 Key = 0x7F -) - -// Alt modifier constant, see Event.Mod field and SetInputMode function. -const ( - ModAlt Modifier = 1 << iota - ModMotion -) - -// Cell colors, you can combine a color with multiple attributes using bitwise -// OR ('|'). -const ( - ColorDefault Attribute = iota - ColorBlack - ColorRed - ColorGreen - ColorYellow - ColorBlue - ColorMagenta - ColorCyan - ColorWhite -) - -// Cell attributes, it is possible to use multiple attributes by combining them -// using bitwise OR ('|'). Although, colors cannot be combined. But you can -// combine attributes and a single color. -// -// It's worth mentioning that some platforms don't support certain attibutes. -// For example windows console doesn't support AttrUnderline. And on some -// terminals applying AttrBold to background may result in blinking text. Use -// them with caution and test your code on various terminals. -const ( - AttrBold Attribute = 1 << (iota + 9) - AttrUnderline - AttrReverse -) - -// Input mode. See SetInputMode function. -const ( - InputEsc InputMode = 1 << iota - InputAlt - InputMouse - InputCurrent InputMode = 0 -) - -// Output mode. See SetOutputMode function. -const ( - OutputCurrent OutputMode = iota - OutputNormal - Output256 - Output216 - OutputGrayscale -) - -// Event type. See Event.Type field. -const ( - EventKey EventType = iota - EventResize - EventMouse - EventError - EventInterrupt - EventRaw - EventNone -) diff --git a/vendor/github.com/nsf/termbox-go/api_windows.go b/vendor/github.com/nsf/termbox-go/api_windows.go deleted file mode 100644 index 7def30a67df0a..0000000000000 --- a/vendor/github.com/nsf/termbox-go/api_windows.go +++ /dev/null @@ -1,239 +0,0 @@ -package termbox - -import ( - "syscall" -) - -// public API - -// Initializes termbox library. This function should be called before any other functions. -// After successful initialization, the library must be finalized using 'Close' function. -// -// Example usage: -// err := termbox.Init() -// if err != nil { -// panic(err) -// } -// defer termbox.Close() -func Init() error { - var err error - - interrupt, err = create_event() - if err != nil { - return err - } - - in, err = syscall.Open("CONIN$", syscall.O_RDWR, 0) - if err != nil { - return err - } - out, err = syscall.Open("CONOUT$", syscall.O_RDWR, 0) - if err != nil { - return err - } - - err = get_console_mode(in, &orig_mode) - if err != nil { - return err - } - - err = set_console_mode(in, enable_window_input) - if err != nil { - return err - } - - orig_size = get_term_size(out) - win_size := get_win_size(out) - - err = set_console_screen_buffer_size(out, win_size) - if err != nil { - return err - } - - err = get_console_cursor_info(out, &orig_cursor_info) - if err != nil { - return err - } - - show_cursor(false) - term_size = get_term_size(out) - back_buffer.init(int(term_size.x), int(term_size.y)) - front_buffer.init(int(term_size.x), int(term_size.y)) - back_buffer.clear() - front_buffer.clear() - clear() - - diffbuf = make([]diff_msg, 0, 32) - - go input_event_producer() - IsInit = true - return nil -} - -// Finalizes termbox library, should be called after successful initialization -// when termbox's functionality isn't required anymore. -func Close() { - // we ignore errors here, because we can't really do anything about them - Clear(0, 0) - Flush() - - // stop event producer - cancel_comm <- true - set_event(interrupt) - select { - case <-input_comm: - default: - } - <-cancel_done_comm - - set_console_cursor_info(out, &orig_cursor_info) - set_console_cursor_position(out, coord{}) - set_console_screen_buffer_size(out, orig_size) - set_console_mode(in, orig_mode) - syscall.Close(in) - syscall.Close(out) - syscall.Close(interrupt) - IsInit = false -} - -// Interrupt an in-progress call to PollEvent by causing it to return -// EventInterrupt. Note that this function will block until the PollEvent -// function has successfully been interrupted. -func Interrupt() { - interrupt_comm <- struct{}{} -} - -// Synchronizes the internal back buffer with the terminal. -func Flush() error { - update_size_maybe() - prepare_diff_messages() - for _, diff := range diffbuf { - r := small_rect{ - left: 0, - top: diff.pos, - right: term_size.x - 1, - bottom: diff.pos + diff.lines - 1, - } - write_console_output(out, diff.chars, r) - } - if !is_cursor_hidden(cursor_x, cursor_y) { - move_cursor(cursor_x, cursor_y) - } - return nil -} - -// Sets the position of the cursor. See also HideCursor(). -func SetCursor(x, y int) { - if is_cursor_hidden(cursor_x, cursor_y) && !is_cursor_hidden(x, y) { - show_cursor(true) - } - - if !is_cursor_hidden(cursor_x, cursor_y) && is_cursor_hidden(x, y) { - show_cursor(false) - } - - cursor_x, cursor_y = x, y - if !is_cursor_hidden(cursor_x, cursor_y) { - move_cursor(cursor_x, cursor_y) - } -} - -// The shortcut for SetCursor(-1, -1). -func HideCursor() { - SetCursor(cursor_hidden, cursor_hidden) -} - -// Changes cell's parameters in the internal back buffer at the specified -// position. -func SetCell(x, y int, ch rune, fg, bg Attribute) { - if x < 0 || x >= back_buffer.width { - return - } - if y < 0 || y >= back_buffer.height { - return - } - - back_buffer.cells[y*back_buffer.width+x] = Cell{ch, fg, bg} -} - -// Returns a slice into the termbox's back buffer. You can get its dimensions -// using 'Size' function. The slice remains valid as long as no 'Clear' or -// 'Flush' function calls were made after call to this function. -func CellBuffer() []Cell { - return back_buffer.cells -} - -// Wait for an event and return it. This is a blocking function call. -func PollEvent() Event { - select { - case ev := <-input_comm: - return ev - case <-interrupt_comm: - return Event{Type: EventInterrupt} - } -} - -// Returns the size of the internal back buffer (which is mostly the same as -// console's window size in characters). But it doesn't always match the size -// of the console window, after the console size has changed, the internal back -// buffer will get in sync only after Clear or Flush function calls. -func Size() (int, int) { - return int(term_size.x), int(term_size.y) -} - -// Clears the internal back buffer. -func Clear(fg, bg Attribute) error { - foreground, background = fg, bg - update_size_maybe() - back_buffer.clear() - return nil -} - -// Sets termbox input mode. Termbox has two input modes: -// -// 1. Esc input mode. When ESC sequence is in the buffer and it doesn't match -// any known sequence. ESC means KeyEsc. This is the default input mode. -// -// 2. Alt input mode. When ESC sequence is in the buffer and it doesn't match -// any known sequence. ESC enables ModAlt modifier for the next keyboard event. -// -// Both input modes can be OR'ed with Mouse mode. Setting Mouse mode bit up will -// enable mouse button press/release and drag events. -// -// If 'mode' is InputCurrent, returns the current input mode. See also Input* -// constants. -func SetInputMode(mode InputMode) InputMode { - if mode == InputCurrent { - return input_mode - } - if mode&InputMouse != 0 { - err := set_console_mode(in, enable_window_input|enable_mouse_input|enable_extended_flags) - if err != nil { - panic(err) - } - } else { - err := set_console_mode(in, enable_window_input) - if err != nil { - panic(err) - } - } - - input_mode = mode - return input_mode -} - -// Sets the termbox output mode. -// -// Windows console does not support extra colour modes, -// so this will always set and return OutputNormal. -func SetOutputMode(mode OutputMode) OutputMode { - return OutputNormal -} - -// Sync comes handy when something causes desync between termbox's understanding -// of a terminal buffer and the reality. Such as a third party process. Sync -// forces a complete resync between the termbox and a terminal, it may not be -// visually pretty though. At the moment on Windows it does nothing. -func Sync() error { - return nil -} diff --git a/vendor/github.com/nsf/termbox-go/collect_terminfo.py b/vendor/github.com/nsf/termbox-go/collect_terminfo.py deleted file mode 100755 index 5e50975e63ab9..0000000000000 --- a/vendor/github.com/nsf/termbox-go/collect_terminfo.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python - -import sys, os, subprocess - -def escaped(s): - return repr(s)[1:-1] - -def tput(term, name): - try: - return subprocess.check_output(['tput', '-T%s' % term, name]).decode() - except subprocess.CalledProcessError as e: - return e.output.decode() - - -def w(s): - if s == None: - return - sys.stdout.write(s) - -terminals = { - 'xterm' : 'xterm', - 'rxvt-256color' : 'rxvt_256color', - 'rxvt-unicode' : 'rxvt_unicode', - 'linux' : 'linux', - 'Eterm' : 'eterm', - 'screen' : 'screen' -} - -keys = [ - "F1", "kf1", - "F2", "kf2", - "F3", "kf3", - "F4", "kf4", - "F5", "kf5", - "F6", "kf6", - "F7", "kf7", - "F8", "kf8", - "F9", "kf9", - "F10", "kf10", - "F11", "kf11", - "F12", "kf12", - "INSERT", "kich1", - "DELETE", "kdch1", - "HOME", "khome", - "END", "kend", - "PGUP", "kpp", - "PGDN", "knp", - "KEY_UP", "kcuu1", - "KEY_DOWN", "kcud1", - "KEY_LEFT", "kcub1", - "KEY_RIGHT", "kcuf1" -] - -funcs = [ - "T_ENTER_CA", "smcup", - "T_EXIT_CA", "rmcup", - "T_SHOW_CURSOR", "cnorm", - "T_HIDE_CURSOR", "civis", - "T_CLEAR_SCREEN", "clear", - "T_SGR0", "sgr0", - "T_UNDERLINE", "smul", - "T_BOLD", "bold", - "T_BLINK", "blink", - "T_REVERSE", "rev", - "T_ENTER_KEYPAD", "smkx", - "T_EXIT_KEYPAD", "rmkx" -] - -def iter_pairs(iterable): - iterable = iter(iterable) - while True: - yield (next(iterable), next(iterable)) - -def do_term(term, nick): - w("// %s\n" % term) - w("var %s_keys = []string{\n\t" % nick) - for k, v in iter_pairs(keys): - w('"') - w(escaped(tput(term, v))) - w('",') - w("\n}\n") - w("var %s_funcs = []string{\n\t" % nick) - for k,v in iter_pairs(funcs): - w('"') - if v == "sgr": - w("\\033[3%d;4%dm") - elif v == "cup": - w("\\033[%d;%dH") - else: - w(escaped(tput(term, v))) - w('", ') - w("\n}\n\n") - -def do_terms(d): - w("var terms = []struct {\n") - w("\tname string\n") - w("\tkeys []string\n") - w("\tfuncs []string\n") - w("}{\n") - for k, v in d.items(): - w('\t{"%s", %s_keys, %s_funcs},\n' % (k, v, v)) - w("}\n\n") - -w("// +build !windows\n\npackage termbox\n\n") - -for k,v in terminals.items(): - do_term(k, v) - -do_terms(terminals) - diff --git a/vendor/github.com/nsf/termbox-go/syscalls.go b/vendor/github.com/nsf/termbox-go/syscalls.go deleted file mode 100644 index 4f52bb9af9a18..0000000000000 --- a/vendor/github.com/nsf/termbox-go/syscalls.go +++ /dev/null @@ -1,39 +0,0 @@ -// +build ignore - -package termbox - -/* -#include -#include -*/ -import "C" - -type syscall_Termios C.struct_termios - -const ( - syscall_IGNBRK = C.IGNBRK - syscall_BRKINT = C.BRKINT - syscall_PARMRK = C.PARMRK - syscall_ISTRIP = C.ISTRIP - syscall_INLCR = C.INLCR - syscall_IGNCR = C.IGNCR - syscall_ICRNL = C.ICRNL - syscall_IXON = C.IXON - syscall_OPOST = C.OPOST - syscall_ECHO = C.ECHO - syscall_ECHONL = C.ECHONL - syscall_ICANON = C.ICANON - syscall_ISIG = C.ISIG - syscall_IEXTEN = C.IEXTEN - syscall_CSIZE = C.CSIZE - syscall_PARENB = C.PARENB - syscall_CS8 = C.CS8 - syscall_VMIN = C.VMIN - syscall_VTIME = C.VTIME - - // on darwin change these to (on *bsd too?): - // C.TIOCGETA - // C.TIOCSETA - syscall_TCGETS = C.TCGETS - syscall_TCSETS = C.TCSETS -) diff --git a/vendor/github.com/nsf/termbox-go/syscalls_darwin.go b/vendor/github.com/nsf/termbox-go/syscalls_darwin.go deleted file mode 100644 index 25b78f7ab70b2..0000000000000 --- a/vendor/github.com/nsf/termbox-go/syscalls_darwin.go +++ /dev/null @@ -1,41 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs syscalls.go - -// +build !amd64 - -package termbox - -type syscall_Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} - -const ( - syscall_IGNBRK = 0x1 - syscall_BRKINT = 0x2 - syscall_PARMRK = 0x8 - syscall_ISTRIP = 0x20 - syscall_INLCR = 0x40 - syscall_IGNCR = 0x80 - syscall_ICRNL = 0x100 - syscall_IXON = 0x200 - syscall_OPOST = 0x1 - syscall_ECHO = 0x8 - syscall_ECHONL = 0x10 - syscall_ICANON = 0x100 - syscall_ISIG = 0x80 - syscall_IEXTEN = 0x400 - syscall_CSIZE = 0x300 - syscall_PARENB = 0x1000 - syscall_CS8 = 0x300 - syscall_VMIN = 0x10 - syscall_VTIME = 0x11 - - syscall_TCGETS = 0x402c7413 - syscall_TCSETS = 0x802c7414 -) diff --git a/vendor/github.com/nsf/termbox-go/syscalls_darwin_amd64.go b/vendor/github.com/nsf/termbox-go/syscalls_darwin_amd64.go deleted file mode 100644 index 11f25be79a4ba..0000000000000 --- a/vendor/github.com/nsf/termbox-go/syscalls_darwin_amd64.go +++ /dev/null @@ -1,40 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs syscalls.go - -package termbox - -type syscall_Termios struct { - Iflag uint64 - Oflag uint64 - Cflag uint64 - Lflag uint64 - Cc [20]uint8 - Pad_cgo_0 [4]byte - Ispeed uint64 - Ospeed uint64 -} - -const ( - syscall_IGNBRK = 0x1 - syscall_BRKINT = 0x2 - syscall_PARMRK = 0x8 - syscall_ISTRIP = 0x20 - syscall_INLCR = 0x40 - syscall_IGNCR = 0x80 - syscall_ICRNL = 0x100 - syscall_IXON = 0x200 - syscall_OPOST = 0x1 - syscall_ECHO = 0x8 - syscall_ECHONL = 0x10 - syscall_ICANON = 0x100 - syscall_ISIG = 0x80 - syscall_IEXTEN = 0x400 - syscall_CSIZE = 0x300 - syscall_PARENB = 0x1000 - syscall_CS8 = 0x300 - syscall_VMIN = 0x10 - syscall_VTIME = 0x11 - - syscall_TCGETS = 0x40487413 - syscall_TCSETS = 0x80487414 -) diff --git a/vendor/github.com/nsf/termbox-go/syscalls_dragonfly.go b/vendor/github.com/nsf/termbox-go/syscalls_dragonfly.go deleted file mode 100644 index e03624ebc71a7..0000000000000 --- a/vendor/github.com/nsf/termbox-go/syscalls_dragonfly.go +++ /dev/null @@ -1,39 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs syscalls.go - -package termbox - -type syscall_Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} - -const ( - syscall_IGNBRK = 0x1 - syscall_BRKINT = 0x2 - syscall_PARMRK = 0x8 - syscall_ISTRIP = 0x20 - syscall_INLCR = 0x40 - syscall_IGNCR = 0x80 - syscall_ICRNL = 0x100 - syscall_IXON = 0x200 - syscall_OPOST = 0x1 - syscall_ECHO = 0x8 - syscall_ECHONL = 0x10 - syscall_ICANON = 0x100 - syscall_ISIG = 0x80 - syscall_IEXTEN = 0x400 - syscall_CSIZE = 0x300 - syscall_PARENB = 0x1000 - syscall_CS8 = 0x300 - syscall_VMIN = 0x10 - syscall_VTIME = 0x11 - - syscall_TCGETS = 0x402c7413 - syscall_TCSETS = 0x802c7414 -) diff --git a/vendor/github.com/nsf/termbox-go/syscalls_freebsd.go b/vendor/github.com/nsf/termbox-go/syscalls_freebsd.go deleted file mode 100644 index e03624ebc71a7..0000000000000 --- a/vendor/github.com/nsf/termbox-go/syscalls_freebsd.go +++ /dev/null @@ -1,39 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs syscalls.go - -package termbox - -type syscall_Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} - -const ( - syscall_IGNBRK = 0x1 - syscall_BRKINT = 0x2 - syscall_PARMRK = 0x8 - syscall_ISTRIP = 0x20 - syscall_INLCR = 0x40 - syscall_IGNCR = 0x80 - syscall_ICRNL = 0x100 - syscall_IXON = 0x200 - syscall_OPOST = 0x1 - syscall_ECHO = 0x8 - syscall_ECHONL = 0x10 - syscall_ICANON = 0x100 - syscall_ISIG = 0x80 - syscall_IEXTEN = 0x400 - syscall_CSIZE = 0x300 - syscall_PARENB = 0x1000 - syscall_CS8 = 0x300 - syscall_VMIN = 0x10 - syscall_VTIME = 0x11 - - syscall_TCGETS = 0x402c7413 - syscall_TCSETS = 0x802c7414 -) diff --git a/vendor/github.com/nsf/termbox-go/syscalls_linux.go b/vendor/github.com/nsf/termbox-go/syscalls_linux.go deleted file mode 100644 index b88960de617c3..0000000000000 --- a/vendor/github.com/nsf/termbox-go/syscalls_linux.go +++ /dev/null @@ -1,33 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs syscalls.go - -package termbox - -import "syscall" - -type syscall_Termios syscall.Termios - -const ( - syscall_IGNBRK = syscall.IGNBRK - syscall_BRKINT = syscall.BRKINT - syscall_PARMRK = syscall.PARMRK - syscall_ISTRIP = syscall.ISTRIP - syscall_INLCR = syscall.INLCR - syscall_IGNCR = syscall.IGNCR - syscall_ICRNL = syscall.ICRNL - syscall_IXON = syscall.IXON - syscall_OPOST = syscall.OPOST - syscall_ECHO = syscall.ECHO - syscall_ECHONL = syscall.ECHONL - syscall_ICANON = syscall.ICANON - syscall_ISIG = syscall.ISIG - syscall_IEXTEN = syscall.IEXTEN - syscall_CSIZE = syscall.CSIZE - syscall_PARENB = syscall.PARENB - syscall_CS8 = syscall.CS8 - syscall_VMIN = syscall.VMIN - syscall_VTIME = syscall.VTIME - - syscall_TCGETS = syscall.TCGETS - syscall_TCSETS = syscall.TCSETS -) diff --git a/vendor/github.com/nsf/termbox-go/syscalls_netbsd.go b/vendor/github.com/nsf/termbox-go/syscalls_netbsd.go deleted file mode 100644 index 49a3355b9a2dd..0000000000000 --- a/vendor/github.com/nsf/termbox-go/syscalls_netbsd.go +++ /dev/null @@ -1,39 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs syscalls.go - -package termbox - -type syscall_Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed int32 - Ospeed int32 -} - -const ( - syscall_IGNBRK = 0x1 - syscall_BRKINT = 0x2 - syscall_PARMRK = 0x8 - syscall_ISTRIP = 0x20 - syscall_INLCR = 0x40 - syscall_IGNCR = 0x80 - syscall_ICRNL = 0x100 - syscall_IXON = 0x200 - syscall_OPOST = 0x1 - syscall_ECHO = 0x8 - syscall_ECHONL = 0x10 - syscall_ICANON = 0x100 - syscall_ISIG = 0x80 - syscall_IEXTEN = 0x400 - syscall_CSIZE = 0x300 - syscall_PARENB = 0x1000 - syscall_CS8 = 0x300 - syscall_VMIN = 0x10 - syscall_VTIME = 0x11 - - syscall_TCGETS = 0x402c7413 - syscall_TCSETS = 0x802c7414 -) diff --git a/vendor/github.com/nsf/termbox-go/syscalls_openbsd.go b/vendor/github.com/nsf/termbox-go/syscalls_openbsd.go deleted file mode 100644 index 49a3355b9a2dd..0000000000000 --- a/vendor/github.com/nsf/termbox-go/syscalls_openbsd.go +++ /dev/null @@ -1,39 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs syscalls.go - -package termbox - -type syscall_Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed int32 - Ospeed int32 -} - -const ( - syscall_IGNBRK = 0x1 - syscall_BRKINT = 0x2 - syscall_PARMRK = 0x8 - syscall_ISTRIP = 0x20 - syscall_INLCR = 0x40 - syscall_IGNCR = 0x80 - syscall_ICRNL = 0x100 - syscall_IXON = 0x200 - syscall_OPOST = 0x1 - syscall_ECHO = 0x8 - syscall_ECHONL = 0x10 - syscall_ICANON = 0x100 - syscall_ISIG = 0x80 - syscall_IEXTEN = 0x400 - syscall_CSIZE = 0x300 - syscall_PARENB = 0x1000 - syscall_CS8 = 0x300 - syscall_VMIN = 0x10 - syscall_VTIME = 0x11 - - syscall_TCGETS = 0x402c7413 - syscall_TCSETS = 0x802c7414 -) diff --git a/vendor/github.com/nsf/termbox-go/syscalls_windows.go b/vendor/github.com/nsf/termbox-go/syscalls_windows.go deleted file mode 100644 index 472d002a56aa6..0000000000000 --- a/vendor/github.com/nsf/termbox-go/syscalls_windows.go +++ /dev/null @@ -1,61 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs -- -DUNICODE syscalls.go - -package termbox - -const ( - foreground_blue = 0x1 - foreground_green = 0x2 - foreground_red = 0x4 - foreground_intensity = 0x8 - background_blue = 0x10 - background_green = 0x20 - background_red = 0x40 - background_intensity = 0x80 - std_input_handle = -0xa - std_output_handle = -0xb - key_event = 0x1 - mouse_event = 0x2 - window_buffer_size_event = 0x4 - enable_window_input = 0x8 - enable_mouse_input = 0x10 - enable_extended_flags = 0x80 - - vk_f1 = 0x70 - vk_f2 = 0x71 - vk_f3 = 0x72 - vk_f4 = 0x73 - vk_f5 = 0x74 - vk_f6 = 0x75 - vk_f7 = 0x76 - vk_f8 = 0x77 - vk_f9 = 0x78 - vk_f10 = 0x79 - vk_f11 = 0x7a - vk_f12 = 0x7b - vk_insert = 0x2d - vk_delete = 0x2e - vk_home = 0x24 - vk_end = 0x23 - vk_pgup = 0x21 - vk_pgdn = 0x22 - vk_arrow_up = 0x26 - vk_arrow_down = 0x28 - vk_arrow_left = 0x25 - vk_arrow_right = 0x27 - vk_backspace = 0x8 - vk_tab = 0x9 - vk_enter = 0xd - vk_esc = 0x1b - vk_space = 0x20 - - left_alt_pressed = 0x2 - left_ctrl_pressed = 0x8 - right_alt_pressed = 0x1 - right_ctrl_pressed = 0x4 - shift_pressed = 0x10 - - generic_read = 0x80000000 - generic_write = 0x40000000 - console_textmode_buffer = 0x1 -) diff --git a/vendor/github.com/nsf/termbox-go/termbox.go b/vendor/github.com/nsf/termbox-go/termbox.go deleted file mode 100644 index c2d86c6584e34..0000000000000 --- a/vendor/github.com/nsf/termbox-go/termbox.go +++ /dev/null @@ -1,511 +0,0 @@ -// +build !windows - -package termbox - -import "unicode/utf8" -import "bytes" -import "syscall" -import "unsafe" -import "strings" -import "strconv" -import "os" -import "io" - -// private API - -const ( - t_enter_ca = iota - t_exit_ca - t_show_cursor - t_hide_cursor - t_clear_screen - t_sgr0 - t_underline - t_bold - t_blink - t_reverse - t_enter_keypad - t_exit_keypad - t_enter_mouse - t_exit_mouse - t_max_funcs -) - -const ( - coord_invalid = -2 - attr_invalid = Attribute(0xFFFF) -) - -type input_event struct { - data []byte - err error -} - -var ( - // term specific sequences - keys []string - funcs []string - - // termbox inner state - orig_tios syscall_Termios - back_buffer cellbuf - front_buffer cellbuf - termw int - termh int - input_mode = InputEsc - output_mode = OutputNormal - out *os.File - in int - lastfg = attr_invalid - lastbg = attr_invalid - lastx = coord_invalid - lasty = coord_invalid - cursor_x = cursor_hidden - cursor_y = cursor_hidden - foreground = ColorDefault - background = ColorDefault - inbuf = make([]byte, 0, 64) - outbuf bytes.Buffer - sigwinch = make(chan os.Signal, 1) - sigio = make(chan os.Signal, 1) - quit = make(chan int) - input_comm = make(chan input_event) - interrupt_comm = make(chan struct{}) - intbuf = make([]byte, 0, 16) - - // grayscale indexes - grayscale = []Attribute{ - 0, 17, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 232, - } -) - -func write_cursor(x, y int) { - outbuf.WriteString("\033[") - outbuf.Write(strconv.AppendUint(intbuf, uint64(y+1), 10)) - outbuf.WriteString(";") - outbuf.Write(strconv.AppendUint(intbuf, uint64(x+1), 10)) - outbuf.WriteString("H") -} - -func write_sgr_fg(a Attribute) { - switch output_mode { - case Output256, Output216, OutputGrayscale: - outbuf.WriteString("\033[38;5;") - outbuf.Write(strconv.AppendUint(intbuf, uint64(a-1), 10)) - outbuf.WriteString("m") - default: - outbuf.WriteString("\033[3") - outbuf.Write(strconv.AppendUint(intbuf, uint64(a-1), 10)) - outbuf.WriteString("m") - } -} - -func write_sgr_bg(a Attribute) { - switch output_mode { - case Output256, Output216, OutputGrayscale: - outbuf.WriteString("\033[48;5;") - outbuf.Write(strconv.AppendUint(intbuf, uint64(a-1), 10)) - outbuf.WriteString("m") - default: - outbuf.WriteString("\033[4") - outbuf.Write(strconv.AppendUint(intbuf, uint64(a-1), 10)) - outbuf.WriteString("m") - } -} - -func write_sgr(fg, bg Attribute) { - switch output_mode { - case Output256, Output216, OutputGrayscale: - outbuf.WriteString("\033[38;5;") - outbuf.Write(strconv.AppendUint(intbuf, uint64(fg-1), 10)) - outbuf.WriteString("m") - outbuf.WriteString("\033[48;5;") - outbuf.Write(strconv.AppendUint(intbuf, uint64(bg-1), 10)) - outbuf.WriteString("m") - default: - outbuf.WriteString("\033[3") - outbuf.Write(strconv.AppendUint(intbuf, uint64(fg-1), 10)) - outbuf.WriteString(";4") - outbuf.Write(strconv.AppendUint(intbuf, uint64(bg-1), 10)) - outbuf.WriteString("m") - } -} - -type winsize struct { - rows uint16 - cols uint16 - xpixels uint16 - ypixels uint16 -} - -func get_term_size(fd uintptr) (int, int) { - var sz winsize - _, _, _ = syscall.Syscall(syscall.SYS_IOCTL, - fd, uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&sz))) - return int(sz.cols), int(sz.rows) -} - -func send_attr(fg, bg Attribute) { - if fg == lastfg && bg == lastbg { - return - } - - outbuf.WriteString(funcs[t_sgr0]) - - var fgcol, bgcol Attribute - - switch output_mode { - case Output256: - fgcol = fg & 0x1FF - bgcol = bg & 0x1FF - case Output216: - fgcol = fg & 0xFF - bgcol = bg & 0xFF - if fgcol > 216 { - fgcol = ColorDefault - } - if bgcol > 216 { - bgcol = ColorDefault - } - if fgcol != ColorDefault { - fgcol += 0x10 - } - if bgcol != ColorDefault { - bgcol += 0x10 - } - case OutputGrayscale: - fgcol = fg & 0x1F - bgcol = bg & 0x1F - if fgcol > 26 { - fgcol = ColorDefault - } - if bgcol > 26 { - bgcol = ColorDefault - } - if fgcol != ColorDefault { - fgcol = grayscale[fgcol] - } - if bgcol != ColorDefault { - bgcol = grayscale[bgcol] - } - default: - fgcol = fg & 0x0F - bgcol = bg & 0x0F - } - - if fgcol != ColorDefault { - if bgcol != ColorDefault { - write_sgr(fgcol, bgcol) - } else { - write_sgr_fg(fgcol) - } - } else if bgcol != ColorDefault { - write_sgr_bg(bgcol) - } - - if fg&AttrBold != 0 { - outbuf.WriteString(funcs[t_bold]) - } - if bg&AttrBold != 0 { - outbuf.WriteString(funcs[t_blink]) - } - if fg&AttrUnderline != 0 { - outbuf.WriteString(funcs[t_underline]) - } - if fg&AttrReverse|bg&AttrReverse != 0 { - outbuf.WriteString(funcs[t_reverse]) - } - - lastfg, lastbg = fg, bg -} - -func send_char(x, y int, ch rune) { - var buf [8]byte - n := utf8.EncodeRune(buf[:], ch) - if x-1 != lastx || y != lasty { - write_cursor(x, y) - } - lastx, lasty = x, y - outbuf.Write(buf[:n]) -} - -func flush() error { - _, err := io.Copy(out, &outbuf) - outbuf.Reset() - return err -} - -func send_clear() error { - send_attr(foreground, background) - outbuf.WriteString(funcs[t_clear_screen]) - if !is_cursor_hidden(cursor_x, cursor_y) { - write_cursor(cursor_x, cursor_y) - } - - // we need to invalidate cursor position too and these two vars are - // used only for simple cursor positioning optimization, cursor - // actually may be in the correct place, but we simply discard - // optimization once and it gives us simple solution for the case when - // cursor moved - lastx = coord_invalid - lasty = coord_invalid - - return flush() -} - -func update_size_maybe() error { - w, h := get_term_size(out.Fd()) - if w != termw || h != termh { - termw, termh = w, h - back_buffer.resize(termw, termh) - front_buffer.resize(termw, termh) - front_buffer.clear() - return send_clear() - } - return nil -} - -func tcsetattr(fd uintptr, termios *syscall_Termios) error { - r, _, e := syscall.Syscall(syscall.SYS_IOCTL, - fd, uintptr(syscall_TCSETS), uintptr(unsafe.Pointer(termios))) - if r != 0 { - return os.NewSyscallError("SYS_IOCTL", e) - } - return nil -} - -func tcgetattr(fd uintptr, termios *syscall_Termios) error { - r, _, e := syscall.Syscall(syscall.SYS_IOCTL, - fd, uintptr(syscall_TCGETS), uintptr(unsafe.Pointer(termios))) - if r != 0 { - return os.NewSyscallError("SYS_IOCTL", e) - } - return nil -} - -func parse_mouse_event(event *Event, buf string) (int, bool) { - if strings.HasPrefix(buf, "\033[M") && len(buf) >= 6 { - // X10 mouse encoding, the simplest one - // \033 [ M Cb Cx Cy - b := buf[3] - 32 - switch b & 3 { - case 0: - if b&64 != 0 { - event.Key = MouseWheelUp - } else { - event.Key = MouseLeft - } - case 1: - if b&64 != 0 { - event.Key = MouseWheelDown - } else { - event.Key = MouseMiddle - } - case 2: - event.Key = MouseRight - case 3: - event.Key = MouseRelease - default: - return 6, false - } - event.Type = EventMouse // KeyEvent by default - if b&32 != 0 { - event.Mod |= ModMotion - } - - // the coord is 1,1 for upper left - event.MouseX = int(buf[4]) - 1 - 32 - event.MouseY = int(buf[5]) - 1 - 32 - return 6, true - } else if strings.HasPrefix(buf, "\033[<") || strings.HasPrefix(buf, "\033[") { - // xterm 1006 extended mode or urxvt 1015 extended mode - // xterm: \033 [ < Cb ; Cx ; Cy (M or m) - // urxvt: \033 [ Cb ; Cx ; Cy M - - // find the first M or m, that's where we stop - mi := strings.IndexAny(buf, "Mm") - if mi == -1 { - return 0, false - } - - // whether it's a capital M or not - isM := buf[mi] == 'M' - - // whether it's urxvt or not - isU := false - - // buf[2] is safe here, because having M or m found means we have at - // least 3 bytes in a string - if buf[2] == '<' { - buf = buf[3:mi] - } else { - isU = true - buf = buf[2:mi] - } - - s1 := strings.Index(buf, ";") - s2 := strings.LastIndex(buf, ";") - // not found or only one ';' - if s1 == -1 || s2 == -1 || s1 == s2 { - return 0, false - } - - n1, err := strconv.ParseInt(buf[0:s1], 10, 64) - if err != nil { - return 0, false - } - n2, err := strconv.ParseInt(buf[s1+1:s2], 10, 64) - if err != nil { - return 0, false - } - n3, err := strconv.ParseInt(buf[s2+1:], 10, 64) - if err != nil { - return 0, false - } - - // on urxvt, first number is encoded exactly as in X10, but we need to - // make it zero-based, on xterm it is zero-based already - if isU { - n1 -= 32 - } - switch n1 & 3 { - case 0: - if n1&64 != 0 { - event.Key = MouseWheelUp - } else { - event.Key = MouseLeft - } - case 1: - if n1&64 != 0 { - event.Key = MouseWheelDown - } else { - event.Key = MouseMiddle - } - case 2: - event.Key = MouseRight - case 3: - event.Key = MouseRelease - default: - return mi + 1, false - } - if !isM { - // on xterm mouse release is signaled by lowercase m - event.Key = MouseRelease - } - - event.Type = EventMouse // KeyEvent by default - if n1&32 != 0 { - event.Mod |= ModMotion - } - - event.MouseX = int(n2) - 1 - event.MouseY = int(n3) - 1 - return mi + 1, true - } - - return 0, false -} - -func parse_escape_sequence(event *Event, buf []byte) (int, bool) { - bufstr := string(buf) - for i, key := range keys { - if strings.HasPrefix(bufstr, key) { - event.Ch = 0 - event.Key = Key(0xFFFF - i) - return len(key), true - } - } - - // if none of the keys match, let's try mouse seqences - return parse_mouse_event(event, bufstr) -} - -func extract_raw_event(data []byte, event *Event) bool { - if len(inbuf) == 0 { - return false - } - - n := len(data) - if n == 0 { - return false - } - - n = copy(data, inbuf) - copy(inbuf, inbuf[n:]) - inbuf = inbuf[:len(inbuf)-n] - - event.N = n - event.Type = EventRaw - return true -} - -func extract_event(inbuf []byte, event *Event) bool { - if len(inbuf) == 0 { - event.N = 0 - return false - } - - if inbuf[0] == '\033' { - // possible escape sequence - if n, ok := parse_escape_sequence(event, inbuf); n != 0 { - event.N = n - return ok - } - - // it's not escape sequence, then it's Alt or Esc, check input_mode - switch { - case input_mode&InputEsc != 0: - // if we're in escape mode, fill Esc event, pop buffer, return success - event.Ch = 0 - event.Key = KeyEsc - event.Mod = 0 - event.N = 1 - return true - case input_mode&InputAlt != 0: - // if we're in alt mode, set Alt modifier to event and redo parsing - event.Mod = ModAlt - ok := extract_event(inbuf[1:], event) - if ok { - event.N++ - } else { - event.N = 0 - } - return ok - default: - panic("unreachable") - } - } - - // if we're here, this is not an escape sequence and not an alt sequence - // so, it's a FUNCTIONAL KEY or a UNICODE character - - // first of all check if it's a functional key - if Key(inbuf[0]) <= KeySpace || Key(inbuf[0]) == KeyBackspace2 { - // fill event, pop buffer, return success - event.Ch = 0 - event.Key = Key(inbuf[0]) - event.N = 1 - return true - } - - // the only possible option is utf8 rune - if r, n := utf8.DecodeRune(inbuf); r != utf8.RuneError { - event.Ch = r - event.Key = 0 - event.N = n - return true - } - - return false -} - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r, _, e := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), uintptr(cmd), - uintptr(arg)) - val = int(r) - if e != 0 { - err = e - } - return -} diff --git a/vendor/github.com/nsf/termbox-go/termbox_common.go b/vendor/github.com/nsf/termbox-go/termbox_common.go deleted file mode 100644 index c3355cc25e38f..0000000000000 --- a/vendor/github.com/nsf/termbox-go/termbox_common.go +++ /dev/null @@ -1,59 +0,0 @@ -package termbox - -// private API, common OS agnostic part - -type cellbuf struct { - width int - height int - cells []Cell -} - -func (this *cellbuf) init(width, height int) { - this.width = width - this.height = height - this.cells = make([]Cell, width*height) -} - -func (this *cellbuf) resize(width, height int) { - if this.width == width && this.height == height { - return - } - - oldw := this.width - oldh := this.height - oldcells := this.cells - - this.init(width, height) - this.clear() - - minw, minh := oldw, oldh - - if width < minw { - minw = width - } - if height < minh { - minh = height - } - - for i := 0; i < minh; i++ { - srco, dsto := i*oldw, i*width - src := oldcells[srco : srco+minw] - dst := this.cells[dsto : dsto+minw] - copy(dst, src) - } -} - -func (this *cellbuf) clear() { - for i := range this.cells { - c := &this.cells[i] - c.Ch = ' ' - c.Fg = foreground - c.Bg = background - } -} - -const cursor_hidden = -1 - -func is_cursor_hidden(x, y int) bool { - return x == cursor_hidden || y == cursor_hidden -} diff --git a/vendor/github.com/nsf/termbox-go/termbox_windows.go b/vendor/github.com/nsf/termbox-go/termbox_windows.go deleted file mode 100644 index f7dad7b8a5fbf..0000000000000 --- a/vendor/github.com/nsf/termbox-go/termbox_windows.go +++ /dev/null @@ -1,856 +0,0 @@ -package termbox - -import "syscall" -import "unsafe" -import "unicode/utf16" -import "github.com/mattn/go-runewidth" - -type ( - wchar uint16 - short int16 - dword uint32 - word uint16 - char_info struct { - char wchar - attr word - } - coord struct { - x short - y short - } - small_rect struct { - left short - top short - right short - bottom short - } - console_screen_buffer_info struct { - size coord - cursor_position coord - attributes word - window small_rect - maximum_window_size coord - } - console_cursor_info struct { - size dword - visible int32 - } - input_record struct { - event_type word - _ [2]byte - event [16]byte - } - key_event_record struct { - key_down int32 - repeat_count word - virtual_key_code word - virtual_scan_code word - unicode_char wchar - control_key_state dword - } - window_buffer_size_record struct { - size coord - } - mouse_event_record struct { - mouse_pos coord - button_state dword - control_key_state dword - event_flags dword - } -) - -const ( - mouse_lmb = 0x1 - mouse_rmb = 0x2 - mouse_mmb = 0x4 | 0x8 | 0x10 -) - -func (this coord) uintptr() uintptr { - return uintptr(*(*int32)(unsafe.Pointer(&this))) -} - -var kernel32 = syscall.NewLazyDLL("kernel32.dll") -var is_cjk = runewidth.IsEastAsian() - -var ( - proc_set_console_active_screen_buffer = kernel32.NewProc("SetConsoleActiveScreenBuffer") - proc_set_console_screen_buffer_size = kernel32.NewProc("SetConsoleScreenBufferSize") - proc_create_console_screen_buffer = kernel32.NewProc("CreateConsoleScreenBuffer") - proc_get_console_screen_buffer_info = kernel32.NewProc("GetConsoleScreenBufferInfo") - proc_write_console_output = kernel32.NewProc("WriteConsoleOutputW") - proc_write_console_output_character = kernel32.NewProc("WriteConsoleOutputCharacterW") - proc_write_console_output_attribute = kernel32.NewProc("WriteConsoleOutputAttribute") - proc_set_console_cursor_info = kernel32.NewProc("SetConsoleCursorInfo") - proc_set_console_cursor_position = kernel32.NewProc("SetConsoleCursorPosition") - proc_get_console_cursor_info = kernel32.NewProc("GetConsoleCursorInfo") - proc_read_console_input = kernel32.NewProc("ReadConsoleInputW") - proc_get_console_mode = kernel32.NewProc("GetConsoleMode") - proc_set_console_mode = kernel32.NewProc("SetConsoleMode") - proc_fill_console_output_character = kernel32.NewProc("FillConsoleOutputCharacterW") - proc_fill_console_output_attribute = kernel32.NewProc("FillConsoleOutputAttribute") - proc_create_event = kernel32.NewProc("CreateEventW") - proc_wait_for_multiple_objects = kernel32.NewProc("WaitForMultipleObjects") - proc_set_event = kernel32.NewProc("SetEvent") -) - -func set_console_active_screen_buffer(h syscall.Handle) (err error) { - r0, _, e1 := syscall.Syscall(proc_set_console_active_screen_buffer.Addr(), - 1, uintptr(h), 0, 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func set_console_screen_buffer_size(h syscall.Handle, size coord) (err error) { - r0, _, e1 := syscall.Syscall(proc_set_console_screen_buffer_size.Addr(), - 2, uintptr(h), size.uintptr(), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func create_console_screen_buffer() (h syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall6(proc_create_console_screen_buffer.Addr(), - 5, uintptr(generic_read|generic_write), 0, 0, console_textmode_buffer, 0, 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return syscall.Handle(r0), err -} - -func get_console_screen_buffer_info(h syscall.Handle, info *console_screen_buffer_info) (err error) { - r0, _, e1 := syscall.Syscall(proc_get_console_screen_buffer_info.Addr(), - 2, uintptr(h), uintptr(unsafe.Pointer(info)), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func write_console_output(h syscall.Handle, chars []char_info, dst small_rect) (err error) { - tmp_coord = coord{dst.right - dst.left + 1, dst.bottom - dst.top + 1} - tmp_rect = dst - r0, _, e1 := syscall.Syscall6(proc_write_console_output.Addr(), - 5, uintptr(h), uintptr(unsafe.Pointer(&chars[0])), tmp_coord.uintptr(), - tmp_coord0.uintptr(), uintptr(unsafe.Pointer(&tmp_rect)), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func write_console_output_character(h syscall.Handle, chars []wchar, pos coord) (err error) { - r0, _, e1 := syscall.Syscall6(proc_write_console_output_character.Addr(), - 5, uintptr(h), uintptr(unsafe.Pointer(&chars[0])), uintptr(len(chars)), - pos.uintptr(), uintptr(unsafe.Pointer(&tmp_arg)), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func write_console_output_attribute(h syscall.Handle, attrs []word, pos coord) (err error) { - r0, _, e1 := syscall.Syscall6(proc_write_console_output_attribute.Addr(), - 5, uintptr(h), uintptr(unsafe.Pointer(&attrs[0])), uintptr(len(attrs)), - pos.uintptr(), uintptr(unsafe.Pointer(&tmp_arg)), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func set_console_cursor_info(h syscall.Handle, info *console_cursor_info) (err error) { - r0, _, e1 := syscall.Syscall(proc_set_console_cursor_info.Addr(), - 2, uintptr(h), uintptr(unsafe.Pointer(info)), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func get_console_cursor_info(h syscall.Handle, info *console_cursor_info) (err error) { - r0, _, e1 := syscall.Syscall(proc_get_console_cursor_info.Addr(), - 2, uintptr(h), uintptr(unsafe.Pointer(info)), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func set_console_cursor_position(h syscall.Handle, pos coord) (err error) { - r0, _, e1 := syscall.Syscall(proc_set_console_cursor_position.Addr(), - 2, uintptr(h), pos.uintptr(), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func read_console_input(h syscall.Handle, record *input_record) (err error) { - r0, _, e1 := syscall.Syscall6(proc_read_console_input.Addr(), - 4, uintptr(h), uintptr(unsafe.Pointer(record)), 1, uintptr(unsafe.Pointer(&tmp_arg)), 0, 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func get_console_mode(h syscall.Handle, mode *dword) (err error) { - r0, _, e1 := syscall.Syscall(proc_get_console_mode.Addr(), - 2, uintptr(h), uintptr(unsafe.Pointer(mode)), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func set_console_mode(h syscall.Handle, mode dword) (err error) { - r0, _, e1 := syscall.Syscall(proc_set_console_mode.Addr(), - 2, uintptr(h), uintptr(mode), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func fill_console_output_character(h syscall.Handle, char wchar, n int) (err error) { - r0, _, e1 := syscall.Syscall6(proc_fill_console_output_character.Addr(), - 5, uintptr(h), uintptr(char), uintptr(n), tmp_coord.uintptr(), - uintptr(unsafe.Pointer(&tmp_arg)), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func fill_console_output_attribute(h syscall.Handle, attr word, n int) (err error) { - r0, _, e1 := syscall.Syscall6(proc_fill_console_output_attribute.Addr(), - 5, uintptr(h), uintptr(attr), uintptr(n), tmp_coord.uintptr(), - uintptr(unsafe.Pointer(&tmp_arg)), 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func create_event() (out syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall6(proc_create_event.Addr(), - 4, 0, 0, 0, 0, 0, 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return syscall.Handle(r0), err -} - -func wait_for_multiple_objects(objects []syscall.Handle) (err error) { - r0, _, e1 := syscall.Syscall6(proc_wait_for_multiple_objects.Addr(), - 4, uintptr(len(objects)), uintptr(unsafe.Pointer(&objects[0])), - 0, 0xFFFFFFFF, 0, 0) - if uint32(r0) == 0xFFFFFFFF { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func set_event(ev syscall.Handle) (err error) { - r0, _, e1 := syscall.Syscall(proc_set_event.Addr(), - 1, uintptr(ev), 0, 0) - if int(r0) == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -type diff_msg struct { - pos short - lines short - chars []char_info -} - -type input_event struct { - event Event - err error -} - -var ( - orig_cursor_info console_cursor_info - orig_size coord - orig_mode dword - orig_screen syscall.Handle - back_buffer cellbuf - front_buffer cellbuf - term_size coord - input_mode = InputEsc - cursor_x = cursor_hidden - cursor_y = cursor_hidden - foreground = ColorDefault - background = ColorDefault - in syscall.Handle - out syscall.Handle - interrupt syscall.Handle - charbuf []char_info - diffbuf []diff_msg - beg_x = -1 - beg_y = -1 - beg_i = -1 - input_comm = make(chan Event) - interrupt_comm = make(chan struct{}) - cancel_comm = make(chan bool, 1) - cancel_done_comm = make(chan bool) - alt_mode_esc = false - - // these ones just to prevent heap allocs at all costs - tmp_info console_screen_buffer_info - tmp_arg dword - tmp_coord0 = coord{0, 0} - tmp_coord = coord{0, 0} - tmp_rect = small_rect{0, 0, 0, 0} -) - -func get_cursor_position(out syscall.Handle) coord { - err := get_console_screen_buffer_info(out, &tmp_info) - if err != nil { - panic(err) - } - return tmp_info.cursor_position -} - -func get_term_size(out syscall.Handle) coord { - err := get_console_screen_buffer_info(out, &tmp_info) - if err != nil { - panic(err) - } - return tmp_info.size -} - -func get_win_size(out syscall.Handle) coord { - err := get_console_screen_buffer_info(out, &tmp_info) - if err != nil { - panic(err) - } - return coord{ - x: tmp_info.window.right - tmp_info.window.left + 1, - y: tmp_info.window.bottom - tmp_info.window.top + 1, - } -} - -func update_size_maybe() { - size := get_term_size(out) - if size.x != term_size.x || size.y != term_size.y { - term_size = size - back_buffer.resize(int(size.x), int(size.y)) - front_buffer.resize(int(size.x), int(size.y)) - front_buffer.clear() - clear() - - area := int(size.x) * int(size.y) - if cap(charbuf) < area { - charbuf = make([]char_info, 0, area) - } - } -} - -var color_table_bg = []word{ - 0, // default (black) - 0, // black - background_red, - background_green, - background_red | background_green, // yellow - background_blue, - background_red | background_blue, // magenta - background_green | background_blue, // cyan - background_red | background_blue | background_green, // white -} - -var color_table_fg = []word{ - foreground_red | foreground_blue | foreground_green, // default (white) - 0, - foreground_red, - foreground_green, - foreground_red | foreground_green, // yellow - foreground_blue, - foreground_red | foreground_blue, // magenta - foreground_green | foreground_blue, // cyan - foreground_red | foreground_blue | foreground_green, // white -} - -const ( - replacement_char = '\uFFFD' - max_rune = '\U0010FFFF' - surr1 = 0xd800 - surr2 = 0xdc00 - surr3 = 0xe000 - surr_self = 0x10000 -) - -func append_diff_line(y int) int { - n := 0 - for x := 0; x < front_buffer.width; { - cell_offset := y*front_buffer.width + x - back := &back_buffer.cells[cell_offset] - front := &front_buffer.cells[cell_offset] - attr, char := cell_to_char_info(*back) - charbuf = append(charbuf, char_info{attr: attr, char: char[0]}) - *front = *back - n++ - w := runewidth.RuneWidth(back.Ch) - if w == 0 || w == 2 && runewidth.IsAmbiguousWidth(back.Ch) { - w = 1 - } - x += w - // If not CJK, fill trailing space with whitespace - if !is_cjk && w == 2 { - charbuf = append(charbuf, char_info{attr: attr, char: ' '}) - } - } - return n -} - -// compares 'back_buffer' with 'front_buffer' and prepares all changes in the form of -// 'diff_msg's in the 'diff_buf' -func prepare_diff_messages() { - // clear buffers - diffbuf = diffbuf[:0] - charbuf = charbuf[:0] - - var diff diff_msg - gbeg := 0 - for y := 0; y < front_buffer.height; y++ { - same := true - line_offset := y * front_buffer.width - for x := 0; x < front_buffer.width; x++ { - cell_offset := line_offset + x - back := &back_buffer.cells[cell_offset] - front := &front_buffer.cells[cell_offset] - if *back != *front { - same = false - break - } - } - if same && diff.lines > 0 { - diffbuf = append(diffbuf, diff) - diff = diff_msg{} - } - if !same { - beg := len(charbuf) - end := beg + append_diff_line(y) - if diff.lines == 0 { - diff.pos = short(y) - gbeg = beg - } - diff.lines++ - diff.chars = charbuf[gbeg:end] - } - } - if diff.lines > 0 { - diffbuf = append(diffbuf, diff) - diff = diff_msg{} - } -} - -func get_ct(table []word, idx int) word { - idx = idx & 0x0F - if idx >= len(table) { - idx = len(table) - 1 - } - return table[idx] -} - -func cell_to_char_info(c Cell) (attr word, wc [2]wchar) { - attr = get_ct(color_table_fg, int(c.Fg)) | get_ct(color_table_bg, int(c.Bg)) - if c.Fg&AttrReverse|c.Bg&AttrReverse != 0 { - attr = (attr&0xF0)>>4 | (attr&0x0F)<<4 - } - if c.Fg&AttrBold != 0 { - attr |= foreground_intensity - } - if c.Bg&AttrBold != 0 { - attr |= background_intensity - } - - r0, r1 := utf16.EncodeRune(c.Ch) - if r0 == 0xFFFD { - wc[0] = wchar(c.Ch) - wc[1] = ' ' - } else { - wc[0] = wchar(r0) - wc[1] = wchar(r1) - } - return -} - -func move_cursor(x, y int) { - err := set_console_cursor_position(out, coord{short(x), short(y)}) - if err != nil { - panic(err) - } -} - -func show_cursor(visible bool) { - var v int32 - if visible { - v = 1 - } - - var info console_cursor_info - info.size = 100 - info.visible = v - err := set_console_cursor_info(out, &info) - if err != nil { - panic(err) - } -} - -func clear() { - var err error - attr, char := cell_to_char_info(Cell{ - ' ', - foreground, - background, - }) - - area := int(term_size.x) * int(term_size.y) - err = fill_console_output_attribute(out, attr, area) - if err != nil { - panic(err) - } - err = fill_console_output_character(out, char[0], area) - if err != nil { - panic(err) - } - if !is_cursor_hidden(cursor_x, cursor_y) { - move_cursor(cursor_x, cursor_y) - } -} - -func key_event_record_to_event(r *key_event_record) (Event, bool) { - if r.key_down == 0 { - return Event{}, false - } - - e := Event{Type: EventKey} - if input_mode&InputAlt != 0 { - if alt_mode_esc { - e.Mod = ModAlt - alt_mode_esc = false - } - if r.control_key_state&(left_alt_pressed|right_alt_pressed) != 0 { - e.Mod = ModAlt - } - } - - ctrlpressed := r.control_key_state&(left_ctrl_pressed|right_ctrl_pressed) != 0 - - if r.virtual_key_code >= vk_f1 && r.virtual_key_code <= vk_f12 { - switch r.virtual_key_code { - case vk_f1: - e.Key = KeyF1 - case vk_f2: - e.Key = KeyF2 - case vk_f3: - e.Key = KeyF3 - case vk_f4: - e.Key = KeyF4 - case vk_f5: - e.Key = KeyF5 - case vk_f6: - e.Key = KeyF6 - case vk_f7: - e.Key = KeyF7 - case vk_f8: - e.Key = KeyF8 - case vk_f9: - e.Key = KeyF9 - case vk_f10: - e.Key = KeyF10 - case vk_f11: - e.Key = KeyF11 - case vk_f12: - e.Key = KeyF12 - default: - panic("unreachable") - } - - return e, true - } - - if r.virtual_key_code <= vk_delete { - switch r.virtual_key_code { - case vk_insert: - e.Key = KeyInsert - case vk_delete: - e.Key = KeyDelete - case vk_home: - e.Key = KeyHome - case vk_end: - e.Key = KeyEnd - case vk_pgup: - e.Key = KeyPgup - case vk_pgdn: - e.Key = KeyPgdn - case vk_arrow_up: - e.Key = KeyArrowUp - case vk_arrow_down: - e.Key = KeyArrowDown - case vk_arrow_left: - e.Key = KeyArrowLeft - case vk_arrow_right: - e.Key = KeyArrowRight - case vk_backspace: - if ctrlpressed { - e.Key = KeyBackspace2 - } else { - e.Key = KeyBackspace - } - case vk_tab: - e.Key = KeyTab - case vk_enter: - e.Key = KeyEnter - case vk_esc: - switch { - case input_mode&InputEsc != 0: - e.Key = KeyEsc - case input_mode&InputAlt != 0: - alt_mode_esc = true - return Event{}, false - } - case vk_space: - if ctrlpressed { - // manual return here, because KeyCtrlSpace is zero - e.Key = KeyCtrlSpace - return e, true - } else { - e.Key = KeySpace - } - } - - if e.Key != 0 { - return e, true - } - } - - if ctrlpressed { - if Key(r.unicode_char) >= KeyCtrlA && Key(r.unicode_char) <= KeyCtrlRsqBracket { - e.Key = Key(r.unicode_char) - if input_mode&InputAlt != 0 && e.Key == KeyEsc { - alt_mode_esc = true - return Event{}, false - } - return e, true - } - switch r.virtual_key_code { - case 192, 50: - // manual return here, because KeyCtrl2 is zero - e.Key = KeyCtrl2 - return e, true - case 51: - if input_mode&InputAlt != 0 { - alt_mode_esc = true - return Event{}, false - } - e.Key = KeyCtrl3 - case 52: - e.Key = KeyCtrl4 - case 53: - e.Key = KeyCtrl5 - case 54: - e.Key = KeyCtrl6 - case 189, 191, 55: - e.Key = KeyCtrl7 - case 8, 56: - e.Key = KeyCtrl8 - } - - if e.Key != 0 { - return e, true - } - } - - if r.unicode_char != 0 { - e.Ch = rune(r.unicode_char) - return e, true - } - - return Event{}, false -} - -func input_event_producer() { - var r input_record - var err error - var last_button Key - var last_button_pressed Key - var last_state = dword(0) - var last_x, last_y = -1, -1 - handles := []syscall.Handle{in, interrupt} - for { - err = wait_for_multiple_objects(handles) - if err != nil { - input_comm <- Event{Type: EventError, Err: err} - } - - select { - case <-cancel_comm: - cancel_done_comm <- true - return - default: - } - - err = read_console_input(in, &r) - if err != nil { - input_comm <- Event{Type: EventError, Err: err} - } - - switch r.event_type { - case key_event: - kr := (*key_event_record)(unsafe.Pointer(&r.event)) - ev, ok := key_event_record_to_event(kr) - if ok { - for i := 0; i < int(kr.repeat_count); i++ { - input_comm <- ev - } - } - case window_buffer_size_event: - sr := *(*window_buffer_size_record)(unsafe.Pointer(&r.event)) - input_comm <- Event{ - Type: EventResize, - Width: int(sr.size.x), - Height: int(sr.size.y), - } - case mouse_event: - mr := *(*mouse_event_record)(unsafe.Pointer(&r.event)) - ev := Event{Type: EventMouse} - switch mr.event_flags { - case 0, 2: - // single or double click - cur_state := mr.button_state - switch { - case last_state&mouse_lmb == 0 && cur_state&mouse_lmb != 0: - last_button = MouseLeft - last_button_pressed = last_button - case last_state&mouse_rmb == 0 && cur_state&mouse_rmb != 0: - last_button = MouseRight - last_button_pressed = last_button - case last_state&mouse_mmb == 0 && cur_state&mouse_mmb != 0: - last_button = MouseMiddle - last_button_pressed = last_button - case last_state&mouse_lmb != 0 && cur_state&mouse_lmb == 0: - last_button = MouseRelease - case last_state&mouse_rmb != 0 && cur_state&mouse_rmb == 0: - last_button = MouseRelease - case last_state&mouse_mmb != 0 && cur_state&mouse_mmb == 0: - last_button = MouseRelease - default: - last_state = cur_state - continue - } - last_state = cur_state - ev.Key = last_button - last_x, last_y = int(mr.mouse_pos.x), int(mr.mouse_pos.y) - ev.MouseX = last_x - ev.MouseY = last_y - case 1: - // mouse motion - x, y := int(mr.mouse_pos.x), int(mr.mouse_pos.y) - if last_state != 0 && (last_x != x || last_y != y) { - ev.Key = last_button_pressed - ev.Mod = ModMotion - ev.MouseX = x - ev.MouseY = y - last_x, last_y = x, y - } else { - ev.Type = EventNone - } - case 4: - // mouse wheel - n := int16(mr.button_state >> 16) - if n > 0 { - ev.Key = MouseWheelUp - } else { - ev.Key = MouseWheelDown - } - last_x, last_y = int(mr.mouse_pos.x), int(mr.mouse_pos.y) - ev.MouseX = last_x - ev.MouseY = last_y - default: - ev.Type = EventNone - } - if ev.Type != EventNone { - input_comm <- ev - } - } - } -} diff --git a/vendor/github.com/nsf/termbox-go/terminfo.go b/vendor/github.com/nsf/termbox-go/terminfo.go deleted file mode 100644 index 35dbd70b8941b..0000000000000 --- a/vendor/github.com/nsf/termbox-go/terminfo.go +++ /dev/null @@ -1,221 +0,0 @@ -// +build !windows -// This file contains a simple and incomplete implementation of the terminfo -// database. Information was taken from the ncurses manpages term(5) and -// terminfo(5). Currently, only the string capabilities for special keys and for -// functions without parameters are actually used. Colors are still done with -// ANSI escape sequences. Other special features that are not (yet?) supported -// are reading from ~/.terminfo, the TERMINFO_DIRS variable, Berkeley database -// format and extended capabilities. - -package termbox - -import ( - "bytes" - "encoding/binary" - "encoding/hex" - "errors" - "fmt" - "io/ioutil" - "os" - "strings" -) - -const ( - ti_magic = 0432 - ti_header_length = 12 - ti_mouse_enter = "\x1b[?1000h\x1b[?1002h\x1b[?1015h\x1b[?1006h" - ti_mouse_leave = "\x1b[?1006l\x1b[?1015l\x1b[?1002l\x1b[?1000l" -) - -func load_terminfo() ([]byte, error) { - var data []byte - var err error - - term := os.Getenv("TERM") - if term == "" { - return nil, fmt.Errorf("termbox: TERM not set") - } - - // The following behaviour follows the one described in terminfo(5) as - // distributed by ncurses. - - terminfo := os.Getenv("TERMINFO") - if terminfo != "" { - // if TERMINFO is set, no other directory should be searched - return ti_try_path(terminfo) - } - - // next, consider ~/.terminfo - home := os.Getenv("HOME") - if home != "" { - data, err = ti_try_path(home + "/.terminfo") - if err == nil { - return data, nil - } - } - - // next, TERMINFO_DIRS - dirs := os.Getenv("TERMINFO_DIRS") - if dirs != "" { - for _, dir := range strings.Split(dirs, ":") { - if dir == "" { - // "" -> "/usr/share/terminfo" - dir = "/usr/share/terminfo" - } - data, err = ti_try_path(dir) - if err == nil { - return data, nil - } - } - } - - // fall back to /usr/share/terminfo - return ti_try_path("/usr/share/terminfo") -} - -func ti_try_path(path string) (data []byte, err error) { - // load_terminfo already made sure it is set - term := os.Getenv("TERM") - - // first try, the typical *nix path - terminfo := path + "/" + term[0:1] + "/" + term - data, err = ioutil.ReadFile(terminfo) - if err == nil { - return - } - - // fallback to darwin specific dirs structure - terminfo = path + "/" + hex.EncodeToString([]byte(term[:1])) + "/" + term - data, err = ioutil.ReadFile(terminfo) - return -} - -func setup_term_builtin() error { - name := os.Getenv("TERM") - if name == "" { - return errors.New("termbox: TERM environment variable not set") - } - - for _, t := range terms { - if t.name == name { - keys = t.keys - funcs = t.funcs - return nil - } - } - - compat_table := []struct { - partial string - keys []string - funcs []string - }{ - {"xterm", xterm_keys, xterm_funcs}, - {"rxvt", rxvt_unicode_keys, rxvt_unicode_funcs}, - {"linux", linux_keys, linux_funcs}, - {"Eterm", eterm_keys, eterm_funcs}, - {"screen", screen_keys, screen_funcs}, - // let's assume that 'cygwin' is xterm compatible - {"cygwin", xterm_keys, xterm_funcs}, - {"st", xterm_keys, xterm_funcs}, - } - - // try compatibility variants - for _, it := range compat_table { - if strings.Contains(name, it.partial) { - keys = it.keys - funcs = it.funcs - return nil - } - } - - return errors.New("termbox: unsupported terminal") -} - -func setup_term() (err error) { - var data []byte - var header [6]int16 - var str_offset, table_offset int16 - - data, err = load_terminfo() - if err != nil { - return setup_term_builtin() - } - - rd := bytes.NewReader(data) - // 0: magic number, 1: size of names section, 2: size of boolean section, 3: - // size of numbers section (in integers), 4: size of the strings section (in - // integers), 5: size of the string table - - err = binary.Read(rd, binary.LittleEndian, header[:]) - if err != nil { - return - } - - if (header[1]+header[2])%2 != 0 { - // old quirk to align everything on word boundaries - header[2] += 1 - } - str_offset = ti_header_length + header[1] + header[2] + 2*header[3] - table_offset = str_offset + 2*header[4] - - keys = make([]string, 0xFFFF-key_min) - for i, _ := range keys { - keys[i], err = ti_read_string(rd, str_offset+2*ti_keys[i], table_offset) - if err != nil { - return - } - } - funcs = make([]string, t_max_funcs) - // the last two entries are reserved for mouse. because the table offset is - // not there, the two entries have to fill in manually - for i, _ := range funcs[:len(funcs)-2] { - funcs[i], err = ti_read_string(rd, str_offset+2*ti_funcs[i], table_offset) - if err != nil { - return - } - } - funcs[t_max_funcs-2] = ti_mouse_enter - funcs[t_max_funcs-1] = ti_mouse_leave - return nil -} - -func ti_read_string(rd *bytes.Reader, str_off, table int16) (string, error) { - var off int16 - - _, err := rd.Seek(int64(str_off), 0) - if err != nil { - return "", err - } - err = binary.Read(rd, binary.LittleEndian, &off) - if err != nil { - return "", err - } - _, err = rd.Seek(int64(table+off), 0) - if err != nil { - return "", err - } - var bs []byte - for { - b, err := rd.ReadByte() - if err != nil { - return "", err - } - if b == byte(0x00) { - break - } - bs = append(bs, b) - } - return string(bs), nil -} - -// "Maps" the function constants from termbox.go to the number of the respective -// string capability in the terminfo file. Taken from (ncurses) term.h. -var ti_funcs = []int16{ - 28, 40, 16, 13, 5, 39, 36, 27, 26, 34, 89, 88, -} - -// Same as above for the special keys. -var ti_keys = []int16{ - 66, 68 /* apparently not a typo; 67 is F10 for whatever reason */, 69, 70, - 71, 72, 73, 74, 75, 67, 216, 217, 77, 59, 76, 164, 82, 81, 87, 61, 79, 83, -} diff --git a/vendor/github.com/nsf/termbox-go/terminfo_builtin.go b/vendor/github.com/nsf/termbox-go/terminfo_builtin.go deleted file mode 100644 index a94866067baed..0000000000000 --- a/vendor/github.com/nsf/termbox-go/terminfo_builtin.go +++ /dev/null @@ -1,64 +0,0 @@ -// +build !windows - -package termbox - -// Eterm -var eterm_keys = []string{ - "\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C", -} -var eterm_funcs = []string{ - "\x1b7\x1b[?47h", "\x1b[2J\x1b[?47l\x1b8", "\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b[m\x0f", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "", "", "", "", -} - -// screen -var screen_keys = []string{ - "\x1bOP", "\x1bOQ", "\x1bOR", "\x1bOS", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[1~", "\x1b[4~", "\x1b[5~", "\x1b[6~", "\x1bOA", "\x1bOB", "\x1bOD", "\x1bOC", -} -var screen_funcs = []string{ - "\x1b[?1049h", "\x1b[?1049l", "\x1b[34h\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[J", "\x1b[m\x0f", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b[?1h\x1b=", "\x1b[?1l\x1b>", ti_mouse_enter, ti_mouse_leave, -} - -// xterm -var xterm_keys = []string{ - "\x1bOP", "\x1bOQ", "\x1bOR", "\x1bOS", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1bOH", "\x1bOF", "\x1b[5~", "\x1b[6~", "\x1bOA", "\x1bOB", "\x1bOD", "\x1bOC", -} -var xterm_funcs = []string{ - "\x1b[?1049h", "\x1b[?1049l", "\x1b[?12l\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b(B\x1b[m", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b[?1h\x1b=", "\x1b[?1l\x1b>", ti_mouse_enter, ti_mouse_leave, -} - -// rxvt-unicode -var rxvt_unicode_keys = []string{ - "\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C", -} -var rxvt_unicode_funcs = []string{ - "\x1b[?1049h", "\x1b[r\x1b[?1049l", "\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b[m\x1b(B", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b=", "\x1b>", ti_mouse_enter, ti_mouse_leave, -} - -// linux -var linux_keys = []string{ - "\x1b[[A", "\x1b[[B", "\x1b[[C", "\x1b[[D", "\x1b[[E", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[1~", "\x1b[4~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C", -} -var linux_funcs = []string{ - "", "", "\x1b[?25h\x1b[?0c", "\x1b[?25l\x1b[?1c", "\x1b[H\x1b[J", "\x1b[0;10m", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "", "", "", "", -} - -// rxvt-256color -var rxvt_256color_keys = []string{ - "\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C", -} -var rxvt_256color_funcs = []string{ - "\x1b7\x1b[?47h", "\x1b[2J\x1b[?47l\x1b8", "\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b[m\x0f", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b=", "\x1b>", ti_mouse_enter, ti_mouse_leave, -} - -var terms = []struct { - name string - keys []string - funcs []string -}{ - {"Eterm", eterm_keys, eterm_funcs}, - {"screen", screen_keys, screen_funcs}, - {"xterm", xterm_keys, xterm_funcs}, - {"rxvt-unicode", rxvt_unicode_keys, rxvt_unicode_funcs}, - {"linux", linux_keys, linux_funcs}, - {"rxvt-256color", rxvt_256color_keys, rxvt_256color_funcs}, -} diff --git a/vendor/golang.org/x/net/.gitattributes b/vendor/golang.org/x/net/.gitattributes deleted file mode 100644 index d2f212e5da80c..0000000000000 --- a/vendor/golang.org/x/net/.gitattributes +++ /dev/null @@ -1,10 +0,0 @@ -# Treat all files in this repo as binary, with no git magic updating -# line endings. Windows users contributing to Go will need to use a -# modern version of git and editors capable of LF line endings. -# -# We'll prevent accidental CRLF line endings from entering the repo -# via the git-review gofmt checks. -# -# See golang.org/issue/9281 - -* -text diff --git a/vendor/golang.org/x/net/.gitignore b/vendor/golang.org/x/net/.gitignore deleted file mode 100644 index 8339fd61d3f41..0000000000000 --- a/vendor/golang.org/x/net/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Add no patterns to .hgignore except for files generated by the build. -last-change diff --git a/vendor/golang.org/x/net/AUTHORS b/vendor/golang.org/x/net/AUTHORS deleted file mode 100644 index 15167cd746c56..0000000000000 --- a/vendor/golang.org/x/net/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/net/CONTRIBUTING.md b/vendor/golang.org/x/net/CONTRIBUTING.md deleted file mode 100644 index 88dff59bc7d20..0000000000000 --- a/vendor/golang.org/x/net/CONTRIBUTING.md +++ /dev/null @@ -1,31 +0,0 @@ -# Contributing to Go - -Go is an open source project. - -It is the work of hundreds of contributors. We appreciate your help! - - -## Filing issues - -When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: - -1. What version of Go are you using (`go version`)? -2. What operating system and processor architecture are you using? -3. What did you do? -4. What did you expect to see? -5. What did you see instead? - -General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. -The gophers there will answer or ask you to file an issue if you've tripped over a bug. - -## Contributing code - -Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) -before sending patches. - -**We do not accept GitHub pull requests** -(we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). - -Unless otherwise noted, the Go source files are distributed under -the BSD-style license found in the LICENSE file. - diff --git a/vendor/golang.org/x/net/CONTRIBUTORS b/vendor/golang.org/x/net/CONTRIBUTORS deleted file mode 100644 index 1c4577e968061..0000000000000 --- a/vendor/golang.org/x/net/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/net/README b/vendor/golang.org/x/net/README deleted file mode 100644 index 6b13d8e505022..0000000000000 --- a/vendor/golang.org/x/net/README +++ /dev/null @@ -1,3 +0,0 @@ -This repository holds supplementary Go networking libraries. - -To submit changes to this repository, see http://golang.org/doc/contribute.html. diff --git a/vendor/golang.org/x/net/codereview.cfg b/vendor/golang.org/x/net/codereview.cfg deleted file mode 100644 index 3f8b14b64e83f..0000000000000 --- a/vendor/golang.org/x/net/codereview.cfg +++ /dev/null @@ -1 +0,0 @@ -issuerepo: golang/go diff --git a/vendor/golang.org/x/net/context/context.go b/vendor/golang.org/x/net/context/context.go index f143ed6a1eb06..a3c021d3f88e9 100644 --- a/vendor/golang.org/x/net/context/context.go +++ b/vendor/golang.org/x/net/context/context.go @@ -5,6 +5,8 @@ // Package context defines the Context type, which carries deadlines, // cancelation signals, and other request-scoped values across API boundaries // and between processes. +// As of Go 1.7 this package is available in the standard library under the +// name context. https://golang.org/pkg/context. // // Incoming requests to a server should create a Context, and outgoing calls to // servers should accept a Context. The chain of function calls between must @@ -36,103 +38,6 @@ // Contexts. package context // import "golang.org/x/net/context" -import "time" - -// A Context carries a deadline, a cancelation signal, and other values across -// API boundaries. -// -// Context's methods may be called by multiple goroutines simultaneously. -type Context interface { - // Deadline returns the time when work done on behalf of this context - // should be canceled. Deadline returns ok==false when no deadline is - // set. Successive calls to Deadline return the same results. - Deadline() (deadline time.Time, ok bool) - - // Done returns a channel that's closed when work done on behalf of this - // context should be canceled. Done may return nil if this context can - // never be canceled. Successive calls to Done return the same value. - // - // WithCancel arranges for Done to be closed when cancel is called; - // WithDeadline arranges for Done to be closed when the deadline - // expires; WithTimeout arranges for Done to be closed when the timeout - // elapses. - // - // Done is provided for use in select statements: - // - // // Stream generates values with DoSomething and sends them to out - // // until DoSomething returns an error or ctx.Done is closed. - // func Stream(ctx context.Context, out chan<- Value) error { - // for { - // v, err := DoSomething(ctx) - // if err != nil { - // return err - // } - // select { - // case <-ctx.Done(): - // return ctx.Err() - // case out <- v: - // } - // } - // } - // - // See http://blog.golang.org/pipelines for more examples of how to use - // a Done channel for cancelation. - Done() <-chan struct{} - - // Err returns a non-nil error value after Done is closed. Err returns - // Canceled if the context was canceled or DeadlineExceeded if the - // context's deadline passed. No other values for Err are defined. - // After Done is closed, successive calls to Err return the same value. - Err() error - - // Value returns the value associated with this context for key, or nil - // if no value is associated with key. Successive calls to Value with - // the same key returns the same result. - // - // Use context values only for request-scoped data that transits - // processes and API boundaries, not for passing optional parameters to - // functions. - // - // A key identifies a specific value in a Context. Functions that wish - // to store values in Context typically allocate a key in a global - // variable then use that key as the argument to context.WithValue and - // Context.Value. A key can be any type that supports equality; - // packages should define keys as an unexported type to avoid - // collisions. - // - // Packages that define a Context key should provide type-safe accessors - // for the values stores using that key: - // - // // Package user defines a User type that's stored in Contexts. - // package user - // - // import "golang.org/x/net/context" - // - // // User is the type of value stored in the Contexts. - // type User struct {...} - // - // // key is an unexported type for keys defined in this package. - // // This prevents collisions with keys defined in other packages. - // type key int - // - // // userKey is the key for user.User values in Contexts. It is - // // unexported; clients use user.NewContext and user.FromContext - // // instead of using this key directly. - // var userKey key = 0 - // - // // NewContext returns a new Context that carries value u. - // func NewContext(ctx context.Context, u *User) context.Context { - // return context.WithValue(ctx, userKey, u) - // } - // - // // FromContext returns the User value stored in ctx, if any. - // func FromContext(ctx context.Context) (*User, bool) { - // u, ok := ctx.Value(userKey).(*User) - // return u, ok - // } - Value(key interface{}) interface{} -} - // Background returns a non-nil, empty Context. It is never canceled, has no // values, and has no deadline. It is typically used by the main function, // initialization, and tests, and as the top-level Context for incoming @@ -149,8 +54,3 @@ func Background() Context { func TODO() Context { return todo } - -// A CancelFunc tells an operation to abandon its work. -// A CancelFunc does not wait for the work to stop. -// After the first call, subsequent calls to a CancelFunc do nothing. -type CancelFunc func() diff --git a/vendor/golang.org/x/net/context/go19.go b/vendor/golang.org/x/net/context/go19.go new file mode 100644 index 0000000000000..d88bd1db127dd --- /dev/null +++ b/vendor/golang.org/x/net/context/go19.go @@ -0,0 +1,20 @@ +// 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. + +// +build go1.9 + +package context + +import "context" // standard library's context, as of Go 1.7 + +// A Context carries a deadline, a cancelation signal, and other values across +// API boundaries. +// +// Context's methods may be called by multiple goroutines simultaneously. +type Context = context.Context + +// A CancelFunc tells an operation to abandon its work. +// A CancelFunc does not wait for the work to stop. +// After the first call, subsequent calls to a CancelFunc do nothing. +type CancelFunc = context.CancelFunc diff --git a/vendor/golang.org/x/net/context/pre_go19.go b/vendor/golang.org/x/net/context/pre_go19.go new file mode 100644 index 0000000000000..b105f80be4fe2 --- /dev/null +++ b/vendor/golang.org/x/net/context/pre_go19.go @@ -0,0 +1,109 @@ +// 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 !go1.9 + +package context + +import "time" + +// A Context carries a deadline, a cancelation signal, and other values across +// API boundaries. +// +// Context's methods may be called by multiple goroutines simultaneously. +type Context interface { + // Deadline returns the time when work done on behalf of this context + // should be canceled. Deadline returns ok==false when no deadline is + // set. Successive calls to Deadline return the same results. + Deadline() (deadline time.Time, ok bool) + + // Done returns a channel that's closed when work done on behalf of this + // context should be canceled. Done may return nil if this context can + // never be canceled. Successive calls to Done return the same value. + // + // WithCancel arranges for Done to be closed when cancel is called; + // WithDeadline arranges for Done to be closed when the deadline + // expires; WithTimeout arranges for Done to be closed when the timeout + // elapses. + // + // Done is provided for use in select statements: + // + // // Stream generates values with DoSomething and sends them to out + // // until DoSomething returns an error or ctx.Done is closed. + // func Stream(ctx context.Context, out chan<- Value) error { + // for { + // v, err := DoSomething(ctx) + // if err != nil { + // return err + // } + // select { + // case <-ctx.Done(): + // return ctx.Err() + // case out <- v: + // } + // } + // } + // + // See http://blog.golang.org/pipelines for more examples of how to use + // a Done channel for cancelation. + Done() <-chan struct{} + + // Err returns a non-nil error value after Done is closed. Err returns + // Canceled if the context was canceled or DeadlineExceeded if the + // context's deadline passed. No other values for Err are defined. + // After Done is closed, successive calls to Err return the same value. + Err() error + + // Value returns the value associated with this context for key, or nil + // if no value is associated with key. Successive calls to Value with + // the same key returns the same result. + // + // Use context values only for request-scoped data that transits + // processes and API boundaries, not for passing optional parameters to + // functions. + // + // A key identifies a specific value in a Context. Functions that wish + // to store values in Context typically allocate a key in a global + // variable then use that key as the argument to context.WithValue and + // Context.Value. A key can be any type that supports equality; + // packages should define keys as an unexported type to avoid + // collisions. + // + // Packages that define a Context key should provide type-safe accessors + // for the values stores using that key: + // + // // Package user defines a User type that's stored in Contexts. + // package user + // + // import "golang.org/x/net/context" + // + // // User is the type of value stored in the Contexts. + // type User struct {...} + // + // // key is an unexported type for keys defined in this package. + // // This prevents collisions with keys defined in other packages. + // type key int + // + // // userKey is the key for user.User values in Contexts. It is + // // unexported; clients use user.NewContext and user.FromContext + // // instead of using this key directly. + // var userKey key = 0 + // + // // NewContext returns a new Context that carries value u. + // func NewContext(ctx context.Context, u *User) context.Context { + // return context.WithValue(ctx, userKey, u) + // } + // + // // FromContext returns the User value stored in ctx, if any. + // func FromContext(ctx context.Context) (*User, bool) { + // u, ok := ctx.Value(userKey).(*User) + // return u, ok + // } + Value(key interface{}) interface{} +} + +// A CancelFunc tells an operation to abandon its work. +// A CancelFunc does not wait for the work to stop. +// After the first call, subsequent calls to a CancelFunc do nothing. +type CancelFunc func() diff --git a/vendor/golang.org/x/net/html/atom/gen.go b/vendor/golang.org/x/net/html/atom/gen.go deleted file mode 100644 index 6bfa86601987a..0000000000000 --- a/vendor/golang.org/x/net/html/atom/gen.go +++ /dev/null @@ -1,648 +0,0 @@ -// 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. - -// +build ignore - -package main - -// This program generates table.go and table_test.go. -// Invoke as -// -// go run gen.go |gofmt >table.go -// go run gen.go -test |gofmt >table_test.go - -import ( - "flag" - "fmt" - "math/rand" - "os" - "sort" - "strings" -) - -// identifier converts s to a Go exported identifier. -// It converts "div" to "Div" and "accept-charset" to "AcceptCharset". -func identifier(s string) string { - b := make([]byte, 0, len(s)) - cap := true - for _, c := range s { - if c == '-' { - cap = true - continue - } - if cap && 'a' <= c && c <= 'z' { - c -= 'a' - 'A' - } - cap = false - b = append(b, byte(c)) - } - return string(b) -} - -var test = flag.Bool("test", false, "generate table_test.go") - -func main() { - flag.Parse() - - var all []string - all = append(all, elements...) - all = append(all, attributes...) - all = append(all, eventHandlers...) - all = append(all, extra...) - sort.Strings(all) - - if *test { - fmt.Printf("// generated by go run gen.go -test; DO NOT EDIT\n\n") - fmt.Printf("package atom\n\n") - fmt.Printf("var testAtomList = []string{\n") - for _, s := range all { - fmt.Printf("\t%q,\n", s) - } - fmt.Printf("}\n") - return - } - - // uniq - lists have dups - // compute max len too - maxLen := 0 - w := 0 - for _, s := range all { - if w == 0 || all[w-1] != s { - if maxLen < len(s) { - maxLen = len(s) - } - all[w] = s - w++ - } - } - all = all[:w] - - // Find hash that minimizes table size. - var best *table - for i := 0; i < 1000000; i++ { - if best != nil && 1<<(best.k-1) < len(all) { - break - } - h := rand.Uint32() - for k := uint(0); k <= 16; k++ { - if best != nil && k >= best.k { - break - } - var t table - if t.init(h, k, all) { - best = &t - break - } - } - } - if best == nil { - fmt.Fprintf(os.Stderr, "failed to construct string table\n") - os.Exit(1) - } - - // Lay out strings, using overlaps when possible. - layout := append([]string{}, all...) - - // Remove strings that are substrings of other strings - for changed := true; changed; { - changed = false - for i, s := range layout { - if s == "" { - continue - } - for j, t := range layout { - if i != j && t != "" && strings.Contains(s, t) { - changed = true - layout[j] = "" - } - } - } - } - - // Join strings where one suffix matches another prefix. - for { - // Find best i, j, k such that layout[i][len-k:] == layout[j][:k], - // maximizing overlap length k. - besti := -1 - bestj := -1 - bestk := 0 - for i, s := range layout { - if s == "" { - continue - } - for j, t := range layout { - if i == j { - continue - } - for k := bestk + 1; k <= len(s) && k <= len(t); k++ { - if s[len(s)-k:] == t[:k] { - besti = i - bestj = j - bestk = k - } - } - } - } - if bestk > 0 { - layout[besti] += layout[bestj][bestk:] - layout[bestj] = "" - continue - } - break - } - - text := strings.Join(layout, "") - - atom := map[string]uint32{} - for _, s := range all { - off := strings.Index(text, s) - if off < 0 { - panic("lost string " + s) - } - atom[s] = uint32(off<<8 | len(s)) - } - - // Generate the Go code. - fmt.Printf("// generated by go run gen.go; DO NOT EDIT\n\n") - fmt.Printf("package atom\n\nconst (\n") - for _, s := range all { - fmt.Printf("\t%s Atom = %#x\n", identifier(s), atom[s]) - } - fmt.Printf(")\n\n") - - fmt.Printf("const hash0 = %#x\n\n", best.h0) - fmt.Printf("const maxAtomLen = %d\n\n", maxLen) - - fmt.Printf("var table = [1<<%d]Atom{\n", best.k) - for i, s := range best.tab { - if s == "" { - continue - } - fmt.Printf("\t%#x: %#x, // %s\n", i, atom[s], s) - } - fmt.Printf("}\n") - datasize := (1 << best.k) * 4 - - fmt.Printf("const atomText =\n") - textsize := len(text) - for len(text) > 60 { - fmt.Printf("\t%q +\n", text[:60]) - text = text[60:] - } - fmt.Printf("\t%q\n\n", text) - - fmt.Fprintf(os.Stderr, "%d atoms; %d string bytes + %d tables = %d total data\n", len(all), textsize, datasize, textsize+datasize) -} - -type byLen []string - -func (x byLen) Less(i, j int) bool { return len(x[i]) > len(x[j]) } -func (x byLen) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x byLen) Len() int { return len(x) } - -// fnv computes the FNV hash with an arbitrary starting value h. -func fnv(h uint32, s string) uint32 { - for i := 0; i < len(s); i++ { - h ^= uint32(s[i]) - h *= 16777619 - } - return h -} - -// A table represents an attempt at constructing the lookup table. -// The lookup table uses cuckoo hashing, meaning that each string -// can be found in one of two positions. -type table struct { - h0 uint32 - k uint - mask uint32 - tab []string -} - -// hash returns the two hashes for s. -func (t *table) hash(s string) (h1, h2 uint32) { - h := fnv(t.h0, s) - h1 = h & t.mask - h2 = (h >> 16) & t.mask - return -} - -// init initializes the table with the given parameters. -// h0 is the initial hash value, -// k is the number of bits of hash value to use, and -// x is the list of strings to store in the table. -// init returns false if the table cannot be constructed. -func (t *table) init(h0 uint32, k uint, x []string) bool { - t.h0 = h0 - t.k = k - t.tab = make([]string, 1< len(t.tab) { - return false - } - s := t.tab[i] - h1, h2 := t.hash(s) - j := h1 + h2 - i - if t.tab[j] != "" && !t.push(j, depth+1) { - return false - } - t.tab[j] = s - return true -} - -// The lists of element names and attribute keys were taken from -// https://html.spec.whatwg.org/multipage/indices.html#index -// as of the "HTML Living Standard - Last Updated 21 February 2015" version. - -var elements = []string{ - "a", - "abbr", - "address", - "area", - "article", - "aside", - "audio", - "b", - "base", - "bdi", - "bdo", - "blockquote", - "body", - "br", - "button", - "canvas", - "caption", - "cite", - "code", - "col", - "colgroup", - "command", - "data", - "datalist", - "dd", - "del", - "details", - "dfn", - "dialog", - "div", - "dl", - "dt", - "em", - "embed", - "fieldset", - "figcaption", - "figure", - "footer", - "form", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "head", - "header", - "hgroup", - "hr", - "html", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "legend", - "li", - "link", - "map", - "mark", - "menu", - "menuitem", - "meta", - "meter", - "nav", - "noscript", - "object", - "ol", - "optgroup", - "option", - "output", - "p", - "param", - "pre", - "progress", - "q", - "rp", - "rt", - "ruby", - "s", - "samp", - "script", - "section", - "select", - "small", - "source", - "span", - "strong", - "style", - "sub", - "summary", - "sup", - "table", - "tbody", - "td", - "template", - "textarea", - "tfoot", - "th", - "thead", - "time", - "title", - "tr", - "track", - "u", - "ul", - "var", - "video", - "wbr", -} - -// https://html.spec.whatwg.org/multipage/indices.html#attributes-3 - -var attributes = []string{ - "abbr", - "accept", - "accept-charset", - "accesskey", - "action", - "alt", - "async", - "autocomplete", - "autofocus", - "autoplay", - "challenge", - "charset", - "checked", - "cite", - "class", - "cols", - "colspan", - "command", - "content", - "contenteditable", - "contextmenu", - "controls", - "coords", - "crossorigin", - "data", - "datetime", - "default", - "defer", - "dir", - "dirname", - "disabled", - "download", - "draggable", - "dropzone", - "enctype", - "for", - "form", - "formaction", - "formenctype", - "formmethod", - "formnovalidate", - "formtarget", - "headers", - "height", - "hidden", - "high", - "href", - "hreflang", - "http-equiv", - "icon", - "id", - "inputmode", - "ismap", - "itemid", - "itemprop", - "itemref", - "itemscope", - "itemtype", - "keytype", - "kind", - "label", - "lang", - "list", - "loop", - "low", - "manifest", - "max", - "maxlength", - "media", - "mediagroup", - "method", - "min", - "minlength", - "multiple", - "muted", - "name", - "novalidate", - "open", - "optimum", - "pattern", - "ping", - "placeholder", - "poster", - "preload", - "radiogroup", - "readonly", - "rel", - "required", - "reversed", - "rows", - "rowspan", - "sandbox", - "spellcheck", - "scope", - "scoped", - "seamless", - "selected", - "shape", - "size", - "sizes", - "sortable", - "sorted", - "span", - "src", - "srcdoc", - "srclang", - "start", - "step", - "style", - "tabindex", - "target", - "title", - "translate", - "type", - "typemustmatch", - "usemap", - "value", - "width", - "wrap", -} - -var eventHandlers = []string{ - "onabort", - "onautocomplete", - "onautocompleteerror", - "onafterprint", - "onbeforeprint", - "onbeforeunload", - "onblur", - "oncancel", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "onclose", - "oncontextmenu", - "oncuechange", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "onhashchange", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onlanguagechange", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmessage", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onoffline", - "ononline", - "onpagehide", - "onpageshow", - "onpause", - "onplay", - "onplaying", - "onpopstate", - "onprogress", - "onratechange", - "onreset", - "onresize", - "onscroll", - "onseeked", - "onseeking", - "onselect", - "onshow", - "onsort", - "onstalled", - "onstorage", - "onsubmit", - "onsuspend", - "ontimeupdate", - "ontoggle", - "onunload", - "onvolumechange", - "onwaiting", -} - -// extra are ad-hoc values not covered by any of the lists above. -var extra = []string{ - "align", - "annotation", - "annotation-xml", - "applet", - "basefont", - "bgsound", - "big", - "blink", - "center", - "color", - "desc", - "face", - "font", - "foreignObject", // HTML is case-insensitive, but SVG-embedded-in-HTML is case-sensitive. - "foreignobject", - "frame", - "frameset", - "image", - "isindex", - "listing", - "malignmark", - "marquee", - "math", - "mglyph", - "mi", - "mn", - "mo", - "ms", - "mtext", - "nobr", - "noembed", - "noframes", - "plaintext", - "prompt", - "public", - "spacer", - "strike", - "svg", - "system", - "tt", - "xmp", -} diff --git a/vendor/golang.org/x/net/html/atom/table.go b/vendor/golang.org/x/net/html/atom/table.go index 2605ba3102f63..2a938864cb9d3 100644 --- a/vendor/golang.org/x/net/html/atom/table.go +++ b/vendor/golang.org/x/net/html/atom/table.go @@ -1,713 +1,783 @@ -// generated by go run gen.go; DO NOT EDIT +// Code generated by go generate gen.go; DO NOT EDIT. + +//go:generate go run gen.go package atom const ( - A Atom = 0x1 - Abbr Atom = 0x4 - Accept Atom = 0x2106 - AcceptCharset Atom = 0x210e - Accesskey Atom = 0x3309 - Action Atom = 0x1f606 - Address Atom = 0x4f307 - Align Atom = 0x1105 - Alt Atom = 0x4503 - Annotation Atom = 0x1670a - AnnotationXml Atom = 0x1670e - Applet Atom = 0x2b306 - Area Atom = 0x2fa04 - Article Atom = 0x38807 - Aside Atom = 0x8305 - Async Atom = 0x7b05 - Audio Atom = 0xa605 - Autocomplete Atom = 0x1fc0c - Autofocus Atom = 0xb309 - Autoplay Atom = 0xce08 - B Atom = 0x101 - Base Atom = 0xd604 - Basefont Atom = 0xd608 - Bdi Atom = 0x1a03 - Bdo Atom = 0xe703 - Bgsound Atom = 0x11807 - Big Atom = 0x12403 - Blink Atom = 0x12705 - Blockquote Atom = 0x12c0a - Body Atom = 0x2f04 - Br Atom = 0x202 - Button Atom = 0x13606 - Canvas Atom = 0x7f06 - Caption Atom = 0x1bb07 - Center Atom = 0x5b506 - Challenge Atom = 0x21f09 - Charset Atom = 0x2807 - Checked Atom = 0x32807 - Cite Atom = 0x3c804 - Class Atom = 0x4de05 - Code Atom = 0x14904 - Col Atom = 0x15003 - Colgroup Atom = 0x15008 - Color Atom = 0x15d05 - Cols Atom = 0x16204 - Colspan Atom = 0x16207 - Command Atom = 0x17507 - Content Atom = 0x42307 - Contenteditable Atom = 0x4230f - Contextmenu Atom = 0x3310b - Controls Atom = 0x18808 - Coords Atom = 0x19406 - Crossorigin Atom = 0x19f0b - Data Atom = 0x44a04 - Datalist Atom = 0x44a08 - Datetime Atom = 0x23c08 - Dd Atom = 0x26702 - Default Atom = 0x8607 - Defer Atom = 0x14b05 - Del Atom = 0x3ef03 - Desc Atom = 0x4db04 - Details Atom = 0x4807 - Dfn Atom = 0x6103 - Dialog Atom = 0x1b06 - Dir Atom = 0x6903 - Dirname Atom = 0x6907 - Disabled Atom = 0x10c08 - Div Atom = 0x11303 - Dl Atom = 0x11e02 - Download Atom = 0x40008 - Draggable Atom = 0x17b09 - Dropzone Atom = 0x39108 - Dt Atom = 0x50902 - Em Atom = 0x6502 - Embed Atom = 0x6505 - Enctype Atom = 0x21107 - Face Atom = 0x5b304 - Fieldset Atom = 0x1b008 - Figcaption Atom = 0x1b80a - Figure Atom = 0x1cc06 - Font Atom = 0xda04 - Footer Atom = 0x8d06 - For Atom = 0x1d803 - ForeignObject Atom = 0x1d80d - Foreignobject Atom = 0x1e50d - Form Atom = 0x1f204 - Formaction Atom = 0x1f20a - Formenctype Atom = 0x20d0b - Formmethod Atom = 0x2280a - Formnovalidate Atom = 0x2320e - Formtarget Atom = 0x2470a - Frame Atom = 0x9a05 - Frameset Atom = 0x9a08 - H1 Atom = 0x26e02 - H2 Atom = 0x29402 - H3 Atom = 0x2a702 - H4 Atom = 0x2e902 - H5 Atom = 0x2f302 - H6 Atom = 0x50b02 - Head Atom = 0x2d504 - Header Atom = 0x2d506 - Headers Atom = 0x2d507 - Height Atom = 0x25106 - Hgroup Atom = 0x25906 - Hidden Atom = 0x26506 - High Atom = 0x26b04 - Hr Atom = 0x27002 - Href Atom = 0x27004 - Hreflang Atom = 0x27008 - Html Atom = 0x25504 - HttpEquiv Atom = 0x2780a - I Atom = 0x601 - Icon Atom = 0x42204 - Id Atom = 0x8502 - Iframe Atom = 0x29606 - Image Atom = 0x29c05 - Img Atom = 0x2a103 - Input Atom = 0x3e805 - Inputmode Atom = 0x3e809 - Ins Atom = 0x1a803 - Isindex Atom = 0x2a907 - Ismap Atom = 0x2b005 - Itemid Atom = 0x33c06 - Itemprop Atom = 0x3c908 - Itemref Atom = 0x5ad07 - Itemscope Atom = 0x2b909 - Itemtype Atom = 0x2c308 - Kbd Atom = 0x1903 - Keygen Atom = 0x3906 - Keytype Atom = 0x53707 - Kind Atom = 0x10904 - Label Atom = 0xf005 - Lang Atom = 0x27404 - Legend Atom = 0x18206 - Li Atom = 0x1202 - Link Atom = 0x12804 - List Atom = 0x44e04 - Listing Atom = 0x44e07 - Loop Atom = 0xf404 - Low Atom = 0x11f03 - Malignmark Atom = 0x100a - Manifest Atom = 0x5f108 - Map Atom = 0x2b203 - Mark Atom = 0x1604 - Marquee Atom = 0x2cb07 - Math Atom = 0x2d204 - Max Atom = 0x2e103 - Maxlength Atom = 0x2e109 - Media Atom = 0x6e05 - Mediagroup Atom = 0x6e0a - Menu Atom = 0x33804 - Menuitem Atom = 0x33808 - Meta Atom = 0x45d04 - Meter Atom = 0x24205 - Method Atom = 0x22c06 - Mglyph Atom = 0x2a206 - Mi Atom = 0x2eb02 - Min Atom = 0x2eb03 - Minlength Atom = 0x2eb09 - Mn Atom = 0x23502 - Mo Atom = 0x3ed02 - Ms Atom = 0x2bc02 - Mtext Atom = 0x2f505 - Multiple Atom = 0x30308 - Muted Atom = 0x30b05 - Name Atom = 0x6c04 - Nav Atom = 0x3e03 - Nobr Atom = 0x5704 - Noembed Atom = 0x6307 - Noframes Atom = 0x9808 - Noscript Atom = 0x3d208 - Novalidate Atom = 0x2360a - Object Atom = 0x1ec06 - Ol Atom = 0xc902 - Onabort Atom = 0x13a07 - Onafterprint Atom = 0x1c00c - Onautocomplete Atom = 0x1fa0e - Onautocompleteerror Atom = 0x1fa13 - Onbeforeprint Atom = 0x6040d - Onbeforeunload Atom = 0x4e70e - Onblur Atom = 0xaa06 - Oncancel Atom = 0xe908 - Oncanplay Atom = 0x28509 - Oncanplaythrough Atom = 0x28510 - Onchange Atom = 0x3a708 - Onclick Atom = 0x31007 - Onclose Atom = 0x31707 - Oncontextmenu Atom = 0x32f0d - Oncuechange Atom = 0x3420b - Ondblclick Atom = 0x34d0a - Ondrag Atom = 0x35706 - Ondragend Atom = 0x35709 - Ondragenter Atom = 0x3600b - Ondragleave Atom = 0x36b0b - Ondragover Atom = 0x3760a - Ondragstart Atom = 0x3800b - Ondrop Atom = 0x38f06 - Ondurationchange Atom = 0x39f10 - Onemptied Atom = 0x39609 - Onended Atom = 0x3af07 - Onerror Atom = 0x3b607 - Onfocus Atom = 0x3bd07 - Onhashchange Atom = 0x3da0c - Oninput Atom = 0x3e607 - Oninvalid Atom = 0x3f209 - Onkeydown Atom = 0x3fb09 - Onkeypress Atom = 0x4080a - Onkeyup Atom = 0x41807 - Onlanguagechange Atom = 0x43210 - Onload Atom = 0x44206 - Onloadeddata Atom = 0x4420c - Onloadedmetadata Atom = 0x45510 - Onloadstart Atom = 0x46b0b - Onmessage Atom = 0x47609 - Onmousedown Atom = 0x47f0b - Onmousemove Atom = 0x48a0b - Onmouseout Atom = 0x4950a - Onmouseover Atom = 0x4a20b - Onmouseup Atom = 0x4ad09 - Onmousewheel Atom = 0x4b60c - Onoffline Atom = 0x4c209 - Ononline Atom = 0x4cb08 - Onpagehide Atom = 0x4d30a - Onpageshow Atom = 0x4fe0a - Onpause Atom = 0x50d07 - Onplay Atom = 0x51706 - Onplaying Atom = 0x51709 - Onpopstate Atom = 0x5200a - Onprogress Atom = 0x52a0a - Onratechange Atom = 0x53e0c - Onreset Atom = 0x54a07 - Onresize Atom = 0x55108 - Onscroll Atom = 0x55f08 - Onseeked Atom = 0x56708 - Onseeking Atom = 0x56f09 - Onselect Atom = 0x57808 - Onshow Atom = 0x58206 - Onsort Atom = 0x58b06 - Onstalled Atom = 0x59509 - Onstorage Atom = 0x59e09 - Onsubmit Atom = 0x5a708 - Onsuspend Atom = 0x5bb09 - Ontimeupdate Atom = 0xdb0c - Ontoggle Atom = 0x5c408 - Onunload Atom = 0x5cc08 - Onvolumechange Atom = 0x5d40e - Onwaiting Atom = 0x5e209 - Open Atom = 0x3cf04 - Optgroup Atom = 0xf608 - Optimum Atom = 0x5eb07 - Option Atom = 0x60006 - Output Atom = 0x49c06 - P Atom = 0xc01 - Param Atom = 0xc05 - Pattern Atom = 0x5107 - Ping Atom = 0x7704 - Placeholder Atom = 0xc30b - Plaintext Atom = 0xfd09 - Poster Atom = 0x15706 - Pre Atom = 0x25e03 - Preload Atom = 0x25e07 - Progress Atom = 0x52c08 - Prompt Atom = 0x5fa06 - Public Atom = 0x41e06 - Q Atom = 0x13101 - Radiogroup Atom = 0x30a - Readonly Atom = 0x2fb08 - Rel Atom = 0x25f03 - Required Atom = 0x1d008 - Reversed Atom = 0x5a08 - Rows Atom = 0x9204 - Rowspan Atom = 0x9207 - Rp Atom = 0x1c602 - Rt Atom = 0x13f02 - Ruby Atom = 0xaf04 - S Atom = 0x2c01 - Samp Atom = 0x4e04 - Sandbox Atom = 0xbb07 - Scope Atom = 0x2bd05 - Scoped Atom = 0x2bd06 - Script Atom = 0x3d406 - Seamless Atom = 0x31c08 - Section Atom = 0x4e207 - Select Atom = 0x57a06 - Selected Atom = 0x57a08 - Shape Atom = 0x4f905 - Size Atom = 0x55504 - Sizes Atom = 0x55505 - Small Atom = 0x18f05 - Sortable Atom = 0x58d08 - Sorted Atom = 0x19906 - Source Atom = 0x1aa06 - Spacer Atom = 0x2db06 - Span Atom = 0x9504 - Spellcheck Atom = 0x3230a - Src Atom = 0x3c303 - Srcdoc Atom = 0x3c306 - Srclang Atom = 0x41107 - Start Atom = 0x38605 - Step Atom = 0x5f704 - Strike Atom = 0x53306 - Strong Atom = 0x55906 - Style Atom = 0x61105 - Sub Atom = 0x5a903 - Summary Atom = 0x61607 - Sup Atom = 0x61d03 - Svg Atom = 0x62003 - System Atom = 0x62306 - Tabindex Atom = 0x46308 - Table Atom = 0x42d05 - Target Atom = 0x24b06 - Tbody Atom = 0x2e05 - Td Atom = 0x4702 - Template Atom = 0x62608 - Textarea Atom = 0x2f608 - Tfoot Atom = 0x8c05 - Th Atom = 0x22e02 - Thead Atom = 0x2d405 - Time Atom = 0xdd04 - Title Atom = 0xa105 - Tr Atom = 0x10502 - Track Atom = 0x10505 - Translate Atom = 0x14009 - Tt Atom = 0x5302 - Type Atom = 0x21404 - Typemustmatch Atom = 0x2140d - U Atom = 0xb01 - Ul Atom = 0x8a02 - Usemap Atom = 0x51106 - Value Atom = 0x4005 - Var Atom = 0x11503 - Video Atom = 0x28105 - Wbr Atom = 0x12103 - Width Atom = 0x50705 - Wrap Atom = 0x58704 - Xmp Atom = 0xc103 + A Atom = 0x1 + Abbr Atom = 0x4 + Accept Atom = 0x1a06 + AcceptCharset Atom = 0x1a0e + Accesskey Atom = 0x2c09 + Acronym Atom = 0xaa07 + Action Atom = 0x27206 + Address Atom = 0x6f307 + Align Atom = 0xb105 + Allowfullscreen Atom = 0x2080f + Allowpaymentrequest Atom = 0xc113 + Allowusermedia Atom = 0xdd0e + Alt Atom = 0xf303 + Annotation Atom = 0x1c90a + AnnotationXml Atom = 0x1c90e + Applet Atom = 0x31906 + Area Atom = 0x35604 + Article Atom = 0x3fc07 + As Atom = 0x3c02 + Aside Atom = 0x10705 + Async Atom = 0xff05 + Audio Atom = 0x11505 + Autocomplete Atom = 0x2780c + Autofocus Atom = 0x12109 + Autoplay Atom = 0x13c08 + B Atom = 0x101 + Base Atom = 0x3b04 + Basefont Atom = 0x3b08 + Bdi Atom = 0xba03 + Bdo Atom = 0x14b03 + Bgsound Atom = 0x15e07 + Big Atom = 0x17003 + Blink Atom = 0x17305 + Blockquote Atom = 0x1870a + Body Atom = 0x2804 + Br Atom = 0x202 + Button Atom = 0x19106 + Canvas Atom = 0x10306 + Caption Atom = 0x23107 + Center Atom = 0x22006 + Challenge Atom = 0x29b09 + Charset Atom = 0x2107 + Checked Atom = 0x47907 + Cite Atom = 0x19c04 + Class Atom = 0x56405 + Code Atom = 0x5c504 + Col Atom = 0x1ab03 + Colgroup Atom = 0x1ab08 + Color Atom = 0x1bf05 + Cols Atom = 0x1c404 + Colspan Atom = 0x1c407 + Command Atom = 0x1d707 + Content Atom = 0x58b07 + Contenteditable Atom = 0x58b0f + Contextmenu Atom = 0x3800b + Controls Atom = 0x1de08 + Coords Atom = 0x1ea06 + Crossorigin Atom = 0x1fb0b + Data Atom = 0x4a504 + Datalist Atom = 0x4a508 + Datetime Atom = 0x2b808 + Dd Atom = 0x2d702 + Default Atom = 0x10a07 + Defer Atom = 0x5c705 + Del Atom = 0x45203 + Desc Atom = 0x56104 + Details Atom = 0x7207 + Dfn Atom = 0x8703 + Dialog Atom = 0xbb06 + Dir Atom = 0x9303 + Dirname Atom = 0x9307 + Disabled Atom = 0x16408 + Div Atom = 0x16b03 + Dl Atom = 0x5e602 + Download Atom = 0x46308 + Draggable Atom = 0x17a09 + Dropzone Atom = 0x40508 + Dt Atom = 0x64b02 + Em Atom = 0x6e02 + Embed Atom = 0x6e05 + Enctype Atom = 0x28d07 + Face Atom = 0x21e04 + Fieldset Atom = 0x22608 + Figcaption Atom = 0x22e0a + Figure Atom = 0x24806 + Font Atom = 0x3f04 + Footer Atom = 0xf606 + For Atom = 0x25403 + ForeignObject Atom = 0x2540d + Foreignobject Atom = 0x2610d + Form Atom = 0x26e04 + Formaction Atom = 0x26e0a + Formenctype Atom = 0x2890b + Formmethod Atom = 0x2a40a + Formnovalidate Atom = 0x2ae0e + Formtarget Atom = 0x2c00a + Frame Atom = 0x8b05 + Frameset Atom = 0x8b08 + H1 Atom = 0x15c02 + H2 Atom = 0x2de02 + H3 Atom = 0x30d02 + H4 Atom = 0x34502 + H5 Atom = 0x34f02 + H6 Atom = 0x64d02 + Head Atom = 0x33104 + Header Atom = 0x33106 + Headers Atom = 0x33107 + Height Atom = 0x5206 + Hgroup Atom = 0x2ca06 + Hidden Atom = 0x2d506 + High Atom = 0x2db04 + Hr Atom = 0x15702 + Href Atom = 0x2e004 + Hreflang Atom = 0x2e008 + Html Atom = 0x5604 + HttpEquiv Atom = 0x2e80a + I Atom = 0x601 + Icon Atom = 0x58a04 + Id Atom = 0x10902 + Iframe Atom = 0x2fc06 + Image Atom = 0x30205 + Img Atom = 0x30703 + Input Atom = 0x44b05 + Inputmode Atom = 0x44b09 + Ins Atom = 0x20403 + Integrity Atom = 0x23f09 + Is Atom = 0x16502 + Isindex Atom = 0x30f07 + Ismap Atom = 0x31605 + Itemid Atom = 0x38b06 + Itemprop Atom = 0x19d08 + Itemref Atom = 0x3cd07 + Itemscope Atom = 0x67109 + Itemtype Atom = 0x31f08 + Kbd Atom = 0xb903 + Keygen Atom = 0x3206 + Keytype Atom = 0xd607 + Kind Atom = 0x17704 + Label Atom = 0x5905 + Lang Atom = 0x2e404 + Legend Atom = 0x18106 + Li Atom = 0xb202 + Link Atom = 0x17404 + List Atom = 0x4a904 + Listing Atom = 0x4a907 + Loop Atom = 0x5d04 + Low Atom = 0xc303 + Main Atom = 0x1004 + Malignmark Atom = 0xb00a + Manifest Atom = 0x6d708 + Map Atom = 0x31803 + Mark Atom = 0xb604 + Marquee Atom = 0x32707 + Math Atom = 0x32e04 + Max Atom = 0x33d03 + Maxlength Atom = 0x33d09 + Media Atom = 0xe605 + Mediagroup Atom = 0xe60a + Menu Atom = 0x38704 + Menuitem Atom = 0x38708 + Meta Atom = 0x4b804 + Meter Atom = 0x9805 + Method Atom = 0x2a806 + Mglyph Atom = 0x30806 + Mi Atom = 0x34702 + Min Atom = 0x34703 + Minlength Atom = 0x34709 + Mn Atom = 0x2b102 + Mo Atom = 0xa402 + Ms Atom = 0x67402 + Mtext Atom = 0x35105 + Multiple Atom = 0x35f08 + Muted Atom = 0x36705 + Name Atom = 0x9604 + Nav Atom = 0x1303 + Nobr Atom = 0x3704 + Noembed Atom = 0x6c07 + Noframes Atom = 0x8908 + Nomodule Atom = 0xa208 + Nonce Atom = 0x1a605 + Noscript Atom = 0x21608 + Novalidate Atom = 0x2b20a + Object Atom = 0x26806 + Ol Atom = 0x13702 + Onabort Atom = 0x19507 + Onafterprint Atom = 0x2360c + Onautocomplete Atom = 0x2760e + Onautocompleteerror Atom = 0x27613 + Onauxclick Atom = 0x61f0a + Onbeforeprint Atom = 0x69e0d + Onbeforeunload Atom = 0x6e70e + Onblur Atom = 0x56d06 + Oncancel Atom = 0x11908 + Oncanplay Atom = 0x14d09 + Oncanplaythrough Atom = 0x14d10 + Onchange Atom = 0x41b08 + Onclick Atom = 0x2f507 + Onclose Atom = 0x36c07 + Oncontextmenu Atom = 0x37e0d + Oncopy Atom = 0x39106 + Oncuechange Atom = 0x3970b + Oncut Atom = 0x3a205 + Ondblclick Atom = 0x3a70a + Ondrag Atom = 0x3b106 + Ondragend Atom = 0x3b109 + Ondragenter Atom = 0x3ba0b + Ondragexit Atom = 0x3c50a + Ondragleave Atom = 0x3df0b + Ondragover Atom = 0x3ea0a + Ondragstart Atom = 0x3f40b + Ondrop Atom = 0x40306 + Ondurationchange Atom = 0x41310 + Onemptied Atom = 0x40a09 + Onended Atom = 0x42307 + Onerror Atom = 0x42a07 + Onfocus Atom = 0x43107 + Onhashchange Atom = 0x43d0c + Oninput Atom = 0x44907 + Oninvalid Atom = 0x45509 + Onkeydown Atom = 0x45e09 + Onkeypress Atom = 0x46b0a + Onkeyup Atom = 0x48007 + Onlanguagechange Atom = 0x48d10 + Onload Atom = 0x49d06 + Onloadeddata Atom = 0x49d0c + Onloadedmetadata Atom = 0x4b010 + Onloadend Atom = 0x4c609 + Onloadstart Atom = 0x4cf0b + Onmessage Atom = 0x4da09 + Onmessageerror Atom = 0x4da0e + Onmousedown Atom = 0x4e80b + Onmouseenter Atom = 0x4f30c + Onmouseleave Atom = 0x4ff0c + Onmousemove Atom = 0x50b0b + Onmouseout Atom = 0x5160a + Onmouseover Atom = 0x5230b + Onmouseup Atom = 0x52e09 + Onmousewheel Atom = 0x53c0c + Onoffline Atom = 0x54809 + Ononline Atom = 0x55108 + Onpagehide Atom = 0x5590a + Onpageshow Atom = 0x5730a + Onpaste Atom = 0x57f07 + Onpause Atom = 0x59a07 + Onplay Atom = 0x5a406 + Onplaying Atom = 0x5a409 + Onpopstate Atom = 0x5ad0a + Onprogress Atom = 0x5b70a + Onratechange Atom = 0x5cc0c + Onrejectionhandled Atom = 0x5d812 + Onreset Atom = 0x5ea07 + Onresize Atom = 0x5f108 + Onscroll Atom = 0x60008 + Onsecuritypolicyviolation Atom = 0x60819 + Onseeked Atom = 0x62908 + Onseeking Atom = 0x63109 + Onselect Atom = 0x63a08 + Onshow Atom = 0x64406 + Onsort Atom = 0x64f06 + Onstalled Atom = 0x65909 + Onstorage Atom = 0x66209 + Onsubmit Atom = 0x66b08 + Onsuspend Atom = 0x67b09 + Ontimeupdate Atom = 0x400c + Ontoggle Atom = 0x68408 + Onunhandledrejection Atom = 0x68c14 + Onunload Atom = 0x6ab08 + Onvolumechange Atom = 0x6b30e + Onwaiting Atom = 0x6c109 + Onwheel Atom = 0x6ca07 + Open Atom = 0x1a304 + Optgroup Atom = 0x5f08 + Optimum Atom = 0x6d107 + Option Atom = 0x6e306 + Output Atom = 0x51d06 + P Atom = 0xc01 + Param Atom = 0xc05 + Pattern Atom = 0x6607 + Picture Atom = 0x7b07 + Ping Atom = 0xef04 + Placeholder Atom = 0x1310b + Plaintext Atom = 0x1b209 + Playsinline Atom = 0x1400b + Poster Atom = 0x2cf06 + Pre Atom = 0x47003 + Preload Atom = 0x48607 + Progress Atom = 0x5b908 + Prompt Atom = 0x53606 + Public Atom = 0x58606 + Q Atom = 0xcf01 + Radiogroup Atom = 0x30a + Rb Atom = 0x3a02 + Readonly Atom = 0x35708 + Referrerpolicy Atom = 0x3d10e + Rel Atom = 0x48703 + Required Atom = 0x24c08 + Reversed Atom = 0x8008 + Rows Atom = 0x9c04 + Rowspan Atom = 0x9c07 + Rp Atom = 0x23c02 + Rt Atom = 0x19a02 + Rtc Atom = 0x19a03 + Ruby Atom = 0xfb04 + S Atom = 0x2501 + Samp Atom = 0x7804 + Sandbox Atom = 0x12907 + Scope Atom = 0x67505 + Scoped Atom = 0x67506 + Script Atom = 0x21806 + Seamless Atom = 0x37108 + Section Atom = 0x56807 + Select Atom = 0x63c06 + Selected Atom = 0x63c08 + Shape Atom = 0x1e505 + Size Atom = 0x5f504 + Sizes Atom = 0x5f505 + Slot Atom = 0x1ef04 + Small Atom = 0x20605 + Sortable Atom = 0x65108 + Sorted Atom = 0x33706 + Source Atom = 0x37806 + Spacer Atom = 0x43706 + Span Atom = 0x9f04 + Spellcheck Atom = 0x4740a + Src Atom = 0x5c003 + Srcdoc Atom = 0x5c006 + Srclang Atom = 0x5f907 + Srcset Atom = 0x6f906 + Start Atom = 0x3fa05 + Step Atom = 0x58304 + Strike Atom = 0xd206 + Strong Atom = 0x6dd06 + Style Atom = 0x6ff05 + Sub Atom = 0x66d03 + Summary Atom = 0x70407 + Sup Atom = 0x70b03 + Svg Atom = 0x70e03 + System Atom = 0x71106 + Tabindex Atom = 0x4be08 + Table Atom = 0x59505 + Target Atom = 0x2c406 + Tbody Atom = 0x2705 + Td Atom = 0x9202 + Template Atom = 0x71408 + Textarea Atom = 0x35208 + Tfoot Atom = 0xf505 + Th Atom = 0x15602 + Thead Atom = 0x33005 + Time Atom = 0x4204 + Title Atom = 0x11005 + Tr Atom = 0xcc02 + Track Atom = 0x1ba05 + Translate Atom = 0x1f209 + Tt Atom = 0x6802 + Type Atom = 0xd904 + Typemustmatch Atom = 0x2900d + U Atom = 0xb01 + Ul Atom = 0xa702 + Updateviacache Atom = 0x460e + Usemap Atom = 0x59e06 + Value Atom = 0x1505 + Var Atom = 0x16d03 + Video Atom = 0x2f105 + Wbr Atom = 0x57c03 + Width Atom = 0x64905 + Workertype Atom = 0x71c0a + Wrap Atom = 0x72604 + Xmp Atom = 0x12f03 ) -const hash0 = 0xc17da63e +const hash0 = 0x81cdf10e -const maxAtomLen = 19 +const maxAtomLen = 25 var table = [1 << 9]Atom{ - 0x1: 0x48a0b, // onmousemove - 0x2: 0x5e209, // onwaiting - 0x3: 0x1fa13, // onautocompleteerror - 0x4: 0x5fa06, // prompt - 0x7: 0x5eb07, // optimum - 0x8: 0x1604, // mark - 0xa: 0x5ad07, // itemref - 0xb: 0x4fe0a, // onpageshow - 0xc: 0x57a06, // select - 0xd: 0x17b09, // draggable - 0xe: 0x3e03, // nav - 0xf: 0x17507, // command - 0x11: 0xb01, // u - 0x14: 0x2d507, // headers - 0x15: 0x44a08, // datalist - 0x17: 0x4e04, // samp - 0x1a: 0x3fb09, // onkeydown - 0x1b: 0x55f08, // onscroll - 0x1c: 0x15003, // col - 0x20: 0x3c908, // itemprop - 0x21: 0x2780a, // http-equiv - 0x22: 0x61d03, // sup - 0x24: 0x1d008, // required - 0x2b: 0x25e07, // preload - 0x2c: 0x6040d, // onbeforeprint - 0x2d: 0x3600b, // ondragenter - 0x2e: 0x50902, // dt - 0x2f: 0x5a708, // onsubmit - 0x30: 0x27002, // hr - 0x31: 0x32f0d, // oncontextmenu - 0x33: 0x29c05, // image - 0x34: 0x50d07, // onpause - 0x35: 0x25906, // hgroup - 0x36: 0x7704, // ping - 0x37: 0x57808, // onselect - 0x3a: 0x11303, // div - 0x3b: 0x1fa0e, // onautocomplete - 0x40: 0x2eb02, // mi - 0x41: 0x31c08, // seamless - 0x42: 0x2807, // charset - 0x43: 0x8502, // id - 0x44: 0x5200a, // onpopstate - 0x45: 0x3ef03, // del - 0x46: 0x2cb07, // marquee - 0x47: 0x3309, // accesskey - 0x49: 0x8d06, // footer - 0x4a: 0x44e04, // list - 0x4b: 0x2b005, // ismap - 0x51: 0x33804, // menu - 0x52: 0x2f04, // body - 0x55: 0x9a08, // frameset - 0x56: 0x54a07, // onreset - 0x57: 0x12705, // blink - 0x58: 0xa105, // title - 0x59: 0x38807, // article - 0x5b: 0x22e02, // th - 0x5d: 0x13101, // q - 0x5e: 0x3cf04, // open - 0x5f: 0x2fa04, // area - 0x61: 0x44206, // onload - 0x62: 0xda04, // font - 0x63: 0xd604, // base - 0x64: 0x16207, // colspan - 0x65: 0x53707, // keytype - 0x66: 0x11e02, // dl - 0x68: 0x1b008, // fieldset - 0x6a: 0x2eb03, // min - 0x6b: 0x11503, // var - 0x6f: 0x2d506, // header - 0x70: 0x13f02, // rt - 0x71: 0x15008, // colgroup - 0x72: 0x23502, // mn - 0x74: 0x13a07, // onabort - 0x75: 0x3906, // keygen - 0x76: 0x4c209, // onoffline - 0x77: 0x21f09, // challenge - 0x78: 0x2b203, // map - 0x7a: 0x2e902, // h4 - 0x7b: 0x3b607, // onerror - 0x7c: 0x2e109, // maxlength - 0x7d: 0x2f505, // mtext - 0x7e: 0xbb07, // sandbox - 0x7f: 0x58b06, // onsort - 0x80: 0x100a, // malignmark - 0x81: 0x45d04, // meta - 0x82: 0x7b05, // async - 0x83: 0x2a702, // h3 - 0x84: 0x26702, // dd - 0x85: 0x27004, // href - 0x86: 0x6e0a, // mediagroup - 0x87: 0x19406, // coords - 0x88: 0x41107, // srclang - 0x89: 0x34d0a, // ondblclick - 0x8a: 0x4005, // value - 0x8c: 0xe908, // oncancel - 0x8e: 0x3230a, // spellcheck - 0x8f: 0x9a05, // frame - 0x91: 0x12403, // big - 0x94: 0x1f606, // action - 0x95: 0x6903, // dir - 0x97: 0x2fb08, // readonly - 0x99: 0x42d05, // table - 0x9a: 0x61607, // summary - 0x9b: 0x12103, // wbr - 0x9c: 0x30a, // radiogroup - 0x9d: 0x6c04, // name - 0x9f: 0x62306, // system - 0xa1: 0x15d05, // color - 0xa2: 0x7f06, // canvas - 0xa3: 0x25504, // html - 0xa5: 0x56f09, // onseeking - 0xac: 0x4f905, // shape - 0xad: 0x25f03, // rel - 0xae: 0x28510, // oncanplaythrough - 0xaf: 0x3760a, // ondragover - 0xb0: 0x62608, // template - 0xb1: 0x1d80d, // foreignObject - 0xb3: 0x9204, // rows - 0xb6: 0x44e07, // listing - 0xb7: 0x49c06, // output - 0xb9: 0x3310b, // contextmenu - 0xbb: 0x11f03, // low - 0xbc: 0x1c602, // rp - 0xbd: 0x5bb09, // onsuspend - 0xbe: 0x13606, // button - 0xbf: 0x4db04, // desc - 0xc1: 0x4e207, // section - 0xc2: 0x52a0a, // onprogress - 0xc3: 0x59e09, // onstorage - 0xc4: 0x2d204, // math - 0xc5: 0x4503, // alt - 0xc7: 0x8a02, // ul - 0xc8: 0x5107, // pattern - 0xc9: 0x4b60c, // onmousewheel - 0xca: 0x35709, // ondragend - 0xcb: 0xaf04, // ruby - 0xcc: 0xc01, // p - 0xcd: 0x31707, // onclose - 0xce: 0x24205, // meter - 0xcf: 0x11807, // bgsound - 0xd2: 0x25106, // height - 0xd4: 0x101, // b - 0xd5: 0x2c308, // itemtype - 0xd8: 0x1bb07, // caption - 0xd9: 0x10c08, // disabled - 0xdb: 0x33808, // menuitem - 0xdc: 0x62003, // svg - 0xdd: 0x18f05, // small - 0xde: 0x44a04, // data - 0xe0: 0x4cb08, // ononline - 0xe1: 0x2a206, // mglyph - 0xe3: 0x6505, // embed - 0xe4: 0x10502, // tr - 0xe5: 0x46b0b, // onloadstart - 0xe7: 0x3c306, // srcdoc - 0xeb: 0x5c408, // ontoggle - 0xed: 0xe703, // bdo - 0xee: 0x4702, // td - 0xef: 0x8305, // aside - 0xf0: 0x29402, // h2 - 0xf1: 0x52c08, // progress - 0xf2: 0x12c0a, // blockquote - 0xf4: 0xf005, // label - 0xf5: 0x601, // i - 0xf7: 0x9207, // rowspan - 0xfb: 0x51709, // onplaying - 0xfd: 0x2a103, // img - 0xfe: 0xf608, // optgroup - 0xff: 0x42307, // content - 0x101: 0x53e0c, // onratechange - 0x103: 0x3da0c, // onhashchange - 0x104: 0x4807, // details - 0x106: 0x40008, // download - 0x109: 0x14009, // translate - 0x10b: 0x4230f, // contenteditable - 0x10d: 0x36b0b, // ondragleave - 0x10e: 0x2106, // accept - 0x10f: 0x57a08, // selected - 0x112: 0x1f20a, // formaction - 0x113: 0x5b506, // center - 0x115: 0x45510, // onloadedmetadata - 0x116: 0x12804, // link - 0x117: 0xdd04, // time - 0x118: 0x19f0b, // crossorigin - 0x119: 0x3bd07, // onfocus - 0x11a: 0x58704, // wrap - 0x11b: 0x42204, // icon - 0x11d: 0x28105, // video - 0x11e: 0x4de05, // class - 0x121: 0x5d40e, // onvolumechange - 0x122: 0xaa06, // onblur - 0x123: 0x2b909, // itemscope - 0x124: 0x61105, // style - 0x127: 0x41e06, // public - 0x129: 0x2320e, // formnovalidate - 0x12a: 0x58206, // onshow - 0x12c: 0x51706, // onplay - 0x12d: 0x3c804, // cite - 0x12e: 0x2bc02, // ms - 0x12f: 0xdb0c, // ontimeupdate - 0x130: 0x10904, // kind - 0x131: 0x2470a, // formtarget - 0x135: 0x3af07, // onended - 0x136: 0x26506, // hidden - 0x137: 0x2c01, // s - 0x139: 0x2280a, // formmethod - 0x13a: 0x3e805, // input - 0x13c: 0x50b02, // h6 - 0x13d: 0xc902, // ol - 0x13e: 0x3420b, // oncuechange - 0x13f: 0x1e50d, // foreignobject - 0x143: 0x4e70e, // onbeforeunload - 0x144: 0x2bd05, // scope - 0x145: 0x39609, // onemptied - 0x146: 0x14b05, // defer - 0x147: 0xc103, // xmp - 0x148: 0x39f10, // ondurationchange - 0x149: 0x1903, // kbd - 0x14c: 0x47609, // onmessage - 0x14d: 0x60006, // option - 0x14e: 0x2eb09, // minlength - 0x14f: 0x32807, // checked - 0x150: 0xce08, // autoplay - 0x152: 0x202, // br - 0x153: 0x2360a, // novalidate - 0x156: 0x6307, // noembed - 0x159: 0x31007, // onclick - 0x15a: 0x47f0b, // onmousedown - 0x15b: 0x3a708, // onchange - 0x15e: 0x3f209, // oninvalid - 0x15f: 0x2bd06, // scoped - 0x160: 0x18808, // controls - 0x161: 0x30b05, // muted - 0x162: 0x58d08, // sortable - 0x163: 0x51106, // usemap - 0x164: 0x1b80a, // figcaption - 0x165: 0x35706, // ondrag - 0x166: 0x26b04, // high - 0x168: 0x3c303, // src - 0x169: 0x15706, // poster - 0x16b: 0x1670e, // annotation-xml - 0x16c: 0x5f704, // step - 0x16d: 0x4, // abbr - 0x16e: 0x1b06, // dialog - 0x170: 0x1202, // li - 0x172: 0x3ed02, // mo - 0x175: 0x1d803, // for - 0x176: 0x1a803, // ins - 0x178: 0x55504, // size - 0x179: 0x43210, // onlanguagechange - 0x17a: 0x8607, // default - 0x17b: 0x1a03, // bdi - 0x17c: 0x4d30a, // onpagehide - 0x17d: 0x6907, // dirname - 0x17e: 0x21404, // type - 0x17f: 0x1f204, // form - 0x181: 0x28509, // oncanplay - 0x182: 0x6103, // dfn - 0x183: 0x46308, // tabindex - 0x186: 0x6502, // em - 0x187: 0x27404, // lang - 0x189: 0x39108, // dropzone - 0x18a: 0x4080a, // onkeypress - 0x18b: 0x23c08, // datetime - 0x18c: 0x16204, // cols - 0x18d: 0x1, // a - 0x18e: 0x4420c, // onloadeddata - 0x190: 0xa605, // audio - 0x192: 0x2e05, // tbody - 0x193: 0x22c06, // method - 0x195: 0xf404, // loop - 0x196: 0x29606, // iframe - 0x198: 0x2d504, // head - 0x19e: 0x5f108, // manifest - 0x19f: 0xb309, // autofocus - 0x1a0: 0x14904, // code - 0x1a1: 0x55906, // strong - 0x1a2: 0x30308, // multiple - 0x1a3: 0xc05, // param - 0x1a6: 0x21107, // enctype - 0x1a7: 0x5b304, // face - 0x1a8: 0xfd09, // plaintext - 0x1a9: 0x26e02, // h1 - 0x1aa: 0x59509, // onstalled - 0x1ad: 0x3d406, // script - 0x1ae: 0x2db06, // spacer - 0x1af: 0x55108, // onresize - 0x1b0: 0x4a20b, // onmouseover - 0x1b1: 0x5cc08, // onunload - 0x1b2: 0x56708, // onseeked - 0x1b4: 0x2140d, // typemustmatch - 0x1b5: 0x1cc06, // figure - 0x1b6: 0x4950a, // onmouseout - 0x1b7: 0x25e03, // pre - 0x1b8: 0x50705, // width - 0x1b9: 0x19906, // sorted - 0x1bb: 0x5704, // nobr - 0x1be: 0x5302, // tt - 0x1bf: 0x1105, // align - 0x1c0: 0x3e607, // oninput - 0x1c3: 0x41807, // onkeyup - 0x1c6: 0x1c00c, // onafterprint - 0x1c7: 0x210e, // accept-charset - 0x1c8: 0x33c06, // itemid - 0x1c9: 0x3e809, // inputmode - 0x1cb: 0x53306, // strike - 0x1cc: 0x5a903, // sub - 0x1cd: 0x10505, // track - 0x1ce: 0x38605, // start - 0x1d0: 0xd608, // basefont - 0x1d6: 0x1aa06, // source - 0x1d7: 0x18206, // legend - 0x1d8: 0x2d405, // thead - 0x1da: 0x8c05, // tfoot - 0x1dd: 0x1ec06, // object - 0x1de: 0x6e05, // media - 0x1df: 0x1670a, // annotation - 0x1e0: 0x20d0b, // formenctype - 0x1e2: 0x3d208, // noscript - 0x1e4: 0x55505, // sizes - 0x1e5: 0x1fc0c, // autocomplete - 0x1e6: 0x9504, // span - 0x1e7: 0x9808, // noframes - 0x1e8: 0x24b06, // target - 0x1e9: 0x38f06, // ondrop - 0x1ea: 0x2b306, // applet - 0x1ec: 0x5a08, // reversed - 0x1f0: 0x2a907, // isindex - 0x1f3: 0x27008, // hreflang - 0x1f5: 0x2f302, // h5 - 0x1f6: 0x4f307, // address - 0x1fa: 0x2e103, // max - 0x1fb: 0xc30b, // placeholder - 0x1fc: 0x2f608, // textarea - 0x1fe: 0x4ad09, // onmouseup - 0x1ff: 0x3800b, // ondragstart + 0x1: 0xe60a, // mediagroup + 0x2: 0x2e404, // lang + 0x4: 0x2c09, // accesskey + 0x5: 0x8b08, // frameset + 0x7: 0x63a08, // onselect + 0x8: 0x71106, // system + 0xa: 0x64905, // width + 0xc: 0x2890b, // formenctype + 0xd: 0x13702, // ol + 0xe: 0x3970b, // oncuechange + 0x10: 0x14b03, // bdo + 0x11: 0x11505, // audio + 0x12: 0x17a09, // draggable + 0x14: 0x2f105, // video + 0x15: 0x2b102, // mn + 0x16: 0x38704, // menu + 0x17: 0x2cf06, // poster + 0x19: 0xf606, // footer + 0x1a: 0x2a806, // method + 0x1b: 0x2b808, // datetime + 0x1c: 0x19507, // onabort + 0x1d: 0x460e, // updateviacache + 0x1e: 0xff05, // async + 0x1f: 0x49d06, // onload + 0x21: 0x11908, // oncancel + 0x22: 0x62908, // onseeked + 0x23: 0x30205, // image + 0x24: 0x5d812, // onrejectionhandled + 0x26: 0x17404, // link + 0x27: 0x51d06, // output + 0x28: 0x33104, // head + 0x29: 0x4ff0c, // onmouseleave + 0x2a: 0x57f07, // onpaste + 0x2b: 0x5a409, // onplaying + 0x2c: 0x1c407, // colspan + 0x2f: 0x1bf05, // color + 0x30: 0x5f504, // size + 0x31: 0x2e80a, // http-equiv + 0x33: 0x601, // i + 0x34: 0x5590a, // onpagehide + 0x35: 0x68c14, // onunhandledrejection + 0x37: 0x42a07, // onerror + 0x3a: 0x3b08, // basefont + 0x3f: 0x1303, // nav + 0x40: 0x17704, // kind + 0x41: 0x35708, // readonly + 0x42: 0x30806, // mglyph + 0x44: 0xb202, // li + 0x46: 0x2d506, // hidden + 0x47: 0x70e03, // svg + 0x48: 0x58304, // step + 0x49: 0x23f09, // integrity + 0x4a: 0x58606, // public + 0x4c: 0x1ab03, // col + 0x4d: 0x1870a, // blockquote + 0x4e: 0x34f02, // h5 + 0x50: 0x5b908, // progress + 0x51: 0x5f505, // sizes + 0x52: 0x34502, // h4 + 0x56: 0x33005, // thead + 0x57: 0xd607, // keytype + 0x58: 0x5b70a, // onprogress + 0x59: 0x44b09, // inputmode + 0x5a: 0x3b109, // ondragend + 0x5d: 0x3a205, // oncut + 0x5e: 0x43706, // spacer + 0x5f: 0x1ab08, // colgroup + 0x62: 0x16502, // is + 0x65: 0x3c02, // as + 0x66: 0x54809, // onoffline + 0x67: 0x33706, // sorted + 0x69: 0x48d10, // onlanguagechange + 0x6c: 0x43d0c, // onhashchange + 0x6d: 0x9604, // name + 0x6e: 0xf505, // tfoot + 0x6f: 0x56104, // desc + 0x70: 0x33d03, // max + 0x72: 0x1ea06, // coords + 0x73: 0x30d02, // h3 + 0x74: 0x6e70e, // onbeforeunload + 0x75: 0x9c04, // rows + 0x76: 0x63c06, // select + 0x77: 0x9805, // meter + 0x78: 0x38b06, // itemid + 0x79: 0x53c0c, // onmousewheel + 0x7a: 0x5c006, // srcdoc + 0x7d: 0x1ba05, // track + 0x7f: 0x31f08, // itemtype + 0x82: 0xa402, // mo + 0x83: 0x41b08, // onchange + 0x84: 0x33107, // headers + 0x85: 0x5cc0c, // onratechange + 0x86: 0x60819, // onsecuritypolicyviolation + 0x88: 0x4a508, // datalist + 0x89: 0x4e80b, // onmousedown + 0x8a: 0x1ef04, // slot + 0x8b: 0x4b010, // onloadedmetadata + 0x8c: 0x1a06, // accept + 0x8d: 0x26806, // object + 0x91: 0x6b30e, // onvolumechange + 0x92: 0x2107, // charset + 0x93: 0x27613, // onautocompleteerror + 0x94: 0xc113, // allowpaymentrequest + 0x95: 0x2804, // body + 0x96: 0x10a07, // default + 0x97: 0x63c08, // selected + 0x98: 0x21e04, // face + 0x99: 0x1e505, // shape + 0x9b: 0x68408, // ontoggle + 0x9e: 0x64b02, // dt + 0x9f: 0xb604, // mark + 0xa1: 0xb01, // u + 0xa4: 0x6ab08, // onunload + 0xa5: 0x5d04, // loop + 0xa6: 0x16408, // disabled + 0xaa: 0x42307, // onended + 0xab: 0xb00a, // malignmark + 0xad: 0x67b09, // onsuspend + 0xae: 0x35105, // mtext + 0xaf: 0x64f06, // onsort + 0xb0: 0x19d08, // itemprop + 0xb3: 0x67109, // itemscope + 0xb4: 0x17305, // blink + 0xb6: 0x3b106, // ondrag + 0xb7: 0xa702, // ul + 0xb8: 0x26e04, // form + 0xb9: 0x12907, // sandbox + 0xba: 0x8b05, // frame + 0xbb: 0x1505, // value + 0xbc: 0x66209, // onstorage + 0xbf: 0xaa07, // acronym + 0xc0: 0x19a02, // rt + 0xc2: 0x202, // br + 0xc3: 0x22608, // fieldset + 0xc4: 0x2900d, // typemustmatch + 0xc5: 0xa208, // nomodule + 0xc6: 0x6c07, // noembed + 0xc7: 0x69e0d, // onbeforeprint + 0xc8: 0x19106, // button + 0xc9: 0x2f507, // onclick + 0xca: 0x70407, // summary + 0xcd: 0xfb04, // ruby + 0xce: 0x56405, // class + 0xcf: 0x3f40b, // ondragstart + 0xd0: 0x23107, // caption + 0xd4: 0xdd0e, // allowusermedia + 0xd5: 0x4cf0b, // onloadstart + 0xd9: 0x16b03, // div + 0xda: 0x4a904, // list + 0xdb: 0x32e04, // math + 0xdc: 0x44b05, // input + 0xdf: 0x3ea0a, // ondragover + 0xe0: 0x2de02, // h2 + 0xe2: 0x1b209, // plaintext + 0xe4: 0x4f30c, // onmouseenter + 0xe7: 0x47907, // checked + 0xe8: 0x47003, // pre + 0xea: 0x35f08, // multiple + 0xeb: 0xba03, // bdi + 0xec: 0x33d09, // maxlength + 0xed: 0xcf01, // q + 0xee: 0x61f0a, // onauxclick + 0xf0: 0x57c03, // wbr + 0xf2: 0x3b04, // base + 0xf3: 0x6e306, // option + 0xf5: 0x41310, // ondurationchange + 0xf7: 0x8908, // noframes + 0xf9: 0x40508, // dropzone + 0xfb: 0x67505, // scope + 0xfc: 0x8008, // reversed + 0xfd: 0x3ba0b, // ondragenter + 0xfe: 0x3fa05, // start + 0xff: 0x12f03, // xmp + 0x100: 0x5f907, // srclang + 0x101: 0x30703, // img + 0x104: 0x101, // b + 0x105: 0x25403, // for + 0x106: 0x10705, // aside + 0x107: 0x44907, // oninput + 0x108: 0x35604, // area + 0x109: 0x2a40a, // formmethod + 0x10a: 0x72604, // wrap + 0x10c: 0x23c02, // rp + 0x10d: 0x46b0a, // onkeypress + 0x10e: 0x6802, // tt + 0x110: 0x34702, // mi + 0x111: 0x36705, // muted + 0x112: 0xf303, // alt + 0x113: 0x5c504, // code + 0x114: 0x6e02, // em + 0x115: 0x3c50a, // ondragexit + 0x117: 0x9f04, // span + 0x119: 0x6d708, // manifest + 0x11a: 0x38708, // menuitem + 0x11b: 0x58b07, // content + 0x11d: 0x6c109, // onwaiting + 0x11f: 0x4c609, // onloadend + 0x121: 0x37e0d, // oncontextmenu + 0x123: 0x56d06, // onblur + 0x124: 0x3fc07, // article + 0x125: 0x9303, // dir + 0x126: 0xef04, // ping + 0x127: 0x24c08, // required + 0x128: 0x45509, // oninvalid + 0x129: 0xb105, // align + 0x12b: 0x58a04, // icon + 0x12c: 0x64d02, // h6 + 0x12d: 0x1c404, // cols + 0x12e: 0x22e0a, // figcaption + 0x12f: 0x45e09, // onkeydown + 0x130: 0x66b08, // onsubmit + 0x131: 0x14d09, // oncanplay + 0x132: 0x70b03, // sup + 0x133: 0xc01, // p + 0x135: 0x40a09, // onemptied + 0x136: 0x39106, // oncopy + 0x137: 0x19c04, // cite + 0x138: 0x3a70a, // ondblclick + 0x13a: 0x50b0b, // onmousemove + 0x13c: 0x66d03, // sub + 0x13d: 0x48703, // rel + 0x13e: 0x5f08, // optgroup + 0x142: 0x9c07, // rowspan + 0x143: 0x37806, // source + 0x144: 0x21608, // noscript + 0x145: 0x1a304, // open + 0x146: 0x20403, // ins + 0x147: 0x2540d, // foreignObject + 0x148: 0x5ad0a, // onpopstate + 0x14a: 0x28d07, // enctype + 0x14b: 0x2760e, // onautocomplete + 0x14c: 0x35208, // textarea + 0x14e: 0x2780c, // autocomplete + 0x14f: 0x15702, // hr + 0x150: 0x1de08, // controls + 0x151: 0x10902, // id + 0x153: 0x2360c, // onafterprint + 0x155: 0x2610d, // foreignobject + 0x156: 0x32707, // marquee + 0x157: 0x59a07, // onpause + 0x158: 0x5e602, // dl + 0x159: 0x5206, // height + 0x15a: 0x34703, // min + 0x15b: 0x9307, // dirname + 0x15c: 0x1f209, // translate + 0x15d: 0x5604, // html + 0x15e: 0x34709, // minlength + 0x15f: 0x48607, // preload + 0x160: 0x71408, // template + 0x161: 0x3df0b, // ondragleave + 0x162: 0x3a02, // rb + 0x164: 0x5c003, // src + 0x165: 0x6dd06, // strong + 0x167: 0x7804, // samp + 0x168: 0x6f307, // address + 0x169: 0x55108, // ononline + 0x16b: 0x1310b, // placeholder + 0x16c: 0x2c406, // target + 0x16d: 0x20605, // small + 0x16e: 0x6ca07, // onwheel + 0x16f: 0x1c90a, // annotation + 0x170: 0x4740a, // spellcheck + 0x171: 0x7207, // details + 0x172: 0x10306, // canvas + 0x173: 0x12109, // autofocus + 0x174: 0xc05, // param + 0x176: 0x46308, // download + 0x177: 0x45203, // del + 0x178: 0x36c07, // onclose + 0x179: 0xb903, // kbd + 0x17a: 0x31906, // applet + 0x17b: 0x2e004, // href + 0x17c: 0x5f108, // onresize + 0x17e: 0x49d0c, // onloadeddata + 0x180: 0xcc02, // tr + 0x181: 0x2c00a, // formtarget + 0x182: 0x11005, // title + 0x183: 0x6ff05, // style + 0x184: 0xd206, // strike + 0x185: 0x59e06, // usemap + 0x186: 0x2fc06, // iframe + 0x187: 0x1004, // main + 0x189: 0x7b07, // picture + 0x18c: 0x31605, // ismap + 0x18e: 0x4a504, // data + 0x18f: 0x5905, // label + 0x191: 0x3d10e, // referrerpolicy + 0x192: 0x15602, // th + 0x194: 0x53606, // prompt + 0x195: 0x56807, // section + 0x197: 0x6d107, // optimum + 0x198: 0x2db04, // high + 0x199: 0x15c02, // h1 + 0x19a: 0x65909, // onstalled + 0x19b: 0x16d03, // var + 0x19c: 0x4204, // time + 0x19e: 0x67402, // ms + 0x19f: 0x33106, // header + 0x1a0: 0x4da09, // onmessage + 0x1a1: 0x1a605, // nonce + 0x1a2: 0x26e0a, // formaction + 0x1a3: 0x22006, // center + 0x1a4: 0x3704, // nobr + 0x1a5: 0x59505, // table + 0x1a6: 0x4a907, // listing + 0x1a7: 0x18106, // legend + 0x1a9: 0x29b09, // challenge + 0x1aa: 0x24806, // figure + 0x1ab: 0xe605, // media + 0x1ae: 0xd904, // type + 0x1af: 0x3f04, // font + 0x1b0: 0x4da0e, // onmessageerror + 0x1b1: 0x37108, // seamless + 0x1b2: 0x8703, // dfn + 0x1b3: 0x5c705, // defer + 0x1b4: 0xc303, // low + 0x1b5: 0x19a03, // rtc + 0x1b6: 0x5230b, // onmouseover + 0x1b7: 0x2b20a, // novalidate + 0x1b8: 0x71c0a, // workertype + 0x1ba: 0x3cd07, // itemref + 0x1bd: 0x1, // a + 0x1be: 0x31803, // map + 0x1bf: 0x400c, // ontimeupdate + 0x1c0: 0x15e07, // bgsound + 0x1c1: 0x3206, // keygen + 0x1c2: 0x2705, // tbody + 0x1c5: 0x64406, // onshow + 0x1c7: 0x2501, // s + 0x1c8: 0x6607, // pattern + 0x1cc: 0x14d10, // oncanplaythrough + 0x1ce: 0x2d702, // dd + 0x1cf: 0x6f906, // srcset + 0x1d0: 0x17003, // big + 0x1d2: 0x65108, // sortable + 0x1d3: 0x48007, // onkeyup + 0x1d5: 0x5a406, // onplay + 0x1d7: 0x4b804, // meta + 0x1d8: 0x40306, // ondrop + 0x1da: 0x60008, // onscroll + 0x1db: 0x1fb0b, // crossorigin + 0x1dc: 0x5730a, // onpageshow + 0x1dd: 0x4, // abbr + 0x1de: 0x9202, // td + 0x1df: 0x58b0f, // contenteditable + 0x1e0: 0x27206, // action + 0x1e1: 0x1400b, // playsinline + 0x1e2: 0x43107, // onfocus + 0x1e3: 0x2e008, // hreflang + 0x1e5: 0x5160a, // onmouseout + 0x1e6: 0x5ea07, // onreset + 0x1e7: 0x13c08, // autoplay + 0x1e8: 0x63109, // onseeking + 0x1ea: 0x67506, // scoped + 0x1ec: 0x30a, // radiogroup + 0x1ee: 0x3800b, // contextmenu + 0x1ef: 0x52e09, // onmouseup + 0x1f1: 0x2ca06, // hgroup + 0x1f2: 0x2080f, // allowfullscreen + 0x1f3: 0x4be08, // tabindex + 0x1f6: 0x30f07, // isindex + 0x1f7: 0x1a0e, // accept-charset + 0x1f8: 0x2ae0e, // formnovalidate + 0x1fb: 0x1c90e, // annotation-xml + 0x1fc: 0x6e05, // embed + 0x1fd: 0x21806, // script + 0x1fe: 0xbb06, // dialog + 0x1ff: 0x1d707, // command } -const atomText = "abbradiogrouparamalignmarkbdialogaccept-charsetbodyaccesskey" + - "genavaluealtdetailsampatternobreversedfnoembedirnamediagroup" + - "ingasyncanvasidefaultfooterowspanoframesetitleaudionblurubya" + - "utofocusandboxmplaceholderautoplaybasefontimeupdatebdoncance" + - "labelooptgrouplaintextrackindisabledivarbgsoundlowbrbigblink" + - "blockquotebuttonabortranslatecodefercolgroupostercolorcolspa" + - "nnotation-xmlcommandraggablegendcontrolsmallcoordsortedcross" + - "originsourcefieldsetfigcaptionafterprintfigurequiredforeignO" + - "bjectforeignobjectformactionautocompleteerrorformenctypemust" + - "matchallengeformmethodformnovalidatetimeterformtargetheightm" + - "lhgroupreloadhiddenhigh1hreflanghttp-equivideoncanplaythroug" + - "h2iframeimageimglyph3isindexismappletitemscopeditemtypemarqu" + - "eematheaderspacermaxlength4minlength5mtextareadonlymultiplem" + - "utedonclickoncloseamlesspellcheckedoncontextmenuitemidoncuec" + - "hangeondblclickondragendondragenterondragleaveondragoverondr" + - "agstarticleondropzonemptiedondurationchangeonendedonerroronf" + - "ocusrcdocitempropenoscriptonhashchangeoninputmodeloninvalido" + - "nkeydownloadonkeypressrclangonkeyupublicontenteditableonlang" + - "uagechangeonloadeddatalistingonloadedmetadatabindexonloadsta" + - "rtonmessageonmousedownonmousemoveonmouseoutputonmouseoveronm" + - "ouseuponmousewheelonofflineononlineonpagehidesclassectionbef" + - "oreunloaddresshapeonpageshowidth6onpausemaponplayingonpopsta" + - "teonprogresstrikeytypeonratechangeonresetonresizestrongonscr" + - "ollonseekedonseekingonselectedonshowraponsortableonstalledon" + - "storageonsubmitemrefacenteronsuspendontoggleonunloadonvolume" + - "changeonwaitingoptimumanifestepromptoptionbeforeprintstylesu" + - "mmarysupsvgsystemplate" +const atomText = "abbradiogrouparamainavalueaccept-charsetbodyaccesskeygenobrb" + + "asefontimeupdateviacacheightmlabelooptgroupatternoembedetail" + + "sampictureversedfnoframesetdirnameterowspanomoduleacronymali" + + "gnmarkbdialogallowpaymentrequestrikeytypeallowusermediagroup" + + "ingaltfooterubyasyncanvasidefaultitleaudioncancelautofocusan" + + "dboxmplaceholderautoplaysinlinebdoncanplaythrough1bgsoundisa" + + "bledivarbigblinkindraggablegendblockquotebuttonabortcitempro" + + "penoncecolgrouplaintextrackcolorcolspannotation-xmlcommandco" + + "ntrolshapecoordslotranslatecrossoriginsmallowfullscreenoscri" + + "ptfacenterfieldsetfigcaptionafterprintegrityfigurequiredfore" + + "ignObjectforeignobjectformactionautocompleteerrorformenctype" + + "mustmatchallengeformmethodformnovalidatetimeformtargethgroup" + + "osterhiddenhigh2hreflanghttp-equivideonclickiframeimageimgly" + + "ph3isindexismappletitemtypemarqueematheadersortedmaxlength4m" + + "inlength5mtextareadonlymultiplemutedoncloseamlessourceoncont" + + "extmenuitemidoncopyoncuechangeoncutondblclickondragendondrag" + + "enterondragexitemreferrerpolicyondragleaveondragoverondragst" + + "articleondropzonemptiedondurationchangeonendedonerroronfocus" + + "paceronhashchangeoninputmodeloninvalidonkeydownloadonkeypres" + + "spellcheckedonkeyupreloadonlanguagechangeonloadeddatalisting" + + "onloadedmetadatabindexonloadendonloadstartonmessageerroronmo" + + "usedownonmouseenteronmouseleaveonmousemoveonmouseoutputonmou" + + "seoveronmouseupromptonmousewheelonofflineononlineonpagehides" + + "classectionbluronpageshowbronpastepublicontenteditableonpaus" + + "emaponplayingonpopstateonprogressrcdocodeferonratechangeonre" + + "jectionhandledonresetonresizesrclangonscrollonsecuritypolicy" + + "violationauxclickonseekedonseekingonselectedonshowidth6onsor" + + "tableonstalledonstorageonsubmitemscopedonsuspendontoggleonun" + + "handledrejectionbeforeprintonunloadonvolumechangeonwaitingon" + + "wheeloptimumanifestrongoptionbeforeunloaddressrcsetstylesumm" + + "arysupsvgsystemplateworkertypewrap" diff --git a/vendor/golang.org/x/net/html/const.go b/vendor/golang.org/x/net/html/const.go index 52f651ff6db82..a3a918f0b381d 100644 --- a/vendor/golang.org/x/net/html/const.go +++ b/vendor/golang.org/x/net/html/const.go @@ -4,7 +4,7 @@ package html -// Section 12.2.3.2 of the HTML5 specification says "The following elements +// Section 12.2.4.2 of the HTML5 specification says "The following elements // have varying levels of special parsing rules". // https://html.spec.whatwg.org/multipage/syntax.html#the-stack-of-open-elements var isSpecialElementMap = map[string]bool{ @@ -52,10 +52,12 @@ var isSpecialElementMap = map[string]bool{ "iframe": true, "img": true, "input": true, - "isindex": true, + "isindex": true, // The 'isindex' element has been removed, but keep it for backwards compatibility. + "keygen": true, "li": true, "link": true, "listing": true, + "main": true, "marquee": true, "menu": true, "meta": true, @@ -95,8 +97,16 @@ func isSpecialElement(element *Node) bool { switch element.Namespace { case "", "html": return isSpecialElementMap[element.Data] + case "math": + switch element.Data { + case "mi", "mo", "mn", "ms", "mtext", "annotation-xml": + return true + } case "svg": - return element.Data == "foreignObject" + switch element.Data { + case "foreignObject", "desc", "title": + return true + } } return false } diff --git a/vendor/golang.org/x/net/html/doc.go b/vendor/golang.org/x/net/html/doc.go index 94f496874abab..822ed42a04c1c 100644 --- a/vendor/golang.org/x/net/html/doc.go +++ b/vendor/golang.org/x/net/html/doc.go @@ -49,18 +49,18 @@ call to Next. For example, to extract an HTML page's anchor text: for { tt := z.Next() switch tt { - case ErrorToken: + case html.ErrorToken: return z.Err() - case TextToken: + case html.TextToken: if depth > 0 { // emitBytes should copy the []byte it receives, // if it doesn't process it immediately. emitBytes(z.Text()) } - case StartTagToken, EndTagToken: + case html.StartTagToken, html.EndTagToken: tn, _ := z.TagName() if len(tn) == 1 && tn[0] == 'a' { - if tt == StartTagToken { + if tt == html.StartTagToken { depth++ } else { depth-- diff --git a/vendor/golang.org/x/net/html/entity.go b/vendor/golang.org/x/net/html/entity.go index a50c04c60e95f..b628880a014d8 100644 --- a/vendor/golang.org/x/net/html/entity.go +++ b/vendor/golang.org/x/net/html/entity.go @@ -75,2083 +75,2083 @@ var entity = map[string]rune{ "Copf;": '\U00002102', "Coproduct;": '\U00002210', "CounterClockwiseContourIntegral;": '\U00002233', - "Cross;": '\U00002A2F', - "Cscr;": '\U0001D49E', - "Cup;": '\U000022D3', - "CupCap;": '\U0000224D', - "DD;": '\U00002145', - "DDotrahd;": '\U00002911', - "DJcy;": '\U00000402', - "DScy;": '\U00000405', - "DZcy;": '\U0000040F', - "Dagger;": '\U00002021', - "Darr;": '\U000021A1', - "Dashv;": '\U00002AE4', - "Dcaron;": '\U0000010E', - "Dcy;": '\U00000414', - "Del;": '\U00002207', - "Delta;": '\U00000394', - "Dfr;": '\U0001D507', - "DiacriticalAcute;": '\U000000B4', - "DiacriticalDot;": '\U000002D9', - "DiacriticalDoubleAcute;": '\U000002DD', - "DiacriticalGrave;": '\U00000060', - "DiacriticalTilde;": '\U000002DC', - "Diamond;": '\U000022C4', - "DifferentialD;": '\U00002146', - "Dopf;": '\U0001D53B', - "Dot;": '\U000000A8', - "DotDot;": '\U000020DC', - "DotEqual;": '\U00002250', - "DoubleContourIntegral;": '\U0000222F', - "DoubleDot;": '\U000000A8', - "DoubleDownArrow;": '\U000021D3', - "DoubleLeftArrow;": '\U000021D0', - "DoubleLeftRightArrow;": '\U000021D4', - "DoubleLeftTee;": '\U00002AE4', - "DoubleLongLeftArrow;": '\U000027F8', - "DoubleLongLeftRightArrow;": '\U000027FA', - "DoubleLongRightArrow;": '\U000027F9', - "DoubleRightArrow;": '\U000021D2', - "DoubleRightTee;": '\U000022A8', - "DoubleUpArrow;": '\U000021D1', - "DoubleUpDownArrow;": '\U000021D5', - "DoubleVerticalBar;": '\U00002225', - "DownArrow;": '\U00002193', - "DownArrowBar;": '\U00002913', - "DownArrowUpArrow;": '\U000021F5', - "DownBreve;": '\U00000311', - "DownLeftRightVector;": '\U00002950', - "DownLeftTeeVector;": '\U0000295E', - "DownLeftVector;": '\U000021BD', - "DownLeftVectorBar;": '\U00002956', - "DownRightTeeVector;": '\U0000295F', - "DownRightVector;": '\U000021C1', - "DownRightVectorBar;": '\U00002957', - "DownTee;": '\U000022A4', - "DownTeeArrow;": '\U000021A7', - "Downarrow;": '\U000021D3', - "Dscr;": '\U0001D49F', - "Dstrok;": '\U00000110', - "ENG;": '\U0000014A', - "ETH;": '\U000000D0', - "Eacute;": '\U000000C9', - "Ecaron;": '\U0000011A', - "Ecirc;": '\U000000CA', - "Ecy;": '\U0000042D', - "Edot;": '\U00000116', - "Efr;": '\U0001D508', - "Egrave;": '\U000000C8', - "Element;": '\U00002208', - "Emacr;": '\U00000112', - "EmptySmallSquare;": '\U000025FB', - "EmptyVerySmallSquare;": '\U000025AB', - "Eogon;": '\U00000118', - "Eopf;": '\U0001D53C', - "Epsilon;": '\U00000395', - "Equal;": '\U00002A75', - "EqualTilde;": '\U00002242', - "Equilibrium;": '\U000021CC', - "Escr;": '\U00002130', - "Esim;": '\U00002A73', - "Eta;": '\U00000397', - "Euml;": '\U000000CB', - "Exists;": '\U00002203', - "ExponentialE;": '\U00002147', - "Fcy;": '\U00000424', - "Ffr;": '\U0001D509', - "FilledSmallSquare;": '\U000025FC', - "FilledVerySmallSquare;": '\U000025AA', - "Fopf;": '\U0001D53D', - "ForAll;": '\U00002200', - "Fouriertrf;": '\U00002131', - "Fscr;": '\U00002131', - "GJcy;": '\U00000403', - "GT;": '\U0000003E', - "Gamma;": '\U00000393', - "Gammad;": '\U000003DC', - "Gbreve;": '\U0000011E', - "Gcedil;": '\U00000122', - "Gcirc;": '\U0000011C', - "Gcy;": '\U00000413', - "Gdot;": '\U00000120', - "Gfr;": '\U0001D50A', - "Gg;": '\U000022D9', - "Gopf;": '\U0001D53E', - "GreaterEqual;": '\U00002265', - "GreaterEqualLess;": '\U000022DB', - "GreaterFullEqual;": '\U00002267', - "GreaterGreater;": '\U00002AA2', - "GreaterLess;": '\U00002277', - "GreaterSlantEqual;": '\U00002A7E', - "GreaterTilde;": '\U00002273', - "Gscr;": '\U0001D4A2', - "Gt;": '\U0000226B', - "HARDcy;": '\U0000042A', - "Hacek;": '\U000002C7', - "Hat;": '\U0000005E', - "Hcirc;": '\U00000124', - "Hfr;": '\U0000210C', - "HilbertSpace;": '\U0000210B', - "Hopf;": '\U0000210D', - "HorizontalLine;": '\U00002500', - "Hscr;": '\U0000210B', - "Hstrok;": '\U00000126', - "HumpDownHump;": '\U0000224E', - "HumpEqual;": '\U0000224F', - "IEcy;": '\U00000415', - "IJlig;": '\U00000132', - "IOcy;": '\U00000401', - "Iacute;": '\U000000CD', - "Icirc;": '\U000000CE', - "Icy;": '\U00000418', - "Idot;": '\U00000130', - "Ifr;": '\U00002111', - "Igrave;": '\U000000CC', - "Im;": '\U00002111', - "Imacr;": '\U0000012A', - "ImaginaryI;": '\U00002148', - "Implies;": '\U000021D2', - "Int;": '\U0000222C', - "Integral;": '\U0000222B', - "Intersection;": '\U000022C2', - "InvisibleComma;": '\U00002063', - "InvisibleTimes;": '\U00002062', - "Iogon;": '\U0000012E', - "Iopf;": '\U0001D540', - "Iota;": '\U00000399', - "Iscr;": '\U00002110', - "Itilde;": '\U00000128', - "Iukcy;": '\U00000406', - "Iuml;": '\U000000CF', - "Jcirc;": '\U00000134', - "Jcy;": '\U00000419', - "Jfr;": '\U0001D50D', - "Jopf;": '\U0001D541', - "Jscr;": '\U0001D4A5', - "Jsercy;": '\U00000408', - "Jukcy;": '\U00000404', - "KHcy;": '\U00000425', - "KJcy;": '\U0000040C', - "Kappa;": '\U0000039A', - "Kcedil;": '\U00000136', - "Kcy;": '\U0000041A', - "Kfr;": '\U0001D50E', - "Kopf;": '\U0001D542', - "Kscr;": '\U0001D4A6', - "LJcy;": '\U00000409', - "LT;": '\U0000003C', - "Lacute;": '\U00000139', - "Lambda;": '\U0000039B', - "Lang;": '\U000027EA', - "Laplacetrf;": '\U00002112', - "Larr;": '\U0000219E', - "Lcaron;": '\U0000013D', - "Lcedil;": '\U0000013B', - "Lcy;": '\U0000041B', - "LeftAngleBracket;": '\U000027E8', - "LeftArrow;": '\U00002190', - "LeftArrowBar;": '\U000021E4', - "LeftArrowRightArrow;": '\U000021C6', - "LeftCeiling;": '\U00002308', - "LeftDoubleBracket;": '\U000027E6', - "LeftDownTeeVector;": '\U00002961', - "LeftDownVector;": '\U000021C3', - "LeftDownVectorBar;": '\U00002959', - "LeftFloor;": '\U0000230A', - "LeftRightArrow;": '\U00002194', - "LeftRightVector;": '\U0000294E', - "LeftTee;": '\U000022A3', - "LeftTeeArrow;": '\U000021A4', - "LeftTeeVector;": '\U0000295A', - "LeftTriangle;": '\U000022B2', - "LeftTriangleBar;": '\U000029CF', - "LeftTriangleEqual;": '\U000022B4', - "LeftUpDownVector;": '\U00002951', - "LeftUpTeeVector;": '\U00002960', - "LeftUpVector;": '\U000021BF', - "LeftUpVectorBar;": '\U00002958', - "LeftVector;": '\U000021BC', - "LeftVectorBar;": '\U00002952', - "Leftarrow;": '\U000021D0', - "Leftrightarrow;": '\U000021D4', - "LessEqualGreater;": '\U000022DA', - "LessFullEqual;": '\U00002266', - "LessGreater;": '\U00002276', - "LessLess;": '\U00002AA1', - "LessSlantEqual;": '\U00002A7D', - "LessTilde;": '\U00002272', - "Lfr;": '\U0001D50F', - "Ll;": '\U000022D8', - "Lleftarrow;": '\U000021DA', - "Lmidot;": '\U0000013F', - "LongLeftArrow;": '\U000027F5', - "LongLeftRightArrow;": '\U000027F7', - "LongRightArrow;": '\U000027F6', - "Longleftarrow;": '\U000027F8', - "Longleftrightarrow;": '\U000027FA', - "Longrightarrow;": '\U000027F9', - "Lopf;": '\U0001D543', - "LowerLeftArrow;": '\U00002199', - "LowerRightArrow;": '\U00002198', - "Lscr;": '\U00002112', - "Lsh;": '\U000021B0', - "Lstrok;": '\U00000141', - "Lt;": '\U0000226A', - "Map;": '\U00002905', - "Mcy;": '\U0000041C', - "MediumSpace;": '\U0000205F', - "Mellintrf;": '\U00002133', - "Mfr;": '\U0001D510', - "MinusPlus;": '\U00002213', - "Mopf;": '\U0001D544', - "Mscr;": '\U00002133', - "Mu;": '\U0000039C', - "NJcy;": '\U0000040A', - "Nacute;": '\U00000143', - "Ncaron;": '\U00000147', - "Ncedil;": '\U00000145', - "Ncy;": '\U0000041D', - "NegativeMediumSpace;": '\U0000200B', - "NegativeThickSpace;": '\U0000200B', - "NegativeThinSpace;": '\U0000200B', - "NegativeVeryThinSpace;": '\U0000200B', - "NestedGreaterGreater;": '\U0000226B', - "NestedLessLess;": '\U0000226A', - "NewLine;": '\U0000000A', - "Nfr;": '\U0001D511', - "NoBreak;": '\U00002060', - "NonBreakingSpace;": '\U000000A0', - "Nopf;": '\U00002115', - "Not;": '\U00002AEC', - "NotCongruent;": '\U00002262', - "NotCupCap;": '\U0000226D', - "NotDoubleVerticalBar;": '\U00002226', - "NotElement;": '\U00002209', - "NotEqual;": '\U00002260', - "NotExists;": '\U00002204', - "NotGreater;": '\U0000226F', - "NotGreaterEqual;": '\U00002271', - "NotGreaterLess;": '\U00002279', - "NotGreaterTilde;": '\U00002275', - "NotLeftTriangle;": '\U000022EA', - "NotLeftTriangleEqual;": '\U000022EC', - "NotLess;": '\U0000226E', - "NotLessEqual;": '\U00002270', - "NotLessGreater;": '\U00002278', - "NotLessTilde;": '\U00002274', - "NotPrecedes;": '\U00002280', - "NotPrecedesSlantEqual;": '\U000022E0', - "NotReverseElement;": '\U0000220C', - "NotRightTriangle;": '\U000022EB', - "NotRightTriangleEqual;": '\U000022ED', - "NotSquareSubsetEqual;": '\U000022E2', - "NotSquareSupersetEqual;": '\U000022E3', - "NotSubsetEqual;": '\U00002288', - "NotSucceeds;": '\U00002281', - "NotSucceedsSlantEqual;": '\U000022E1', - "NotSupersetEqual;": '\U00002289', - "NotTilde;": '\U00002241', - "NotTildeEqual;": '\U00002244', - "NotTildeFullEqual;": '\U00002247', - "NotTildeTilde;": '\U00002249', - "NotVerticalBar;": '\U00002224', - "Nscr;": '\U0001D4A9', - "Ntilde;": '\U000000D1', - "Nu;": '\U0000039D', - "OElig;": '\U00000152', - "Oacute;": '\U000000D3', - "Ocirc;": '\U000000D4', - "Ocy;": '\U0000041E', - "Odblac;": '\U00000150', - "Ofr;": '\U0001D512', - "Ograve;": '\U000000D2', - "Omacr;": '\U0000014C', - "Omega;": '\U000003A9', - "Omicron;": '\U0000039F', - "Oopf;": '\U0001D546', - "OpenCurlyDoubleQuote;": '\U0000201C', - "OpenCurlyQuote;": '\U00002018', - "Or;": '\U00002A54', - "Oscr;": '\U0001D4AA', - "Oslash;": '\U000000D8', - "Otilde;": '\U000000D5', - "Otimes;": '\U00002A37', - "Ouml;": '\U000000D6', - "OverBar;": '\U0000203E', - "OverBrace;": '\U000023DE', - "OverBracket;": '\U000023B4', - "OverParenthesis;": '\U000023DC', - "PartialD;": '\U00002202', - "Pcy;": '\U0000041F', - "Pfr;": '\U0001D513', - "Phi;": '\U000003A6', - "Pi;": '\U000003A0', - "PlusMinus;": '\U000000B1', - "Poincareplane;": '\U0000210C', - "Popf;": '\U00002119', - "Pr;": '\U00002ABB', - "Precedes;": '\U0000227A', - "PrecedesEqual;": '\U00002AAF', - "PrecedesSlantEqual;": '\U0000227C', - "PrecedesTilde;": '\U0000227E', - "Prime;": '\U00002033', - "Product;": '\U0000220F', - "Proportion;": '\U00002237', - "Proportional;": '\U0000221D', - "Pscr;": '\U0001D4AB', - "Psi;": '\U000003A8', - "QUOT;": '\U00000022', - "Qfr;": '\U0001D514', - "Qopf;": '\U0000211A', - "Qscr;": '\U0001D4AC', - "RBarr;": '\U00002910', - "REG;": '\U000000AE', - "Racute;": '\U00000154', - "Rang;": '\U000027EB', - "Rarr;": '\U000021A0', - "Rarrtl;": '\U00002916', - "Rcaron;": '\U00000158', - "Rcedil;": '\U00000156', - "Rcy;": '\U00000420', - "Re;": '\U0000211C', - "ReverseElement;": '\U0000220B', - "ReverseEquilibrium;": '\U000021CB', - "ReverseUpEquilibrium;": '\U0000296F', - "Rfr;": '\U0000211C', - "Rho;": '\U000003A1', - "RightAngleBracket;": '\U000027E9', - "RightArrow;": '\U00002192', - "RightArrowBar;": '\U000021E5', - "RightArrowLeftArrow;": '\U000021C4', - "RightCeiling;": '\U00002309', - "RightDoubleBracket;": '\U000027E7', - "RightDownTeeVector;": '\U0000295D', - "RightDownVector;": '\U000021C2', - "RightDownVectorBar;": '\U00002955', - "RightFloor;": '\U0000230B', - "RightTee;": '\U000022A2', - "RightTeeArrow;": '\U000021A6', - "RightTeeVector;": '\U0000295B', - "RightTriangle;": '\U000022B3', - "RightTriangleBar;": '\U000029D0', - "RightTriangleEqual;": '\U000022B5', - "RightUpDownVector;": '\U0000294F', - "RightUpTeeVector;": '\U0000295C', - "RightUpVector;": '\U000021BE', - "RightUpVectorBar;": '\U00002954', - "RightVector;": '\U000021C0', - "RightVectorBar;": '\U00002953', - "Rightarrow;": '\U000021D2', - "Ropf;": '\U0000211D', - "RoundImplies;": '\U00002970', - "Rrightarrow;": '\U000021DB', - "Rscr;": '\U0000211B', - "Rsh;": '\U000021B1', - "RuleDelayed;": '\U000029F4', - "SHCHcy;": '\U00000429', - "SHcy;": '\U00000428', - "SOFTcy;": '\U0000042C', - "Sacute;": '\U0000015A', - "Sc;": '\U00002ABC', - "Scaron;": '\U00000160', - "Scedil;": '\U0000015E', - "Scirc;": '\U0000015C', - "Scy;": '\U00000421', - "Sfr;": '\U0001D516', - "ShortDownArrow;": '\U00002193', - "ShortLeftArrow;": '\U00002190', - "ShortRightArrow;": '\U00002192', - "ShortUpArrow;": '\U00002191', - "Sigma;": '\U000003A3', - "SmallCircle;": '\U00002218', - "Sopf;": '\U0001D54A', - "Sqrt;": '\U0000221A', - "Square;": '\U000025A1', - "SquareIntersection;": '\U00002293', - "SquareSubset;": '\U0000228F', - "SquareSubsetEqual;": '\U00002291', - "SquareSuperset;": '\U00002290', - "SquareSupersetEqual;": '\U00002292', - "SquareUnion;": '\U00002294', - "Sscr;": '\U0001D4AE', - "Star;": '\U000022C6', - "Sub;": '\U000022D0', - "Subset;": '\U000022D0', - "SubsetEqual;": '\U00002286', - "Succeeds;": '\U0000227B', - "SucceedsEqual;": '\U00002AB0', - "SucceedsSlantEqual;": '\U0000227D', - "SucceedsTilde;": '\U0000227F', - "SuchThat;": '\U0000220B', - "Sum;": '\U00002211', - "Sup;": '\U000022D1', - "Superset;": '\U00002283', - "SupersetEqual;": '\U00002287', - "Supset;": '\U000022D1', - "THORN;": '\U000000DE', - "TRADE;": '\U00002122', - "TSHcy;": '\U0000040B', - "TScy;": '\U00000426', - "Tab;": '\U00000009', - "Tau;": '\U000003A4', - "Tcaron;": '\U00000164', - "Tcedil;": '\U00000162', - "Tcy;": '\U00000422', - "Tfr;": '\U0001D517', - "Therefore;": '\U00002234', - "Theta;": '\U00000398', - "ThinSpace;": '\U00002009', - "Tilde;": '\U0000223C', - "TildeEqual;": '\U00002243', - "TildeFullEqual;": '\U00002245', - "TildeTilde;": '\U00002248', - "Topf;": '\U0001D54B', - "TripleDot;": '\U000020DB', - "Tscr;": '\U0001D4AF', - "Tstrok;": '\U00000166', - "Uacute;": '\U000000DA', - "Uarr;": '\U0000219F', - "Uarrocir;": '\U00002949', - "Ubrcy;": '\U0000040E', - "Ubreve;": '\U0000016C', - "Ucirc;": '\U000000DB', - "Ucy;": '\U00000423', - "Udblac;": '\U00000170', - "Ufr;": '\U0001D518', - "Ugrave;": '\U000000D9', - "Umacr;": '\U0000016A', - "UnderBar;": '\U0000005F', - "UnderBrace;": '\U000023DF', - "UnderBracket;": '\U000023B5', - "UnderParenthesis;": '\U000023DD', - "Union;": '\U000022C3', - "UnionPlus;": '\U0000228E', - "Uogon;": '\U00000172', - "Uopf;": '\U0001D54C', - "UpArrow;": '\U00002191', - "UpArrowBar;": '\U00002912', - "UpArrowDownArrow;": '\U000021C5', - "UpDownArrow;": '\U00002195', - "UpEquilibrium;": '\U0000296E', - "UpTee;": '\U000022A5', - "UpTeeArrow;": '\U000021A5', - "Uparrow;": '\U000021D1', - "Updownarrow;": '\U000021D5', - "UpperLeftArrow;": '\U00002196', - "UpperRightArrow;": '\U00002197', - "Upsi;": '\U000003D2', - "Upsilon;": '\U000003A5', - "Uring;": '\U0000016E', - "Uscr;": '\U0001D4B0', - "Utilde;": '\U00000168', - "Uuml;": '\U000000DC', - "VDash;": '\U000022AB', - "Vbar;": '\U00002AEB', - "Vcy;": '\U00000412', - "Vdash;": '\U000022A9', - "Vdashl;": '\U00002AE6', - "Vee;": '\U000022C1', - "Verbar;": '\U00002016', - "Vert;": '\U00002016', - "VerticalBar;": '\U00002223', - "VerticalLine;": '\U0000007C', - "VerticalSeparator;": '\U00002758', - "VerticalTilde;": '\U00002240', - "VeryThinSpace;": '\U0000200A', - "Vfr;": '\U0001D519', - "Vopf;": '\U0001D54D', - "Vscr;": '\U0001D4B1', - "Vvdash;": '\U000022AA', - "Wcirc;": '\U00000174', - "Wedge;": '\U000022C0', - "Wfr;": '\U0001D51A', - "Wopf;": '\U0001D54E', - "Wscr;": '\U0001D4B2', - "Xfr;": '\U0001D51B', - "Xi;": '\U0000039E', - "Xopf;": '\U0001D54F', - "Xscr;": '\U0001D4B3', - "YAcy;": '\U0000042F', - "YIcy;": '\U00000407', - "YUcy;": '\U0000042E', - "Yacute;": '\U000000DD', - "Ycirc;": '\U00000176', - "Ycy;": '\U0000042B', - "Yfr;": '\U0001D51C', - "Yopf;": '\U0001D550', - "Yscr;": '\U0001D4B4', - "Yuml;": '\U00000178', - "ZHcy;": '\U00000416', - "Zacute;": '\U00000179', - "Zcaron;": '\U0000017D', - "Zcy;": '\U00000417', - "Zdot;": '\U0000017B', - "ZeroWidthSpace;": '\U0000200B', - "Zeta;": '\U00000396', - "Zfr;": '\U00002128', - "Zopf;": '\U00002124', - "Zscr;": '\U0001D4B5', - "aacute;": '\U000000E1', - "abreve;": '\U00000103', - "ac;": '\U0000223E', - "acd;": '\U0000223F', - "acirc;": '\U000000E2', - "acute;": '\U000000B4', - "acy;": '\U00000430', - "aelig;": '\U000000E6', - "af;": '\U00002061', - "afr;": '\U0001D51E', - "agrave;": '\U000000E0', - "alefsym;": '\U00002135', - "aleph;": '\U00002135', - "alpha;": '\U000003B1', - "amacr;": '\U00000101', - "amalg;": '\U00002A3F', - "amp;": '\U00000026', - "and;": '\U00002227', - "andand;": '\U00002A55', - "andd;": '\U00002A5C', - "andslope;": '\U00002A58', - "andv;": '\U00002A5A', - "ang;": '\U00002220', - "ange;": '\U000029A4', - "angle;": '\U00002220', - "angmsd;": '\U00002221', - "angmsdaa;": '\U000029A8', - "angmsdab;": '\U000029A9', - "angmsdac;": '\U000029AA', - "angmsdad;": '\U000029AB', - "angmsdae;": '\U000029AC', - "angmsdaf;": '\U000029AD', - "angmsdag;": '\U000029AE', - "angmsdah;": '\U000029AF', - "angrt;": '\U0000221F', - "angrtvb;": '\U000022BE', - "angrtvbd;": '\U0000299D', - "angsph;": '\U00002222', - "angst;": '\U000000C5', - "angzarr;": '\U0000237C', - "aogon;": '\U00000105', - "aopf;": '\U0001D552', - "ap;": '\U00002248', - "apE;": '\U00002A70', - "apacir;": '\U00002A6F', - "ape;": '\U0000224A', - "apid;": '\U0000224B', - "apos;": '\U00000027', - "approx;": '\U00002248', - "approxeq;": '\U0000224A', - "aring;": '\U000000E5', - "ascr;": '\U0001D4B6', - "ast;": '\U0000002A', - "asymp;": '\U00002248', - "asympeq;": '\U0000224D', - "atilde;": '\U000000E3', - "auml;": '\U000000E4', - "awconint;": '\U00002233', - "awint;": '\U00002A11', - "bNot;": '\U00002AED', - "backcong;": '\U0000224C', - "backepsilon;": '\U000003F6', - "backprime;": '\U00002035', - "backsim;": '\U0000223D', - "backsimeq;": '\U000022CD', - "barvee;": '\U000022BD', - "barwed;": '\U00002305', - "barwedge;": '\U00002305', - "bbrk;": '\U000023B5', - "bbrktbrk;": '\U000023B6', - "bcong;": '\U0000224C', - "bcy;": '\U00000431', - "bdquo;": '\U0000201E', - "becaus;": '\U00002235', - "because;": '\U00002235', - "bemptyv;": '\U000029B0', - "bepsi;": '\U000003F6', - "bernou;": '\U0000212C', - "beta;": '\U000003B2', - "beth;": '\U00002136', - "between;": '\U0000226C', - "bfr;": '\U0001D51F', - "bigcap;": '\U000022C2', - "bigcirc;": '\U000025EF', - "bigcup;": '\U000022C3', - "bigodot;": '\U00002A00', - "bigoplus;": '\U00002A01', - "bigotimes;": '\U00002A02', - "bigsqcup;": '\U00002A06', - "bigstar;": '\U00002605', - "bigtriangledown;": '\U000025BD', - "bigtriangleup;": '\U000025B3', - "biguplus;": '\U00002A04', - "bigvee;": '\U000022C1', - "bigwedge;": '\U000022C0', - "bkarow;": '\U0000290D', - "blacklozenge;": '\U000029EB', - "blacksquare;": '\U000025AA', - "blacktriangle;": '\U000025B4', - "blacktriangledown;": '\U000025BE', - "blacktriangleleft;": '\U000025C2', - "blacktriangleright;": '\U000025B8', - "blank;": '\U00002423', - "blk12;": '\U00002592', - "blk14;": '\U00002591', - "blk34;": '\U00002593', - "block;": '\U00002588', - "bnot;": '\U00002310', - "bopf;": '\U0001D553', - "bot;": '\U000022A5', - "bottom;": '\U000022A5', - "bowtie;": '\U000022C8', - "boxDL;": '\U00002557', - "boxDR;": '\U00002554', - "boxDl;": '\U00002556', - "boxDr;": '\U00002553', - "boxH;": '\U00002550', - "boxHD;": '\U00002566', - "boxHU;": '\U00002569', - "boxHd;": '\U00002564', - "boxHu;": '\U00002567', - "boxUL;": '\U0000255D', - "boxUR;": '\U0000255A', - "boxUl;": '\U0000255C', - "boxUr;": '\U00002559', - "boxV;": '\U00002551', - "boxVH;": '\U0000256C', - "boxVL;": '\U00002563', - "boxVR;": '\U00002560', - "boxVh;": '\U0000256B', - "boxVl;": '\U00002562', - "boxVr;": '\U0000255F', - "boxbox;": '\U000029C9', - "boxdL;": '\U00002555', - "boxdR;": '\U00002552', - "boxdl;": '\U00002510', - "boxdr;": '\U0000250C', - "boxh;": '\U00002500', - "boxhD;": '\U00002565', - "boxhU;": '\U00002568', - "boxhd;": '\U0000252C', - "boxhu;": '\U00002534', - "boxminus;": '\U0000229F', - "boxplus;": '\U0000229E', - "boxtimes;": '\U000022A0', - "boxuL;": '\U0000255B', - "boxuR;": '\U00002558', - "boxul;": '\U00002518', - "boxur;": '\U00002514', - "boxv;": '\U00002502', - "boxvH;": '\U0000256A', - "boxvL;": '\U00002561', - "boxvR;": '\U0000255E', - "boxvh;": '\U0000253C', - "boxvl;": '\U00002524', - "boxvr;": '\U0000251C', - "bprime;": '\U00002035', - "breve;": '\U000002D8', - "brvbar;": '\U000000A6', - "bscr;": '\U0001D4B7', - "bsemi;": '\U0000204F', - "bsim;": '\U0000223D', - "bsime;": '\U000022CD', - "bsol;": '\U0000005C', - "bsolb;": '\U000029C5', - "bsolhsub;": '\U000027C8', - "bull;": '\U00002022', - "bullet;": '\U00002022', - "bump;": '\U0000224E', - "bumpE;": '\U00002AAE', - "bumpe;": '\U0000224F', - "bumpeq;": '\U0000224F', - "cacute;": '\U00000107', - "cap;": '\U00002229', - "capand;": '\U00002A44', - "capbrcup;": '\U00002A49', - "capcap;": '\U00002A4B', - "capcup;": '\U00002A47', - "capdot;": '\U00002A40', - "caret;": '\U00002041', - "caron;": '\U000002C7', - "ccaps;": '\U00002A4D', - "ccaron;": '\U0000010D', - "ccedil;": '\U000000E7', - "ccirc;": '\U00000109', - "ccups;": '\U00002A4C', - "ccupssm;": '\U00002A50', - "cdot;": '\U0000010B', - "cedil;": '\U000000B8', - "cemptyv;": '\U000029B2', - "cent;": '\U000000A2', - "centerdot;": '\U000000B7', - "cfr;": '\U0001D520', - "chcy;": '\U00000447', - "check;": '\U00002713', - "checkmark;": '\U00002713', - "chi;": '\U000003C7', - "cir;": '\U000025CB', - "cirE;": '\U000029C3', - "circ;": '\U000002C6', - "circeq;": '\U00002257', - "circlearrowleft;": '\U000021BA', - "circlearrowright;": '\U000021BB', - "circledR;": '\U000000AE', - "circledS;": '\U000024C8', - "circledast;": '\U0000229B', - "circledcirc;": '\U0000229A', - "circleddash;": '\U0000229D', - "cire;": '\U00002257', - "cirfnint;": '\U00002A10', - "cirmid;": '\U00002AEF', - "cirscir;": '\U000029C2', - "clubs;": '\U00002663', - "clubsuit;": '\U00002663', - "colon;": '\U0000003A', - "colone;": '\U00002254', - "coloneq;": '\U00002254', - "comma;": '\U0000002C', - "commat;": '\U00000040', - "comp;": '\U00002201', - "compfn;": '\U00002218', - "complement;": '\U00002201', - "complexes;": '\U00002102', - "cong;": '\U00002245', - "congdot;": '\U00002A6D', - "conint;": '\U0000222E', - "copf;": '\U0001D554', - "coprod;": '\U00002210', - "copy;": '\U000000A9', - "copysr;": '\U00002117', - "crarr;": '\U000021B5', - "cross;": '\U00002717', - "cscr;": '\U0001D4B8', - "csub;": '\U00002ACF', - "csube;": '\U00002AD1', - "csup;": '\U00002AD0', - "csupe;": '\U00002AD2', - "ctdot;": '\U000022EF', - "cudarrl;": '\U00002938', - "cudarrr;": '\U00002935', - "cuepr;": '\U000022DE', - "cuesc;": '\U000022DF', - "cularr;": '\U000021B6', - "cularrp;": '\U0000293D', - "cup;": '\U0000222A', - "cupbrcap;": '\U00002A48', - "cupcap;": '\U00002A46', - "cupcup;": '\U00002A4A', - "cupdot;": '\U0000228D', - "cupor;": '\U00002A45', - "curarr;": '\U000021B7', - "curarrm;": '\U0000293C', - "curlyeqprec;": '\U000022DE', - "curlyeqsucc;": '\U000022DF', - "curlyvee;": '\U000022CE', - "curlywedge;": '\U000022CF', - "curren;": '\U000000A4', - "curvearrowleft;": '\U000021B6', - "curvearrowright;": '\U000021B7', - "cuvee;": '\U000022CE', - "cuwed;": '\U000022CF', - "cwconint;": '\U00002232', - "cwint;": '\U00002231', - "cylcty;": '\U0000232D', - "dArr;": '\U000021D3', - "dHar;": '\U00002965', - "dagger;": '\U00002020', - "daleth;": '\U00002138', - "darr;": '\U00002193', - "dash;": '\U00002010', - "dashv;": '\U000022A3', - "dbkarow;": '\U0000290F', - "dblac;": '\U000002DD', - "dcaron;": '\U0000010F', - "dcy;": '\U00000434', - "dd;": '\U00002146', - "ddagger;": '\U00002021', - "ddarr;": '\U000021CA', - "ddotseq;": '\U00002A77', - "deg;": '\U000000B0', - "delta;": '\U000003B4', - "demptyv;": '\U000029B1', - "dfisht;": '\U0000297F', - "dfr;": '\U0001D521', - "dharl;": '\U000021C3', - "dharr;": '\U000021C2', - "diam;": '\U000022C4', - "diamond;": '\U000022C4', - "diamondsuit;": '\U00002666', - "diams;": '\U00002666', - "die;": '\U000000A8', - "digamma;": '\U000003DD', - "disin;": '\U000022F2', - "div;": '\U000000F7', - "divide;": '\U000000F7', - "divideontimes;": '\U000022C7', - "divonx;": '\U000022C7', - "djcy;": '\U00000452', - "dlcorn;": '\U0000231E', - "dlcrop;": '\U0000230D', - "dollar;": '\U00000024', - "dopf;": '\U0001D555', - "dot;": '\U000002D9', - "doteq;": '\U00002250', - "doteqdot;": '\U00002251', - "dotminus;": '\U00002238', - "dotplus;": '\U00002214', - "dotsquare;": '\U000022A1', - "doublebarwedge;": '\U00002306', - "downarrow;": '\U00002193', - "downdownarrows;": '\U000021CA', - "downharpoonleft;": '\U000021C3', - "downharpoonright;": '\U000021C2', - "drbkarow;": '\U00002910', - "drcorn;": '\U0000231F', - "drcrop;": '\U0000230C', - "dscr;": '\U0001D4B9', - "dscy;": '\U00000455', - "dsol;": '\U000029F6', - "dstrok;": '\U00000111', - "dtdot;": '\U000022F1', - "dtri;": '\U000025BF', - "dtrif;": '\U000025BE', - "duarr;": '\U000021F5', - "duhar;": '\U0000296F', - "dwangle;": '\U000029A6', - "dzcy;": '\U0000045F', - "dzigrarr;": '\U000027FF', - "eDDot;": '\U00002A77', - "eDot;": '\U00002251', - "eacute;": '\U000000E9', - "easter;": '\U00002A6E', - "ecaron;": '\U0000011B', - "ecir;": '\U00002256', - "ecirc;": '\U000000EA', - "ecolon;": '\U00002255', - "ecy;": '\U0000044D', - "edot;": '\U00000117', - "ee;": '\U00002147', - "efDot;": '\U00002252', - "efr;": '\U0001D522', - "eg;": '\U00002A9A', - "egrave;": '\U000000E8', - "egs;": '\U00002A96', - "egsdot;": '\U00002A98', - "el;": '\U00002A99', - "elinters;": '\U000023E7', - "ell;": '\U00002113', - "els;": '\U00002A95', - "elsdot;": '\U00002A97', - "emacr;": '\U00000113', - "empty;": '\U00002205', - "emptyset;": '\U00002205', - "emptyv;": '\U00002205', - "emsp;": '\U00002003', - "emsp13;": '\U00002004', - "emsp14;": '\U00002005', - "eng;": '\U0000014B', - "ensp;": '\U00002002', - "eogon;": '\U00000119', - "eopf;": '\U0001D556', - "epar;": '\U000022D5', - "eparsl;": '\U000029E3', - "eplus;": '\U00002A71', - "epsi;": '\U000003B5', - "epsilon;": '\U000003B5', - "epsiv;": '\U000003F5', - "eqcirc;": '\U00002256', - "eqcolon;": '\U00002255', - "eqsim;": '\U00002242', - "eqslantgtr;": '\U00002A96', - "eqslantless;": '\U00002A95', - "equals;": '\U0000003D', - "equest;": '\U0000225F', - "equiv;": '\U00002261', - "equivDD;": '\U00002A78', - "eqvparsl;": '\U000029E5', - "erDot;": '\U00002253', - "erarr;": '\U00002971', - "escr;": '\U0000212F', - "esdot;": '\U00002250', - "esim;": '\U00002242', - "eta;": '\U000003B7', - "eth;": '\U000000F0', - "euml;": '\U000000EB', - "euro;": '\U000020AC', - "excl;": '\U00000021', - "exist;": '\U00002203', - "expectation;": '\U00002130', - "exponentiale;": '\U00002147', - "fallingdotseq;": '\U00002252', - "fcy;": '\U00000444', - "female;": '\U00002640', - "ffilig;": '\U0000FB03', - "fflig;": '\U0000FB00', - "ffllig;": '\U0000FB04', - "ffr;": '\U0001D523', - "filig;": '\U0000FB01', - "flat;": '\U0000266D', - "fllig;": '\U0000FB02', - "fltns;": '\U000025B1', - "fnof;": '\U00000192', - "fopf;": '\U0001D557', - "forall;": '\U00002200', - "fork;": '\U000022D4', - "forkv;": '\U00002AD9', - "fpartint;": '\U00002A0D', - "frac12;": '\U000000BD', - "frac13;": '\U00002153', - "frac14;": '\U000000BC', - "frac15;": '\U00002155', - "frac16;": '\U00002159', - "frac18;": '\U0000215B', - "frac23;": '\U00002154', - "frac25;": '\U00002156', - "frac34;": '\U000000BE', - "frac35;": '\U00002157', - "frac38;": '\U0000215C', - "frac45;": '\U00002158', - "frac56;": '\U0000215A', - "frac58;": '\U0000215D', - "frac78;": '\U0000215E', - "frasl;": '\U00002044', - "frown;": '\U00002322', - "fscr;": '\U0001D4BB', - "gE;": '\U00002267', - "gEl;": '\U00002A8C', - "gacute;": '\U000001F5', - "gamma;": '\U000003B3', - "gammad;": '\U000003DD', - "gap;": '\U00002A86', - "gbreve;": '\U0000011F', - "gcirc;": '\U0000011D', - "gcy;": '\U00000433', - "gdot;": '\U00000121', - "ge;": '\U00002265', - "gel;": '\U000022DB', - "geq;": '\U00002265', - "geqq;": '\U00002267', - "geqslant;": '\U00002A7E', - "ges;": '\U00002A7E', - "gescc;": '\U00002AA9', - "gesdot;": '\U00002A80', - "gesdoto;": '\U00002A82', - "gesdotol;": '\U00002A84', - "gesles;": '\U00002A94', - "gfr;": '\U0001D524', - "gg;": '\U0000226B', - "ggg;": '\U000022D9', - "gimel;": '\U00002137', - "gjcy;": '\U00000453', - "gl;": '\U00002277', - "glE;": '\U00002A92', - "gla;": '\U00002AA5', - "glj;": '\U00002AA4', - "gnE;": '\U00002269', - "gnap;": '\U00002A8A', - "gnapprox;": '\U00002A8A', - "gne;": '\U00002A88', - "gneq;": '\U00002A88', - "gneqq;": '\U00002269', - "gnsim;": '\U000022E7', - "gopf;": '\U0001D558', - "grave;": '\U00000060', - "gscr;": '\U0000210A', - "gsim;": '\U00002273', - "gsime;": '\U00002A8E', - "gsiml;": '\U00002A90', - "gt;": '\U0000003E', - "gtcc;": '\U00002AA7', - "gtcir;": '\U00002A7A', - "gtdot;": '\U000022D7', - "gtlPar;": '\U00002995', - "gtquest;": '\U00002A7C', - "gtrapprox;": '\U00002A86', - "gtrarr;": '\U00002978', - "gtrdot;": '\U000022D7', - "gtreqless;": '\U000022DB', - "gtreqqless;": '\U00002A8C', - "gtrless;": '\U00002277', - "gtrsim;": '\U00002273', - "hArr;": '\U000021D4', - "hairsp;": '\U0000200A', - "half;": '\U000000BD', - "hamilt;": '\U0000210B', - "hardcy;": '\U0000044A', - "harr;": '\U00002194', - "harrcir;": '\U00002948', - "harrw;": '\U000021AD', - "hbar;": '\U0000210F', - "hcirc;": '\U00000125', - "hearts;": '\U00002665', - "heartsuit;": '\U00002665', - "hellip;": '\U00002026', - "hercon;": '\U000022B9', - "hfr;": '\U0001D525', - "hksearow;": '\U00002925', - "hkswarow;": '\U00002926', - "hoarr;": '\U000021FF', - "homtht;": '\U0000223B', - "hookleftarrow;": '\U000021A9', - "hookrightarrow;": '\U000021AA', - "hopf;": '\U0001D559', - "horbar;": '\U00002015', - "hscr;": '\U0001D4BD', - "hslash;": '\U0000210F', - "hstrok;": '\U00000127', - "hybull;": '\U00002043', - "hyphen;": '\U00002010', - "iacute;": '\U000000ED', - "ic;": '\U00002063', - "icirc;": '\U000000EE', - "icy;": '\U00000438', - "iecy;": '\U00000435', - "iexcl;": '\U000000A1', - "iff;": '\U000021D4', - "ifr;": '\U0001D526', - "igrave;": '\U000000EC', - "ii;": '\U00002148', - "iiiint;": '\U00002A0C', - "iiint;": '\U0000222D', - "iinfin;": '\U000029DC', - "iiota;": '\U00002129', - "ijlig;": '\U00000133', - "imacr;": '\U0000012B', - "image;": '\U00002111', - "imagline;": '\U00002110', - "imagpart;": '\U00002111', - "imath;": '\U00000131', - "imof;": '\U000022B7', - "imped;": '\U000001B5', - "in;": '\U00002208', - "incare;": '\U00002105', - "infin;": '\U0000221E', - "infintie;": '\U000029DD', - "inodot;": '\U00000131', - "int;": '\U0000222B', - "intcal;": '\U000022BA', - "integers;": '\U00002124', - "intercal;": '\U000022BA', - "intlarhk;": '\U00002A17', - "intprod;": '\U00002A3C', - "iocy;": '\U00000451', - "iogon;": '\U0000012F', - "iopf;": '\U0001D55A', - "iota;": '\U000003B9', - "iprod;": '\U00002A3C', - "iquest;": '\U000000BF', - "iscr;": '\U0001D4BE', - "isin;": '\U00002208', - "isinE;": '\U000022F9', - "isindot;": '\U000022F5', - "isins;": '\U000022F4', - "isinsv;": '\U000022F3', - "isinv;": '\U00002208', - "it;": '\U00002062', - "itilde;": '\U00000129', - "iukcy;": '\U00000456', - "iuml;": '\U000000EF', - "jcirc;": '\U00000135', - "jcy;": '\U00000439', - "jfr;": '\U0001D527', - "jmath;": '\U00000237', - "jopf;": '\U0001D55B', - "jscr;": '\U0001D4BF', - "jsercy;": '\U00000458', - "jukcy;": '\U00000454', - "kappa;": '\U000003BA', - "kappav;": '\U000003F0', - "kcedil;": '\U00000137', - "kcy;": '\U0000043A', - "kfr;": '\U0001D528', - "kgreen;": '\U00000138', - "khcy;": '\U00000445', - "kjcy;": '\U0000045C', - "kopf;": '\U0001D55C', - "kscr;": '\U0001D4C0', - "lAarr;": '\U000021DA', - "lArr;": '\U000021D0', - "lAtail;": '\U0000291B', - "lBarr;": '\U0000290E', - "lE;": '\U00002266', - "lEg;": '\U00002A8B', - "lHar;": '\U00002962', - "lacute;": '\U0000013A', - "laemptyv;": '\U000029B4', - "lagran;": '\U00002112', - "lambda;": '\U000003BB', - "lang;": '\U000027E8', - "langd;": '\U00002991', - "langle;": '\U000027E8', - "lap;": '\U00002A85', - "laquo;": '\U000000AB', - "larr;": '\U00002190', - "larrb;": '\U000021E4', - "larrbfs;": '\U0000291F', - "larrfs;": '\U0000291D', - "larrhk;": '\U000021A9', - "larrlp;": '\U000021AB', - "larrpl;": '\U00002939', - "larrsim;": '\U00002973', - "larrtl;": '\U000021A2', - "lat;": '\U00002AAB', - "latail;": '\U00002919', - "late;": '\U00002AAD', - "lbarr;": '\U0000290C', - "lbbrk;": '\U00002772', - "lbrace;": '\U0000007B', - "lbrack;": '\U0000005B', - "lbrke;": '\U0000298B', - "lbrksld;": '\U0000298F', - "lbrkslu;": '\U0000298D', - "lcaron;": '\U0000013E', - "lcedil;": '\U0000013C', - "lceil;": '\U00002308', - "lcub;": '\U0000007B', - "lcy;": '\U0000043B', - "ldca;": '\U00002936', - "ldquo;": '\U0000201C', - "ldquor;": '\U0000201E', - "ldrdhar;": '\U00002967', - "ldrushar;": '\U0000294B', - "ldsh;": '\U000021B2', - "le;": '\U00002264', - "leftarrow;": '\U00002190', - "leftarrowtail;": '\U000021A2', - "leftharpoondown;": '\U000021BD', - "leftharpoonup;": '\U000021BC', - "leftleftarrows;": '\U000021C7', - "leftrightarrow;": '\U00002194', - "leftrightarrows;": '\U000021C6', - "leftrightharpoons;": '\U000021CB', - "leftrightsquigarrow;": '\U000021AD', - "leftthreetimes;": '\U000022CB', - "leg;": '\U000022DA', - "leq;": '\U00002264', - "leqq;": '\U00002266', - "leqslant;": '\U00002A7D', - "les;": '\U00002A7D', - "lescc;": '\U00002AA8', - "lesdot;": '\U00002A7F', - "lesdoto;": '\U00002A81', - "lesdotor;": '\U00002A83', - "lesges;": '\U00002A93', - "lessapprox;": '\U00002A85', - "lessdot;": '\U000022D6', - "lesseqgtr;": '\U000022DA', - "lesseqqgtr;": '\U00002A8B', - "lessgtr;": '\U00002276', - "lesssim;": '\U00002272', - "lfisht;": '\U0000297C', - "lfloor;": '\U0000230A', - "lfr;": '\U0001D529', - "lg;": '\U00002276', - "lgE;": '\U00002A91', - "lhard;": '\U000021BD', - "lharu;": '\U000021BC', - "lharul;": '\U0000296A', - "lhblk;": '\U00002584', - "ljcy;": '\U00000459', - "ll;": '\U0000226A', - "llarr;": '\U000021C7', - "llcorner;": '\U0000231E', - "llhard;": '\U0000296B', - "lltri;": '\U000025FA', - "lmidot;": '\U00000140', - "lmoust;": '\U000023B0', - "lmoustache;": '\U000023B0', - "lnE;": '\U00002268', - "lnap;": '\U00002A89', - "lnapprox;": '\U00002A89', - "lne;": '\U00002A87', - "lneq;": '\U00002A87', - "lneqq;": '\U00002268', - "lnsim;": '\U000022E6', - "loang;": '\U000027EC', - "loarr;": '\U000021FD', - "lobrk;": '\U000027E6', - "longleftarrow;": '\U000027F5', - "longleftrightarrow;": '\U000027F7', - "longmapsto;": '\U000027FC', - "longrightarrow;": '\U000027F6', - "looparrowleft;": '\U000021AB', - "looparrowright;": '\U000021AC', - "lopar;": '\U00002985', - "lopf;": '\U0001D55D', - "loplus;": '\U00002A2D', - "lotimes;": '\U00002A34', - "lowast;": '\U00002217', - "lowbar;": '\U0000005F', - "loz;": '\U000025CA', - "lozenge;": '\U000025CA', - "lozf;": '\U000029EB', - "lpar;": '\U00000028', - "lparlt;": '\U00002993', - "lrarr;": '\U000021C6', - "lrcorner;": '\U0000231F', - "lrhar;": '\U000021CB', - "lrhard;": '\U0000296D', - "lrm;": '\U0000200E', - "lrtri;": '\U000022BF', - "lsaquo;": '\U00002039', - "lscr;": '\U0001D4C1', - "lsh;": '\U000021B0', - "lsim;": '\U00002272', - "lsime;": '\U00002A8D', - "lsimg;": '\U00002A8F', - "lsqb;": '\U0000005B', - "lsquo;": '\U00002018', - "lsquor;": '\U0000201A', - "lstrok;": '\U00000142', - "lt;": '\U0000003C', - "ltcc;": '\U00002AA6', - "ltcir;": '\U00002A79', - "ltdot;": '\U000022D6', - "lthree;": '\U000022CB', - "ltimes;": '\U000022C9', - "ltlarr;": '\U00002976', - "ltquest;": '\U00002A7B', - "ltrPar;": '\U00002996', - "ltri;": '\U000025C3', - "ltrie;": '\U000022B4', - "ltrif;": '\U000025C2', - "lurdshar;": '\U0000294A', - "luruhar;": '\U00002966', - "mDDot;": '\U0000223A', - "macr;": '\U000000AF', - "male;": '\U00002642', - "malt;": '\U00002720', - "maltese;": '\U00002720', - "map;": '\U000021A6', - "mapsto;": '\U000021A6', - "mapstodown;": '\U000021A7', - "mapstoleft;": '\U000021A4', - "mapstoup;": '\U000021A5', - "marker;": '\U000025AE', - "mcomma;": '\U00002A29', - "mcy;": '\U0000043C', - "mdash;": '\U00002014', - "measuredangle;": '\U00002221', - "mfr;": '\U0001D52A', - "mho;": '\U00002127', - "micro;": '\U000000B5', - "mid;": '\U00002223', - "midast;": '\U0000002A', - "midcir;": '\U00002AF0', - "middot;": '\U000000B7', - "minus;": '\U00002212', - "minusb;": '\U0000229F', - "minusd;": '\U00002238', - "minusdu;": '\U00002A2A', - "mlcp;": '\U00002ADB', - "mldr;": '\U00002026', - "mnplus;": '\U00002213', - "models;": '\U000022A7', - "mopf;": '\U0001D55E', - "mp;": '\U00002213', - "mscr;": '\U0001D4C2', - "mstpos;": '\U0000223E', - "mu;": '\U000003BC', - "multimap;": '\U000022B8', - "mumap;": '\U000022B8', - "nLeftarrow;": '\U000021CD', - "nLeftrightarrow;": '\U000021CE', - "nRightarrow;": '\U000021CF', - "nVDash;": '\U000022AF', - "nVdash;": '\U000022AE', - "nabla;": '\U00002207', - "nacute;": '\U00000144', - "nap;": '\U00002249', - "napos;": '\U00000149', - "napprox;": '\U00002249', - "natur;": '\U0000266E', - "natural;": '\U0000266E', - "naturals;": '\U00002115', - "nbsp;": '\U000000A0', - "ncap;": '\U00002A43', - "ncaron;": '\U00000148', - "ncedil;": '\U00000146', - "ncong;": '\U00002247', - "ncup;": '\U00002A42', - "ncy;": '\U0000043D', - "ndash;": '\U00002013', - "ne;": '\U00002260', - "neArr;": '\U000021D7', - "nearhk;": '\U00002924', - "nearr;": '\U00002197', - "nearrow;": '\U00002197', - "nequiv;": '\U00002262', - "nesear;": '\U00002928', - "nexist;": '\U00002204', - "nexists;": '\U00002204', - "nfr;": '\U0001D52B', - "nge;": '\U00002271', - "ngeq;": '\U00002271', - "ngsim;": '\U00002275', - "ngt;": '\U0000226F', - "ngtr;": '\U0000226F', - "nhArr;": '\U000021CE', - "nharr;": '\U000021AE', - "nhpar;": '\U00002AF2', - "ni;": '\U0000220B', - "nis;": '\U000022FC', - "nisd;": '\U000022FA', - "niv;": '\U0000220B', - "njcy;": '\U0000045A', - "nlArr;": '\U000021CD', - "nlarr;": '\U0000219A', - "nldr;": '\U00002025', - "nle;": '\U00002270', - "nleftarrow;": '\U0000219A', - "nleftrightarrow;": '\U000021AE', - "nleq;": '\U00002270', - "nless;": '\U0000226E', - "nlsim;": '\U00002274', - "nlt;": '\U0000226E', - "nltri;": '\U000022EA', - "nltrie;": '\U000022EC', - "nmid;": '\U00002224', - "nopf;": '\U0001D55F', - "not;": '\U000000AC', - "notin;": '\U00002209', - "notinva;": '\U00002209', - "notinvb;": '\U000022F7', - "notinvc;": '\U000022F6', - "notni;": '\U0000220C', - "notniva;": '\U0000220C', - "notnivb;": '\U000022FE', - "notnivc;": '\U000022FD', - "npar;": '\U00002226', - "nparallel;": '\U00002226', - "npolint;": '\U00002A14', - "npr;": '\U00002280', - "nprcue;": '\U000022E0', - "nprec;": '\U00002280', - "nrArr;": '\U000021CF', - "nrarr;": '\U0000219B', - "nrightarrow;": '\U0000219B', - "nrtri;": '\U000022EB', - "nrtrie;": '\U000022ED', - "nsc;": '\U00002281', - "nsccue;": '\U000022E1', - "nscr;": '\U0001D4C3', - "nshortmid;": '\U00002224', - "nshortparallel;": '\U00002226', - "nsim;": '\U00002241', - "nsime;": '\U00002244', - "nsimeq;": '\U00002244', - "nsmid;": '\U00002224', - "nspar;": '\U00002226', - "nsqsube;": '\U000022E2', - "nsqsupe;": '\U000022E3', - "nsub;": '\U00002284', - "nsube;": '\U00002288', - "nsubseteq;": '\U00002288', - "nsucc;": '\U00002281', - "nsup;": '\U00002285', - "nsupe;": '\U00002289', - "nsupseteq;": '\U00002289', - "ntgl;": '\U00002279', - "ntilde;": '\U000000F1', - "ntlg;": '\U00002278', - "ntriangleleft;": '\U000022EA', - "ntrianglelefteq;": '\U000022EC', - "ntriangleright;": '\U000022EB', - "ntrianglerighteq;": '\U000022ED', - "nu;": '\U000003BD', - "num;": '\U00000023', - "numero;": '\U00002116', - "numsp;": '\U00002007', - "nvDash;": '\U000022AD', - "nvHarr;": '\U00002904', - "nvdash;": '\U000022AC', - "nvinfin;": '\U000029DE', - "nvlArr;": '\U00002902', - "nvrArr;": '\U00002903', - "nwArr;": '\U000021D6', - "nwarhk;": '\U00002923', - "nwarr;": '\U00002196', - "nwarrow;": '\U00002196', - "nwnear;": '\U00002927', - "oS;": '\U000024C8', - "oacute;": '\U000000F3', - "oast;": '\U0000229B', - "ocir;": '\U0000229A', - "ocirc;": '\U000000F4', - "ocy;": '\U0000043E', - "odash;": '\U0000229D', - "odblac;": '\U00000151', - "odiv;": '\U00002A38', - "odot;": '\U00002299', - "odsold;": '\U000029BC', - "oelig;": '\U00000153', - "ofcir;": '\U000029BF', - "ofr;": '\U0001D52C', - "ogon;": '\U000002DB', - "ograve;": '\U000000F2', - "ogt;": '\U000029C1', - "ohbar;": '\U000029B5', - "ohm;": '\U000003A9', - "oint;": '\U0000222E', - "olarr;": '\U000021BA', - "olcir;": '\U000029BE', - "olcross;": '\U000029BB', - "oline;": '\U0000203E', - "olt;": '\U000029C0', - "omacr;": '\U0000014D', - "omega;": '\U000003C9', - "omicron;": '\U000003BF', - "omid;": '\U000029B6', - "ominus;": '\U00002296', - "oopf;": '\U0001D560', - "opar;": '\U000029B7', - "operp;": '\U000029B9', - "oplus;": '\U00002295', - "or;": '\U00002228', - "orarr;": '\U000021BB', - "ord;": '\U00002A5D', - "order;": '\U00002134', - "orderof;": '\U00002134', - "ordf;": '\U000000AA', - "ordm;": '\U000000BA', - "origof;": '\U000022B6', - "oror;": '\U00002A56', - "orslope;": '\U00002A57', - "orv;": '\U00002A5B', - "oscr;": '\U00002134', - "oslash;": '\U000000F8', - "osol;": '\U00002298', - "otilde;": '\U000000F5', - "otimes;": '\U00002297', - "otimesas;": '\U00002A36', - "ouml;": '\U000000F6', - "ovbar;": '\U0000233D', - "par;": '\U00002225', - "para;": '\U000000B6', - "parallel;": '\U00002225', - "parsim;": '\U00002AF3', - "parsl;": '\U00002AFD', - "part;": '\U00002202', - "pcy;": '\U0000043F', - "percnt;": '\U00000025', - "period;": '\U0000002E', - "permil;": '\U00002030', - "perp;": '\U000022A5', - "pertenk;": '\U00002031', - "pfr;": '\U0001D52D', - "phi;": '\U000003C6', - "phiv;": '\U000003D5', - "phmmat;": '\U00002133', - "phone;": '\U0000260E', - "pi;": '\U000003C0', - "pitchfork;": '\U000022D4', - "piv;": '\U000003D6', - "planck;": '\U0000210F', - "planckh;": '\U0000210E', - "plankv;": '\U0000210F', - "plus;": '\U0000002B', - "plusacir;": '\U00002A23', - "plusb;": '\U0000229E', - "pluscir;": '\U00002A22', - "plusdo;": '\U00002214', - "plusdu;": '\U00002A25', - "pluse;": '\U00002A72', - "plusmn;": '\U000000B1', - "plussim;": '\U00002A26', - "plustwo;": '\U00002A27', - "pm;": '\U000000B1', - "pointint;": '\U00002A15', - "popf;": '\U0001D561', - "pound;": '\U000000A3', - "pr;": '\U0000227A', - "prE;": '\U00002AB3', - "prap;": '\U00002AB7', - "prcue;": '\U0000227C', - "pre;": '\U00002AAF', - "prec;": '\U0000227A', - "precapprox;": '\U00002AB7', - "preccurlyeq;": '\U0000227C', - "preceq;": '\U00002AAF', - "precnapprox;": '\U00002AB9', - "precneqq;": '\U00002AB5', - "precnsim;": '\U000022E8', - "precsim;": '\U0000227E', - "prime;": '\U00002032', - "primes;": '\U00002119', - "prnE;": '\U00002AB5', - "prnap;": '\U00002AB9', - "prnsim;": '\U000022E8', - "prod;": '\U0000220F', - "profalar;": '\U0000232E', - "profline;": '\U00002312', - "profsurf;": '\U00002313', - "prop;": '\U0000221D', - "propto;": '\U0000221D', - "prsim;": '\U0000227E', - "prurel;": '\U000022B0', - "pscr;": '\U0001D4C5', - "psi;": '\U000003C8', - "puncsp;": '\U00002008', - "qfr;": '\U0001D52E', - "qint;": '\U00002A0C', - "qopf;": '\U0001D562', - "qprime;": '\U00002057', - "qscr;": '\U0001D4C6', - "quaternions;": '\U0000210D', - "quatint;": '\U00002A16', - "quest;": '\U0000003F', - "questeq;": '\U0000225F', - "quot;": '\U00000022', - "rAarr;": '\U000021DB', - "rArr;": '\U000021D2', - "rAtail;": '\U0000291C', - "rBarr;": '\U0000290F', - "rHar;": '\U00002964', - "racute;": '\U00000155', - "radic;": '\U0000221A', - "raemptyv;": '\U000029B3', - "rang;": '\U000027E9', - "rangd;": '\U00002992', - "range;": '\U000029A5', - "rangle;": '\U000027E9', - "raquo;": '\U000000BB', - "rarr;": '\U00002192', - "rarrap;": '\U00002975', - "rarrb;": '\U000021E5', - "rarrbfs;": '\U00002920', - "rarrc;": '\U00002933', - "rarrfs;": '\U0000291E', - "rarrhk;": '\U000021AA', - "rarrlp;": '\U000021AC', - "rarrpl;": '\U00002945', - "rarrsim;": '\U00002974', - "rarrtl;": '\U000021A3', - "rarrw;": '\U0000219D', - "ratail;": '\U0000291A', - "ratio;": '\U00002236', - "rationals;": '\U0000211A', - "rbarr;": '\U0000290D', - "rbbrk;": '\U00002773', - "rbrace;": '\U0000007D', - "rbrack;": '\U0000005D', - "rbrke;": '\U0000298C', - "rbrksld;": '\U0000298E', - "rbrkslu;": '\U00002990', - "rcaron;": '\U00000159', - "rcedil;": '\U00000157', - "rceil;": '\U00002309', - "rcub;": '\U0000007D', - "rcy;": '\U00000440', - "rdca;": '\U00002937', - "rdldhar;": '\U00002969', - "rdquo;": '\U0000201D', - "rdquor;": '\U0000201D', - "rdsh;": '\U000021B3', - "real;": '\U0000211C', - "realine;": '\U0000211B', - "realpart;": '\U0000211C', - "reals;": '\U0000211D', - "rect;": '\U000025AD', - "reg;": '\U000000AE', - "rfisht;": '\U0000297D', - "rfloor;": '\U0000230B', - "rfr;": '\U0001D52F', - "rhard;": '\U000021C1', - "rharu;": '\U000021C0', - "rharul;": '\U0000296C', - "rho;": '\U000003C1', - "rhov;": '\U000003F1', - "rightarrow;": '\U00002192', - "rightarrowtail;": '\U000021A3', - "rightharpoondown;": '\U000021C1', - "rightharpoonup;": '\U000021C0', - "rightleftarrows;": '\U000021C4', - "rightleftharpoons;": '\U000021CC', - "rightrightarrows;": '\U000021C9', - "rightsquigarrow;": '\U0000219D', - "rightthreetimes;": '\U000022CC', - "ring;": '\U000002DA', - "risingdotseq;": '\U00002253', - "rlarr;": '\U000021C4', - "rlhar;": '\U000021CC', - "rlm;": '\U0000200F', - "rmoust;": '\U000023B1', - "rmoustache;": '\U000023B1', - "rnmid;": '\U00002AEE', - "roang;": '\U000027ED', - "roarr;": '\U000021FE', - "robrk;": '\U000027E7', - "ropar;": '\U00002986', - "ropf;": '\U0001D563', - "roplus;": '\U00002A2E', - "rotimes;": '\U00002A35', - "rpar;": '\U00000029', - "rpargt;": '\U00002994', - "rppolint;": '\U00002A12', - "rrarr;": '\U000021C9', - "rsaquo;": '\U0000203A', - "rscr;": '\U0001D4C7', - "rsh;": '\U000021B1', - "rsqb;": '\U0000005D', - "rsquo;": '\U00002019', - "rsquor;": '\U00002019', - "rthree;": '\U000022CC', - "rtimes;": '\U000022CA', - "rtri;": '\U000025B9', - "rtrie;": '\U000022B5', - "rtrif;": '\U000025B8', - "rtriltri;": '\U000029CE', - "ruluhar;": '\U00002968', - "rx;": '\U0000211E', - "sacute;": '\U0000015B', - "sbquo;": '\U0000201A', - "sc;": '\U0000227B', - "scE;": '\U00002AB4', - "scap;": '\U00002AB8', - "scaron;": '\U00000161', - "sccue;": '\U0000227D', - "sce;": '\U00002AB0', - "scedil;": '\U0000015F', - "scirc;": '\U0000015D', - "scnE;": '\U00002AB6', - "scnap;": '\U00002ABA', - "scnsim;": '\U000022E9', - "scpolint;": '\U00002A13', - "scsim;": '\U0000227F', - "scy;": '\U00000441', - "sdot;": '\U000022C5', - "sdotb;": '\U000022A1', - "sdote;": '\U00002A66', - "seArr;": '\U000021D8', - "searhk;": '\U00002925', - "searr;": '\U00002198', - "searrow;": '\U00002198', - "sect;": '\U000000A7', - "semi;": '\U0000003B', - "seswar;": '\U00002929', - "setminus;": '\U00002216', - "setmn;": '\U00002216', - "sext;": '\U00002736', - "sfr;": '\U0001D530', - "sfrown;": '\U00002322', - "sharp;": '\U0000266F', - "shchcy;": '\U00000449', - "shcy;": '\U00000448', - "shortmid;": '\U00002223', - "shortparallel;": '\U00002225', - "shy;": '\U000000AD', - "sigma;": '\U000003C3', - "sigmaf;": '\U000003C2', - "sigmav;": '\U000003C2', - "sim;": '\U0000223C', - "simdot;": '\U00002A6A', - "sime;": '\U00002243', - "simeq;": '\U00002243', - "simg;": '\U00002A9E', - "simgE;": '\U00002AA0', - "siml;": '\U00002A9D', - "simlE;": '\U00002A9F', - "simne;": '\U00002246', - "simplus;": '\U00002A24', - "simrarr;": '\U00002972', - "slarr;": '\U00002190', - "smallsetminus;": '\U00002216', - "smashp;": '\U00002A33', - "smeparsl;": '\U000029E4', - "smid;": '\U00002223', - "smile;": '\U00002323', - "smt;": '\U00002AAA', - "smte;": '\U00002AAC', - "softcy;": '\U0000044C', - "sol;": '\U0000002F', - "solb;": '\U000029C4', - "solbar;": '\U0000233F', - "sopf;": '\U0001D564', - "spades;": '\U00002660', - "spadesuit;": '\U00002660', - "spar;": '\U00002225', - "sqcap;": '\U00002293', - "sqcup;": '\U00002294', - "sqsub;": '\U0000228F', - "sqsube;": '\U00002291', - "sqsubset;": '\U0000228F', - "sqsubseteq;": '\U00002291', - "sqsup;": '\U00002290', - "sqsupe;": '\U00002292', - "sqsupset;": '\U00002290', - "sqsupseteq;": '\U00002292', - "squ;": '\U000025A1', - "square;": '\U000025A1', - "squarf;": '\U000025AA', - "squf;": '\U000025AA', - "srarr;": '\U00002192', - "sscr;": '\U0001D4C8', - "ssetmn;": '\U00002216', - "ssmile;": '\U00002323', - "sstarf;": '\U000022C6', - "star;": '\U00002606', - "starf;": '\U00002605', - "straightepsilon;": '\U000003F5', - "straightphi;": '\U000003D5', - "strns;": '\U000000AF', - "sub;": '\U00002282', - "subE;": '\U00002AC5', - "subdot;": '\U00002ABD', - "sube;": '\U00002286', - "subedot;": '\U00002AC3', - "submult;": '\U00002AC1', - "subnE;": '\U00002ACB', - "subne;": '\U0000228A', - "subplus;": '\U00002ABF', - "subrarr;": '\U00002979', - "subset;": '\U00002282', - "subseteq;": '\U00002286', - "subseteqq;": '\U00002AC5', - "subsetneq;": '\U0000228A', - "subsetneqq;": '\U00002ACB', - "subsim;": '\U00002AC7', - "subsub;": '\U00002AD5', - "subsup;": '\U00002AD3', - "succ;": '\U0000227B', - "succapprox;": '\U00002AB8', - "succcurlyeq;": '\U0000227D', - "succeq;": '\U00002AB0', - "succnapprox;": '\U00002ABA', - "succneqq;": '\U00002AB6', - "succnsim;": '\U000022E9', - "succsim;": '\U0000227F', - "sum;": '\U00002211', - "sung;": '\U0000266A', - "sup;": '\U00002283', - "sup1;": '\U000000B9', - "sup2;": '\U000000B2', - "sup3;": '\U000000B3', - "supE;": '\U00002AC6', - "supdot;": '\U00002ABE', - "supdsub;": '\U00002AD8', - "supe;": '\U00002287', - "supedot;": '\U00002AC4', - "suphsol;": '\U000027C9', - "suphsub;": '\U00002AD7', - "suplarr;": '\U0000297B', - "supmult;": '\U00002AC2', - "supnE;": '\U00002ACC', - "supne;": '\U0000228B', - "supplus;": '\U00002AC0', - "supset;": '\U00002283', - "supseteq;": '\U00002287', - "supseteqq;": '\U00002AC6', - "supsetneq;": '\U0000228B', - "supsetneqq;": '\U00002ACC', - "supsim;": '\U00002AC8', - "supsub;": '\U00002AD4', - "supsup;": '\U00002AD6', - "swArr;": '\U000021D9', - "swarhk;": '\U00002926', - "swarr;": '\U00002199', - "swarrow;": '\U00002199', - "swnwar;": '\U0000292A', - "szlig;": '\U000000DF', - "target;": '\U00002316', - "tau;": '\U000003C4', - "tbrk;": '\U000023B4', - "tcaron;": '\U00000165', - "tcedil;": '\U00000163', - "tcy;": '\U00000442', - "tdot;": '\U000020DB', - "telrec;": '\U00002315', - "tfr;": '\U0001D531', - "there4;": '\U00002234', - "therefore;": '\U00002234', - "theta;": '\U000003B8', - "thetasym;": '\U000003D1', - "thetav;": '\U000003D1', - "thickapprox;": '\U00002248', - "thicksim;": '\U0000223C', - "thinsp;": '\U00002009', - "thkap;": '\U00002248', - "thksim;": '\U0000223C', - "thorn;": '\U000000FE', - "tilde;": '\U000002DC', - "times;": '\U000000D7', - "timesb;": '\U000022A0', - "timesbar;": '\U00002A31', - "timesd;": '\U00002A30', - "tint;": '\U0000222D', - "toea;": '\U00002928', - "top;": '\U000022A4', - "topbot;": '\U00002336', - "topcir;": '\U00002AF1', - "topf;": '\U0001D565', - "topfork;": '\U00002ADA', - "tosa;": '\U00002929', - "tprime;": '\U00002034', - "trade;": '\U00002122', - "triangle;": '\U000025B5', - "triangledown;": '\U000025BF', - "triangleleft;": '\U000025C3', - "trianglelefteq;": '\U000022B4', - "triangleq;": '\U0000225C', - "triangleright;": '\U000025B9', - "trianglerighteq;": '\U000022B5', - "tridot;": '\U000025EC', - "trie;": '\U0000225C', - "triminus;": '\U00002A3A', - "triplus;": '\U00002A39', - "trisb;": '\U000029CD', - "tritime;": '\U00002A3B', - "trpezium;": '\U000023E2', - "tscr;": '\U0001D4C9', - "tscy;": '\U00000446', - "tshcy;": '\U0000045B', - "tstrok;": '\U00000167', - "twixt;": '\U0000226C', - "twoheadleftarrow;": '\U0000219E', - "twoheadrightarrow;": '\U000021A0', - "uArr;": '\U000021D1', - "uHar;": '\U00002963', - "uacute;": '\U000000FA', - "uarr;": '\U00002191', - "ubrcy;": '\U0000045E', - "ubreve;": '\U0000016D', - "ucirc;": '\U000000FB', - "ucy;": '\U00000443', - "udarr;": '\U000021C5', - "udblac;": '\U00000171', - "udhar;": '\U0000296E', - "ufisht;": '\U0000297E', - "ufr;": '\U0001D532', - "ugrave;": '\U000000F9', - "uharl;": '\U000021BF', - "uharr;": '\U000021BE', - "uhblk;": '\U00002580', - "ulcorn;": '\U0000231C', - "ulcorner;": '\U0000231C', - "ulcrop;": '\U0000230F', - "ultri;": '\U000025F8', - "umacr;": '\U0000016B', - "uml;": '\U000000A8', - "uogon;": '\U00000173', - "uopf;": '\U0001D566', - "uparrow;": '\U00002191', - "updownarrow;": '\U00002195', - "upharpoonleft;": '\U000021BF', - "upharpoonright;": '\U000021BE', - "uplus;": '\U0000228E', - "upsi;": '\U000003C5', - "upsih;": '\U000003D2', - "upsilon;": '\U000003C5', - "upuparrows;": '\U000021C8', - "urcorn;": '\U0000231D', - "urcorner;": '\U0000231D', - "urcrop;": '\U0000230E', - "uring;": '\U0000016F', - "urtri;": '\U000025F9', - "uscr;": '\U0001D4CA', - "utdot;": '\U000022F0', - "utilde;": '\U00000169', - "utri;": '\U000025B5', - "utrif;": '\U000025B4', - "uuarr;": '\U000021C8', - "uuml;": '\U000000FC', - "uwangle;": '\U000029A7', - "vArr;": '\U000021D5', - "vBar;": '\U00002AE8', - "vBarv;": '\U00002AE9', - "vDash;": '\U000022A8', - "vangrt;": '\U0000299C', - "varepsilon;": '\U000003F5', - "varkappa;": '\U000003F0', - "varnothing;": '\U00002205', - "varphi;": '\U000003D5', - "varpi;": '\U000003D6', - "varpropto;": '\U0000221D', - "varr;": '\U00002195', - "varrho;": '\U000003F1', - "varsigma;": '\U000003C2', - "vartheta;": '\U000003D1', - "vartriangleleft;": '\U000022B2', - "vartriangleright;": '\U000022B3', - "vcy;": '\U00000432', - "vdash;": '\U000022A2', - "vee;": '\U00002228', - "veebar;": '\U000022BB', - "veeeq;": '\U0000225A', - "vellip;": '\U000022EE', - "verbar;": '\U0000007C', - "vert;": '\U0000007C', - "vfr;": '\U0001D533', - "vltri;": '\U000022B2', - "vopf;": '\U0001D567', - "vprop;": '\U0000221D', - "vrtri;": '\U000022B3', - "vscr;": '\U0001D4CB', - "vzigzag;": '\U0000299A', - "wcirc;": '\U00000175', - "wedbar;": '\U00002A5F', - "wedge;": '\U00002227', - "wedgeq;": '\U00002259', - "weierp;": '\U00002118', - "wfr;": '\U0001D534', - "wopf;": '\U0001D568', - "wp;": '\U00002118', - "wr;": '\U00002240', - "wreath;": '\U00002240', - "wscr;": '\U0001D4CC', - "xcap;": '\U000022C2', - "xcirc;": '\U000025EF', - "xcup;": '\U000022C3', - "xdtri;": '\U000025BD', - "xfr;": '\U0001D535', - "xhArr;": '\U000027FA', - "xharr;": '\U000027F7', - "xi;": '\U000003BE', - "xlArr;": '\U000027F8', - "xlarr;": '\U000027F5', - "xmap;": '\U000027FC', - "xnis;": '\U000022FB', - "xodot;": '\U00002A00', - "xopf;": '\U0001D569', - "xoplus;": '\U00002A01', - "xotime;": '\U00002A02', - "xrArr;": '\U000027F9', - "xrarr;": '\U000027F6', - "xscr;": '\U0001D4CD', - "xsqcup;": '\U00002A06', - "xuplus;": '\U00002A04', - "xutri;": '\U000025B3', - "xvee;": '\U000022C1', - "xwedge;": '\U000022C0', - "yacute;": '\U000000FD', - "yacy;": '\U0000044F', - "ycirc;": '\U00000177', - "ycy;": '\U0000044B', - "yen;": '\U000000A5', - "yfr;": '\U0001D536', - "yicy;": '\U00000457', - "yopf;": '\U0001D56A', - "yscr;": '\U0001D4CE', - "yucy;": '\U0000044E', - "yuml;": '\U000000FF', - "zacute;": '\U0000017A', - "zcaron;": '\U0000017E', - "zcy;": '\U00000437', - "zdot;": '\U0000017C', - "zeetrf;": '\U00002128', - "zeta;": '\U000003B6', - "zfr;": '\U0001D537', - "zhcy;": '\U00000436', - "zigrarr;": '\U000021DD', - "zopf;": '\U0001D56B', - "zscr;": '\U0001D4CF', - "zwj;": '\U0000200D', - "zwnj;": '\U0000200C', - "AElig": '\U000000C6', - "AMP": '\U00000026', - "Aacute": '\U000000C1', - "Acirc": '\U000000C2', - "Agrave": '\U000000C0', - "Aring": '\U000000C5', - "Atilde": '\U000000C3', - "Auml": '\U000000C4', - "COPY": '\U000000A9', - "Ccedil": '\U000000C7', - "ETH": '\U000000D0', - "Eacute": '\U000000C9', - "Ecirc": '\U000000CA', - "Egrave": '\U000000C8', - "Euml": '\U000000CB', - "GT": '\U0000003E', - "Iacute": '\U000000CD', - "Icirc": '\U000000CE', - "Igrave": '\U000000CC', - "Iuml": '\U000000CF', - "LT": '\U0000003C', - "Ntilde": '\U000000D1', - "Oacute": '\U000000D3', - "Ocirc": '\U000000D4', - "Ograve": '\U000000D2', - "Oslash": '\U000000D8', - "Otilde": '\U000000D5', - "Ouml": '\U000000D6', - "QUOT": '\U00000022', - "REG": '\U000000AE', - "THORN": '\U000000DE', - "Uacute": '\U000000DA', - "Ucirc": '\U000000DB', - "Ugrave": '\U000000D9', - "Uuml": '\U000000DC', - "Yacute": '\U000000DD', - "aacute": '\U000000E1', - "acirc": '\U000000E2', - "acute": '\U000000B4', - "aelig": '\U000000E6', - "agrave": '\U000000E0', - "amp": '\U00000026', - "aring": '\U000000E5', - "atilde": '\U000000E3', - "auml": '\U000000E4', - "brvbar": '\U000000A6', - "ccedil": '\U000000E7', - "cedil": '\U000000B8', - "cent": '\U000000A2', - "copy": '\U000000A9', - "curren": '\U000000A4', - "deg": '\U000000B0', - "divide": '\U000000F7', - "eacute": '\U000000E9', - "ecirc": '\U000000EA', - "egrave": '\U000000E8', - "eth": '\U000000F0', - "euml": '\U000000EB', - "frac12": '\U000000BD', - "frac14": '\U000000BC', - "frac34": '\U000000BE', - "gt": '\U0000003E', - "iacute": '\U000000ED', - "icirc": '\U000000EE', - "iexcl": '\U000000A1', - "igrave": '\U000000EC', - "iquest": '\U000000BF', - "iuml": '\U000000EF', - "laquo": '\U000000AB', - "lt": '\U0000003C', - "macr": '\U000000AF', - "micro": '\U000000B5', - "middot": '\U000000B7', - "nbsp": '\U000000A0', - "not": '\U000000AC', - "ntilde": '\U000000F1', - "oacute": '\U000000F3', - "ocirc": '\U000000F4', - "ograve": '\U000000F2', - "ordf": '\U000000AA', - "ordm": '\U000000BA', - "oslash": '\U000000F8', - "otilde": '\U000000F5', - "ouml": '\U000000F6', - "para": '\U000000B6', - "plusmn": '\U000000B1', - "pound": '\U000000A3', - "quot": '\U00000022', - "raquo": '\U000000BB', - "reg": '\U000000AE', - "sect": '\U000000A7', - "shy": '\U000000AD', - "sup1": '\U000000B9', - "sup2": '\U000000B2', - "sup3": '\U000000B3', - "szlig": '\U000000DF', - "thorn": '\U000000FE', - "times": '\U000000D7', - "uacute": '\U000000FA', - "ucirc": '\U000000FB', - "ugrave": '\U000000F9', - "uml": '\U000000A8', - "uuml": '\U000000FC', - "yacute": '\U000000FD', - "yen": '\U000000A5', - "yuml": '\U000000FF', + "Cross;": '\U00002A2F', + "Cscr;": '\U0001D49E', + "Cup;": '\U000022D3', + "CupCap;": '\U0000224D', + "DD;": '\U00002145', + "DDotrahd;": '\U00002911', + "DJcy;": '\U00000402', + "DScy;": '\U00000405', + "DZcy;": '\U0000040F', + "Dagger;": '\U00002021', + "Darr;": '\U000021A1', + "Dashv;": '\U00002AE4', + "Dcaron;": '\U0000010E', + "Dcy;": '\U00000414', + "Del;": '\U00002207', + "Delta;": '\U00000394', + "Dfr;": '\U0001D507', + "DiacriticalAcute;": '\U000000B4', + "DiacriticalDot;": '\U000002D9', + "DiacriticalDoubleAcute;": '\U000002DD', + "DiacriticalGrave;": '\U00000060', + "DiacriticalTilde;": '\U000002DC', + "Diamond;": '\U000022C4', + "DifferentialD;": '\U00002146', + "Dopf;": '\U0001D53B', + "Dot;": '\U000000A8', + "DotDot;": '\U000020DC', + "DotEqual;": '\U00002250', + "DoubleContourIntegral;": '\U0000222F', + "DoubleDot;": '\U000000A8', + "DoubleDownArrow;": '\U000021D3', + "DoubleLeftArrow;": '\U000021D0', + "DoubleLeftRightArrow;": '\U000021D4', + "DoubleLeftTee;": '\U00002AE4', + "DoubleLongLeftArrow;": '\U000027F8', + "DoubleLongLeftRightArrow;": '\U000027FA', + "DoubleLongRightArrow;": '\U000027F9', + "DoubleRightArrow;": '\U000021D2', + "DoubleRightTee;": '\U000022A8', + "DoubleUpArrow;": '\U000021D1', + "DoubleUpDownArrow;": '\U000021D5', + "DoubleVerticalBar;": '\U00002225', + "DownArrow;": '\U00002193', + "DownArrowBar;": '\U00002913', + "DownArrowUpArrow;": '\U000021F5', + "DownBreve;": '\U00000311', + "DownLeftRightVector;": '\U00002950', + "DownLeftTeeVector;": '\U0000295E', + "DownLeftVector;": '\U000021BD', + "DownLeftVectorBar;": '\U00002956', + "DownRightTeeVector;": '\U0000295F', + "DownRightVector;": '\U000021C1', + "DownRightVectorBar;": '\U00002957', + "DownTee;": '\U000022A4', + "DownTeeArrow;": '\U000021A7', + "Downarrow;": '\U000021D3', + "Dscr;": '\U0001D49F', + "Dstrok;": '\U00000110', + "ENG;": '\U0000014A', + "ETH;": '\U000000D0', + "Eacute;": '\U000000C9', + "Ecaron;": '\U0000011A', + "Ecirc;": '\U000000CA', + "Ecy;": '\U0000042D', + "Edot;": '\U00000116', + "Efr;": '\U0001D508', + "Egrave;": '\U000000C8', + "Element;": '\U00002208', + "Emacr;": '\U00000112', + "EmptySmallSquare;": '\U000025FB', + "EmptyVerySmallSquare;": '\U000025AB', + "Eogon;": '\U00000118', + "Eopf;": '\U0001D53C', + "Epsilon;": '\U00000395', + "Equal;": '\U00002A75', + "EqualTilde;": '\U00002242', + "Equilibrium;": '\U000021CC', + "Escr;": '\U00002130', + "Esim;": '\U00002A73', + "Eta;": '\U00000397', + "Euml;": '\U000000CB', + "Exists;": '\U00002203', + "ExponentialE;": '\U00002147', + "Fcy;": '\U00000424', + "Ffr;": '\U0001D509', + "FilledSmallSquare;": '\U000025FC', + "FilledVerySmallSquare;": '\U000025AA', + "Fopf;": '\U0001D53D', + "ForAll;": '\U00002200', + "Fouriertrf;": '\U00002131', + "Fscr;": '\U00002131', + "GJcy;": '\U00000403', + "GT;": '\U0000003E', + "Gamma;": '\U00000393', + "Gammad;": '\U000003DC', + "Gbreve;": '\U0000011E', + "Gcedil;": '\U00000122', + "Gcirc;": '\U0000011C', + "Gcy;": '\U00000413', + "Gdot;": '\U00000120', + "Gfr;": '\U0001D50A', + "Gg;": '\U000022D9', + "Gopf;": '\U0001D53E', + "GreaterEqual;": '\U00002265', + "GreaterEqualLess;": '\U000022DB', + "GreaterFullEqual;": '\U00002267', + "GreaterGreater;": '\U00002AA2', + "GreaterLess;": '\U00002277', + "GreaterSlantEqual;": '\U00002A7E', + "GreaterTilde;": '\U00002273', + "Gscr;": '\U0001D4A2', + "Gt;": '\U0000226B', + "HARDcy;": '\U0000042A', + "Hacek;": '\U000002C7', + "Hat;": '\U0000005E', + "Hcirc;": '\U00000124', + "Hfr;": '\U0000210C', + "HilbertSpace;": '\U0000210B', + "Hopf;": '\U0000210D', + "HorizontalLine;": '\U00002500', + "Hscr;": '\U0000210B', + "Hstrok;": '\U00000126', + "HumpDownHump;": '\U0000224E', + "HumpEqual;": '\U0000224F', + "IEcy;": '\U00000415', + "IJlig;": '\U00000132', + "IOcy;": '\U00000401', + "Iacute;": '\U000000CD', + "Icirc;": '\U000000CE', + "Icy;": '\U00000418', + "Idot;": '\U00000130', + "Ifr;": '\U00002111', + "Igrave;": '\U000000CC', + "Im;": '\U00002111', + "Imacr;": '\U0000012A', + "ImaginaryI;": '\U00002148', + "Implies;": '\U000021D2', + "Int;": '\U0000222C', + "Integral;": '\U0000222B', + "Intersection;": '\U000022C2', + "InvisibleComma;": '\U00002063', + "InvisibleTimes;": '\U00002062', + "Iogon;": '\U0000012E', + "Iopf;": '\U0001D540', + "Iota;": '\U00000399', + "Iscr;": '\U00002110', + "Itilde;": '\U00000128', + "Iukcy;": '\U00000406', + "Iuml;": '\U000000CF', + "Jcirc;": '\U00000134', + "Jcy;": '\U00000419', + "Jfr;": '\U0001D50D', + "Jopf;": '\U0001D541', + "Jscr;": '\U0001D4A5', + "Jsercy;": '\U00000408', + "Jukcy;": '\U00000404', + "KHcy;": '\U00000425', + "KJcy;": '\U0000040C', + "Kappa;": '\U0000039A', + "Kcedil;": '\U00000136', + "Kcy;": '\U0000041A', + "Kfr;": '\U0001D50E', + "Kopf;": '\U0001D542', + "Kscr;": '\U0001D4A6', + "LJcy;": '\U00000409', + "LT;": '\U0000003C', + "Lacute;": '\U00000139', + "Lambda;": '\U0000039B', + "Lang;": '\U000027EA', + "Laplacetrf;": '\U00002112', + "Larr;": '\U0000219E', + "Lcaron;": '\U0000013D', + "Lcedil;": '\U0000013B', + "Lcy;": '\U0000041B', + "LeftAngleBracket;": '\U000027E8', + "LeftArrow;": '\U00002190', + "LeftArrowBar;": '\U000021E4', + "LeftArrowRightArrow;": '\U000021C6', + "LeftCeiling;": '\U00002308', + "LeftDoubleBracket;": '\U000027E6', + "LeftDownTeeVector;": '\U00002961', + "LeftDownVector;": '\U000021C3', + "LeftDownVectorBar;": '\U00002959', + "LeftFloor;": '\U0000230A', + "LeftRightArrow;": '\U00002194', + "LeftRightVector;": '\U0000294E', + "LeftTee;": '\U000022A3', + "LeftTeeArrow;": '\U000021A4', + "LeftTeeVector;": '\U0000295A', + "LeftTriangle;": '\U000022B2', + "LeftTriangleBar;": '\U000029CF', + "LeftTriangleEqual;": '\U000022B4', + "LeftUpDownVector;": '\U00002951', + "LeftUpTeeVector;": '\U00002960', + "LeftUpVector;": '\U000021BF', + "LeftUpVectorBar;": '\U00002958', + "LeftVector;": '\U000021BC', + "LeftVectorBar;": '\U00002952', + "Leftarrow;": '\U000021D0', + "Leftrightarrow;": '\U000021D4', + "LessEqualGreater;": '\U000022DA', + "LessFullEqual;": '\U00002266', + "LessGreater;": '\U00002276', + "LessLess;": '\U00002AA1', + "LessSlantEqual;": '\U00002A7D', + "LessTilde;": '\U00002272', + "Lfr;": '\U0001D50F', + "Ll;": '\U000022D8', + "Lleftarrow;": '\U000021DA', + "Lmidot;": '\U0000013F', + "LongLeftArrow;": '\U000027F5', + "LongLeftRightArrow;": '\U000027F7', + "LongRightArrow;": '\U000027F6', + "Longleftarrow;": '\U000027F8', + "Longleftrightarrow;": '\U000027FA', + "Longrightarrow;": '\U000027F9', + "Lopf;": '\U0001D543', + "LowerLeftArrow;": '\U00002199', + "LowerRightArrow;": '\U00002198', + "Lscr;": '\U00002112', + "Lsh;": '\U000021B0', + "Lstrok;": '\U00000141', + "Lt;": '\U0000226A', + "Map;": '\U00002905', + "Mcy;": '\U0000041C', + "MediumSpace;": '\U0000205F', + "Mellintrf;": '\U00002133', + "Mfr;": '\U0001D510', + "MinusPlus;": '\U00002213', + "Mopf;": '\U0001D544', + "Mscr;": '\U00002133', + "Mu;": '\U0000039C', + "NJcy;": '\U0000040A', + "Nacute;": '\U00000143', + "Ncaron;": '\U00000147', + "Ncedil;": '\U00000145', + "Ncy;": '\U0000041D', + "NegativeMediumSpace;": '\U0000200B', + "NegativeThickSpace;": '\U0000200B', + "NegativeThinSpace;": '\U0000200B', + "NegativeVeryThinSpace;": '\U0000200B', + "NestedGreaterGreater;": '\U0000226B', + "NestedLessLess;": '\U0000226A', + "NewLine;": '\U0000000A', + "Nfr;": '\U0001D511', + "NoBreak;": '\U00002060', + "NonBreakingSpace;": '\U000000A0', + "Nopf;": '\U00002115', + "Not;": '\U00002AEC', + "NotCongruent;": '\U00002262', + "NotCupCap;": '\U0000226D', + "NotDoubleVerticalBar;": '\U00002226', + "NotElement;": '\U00002209', + "NotEqual;": '\U00002260', + "NotExists;": '\U00002204', + "NotGreater;": '\U0000226F', + "NotGreaterEqual;": '\U00002271', + "NotGreaterLess;": '\U00002279', + "NotGreaterTilde;": '\U00002275', + "NotLeftTriangle;": '\U000022EA', + "NotLeftTriangleEqual;": '\U000022EC', + "NotLess;": '\U0000226E', + "NotLessEqual;": '\U00002270', + "NotLessGreater;": '\U00002278', + "NotLessTilde;": '\U00002274', + "NotPrecedes;": '\U00002280', + "NotPrecedesSlantEqual;": '\U000022E0', + "NotReverseElement;": '\U0000220C', + "NotRightTriangle;": '\U000022EB', + "NotRightTriangleEqual;": '\U000022ED', + "NotSquareSubsetEqual;": '\U000022E2', + "NotSquareSupersetEqual;": '\U000022E3', + "NotSubsetEqual;": '\U00002288', + "NotSucceeds;": '\U00002281', + "NotSucceedsSlantEqual;": '\U000022E1', + "NotSupersetEqual;": '\U00002289', + "NotTilde;": '\U00002241', + "NotTildeEqual;": '\U00002244', + "NotTildeFullEqual;": '\U00002247', + "NotTildeTilde;": '\U00002249', + "NotVerticalBar;": '\U00002224', + "Nscr;": '\U0001D4A9', + "Ntilde;": '\U000000D1', + "Nu;": '\U0000039D', + "OElig;": '\U00000152', + "Oacute;": '\U000000D3', + "Ocirc;": '\U000000D4', + "Ocy;": '\U0000041E', + "Odblac;": '\U00000150', + "Ofr;": '\U0001D512', + "Ograve;": '\U000000D2', + "Omacr;": '\U0000014C', + "Omega;": '\U000003A9', + "Omicron;": '\U0000039F', + "Oopf;": '\U0001D546', + "OpenCurlyDoubleQuote;": '\U0000201C', + "OpenCurlyQuote;": '\U00002018', + "Or;": '\U00002A54', + "Oscr;": '\U0001D4AA', + "Oslash;": '\U000000D8', + "Otilde;": '\U000000D5', + "Otimes;": '\U00002A37', + "Ouml;": '\U000000D6', + "OverBar;": '\U0000203E', + "OverBrace;": '\U000023DE', + "OverBracket;": '\U000023B4', + "OverParenthesis;": '\U000023DC', + "PartialD;": '\U00002202', + "Pcy;": '\U0000041F', + "Pfr;": '\U0001D513', + "Phi;": '\U000003A6', + "Pi;": '\U000003A0', + "PlusMinus;": '\U000000B1', + "Poincareplane;": '\U0000210C', + "Popf;": '\U00002119', + "Pr;": '\U00002ABB', + "Precedes;": '\U0000227A', + "PrecedesEqual;": '\U00002AAF', + "PrecedesSlantEqual;": '\U0000227C', + "PrecedesTilde;": '\U0000227E', + "Prime;": '\U00002033', + "Product;": '\U0000220F', + "Proportion;": '\U00002237', + "Proportional;": '\U0000221D', + "Pscr;": '\U0001D4AB', + "Psi;": '\U000003A8', + "QUOT;": '\U00000022', + "Qfr;": '\U0001D514', + "Qopf;": '\U0000211A', + "Qscr;": '\U0001D4AC', + "RBarr;": '\U00002910', + "REG;": '\U000000AE', + "Racute;": '\U00000154', + "Rang;": '\U000027EB', + "Rarr;": '\U000021A0', + "Rarrtl;": '\U00002916', + "Rcaron;": '\U00000158', + "Rcedil;": '\U00000156', + "Rcy;": '\U00000420', + "Re;": '\U0000211C', + "ReverseElement;": '\U0000220B', + "ReverseEquilibrium;": '\U000021CB', + "ReverseUpEquilibrium;": '\U0000296F', + "Rfr;": '\U0000211C', + "Rho;": '\U000003A1', + "RightAngleBracket;": '\U000027E9', + "RightArrow;": '\U00002192', + "RightArrowBar;": '\U000021E5', + "RightArrowLeftArrow;": '\U000021C4', + "RightCeiling;": '\U00002309', + "RightDoubleBracket;": '\U000027E7', + "RightDownTeeVector;": '\U0000295D', + "RightDownVector;": '\U000021C2', + "RightDownVectorBar;": '\U00002955', + "RightFloor;": '\U0000230B', + "RightTee;": '\U000022A2', + "RightTeeArrow;": '\U000021A6', + "RightTeeVector;": '\U0000295B', + "RightTriangle;": '\U000022B3', + "RightTriangleBar;": '\U000029D0', + "RightTriangleEqual;": '\U000022B5', + "RightUpDownVector;": '\U0000294F', + "RightUpTeeVector;": '\U0000295C', + "RightUpVector;": '\U000021BE', + "RightUpVectorBar;": '\U00002954', + "RightVector;": '\U000021C0', + "RightVectorBar;": '\U00002953', + "Rightarrow;": '\U000021D2', + "Ropf;": '\U0000211D', + "RoundImplies;": '\U00002970', + "Rrightarrow;": '\U000021DB', + "Rscr;": '\U0000211B', + "Rsh;": '\U000021B1', + "RuleDelayed;": '\U000029F4', + "SHCHcy;": '\U00000429', + "SHcy;": '\U00000428', + "SOFTcy;": '\U0000042C', + "Sacute;": '\U0000015A', + "Sc;": '\U00002ABC', + "Scaron;": '\U00000160', + "Scedil;": '\U0000015E', + "Scirc;": '\U0000015C', + "Scy;": '\U00000421', + "Sfr;": '\U0001D516', + "ShortDownArrow;": '\U00002193', + "ShortLeftArrow;": '\U00002190', + "ShortRightArrow;": '\U00002192', + "ShortUpArrow;": '\U00002191', + "Sigma;": '\U000003A3', + "SmallCircle;": '\U00002218', + "Sopf;": '\U0001D54A', + "Sqrt;": '\U0000221A', + "Square;": '\U000025A1', + "SquareIntersection;": '\U00002293', + "SquareSubset;": '\U0000228F', + "SquareSubsetEqual;": '\U00002291', + "SquareSuperset;": '\U00002290', + "SquareSupersetEqual;": '\U00002292', + "SquareUnion;": '\U00002294', + "Sscr;": '\U0001D4AE', + "Star;": '\U000022C6', + "Sub;": '\U000022D0', + "Subset;": '\U000022D0', + "SubsetEqual;": '\U00002286', + "Succeeds;": '\U0000227B', + "SucceedsEqual;": '\U00002AB0', + "SucceedsSlantEqual;": '\U0000227D', + "SucceedsTilde;": '\U0000227F', + "SuchThat;": '\U0000220B', + "Sum;": '\U00002211', + "Sup;": '\U000022D1', + "Superset;": '\U00002283', + "SupersetEqual;": '\U00002287', + "Supset;": '\U000022D1', + "THORN;": '\U000000DE', + "TRADE;": '\U00002122', + "TSHcy;": '\U0000040B', + "TScy;": '\U00000426', + "Tab;": '\U00000009', + "Tau;": '\U000003A4', + "Tcaron;": '\U00000164', + "Tcedil;": '\U00000162', + "Tcy;": '\U00000422', + "Tfr;": '\U0001D517', + "Therefore;": '\U00002234', + "Theta;": '\U00000398', + "ThinSpace;": '\U00002009', + "Tilde;": '\U0000223C', + "TildeEqual;": '\U00002243', + "TildeFullEqual;": '\U00002245', + "TildeTilde;": '\U00002248', + "Topf;": '\U0001D54B', + "TripleDot;": '\U000020DB', + "Tscr;": '\U0001D4AF', + "Tstrok;": '\U00000166', + "Uacute;": '\U000000DA', + "Uarr;": '\U0000219F', + "Uarrocir;": '\U00002949', + "Ubrcy;": '\U0000040E', + "Ubreve;": '\U0000016C', + "Ucirc;": '\U000000DB', + "Ucy;": '\U00000423', + "Udblac;": '\U00000170', + "Ufr;": '\U0001D518', + "Ugrave;": '\U000000D9', + "Umacr;": '\U0000016A', + "UnderBar;": '\U0000005F', + "UnderBrace;": '\U000023DF', + "UnderBracket;": '\U000023B5', + "UnderParenthesis;": '\U000023DD', + "Union;": '\U000022C3', + "UnionPlus;": '\U0000228E', + "Uogon;": '\U00000172', + "Uopf;": '\U0001D54C', + "UpArrow;": '\U00002191', + "UpArrowBar;": '\U00002912', + "UpArrowDownArrow;": '\U000021C5', + "UpDownArrow;": '\U00002195', + "UpEquilibrium;": '\U0000296E', + "UpTee;": '\U000022A5', + "UpTeeArrow;": '\U000021A5', + "Uparrow;": '\U000021D1', + "Updownarrow;": '\U000021D5', + "UpperLeftArrow;": '\U00002196', + "UpperRightArrow;": '\U00002197', + "Upsi;": '\U000003D2', + "Upsilon;": '\U000003A5', + "Uring;": '\U0000016E', + "Uscr;": '\U0001D4B0', + "Utilde;": '\U00000168', + "Uuml;": '\U000000DC', + "VDash;": '\U000022AB', + "Vbar;": '\U00002AEB', + "Vcy;": '\U00000412', + "Vdash;": '\U000022A9', + "Vdashl;": '\U00002AE6', + "Vee;": '\U000022C1', + "Verbar;": '\U00002016', + "Vert;": '\U00002016', + "VerticalBar;": '\U00002223', + "VerticalLine;": '\U0000007C', + "VerticalSeparator;": '\U00002758', + "VerticalTilde;": '\U00002240', + "VeryThinSpace;": '\U0000200A', + "Vfr;": '\U0001D519', + "Vopf;": '\U0001D54D', + "Vscr;": '\U0001D4B1', + "Vvdash;": '\U000022AA', + "Wcirc;": '\U00000174', + "Wedge;": '\U000022C0', + "Wfr;": '\U0001D51A', + "Wopf;": '\U0001D54E', + "Wscr;": '\U0001D4B2', + "Xfr;": '\U0001D51B', + "Xi;": '\U0000039E', + "Xopf;": '\U0001D54F', + "Xscr;": '\U0001D4B3', + "YAcy;": '\U0000042F', + "YIcy;": '\U00000407', + "YUcy;": '\U0000042E', + "Yacute;": '\U000000DD', + "Ycirc;": '\U00000176', + "Ycy;": '\U0000042B', + "Yfr;": '\U0001D51C', + "Yopf;": '\U0001D550', + "Yscr;": '\U0001D4B4', + "Yuml;": '\U00000178', + "ZHcy;": '\U00000416', + "Zacute;": '\U00000179', + "Zcaron;": '\U0000017D', + "Zcy;": '\U00000417', + "Zdot;": '\U0000017B', + "ZeroWidthSpace;": '\U0000200B', + "Zeta;": '\U00000396', + "Zfr;": '\U00002128', + "Zopf;": '\U00002124', + "Zscr;": '\U0001D4B5', + "aacute;": '\U000000E1', + "abreve;": '\U00000103', + "ac;": '\U0000223E', + "acd;": '\U0000223F', + "acirc;": '\U000000E2', + "acute;": '\U000000B4', + "acy;": '\U00000430', + "aelig;": '\U000000E6', + "af;": '\U00002061', + "afr;": '\U0001D51E', + "agrave;": '\U000000E0', + "alefsym;": '\U00002135', + "aleph;": '\U00002135', + "alpha;": '\U000003B1', + "amacr;": '\U00000101', + "amalg;": '\U00002A3F', + "amp;": '\U00000026', + "and;": '\U00002227', + "andand;": '\U00002A55', + "andd;": '\U00002A5C', + "andslope;": '\U00002A58', + "andv;": '\U00002A5A', + "ang;": '\U00002220', + "ange;": '\U000029A4', + "angle;": '\U00002220', + "angmsd;": '\U00002221', + "angmsdaa;": '\U000029A8', + "angmsdab;": '\U000029A9', + "angmsdac;": '\U000029AA', + "angmsdad;": '\U000029AB', + "angmsdae;": '\U000029AC', + "angmsdaf;": '\U000029AD', + "angmsdag;": '\U000029AE', + "angmsdah;": '\U000029AF', + "angrt;": '\U0000221F', + "angrtvb;": '\U000022BE', + "angrtvbd;": '\U0000299D', + "angsph;": '\U00002222', + "angst;": '\U000000C5', + "angzarr;": '\U0000237C', + "aogon;": '\U00000105', + "aopf;": '\U0001D552', + "ap;": '\U00002248', + "apE;": '\U00002A70', + "apacir;": '\U00002A6F', + "ape;": '\U0000224A', + "apid;": '\U0000224B', + "apos;": '\U00000027', + "approx;": '\U00002248', + "approxeq;": '\U0000224A', + "aring;": '\U000000E5', + "ascr;": '\U0001D4B6', + "ast;": '\U0000002A', + "asymp;": '\U00002248', + "asympeq;": '\U0000224D', + "atilde;": '\U000000E3', + "auml;": '\U000000E4', + "awconint;": '\U00002233', + "awint;": '\U00002A11', + "bNot;": '\U00002AED', + "backcong;": '\U0000224C', + "backepsilon;": '\U000003F6', + "backprime;": '\U00002035', + "backsim;": '\U0000223D', + "backsimeq;": '\U000022CD', + "barvee;": '\U000022BD', + "barwed;": '\U00002305', + "barwedge;": '\U00002305', + "bbrk;": '\U000023B5', + "bbrktbrk;": '\U000023B6', + "bcong;": '\U0000224C', + "bcy;": '\U00000431', + "bdquo;": '\U0000201E', + "becaus;": '\U00002235', + "because;": '\U00002235', + "bemptyv;": '\U000029B0', + "bepsi;": '\U000003F6', + "bernou;": '\U0000212C', + "beta;": '\U000003B2', + "beth;": '\U00002136', + "between;": '\U0000226C', + "bfr;": '\U0001D51F', + "bigcap;": '\U000022C2', + "bigcirc;": '\U000025EF', + "bigcup;": '\U000022C3', + "bigodot;": '\U00002A00', + "bigoplus;": '\U00002A01', + "bigotimes;": '\U00002A02', + "bigsqcup;": '\U00002A06', + "bigstar;": '\U00002605', + "bigtriangledown;": '\U000025BD', + "bigtriangleup;": '\U000025B3', + "biguplus;": '\U00002A04', + "bigvee;": '\U000022C1', + "bigwedge;": '\U000022C0', + "bkarow;": '\U0000290D', + "blacklozenge;": '\U000029EB', + "blacksquare;": '\U000025AA', + "blacktriangle;": '\U000025B4', + "blacktriangledown;": '\U000025BE', + "blacktriangleleft;": '\U000025C2', + "blacktriangleright;": '\U000025B8', + "blank;": '\U00002423', + "blk12;": '\U00002592', + "blk14;": '\U00002591', + "blk34;": '\U00002593', + "block;": '\U00002588', + "bnot;": '\U00002310', + "bopf;": '\U0001D553', + "bot;": '\U000022A5', + "bottom;": '\U000022A5', + "bowtie;": '\U000022C8', + "boxDL;": '\U00002557', + "boxDR;": '\U00002554', + "boxDl;": '\U00002556', + "boxDr;": '\U00002553', + "boxH;": '\U00002550', + "boxHD;": '\U00002566', + "boxHU;": '\U00002569', + "boxHd;": '\U00002564', + "boxHu;": '\U00002567', + "boxUL;": '\U0000255D', + "boxUR;": '\U0000255A', + "boxUl;": '\U0000255C', + "boxUr;": '\U00002559', + "boxV;": '\U00002551', + "boxVH;": '\U0000256C', + "boxVL;": '\U00002563', + "boxVR;": '\U00002560', + "boxVh;": '\U0000256B', + "boxVl;": '\U00002562', + "boxVr;": '\U0000255F', + "boxbox;": '\U000029C9', + "boxdL;": '\U00002555', + "boxdR;": '\U00002552', + "boxdl;": '\U00002510', + "boxdr;": '\U0000250C', + "boxh;": '\U00002500', + "boxhD;": '\U00002565', + "boxhU;": '\U00002568', + "boxhd;": '\U0000252C', + "boxhu;": '\U00002534', + "boxminus;": '\U0000229F', + "boxplus;": '\U0000229E', + "boxtimes;": '\U000022A0', + "boxuL;": '\U0000255B', + "boxuR;": '\U00002558', + "boxul;": '\U00002518', + "boxur;": '\U00002514', + "boxv;": '\U00002502', + "boxvH;": '\U0000256A', + "boxvL;": '\U00002561', + "boxvR;": '\U0000255E', + "boxvh;": '\U0000253C', + "boxvl;": '\U00002524', + "boxvr;": '\U0000251C', + "bprime;": '\U00002035', + "breve;": '\U000002D8', + "brvbar;": '\U000000A6', + "bscr;": '\U0001D4B7', + "bsemi;": '\U0000204F', + "bsim;": '\U0000223D', + "bsime;": '\U000022CD', + "bsol;": '\U0000005C', + "bsolb;": '\U000029C5', + "bsolhsub;": '\U000027C8', + "bull;": '\U00002022', + "bullet;": '\U00002022', + "bump;": '\U0000224E', + "bumpE;": '\U00002AAE', + "bumpe;": '\U0000224F', + "bumpeq;": '\U0000224F', + "cacute;": '\U00000107', + "cap;": '\U00002229', + "capand;": '\U00002A44', + "capbrcup;": '\U00002A49', + "capcap;": '\U00002A4B', + "capcup;": '\U00002A47', + "capdot;": '\U00002A40', + "caret;": '\U00002041', + "caron;": '\U000002C7', + "ccaps;": '\U00002A4D', + "ccaron;": '\U0000010D', + "ccedil;": '\U000000E7', + "ccirc;": '\U00000109', + "ccups;": '\U00002A4C', + "ccupssm;": '\U00002A50', + "cdot;": '\U0000010B', + "cedil;": '\U000000B8', + "cemptyv;": '\U000029B2', + "cent;": '\U000000A2', + "centerdot;": '\U000000B7', + "cfr;": '\U0001D520', + "chcy;": '\U00000447', + "check;": '\U00002713', + "checkmark;": '\U00002713', + "chi;": '\U000003C7', + "cir;": '\U000025CB', + "cirE;": '\U000029C3', + "circ;": '\U000002C6', + "circeq;": '\U00002257', + "circlearrowleft;": '\U000021BA', + "circlearrowright;": '\U000021BB', + "circledR;": '\U000000AE', + "circledS;": '\U000024C8', + "circledast;": '\U0000229B', + "circledcirc;": '\U0000229A', + "circleddash;": '\U0000229D', + "cire;": '\U00002257', + "cirfnint;": '\U00002A10', + "cirmid;": '\U00002AEF', + "cirscir;": '\U000029C2', + "clubs;": '\U00002663', + "clubsuit;": '\U00002663', + "colon;": '\U0000003A', + "colone;": '\U00002254', + "coloneq;": '\U00002254', + "comma;": '\U0000002C', + "commat;": '\U00000040', + "comp;": '\U00002201', + "compfn;": '\U00002218', + "complement;": '\U00002201', + "complexes;": '\U00002102', + "cong;": '\U00002245', + "congdot;": '\U00002A6D', + "conint;": '\U0000222E', + "copf;": '\U0001D554', + "coprod;": '\U00002210', + "copy;": '\U000000A9', + "copysr;": '\U00002117', + "crarr;": '\U000021B5', + "cross;": '\U00002717', + "cscr;": '\U0001D4B8', + "csub;": '\U00002ACF', + "csube;": '\U00002AD1', + "csup;": '\U00002AD0', + "csupe;": '\U00002AD2', + "ctdot;": '\U000022EF', + "cudarrl;": '\U00002938', + "cudarrr;": '\U00002935', + "cuepr;": '\U000022DE', + "cuesc;": '\U000022DF', + "cularr;": '\U000021B6', + "cularrp;": '\U0000293D', + "cup;": '\U0000222A', + "cupbrcap;": '\U00002A48', + "cupcap;": '\U00002A46', + "cupcup;": '\U00002A4A', + "cupdot;": '\U0000228D', + "cupor;": '\U00002A45', + "curarr;": '\U000021B7', + "curarrm;": '\U0000293C', + "curlyeqprec;": '\U000022DE', + "curlyeqsucc;": '\U000022DF', + "curlyvee;": '\U000022CE', + "curlywedge;": '\U000022CF', + "curren;": '\U000000A4', + "curvearrowleft;": '\U000021B6', + "curvearrowright;": '\U000021B7', + "cuvee;": '\U000022CE', + "cuwed;": '\U000022CF', + "cwconint;": '\U00002232', + "cwint;": '\U00002231', + "cylcty;": '\U0000232D', + "dArr;": '\U000021D3', + "dHar;": '\U00002965', + "dagger;": '\U00002020', + "daleth;": '\U00002138', + "darr;": '\U00002193', + "dash;": '\U00002010', + "dashv;": '\U000022A3', + "dbkarow;": '\U0000290F', + "dblac;": '\U000002DD', + "dcaron;": '\U0000010F', + "dcy;": '\U00000434', + "dd;": '\U00002146', + "ddagger;": '\U00002021', + "ddarr;": '\U000021CA', + "ddotseq;": '\U00002A77', + "deg;": '\U000000B0', + "delta;": '\U000003B4', + "demptyv;": '\U000029B1', + "dfisht;": '\U0000297F', + "dfr;": '\U0001D521', + "dharl;": '\U000021C3', + "dharr;": '\U000021C2', + "diam;": '\U000022C4', + "diamond;": '\U000022C4', + "diamondsuit;": '\U00002666', + "diams;": '\U00002666', + "die;": '\U000000A8', + "digamma;": '\U000003DD', + "disin;": '\U000022F2', + "div;": '\U000000F7', + "divide;": '\U000000F7', + "divideontimes;": '\U000022C7', + "divonx;": '\U000022C7', + "djcy;": '\U00000452', + "dlcorn;": '\U0000231E', + "dlcrop;": '\U0000230D', + "dollar;": '\U00000024', + "dopf;": '\U0001D555', + "dot;": '\U000002D9', + "doteq;": '\U00002250', + "doteqdot;": '\U00002251', + "dotminus;": '\U00002238', + "dotplus;": '\U00002214', + "dotsquare;": '\U000022A1', + "doublebarwedge;": '\U00002306', + "downarrow;": '\U00002193', + "downdownarrows;": '\U000021CA', + "downharpoonleft;": '\U000021C3', + "downharpoonright;": '\U000021C2', + "drbkarow;": '\U00002910', + "drcorn;": '\U0000231F', + "drcrop;": '\U0000230C', + "dscr;": '\U0001D4B9', + "dscy;": '\U00000455', + "dsol;": '\U000029F6', + "dstrok;": '\U00000111', + "dtdot;": '\U000022F1', + "dtri;": '\U000025BF', + "dtrif;": '\U000025BE', + "duarr;": '\U000021F5', + "duhar;": '\U0000296F', + "dwangle;": '\U000029A6', + "dzcy;": '\U0000045F', + "dzigrarr;": '\U000027FF', + "eDDot;": '\U00002A77', + "eDot;": '\U00002251', + "eacute;": '\U000000E9', + "easter;": '\U00002A6E', + "ecaron;": '\U0000011B', + "ecir;": '\U00002256', + "ecirc;": '\U000000EA', + "ecolon;": '\U00002255', + "ecy;": '\U0000044D', + "edot;": '\U00000117', + "ee;": '\U00002147', + "efDot;": '\U00002252', + "efr;": '\U0001D522', + "eg;": '\U00002A9A', + "egrave;": '\U000000E8', + "egs;": '\U00002A96', + "egsdot;": '\U00002A98', + "el;": '\U00002A99', + "elinters;": '\U000023E7', + "ell;": '\U00002113', + "els;": '\U00002A95', + "elsdot;": '\U00002A97', + "emacr;": '\U00000113', + "empty;": '\U00002205', + "emptyset;": '\U00002205', + "emptyv;": '\U00002205', + "emsp;": '\U00002003', + "emsp13;": '\U00002004', + "emsp14;": '\U00002005', + "eng;": '\U0000014B', + "ensp;": '\U00002002', + "eogon;": '\U00000119', + "eopf;": '\U0001D556', + "epar;": '\U000022D5', + "eparsl;": '\U000029E3', + "eplus;": '\U00002A71', + "epsi;": '\U000003B5', + "epsilon;": '\U000003B5', + "epsiv;": '\U000003F5', + "eqcirc;": '\U00002256', + "eqcolon;": '\U00002255', + "eqsim;": '\U00002242', + "eqslantgtr;": '\U00002A96', + "eqslantless;": '\U00002A95', + "equals;": '\U0000003D', + "equest;": '\U0000225F', + "equiv;": '\U00002261', + "equivDD;": '\U00002A78', + "eqvparsl;": '\U000029E5', + "erDot;": '\U00002253', + "erarr;": '\U00002971', + "escr;": '\U0000212F', + "esdot;": '\U00002250', + "esim;": '\U00002242', + "eta;": '\U000003B7', + "eth;": '\U000000F0', + "euml;": '\U000000EB', + "euro;": '\U000020AC', + "excl;": '\U00000021', + "exist;": '\U00002203', + "expectation;": '\U00002130', + "exponentiale;": '\U00002147', + "fallingdotseq;": '\U00002252', + "fcy;": '\U00000444', + "female;": '\U00002640', + "ffilig;": '\U0000FB03', + "fflig;": '\U0000FB00', + "ffllig;": '\U0000FB04', + "ffr;": '\U0001D523', + "filig;": '\U0000FB01', + "flat;": '\U0000266D', + "fllig;": '\U0000FB02', + "fltns;": '\U000025B1', + "fnof;": '\U00000192', + "fopf;": '\U0001D557', + "forall;": '\U00002200', + "fork;": '\U000022D4', + "forkv;": '\U00002AD9', + "fpartint;": '\U00002A0D', + "frac12;": '\U000000BD', + "frac13;": '\U00002153', + "frac14;": '\U000000BC', + "frac15;": '\U00002155', + "frac16;": '\U00002159', + "frac18;": '\U0000215B', + "frac23;": '\U00002154', + "frac25;": '\U00002156', + "frac34;": '\U000000BE', + "frac35;": '\U00002157', + "frac38;": '\U0000215C', + "frac45;": '\U00002158', + "frac56;": '\U0000215A', + "frac58;": '\U0000215D', + "frac78;": '\U0000215E', + "frasl;": '\U00002044', + "frown;": '\U00002322', + "fscr;": '\U0001D4BB', + "gE;": '\U00002267', + "gEl;": '\U00002A8C', + "gacute;": '\U000001F5', + "gamma;": '\U000003B3', + "gammad;": '\U000003DD', + "gap;": '\U00002A86', + "gbreve;": '\U0000011F', + "gcirc;": '\U0000011D', + "gcy;": '\U00000433', + "gdot;": '\U00000121', + "ge;": '\U00002265', + "gel;": '\U000022DB', + "geq;": '\U00002265', + "geqq;": '\U00002267', + "geqslant;": '\U00002A7E', + "ges;": '\U00002A7E', + "gescc;": '\U00002AA9', + "gesdot;": '\U00002A80', + "gesdoto;": '\U00002A82', + "gesdotol;": '\U00002A84', + "gesles;": '\U00002A94', + "gfr;": '\U0001D524', + "gg;": '\U0000226B', + "ggg;": '\U000022D9', + "gimel;": '\U00002137', + "gjcy;": '\U00000453', + "gl;": '\U00002277', + "glE;": '\U00002A92', + "gla;": '\U00002AA5', + "glj;": '\U00002AA4', + "gnE;": '\U00002269', + "gnap;": '\U00002A8A', + "gnapprox;": '\U00002A8A', + "gne;": '\U00002A88', + "gneq;": '\U00002A88', + "gneqq;": '\U00002269', + "gnsim;": '\U000022E7', + "gopf;": '\U0001D558', + "grave;": '\U00000060', + "gscr;": '\U0000210A', + "gsim;": '\U00002273', + "gsime;": '\U00002A8E', + "gsiml;": '\U00002A90', + "gt;": '\U0000003E', + "gtcc;": '\U00002AA7', + "gtcir;": '\U00002A7A', + "gtdot;": '\U000022D7', + "gtlPar;": '\U00002995', + "gtquest;": '\U00002A7C', + "gtrapprox;": '\U00002A86', + "gtrarr;": '\U00002978', + "gtrdot;": '\U000022D7', + "gtreqless;": '\U000022DB', + "gtreqqless;": '\U00002A8C', + "gtrless;": '\U00002277', + "gtrsim;": '\U00002273', + "hArr;": '\U000021D4', + "hairsp;": '\U0000200A', + "half;": '\U000000BD', + "hamilt;": '\U0000210B', + "hardcy;": '\U0000044A', + "harr;": '\U00002194', + "harrcir;": '\U00002948', + "harrw;": '\U000021AD', + "hbar;": '\U0000210F', + "hcirc;": '\U00000125', + "hearts;": '\U00002665', + "heartsuit;": '\U00002665', + "hellip;": '\U00002026', + "hercon;": '\U000022B9', + "hfr;": '\U0001D525', + "hksearow;": '\U00002925', + "hkswarow;": '\U00002926', + "hoarr;": '\U000021FF', + "homtht;": '\U0000223B', + "hookleftarrow;": '\U000021A9', + "hookrightarrow;": '\U000021AA', + "hopf;": '\U0001D559', + "horbar;": '\U00002015', + "hscr;": '\U0001D4BD', + "hslash;": '\U0000210F', + "hstrok;": '\U00000127', + "hybull;": '\U00002043', + "hyphen;": '\U00002010', + "iacute;": '\U000000ED', + "ic;": '\U00002063', + "icirc;": '\U000000EE', + "icy;": '\U00000438', + "iecy;": '\U00000435', + "iexcl;": '\U000000A1', + "iff;": '\U000021D4', + "ifr;": '\U0001D526', + "igrave;": '\U000000EC', + "ii;": '\U00002148', + "iiiint;": '\U00002A0C', + "iiint;": '\U0000222D', + "iinfin;": '\U000029DC', + "iiota;": '\U00002129', + "ijlig;": '\U00000133', + "imacr;": '\U0000012B', + "image;": '\U00002111', + "imagline;": '\U00002110', + "imagpart;": '\U00002111', + "imath;": '\U00000131', + "imof;": '\U000022B7', + "imped;": '\U000001B5', + "in;": '\U00002208', + "incare;": '\U00002105', + "infin;": '\U0000221E', + "infintie;": '\U000029DD', + "inodot;": '\U00000131', + "int;": '\U0000222B', + "intcal;": '\U000022BA', + "integers;": '\U00002124', + "intercal;": '\U000022BA', + "intlarhk;": '\U00002A17', + "intprod;": '\U00002A3C', + "iocy;": '\U00000451', + "iogon;": '\U0000012F', + "iopf;": '\U0001D55A', + "iota;": '\U000003B9', + "iprod;": '\U00002A3C', + "iquest;": '\U000000BF', + "iscr;": '\U0001D4BE', + "isin;": '\U00002208', + "isinE;": '\U000022F9', + "isindot;": '\U000022F5', + "isins;": '\U000022F4', + "isinsv;": '\U000022F3', + "isinv;": '\U00002208', + "it;": '\U00002062', + "itilde;": '\U00000129', + "iukcy;": '\U00000456', + "iuml;": '\U000000EF', + "jcirc;": '\U00000135', + "jcy;": '\U00000439', + "jfr;": '\U0001D527', + "jmath;": '\U00000237', + "jopf;": '\U0001D55B', + "jscr;": '\U0001D4BF', + "jsercy;": '\U00000458', + "jukcy;": '\U00000454', + "kappa;": '\U000003BA', + "kappav;": '\U000003F0', + "kcedil;": '\U00000137', + "kcy;": '\U0000043A', + "kfr;": '\U0001D528', + "kgreen;": '\U00000138', + "khcy;": '\U00000445', + "kjcy;": '\U0000045C', + "kopf;": '\U0001D55C', + "kscr;": '\U0001D4C0', + "lAarr;": '\U000021DA', + "lArr;": '\U000021D0', + "lAtail;": '\U0000291B', + "lBarr;": '\U0000290E', + "lE;": '\U00002266', + "lEg;": '\U00002A8B', + "lHar;": '\U00002962', + "lacute;": '\U0000013A', + "laemptyv;": '\U000029B4', + "lagran;": '\U00002112', + "lambda;": '\U000003BB', + "lang;": '\U000027E8', + "langd;": '\U00002991', + "langle;": '\U000027E8', + "lap;": '\U00002A85', + "laquo;": '\U000000AB', + "larr;": '\U00002190', + "larrb;": '\U000021E4', + "larrbfs;": '\U0000291F', + "larrfs;": '\U0000291D', + "larrhk;": '\U000021A9', + "larrlp;": '\U000021AB', + "larrpl;": '\U00002939', + "larrsim;": '\U00002973', + "larrtl;": '\U000021A2', + "lat;": '\U00002AAB', + "latail;": '\U00002919', + "late;": '\U00002AAD', + "lbarr;": '\U0000290C', + "lbbrk;": '\U00002772', + "lbrace;": '\U0000007B', + "lbrack;": '\U0000005B', + "lbrke;": '\U0000298B', + "lbrksld;": '\U0000298F', + "lbrkslu;": '\U0000298D', + "lcaron;": '\U0000013E', + "lcedil;": '\U0000013C', + "lceil;": '\U00002308', + "lcub;": '\U0000007B', + "lcy;": '\U0000043B', + "ldca;": '\U00002936', + "ldquo;": '\U0000201C', + "ldquor;": '\U0000201E', + "ldrdhar;": '\U00002967', + "ldrushar;": '\U0000294B', + "ldsh;": '\U000021B2', + "le;": '\U00002264', + "leftarrow;": '\U00002190', + "leftarrowtail;": '\U000021A2', + "leftharpoondown;": '\U000021BD', + "leftharpoonup;": '\U000021BC', + "leftleftarrows;": '\U000021C7', + "leftrightarrow;": '\U00002194', + "leftrightarrows;": '\U000021C6', + "leftrightharpoons;": '\U000021CB', + "leftrightsquigarrow;": '\U000021AD', + "leftthreetimes;": '\U000022CB', + "leg;": '\U000022DA', + "leq;": '\U00002264', + "leqq;": '\U00002266', + "leqslant;": '\U00002A7D', + "les;": '\U00002A7D', + "lescc;": '\U00002AA8', + "lesdot;": '\U00002A7F', + "lesdoto;": '\U00002A81', + "lesdotor;": '\U00002A83', + "lesges;": '\U00002A93', + "lessapprox;": '\U00002A85', + "lessdot;": '\U000022D6', + "lesseqgtr;": '\U000022DA', + "lesseqqgtr;": '\U00002A8B', + "lessgtr;": '\U00002276', + "lesssim;": '\U00002272', + "lfisht;": '\U0000297C', + "lfloor;": '\U0000230A', + "lfr;": '\U0001D529', + "lg;": '\U00002276', + "lgE;": '\U00002A91', + "lhard;": '\U000021BD', + "lharu;": '\U000021BC', + "lharul;": '\U0000296A', + "lhblk;": '\U00002584', + "ljcy;": '\U00000459', + "ll;": '\U0000226A', + "llarr;": '\U000021C7', + "llcorner;": '\U0000231E', + "llhard;": '\U0000296B', + "lltri;": '\U000025FA', + "lmidot;": '\U00000140', + "lmoust;": '\U000023B0', + "lmoustache;": '\U000023B0', + "lnE;": '\U00002268', + "lnap;": '\U00002A89', + "lnapprox;": '\U00002A89', + "lne;": '\U00002A87', + "lneq;": '\U00002A87', + "lneqq;": '\U00002268', + "lnsim;": '\U000022E6', + "loang;": '\U000027EC', + "loarr;": '\U000021FD', + "lobrk;": '\U000027E6', + "longleftarrow;": '\U000027F5', + "longleftrightarrow;": '\U000027F7', + "longmapsto;": '\U000027FC', + "longrightarrow;": '\U000027F6', + "looparrowleft;": '\U000021AB', + "looparrowright;": '\U000021AC', + "lopar;": '\U00002985', + "lopf;": '\U0001D55D', + "loplus;": '\U00002A2D', + "lotimes;": '\U00002A34', + "lowast;": '\U00002217', + "lowbar;": '\U0000005F', + "loz;": '\U000025CA', + "lozenge;": '\U000025CA', + "lozf;": '\U000029EB', + "lpar;": '\U00000028', + "lparlt;": '\U00002993', + "lrarr;": '\U000021C6', + "lrcorner;": '\U0000231F', + "lrhar;": '\U000021CB', + "lrhard;": '\U0000296D', + "lrm;": '\U0000200E', + "lrtri;": '\U000022BF', + "lsaquo;": '\U00002039', + "lscr;": '\U0001D4C1', + "lsh;": '\U000021B0', + "lsim;": '\U00002272', + "lsime;": '\U00002A8D', + "lsimg;": '\U00002A8F', + "lsqb;": '\U0000005B', + "lsquo;": '\U00002018', + "lsquor;": '\U0000201A', + "lstrok;": '\U00000142', + "lt;": '\U0000003C', + "ltcc;": '\U00002AA6', + "ltcir;": '\U00002A79', + "ltdot;": '\U000022D6', + "lthree;": '\U000022CB', + "ltimes;": '\U000022C9', + "ltlarr;": '\U00002976', + "ltquest;": '\U00002A7B', + "ltrPar;": '\U00002996', + "ltri;": '\U000025C3', + "ltrie;": '\U000022B4', + "ltrif;": '\U000025C2', + "lurdshar;": '\U0000294A', + "luruhar;": '\U00002966', + "mDDot;": '\U0000223A', + "macr;": '\U000000AF', + "male;": '\U00002642', + "malt;": '\U00002720', + "maltese;": '\U00002720', + "map;": '\U000021A6', + "mapsto;": '\U000021A6', + "mapstodown;": '\U000021A7', + "mapstoleft;": '\U000021A4', + "mapstoup;": '\U000021A5', + "marker;": '\U000025AE', + "mcomma;": '\U00002A29', + "mcy;": '\U0000043C', + "mdash;": '\U00002014', + "measuredangle;": '\U00002221', + "mfr;": '\U0001D52A', + "mho;": '\U00002127', + "micro;": '\U000000B5', + "mid;": '\U00002223', + "midast;": '\U0000002A', + "midcir;": '\U00002AF0', + "middot;": '\U000000B7', + "minus;": '\U00002212', + "minusb;": '\U0000229F', + "minusd;": '\U00002238', + "minusdu;": '\U00002A2A', + "mlcp;": '\U00002ADB', + "mldr;": '\U00002026', + "mnplus;": '\U00002213', + "models;": '\U000022A7', + "mopf;": '\U0001D55E', + "mp;": '\U00002213', + "mscr;": '\U0001D4C2', + "mstpos;": '\U0000223E', + "mu;": '\U000003BC', + "multimap;": '\U000022B8', + "mumap;": '\U000022B8', + "nLeftarrow;": '\U000021CD', + "nLeftrightarrow;": '\U000021CE', + "nRightarrow;": '\U000021CF', + "nVDash;": '\U000022AF', + "nVdash;": '\U000022AE', + "nabla;": '\U00002207', + "nacute;": '\U00000144', + "nap;": '\U00002249', + "napos;": '\U00000149', + "napprox;": '\U00002249', + "natur;": '\U0000266E', + "natural;": '\U0000266E', + "naturals;": '\U00002115', + "nbsp;": '\U000000A0', + "ncap;": '\U00002A43', + "ncaron;": '\U00000148', + "ncedil;": '\U00000146', + "ncong;": '\U00002247', + "ncup;": '\U00002A42', + "ncy;": '\U0000043D', + "ndash;": '\U00002013', + "ne;": '\U00002260', + "neArr;": '\U000021D7', + "nearhk;": '\U00002924', + "nearr;": '\U00002197', + "nearrow;": '\U00002197', + "nequiv;": '\U00002262', + "nesear;": '\U00002928', + "nexist;": '\U00002204', + "nexists;": '\U00002204', + "nfr;": '\U0001D52B', + "nge;": '\U00002271', + "ngeq;": '\U00002271', + "ngsim;": '\U00002275', + "ngt;": '\U0000226F', + "ngtr;": '\U0000226F', + "nhArr;": '\U000021CE', + "nharr;": '\U000021AE', + "nhpar;": '\U00002AF2', + "ni;": '\U0000220B', + "nis;": '\U000022FC', + "nisd;": '\U000022FA', + "niv;": '\U0000220B', + "njcy;": '\U0000045A', + "nlArr;": '\U000021CD', + "nlarr;": '\U0000219A', + "nldr;": '\U00002025', + "nle;": '\U00002270', + "nleftarrow;": '\U0000219A', + "nleftrightarrow;": '\U000021AE', + "nleq;": '\U00002270', + "nless;": '\U0000226E', + "nlsim;": '\U00002274', + "nlt;": '\U0000226E', + "nltri;": '\U000022EA', + "nltrie;": '\U000022EC', + "nmid;": '\U00002224', + "nopf;": '\U0001D55F', + "not;": '\U000000AC', + "notin;": '\U00002209', + "notinva;": '\U00002209', + "notinvb;": '\U000022F7', + "notinvc;": '\U000022F6', + "notni;": '\U0000220C', + "notniva;": '\U0000220C', + "notnivb;": '\U000022FE', + "notnivc;": '\U000022FD', + "npar;": '\U00002226', + "nparallel;": '\U00002226', + "npolint;": '\U00002A14', + "npr;": '\U00002280', + "nprcue;": '\U000022E0', + "nprec;": '\U00002280', + "nrArr;": '\U000021CF', + "nrarr;": '\U0000219B', + "nrightarrow;": '\U0000219B', + "nrtri;": '\U000022EB', + "nrtrie;": '\U000022ED', + "nsc;": '\U00002281', + "nsccue;": '\U000022E1', + "nscr;": '\U0001D4C3', + "nshortmid;": '\U00002224', + "nshortparallel;": '\U00002226', + "nsim;": '\U00002241', + "nsime;": '\U00002244', + "nsimeq;": '\U00002244', + "nsmid;": '\U00002224', + "nspar;": '\U00002226', + "nsqsube;": '\U000022E2', + "nsqsupe;": '\U000022E3', + "nsub;": '\U00002284', + "nsube;": '\U00002288', + "nsubseteq;": '\U00002288', + "nsucc;": '\U00002281', + "nsup;": '\U00002285', + "nsupe;": '\U00002289', + "nsupseteq;": '\U00002289', + "ntgl;": '\U00002279', + "ntilde;": '\U000000F1', + "ntlg;": '\U00002278', + "ntriangleleft;": '\U000022EA', + "ntrianglelefteq;": '\U000022EC', + "ntriangleright;": '\U000022EB', + "ntrianglerighteq;": '\U000022ED', + "nu;": '\U000003BD', + "num;": '\U00000023', + "numero;": '\U00002116', + "numsp;": '\U00002007', + "nvDash;": '\U000022AD', + "nvHarr;": '\U00002904', + "nvdash;": '\U000022AC', + "nvinfin;": '\U000029DE', + "nvlArr;": '\U00002902', + "nvrArr;": '\U00002903', + "nwArr;": '\U000021D6', + "nwarhk;": '\U00002923', + "nwarr;": '\U00002196', + "nwarrow;": '\U00002196', + "nwnear;": '\U00002927', + "oS;": '\U000024C8', + "oacute;": '\U000000F3', + "oast;": '\U0000229B', + "ocir;": '\U0000229A', + "ocirc;": '\U000000F4', + "ocy;": '\U0000043E', + "odash;": '\U0000229D', + "odblac;": '\U00000151', + "odiv;": '\U00002A38', + "odot;": '\U00002299', + "odsold;": '\U000029BC', + "oelig;": '\U00000153', + "ofcir;": '\U000029BF', + "ofr;": '\U0001D52C', + "ogon;": '\U000002DB', + "ograve;": '\U000000F2', + "ogt;": '\U000029C1', + "ohbar;": '\U000029B5', + "ohm;": '\U000003A9', + "oint;": '\U0000222E', + "olarr;": '\U000021BA', + "olcir;": '\U000029BE', + "olcross;": '\U000029BB', + "oline;": '\U0000203E', + "olt;": '\U000029C0', + "omacr;": '\U0000014D', + "omega;": '\U000003C9', + "omicron;": '\U000003BF', + "omid;": '\U000029B6', + "ominus;": '\U00002296', + "oopf;": '\U0001D560', + "opar;": '\U000029B7', + "operp;": '\U000029B9', + "oplus;": '\U00002295', + "or;": '\U00002228', + "orarr;": '\U000021BB', + "ord;": '\U00002A5D', + "order;": '\U00002134', + "orderof;": '\U00002134', + "ordf;": '\U000000AA', + "ordm;": '\U000000BA', + "origof;": '\U000022B6', + "oror;": '\U00002A56', + "orslope;": '\U00002A57', + "orv;": '\U00002A5B', + "oscr;": '\U00002134', + "oslash;": '\U000000F8', + "osol;": '\U00002298', + "otilde;": '\U000000F5', + "otimes;": '\U00002297', + "otimesas;": '\U00002A36', + "ouml;": '\U000000F6', + "ovbar;": '\U0000233D', + "par;": '\U00002225', + "para;": '\U000000B6', + "parallel;": '\U00002225', + "parsim;": '\U00002AF3', + "parsl;": '\U00002AFD', + "part;": '\U00002202', + "pcy;": '\U0000043F', + "percnt;": '\U00000025', + "period;": '\U0000002E', + "permil;": '\U00002030', + "perp;": '\U000022A5', + "pertenk;": '\U00002031', + "pfr;": '\U0001D52D', + "phi;": '\U000003C6', + "phiv;": '\U000003D5', + "phmmat;": '\U00002133', + "phone;": '\U0000260E', + "pi;": '\U000003C0', + "pitchfork;": '\U000022D4', + "piv;": '\U000003D6', + "planck;": '\U0000210F', + "planckh;": '\U0000210E', + "plankv;": '\U0000210F', + "plus;": '\U0000002B', + "plusacir;": '\U00002A23', + "plusb;": '\U0000229E', + "pluscir;": '\U00002A22', + "plusdo;": '\U00002214', + "plusdu;": '\U00002A25', + "pluse;": '\U00002A72', + "plusmn;": '\U000000B1', + "plussim;": '\U00002A26', + "plustwo;": '\U00002A27', + "pm;": '\U000000B1', + "pointint;": '\U00002A15', + "popf;": '\U0001D561', + "pound;": '\U000000A3', + "pr;": '\U0000227A', + "prE;": '\U00002AB3', + "prap;": '\U00002AB7', + "prcue;": '\U0000227C', + "pre;": '\U00002AAF', + "prec;": '\U0000227A', + "precapprox;": '\U00002AB7', + "preccurlyeq;": '\U0000227C', + "preceq;": '\U00002AAF', + "precnapprox;": '\U00002AB9', + "precneqq;": '\U00002AB5', + "precnsim;": '\U000022E8', + "precsim;": '\U0000227E', + "prime;": '\U00002032', + "primes;": '\U00002119', + "prnE;": '\U00002AB5', + "prnap;": '\U00002AB9', + "prnsim;": '\U000022E8', + "prod;": '\U0000220F', + "profalar;": '\U0000232E', + "profline;": '\U00002312', + "profsurf;": '\U00002313', + "prop;": '\U0000221D', + "propto;": '\U0000221D', + "prsim;": '\U0000227E', + "prurel;": '\U000022B0', + "pscr;": '\U0001D4C5', + "psi;": '\U000003C8', + "puncsp;": '\U00002008', + "qfr;": '\U0001D52E', + "qint;": '\U00002A0C', + "qopf;": '\U0001D562', + "qprime;": '\U00002057', + "qscr;": '\U0001D4C6', + "quaternions;": '\U0000210D', + "quatint;": '\U00002A16', + "quest;": '\U0000003F', + "questeq;": '\U0000225F', + "quot;": '\U00000022', + "rAarr;": '\U000021DB', + "rArr;": '\U000021D2', + "rAtail;": '\U0000291C', + "rBarr;": '\U0000290F', + "rHar;": '\U00002964', + "racute;": '\U00000155', + "radic;": '\U0000221A', + "raemptyv;": '\U000029B3', + "rang;": '\U000027E9', + "rangd;": '\U00002992', + "range;": '\U000029A5', + "rangle;": '\U000027E9', + "raquo;": '\U000000BB', + "rarr;": '\U00002192', + "rarrap;": '\U00002975', + "rarrb;": '\U000021E5', + "rarrbfs;": '\U00002920', + "rarrc;": '\U00002933', + "rarrfs;": '\U0000291E', + "rarrhk;": '\U000021AA', + "rarrlp;": '\U000021AC', + "rarrpl;": '\U00002945', + "rarrsim;": '\U00002974', + "rarrtl;": '\U000021A3', + "rarrw;": '\U0000219D', + "ratail;": '\U0000291A', + "ratio;": '\U00002236', + "rationals;": '\U0000211A', + "rbarr;": '\U0000290D', + "rbbrk;": '\U00002773', + "rbrace;": '\U0000007D', + "rbrack;": '\U0000005D', + "rbrke;": '\U0000298C', + "rbrksld;": '\U0000298E', + "rbrkslu;": '\U00002990', + "rcaron;": '\U00000159', + "rcedil;": '\U00000157', + "rceil;": '\U00002309', + "rcub;": '\U0000007D', + "rcy;": '\U00000440', + "rdca;": '\U00002937', + "rdldhar;": '\U00002969', + "rdquo;": '\U0000201D', + "rdquor;": '\U0000201D', + "rdsh;": '\U000021B3', + "real;": '\U0000211C', + "realine;": '\U0000211B', + "realpart;": '\U0000211C', + "reals;": '\U0000211D', + "rect;": '\U000025AD', + "reg;": '\U000000AE', + "rfisht;": '\U0000297D', + "rfloor;": '\U0000230B', + "rfr;": '\U0001D52F', + "rhard;": '\U000021C1', + "rharu;": '\U000021C0', + "rharul;": '\U0000296C', + "rho;": '\U000003C1', + "rhov;": '\U000003F1', + "rightarrow;": '\U00002192', + "rightarrowtail;": '\U000021A3', + "rightharpoondown;": '\U000021C1', + "rightharpoonup;": '\U000021C0', + "rightleftarrows;": '\U000021C4', + "rightleftharpoons;": '\U000021CC', + "rightrightarrows;": '\U000021C9', + "rightsquigarrow;": '\U0000219D', + "rightthreetimes;": '\U000022CC', + "ring;": '\U000002DA', + "risingdotseq;": '\U00002253', + "rlarr;": '\U000021C4', + "rlhar;": '\U000021CC', + "rlm;": '\U0000200F', + "rmoust;": '\U000023B1', + "rmoustache;": '\U000023B1', + "rnmid;": '\U00002AEE', + "roang;": '\U000027ED', + "roarr;": '\U000021FE', + "robrk;": '\U000027E7', + "ropar;": '\U00002986', + "ropf;": '\U0001D563', + "roplus;": '\U00002A2E', + "rotimes;": '\U00002A35', + "rpar;": '\U00000029', + "rpargt;": '\U00002994', + "rppolint;": '\U00002A12', + "rrarr;": '\U000021C9', + "rsaquo;": '\U0000203A', + "rscr;": '\U0001D4C7', + "rsh;": '\U000021B1', + "rsqb;": '\U0000005D', + "rsquo;": '\U00002019', + "rsquor;": '\U00002019', + "rthree;": '\U000022CC', + "rtimes;": '\U000022CA', + "rtri;": '\U000025B9', + "rtrie;": '\U000022B5', + "rtrif;": '\U000025B8', + "rtriltri;": '\U000029CE', + "ruluhar;": '\U00002968', + "rx;": '\U0000211E', + "sacute;": '\U0000015B', + "sbquo;": '\U0000201A', + "sc;": '\U0000227B', + "scE;": '\U00002AB4', + "scap;": '\U00002AB8', + "scaron;": '\U00000161', + "sccue;": '\U0000227D', + "sce;": '\U00002AB0', + "scedil;": '\U0000015F', + "scirc;": '\U0000015D', + "scnE;": '\U00002AB6', + "scnap;": '\U00002ABA', + "scnsim;": '\U000022E9', + "scpolint;": '\U00002A13', + "scsim;": '\U0000227F', + "scy;": '\U00000441', + "sdot;": '\U000022C5', + "sdotb;": '\U000022A1', + "sdote;": '\U00002A66', + "seArr;": '\U000021D8', + "searhk;": '\U00002925', + "searr;": '\U00002198', + "searrow;": '\U00002198', + "sect;": '\U000000A7', + "semi;": '\U0000003B', + "seswar;": '\U00002929', + "setminus;": '\U00002216', + "setmn;": '\U00002216', + "sext;": '\U00002736', + "sfr;": '\U0001D530', + "sfrown;": '\U00002322', + "sharp;": '\U0000266F', + "shchcy;": '\U00000449', + "shcy;": '\U00000448', + "shortmid;": '\U00002223', + "shortparallel;": '\U00002225', + "shy;": '\U000000AD', + "sigma;": '\U000003C3', + "sigmaf;": '\U000003C2', + "sigmav;": '\U000003C2', + "sim;": '\U0000223C', + "simdot;": '\U00002A6A', + "sime;": '\U00002243', + "simeq;": '\U00002243', + "simg;": '\U00002A9E', + "simgE;": '\U00002AA0', + "siml;": '\U00002A9D', + "simlE;": '\U00002A9F', + "simne;": '\U00002246', + "simplus;": '\U00002A24', + "simrarr;": '\U00002972', + "slarr;": '\U00002190', + "smallsetminus;": '\U00002216', + "smashp;": '\U00002A33', + "smeparsl;": '\U000029E4', + "smid;": '\U00002223', + "smile;": '\U00002323', + "smt;": '\U00002AAA', + "smte;": '\U00002AAC', + "softcy;": '\U0000044C', + "sol;": '\U0000002F', + "solb;": '\U000029C4', + "solbar;": '\U0000233F', + "sopf;": '\U0001D564', + "spades;": '\U00002660', + "spadesuit;": '\U00002660', + "spar;": '\U00002225', + "sqcap;": '\U00002293', + "sqcup;": '\U00002294', + "sqsub;": '\U0000228F', + "sqsube;": '\U00002291', + "sqsubset;": '\U0000228F', + "sqsubseteq;": '\U00002291', + "sqsup;": '\U00002290', + "sqsupe;": '\U00002292', + "sqsupset;": '\U00002290', + "sqsupseteq;": '\U00002292', + "squ;": '\U000025A1', + "square;": '\U000025A1', + "squarf;": '\U000025AA', + "squf;": '\U000025AA', + "srarr;": '\U00002192', + "sscr;": '\U0001D4C8', + "ssetmn;": '\U00002216', + "ssmile;": '\U00002323', + "sstarf;": '\U000022C6', + "star;": '\U00002606', + "starf;": '\U00002605', + "straightepsilon;": '\U000003F5', + "straightphi;": '\U000003D5', + "strns;": '\U000000AF', + "sub;": '\U00002282', + "subE;": '\U00002AC5', + "subdot;": '\U00002ABD', + "sube;": '\U00002286', + "subedot;": '\U00002AC3', + "submult;": '\U00002AC1', + "subnE;": '\U00002ACB', + "subne;": '\U0000228A', + "subplus;": '\U00002ABF', + "subrarr;": '\U00002979', + "subset;": '\U00002282', + "subseteq;": '\U00002286', + "subseteqq;": '\U00002AC5', + "subsetneq;": '\U0000228A', + "subsetneqq;": '\U00002ACB', + "subsim;": '\U00002AC7', + "subsub;": '\U00002AD5', + "subsup;": '\U00002AD3', + "succ;": '\U0000227B', + "succapprox;": '\U00002AB8', + "succcurlyeq;": '\U0000227D', + "succeq;": '\U00002AB0', + "succnapprox;": '\U00002ABA', + "succneqq;": '\U00002AB6', + "succnsim;": '\U000022E9', + "succsim;": '\U0000227F', + "sum;": '\U00002211', + "sung;": '\U0000266A', + "sup;": '\U00002283', + "sup1;": '\U000000B9', + "sup2;": '\U000000B2', + "sup3;": '\U000000B3', + "supE;": '\U00002AC6', + "supdot;": '\U00002ABE', + "supdsub;": '\U00002AD8', + "supe;": '\U00002287', + "supedot;": '\U00002AC4', + "suphsol;": '\U000027C9', + "suphsub;": '\U00002AD7', + "suplarr;": '\U0000297B', + "supmult;": '\U00002AC2', + "supnE;": '\U00002ACC', + "supne;": '\U0000228B', + "supplus;": '\U00002AC0', + "supset;": '\U00002283', + "supseteq;": '\U00002287', + "supseteqq;": '\U00002AC6', + "supsetneq;": '\U0000228B', + "supsetneqq;": '\U00002ACC', + "supsim;": '\U00002AC8', + "supsub;": '\U00002AD4', + "supsup;": '\U00002AD6', + "swArr;": '\U000021D9', + "swarhk;": '\U00002926', + "swarr;": '\U00002199', + "swarrow;": '\U00002199', + "swnwar;": '\U0000292A', + "szlig;": '\U000000DF', + "target;": '\U00002316', + "tau;": '\U000003C4', + "tbrk;": '\U000023B4', + "tcaron;": '\U00000165', + "tcedil;": '\U00000163', + "tcy;": '\U00000442', + "tdot;": '\U000020DB', + "telrec;": '\U00002315', + "tfr;": '\U0001D531', + "there4;": '\U00002234', + "therefore;": '\U00002234', + "theta;": '\U000003B8', + "thetasym;": '\U000003D1', + "thetav;": '\U000003D1', + "thickapprox;": '\U00002248', + "thicksim;": '\U0000223C', + "thinsp;": '\U00002009', + "thkap;": '\U00002248', + "thksim;": '\U0000223C', + "thorn;": '\U000000FE', + "tilde;": '\U000002DC', + "times;": '\U000000D7', + "timesb;": '\U000022A0', + "timesbar;": '\U00002A31', + "timesd;": '\U00002A30', + "tint;": '\U0000222D', + "toea;": '\U00002928', + "top;": '\U000022A4', + "topbot;": '\U00002336', + "topcir;": '\U00002AF1', + "topf;": '\U0001D565', + "topfork;": '\U00002ADA', + "tosa;": '\U00002929', + "tprime;": '\U00002034', + "trade;": '\U00002122', + "triangle;": '\U000025B5', + "triangledown;": '\U000025BF', + "triangleleft;": '\U000025C3', + "trianglelefteq;": '\U000022B4', + "triangleq;": '\U0000225C', + "triangleright;": '\U000025B9', + "trianglerighteq;": '\U000022B5', + "tridot;": '\U000025EC', + "trie;": '\U0000225C', + "triminus;": '\U00002A3A', + "triplus;": '\U00002A39', + "trisb;": '\U000029CD', + "tritime;": '\U00002A3B', + "trpezium;": '\U000023E2', + "tscr;": '\U0001D4C9', + "tscy;": '\U00000446', + "tshcy;": '\U0000045B', + "tstrok;": '\U00000167', + "twixt;": '\U0000226C', + "twoheadleftarrow;": '\U0000219E', + "twoheadrightarrow;": '\U000021A0', + "uArr;": '\U000021D1', + "uHar;": '\U00002963', + "uacute;": '\U000000FA', + "uarr;": '\U00002191', + "ubrcy;": '\U0000045E', + "ubreve;": '\U0000016D', + "ucirc;": '\U000000FB', + "ucy;": '\U00000443', + "udarr;": '\U000021C5', + "udblac;": '\U00000171', + "udhar;": '\U0000296E', + "ufisht;": '\U0000297E', + "ufr;": '\U0001D532', + "ugrave;": '\U000000F9', + "uharl;": '\U000021BF', + "uharr;": '\U000021BE', + "uhblk;": '\U00002580', + "ulcorn;": '\U0000231C', + "ulcorner;": '\U0000231C', + "ulcrop;": '\U0000230F', + "ultri;": '\U000025F8', + "umacr;": '\U0000016B', + "uml;": '\U000000A8', + "uogon;": '\U00000173', + "uopf;": '\U0001D566', + "uparrow;": '\U00002191', + "updownarrow;": '\U00002195', + "upharpoonleft;": '\U000021BF', + "upharpoonright;": '\U000021BE', + "uplus;": '\U0000228E', + "upsi;": '\U000003C5', + "upsih;": '\U000003D2', + "upsilon;": '\U000003C5', + "upuparrows;": '\U000021C8', + "urcorn;": '\U0000231D', + "urcorner;": '\U0000231D', + "urcrop;": '\U0000230E', + "uring;": '\U0000016F', + "urtri;": '\U000025F9', + "uscr;": '\U0001D4CA', + "utdot;": '\U000022F0', + "utilde;": '\U00000169', + "utri;": '\U000025B5', + "utrif;": '\U000025B4', + "uuarr;": '\U000021C8', + "uuml;": '\U000000FC', + "uwangle;": '\U000029A7', + "vArr;": '\U000021D5', + "vBar;": '\U00002AE8', + "vBarv;": '\U00002AE9', + "vDash;": '\U000022A8', + "vangrt;": '\U0000299C', + "varepsilon;": '\U000003F5', + "varkappa;": '\U000003F0', + "varnothing;": '\U00002205', + "varphi;": '\U000003D5', + "varpi;": '\U000003D6', + "varpropto;": '\U0000221D', + "varr;": '\U00002195', + "varrho;": '\U000003F1', + "varsigma;": '\U000003C2', + "vartheta;": '\U000003D1', + "vartriangleleft;": '\U000022B2', + "vartriangleright;": '\U000022B3', + "vcy;": '\U00000432', + "vdash;": '\U000022A2', + "vee;": '\U00002228', + "veebar;": '\U000022BB', + "veeeq;": '\U0000225A', + "vellip;": '\U000022EE', + "verbar;": '\U0000007C', + "vert;": '\U0000007C', + "vfr;": '\U0001D533', + "vltri;": '\U000022B2', + "vopf;": '\U0001D567', + "vprop;": '\U0000221D', + "vrtri;": '\U000022B3', + "vscr;": '\U0001D4CB', + "vzigzag;": '\U0000299A', + "wcirc;": '\U00000175', + "wedbar;": '\U00002A5F', + "wedge;": '\U00002227', + "wedgeq;": '\U00002259', + "weierp;": '\U00002118', + "wfr;": '\U0001D534', + "wopf;": '\U0001D568', + "wp;": '\U00002118', + "wr;": '\U00002240', + "wreath;": '\U00002240', + "wscr;": '\U0001D4CC', + "xcap;": '\U000022C2', + "xcirc;": '\U000025EF', + "xcup;": '\U000022C3', + "xdtri;": '\U000025BD', + "xfr;": '\U0001D535', + "xhArr;": '\U000027FA', + "xharr;": '\U000027F7', + "xi;": '\U000003BE', + "xlArr;": '\U000027F8', + "xlarr;": '\U000027F5', + "xmap;": '\U000027FC', + "xnis;": '\U000022FB', + "xodot;": '\U00002A00', + "xopf;": '\U0001D569', + "xoplus;": '\U00002A01', + "xotime;": '\U00002A02', + "xrArr;": '\U000027F9', + "xrarr;": '\U000027F6', + "xscr;": '\U0001D4CD', + "xsqcup;": '\U00002A06', + "xuplus;": '\U00002A04', + "xutri;": '\U000025B3', + "xvee;": '\U000022C1', + "xwedge;": '\U000022C0', + "yacute;": '\U000000FD', + "yacy;": '\U0000044F', + "ycirc;": '\U00000177', + "ycy;": '\U0000044B', + "yen;": '\U000000A5', + "yfr;": '\U0001D536', + "yicy;": '\U00000457', + "yopf;": '\U0001D56A', + "yscr;": '\U0001D4CE', + "yucy;": '\U0000044E', + "yuml;": '\U000000FF', + "zacute;": '\U0000017A', + "zcaron;": '\U0000017E', + "zcy;": '\U00000437', + "zdot;": '\U0000017C', + "zeetrf;": '\U00002128', + "zeta;": '\U000003B6', + "zfr;": '\U0001D537', + "zhcy;": '\U00000436', + "zigrarr;": '\U000021DD', + "zopf;": '\U0001D56B', + "zscr;": '\U0001D4CF', + "zwj;": '\U0000200D', + "zwnj;": '\U0000200C', + "AElig": '\U000000C6', + "AMP": '\U00000026', + "Aacute": '\U000000C1', + "Acirc": '\U000000C2', + "Agrave": '\U000000C0', + "Aring": '\U000000C5', + "Atilde": '\U000000C3', + "Auml": '\U000000C4', + "COPY": '\U000000A9', + "Ccedil": '\U000000C7', + "ETH": '\U000000D0', + "Eacute": '\U000000C9', + "Ecirc": '\U000000CA', + "Egrave": '\U000000C8', + "Euml": '\U000000CB', + "GT": '\U0000003E', + "Iacute": '\U000000CD', + "Icirc": '\U000000CE', + "Igrave": '\U000000CC', + "Iuml": '\U000000CF', + "LT": '\U0000003C', + "Ntilde": '\U000000D1', + "Oacute": '\U000000D3', + "Ocirc": '\U000000D4', + "Ograve": '\U000000D2', + "Oslash": '\U000000D8', + "Otilde": '\U000000D5', + "Ouml": '\U000000D6', + "QUOT": '\U00000022', + "REG": '\U000000AE', + "THORN": '\U000000DE', + "Uacute": '\U000000DA', + "Ucirc": '\U000000DB', + "Ugrave": '\U000000D9', + "Uuml": '\U000000DC', + "Yacute": '\U000000DD', + "aacute": '\U000000E1', + "acirc": '\U000000E2', + "acute": '\U000000B4', + "aelig": '\U000000E6', + "agrave": '\U000000E0', + "amp": '\U00000026', + "aring": '\U000000E5', + "atilde": '\U000000E3', + "auml": '\U000000E4', + "brvbar": '\U000000A6', + "ccedil": '\U000000E7', + "cedil": '\U000000B8', + "cent": '\U000000A2', + "copy": '\U000000A9', + "curren": '\U000000A4', + "deg": '\U000000B0', + "divide": '\U000000F7', + "eacute": '\U000000E9', + "ecirc": '\U000000EA', + "egrave": '\U000000E8', + "eth": '\U000000F0', + "euml": '\U000000EB', + "frac12": '\U000000BD', + "frac14": '\U000000BC', + "frac34": '\U000000BE', + "gt": '\U0000003E', + "iacute": '\U000000ED', + "icirc": '\U000000EE', + "iexcl": '\U000000A1', + "igrave": '\U000000EC', + "iquest": '\U000000BF', + "iuml": '\U000000EF', + "laquo": '\U000000AB', + "lt": '\U0000003C', + "macr": '\U000000AF', + "micro": '\U000000B5', + "middot": '\U000000B7', + "nbsp": '\U000000A0', + "not": '\U000000AC', + "ntilde": '\U000000F1', + "oacute": '\U000000F3', + "ocirc": '\U000000F4', + "ograve": '\U000000F2', + "ordf": '\U000000AA', + "ordm": '\U000000BA', + "oslash": '\U000000F8', + "otilde": '\U000000F5', + "ouml": '\U000000F6', + "para": '\U000000B6', + "plusmn": '\U000000B1', + "pound": '\U000000A3', + "quot": '\U00000022', + "raquo": '\U000000BB', + "reg": '\U000000AE', + "sect": '\U000000A7', + "shy": '\U000000AD', + "sup1": '\U000000B9', + "sup2": '\U000000B2', + "sup3": '\U000000B3', + "szlig": '\U000000DF', + "thorn": '\U000000FE', + "times": '\U000000D7', + "uacute": '\U000000FA', + "ucirc": '\U000000FB', + "ugrave": '\U000000F9', + "uml": '\U000000A8', + "uuml": '\U000000FC', + "yacute": '\U000000FD', + "yen": '\U000000A5', + "yuml": '\U000000FF', } // HTML entities that are two unicode codepoints. diff --git a/vendor/golang.org/x/net/html/foreign.go b/vendor/golang.org/x/net/html/foreign.go index d3b3844099bf1..01477a96397c9 100644 --- a/vendor/golang.org/x/net/html/foreign.go +++ b/vendor/golang.org/x/net/html/foreign.go @@ -67,7 +67,7 @@ func mathMLTextIntegrationPoint(n *Node) bool { return false } -// Section 12.2.5.5. +// Section 12.2.6.5. var breakout = map[string]bool{ "b": true, "big": true, @@ -115,7 +115,7 @@ var breakout = map[string]bool{ "var": true, } -// Section 12.2.5.5. +// Section 12.2.6.5. var svgTagNameAdjustments = map[string]string{ "altglyph": "altGlyph", "altglyphdef": "altGlyphDef", @@ -155,7 +155,7 @@ var svgTagNameAdjustments = map[string]string{ "textpath": "textPath", } -// Section 12.2.5.1 +// Section 12.2.6.1 var mathMLAttributeAdjustments = map[string]string{ "definitionurl": "definitionURL", } diff --git a/vendor/golang.org/x/net/html/node.go b/vendor/golang.org/x/net/html/node.go index 26b657aec83b5..633ee15dc55b5 100644 --- a/vendor/golang.org/x/net/html/node.go +++ b/vendor/golang.org/x/net/html/node.go @@ -21,9 +21,10 @@ const ( scopeMarkerNode ) -// Section 12.2.3.3 says "scope markers are inserted when entering applet -// elements, buttons, object elements, marquees, table cells, and table -// captions, and are used to prevent formatting from 'leaking'". +// Section 12.2.4.3 says "The markers are inserted when entering applet, +// object, marquee, template, td, th, and caption elements, and are used +// to prevent formatting from "leaking" into applet, object, marquee, +// template, td, th, and caption elements". var scopeMarker = Node{Type: scopeMarkerNode} // A Node consists of a NodeType and some Data (tag name for element nodes, @@ -173,6 +174,16 @@ func (s *nodeStack) index(n *Node) int { return -1 } +// contains returns whether a is within s. +func (s *nodeStack) contains(a atom.Atom) bool { + for _, n := range *s { + if n.DataAtom == a && n.Namespace == "" { + return true + } + } + return false +} + // insert inserts a node at the given index. func (s *nodeStack) insert(i int, n *Node) { (*s) = append(*s, nil) @@ -191,3 +202,19 @@ func (s *nodeStack) remove(n *Node) { (*s)[j] = nil *s = (*s)[:j] } + +type insertionModeStack []insertionMode + +func (s *insertionModeStack) pop() (im insertionMode) { + i := len(*s) + im = (*s)[i-1] + *s = (*s)[:i-1] + return im +} + +func (s *insertionModeStack) top() insertionMode { + if i := len(*s); i > 0 { + return (*s)[i-1] + } + return nil +} diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go index be4b2bf5aa9e0..1d3c198ae7d26 100644 --- a/vendor/golang.org/x/net/html/parse.go +++ b/vendor/golang.org/x/net/html/parse.go @@ -25,20 +25,22 @@ type parser struct { hasSelfClosingToken bool // doc is the document root element. doc *Node - // The stack of open elements (section 12.2.3.2) and active formatting - // elements (section 12.2.3.3). + // The stack of open elements (section 12.2.4.2) and active formatting + // elements (section 12.2.4.3). oe, afe nodeStack - // Element pointers (section 12.2.3.4). + // Element pointers (section 12.2.4.4). head, form *Node - // Other parsing state flags (section 12.2.3.5). + // Other parsing state flags (section 12.2.4.5). scripting, framesetOK bool + // The stack of template insertion modes + templateStack insertionModeStack // im is the current insertion mode. im insertionMode // originalIM is the insertion mode to go back to after completing a text // or inTableText insertion mode. originalIM insertionMode // fosterParenting is whether new elements should be inserted according to - // the foster parenting rules (section 12.2.5.3). + // the foster parenting rules (section 12.2.6.1). fosterParenting bool // quirks is whether the parser is operating in "quirks mode." quirks bool @@ -56,7 +58,7 @@ func (p *parser) top() *Node { return p.doc } -// Stop tags for use in popUntil. These come from section 12.2.3.2. +// Stop tags for use in popUntil. These come from section 12.2.4.2. var ( defaultScopeStopTags = map[string][]a.Atom{ "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template}, @@ -79,7 +81,7 @@ const ( // popUntil pops the stack of open elements at the highest element whose tag // is in matchTags, provided there is no higher element in the scope's stop -// tags (as defined in section 12.2.3.2). It returns whether or not there was +// tags (as defined in section 12.2.4.2). It returns whether or not there was // such an element. If there was not, popUntil leaves the stack unchanged. // // For example, the set of stop tags for table scope is: "html", "table". If @@ -126,7 +128,7 @@ func (p *parser) indexOfElementInScope(s scope, matchTags ...a.Atom) int { return -1 } case tableScope: - if tagAtom == a.Html || tagAtom == a.Table { + if tagAtom == a.Html || tagAtom == a.Table || tagAtom == a.Template { return -1 } case selectScope: @@ -162,17 +164,17 @@ func (p *parser) clearStackToContext(s scope) { tagAtom := p.oe[i].DataAtom switch s { case tableScope: - if tagAtom == a.Html || tagAtom == a.Table { + if tagAtom == a.Html || tagAtom == a.Table || tagAtom == a.Template { p.oe = p.oe[:i+1] return } case tableRowScope: - if tagAtom == a.Html || tagAtom == a.Tr { + if tagAtom == a.Html || tagAtom == a.Tr || tagAtom == a.Template { p.oe = p.oe[:i+1] return } case tableBodyScope: - if tagAtom == a.Html || tagAtom == a.Tbody || tagAtom == a.Tfoot || tagAtom == a.Thead { + if tagAtom == a.Html || tagAtom == a.Tbody || tagAtom == a.Tfoot || tagAtom == a.Thead || tagAtom == a.Template { p.oe = p.oe[:i+1] return } @@ -183,7 +185,7 @@ func (p *parser) clearStackToContext(s scope) { } // generateImpliedEndTags pops nodes off the stack of open elements as long as -// the top node has a tag name of dd, dt, li, option, optgroup, p, rp, or rt. +// the top node has a tag name of dd, dt, li, optgroup, option, p, rb, rp, rt or rtc. // If exceptions are specified, nodes with that name will not be popped off. func (p *parser) generateImpliedEndTags(exceptions ...string) { var i int @@ -192,7 +194,7 @@ loop: n := p.oe[i] if n.Type == ElementNode { switch n.DataAtom { - case a.Dd, a.Dt, a.Li, a.Option, a.Optgroup, a.P, a.Rp, a.Rt: + case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc: for _, except := range exceptions { if n.Data == except { break loop @@ -234,9 +236,9 @@ func (p *parser) shouldFosterParent() bool { } // fosterParent adds a child node according to the foster parenting rules. -// Section 12.2.5.3, "foster parenting". +// Section 12.2.6.1, "foster parenting". func (p *parser) fosterParent(n *Node) { - var table, parent, prev *Node + var table, parent, prev, template *Node var i int for i = len(p.oe) - 1; i >= 0; i-- { if p.oe[i].DataAtom == a.Table { @@ -245,6 +247,19 @@ func (p *parser) fosterParent(n *Node) { } } + var j int + for j = len(p.oe) - 1; j >= 0; j-- { + if p.oe[j].DataAtom == a.Template { + template = p.oe[j] + break + } + } + + if template != nil && (table == nil || j > i) { + template.AppendChild(n) + return + } + if table == nil { // The foster parent is the html element. parent = p.oe[0] @@ -304,7 +319,7 @@ func (p *parser) addElement() { }) } -// Section 12.2.3.3. +// Section 12.2.4.3. func (p *parser) addFormattingElement() { tagAtom, attr := p.tok.DataAtom, p.tok.Attr p.addElement() @@ -351,7 +366,7 @@ findIdenticalElements: p.afe = append(p.afe, p.top()) } -// Section 12.2.3.3. +// Section 12.2.4.3. func (p *parser) clearActiveFormattingElements() { for { n := p.afe.pop() @@ -361,7 +376,7 @@ func (p *parser) clearActiveFormattingElements() { } } -// Section 12.2.3.3. +// Section 12.2.4.3. func (p *parser) reconstructActiveFormattingElements() { n := p.afe.top() if n == nil { @@ -390,12 +405,12 @@ func (p *parser) reconstructActiveFormattingElements() { } } -// Section 12.2.4. +// Section 12.2.5. func (p *parser) acknowledgeSelfClosingTag() { p.hasSelfClosingToken = false } -// An insertion mode (section 12.2.3.1) is the state transition function from +// An insertion mode (section 12.2.4.1) is the state transition function from // a particular state in the HTML5 parser's state machine. It updates the // parser's fields depending on parser.tok (where ErrorToken means EOF). // It returns whether the token was consumed. @@ -403,7 +418,7 @@ type insertionMode func(*parser) bool // setOriginalIM sets the insertion mode to return to after completing a text or // inTableText insertion mode. -// Section 12.2.3.1, "using the rules for". +// Section 12.2.4.1, "using the rules for". func (p *parser) setOriginalIM() { if p.originalIM != nil { panic("html: bad parser state: originalIM was set twice") @@ -411,18 +426,35 @@ func (p *parser) setOriginalIM() { p.originalIM = p.im } -// Section 12.2.3.1, "reset the insertion mode". +// Section 12.2.4.1, "reset the insertion mode". func (p *parser) resetInsertionMode() { for i := len(p.oe) - 1; i >= 0; i-- { n := p.oe[i] - if i == 0 && p.context != nil { + last := i == 0 + if last && p.context != nil { n = p.context } switch n.DataAtom { case a.Select: + if !last { + for ancestor, first := n, p.oe[0]; ancestor != first; { + ancestor = p.oe[p.oe.index(ancestor)-1] + switch ancestor.DataAtom { + case a.Template: + p.im = inSelectIM + return + case a.Table: + p.im = inSelectInTableIM + return + } + } + } p.im = inSelectIM case a.Td, a.Th: + // TODO: remove this divergence from the HTML5 spec. + // + // See https://bugs.chromium.org/p/chromium/issues/detail?id=829668 p.im = inCellIM case a.Tr: p.im = inRowIM @@ -434,25 +466,41 @@ func (p *parser) resetInsertionMode() { p.im = inColumnGroupIM case a.Table: p.im = inTableIM + case a.Template: + // TODO: remove this divergence from the HTML5 spec. + if n.Namespace != "" { + continue + } + p.im = p.templateStack.top() case a.Head: - p.im = inBodyIM + // TODO: remove this divergence from the HTML5 spec. + // + // See https://bugs.chromium.org/p/chromium/issues/detail?id=829668 + p.im = inHeadIM case a.Body: p.im = inBodyIM case a.Frameset: p.im = inFramesetIM case a.Html: - p.im = beforeHeadIM + if p.head == nil { + p.im = beforeHeadIM + } else { + p.im = afterHeadIM + } default: + if last { + p.im = inBodyIM + return + } continue } return } - p.im = inBodyIM } const whitespace = " \t\r\n\f" -// Section 12.2.5.4.1. +// Section 12.2.6.4.1. func initialIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -479,7 +527,7 @@ func initialIM(p *parser) bool { return false } -// Section 12.2.5.4.2. +// Section 12.2.6.4.2. func beforeHTMLIM(p *parser) bool { switch p.tok.Type { case DoctypeToken: @@ -517,7 +565,7 @@ func beforeHTMLIM(p *parser) bool { return false } -// Section 12.2.5.4.3. +// Section 12.2.6.4.3. func beforeHeadIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -560,7 +608,7 @@ func beforeHeadIM(p *parser) bool { return false } -// Section 12.2.5.4.4. +// Section 12.2.6.4.4. func inHeadIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -590,19 +638,41 @@ func inHeadIM(p *parser) bool { case a.Head: // Ignore the token. return true + case a.Template: + p.addElement() + p.afe = append(p.afe, &scopeMarker) + p.framesetOK = false + p.im = inTemplateIM + p.templateStack = append(p.templateStack, inTemplateIM) + return true } case EndTagToken: switch p.tok.DataAtom { case a.Head: - n := p.oe.pop() - if n.DataAtom != a.Head { - panic("html: bad parser state: element not found, in the in-head insertion mode") - } + p.oe.pop() p.im = afterHeadIM return true case a.Body, a.Html, a.Br: p.parseImpliedToken(EndTagToken, a.Head, a.Head.String()) return false + case a.Template: + if !p.oe.contains(a.Template) { + return true + } + // TODO: remove this divergence from the HTML5 spec. + // + // See https://bugs.chromium.org/p/chromium/issues/detail?id=829668 + p.generateImpliedEndTags() + for i := len(p.oe) - 1; i >= 0; i-- { + if n := p.oe[i]; n.Namespace == "" && n.DataAtom == a.Template { + p.oe = p.oe[:i] + break + } + } + p.clearActiveFormattingElements() + p.templateStack.pop() + p.resetInsertionMode() + return true default: // Ignore the token. return true @@ -622,7 +692,7 @@ func inHeadIM(p *parser) bool { return false } -// Section 12.2.5.4.6. +// Section 12.2.6.4.6. func afterHeadIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -648,7 +718,7 @@ func afterHeadIM(p *parser) bool { p.addElement() p.im = inFramesetIM return true - case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Title: + case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title: p.oe = append(p.oe, p.head) defer p.oe.remove(p.head) return inHeadIM(p) @@ -660,6 +730,8 @@ func afterHeadIM(p *parser) bool { switch p.tok.DataAtom { case a.Body, a.Html, a.Br: // Drop down to creating an implied tag. + case a.Template: + return inHeadIM(p) default: // Ignore the token. return true @@ -697,7 +769,7 @@ func copyAttributes(dst *Node, src Token) { } } -// Section 12.2.5.4.7. +// Section 12.2.6.4.7. func inBodyIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -727,10 +799,16 @@ func inBodyIM(p *parser) bool { case StartTagToken: switch p.tok.DataAtom { case a.Html: + if p.oe.contains(a.Template) { + return true + } copyAttributes(p.oe[0], p.tok) - case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Title: + case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title: return inHeadIM(p) case a.Body: + if p.oe.contains(a.Template) { + return true + } if len(p.oe) >= 2 { body := p.oe[1] if body.Type == ElementNode && body.DataAtom == a.Body { @@ -767,9 +845,13 @@ func inBodyIM(p *parser) bool { // The newline, if any, will be dealt with by the TextToken case. p.framesetOK = false case a.Form: - if p.form == nil { - p.popUntil(buttonScope, a.P) - p.addElement() + if p.form != nil && !p.oe.contains(a.Template) { + // Ignore the token + return true + } + p.popUntil(buttonScope, a.P) + p.addElement() + if !p.oe.contains(a.Template) { p.form = p.top() } case a.Li: @@ -819,7 +901,7 @@ func inBodyIM(p *parser) bool { case a.A: for i := len(p.afe) - 1; i >= 0 && p.afe[i].Type != scopeMarkerNode; i-- { if n := p.afe[i]; n.Type == ElementNode && n.DataAtom == a.A { - p.inBodyEndTagFormatting(a.A) + p.inBodyEndTagFormatting(a.A, "a") p.oe.remove(n) p.afe.remove(n) break @@ -833,7 +915,7 @@ func inBodyIM(p *parser) bool { case a.Nobr: p.reconstructActiveFormattingElements() if p.elementInScope(defaultScope, a.Nobr) { - p.inBodyEndTagFormatting(a.Nobr) + p.inBodyEndTagFormatting(a.Nobr, "nobr") p.reconstructActiveFormattingElements() } p.addFormattingElement() @@ -903,6 +985,14 @@ func inBodyIM(p *parser) bool { p.acknowledgeSelfClosingTag() p.popUntil(buttonScope, a.P) p.parseImpliedToken(StartTagToken, a.Form, a.Form.String()) + if p.form == nil { + // NOTE: The 'isindex' element has been removed, + // and the 'template' element has not been designed to be + // collaborative with the index element. + // + // Ignore the token. + return true + } if action != "" { p.form.Attr = []Attribute{{Key: "action", Val: action}} } @@ -952,11 +1042,16 @@ func inBodyIM(p *parser) bool { } p.reconstructActiveFormattingElements() p.addElement() - case a.Rp, a.Rt: + case a.Rb, a.Rtc: if p.elementInScope(defaultScope, a.Ruby) { p.generateImpliedEndTags() } p.addElement() + case a.Rp, a.Rt: + if p.elementInScope(defaultScope, a.Ruby) { + p.generateImpliedEndTags("rtc") + } + p.addElement() case a.Math, a.Svg: p.reconstructActiveFormattingElements() if p.tok.DataAtom == a.Math { @@ -993,15 +1088,29 @@ func inBodyIM(p *parser) bool { case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul: p.popUntil(defaultScope, p.tok.DataAtom) case a.Form: - node := p.form - p.form = nil - i := p.indexOfElementInScope(defaultScope, a.Form) - if node == nil || i == -1 || p.oe[i] != node { - // Ignore the token. - return true + if p.oe.contains(a.Template) { + i := p.indexOfElementInScope(defaultScope, a.Form) + if i == -1 { + // Ignore the token. + return true + } + p.generateImpliedEndTags() + if p.oe[i].DataAtom != a.Form { + // Ignore the token. + return true + } + p.popUntil(defaultScope, a.Form) + } else { + node := p.form + p.form = nil + i := p.indexOfElementInScope(defaultScope, a.Form) + if node == nil || i == -1 || p.oe[i] != node { + // Ignore the token. + return true + } + p.generateImpliedEndTags() + p.oe.remove(node) } - p.generateImpliedEndTags() - p.oe.remove(node) case a.P: if !p.elementInScope(buttonScope, a.P) { p.parseImpliedToken(StartTagToken, a.P, a.P.String()) @@ -1014,7 +1123,7 @@ func inBodyIM(p *parser) bool { case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6: p.popUntil(defaultScope, a.H1, a.H2, a.H3, a.H4, a.H5, a.H6) case a.A, a.B, a.Big, a.Code, a.Em, a.Font, a.I, a.Nobr, a.S, a.Small, a.Strike, a.Strong, a.Tt, a.U: - p.inBodyEndTagFormatting(p.tok.DataAtom) + p.inBodyEndTagFormatting(p.tok.DataAtom, p.tok.Data) case a.Applet, a.Marquee, a.Object: if p.popUntil(defaultScope, p.tok.DataAtom) { p.clearActiveFormattingElements() @@ -1022,20 +1131,37 @@ func inBodyIM(p *parser) bool { case a.Br: p.tok.Type = StartTagToken return false + case a.Template: + return inHeadIM(p) default: - p.inBodyEndTagOther(p.tok.DataAtom) + p.inBodyEndTagOther(p.tok.DataAtom, p.tok.Data) } case CommentToken: p.addChild(&Node{ Type: CommentNode, Data: p.tok.Data, }) + case ErrorToken: + // TODO: remove this divergence from the HTML5 spec. + if len(p.templateStack) > 0 { + p.im = inTemplateIM + return false + } else { + for _, e := range p.oe { + switch e.DataAtom { + case a.Dd, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb, a.Rp, a.Rt, a.Rtc, a.Tbody, a.Td, a.Tfoot, a.Th, + a.Thead, a.Tr, a.Body, a.Html: + default: + return true + } + } + } } return true } -func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) { +func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { // This is the "adoption agency" algorithm, described at // https://html.spec.whatwg.org/multipage/syntax.html#adoptionAgency @@ -1057,7 +1183,7 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) { } } if formattingElement == nil { - p.inBodyEndTagOther(tagAtom) + p.inBodyEndTagOther(tagAtom, tagName) return } feIndex := p.oe.index(formattingElement) @@ -1160,11 +1286,19 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) { } // inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM. -// "Any other end tag" handling from 12.2.5.5 The rules for parsing tokens in foreign content +// "Any other end tag" handling from 12.2.6.5 The rules for parsing tokens in foreign content // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inforeign -func (p *parser) inBodyEndTagOther(tagAtom a.Atom) { +func (p *parser) inBodyEndTagOther(tagAtom a.Atom, tagName string) { for i := len(p.oe) - 1; i >= 0; i-- { - if p.oe[i].DataAtom == tagAtom { + // Two element nodes have the same tag if they have the same Data (a + // string-typed field). As an optimization, for common HTML tags, each + // Data string is assigned a unique, non-zero DataAtom (a uint32-typed + // field), since integer comparison is faster than string comparison. + // Uncommon (custom) tags get a zero DataAtom. + // + // The if condition here is equivalent to (p.oe[i].Data == tagName). + if (p.oe[i].DataAtom == tagAtom) && + ((tagAtom != 0) || (p.oe[i].Data == tagName)) { p.oe = p.oe[:i] break } @@ -1174,7 +1308,7 @@ func (p *parser) inBodyEndTagOther(tagAtom a.Atom) { } } -// Section 12.2.5.4.8. +// Section 12.2.6.4.8. func textIM(p *parser) bool { switch p.tok.Type { case ErrorToken: @@ -1203,12 +1337,9 @@ func textIM(p *parser) bool { return p.tok.Type == EndTagToken } -// Section 12.2.5.4.9. +// Section 12.2.6.4.9. func inTableIM(p *parser) bool { switch p.tok.Type { - case ErrorToken: - // Stop parsing. - return true case TextToken: p.tok.Data = strings.Replace(p.tok.Data, "\x00", "", -1) switch p.oe.top().DataAtom { @@ -1249,7 +1380,7 @@ func inTableIM(p *parser) bool { } // Ignore the token. return true - case a.Style, a.Script: + case a.Style, a.Script, a.Template: return inHeadIM(p) case a.Input: for _, t := range p.tok.Attr { @@ -1261,7 +1392,7 @@ func inTableIM(p *parser) bool { } // Otherwise drop down to the default action. case a.Form: - if p.form != nil { + if p.oe.contains(a.Template) || p.form != nil { // Ignore the token. return true } @@ -1291,6 +1422,8 @@ func inTableIM(p *parser) bool { case a.Body, a.Caption, a.Col, a.Colgroup, a.Html, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr: // Ignore the token. return true + case a.Template: + return inHeadIM(p) } case CommentToken: p.addChild(&Node{ @@ -1301,6 +1434,8 @@ func inTableIM(p *parser) bool { case DoctypeToken: // Ignore the token. return true + case ErrorToken: + return inBodyIM(p) } p.fosterParenting = true @@ -1309,7 +1444,7 @@ func inTableIM(p *parser) bool { return inBodyIM(p) } -// Section 12.2.5.4.11. +// Section 12.2.6.4.11. func inCaptionIM(p *parser) bool { switch p.tok.Type { case StartTagToken: @@ -1355,7 +1490,7 @@ func inCaptionIM(p *parser) bool { return inBodyIM(p) } -// Section 12.2.5.4.12. +// Section 12.2.6.4.12. func inColumnGroupIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -1386,11 +1521,13 @@ func inColumnGroupIM(p *parser) bool { p.oe.pop() p.acknowledgeSelfClosingTag() return true + case a.Template: + return inHeadIM(p) } case EndTagToken: switch p.tok.DataAtom { case a.Colgroup: - if p.oe.top().DataAtom != a.Html { + if p.oe.top().DataAtom == a.Colgroup { p.oe.pop() p.im = inTableIM } @@ -1398,17 +1535,21 @@ func inColumnGroupIM(p *parser) bool { case a.Col: // Ignore the token. return true + case a.Template: + return inHeadIM(p) } + case ErrorToken: + return inBodyIM(p) } - if p.oe.top().DataAtom != a.Html { - p.oe.pop() - p.im = inTableIM - return false + if p.oe.top().DataAtom != a.Colgroup { + return true } - return true + p.oe.pop() + p.im = inTableIM + return false } -// Section 12.2.5.4.13. +// Section 12.2.6.4.13. func inTableBodyIM(p *parser) bool { switch p.tok.Type { case StartTagToken: @@ -1460,7 +1601,7 @@ func inTableBodyIM(p *parser) bool { return inTableIM(p) } -// Section 12.2.5.4.14. +// Section 12.2.6.4.14. func inRowIM(p *parser) bool { switch p.tok.Type { case StartTagToken: @@ -1511,7 +1652,7 @@ func inRowIM(p *parser) bool { return inTableIM(p) } -// Section 12.2.5.4.15. +// Section 12.2.6.4.15. func inCellIM(p *parser) bool { switch p.tok.Type { case StartTagToken: @@ -1560,12 +1701,9 @@ func inCellIM(p *parser) bool { return inBodyIM(p) } -// Section 12.2.5.4.16. +// Section 12.2.6.4.16. func inSelectIM(p *parser) bool { switch p.tok.Type { - case ErrorToken: - // Stop parsing. - return true case TextToken: p.addText(strings.Replace(p.tok.Data, "\x00", "", -1)) case StartTagToken: @@ -1586,8 +1724,12 @@ func inSelectIM(p *parser) bool { } p.addElement() case a.Select: - p.tok.Type = EndTagToken - return false + if p.popUntil(selectScope, a.Select) { + p.resetInsertionMode() + } else { + // Ignore the token. + return true + } case a.Input, a.Keygen, a.Textarea: if p.elementInScope(selectScope, a.Select) { p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) @@ -1597,7 +1739,7 @@ func inSelectIM(p *parser) bool { p.tokenizer.NextIsNotRawText() // Ignore the token. return true - case a.Script: + case a.Script, a.Template: return inHeadIM(p) } case EndTagToken: @@ -1617,7 +1759,12 @@ func inSelectIM(p *parser) bool { case a.Select: if p.popUntil(selectScope, a.Select) { p.resetInsertionMode() + } else { + // Ignore the token. + return true } + case a.Template: + return inHeadIM(p) } case CommentToken: p.addChild(&Node{ @@ -1627,30 +1774,107 @@ func inSelectIM(p *parser) bool { case DoctypeToken: // Ignore the token. return true + case ErrorToken: + return inBodyIM(p) } return true } -// Section 12.2.5.4.17. +// Section 12.2.6.4.17. func inSelectInTableIM(p *parser) bool { switch p.tok.Type { case StartTagToken, EndTagToken: switch p.tok.DataAtom { case a.Caption, a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr, a.Td, a.Th: - if p.tok.Type == StartTagToken || p.elementInScope(tableScope, p.tok.DataAtom) { - p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) - return false - } else { + if p.tok.Type == EndTagToken && !p.elementInScope(tableScope, p.tok.DataAtom) { // Ignore the token. return true } + // This is like p.popUntil(selectScope, a.Select), but it also + // matches , not just