repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/samber/lo/channel.go
vendor/github.com/samber/lo/channel.go
package lo import ( "math/rand" "time" ) type DispatchingStrategy[T any] func(msg T, index uint64, channels []<-chan T) int // ChannelDispatcher distributes messages from input channels into N child channels. // Close events are propagated to children. // Underlying channels can have a fixed buffer capacity or be unbuffered when cap is 0. func ChannelDispatcher[T any](stream <-chan T, count int, channelBufferCap int, strategy DispatchingStrategy[T]) []<-chan T { children := createChannels[T](count, channelBufferCap) roChildren := channelsToReadOnly(children) go func() { // propagate channel closing to children defer closeChannels(children) var i uint64 = 0 for { msg, ok := <-stream if !ok { return } destination := strategy(msg, i, roChildren) % count children[destination] <- msg i++ } }() return roChildren } func createChannels[T any](count int, channelBufferCap int) []chan T { children := make([]chan T, 0, count) for i := 0; i < count; i++ { children = append(children, make(chan T, channelBufferCap)) } return children } func channelsToReadOnly[T any](children []chan T) []<-chan T { roChildren := make([]<-chan T, 0, len(children)) for i := range children { roChildren = append(roChildren, children[i]) } return roChildren } func closeChannels[T any](children []chan T) { for i := 0; i < len(children); i++ { close(children[i]) } } func channelIsNotFull[T any](ch <-chan T) bool { return cap(ch) == 0 || len(ch) < cap(ch) } // DispatchingStrategyRoundRobin distributes messages in a rotating sequential manner. // If the channel capacity is exceeded, the next channel will be selected and so on. func DispatchingStrategyRoundRobin[T any](msg T, index uint64, channels []<-chan T) int { for { i := int(index % uint64(len(channels))) if channelIsNotFull(channels[i]) { return i } index++ time.Sleep(10 * time.Microsecond) // prevent CPU from burning 🔥 } } // DispatchingStrategyRandom distributes messages in a random manner. // If the channel capacity is exceeded, another random channel will be selected and so on. func DispatchingStrategyRandom[T any](msg T, index uint64, channels []<-chan T) int { for { i := rand.Intn(len(channels)) if channelIsNotFull(channels[i]) { return i } time.Sleep(10 * time.Microsecond) // prevent CPU from burning 🔥 } } // DispatchingStrategyRandom distributes messages in a weighted manner. // If the channel capacity is exceeded, another random channel will be selected and so on. func DispatchingStrategyWeightedRandom[T any](weights []int) DispatchingStrategy[T] { seq := []int{} for i := 0; i < len(weights); i++ { for j := 0; j < weights[i]; j++ { seq = append(seq, i) } } return func(msg T, index uint64, channels []<-chan T) int { for { i := seq[rand.Intn(len(seq))] if channelIsNotFull(channels[i]) { return i } time.Sleep(10 * time.Microsecond) // prevent CPU from burning 🔥 } } } // DispatchingStrategyFirst distributes messages in the first non-full channel. // If the capacity of the first channel is exceeded, the second channel will be selected and so on. func DispatchingStrategyFirst[T any](msg T, index uint64, channels []<-chan T) int { for { for i := range channels { if channelIsNotFull(channels[i]) { return i } } time.Sleep(10 * time.Microsecond) // prevent CPU from burning 🔥 } } // DispatchingStrategyLeast distributes messages in the emptiest channel. func DispatchingStrategyLeast[T any](msg T, index uint64, channels []<-chan T) int { seq := Range(len(channels)) return MinBy(seq, func(item int, min int) bool { return len(channels[item]) < len(channels[min]) }) } // DispatchingStrategyMost distributes messages in the fulliest channel. // If the channel capacity is exceeded, the next channel will be selected and so on. func DispatchingStrategyMost[T any](msg T, index uint64, channels []<-chan T) int { seq := Range(len(channels)) return MaxBy(seq, func(item int, max int) bool { return len(channels[item]) > len(channels[max]) && channelIsNotFull(channels[item]) }) } // SliceToChannel returns a read-only channels of collection elements. func SliceToChannel[T any](bufferSize int, collection []T) <-chan T { ch := make(chan T, bufferSize) go func() { for _, item := range collection { ch <- item } close(ch) }() return ch } // Generator implements the generator design pattern. func Generator[T any](bufferSize int, generator func(yield func(T))) <-chan T { ch := make(chan T, bufferSize) go func() { // WARNING: infinite loop generator(func(t T) { ch <- t }) close(ch) }() return ch } // Batch creates a slice of n elements from a channel. Returns the slice and the slice length. // @TODO: we should probaby provide an helper that reuse the same buffer. func Batch[T any](ch <-chan T, size int) (collection []T, length int, readTime time.Duration, ok bool) { buffer := make([]T, 0, size) index := 0 now := time.Now() for ; index < size; index++ { item, ok := <-ch if !ok { return buffer, index, time.Since(now), false } buffer = append(buffer, item) } return buffer, index, time.Since(now), true } // BatchWithTimeout creates a slice of n elements from a channel, with timeout. Returns the slice and the slice length. // @TODO: we should probaby provide an helper that reuse the same buffer. func BatchWithTimeout[T any](ch <-chan T, size int, timeout time.Duration) (collection []T, length int, readTime time.Duration, ok bool) { expire := time.NewTimer(timeout) defer expire.Stop() buffer := make([]T, 0, size) index := 0 now := time.Now() for ; index < size; index++ { select { case item, ok := <-ch: if !ok { return buffer, index, time.Since(now), false } buffer = append(buffer, item) case <-expire.C: return buffer, index, time.Since(now), true } } return buffer, index, time.Since(now), true }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/samber/lo/func.go
vendor/github.com/samber/lo/func.go
package lo // Partial returns new function that, when called, has its first argument set to the provided value. func Partial[T1, T2, R any](f func(T1, T2) R, arg1 T1) func(T2) R { return func(t2 T2) R { return f(arg1, t2) } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/davecgh/go-spew/spew/config.go
vendor/github.com/davecgh/go-spew/spew/config.go
/* * Copyright (c) 2013-2016 Dave Collins <dave@davec.name> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package spew import ( "bytes" "fmt" "io" "os" ) // ConfigState houses the configuration options used by spew to format and // display values. There is a global instance, Config, that is used to control // all top-level Formatter and Dump functionality. Each ConfigState instance // provides methods equivalent to the top-level functions. // // The zero value for ConfigState provides no indentation. You would typically // want to set it to a space or a tab. // // Alternatively, you can use NewDefaultConfig to get a ConfigState instance // with default settings. See the documentation of NewDefaultConfig for default // values. type ConfigState struct { // Indent specifies the string to use for each indentation level. The // global config instance that all top-level functions use set this to a // single space by default. If you would like more indentation, you might // set this to a tab with "\t" or perhaps two spaces with " ". Indent string // MaxDepth controls the maximum number of levels to descend into nested // data structures. The default, 0, means there is no limit. // // NOTE: Circular data structures are properly detected, so it is not // necessary to set this value unless you specifically want to limit deeply // nested data structures. MaxDepth int // DisableMethods specifies whether or not error and Stringer interfaces are // invoked for types that implement them. DisableMethods bool // DisablePointerMethods specifies whether or not to check for and invoke // error and Stringer interfaces on types which only accept a pointer // receiver when the current type is not a pointer. // // NOTE: This might be an unsafe action since calling one of these methods // with a pointer receiver could technically mutate the value, however, // in practice, types which choose to satisify an error or Stringer // interface with a pointer receiver should not be mutating their state // inside these interface methods. As a result, this option relies on // access to the unsafe package, so it will not have any effect when // running in environments without access to the unsafe package such as // Google App Engine or with the "safe" build tag specified. DisablePointerMethods bool // DisablePointerAddresses specifies whether to disable the printing of // pointer addresses. This is useful when diffing data structures in tests. DisablePointerAddresses bool // DisableCapacities specifies whether to disable the printing of capacities // for arrays, slices, maps and channels. This is useful when diffing // data structures in tests. DisableCapacities bool // ContinueOnMethod specifies whether or not recursion should continue once // a custom error or Stringer interface is invoked. The default, false, // means it will print the results of invoking the custom error or Stringer // interface and return immediately instead of continuing to recurse into // the internals of the data type. // // NOTE: This flag does not have any effect if method invocation is disabled // via the DisableMethods or DisablePointerMethods options. ContinueOnMethod bool // SortKeys specifies map keys should be sorted before being printed. Use // this to have a more deterministic, diffable output. Note that only // native types (bool, int, uint, floats, uintptr and string) and types // that support the error or Stringer interfaces (if methods are // enabled) are supported, with other types sorted according to the // reflect.Value.String() output which guarantees display stability. SortKeys bool // SpewKeys specifies that, as a last resort attempt, map keys should // be spewed to strings and sorted by those strings. This is only // considered if SortKeys is true. SpewKeys bool } // Config is the active configuration of the top-level functions. // The configuration can be changed by modifying the contents of spew.Config. var Config = ConfigState{Indent: " "} // Errorf is a wrapper for fmt.Errorf that treats each argument as if it were // passed with a Formatter interface returned by c.NewFormatter. It returns // the formatted string as a value that satisfies error. See NewFormatter // for formatting details. // // This function is shorthand for the following syntax: // // fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b)) func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) { return fmt.Errorf(format, c.convertArgs(a)...) } // Fprint is a wrapper for fmt.Fprint that treats each argument as if it were // passed with a Formatter interface returned by c.NewFormatter. It returns // the number of bytes written and any write error encountered. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b)) func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) { return fmt.Fprint(w, c.convertArgs(a)...) } // Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were // passed with a Formatter interface returned by c.NewFormatter. It returns // the number of bytes written and any write error encountered. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b)) func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { return fmt.Fprintf(w, format, c.convertArgs(a)...) } // Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it // passed with a Formatter interface returned by c.NewFormatter. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b)) func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { return fmt.Fprintln(w, c.convertArgs(a)...) } // Print is a wrapper for fmt.Print that treats each argument as if it were // passed with a Formatter interface returned by c.NewFormatter. It returns // the number of bytes written and any write error encountered. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Print(c.NewFormatter(a), c.NewFormatter(b)) func (c *ConfigState) Print(a ...interface{}) (n int, err error) { return fmt.Print(c.convertArgs(a)...) } // Printf is a wrapper for fmt.Printf that treats each argument as if it were // passed with a Formatter interface returned by c.NewFormatter. It returns // the number of bytes written and any write error encountered. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b)) func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) { return fmt.Printf(format, c.convertArgs(a)...) } // Println is a wrapper for fmt.Println that treats each argument as if it were // passed with a Formatter interface returned by c.NewFormatter. It returns // the number of bytes written and any write error encountered. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Println(c.NewFormatter(a), c.NewFormatter(b)) func (c *ConfigState) Println(a ...interface{}) (n int, err error) { return fmt.Println(c.convertArgs(a)...) } // Sprint is a wrapper for fmt.Sprint that treats each argument as if it were // passed with a Formatter interface returned by c.NewFormatter. It returns // the resulting string. See NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b)) func (c *ConfigState) Sprint(a ...interface{}) string { return fmt.Sprint(c.convertArgs(a)...) } // Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were // passed with a Formatter interface returned by c.NewFormatter. It returns // the resulting string. See NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b)) func (c *ConfigState) Sprintf(format string, a ...interface{}) string { return fmt.Sprintf(format, c.convertArgs(a)...) } // Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it // were passed with a Formatter interface returned by c.NewFormatter. It // returns the resulting string. See NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b)) func (c *ConfigState) Sprintln(a ...interface{}) string { return fmt.Sprintln(c.convertArgs(a)...) } /* NewFormatter returns a custom formatter that satisfies the fmt.Formatter interface. As a result, it integrates cleanly with standard fmt package printing functions. The formatter is useful for inline printing of smaller data types similar to the standard %v format specifier. The custom formatter only responds to the %v (most compact), %+v (adds pointer addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb combinations. Any other verbs such as %x and %q will be sent to the the standard fmt package for formatting. In addition, the custom formatter ignores the width and precision arguments (however they will still work on the format specifiers not handled by the custom formatter). Typically this function shouldn't be called directly. It is much easier to make use of the custom formatter by calling one of the convenience functions such as c.Printf, c.Println, or c.Printf. */ func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter { return newFormatter(c, v) } // Fdump formats and displays the passed arguments to io.Writer w. It formats // exactly the same as Dump. func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) { fdump(c, w, a...) } /* Dump displays the passed parameters to standard out with newlines, customizable indentation, and additional debug information such as complete types and all pointer addresses used to indirect to the final value. It provides the following features over the built-in printing facilities provided by the fmt package: * Pointers are dereferenced and followed * Circular data structures are detected and handled properly * Custom Stringer/error interfaces are optionally invoked, including on unexported types * Custom types which only implement the Stringer/error interfaces via a pointer receiver are optionally invoked when passing non-pointer variables * Byte arrays and slices are dumped like the hexdump -C command which includes offsets, byte values in hex, and ASCII output The configuration options are controlled by modifying the public members of c. See ConfigState for options documentation. See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to get the formatted result as a string. */ func (c *ConfigState) Dump(a ...interface{}) { fdump(c, os.Stdout, a...) } // Sdump returns a string with the passed arguments formatted exactly the same // as Dump. func (c *ConfigState) Sdump(a ...interface{}) string { var buf bytes.Buffer fdump(c, &buf, a...) return buf.String() } // convertArgs accepts a slice of arguments and returns a slice of the same // length with each argument converted to a spew Formatter interface using // the ConfigState associated with s. func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) { formatters = make([]interface{}, len(args)) for index, arg := range args { formatters[index] = newFormatter(c, arg) } return formatters } // NewDefaultConfig returns a ConfigState with the following default settings. // // Indent: " " // MaxDepth: 0 // DisableMethods: false // DisablePointerMethods: false // ContinueOnMethod: false // SortKeys: false func NewDefaultConfig() *ConfigState { return &ConfigState{Indent: " "} }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/davecgh/go-spew/spew/format.go
vendor/github.com/davecgh/go-spew/spew/format.go
/* * Copyright (c) 2013-2016 Dave Collins <dave@davec.name> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package spew import ( "bytes" "fmt" "reflect" "strconv" "strings" ) // supportedFlags is a list of all the character flags supported by fmt package. const supportedFlags = "0-+# " // formatState implements the fmt.Formatter interface and contains information // about the state of a formatting operation. The NewFormatter function can // be used to get a new Formatter which can be used directly as arguments // in standard fmt package printing calls. type formatState struct { value interface{} fs fmt.State depth int pointers map[uintptr]int ignoreNextType bool cs *ConfigState } // buildDefaultFormat recreates the original format string without precision // and width information to pass in to fmt.Sprintf in the case of an // unrecognized type. Unless new types are added to the language, this // function won't ever be called. func (f *formatState) buildDefaultFormat() (format string) { buf := bytes.NewBuffer(percentBytes) for _, flag := range supportedFlags { if f.fs.Flag(int(flag)) { buf.WriteRune(flag) } } buf.WriteRune('v') format = buf.String() return format } // constructOrigFormat recreates the original format string including precision // and width information to pass along to the standard fmt package. This allows // automatic deferral of all format strings this package doesn't support. func (f *formatState) constructOrigFormat(verb rune) (format string) { buf := bytes.NewBuffer(percentBytes) for _, flag := range supportedFlags { if f.fs.Flag(int(flag)) { buf.WriteRune(flag) } } if width, ok := f.fs.Width(); ok { buf.WriteString(strconv.Itoa(width)) } if precision, ok := f.fs.Precision(); ok { buf.Write(precisionBytes) buf.WriteString(strconv.Itoa(precision)) } buf.WriteRune(verb) format = buf.String() return format } // unpackValue returns values inside of non-nil interfaces when possible and // ensures that types for values which have been unpacked from an interface // are displayed when the show types flag is also set. // This is useful for data types like structs, arrays, slices, and maps which // can contain varying types packed inside an interface. func (f *formatState) unpackValue(v reflect.Value) reflect.Value { if v.Kind() == reflect.Interface { f.ignoreNextType = false if !v.IsNil() { v = v.Elem() } } return v } // formatPtr handles formatting of pointers by indirecting them as necessary. func (f *formatState) formatPtr(v reflect.Value) { // Display nil if top level pointer is nil. showTypes := f.fs.Flag('#') if v.IsNil() && (!showTypes || f.ignoreNextType) { f.fs.Write(nilAngleBytes) return } // Remove pointers at or below the current depth from map used to detect // circular refs. for k, depth := range f.pointers { if depth >= f.depth { delete(f.pointers, k) } } // Keep list of all dereferenced pointers to possibly show later. pointerChain := make([]uintptr, 0) // Figure out how many levels of indirection there are by derferencing // pointers and unpacking interfaces down the chain while detecting circular // references. nilFound := false cycleFound := false indirects := 0 ve := v for ve.Kind() == reflect.Ptr { if ve.IsNil() { nilFound = true break } indirects++ addr := ve.Pointer() pointerChain = append(pointerChain, addr) if pd, ok := f.pointers[addr]; ok && pd < f.depth { cycleFound = true indirects-- break } f.pointers[addr] = f.depth ve = ve.Elem() if ve.Kind() == reflect.Interface { if ve.IsNil() { nilFound = true break } ve = ve.Elem() } } // Display type or indirection level depending on flags. if showTypes && !f.ignoreNextType { f.fs.Write(openParenBytes) f.fs.Write(bytes.Repeat(asteriskBytes, indirects)) f.fs.Write([]byte(ve.Type().String())) f.fs.Write(closeParenBytes) } else { if nilFound || cycleFound { indirects += strings.Count(ve.Type().String(), "*") } f.fs.Write(openAngleBytes) f.fs.Write([]byte(strings.Repeat("*", indirects))) f.fs.Write(closeAngleBytes) } // Display pointer information depending on flags. if f.fs.Flag('+') && (len(pointerChain) > 0) { f.fs.Write(openParenBytes) for i, addr := range pointerChain { if i > 0 { f.fs.Write(pointerChainBytes) } printHexPtr(f.fs, addr) } f.fs.Write(closeParenBytes) } // Display dereferenced value. switch { case nilFound: f.fs.Write(nilAngleBytes) case cycleFound: f.fs.Write(circularShortBytes) default: f.ignoreNextType = true f.format(ve) } } // format is the main workhorse for providing the Formatter interface. It // uses the passed reflect value to figure out what kind of object we are // dealing with and formats it appropriately. It is a recursive function, // however circular data structures are detected and handled properly. func (f *formatState) format(v reflect.Value) { // Handle invalid reflect values immediately. kind := v.Kind() if kind == reflect.Invalid { f.fs.Write(invalidAngleBytes) return } // Handle pointers specially. if kind == reflect.Ptr { f.formatPtr(v) return } // Print type information unless already handled elsewhere. if !f.ignoreNextType && f.fs.Flag('#') { f.fs.Write(openParenBytes) f.fs.Write([]byte(v.Type().String())) f.fs.Write(closeParenBytes) } f.ignoreNextType = false // Call Stringer/error interfaces if they exist and the handle methods // flag is enabled. if !f.cs.DisableMethods { if (kind != reflect.Invalid) && (kind != reflect.Interface) { if handled := handleMethods(f.cs, f.fs, v); handled { return } } } switch kind { case reflect.Invalid: // Do nothing. We should never get here since invalid has already // been handled above. case reflect.Bool: printBool(f.fs, v.Bool()) case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: printInt(f.fs, v.Int(), 10) case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: printUint(f.fs, v.Uint(), 10) case reflect.Float32: printFloat(f.fs, v.Float(), 32) case reflect.Float64: printFloat(f.fs, v.Float(), 64) case reflect.Complex64: printComplex(f.fs, v.Complex(), 32) case reflect.Complex128: printComplex(f.fs, v.Complex(), 64) case reflect.Slice: if v.IsNil() { f.fs.Write(nilAngleBytes) break } fallthrough case reflect.Array: f.fs.Write(openBracketBytes) f.depth++ if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { f.fs.Write(maxShortBytes) } else { numEntries := v.Len() for i := 0; i < numEntries; i++ { if i > 0 { f.fs.Write(spaceBytes) } f.ignoreNextType = true f.format(f.unpackValue(v.Index(i))) } } f.depth-- f.fs.Write(closeBracketBytes) case reflect.String: f.fs.Write([]byte(v.String())) case reflect.Interface: // The only time we should get here is for nil interfaces due to // unpackValue calls. if v.IsNil() { f.fs.Write(nilAngleBytes) } case reflect.Ptr: // Do nothing. We should never get here since pointers have already // been handled above. case reflect.Map: // nil maps should be indicated as different than empty maps if v.IsNil() { f.fs.Write(nilAngleBytes) break } f.fs.Write(openMapBytes) f.depth++ if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { f.fs.Write(maxShortBytes) } else { keys := v.MapKeys() if f.cs.SortKeys { sortValues(keys, f.cs) } for i, key := range keys { if i > 0 { f.fs.Write(spaceBytes) } f.ignoreNextType = true f.format(f.unpackValue(key)) f.fs.Write(colonBytes) f.ignoreNextType = true f.format(f.unpackValue(v.MapIndex(key))) } } f.depth-- f.fs.Write(closeMapBytes) case reflect.Struct: numFields := v.NumField() f.fs.Write(openBraceBytes) f.depth++ if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { f.fs.Write(maxShortBytes) } else { vt := v.Type() for i := 0; i < numFields; i++ { if i > 0 { f.fs.Write(spaceBytes) } vtf := vt.Field(i) if f.fs.Flag('+') || f.fs.Flag('#') { f.fs.Write([]byte(vtf.Name)) f.fs.Write(colonBytes) } f.format(f.unpackValue(v.Field(i))) } } f.depth-- f.fs.Write(closeBraceBytes) case reflect.Uintptr: printHexPtr(f.fs, uintptr(v.Uint())) case reflect.UnsafePointer, reflect.Chan, reflect.Func: printHexPtr(f.fs, v.Pointer()) // There were not any other types at the time this code was written, but // fall back to letting the default fmt package handle it if any get added. default: format := f.buildDefaultFormat() if v.CanInterface() { fmt.Fprintf(f.fs, format, v.Interface()) } else { fmt.Fprintf(f.fs, format, v.String()) } } } // Format satisfies the fmt.Formatter interface. See NewFormatter for usage // details. func (f *formatState) Format(fs fmt.State, verb rune) { f.fs = fs // Use standard formatting for verbs that are not v. if verb != 'v' { format := f.constructOrigFormat(verb) fmt.Fprintf(fs, format, f.value) return } if f.value == nil { if fs.Flag('#') { fs.Write(interfaceBytes) } fs.Write(nilAngleBytes) return } f.format(reflect.ValueOf(f.value)) } // newFormatter is a helper function to consolidate the logic from the various // public methods which take varying config states. func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter { fs := &formatState{value: v, cs: cs} fs.pointers = make(map[uintptr]int) return fs } /* NewFormatter returns a custom formatter that satisfies the fmt.Formatter interface. As a result, it integrates cleanly with standard fmt package printing functions. The formatter is useful for inline printing of smaller data types similar to the standard %v format specifier. The custom formatter only responds to the %v (most compact), %+v (adds pointer addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb combinations. Any other verbs such as %x and %q will be sent to the the standard fmt package for formatting. In addition, the custom formatter ignores the width and precision arguments (however they will still work on the format specifiers not handled by the custom formatter). Typically this function shouldn't be called directly. It is much easier to make use of the custom formatter by calling one of the convenience functions such as Printf, Println, or Fprintf. */ func NewFormatter(v interface{}) fmt.Formatter { return newFormatter(&Config, v) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/davecgh/go-spew/spew/bypass.go
vendor/github.com/davecgh/go-spew/spew/bypass.go
// Copyright (c) 2015-2016 Dave Collins <dave@davec.name> // // Permission to use, copy, modify, and distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // NOTE: Due to the following build constraints, this file will only be compiled // when the code is not running on Google App Engine, compiled by GopherJS, and // "-tags safe" is not added to the go build command line. The "disableunsafe" // tag is deprecated and thus should not be used. // Go versions prior to 1.4 are disabled because they use a different layout // for interfaces which make the implementation of unsafeReflectValue more complex. // +build !js,!appengine,!safe,!disableunsafe,go1.4 package spew import ( "reflect" "unsafe" ) const ( // UnsafeDisabled is a build-time constant which specifies whether or // not access to the unsafe package is available. UnsafeDisabled = false // ptrSize is the size of a pointer on the current arch. ptrSize = unsafe.Sizeof((*byte)(nil)) ) type flag uintptr var ( // flagRO indicates whether the value field of a reflect.Value // is read-only. flagRO flag // flagAddr indicates whether the address of the reflect.Value's // value may be taken. flagAddr flag ) // flagKindMask holds the bits that make up the kind // part of the flags field. In all the supported versions, // it is in the lower 5 bits. const flagKindMask = flag(0x1f) // Different versions of Go have used different // bit layouts for the flags type. This table // records the known combinations. var okFlags = []struct { ro, addr flag }{{ // From Go 1.4 to 1.5 ro: 1 << 5, addr: 1 << 7, }, { // Up to Go tip. ro: 1<<5 | 1<<6, addr: 1 << 8, }} var flagValOffset = func() uintptr { field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") if !ok { panic("reflect.Value has no flag field") } return field.Offset }() // flagField returns a pointer to the flag field of a reflect.Value. func flagField(v *reflect.Value) *flag { return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset)) } // unsafeReflectValue converts the passed reflect.Value into a one that bypasses // the typical safety restrictions preventing access to unaddressable and // unexported data. It works by digging the raw pointer to the underlying // value out of the protected value and generating a new unprotected (unsafe) // reflect.Value to it. // // This allows us to check for implementations of the Stringer and error // interfaces to be used for pretty printing ordinarily unaddressable and // inaccessible values such as unexported struct fields. func unsafeReflectValue(v reflect.Value) reflect.Value { if !v.IsValid() || (v.CanInterface() && v.CanAddr()) { return v } flagFieldPtr := flagField(&v) *flagFieldPtr &^= flagRO *flagFieldPtr |= flagAddr return v } // Sanity checks against future reflect package changes // to the type or semantics of the Value.flag field. func init() { field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") if !ok { panic("reflect.Value has no flag field") } if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() { panic("reflect.Value flag field has changed kind") } type t0 int var t struct { A t0 // t0 will have flagEmbedRO set. t0 // a will have flagStickyRO set a t0 } vA := reflect.ValueOf(t).FieldByName("A") va := reflect.ValueOf(t).FieldByName("a") vt0 := reflect.ValueOf(t).FieldByName("t0") // Infer flagRO from the difference between the flags // for the (otherwise identical) fields in t. flagPublic := *flagField(&vA) flagWithRO := *flagField(&va) | *flagField(&vt0) flagRO = flagPublic ^ flagWithRO // Infer flagAddr from the difference between a value // taken from a pointer and not. vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A") flagNoPtr := *flagField(&vA) flagPtr := *flagField(&vPtrA) flagAddr = flagNoPtr ^ flagPtr // Check that the inferred flags tally with one of the known versions. for _, f := range okFlags { if flagRO == f.ro && flagAddr == f.addr { return } } panic("reflect.Value read-only flag has changed semantics") }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go
vendor/github.com/davecgh/go-spew/spew/bypasssafe.go
// Copyright (c) 2015-2016 Dave Collins <dave@davec.name> // // Permission to use, copy, modify, and distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // NOTE: Due to the following build constraints, this file will only be compiled // when the code is running on Google App Engine, compiled by GopherJS, or // "-tags safe" is added to the go build command line. The "disableunsafe" // tag is deprecated and thus should not be used. // +build js appengine safe disableunsafe !go1.4 package spew import "reflect" const ( // UnsafeDisabled is a build-time constant which specifies whether or // not access to the unsafe package is available. UnsafeDisabled = true ) // unsafeReflectValue typically converts the passed reflect.Value into a one // that bypasses the typical safety restrictions preventing access to // unaddressable and unexported data. However, doing this relies on access to // the unsafe package. This is a stub version which simply returns the passed // reflect.Value when the unsafe package is not available. func unsafeReflectValue(v reflect.Value) reflect.Value { return v }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/davecgh/go-spew/spew/doc.go
vendor/github.com/davecgh/go-spew/spew/doc.go
/* * Copyright (c) 2013-2016 Dave Collins <dave@davec.name> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* Package spew implements a deep pretty printer for Go data structures to aid in debugging. A quick overview of the additional features spew provides over the built-in printing facilities for Go data types are as follows: * Pointers are dereferenced and followed * Circular data structures are detected and handled properly * Custom Stringer/error interfaces are optionally invoked, including on unexported types * Custom types which only implement the Stringer/error interfaces via a pointer receiver are optionally invoked when passing non-pointer variables * Byte arrays and slices are dumped like the hexdump -C command which includes offsets, byte values in hex, and ASCII output (only when using Dump style) There are two different approaches spew allows for dumping Go data structures: * Dump style which prints with newlines, customizable indentation, and additional debug information such as types and all pointer addresses used to indirect to the final value * A custom Formatter interface that integrates cleanly with the standard fmt package and replaces %v, %+v, %#v, and %#+v to provide inline printing similar to the default %v while providing the additional functionality outlined above and passing unsupported format verbs such as %x and %q along to fmt Quick Start This section demonstrates how to quickly get started with spew. See the sections below for further details on formatting and configuration options. To dump a variable with full newlines, indentation, type, and pointer information use Dump, Fdump, or Sdump: spew.Dump(myVar1, myVar2, ...) spew.Fdump(someWriter, myVar1, myVar2, ...) str := spew.Sdump(myVar1, myVar2, ...) Alternatively, if you would prefer to use format strings with a compacted inline printing style, use the convenience wrappers Printf, Fprintf, etc with %v (most compact), %+v (adds pointer addresses), %#v (adds types), or %#+v (adds types and pointer addresses): spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) Configuration Options Configuration of spew is handled by fields in the ConfigState type. For convenience, all of the top-level functions use a global state available via the spew.Config global. It is also possible to create a ConfigState instance that provides methods equivalent to the top-level functions. This allows concurrent configuration options. See the ConfigState documentation for more details. The following configuration options are available: * Indent String to use for each indentation level for Dump functions. It is a single space by default. A popular alternative is "\t". * MaxDepth Maximum number of levels to descend into nested data structures. There is no limit by default. * DisableMethods Disables invocation of error and Stringer interface methods. Method invocation is enabled by default. * DisablePointerMethods Disables invocation of error and Stringer interface methods on types which only accept pointer receivers from non-pointer variables. Pointer method invocation is enabled by default. * DisablePointerAddresses DisablePointerAddresses specifies whether to disable the printing of pointer addresses. This is useful when diffing data structures in tests. * DisableCapacities DisableCapacities specifies whether to disable the printing of capacities for arrays, slices, maps and channels. This is useful when diffing data structures in tests. * ContinueOnMethod Enables recursion into types after invoking error and Stringer interface methods. Recursion after method invocation is disabled by default. * SortKeys Specifies map keys should be sorted before being printed. Use this to have a more deterministic, diffable output. Note that only native types (bool, int, uint, floats, uintptr and string) and types which implement error or Stringer interfaces are supported with other types sorted according to the reflect.Value.String() output which guarantees display stability. Natural map order is used by default. * SpewKeys Specifies that, as a last resort attempt, map keys should be spewed to strings and sorted by those strings. This is only considered if SortKeys is true. Dump Usage Simply call spew.Dump with a list of variables you want to dump: spew.Dump(myVar1, myVar2, ...) You may also call spew.Fdump if you would prefer to output to an arbitrary io.Writer. For example, to dump to standard error: spew.Fdump(os.Stderr, myVar1, myVar2, ...) A third option is to call spew.Sdump to get the formatted output as a string: str := spew.Sdump(myVar1, myVar2, ...) Sample Dump Output See the Dump example for details on the setup of the types and variables being shown here. (main.Foo) { unexportedField: (*main.Bar)(0xf84002e210)({ flag: (main.Flag) flagTwo, data: (uintptr) <nil> }), ExportedField: (map[interface {}]interface {}) (len=1) { (string) (len=3) "one": (bool) true } } Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C command as shown. ([]uint8) (len=32 cap=32) { 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| 00000020 31 32 |12| } Custom Formatter Spew provides a custom formatter that implements the fmt.Formatter interface so that it integrates cleanly with standard fmt package printing functions. The formatter is useful for inline printing of smaller data types similar to the standard %v format specifier. The custom formatter only responds to the %v (most compact), %+v (adds pointer addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb combinations. Any other verbs such as %x and %q will be sent to the the standard fmt package for formatting. In addition, the custom formatter ignores the width and precision arguments (however they will still work on the format specifiers not handled by the custom formatter). Custom Formatter Usage The simplest way to make use of the spew custom formatter is to call one of the convenience functions such as spew.Printf, spew.Println, or spew.Printf. The functions have syntax you are most likely already familiar with: spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) spew.Println(myVar, myVar2) spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) See the Index for the full list convenience functions. Sample Formatter Output Double pointer to a uint8: %v: <**>5 %+v: <**>(0xf8400420d0->0xf8400420c8)5 %#v: (**uint8)5 %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 Pointer to circular struct with a uint8 field and a pointer to itself: %v: <*>{1 <*><shown>} %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)<shown>} %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)<shown>} %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)<shown>} See the Printf example for details on the setup of variables being shown here. Errors Since it is possible for custom Stringer/error interfaces to panic, spew detects them and handles them internally by printing the panic information inline with the output. Since spew is intended to provide deep pretty printing capabilities on structures, it intentionally does not return any errors. */ package spew
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/davecgh/go-spew/spew/dump.go
vendor/github.com/davecgh/go-spew/spew/dump.go
/* * Copyright (c) 2013-2016 Dave Collins <dave@davec.name> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package spew import ( "bytes" "encoding/hex" "fmt" "io" "os" "reflect" "regexp" "strconv" "strings" ) var ( // uint8Type is a reflect.Type representing a uint8. It is used to // convert cgo types to uint8 slices for hexdumping. uint8Type = reflect.TypeOf(uint8(0)) // cCharRE is a regular expression that matches a cgo char. // It is used to detect character arrays to hexdump them. cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`) // cUnsignedCharRE is a regular expression that matches a cgo unsigned // char. It is used to detect unsigned character arrays to hexdump // them. cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`) // cUint8tCharRE is a regular expression that matches a cgo uint8_t. // It is used to detect uint8_t arrays to hexdump them. cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`) ) // dumpState contains information about the state of a dump operation. type dumpState struct { w io.Writer depth int pointers map[uintptr]int ignoreNextType bool ignoreNextIndent bool cs *ConfigState } // indent performs indentation according to the depth level and cs.Indent // option. func (d *dumpState) indent() { if d.ignoreNextIndent { d.ignoreNextIndent = false return } d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth)) } // unpackValue returns values inside of non-nil interfaces when possible. // This is useful for data types like structs, arrays, slices, and maps which // can contain varying types packed inside an interface. func (d *dumpState) unpackValue(v reflect.Value) reflect.Value { if v.Kind() == reflect.Interface && !v.IsNil() { v = v.Elem() } return v } // dumpPtr handles formatting of pointers by indirecting them as necessary. func (d *dumpState) dumpPtr(v reflect.Value) { // Remove pointers at or below the current depth from map used to detect // circular refs. for k, depth := range d.pointers { if depth >= d.depth { delete(d.pointers, k) } } // Keep list of all dereferenced pointers to show later. pointerChain := make([]uintptr, 0) // Figure out how many levels of indirection there are by dereferencing // pointers and unpacking interfaces down the chain while detecting circular // references. nilFound := false cycleFound := false indirects := 0 ve := v for ve.Kind() == reflect.Ptr { if ve.IsNil() { nilFound = true break } indirects++ addr := ve.Pointer() pointerChain = append(pointerChain, addr) if pd, ok := d.pointers[addr]; ok && pd < d.depth { cycleFound = true indirects-- break } d.pointers[addr] = d.depth ve = ve.Elem() if ve.Kind() == reflect.Interface { if ve.IsNil() { nilFound = true break } ve = ve.Elem() } } // Display type information. d.w.Write(openParenBytes) d.w.Write(bytes.Repeat(asteriskBytes, indirects)) d.w.Write([]byte(ve.Type().String())) d.w.Write(closeParenBytes) // Display pointer information. if !d.cs.DisablePointerAddresses && len(pointerChain) > 0 { d.w.Write(openParenBytes) for i, addr := range pointerChain { if i > 0 { d.w.Write(pointerChainBytes) } printHexPtr(d.w, addr) } d.w.Write(closeParenBytes) } // Display dereferenced value. d.w.Write(openParenBytes) switch { case nilFound: d.w.Write(nilAngleBytes) case cycleFound: d.w.Write(circularBytes) default: d.ignoreNextType = true d.dump(ve) } d.w.Write(closeParenBytes) } // dumpSlice handles formatting of arrays and slices. Byte (uint8 under // reflection) arrays and slices are dumped in hexdump -C fashion. func (d *dumpState) dumpSlice(v reflect.Value) { // Determine whether this type should be hex dumped or not. Also, // for types which should be hexdumped, try to use the underlying data // first, then fall back to trying to convert them to a uint8 slice. var buf []uint8 doConvert := false doHexDump := false numEntries := v.Len() if numEntries > 0 { vt := v.Index(0).Type() vts := vt.String() switch { // C types that need to be converted. case cCharRE.MatchString(vts): fallthrough case cUnsignedCharRE.MatchString(vts): fallthrough case cUint8tCharRE.MatchString(vts): doConvert = true // Try to use existing uint8 slices and fall back to converting // and copying if that fails. case vt.Kind() == reflect.Uint8: // We need an addressable interface to convert the type // to a byte slice. However, the reflect package won't // give us an interface on certain things like // unexported struct fields in order to enforce // visibility rules. We use unsafe, when available, to // bypass these restrictions since this package does not // mutate the values. vs := v if !vs.CanInterface() || !vs.CanAddr() { vs = unsafeReflectValue(vs) } if !UnsafeDisabled { vs = vs.Slice(0, numEntries) // Use the existing uint8 slice if it can be // type asserted. iface := vs.Interface() if slice, ok := iface.([]uint8); ok { buf = slice doHexDump = true break } } // The underlying data needs to be converted if it can't // be type asserted to a uint8 slice. doConvert = true } // Copy and convert the underlying type if needed. if doConvert && vt.ConvertibleTo(uint8Type) { // Convert and copy each element into a uint8 byte // slice. buf = make([]uint8, numEntries) for i := 0; i < numEntries; i++ { vv := v.Index(i) buf[i] = uint8(vv.Convert(uint8Type).Uint()) } doHexDump = true } } // Hexdump the entire slice as needed. if doHexDump { indent := strings.Repeat(d.cs.Indent, d.depth) str := indent + hex.Dump(buf) str = strings.Replace(str, "\n", "\n"+indent, -1) str = strings.TrimRight(str, d.cs.Indent) d.w.Write([]byte(str)) return } // Recursively call dump for each item. for i := 0; i < numEntries; i++ { d.dump(d.unpackValue(v.Index(i))) if i < (numEntries - 1) { d.w.Write(commaNewlineBytes) } else { d.w.Write(newlineBytes) } } } // dump is the main workhorse for dumping a value. It uses the passed reflect // value to figure out what kind of object we are dealing with and formats it // appropriately. It is a recursive function, however circular data structures // are detected and handled properly. func (d *dumpState) dump(v reflect.Value) { // Handle invalid reflect values immediately. kind := v.Kind() if kind == reflect.Invalid { d.w.Write(invalidAngleBytes) return } // Handle pointers specially. if kind == reflect.Ptr { d.indent() d.dumpPtr(v) return } // Print type information unless already handled elsewhere. if !d.ignoreNextType { d.indent() d.w.Write(openParenBytes) d.w.Write([]byte(v.Type().String())) d.w.Write(closeParenBytes) d.w.Write(spaceBytes) } d.ignoreNextType = false // Display length and capacity if the built-in len and cap functions // work with the value's kind and the len/cap itself is non-zero. valueLen, valueCap := 0, 0 switch v.Kind() { case reflect.Array, reflect.Slice, reflect.Chan: valueLen, valueCap = v.Len(), v.Cap() case reflect.Map, reflect.String: valueLen = v.Len() } if valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 { d.w.Write(openParenBytes) if valueLen != 0 { d.w.Write(lenEqualsBytes) printInt(d.w, int64(valueLen), 10) } if !d.cs.DisableCapacities && valueCap != 0 { if valueLen != 0 { d.w.Write(spaceBytes) } d.w.Write(capEqualsBytes) printInt(d.w, int64(valueCap), 10) } d.w.Write(closeParenBytes) d.w.Write(spaceBytes) } // Call Stringer/error interfaces if they exist and the handle methods flag // is enabled if !d.cs.DisableMethods { if (kind != reflect.Invalid) && (kind != reflect.Interface) { if handled := handleMethods(d.cs, d.w, v); handled { return } } } switch kind { case reflect.Invalid: // Do nothing. We should never get here since invalid has already // been handled above. case reflect.Bool: printBool(d.w, v.Bool()) case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: printInt(d.w, v.Int(), 10) case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: printUint(d.w, v.Uint(), 10) case reflect.Float32: printFloat(d.w, v.Float(), 32) case reflect.Float64: printFloat(d.w, v.Float(), 64) case reflect.Complex64: printComplex(d.w, v.Complex(), 32) case reflect.Complex128: printComplex(d.w, v.Complex(), 64) case reflect.Slice: if v.IsNil() { d.w.Write(nilAngleBytes) break } fallthrough case reflect.Array: d.w.Write(openBraceNewlineBytes) d.depth++ if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { d.indent() d.w.Write(maxNewlineBytes) } else { d.dumpSlice(v) } d.depth-- d.indent() d.w.Write(closeBraceBytes) case reflect.String: d.w.Write([]byte(strconv.Quote(v.String()))) case reflect.Interface: // The only time we should get here is for nil interfaces due to // unpackValue calls. if v.IsNil() { d.w.Write(nilAngleBytes) } case reflect.Ptr: // Do nothing. We should never get here since pointers have already // been handled above. case reflect.Map: // nil maps should be indicated as different than empty maps if v.IsNil() { d.w.Write(nilAngleBytes) break } d.w.Write(openBraceNewlineBytes) d.depth++ if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { d.indent() d.w.Write(maxNewlineBytes) } else { numEntries := v.Len() keys := v.MapKeys() if d.cs.SortKeys { sortValues(keys, d.cs) } for i, key := range keys { d.dump(d.unpackValue(key)) d.w.Write(colonSpaceBytes) d.ignoreNextIndent = true d.dump(d.unpackValue(v.MapIndex(key))) if i < (numEntries - 1) { d.w.Write(commaNewlineBytes) } else { d.w.Write(newlineBytes) } } } d.depth-- d.indent() d.w.Write(closeBraceBytes) case reflect.Struct: d.w.Write(openBraceNewlineBytes) d.depth++ if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { d.indent() d.w.Write(maxNewlineBytes) } else { vt := v.Type() numFields := v.NumField() for i := 0; i < numFields; i++ { d.indent() vtf := vt.Field(i) d.w.Write([]byte(vtf.Name)) d.w.Write(colonSpaceBytes) d.ignoreNextIndent = true d.dump(d.unpackValue(v.Field(i))) if i < (numFields - 1) { d.w.Write(commaNewlineBytes) } else { d.w.Write(newlineBytes) } } } d.depth-- d.indent() d.w.Write(closeBraceBytes) case reflect.Uintptr: printHexPtr(d.w, uintptr(v.Uint())) case reflect.UnsafePointer, reflect.Chan, reflect.Func: printHexPtr(d.w, v.Pointer()) // There were not any other types at the time this code was written, but // fall back to letting the default fmt package handle it in case any new // types are added. default: if v.CanInterface() { fmt.Fprintf(d.w, "%v", v.Interface()) } else { fmt.Fprintf(d.w, "%v", v.String()) } } } // fdump is a helper function to consolidate the logic from the various public // methods which take varying writers and config states. func fdump(cs *ConfigState, w io.Writer, a ...interface{}) { for _, arg := range a { if arg == nil { w.Write(interfaceBytes) w.Write(spaceBytes) w.Write(nilAngleBytes) w.Write(newlineBytes) continue } d := dumpState{w: w, cs: cs} d.pointers = make(map[uintptr]int) d.dump(reflect.ValueOf(arg)) d.w.Write(newlineBytes) } } // Fdump formats and displays the passed arguments to io.Writer w. It formats // exactly the same as Dump. func Fdump(w io.Writer, a ...interface{}) { fdump(&Config, w, a...) } // Sdump returns a string with the passed arguments formatted exactly the same // as Dump. func Sdump(a ...interface{}) string { var buf bytes.Buffer fdump(&Config, &buf, a...) return buf.String() } /* Dump displays the passed parameters to standard out with newlines, customizable indentation, and additional debug information such as complete types and all pointer addresses used to indirect to the final value. It provides the following features over the built-in printing facilities provided by the fmt package: * Pointers are dereferenced and followed * Circular data structures are detected and handled properly * Custom Stringer/error interfaces are optionally invoked, including on unexported types * Custom types which only implement the Stringer/error interfaces via a pointer receiver are optionally invoked when passing non-pointer variables * Byte arrays and slices are dumped like the hexdump -C command which includes offsets, byte values in hex, and ASCII output The configuration options are controlled by an exported package global, spew.Config. See ConfigState for options documentation. See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to get the formatted result as a string. */ func Dump(a ...interface{}) { fdump(&Config, os.Stdout, a...) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/davecgh/go-spew/spew/spew.go
vendor/github.com/davecgh/go-spew/spew/spew.go
/* * Copyright (c) 2013-2016 Dave Collins <dave@davec.name> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package spew import ( "fmt" "io" ) // Errorf is a wrapper for fmt.Errorf that treats each argument as if it were // passed with a default Formatter interface returned by NewFormatter. It // returns the formatted string as a value that satisfies error. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b)) func Errorf(format string, a ...interface{}) (err error) { return fmt.Errorf(format, convertArgs(a)...) } // Fprint is a wrapper for fmt.Fprint that treats each argument as if it were // passed with a default Formatter interface returned by NewFormatter. It // returns the number of bytes written and any write error encountered. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b)) func Fprint(w io.Writer, a ...interface{}) (n int, err error) { return fmt.Fprint(w, convertArgs(a)...) } // Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were // passed with a default Formatter interface returned by NewFormatter. It // returns the number of bytes written and any write error encountered. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b)) func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { return fmt.Fprintf(w, format, convertArgs(a)...) } // Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it // passed with a default Formatter interface returned by NewFormatter. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b)) func Fprintln(w io.Writer, a ...interface{}) (n int, err error) { return fmt.Fprintln(w, convertArgs(a)...) } // Print is a wrapper for fmt.Print that treats each argument as if it were // passed with a default Formatter interface returned by NewFormatter. It // returns the number of bytes written and any write error encountered. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b)) func Print(a ...interface{}) (n int, err error) { return fmt.Print(convertArgs(a)...) } // Printf is a wrapper for fmt.Printf that treats each argument as if it were // passed with a default Formatter interface returned by NewFormatter. It // returns the number of bytes written and any write error encountered. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b)) func Printf(format string, a ...interface{}) (n int, err error) { return fmt.Printf(format, convertArgs(a)...) } // Println is a wrapper for fmt.Println that treats each argument as if it were // passed with a default Formatter interface returned by NewFormatter. It // returns the number of bytes written and any write error encountered. See // NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b)) func Println(a ...interface{}) (n int, err error) { return fmt.Println(convertArgs(a)...) } // Sprint is a wrapper for fmt.Sprint that treats each argument as if it were // passed with a default Formatter interface returned by NewFormatter. It // returns the resulting string. See NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b)) func Sprint(a ...interface{}) string { return fmt.Sprint(convertArgs(a)...) } // Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were // passed with a default Formatter interface returned by NewFormatter. It // returns the resulting string. See NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b)) func Sprintf(format string, a ...interface{}) string { return fmt.Sprintf(format, convertArgs(a)...) } // Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it // were passed with a default Formatter interface returned by NewFormatter. It // returns the resulting string. See NewFormatter for formatting details. // // This function is shorthand for the following syntax: // // fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b)) func Sprintln(a ...interface{}) string { return fmt.Sprintln(convertArgs(a)...) } // convertArgs accepts a slice of arguments and returns a slice of the same // length with each argument converted to a default spew Formatter interface. func convertArgs(args []interface{}) (formatters []interface{}) { formatters = make([]interface{}, len(args)) for index, arg := range args { formatters[index] = NewFormatter(arg) } return formatters }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/davecgh/go-spew/spew/common.go
vendor/github.com/davecgh/go-spew/spew/common.go
/* * Copyright (c) 2013-2016 Dave Collins <dave@davec.name> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package spew import ( "bytes" "fmt" "io" "reflect" "sort" "strconv" ) // Some constants in the form of bytes to avoid string overhead. This mirrors // the technique used in the fmt package. var ( panicBytes = []byte("(PANIC=") plusBytes = []byte("+") iBytes = []byte("i") trueBytes = []byte("true") falseBytes = []byte("false") interfaceBytes = []byte("(interface {})") commaNewlineBytes = []byte(",\n") newlineBytes = []byte("\n") openBraceBytes = []byte("{") openBraceNewlineBytes = []byte("{\n") closeBraceBytes = []byte("}") asteriskBytes = []byte("*") colonBytes = []byte(":") colonSpaceBytes = []byte(": ") openParenBytes = []byte("(") closeParenBytes = []byte(")") spaceBytes = []byte(" ") pointerChainBytes = []byte("->") nilAngleBytes = []byte("<nil>") maxNewlineBytes = []byte("<max depth reached>\n") maxShortBytes = []byte("<max>") circularBytes = []byte("<already shown>") circularShortBytes = []byte("<shown>") invalidAngleBytes = []byte("<invalid>") openBracketBytes = []byte("[") closeBracketBytes = []byte("]") percentBytes = []byte("%") precisionBytes = []byte(".") openAngleBytes = []byte("<") closeAngleBytes = []byte(">") openMapBytes = []byte("map[") closeMapBytes = []byte("]") lenEqualsBytes = []byte("len=") capEqualsBytes = []byte("cap=") ) // hexDigits is used to map a decimal value to a hex digit. var hexDigits = "0123456789abcdef" // catchPanic handles any panics that might occur during the handleMethods // calls. func catchPanic(w io.Writer, v reflect.Value) { if err := recover(); err != nil { w.Write(panicBytes) fmt.Fprintf(w, "%v", err) w.Write(closeParenBytes) } } // handleMethods attempts to call the Error and String methods on the underlying // type the passed reflect.Value represents and outputes the result to Writer w. // // It handles panics in any called methods by catching and displaying the error // as the formatted value. func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) { // We need an interface to check if the type implements the error or // Stringer interface. However, the reflect package won't give us an // interface on certain things like unexported struct fields in order // to enforce visibility rules. We use unsafe, when it's available, // to bypass these restrictions since this package does not mutate the // values. if !v.CanInterface() { if UnsafeDisabled { return false } v = unsafeReflectValue(v) } // Choose whether or not to do error and Stringer interface lookups against // the base type or a pointer to the base type depending on settings. // Technically calling one of these methods with a pointer receiver can // mutate the value, however, types which choose to satisify an error or // Stringer interface with a pointer receiver should not be mutating their // state inside these interface methods. if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() { v = unsafeReflectValue(v) } if v.CanAddr() { v = v.Addr() } // Is it an error or Stringer? switch iface := v.Interface().(type) { case error: defer catchPanic(w, v) if cs.ContinueOnMethod { w.Write(openParenBytes) w.Write([]byte(iface.Error())) w.Write(closeParenBytes) w.Write(spaceBytes) return false } w.Write([]byte(iface.Error())) return true case fmt.Stringer: defer catchPanic(w, v) if cs.ContinueOnMethod { w.Write(openParenBytes) w.Write([]byte(iface.String())) w.Write(closeParenBytes) w.Write(spaceBytes) return false } w.Write([]byte(iface.String())) return true } return false } // printBool outputs a boolean value as true or false to Writer w. func printBool(w io.Writer, val bool) { if val { w.Write(trueBytes) } else { w.Write(falseBytes) } } // printInt outputs a signed integer value to Writer w. func printInt(w io.Writer, val int64, base int) { w.Write([]byte(strconv.FormatInt(val, base))) } // printUint outputs an unsigned integer value to Writer w. func printUint(w io.Writer, val uint64, base int) { w.Write([]byte(strconv.FormatUint(val, base))) } // printFloat outputs a floating point value using the specified precision, // which is expected to be 32 or 64bit, to Writer w. func printFloat(w io.Writer, val float64, precision int) { w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision))) } // printComplex outputs a complex value using the specified float precision // for the real and imaginary parts to Writer w. func printComplex(w io.Writer, c complex128, floatPrecision int) { r := real(c) w.Write(openParenBytes) w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision))) i := imag(c) if i >= 0 { w.Write(plusBytes) } w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision))) w.Write(iBytes) w.Write(closeParenBytes) } // printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x' // prefix to Writer w. func printHexPtr(w io.Writer, p uintptr) { // Null pointer. num := uint64(p) if num == 0 { w.Write(nilAngleBytes) return } // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix buf := make([]byte, 18) // It's simpler to construct the hex string right to left. base := uint64(16) i := len(buf) - 1 for num >= base { buf[i] = hexDigits[num%base] num /= base i-- } buf[i] = hexDigits[num] // Add '0x' prefix. i-- buf[i] = 'x' i-- buf[i] = '0' // Strip unused leading bytes. buf = buf[i:] w.Write(buf) } // valuesSorter implements sort.Interface to allow a slice of reflect.Value // elements to be sorted. type valuesSorter struct { values []reflect.Value strings []string // either nil or same len and values cs *ConfigState } // newValuesSorter initializes a valuesSorter instance, which holds a set of // surrogate keys on which the data should be sorted. It uses flags in // ConfigState to decide if and how to populate those surrogate keys. func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface { vs := &valuesSorter{values: values, cs: cs} if canSortSimply(vs.values[0].Kind()) { return vs } if !cs.DisableMethods { vs.strings = make([]string, len(values)) for i := range vs.values { b := bytes.Buffer{} if !handleMethods(cs, &b, vs.values[i]) { vs.strings = nil break } vs.strings[i] = b.String() } } if vs.strings == nil && cs.SpewKeys { vs.strings = make([]string, len(values)) for i := range vs.values { vs.strings[i] = Sprintf("%#v", vs.values[i].Interface()) } } return vs } // canSortSimply tests whether a reflect.Kind is a primitive that can be sorted // directly, or whether it should be considered for sorting by surrogate keys // (if the ConfigState allows it). func canSortSimply(kind reflect.Kind) bool { // This switch parallels valueSortLess, except for the default case. switch kind { case reflect.Bool: return true case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: return true case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: return true case reflect.Float32, reflect.Float64: return true case reflect.String: return true case reflect.Uintptr: return true case reflect.Array: return true } return false } // Len returns the number of values in the slice. It is part of the // sort.Interface implementation. func (s *valuesSorter) Len() int { return len(s.values) } // Swap swaps the values at the passed indices. It is part of the // sort.Interface implementation. func (s *valuesSorter) Swap(i, j int) { s.values[i], s.values[j] = s.values[j], s.values[i] if s.strings != nil { s.strings[i], s.strings[j] = s.strings[j], s.strings[i] } } // valueSortLess returns whether the first value should sort before the second // value. It is used by valueSorter.Less as part of the sort.Interface // implementation. func valueSortLess(a, b reflect.Value) bool { switch a.Kind() { case reflect.Bool: return !a.Bool() && b.Bool() case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: return a.Int() < b.Int() case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: return a.Uint() < b.Uint() case reflect.Float32, reflect.Float64: return a.Float() < b.Float() case reflect.String: return a.String() < b.String() case reflect.Uintptr: return a.Uint() < b.Uint() case reflect.Array: // Compare the contents of both arrays. l := a.Len() for i := 0; i < l; i++ { av := a.Index(i) bv := b.Index(i) if av.Interface() == bv.Interface() { continue } return valueSortLess(av, bv) } } return a.String() < b.String() } // Less returns whether the value at index i should sort before the // value at index j. It is part of the sort.Interface implementation. func (s *valuesSorter) Less(i, j int) bool { if s.strings == nil { return valueSortLess(s.values[i], s.values[j]) } return s.strings[i] < s.strings[j] } // sortValues is a sort function that handles both native types and any type that // can be converted to error or Stringer. Other inputs are sorted according to // their Value.String() value to ensure display stability. func sortValues(values []reflect.Value, cs *ConfigState) { if len(values) == 0 { return } sort.Sort(newValuesSorter(values, cs)) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/mitchellh/go-ps/process_freebsd.go
vendor/github.com/mitchellh/go-ps/process_freebsd.go
// +build freebsd package ps import ( "bytes" "encoding/binary" "syscall" "unsafe" ) // copied from sys/sysctl.h const ( CTL_KERN = 1 // "high kernel": proc, limits KERN_PROC = 14 // struct: process entries KERN_PROC_PID = 1 // by process id KERN_PROC_PROC = 8 // only return procs KERN_PROC_PATHNAME = 12 // path to executable ) // copied from sys/user.h type Kinfo_proc struct { Ki_structsize int32 Ki_layout int32 Ki_args int64 Ki_paddr int64 Ki_addr int64 Ki_tracep int64 Ki_textvp int64 Ki_fd int64 Ki_vmspace int64 Ki_wchan int64 Ki_pid int32 Ki_ppid int32 Ki_pgid int32 Ki_tpgid int32 Ki_sid int32 Ki_tsid int32 Ki_jobc [2]byte Ki_spare_short1 [2]byte Ki_tdev int32 Ki_siglist [16]byte Ki_sigmask [16]byte Ki_sigignore [16]byte Ki_sigcatch [16]byte Ki_uid int32 Ki_ruid int32 Ki_svuid int32 Ki_rgid int32 Ki_svgid int32 Ki_ngroups [2]byte Ki_spare_short2 [2]byte Ki_groups [64]byte Ki_size int64 Ki_rssize int64 Ki_swrss int64 Ki_tsize int64 Ki_dsize int64 Ki_ssize int64 Ki_xstat [2]byte Ki_acflag [2]byte Ki_pctcpu int32 Ki_estcpu int32 Ki_slptime int32 Ki_swtime int32 Ki_cow int32 Ki_runtime int64 Ki_start [16]byte Ki_childtime [16]byte Ki_flag int64 Ki_kiflag int64 Ki_traceflag int32 Ki_stat [1]byte Ki_nice [1]byte Ki_lock [1]byte Ki_rqindex [1]byte Ki_oncpu [1]byte Ki_lastcpu [1]byte Ki_ocomm [17]byte Ki_wmesg [9]byte Ki_login [18]byte Ki_lockname [9]byte Ki_comm [20]byte Ki_emul [17]byte Ki_sparestrings [68]byte Ki_spareints [36]byte Ki_cr_flags int32 Ki_jid int32 Ki_numthreads int32 Ki_tid int32 Ki_pri int32 Ki_rusage [144]byte Ki_rusage_ch [144]byte Ki_pcb int64 Ki_kstack int64 Ki_udata int64 Ki_tdaddr int64 Ki_spareptrs [48]byte Ki_spareint64s [96]byte Ki_sflag int64 Ki_tdflags int64 } // UnixProcess is an implementation of Process that contains Unix-specific // fields and information. type UnixProcess struct { pid int ppid int state rune pgrp int sid int binary string } func (p *UnixProcess) Pid() int { return p.pid } func (p *UnixProcess) PPid() int { return p.ppid } func (p *UnixProcess) Executable() string { return p.binary } // Refresh reloads all the data associated with this process. func (p *UnixProcess) Refresh() error { mib := []int32{CTL_KERN, KERN_PROC, KERN_PROC_PID, int32(p.pid)} buf, length, err := call_syscall(mib) if err != nil { return err } proc_k := Kinfo_proc{} if length != uint64(unsafe.Sizeof(proc_k)) { return err } k, err := parse_kinfo_proc(buf) if err != nil { return err } p.ppid, p.pgrp, p.sid, p.binary = copy_params(&k) return nil } func copy_params(k *Kinfo_proc) (int, int, int, string) { n := -1 for i, b := range k.Ki_comm { if b == 0 { break } n = i + 1 } comm := string(k.Ki_comm[:n]) return int(k.Ki_ppid), int(k.Ki_pgid), int(k.Ki_sid), comm } func findProcess(pid int) (Process, error) { mib := []int32{CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, int32(pid)} _, _, err := call_syscall(mib) if err != nil { return nil, err } return newUnixProcess(pid) } func processes() ([]Process, error) { results := make([]Process, 0, 50) mib := []int32{CTL_KERN, KERN_PROC, KERN_PROC_PROC, 0} buf, length, err := call_syscall(mib) if err != nil { return results, err } // get kinfo_proc size k := Kinfo_proc{} procinfo_len := int(unsafe.Sizeof(k)) count := int(length / uint64(procinfo_len)) // parse buf to procs for i := 0; i < count; i++ { b := buf[i*procinfo_len : i*procinfo_len+procinfo_len] k, err := parse_kinfo_proc(b) if err != nil { continue } p, err := newUnixProcess(int(k.Ki_pid)) if err != nil { continue } p.ppid, p.pgrp, p.sid, p.binary = copy_params(&k) results = append(results, p) } return results, nil } func parse_kinfo_proc(buf []byte) (Kinfo_proc, error) { var k Kinfo_proc br := bytes.NewReader(buf) err := binary.Read(br, binary.LittleEndian, &k) if err != nil { return k, err } return k, nil } func call_syscall(mib []int32) ([]byte, uint64, error) { miblen := uint64(len(mib)) // get required buffer size length := uint64(0) _, _, err := syscall.RawSyscall6( syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), uintptr(miblen), 0, uintptr(unsafe.Pointer(&length)), 0, 0) if err != 0 { b := make([]byte, 0) return b, length, err } if length == 0 { b := make([]byte, 0) return b, length, err } // get proc info itself buf := make([]byte, length) _, _, err = syscall.RawSyscall6( syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), uintptr(miblen), uintptr(unsafe.Pointer(&buf[0])), uintptr(unsafe.Pointer(&length)), 0, 0) if err != 0 { return buf, length, err } return buf, length, nil } func newUnixProcess(pid int) (*UnixProcess, error) { p := &UnixProcess{pid: pid} return p, p.Refresh() }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/mitchellh/go-ps/process_darwin.go
vendor/github.com/mitchellh/go-ps/process_darwin.go
// +build darwin package ps import ( "bytes" "encoding/binary" "syscall" "unsafe" ) type DarwinProcess struct { pid int ppid int binary string } func (p *DarwinProcess) Pid() int { return p.pid } func (p *DarwinProcess) PPid() int { return p.ppid } func (p *DarwinProcess) Executable() string { return p.binary } func findProcess(pid int) (Process, error) { ps, err := processes() if err != nil { return nil, err } for _, p := range ps { if p.Pid() == pid { return p, nil } } return nil, nil } func processes() ([]Process, error) { buf, err := darwinSyscall() if err != nil { return nil, err } procs := make([]*kinfoProc, 0, 50) k := 0 for i := _KINFO_STRUCT_SIZE; i < buf.Len(); i += _KINFO_STRUCT_SIZE { proc := &kinfoProc{} err = binary.Read(bytes.NewBuffer(buf.Bytes()[k:i]), binary.LittleEndian, proc) if err != nil { return nil, err } k = i procs = append(procs, proc) } darwinProcs := make([]Process, len(procs)) for i, p := range procs { darwinProcs[i] = &DarwinProcess{ pid: int(p.Pid), ppid: int(p.PPid), binary: darwinCstring(p.Comm), } } return darwinProcs, nil } func darwinCstring(s [16]byte) string { i := 0 for _, b := range s { if b != 0 { i++ } else { break } } return string(s[:i]) } func darwinSyscall() (*bytes.Buffer, error) { mib := [4]int32{_CTRL_KERN, _KERN_PROC, _KERN_PROC_ALL, 0} size := uintptr(0) _, _, errno := syscall.Syscall6( syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 4, 0, uintptr(unsafe.Pointer(&size)), 0, 0) if errno != 0 { return nil, errno } bs := make([]byte, size) _, _, errno = syscall.Syscall6( syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 4, uintptr(unsafe.Pointer(&bs[0])), uintptr(unsafe.Pointer(&size)), 0, 0) if errno != 0 { return nil, errno } return bytes.NewBuffer(bs[0:size]), nil } const ( _CTRL_KERN = 1 _KERN_PROC = 14 _KERN_PROC_ALL = 0 _KINFO_STRUCT_SIZE = 648 ) type kinfoProc struct { _ [40]byte Pid int32 _ [199]byte Comm [16]byte _ [301]byte PPid int32 _ [84]byte }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/mitchellh/go-ps/process_linux.go
vendor/github.com/mitchellh/go-ps/process_linux.go
// +build linux package ps import ( "fmt" "io/ioutil" "strings" ) // Refresh reloads all the data associated with this process. func (p *UnixProcess) Refresh() error { statPath := fmt.Sprintf("/proc/%d/stat", p.pid) dataBytes, err := ioutil.ReadFile(statPath) if err != nil { return err } // First, parse out the image name data := string(dataBytes) binStart := strings.IndexRune(data, '(') + 1 binEnd := strings.IndexRune(data[binStart:], ')') p.binary = data[binStart : binStart+binEnd] // Move past the image name and start parsing the rest data = data[binStart+binEnd+2:] _, err = fmt.Sscanf(data, "%c %d %d %d", &p.state, &p.ppid, &p.pgrp, &p.sid) return err }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/mitchellh/go-ps/process_windows.go
vendor/github.com/mitchellh/go-ps/process_windows.go
// +build windows package ps import ( "fmt" "syscall" "unsafe" ) // Windows API functions var ( modKernel32 = syscall.NewLazyDLL("kernel32.dll") procCloseHandle = modKernel32.NewProc("CloseHandle") procCreateToolhelp32Snapshot = modKernel32.NewProc("CreateToolhelp32Snapshot") procProcess32First = modKernel32.NewProc("Process32FirstW") procProcess32Next = modKernel32.NewProc("Process32NextW") ) // Some constants from the Windows API const ( ERROR_NO_MORE_FILES = 0x12 MAX_PATH = 260 ) // PROCESSENTRY32 is the Windows API structure that contains a process's // information. type PROCESSENTRY32 struct { Size uint32 CntUsage uint32 ProcessID uint32 DefaultHeapID uintptr ModuleID uint32 CntThreads uint32 ParentProcessID uint32 PriorityClassBase int32 Flags uint32 ExeFile [MAX_PATH]uint16 } // WindowsProcess is an implementation of Process for Windows. type WindowsProcess struct { pid int ppid int exe string } func (p *WindowsProcess) Pid() int { return p.pid } func (p *WindowsProcess) PPid() int { return p.ppid } func (p *WindowsProcess) Executable() string { return p.exe } func newWindowsProcess(e *PROCESSENTRY32) *WindowsProcess { // Find when the string ends for decoding end := 0 for { if e.ExeFile[end] == 0 { break } end++ } return &WindowsProcess{ pid: int(e.ProcessID), ppid: int(e.ParentProcessID), exe: syscall.UTF16ToString(e.ExeFile[:end]), } } func findProcess(pid int) (Process, error) { ps, err := processes() if err != nil { return nil, err } for _, p := range ps { if p.Pid() == pid { return p, nil } } return nil, nil } func processes() ([]Process, error) { handle, _, _ := procCreateToolhelp32Snapshot.Call( 0x00000002, 0) if handle < 0 { return nil, syscall.GetLastError() } defer procCloseHandle.Call(handle) var entry PROCESSENTRY32 entry.Size = uint32(unsafe.Sizeof(entry)) ret, _, _ := procProcess32First.Call(handle, uintptr(unsafe.Pointer(&entry))) if ret == 0 { return nil, fmt.Errorf("Error retrieving process info.") } results := make([]Process, 0, 50) for { results = append(results, newWindowsProcess(&entry)) ret, _, _ := procProcess32Next.Call(handle, uintptr(unsafe.Pointer(&entry))) if ret == 0 { break } } return results, nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/mitchellh/go-ps/process.go
vendor/github.com/mitchellh/go-ps/process.go
// ps provides an API for finding and listing processes in a platform-agnostic // way. // // NOTE: If you're reading these docs online via GoDocs or some other system, // you might only see the Unix docs. This project makes heavy use of // platform-specific implementations. We recommend reading the source if you // are interested. package ps // Process is the generic interface that is implemented on every platform // and provides common operations for processes. type Process interface { // Pid is the process ID for this process. Pid() int // PPid is the parent process ID for this process. PPid() int // Executable name running this process. This is not a path to the // executable. Executable() string } // Processes returns all processes. // // This of course will be a point-in-time snapshot of when this method was // called. Some operating systems don't provide snapshot capability of the // process table, in which case the process table returned might contain // ephemeral entities that happened to be running when this was called. func Processes() ([]Process, error) { return processes() } // FindProcess looks up a single process by pid. // // Process will be nil and error will be nil if a matching process is // not found. func FindProcess(pid int) (Process, error) { return findProcess(pid) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/mitchellh/go-ps/process_solaris.go
vendor/github.com/mitchellh/go-ps/process_solaris.go
// +build solaris package ps import ( "encoding/binary" "fmt" "os" ) type ushort_t uint16 type id_t int32 type pid_t int32 type uid_t int32 type gid_t int32 type dev_t uint64 type size_t uint64 type uintptr_t uint64 type timestruc_t [16]byte // This is copy from /usr/include/sys/procfs.h type psinfo_t struct { Pr_flag int32 /* process flags (DEPRECATED; do not use) */ Pr_nlwp int32 /* number of active lwps in the process */ Pr_pid pid_t /* unique process id */ Pr_ppid pid_t /* process id of parent */ Pr_pgid pid_t /* pid of process group leader */ Pr_sid pid_t /* session id */ Pr_uid uid_t /* real user id */ Pr_euid uid_t /* effective user id */ Pr_gid gid_t /* real group id */ Pr_egid gid_t /* effective group id */ Pr_addr uintptr_t /* address of process */ Pr_size size_t /* size of process image in Kbytes */ Pr_rssize size_t /* resident set size in Kbytes */ Pr_pad1 size_t Pr_ttydev dev_t /* controlling tty device (or PRNODEV) */ // Guess this following 2 ushort_t values require a padding to properly // align to the 64bit mark. Pr_pctcpu ushort_t /* % of recent cpu time used by all lwps */ Pr_pctmem ushort_t /* % of system memory used by process */ Pr_pad64bit [4]byte Pr_start timestruc_t /* process start time, from the epoch */ Pr_time timestruc_t /* usr+sys cpu time for this process */ Pr_ctime timestruc_t /* usr+sys cpu time for reaped children */ Pr_fname [16]byte /* name of execed file */ Pr_psargs [80]byte /* initial characters of arg list */ Pr_wstat int32 /* if zombie, the wait() status */ Pr_argc int32 /* initial argument count */ Pr_argv uintptr_t /* address of initial argument vector */ Pr_envp uintptr_t /* address of initial environment vector */ Pr_dmodel [1]byte /* data model of the process */ Pr_pad2 [3]byte Pr_taskid id_t /* task id */ Pr_projid id_t /* project id */ Pr_nzomb int32 /* number of zombie lwps in the process */ Pr_poolid id_t /* pool id */ Pr_zoneid id_t /* zone id */ Pr_contract id_t /* process contract */ Pr_filler int32 /* reserved for future use */ Pr_lwp [128]byte /* information for representative lwp */ } func (p *UnixProcess) Refresh() error { var psinfo psinfo_t path := fmt.Sprintf("/proc/%d/psinfo", p.pid) fh, err := os.Open(path) if err != nil { return err } defer fh.Close() err = binary.Read(fh, binary.LittleEndian, &psinfo) if err != nil { return err } p.ppid = int(psinfo.Pr_ppid) p.binary = toString(psinfo.Pr_fname[:], 16) return nil } func toString(array []byte, len int) string { for i := 0; i < len; i++ { if array[i] == 0 { return string(array[:i]) } } return string(array[:]) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/mitchellh/go-ps/process_unix.go
vendor/github.com/mitchellh/go-ps/process_unix.go
// +build linux solaris package ps import ( "fmt" "io" "os" "strconv" ) // UnixProcess is an implementation of Process that contains Unix-specific // fields and information. type UnixProcess struct { pid int ppid int state rune pgrp int sid int binary string } func (p *UnixProcess) Pid() int { return p.pid } func (p *UnixProcess) PPid() int { return p.ppid } func (p *UnixProcess) Executable() string { return p.binary } func findProcess(pid int) (Process, error) { dir := fmt.Sprintf("/proc/%d", pid) _, err := os.Stat(dir) if err != nil { if os.IsNotExist(err) { return nil, nil } return nil, err } return newUnixProcess(pid) } func processes() ([]Process, error) { d, err := os.Open("/proc") if err != nil { return nil, err } defer d.Close() results := make([]Process, 0, 50) for { names, err := d.Readdirnames(10) if err == io.EOF { break } if err != nil { return nil, err } for _, name := range names { // We only care if the name starts with a numeric if name[0] < '0' || name[0] > '9' { continue } // From this point forward, any errors we just ignore, because // it might simply be that the process doesn't exist anymore. pid, err := strconv.ParseInt(name, 10, 0) if err != nil { continue } p, err := newUnixProcess(int(pid)) if err != nil { continue } results = append(results, p) } } return results, nil } func newUnixProcess(pid int) (*UnixProcess, error) { p := &UnixProcess{pid: pid} return p, p.Refresh() }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/fatih/color/color.go
vendor/github.com/fatih/color/color.go
package color import ( "fmt" "io" "os" "strconv" "strings" "sync" "github.com/mattn/go-colorable" "github.com/mattn/go-isatty" ) var ( // NoColor defines if the output is colorized or not. It's dynamically set to // false or true based on the stdout's file descriptor referring to a terminal // or not. This is a global option and affects all colors. For more control // over each color block use the methods DisableColor() individually. NoColor = os.Getenv("TERM") == "dumb" || (!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd())) // Output defines the standard output of the print functions. By default // os.Stdout is used. Output = colorable.NewColorableStdout() // Error defines a color supporting writer for os.Stderr. Error = colorable.NewColorableStderr() // colorsCache is used to reduce the count of created Color objects and // allows to reuse already created objects with required Attribute. colorsCache = make(map[Attribute]*Color) colorsCacheMu sync.Mutex // protects colorsCache ) // Color defines a custom color object which is defined by SGR parameters. type Color struct { params []Attribute noColor *bool } // Attribute defines a single SGR Code type Attribute int const escape = "\x1b" // Base attributes const ( Reset Attribute = iota Bold Faint Italic Underline BlinkSlow BlinkRapid ReverseVideo Concealed CrossedOut ) // Foreground text colors const ( FgBlack Attribute = iota + 30 FgRed FgGreen FgYellow FgBlue FgMagenta FgCyan FgWhite ) // Foreground Hi-Intensity text colors const ( FgHiBlack Attribute = iota + 90 FgHiRed FgHiGreen FgHiYellow FgHiBlue FgHiMagenta FgHiCyan FgHiWhite ) // Background text colors const ( BgBlack Attribute = iota + 40 BgRed BgGreen BgYellow BgBlue BgMagenta BgCyan BgWhite ) // Background Hi-Intensity text colors const ( BgHiBlack Attribute = iota + 100 BgHiRed BgHiGreen BgHiYellow BgHiBlue BgHiMagenta BgHiCyan BgHiWhite ) // New returns a newly created color object. func New(value ...Attribute) *Color { c := &Color{params: make([]Attribute, 0)} c.Add(value...) return c } // Set sets the given parameters immediately. It will change the color of // output with the given SGR parameters until color.Unset() is called. func Set(p ...Attribute) *Color { c := New(p...) c.Set() return c } // Unset resets all escape attributes and clears the output. Usually should // be called after Set(). func Unset() { if NoColor { return } fmt.Fprintf(Output, "%s[%dm", escape, Reset) } // Set sets the SGR sequence. func (c *Color) Set() *Color { if c.isNoColorSet() { return c } fmt.Fprintf(Output, c.format()) return c } func (c *Color) unset() { if c.isNoColorSet() { return } Unset() } func (c *Color) setWriter(w io.Writer) *Color { if c.isNoColorSet() { return c } fmt.Fprintf(w, c.format()) return c } func (c *Color) unsetWriter(w io.Writer) { if c.isNoColorSet() { return } if NoColor { return } fmt.Fprintf(w, "%s[%dm", escape, Reset) } // Add is used to chain SGR parameters. Use as many as parameters to combine // and create custom color objects. Example: Add(color.FgRed, color.Underline). func (c *Color) Add(value ...Attribute) *Color { c.params = append(c.params, value...) return c } func (c *Color) prepend(value Attribute) { c.params = append(c.params, 0) copy(c.params[1:], c.params[0:]) c.params[0] = value } // Fprint formats using the default formats for its operands and writes to w. // Spaces are added between operands when neither is a string. // It returns the number of bytes written and any write error encountered. // On Windows, users should wrap w with colorable.NewColorable() if w is of // type *os.File. func (c *Color) Fprint(w io.Writer, a ...interface{}) (n int, err error) { c.setWriter(w) defer c.unsetWriter(w) return fmt.Fprint(w, a...) } // Print formats using the default formats for its operands and writes to // standard output. Spaces are added between operands when neither is a // string. It returns the number of bytes written and any write error // encountered. This is the standard fmt.Print() method wrapped with the given // color. func (c *Color) Print(a ...interface{}) (n int, err error) { c.Set() defer c.unset() return fmt.Fprint(Output, a...) } // Fprintf formats according to a format specifier and writes to w. // It returns the number of bytes written and any write error encountered. // On Windows, users should wrap w with colorable.NewColorable() if w is of // type *os.File. func (c *Color) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { c.setWriter(w) defer c.unsetWriter(w) return fmt.Fprintf(w, format, a...) } // Printf formats according to a format specifier and writes to standard output. // It returns the number of bytes written and any write error encountered. // This is the standard fmt.Printf() method wrapped with the given color. func (c *Color) Printf(format string, a ...interface{}) (n int, err error) { c.Set() defer c.unset() return fmt.Fprintf(Output, format, a...) } // Fprintln formats using the default formats for its operands and writes to w. // Spaces are always added between operands and a newline is appended. // On Windows, users should wrap w with colorable.NewColorable() if w is of // type *os.File. func (c *Color) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { c.setWriter(w) defer c.unsetWriter(w) return fmt.Fprintln(w, a...) } // Println formats using the default formats for its operands and writes to // standard output. Spaces are always added between operands and a newline is // appended. It returns the number of bytes written and any write error // encountered. This is the standard fmt.Print() method wrapped with the given // color. func (c *Color) Println(a ...interface{}) (n int, err error) { c.Set() defer c.unset() return fmt.Fprintln(Output, a...) } // Sprint is just like Print, but returns a string instead of printing it. func (c *Color) Sprint(a ...interface{}) string { return c.wrap(fmt.Sprint(a...)) } // Sprintln is just like Println, but returns a string instead of printing it. func (c *Color) Sprintln(a ...interface{}) string { return c.wrap(fmt.Sprintln(a...)) } // Sprintf is just like Printf, but returns a string instead of printing it. func (c *Color) Sprintf(format string, a ...interface{}) string { return c.wrap(fmt.Sprintf(format, a...)) } // FprintFunc returns a new function that prints the passed arguments as // colorized with color.Fprint(). func (c *Color) FprintFunc() func(w io.Writer, a ...interface{}) { return func(w io.Writer, a ...interface{}) { c.Fprint(w, a...) } } // PrintFunc returns a new function that prints the passed arguments as // colorized with color.Print(). func (c *Color) PrintFunc() func(a ...interface{}) { return func(a ...interface{}) { c.Print(a...) } } // FprintfFunc returns a new function that prints the passed arguments as // colorized with color.Fprintf(). func (c *Color) FprintfFunc() func(w io.Writer, format string, a ...interface{}) { return func(w io.Writer, format string, a ...interface{}) { c.Fprintf(w, format, a...) } } // PrintfFunc returns a new function that prints the passed arguments as // colorized with color.Printf(). func (c *Color) PrintfFunc() func(format string, a ...interface{}) { return func(format string, a ...interface{}) { c.Printf(format, a...) } } // FprintlnFunc returns a new function that prints the passed arguments as // colorized with color.Fprintln(). func (c *Color) FprintlnFunc() func(w io.Writer, a ...interface{}) { return func(w io.Writer, a ...interface{}) { c.Fprintln(w, a...) } } // PrintlnFunc returns a new function that prints the passed arguments as // colorized with color.Println(). func (c *Color) PrintlnFunc() func(a ...interface{}) { return func(a ...interface{}) { c.Println(a...) } } // SprintFunc returns a new function that returns colorized strings for the // given arguments with fmt.Sprint(). Useful to put into or mix into other // string. Windows users should use this in conjunction with color.Output, example: // // put := New(FgYellow).SprintFunc() // fmt.Fprintf(color.Output, "This is a %s", put("warning")) func (c *Color) SprintFunc() func(a ...interface{}) string { return func(a ...interface{}) string { return c.wrap(fmt.Sprint(a...)) } } // SprintfFunc returns a new function that returns colorized strings for the // given arguments with fmt.Sprintf(). Useful to put into or mix into other // string. Windows users should use this in conjunction with color.Output. func (c *Color) SprintfFunc() func(format string, a ...interface{}) string { return func(format string, a ...interface{}) string { return c.wrap(fmt.Sprintf(format, a...)) } } // SprintlnFunc returns a new function that returns colorized strings for the // given arguments with fmt.Sprintln(). Useful to put into or mix into other // string. Windows users should use this in conjunction with color.Output. func (c *Color) SprintlnFunc() func(a ...interface{}) string { return func(a ...interface{}) string { return c.wrap(fmt.Sprintln(a...)) } } // sequence returns a formatted SGR sequence to be plugged into a "\x1b[...m" // an example output might be: "1;36" -> bold cyan func (c *Color) sequence() string { format := make([]string, len(c.params)) for i, v := range c.params { format[i] = strconv.Itoa(int(v)) } return strings.Join(format, ";") } // wrap wraps the s string with the colors attributes. The string is ready to // be printed. func (c *Color) wrap(s string) string { if c.isNoColorSet() { return s } return c.format() + s + c.unformat() } func (c *Color) format() string { return fmt.Sprintf("%s[%sm", escape, c.sequence()) } func (c *Color) unformat() string { return fmt.Sprintf("%s[%dm", escape, Reset) } // DisableColor disables the color output. Useful to not change any existing // code and still being able to output. Can be used for flags like // "--no-color". To enable back use EnableColor() method. func (c *Color) DisableColor() { c.noColor = boolPtr(true) } // EnableColor enables the color output. Use it in conjunction with // DisableColor(). Otherwise this method has no side effects. func (c *Color) EnableColor() { c.noColor = boolPtr(false) } func (c *Color) isNoColorSet() bool { // check first if we have user setted action if c.noColor != nil { return *c.noColor } // if not return the global option, which is disabled by default return NoColor } // Equals returns a boolean value indicating whether two colors are equal. func (c *Color) Equals(c2 *Color) bool { if len(c.params) != len(c2.params) { return false } for _, attr := range c.params { if !c2.attrExists(attr) { return false } } return true } func (c *Color) attrExists(a Attribute) bool { for _, attr := range c.params { if attr == a { return true } } return false } func boolPtr(v bool) *bool { return &v } func getCachedColor(p Attribute) *Color { colorsCacheMu.Lock() defer colorsCacheMu.Unlock() c, ok := colorsCache[p] if !ok { c = New(p) colorsCache[p] = c } return c } func colorPrint(format string, p Attribute, a ...interface{}) { c := getCachedColor(p) if !strings.HasSuffix(format, "\n") { format += "\n" } if len(a) == 0 { c.Print(format) } else { c.Printf(format, a...) } } func colorString(format string, p Attribute, a ...interface{}) string { c := getCachedColor(p) if len(a) == 0 { return c.SprintFunc()(format) } return c.SprintfFunc()(format, a...) } // Black is a convenient helper function to print with black foreground. A // newline is appended to format by default. func Black(format string, a ...interface{}) { colorPrint(format, FgBlack, a...) } // Red is a convenient helper function to print with red foreground. A // newline is appended to format by default. func Red(format string, a ...interface{}) { colorPrint(format, FgRed, a...) } // Green is a convenient helper function to print with green foreground. A // newline is appended to format by default. func Green(format string, a ...interface{}) { colorPrint(format, FgGreen, a...) } // Yellow is a convenient helper function to print with yellow foreground. // A newline is appended to format by default. func Yellow(format string, a ...interface{}) { colorPrint(format, FgYellow, a...) } // Blue is a convenient helper function to print with blue foreground. A // newline is appended to format by default. func Blue(format string, a ...interface{}) { colorPrint(format, FgBlue, a...) } // Magenta is a convenient helper function to print with magenta foreground. // A newline is appended to format by default. func Magenta(format string, a ...interface{}) { colorPrint(format, FgMagenta, a...) } // Cyan is a convenient helper function to print with cyan foreground. A // newline is appended to format by default. func Cyan(format string, a ...interface{}) { colorPrint(format, FgCyan, a...) } // White is a convenient helper function to print with white foreground. A // newline is appended to format by default. func White(format string, a ...interface{}) { colorPrint(format, FgWhite, a...) } // BlackString is a convenient helper function to return a string with black // foreground. func BlackString(format string, a ...interface{}) string { return colorString(format, FgBlack, a...) } // RedString is a convenient helper function to return a string with red // foreground. func RedString(format string, a ...interface{}) string { return colorString(format, FgRed, a...) } // GreenString is a convenient helper function to return a string with green // foreground. func GreenString(format string, a ...interface{}) string { return colorString(format, FgGreen, a...) } // YellowString is a convenient helper function to return a string with yellow // foreground. func YellowString(format string, a ...interface{}) string { return colorString(format, FgYellow, a...) } // BlueString is a convenient helper function to return a string with blue // foreground. func BlueString(format string, a ...interface{}) string { return colorString(format, FgBlue, a...) } // MagentaString is a convenient helper function to return a string with magenta // foreground. func MagentaString(format string, a ...interface{}) string { return colorString(format, FgMagenta, a...) } // CyanString is a convenient helper function to return a string with cyan // foreground. func CyanString(format string, a ...interface{}) string { return colorString(format, FgCyan, a...) } // WhiteString is a convenient helper function to return a string with white // foreground. func WhiteString(format string, a ...interface{}) string { return colorString(format, FgWhite, a...) } // HiBlack is a convenient helper function to print with hi-intensity black foreground. A // newline is appended to format by default. func HiBlack(format string, a ...interface{}) { colorPrint(format, FgHiBlack, a...) } // HiRed is a convenient helper function to print with hi-intensity red foreground. A // newline is appended to format by default. func HiRed(format string, a ...interface{}) { colorPrint(format, FgHiRed, a...) } // HiGreen is a convenient helper function to print with hi-intensity green foreground. A // newline is appended to format by default. func HiGreen(format string, a ...interface{}) { colorPrint(format, FgHiGreen, a...) } // HiYellow is a convenient helper function to print with hi-intensity yellow foreground. // A newline is appended to format by default. func HiYellow(format string, a ...interface{}) { colorPrint(format, FgHiYellow, a...) } // HiBlue is a convenient helper function to print with hi-intensity blue foreground. A // newline is appended to format by default. func HiBlue(format string, a ...interface{}) { colorPrint(format, FgHiBlue, a...) } // HiMagenta is a convenient helper function to print with hi-intensity magenta foreground. // A newline is appended to format by default. func HiMagenta(format string, a ...interface{}) { colorPrint(format, FgHiMagenta, a...) } // HiCyan is a convenient helper function to print with hi-intensity cyan foreground. A // newline is appended to format by default. func HiCyan(format string, a ...interface{}) { colorPrint(format, FgHiCyan, a...) } // HiWhite is a convenient helper function to print with hi-intensity white foreground. A // newline is appended to format by default. func HiWhite(format string, a ...interface{}) { colorPrint(format, FgHiWhite, a...) } // HiBlackString is a convenient helper function to return a string with hi-intensity black // foreground. func HiBlackString(format string, a ...interface{}) string { return colorString(format, FgHiBlack, a...) } // HiRedString is a convenient helper function to return a string with hi-intensity red // foreground. func HiRedString(format string, a ...interface{}) string { return colorString(format, FgHiRed, a...) } // HiGreenString is a convenient helper function to return a string with hi-intensity green // foreground. func HiGreenString(format string, a ...interface{}) string { return colorString(format, FgHiGreen, a...) } // HiYellowString is a convenient helper function to return a string with hi-intensity yellow // foreground. func HiYellowString(format string, a ...interface{}) string { return colorString(format, FgHiYellow, a...) } // HiBlueString is a convenient helper function to return a string with hi-intensity blue // foreground. func HiBlueString(format string, a ...interface{}) string { return colorString(format, FgHiBlue, a...) } // HiMagentaString is a convenient helper function to return a string with hi-intensity magenta // foreground. func HiMagentaString(format string, a ...interface{}) string { return colorString(format, FgHiMagenta, a...) } // HiCyanString is a convenient helper function to return a string with hi-intensity cyan // foreground. func HiCyanString(format string, a ...interface{}) string { return colorString(format, FgHiCyan, a...) } // HiWhiteString is a convenient helper function to return a string with hi-intensity white // foreground. func HiWhiteString(format string, a ...interface{}) string { return colorString(format, FgHiWhite, a...) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/fatih/color/doc.go
vendor/github.com/fatih/color/doc.go
/* Package color is an ANSI color package to output colorized or SGR defined output to the standard output. The API can be used in several way, pick one that suits you. Use simple and default helper functions with predefined foreground colors: color.Cyan("Prints text in cyan.") // a newline will be appended automatically color.Blue("Prints %s in blue.", "text") // More default foreground colors.. color.Red("We have red") color.Yellow("Yellow color too!") color.Magenta("And many others ..") // Hi-intensity colors color.HiGreen("Bright green color.") color.HiBlack("Bright black means gray..") color.HiWhite("Shiny white color!") However there are times where custom color mixes are required. Below are some examples to create custom color objects and use the print functions of each separate color object. // Create a new color object c := color.New(color.FgCyan).Add(color.Underline) c.Println("Prints cyan text with an underline.") // Or just add them to New() d := color.New(color.FgCyan, color.Bold) d.Printf("This prints bold cyan %s\n", "too!.") // Mix up foreground and background colors, create new mixes! red := color.New(color.FgRed) boldRed := red.Add(color.Bold) boldRed.Println("This will print text in bold red.") whiteBackground := red.Add(color.BgWhite) whiteBackground.Println("Red text with White background.") // Use your own io.Writer output color.New(color.FgBlue).Fprintln(myWriter, "blue color!") blue := color.New(color.FgBlue) blue.Fprint(myWriter, "This will print text in blue.") You can create PrintXxx functions to simplify even more: // Create a custom print function for convenient red := color.New(color.FgRed).PrintfFunc() red("warning") red("error: %s", err) // Mix up multiple attributes notice := color.New(color.Bold, color.FgGreen).PrintlnFunc() notice("don't forget this...") You can also FprintXxx functions to pass your own io.Writer: blue := color.New(FgBlue).FprintfFunc() blue(myWriter, "important notice: %s", stars) // Mix up with multiple attributes success := color.New(color.Bold, color.FgGreen).FprintlnFunc() success(myWriter, don't forget this...") Or create SprintXxx functions to mix strings with other non-colorized strings: yellow := New(FgYellow).SprintFunc() red := New(FgRed).SprintFunc() fmt.Printf("this is a %s and this is %s.\n", yellow("warning"), red("error")) info := New(FgWhite, BgGreen).SprintFunc() fmt.Printf("this %s rocks!\n", info("package")) Windows support is enabled by default. All Print functions work as intended. However only for color.SprintXXX functions, user should use fmt.FprintXXX and set the output to color.Output: fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS")) info := New(FgWhite, BgGreen).SprintFunc() fmt.Fprintf(color.Output, "this %s rocks!\n", info("package")) Using with existing code is possible. Just use the Set() method to set the standard output to the given parameters. That way a rewrite of an existing code is not required. // Use handy standard colors. color.Set(color.FgYellow) fmt.Println("Existing text will be now in Yellow") fmt.Printf("This one %s\n", "too") color.Unset() // don't forget to unset // You can mix up parameters color.Set(color.FgMagenta, color.Bold) defer color.Unset() // use it in your function fmt.Println("All text will be now bold magenta.") There might be a case where you want to disable color output (for example to pipe the standard output of your app to somewhere else). `Color` has support to disable colors both globally and for single color definition. For example suppose you have a CLI app and a `--no-color` bool flag. You can easily disable the color output with: var flagNoColor = flag.Bool("no-color", false, "Disable color output") if *flagNoColor { color.NoColor = true // disables colorized output } It also has support for single color definitions (local). You can disable/enable color output on the fly: c := color.New(color.FgCyan) c.Println("Prints cyan text") c.DisableColor() c.Println("This is printed without any color") c.EnableColor() c.Println("This prints again cyan...") */ package color
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/quickstart.go
vendor/github.com/gookit/color/quickstart.go
package color /************************************************************* * quick use color print message *************************************************************/ // Redp print message with Red color func Redp(a ...interface{}) { Red.Print(a...) } // Redln print message line with Red color func Redln(a ...interface{}) { Red.Println(a...) } // Bluep print message with Blue color func Bluep(a ...interface{}) { Blue.Print(a...) } // Blueln print message line with Blue color func Blueln(a ...interface{}) { Blue.Println(a...) } // Cyanp print message with Cyan color func Cyanp(a ...interface{}) { Cyan.Print(a...) } // Cyanln print message line with Cyan color func Cyanln(a ...interface{}) { Cyan.Println(a...) } // Grayp print message with Gray color func Grayp(a ...interface{}) { Gray.Print(a...) } // Grayln print message line with Gray color func Grayln(a ...interface{}) { Gray.Println(a...) } // Greenp print message with Green color func Greenp(a ...interface{}) { Green.Print(a...) } // Greenln print message line with Green color func Greenln(a ...interface{}) { Green.Println(a...) } // Yellowp print message with Yellow color func Yellowp(a ...interface{}) { Yellow.Print(a...) } // Yellowln print message line with Yellow color func Yellowln(a ...interface{}) { Yellow.Println(a...) } // Magentap print message with Magenta color func Magentap(a ...interface{}) { Magenta.Print(a...) } // Magentaln print message line with Magenta color func Magentaln(a ...interface{}) { Magenta.Println(a...) } /************************************************************* * quick use style print message *************************************************************/ // Infof print message with Info style func Infof(format string, a ...interface{}) { Info.Printf(format, a...) } // Infoln print message with Info style func Infoln(a ...interface{}) { Info.Println(a...) } // Errorf print message with Error style func Errorf(format string, a ...interface{}) { Error.Printf(format, a...) } // Errorln print message with Error style func Errorln(a ...interface{}) { Error.Println(a...) } // Warnf print message with Warn style func Warnf(format string, a ...interface{}) { Warn.Printf(format, a...) } // Warnln print message with Warn style func Warnln(a ...interface{}) { Warn.Println(a...) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/color_256.go
vendor/github.com/gookit/color/color_256.go
package color import ( "fmt" "strconv" "strings" ) /* from wikipedia, 256 color: ESC[ … 38;5;<n> … m选择前景色 ESC[ … 48;5;<n> … m选择背景色 0- 7:标准颜色(同 ESC[30–37m) 8- 15:高强度颜色(同 ESC[90–97m) 16-231:6 × 6 × 6 立方(216色): 16 + 36 × r + 6 × g + b (0 ≤ r, g, b ≤ 5) 232-255:从黑到白的24阶灰度色 */ // tpl for 8 bit 256 color(`2^8`) // // format: // ESC[ … 38;5;<n> … m // 选择前景色 // ESC[ … 48;5;<n> … m // 选择背景色 // // example: // fg "\x1b[38;5;242m" // bg "\x1b[48;5;208m" // both "\x1b[38;5;242;48;5;208m" // // links: // https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97#8位 const ( TplFg256 = "38;5;%d" TplBg256 = "48;5;%d" Fg256Pfx = "38;5;" Bg256Pfx = "48;5;" ) /************************************************************* * 8bit(256) Color: Bit8Color Color256 *************************************************************/ // Color256 256 color (8 bit), uint8 range at 0 - 255 // // 颜色值使用10进制和16进制都可 0x98 = 152 // // The color consists of two uint8: // 0: color value // 1: color type; Fg=0, Bg=1, >1: unset value // // example: // fg color: [152, 0] // bg color: [152, 1] // // NOTICE: now support 256 color on windows CMD, PowerShell // lint warn - Name starts with package name type Color256 [2]uint8 type Bit8Color = Color256 // alias var emptyC256 = Color256{1: 99} // Bit8 create a color256 func Bit8(val uint8, isBg ...bool) Color256 { return C256(val, isBg...) } // C256 create a color256 func C256(val uint8, isBg ...bool) Color256 { bc := Color256{val} // mark is bg color if len(isBg) > 0 && isBg[0] { bc[1] = AsBg } return bc } // Set terminal by 256 color code func (c Color256) Set() error { return SetTerminal(c.String()) } // Reset terminal. alias of the ResetTerminal() func (c Color256) Reset() error { return ResetTerminal() } // Print print message func (c Color256) Print(a ...interface{}) { doPrintV2(c.String(), fmt.Sprint(a...)) } // Printf format and print message func (c Color256) Printf(format string, a ...interface{}) { doPrintV2(c.String(), fmt.Sprintf(format, a...)) } // Println print message with newline func (c Color256) Println(a ...interface{}) { doPrintlnV2(c.String(), a) } // Sprint returns rendered message func (c Color256) Sprint(a ...interface{}) string { return RenderCode(c.String(), a...) } // Sprintf returns format and rendered message func (c Color256) Sprintf(format string, a ...interface{}) string { return RenderString(c.String(), fmt.Sprintf(format, a...)) } // C16 convert color-256 to 16 color. func (c Color256) C16() Color { return c.Basic() } // Basic convert color-256 to basic 16 color. func (c Color256) Basic() Color { return Color(c[0]) // TODO } // RGB convert color-256 to RGB color. func (c Color256) RGB() RGBColor { return RGBFromSlice(C256ToRgb(c[0]), c[1] == AsBg) } // RGBColor convert color-256 to RGB color. func (c Color256) RGBColor() RGBColor { return c.RGB() } // Value return color value func (c Color256) Value() uint8 { return c[0] } // Code convert to color code string. eg: "12" func (c Color256) Code() string { return strconv.Itoa(int(c[0])) } // FullCode convert to color code string with prefix. eg: "38;5;12" func (c Color256) FullCode() string { return c.String() } // String convert to color code string with prefix. eg: "38;5;12" func (c Color256) String() string { if c[1] == AsFg { // 0 is Fg // return fmt.Sprintf(TplFg256, c[0]) return Fg256Pfx + strconv.Itoa(int(c[0])) } if c[1] == AsBg { // 1 is Bg // return fmt.Sprintf(TplBg256, c[0]) return Bg256Pfx + strconv.Itoa(int(c[0])) } return "" // empty } // IsFg color func (c Color256) IsFg() bool { return c[1] == AsFg } // ToFg 256 color func (c Color256) ToFg() Color256 { c[1] = AsFg return c } // IsBg color func (c Color256) IsBg() bool { return c[1] == AsBg } // ToBg 256 color func (c Color256) ToBg() Color256 { c[1] = AsBg return c } // IsEmpty value func (c Color256) IsEmpty() bool { return c[1] > 1 } /************************************************************* * 8bit(256) Style *************************************************************/ // Style256 definition // // 前/背景色 // 都是由两位uint8组成, 第一位是色彩值; // 第二位与 Bit8Color 不一样的是,在这里表示是否设置了值 0 未设置 !=0 已设置 type Style256 struct { // p Printer // Name of the style Name string // color options of the style opts Opts // fg and bg color fg, bg Color256 } // S256 create a color256 style // Usage: // s := color.S256() // s := color.S256(132) // fg // s := color.S256(132, 203) // fg and bg func S256(fgAndBg ...uint8) *Style256 { s := &Style256{} vl := len(fgAndBg) if vl > 0 { // with fg s.fg = Color256{fgAndBg[0], 1} if vl > 1 { // and with bg s.bg = Color256{fgAndBg[1], 1} } } return s } // Set fg and bg color value, can also with color options func (s *Style256) Set(fgVal, bgVal uint8, opts ...Color) *Style256 { s.fg = Color256{fgVal, 1} s.bg = Color256{bgVal, 1} s.opts.Add(opts...) return s } // SetBg set bg color value func (s *Style256) SetBg(bgVal uint8) *Style256 { s.bg = Color256{bgVal, 1} return s } // SetFg set fg color value func (s *Style256) SetFg(fgVal uint8) *Style256 { s.fg = Color256{fgVal, 1} return s } // SetOpts set options func (s *Style256) SetOpts(opts Opts) *Style256 { s.opts = opts return s } // AddOpts add options func (s *Style256) AddOpts(opts ...Color) *Style256 { s.opts.Add(opts...) return s } // Print message func (s *Style256) Print(a ...interface{}) { doPrintV2(s.String(), fmt.Sprint(a...)) } // Printf format and print message func (s *Style256) Printf(format string, a ...interface{}) { doPrintV2(s.String(), fmt.Sprintf(format, a...)) } // Println print message with newline func (s *Style256) Println(a ...interface{}) { doPrintlnV2(s.String(), a) } // Sprint returns rendered message func (s *Style256) Sprint(a ...interface{}) string { return RenderCode(s.Code(), a...) } // Sprintf returns format and rendered message func (s *Style256) Sprintf(format string, a ...interface{}) string { return RenderString(s.Code(), fmt.Sprintf(format, a...)) } // Code convert to color code string func (s *Style256) Code() string { return s.String() } // String convert to color code string func (s *Style256) String() string { var ss []string if s.fg[1] > 0 { ss = append(ss, fmt.Sprintf(TplFg256, s.fg[0])) } if s.bg[1] > 0 { ss = append(ss, fmt.Sprintf(TplBg256, s.bg[0])) } if s.opts.IsValid() { ss = append(ss, s.opts.String()) } return strings.Join(ss, ";") }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/utils.go
vendor/github.com/gookit/color/utils.go
package color import ( "fmt" "io" "log" "strings" ) // SetTerminal by given code. func SetTerminal(code string) error { if !Enable || !SupportColor() { return nil } _, err := fmt.Fprintf(output, SettingTpl, code) return err } // ResetTerminal terminal setting. func ResetTerminal() error { if !Enable || !SupportColor() { return nil } _, err := fmt.Fprint(output, ResetSet) return err } /************************************************************* * print methods(will auto parse color tags) *************************************************************/ // Print render color tag and print messages func Print(a ...interface{}) { Fprint(output, a...) } // Printf format and print messages func Printf(format string, a ...interface{}) { Fprintf(output, format, a...) } // Println messages with new line func Println(a ...interface{}) { Fprintln(output, a...) } // Fprint print rendered messages to writer // Notice: will ignore print error func Fprint(w io.Writer, a ...interface{}) { _, err := fmt.Fprint(w, Render(a...)) saveInternalError(err) // if isLikeInCmd { // renderColorCodeOnCmd(func() { // _, _ = fmt.Fprint(w, Render(a...)) // }) // } else { // _, _ = fmt.Fprint(w, Render(a...)) // } } // Fprintf print format and rendered messages to writer. // Notice: will ignore print error func Fprintf(w io.Writer, format string, a ...interface{}) { str := fmt.Sprintf(format, a...) _, err := fmt.Fprint(w, ReplaceTag(str)) saveInternalError(err) } // Fprintln print rendered messages line to writer // Notice: will ignore print error func Fprintln(w io.Writer, a ...interface{}) { str := formatArgsForPrintln(a) _, err := fmt.Fprintln(w, ReplaceTag(str)) saveInternalError(err) } // Lprint passes colored messages to a log.Logger for printing. // Notice: should be goroutine safe func Lprint(l *log.Logger, a ...interface{}) { l.Print(Render(a...)) } // Render parse color tags, return rendered string. // Usage: // text := Render("<info>hello</> <cyan>world</>!") // fmt.Println(text) func Render(a ...interface{}) string { if len(a) == 0 { return "" } return ReplaceTag(fmt.Sprint(a...)) } // Sprint parse color tags, return rendered string func Sprint(a ...interface{}) string { if len(a) == 0 { return "" } return ReplaceTag(fmt.Sprint(a...)) } // Sprintf format and return rendered string func Sprintf(format string, a ...interface{}) string { return ReplaceTag(fmt.Sprintf(format, a...)) } // String alias of the ReplaceTag func String(s string) string { return ReplaceTag(s) } // Text alias of the ReplaceTag func Text(s string) string { return ReplaceTag(s) } /************************************************************* * helper methods for print *************************************************************/ // new implementation, support render full color code on pwsh.exe, cmd.exe func doPrintV2(code, str string) { _, err := fmt.Fprint(output, RenderString(code, str)) saveInternalError(err) // if isLikeInCmd { // renderColorCodeOnCmd(func() { // _, _ = fmt.Fprint(output, RenderString(code, str)) // }) // } else { // _, _ = fmt.Fprint(output, RenderString(code, str)) // } } // new implementation, support render full color code on pwsh.exe, cmd.exe func doPrintlnV2(code string, args []interface{}) { str := formatArgsForPrintln(args) _, err := fmt.Fprintln(output, RenderString(code, str)) saveInternalError(err) } // if use Println, will add spaces for each arg func formatArgsForPrintln(args []interface{}) (message string) { if ln := len(args); ln == 0 { message = "" } else if ln == 1 { message = fmt.Sprint(args[0]) } else { message = fmt.Sprintln(args...) // clear last "\n" message = message[:len(message)-1] } return } /************************************************************* * helper methods *************************************************************/ // is on debug mode // func isDebugMode() bool { // return debugMode == "on" // } func debugf(f string, v ...interface{}) { if debugMode { fmt.Print("COLOR_DEBUG: ") fmt.Printf(f, v...) fmt.Println() } } // equals: return ok ? val1 : val2 func compareVal(ok bool, val1, val2 uint8) uint8 { if ok { return val1 } return val2 } func saveInternalError(err error) { if err != nil { debugf("inner error: %s", err.Error()) innerErrs = append(innerErrs, err) } } func stringToArr(str, sep string) (arr []string) { str = strings.TrimSpace(str) if str == "" { return } ss := strings.Split(str, sep) for _, val := range ss { if val = strings.TrimSpace(val); val != "" { arr = append(arr, val) } } return }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/color_16.go
vendor/github.com/gookit/color/color_16.go
package color import ( "fmt" "strconv" ) // Color Color16, 16 color value type // 3(2^3=8) OR 4(2^4=16) bite color. type Color uint8 type Basic = Color // alias of Color // Opts basic color options. code: 0 - 9 type Opts []Color // Add option value func (o *Opts) Add(ops ...Color) { for _, op := range ops { if uint8(op) < 10 { *o = append(*o, op) } } } // IsValid options func (o Opts) IsValid() bool { return len(o) > 0 } // IsEmpty options func (o Opts) IsEmpty() bool { return len(o) == 0 } // String options to string. eg: "1;3" func (o Opts) String() string { return Colors2code(o...) } /************************************************************* * Basic 16 color definition *************************************************************/ // Base value for foreground/background color const ( FgBase uint8 = 30 BgBase uint8 = 40 // hi color base code HiFgBase uint8 = 90 HiBgBase uint8 = 100 ) // Foreground colors. basic foreground colors 30 - 37 const ( FgBlack Color = iota + 30 FgRed FgGreen FgYellow FgBlue FgMagenta // 品红 FgCyan // 青色 FgWhite // FgDefault revert default FG FgDefault Color = 39 ) // Extra foreground color 90 - 97(非标准) const ( FgDarkGray Color = iota + 90 // 亮黑(灰) FgLightRed FgLightGreen FgLightYellow FgLightBlue FgLightMagenta FgLightCyan FgLightWhite // FgGray is alias of FgDarkGray FgGray Color = 90 // 亮黑(灰) ) // Background colors. basic background colors 40 - 47 const ( BgBlack Color = iota + 40 BgRed BgGreen BgYellow // BgBrown like yellow BgBlue BgMagenta BgCyan BgWhite // BgDefault revert default BG BgDefault Color = 49 ) // Extra background color 100 - 107(非标准) const ( BgDarkGray Color = iota + 100 BgLightRed BgLightGreen BgLightYellow BgLightBlue BgLightMagenta BgLightCyan BgLightWhite // BgGray is alias of BgDarkGray BgGray Color = 100 ) // Option settings const ( OpReset Color = iota // 0 重置所有设置 OpBold // 1 加粗 OpFuzzy // 2 模糊(不是所有的终端仿真器都支持) OpItalic // 3 斜体(不是所有的终端仿真器都支持) OpUnderscore // 4 下划线 OpBlink // 5 闪烁 OpFastBlink // 5 快速闪烁(未广泛支持) OpReverse // 7 颠倒的 交换背景色与前景色 OpConcealed // 8 隐匿的 OpStrikethrough // 9 删除的,删除线(未广泛支持) ) // There are basic and light foreground color aliases const ( Red = FgRed Cyan = FgCyan Gray = FgDarkGray // is light Black Blue = FgBlue Black = FgBlack Green = FgGreen White = FgWhite Yellow = FgYellow Magenta = FgMagenta // special Bold = OpBold Normal = FgDefault // extra light LightRed = FgLightRed LightCyan = FgLightCyan LightBlue = FgLightBlue LightGreen = FgLightGreen LightWhite = FgLightWhite LightYellow = FgLightYellow LightMagenta = FgLightMagenta HiRed = FgLightRed HiCyan = FgLightCyan HiBlue = FgLightBlue HiGreen = FgLightGreen HiWhite = FgLightWhite HiYellow = FgLightYellow HiMagenta = FgLightMagenta BgHiRed = BgLightRed BgHiCyan = BgLightCyan BgHiBlue = BgLightBlue BgHiGreen = BgLightGreen BgHiWhite = BgLightWhite BgHiYellow = BgLightYellow BgHiMagenta = BgLightMagenta ) // Bit4 an method for create Color func Bit4(code uint8) Color { return Color(code) } /************************************************************* * Color render methods *************************************************************/ // Name get color code name. func (c Color) Name() string { name, ok := basic2nameMap[uint8(c)] if ok { return name } return "unknown" } // Text render a text message func (c Color) Text(message string) string { return RenderString(c.String(), message) } // Render messages by color setting // Usage: // green := color.FgGreen.Render // fmt.Println(green("message")) func (c Color) Render(a ...interface{}) string { return RenderCode(c.String(), a...) } // Renderln messages by color setting. // like Println, will add spaces for each argument // Usage: // green := color.FgGreen.Renderln // fmt.Println(green("message")) func (c Color) Renderln(a ...interface{}) string { return RenderWithSpaces(c.String(), a...) } // Sprint render messages by color setting. is alias of the Render() func (c Color) Sprint(a ...interface{}) string { return RenderCode(c.String(), a...) } // Sprintf format and render message. // Usage: // green := color.Green.Sprintf // colored := green("message") func (c Color) Sprintf(format string, args ...interface{}) string { return RenderString(c.String(), fmt.Sprintf(format, args...)) } // Print messages. // Usage: // color.Green.Print("message") // OR: // green := color.FgGreen.Print // green("message") func (c Color) Print(args ...interface{}) { doPrintV2(c.Code(), fmt.Sprint(args...)) } // Printf format and print messages. // Usage: // color.Cyan.Printf("string %s", "arg0") func (c Color) Printf(format string, a ...interface{}) { doPrintV2(c.Code(), fmt.Sprintf(format, a...)) } // Println messages with new line func (c Color) Println(a ...interface{}) { doPrintlnV2(c.String(), a) } // Light current color. eg: 36(FgCyan) -> 96(FgLightCyan). // Usage: // lightCyan := Cyan.Light() // lightCyan.Print("message") func (c Color) Light() Color { val := int(c) if val >= 30 && val <= 47 { return Color(uint8(c) + 60) } // don't change return c } // Darken current color. eg. 96(FgLightCyan) -> 36(FgCyan) // Usage: // cyan := LightCyan.Darken() // cyan.Print("message") func (c Color) Darken() Color { val := int(c) if val >= 90 && val <= 107 { return Color(uint8(c) - 60) } // don't change return c } // C256 convert 16 color to 256-color code. func (c Color) C256() Color256 { val := uint8(c) if val < 10 { // is option code return emptyC256 // empty } var isBg uint8 if val >= BgBase && val <= 47 { // is bg isBg = AsBg val = val - 10 // to fg code } else if val >= HiBgBase && val <= 107 { // is hi bg isBg = AsBg val = val - 10 // to fg code } if c256, ok := basicTo256Map[val]; ok { return Color256{c256, isBg} } // use raw value direct convert return Color256{val} } // RGB convert 16 color to 256-color code. func (c Color) RGB() RGBColor { val := uint8(c) if val < 10 { // is option code return emptyRGBColor } return HEX(Basic2hex(val)) } // Code convert to code string. eg "35" func (c Color) Code() string { // return fmt.Sprintf("%d", c) return strconv.Itoa(int(c)) } // String convert to code string. eg "35" func (c Color) String() string { // return fmt.Sprintf("%d", c) return strconv.Itoa(int(c)) } // IsValid color value func (c Color) IsValid() bool { return c < 107 } /************************************************************* * basic color maps *************************************************************/ // FgColors foreground colors map var FgColors = map[string]Color{ "black": FgBlack, "red": FgRed, "green": FgGreen, "yellow": FgYellow, "blue": FgBlue, "magenta": FgMagenta, "cyan": FgCyan, "white": FgWhite, "default": FgDefault, } // BgColors background colors map var BgColors = map[string]Color{ "black": BgBlack, "red": BgRed, "green": BgGreen, "yellow": BgYellow, "blue": BgBlue, "magenta": BgMagenta, "cyan": BgCyan, "white": BgWhite, "default": BgDefault, } // ExFgColors extra foreground colors map var ExFgColors = map[string]Color{ "darkGray": FgDarkGray, "lightRed": FgLightRed, "lightGreen": FgLightGreen, "lightYellow": FgLightYellow, "lightBlue": FgLightBlue, "lightMagenta": FgLightMagenta, "lightCyan": FgLightCyan, "lightWhite": FgLightWhite, } // ExBgColors extra background colors map var ExBgColors = map[string]Color{ "darkGray": BgDarkGray, "lightRed": BgLightRed, "lightGreen": BgLightGreen, "lightYellow": BgLightYellow, "lightBlue": BgLightBlue, "lightMagenta": BgLightMagenta, "lightCyan": BgLightCyan, "lightWhite": BgLightWhite, } // Options color options map // Deprecated // NOTICE: please use AllOptions instead. var Options = AllOptions // AllOptions color options map var AllOptions = map[string]Color{ "reset": OpReset, "bold": OpBold, "fuzzy": OpFuzzy, "italic": OpItalic, "underscore": OpUnderscore, "blink": OpBlink, "reverse": OpReverse, "concealed": OpConcealed, } var ( // TODO basic name alias // basicNameAlias = map[string]string{} // basic color name to code name2basicMap = initName2basicMap() // basic2nameMap basic color code to name basic2nameMap = map[uint8]string{ 30: "black", 31: "red", 32: "green", 33: "yellow", 34: "blue", 35: "magenta", 36: "cyan", 37: "white", // hi color code 90: "lightBlack", 91: "lightRed", 92: "lightGreen", 93: "lightYellow", 94: "lightBlue", 95: "lightMagenta", 96: "lightCyan", 97: "lightWhite", // options 0: "reset", 1: "bold", 2: "fuzzy", 3: "italic", 4: "underscore", 5: "blink", 7: "reverse", 8: "concealed", } ) // Basic2nameMap data func Basic2nameMap() map[uint8]string { return basic2nameMap } func initName2basicMap() map[string]uint8 { n2b := make(map[string]uint8, len(basic2nameMap)) for u, s := range basic2nameMap { n2b[s] = u } return n2b }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/convert.go
vendor/github.com/gookit/color/convert.go
package color import ( "fmt" "math" "strconv" "strings" ) var ( // ---------- basic(16) <=> 256 color convert ---------- basicTo256Map = map[uint8]uint8{ 30: 0, // black 000000 31: 160, // red c51e14 32: 34, // green 1dc121 33: 184, // yellow c7c329 34: 20, // blue 0a2fc4 35: 170, // magenta c839c5 36: 44, // cyan 20c5c6 37: 188, // white c7c7c7 90: 59, // lightBlack 686868 91: 203, // lightRed fd6f6b 92: 83, // lightGreen 67f86f 93: 227, // lightYellow fffa72 94: 69, // lightBlue 6a76fb 95: 213, // lightMagenta fd7cfc 96: 87, // lightCyan 68fdfe 97: 15, // lightWhite ffffff } // ---------- basic(16) <=> RGB color convert ---------- // refer from Hyper app basic2hexMap = map[uint8]string{ 30: "000000", // black 31: "c51e14", // red 32: "1dc121", // green 33: "c7c329", // yellow 34: "0a2fc4", // blue 35: "c839c5", // magenta 36: "20c5c6", // cyan 37: "c7c7c7", // white 90: "686868", // lightBlack/darkGray 91: "fd6f6b", // lightRed 92: "67f86f", // lightGreen 93: "fffa72", // lightYellow 94: "6a76fb", // lightBlue 95: "fd7cfc", // lightMagenta 96: "68fdfe", // lightCyan 97: "ffffff", // lightWhite } // will convert data from basic2hexMap hex2basicMap = initHex2basicMap() // ---------- 256 <=> RGB color convert ---------- // adapted from https://gist.github.com/MicahElliott/719710 c256ToHexMap = init256ToHexMap() // rgb to 256 color look-up table // RGB hex => 256 code hexTo256Table = map[string]uint8{ // Primary 3-bit (8 colors). Unique representation! "000000": 0, "800000": 1, "008000": 2, "808000": 3, "000080": 4, "800080": 5, "008080": 6, "c0c0c0": 7, // Equivalent "bright" versions of original 8 colors. "808080": 8, "ff0000": 9, "00ff00": 10, "ffff00": 11, "0000ff": 12, "ff00ff": 13, "00ffff": 14, "ffffff": 15, // values commented out below are duplicates from the prior sections // Strictly ascending. // "000000": 16, "000001": 16, // up: avoid key conflicts, value + 1 "00005f": 17, "000087": 18, "0000af": 19, "0000d7": 20, // "0000ff": 21, "0000fe": 21, // up: avoid key conflicts, value - 1 "005f00": 22, "005f5f": 23, "005f87": 24, "005faf": 25, "005fd7": 26, "005fff": 27, "008700": 28, "00875f": 29, "008787": 30, "0087af": 31, "0087d7": 32, "0087ff": 33, "00af00": 34, "00af5f": 35, "00af87": 36, "00afaf": 37, "00afd7": 38, "00afff": 39, "00d700": 40, "00d75f": 41, "00d787": 42, "00d7af": 43, "00d7d7": 44, "00d7ff": 45, // "00ff00": 46, "00ff01": 46, // up: avoid key conflicts, value + 1 "00ff5f": 47, "00ff87": 48, "00ffaf": 49, "00ffd7": 50, // "00ffff": 51, "00fffe": 51, // up: avoid key conflicts, value - 1 "5f0000": 52, "5f005f": 53, "5f0087": 54, "5f00af": 55, "5f00d7": 56, "5f00ff": 57, "5f5f00": 58, "5f5f5f": 59, "5f5f87": 60, "5f5faf": 61, "5f5fd7": 62, "5f5fff": 63, "5f8700": 64, "5f875f": 65, "5f8787": 66, "5f87af": 67, "5f87d7": 68, "5f87ff": 69, "5faf00": 70, "5faf5f": 71, "5faf87": 72, "5fafaf": 73, "5fafd7": 74, "5fafff": 75, "5fd700": 76, "5fd75f": 77, "5fd787": 78, "5fd7af": 79, "5fd7d7": 80, "5fd7ff": 81, "5fff00": 82, "5fff5f": 83, "5fff87": 84, "5fffaf": 85, "5fffd7": 86, "5fffff": 87, "870000": 88, "87005f": 89, "870087": 90, "8700af": 91, "8700d7": 92, "8700ff": 93, "875f00": 94, "875f5f": 95, "875f87": 96, "875faf": 97, "875fd7": 98, "875fff": 99, "878700": 100, "87875f": 101, "878787": 102, "8787af": 103, "8787d7": 104, "8787ff": 105, "87af00": 106, "87af5f": 107, "87af87": 108, "87afaf": 109, "87afd7": 110, "87afff": 111, "87d700": 112, "87d75f": 113, "87d787": 114, "87d7af": 115, "87d7d7": 116, "87d7ff": 117, "87ff00": 118, "87ff5f": 119, "87ff87": 120, "87ffaf": 121, "87ffd7": 122, "87ffff": 123, "af0000": 124, "af005f": 125, "af0087": 126, "af00af": 127, "af00d7": 128, "af00ff": 129, "af5f00": 130, "af5f5f": 131, "af5f87": 132, "af5faf": 133, "af5fd7": 134, "af5fff": 135, "af8700": 136, "af875f": 137, "af8787": 138, "af87af": 139, "af87d7": 140, "af87ff": 141, "afaf00": 142, "afaf5f": 143, "afaf87": 144, "afafaf": 145, "afafd7": 146, "afafff": 147, "afd700": 148, "afd75f": 149, "afd787": 150, "afd7af": 151, "afd7d7": 152, "afd7ff": 153, "afff00": 154, "afff5f": 155, "afff87": 156, "afffaf": 157, "afffd7": 158, "afffff": 159, "d70000": 160, "d7005f": 161, "d70087": 162, "d700af": 163, "d700d7": 164, "d700ff": 165, "d75f00": 166, "d75f5f": 167, "d75f87": 168, "d75faf": 169, "d75fd7": 170, "d75fff": 171, "d78700": 172, "d7875f": 173, "d78787": 174, "d787af": 175, "d787d7": 176, "d787ff": 177, "d7af00": 178, "d7af5f": 179, "d7af87": 180, "d7afaf": 181, "d7afd7": 182, "d7afff": 183, "d7d700": 184, "d7d75f": 185, "d7d787": 186, "d7d7af": 187, "d7d7d7": 188, "d7d7ff": 189, "d7ff00": 190, "d7ff5f": 191, "d7ff87": 192, "d7ffaf": 193, "d7ffd7": 194, "d7ffff": 195, // "ff0000": 196, "ff0001": 196, // up: avoid key conflicts, value + 1 "ff005f": 197, "ff0087": 198, "ff00af": 199, "ff00d7": 200, // "ff00ff": 201, "ff00fe": 201, // up: avoid key conflicts, value - 1 "ff5f00": 202, "ff5f5f": 203, "ff5f87": 204, "ff5faf": 205, "ff5fd7": 206, "ff5fff": 207, "ff8700": 208, "ff875f": 209, "ff8787": 210, "ff87af": 211, "ff87d7": 212, "ff87ff": 213, "ffaf00": 214, "ffaf5f": 215, "ffaf87": 216, "ffafaf": 217, "ffafd7": 218, "ffafff": 219, "ffd700": 220, "ffd75f": 221, "ffd787": 222, "ffd7af": 223, "ffd7d7": 224, "ffd7ff": 225, // "ffff00": 226, "ffff01": 226, // up: avoid key conflicts, value + 1 "ffff5f": 227, "ffff87": 228, "ffffaf": 229, "ffffd7": 230, // "ffffff": 231, "fffffe": 231, // up: avoid key conflicts, value - 1 // Gray-scale range. "080808": 232, "121212": 233, "1c1c1c": 234, "262626": 235, "303030": 236, "3a3a3a": 237, "444444": 238, "4e4e4e": 239, "585858": 240, "626262": 241, "6c6c6c": 242, "767676": 243, // "808080": 244, "808081": 244, // up: avoid key conflicts, value + 1 "8a8a8a": 245, "949494": 246, "9e9e9e": 247, "a8a8a8": 248, "b2b2b2": 249, "bcbcbc": 250, "c6c6c6": 251, "d0d0d0": 252, "dadada": 253, "e4e4e4": 254, "eeeeee": 255, } incs = []uint8{0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff} ) func initHex2basicMap() map[string]uint8 { h2b := make(map[string]uint8, len(basic2hexMap)) // ini data map for u, s := range basic2hexMap { h2b[s] = u } return h2b } func init256ToHexMap() map[uint8]string { c256toh := make(map[uint8]string, len(hexTo256Table)) // ini data map for hex, c256 := range hexTo256Table { c256toh[c256] = hex } return c256toh } // RgbTo256Table mapping data func RgbTo256Table() map[string]uint8 { return hexTo256Table } // Colors2code convert colors to code. return like "32;45;3" func Colors2code(colors ...Color) string { if len(colors) == 0 { return "" } var codes []string for _, color := range colors { codes = append(codes, color.String()) } return strings.Join(codes, ";") } /************************************************************* * HEX code <=> RGB/True color code *************************************************************/ // Hex2rgb alias of the HexToRgb() func Hex2rgb(hex string) []int { return HexToRgb(hex) } // HexToRGB alias of the HexToRgb() func HexToRGB(hex string) []int { return HexToRgb(hex) } // HexToRgb convert hex color string to RGB numbers // // Usage: // rgb := HexToRgb("ccc") // rgb: [204 204 204] // rgb := HexToRgb("aabbcc") // rgb: [170 187 204] // rgb := HexToRgb("#aabbcc") // rgb: [170 187 204] // rgb := HexToRgb("0xad99c0") // rgb: [170 187 204] func HexToRgb(hex string) (rgb []int) { hex = strings.TrimSpace(hex) if hex == "" { return } // like from css. eg "#ccc" "#ad99c0" if hex[0] == '#' { hex = hex[1:] } hex = strings.ToLower(hex) switch len(hex) { case 3: // "ccc" hex = string([]byte{hex[0], hex[0], hex[1], hex[1], hex[2], hex[2]}) case 8: // "0xad99c0" hex = strings.TrimPrefix(hex, "0x") } // recheck if len(hex) != 6 { return } // convert string to int64 if i64, err := strconv.ParseInt(hex, 16, 32); err == nil { color := int(i64) // parse int rgb = make([]int, 3) rgb[0] = color >> 16 rgb[1] = (color & 0x00FF00) >> 8 rgb[2] = color & 0x0000FF } return } // Rgb2hex alias of the RgbToHex() func Rgb2hex(rgb []int) string { return RgbToHex(rgb) } // RgbToHex convert RGB-code to hex-code // // Usage: // hex := RgbToHex([]int{170, 187, 204}) // hex: "aabbcc" func RgbToHex(rgb []int) string { hexNodes := make([]string, len(rgb)) for _, v := range rgb { hexNodes = append(hexNodes, strconv.FormatInt(int64(v), 16)) } return strings.Join(hexNodes, "") } /************************************************************* * 4bit(16) color <=> RGB/True color *************************************************************/ // Basic2hex convert basic color to hex string. func Basic2hex(val uint8) string { return basic2hexMap[val] } // Hex2basic convert hex string to basic color code. func Hex2basic(hex string) uint8 { return hex2basicMap[hex] } // Rgb2basic alias of the RgbToAnsi() func Rgb2basic(r, g, b uint8, isBg bool) uint8 { // is basic color, direct use static map data. hex := RgbToHex([]int{int(r), int(g), int(b)}) if val, ok := hex2basicMap[hex]; ok { if isBg { return val + 10 } return val } return RgbToAnsi(r, g, b, isBg) } // Rgb2ansi alias of the RgbToAnsi() func Rgb2ansi(r, g, b uint8, isBg bool) uint8 { return RgbToAnsi(r, g, b, isBg) } // RgbToAnsi convert RGB-code to 16-code // refer https://github.com/radareorg/radare2/blob/master/libr/cons/rgb.c#L249-L271 func RgbToAnsi(r, g, b uint8, isBg bool) uint8 { var bright, c, k uint8 base := compareVal(isBg, BgBase, FgBase) // eco bright-specific if r == 0x80 && g == 0x80 && b == 0x80 { // 0x80=128 bright = 53 } else if r == 0xff || g == 0xff || b == 0xff { // 0xff=255 bright = 60 } // else bright = 0 if r == g && g == b { // 0x7f=127 // r = (r > 0x7f) ? 1 : 0; r = compareVal(r > 0x7f, 1, 0) g = compareVal(g > 0x7f, 1, 0) b = compareVal(b > 0x7f, 1, 0) } else { k = (r + g + b) / 3 // r = (r >= k) ? 1 : 0; r = compareVal(r >= k, 1, 0) g = compareVal(g >= k, 1, 0) b = compareVal(b >= k, 1, 0) } // c = (r ? 1 : 0) + (g ? (b ? 6 : 2) : (b ? 4 : 0)) c = compareVal(r > 0, 1, 0) if g > 0 { c += compareVal(b > 0, 6, 2) } else { c += compareVal(b > 0, 4, 0) } return base + bright + c } /************************************************************* * 8bit(256) color <=> RGB/True color *************************************************************/ // Rgb2short convert RGB-code to 256-code func Rgb2short(r, g, b uint8) uint8 { return RgbTo256(r, g, b) } // RgbTo256 convert RGB-code to 256-code func RgbTo256(r, g, b uint8) uint8 { res := make([]uint8, 3) for partI, part := range [3]uint8{r, g, b} { i := 0 for i < len(incs)-1 { s, b := incs[i], incs[i+1] // smaller, bigger if s <= part && part <= b { s1 := math.Abs(float64(s) - float64(part)) b1 := math.Abs(float64(b) - float64(part)) var closest uint8 if s1 < b1 { closest = s } else { closest = b } res[partI] = closest break } i++ } } hex := fmt.Sprintf("%02x%02x%02x", res[0], res[1], res[2]) equiv := hexTo256Table[hex] return equiv } // C256ToRgb convert an 256 color code to RGB numbers func C256ToRgb(val uint8) (rgb []uint8) { hex := c256ToHexMap[val] // convert to rgb code rgbInts := Hex2rgb(hex) return []uint8{ uint8(rgbInts[0]), uint8(rgbInts[1]), uint8(rgbInts[2]), } } // C256ToRgbV1 convert an 256 color code to RGB numbers // refer https://github.com/torvalds/linux/commit/cec5b2a97a11ade56a701e83044d0a2a984c67b4 func C256ToRgbV1(val uint8) (rgb []uint8) { var r, g, b uint8 if val < 8 { // Standard colours. // r = val&1 ? 0xaa : 0x00; r = compareVal(val&1 == 1, 0xaa, 0x00) g = compareVal(val&2 == 2, 0xaa, 0x00) b = compareVal(val&4 == 4, 0xaa, 0x00) } else if val < 16 { // r = val & 1 ? 0xff : 0x55; r = compareVal(val&1 == 1, 0xff, 0x55) g = compareVal(val&2 == 2, 0xff, 0x55) b = compareVal(val&4 == 4, 0xff, 0x55) } else if val < 232 { /* 6x6x6 colour cube. */ r = (val - 16) / 36 * 85 / 2 g = (val - 16) / 6 % 6 * 85 / 2 b = (val - 16) % 6 * 85 / 2 } else { /* Grayscale ramp. */ nv := uint8(int(val)*10 - 2312) // set value r, g, b = nv, nv, nv } return []uint8{r, g, b} }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/printer.go
vendor/github.com/gookit/color/printer.go
package color import "fmt" /************************************************************* * colored message Printer *************************************************************/ // PrinterFace interface type PrinterFace interface { fmt.Stringer Sprint(a ...interface{}) string Sprintf(format string, a ...interface{}) string Print(a ...interface{}) Printf(format string, a ...interface{}) Println(a ...interface{}) } // Printer a generic color message printer. // // Usage: // p := &Printer{Code: "32;45;3"} // p.Print("message") type Printer struct { // NoColor disable color. NoColor bool // Code color code string. eg "32;45;3" Code string } // NewPrinter instance func NewPrinter(colorCode string) *Printer { return &Printer{Code: colorCode} } // String returns color code string. eg: "32;45;3" func (p *Printer) String() string { // panic("implement me") return p.Code } // Sprint returns rendering colored messages func (p *Printer) Sprint(a ...interface{}) string { return RenderCode(p.String(), a...) } // Sprintf returns format and rendering colored messages func (p *Printer) Sprintf(format string, a ...interface{}) string { return RenderString(p.String(), fmt.Sprintf(format, a...)) } // Print rendering colored messages func (p *Printer) Print(a ...interface{}) { doPrintV2(p.String(), fmt.Sprint(a...)) } // Printf format and rendering colored messages func (p *Printer) Printf(format string, a ...interface{}) { doPrintV2(p.String(), fmt.Sprintf(format, a...)) } // Println rendering colored messages with newline func (p *Printer) Println(a ...interface{}) { doPrintlnV2(p.Code, a) } // IsEmpty color code func (p *Printer) IsEmpty() bool { return p.Code == "" } /************************************************************* * SimplePrinter struct *************************************************************/ // SimplePrinter use for quick use color print on inject to struct type SimplePrinter struct{} // Print message func (s *SimplePrinter) Print(v ...interface{}) { Print(v...) } // Printf message func (s *SimplePrinter) Printf(format string, v ...interface{}) { Printf(format, v...) } // Println message func (s *SimplePrinter) Println(v ...interface{}) { Println(v...) } // Infof message func (s *SimplePrinter) Infof(format string, a ...interface{}) { Info.Printf(format, a...) } // Infoln message func (s *SimplePrinter) Infoln(a ...interface{}) { Info.Println(a...) } // Warnf message func (s *SimplePrinter) Warnf(format string, a ...interface{}) { Warn.Printf(format, a...) } // Warnln message func (s *SimplePrinter) Warnln(a ...interface{}) { Warn.Println(a...) } // Errorf message func (s *SimplePrinter) Errorf(format string, a ...interface{}) { Error.Printf(format, a...) } // Errorln message func (s *SimplePrinter) Errorln(a ...interface{}) { Error.Println(a...) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/color.go
vendor/github.com/gookit/color/color.go
/* Package color is Command line color library. Support rich color rendering output, universal API method, compatible with Windows system Source code and other details for the project are available at GitHub: https://github.com/gookit/color More usage please see README and tests. */ package color import ( "fmt" "io" "os" "regexp" "github.com/xo/terminfo" ) // terminal color available level alias of the terminfo.ColorLevel* const ( LevelNo = terminfo.ColorLevelNone // not support color. Level16 = terminfo.ColorLevelBasic // 3/4 bit color supported Level256 = terminfo.ColorLevelHundreds // 8 bit color supported LevelRgb = terminfo.ColorLevelMillions // (24 bit)true color supported ) // color render templates // ESC 操作的表示: // "\033"(Octal 8进制) = "\x1b"(Hexadecimal 16进制) = 27 (10进制) const ( SettingTpl = "\x1b[%sm" FullColorTpl = "\x1b[%sm%s\x1b[0m" ) // ResetSet Close all properties. const ResetSet = "\x1b[0m" // CodeExpr regex to clear color codes eg "\033[1;36mText\x1b[0m" const CodeExpr = `\033\[[\d;?]+m` var ( // Enable switch color render and display // // NOTICE: // if ENV: NO_COLOR is not empty, will disable color render. Enable = os.Getenv("NO_COLOR") == "" // RenderTag render HTML tag on call color.Xprint, color.PrintX RenderTag = true // debug mode for development. // // set env: // COLOR_DEBUG_MODE=on // or: // COLOR_DEBUG_MODE=on go run ./_examples/envcheck.go debugMode = os.Getenv("COLOR_DEBUG_MODE") == "on" // inner errors record on detect color level innerErrs []error // output the default io.Writer message print output io.Writer = os.Stdout // mark current env, It's like in `cmd.exe` // if not in windows, it's always is False. isLikeInCmd bool // the color support level for current terminal // needVTP - need enable VTP, only for windows OS colorLevel, needVTP = detectTermColorLevel() // match color codes codeRegex = regexp.MustCompile(CodeExpr) // mark current env is support color. // Always: isLikeInCmd != supportColor // supportColor = IsSupportColor() ) // TermColorLevel value on current ENV func TermColorLevel() terminfo.ColorLevel { return colorLevel } // SupportColor on the current ENV func SupportColor() bool { return colorLevel > terminfo.ColorLevelNone } // Support16Color on the current ENV // func Support16Color() bool { // return colorLevel > terminfo.ColorLevelNone // } // Support256Color on the current ENV func Support256Color() bool { return colorLevel > terminfo.ColorLevelBasic } // SupportTrueColor on the current ENV func SupportTrueColor() bool { return colorLevel > terminfo.ColorLevelHundreds } /************************************************************* * global settings *************************************************************/ // Set set console color attributes func Set(colors ...Color) (int, error) { code := Colors2code(colors...) err := SetTerminal(code) return 0, err } // Reset reset console color attributes func Reset() (int, error) { err := ResetTerminal() return 0, err } // Disable disable color output func Disable() bool { oldVal := Enable Enable = false return oldVal } // NotRenderTag on call color.Xprint, color.PrintX func NotRenderTag() { RenderTag = false } // SetOutput set default colored text output func SetOutput(w io.Writer) { output = w } // ResetOutput reset output func ResetOutput() { output = os.Stdout } // ResetOptions reset all package option setting func ResetOptions() { RenderTag = true Enable = true output = os.Stdout } // ForceColor force open color render func ForceSetColorLevel(level terminfo.ColorLevel) terminfo.ColorLevel { oldLevelVal := colorLevel colorLevel = level return oldLevelVal } // ForceColor force open color render func ForceColor() terminfo.ColorLevel { return ForceOpenColor() } // ForceOpenColor force open color render func ForceOpenColor() terminfo.ColorLevel { // TODO should set level to ? return ForceSetColorLevel(terminfo.ColorLevelMillions) } // IsLikeInCmd check result // Deprecated func IsLikeInCmd() bool { return isLikeInCmd } // InnerErrs info func InnerErrs() []error { return innerErrs } /************************************************************* * render color code *************************************************************/ // RenderCode render message by color code. // Usage: // msg := RenderCode("3;32;45", "some", "message") func RenderCode(code string, args ...interface{}) string { var message string if ln := len(args); ln == 0 { return "" } message = fmt.Sprint(args...) if len(code) == 0 { return message } // disabled OR not support color if !Enable || !SupportColor() { return ClearCode(message) } return fmt.Sprintf(FullColorTpl, code, message) } // RenderWithSpaces Render code with spaces. // If the number of args is > 1, a space will be added between the args func RenderWithSpaces(code string, args ...interface{}) string { message := formatArgsForPrintln(args) if len(code) == 0 { return message } // disabled OR not support color if !Enable || !SupportColor() { return ClearCode(message) } return fmt.Sprintf(FullColorTpl, code, message) } // RenderString render a string with color code. // Usage: // msg := RenderString("3;32;45", "a message") func RenderString(code string, str string) string { if len(code) == 0 || str == "" { return str } // disabled OR not support color if !Enable || !SupportColor() { return ClearCode(str) } return fmt.Sprintf(FullColorTpl, code, str) } // ClearCode clear color codes. // eg: "\033[36;1mText\x1b[0m" -> "Text" func ClearCode(str string) string { return codeRegex.ReplaceAllString(str, "") }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/detect_windows.go
vendor/github.com/gookit/color/detect_windows.go
// +build windows // Display color on windows // refer: // golang.org/x/sys/windows // golang.org/x/crypto/ssh/terminal // https://docs.microsoft.com/en-us/windows/console package color import ( "os" "syscall" "unsafe" "github.com/xo/terminfo" "golang.org/x/sys/windows" ) // related docs // https://docs.microsoft.com/zh-cn/windows/console/console-virtual-terminal-sequences // https://docs.microsoft.com/zh-cn/windows/console/console-virtual-terminal-sequences#samples var ( // isMSys bool kernel32 *syscall.LazyDLL procGetConsoleMode *syscall.LazyProc procSetConsoleMode *syscall.LazyProc ) func init() { if !SupportColor() { isLikeInCmd = true return } // if disabled. if !Enable { return } // if at windows's ConEmu, Cmder, putty ... terminals not need VTP // -------- try force enable colors on windows terminal ------- tryEnableVTP(needVTP) // fetch console screen buffer info // err := getConsoleScreenBufferInfo(uintptr(syscall.Stdout), &defScreenInfo) } // try force enable colors on windows terminal func tryEnableVTP(enable bool) bool { if !enable { return false } debugf("True-Color by enable VirtualTerminalProcessing on windows") initKernel32Proc() // enable colors on windows terminal if tryEnableOnCONOUT() { return true } return tryEnableOnStdout() } func initKernel32Proc() { if kernel32 != nil { return } // load related windows dll // https://docs.microsoft.com/en-us/windows/console/setconsolemode kernel32 = syscall.NewLazyDLL("kernel32.dll") procGetConsoleMode = kernel32.NewProc("GetConsoleMode") procSetConsoleMode = kernel32.NewProc("SetConsoleMode") } func tryEnableOnCONOUT() bool { outHandle, err := syscall.Open("CONOUT$", syscall.O_RDWR, 0) if err != nil { saveInternalError(err) return false } err = EnableVirtualTerminalProcessing(outHandle, true) if err != nil { saveInternalError(err) return false } return true } func tryEnableOnStdout() bool { // try direct open syscall.Stdout err := EnableVirtualTerminalProcessing(syscall.Stdout, true) if err != nil { saveInternalError(err) return false } return true } // Get the Windows Version and Build Number var ( winVersion, _, buildNumber = windows.RtlGetNtVersionNumbers() ) // refer // https://github.com/Delta456/box-cli-maker/blob/7b5a1ad8a016ce181e7d8b05e24b54ff60b4b38a/detect_windows.go#L30-L57 // https://github.com/gookit/color/issues/25#issuecomment-738727917 // detects the Color Level Supported on windows: cmd, powerShell func detectSpecialTermColor(termVal string) (tl terminfo.ColorLevel, needVTP bool) { if os.Getenv("ConEmuANSI") == "ON" { debugf("support True Color by ConEmuANSI=ON") // ConEmuANSI is "ON" for generic ANSI support // but True Color option is enabled by default // I am just assuming that people wouldn't have disabled it // Even if it is not enabled then ConEmu will auto round off // accordingly return terminfo.ColorLevelMillions, false } // Before Windows 10 Build Number 10586, console never supported ANSI Colors if buildNumber < 10586 || winVersion < 10 { // Detect if using ANSICON on older systems if os.Getenv("ANSICON") != "" { conVersion := os.Getenv("ANSICON_VER") // 8 bit Colors were only supported after v1.81 release if conVersion >= "181" { return terminfo.ColorLevelHundreds, false } return terminfo.ColorLevelBasic, false } return terminfo.ColorLevelNone, false } // True Color is not available before build 14931 so fallback to 8 bit color. if buildNumber < 14931 { return terminfo.ColorLevelHundreds, true } // Windows 10 build 14931 is the first release that supports 16m/TrueColor debugf("support True Color on windows version is >= build 14931") return terminfo.ColorLevelMillions, true } /************************************************************* * render full color code on windows(8,16,24bit color) *************************************************************/ // docs https://docs.microsoft.com/zh-cn/windows/console/getconsolemode#parameters const ( // equals to docs page's ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 EnableVirtualTerminalProcessingMode uint32 = 0x4 ) // EnableVirtualTerminalProcessing Enable virtual terminal processing // // ref from github.com/konsorten/go-windows-terminal-sequences // doc https://docs.microsoft.com/zh-cn/windows/console/console-virtual-terminal-sequences#samples // // Usage: // err := EnableVirtualTerminalProcessing(syscall.Stdout, true) // // support print color text // err = EnableVirtualTerminalProcessing(syscall.Stdout, false) func EnableVirtualTerminalProcessing(stream syscall.Handle, enable bool) error { var mode uint32 // Check if it is currently in the terminal // err := syscall.GetConsoleMode(syscall.Stdout, &mode) err := syscall.GetConsoleMode(stream, &mode) if err != nil { // fmt.Println("EnableVirtualTerminalProcessing", err) return err } if enable { mode |= EnableVirtualTerminalProcessingMode } else { mode &^= EnableVirtualTerminalProcessingMode } ret, _, err := procSetConsoleMode.Call(uintptr(stream), uintptr(mode)) if ret == 0 { return err } return nil } // renderColorCodeOnCmd enable cmd color render. // func renderColorCodeOnCmd(fn func()) { // err := EnableVirtualTerminalProcessing(syscall.Stdout, true) // // if is not in terminal, will clear color tag. // if err != nil { // // panic(err) // fn() // return // } // // // force open color render // old := ForceOpenColor() // fn() // // revert color setting // supportColor = old // // err = EnableVirtualTerminalProcessing(syscall.Stdout, false) // if err != nil { // panic(err) // } // } /************************************************************* * render simple color code on windows *************************************************************/ // IsTty returns true if the given file descriptor is a terminal. func IsTty(fd uintptr) bool { initKernel32Proc() var st uint32 r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) return r != 0 && e == 0 } // IsTerminal returns true if the given file descriptor is a terminal. // // Usage: // fd := os.Stdout.Fd() // fd := uintptr(syscall.Stdout) // for windows // IsTerminal(fd) func IsTerminal(fd uintptr) bool { initKernel32Proc() var st uint32 r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) return r != 0 && e == 0 }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/color_rgb.go
vendor/github.com/gookit/color/color_rgb.go
package color import ( "fmt" "strconv" "strings" ) // 24 bit RGB color // RGB: // R 0-255 G 0-255 B 0-255 // R 00-FF G 00-FF B 00-FF (16进制) // // Format: // ESC[ … 38;2;<r>;<g>;<b> … m // Select RGB foreground color // ESC[ … 48;2;<r>;<g>;<b> … m // Choose RGB background color // // links: // https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97#24位 // // example: // fg: \x1b[38;2;30;144;255mMESSAGE\x1b[0m // bg: \x1b[48;2;30;144;255mMESSAGE\x1b[0m // both: \x1b[38;2;233;90;203;48;2;30;144;255mMESSAGE\x1b[0m const ( TplFgRGB = "38;2;%d;%d;%d" TplBgRGB = "48;2;%d;%d;%d" FgRGBPfx = "38;2;" BgRGBPfx = "48;2;" ) // mark color is fg or bg. const ( AsFg uint8 = iota AsBg ) // values from https://github.com/go-terminfo/terminfo // var ( // RgbaBlack = image_color.RGBA{0, 0, 0, 255} // Red = color.RGBA{205, 0, 0, 255} // Green = color.RGBA{0, 205, 0, 255} // Orange = color.RGBA{205, 205, 0, 255} // Blue = color.RGBA{0, 0, 238, 255} // Magenta = color.RGBA{205, 0, 205, 255} // Cyan = color.RGBA{0, 205, 205, 255} // LightGrey = color.RGBA{229, 229, 229, 255} // // DarkGrey = color.RGBA{127, 127, 127, 255} // LightRed = color.RGBA{255, 0, 0, 255} // LightGreen = color.RGBA{0, 255, 0, 255} // Yellow = color.RGBA{255, 255, 0, 255} // LightBlue = color.RGBA{92, 92, 255, 255} // LightMagenta = color.RGBA{255, 0, 255, 255} // LightCyan = color.RGBA{0, 255, 255, 255} // White = color.RGBA{255, 255, 255, 255} // ) /************************************************************* * RGB Color(Bit24Color, TrueColor) *************************************************************/ // RGBColor definition. // // The first to third digits represent the color value. // The last digit represents the foreground(0), background(1), >1 is unset value // // Usage: // // 0, 1, 2 is R,G,B. // // 3rd: Fg=0, Bg=1, >1: unset value // RGBColor{30,144,255, 0} // RGBColor{30,144,255, 1} // // NOTICE: now support RGB color on windows CMD, PowerShell type RGBColor [4]uint8 // create a empty RGBColor var emptyRGBColor = RGBColor{3: 99} // RGB color create. // Usage: // c := RGB(30,144,255) // c := RGB(30,144,255, true) // c.Print("message") func RGB(r, g, b uint8, isBg ...bool) RGBColor { rgb := RGBColor{r, g, b} if len(isBg) > 0 && isBg[0] { rgb[3] = AsBg } return rgb } // Rgb alias of the RGB() func Rgb(r, g, b uint8, isBg ...bool) RGBColor { return RGB(r, g, b, isBg...) } // Bit24 alias of the RGB() func Bit24(r, g, b uint8, isBg ...bool) RGBColor { return RGB(r, g, b, isBg...) } // RGBFromSlice quick RGBColor from slice func RGBFromSlice(rgb []uint8, isBg ...bool) RGBColor { return RGB(rgb[0], rgb[1], rgb[2], isBg...) } // HEX create RGB color from a HEX color string. // Usage: // c := HEX("ccc") // rgb: [204 204 204] // c := HEX("aabbcc") // rgb: [170 187 204] // c := HEX("#aabbcc") // c := HEX("0xaabbcc") // c.Print("message") func HEX(hex string, isBg ...bool) RGBColor { if rgb := HexToRgb(hex); len(rgb) > 0 { return RGB(uint8(rgb[0]), uint8(rgb[1]), uint8(rgb[2]), isBg...) } // mark is empty return emptyRGBColor } // Hex alias of the HEX() func Hex(hex string, isBg ...bool) RGBColor { return HEX(hex, isBg...) } // RGBFromString create RGB color from a string. // Usage: // c := RGBFromString("170,187,204") // c.Print("message") func RGBFromString(rgb string, isBg ...bool) RGBColor { ss := stringToArr(rgb, ",") if len(ss) != 3 { return emptyRGBColor } var ar [3]int for i, val := range ss { iv, err := strconv.Atoi(val) if err != nil { return emptyRGBColor } ar[i] = iv } return RGB(uint8(ar[0]), uint8(ar[1]), uint8(ar[2]), isBg...) } // Set terminal by rgb/true color code func (c RGBColor) Set() error { return SetTerminal(c.String()) } // Reset terminal. alias of the ResetTerminal() func (c RGBColor) Reset() error { return ResetTerminal() } // Print print message func (c RGBColor) Print(a ...interface{}) { doPrintV2(c.String(), fmt.Sprint(a...)) } // Printf format and print message func (c RGBColor) Printf(format string, a ...interface{}) { doPrintV2(c.String(), fmt.Sprintf(format, a...)) } // Println print message with newline func (c RGBColor) Println(a ...interface{}) { doPrintlnV2(c.String(), a) } // Sprint returns rendered message func (c RGBColor) Sprint(a ...interface{}) string { return RenderCode(c.String(), a...) } // Sprintf returns format and rendered message func (c RGBColor) Sprintf(format string, a ...interface{}) string { return RenderString(c.String(), fmt.Sprintf(format, a...)) } // Values to RGB values func (c RGBColor) Values() []int { return []int{int(c[0]), int(c[1]), int(c[2])} } // Code to color code string without prefix. eg: "204;123;56" func (c RGBColor) Code() string { return fmt.Sprintf("%d;%d;%d", c[0], c[1], c[2]) } // Hex color rgb to hex string. as in "ff0080". func (c RGBColor) Hex() string { return fmt.Sprintf("%02x%02x%02x", c[0], c[1], c[2]) } // FullCode to color code string with prefix func (c RGBColor) FullCode() string { return c.String() } // String to color code string with prefix. eg: "38;2;204;123;56" func (c RGBColor) String() string { if c[3] == AsFg { return fmt.Sprintf(TplFgRGB, c[0], c[1], c[2]) } if c[3] == AsBg { return fmt.Sprintf(TplBgRGB, c[0], c[1], c[2]) } // c[3] > 1 is empty return "" } // IsEmpty value func (c RGBColor) IsEmpty() bool { return c[3] > AsBg } // IsValid value // func (c RGBColor) IsValid() bool { // return c[3] <= AsBg // } // C256 returns the closest approximate 256 (8 bit) color func (c RGBColor) C256() Color256 { return C256(RgbTo256(c[0], c[1], c[2]), c[3] == AsBg) } // Basic returns the closest approximate 16 (4 bit) color func (c RGBColor) Basic() Color { // return Color(RgbToAnsi(c[0], c[1], c[2], c[3] == AsBg)) return Color(Rgb2basic(c[0], c[1], c[2], c[3] == AsBg)) } // Color returns the closest approximate 16 (4 bit) color func (c RGBColor) Color() Color { return c.Basic() } // C16 returns the closest approximate 16 (4 bit) color func (c RGBColor) C16() Color { return c.Basic() } /************************************************************* * RGB Style *************************************************************/ // RGBStyle definition. // // Foreground/Background color // All are composed of 4 digits uint8, the first three digits are the color value; // The last bit is different from RGBColor, here it indicates whether the value is set. // - 1 Has been set // - ^1 Not set type RGBStyle struct { // Name of the style Name string // color options of the style opts Opts // fg and bg color fg, bg RGBColor } // NewRGBStyle create a RGBStyle. func NewRGBStyle(fg RGBColor, bg ...RGBColor) *RGBStyle { s := &RGBStyle{} if len(bg) > 0 { s.SetBg(bg[0]) } return s.SetFg(fg) } // HEXStyle create a RGBStyle from HEX color string. // Usage: // s := HEXStyle("aabbcc", "eee") // s.Print("message") func HEXStyle(fg string, bg ...string) *RGBStyle { s := &RGBStyle{} if len(bg) > 0 { s.SetBg(HEX(bg[0])) } if len(fg) > 0 { s.SetFg(HEX(fg)) } return s } // RGBStyleFromString create a RGBStyle from color value string. // Usage: // s := RGBStyleFromString("170,187,204", "70,87,4") // s.Print("message") func RGBStyleFromString(fg string, bg ...string) *RGBStyle { s := &RGBStyle{} if len(bg) > 0 { s.SetBg(RGBFromString(bg[0])) } return s.SetFg(RGBFromString(fg)) } // Set fg and bg color, can also with color options func (s *RGBStyle) Set(fg, bg RGBColor, opts ...Color) *RGBStyle { return s.SetFg(fg).SetBg(bg).SetOpts(opts) } // SetFg set fg color func (s *RGBStyle) SetFg(fg RGBColor) *RGBStyle { fg[3] = 1 // add fixed value, mark is valid s.fg = fg return s } // SetBg set bg color func (s *RGBStyle) SetBg(bg RGBColor) *RGBStyle { bg[3] = 1 // add fixed value, mark is valid s.bg = bg return s } // SetOpts set color options func (s *RGBStyle) SetOpts(opts Opts) *RGBStyle { s.opts = opts return s } // AddOpts add options func (s *RGBStyle) AddOpts(opts ...Color) *RGBStyle { s.opts.Add(opts...) return s } // Print print message func (s *RGBStyle) Print(a ...interface{}) { doPrintV2(s.String(), fmt.Sprint(a...)) } // Printf format and print message func (s *RGBStyle) Printf(format string, a ...interface{}) { doPrintV2(s.String(), fmt.Sprintf(format, a...)) } // Println print message with newline func (s *RGBStyle) Println(a ...interface{}) { doPrintlnV2(s.String(), a) } // Sprint returns rendered message func (s *RGBStyle) Sprint(a ...interface{}) string { return RenderCode(s.String(), a...) } // Sprintf returns format and rendered message func (s *RGBStyle) Sprintf(format string, a ...interface{}) string { return RenderString(s.String(), fmt.Sprintf(format, a...)) } // Code convert to color code string func (s *RGBStyle) Code() string { return s.String() } // FullCode convert to color code string func (s *RGBStyle) FullCode() string { return s.String() } // String convert to color code string func (s *RGBStyle) String() string { var ss []string // last value ensure is enable. if s.fg[3] == 1 { ss = append(ss, fmt.Sprintf(TplFgRGB, s.fg[0], s.fg[1], s.fg[2])) } if s.bg[3] == 1 { ss = append(ss, fmt.Sprintf(TplBgRGB, s.bg[0], s.bg[1], s.bg[2])) } if s.opts.IsValid() { ss = append(ss, s.opts.String()) } return strings.Join(ss, ";") } // IsEmpty style func (s *RGBStyle) IsEmpty() bool { return s.fg[3] != 1 && s.bg[3] != 1 }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/detect_nonwin.go
vendor/github.com/gookit/color/detect_nonwin.go
// +build !windows // The method in the file has no effect // Only for compatibility with non-Windows systems package color import ( "strings" "syscall" "github.com/xo/terminfo" ) // detect special term color support func detectSpecialTermColor(termVal string) (terminfo.ColorLevel, bool) { if termVal == "" { return terminfo.ColorLevelNone, false } debugf("terminfo check fail - fallback detect color by check TERM value") // on TERM=screen: // - support 256, not support true-color. test on macOS if termVal == "screen" { return terminfo.ColorLevelHundreds, false } if strings.Contains(termVal, "256color") { return terminfo.ColorLevelHundreds, false } if strings.Contains(termVal, "xterm") { return terminfo.ColorLevelHundreds, false // return terminfo.ColorLevelBasic, false } // return terminfo.ColorLevelNone, nil return terminfo.ColorLevelBasic, false } // IsTerminal returns true if the given file descriptor is a terminal. // // Usage: // IsTerminal(os.Stdout.Fd()) func IsTerminal(fd uintptr) bool { return fd == uintptr(syscall.Stdout) || fd == uintptr(syscall.Stdin) || fd == uintptr(syscall.Stderr) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/style.go
vendor/github.com/gookit/color/style.go
package color import ( "fmt" "strings" ) /************************************************************* * 16 color Style *************************************************************/ // Style a 16 color style. can add: fg color, bg color, color options // // Example: // color.Style{color.FgGreen}.Print("message") type Style []Color // New create a custom style // // Usage: // color.New(color.FgGreen).Print("message") // equals to: // color.Style{color.FgGreen}.Print("message") func New(colors ...Color) Style { return colors } // Save to global styles map func (s Style) Save(name string) { AddStyle(name, s) } // Add to global styles map func (s *Style) Add(cs ...Color) { *s = append(*s, cs...) } // Render render text // Usage: // color.New(color.FgGreen).Render("text") // color.New(color.FgGreen, color.BgBlack, color.OpBold).Render("text") func (s Style) Render(a ...interface{}) string { return RenderCode(s.String(), a...) } // Renderln render text line. // like Println, will add spaces for each argument // Usage: // color.New(color.FgGreen).Renderln("text", "more") // color.New(color.FgGreen, color.BgBlack, color.OpBold).Render("text", "more") func (s Style) Renderln(a ...interface{}) string { return RenderWithSpaces(s.String(), a...) } // Sprint is alias of the 'Render' func (s Style) Sprint(a ...interface{}) string { return RenderCode(s.String(), a...) } // Sprintf format and render message. func (s Style) Sprintf(format string, a ...interface{}) string { return RenderString(s.String(), fmt.Sprintf(format, a...)) } // Print render and Print text func (s Style) Print(a ...interface{}) { doPrintV2(s.String(), fmt.Sprint(a...)) } // Printf render and print text func (s Style) Printf(format string, a ...interface{}) { doPrintV2(s.Code(), fmt.Sprintf(format, a...)) } // Println render and print text line func (s Style) Println(a ...interface{}) { doPrintlnV2(s.String(), a) } // Code convert to code string. returns like "32;45;3" func (s Style) Code() string { return s.String() } // String convert to code string. returns like "32;45;3" func (s Style) String() string { return Colors2code(s...) } // IsEmpty style func (s Style) IsEmpty() bool { return len(s) == 0 } /************************************************************* * Theme(extended Style) *************************************************************/ // Theme definition. extends from Style type Theme struct { // Name theme name Name string // Style for the theme Style } // NewTheme instance func NewTheme(name string, style Style) *Theme { return &Theme{name, style} } // Save to themes map func (t *Theme) Save() { AddTheme(t.Name, t.Style) } // Tips use name as title, only apply style for name func (t *Theme) Tips(format string, a ...interface{}) { // only apply style for name t.Print(strings.ToUpper(t.Name) + ": ") Printf(format+"\n", a...) } // Prompt use name as title, and apply style for message func (t *Theme) Prompt(format string, a ...interface{}) { title := strings.ToUpper(t.Name) + ":" t.Println(title, fmt.Sprintf(format, a...)) } // Block like Prompt, but will wrap a empty line func (t *Theme) Block(format string, a ...interface{}) { title := strings.ToUpper(t.Name) + ":\n" t.Println(title, fmt.Sprintf(format, a...)) } /************************************************************* * Theme: internal themes *************************************************************/ // internal themes(like bootstrap style) // Usage: // color.Info.Print("message") // color.Info.Printf("a %s message", "test") // color.Warn.Println("message") // color.Error.Println("message") var ( // Info color style Info = &Theme{"info", Style{OpReset, FgGreen}} // Note color style Note = &Theme{"note", Style{OpBold, FgLightCyan}} // Warn color style Warn = &Theme{"warning", Style{OpBold, FgYellow}} // Light color style Light = &Theme{"light", Style{FgLightWhite, BgBlack}} // Error color style Error = &Theme{"error", Style{FgLightWhite, BgRed}} // Danger color style Danger = &Theme{"danger", Style{OpBold, FgRed}} // Debug color style Debug = &Theme{"debug", Style{OpReset, FgCyan}} // Notice color style Notice = &Theme{"notice", Style{OpBold, FgCyan}} // Comment color style Comment = &Theme{"comment", Style{OpReset, FgYellow}} // Success color style Success = &Theme{"success", Style{OpBold, FgGreen}} // Primary color style Primary = &Theme{"primary", Style{OpReset, FgBlue}} // Question color style Question = &Theme{"question", Style{OpReset, FgMagenta}} // Secondary color style Secondary = &Theme{"secondary", Style{FgDarkGray}} ) // Themes internal defined themes. // Usage: // color.Themes["info"].Println("message") var Themes = map[string]*Theme{ "info": Info, "note": Note, "light": Light, "error": Error, "debug": Debug, "danger": Danger, "notice": Notice, "success": Success, "comment": Comment, "primary": Primary, "warning": Warn, "question": Question, "secondary": Secondary, } // AddTheme add a theme and style func AddTheme(name string, style Style) { Themes[name] = NewTheme(name, style) Styles[name] = style } // GetTheme get defined theme by name func GetTheme(name string) *Theme { return Themes[name] } /************************************************************* * internal styles *************************************************************/ // Styles internal defined styles, like bootstrap styles. // Usage: // color.Styles["info"].Println("message") var Styles = map[string]Style{ "info": {OpReset, FgGreen}, "note": {OpBold, FgLightCyan}, "light": {FgLightWhite, BgRed}, "error": {FgLightWhite, BgRed}, "danger": {OpBold, FgRed}, "notice": {OpBold, FgCyan}, "success": {OpBold, FgGreen}, "comment": {OpReset, FgMagenta}, "primary": {OpReset, FgBlue}, "warning": {OpBold, FgYellow}, "question": {OpReset, FgMagenta}, "secondary": {FgDarkGray}, } // some style name alias var styleAliases = map[string]string{ "err": "error", "suc": "success", "warn": "warning", } // AddStyle add a style func AddStyle(name string, s Style) { Styles[name] = s } // GetStyle get defined style by name func GetStyle(name string) Style { if s, ok := Styles[name]; ok { return s } if realName, ok := styleAliases[name]; ok { return Styles[realName] } // empty style return New() } /************************************************************* * color scheme *************************************************************/ // Scheme struct type Scheme struct { Name string Styles map[string]Style } // NewScheme create new Scheme func NewScheme(name string, styles map[string]Style) *Scheme { return &Scheme{Name: name, Styles: styles} } // NewDefaultScheme create an defuault color Scheme func NewDefaultScheme(name string) *Scheme { return NewScheme(name, map[string]Style{ "info": {OpReset, FgGreen}, "warn": {OpBold, FgYellow}, "error": {FgLightWhite, BgRed}, }) } // Style get by name func (s *Scheme) Style(name string) Style { return s.Styles[name] } // Infof message print func (s *Scheme) Infof(format string, a ...interface{}) { s.Styles["info"].Printf(format, a...) } // Infoln message print func (s *Scheme) Infoln(v ...interface{}) { s.Styles["info"].Println(v...) } // Warnf message print func (s *Scheme) Warnf(format string, a ...interface{}) { s.Styles["warn"].Printf(format, a...) } // Warnln message print func (s *Scheme) Warnln(v ...interface{}) { s.Styles["warn"].Println(v...) } // Errorf message print func (s *Scheme) Errorf(format string, a ...interface{}) { s.Styles["error"].Printf(format, a...) } // Errorln message print func (s *Scheme) Errorln(v ...interface{}) { s.Styles["error"].Println(v...) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/color_tag.go
vendor/github.com/gookit/color/color_tag.go
package color import ( "fmt" "regexp" "strings" ) // output colored text like use html tag. (not support windows cmd) const ( // MatchExpr regex to match color tags // // Notice: golang 不支持反向引用. 即不支持使用 \1 引用第一个匹配 ([a-z=;]+) // MatchExpr = `<([a-z=;]+)>(.*?)<\/\1>` // 所以调整一下 统一使用 `</>` 来结束标签,例如 "<info>some text</>" // // allow custom attrs, eg: "<fg=white;bg=blue;op=bold>content</>" // (?s:...) s - 让 "." 匹配换行 MatchExpr = `<([0-9a-zA-Z_=,;]+)>(?s:(.*?))<\/>` // AttrExpr regex to match custom color attributes // eg: "<fg=white;bg=blue;op=bold>content</>" AttrExpr = `(fg|bg|op)[\s]*=[\s]*([0-9a-zA-Z,]+);?` // StripExpr regex used for removing color tags // StripExpr = `<[\/]?[a-zA-Z=;]+>` // 随着上面的做一些调整 StripExpr = `<[\/]?[0-9a-zA-Z_=,;]*>` ) var ( attrRegex = regexp.MustCompile(AttrExpr) matchRegex = regexp.MustCompile(MatchExpr) stripRegex = regexp.MustCompile(StripExpr) ) /************************************************************* * internal defined color tags *************************************************************/ // There are internal defined color tags // Usage: <tag>content text</> // @notice 加 0 在前面是为了防止之前的影响到现在的设置 var colorTags = map[string]string{ // basic tags "red": "0;31", "red1": "1;31", // with bold "redB": "1;31", "red_b": "1;31", "blue": "0;34", "blue1": "1;34", // with bold "blueB": "1;34", "blue_b": "1;34", "cyan": "0;36", "cyan1": "1;36", // with bold "cyanB": "1;36", "cyan_b": "1;36", "green": "0;32", "green1": "1;32", // with bold "greenB": "1;32", "green_b": "1;32", "black": "0;30", "white": "1;37", "default": "0;39", // no color "normal": "0;39", // no color "brown": "0;33", // #A52A2A "yellow": "0;33", "ylw0": "0;33", "yellowB": "1;33", // with bold "ylw1": "1;33", "ylwB": "1;33", "magenta": "0;35", "mga": "0;35", // short name "magentaB": "1;35", // with bold "mgb": "1;35", "mgaB": "1;35", // light/hi tags "gray": "0;90", "darkGray": "0;90", "dark_gray": "0;90", "lightYellow": "0;93", "light_yellow": "0;93", "hiYellow": "0;93", "hi_yellow": "0;93", "hiYellowB": "1;93", // with bold "hi_yellow_b": "1;93", "lightMagenta": "0;95", "light_magenta": "0;95", "hiMagenta": "0;95", "hi_magenta": "0;95", "lightMagentaB": "1;95", // with bold "hiMagentaB": "1;95", // with bold "hi_magenta_b": "1;95", "lightRed": "0;91", "light_red": "0;91", "hiRed": "0;91", "hi_red": "0;91", "lightRedB": "1;91", // with bold "light_red_b": "1;91", "hi_red_b": "1;91", "lightGreen": "0;92", "light_green": "0;92", "hiGreen": "0;92", "hi_green": "0;92", "lightGreenB": "1;92", "light_green_b": "1;92", "hi_green_b": "1;92", "lightBlue": "0;94", "light_blue": "0;94", "hiBlue": "0;94", "hi_blue": "0;94", "lightBlueB": "1;94", "light_blue_b": "1;94", "hi_blue_b": "1;94", "lightCyan": "0;96", "light_cyan": "0;96", "hiCyan": "0;96", "hi_cyan": "0;96", "lightCyanB": "1;96", "light_cyan_b": "1;96", "hi_cyan_b": "1;96", "lightWhite": "0;97;40", "light_white": "0;97;40", // option "bold": "1", "b": "1", "underscore": "4", "us": "4", // short name for 'underscore' "reverse": "7", // alert tags, like bootstrap's alert "suc": "1;32", // same "green" and "bold" "success": "1;32", "info": "0;32", // same "green", "comment": "0;33", // same "brown" "note": "36;1", "notice": "36;4", "warn": "0;1;33", "warning": "0;30;43", "primary": "0;34", "danger": "1;31", // same "red" but add bold "err": "97;41", "error": "97;41", // fg light white; bg red } /************************************************************* * parse color tags *************************************************************/ var ( tagParser = TagParser{} rxNumStr = regexp.MustCompile("^[0-9]{1,3}$") rxHexCode = regexp.MustCompile("^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$") ) // TagParser struct type TagParser struct { disable bool } // NewTagParser create func NewTagParser() *TagParser { return &TagParser{} } // func (tp *TagParser) Disable() *TagParser { // tp.disable = true // return tp // } // ParseByEnv parse given string. will check package setting. func (tp *TagParser) ParseByEnv(str string) string { // disable handler TAG if !RenderTag { return str } // disable OR not support color if !Enable || !SupportColor() { return ClearTag(str) } return tp.Parse(str) } // Parse parse given string, replace color tag and return rendered string func (tp *TagParser) Parse(str string) string { // not contains color tag if !strings.Contains(str, "</>") { return str } // find color tags by regex. str eg: "<fg=white;bg=blue;op=bold>content</>" matched := matchRegex.FindAllStringSubmatch(str, -1) // item: 0 full text 1 tag name 2 tag content for _, item := range matched { full, tag, content := item[0], item[1], item[2] // use defined tag name: "<info>content</>" -> tag: "info" if !strings.ContainsRune(tag, '=') { code := colorTags[tag] if len(code) > 0 { now := RenderString(code, content) // old := WrapTag(content, tag) is equals to var 'full' str = strings.Replace(str, full, now, 1) } continue } // custom color in tag // - basic: "fg=white;bg=blue;op=bold" if code := ParseCodeFromAttr(tag); len(code) > 0 { now := RenderString(code, content) str = strings.Replace(str, full, now, 1) } } return str } // func (tp *TagParser) ParseAttr(attr string) (code string) { // return // } // ReplaceTag parse string, replace color tag and return rendered string func ReplaceTag(str string) string { return tagParser.ParseByEnv(str) } // ParseCodeFromAttr parse color attributes. // // attr format: // // VALUE please see var: FgColors, BgColors, AllOptions // "fg=VALUE;bg=VALUE;op=VALUE" // 16 color: // "fg=yellow" // "bg=red" // "op=bold,underscore" option is allow multi value // "fg=white;bg=blue;op=bold" // "fg=white;op=bold,underscore" // 256 color: // "fg=167" // "fg=167;bg=23" // "fg=167;bg=23;op=bold" // true color: // // hex // "fg=fc1cac" // "fg=fc1cac;bg=c2c3c4" // // r,g,b // "fg=23,45,214" // "fg=23,45,214;bg=109,99,88" func ParseCodeFromAttr(attr string) (code string) { if !strings.ContainsRune(attr, '=') { return } attr = strings.Trim(attr, ";=,") if len(attr) == 0 { return } var codes []string matched := attrRegex.FindAllStringSubmatch(attr, -1) for _, item := range matched { pos, val := item[1], item[2] switch pos { case "fg": if c, ok := FgColors[val]; ok { // basic codes = append(codes, c.String()) } else if c, ok := ExFgColors[val]; ok { // extra codes = append(codes, c.String()) } else if code := rgbHex256toCode(val, false); code != "" { codes = append(codes, code) } case "bg": if c, ok := BgColors[val]; ok { // basic bg codes = append(codes, c.String()) } else if c, ok := ExBgColors[val]; ok { // extra bg codes = append(codes, c.String()) } else if code := rgbHex256toCode(val, true); code != "" { codes = append(codes, code) } case "op": // options allow multi value if strings.Contains(val, ",") { ns := strings.Split(val, ",") for _, n := range ns { if c, ok := AllOptions[n]; ok { codes = append(codes, c.String()) } } } else if c, ok := AllOptions[val]; ok { codes = append(codes, c.String()) } } } return strings.Join(codes, ";") } func rgbHex256toCode(val string, isBg bool) (code string) { if len(val) == 6 && rxHexCode.MatchString(val) { // hex: "fc1cac" code = HEX(val, isBg).String() } else if strings.ContainsRune(val, ',') { // rgb: "231,178,161" code = strings.Replace(val, ",", ";", -1) if isBg { code = BgRGBPfx + code } else { code = FgRGBPfx + code } } else if len(val) < 4 && rxNumStr.MatchString(val) { // 256 code if isBg { code = Bg256Pfx + val } else { code = Fg256Pfx + val } } return } // ClearTag clear all tag for a string func ClearTag(s string) string { if !strings.Contains(s, "</>") { return s } return stripRegex.ReplaceAllString(s, "") } /************************************************************* * helper methods *************************************************************/ // GetTagCode get color code by tag name func GetTagCode(name string) string { return colorTags[name] } // ApplyTag for messages func ApplyTag(tag string, a ...interface{}) string { return RenderCode(GetTagCode(tag), a...) } // WrapTag wrap a tag for a string "<tag>content</>" func WrapTag(s string, tag string) string { if s == "" || tag == "" { return s } return fmt.Sprintf("<%s>%s</>", tag, s) } // GetColorTags get all internal color tags func GetColorTags() map[string]string { return colorTags } // IsDefinedTag is defined tag name func IsDefinedTag(name string) bool { _, ok := colorTags[name] return ok } /************************************************************* * Tag extra *************************************************************/ // Tag value is a defined style name // Usage: // Tag("info").Println("message") type Tag string // Print messages func (tg Tag) Print(a ...interface{}) { name := string(tg) str := fmt.Sprint(a...) if stl := GetStyle(name); !stl.IsEmpty() { stl.Print(str) } else { doPrintV2(GetTagCode(name), str) } } // Printf format and print messages func (tg Tag) Printf(format string, a ...interface{}) { name := string(tg) str := fmt.Sprintf(format, a...) if stl := GetStyle(name); !stl.IsEmpty() { stl.Print(str) } else { doPrintV2(GetTagCode(name), str) } } // Println messages line func (tg Tag) Println(a ...interface{}) { name := string(tg) if stl := GetStyle(name); !stl.IsEmpty() { stl.Println(a...) } else { doPrintlnV2(GetTagCode(name), a) } } // Sprint render messages func (tg Tag) Sprint(a ...interface{}) string { name := string(tg) // if stl := GetStyle(name); !stl.IsEmpty() { // return stl.Render(args...) // } return RenderCode(GetTagCode(name), a...) } // Sprintf format and render messages func (tg Tag) Sprintf(format string, a ...interface{}) string { tag := string(tg) str := fmt.Sprintf(format, a...) return RenderString(GetTagCode(tag), str) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/gookit/color/detect_env.go
vendor/github.com/gookit/color/detect_env.go
package color import ( "io" "io/ioutil" "os" "runtime" "strconv" "strings" "syscall" "github.com/xo/terminfo" ) /************************************************************* * helper methods for detect color supports *************************************************************/ // DetectColorLevel for current env // // NOTICE: The method will detect terminal info each times, // if only want get current color level, please direct call SupportColor() or TermColorLevel() func DetectColorLevel() terminfo.ColorLevel { level, _ := detectTermColorLevel() return level } // detect terminal color support level // // refer https://github.com/Delta456/box-cli-maker func detectTermColorLevel() (level terminfo.ColorLevel, needVTP bool) { // on windows WSL: // - runtime.GOOS == "Linux" // - support true-color // env: // WSL_DISTRO_NAME=Debian if val := os.Getenv("WSL_DISTRO_NAME"); val != "" { // detect WSL as it has True Color support if detectWSL() { debugf("True Color support on WSL environment") return terminfo.ColorLevelMillions, false } } isWin := runtime.GOOS == "windows" termVal := os.Getenv("TERM") // on TERM=screen: not support true-color if termVal != "screen" { // On JetBrains Terminal // - support true-color // env: // TERMINAL_EMULATOR=JetBrains-JediTerm val := os.Getenv("TERMINAL_EMULATOR") if val == "JetBrains-JediTerm" { debugf("True Color support on JetBrains-JediTerm, is win: %v", isWin) return terminfo.ColorLevelMillions, isWin } } // level, err = terminfo.ColorLevelFromEnv() level = detectColorLevelFromEnv(termVal, isWin) debugf("color level by detectColorLevelFromEnv: %s", level.String()) // fallback: simple detect by TERM value string. if level == terminfo.ColorLevelNone { debugf("level none - fallback check special term color support") // on Windows: enable VTP as it has True Color support level, needVTP = detectSpecialTermColor(termVal) } return } // detectColorFromEnv returns the color level COLORTERM, FORCE_COLOR, // TERM_PROGRAM, or determined from the TERM environment variable. // // refer the terminfo.ColorLevelFromEnv() // https://en.wikipedia.org/wiki/Terminfo func detectColorLevelFromEnv(termVal string, isWin bool) terminfo.ColorLevel { // check for overriding environment variables colorTerm, termProg, forceColor := os.Getenv("COLORTERM"), os.Getenv("TERM_PROGRAM"), os.Getenv("FORCE_COLOR") switch { case strings.Contains(colorTerm, "truecolor") || strings.Contains(colorTerm, "24bit"): if termVal == "screen" { // on TERM=screen: not support true-color return terminfo.ColorLevelHundreds } return terminfo.ColorLevelMillions case colorTerm != "" || forceColor != "": return terminfo.ColorLevelBasic case termProg == "Apple_Terminal": return terminfo.ColorLevelHundreds case termProg == "Terminus" || termProg == "Hyper": if termVal == "screen" { // on TERM=screen: not support true-color return terminfo.ColorLevelHundreds } return terminfo.ColorLevelMillions case termProg == "iTerm.app": if termVal == "screen" { // on TERM=screen: not support true-color return terminfo.ColorLevelHundreds } // check iTerm version ver := os.Getenv("TERM_PROGRAM_VERSION") if ver != "" { i, err := strconv.Atoi(strings.Split(ver, ".")[0]) if err != nil { saveInternalError(terminfo.ErrInvalidTermProgramVersion) // return terminfo.ColorLevelNone return terminfo.ColorLevelHundreds } if i == 3 { return terminfo.ColorLevelMillions } } return terminfo.ColorLevelHundreds } // otherwise determine from TERM's max_colors capability if !isWin && termVal != "" { debugf("TERM=%s - check color level by load terminfo file", termVal) ti, err := terminfo.Load(termVal) if err != nil { saveInternalError(err) return terminfo.ColorLevelNone } debugf("the loaded term info file is: %s", ti.File) v, ok := ti.Nums[terminfo.MaxColors] switch { case !ok || v <= 16: return terminfo.ColorLevelNone case ok && v >= 256: return terminfo.ColorLevelHundreds } return terminfo.ColorLevelBasic } // no TERM env value. default return none level return terminfo.ColorLevelNone // return terminfo.ColorLevelBasic } var detectedWSL bool var wslContents string // https://github.com/Microsoft/WSL/issues/423#issuecomment-221627364 func detectWSL() bool { if !detectedWSL { b := make([]byte, 1024) // `cat /proc/version` // on mac: // !not the file! // on linux(debian,ubuntu,alpine): // Linux version 4.19.121-linuxkit (root@18b3f92ade35) (gcc version 9.2.0 (Alpine 9.2.0)) #1 SMP Thu Jan 21 15:36:34 UTC 2021 // on win git bash, conEmu: // MINGW64_NT-10.0-19042 version 3.1.7-340.x86_64 (@WIN-N0G619FD3UK) (gcc version 9.3.0 (GCC) ) 2020-10-23 13:08 UTC // on WSL: // Linux version 4.4.0-19041-Microsoft (Microsoft@Microsoft.com) (gcc version 5.4.0 (GCC) ) #488-Microsoft Mon Sep 01 13:43:00 PST 2020 f, err := os.Open("/proc/version") if err == nil { _, _ = f.Read(b) // ignore error if err = f.Close(); err != nil { saveInternalError(err) } wslContents = string(b) } detectedWSL = true } return strings.Contains(wslContents, "Microsoft") } // refer // https://github.com/Delta456/box-cli-maker/blob/7b5a1ad8a016ce181e7d8b05e24b54ff60b4b38a/detect_unix.go#L27-L45 // detect WSL as it has True Color support func isWSL() bool { // on windows WSL: // - runtime.GOOS == "Linux" // - support true-color // WSL_DISTRO_NAME=Debian if val := os.Getenv("WSL_DISTRO_NAME"); val == "" { return false } // `cat /proc/sys/kernel/osrelease` // on mac: // !not the file! // on linux: // 4.19.121-linuxkit // on WSL Output: // 4.4.0-19041-Microsoft wsl, err := ioutil.ReadFile("/proc/sys/kernel/osrelease") if err != nil { saveInternalError(err) return false } // it gives "Microsoft" for WSL and "microsoft" for WSL 2 // it support True-color content := strings.ToLower(string(wsl)) return strings.Contains(content, "microsoft") } /************************************************************* * helper methods for check env *************************************************************/ // IsWindows OS env func IsWindows() bool { return runtime.GOOS == "windows" } // IsConsole Determine whether w is one of stderr, stdout, stdin func IsConsole(w io.Writer) bool { o, ok := w.(*os.File) if !ok { return false } fd := o.Fd() // fix: cannot use 'o == os.Stdout' to compare return fd == uintptr(syscall.Stdout) || fd == uintptr(syscall.Stdin) || fd == uintptr(syscall.Stderr) } // IsMSys msys(MINGW64) environment, does not necessarily support color func IsMSys() bool { // like "MSYSTEM=MINGW64" if len(os.Getenv("MSYSTEM")) > 0 { return true } return false } // IsSupportColor check current console is support color. // // NOTICE: The method will detect terminal info each times, // if only want get current color level, please direct call SupportColor() or TermColorLevel() func IsSupportColor() bool { return IsSupport16Color() } // IsSupportColor check current console is support color. // // NOTICE: The method will detect terminal info each times, // if only want get current color level, please direct call SupportColor() or TermColorLevel() func IsSupport16Color() bool { level, _ := detectTermColorLevel() return level > terminfo.ColorLevelNone } // IsSupport256Color render check // // NOTICE: The method will detect terminal info each times, // if only want get current color level, please direct call SupportColor() or TermColorLevel() func IsSupport256Color() bool { level, _ := detectTermColorLevel() return level > terminfo.ColorLevelBasic } // IsSupportRGBColor check. alias of the IsSupportTrueColor() // // NOTICE: The method will detect terminal info each times, // if only want get current color level, please direct call SupportColor() or TermColorLevel() func IsSupportRGBColor() bool { return IsSupportTrueColor() } // IsSupportTrueColor render check. // // NOTICE: The method will detect terminal info each times, // if only want get current color level, please direct call SupportColor() or TermColorLevel() // // ENV: // "COLORTERM=truecolor" // "COLORTERM=24bit" func IsSupportTrueColor() bool { level, _ := detectTermColorLevel() return level > terminfo.ColorLevelHundreds }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/github.com/jbenet/go-context/io/ctxio.go
vendor/github.com/jbenet/go-context/io/ctxio.go
// Package ctxio provides io.Reader and io.Writer wrappers that // respect context.Contexts. Use these at the interface between // your context code and your io. // // WARNING: read the code. see how writes and reads will continue // until you cancel the io. Maybe this package should provide // versions of io.ReadCloser and io.WriteCloser that automatically // call .Close when the context expires. But for now -- since in my // use cases I have long-lived connections with ephemeral io wrappers // -- this has yet to be a need. package ctxio import ( "io" context "golang.org/x/net/context" ) type ioret struct { n int err error } type Writer interface { io.Writer } type ctxWriter struct { w io.Writer ctx context.Context } // NewWriter wraps a writer to make it respect given Context. // If there is a blocking write, the returned Writer will return // whenever the context is cancelled (the return values are n=0 // and err=ctx.Err().) // // Note well: this wrapper DOES NOT ACTUALLY cancel the underlying // write-- there is no way to do that with the standard go io // interface. So the read and write _will_ happen or hang. So, use // this sparingly, make sure to cancel the read or write as necesary // (e.g. closing a connection whose context is up, etc.) // // Furthermore, in order to protect your memory from being read // _after_ you've cancelled the context, this io.Writer will // first make a **copy** of the buffer. func NewWriter(ctx context.Context, w io.Writer) *ctxWriter { if ctx == nil { ctx = context.Background() } return &ctxWriter{ctx: ctx, w: w} } func (w *ctxWriter) Write(buf []byte) (int, error) { buf2 := make([]byte, len(buf)) copy(buf2, buf) c := make(chan ioret, 1) go func() { n, err := w.w.Write(buf2) c <- ioret{n, err} close(c) }() select { case r := <-c: return r.n, r.err case <-w.ctx.Done(): return 0, w.ctx.Err() } } type Reader interface { io.Reader } type ctxReader struct { r io.Reader ctx context.Context } // NewReader wraps a reader to make it respect given Context. // If there is a blocking read, the returned Reader will return // whenever the context is cancelled (the return values are n=0 // and err=ctx.Err().) // // Note well: this wrapper DOES NOT ACTUALLY cancel the underlying // write-- there is no way to do that with the standard go io // interface. So the read and write _will_ happen or hang. So, use // this sparingly, make sure to cancel the read or write as necesary // (e.g. closing a connection whose context is up, etc.) // // Furthermore, in order to protect your memory from being read // _before_ you've cancelled the context, this io.Reader will // allocate a buffer of the same size, and **copy** into the client's // if the read succeeds in time. func NewReader(ctx context.Context, r io.Reader) *ctxReader { return &ctxReader{ctx: ctx, r: r} } func (r *ctxReader) Read(buf []byte) (int, error) { buf2 := make([]byte, len(buf)) c := make(chan ioret, 1) go func() { n, err := r.r.Read(buf2) c <- ioret{n, err} close(c) }() select { case ret := <-c: copy(buf, buf2) return ret.n, ret.err case <-r.ctx.Done(): return 0, r.ctx.Err() } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/yaml.go
vendor/gopkg.in/yaml.v3/yaml.go
// // Copyright (c) 2011-2019 Canonical Ltd // // 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. // Package yaml implements YAML support for the Go language. // // Source code and other details for the project are available at GitHub: // // https://github.com/go-yaml/yaml // package yaml import ( "errors" "fmt" "io" "reflect" "strings" "sync" "unicode/utf8" ) // The Unmarshaler interface may be implemented by types to customize their // behavior when being unmarshaled from a YAML document. type Unmarshaler interface { UnmarshalYAML(value *Node) error } type obsoleteUnmarshaler interface { UnmarshalYAML(unmarshal func(interface{}) error) error } // The Marshaler interface may be implemented by types to customize their // behavior when being marshaled into a YAML document. The returned value // is marshaled in place of the original value implementing Marshaler. // // If an error is returned by MarshalYAML, the marshaling procedure stops // and returns with the provided error. type Marshaler interface { MarshalYAML() (interface{}, error) } // Unmarshal decodes the first document found within the in byte slice // and assigns decoded values into the out value. // // Maps and pointers (to a struct, string, int, etc) are accepted as out // values. If an internal pointer within a struct is not initialized, // the yaml package will initialize it if necessary for unmarshalling // the provided data. The out parameter must not be nil. // // The type of the decoded values should be compatible with the respective // values in out. If one or more values cannot be decoded due to a type // mismatches, decoding continues partially until the end of the YAML // content, and a *yaml.TypeError is returned with details for all // missed values. // // Struct fields are only unmarshalled if they are exported (have an // upper case first letter), and are unmarshalled using the field name // lowercased as the default key. Custom keys may be defined via the // "yaml" name in the field tag: the content preceding the first comma // is used as the key, and the following comma-separated options are // used to tweak the marshalling process (see Marshal). // Conflicting names result in a runtime error. // // For example: // // type T struct { // F int `yaml:"a,omitempty"` // B int // } // var t T // yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) // // See the documentation of Marshal for the format of tags and a list of // supported tag options. // func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } // A Decoder reads and decodes YAML values from an input stream. type Decoder struct { parser *parser knownFields bool } // NewDecoder returns a new decoder that reads from r. // // The decoder introduces its own buffering and may read // data from r beyond the YAML values requested. func NewDecoder(r io.Reader) *Decoder { return &Decoder{ parser: newParserFromReader(r), } } // KnownFields ensures that the keys in decoded mappings to // exist as fields in the struct being decoded into. func (dec *Decoder) KnownFields(enable bool) { dec.knownFields = enable } // Decode reads the next YAML-encoded value from its input // and stores it in the value pointed to by v. // // See the documentation for Unmarshal for details about the // conversion of YAML into a Go value. func (dec *Decoder) Decode(v interface{}) (err error) { d := newDecoder() d.knownFields = dec.knownFields defer handleErr(&err) node := dec.parser.parse() if node == nil { return io.EOF } out := reflect.ValueOf(v) if out.Kind() == reflect.Ptr && !out.IsNil() { out = out.Elem() } d.unmarshal(node, out) if len(d.terrors) > 0 { return &TypeError{d.terrors} } return nil } // Decode decodes the node and stores its data into the value pointed to by v. // // See the documentation for Unmarshal for details about the // conversion of YAML into a Go value. func (n *Node) Decode(v interface{}) (err error) { d := newDecoder() defer handleErr(&err) out := reflect.ValueOf(v) if out.Kind() == reflect.Ptr && !out.IsNil() { out = out.Elem() } d.unmarshal(n, out) if len(d.terrors) > 0 { return &TypeError{d.terrors} } return nil } func unmarshal(in []byte, out interface{}, strict bool) (err error) { defer handleErr(&err) d := newDecoder() p := newParser(in) defer p.destroy() node := p.parse() if node != nil { v := reflect.ValueOf(out) if v.Kind() == reflect.Ptr && !v.IsNil() { v = v.Elem() } d.unmarshal(node, v) } if len(d.terrors) > 0 { return &TypeError{d.terrors} } return nil } // Marshal serializes the value provided into a YAML document. The structure // of the generated document will reflect the structure of the value itself. // Maps and pointers (to struct, string, int, etc) are accepted as the in value. // // Struct fields are only marshalled if they are exported (have an upper case // first letter), and are marshalled using the field name lowercased as the // default key. Custom keys may be defined via the "yaml" name in the field // tag: the content preceding the first comma is used as the key, and the // following comma-separated options are used to tweak the marshalling process. // Conflicting names result in a runtime error. // // The field tag format accepted is: // // `(...) yaml:"[<key>][,<flag1>[,<flag2>]]" (...)` // // The following flags are currently supported: // // omitempty Only include the field if it's not set to the zero // value for the type or to empty slices or maps. // Zero valued structs will be omitted if all their public // fields are zero, unless they implement an IsZero // method (see the IsZeroer interface type), in which // case the field will be excluded if IsZero returns true. // // flow Marshal using a flow style (useful for structs, // sequences and maps). // // inline Inline the field, which must be a struct or a map, // causing all of its fields or keys to be processed as if // they were part of the outer struct. For maps, keys must // not conflict with the yaml keys of other struct fields. // // In addition, if the key is "-", the field is ignored. // // For example: // // type T struct { // F int `yaml:"a,omitempty"` // B int // } // yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" // yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" // func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() defer e.destroy() e.marshalDoc("", reflect.ValueOf(in)) e.finish() out = e.out return } // An Encoder writes YAML values to an output stream. type Encoder struct { encoder *encoder } // NewEncoder returns a new encoder that writes to w. // The Encoder should be closed after use to flush all data // to w. func NewEncoder(w io.Writer) *Encoder { return &Encoder{ encoder: newEncoderWithWriter(w), } } // Encode writes the YAML encoding of v to the stream. // If multiple items are encoded to the stream, the // second and subsequent document will be preceded // with a "---" document separator, but the first will not. // // See the documentation for Marshal for details about the conversion of Go // values to YAML. func (e *Encoder) Encode(v interface{}) (err error) { defer handleErr(&err) e.encoder.marshalDoc("", reflect.ValueOf(v)) return nil } // Encode encodes value v and stores its representation in n. // // See the documentation for Marshal for details about the // conversion of Go values into YAML. func (n *Node) Encode(v interface{}) (err error) { defer handleErr(&err) e := newEncoder() defer e.destroy() e.marshalDoc("", reflect.ValueOf(v)) e.finish() p := newParser(e.out) p.textless = true defer p.destroy() doc := p.parse() *n = *doc.Content[0] return nil } // SetIndent changes the used indentation used when encoding. func (e *Encoder) SetIndent(spaces int) { if spaces < 0 { panic("yaml: cannot indent to a negative number of spaces") } e.encoder.indent = spaces } // Close closes the encoder by writing any remaining data. // It does not write a stream terminating string "...". func (e *Encoder) Close() (err error) { defer handleErr(&err) e.encoder.finish() return nil } func handleErr(err *error) { if v := recover(); v != nil { if e, ok := v.(yamlError); ok { *err = e.err } else { panic(v) } } } type yamlError struct { err error } func fail(err error) { panic(yamlError{err}) } func failf(format string, args ...interface{}) { panic(yamlError{fmt.Errorf("yaml: "+format, args...)}) } // A TypeError is returned by Unmarshal when one or more fields in // the YAML document cannot be properly decoded into the requested // types. When this error is returned, the value is still // unmarshaled partially. type TypeError struct { Errors []string } func (e *TypeError) Error() string { return fmt.Sprintf("yaml: unmarshal errors:\n %s", strings.Join(e.Errors, "\n ")) } type Kind uint32 const ( DocumentNode Kind = 1 << iota SequenceNode MappingNode ScalarNode AliasNode ) type Style uint32 const ( TaggedStyle Style = 1 << iota DoubleQuotedStyle SingleQuotedStyle LiteralStyle FoldedStyle FlowStyle ) // Node represents an element in the YAML document hierarchy. While documents // are typically encoded and decoded into higher level types, such as structs // and maps, Node is an intermediate representation that allows detailed // control over the content being decoded or encoded. // // It's worth noting that although Node offers access into details such as // line numbers, colums, and comments, the content when re-encoded will not // have its original textual representation preserved. An effort is made to // render the data plesantly, and to preserve comments near the data they // describe, though. // // Values that make use of the Node type interact with the yaml package in the // same way any other type would do, by encoding and decoding yaml data // directly or indirectly into them. // // For example: // // var person struct { // Name string // Address yaml.Node // } // err := yaml.Unmarshal(data, &person) // // Or by itself: // // var person Node // err := yaml.Unmarshal(data, &person) // type Node struct { // Kind defines whether the node is a document, a mapping, a sequence, // a scalar value, or an alias to another node. The specific data type of // scalar nodes may be obtained via the ShortTag and LongTag methods. Kind Kind // Style allows customizing the apperance of the node in the tree. Style Style // Tag holds the YAML tag defining the data type for the value. // When decoding, this field will always be set to the resolved tag, // even when it wasn't explicitly provided in the YAML content. // When encoding, if this field is unset the value type will be // implied from the node properties, and if it is set, it will only // be serialized into the representation if TaggedStyle is used or // the implicit tag diverges from the provided one. Tag string // Value holds the unescaped and unquoted represenation of the value. Value string // Anchor holds the anchor name for this node, which allows aliases to point to it. Anchor string // Alias holds the node that this alias points to. Only valid when Kind is AliasNode. Alias *Node // Content holds contained nodes for documents, mappings, and sequences. Content []*Node // HeadComment holds any comments in the lines preceding the node and // not separated by an empty line. HeadComment string // LineComment holds any comments at the end of the line where the node is in. LineComment string // FootComment holds any comments following the node and before empty lines. FootComment string // Line and Column hold the node position in the decoded YAML text. // These fields are not respected when encoding the node. Line int Column int } // IsZero returns whether the node has all of its fields unset. func (n *Node) IsZero() bool { return n.Kind == 0 && n.Style == 0 && n.Tag == "" && n.Value == "" && n.Anchor == "" && n.Alias == nil && n.Content == nil && n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0 } // LongTag returns the long form of the tag that indicates the data type for // the node. If the Tag field isn't explicitly defined, one will be computed // based on the node properties. func (n *Node) LongTag() string { return longTag(n.ShortTag()) } // ShortTag returns the short form of the YAML tag that indicates data type for // the node. If the Tag field isn't explicitly defined, one will be computed // based on the node properties. func (n *Node) ShortTag() string { if n.indicatedString() { return strTag } if n.Tag == "" || n.Tag == "!" { switch n.Kind { case MappingNode: return mapTag case SequenceNode: return seqTag case AliasNode: if n.Alias != nil { return n.Alias.ShortTag() } case ScalarNode: tag, _ := resolve("", n.Value) return tag case 0: // Special case to make the zero value convenient. if n.IsZero() { return nullTag } } return "" } return shortTag(n.Tag) } func (n *Node) indicatedString() bool { return n.Kind == ScalarNode && (shortTag(n.Tag) == strTag || (n.Tag == "" || n.Tag == "!") && n.Style&(SingleQuotedStyle|DoubleQuotedStyle|LiteralStyle|FoldedStyle) != 0) } // SetString is a convenience function that sets the node to a string value // and defines its style in a pleasant way depending on its content. func (n *Node) SetString(s string) { n.Kind = ScalarNode if utf8.ValidString(s) { n.Value = s n.Tag = strTag } else { n.Value = encodeBase64(s) n.Tag = binaryTag } if strings.Contains(n.Value, "\n") { n.Style = LiteralStyle } } // -------------------------------------------------------------------------- // Maintain a mapping of keys to structure field indexes // The code in this section was copied from mgo/bson. // structInfo holds details for the serialization of fields of // a given struct. type structInfo struct { FieldsMap map[string]fieldInfo FieldsList []fieldInfo // InlineMap is the number of the field in the struct that // contains an ,inline map, or -1 if there's none. InlineMap int // InlineUnmarshalers holds indexes to inlined fields that // contain unmarshaler values. InlineUnmarshalers [][]int } type fieldInfo struct { Key string Num int OmitEmpty bool Flow bool // Id holds the unique field identifier, so we can cheaply // check for field duplicates without maintaining an extra map. Id int // Inline holds the field index if the field is part of an inlined struct. Inline []int } var structMap = make(map[reflect.Type]*structInfo) var fieldMapMutex sync.RWMutex var unmarshalerType reflect.Type func init() { var v Unmarshaler unmarshalerType = reflect.ValueOf(&v).Elem().Type() } func getStructInfo(st reflect.Type) (*structInfo, error) { fieldMapMutex.RLock() sinfo, found := structMap[st] fieldMapMutex.RUnlock() if found { return sinfo, nil } n := st.NumField() fieldsMap := make(map[string]fieldInfo) fieldsList := make([]fieldInfo, 0, n) inlineMap := -1 inlineUnmarshalers := [][]int(nil) for i := 0; i != n; i++ { field := st.Field(i) if field.PkgPath != "" && !field.Anonymous { continue // Private field } info := fieldInfo{Num: i} tag := field.Tag.Get("yaml") if tag == "" && strings.Index(string(field.Tag), ":") < 0 { tag = string(field.Tag) } if tag == "-" { continue } inline := false fields := strings.Split(tag, ",") if len(fields) > 1 { for _, flag := range fields[1:] { switch flag { case "omitempty": info.OmitEmpty = true case "flow": info.Flow = true case "inline": inline = true default: return nil, errors.New(fmt.Sprintf("unsupported flag %q in tag %q of type %s", flag, tag, st)) } } tag = fields[0] } if inline { switch field.Type.Kind() { case reflect.Map: if inlineMap >= 0 { return nil, errors.New("multiple ,inline maps in struct " + st.String()) } if field.Type.Key() != reflect.TypeOf("") { return nil, errors.New("option ,inline needs a map with string keys in struct " + st.String()) } inlineMap = info.Num case reflect.Struct, reflect.Ptr: ftype := field.Type for ftype.Kind() == reflect.Ptr { ftype = ftype.Elem() } if ftype.Kind() != reflect.Struct { return nil, errors.New("option ,inline may only be used on a struct or map field") } if reflect.PtrTo(ftype).Implements(unmarshalerType) { inlineUnmarshalers = append(inlineUnmarshalers, []int{i}) } else { sinfo, err := getStructInfo(ftype) if err != nil { return nil, err } for _, index := range sinfo.InlineUnmarshalers { inlineUnmarshalers = append(inlineUnmarshalers, append([]int{i}, index...)) } for _, finfo := range sinfo.FieldsList { if _, found := fieldsMap[finfo.Key]; found { msg := "duplicated key '" + finfo.Key + "' in struct " + st.String() return nil, errors.New(msg) } if finfo.Inline == nil { finfo.Inline = []int{i, finfo.Num} } else { finfo.Inline = append([]int{i}, finfo.Inline...) } finfo.Id = len(fieldsList) fieldsMap[finfo.Key] = finfo fieldsList = append(fieldsList, finfo) } } default: return nil, errors.New("option ,inline may only be used on a struct or map field") } continue } if tag != "" { info.Key = tag } else { info.Key = strings.ToLower(field.Name) } if _, found = fieldsMap[info.Key]; found { msg := "duplicated key '" + info.Key + "' in struct " + st.String() return nil, errors.New(msg) } info.Id = len(fieldsList) fieldsList = append(fieldsList, info) fieldsMap[info.Key] = info } sinfo = &structInfo{ FieldsMap: fieldsMap, FieldsList: fieldsList, InlineMap: inlineMap, InlineUnmarshalers: inlineUnmarshalers, } fieldMapMutex.Lock() structMap[st] = sinfo fieldMapMutex.Unlock() return sinfo, nil } // IsZeroer is used to check whether an object is zero to // determine whether it should be omitted when marshaling // with the omitempty flag. One notable implementation // is time.Time. type IsZeroer interface { IsZero() bool } func isZero(v reflect.Value) bool { kind := v.Kind() if z, ok := v.Interface().(IsZeroer); ok { if (kind == reflect.Ptr || kind == reflect.Interface) && v.IsNil() { return true } return z.IsZero() } switch kind { case reflect.String: return len(v.String()) == 0 case reflect.Interface, reflect.Ptr: return v.IsNil() case reflect.Slice: return v.Len() == 0 case reflect.Map: return v.Len() == 0 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return v.Int() == 0 case reflect.Float32, reflect.Float64: return v.Float() == 0 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: return v.Uint() == 0 case reflect.Bool: return !v.Bool() case reflect.Struct: vt := v.Type() for i := v.NumField() - 1; i >= 0; i-- { if vt.Field(i).PkgPath != "" { continue // Private field } if !isZero(v.Field(i)) { return false } } return true } return false }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/emitterc.go
vendor/gopkg.in/yaml.v3/emitterc.go
// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov // // 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. package yaml import ( "bytes" "fmt" ) // Flush the buffer if needed. func flush(emitter *yaml_emitter_t) bool { if emitter.buffer_pos+5 >= len(emitter.buffer) { return yaml_emitter_flush(emitter) } return true } // Put a character to the output buffer. func put(emitter *yaml_emitter_t, value byte) bool { if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { return false } emitter.buffer[emitter.buffer_pos] = value emitter.buffer_pos++ emitter.column++ return true } // Put a line break to the output buffer. func put_break(emitter *yaml_emitter_t) bool { if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { return false } switch emitter.line_break { case yaml_CR_BREAK: emitter.buffer[emitter.buffer_pos] = '\r' emitter.buffer_pos += 1 case yaml_LN_BREAK: emitter.buffer[emitter.buffer_pos] = '\n' emitter.buffer_pos += 1 case yaml_CRLN_BREAK: emitter.buffer[emitter.buffer_pos+0] = '\r' emitter.buffer[emitter.buffer_pos+1] = '\n' emitter.buffer_pos += 2 default: panic("unknown line break setting") } if emitter.column == 0 { emitter.space_above = true } emitter.column = 0 emitter.line++ // [Go] Do this here and below and drop from everywhere else (see commented lines). emitter.indention = true return true } // Copy a character from a string into buffer. func write(emitter *yaml_emitter_t, s []byte, i *int) bool { if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { return false } p := emitter.buffer_pos w := width(s[*i]) switch w { case 4: emitter.buffer[p+3] = s[*i+3] fallthrough case 3: emitter.buffer[p+2] = s[*i+2] fallthrough case 2: emitter.buffer[p+1] = s[*i+1] fallthrough case 1: emitter.buffer[p+0] = s[*i+0] default: panic("unknown character width") } emitter.column++ emitter.buffer_pos += w *i += w return true } // Write a whole string into buffer. func write_all(emitter *yaml_emitter_t, s []byte) bool { for i := 0; i < len(s); { if !write(emitter, s, &i) { return false } } return true } // Copy a line break character from a string into buffer. func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool { if s[*i] == '\n' { if !put_break(emitter) { return false } *i++ } else { if !write(emitter, s, i) { return false } if emitter.column == 0 { emitter.space_above = true } emitter.column = 0 emitter.line++ // [Go] Do this here and above and drop from everywhere else (see commented lines). emitter.indention = true } return true } // Set an emitter error and return false. func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool { emitter.error = yaml_EMITTER_ERROR emitter.problem = problem return false } // Emit an event. func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { emitter.events = append(emitter.events, *event) for !yaml_emitter_need_more_events(emitter) { event := &emitter.events[emitter.events_head] if !yaml_emitter_analyze_event(emitter, event) { return false } if !yaml_emitter_state_machine(emitter, event) { return false } yaml_event_delete(event) emitter.events_head++ } return true } // Check if we need to accumulate more events before emitting. // // We accumulate extra // - 1 event for DOCUMENT-START // - 2 events for SEQUENCE-START // - 3 events for MAPPING-START // func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { if emitter.events_head == len(emitter.events) { return true } var accumulate int switch emitter.events[emitter.events_head].typ { case yaml_DOCUMENT_START_EVENT: accumulate = 1 break case yaml_SEQUENCE_START_EVENT: accumulate = 2 break case yaml_MAPPING_START_EVENT: accumulate = 3 break default: return false } if len(emitter.events)-emitter.events_head > accumulate { return false } var level int for i := emitter.events_head; i < len(emitter.events); i++ { switch emitter.events[i].typ { case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT: level++ case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT: level-- } if level == 0 { return false } } return true } // Append a directive to the directives stack. func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool { for i := 0; i < len(emitter.tag_directives); i++ { if bytes.Equal(value.handle, emitter.tag_directives[i].handle) { if allow_duplicates { return true } return yaml_emitter_set_emitter_error(emitter, "duplicate %TAG directive") } } // [Go] Do we actually need to copy this given garbage collection // and the lack of deallocating destructors? tag_copy := yaml_tag_directive_t{ handle: make([]byte, len(value.handle)), prefix: make([]byte, len(value.prefix)), } copy(tag_copy.handle, value.handle) copy(tag_copy.prefix, value.prefix) emitter.tag_directives = append(emitter.tag_directives, tag_copy) return true } // Increase the indentation level. func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool { emitter.indents = append(emitter.indents, emitter.indent) if emitter.indent < 0 { if flow { emitter.indent = emitter.best_indent } else { emitter.indent = 0 } } else if !indentless { // [Go] This was changed so that indentations are more regular. if emitter.states[len(emitter.states)-1] == yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE { // The first indent inside a sequence will just skip the "- " indicator. emitter.indent += 2 } else { // Everything else aligns to the chosen indentation. emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent) } } return true } // State dispatcher. func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool { switch emitter.state { default: case yaml_EMIT_STREAM_START_STATE: return yaml_emitter_emit_stream_start(emitter, event) case yaml_EMIT_FIRST_DOCUMENT_START_STATE: return yaml_emitter_emit_document_start(emitter, event, true) case yaml_EMIT_DOCUMENT_START_STATE: return yaml_emitter_emit_document_start(emitter, event, false) case yaml_EMIT_DOCUMENT_CONTENT_STATE: return yaml_emitter_emit_document_content(emitter, event) case yaml_EMIT_DOCUMENT_END_STATE: return yaml_emitter_emit_document_end(emitter, event) case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE: return yaml_emitter_emit_flow_sequence_item(emitter, event, true, false) case yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE: return yaml_emitter_emit_flow_sequence_item(emitter, event, false, true) case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE: return yaml_emitter_emit_flow_sequence_item(emitter, event, false, false) case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE: return yaml_emitter_emit_flow_mapping_key(emitter, event, true, false) case yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE: return yaml_emitter_emit_flow_mapping_key(emitter, event, false, true) case yaml_EMIT_FLOW_MAPPING_KEY_STATE: return yaml_emitter_emit_flow_mapping_key(emitter, event, false, false) case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE: return yaml_emitter_emit_flow_mapping_value(emitter, event, true) case yaml_EMIT_FLOW_MAPPING_VALUE_STATE: return yaml_emitter_emit_flow_mapping_value(emitter, event, false) case yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE: return yaml_emitter_emit_block_sequence_item(emitter, event, true) case yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE: return yaml_emitter_emit_block_sequence_item(emitter, event, false) case yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE: return yaml_emitter_emit_block_mapping_key(emitter, event, true) case yaml_EMIT_BLOCK_MAPPING_KEY_STATE: return yaml_emitter_emit_block_mapping_key(emitter, event, false) case yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE: return yaml_emitter_emit_block_mapping_value(emitter, event, true) case yaml_EMIT_BLOCK_MAPPING_VALUE_STATE: return yaml_emitter_emit_block_mapping_value(emitter, event, false) case yaml_EMIT_END_STATE: return yaml_emitter_set_emitter_error(emitter, "expected nothing after STREAM-END") } panic("invalid emitter state") } // Expect STREAM-START. func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { if event.typ != yaml_STREAM_START_EVENT { return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START") } if emitter.encoding == yaml_ANY_ENCODING { emitter.encoding = event.encoding if emitter.encoding == yaml_ANY_ENCODING { emitter.encoding = yaml_UTF8_ENCODING } } if emitter.best_indent < 2 || emitter.best_indent > 9 { emitter.best_indent = 2 } if emitter.best_width >= 0 && emitter.best_width <= emitter.best_indent*2 { emitter.best_width = 80 } if emitter.best_width < 0 { emitter.best_width = 1<<31 - 1 } if emitter.line_break == yaml_ANY_BREAK { emitter.line_break = yaml_LN_BREAK } emitter.indent = -1 emitter.line = 0 emitter.column = 0 emitter.whitespace = true emitter.indention = true emitter.space_above = true emitter.foot_indent = -1 if emitter.encoding != yaml_UTF8_ENCODING { if !yaml_emitter_write_bom(emitter) { return false } } emitter.state = yaml_EMIT_FIRST_DOCUMENT_START_STATE return true } // Expect DOCUMENT-START or STREAM-END. func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { if event.typ == yaml_DOCUMENT_START_EVENT { if event.version_directive != nil { if !yaml_emitter_analyze_version_directive(emitter, event.version_directive) { return false } } for i := 0; i < len(event.tag_directives); i++ { tag_directive := &event.tag_directives[i] if !yaml_emitter_analyze_tag_directive(emitter, tag_directive) { return false } if !yaml_emitter_append_tag_directive(emitter, tag_directive, false) { return false } } for i := 0; i < len(default_tag_directives); i++ { tag_directive := &default_tag_directives[i] if !yaml_emitter_append_tag_directive(emitter, tag_directive, true) { return false } } implicit := event.implicit if !first || emitter.canonical { implicit = false } if emitter.open_ended && (event.version_directive != nil || len(event.tag_directives) > 0) { if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { return false } if !yaml_emitter_write_indent(emitter) { return false } } if event.version_directive != nil { implicit = false if !yaml_emitter_write_indicator(emitter, []byte("%YAML"), true, false, false) { return false } if !yaml_emitter_write_indicator(emitter, []byte("1.1"), true, false, false) { return false } if !yaml_emitter_write_indent(emitter) { return false } } if len(event.tag_directives) > 0 { implicit = false for i := 0; i < len(event.tag_directives); i++ { tag_directive := &event.tag_directives[i] if !yaml_emitter_write_indicator(emitter, []byte("%TAG"), true, false, false) { return false } if !yaml_emitter_write_tag_handle(emitter, tag_directive.handle) { return false } if !yaml_emitter_write_tag_content(emitter, tag_directive.prefix, true) { return false } if !yaml_emitter_write_indent(emitter) { return false } } } if yaml_emitter_check_empty_document(emitter) { implicit = false } if !implicit { if !yaml_emitter_write_indent(emitter) { return false } if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) { return false } if emitter.canonical || true { if !yaml_emitter_write_indent(emitter) { return false } } } if len(emitter.head_comment) > 0 { if !yaml_emitter_process_head_comment(emitter) { return false } if !put_break(emitter) { return false } } emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE return true } if event.typ == yaml_STREAM_END_EVENT { if emitter.open_ended { if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { return false } if !yaml_emitter_write_indent(emitter) { return false } } if !yaml_emitter_flush(emitter) { return false } emitter.state = yaml_EMIT_END_STATE return true } return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-START or STREAM-END") } // Expect the root node. func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool { emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE) if !yaml_emitter_process_head_comment(emitter) { return false } if !yaml_emitter_emit_node(emitter, event, true, false, false, false) { return false } if !yaml_emitter_process_line_comment(emitter) { return false } if !yaml_emitter_process_foot_comment(emitter) { return false } return true } // Expect DOCUMENT-END. func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool { if event.typ != yaml_DOCUMENT_END_EVENT { return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END") } // [Go] Force document foot separation. emitter.foot_indent = 0 if !yaml_emitter_process_foot_comment(emitter) { return false } emitter.foot_indent = -1 if !yaml_emitter_write_indent(emitter) { return false } if !event.implicit { // [Go] Allocate the slice elsewhere. if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { return false } if !yaml_emitter_write_indent(emitter) { return false } } if !yaml_emitter_flush(emitter) { return false } emitter.state = yaml_EMIT_DOCUMENT_START_STATE emitter.tag_directives = emitter.tag_directives[:0] return true } // Expect a flow item node. func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first, trail bool) bool { if first { if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) { return false } if !yaml_emitter_increase_indent(emitter, true, false) { return false } emitter.flow_level++ } if event.typ == yaml_SEQUENCE_END_EVENT { if emitter.canonical && !first && !trail { if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { return false } } emitter.flow_level-- emitter.indent = emitter.indents[len(emitter.indents)-1] emitter.indents = emitter.indents[:len(emitter.indents)-1] if emitter.column == 0 || emitter.canonical && !first { if !yaml_emitter_write_indent(emitter) { return false } } if !yaml_emitter_write_indicator(emitter, []byte{']'}, false, false, false) { return false } if !yaml_emitter_process_line_comment(emitter) { return false } if !yaml_emitter_process_foot_comment(emitter) { return false } emitter.state = emitter.states[len(emitter.states)-1] emitter.states = emitter.states[:len(emitter.states)-1] return true } if !first && !trail { if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { return false } } if !yaml_emitter_process_head_comment(emitter) { return false } if emitter.column == 0 { if !yaml_emitter_write_indent(emitter) { return false } } if emitter.canonical || emitter.column > emitter.best_width { if !yaml_emitter_write_indent(emitter) { return false } } if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE) } else { emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE) } if !yaml_emitter_emit_node(emitter, event, false, true, false, false) { return false } if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { return false } } if !yaml_emitter_process_line_comment(emitter) { return false } if !yaml_emitter_process_foot_comment(emitter) { return false } return true } // Expect a flow key node. func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first, trail bool) bool { if first { if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) { return false } if !yaml_emitter_increase_indent(emitter, true, false) { return false } emitter.flow_level++ } if event.typ == yaml_MAPPING_END_EVENT { if (emitter.canonical || len(emitter.head_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0) && !first && !trail { if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { return false } } if !yaml_emitter_process_head_comment(emitter) { return false } emitter.flow_level-- emitter.indent = emitter.indents[len(emitter.indents)-1] emitter.indents = emitter.indents[:len(emitter.indents)-1] if emitter.canonical && !first { if !yaml_emitter_write_indent(emitter) { return false } } if !yaml_emitter_write_indicator(emitter, []byte{'}'}, false, false, false) { return false } if !yaml_emitter_process_line_comment(emitter) { return false } if !yaml_emitter_process_foot_comment(emitter) { return false } emitter.state = emitter.states[len(emitter.states)-1] emitter.states = emitter.states[:len(emitter.states)-1] return true } if !first && !trail { if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { return false } } if !yaml_emitter_process_head_comment(emitter) { return false } if emitter.column == 0 { if !yaml_emitter_write_indent(emitter) { return false } } if emitter.canonical || emitter.column > emitter.best_width { if !yaml_emitter_write_indent(emitter) { return false } } if !emitter.canonical && yaml_emitter_check_simple_key(emitter) { emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE) return yaml_emitter_emit_node(emitter, event, false, false, true, true) } if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, false) { return false } emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_VALUE_STATE) return yaml_emitter_emit_node(emitter, event, false, false, true, false) } // Expect a flow value node. func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { if simple { if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { return false } } else { if emitter.canonical || emitter.column > emitter.best_width { if !yaml_emitter_write_indent(emitter) { return false } } if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, false) { return false } } if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE) } else { emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE) } if !yaml_emitter_emit_node(emitter, event, false, false, true, false) { return false } if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { return false } } if !yaml_emitter_process_line_comment(emitter) { return false } if !yaml_emitter_process_foot_comment(emitter) { return false } return true } // Expect a block item node. func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { if first { if !yaml_emitter_increase_indent(emitter, false, false) { return false } } if event.typ == yaml_SEQUENCE_END_EVENT { emitter.indent = emitter.indents[len(emitter.indents)-1] emitter.indents = emitter.indents[:len(emitter.indents)-1] emitter.state = emitter.states[len(emitter.states)-1] emitter.states = emitter.states[:len(emitter.states)-1] return true } if !yaml_emitter_process_head_comment(emitter) { return false } if !yaml_emitter_write_indent(emitter) { return false } if !yaml_emitter_write_indicator(emitter, []byte{'-'}, true, false, true) { return false } emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE) if !yaml_emitter_emit_node(emitter, event, false, true, false, false) { return false } if !yaml_emitter_process_line_comment(emitter) { return false } if !yaml_emitter_process_foot_comment(emitter) { return false } return true } // Expect a block key node. func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { if first { if !yaml_emitter_increase_indent(emitter, false, false) { return false } } if !yaml_emitter_process_head_comment(emitter) { return false } if event.typ == yaml_MAPPING_END_EVENT { emitter.indent = emitter.indents[len(emitter.indents)-1] emitter.indents = emitter.indents[:len(emitter.indents)-1] emitter.state = emitter.states[len(emitter.states)-1] emitter.states = emitter.states[:len(emitter.states)-1] return true } if !yaml_emitter_write_indent(emitter) { return false } if len(emitter.line_comment) > 0 { // [Go] A line comment was provided for the key. That's unusual as the // scanner associates line comments with the value. Either way, // save the line comment and render it appropriately later. emitter.key_line_comment = emitter.line_comment emitter.line_comment = nil } if yaml_emitter_check_simple_key(emitter) { emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE) return yaml_emitter_emit_node(emitter, event, false, false, true, true) } if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, true) { return false } emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_VALUE_STATE) return yaml_emitter_emit_node(emitter, event, false, false, true, false) } // Expect a block value node. func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { if simple { if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { return false } } else { if !yaml_emitter_write_indent(emitter) { return false } if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, true) { return false } } if len(emitter.key_line_comment) > 0 { // [Go] Line comments are generally associated with the value, but when there's // no value on the same line as a mapping key they end up attached to the // key itself. if event.typ == yaml_SCALAR_EVENT { if len(emitter.line_comment) == 0 { // A scalar is coming and it has no line comments by itself yet, // so just let it handle the line comment as usual. If it has a // line comment, we can't have both so the one from the key is lost. emitter.line_comment = emitter.key_line_comment emitter.key_line_comment = nil } } else if event.sequence_style() != yaml_FLOW_SEQUENCE_STYLE && (event.typ == yaml_MAPPING_START_EVENT || event.typ == yaml_SEQUENCE_START_EVENT) { // An indented block follows, so write the comment right now. emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment if !yaml_emitter_process_line_comment(emitter) { return false } emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment } } emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE) if !yaml_emitter_emit_node(emitter, event, false, false, true, false) { return false } if !yaml_emitter_process_line_comment(emitter) { return false } if !yaml_emitter_process_foot_comment(emitter) { return false } return true } func yaml_emitter_silent_nil_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { return event.typ == yaml_SCALAR_EVENT && event.implicit && !emitter.canonical && len(emitter.scalar_data.value) == 0 } // Expect a node. func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t, root bool, sequence bool, mapping bool, simple_key bool) bool { emitter.root_context = root emitter.sequence_context = sequence emitter.mapping_context = mapping emitter.simple_key_context = simple_key switch event.typ { case yaml_ALIAS_EVENT: return yaml_emitter_emit_alias(emitter, event) case yaml_SCALAR_EVENT: return yaml_emitter_emit_scalar(emitter, event) case yaml_SEQUENCE_START_EVENT: return yaml_emitter_emit_sequence_start(emitter, event) case yaml_MAPPING_START_EVENT: return yaml_emitter_emit_mapping_start(emitter, event) default: return yaml_emitter_set_emitter_error(emitter, fmt.Sprintf("expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got %v", event.typ)) } } // Expect ALIAS. func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool { if !yaml_emitter_process_anchor(emitter) { return false } emitter.state = emitter.states[len(emitter.states)-1] emitter.states = emitter.states[:len(emitter.states)-1] return true } // Expect SCALAR. func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool { if !yaml_emitter_select_scalar_style(emitter, event) { return false } if !yaml_emitter_process_anchor(emitter) { return false } if !yaml_emitter_process_tag(emitter) { return false } if !yaml_emitter_increase_indent(emitter, true, false) { return false } if !yaml_emitter_process_scalar(emitter) { return false } emitter.indent = emitter.indents[len(emitter.indents)-1] emitter.indents = emitter.indents[:len(emitter.indents)-1] emitter.state = emitter.states[len(emitter.states)-1] emitter.states = emitter.states[:len(emitter.states)-1] return true } // Expect SEQUENCE-START. func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { if !yaml_emitter_process_anchor(emitter) { return false } if !yaml_emitter_process_tag(emitter) { return false } if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE || yaml_emitter_check_empty_sequence(emitter) { emitter.state = yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE } else { emitter.state = yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE } return true } // Expect MAPPING-START. func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { if !yaml_emitter_process_anchor(emitter) { return false } if !yaml_emitter_process_tag(emitter) { return false } if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE || yaml_emitter_check_empty_mapping(emitter) { emitter.state = yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE } else { emitter.state = yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE } return true } // Check if the document content is an empty scalar. func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool { return false // [Go] Huh? } // Check if the next events represent an empty sequence. func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool { if len(emitter.events)-emitter.events_head < 2 { return false } return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT && emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT } // Check if the next events represent an empty mapping. func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool { if len(emitter.events)-emitter.events_head < 2 { return false } return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT && emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT } // Check if the next node can be expressed as a simple key. func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool { length := 0 switch emitter.events[emitter.events_head].typ { case yaml_ALIAS_EVENT: length += len(emitter.anchor_data.anchor) case yaml_SCALAR_EVENT: if emitter.scalar_data.multiline { return false } length += len(emitter.anchor_data.anchor) + len(emitter.tag_data.handle) + len(emitter.tag_data.suffix) + len(emitter.scalar_data.value) case yaml_SEQUENCE_START_EVENT: if !yaml_emitter_check_empty_sequence(emitter) { return false } length += len(emitter.anchor_data.anchor) + len(emitter.tag_data.handle) + len(emitter.tag_data.suffix) case yaml_MAPPING_START_EVENT: if !yaml_emitter_check_empty_mapping(emitter) { return false } length += len(emitter.anchor_data.anchor) + len(emitter.tag_data.handle) + len(emitter.tag_data.suffix) default: return false } return length <= 128 } // Determine an acceptable scalar style. func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool { no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 if no_tag && !event.implicit && !event.quoted_implicit { return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified") } style := event.scalar_style() if style == yaml_ANY_SCALAR_STYLE { style = yaml_PLAIN_SCALAR_STYLE } if emitter.canonical { style = yaml_DOUBLE_QUOTED_SCALAR_STYLE } if emitter.simple_key_context && emitter.scalar_data.multiline { style = yaml_DOUBLE_QUOTED_SCALAR_STYLE } if style == yaml_PLAIN_SCALAR_STYLE { if emitter.flow_level > 0 && !emitter.scalar_data.flow_plain_allowed || emitter.flow_level == 0 && !emitter.scalar_data.block_plain_allowed { style = yaml_SINGLE_QUOTED_SCALAR_STYLE } if len(emitter.scalar_data.value) == 0 && (emitter.flow_level > 0 || emitter.simple_key_context) { style = yaml_SINGLE_QUOTED_SCALAR_STYLE } if no_tag && !event.implicit { style = yaml_SINGLE_QUOTED_SCALAR_STYLE } } if style == yaml_SINGLE_QUOTED_SCALAR_STYLE { if !emitter.scalar_data.single_quoted_allowed { style = yaml_DOUBLE_QUOTED_SCALAR_STYLE } } if style == yaml_LITERAL_SCALAR_STYLE || style == yaml_FOLDED_SCALAR_STYLE { if !emitter.scalar_data.block_allowed || emitter.flow_level > 0 || emitter.simple_key_context { style = yaml_DOUBLE_QUOTED_SCALAR_STYLE } } if no_tag && !event.quoted_implicit && style != yaml_PLAIN_SCALAR_STYLE { emitter.tag_data.handle = []byte{'!'} } emitter.scalar_data.style = style return true } // Write an anchor. func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool { if emitter.anchor_data.anchor == nil { return true } c := []byte{'&'} if emitter.anchor_data.alias { c[0] = '*' } if !yaml_emitter_write_indicator(emitter, c, true, false, false) { return false } return yaml_emitter_write_anchor(emitter, emitter.anchor_data.anchor) } // Write a tag. func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool { if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 { return true } if len(emitter.tag_data.handle) > 0 { if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) { return false } if len(emitter.tag_data.suffix) > 0 { if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { return false } } } else { // [Go] Allocate these slices elsewhere. if !yaml_emitter_write_indicator(emitter, []byte("!<"), true, false, false) { return false } if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { return false }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/resolve.go
vendor/gopkg.in/yaml.v3/resolve.go
// // Copyright (c) 2011-2019 Canonical Ltd // // 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. package yaml import ( "encoding/base64" "math" "regexp" "strconv" "strings" "time" ) type resolveMapItem struct { value interface{} tag string } var resolveTable = make([]byte, 256) var resolveMap = make(map[string]resolveMapItem) func init() { t := resolveTable t[int('+')] = 'S' // Sign t[int('-')] = 'S' for _, c := range "0123456789" { t[int(c)] = 'D' // Digit } for _, c := range "yYnNtTfFoO~" { t[int(c)] = 'M' // In map } t[int('.')] = '.' // Float (potentially in map) var resolveMapList = []struct { v interface{} tag string l []string }{ {true, boolTag, []string{"true", "True", "TRUE"}}, {false, boolTag, []string{"false", "False", "FALSE"}}, {nil, nullTag, []string{"", "~", "null", "Null", "NULL"}}, {math.NaN(), floatTag, []string{".nan", ".NaN", ".NAN"}}, {math.Inf(+1), floatTag, []string{".inf", ".Inf", ".INF"}}, {math.Inf(+1), floatTag, []string{"+.inf", "+.Inf", "+.INF"}}, {math.Inf(-1), floatTag, []string{"-.inf", "-.Inf", "-.INF"}}, {"<<", mergeTag, []string{"<<"}}, } m := resolveMap for _, item := range resolveMapList { for _, s := range item.l { m[s] = resolveMapItem{item.v, item.tag} } } } const ( nullTag = "!!null" boolTag = "!!bool" strTag = "!!str" intTag = "!!int" floatTag = "!!float" timestampTag = "!!timestamp" seqTag = "!!seq" mapTag = "!!map" binaryTag = "!!binary" mergeTag = "!!merge" ) var longTags = make(map[string]string) var shortTags = make(map[string]string) func init() { for _, stag := range []string{nullTag, boolTag, strTag, intTag, floatTag, timestampTag, seqTag, mapTag, binaryTag, mergeTag} { ltag := longTag(stag) longTags[stag] = ltag shortTags[ltag] = stag } } const longTagPrefix = "tag:yaml.org,2002:" func shortTag(tag string) string { if strings.HasPrefix(tag, longTagPrefix) { if stag, ok := shortTags[tag]; ok { return stag } return "!!" + tag[len(longTagPrefix):] } return tag } func longTag(tag string) string { if strings.HasPrefix(tag, "!!") { if ltag, ok := longTags[tag]; ok { return ltag } return longTagPrefix + tag[2:] } return tag } func resolvableTag(tag string) bool { switch tag { case "", strTag, boolTag, intTag, floatTag, nullTag, timestampTag: return true } return false } var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`) func resolve(tag string, in string) (rtag string, out interface{}) { tag = shortTag(tag) if !resolvableTag(tag) { return tag, in } defer func() { switch tag { case "", rtag, strTag, binaryTag: return case floatTag: if rtag == intTag { switch v := out.(type) { case int64: rtag = floatTag out = float64(v) return case int: rtag = floatTag out = float64(v) return } } } failf("cannot decode %s `%s` as a %s", shortTag(rtag), in, shortTag(tag)) }() // Any data is accepted as a !!str or !!binary. // Otherwise, the prefix is enough of a hint about what it might be. hint := byte('N') if in != "" { hint = resolveTable[in[0]] } if hint != 0 && tag != strTag && tag != binaryTag { // Handle things we can lookup in a map. if item, ok := resolveMap[in]; ok { return item.tag, item.value } // Base 60 floats are a bad idea, were dropped in YAML 1.2, and // are purposefully unsupported here. They're still quoted on // the way out for compatibility with other parser, though. switch hint { case 'M': // We've already checked the map above. case '.': // Not in the map, so maybe a normal float. floatv, err := strconv.ParseFloat(in, 64) if err == nil { return floatTag, floatv } case 'D', 'S': // Int, float, or timestamp. // Only try values as a timestamp if the value is unquoted or there's an explicit // !!timestamp tag. if tag == "" || tag == timestampTag { t, ok := parseTimestamp(in) if ok { return timestampTag, t } } plain := strings.Replace(in, "_", "", -1) intv, err := strconv.ParseInt(plain, 0, 64) if err == nil { if intv == int64(int(intv)) { return intTag, int(intv) } else { return intTag, intv } } uintv, err := strconv.ParseUint(plain, 0, 64) if err == nil { return intTag, uintv } if yamlStyleFloat.MatchString(plain) { floatv, err := strconv.ParseFloat(plain, 64) if err == nil { return floatTag, floatv } } if strings.HasPrefix(plain, "0b") { intv, err := strconv.ParseInt(plain[2:], 2, 64) if err == nil { if intv == int64(int(intv)) { return intTag, int(intv) } else { return intTag, intv } } uintv, err := strconv.ParseUint(plain[2:], 2, 64) if err == nil { return intTag, uintv } } else if strings.HasPrefix(plain, "-0b") { intv, err := strconv.ParseInt("-"+plain[3:], 2, 64) if err == nil { if true || intv == int64(int(intv)) { return intTag, int(intv) } else { return intTag, intv } } } // Octals as introduced in version 1.2 of the spec. // Octals from the 1.1 spec, spelled as 0777, are still // decoded by default in v3 as well for compatibility. // May be dropped in v4 depending on how usage evolves. if strings.HasPrefix(plain, "0o") { intv, err := strconv.ParseInt(plain[2:], 8, 64) if err == nil { if intv == int64(int(intv)) { return intTag, int(intv) } else { return intTag, intv } } uintv, err := strconv.ParseUint(plain[2:], 8, 64) if err == nil { return intTag, uintv } } else if strings.HasPrefix(plain, "-0o") { intv, err := strconv.ParseInt("-"+plain[3:], 8, 64) if err == nil { if true || intv == int64(int(intv)) { return intTag, int(intv) } else { return intTag, intv } } } default: panic("internal error: missing handler for resolver table: " + string(rune(hint)) + " (with " + in + ")") } } return strTag, in } // encodeBase64 encodes s as base64 that is broken up into multiple lines // as appropriate for the resulting length. func encodeBase64(s string) string { const lineLen = 70 encLen := base64.StdEncoding.EncodedLen(len(s)) lines := encLen/lineLen + 1 buf := make([]byte, encLen*2+lines) in := buf[0:encLen] out := buf[encLen:] base64.StdEncoding.Encode(in, []byte(s)) k := 0 for i := 0; i < len(in); i += lineLen { j := i + lineLen if j > len(in) { j = len(in) } k += copy(out[k:], in[i:j]) if lines > 1 { out[k] = '\n' k++ } } return string(out[:k]) } // This is a subset of the formats allowed by the regular expression // defined at http://yaml.org/type/timestamp.html. var allowedTimestampFormats = []string{ "2006-1-2T15:4:5.999999999Z07:00", // RCF3339Nano with short date fields. "2006-1-2t15:4:5.999999999Z07:00", // RFC3339Nano with short date fields and lower-case "t". "2006-1-2 15:4:5.999999999", // space separated with no time zone "2006-1-2", // date only // Notable exception: time.Parse cannot handle: "2001-12-14 21:59:43.10 -5" // from the set of examples. } // parseTimestamp parses s as a timestamp string and // returns the timestamp and reports whether it succeeded. // Timestamp formats are defined at http://yaml.org/type/timestamp.html func parseTimestamp(s string) (time.Time, bool) { // TODO write code to check all the formats supported by // http://yaml.org/type/timestamp.html instead of using time.Parse. // Quick check: all date formats start with YYYY-. i := 0 for ; i < len(s); i++ { if c := s[i]; c < '0' || c > '9' { break } } if i != 4 || i == len(s) || s[i] != '-' { return time.Time{}, false } for _, format := range allowedTimestampFormats { if t, err := time.Parse(format, s); err == nil { return t, true } } return time.Time{}, false }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/apic.go
vendor/gopkg.in/yaml.v3/apic.go
// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov // // 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. package yaml import ( "io" ) func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) { //fmt.Println("yaml_insert_token", "pos:", pos, "typ:", token.typ, "head:", parser.tokens_head, "len:", len(parser.tokens)) // Check if we can move the queue at the beginning of the buffer. if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) { if parser.tokens_head != len(parser.tokens) { copy(parser.tokens, parser.tokens[parser.tokens_head:]) } parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head] parser.tokens_head = 0 } parser.tokens = append(parser.tokens, *token) if pos < 0 { return } copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:]) parser.tokens[parser.tokens_head+pos] = *token } // Create a new parser object. func yaml_parser_initialize(parser *yaml_parser_t) bool { *parser = yaml_parser_t{ raw_buffer: make([]byte, 0, input_raw_buffer_size), buffer: make([]byte, 0, input_buffer_size), } return true } // Destroy a parser object. func yaml_parser_delete(parser *yaml_parser_t) { *parser = yaml_parser_t{} } // String read handler. func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { if parser.input_pos == len(parser.input) { return 0, io.EOF } n = copy(buffer, parser.input[parser.input_pos:]) parser.input_pos += n return n, nil } // Reader read handler. func yaml_reader_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { return parser.input_reader.Read(buffer) } // Set a string input. func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) { if parser.read_handler != nil { panic("must set the input source only once") } parser.read_handler = yaml_string_read_handler parser.input = input parser.input_pos = 0 } // Set a file input. func yaml_parser_set_input_reader(parser *yaml_parser_t, r io.Reader) { if parser.read_handler != nil { panic("must set the input source only once") } parser.read_handler = yaml_reader_read_handler parser.input_reader = r } // Set the source encoding. func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) { if parser.encoding != yaml_ANY_ENCODING { panic("must set the encoding only once") } parser.encoding = encoding } // Create a new emitter object. func yaml_emitter_initialize(emitter *yaml_emitter_t) { *emitter = yaml_emitter_t{ buffer: make([]byte, output_buffer_size), raw_buffer: make([]byte, 0, output_raw_buffer_size), states: make([]yaml_emitter_state_t, 0, initial_stack_size), events: make([]yaml_event_t, 0, initial_queue_size), best_width: -1, } } // Destroy an emitter object. func yaml_emitter_delete(emitter *yaml_emitter_t) { *emitter = yaml_emitter_t{} } // String write handler. func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error { *emitter.output_buffer = append(*emitter.output_buffer, buffer...) return nil } // yaml_writer_write_handler uses emitter.output_writer to write the // emitted text. func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) error { _, err := emitter.output_writer.Write(buffer) return err } // Set a string output. func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) { if emitter.write_handler != nil { panic("must set the output target only once") } emitter.write_handler = yaml_string_write_handler emitter.output_buffer = output_buffer } // Set a file output. func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) { if emitter.write_handler != nil { panic("must set the output target only once") } emitter.write_handler = yaml_writer_write_handler emitter.output_writer = w } // Set the output encoding. func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) { if emitter.encoding != yaml_ANY_ENCODING { panic("must set the output encoding only once") } emitter.encoding = encoding } // Set the canonical output style. func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { emitter.canonical = canonical } // Set the indentation increment. func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { if indent < 2 || indent > 9 { indent = 2 } emitter.best_indent = indent } // Set the preferred line width. func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) { if width < 0 { width = -1 } emitter.best_width = width } // Set if unescaped non-ASCII characters are allowed. func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) { emitter.unicode = unicode } // Set the preferred line break character. func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) { emitter.line_break = line_break } ///* // * Destroy a token object. // */ // //YAML_DECLARE(void) //yaml_token_delete(yaml_token_t *token) //{ // assert(token); // Non-NULL token object expected. // // switch (token.type) // { // case YAML_TAG_DIRECTIVE_TOKEN: // yaml_free(token.data.tag_directive.handle); // yaml_free(token.data.tag_directive.prefix); // break; // // case YAML_ALIAS_TOKEN: // yaml_free(token.data.alias.value); // break; // // case YAML_ANCHOR_TOKEN: // yaml_free(token.data.anchor.value); // break; // // case YAML_TAG_TOKEN: // yaml_free(token.data.tag.handle); // yaml_free(token.data.tag.suffix); // break; // // case YAML_SCALAR_TOKEN: // yaml_free(token.data.scalar.value); // break; // // default: // break; // } // // memset(token, 0, sizeof(yaml_token_t)); //} // ///* // * Check if a string is a valid UTF-8 sequence. // * // * Check 'reader.c' for more details on UTF-8 encoding. // */ // //static int //yaml_check_utf8(yaml_char_t *start, size_t length) //{ // yaml_char_t *end = start+length; // yaml_char_t *pointer = start; // // while (pointer < end) { // unsigned char octet; // unsigned int width; // unsigned int value; // size_t k; // // octet = pointer[0]; // width = (octet & 0x80) == 0x00 ? 1 : // (octet & 0xE0) == 0xC0 ? 2 : // (octet & 0xF0) == 0xE0 ? 3 : // (octet & 0xF8) == 0xF0 ? 4 : 0; // value = (octet & 0x80) == 0x00 ? octet & 0x7F : // (octet & 0xE0) == 0xC0 ? octet & 0x1F : // (octet & 0xF0) == 0xE0 ? octet & 0x0F : // (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0; // if (!width) return 0; // if (pointer+width > end) return 0; // for (k = 1; k < width; k ++) { // octet = pointer[k]; // if ((octet & 0xC0) != 0x80) return 0; // value = (value << 6) + (octet & 0x3F); // } // if (!((width == 1) || // (width == 2 && value >= 0x80) || // (width == 3 && value >= 0x800) || // (width == 4 && value >= 0x10000))) return 0; // // pointer += width; // } // // return 1; //} // // Create STREAM-START. func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) { *event = yaml_event_t{ typ: yaml_STREAM_START_EVENT, encoding: encoding, } } // Create STREAM-END. func yaml_stream_end_event_initialize(event *yaml_event_t) { *event = yaml_event_t{ typ: yaml_STREAM_END_EVENT, } } // Create DOCUMENT-START. func yaml_document_start_event_initialize( event *yaml_event_t, version_directive *yaml_version_directive_t, tag_directives []yaml_tag_directive_t, implicit bool, ) { *event = yaml_event_t{ typ: yaml_DOCUMENT_START_EVENT, version_directive: version_directive, tag_directives: tag_directives, implicit: implicit, } } // Create DOCUMENT-END. func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) { *event = yaml_event_t{ typ: yaml_DOCUMENT_END_EVENT, implicit: implicit, } } // Create ALIAS. func yaml_alias_event_initialize(event *yaml_event_t, anchor []byte) bool { *event = yaml_event_t{ typ: yaml_ALIAS_EVENT, anchor: anchor, } return true } // Create SCALAR. func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, value []byte, plain_implicit, quoted_implicit bool, style yaml_scalar_style_t) bool { *event = yaml_event_t{ typ: yaml_SCALAR_EVENT, anchor: anchor, tag: tag, value: value, implicit: plain_implicit, quoted_implicit: quoted_implicit, style: yaml_style_t(style), } return true } // Create SEQUENCE-START. func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool { *event = yaml_event_t{ typ: yaml_SEQUENCE_START_EVENT, anchor: anchor, tag: tag, implicit: implicit, style: yaml_style_t(style), } return true } // Create SEQUENCE-END. func yaml_sequence_end_event_initialize(event *yaml_event_t) bool { *event = yaml_event_t{ typ: yaml_SEQUENCE_END_EVENT, } return true } // Create MAPPING-START. func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) { *event = yaml_event_t{ typ: yaml_MAPPING_START_EVENT, anchor: anchor, tag: tag, implicit: implicit, style: yaml_style_t(style), } } // Create MAPPING-END. func yaml_mapping_end_event_initialize(event *yaml_event_t) { *event = yaml_event_t{ typ: yaml_MAPPING_END_EVENT, } } // Destroy an event object. func yaml_event_delete(event *yaml_event_t) { *event = yaml_event_t{} } ///* // * Create a document object. // */ // //YAML_DECLARE(int) //yaml_document_initialize(document *yaml_document_t, // version_directive *yaml_version_directive_t, // tag_directives_start *yaml_tag_directive_t, // tag_directives_end *yaml_tag_directive_t, // start_implicit int, end_implicit int) //{ // struct { // error yaml_error_type_t // } context // struct { // start *yaml_node_t // end *yaml_node_t // top *yaml_node_t // } nodes = { NULL, NULL, NULL } // version_directive_copy *yaml_version_directive_t = NULL // struct { // start *yaml_tag_directive_t // end *yaml_tag_directive_t // top *yaml_tag_directive_t // } tag_directives_copy = { NULL, NULL, NULL } // value yaml_tag_directive_t = { NULL, NULL } // mark yaml_mark_t = { 0, 0, 0 } // // assert(document) // Non-NULL document object is expected. // assert((tag_directives_start && tag_directives_end) || // (tag_directives_start == tag_directives_end)) // // Valid tag directives are expected. // // if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error // // if (version_directive) { // version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t)) // if (!version_directive_copy) goto error // version_directive_copy.major = version_directive.major // version_directive_copy.minor = version_directive.minor // } // // if (tag_directives_start != tag_directives_end) { // tag_directive *yaml_tag_directive_t // if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE)) // goto error // for (tag_directive = tag_directives_start // tag_directive != tag_directives_end; tag_directive ++) { // assert(tag_directive.handle) // assert(tag_directive.prefix) // if (!yaml_check_utf8(tag_directive.handle, // strlen((char *)tag_directive.handle))) // goto error // if (!yaml_check_utf8(tag_directive.prefix, // strlen((char *)tag_directive.prefix))) // goto error // value.handle = yaml_strdup(tag_directive.handle) // value.prefix = yaml_strdup(tag_directive.prefix) // if (!value.handle || !value.prefix) goto error // if (!PUSH(&context, tag_directives_copy, value)) // goto error // value.handle = NULL // value.prefix = NULL // } // } // // DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy, // tag_directives_copy.start, tag_directives_copy.top, // start_implicit, end_implicit, mark, mark) // // return 1 // //error: // STACK_DEL(&context, nodes) // yaml_free(version_directive_copy) // while (!STACK_EMPTY(&context, tag_directives_copy)) { // value yaml_tag_directive_t = POP(&context, tag_directives_copy) // yaml_free(value.handle) // yaml_free(value.prefix) // } // STACK_DEL(&context, tag_directives_copy) // yaml_free(value.handle) // yaml_free(value.prefix) // // return 0 //} // ///* // * Destroy a document object. // */ // //YAML_DECLARE(void) //yaml_document_delete(document *yaml_document_t) //{ // struct { // error yaml_error_type_t // } context // tag_directive *yaml_tag_directive_t // // context.error = YAML_NO_ERROR // Eliminate a compiler warning. // // assert(document) // Non-NULL document object is expected. // // while (!STACK_EMPTY(&context, document.nodes)) { // node yaml_node_t = POP(&context, document.nodes) // yaml_free(node.tag) // switch (node.type) { // case YAML_SCALAR_NODE: // yaml_free(node.data.scalar.value) // break // case YAML_SEQUENCE_NODE: // STACK_DEL(&context, node.data.sequence.items) // break // case YAML_MAPPING_NODE: // STACK_DEL(&context, node.data.mapping.pairs) // break // default: // assert(0) // Should not happen. // } // } // STACK_DEL(&context, document.nodes) // // yaml_free(document.version_directive) // for (tag_directive = document.tag_directives.start // tag_directive != document.tag_directives.end // tag_directive++) { // yaml_free(tag_directive.handle) // yaml_free(tag_directive.prefix) // } // yaml_free(document.tag_directives.start) // // memset(document, 0, sizeof(yaml_document_t)) //} // ///** // * Get a document node. // */ // //YAML_DECLARE(yaml_node_t *) //yaml_document_get_node(document *yaml_document_t, index int) //{ // assert(document) // Non-NULL document object is expected. // // if (index > 0 && document.nodes.start + index <= document.nodes.top) { // return document.nodes.start + index - 1 // } // return NULL //} // ///** // * Get the root object. // */ // //YAML_DECLARE(yaml_node_t *) //yaml_document_get_root_node(document *yaml_document_t) //{ // assert(document) // Non-NULL document object is expected. // // if (document.nodes.top != document.nodes.start) { // return document.nodes.start // } // return NULL //} // ///* // * Add a scalar node to a document. // */ // //YAML_DECLARE(int) //yaml_document_add_scalar(document *yaml_document_t, // tag *yaml_char_t, value *yaml_char_t, length int, // style yaml_scalar_style_t) //{ // struct { // error yaml_error_type_t // } context // mark yaml_mark_t = { 0, 0, 0 } // tag_copy *yaml_char_t = NULL // value_copy *yaml_char_t = NULL // node yaml_node_t // // assert(document) // Non-NULL document object is expected. // assert(value) // Non-NULL value is expected. // // if (!tag) { // tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG // } // // if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error // tag_copy = yaml_strdup(tag) // if (!tag_copy) goto error // // if (length < 0) { // length = strlen((char *)value) // } // // if (!yaml_check_utf8(value, length)) goto error // value_copy = yaml_malloc(length+1) // if (!value_copy) goto error // memcpy(value_copy, value, length) // value_copy[length] = '\0' // // SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark) // if (!PUSH(&context, document.nodes, node)) goto error // // return document.nodes.top - document.nodes.start // //error: // yaml_free(tag_copy) // yaml_free(value_copy) // // return 0 //} // ///* // * Add a sequence node to a document. // */ // //YAML_DECLARE(int) //yaml_document_add_sequence(document *yaml_document_t, // tag *yaml_char_t, style yaml_sequence_style_t) //{ // struct { // error yaml_error_type_t // } context // mark yaml_mark_t = { 0, 0, 0 } // tag_copy *yaml_char_t = NULL // struct { // start *yaml_node_item_t // end *yaml_node_item_t // top *yaml_node_item_t // } items = { NULL, NULL, NULL } // node yaml_node_t // // assert(document) // Non-NULL document object is expected. // // if (!tag) { // tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG // } // // if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error // tag_copy = yaml_strdup(tag) // if (!tag_copy) goto error // // if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error // // SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end, // style, mark, mark) // if (!PUSH(&context, document.nodes, node)) goto error // // return document.nodes.top - document.nodes.start // //error: // STACK_DEL(&context, items) // yaml_free(tag_copy) // // return 0 //} // ///* // * Add a mapping node to a document. // */ // //YAML_DECLARE(int) //yaml_document_add_mapping(document *yaml_document_t, // tag *yaml_char_t, style yaml_mapping_style_t) //{ // struct { // error yaml_error_type_t // } context // mark yaml_mark_t = { 0, 0, 0 } // tag_copy *yaml_char_t = NULL // struct { // start *yaml_node_pair_t // end *yaml_node_pair_t // top *yaml_node_pair_t // } pairs = { NULL, NULL, NULL } // node yaml_node_t // // assert(document) // Non-NULL document object is expected. // // if (!tag) { // tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG // } // // if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error // tag_copy = yaml_strdup(tag) // if (!tag_copy) goto error // // if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error // // MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end, // style, mark, mark) // if (!PUSH(&context, document.nodes, node)) goto error // // return document.nodes.top - document.nodes.start // //error: // STACK_DEL(&context, pairs) // yaml_free(tag_copy) // // return 0 //} // ///* // * Append an item to a sequence node. // */ // //YAML_DECLARE(int) //yaml_document_append_sequence_item(document *yaml_document_t, // sequence int, item int) //{ // struct { // error yaml_error_type_t // } context // // assert(document) // Non-NULL document is required. // assert(sequence > 0 // && document.nodes.start + sequence <= document.nodes.top) // // Valid sequence id is required. // assert(document.nodes.start[sequence-1].type == YAML_SEQUENCE_NODE) // // A sequence node is required. // assert(item > 0 && document.nodes.start + item <= document.nodes.top) // // Valid item id is required. // // if (!PUSH(&context, // document.nodes.start[sequence-1].data.sequence.items, item)) // return 0 // // return 1 //} // ///* // * Append a pair of a key and a value to a mapping node. // */ // //YAML_DECLARE(int) //yaml_document_append_mapping_pair(document *yaml_document_t, // mapping int, key int, value int) //{ // struct { // error yaml_error_type_t // } context // // pair yaml_node_pair_t // // assert(document) // Non-NULL document is required. // assert(mapping > 0 // && document.nodes.start + mapping <= document.nodes.top) // // Valid mapping id is required. // assert(document.nodes.start[mapping-1].type == YAML_MAPPING_NODE) // // A mapping node is required. // assert(key > 0 && document.nodes.start + key <= document.nodes.top) // // Valid key id is required. // assert(value > 0 && document.nodes.start + value <= document.nodes.top) // // Valid value id is required. // // pair.key = key // pair.value = value // // if (!PUSH(&context, // document.nodes.start[mapping-1].data.mapping.pairs, pair)) // return 0 // // return 1 //} // //
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/encode.go
vendor/gopkg.in/yaml.v3/encode.go
// // Copyright (c) 2011-2019 Canonical Ltd // // 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. package yaml import ( "encoding" "fmt" "io" "reflect" "regexp" "sort" "strconv" "strings" "time" "unicode/utf8" ) type encoder struct { emitter yaml_emitter_t event yaml_event_t out []byte flow bool indent int doneInit bool } func newEncoder() *encoder { e := &encoder{} yaml_emitter_initialize(&e.emitter) yaml_emitter_set_output_string(&e.emitter, &e.out) yaml_emitter_set_unicode(&e.emitter, true) return e } func newEncoderWithWriter(w io.Writer) *encoder { e := &encoder{} yaml_emitter_initialize(&e.emitter) yaml_emitter_set_output_writer(&e.emitter, w) yaml_emitter_set_unicode(&e.emitter, true) return e } func (e *encoder) init() { if e.doneInit { return } if e.indent == 0 { e.indent = 4 } e.emitter.best_indent = e.indent yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING) e.emit() e.doneInit = true } func (e *encoder) finish() { e.emitter.open_ended = false yaml_stream_end_event_initialize(&e.event) e.emit() } func (e *encoder) destroy() { yaml_emitter_delete(&e.emitter) } func (e *encoder) emit() { // This will internally delete the e.event value. e.must(yaml_emitter_emit(&e.emitter, &e.event)) } func (e *encoder) must(ok bool) { if !ok { msg := e.emitter.problem if msg == "" { msg = "unknown problem generating YAML content" } failf("%s", msg) } } func (e *encoder) marshalDoc(tag string, in reflect.Value) { e.init() var node *Node if in.IsValid() { node, _ = in.Interface().(*Node) } if node != nil && node.Kind == DocumentNode { e.nodev(in) } else { yaml_document_start_event_initialize(&e.event, nil, nil, true) e.emit() e.marshal(tag, in) yaml_document_end_event_initialize(&e.event, true) e.emit() } } func (e *encoder) marshal(tag string, in reflect.Value) { tag = shortTag(tag) if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() { e.nilv() return } iface := in.Interface() switch value := iface.(type) { case *Node: e.nodev(in) return case Node: if !in.CanAddr() { var n = reflect.New(in.Type()).Elem() n.Set(in) in = n } e.nodev(in.Addr()) return case time.Time: e.timev(tag, in) return case *time.Time: e.timev(tag, in.Elem()) return case time.Duration: e.stringv(tag, reflect.ValueOf(value.String())) return case Marshaler: v, err := value.MarshalYAML() if err != nil { fail(err) } if v == nil { e.nilv() return } e.marshal(tag, reflect.ValueOf(v)) return case encoding.TextMarshaler: text, err := value.MarshalText() if err != nil { fail(err) } in = reflect.ValueOf(string(text)) case nil: e.nilv() return } switch in.Kind() { case reflect.Interface: e.marshal(tag, in.Elem()) case reflect.Map: e.mapv(tag, in) case reflect.Ptr: e.marshal(tag, in.Elem()) case reflect.Struct: e.structv(tag, in) case reflect.Slice, reflect.Array: e.slicev(tag, in) case reflect.String: e.stringv(tag, in) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: e.intv(tag, in) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: e.uintv(tag, in) case reflect.Float32, reflect.Float64: e.floatv(tag, in) case reflect.Bool: e.boolv(tag, in) default: panic("cannot marshal type: " + in.Type().String()) } } func (e *encoder) mapv(tag string, in reflect.Value) { e.mappingv(tag, func() { keys := keyList(in.MapKeys()) sort.Sort(keys) for _, k := range keys { e.marshal("", k) e.marshal("", in.MapIndex(k)) } }) } func (e *encoder) fieldByIndex(v reflect.Value, index []int) (field reflect.Value) { for _, num := range index { for { if v.Kind() == reflect.Ptr { if v.IsNil() { return reflect.Value{} } v = v.Elem() continue } break } v = v.Field(num) } return v } func (e *encoder) structv(tag string, in reflect.Value) { sinfo, err := getStructInfo(in.Type()) if err != nil { panic(err) } e.mappingv(tag, func() { for _, info := range sinfo.FieldsList { var value reflect.Value if info.Inline == nil { value = in.Field(info.Num) } else { value = e.fieldByIndex(in, info.Inline) if !value.IsValid() { continue } } if info.OmitEmpty && isZero(value) { continue } e.marshal("", reflect.ValueOf(info.Key)) e.flow = info.Flow e.marshal("", value) } if sinfo.InlineMap >= 0 { m := in.Field(sinfo.InlineMap) if m.Len() > 0 { e.flow = false keys := keyList(m.MapKeys()) sort.Sort(keys) for _, k := range keys { if _, found := sinfo.FieldsMap[k.String()]; found { panic(fmt.Sprintf("cannot have key %q in inlined map: conflicts with struct field", k.String())) } e.marshal("", k) e.flow = false e.marshal("", m.MapIndex(k)) } } } }) } func (e *encoder) mappingv(tag string, f func()) { implicit := tag == "" style := yaml_BLOCK_MAPPING_STYLE if e.flow { e.flow = false style = yaml_FLOW_MAPPING_STYLE } yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) e.emit() f() yaml_mapping_end_event_initialize(&e.event) e.emit() } func (e *encoder) slicev(tag string, in reflect.Value) { implicit := tag == "" style := yaml_BLOCK_SEQUENCE_STYLE if e.flow { e.flow = false style = yaml_FLOW_SEQUENCE_STYLE } e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) e.emit() n := in.Len() for i := 0; i < n; i++ { e.marshal("", in.Index(i)) } e.must(yaml_sequence_end_event_initialize(&e.event)) e.emit() } // isBase60 returns whether s is in base 60 notation as defined in YAML 1.1. // // The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported // in YAML 1.2 and by this package, but these should be marshalled quoted for // the time being for compatibility with other parsers. func isBase60Float(s string) (result bool) { // Fast path. if s == "" { return false } c := s[0] if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 { return false } // Do the full match. return base60float.MatchString(s) } // From http://yaml.org/type/float.html, except the regular expression there // is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix. var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`) // isOldBool returns whether s is bool notation as defined in YAML 1.1. // // We continue to force strings that YAML 1.1 would interpret as booleans to be // rendered as quotes strings so that the marshalled output valid for YAML 1.1 // parsing. func isOldBool(s string) (result bool) { switch s { case "y", "Y", "yes", "Yes", "YES", "on", "On", "ON", "n", "N", "no", "No", "NO", "off", "Off", "OFF": return true default: return false } } func (e *encoder) stringv(tag string, in reflect.Value) { var style yaml_scalar_style_t s := in.String() canUsePlain := true switch { case !utf8.ValidString(s): if tag == binaryTag { failf("explicitly tagged !!binary data must be base64-encoded") } if tag != "" { failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) } // It can't be encoded directly as YAML so use a binary tag // and encode it as base64. tag = binaryTag s = encodeBase64(s) case tag == "": // Check to see if it would resolve to a specific // tag when encoded unquoted. If it doesn't, // there's no need to quote it. rtag, _ := resolve("", s) canUsePlain = rtag == strTag && !(isBase60Float(s) || isOldBool(s)) } // Note: it's possible for user code to emit invalid YAML // if they explicitly specify a tag and a string containing // text that's incompatible with that tag. switch { case strings.Contains(s, "\n"): if e.flow { style = yaml_DOUBLE_QUOTED_SCALAR_STYLE } else { style = yaml_LITERAL_SCALAR_STYLE } case canUsePlain: style = yaml_PLAIN_SCALAR_STYLE default: style = yaml_DOUBLE_QUOTED_SCALAR_STYLE } e.emitScalar(s, "", tag, style, nil, nil, nil, nil) } func (e *encoder) boolv(tag string, in reflect.Value) { var s string if in.Bool() { s = "true" } else { s = "false" } e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) } func (e *encoder) intv(tag string, in reflect.Value) { s := strconv.FormatInt(in.Int(), 10) e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) } func (e *encoder) uintv(tag string, in reflect.Value) { s := strconv.FormatUint(in.Uint(), 10) e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) } func (e *encoder) timev(tag string, in reflect.Value) { t := in.Interface().(time.Time) s := t.Format(time.RFC3339Nano) e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) } func (e *encoder) floatv(tag string, in reflect.Value) { // Issue #352: When formatting, use the precision of the underlying value precision := 64 if in.Kind() == reflect.Float32 { precision = 32 } s := strconv.FormatFloat(in.Float(), 'g', -1, precision) switch s { case "+Inf": s = ".inf" case "-Inf": s = "-.inf" case "NaN": s = ".nan" } e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) } func (e *encoder) nilv() { e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) } func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t, head, line, foot, tail []byte) { // TODO Kill this function. Replace all initialize calls by their underlining Go literals. implicit := tag == "" if !implicit { tag = longTag(tag) } e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style)) e.event.head_comment = head e.event.line_comment = line e.event.foot_comment = foot e.event.tail_comment = tail e.emit() } func (e *encoder) nodev(in reflect.Value) { e.node(in.Interface().(*Node), "") } func (e *encoder) node(node *Node, tail string) { // Zero nodes behave as nil. if node.Kind == 0 && node.IsZero() { e.nilv() return } // If the tag was not explicitly requested, and dropping it won't change the // implicit tag of the value, don't include it in the presentation. var tag = node.Tag var stag = shortTag(tag) var forceQuoting bool if tag != "" && node.Style&TaggedStyle == 0 { if node.Kind == ScalarNode { if stag == strTag && node.Style&(SingleQuotedStyle|DoubleQuotedStyle|LiteralStyle|FoldedStyle) != 0 { tag = "" } else { rtag, _ := resolve("", node.Value) if rtag == stag { tag = "" } else if stag == strTag { tag = "" forceQuoting = true } } } else { var rtag string switch node.Kind { case MappingNode: rtag = mapTag case SequenceNode: rtag = seqTag } if rtag == stag { tag = "" } } } switch node.Kind { case DocumentNode: yaml_document_start_event_initialize(&e.event, nil, nil, true) e.event.head_comment = []byte(node.HeadComment) e.emit() for _, node := range node.Content { e.node(node, "") } yaml_document_end_event_initialize(&e.event, true) e.event.foot_comment = []byte(node.FootComment) e.emit() case SequenceNode: style := yaml_BLOCK_SEQUENCE_STYLE if node.Style&FlowStyle != 0 { style = yaml_FLOW_SEQUENCE_STYLE } e.must(yaml_sequence_start_event_initialize(&e.event, []byte(node.Anchor), []byte(longTag(tag)), tag == "", style)) e.event.head_comment = []byte(node.HeadComment) e.emit() for _, node := range node.Content { e.node(node, "") } e.must(yaml_sequence_end_event_initialize(&e.event)) e.event.line_comment = []byte(node.LineComment) e.event.foot_comment = []byte(node.FootComment) e.emit() case MappingNode: style := yaml_BLOCK_MAPPING_STYLE if node.Style&FlowStyle != 0 { style = yaml_FLOW_MAPPING_STYLE } yaml_mapping_start_event_initialize(&e.event, []byte(node.Anchor), []byte(longTag(tag)), tag == "", style) e.event.tail_comment = []byte(tail) e.event.head_comment = []byte(node.HeadComment) e.emit() // The tail logic below moves the foot comment of prior keys to the following key, // since the value for each key may be a nested structure and the foot needs to be // processed only the entirety of the value is streamed. The last tail is processed // with the mapping end event. var tail string for i := 0; i+1 < len(node.Content); i += 2 { k := node.Content[i] foot := k.FootComment if foot != "" { kopy := *k kopy.FootComment = "" k = &kopy } e.node(k, tail) tail = foot v := node.Content[i+1] e.node(v, "") } yaml_mapping_end_event_initialize(&e.event) e.event.tail_comment = []byte(tail) e.event.line_comment = []byte(node.LineComment) e.event.foot_comment = []byte(node.FootComment) e.emit() case AliasNode: yaml_alias_event_initialize(&e.event, []byte(node.Value)) e.event.head_comment = []byte(node.HeadComment) e.event.line_comment = []byte(node.LineComment) e.event.foot_comment = []byte(node.FootComment) e.emit() case ScalarNode: value := node.Value if !utf8.ValidString(value) { if stag == binaryTag { failf("explicitly tagged !!binary data must be base64-encoded") } if stag != "" { failf("cannot marshal invalid UTF-8 data as %s", stag) } // It can't be encoded directly as YAML so use a binary tag // and encode it as base64. tag = binaryTag value = encodeBase64(value) } style := yaml_PLAIN_SCALAR_STYLE switch { case node.Style&DoubleQuotedStyle != 0: style = yaml_DOUBLE_QUOTED_SCALAR_STYLE case node.Style&SingleQuotedStyle != 0: style = yaml_SINGLE_QUOTED_SCALAR_STYLE case node.Style&LiteralStyle != 0: style = yaml_LITERAL_SCALAR_STYLE case node.Style&FoldedStyle != 0: style = yaml_FOLDED_SCALAR_STYLE case strings.Contains(value, "\n"): style = yaml_LITERAL_SCALAR_STYLE case forceQuoting: style = yaml_DOUBLE_QUOTED_SCALAR_STYLE } e.emitScalar(value, node.Anchor, tag, style, []byte(node.HeadComment), []byte(node.LineComment), []byte(node.FootComment), []byte(tail)) default: failf("cannot encode node with unknown kind %d", node.Kind) } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/sorter.go
vendor/gopkg.in/yaml.v3/sorter.go
// // Copyright (c) 2011-2019 Canonical Ltd // // 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. package yaml import ( "reflect" "unicode" ) type keyList []reflect.Value func (l keyList) Len() int { return len(l) } func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } func (l keyList) Less(i, j int) bool { a := l[i] b := l[j] ak := a.Kind() bk := b.Kind() for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { a = a.Elem() ak = a.Kind() } for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { b = b.Elem() bk = b.Kind() } af, aok := keyFloat(a) bf, bok := keyFloat(b) if aok && bok { if af != bf { return af < bf } if ak != bk { return ak < bk } return numLess(a, b) } if ak != reflect.String || bk != reflect.String { return ak < bk } ar, br := []rune(a.String()), []rune(b.String()) digits := false for i := 0; i < len(ar) && i < len(br); i++ { if ar[i] == br[i] { digits = unicode.IsDigit(ar[i]) continue } al := unicode.IsLetter(ar[i]) bl := unicode.IsLetter(br[i]) if al && bl { return ar[i] < br[i] } if al || bl { if digits { return al } else { return bl } } var ai, bi int var an, bn int64 if ar[i] == '0' || br[i] == '0' { for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { if ar[j] != '0' { an = 1 bn = 1 break } } } for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { an = an*10 + int64(ar[ai]-'0') } for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { bn = bn*10 + int64(br[bi]-'0') } if an != bn { return an < bn } if ai != bi { return ai < bi } return ar[i] < br[i] } return len(ar) < len(br) } // keyFloat returns a float value for v if it is a number/bool // and whether it is a number/bool or not. func keyFloat(v reflect.Value) (f float64, ok bool) { switch v.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return float64(v.Int()), true case reflect.Float32, reflect.Float64: return v.Float(), true case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: return float64(v.Uint()), true case reflect.Bool: if v.Bool() { return 1, true } return 0, true } return 0, false } // numLess returns whether a < b. // a and b must necessarily have the same kind. func numLess(a, b reflect.Value) bool { switch a.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return a.Int() < b.Int() case reflect.Float32, reflect.Float64: return a.Float() < b.Float() case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: return a.Uint() < b.Uint() case reflect.Bool: return !a.Bool() && b.Bool() } panic("not a number") }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/yamlprivateh.go
vendor/gopkg.in/yaml.v3/yamlprivateh.go
// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov // // 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. package yaml const ( // The size of the input raw buffer. input_raw_buffer_size = 512 // The size of the input buffer. // It should be possible to decode the whole raw buffer. input_buffer_size = input_raw_buffer_size * 3 // The size of the output buffer. output_buffer_size = 128 // The size of the output raw buffer. // It should be possible to encode the whole output buffer. output_raw_buffer_size = (output_buffer_size*2 + 2) // The size of other stacks and queues. initial_stack_size = 16 initial_queue_size = 16 initial_string_size = 16 ) // Check if the character at the specified position is an alphabetical // character, a digit, '_', or '-'. func is_alpha(b []byte, i int) bool { return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-' } // Check if the character at the specified position is a digit. func is_digit(b []byte, i int) bool { return b[i] >= '0' && b[i] <= '9' } // Get the value of a digit. func as_digit(b []byte, i int) int { return int(b[i]) - '0' } // Check if the character at the specified position is a hex-digit. func is_hex(b []byte, i int) bool { return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f' } // Get the value of a hex-digit. func as_hex(b []byte, i int) int { bi := b[i] if bi >= 'A' && bi <= 'F' { return int(bi) - 'A' + 10 } if bi >= 'a' && bi <= 'f' { return int(bi) - 'a' + 10 } return int(bi) - '0' } // Check if the character is ASCII. func is_ascii(b []byte, i int) bool { return b[i] <= 0x7F } // Check if the character at the start of the buffer can be printed unescaped. func is_printable(b []byte, i int) bool { return ((b[i] == 0x0A) || // . == #x0A (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF (b[i] > 0xC2 && b[i] < 0xED) || (b[i] == 0xED && b[i+1] < 0xA0) || (b[i] == 0xEE) || (b[i] == 0xEF && // #xE000 <= . <= #xFFFD !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF)))) } // Check if the character at the specified position is NUL. func is_z(b []byte, i int) bool { return b[i] == 0x00 } // Check if the beginning of the buffer is a BOM. func is_bom(b []byte, i int) bool { return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF } // Check if the character at the specified position is space. func is_space(b []byte, i int) bool { return b[i] == ' ' } // Check if the character at the specified position is tab. func is_tab(b []byte, i int) bool { return b[i] == '\t' } // Check if the character at the specified position is blank (space or tab). func is_blank(b []byte, i int) bool { //return is_space(b, i) || is_tab(b, i) return b[i] == ' ' || b[i] == '\t' } // Check if the character at the specified position is a line break. func is_break(b []byte, i int) bool { return (b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029) } func is_crlf(b []byte, i int) bool { return b[i] == '\r' && b[i+1] == '\n' } // Check if the character is a line break or NUL. func is_breakz(b []byte, i int) bool { //return is_break(b, i) || is_z(b, i) return ( // is_break: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) // is_z: b[i] == 0) } // Check if the character is a line break, space, or NUL. func is_spacez(b []byte, i int) bool { //return is_space(b, i) || is_breakz(b, i) return ( // is_space: b[i] == ' ' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) b[i] == 0) } // Check if the character is a line break, space, tab, or NUL. func is_blankz(b []byte, i int) bool { //return is_blank(b, i) || is_breakz(b, i) return ( // is_blank: b[i] == ' ' || b[i] == '\t' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) b[i] == 0) } // Determine the width of the character. func width(b byte) int { // Don't replace these by a switch without first // confirming that it is being inlined. if b&0x80 == 0x00 { return 1 } if b&0xE0 == 0xC0 { return 2 } if b&0xF0 == 0xE0 { return 3 } if b&0xF8 == 0xF0 { return 4 } return 0 }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/readerc.go
vendor/gopkg.in/yaml.v3/readerc.go
// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov // // 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. package yaml import ( "io" ) // Set the reader error and return 0. func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool { parser.error = yaml_READER_ERROR parser.problem = problem parser.problem_offset = offset parser.problem_value = value return false } // Byte order marks. const ( bom_UTF8 = "\xef\xbb\xbf" bom_UTF16LE = "\xff\xfe" bom_UTF16BE = "\xfe\xff" ) // Determine the input stream encoding by checking the BOM symbol. If no BOM is // found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure. func yaml_parser_determine_encoding(parser *yaml_parser_t) bool { // Ensure that we had enough bytes in the raw buffer. for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 { if !yaml_parser_update_raw_buffer(parser) { return false } } // Determine the encoding. buf := parser.raw_buffer pos := parser.raw_buffer_pos avail := len(buf) - pos if avail >= 2 && buf[pos] == bom_UTF16LE[0] && buf[pos+1] == bom_UTF16LE[1] { parser.encoding = yaml_UTF16LE_ENCODING parser.raw_buffer_pos += 2 parser.offset += 2 } else if avail >= 2 && buf[pos] == bom_UTF16BE[0] && buf[pos+1] == bom_UTF16BE[1] { parser.encoding = yaml_UTF16BE_ENCODING parser.raw_buffer_pos += 2 parser.offset += 2 } else if avail >= 3 && buf[pos] == bom_UTF8[0] && buf[pos+1] == bom_UTF8[1] && buf[pos+2] == bom_UTF8[2] { parser.encoding = yaml_UTF8_ENCODING parser.raw_buffer_pos += 3 parser.offset += 3 } else { parser.encoding = yaml_UTF8_ENCODING } return true } // Update the raw buffer. func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool { size_read := 0 // Return if the raw buffer is full. if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) { return true } // Return on EOF. if parser.eof { return true } // Move the remaining bytes in the raw buffer to the beginning. if parser.raw_buffer_pos > 0 && parser.raw_buffer_pos < len(parser.raw_buffer) { copy(parser.raw_buffer, parser.raw_buffer[parser.raw_buffer_pos:]) } parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)-parser.raw_buffer_pos] parser.raw_buffer_pos = 0 // Call the read handler to fill the buffer. size_read, err := parser.read_handler(parser, parser.raw_buffer[len(parser.raw_buffer):cap(parser.raw_buffer)]) parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)+size_read] if err == io.EOF { parser.eof = true } else if err != nil { return yaml_parser_set_reader_error(parser, "input error: "+err.Error(), parser.offset, -1) } return true } // Ensure that the buffer contains at least `length` characters. // Return true on success, false on failure. // // The length is supposed to be significantly less that the buffer size. func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { if parser.read_handler == nil { panic("read handler must be set") } // [Go] This function was changed to guarantee the requested length size at EOF. // The fact we need to do this is pretty awful, but the description above implies // for that to be the case, and there are tests // If the EOF flag is set and the raw buffer is empty, do nothing. if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { // [Go] ACTUALLY! Read the documentation of this function above. // This is just broken. To return true, we need to have the // given length in the buffer. Not doing that means every single // check that calls this function to make sure the buffer has a // given length is Go) panicking; or C) accessing invalid memory. //return true } // Return if the buffer contains enough characters. if parser.unread >= length { return true } // Determine the input encoding if it is not known yet. if parser.encoding == yaml_ANY_ENCODING { if !yaml_parser_determine_encoding(parser) { return false } } // Move the unread characters to the beginning of the buffer. buffer_len := len(parser.buffer) if parser.buffer_pos > 0 && parser.buffer_pos < buffer_len { copy(parser.buffer, parser.buffer[parser.buffer_pos:]) buffer_len -= parser.buffer_pos parser.buffer_pos = 0 } else if parser.buffer_pos == buffer_len { buffer_len = 0 parser.buffer_pos = 0 } // Open the whole buffer for writing, and cut it before returning. parser.buffer = parser.buffer[:cap(parser.buffer)] // Fill the buffer until it has enough characters. first := true for parser.unread < length { // Fill the raw buffer if necessary. if !first || parser.raw_buffer_pos == len(parser.raw_buffer) { if !yaml_parser_update_raw_buffer(parser) { parser.buffer = parser.buffer[:buffer_len] return false } } first = false // Decode the raw buffer. inner: for parser.raw_buffer_pos != len(parser.raw_buffer) { var value rune var width int raw_unread := len(parser.raw_buffer) - parser.raw_buffer_pos // Decode the next character. switch parser.encoding { case yaml_UTF8_ENCODING: // Decode a UTF-8 character. Check RFC 3629 // (http://www.ietf.org/rfc/rfc3629.txt) for more details. // // The following table (taken from the RFC) is used for // decoding. // // Char. number range | UTF-8 octet sequence // (hexadecimal) | (binary) // --------------------+------------------------------------ // 0000 0000-0000 007F | 0xxxxxxx // 0000 0080-0000 07FF | 110xxxxx 10xxxxxx // 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx // 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx // // Additionally, the characters in the range 0xD800-0xDFFF // are prohibited as they are reserved for use with UTF-16 // surrogate pairs. // Determine the length of the UTF-8 sequence. octet := parser.raw_buffer[parser.raw_buffer_pos] switch { case octet&0x80 == 0x00: width = 1 case octet&0xE0 == 0xC0: width = 2 case octet&0xF0 == 0xE0: width = 3 case octet&0xF8 == 0xF0: width = 4 default: // The leading octet is invalid. return yaml_parser_set_reader_error(parser, "invalid leading UTF-8 octet", parser.offset, int(octet)) } // Check if the raw buffer contains an incomplete character. if width > raw_unread { if parser.eof { return yaml_parser_set_reader_error(parser, "incomplete UTF-8 octet sequence", parser.offset, -1) } break inner } // Decode the leading octet. switch { case octet&0x80 == 0x00: value = rune(octet & 0x7F) case octet&0xE0 == 0xC0: value = rune(octet & 0x1F) case octet&0xF0 == 0xE0: value = rune(octet & 0x0F) case octet&0xF8 == 0xF0: value = rune(octet & 0x07) default: value = 0 } // Check and decode the trailing octets. for k := 1; k < width; k++ { octet = parser.raw_buffer[parser.raw_buffer_pos+k] // Check if the octet is valid. if (octet & 0xC0) != 0x80 { return yaml_parser_set_reader_error(parser, "invalid trailing UTF-8 octet", parser.offset+k, int(octet)) } // Decode the octet. value = (value << 6) + rune(octet&0x3F) } // Check the length of the sequence against the value. switch { case width == 1: case width == 2 && value >= 0x80: case width == 3 && value >= 0x800: case width == 4 && value >= 0x10000: default: return yaml_parser_set_reader_error(parser, "invalid length of a UTF-8 sequence", parser.offset, -1) } // Check the range of the value. if value >= 0xD800 && value <= 0xDFFF || value > 0x10FFFF { return yaml_parser_set_reader_error(parser, "invalid Unicode character", parser.offset, int(value)) } case yaml_UTF16LE_ENCODING, yaml_UTF16BE_ENCODING: var low, high int if parser.encoding == yaml_UTF16LE_ENCODING { low, high = 0, 1 } else { low, high = 1, 0 } // The UTF-16 encoding is not as simple as one might // naively think. Check RFC 2781 // (http://www.ietf.org/rfc/rfc2781.txt). // // Normally, two subsequent bytes describe a Unicode // character. However a special technique (called a // surrogate pair) is used for specifying character // values larger than 0xFFFF. // // A surrogate pair consists of two pseudo-characters: // high surrogate area (0xD800-0xDBFF) // low surrogate area (0xDC00-0xDFFF) // // The following formulas are used for decoding // and encoding characters using surrogate pairs: // // U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF) // U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF) // W1 = 110110yyyyyyyyyy // W2 = 110111xxxxxxxxxx // // where U is the character value, W1 is the high surrogate // area, W2 is the low surrogate area. // Check for incomplete UTF-16 character. if raw_unread < 2 { if parser.eof { return yaml_parser_set_reader_error(parser, "incomplete UTF-16 character", parser.offset, -1) } break inner } // Get the character. value = rune(parser.raw_buffer[parser.raw_buffer_pos+low]) + (rune(parser.raw_buffer[parser.raw_buffer_pos+high]) << 8) // Check for unexpected low surrogate area. if value&0xFC00 == 0xDC00 { return yaml_parser_set_reader_error(parser, "unexpected low surrogate area", parser.offset, int(value)) } // Check for a high surrogate area. if value&0xFC00 == 0xD800 { width = 4 // Check for incomplete surrogate pair. if raw_unread < 4 { if parser.eof { return yaml_parser_set_reader_error(parser, "incomplete UTF-16 surrogate pair", parser.offset, -1) } break inner } // Get the next character. value2 := rune(parser.raw_buffer[parser.raw_buffer_pos+low+2]) + (rune(parser.raw_buffer[parser.raw_buffer_pos+high+2]) << 8) // Check for a low surrogate area. if value2&0xFC00 != 0xDC00 { return yaml_parser_set_reader_error(parser, "expected low surrogate area", parser.offset+2, int(value2)) } // Generate the value of the surrogate pair. value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF) } else { width = 2 } default: panic("impossible") } // Check if the character is in the allowed range: // #x9 | #xA | #xD | [#x20-#x7E] (8 bit) // | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit) // | [#x10000-#x10FFFF] (32 bit) switch { case value == 0x09: case value == 0x0A: case value == 0x0D: case value >= 0x20 && value <= 0x7E: case value == 0x85: case value >= 0xA0 && value <= 0xD7FF: case value >= 0xE000 && value <= 0xFFFD: case value >= 0x10000 && value <= 0x10FFFF: default: return yaml_parser_set_reader_error(parser, "control characters are not allowed", parser.offset, int(value)) } // Move the raw pointers. parser.raw_buffer_pos += width parser.offset += width // Finally put the character into the buffer. if value <= 0x7F { // 0000 0000-0000 007F . 0xxxxxxx parser.buffer[buffer_len+0] = byte(value) buffer_len += 1 } else if value <= 0x7FF { // 0000 0080-0000 07FF . 110xxxxx 10xxxxxx parser.buffer[buffer_len+0] = byte(0xC0 + (value >> 6)) parser.buffer[buffer_len+1] = byte(0x80 + (value & 0x3F)) buffer_len += 2 } else if value <= 0xFFFF { // 0000 0800-0000 FFFF . 1110xxxx 10xxxxxx 10xxxxxx parser.buffer[buffer_len+0] = byte(0xE0 + (value >> 12)) parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 6) & 0x3F)) parser.buffer[buffer_len+2] = byte(0x80 + (value & 0x3F)) buffer_len += 3 } else { // 0001 0000-0010 FFFF . 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx parser.buffer[buffer_len+0] = byte(0xF0 + (value >> 18)) parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 12) & 0x3F)) parser.buffer[buffer_len+2] = byte(0x80 + ((value >> 6) & 0x3F)) parser.buffer[buffer_len+3] = byte(0x80 + (value & 0x3F)) buffer_len += 4 } parser.unread++ } // On EOF, put NUL into the buffer and return. if parser.eof { parser.buffer[buffer_len] = 0 buffer_len++ parser.unread++ break } } // [Go] Read the documentation of this function above. To return true, // we need to have the given length in the buffer. Not doing that means // every single check that calls this function to make sure the buffer // has a given length is Go) panicking; or C) accessing invalid memory. // This happens here due to the EOF above breaking early. for buffer_len < length { parser.buffer[buffer_len] = 0 buffer_len++ } parser.buffer = parser.buffer[:buffer_len] return true }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/writerc.go
vendor/gopkg.in/yaml.v3/writerc.go
// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov // // 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. package yaml // Set the writer error and return false. func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { emitter.error = yaml_WRITER_ERROR emitter.problem = problem return false } // Flush the output buffer. func yaml_emitter_flush(emitter *yaml_emitter_t) bool { if emitter.write_handler == nil { panic("write handler not set") } // Check if the buffer is empty. if emitter.buffer_pos == 0 { return true } if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) } emitter.buffer_pos = 0 return true }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/yamlh.go
vendor/gopkg.in/yaml.v3/yamlh.go
// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov // // 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. package yaml import ( "fmt" "io" ) // The version directive data. type yaml_version_directive_t struct { major int8 // The major version number. minor int8 // The minor version number. } // The tag directive data. type yaml_tag_directive_t struct { handle []byte // The tag handle. prefix []byte // The tag prefix. } type yaml_encoding_t int // The stream encoding. const ( // Let the parser choose the encoding. yaml_ANY_ENCODING yaml_encoding_t = iota yaml_UTF8_ENCODING // The default UTF-8 encoding. yaml_UTF16LE_ENCODING // The UTF-16-LE encoding with BOM. yaml_UTF16BE_ENCODING // The UTF-16-BE encoding with BOM. ) type yaml_break_t int // Line break types. const ( // Let the parser choose the break type. yaml_ANY_BREAK yaml_break_t = iota yaml_CR_BREAK // Use CR for line breaks (Mac style). yaml_LN_BREAK // Use LN for line breaks (Unix style). yaml_CRLN_BREAK // Use CR LN for line breaks (DOS style). ) type yaml_error_type_t int // Many bad things could happen with the parser and emitter. const ( // No error is produced. yaml_NO_ERROR yaml_error_type_t = iota yaml_MEMORY_ERROR // Cannot allocate or reallocate a block of memory. yaml_READER_ERROR // Cannot read or decode the input stream. yaml_SCANNER_ERROR // Cannot scan the input stream. yaml_PARSER_ERROR // Cannot parse the input stream. yaml_COMPOSER_ERROR // Cannot compose a YAML document. yaml_WRITER_ERROR // Cannot write to the output stream. yaml_EMITTER_ERROR // Cannot emit a YAML stream. ) // The pointer position. type yaml_mark_t struct { index int // The position index. line int // The position line. column int // The position column. } // Node Styles type yaml_style_t int8 type yaml_scalar_style_t yaml_style_t // Scalar styles. const ( // Let the emitter choose the style. yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = 0 yaml_PLAIN_SCALAR_STYLE yaml_scalar_style_t = 1 << iota // The plain scalar style. yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style. yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style. yaml_LITERAL_SCALAR_STYLE // The literal scalar style. yaml_FOLDED_SCALAR_STYLE // The folded scalar style. ) type yaml_sequence_style_t yaml_style_t // Sequence styles. const ( // Let the emitter choose the style. yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota yaml_BLOCK_SEQUENCE_STYLE // The block sequence style. yaml_FLOW_SEQUENCE_STYLE // The flow sequence style. ) type yaml_mapping_style_t yaml_style_t // Mapping styles. const ( // Let the emitter choose the style. yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota yaml_BLOCK_MAPPING_STYLE // The block mapping style. yaml_FLOW_MAPPING_STYLE // The flow mapping style. ) // Tokens type yaml_token_type_t int // Token types. const ( // An empty token. yaml_NO_TOKEN yaml_token_type_t = iota yaml_STREAM_START_TOKEN // A STREAM-START token. yaml_STREAM_END_TOKEN // A STREAM-END token. yaml_VERSION_DIRECTIVE_TOKEN // A VERSION-DIRECTIVE token. yaml_TAG_DIRECTIVE_TOKEN // A TAG-DIRECTIVE token. yaml_DOCUMENT_START_TOKEN // A DOCUMENT-START token. yaml_DOCUMENT_END_TOKEN // A DOCUMENT-END token. yaml_BLOCK_SEQUENCE_START_TOKEN // A BLOCK-SEQUENCE-START token. yaml_BLOCK_MAPPING_START_TOKEN // A BLOCK-SEQUENCE-END token. yaml_BLOCK_END_TOKEN // A BLOCK-END token. yaml_FLOW_SEQUENCE_START_TOKEN // A FLOW-SEQUENCE-START token. yaml_FLOW_SEQUENCE_END_TOKEN // A FLOW-SEQUENCE-END token. yaml_FLOW_MAPPING_START_TOKEN // A FLOW-MAPPING-START token. yaml_FLOW_MAPPING_END_TOKEN // A FLOW-MAPPING-END token. yaml_BLOCK_ENTRY_TOKEN // A BLOCK-ENTRY token. yaml_FLOW_ENTRY_TOKEN // A FLOW-ENTRY token. yaml_KEY_TOKEN // A KEY token. yaml_VALUE_TOKEN // A VALUE token. yaml_ALIAS_TOKEN // An ALIAS token. yaml_ANCHOR_TOKEN // An ANCHOR token. yaml_TAG_TOKEN // A TAG token. yaml_SCALAR_TOKEN // A SCALAR token. ) func (tt yaml_token_type_t) String() string { switch tt { case yaml_NO_TOKEN: return "yaml_NO_TOKEN" case yaml_STREAM_START_TOKEN: return "yaml_STREAM_START_TOKEN" case yaml_STREAM_END_TOKEN: return "yaml_STREAM_END_TOKEN" case yaml_VERSION_DIRECTIVE_TOKEN: return "yaml_VERSION_DIRECTIVE_TOKEN" case yaml_TAG_DIRECTIVE_TOKEN: return "yaml_TAG_DIRECTIVE_TOKEN" case yaml_DOCUMENT_START_TOKEN: return "yaml_DOCUMENT_START_TOKEN" case yaml_DOCUMENT_END_TOKEN: return "yaml_DOCUMENT_END_TOKEN" case yaml_BLOCK_SEQUENCE_START_TOKEN: return "yaml_BLOCK_SEQUENCE_START_TOKEN" case yaml_BLOCK_MAPPING_START_TOKEN: return "yaml_BLOCK_MAPPING_START_TOKEN" case yaml_BLOCK_END_TOKEN: return "yaml_BLOCK_END_TOKEN" case yaml_FLOW_SEQUENCE_START_TOKEN: return "yaml_FLOW_SEQUENCE_START_TOKEN" case yaml_FLOW_SEQUENCE_END_TOKEN: return "yaml_FLOW_SEQUENCE_END_TOKEN" case yaml_FLOW_MAPPING_START_TOKEN: return "yaml_FLOW_MAPPING_START_TOKEN" case yaml_FLOW_MAPPING_END_TOKEN: return "yaml_FLOW_MAPPING_END_TOKEN" case yaml_BLOCK_ENTRY_TOKEN: return "yaml_BLOCK_ENTRY_TOKEN" case yaml_FLOW_ENTRY_TOKEN: return "yaml_FLOW_ENTRY_TOKEN" case yaml_KEY_TOKEN: return "yaml_KEY_TOKEN" case yaml_VALUE_TOKEN: return "yaml_VALUE_TOKEN" case yaml_ALIAS_TOKEN: return "yaml_ALIAS_TOKEN" case yaml_ANCHOR_TOKEN: return "yaml_ANCHOR_TOKEN" case yaml_TAG_TOKEN: return "yaml_TAG_TOKEN" case yaml_SCALAR_TOKEN: return "yaml_SCALAR_TOKEN" } return "<unknown token>" } // The token structure. type yaml_token_t struct { // The token type. typ yaml_token_type_t // The start/end of the token. start_mark, end_mark yaml_mark_t // The stream encoding (for yaml_STREAM_START_TOKEN). encoding yaml_encoding_t // The alias/anchor/scalar value or tag/tag directive handle // (for yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN, yaml_TAG_TOKEN, yaml_TAG_DIRECTIVE_TOKEN). value []byte // The tag suffix (for yaml_TAG_TOKEN). suffix []byte // The tag directive prefix (for yaml_TAG_DIRECTIVE_TOKEN). prefix []byte // The scalar style (for yaml_SCALAR_TOKEN). style yaml_scalar_style_t // The version directive major/minor (for yaml_VERSION_DIRECTIVE_TOKEN). major, minor int8 } // Events type yaml_event_type_t int8 // Event types. const ( // An empty event. yaml_NO_EVENT yaml_event_type_t = iota yaml_STREAM_START_EVENT // A STREAM-START event. yaml_STREAM_END_EVENT // A STREAM-END event. yaml_DOCUMENT_START_EVENT // A DOCUMENT-START event. yaml_DOCUMENT_END_EVENT // A DOCUMENT-END event. yaml_ALIAS_EVENT // An ALIAS event. yaml_SCALAR_EVENT // A SCALAR event. yaml_SEQUENCE_START_EVENT // A SEQUENCE-START event. yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event. yaml_MAPPING_START_EVENT // A MAPPING-START event. yaml_MAPPING_END_EVENT // A MAPPING-END event. yaml_TAIL_COMMENT_EVENT ) var eventStrings = []string{ yaml_NO_EVENT: "none", yaml_STREAM_START_EVENT: "stream start", yaml_STREAM_END_EVENT: "stream end", yaml_DOCUMENT_START_EVENT: "document start", yaml_DOCUMENT_END_EVENT: "document end", yaml_ALIAS_EVENT: "alias", yaml_SCALAR_EVENT: "scalar", yaml_SEQUENCE_START_EVENT: "sequence start", yaml_SEQUENCE_END_EVENT: "sequence end", yaml_MAPPING_START_EVENT: "mapping start", yaml_MAPPING_END_EVENT: "mapping end", yaml_TAIL_COMMENT_EVENT: "tail comment", } func (e yaml_event_type_t) String() string { if e < 0 || int(e) >= len(eventStrings) { return fmt.Sprintf("unknown event %d", e) } return eventStrings[e] } // The event structure. type yaml_event_t struct { // The event type. typ yaml_event_type_t // The start and end of the event. start_mark, end_mark yaml_mark_t // The document encoding (for yaml_STREAM_START_EVENT). encoding yaml_encoding_t // The version directive (for yaml_DOCUMENT_START_EVENT). version_directive *yaml_version_directive_t // The list of tag directives (for yaml_DOCUMENT_START_EVENT). tag_directives []yaml_tag_directive_t // The comments head_comment []byte line_comment []byte foot_comment []byte tail_comment []byte // The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT). anchor []byte // The tag (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). tag []byte // The scalar value (for yaml_SCALAR_EVENT). value []byte // Is the document start/end indicator implicit, or the tag optional? // (for yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_SCALAR_EVENT). implicit bool // Is the tag optional for any non-plain style? (for yaml_SCALAR_EVENT). quoted_implicit bool // The style (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). style yaml_style_t } func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return yaml_scalar_style_t(e.style) } func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return yaml_sequence_style_t(e.style) } func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return yaml_mapping_style_t(e.style) } // Nodes const ( yaml_NULL_TAG = "tag:yaml.org,2002:null" // The tag !!null with the only possible value: null. yaml_BOOL_TAG = "tag:yaml.org,2002:bool" // The tag !!bool with the values: true and false. yaml_STR_TAG = "tag:yaml.org,2002:str" // The tag !!str for string values. yaml_INT_TAG = "tag:yaml.org,2002:int" // The tag !!int for integer values. yaml_FLOAT_TAG = "tag:yaml.org,2002:float" // The tag !!float for float values. yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" // The tag !!timestamp for date and time values. yaml_SEQ_TAG = "tag:yaml.org,2002:seq" // The tag !!seq is used to denote sequences. yaml_MAP_TAG = "tag:yaml.org,2002:map" // The tag !!map is used to denote mapping. // Not in original libyaml. yaml_BINARY_TAG = "tag:yaml.org,2002:binary" yaml_MERGE_TAG = "tag:yaml.org,2002:merge" yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str. yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq. yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG // The default mapping tag is !!map. ) type yaml_node_type_t int // Node types. const ( // An empty node. yaml_NO_NODE yaml_node_type_t = iota yaml_SCALAR_NODE // A scalar node. yaml_SEQUENCE_NODE // A sequence node. yaml_MAPPING_NODE // A mapping node. ) // An element of a sequence node. type yaml_node_item_t int // An element of a mapping node. type yaml_node_pair_t struct { key int // The key of the element. value int // The value of the element. } // The node structure. type yaml_node_t struct { typ yaml_node_type_t // The node type. tag []byte // The node tag. // The node data. // The scalar parameters (for yaml_SCALAR_NODE). scalar struct { value []byte // The scalar value. length int // The length of the scalar value. style yaml_scalar_style_t // The scalar style. } // The sequence parameters (for YAML_SEQUENCE_NODE). sequence struct { items_data []yaml_node_item_t // The stack of sequence items. style yaml_sequence_style_t // The sequence style. } // The mapping parameters (for yaml_MAPPING_NODE). mapping struct { pairs_data []yaml_node_pair_t // The stack of mapping pairs (key, value). pairs_start *yaml_node_pair_t // The beginning of the stack. pairs_end *yaml_node_pair_t // The end of the stack. pairs_top *yaml_node_pair_t // The top of the stack. style yaml_mapping_style_t // The mapping style. } start_mark yaml_mark_t // The beginning of the node. end_mark yaml_mark_t // The end of the node. } // The document structure. type yaml_document_t struct { // The document nodes. nodes []yaml_node_t // The version directive. version_directive *yaml_version_directive_t // The list of tag directives. tag_directives_data []yaml_tag_directive_t tag_directives_start int // The beginning of the tag directives list. tag_directives_end int // The end of the tag directives list. start_implicit int // Is the document start indicator implicit? end_implicit int // Is the document end indicator implicit? // The start/end of the document. start_mark, end_mark yaml_mark_t } // The prototype of a read handler. // // The read handler is called when the parser needs to read more bytes from the // source. The handler should write not more than size bytes to the buffer. // The number of written bytes should be set to the size_read variable. // // [in,out] data A pointer to an application data specified by // yaml_parser_set_input(). // [out] buffer The buffer to write the data from the source. // [in] size The size of the buffer. // [out] size_read The actual number of bytes read from the source. // // On success, the handler should return 1. If the handler failed, // the returned value should be 0. On EOF, the handler should set the // size_read to 0 and return 1. type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error) // This structure holds information about a potential simple key. type yaml_simple_key_t struct { possible bool // Is a simple key possible? required bool // Is a simple key required? token_number int // The number of the token. mark yaml_mark_t // The position mark. } // The states of the parser. type yaml_parser_state_t int const ( yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE // Expect the beginning of an implicit document. yaml_PARSE_DOCUMENT_START_STATE // Expect DOCUMENT-START. yaml_PARSE_DOCUMENT_CONTENT_STATE // Expect the content of a document. yaml_PARSE_DOCUMENT_END_STATE // Expect DOCUMENT-END. yaml_PARSE_BLOCK_NODE_STATE // Expect a block node. yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE // Expect a block node or indentless sequence. yaml_PARSE_FLOW_NODE_STATE // Expect a flow node. yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a block sequence. yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE // Expect an entry of a block sequence. yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE // Expect an entry of an indentless sequence. yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. yaml_PARSE_BLOCK_MAPPING_KEY_STATE // Expect a block mapping key. yaml_PARSE_BLOCK_MAPPING_VALUE_STATE // Expect a block mapping value. yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a flow sequence. yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE // Expect an entry of a flow sequence. yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE // Expect a key of an ordered mapping. yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE // Expect a value of an ordered mapping. yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE // Expect the and of an ordered mapping entry. yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. yaml_PARSE_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. yaml_PARSE_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE // Expect an empty value of a flow mapping. yaml_PARSE_END_STATE // Expect nothing. ) func (ps yaml_parser_state_t) String() string { switch ps { case yaml_PARSE_STREAM_START_STATE: return "yaml_PARSE_STREAM_START_STATE" case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: return "yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE" case yaml_PARSE_DOCUMENT_START_STATE: return "yaml_PARSE_DOCUMENT_START_STATE" case yaml_PARSE_DOCUMENT_CONTENT_STATE: return "yaml_PARSE_DOCUMENT_CONTENT_STATE" case yaml_PARSE_DOCUMENT_END_STATE: return "yaml_PARSE_DOCUMENT_END_STATE" case yaml_PARSE_BLOCK_NODE_STATE: return "yaml_PARSE_BLOCK_NODE_STATE" case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: return "yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE" case yaml_PARSE_FLOW_NODE_STATE: return "yaml_PARSE_FLOW_NODE_STATE" case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: return "yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE" case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: return "yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE" case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: return "yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE" case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: return "yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE" case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: return "yaml_PARSE_BLOCK_MAPPING_KEY_STATE" case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: return "yaml_PARSE_BLOCK_MAPPING_VALUE_STATE" case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: return "yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE" case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE" case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE" case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE" case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE" case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: return "yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE" case yaml_PARSE_FLOW_MAPPING_KEY_STATE: return "yaml_PARSE_FLOW_MAPPING_KEY_STATE" case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: return "yaml_PARSE_FLOW_MAPPING_VALUE_STATE" case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: return "yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE" case yaml_PARSE_END_STATE: return "yaml_PARSE_END_STATE" } return "<unknown parser state>" } // This structure holds aliases data. type yaml_alias_data_t struct { anchor []byte // The anchor. index int // The node id. mark yaml_mark_t // The anchor mark. } // The parser structure. // // All members are internal. Manage the structure using the // yaml_parser_ family of functions. type yaml_parser_t struct { // Error handling error yaml_error_type_t // Error type. problem string // Error description. // The byte about which the problem occurred. problem_offset int problem_value int problem_mark yaml_mark_t // The error context. context string context_mark yaml_mark_t // Reader stuff read_handler yaml_read_handler_t // Read handler. input_reader io.Reader // File input data. input []byte // String input data. input_pos int eof bool // EOF flag buffer []byte // The working buffer. buffer_pos int // The current position of the buffer. unread int // The number of unread characters in the buffer. newlines int // The number of line breaks since last non-break/non-blank character raw_buffer []byte // The raw buffer. raw_buffer_pos int // The current position of the buffer. encoding yaml_encoding_t // The input encoding. offset int // The offset of the current position (in bytes). mark yaml_mark_t // The mark of the current position. // Comments head_comment []byte // The current head comments line_comment []byte // The current line comments foot_comment []byte // The current foot comments tail_comment []byte // Foot comment that happens at the end of a block. stem_comment []byte // Comment in item preceding a nested structure (list inside list item, etc) comments []yaml_comment_t // The folded comments for all parsed tokens comments_head int // Scanner stuff stream_start_produced bool // Have we started to scan the input stream? stream_end_produced bool // Have we reached the end of the input stream? flow_level int // The number of unclosed '[' and '{' indicators. tokens []yaml_token_t // The tokens queue. tokens_head int // The head of the tokens queue. tokens_parsed int // The number of tokens fetched from the queue. token_available bool // Does the tokens queue contain a token ready for dequeueing. indent int // The current indentation level. indents []int // The indentation levels stack. simple_key_allowed bool // May a simple key occur at the current position? simple_keys []yaml_simple_key_t // The stack of simple keys. simple_keys_by_tok map[int]int // possible simple_key indexes indexed by token_number // Parser stuff state yaml_parser_state_t // The current parser state. states []yaml_parser_state_t // The parser states stack. marks []yaml_mark_t // The stack of marks. tag_directives []yaml_tag_directive_t // The list of TAG directives. // Dumper stuff aliases []yaml_alias_data_t // The alias data. document *yaml_document_t // The currently parsed document. } type yaml_comment_t struct { scan_mark yaml_mark_t // Position where scanning for comments started token_mark yaml_mark_t // Position after which tokens will be associated with this comment start_mark yaml_mark_t // Position of '#' comment mark end_mark yaml_mark_t // Position where comment terminated head []byte line []byte foot []byte } // Emitter Definitions // The prototype of a write handler. // // The write handler is called when the emitter needs to flush the accumulated // characters to the output. The handler should write @a size bytes of the // @a buffer to the output. // // @param[in,out] data A pointer to an application data specified by // yaml_emitter_set_output(). // @param[in] buffer The buffer with bytes to be written. // @param[in] size The size of the buffer. // // @returns On success, the handler should return @c 1. If the handler failed, // the returned value should be @c 0. // type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error type yaml_emitter_state_t int // The emitter states. const ( // Expect STREAM-START. yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota yaml_EMIT_FIRST_DOCUMENT_START_STATE // Expect the first DOCUMENT-START or STREAM-END. yaml_EMIT_DOCUMENT_START_STATE // Expect DOCUMENT-START or STREAM-END. yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document. yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END. yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence. yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE // Expect the next item of a flow sequence, with the comma already written out yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence. yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE // Expect the next key of a flow mapping, with the comma already written out yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping. yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a block sequence. yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE // Expect an item of a block sequence. yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. yaml_EMIT_BLOCK_MAPPING_KEY_STATE // Expect the key of a block mapping. yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a block mapping. yaml_EMIT_BLOCK_MAPPING_VALUE_STATE // Expect a value of a block mapping. yaml_EMIT_END_STATE // Expect nothing. ) // The emitter structure. // // All members are internal. Manage the structure using the @c yaml_emitter_ // family of functions. type yaml_emitter_t struct { // Error handling error yaml_error_type_t // Error type. problem string // Error description. // Writer stuff write_handler yaml_write_handler_t // Write handler. output_buffer *[]byte // String output data. output_writer io.Writer // File output data. buffer []byte // The working buffer. buffer_pos int // The current position of the buffer. raw_buffer []byte // The raw buffer. raw_buffer_pos int // The current position of the buffer. encoding yaml_encoding_t // The stream encoding. // Emitter stuff canonical bool // If the output is in the canonical style? best_indent int // The number of indentation spaces. best_width int // The preferred width of the output lines. unicode bool // Allow unescaped non-ASCII characters? line_break yaml_break_t // The preferred line break. state yaml_emitter_state_t // The current emitter state. states []yaml_emitter_state_t // The stack of states. events []yaml_event_t // The event queue. events_head int // The head of the event queue. indents []int // The stack of indentation levels. tag_directives []yaml_tag_directive_t // The list of tag directives. indent int // The current indentation level. flow_level int // The current flow level. root_context bool // Is it the document root context? sequence_context bool // Is it a sequence context? mapping_context bool // Is it a mapping context? simple_key_context bool // Is it a simple mapping key context? line int // The current line. column int // The current column. whitespace bool // If the last character was a whitespace? indention bool // If the last character was an indentation character (' ', '-', '?', ':')? open_ended bool // If an explicit document end is required? space_above bool // Is there's an empty line above? foot_indent int // The indent used to write the foot comment above, or -1 if none. // Anchor analysis. anchor_data struct { anchor []byte // The anchor value. alias bool // Is it an alias? } // Tag analysis. tag_data struct { handle []byte // The tag handle. suffix []byte // The tag suffix. } // Scalar analysis. scalar_data struct { value []byte // The scalar value. multiline bool // Does the scalar contain line breaks? flow_plain_allowed bool // Can the scalar be expessed in the flow plain style? block_plain_allowed bool // Can the scalar be expressed in the block plain style? single_quoted_allowed bool // Can the scalar be expressed in the single quoted style? block_allowed bool // Can the scalar be expressed in the literal or folded styles? style yaml_scalar_style_t // The output style. } // Comments head_comment []byte line_comment []byte foot_comment []byte tail_comment []byte key_line_comment []byte // Dumper stuff opened bool // If the stream was already opened? closed bool // If the stream was already closed? // The information associated with the document nodes. anchors *struct { references int // The number of references. anchor int // The anchor id. serialized bool // If the node has been emitted? } last_anchor_id int // The last assigned anchor id. document *yaml_document_t // The currently emitted document. }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/scannerc.go
vendor/gopkg.in/yaml.v3/scannerc.go
// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov // // 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. package yaml import ( "bytes" "fmt" ) // Introduction // ************ // // The following notes assume that you are familiar with the YAML specification // (http://yaml.org/spec/1.2/spec.html). We mostly follow it, although in // some cases we are less restrictive that it requires. // // The process of transforming a YAML stream into a sequence of events is // divided on two steps: Scanning and Parsing. // // The Scanner transforms the input stream into a sequence of tokens, while the // parser transform the sequence of tokens produced by the Scanner into a // sequence of parsing events. // // The Scanner is rather clever and complicated. The Parser, on the contrary, // is a straightforward implementation of a recursive-descendant parser (or, // LL(1) parser, as it is usually called). // // Actually there are two issues of Scanning that might be called "clever", the // rest is quite straightforward. The issues are "block collection start" and // "simple keys". Both issues are explained below in details. // // Here the Scanning step is explained and implemented. We start with the list // of all the tokens produced by the Scanner together with short descriptions. // // Now, tokens: // // STREAM-START(encoding) # The stream start. // STREAM-END # The stream end. // VERSION-DIRECTIVE(major,minor) # The '%YAML' directive. // TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive. // DOCUMENT-START # '---' // DOCUMENT-END # '...' // BLOCK-SEQUENCE-START # Indentation increase denoting a block // BLOCK-MAPPING-START # sequence or a block mapping. // BLOCK-END # Indentation decrease. // FLOW-SEQUENCE-START # '[' // FLOW-SEQUENCE-END # ']' // BLOCK-SEQUENCE-START # '{' // BLOCK-SEQUENCE-END # '}' // BLOCK-ENTRY # '-' // FLOW-ENTRY # ',' // KEY # '?' or nothing (simple keys). // VALUE # ':' // ALIAS(anchor) # '*anchor' // ANCHOR(anchor) # '&anchor' // TAG(handle,suffix) # '!handle!suffix' // SCALAR(value,style) # A scalar. // // The following two tokens are "virtual" tokens denoting the beginning and the // end of the stream: // // STREAM-START(encoding) // STREAM-END // // We pass the information about the input stream encoding with the // STREAM-START token. // // The next two tokens are responsible for tags: // // VERSION-DIRECTIVE(major,minor) // TAG-DIRECTIVE(handle,prefix) // // Example: // // %YAML 1.1 // %TAG ! !foo // %TAG !yaml! tag:yaml.org,2002: // --- // // The correspoding sequence of tokens: // // STREAM-START(utf-8) // VERSION-DIRECTIVE(1,1) // TAG-DIRECTIVE("!","!foo") // TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:") // DOCUMENT-START // STREAM-END // // Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole // line. // // The document start and end indicators are represented by: // // DOCUMENT-START // DOCUMENT-END // // Note that if a YAML stream contains an implicit document (without '---' // and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be // produced. // // In the following examples, we present whole documents together with the // produced tokens. // // 1. An implicit document: // // 'a scalar' // // Tokens: // // STREAM-START(utf-8) // SCALAR("a scalar",single-quoted) // STREAM-END // // 2. An explicit document: // // --- // 'a scalar' // ... // // Tokens: // // STREAM-START(utf-8) // DOCUMENT-START // SCALAR("a scalar",single-quoted) // DOCUMENT-END // STREAM-END // // 3. Several documents in a stream: // // 'a scalar' // --- // 'another scalar' // --- // 'yet another scalar' // // Tokens: // // STREAM-START(utf-8) // SCALAR("a scalar",single-quoted) // DOCUMENT-START // SCALAR("another scalar",single-quoted) // DOCUMENT-START // SCALAR("yet another scalar",single-quoted) // STREAM-END // // We have already introduced the SCALAR token above. The following tokens are // used to describe aliases, anchors, tag, and scalars: // // ALIAS(anchor) // ANCHOR(anchor) // TAG(handle,suffix) // SCALAR(value,style) // // The following series of examples illustrate the usage of these tokens: // // 1. A recursive sequence: // // &A [ *A ] // // Tokens: // // STREAM-START(utf-8) // ANCHOR("A") // FLOW-SEQUENCE-START // ALIAS("A") // FLOW-SEQUENCE-END // STREAM-END // // 2. A tagged scalar: // // !!float "3.14" # A good approximation. // // Tokens: // // STREAM-START(utf-8) // TAG("!!","float") // SCALAR("3.14",double-quoted) // STREAM-END // // 3. Various scalar styles: // // --- # Implicit empty plain scalars do not produce tokens. // --- a plain scalar // --- 'a single-quoted scalar' // --- "a double-quoted scalar" // --- |- // a literal scalar // --- >- // a folded // scalar // // Tokens: // // STREAM-START(utf-8) // DOCUMENT-START // DOCUMENT-START // SCALAR("a plain scalar",plain) // DOCUMENT-START // SCALAR("a single-quoted scalar",single-quoted) // DOCUMENT-START // SCALAR("a double-quoted scalar",double-quoted) // DOCUMENT-START // SCALAR("a literal scalar",literal) // DOCUMENT-START // SCALAR("a folded scalar",folded) // STREAM-END // // Now it's time to review collection-related tokens. We will start with // flow collections: // // FLOW-SEQUENCE-START // FLOW-SEQUENCE-END // FLOW-MAPPING-START // FLOW-MAPPING-END // FLOW-ENTRY // KEY // VALUE // // The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and // FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}' // correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the // indicators '?' and ':', which are used for denoting mapping keys and values, // are represented by the KEY and VALUE tokens. // // The following examples show flow collections: // // 1. A flow sequence: // // [item 1, item 2, item 3] // // Tokens: // // STREAM-START(utf-8) // FLOW-SEQUENCE-START // SCALAR("item 1",plain) // FLOW-ENTRY // SCALAR("item 2",plain) // FLOW-ENTRY // SCALAR("item 3",plain) // FLOW-SEQUENCE-END // STREAM-END // // 2. A flow mapping: // // { // a simple key: a value, # Note that the KEY token is produced. // ? a complex key: another value, // } // // Tokens: // // STREAM-START(utf-8) // FLOW-MAPPING-START // KEY // SCALAR("a simple key",plain) // VALUE // SCALAR("a value",plain) // FLOW-ENTRY // KEY // SCALAR("a complex key",plain) // VALUE // SCALAR("another value",plain) // FLOW-ENTRY // FLOW-MAPPING-END // STREAM-END // // A simple key is a key which is not denoted by the '?' indicator. Note that // the Scanner still produce the KEY token whenever it encounters a simple key. // // For scanning block collections, the following tokens are used (note that we // repeat KEY and VALUE here): // // BLOCK-SEQUENCE-START // BLOCK-MAPPING-START // BLOCK-END // BLOCK-ENTRY // KEY // VALUE // // The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation // increase that precedes a block collection (cf. the INDENT token in Python). // The token BLOCK-END denote indentation decrease that ends a block collection // (cf. the DEDENT token in Python). However YAML has some syntax pecularities // that makes detections of these tokens more complex. // // The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators // '-', '?', and ':' correspondingly. // // The following examples show how the tokens BLOCK-SEQUENCE-START, // BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner: // // 1. Block sequences: // // - item 1 // - item 2 // - // - item 3.1 // - item 3.2 // - // key 1: value 1 // key 2: value 2 // // Tokens: // // STREAM-START(utf-8) // BLOCK-SEQUENCE-START // BLOCK-ENTRY // SCALAR("item 1",plain) // BLOCK-ENTRY // SCALAR("item 2",plain) // BLOCK-ENTRY // BLOCK-SEQUENCE-START // BLOCK-ENTRY // SCALAR("item 3.1",plain) // BLOCK-ENTRY // SCALAR("item 3.2",plain) // BLOCK-END // BLOCK-ENTRY // BLOCK-MAPPING-START // KEY // SCALAR("key 1",plain) // VALUE // SCALAR("value 1",plain) // KEY // SCALAR("key 2",plain) // VALUE // SCALAR("value 2",plain) // BLOCK-END // BLOCK-END // STREAM-END // // 2. Block mappings: // // a simple key: a value # The KEY token is produced here. // ? a complex key // : another value // a mapping: // key 1: value 1 // key 2: value 2 // a sequence: // - item 1 // - item 2 // // Tokens: // // STREAM-START(utf-8) // BLOCK-MAPPING-START // KEY // SCALAR("a simple key",plain) // VALUE // SCALAR("a value",plain) // KEY // SCALAR("a complex key",plain) // VALUE // SCALAR("another value",plain) // KEY // SCALAR("a mapping",plain) // BLOCK-MAPPING-START // KEY // SCALAR("key 1",plain) // VALUE // SCALAR("value 1",plain) // KEY // SCALAR("key 2",plain) // VALUE // SCALAR("value 2",plain) // BLOCK-END // KEY // SCALAR("a sequence",plain) // VALUE // BLOCK-SEQUENCE-START // BLOCK-ENTRY // SCALAR("item 1",plain) // BLOCK-ENTRY // SCALAR("item 2",plain) // BLOCK-END // BLOCK-END // STREAM-END // // YAML does not always require to start a new block collection from a new // line. If the current line contains only '-', '?', and ':' indicators, a new // block collection may start at the current line. The following examples // illustrate this case: // // 1. Collections in a sequence: // // - - item 1 // - item 2 // - key 1: value 1 // key 2: value 2 // - ? complex key // : complex value // // Tokens: // // STREAM-START(utf-8) // BLOCK-SEQUENCE-START // BLOCK-ENTRY // BLOCK-SEQUENCE-START // BLOCK-ENTRY // SCALAR("item 1",plain) // BLOCK-ENTRY // SCALAR("item 2",plain) // BLOCK-END // BLOCK-ENTRY // BLOCK-MAPPING-START // KEY // SCALAR("key 1",plain) // VALUE // SCALAR("value 1",plain) // KEY // SCALAR("key 2",plain) // VALUE // SCALAR("value 2",plain) // BLOCK-END // BLOCK-ENTRY // BLOCK-MAPPING-START // KEY // SCALAR("complex key") // VALUE // SCALAR("complex value") // BLOCK-END // BLOCK-END // STREAM-END // // 2. Collections in a mapping: // // ? a sequence // : - item 1 // - item 2 // ? a mapping // : key 1: value 1 // key 2: value 2 // // Tokens: // // STREAM-START(utf-8) // BLOCK-MAPPING-START // KEY // SCALAR("a sequence",plain) // VALUE // BLOCK-SEQUENCE-START // BLOCK-ENTRY // SCALAR("item 1",plain) // BLOCK-ENTRY // SCALAR("item 2",plain) // BLOCK-END // KEY // SCALAR("a mapping",plain) // VALUE // BLOCK-MAPPING-START // KEY // SCALAR("key 1",plain) // VALUE // SCALAR("value 1",plain) // KEY // SCALAR("key 2",plain) // VALUE // SCALAR("value 2",plain) // BLOCK-END // BLOCK-END // STREAM-END // // YAML also permits non-indented sequences if they are included into a block // mapping. In this case, the token BLOCK-SEQUENCE-START is not produced: // // key: // - item 1 # BLOCK-SEQUENCE-START is NOT produced here. // - item 2 // // Tokens: // // STREAM-START(utf-8) // BLOCK-MAPPING-START // KEY // SCALAR("key",plain) // VALUE // BLOCK-ENTRY // SCALAR("item 1",plain) // BLOCK-ENTRY // SCALAR("item 2",plain) // BLOCK-END // // Ensure that the buffer contains the required number of characters. // Return true on success, false on failure (reader error or memory error). func cache(parser *yaml_parser_t, length int) bool { // [Go] This was inlined: !cache(A, B) -> unread < B && !update(A, B) return parser.unread >= length || yaml_parser_update_buffer(parser, length) } // Advance the buffer pointer. func skip(parser *yaml_parser_t) { if !is_blank(parser.buffer, parser.buffer_pos) { parser.newlines = 0 } parser.mark.index++ parser.mark.column++ parser.unread-- parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) } func skip_line(parser *yaml_parser_t) { if is_crlf(parser.buffer, parser.buffer_pos) { parser.mark.index += 2 parser.mark.column = 0 parser.mark.line++ parser.unread -= 2 parser.buffer_pos += 2 parser.newlines++ } else if is_break(parser.buffer, parser.buffer_pos) { parser.mark.index++ parser.mark.column = 0 parser.mark.line++ parser.unread-- parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) parser.newlines++ } } // Copy a character to a string buffer and advance pointers. func read(parser *yaml_parser_t, s []byte) []byte { if !is_blank(parser.buffer, parser.buffer_pos) { parser.newlines = 0 } w := width(parser.buffer[parser.buffer_pos]) if w == 0 { panic("invalid character sequence") } if len(s) == 0 { s = make([]byte, 0, 32) } if w == 1 && len(s)+w <= cap(s) { s = s[:len(s)+1] s[len(s)-1] = parser.buffer[parser.buffer_pos] parser.buffer_pos++ } else { s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...) parser.buffer_pos += w } parser.mark.index++ parser.mark.column++ parser.unread-- return s } // Copy a line break character to a string buffer and advance pointers. func read_line(parser *yaml_parser_t, s []byte) []byte { buf := parser.buffer pos := parser.buffer_pos switch { case buf[pos] == '\r' && buf[pos+1] == '\n': // CR LF . LF s = append(s, '\n') parser.buffer_pos += 2 parser.mark.index++ parser.unread-- case buf[pos] == '\r' || buf[pos] == '\n': // CR|LF . LF s = append(s, '\n') parser.buffer_pos += 1 case buf[pos] == '\xC2' && buf[pos+1] == '\x85': // NEL . LF s = append(s, '\n') parser.buffer_pos += 2 case buf[pos] == '\xE2' && buf[pos+1] == '\x80' && (buf[pos+2] == '\xA8' || buf[pos+2] == '\xA9'): // LS|PS . LS|PS s = append(s, buf[parser.buffer_pos:pos+3]...) parser.buffer_pos += 3 default: return s } parser.mark.index++ parser.mark.column = 0 parser.mark.line++ parser.unread-- parser.newlines++ return s } // Get the next token. func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool { // Erase the token object. *token = yaml_token_t{} // [Go] Is this necessary? // No tokens after STREAM-END or error. if parser.stream_end_produced || parser.error != yaml_NO_ERROR { return true } // Ensure that the tokens queue contains enough tokens. if !parser.token_available { if !yaml_parser_fetch_more_tokens(parser) { return false } } // Fetch the next token from the queue. *token = parser.tokens[parser.tokens_head] parser.tokens_head++ parser.tokens_parsed++ parser.token_available = false if token.typ == yaml_STREAM_END_TOKEN { parser.stream_end_produced = true } return true } // Set the scanner error and return false. func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string) bool { parser.error = yaml_SCANNER_ERROR parser.context = context parser.context_mark = context_mark parser.problem = problem parser.problem_mark = parser.mark return false } func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive bool, context_mark yaml_mark_t, problem string) bool { context := "while parsing a tag" if directive { context = "while parsing a %TAG directive" } return yaml_parser_set_scanner_error(parser, context, context_mark, problem) } func trace(args ...interface{}) func() { pargs := append([]interface{}{"+++"}, args...) fmt.Println(pargs...) pargs = append([]interface{}{"---"}, args...) return func() { fmt.Println(pargs...) } } // Ensure that the tokens queue contains at least one token which can be // returned to the Parser. func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { // While we need more tokens to fetch, do it. for { // [Go] The comment parsing logic requires a lookahead of two tokens // so that foot comments may be parsed in time of associating them // with the tokens that are parsed before them, and also for line // comments to be transformed into head comments in some edge cases. if parser.tokens_head < len(parser.tokens)-2 { // If a potential simple key is at the head position, we need to fetch // the next token to disambiguate it. head_tok_idx, ok := parser.simple_keys_by_tok[parser.tokens_parsed] if !ok { break } else if valid, ok := yaml_simple_key_is_valid(parser, &parser.simple_keys[head_tok_idx]); !ok { return false } else if !valid { break } } // Fetch the next token. if !yaml_parser_fetch_next_token(parser) { return false } } parser.token_available = true return true } // The dispatcher for token fetchers. func yaml_parser_fetch_next_token(parser *yaml_parser_t) (ok bool) { // Ensure that the buffer is initialized. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false } // Check if we just started scanning. Fetch STREAM-START then. if !parser.stream_start_produced { return yaml_parser_fetch_stream_start(parser) } scan_mark := parser.mark // Eat whitespaces and comments until we reach the next token. if !yaml_parser_scan_to_next_token(parser) { return false } // [Go] While unrolling indents, transform the head comments of prior // indentation levels observed after scan_start into foot comments at // the respective indexes. // Check the indentation level against the current column. if !yaml_parser_unroll_indent(parser, parser.mark.column, scan_mark) { return false } // Ensure that the buffer contains at least 4 characters. 4 is the length // of the longest indicators ('--- ' and '... '). if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { return false } // Is it the end of the stream? if is_z(parser.buffer, parser.buffer_pos) { return yaml_parser_fetch_stream_end(parser) } // Is it a directive? if parser.mark.column == 0 && parser.buffer[parser.buffer_pos] == '%' { return yaml_parser_fetch_directive(parser) } buf := parser.buffer pos := parser.buffer_pos // Is it the document start indicator? if parser.mark.column == 0 && buf[pos] == '-' && buf[pos+1] == '-' && buf[pos+2] == '-' && is_blankz(buf, pos+3) { return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_START_TOKEN) } // Is it the document end indicator? if parser.mark.column == 0 && buf[pos] == '.' && buf[pos+1] == '.' && buf[pos+2] == '.' && is_blankz(buf, pos+3) { return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_END_TOKEN) } comment_mark := parser.mark if len(parser.tokens) > 0 && (parser.flow_level == 0 && buf[pos] == ':' || parser.flow_level > 0 && buf[pos] == ',') { // Associate any following comments with the prior token. comment_mark = parser.tokens[len(parser.tokens)-1].start_mark } defer func() { if !ok { return } if len(parser.tokens) > 0 && parser.tokens[len(parser.tokens)-1].typ == yaml_BLOCK_ENTRY_TOKEN { // Sequence indicators alone have no line comments. It becomes // a head comment for whatever follows. return } if !yaml_parser_scan_line_comment(parser, comment_mark) { ok = false return } }() // Is it the flow sequence start indicator? if buf[pos] == '[' { return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_SEQUENCE_START_TOKEN) } // Is it the flow mapping start indicator? if parser.buffer[parser.buffer_pos] == '{' { return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_MAPPING_START_TOKEN) } // Is it the flow sequence end indicator? if parser.buffer[parser.buffer_pos] == ']' { return yaml_parser_fetch_flow_collection_end(parser, yaml_FLOW_SEQUENCE_END_TOKEN) } // Is it the flow mapping end indicator? if parser.buffer[parser.buffer_pos] == '}' { return yaml_parser_fetch_flow_collection_end(parser, yaml_FLOW_MAPPING_END_TOKEN) } // Is it the flow entry indicator? if parser.buffer[parser.buffer_pos] == ',' { return yaml_parser_fetch_flow_entry(parser) } // Is it the block entry indicator? if parser.buffer[parser.buffer_pos] == '-' && is_blankz(parser.buffer, parser.buffer_pos+1) { return yaml_parser_fetch_block_entry(parser) } // Is it the key indicator? if parser.buffer[parser.buffer_pos] == '?' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { return yaml_parser_fetch_key(parser) } // Is it the value indicator? if parser.buffer[parser.buffer_pos] == ':' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { return yaml_parser_fetch_value(parser) } // Is it an alias? if parser.buffer[parser.buffer_pos] == '*' { return yaml_parser_fetch_anchor(parser, yaml_ALIAS_TOKEN) } // Is it an anchor? if parser.buffer[parser.buffer_pos] == '&' { return yaml_parser_fetch_anchor(parser, yaml_ANCHOR_TOKEN) } // Is it a tag? if parser.buffer[parser.buffer_pos] == '!' { return yaml_parser_fetch_tag(parser) } // Is it a literal scalar? if parser.buffer[parser.buffer_pos] == '|' && parser.flow_level == 0 { return yaml_parser_fetch_block_scalar(parser, true) } // Is it a folded scalar? if parser.buffer[parser.buffer_pos] == '>' && parser.flow_level == 0 { return yaml_parser_fetch_block_scalar(parser, false) } // Is it a single-quoted scalar? if parser.buffer[parser.buffer_pos] == '\'' { return yaml_parser_fetch_flow_scalar(parser, true) } // Is it a double-quoted scalar? if parser.buffer[parser.buffer_pos] == '"' { return yaml_parser_fetch_flow_scalar(parser, false) } // Is it a plain scalar? // // A plain scalar may start with any non-blank characters except // // '-', '?', ':', ',', '[', ']', '{', '}', // '#', '&', '*', '!', '|', '>', '\'', '\"', // '%', '@', '`'. // // In the block context (and, for the '-' indicator, in the flow context // too), it may also start with the characters // // '-', '?', ':' // // if it is followed by a non-space character. // // The last rule is more restrictive than the specification requires. // [Go] TODO Make this logic more reasonable. //switch parser.buffer[parser.buffer_pos] { //case '-', '?', ':', ',', '?', '-', ',', ':', ']', '[', '}', '{', '&', '#', '!', '*', '>', '|', '"', '\'', '@', '%', '-', '`': //} if !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '-' || parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '[' || parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || parser.buffer[parser.buffer_pos] == '}' || parser.buffer[parser.buffer_pos] == '#' || parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '*' || parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '|' || parser.buffer[parser.buffer_pos] == '>' || parser.buffer[parser.buffer_pos] == '\'' || parser.buffer[parser.buffer_pos] == '"' || parser.buffer[parser.buffer_pos] == '%' || parser.buffer[parser.buffer_pos] == '@' || parser.buffer[parser.buffer_pos] == '`') || (parser.buffer[parser.buffer_pos] == '-' && !is_blank(parser.buffer, parser.buffer_pos+1)) || (parser.flow_level == 0 && (parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':') && !is_blankz(parser.buffer, parser.buffer_pos+1)) { return yaml_parser_fetch_plain_scalar(parser) } // If we don't determine the token type so far, it is an error. return yaml_parser_set_scanner_error(parser, "while scanning for the next token", parser.mark, "found character that cannot start any token") } func yaml_simple_key_is_valid(parser *yaml_parser_t, simple_key *yaml_simple_key_t) (valid, ok bool) { if !simple_key.possible { return false, true } // The 1.2 specification says: // // "If the ? indicator is omitted, parsing needs to see past the // implicit key to recognize it as such. To limit the amount of // lookahead required, the “:” indicator must appear at most 1024 // Unicode characters beyond the start of the key. In addition, the key // is restricted to a single line." // if simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index { // Check if the potential simple key to be removed is required. if simple_key.required { return false, yaml_parser_set_scanner_error(parser, "while scanning a simple key", simple_key.mark, "could not find expected ':'") } simple_key.possible = false return false, true } return true, true } // Check if a simple key may start at the current position and add it if // needed. func yaml_parser_save_simple_key(parser *yaml_parser_t) bool { // A simple key is required at the current position if the scanner is in // the block context and the current column coincides with the indentation // level. required := parser.flow_level == 0 && parser.indent == parser.mark.column // // If the current position may start a simple key, save it. // if parser.simple_key_allowed { simple_key := yaml_simple_key_t{ possible: true, required: required, token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), mark: parser.mark, } if !yaml_parser_remove_simple_key(parser) { return false } parser.simple_keys[len(parser.simple_keys)-1] = simple_key parser.simple_keys_by_tok[simple_key.token_number] = len(parser.simple_keys) - 1 } return true } // Remove a potential simple key at the current flow level. func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool { i := len(parser.simple_keys) - 1 if parser.simple_keys[i].possible { // If the key is required, it is an error. if parser.simple_keys[i].required { return yaml_parser_set_scanner_error(parser, "while scanning a simple key", parser.simple_keys[i].mark, "could not find expected ':'") } // Remove the key from the stack. parser.simple_keys[i].possible = false delete(parser.simple_keys_by_tok, parser.simple_keys[i].token_number) } return true } // max_flow_level limits the flow_level const max_flow_level = 10000 // Increase the flow level and resize the simple key list if needed. func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool { // Reset the simple key on the next level. parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{ possible: false, required: false, token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), mark: parser.mark, }) // Increase the flow level. parser.flow_level++ if parser.flow_level > max_flow_level { return yaml_parser_set_scanner_error(parser, "while increasing flow level", parser.simple_keys[len(parser.simple_keys)-1].mark, fmt.Sprintf("exceeded max depth of %d", max_flow_level)) } return true } // Decrease the flow level. func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool { if parser.flow_level > 0 { parser.flow_level-- last := len(parser.simple_keys) - 1 delete(parser.simple_keys_by_tok, parser.simple_keys[last].token_number) parser.simple_keys = parser.simple_keys[:last] } return true } // max_indents limits the indents stack size const max_indents = 10000 // Push the current indentation level to the stack and set the new level // the current column is greater than the indentation level. In this case, // append or insert the specified token into the token queue. func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t) bool { // In the flow context, do nothing. if parser.flow_level > 0 { return true } if parser.indent < column { // Push the current indentation level to the stack and set the new // indentation level. parser.indents = append(parser.indents, parser.indent) parser.indent = column if len(parser.indents) > max_indents { return yaml_parser_set_scanner_error(parser, "while increasing indent level", parser.simple_keys[len(parser.simple_keys)-1].mark, fmt.Sprintf("exceeded max depth of %d", max_indents)) } // Create a token and insert it into the queue. token := yaml_token_t{ typ: typ, start_mark: mark, end_mark: mark, } if number > -1 { number -= parser.tokens_parsed } yaml_insert_token(parser, number, &token) } return true } // Pop indentation levels from the indents stack until the current level // becomes less or equal to the column. For each indentation level, append // the BLOCK-END token. func yaml_parser_unroll_indent(parser *yaml_parser_t, column int, scan_mark yaml_mark_t) bool { // In the flow context, do nothing. if parser.flow_level > 0 { return true } block_mark := scan_mark block_mark.index-- // Loop through the indentation levels in the stack. for parser.indent > column { // [Go] Reposition the end token before potential following // foot comments of parent blocks. For that, search // backwards for recent comments that were at the same // indent as the block that is ending now. stop_index := block_mark.index for i := len(parser.comments) - 1; i >= 0; i-- { comment := &parser.comments[i] if comment.end_mark.index < stop_index { // Don't go back beyond the start of the comment/whitespace scan, unless column < 0.
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/decode.go
vendor/gopkg.in/yaml.v3/decode.go
// // Copyright (c) 2011-2019 Canonical Ltd // // 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. package yaml import ( "encoding" "encoding/base64" "fmt" "io" "math" "reflect" "strconv" "time" ) // ---------------------------------------------------------------------------- // Parser, produces a node tree out of a libyaml event stream. type parser struct { parser yaml_parser_t event yaml_event_t doc *Node anchors map[string]*Node doneInit bool textless bool } func newParser(b []byte) *parser { p := parser{} if !yaml_parser_initialize(&p.parser) { panic("failed to initialize YAML emitter") } if len(b) == 0 { b = []byte{'\n'} } yaml_parser_set_input_string(&p.parser, b) return &p } func newParserFromReader(r io.Reader) *parser { p := parser{} if !yaml_parser_initialize(&p.parser) { panic("failed to initialize YAML emitter") } yaml_parser_set_input_reader(&p.parser, r) return &p } func (p *parser) init() { if p.doneInit { return } p.anchors = make(map[string]*Node) p.expect(yaml_STREAM_START_EVENT) p.doneInit = true } func (p *parser) destroy() { if p.event.typ != yaml_NO_EVENT { yaml_event_delete(&p.event) } yaml_parser_delete(&p.parser) } // expect consumes an event from the event stream and // checks that it's of the expected type. func (p *parser) expect(e yaml_event_type_t) { if p.event.typ == yaml_NO_EVENT { if !yaml_parser_parse(&p.parser, &p.event) { p.fail() } } if p.event.typ == yaml_STREAM_END_EVENT { failf("attempted to go past the end of stream; corrupted value?") } if p.event.typ != e { p.parser.problem = fmt.Sprintf("expected %s event but got %s", e, p.event.typ) p.fail() } yaml_event_delete(&p.event) p.event.typ = yaml_NO_EVENT } // peek peeks at the next event in the event stream, // puts the results into p.event and returns the event type. func (p *parser) peek() yaml_event_type_t { if p.event.typ != yaml_NO_EVENT { return p.event.typ } // It's curious choice from the underlying API to generally return a // positive result on success, but on this case return true in an error // scenario. This was the source of bugs in the past (issue #666). if !yaml_parser_parse(&p.parser, &p.event) || p.parser.error != yaml_NO_ERROR { p.fail() } return p.event.typ } func (p *parser) fail() { var where string var line int if p.parser.context_mark.line != 0 { line = p.parser.context_mark.line // Scanner errors don't iterate line before returning error if p.parser.error == yaml_SCANNER_ERROR { line++ } } else if p.parser.problem_mark.line != 0 { line = p.parser.problem_mark.line // Scanner errors don't iterate line before returning error if p.parser.error == yaml_SCANNER_ERROR { line++ } } if line != 0 { where = "line " + strconv.Itoa(line) + ": " } var msg string if len(p.parser.problem) > 0 { msg = p.parser.problem } else { msg = "unknown problem parsing YAML content" } failf("%s%s", where, msg) } func (p *parser) anchor(n *Node, anchor []byte) { if anchor != nil { n.Anchor = string(anchor) p.anchors[n.Anchor] = n } } func (p *parser) parse() *Node { p.init() switch p.peek() { case yaml_SCALAR_EVENT: return p.scalar() case yaml_ALIAS_EVENT: return p.alias() case yaml_MAPPING_START_EVENT: return p.mapping() case yaml_SEQUENCE_START_EVENT: return p.sequence() case yaml_DOCUMENT_START_EVENT: return p.document() case yaml_STREAM_END_EVENT: // Happens when attempting to decode an empty buffer. return nil case yaml_TAIL_COMMENT_EVENT: panic("internal error: unexpected tail comment event (please report)") default: panic("internal error: attempted to parse unknown event (please report): " + p.event.typ.String()) } } func (p *parser) node(kind Kind, defaultTag, tag, value string) *Node { var style Style if tag != "" && tag != "!" { tag = shortTag(tag) style = TaggedStyle } else if defaultTag != "" { tag = defaultTag } else if kind == ScalarNode { tag, _ = resolve("", value) } n := &Node{ Kind: kind, Tag: tag, Value: value, Style: style, } if !p.textless { n.Line = p.event.start_mark.line + 1 n.Column = p.event.start_mark.column + 1 n.HeadComment = string(p.event.head_comment) n.LineComment = string(p.event.line_comment) n.FootComment = string(p.event.foot_comment) } return n } func (p *parser) parseChild(parent *Node) *Node { child := p.parse() parent.Content = append(parent.Content, child) return child } func (p *parser) document() *Node { n := p.node(DocumentNode, "", "", "") p.doc = n p.expect(yaml_DOCUMENT_START_EVENT) p.parseChild(n) if p.peek() == yaml_DOCUMENT_END_EVENT { n.FootComment = string(p.event.foot_comment) } p.expect(yaml_DOCUMENT_END_EVENT) return n } func (p *parser) alias() *Node { n := p.node(AliasNode, "", "", string(p.event.anchor)) n.Alias = p.anchors[n.Value] if n.Alias == nil { failf("unknown anchor '%s' referenced", n.Value) } p.expect(yaml_ALIAS_EVENT) return n } func (p *parser) scalar() *Node { var parsedStyle = p.event.scalar_style() var nodeStyle Style switch { case parsedStyle&yaml_DOUBLE_QUOTED_SCALAR_STYLE != 0: nodeStyle = DoubleQuotedStyle case parsedStyle&yaml_SINGLE_QUOTED_SCALAR_STYLE != 0: nodeStyle = SingleQuotedStyle case parsedStyle&yaml_LITERAL_SCALAR_STYLE != 0: nodeStyle = LiteralStyle case parsedStyle&yaml_FOLDED_SCALAR_STYLE != 0: nodeStyle = FoldedStyle } var nodeValue = string(p.event.value) var nodeTag = string(p.event.tag) var defaultTag string if nodeStyle == 0 { if nodeValue == "<<" { defaultTag = mergeTag } } else { defaultTag = strTag } n := p.node(ScalarNode, defaultTag, nodeTag, nodeValue) n.Style |= nodeStyle p.anchor(n, p.event.anchor) p.expect(yaml_SCALAR_EVENT) return n } func (p *parser) sequence() *Node { n := p.node(SequenceNode, seqTag, string(p.event.tag), "") if p.event.sequence_style()&yaml_FLOW_SEQUENCE_STYLE != 0 { n.Style |= FlowStyle } p.anchor(n, p.event.anchor) p.expect(yaml_SEQUENCE_START_EVENT) for p.peek() != yaml_SEQUENCE_END_EVENT { p.parseChild(n) } n.LineComment = string(p.event.line_comment) n.FootComment = string(p.event.foot_comment) p.expect(yaml_SEQUENCE_END_EVENT) return n } func (p *parser) mapping() *Node { n := p.node(MappingNode, mapTag, string(p.event.tag), "") block := true if p.event.mapping_style()&yaml_FLOW_MAPPING_STYLE != 0 { block = false n.Style |= FlowStyle } p.anchor(n, p.event.anchor) p.expect(yaml_MAPPING_START_EVENT) for p.peek() != yaml_MAPPING_END_EVENT { k := p.parseChild(n) if block && k.FootComment != "" { // Must be a foot comment for the prior value when being dedented. if len(n.Content) > 2 { n.Content[len(n.Content)-3].FootComment = k.FootComment k.FootComment = "" } } v := p.parseChild(n) if k.FootComment == "" && v.FootComment != "" { k.FootComment = v.FootComment v.FootComment = "" } if p.peek() == yaml_TAIL_COMMENT_EVENT { if k.FootComment == "" { k.FootComment = string(p.event.foot_comment) } p.expect(yaml_TAIL_COMMENT_EVENT) } } n.LineComment = string(p.event.line_comment) n.FootComment = string(p.event.foot_comment) if n.Style&FlowStyle == 0 && n.FootComment != "" && len(n.Content) > 1 { n.Content[len(n.Content)-2].FootComment = n.FootComment n.FootComment = "" } p.expect(yaml_MAPPING_END_EVENT) return n } // ---------------------------------------------------------------------------- // Decoder, unmarshals a node into a provided value. type decoder struct { doc *Node aliases map[*Node]bool terrors []string stringMapType reflect.Type generalMapType reflect.Type knownFields bool uniqueKeys bool decodeCount int aliasCount int aliasDepth int mergedFields map[interface{}]bool } var ( nodeType = reflect.TypeOf(Node{}) durationType = reflect.TypeOf(time.Duration(0)) stringMapType = reflect.TypeOf(map[string]interface{}{}) generalMapType = reflect.TypeOf(map[interface{}]interface{}{}) ifaceType = generalMapType.Elem() timeType = reflect.TypeOf(time.Time{}) ptrTimeType = reflect.TypeOf(&time.Time{}) ) func newDecoder() *decoder { d := &decoder{ stringMapType: stringMapType, generalMapType: generalMapType, uniqueKeys: true, } d.aliases = make(map[*Node]bool) return d } func (d *decoder) terror(n *Node, tag string, out reflect.Value) { if n.Tag != "" { tag = n.Tag } value := n.Value if tag != seqTag && tag != mapTag { if len(value) > 10 { value = " `" + value[:7] + "...`" } else { value = " `" + value + "`" } } d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.Line, shortTag(tag), value, out.Type())) } func (d *decoder) callUnmarshaler(n *Node, u Unmarshaler) (good bool) { err := u.UnmarshalYAML(n) if e, ok := err.(*TypeError); ok { d.terrors = append(d.terrors, e.Errors...) return false } if err != nil { fail(err) } return true } func (d *decoder) callObsoleteUnmarshaler(n *Node, u obsoleteUnmarshaler) (good bool) { terrlen := len(d.terrors) err := u.UnmarshalYAML(func(v interface{}) (err error) { defer handleErr(&err) d.unmarshal(n, reflect.ValueOf(v)) if len(d.terrors) > terrlen { issues := d.terrors[terrlen:] d.terrors = d.terrors[:terrlen] return &TypeError{issues} } return nil }) if e, ok := err.(*TypeError); ok { d.terrors = append(d.terrors, e.Errors...) return false } if err != nil { fail(err) } return true } // d.prepare initializes and dereferences pointers and calls UnmarshalYAML // if a value is found to implement it. // It returns the initialized and dereferenced out value, whether // unmarshalling was already done by UnmarshalYAML, and if so whether // its types unmarshalled appropriately. // // If n holds a null value, prepare returns before doing anything. func (d *decoder) prepare(n *Node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { if n.ShortTag() == nullTag { return out, false, false } again := true for again { again = false if out.Kind() == reflect.Ptr { if out.IsNil() { out.Set(reflect.New(out.Type().Elem())) } out = out.Elem() again = true } if out.CanAddr() { outi := out.Addr().Interface() if u, ok := outi.(Unmarshaler); ok { good = d.callUnmarshaler(n, u) return out, true, good } if u, ok := outi.(obsoleteUnmarshaler); ok { good = d.callObsoleteUnmarshaler(n, u) return out, true, good } } } return out, false, false } func (d *decoder) fieldByIndex(n *Node, v reflect.Value, index []int) (field reflect.Value) { if n.ShortTag() == nullTag { return reflect.Value{} } for _, num := range index { for { if v.Kind() == reflect.Ptr { if v.IsNil() { v.Set(reflect.New(v.Type().Elem())) } v = v.Elem() continue } break } v = v.Field(num) } return v } const ( // 400,000 decode operations is ~500kb of dense object declarations, or // ~5kb of dense object declarations with 10000% alias expansion alias_ratio_range_low = 400000 // 4,000,000 decode operations is ~5MB of dense object declarations, or // ~4.5MB of dense object declarations with 10% alias expansion alias_ratio_range_high = 4000000 // alias_ratio_range is the range over which we scale allowed alias ratios alias_ratio_range = float64(alias_ratio_range_high - alias_ratio_range_low) ) func allowedAliasRatio(decodeCount int) float64 { switch { case decodeCount <= alias_ratio_range_low: // allow 99% to come from alias expansion for small-to-medium documents return 0.99 case decodeCount >= alias_ratio_range_high: // allow 10% to come from alias expansion for very large documents return 0.10 default: // scale smoothly from 99% down to 10% over the range. // this maps to 396,000 - 400,000 allowed alias-driven decodes over the range. // 400,000 decode operations is ~100MB of allocations in worst-case scenarios (single-item maps). return 0.99 - 0.89*(float64(decodeCount-alias_ratio_range_low)/alias_ratio_range) } } func (d *decoder) unmarshal(n *Node, out reflect.Value) (good bool) { d.decodeCount++ if d.aliasDepth > 0 { d.aliasCount++ } if d.aliasCount > 100 && d.decodeCount > 1000 && float64(d.aliasCount)/float64(d.decodeCount) > allowedAliasRatio(d.decodeCount) { failf("document contains excessive aliasing") } if out.Type() == nodeType { out.Set(reflect.ValueOf(n).Elem()) return true } switch n.Kind { case DocumentNode: return d.document(n, out) case AliasNode: return d.alias(n, out) } out, unmarshaled, good := d.prepare(n, out) if unmarshaled { return good } switch n.Kind { case ScalarNode: good = d.scalar(n, out) case MappingNode: good = d.mapping(n, out) case SequenceNode: good = d.sequence(n, out) case 0: if n.IsZero() { return d.null(out) } fallthrough default: failf("cannot decode node with unknown kind %d", n.Kind) } return good } func (d *decoder) document(n *Node, out reflect.Value) (good bool) { if len(n.Content) == 1 { d.doc = n d.unmarshal(n.Content[0], out) return true } return false } func (d *decoder) alias(n *Node, out reflect.Value) (good bool) { if d.aliases[n] { // TODO this could actually be allowed in some circumstances. failf("anchor '%s' value contains itself", n.Value) } d.aliases[n] = true d.aliasDepth++ good = d.unmarshal(n.Alias, out) d.aliasDepth-- delete(d.aliases, n) return good } var zeroValue reflect.Value func resetMap(out reflect.Value) { for _, k := range out.MapKeys() { out.SetMapIndex(k, zeroValue) } } func (d *decoder) null(out reflect.Value) bool { if out.CanAddr() { switch out.Kind() { case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: out.Set(reflect.Zero(out.Type())) return true } } return false } func (d *decoder) scalar(n *Node, out reflect.Value) bool { var tag string var resolved interface{} if n.indicatedString() { tag = strTag resolved = n.Value } else { tag, resolved = resolve(n.Tag, n.Value) if tag == binaryTag { data, err := base64.StdEncoding.DecodeString(resolved.(string)) if err != nil { failf("!!binary value contains invalid base64 data") } resolved = string(data) } } if resolved == nil { return d.null(out) } if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { // We've resolved to exactly the type we want, so use that. out.Set(resolvedv) return true } // Perhaps we can use the value as a TextUnmarshaler to // set its value. if out.CanAddr() { u, ok := out.Addr().Interface().(encoding.TextUnmarshaler) if ok { var text []byte if tag == binaryTag { text = []byte(resolved.(string)) } else { // We let any value be unmarshaled into TextUnmarshaler. // That might be more lax than we'd like, but the // TextUnmarshaler itself should bowl out any dubious values. text = []byte(n.Value) } err := u.UnmarshalText(text) if err != nil { fail(err) } return true } } switch out.Kind() { case reflect.String: if tag == binaryTag { out.SetString(resolved.(string)) return true } out.SetString(n.Value) return true case reflect.Interface: out.Set(reflect.ValueOf(resolved)) return true case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: // This used to work in v2, but it's very unfriendly. isDuration := out.Type() == durationType switch resolved := resolved.(type) { case int: if !isDuration && !out.OverflowInt(int64(resolved)) { out.SetInt(int64(resolved)) return true } case int64: if !isDuration && !out.OverflowInt(resolved) { out.SetInt(resolved) return true } case uint64: if !isDuration && resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { out.SetInt(int64(resolved)) return true } case float64: if !isDuration && resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { out.SetInt(int64(resolved)) return true } case string: if out.Type() == durationType { d, err := time.ParseDuration(resolved) if err == nil { out.SetInt(int64(d)) return true } } } case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: switch resolved := resolved.(type) { case int: if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { out.SetUint(uint64(resolved)) return true } case int64: if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { out.SetUint(uint64(resolved)) return true } case uint64: if !out.OverflowUint(uint64(resolved)) { out.SetUint(uint64(resolved)) return true } case float64: if resolved <= math.MaxUint64 && !out.OverflowUint(uint64(resolved)) { out.SetUint(uint64(resolved)) return true } } case reflect.Bool: switch resolved := resolved.(type) { case bool: out.SetBool(resolved) return true case string: // This offers some compatibility with the 1.1 spec (https://yaml.org/type/bool.html). // It only works if explicitly attempting to unmarshal into a typed bool value. switch resolved { case "y", "Y", "yes", "Yes", "YES", "on", "On", "ON": out.SetBool(true) return true case "n", "N", "no", "No", "NO", "off", "Off", "OFF": out.SetBool(false) return true } } case reflect.Float32, reflect.Float64: switch resolved := resolved.(type) { case int: out.SetFloat(float64(resolved)) return true case int64: out.SetFloat(float64(resolved)) return true case uint64: out.SetFloat(float64(resolved)) return true case float64: out.SetFloat(resolved) return true } case reflect.Struct: if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { out.Set(resolvedv) return true } case reflect.Ptr: panic("yaml internal error: please report the issue") } d.terror(n, tag, out) return false } func settableValueOf(i interface{}) reflect.Value { v := reflect.ValueOf(i) sv := reflect.New(v.Type()).Elem() sv.Set(v) return sv } func (d *decoder) sequence(n *Node, out reflect.Value) (good bool) { l := len(n.Content) var iface reflect.Value switch out.Kind() { case reflect.Slice: out.Set(reflect.MakeSlice(out.Type(), l, l)) case reflect.Array: if l != out.Len() { failf("invalid array: want %d elements but got %d", out.Len(), l) } case reflect.Interface: // No type hints. Will have to use a generic sequence. iface = out out = settableValueOf(make([]interface{}, l)) default: d.terror(n, seqTag, out) return false } et := out.Type().Elem() j := 0 for i := 0; i < l; i++ { e := reflect.New(et).Elem() if ok := d.unmarshal(n.Content[i], e); ok { out.Index(j).Set(e) j++ } } if out.Kind() != reflect.Array { out.Set(out.Slice(0, j)) } if iface.IsValid() { iface.Set(out) } return true } func (d *decoder) mapping(n *Node, out reflect.Value) (good bool) { l := len(n.Content) if d.uniqueKeys { nerrs := len(d.terrors) for i := 0; i < l; i += 2 { ni := n.Content[i] for j := i + 2; j < l; j += 2 { nj := n.Content[j] if ni.Kind == nj.Kind && ni.Value == nj.Value { d.terrors = append(d.terrors, fmt.Sprintf("line %d: mapping key %#v already defined at line %d", nj.Line, nj.Value, ni.Line)) } } } if len(d.terrors) > nerrs { return false } } switch out.Kind() { case reflect.Struct: return d.mappingStruct(n, out) case reflect.Map: // okay case reflect.Interface: iface := out if isStringMap(n) { out = reflect.MakeMap(d.stringMapType) } else { out = reflect.MakeMap(d.generalMapType) } iface.Set(out) default: d.terror(n, mapTag, out) return false } outt := out.Type() kt := outt.Key() et := outt.Elem() stringMapType := d.stringMapType generalMapType := d.generalMapType if outt.Elem() == ifaceType { if outt.Key().Kind() == reflect.String { d.stringMapType = outt } else if outt.Key() == ifaceType { d.generalMapType = outt } } mergedFields := d.mergedFields d.mergedFields = nil var mergeNode *Node mapIsNew := false if out.IsNil() { out.Set(reflect.MakeMap(outt)) mapIsNew = true } for i := 0; i < l; i += 2 { if isMerge(n.Content[i]) { mergeNode = n.Content[i+1] continue } k := reflect.New(kt).Elem() if d.unmarshal(n.Content[i], k) { if mergedFields != nil { ki := k.Interface() if mergedFields[ki] { continue } mergedFields[ki] = true } kkind := k.Kind() if kkind == reflect.Interface { kkind = k.Elem().Kind() } if kkind == reflect.Map || kkind == reflect.Slice { failf("invalid map key: %#v", k.Interface()) } e := reflect.New(et).Elem() if d.unmarshal(n.Content[i+1], e) || n.Content[i+1].ShortTag() == nullTag && (mapIsNew || !out.MapIndex(k).IsValid()) { out.SetMapIndex(k, e) } } } d.mergedFields = mergedFields if mergeNode != nil { d.merge(n, mergeNode, out) } d.stringMapType = stringMapType d.generalMapType = generalMapType return true } func isStringMap(n *Node) bool { if n.Kind != MappingNode { return false } l := len(n.Content) for i := 0; i < l; i += 2 { shortTag := n.Content[i].ShortTag() if shortTag != strTag && shortTag != mergeTag { return false } } return true } func (d *decoder) mappingStruct(n *Node, out reflect.Value) (good bool) { sinfo, err := getStructInfo(out.Type()) if err != nil { panic(err) } var inlineMap reflect.Value var elemType reflect.Type if sinfo.InlineMap != -1 { inlineMap = out.Field(sinfo.InlineMap) elemType = inlineMap.Type().Elem() } for _, index := range sinfo.InlineUnmarshalers { field := d.fieldByIndex(n, out, index) d.prepare(n, field) } mergedFields := d.mergedFields d.mergedFields = nil var mergeNode *Node var doneFields []bool if d.uniqueKeys { doneFields = make([]bool, len(sinfo.FieldsList)) } name := settableValueOf("") l := len(n.Content) for i := 0; i < l; i += 2 { ni := n.Content[i] if isMerge(ni) { mergeNode = n.Content[i+1] continue } if !d.unmarshal(ni, name) { continue } sname := name.String() if mergedFields != nil { if mergedFields[sname] { continue } mergedFields[sname] = true } if info, ok := sinfo.FieldsMap[sname]; ok { if d.uniqueKeys { if doneFields[info.Id] { d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.Line, name.String(), out.Type())) continue } doneFields[info.Id] = true } var field reflect.Value if info.Inline == nil { field = out.Field(info.Num) } else { field = d.fieldByIndex(n, out, info.Inline) } d.unmarshal(n.Content[i+1], field) } else if sinfo.InlineMap != -1 { if inlineMap.IsNil() { inlineMap.Set(reflect.MakeMap(inlineMap.Type())) } value := reflect.New(elemType).Elem() d.unmarshal(n.Content[i+1], value) inlineMap.SetMapIndex(name, value) } else if d.knownFields { d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.Line, name.String(), out.Type())) } } d.mergedFields = mergedFields if mergeNode != nil { d.merge(n, mergeNode, out) } return true } func failWantMap() { failf("map merge requires map or sequence of maps as the value") } func (d *decoder) merge(parent *Node, merge *Node, out reflect.Value) { mergedFields := d.mergedFields if mergedFields == nil { d.mergedFields = make(map[interface{}]bool) for i := 0; i < len(parent.Content); i += 2 { k := reflect.New(ifaceType).Elem() if d.unmarshal(parent.Content[i], k) { d.mergedFields[k.Interface()] = true } } } switch merge.Kind { case MappingNode: d.unmarshal(merge, out) case AliasNode: if merge.Alias != nil && merge.Alias.Kind != MappingNode { failWantMap() } d.unmarshal(merge, out) case SequenceNode: for i := 0; i < len(merge.Content); i++ { ni := merge.Content[i] if ni.Kind == AliasNode { if ni.Alias != nil && ni.Alias.Kind != MappingNode { failWantMap() } } else if ni.Kind != MappingNode { failWantMap() } d.unmarshal(ni, out) } default: failWantMap() } d.mergedFields = mergedFields } func isMerge(n *Node) bool { return n.Kind == ScalarNode && n.Value == "<<" && (n.Tag == "" || n.Tag == "!" || shortTag(n.Tag) == mergeTag) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/yaml.v3/parserc.go
vendor/gopkg.in/yaml.v3/parserc.go
// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov // // 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. package yaml import ( "bytes" ) // The parser implements the following grammar: // // stream ::= STREAM-START implicit_document? explicit_document* STREAM-END // implicit_document ::= block_node DOCUMENT-END* // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // block_node_or_indentless_sequence ::= // ALIAS // | properties (block_content | indentless_block_sequence)? // | block_content // | indentless_block_sequence // block_node ::= ALIAS // | properties block_content? // | block_content // flow_node ::= ALIAS // | properties flow_content? // | flow_content // properties ::= TAG ANCHOR? | ANCHOR TAG? // block_content ::= block_collection | flow_collection | SCALAR // flow_content ::= flow_collection | SCALAR // block_collection ::= block_sequence | block_mapping // flow_collection ::= flow_sequence | flow_mapping // block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END // indentless_sequence ::= (BLOCK-ENTRY block_node?)+ // block_mapping ::= BLOCK-MAPPING_START // ((KEY block_node_or_indentless_sequence?)? // (VALUE block_node_or_indentless_sequence?)?)* // BLOCK-END // flow_sequence ::= FLOW-SEQUENCE-START // (flow_sequence_entry FLOW-ENTRY)* // flow_sequence_entry? // FLOW-SEQUENCE-END // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? // flow_mapping ::= FLOW-MAPPING-START // (flow_mapping_entry FLOW-ENTRY)* // flow_mapping_entry? // FLOW-MAPPING-END // flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? // Peek the next token in the token queue. func peek_token(parser *yaml_parser_t) *yaml_token_t { if parser.token_available || yaml_parser_fetch_more_tokens(parser) { token := &parser.tokens[parser.tokens_head] yaml_parser_unfold_comments(parser, token) return token } return nil } // yaml_parser_unfold_comments walks through the comments queue and joins all // comments behind the position of the provided token into the respective // top-level comment slices in the parser. func yaml_parser_unfold_comments(parser *yaml_parser_t, token *yaml_token_t) { for parser.comments_head < len(parser.comments) && token.start_mark.index >= parser.comments[parser.comments_head].token_mark.index { comment := &parser.comments[parser.comments_head] if len(comment.head) > 0 { if token.typ == yaml_BLOCK_END_TOKEN { // No heads on ends, so keep comment.head for a follow up token. break } if len(parser.head_comment) > 0 { parser.head_comment = append(parser.head_comment, '\n') } parser.head_comment = append(parser.head_comment, comment.head...) } if len(comment.foot) > 0 { if len(parser.foot_comment) > 0 { parser.foot_comment = append(parser.foot_comment, '\n') } parser.foot_comment = append(parser.foot_comment, comment.foot...) } if len(comment.line) > 0 { if len(parser.line_comment) > 0 { parser.line_comment = append(parser.line_comment, '\n') } parser.line_comment = append(parser.line_comment, comment.line...) } *comment = yaml_comment_t{} parser.comments_head++ } } // Remove the next token from the queue (must be called after peek_token). func skip_token(parser *yaml_parser_t) { parser.token_available = false parser.tokens_parsed++ parser.stream_end_produced = parser.tokens[parser.tokens_head].typ == yaml_STREAM_END_TOKEN parser.tokens_head++ } // Get the next event. func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool { // Erase the event object. *event = yaml_event_t{} // No events after the end of the stream or error. if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE { return true } // Generate the next event. return yaml_parser_state_machine(parser, event) } // Set parser error. func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool { parser.error = yaml_PARSER_ERROR parser.problem = problem parser.problem_mark = problem_mark return false } func yaml_parser_set_parser_error_context(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string, problem_mark yaml_mark_t) bool { parser.error = yaml_PARSER_ERROR parser.context = context parser.context_mark = context_mark parser.problem = problem parser.problem_mark = problem_mark return false } // State dispatcher. func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool { //trace("yaml_parser_state_machine", "state:", parser.state.String()) switch parser.state { case yaml_PARSE_STREAM_START_STATE: return yaml_parser_parse_stream_start(parser, event) case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: return yaml_parser_parse_document_start(parser, event, true) case yaml_PARSE_DOCUMENT_START_STATE: return yaml_parser_parse_document_start(parser, event, false) case yaml_PARSE_DOCUMENT_CONTENT_STATE: return yaml_parser_parse_document_content(parser, event) case yaml_PARSE_DOCUMENT_END_STATE: return yaml_parser_parse_document_end(parser, event) case yaml_PARSE_BLOCK_NODE_STATE: return yaml_parser_parse_node(parser, event, true, false) case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: return yaml_parser_parse_node(parser, event, true, true) case yaml_PARSE_FLOW_NODE_STATE: return yaml_parser_parse_node(parser, event, false, false) case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: return yaml_parser_parse_block_sequence_entry(parser, event, true) case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: return yaml_parser_parse_block_sequence_entry(parser, event, false) case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: return yaml_parser_parse_indentless_sequence_entry(parser, event) case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: return yaml_parser_parse_block_mapping_key(parser, event, true) case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: return yaml_parser_parse_block_mapping_key(parser, event, false) case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: return yaml_parser_parse_block_mapping_value(parser, event) case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: return yaml_parser_parse_flow_sequence_entry(parser, event, true) case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: return yaml_parser_parse_flow_sequence_entry(parser, event, false) case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event) case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event) case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event) case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: return yaml_parser_parse_flow_mapping_key(parser, event, true) case yaml_PARSE_FLOW_MAPPING_KEY_STATE: return yaml_parser_parse_flow_mapping_key(parser, event, false) case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: return yaml_parser_parse_flow_mapping_value(parser, event, false) case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: return yaml_parser_parse_flow_mapping_value(parser, event, true) default: panic("invalid parser state") } } // Parse the production: // stream ::= STREAM-START implicit_document? explicit_document* STREAM-END // ************ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { return false } if token.typ != yaml_STREAM_START_TOKEN { return yaml_parser_set_parser_error(parser, "did not find expected <stream-start>", token.start_mark) } parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE *event = yaml_event_t{ typ: yaml_STREAM_START_EVENT, start_mark: token.start_mark, end_mark: token.end_mark, encoding: token.encoding, } skip_token(parser) return true } // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* // * // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // ************************* func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { token := peek_token(parser) if token == nil { return false } // Parse extra document end indicators. if !implicit { for token.typ == yaml_DOCUMENT_END_TOKEN { skip_token(parser) token = peek_token(parser) if token == nil { return false } } } if implicit && token.typ != yaml_VERSION_DIRECTIVE_TOKEN && token.typ != yaml_TAG_DIRECTIVE_TOKEN && token.typ != yaml_DOCUMENT_START_TOKEN && token.typ != yaml_STREAM_END_TOKEN { // Parse an implicit document. if !yaml_parser_process_directives(parser, nil, nil) { return false } parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) parser.state = yaml_PARSE_BLOCK_NODE_STATE var head_comment []byte if len(parser.head_comment) > 0 { // [Go] Scan the header comment backwards, and if an empty line is found, break // the header so the part before the last empty line goes into the // document header, while the bottom of it goes into a follow up event. for i := len(parser.head_comment) - 1; i > 0; i-- { if parser.head_comment[i] == '\n' { if i == len(parser.head_comment)-1 { head_comment = parser.head_comment[:i] parser.head_comment = parser.head_comment[i+1:] break } else if parser.head_comment[i-1] == '\n' { head_comment = parser.head_comment[:i-1] parser.head_comment = parser.head_comment[i+1:] break } } } } *event = yaml_event_t{ typ: yaml_DOCUMENT_START_EVENT, start_mark: token.start_mark, end_mark: token.end_mark, head_comment: head_comment, } } else if token.typ != yaml_STREAM_END_TOKEN { // Parse an explicit document. var version_directive *yaml_version_directive_t var tag_directives []yaml_tag_directive_t start_mark := token.start_mark if !yaml_parser_process_directives(parser, &version_directive, &tag_directives) { return false } token = peek_token(parser) if token == nil { return false } if token.typ != yaml_DOCUMENT_START_TOKEN { yaml_parser_set_parser_error(parser, "did not find expected <document start>", token.start_mark) return false } parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE end_mark := token.end_mark *event = yaml_event_t{ typ: yaml_DOCUMENT_START_EVENT, start_mark: start_mark, end_mark: end_mark, version_directive: version_directive, tag_directives: tag_directives, implicit: false, } skip_token(parser) } else { // Parse the stream end. parser.state = yaml_PARSE_END_STATE *event = yaml_event_t{ typ: yaml_STREAM_END_EVENT, start_mark: token.start_mark, end_mark: token.end_mark, } skip_token(parser) } return true } // Parse the productions: // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // *********** // func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { return false } if token.typ == yaml_VERSION_DIRECTIVE_TOKEN || token.typ == yaml_TAG_DIRECTIVE_TOKEN || token.typ == yaml_DOCUMENT_START_TOKEN || token.typ == yaml_DOCUMENT_END_TOKEN || token.typ == yaml_STREAM_END_TOKEN { parser.state = parser.states[len(parser.states)-1] parser.states = parser.states[:len(parser.states)-1] return yaml_parser_process_empty_scalar(parser, event, token.start_mark) } return yaml_parser_parse_node(parser, event, true, false) } // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* // ************* // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { return false } start_mark := token.start_mark end_mark := token.start_mark implicit := true if token.typ == yaml_DOCUMENT_END_TOKEN { end_mark = token.end_mark skip_token(parser) implicit = false } parser.tag_directives = parser.tag_directives[:0] parser.state = yaml_PARSE_DOCUMENT_START_STATE *event = yaml_event_t{ typ: yaml_DOCUMENT_END_EVENT, start_mark: start_mark, end_mark: end_mark, implicit: implicit, } yaml_parser_set_event_comments(parser, event) if len(event.head_comment) > 0 && len(event.foot_comment) == 0 { event.foot_comment = event.head_comment event.head_comment = nil } return true } func yaml_parser_set_event_comments(parser *yaml_parser_t, event *yaml_event_t) { event.head_comment = parser.head_comment event.line_comment = parser.line_comment event.foot_comment = parser.foot_comment parser.head_comment = nil parser.line_comment = nil parser.foot_comment = nil parser.tail_comment = nil parser.stem_comment = nil } // Parse the productions: // block_node_or_indentless_sequence ::= // ALIAS // ***** // | properties (block_content | indentless_block_sequence)? // ********** * // | block_content | indentless_block_sequence // * // block_node ::= ALIAS // ***** // | properties block_content? // ********** * // | block_content // * // flow_node ::= ALIAS // ***** // | properties flow_content? // ********** * // | flow_content // * // properties ::= TAG ANCHOR? | ANCHOR TAG? // ************************* // block_content ::= block_collection | flow_collection | SCALAR // ****** // flow_content ::= flow_collection | SCALAR // ****** func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() token := peek_token(parser) if token == nil { return false } if token.typ == yaml_ALIAS_TOKEN { parser.state = parser.states[len(parser.states)-1] parser.states = parser.states[:len(parser.states)-1] *event = yaml_event_t{ typ: yaml_ALIAS_EVENT, start_mark: token.start_mark, end_mark: token.end_mark, anchor: token.value, } yaml_parser_set_event_comments(parser, event) skip_token(parser) return true } start_mark := token.start_mark end_mark := token.start_mark var tag_token bool var tag_handle, tag_suffix, anchor []byte var tag_mark yaml_mark_t if token.typ == yaml_ANCHOR_TOKEN { anchor = token.value start_mark = token.start_mark end_mark = token.end_mark skip_token(parser) token = peek_token(parser) if token == nil { return false } if token.typ == yaml_TAG_TOKEN { tag_token = true tag_handle = token.value tag_suffix = token.suffix tag_mark = token.start_mark end_mark = token.end_mark skip_token(parser) token = peek_token(parser) if token == nil { return false } } } else if token.typ == yaml_TAG_TOKEN { tag_token = true tag_handle = token.value tag_suffix = token.suffix start_mark = token.start_mark tag_mark = token.start_mark end_mark = token.end_mark skip_token(parser) token = peek_token(parser) if token == nil { return false } if token.typ == yaml_ANCHOR_TOKEN { anchor = token.value end_mark = token.end_mark skip_token(parser) token = peek_token(parser) if token == nil { return false } } } var tag []byte if tag_token { if len(tag_handle) == 0 { tag = tag_suffix tag_suffix = nil } else { for i := range parser.tag_directives { if bytes.Equal(parser.tag_directives[i].handle, tag_handle) { tag = append([]byte(nil), parser.tag_directives[i].prefix...) tag = append(tag, tag_suffix...) break } } if len(tag) == 0 { yaml_parser_set_parser_error_context(parser, "while parsing a node", start_mark, "found undefined tag handle", tag_mark) return false } } } implicit := len(tag) == 0 if indentless_sequence && token.typ == yaml_BLOCK_ENTRY_TOKEN { end_mark = token.end_mark parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE *event = yaml_event_t{ typ: yaml_SEQUENCE_START_EVENT, start_mark: start_mark, end_mark: end_mark, anchor: anchor, tag: tag, implicit: implicit, style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), } return true } if token.typ == yaml_SCALAR_TOKEN { var plain_implicit, quoted_implicit bool end_mark = token.end_mark if (len(tag) == 0 && token.style == yaml_PLAIN_SCALAR_STYLE) || (len(tag) == 1 && tag[0] == '!') { plain_implicit = true } else if len(tag) == 0 { quoted_implicit = true } parser.state = parser.states[len(parser.states)-1] parser.states = parser.states[:len(parser.states)-1] *event = yaml_event_t{ typ: yaml_SCALAR_EVENT, start_mark: start_mark, end_mark: end_mark, anchor: anchor, tag: tag, value: token.value, implicit: plain_implicit, quoted_implicit: quoted_implicit, style: yaml_style_t(token.style), } yaml_parser_set_event_comments(parser, event) skip_token(parser) return true } if token.typ == yaml_FLOW_SEQUENCE_START_TOKEN { // [Go] Some of the events below can be merged as they differ only on style. end_mark = token.end_mark parser.state = yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE *event = yaml_event_t{ typ: yaml_SEQUENCE_START_EVENT, start_mark: start_mark, end_mark: end_mark, anchor: anchor, tag: tag, implicit: implicit, style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE), } yaml_parser_set_event_comments(parser, event) return true } if token.typ == yaml_FLOW_MAPPING_START_TOKEN { end_mark = token.end_mark parser.state = yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE *event = yaml_event_t{ typ: yaml_MAPPING_START_EVENT, start_mark: start_mark, end_mark: end_mark, anchor: anchor, tag: tag, implicit: implicit, style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), } yaml_parser_set_event_comments(parser, event) return true } if block && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN { end_mark = token.end_mark parser.state = yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE *event = yaml_event_t{ typ: yaml_SEQUENCE_START_EVENT, start_mark: start_mark, end_mark: end_mark, anchor: anchor, tag: tag, implicit: implicit, style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), } if parser.stem_comment != nil { event.head_comment = parser.stem_comment parser.stem_comment = nil } return true } if block && token.typ == yaml_BLOCK_MAPPING_START_TOKEN { end_mark = token.end_mark parser.state = yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE *event = yaml_event_t{ typ: yaml_MAPPING_START_EVENT, start_mark: start_mark, end_mark: end_mark, anchor: anchor, tag: tag, implicit: implicit, style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE), } if parser.stem_comment != nil { event.head_comment = parser.stem_comment parser.stem_comment = nil } return true } if len(anchor) > 0 || len(tag) > 0 { parser.state = parser.states[len(parser.states)-1] parser.states = parser.states[:len(parser.states)-1] *event = yaml_event_t{ typ: yaml_SCALAR_EVENT, start_mark: start_mark, end_mark: end_mark, anchor: anchor, tag: tag, implicit: implicit, quoted_implicit: false, style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), } return true } context := "while parsing a flow node" if block { context = "while parsing a block node" } yaml_parser_set_parser_error_context(parser, context, start_mark, "did not find expected node content", token.start_mark) return false } // Parse the productions: // block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END // ******************** *********** * ********* // func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) if token == nil { return false } parser.marks = append(parser.marks, token.start_mark) skip_token(parser) } token := peek_token(parser) if token == nil { return false } if token.typ == yaml_BLOCK_ENTRY_TOKEN { mark := token.end_mark prior_head_len := len(parser.head_comment) skip_token(parser) yaml_parser_split_stem_comment(parser, prior_head_len) token = peek_token(parser) if token == nil { return false } if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE) return yaml_parser_parse_node(parser, event, true, false) } else { parser.state = yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE return yaml_parser_process_empty_scalar(parser, event, mark) } } if token.typ == yaml_BLOCK_END_TOKEN { parser.state = parser.states[len(parser.states)-1] parser.states = parser.states[:len(parser.states)-1] parser.marks = parser.marks[:len(parser.marks)-1] *event = yaml_event_t{ typ: yaml_SEQUENCE_END_EVENT, start_mark: token.start_mark, end_mark: token.end_mark, } skip_token(parser) return true } context_mark := parser.marks[len(parser.marks)-1] parser.marks = parser.marks[:len(parser.marks)-1] return yaml_parser_set_parser_error_context(parser, "while parsing a block collection", context_mark, "did not find expected '-' indicator", token.start_mark) } // Parse the productions: // indentless_sequence ::= (BLOCK-ENTRY block_node?)+ // *********** * func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { return false } if token.typ == yaml_BLOCK_ENTRY_TOKEN { mark := token.end_mark prior_head_len := len(parser.head_comment) skip_token(parser) yaml_parser_split_stem_comment(parser, prior_head_len) token = peek_token(parser) if token == nil { return false } if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_KEY_TOKEN && token.typ != yaml_VALUE_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { parser.states = append(parser.states, yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE) return yaml_parser_parse_node(parser, event, true, false) } parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE return yaml_parser_process_empty_scalar(parser, event, mark) } parser.state = parser.states[len(parser.states)-1] parser.states = parser.states[:len(parser.states)-1] *event = yaml_event_t{ typ: yaml_SEQUENCE_END_EVENT, start_mark: token.start_mark, end_mark: token.start_mark, // [Go] Shouldn't this be token.end_mark? } return true } // Split stem comment from head comment. // // When a sequence or map is found under a sequence entry, the former head comment // is assigned to the underlying sequence or map as a whole, not the individual // sequence or map entry as would be expected otherwise. To handle this case the // previous head comment is moved aside as the stem comment. func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) { if stem_len == 0 { return } token := peek_token(parser) if token == nil || token.typ != yaml_BLOCK_SEQUENCE_START_TOKEN && token.typ != yaml_BLOCK_MAPPING_START_TOKEN { return } parser.stem_comment = parser.head_comment[:stem_len] if len(parser.head_comment) == stem_len { parser.head_comment = nil } else { // Copy suffix to prevent very strange bugs if someone ever appends // further bytes to the prefix in the stem_comment slice above. parser.head_comment = append([]byte(nil), parser.head_comment[stem_len+1:]...) } } // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START // ******************* // ((KEY block_node_or_indentless_sequence?)? // *** * // (VALUE block_node_or_indentless_sequence?)?)* // // BLOCK-END // ********* // func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) if token == nil { return false } parser.marks = append(parser.marks, token.start_mark) skip_token(parser) } token := peek_token(parser) if token == nil { return false } // [Go] A tail comment was left from the prior mapping value processed. Emit an event // as it needs to be processed with that value and not the following key. if len(parser.tail_comment) > 0 { *event = yaml_event_t{ typ: yaml_TAIL_COMMENT_EVENT, start_mark: token.start_mark, end_mark: token.end_mark, foot_comment: parser.tail_comment, } parser.tail_comment = nil return true } if token.typ == yaml_KEY_TOKEN { mark := token.end_mark skip_token(parser) token = peek_token(parser) if token == nil { return false } if token.typ != yaml_KEY_TOKEN && token.typ != yaml_VALUE_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE) return yaml_parser_parse_node(parser, event, true, true) } else { parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE return yaml_parser_process_empty_scalar(parser, event, mark) } } else if token.typ == yaml_BLOCK_END_TOKEN { parser.state = parser.states[len(parser.states)-1] parser.states = parser.states[:len(parser.states)-1] parser.marks = parser.marks[:len(parser.marks)-1] *event = yaml_event_t{ typ: yaml_MAPPING_END_EVENT, start_mark: token.start_mark, end_mark: token.end_mark, } yaml_parser_set_event_comments(parser, event) skip_token(parser) return true } context_mark := parser.marks[len(parser.marks)-1] parser.marks = parser.marks[:len(parser.marks)-1] return yaml_parser_set_parser_error_context(parser, "while parsing a block mapping", context_mark, "did not find expected key", token.start_mark) } // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START // // ((KEY block_node_or_indentless_sequence?)? // // (VALUE block_node_or_indentless_sequence?)?)* // ***** * // BLOCK-END // // func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { return false } if token.typ == yaml_VALUE_TOKEN { mark := token.end_mark skip_token(parser) token = peek_token(parser) if token == nil { return false } if token.typ != yaml_KEY_TOKEN && token.typ != yaml_VALUE_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_KEY_STATE) return yaml_parser_parse_node(parser, event, true, true) } parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE return yaml_parser_process_empty_scalar(parser, event, mark) } parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE return yaml_parser_process_empty_scalar(parser, event, token.start_mark) } // Parse the productions: // flow_sequence ::= FLOW-SEQUENCE-START // ******************* // (flow_sequence_entry FLOW-ENTRY)* // * ********** // flow_sequence_entry? // * // FLOW-SEQUENCE-END // ***************** // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? // * // func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) if token == nil { return false } parser.marks = append(parser.marks, token.start_mark) skip_token(parser) } token := peek_token(parser) if token == nil { return false } if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { if !first { if token.typ == yaml_FLOW_ENTRY_TOKEN { skip_token(parser) token = peek_token(parser) if token == nil { return false } } else { context_mark := parser.marks[len(parser.marks)-1] parser.marks = parser.marks[:len(parser.marks)-1] return yaml_parser_set_parser_error_context(parser, "while parsing a flow sequence", context_mark, "did not find expected ',' or ']'", token.start_mark) } } if token.typ == yaml_KEY_TOKEN { parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE *event = yaml_event_t{ typ: yaml_MAPPING_START_EVENT, start_mark: token.start_mark, end_mark: token.end_mark, implicit: true, style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), } skip_token(parser) return true } else if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE) return yaml_parser_parse_node(parser, event, false, false) } } parser.state = parser.states[len(parser.states)-1] parser.states = parser.states[:len(parser.states)-1] parser.marks = parser.marks[:len(parser.marks)-1] *event = yaml_event_t{ typ: yaml_SEQUENCE_END_EVENT, start_mark: token.start_mark, end_mark: token.end_mark, } yaml_parser_set_event_comments(parser, event) skip_token(parser) return true } // // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? // *** * // func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { return false } if token.typ != yaml_VALUE_TOKEN && token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE)
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/warnings.v0/warnings.go
vendor/gopkg.in/warnings.v0/warnings.go
// Package warnings implements error handling with non-fatal errors (warnings). // // A recurring pattern in Go programming is the following: // // func myfunc(params) error { // if err := doSomething(...); err != nil { // return err // } // if err := doSomethingElse(...); err != nil { // return err // } // if ok := doAnotherThing(...); !ok { // return errors.New("my error") // } // ... // return nil // } // // This pattern allows interrupting the flow on any received error. But what if // there are errors that should be noted but still not fatal, for which the flow // should not be interrupted? Implementing such logic at each if statement would // make the code complex and the flow much harder to follow. // // Package warnings provides the Collector type and a clean and simple pattern // for achieving such logic. The Collector takes care of deciding when to break // the flow and when to continue, collecting any non-fatal errors (warnings) // along the way. The only requirement is that fatal and non-fatal errors can be // distinguished programmatically; that is a function such as // // IsFatal(error) bool // // must be implemented. The following is an example of what the above snippet // could look like using the warnings package: // // import "gopkg.in/warnings.v0" // // func isFatal(err error) bool { // _, ok := err.(WarningType) // return !ok // } // // func myfunc(params) error { // c := warnings.NewCollector(isFatal) // c.FatalWithWarnings = true // if err := c.Collect(doSomething()); err != nil { // return err // } // if err := c.Collect(doSomethingElse(...)); err != nil { // return err // } // if ok := doAnotherThing(...); !ok { // if err := c.Collect(errors.New("my error")); err != nil { // return err // } // } // ... // return c.Done() // } // // For an example of a non-trivial code base using this library, see // gopkg.in/gcfg.v1 // // Rules for using warnings // // - ensure that warnings are programmatically distinguishable from fatal // errors (i.e. implement an isFatal function and any necessary error types) // - ensure that there is a single Collector instance for a call of each // exported function // - ensure that all errors (fatal or warning) are fed through Collect // - ensure that every time an error is returned, it is one returned by a // Collector (from Collect or Done) // - ensure that Collect is never called after Done // // TODO // // - optionally limit the number of warnings (e.g. stop after 20 warnings) (?) // - consider interaction with contexts // - go vet-style invocations verifier // - semi-automatic code converter // package warnings // import "gopkg.in/warnings.v0" import ( "bytes" "fmt" ) // List holds a collection of warnings and optionally one fatal error. type List struct { Warnings []error Fatal error } // Error implements the error interface. func (l List) Error() string { b := bytes.NewBuffer(nil) if l.Fatal != nil { fmt.Fprintln(b, "fatal:") fmt.Fprintln(b, l.Fatal) } switch len(l.Warnings) { case 0: // nop case 1: fmt.Fprintln(b, "warning:") default: fmt.Fprintln(b, "warnings:") } for _, err := range l.Warnings { fmt.Fprintln(b, err) } return b.String() } // A Collector collects errors up to the first fatal error. type Collector struct { // IsFatal distinguishes between warnings and fatal errors. IsFatal func(error) bool // FatalWithWarnings set to true means that a fatal error is returned as // a List together with all warnings so far. The default behavior is to // only return the fatal error and discard any warnings that have been // collected. FatalWithWarnings bool l List done bool } // NewCollector returns a new Collector; it uses isFatal to distinguish between // warnings and fatal errors. func NewCollector(isFatal func(error) bool) *Collector { return &Collector{IsFatal: isFatal} } // Collect collects a single error (warning or fatal). It returns nil if // collection can continue (only warnings so far), or otherwise the errors // collected. Collect mustn't be called after the first fatal error or after // Done has been called. func (c *Collector) Collect(err error) error { if c.done { panic("warnings.Collector already done") } if err == nil { return nil } if c.IsFatal(err) { c.done = true c.l.Fatal = err } else { c.l.Warnings = append(c.l.Warnings, err) } if c.l.Fatal != nil { return c.erorr() } return nil } // Done ends collection and returns the collected error(s). func (c *Collector) Done() error { c.done = true return c.erorr() } func (c *Collector) erorr() error { if !c.FatalWithWarnings && c.l.Fatal != nil { return c.l.Fatal } if c.l.Fatal == nil && len(c.l.Warnings) == 0 { return nil } // Note that a single warning is also returned as a List. This is to make it // easier to determine fatal-ness of the returned error. return c.l } // FatalOnly returns the fatal error, if any, **in an error returned by a // Collector**. It returns nil if and only if err is nil or err is a List // with err.Fatal == nil. func FatalOnly(err error) error { l, ok := err.(List) if !ok { return err } return l.Fatal } // WarningsOnly returns the warnings **in an error returned by a Collector**. func WarningsOnly(err error) []error { l, ok := err.(List) if !ok { return nil } return l.Warnings }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/patricia/patricia.go
vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/patricia/patricia.go
// Copyright (c) 2014 The go-patricia AUTHORS // // Use of this source code is governed by The MIT License // that can be found in the LICENSE file. package patricia import ( "bytes" "errors" "fmt" "io" "strings" ) //------------------------------------------------------------------------------ // Trie //------------------------------------------------------------------------------ const ( defaultMaxPrefixPerNode = 10 ) var ( maxPrefixPerNode = defaultMaxPrefixPerNode ) type ( // Prefix is the type of node prefixes Prefix []byte // Item is just interface{} Item interface{} // VisitorFunc is the type of functions passed to visit function VisitorFunc func(prefix Prefix, item Item) error // FuzzyVisitorFunc additionaly returns how many characters were skipped which can be sorted on FuzzyVisitorFunc func(prefix Prefix, item Item, skipped int) error ) // Trie is a generic patricia trie that allows fast retrieval of items by prefix. // and other funky stuff. // // Trie is not thread-safe. type Trie struct { prefix Prefix item Item mask uint64 children childList } // Public API ------------------------------------------------------------------ // NewTrie constructs a new trie. func NewTrie() *Trie { trie := &Trie{} trie.children = newSuperDenseChildList() trie.mask = 0 return trie } // SetMaxPrefixPerNode sets the maximum length of a prefix before it is split into two nodes func SetMaxPrefixPerNode(value int) { maxPrefixPerNode = value } // Clone makes a copy of an existing trie. // Items stored in both tries become shared, obviously. func (trie *Trie) Clone() *Trie { return &Trie{ prefix: append(Prefix(nil), trie.prefix...), item: trie.item, children: trie.children.clone(), } } // Item returns the item stored in the root of this trie. func (trie *Trie) Item() Item { return trie.item } // Insert inserts a new item into the trie using the given prefix. Insert does // not replace existing items. It returns false if an item was already in place. func (trie *Trie) Insert(key Prefix, item Item) (inserted bool) { return trie.put(key, item, false) } // Set works much like Insert, but it always sets the item, possibly replacing // the item previously inserted. func (trie *Trie) Set(key Prefix, item Item) { trie.put(key, item, true) } // Get returns the item located at key. // // This method is a bit dangerous, because Get can as well end up in an internal // node that is not really representing any user-defined value. So when nil is // a valid value being used, it is not possible to tell if the value was inserted // into the tree by the user or not. A possible workaround for this is not to use // nil interface as a valid value, even using zero value of any type is enough // to prevent this bad behaviour. func (trie *Trie) Get(key Prefix) (item Item) { _, node, found, leftover := trie.findSubtree(key) if !found || len(leftover) != 0 { return nil } return node.item } // Match returns what Get(prefix) != nil would return. The same warning as for // Get applies here as well. func (trie *Trie) Match(prefix Prefix) (matchedExactly bool) { return trie.Get(prefix) != nil } // MatchSubtree returns true when there is a subtree representing extensions // to key, that is if there are any keys in the tree which have key as prefix. func (trie *Trie) MatchSubtree(key Prefix) (matched bool) { _, _, matched, _ = trie.findSubtree(key) return } // Visit calls visitor on every node containing a non-nil item // in alphabetical order. // // If an error is returned from visitor, the function stops visiting the tree // and returns that error, unless it is a special error - SkipSubtree. In that // case Visit skips the subtree represented by the current node and continues // elsewhere. func (trie *Trie) Visit(visitor VisitorFunc) error { return trie.walk(nil, visitor) } func (trie *Trie) size() int { n := 0 err := trie.walk(nil, func(prefix Prefix, item Item) error { n++ return nil }) if err != nil { panic(err) } return n } func (trie *Trie) total() int { return 1 + trie.children.total() } // VisitSubtree works much like Visit, but it only visits nodes matching prefix. func (trie *Trie) VisitSubtree(prefix Prefix, visitor VisitorFunc) error { // Nil prefix not allowed. if prefix == nil { panic(ErrNilPrefix) } // Empty trie must be handled explicitly. if trie.prefix == nil { return nil } // Locate the relevant subtree. _, root, found, leftover := trie.findSubtree(prefix) if !found { return nil } prefix = append(prefix, leftover...) // Visit it. return root.walk(prefix, visitor) } type potentialSubtree struct { idx int skipped int prefix Prefix node *Trie } // VisitFuzzy visits every node that is succesfully matched via fuzzy matching func (trie *Trie) VisitFuzzy(partial Prefix, caseInsensitive bool, visitor FuzzyVisitorFunc) error { if len(partial) == 0 { return trie.VisitPrefixes(partial, caseInsensitive, func(prefix Prefix, item Item) error { return visitor(prefix, item, 0) }) } var ( m uint64 cmp uint64 i int p potentialSubtree ) potential := []potentialSubtree{potentialSubtree{node: trie, prefix: Prefix(""), idx: 0}} for l := len(potential); l > 0; l = len(potential) { i = l - 1 p = potential[i] potential = potential[:i] m = makePrefixMask(partial[p.idx:]) if caseInsensitive { cmp = caseInsensitiveMask(p.node.mask) } else { cmp = p.node.mask } if (cmp & m) != m { continue } matchCount, skipped := fuzzyMatchCount(p.node.prefix, partial[p.idx:], p.idx, caseInsensitive) p.idx += matchCount if p.idx != 0 { p.skipped += skipped } if p.idx == len(partial) { fullPrefix := append(p.prefix, p.node.prefix...) err := p.node.walk(Prefix(""), func(prefix Prefix, item Item) error { key := make([]byte, len(fullPrefix), len(fullPrefix)+len(prefix)) copy(key, fullPrefix) key = append(key, prefix...) err := visitor(key, item, p.skipped) if err != nil { return err } return nil }) if err != nil { return err } continue } for _, c := range p.node.children.getChildren() { if c != nil { newPrefix := make(Prefix, len(p.prefix), len(p.prefix)+len(p.node.prefix)) copy(newPrefix, p.prefix) newPrefix = append(newPrefix, p.node.prefix...) potential = append(potential, potentialSubtree{ node: c, prefix: newPrefix, idx: p.idx, skipped: p.skipped, }) } else { fmt.Println("warning, child isn il") } } } return nil } func fuzzyMatchCount(prefix, query Prefix, idx int, caseInsensitive bool) (count, skipped int) { for i := 0; i < len(prefix); i++ { var match bool if caseInsensitive { match = matchCaseInsensitive(prefix[i], query[count]) } else { match = prefix[i] == query[count] } if !match { if count+idx > 0 { skipped++ } continue } count++ if count >= len(query) { return } } return } // VisitSubstring takes a substring and visits all the nodes that whos prefix contains this substring func (trie *Trie) VisitSubstring(substring Prefix, caseInsensitive bool, visitor VisitorFunc) error { if len(substring) == 0 { return trie.VisitSubtree(substring, visitor) } var ( m uint64 cmp uint64 i int p potentialSubtree suffixLen int maxSuffixLen = len(substring) - 1 ) potential := []potentialSubtree{potentialSubtree{node: trie, prefix: nil}} for l := len(potential); l > 0; l = len(potential) { i = l - 1 p = potential[i] potential = potential[:i] if len(p.prefix) < maxSuffixLen { suffixLen = len(p.prefix) } else { suffixLen = maxSuffixLen } searchBytes := append(p.prefix[len(p.prefix)-suffixLen:], p.node.prefix...) contains := false if caseInsensitive { contains = bytes.Contains(bytes.ToUpper(searchBytes), bytes.ToUpper(substring)) } else { contains = bytes.Contains(searchBytes, substring) } if contains { fullPrefix := append(p.prefix, p.node.prefix...) err := p.node.walk(Prefix(""), func(prefix Prefix, item Item) error { key := make([]byte, len(fullPrefix), len(fullPrefix)+len(prefix)) copy(key, fullPrefix) key = append(key, prefix...) copy(key, append(fullPrefix, prefix...)) err := visitor(key, item) if err != nil { return err } return nil }) if err != nil { return err } } newPrefix := make(Prefix, len(p.prefix), len(p.prefix)+len(p.node.prefix)) copy(newPrefix, p.prefix) newPrefix = append(newPrefix, p.node.prefix...) overLap := overlapLength(newPrefix, substring, caseInsensitive) m = makePrefixMask(substring[overLap:]) for _, c := range p.node.children.getChildren() { if caseInsensitive { cmp = caseInsensitiveMask(c.mask) } else { cmp = c.mask } if c != nil && (cmp&m == m) { potential = append(potential, potentialSubtree{ node: c, prefix: newPrefix, }) } } } return nil } func overlapLength(prefix, query Prefix, caseInsensitive bool) int { startLength := len(query) - 1 if len(prefix) < startLength { startLength = len(prefix) } for i := startLength; i > 0; i-- { suffix := prefix[len(prefix)-i:] queryPrefix := query[:i] if caseInsensitive { if bytes.EqualFold(suffix, queryPrefix) { return i } } else if bytes.Equal(suffix, queryPrefix) { return i } } return 0 } // VisitPrefixes visits only nodes that represent prefixes of key. // To say the obvious, returning SkipSubtree from visitor makes no sense here. func (trie *Trie) VisitPrefixes(key Prefix, caseInsensitive bool, visitor VisitorFunc) error { // Nil key not allowed. if key == nil { panic(ErrNilPrefix) } // Empty trie must be handled explicitly. if trie.prefix == nil { return nil } // Walk the path matching key prefixes. node := trie prefix := key offset := 0 for { // Compute what part of prefix matches. common := node.longestCommonPrefixLength(key, caseInsensitive) key = key[common:] offset += common // Partial match means that there is no subtree matching prefix. if common < len(node.prefix) { return nil } // Call the visitor. if item := node.item; item != nil { if err := visitor(prefix[:offset], item); err != nil { return err } } if len(key) == 0 { // This node represents key, we are finished. return nil } // There is some key suffix left, move to the children. child := node.children.next(key[0]) if child == nil { // There is nowhere to continue, return. return nil } node = child } } // Delete deletes the item represented by the given prefix. // // True is returned if the matching node was found and deleted. func (trie *Trie) Delete(key Prefix) (deleted bool) { // Nil prefix not allowed. if key == nil { panic(ErrNilPrefix) } // Empty trie must be handled explicitly. if trie.prefix == nil { return false } // Find the relevant node. path, found, _ := trie.findSubtreePath(key) if !found { return false } node := path[len(path)-1] var parent *Trie if len(path) != 1 { parent = path[len(path)-2] } // If the item is already set to nil, there is nothing to do. if node.item == nil { return false } // Delete the item. node.item = nil // Initialise i before goto. // Will be used later in a loop. i := len(path) - 1 // In case there are some child nodes, we cannot drop the whole subtree. // We can try to compact nodes, though. if node.children.length() != 0 { goto Compact } // In case we are at the root, just reset it and we are done. if parent == nil { node.reset() return true } // We can drop a subtree. // Find the first ancestor that has its value set or it has 2 or more child nodes. // That will be the node where to drop the subtree at. for ; i >= 0; i-- { if current := path[i]; current.item != nil || current.children.length() >= 2 { break } } // Handle the case when there is no such node. // In other words, we can reset the whole tree. if i == -1 { path[0].reset() return true } // We can just remove the subtree here. node = path[i] if i == 0 { parent = nil } else { parent = path[i-1] } // i+1 is always a valid index since i is never pointing to the last node. // The loop above skips at least the last node since we are sure that the item // is set to nil and it has no children, othewise we would be compacting instead. node.children.remove(path[i+1].prefix[0]) // lastly, the bitmasks of all of the parent nodes have to be updated again, since // a child node of all of them has bin removed for ; i >= 0; i-- { n := path[i] n.mask = n.children.combinedMask() } Compact: // The node is set to the first non-empty ancestor, // so try to compact since that might be possible now. if compacted := node.compact(); compacted != node { if parent == nil { *node = *compacted } else { parent.children.replace(node.prefix[0], compacted) *parent = *parent.compact() } } return true } // DeleteSubtree finds the subtree exactly matching prefix and deletes it. // // True is returned if the subtree was found and deleted. func (trie *Trie) DeleteSubtree(prefix Prefix) (deleted bool) { // Nil prefix not allowed. if prefix == nil { panic(ErrNilPrefix) } // Empty trie must be handled explicitly. if trie.prefix == nil { return false } // Locate the relevant subtree. parent, root, found, _ := trie.findSubtree(prefix) path, _, _ := trie.findSubtreePath(prefix) if !found { return false } // If we are in the root of the trie, reset the trie. if parent == nil { root.reset() return true } // Otherwise remove the root node from its parent. parent.children.remove(root.prefix[0]) // update masks parent.mask = parent.children.combinedMask() for i := len(path) - 1; i >= 0; i-- { n := path[i] n.mask = n.children.combinedMask() } return true } // Internal helper methods ----------------------------------------------------- func (trie *Trie) empty() bool { return trie.item == nil && trie.children.length() == 0 } func (trie *Trie) reset() { trie.prefix = nil trie.children = newSuperDenseChildList() } func makePrefixMask(key Prefix) uint64 { var mask uint64 for _, b := range key { if b >= '0' && b <= '9' { // 0-9 bits: 0-9 b -= 48 } else if b >= 'A' && b <= 'Z' { // A-Z bits: 10-35 b -= 55 } else if b >= 'a' && b <= 'z' { // a-z bits: 36-61 b -= 61 } else if b == '.' { b = 62 } else if b == '-' { b = 63 } else { continue } mask |= uint64(1) << uint64(b) } return mask } const upperBits = 0xFFFFFFC00 const lowerBits = 0x3FFFFFF000000000 func caseInsensitiveMask(mask uint64) uint64 { mask |= (mask & upperBits) << uint64(26) mask |= (mask & lowerBits) >> uint64(26) return mask } var charmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-" func (trie *Trie) put(key Prefix, item Item, replace bool) (inserted bool) { // Nil prefix not allowed. if key == nil { panic(ErrNilPrefix) } var ( common int node = trie child *Trie mask uint64 ) mask = makePrefixMask(key) if node.prefix == nil { node.mask |= mask if len(key) <= maxPrefixPerNode { node.prefix = key goto InsertItem } node.prefix = key[:maxPrefixPerNode] key = key[maxPrefixPerNode:] mask = makePrefixMask(key) goto AppendChild } for { // Compute the longest common prefix length. common = node.longestCommonPrefixLength(key, false) key = key[common:] // Only a part matches, split. if common < len(node.prefix) { goto SplitPrefix } // common == len(node.prefix) since never (common > len(node.prefix)) // common == len(former key) <-> 0 == len(key) // -> former key == node.prefix if len(key) == 0 { goto InsertItem } node.mask |= mask // Check children for matching prefix. child = node.children.next(key[0]) if child == nil { goto AppendChild } node = child } SplitPrefix: // Split the prefix if necessary. child = new(Trie) *child = *node *node = *NewTrie() node.prefix = child.prefix[:common] child.prefix = child.prefix[common:] child = child.compact() node.children = node.children.add(child) node.mask = child.mask node.mask |= mask mask = makePrefixMask(key) AppendChild: // Keep appending children until whole prefix is inserted. // This loop starts with empty node.prefix that needs to be filled. for len(key) != 0 { child := NewTrie() child.mask = mask if len(key) <= maxPrefixPerNode { child.prefix = key node.children = node.children.add(child) node = child goto InsertItem } else { child.prefix = key[:maxPrefixPerNode] key = key[maxPrefixPerNode:] mask = makePrefixMask(key) node.children = node.children.add(child) node = child } } InsertItem: // Try to insert the item if possible. if replace || node.item == nil { node.item = item return true } return false } func (trie *Trie) compact() *Trie { // Only a node with a single child can be compacted. if trie.children.length() != 1 { return trie } child := trie.children.head() // If any item is set, we cannot compact since we want to retain // the ability to do searching by key. This makes compaction less usable, // but that simply cannot be avoided. if trie.item != nil || child.item != nil { return trie } // Make sure the combined prefixes fit into a single node. if len(trie.prefix)+len(child.prefix) > maxPrefixPerNode { return trie } // Concatenate the prefixes, move the items. child.prefix = append(trie.prefix, child.prefix...) child.mask = trie.mask if trie.item != nil { child.item = trie.item } return child } func (trie *Trie) findSubtree(prefix Prefix) (parent *Trie, root *Trie, found bool, leftover Prefix) { // Find the subtree matching prefix. root = trie for { // Compute what part of prefix matches. common := root.longestCommonPrefixLength(prefix, false) prefix = prefix[common:] // We used up the whole prefix, subtree found. if len(prefix) == 0 { found = true leftover = root.prefix[common:] return } // Partial match means that there is no subtree matching prefix. if common < len(root.prefix) { leftover = root.prefix[common:] return } // There is some prefix left, move to the children. child := root.children.next(prefix[0]) if child == nil { // There is nowhere to continue, there is no subtree matching prefix. return } parent = root root = child } } func (trie *Trie) findSubtreePath(prefix Prefix) (path []*Trie, found bool, leftover Prefix) { // Find the subtree matching prefix. root := trie var subtreePath []*Trie for { // Append the current root to the path. subtreePath = append(subtreePath, root) // Compute what part of prefix matches. common := root.longestCommonPrefixLength(prefix, false) prefix = prefix[common:] // We used up the whole prefix, subtree found. if len(prefix) == 0 { path = subtreePath found = true leftover = root.prefix[common:] return } // Partial match means that there is no subtree matching prefix. if common < len(root.prefix) { leftover = root.prefix[common:] return } // There is some prefix left, move to the children. child := root.children.next(prefix[0]) if child == nil { // There is nowhere to continue, there is no subtree matching prefix. return } root = child } } func (trie *Trie) walk(actualRootPrefix Prefix, visitor VisitorFunc) error { var prefix Prefix // Allocate a bit more space for prefix at the beginning. if actualRootPrefix == nil { prefix = make(Prefix, 32+len(trie.prefix)) copy(prefix, trie.prefix) prefix = prefix[:len(trie.prefix)] } else { prefix = make(Prefix, 32+len(actualRootPrefix)) copy(prefix, actualRootPrefix) prefix = prefix[:len(actualRootPrefix)] } // Visit the root first. Not that this works for empty trie as well since // in that case item == nil && len(children) == 0. if trie.item != nil { if err := visitor(prefix, trie.item); err != nil { if err == SkipSubtree { return nil } return err } } // Then continue to the children. return trie.children.walk(&prefix, visitor) } func (trie *Trie) longestCommonPrefixLength(prefix Prefix, caseInsensitive bool) (i int) { for ; i < len(prefix) && i < len(trie.prefix); i++ { p := prefix[i] t := trie.prefix[i] if caseInsensitive { if !(matchCaseInsensitive(t, p)) { break } } else { if p != t { break } } } return } func matchCaseInsensitive(a byte, b byte) bool { return a == b+32 || b == a+32 || a == b } func (trie *Trie) dump() string { writer := &bytes.Buffer{} trie.print(writer, 0) return writer.String() } func (trie *Trie) print(writer io.Writer, indent int) { fmt.Fprintf(writer, "%s%s %v\n", strings.Repeat(" ", indent), string(trie.prefix), trie.item) trie.children.print(writer, indent+2) } // Errors ---------------------------------------------------------------------- var ( SkipSubtree = errors.New("Skip this subtree") ErrNilPrefix = errors.New("Nil prefix passed into a method call") )
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/patricia/children.go
vendor/gopkg.in/ozeidan/fuzzy-patricia.v3/patricia/children.go
// Copyright (c) 2014 The go-patricia AUTHORS // // Use of this source code is governed by The MIT License // that can be found in the LICENSE file. package patricia import ( "io" "sort" ) type childList interface { length() int head() *Trie add(child *Trie) childList remove(b byte) replace(b byte, child *Trie) next(b byte) *Trie combinedMask() uint64 getChildren() []*Trie walk(prefix *Prefix, visitor VisitorFunc) error print(w io.Writer, indent int) clone() childList total() int } type tries []*Trie func (t tries) Len() int { return len(t) } func (t tries) Less(i, j int) bool { strings := sort.StringSlice{string(t[i].prefix), string(t[j].prefix)} return strings.Less(0, 1) } func (t tries) Swap(i, j int) { t[i], t[j] = t[j], t[i] } type childContainer struct { char byte node *Trie } type superDenseChildList struct { children []childContainer } func newSuperDenseChildList() childList { return &superDenseChildList{ make([]childContainer, 0), } } func (list *superDenseChildList) length() int { return len(list.children) } func (list *superDenseChildList) head() *Trie { if len(list.children) > 0 { return list.children[0].node } return nil } func (list *superDenseChildList) add(child *Trie) childList { char := child.prefix[0] list.children = append(list.children, childContainer{ char, child, }) return list } func (list *superDenseChildList) remove(b byte) { children := list.children for i := 0; i < len(children); i++ { if children[i].char == b { // children[i] = children[len(children)-1] // children = children[:len(children)-1] // children = append(children[:i], children[i+1:]...) newChildren := make([]childContainer, len(children)-1) // copy the elements over to avoid "memory leaks" copy(newChildren, children[:i]) copy(newChildren[i:], children[i+1:]) list.children = newChildren // list.children = make([]childContainer, len(children)) // copy(list.children, children) // children = nil return } } } func (list *superDenseChildList) replace(b byte, child *Trie) { children := list.children for i := 0; i < len(list.children); i++ { if children[i].char == b { children[i].node = child return } } } func (list *superDenseChildList) next(b byte) *Trie { children := list.children for i := 0; i < len(list.children); i++ { if children[i].char == b { return children[i].node } } return nil } func (list superDenseChildList) combinedMask() uint64 { var mask uint64 for _, child := range list.children { // fmt.Printf("child = %+v\n", child) mask |= child.node.mask } return mask } func (list *superDenseChildList) getChildren() []*Trie { children := make([]*Trie, 0, len(list.children)) for _, child := range list.children { children = append(children, child.node) } return children } func (list *superDenseChildList) walk(prefix *Prefix, visitor VisitorFunc) error { for _, child := range list.children { node := child.node *prefix = append(*prefix, node.prefix...) if node.item != nil { if err := visitor(*prefix, node.item); err != nil { if err == SkipSubtree { *prefix = (*prefix)[:len(*prefix)-len(node.prefix)] continue } *prefix = (*prefix)[:len(*prefix)-len(node.prefix)] return err } } err := node.children.walk(prefix, visitor) *prefix = (*prefix)[:len(*prefix)-len(node.prefix)] if err != nil { return err } } return nil } func (list *superDenseChildList) print(w io.Writer, indent int) { for _, child := range list.children { child.node.print(w, indent) } } func (list *superDenseChildList) clone() childList { clones := make([]childContainer, len(list.children)) for i := 0; i < len(list.children); i++ { child := list.children[i] clones[i] = childContainer{child.char, child.node.Clone()} } return &superDenseChildList{ clones, } } func (list *superDenseChildList) total() int { return len(list.children) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/exp/slices/sort.go
vendor/golang.org/x/exp/slices/sort.go
// Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:generate go run $GOROOT/src/sort/gen_sort_variants.go -exp package slices import ( "math/bits" "golang.org/x/exp/constraints" ) // Sort sorts a slice of any ordered type in ascending order. // When sorting floating-point numbers, NaNs are ordered before other values. func Sort[S ~[]E, E constraints.Ordered](x S) { n := len(x) pdqsortOrdered(x, 0, n, bits.Len(uint(n))) } // SortFunc sorts the slice x in ascending order as determined by the cmp // function. This sort is not guaranteed to be stable. // cmp(a, b) should return a negative number when a < b, a positive number when // a > b and zero when a == b or when a is not comparable to b in the sense // of the formal definition of Strict Weak Ordering. // // SortFunc requires that cmp is a strict weak ordering. // See https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings. // To indicate 'uncomparable', return 0 from the function. func SortFunc[S ~[]E, E any](x S, cmp func(a, b E) int) { n := len(x) pdqsortCmpFunc(x, 0, n, bits.Len(uint(n)), cmp) } // SortStableFunc sorts the slice x while keeping the original order of equal // elements, using cmp to compare elements in the same way as [SortFunc]. func SortStableFunc[S ~[]E, E any](x S, cmp func(a, b E) int) { stableCmpFunc(x, len(x), cmp) } // IsSorted reports whether x is sorted in ascending order. func IsSorted[S ~[]E, E constraints.Ordered](x S) bool { for i := len(x) - 1; i > 0; i-- { if cmpLess(x[i], x[i-1]) { return false } } return true } // IsSortedFunc reports whether x is sorted in ascending order, with cmp as the // comparison function as defined by [SortFunc]. func IsSortedFunc[S ~[]E, E any](x S, cmp func(a, b E) int) bool { for i := len(x) - 1; i > 0; i-- { if cmp(x[i], x[i-1]) < 0 { return false } } return true } // Min returns the minimal value in x. It panics if x is empty. // For floating-point numbers, Min propagates NaNs (any NaN value in x // forces the output to be NaN). func Min[S ~[]E, E constraints.Ordered](x S) E { if len(x) < 1 { panic("slices.Min: empty list") } m := x[0] for i := 1; i < len(x); i++ { m = min(m, x[i]) } return m } // MinFunc returns the minimal value in x, using cmp to compare elements. // It panics if x is empty. If there is more than one minimal element // according to the cmp function, MinFunc returns the first one. func MinFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E { if len(x) < 1 { panic("slices.MinFunc: empty list") } m := x[0] for i := 1; i < len(x); i++ { if cmp(x[i], m) < 0 { m = x[i] } } return m } // Max returns the maximal value in x. It panics if x is empty. // For floating-point E, Max propagates NaNs (any NaN value in x // forces the output to be NaN). func Max[S ~[]E, E constraints.Ordered](x S) E { if len(x) < 1 { panic("slices.Max: empty list") } m := x[0] for i := 1; i < len(x); i++ { m = max(m, x[i]) } return m } // MaxFunc returns the maximal value in x, using cmp to compare elements. // It panics if x is empty. If there is more than one maximal element // according to the cmp function, MaxFunc returns the first one. func MaxFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E { if len(x) < 1 { panic("slices.MaxFunc: empty list") } m := x[0] for i := 1; i < len(x); i++ { if cmp(x[i], m) > 0 { m = x[i] } } return m } // BinarySearch searches for target in a sorted slice and returns the position // where target is found, or the position where target would appear in the // sort order; it also returns a bool saying whether the target is really found // in the slice. The slice must be sorted in increasing order. func BinarySearch[S ~[]E, E constraints.Ordered](x S, target E) (int, bool) { // Inlining is faster than calling BinarySearchFunc with a lambda. n := len(x) // Define x[-1] < target and x[n] >= target. // Invariant: x[i-1] < target, x[j] >= target. i, j := 0, n for i < j { h := int(uint(i+j) >> 1) // avoid overflow when computing h // i ≤ h < j if cmpLess(x[h], target) { i = h + 1 // preserves x[i-1] < target } else { j = h // preserves x[j] >= target } } // i == j, x[i-1] < target, and x[j] (= x[i]) >= target => answer is i. return i, i < n && (x[i] == target || (isNaN(x[i]) && isNaN(target))) } // BinarySearchFunc works like [BinarySearch], but uses a custom comparison // function. The slice must be sorted in increasing order, where "increasing" // is defined by cmp. cmp should return 0 if the slice element matches // the target, a negative number if the slice element precedes the target, // or a positive number if the slice element follows the target. // cmp must implement the same ordering as the slice, such that if // cmp(a, t) < 0 and cmp(b, t) >= 0, then a must precede b in the slice. func BinarySearchFunc[S ~[]E, E, T any](x S, target T, cmp func(E, T) int) (int, bool) { n := len(x) // Define cmp(x[-1], target) < 0 and cmp(x[n], target) >= 0 . // Invariant: cmp(x[i - 1], target) < 0, cmp(x[j], target) >= 0. i, j := 0, n for i < j { h := int(uint(i+j) >> 1) // avoid overflow when computing h // i ≤ h < j if cmp(x[h], target) < 0 { i = h + 1 // preserves cmp(x[i - 1], target) < 0 } else { j = h // preserves cmp(x[j], target) >= 0 } } // i == j, cmp(x[i-1], target) < 0, and cmp(x[j], target) (= cmp(x[i], target)) >= 0 => answer is i. return i, i < n && cmp(x[i], target) == 0 } type sortedHint int // hint for pdqsort when choosing the pivot const ( unknownHint sortedHint = iota increasingHint decreasingHint ) // xorshift paper: https://www.jstatsoft.org/article/view/v008i14/xorshift.pdf type xorshift uint64 func (r *xorshift) Next() uint64 { *r ^= *r << 13 *r ^= *r >> 17 *r ^= *r << 5 return uint64(*r) } func nextPowerOfTwo(length int) uint { return 1 << bits.Len(uint(length)) } // isNaN reports whether x is a NaN without requiring the math package. // This will always return false if T is not floating-point. func isNaN[T constraints.Ordered](x T) bool { return x != x }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/exp/slices/zsortordered.go
vendor/golang.org/x/exp/slices/zsortordered.go
// Code generated by gen_sort_variants.go; DO NOT EDIT. // Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package slices import "golang.org/x/exp/constraints" // insertionSortOrdered sorts data[a:b] using insertion sort. func insertionSortOrdered[E constraints.Ordered](data []E, a, b int) { for i := a + 1; i < b; i++ { for j := i; j > a && cmpLess(data[j], data[j-1]); j-- { data[j], data[j-1] = data[j-1], data[j] } } } // siftDownOrdered implements the heap property on data[lo:hi]. // first is an offset into the array where the root of the heap lies. func siftDownOrdered[E constraints.Ordered](data []E, lo, hi, first int) { root := lo for { child := 2*root + 1 if child >= hi { break } if child+1 < hi && cmpLess(data[first+child], data[first+child+1]) { child++ } if !cmpLess(data[first+root], data[first+child]) { return } data[first+root], data[first+child] = data[first+child], data[first+root] root = child } } func heapSortOrdered[E constraints.Ordered](data []E, a, b int) { first := a lo := 0 hi := b - a // Build heap with greatest element at top. for i := (hi - 1) / 2; i >= 0; i-- { siftDownOrdered(data, i, hi, first) } // Pop elements, largest first, into end of data. for i := hi - 1; i >= 0; i-- { data[first], data[first+i] = data[first+i], data[first] siftDownOrdered(data, lo, i, first) } } // pdqsortOrdered sorts data[a:b]. // The algorithm based on pattern-defeating quicksort(pdqsort), but without the optimizations from BlockQuicksort. // pdqsort paper: https://arxiv.org/pdf/2106.05123.pdf // C++ implementation: https://github.com/orlp/pdqsort // Rust implementation: https://docs.rs/pdqsort/latest/pdqsort/ // limit is the number of allowed bad (very unbalanced) pivots before falling back to heapsort. func pdqsortOrdered[E constraints.Ordered](data []E, a, b, limit int) { const maxInsertion = 12 var ( wasBalanced = true // whether the last partitioning was reasonably balanced wasPartitioned = true // whether the slice was already partitioned ) for { length := b - a if length <= maxInsertion { insertionSortOrdered(data, a, b) return } // Fall back to heapsort if too many bad choices were made. if limit == 0 { heapSortOrdered(data, a, b) return } // If the last partitioning was imbalanced, we need to breaking patterns. if !wasBalanced { breakPatternsOrdered(data, a, b) limit-- } pivot, hint := choosePivotOrdered(data, a, b) if hint == decreasingHint { reverseRangeOrdered(data, a, b) // The chosen pivot was pivot-a elements after the start of the array. // After reversing it is pivot-a elements before the end of the array. // The idea came from Rust's implementation. pivot = (b - 1) - (pivot - a) hint = increasingHint } // The slice is likely already sorted. if wasBalanced && wasPartitioned && hint == increasingHint { if partialInsertionSortOrdered(data, a, b) { return } } // Probably the slice contains many duplicate elements, partition the slice into // elements equal to and elements greater than the pivot. if a > 0 && !cmpLess(data[a-1], data[pivot]) { mid := partitionEqualOrdered(data, a, b, pivot) a = mid continue } mid, alreadyPartitioned := partitionOrdered(data, a, b, pivot) wasPartitioned = alreadyPartitioned leftLen, rightLen := mid-a, b-mid balanceThreshold := length / 8 if leftLen < rightLen { wasBalanced = leftLen >= balanceThreshold pdqsortOrdered(data, a, mid, limit) a = mid + 1 } else { wasBalanced = rightLen >= balanceThreshold pdqsortOrdered(data, mid+1, b, limit) b = mid } } } // partitionOrdered does one quicksort partition. // Let p = data[pivot] // Moves elements in data[a:b] around, so that data[i]<p and data[j]>=p for i<newpivot and j>newpivot. // On return, data[newpivot] = p func partitionOrdered[E constraints.Ordered](data []E, a, b, pivot int) (newpivot int, alreadyPartitioned bool) { data[a], data[pivot] = data[pivot], data[a] i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned for i <= j && cmpLess(data[i], data[a]) { i++ } for i <= j && !cmpLess(data[j], data[a]) { j-- } if i > j { data[j], data[a] = data[a], data[j] return j, true } data[i], data[j] = data[j], data[i] i++ j-- for { for i <= j && cmpLess(data[i], data[a]) { i++ } for i <= j && !cmpLess(data[j], data[a]) { j-- } if i > j { break } data[i], data[j] = data[j], data[i] i++ j-- } data[j], data[a] = data[a], data[j] return j, false } // partitionEqualOrdered partitions data[a:b] into elements equal to data[pivot] followed by elements greater than data[pivot]. // It assumed that data[a:b] does not contain elements smaller than the data[pivot]. func partitionEqualOrdered[E constraints.Ordered](data []E, a, b, pivot int) (newpivot int) { data[a], data[pivot] = data[pivot], data[a] i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned for { for i <= j && !cmpLess(data[a], data[i]) { i++ } for i <= j && cmpLess(data[a], data[j]) { j-- } if i > j { break } data[i], data[j] = data[j], data[i] i++ j-- } return i } // partialInsertionSortOrdered partially sorts a slice, returns true if the slice is sorted at the end. func partialInsertionSortOrdered[E constraints.Ordered](data []E, a, b int) bool { const ( maxSteps = 5 // maximum number of adjacent out-of-order pairs that will get shifted shortestShifting = 50 // don't shift any elements on short arrays ) i := a + 1 for j := 0; j < maxSteps; j++ { for i < b && !cmpLess(data[i], data[i-1]) { i++ } if i == b { return true } if b-a < shortestShifting { return false } data[i], data[i-1] = data[i-1], data[i] // Shift the smaller one to the left. if i-a >= 2 { for j := i - 1; j >= 1; j-- { if !cmpLess(data[j], data[j-1]) { break } data[j], data[j-1] = data[j-1], data[j] } } // Shift the greater one to the right. if b-i >= 2 { for j := i + 1; j < b; j++ { if !cmpLess(data[j], data[j-1]) { break } data[j], data[j-1] = data[j-1], data[j] } } } return false } // breakPatternsOrdered scatters some elements around in an attempt to break some patterns // that might cause imbalanced partitions in quicksort. func breakPatternsOrdered[E constraints.Ordered](data []E, a, b int) { length := b - a if length >= 8 { random := xorshift(length) modulus := nextPowerOfTwo(length) for idx := a + (length/4)*2 - 1; idx <= a+(length/4)*2+1; idx++ { other := int(uint(random.Next()) & (modulus - 1)) if other >= length { other -= length } data[idx], data[a+other] = data[a+other], data[idx] } } } // choosePivotOrdered chooses a pivot in data[a:b]. // // [0,8): chooses a static pivot. // [8,shortestNinther): uses the simple median-of-three method. // [shortestNinther,∞): uses the Tukey ninther method. func choosePivotOrdered[E constraints.Ordered](data []E, a, b int) (pivot int, hint sortedHint) { const ( shortestNinther = 50 maxSwaps = 4 * 3 ) l := b - a var ( swaps int i = a + l/4*1 j = a + l/4*2 k = a + l/4*3 ) if l >= 8 { if l >= shortestNinther { // Tukey ninther method, the idea came from Rust's implementation. i = medianAdjacentOrdered(data, i, &swaps) j = medianAdjacentOrdered(data, j, &swaps) k = medianAdjacentOrdered(data, k, &swaps) } // Find the median among i, j, k and stores it into j. j = medianOrdered(data, i, j, k, &swaps) } switch swaps { case 0: return j, increasingHint case maxSwaps: return j, decreasingHint default: return j, unknownHint } } // order2Ordered returns x,y where data[x] <= data[y], where x,y=a,b or x,y=b,a. func order2Ordered[E constraints.Ordered](data []E, a, b int, swaps *int) (int, int) { if cmpLess(data[b], data[a]) { *swaps++ return b, a } return a, b } // medianOrdered returns x where data[x] is the median of data[a],data[b],data[c], where x is a, b, or c. func medianOrdered[E constraints.Ordered](data []E, a, b, c int, swaps *int) int { a, b = order2Ordered(data, a, b, swaps) b, c = order2Ordered(data, b, c, swaps) a, b = order2Ordered(data, a, b, swaps) return b } // medianAdjacentOrdered finds the median of data[a - 1], data[a], data[a + 1] and stores the index into a. func medianAdjacentOrdered[E constraints.Ordered](data []E, a int, swaps *int) int { return medianOrdered(data, a-1, a, a+1, swaps) } func reverseRangeOrdered[E constraints.Ordered](data []E, a, b int) { i := a j := b - 1 for i < j { data[i], data[j] = data[j], data[i] i++ j-- } } func swapRangeOrdered[E constraints.Ordered](data []E, a, b, n int) { for i := 0; i < n; i++ { data[a+i], data[b+i] = data[b+i], data[a+i] } } func stableOrdered[E constraints.Ordered](data []E, n int) { blockSize := 20 // must be > 0 a, b := 0, blockSize for b <= n { insertionSortOrdered(data, a, b) a = b b += blockSize } insertionSortOrdered(data, a, n) for blockSize < n { a, b = 0, 2*blockSize for b <= n { symMergeOrdered(data, a, a+blockSize, b) a = b b += 2 * blockSize } if m := a + blockSize; m < n { symMergeOrdered(data, a, m, n) } blockSize *= 2 } } // symMergeOrdered merges the two sorted subsequences data[a:m] and data[m:b] using // the SymMerge algorithm from Pok-Son Kim and Arne Kutzner, "Stable Minimum // Storage Merging by Symmetric Comparisons", in Susanne Albers and Tomasz // Radzik, editors, Algorithms - ESA 2004, volume 3221 of Lecture Notes in // Computer Science, pages 714-723. Springer, 2004. // // Let M = m-a and N = b-n. Wolog M < N. // The recursion depth is bound by ceil(log(N+M)). // The algorithm needs O(M*log(N/M + 1)) calls to data.Less. // The algorithm needs O((M+N)*log(M)) calls to data.Swap. // // The paper gives O((M+N)*log(M)) as the number of assignments assuming a // rotation algorithm which uses O(M+N+gcd(M+N)) assignments. The argumentation // in the paper carries through for Swap operations, especially as the block // swapping rotate uses only O(M+N) Swaps. // // symMerge assumes non-degenerate arguments: a < m && m < b. // Having the caller check this condition eliminates many leaf recursion calls, // which improves performance. func symMergeOrdered[E constraints.Ordered](data []E, a, m, b int) { // Avoid unnecessary recursions of symMerge // by direct insertion of data[a] into data[m:b] // if data[a:m] only contains one element. if m-a == 1 { // Use binary search to find the lowest index i // such that data[i] >= data[a] for m <= i < b. // Exit the search loop with i == b in case no such index exists. i := m j := b for i < j { h := int(uint(i+j) >> 1) if cmpLess(data[h], data[a]) { i = h + 1 } else { j = h } } // Swap values until data[a] reaches the position before i. for k := a; k < i-1; k++ { data[k], data[k+1] = data[k+1], data[k] } return } // Avoid unnecessary recursions of symMerge // by direct insertion of data[m] into data[a:m] // if data[m:b] only contains one element. if b-m == 1 { // Use binary search to find the lowest index i // such that data[i] > data[m] for a <= i < m. // Exit the search loop with i == m in case no such index exists. i := a j := m for i < j { h := int(uint(i+j) >> 1) if !cmpLess(data[m], data[h]) { i = h + 1 } else { j = h } } // Swap values until data[m] reaches the position i. for k := m; k > i; k-- { data[k], data[k-1] = data[k-1], data[k] } return } mid := int(uint(a+b) >> 1) n := mid + m var start, r int if m > mid { start = n - b r = mid } else { start = a r = m } p := n - 1 for start < r { c := int(uint(start+r) >> 1) if !cmpLess(data[p-c], data[c]) { start = c + 1 } else { r = c } } end := n - start if start < m && m < end { rotateOrdered(data, start, m, end) } if a < start && start < mid { symMergeOrdered(data, a, start, mid) } if mid < end && end < b { symMergeOrdered(data, mid, end, b) } } // rotateOrdered rotates two consecutive blocks u = data[a:m] and v = data[m:b] in data: // Data of the form 'x u v y' is changed to 'x v u y'. // rotate performs at most b-a many calls to data.Swap, // and it assumes non-degenerate arguments: a < m && m < b. func rotateOrdered[E constraints.Ordered](data []E, a, m, b int) { i := m - a j := b - m for i != j { if i > j { swapRangeOrdered(data, m-i, m, j) i -= j } else { swapRangeOrdered(data, m-i, m+j-i, i) j -= i } } // i == j swapRangeOrdered(data, m-i, m, i) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/exp/slices/zsortanyfunc.go
vendor/golang.org/x/exp/slices/zsortanyfunc.go
// Code generated by gen_sort_variants.go; DO NOT EDIT. // Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package slices // insertionSortCmpFunc sorts data[a:b] using insertion sort. func insertionSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) { for i := a + 1; i < b; i++ { for j := i; j > a && (cmp(data[j], data[j-1]) < 0); j-- { data[j], data[j-1] = data[j-1], data[j] } } } // siftDownCmpFunc implements the heap property on data[lo:hi]. // first is an offset into the array where the root of the heap lies. func siftDownCmpFunc[E any](data []E, lo, hi, first int, cmp func(a, b E) int) { root := lo for { child := 2*root + 1 if child >= hi { break } if child+1 < hi && (cmp(data[first+child], data[first+child+1]) < 0) { child++ } if !(cmp(data[first+root], data[first+child]) < 0) { return } data[first+root], data[first+child] = data[first+child], data[first+root] root = child } } func heapSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) { first := a lo := 0 hi := b - a // Build heap with greatest element at top. for i := (hi - 1) / 2; i >= 0; i-- { siftDownCmpFunc(data, i, hi, first, cmp) } // Pop elements, largest first, into end of data. for i := hi - 1; i >= 0; i-- { data[first], data[first+i] = data[first+i], data[first] siftDownCmpFunc(data, lo, i, first, cmp) } } // pdqsortCmpFunc sorts data[a:b]. // The algorithm based on pattern-defeating quicksort(pdqsort), but without the optimizations from BlockQuicksort. // pdqsort paper: https://arxiv.org/pdf/2106.05123.pdf // C++ implementation: https://github.com/orlp/pdqsort // Rust implementation: https://docs.rs/pdqsort/latest/pdqsort/ // limit is the number of allowed bad (very unbalanced) pivots before falling back to heapsort. func pdqsortCmpFunc[E any](data []E, a, b, limit int, cmp func(a, b E) int) { const maxInsertion = 12 var ( wasBalanced = true // whether the last partitioning was reasonably balanced wasPartitioned = true // whether the slice was already partitioned ) for { length := b - a if length <= maxInsertion { insertionSortCmpFunc(data, a, b, cmp) return } // Fall back to heapsort if too many bad choices were made. if limit == 0 { heapSortCmpFunc(data, a, b, cmp) return } // If the last partitioning was imbalanced, we need to breaking patterns. if !wasBalanced { breakPatternsCmpFunc(data, a, b, cmp) limit-- } pivot, hint := choosePivotCmpFunc(data, a, b, cmp) if hint == decreasingHint { reverseRangeCmpFunc(data, a, b, cmp) // The chosen pivot was pivot-a elements after the start of the array. // After reversing it is pivot-a elements before the end of the array. // The idea came from Rust's implementation. pivot = (b - 1) - (pivot - a) hint = increasingHint } // The slice is likely already sorted. if wasBalanced && wasPartitioned && hint == increasingHint { if partialInsertionSortCmpFunc(data, a, b, cmp) { return } } // Probably the slice contains many duplicate elements, partition the slice into // elements equal to and elements greater than the pivot. if a > 0 && !(cmp(data[a-1], data[pivot]) < 0) { mid := partitionEqualCmpFunc(data, a, b, pivot, cmp) a = mid continue } mid, alreadyPartitioned := partitionCmpFunc(data, a, b, pivot, cmp) wasPartitioned = alreadyPartitioned leftLen, rightLen := mid-a, b-mid balanceThreshold := length / 8 if leftLen < rightLen { wasBalanced = leftLen >= balanceThreshold pdqsortCmpFunc(data, a, mid, limit, cmp) a = mid + 1 } else { wasBalanced = rightLen >= balanceThreshold pdqsortCmpFunc(data, mid+1, b, limit, cmp) b = mid } } } // partitionCmpFunc does one quicksort partition. // Let p = data[pivot] // Moves elements in data[a:b] around, so that data[i]<p and data[j]>=p for i<newpivot and j>newpivot. // On return, data[newpivot] = p func partitionCmpFunc[E any](data []E, a, b, pivot int, cmp func(a, b E) int) (newpivot int, alreadyPartitioned bool) { data[a], data[pivot] = data[pivot], data[a] i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned for i <= j && (cmp(data[i], data[a]) < 0) { i++ } for i <= j && !(cmp(data[j], data[a]) < 0) { j-- } if i > j { data[j], data[a] = data[a], data[j] return j, true } data[i], data[j] = data[j], data[i] i++ j-- for { for i <= j && (cmp(data[i], data[a]) < 0) { i++ } for i <= j && !(cmp(data[j], data[a]) < 0) { j-- } if i > j { break } data[i], data[j] = data[j], data[i] i++ j-- } data[j], data[a] = data[a], data[j] return j, false } // partitionEqualCmpFunc partitions data[a:b] into elements equal to data[pivot] followed by elements greater than data[pivot]. // It assumed that data[a:b] does not contain elements smaller than the data[pivot]. func partitionEqualCmpFunc[E any](data []E, a, b, pivot int, cmp func(a, b E) int) (newpivot int) { data[a], data[pivot] = data[pivot], data[a] i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned for { for i <= j && !(cmp(data[a], data[i]) < 0) { i++ } for i <= j && (cmp(data[a], data[j]) < 0) { j-- } if i > j { break } data[i], data[j] = data[j], data[i] i++ j-- } return i } // partialInsertionSortCmpFunc partially sorts a slice, returns true if the slice is sorted at the end. func partialInsertionSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) bool { const ( maxSteps = 5 // maximum number of adjacent out-of-order pairs that will get shifted shortestShifting = 50 // don't shift any elements on short arrays ) i := a + 1 for j := 0; j < maxSteps; j++ { for i < b && !(cmp(data[i], data[i-1]) < 0) { i++ } if i == b { return true } if b-a < shortestShifting { return false } data[i], data[i-1] = data[i-1], data[i] // Shift the smaller one to the left. if i-a >= 2 { for j := i - 1; j >= 1; j-- { if !(cmp(data[j], data[j-1]) < 0) { break } data[j], data[j-1] = data[j-1], data[j] } } // Shift the greater one to the right. if b-i >= 2 { for j := i + 1; j < b; j++ { if !(cmp(data[j], data[j-1]) < 0) { break } data[j], data[j-1] = data[j-1], data[j] } } } return false } // breakPatternsCmpFunc scatters some elements around in an attempt to break some patterns // that might cause imbalanced partitions in quicksort. func breakPatternsCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) { length := b - a if length >= 8 { random := xorshift(length) modulus := nextPowerOfTwo(length) for idx := a + (length/4)*2 - 1; idx <= a+(length/4)*2+1; idx++ { other := int(uint(random.Next()) & (modulus - 1)) if other >= length { other -= length } data[idx], data[a+other] = data[a+other], data[idx] } } } // choosePivotCmpFunc chooses a pivot in data[a:b]. // // [0,8): chooses a static pivot. // [8,shortestNinther): uses the simple median-of-three method. // [shortestNinther,∞): uses the Tukey ninther method. func choosePivotCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) (pivot int, hint sortedHint) { const ( shortestNinther = 50 maxSwaps = 4 * 3 ) l := b - a var ( swaps int i = a + l/4*1 j = a + l/4*2 k = a + l/4*3 ) if l >= 8 { if l >= shortestNinther { // Tukey ninther method, the idea came from Rust's implementation. i = medianAdjacentCmpFunc(data, i, &swaps, cmp) j = medianAdjacentCmpFunc(data, j, &swaps, cmp) k = medianAdjacentCmpFunc(data, k, &swaps, cmp) } // Find the median among i, j, k and stores it into j. j = medianCmpFunc(data, i, j, k, &swaps, cmp) } switch swaps { case 0: return j, increasingHint case maxSwaps: return j, decreasingHint default: return j, unknownHint } } // order2CmpFunc returns x,y where data[x] <= data[y], where x,y=a,b or x,y=b,a. func order2CmpFunc[E any](data []E, a, b int, swaps *int, cmp func(a, b E) int) (int, int) { if cmp(data[b], data[a]) < 0 { *swaps++ return b, a } return a, b } // medianCmpFunc returns x where data[x] is the median of data[a],data[b],data[c], where x is a, b, or c. func medianCmpFunc[E any](data []E, a, b, c int, swaps *int, cmp func(a, b E) int) int { a, b = order2CmpFunc(data, a, b, swaps, cmp) b, c = order2CmpFunc(data, b, c, swaps, cmp) a, b = order2CmpFunc(data, a, b, swaps, cmp) return b } // medianAdjacentCmpFunc finds the median of data[a - 1], data[a], data[a + 1] and stores the index into a. func medianAdjacentCmpFunc[E any](data []E, a int, swaps *int, cmp func(a, b E) int) int { return medianCmpFunc(data, a-1, a, a+1, swaps, cmp) } func reverseRangeCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) { i := a j := b - 1 for i < j { data[i], data[j] = data[j], data[i] i++ j-- } } func swapRangeCmpFunc[E any](data []E, a, b, n int, cmp func(a, b E) int) { for i := 0; i < n; i++ { data[a+i], data[b+i] = data[b+i], data[a+i] } } func stableCmpFunc[E any](data []E, n int, cmp func(a, b E) int) { blockSize := 20 // must be > 0 a, b := 0, blockSize for b <= n { insertionSortCmpFunc(data, a, b, cmp) a = b b += blockSize } insertionSortCmpFunc(data, a, n, cmp) for blockSize < n { a, b = 0, 2*blockSize for b <= n { symMergeCmpFunc(data, a, a+blockSize, b, cmp) a = b b += 2 * blockSize } if m := a + blockSize; m < n { symMergeCmpFunc(data, a, m, n, cmp) } blockSize *= 2 } } // symMergeCmpFunc merges the two sorted subsequences data[a:m] and data[m:b] using // the SymMerge algorithm from Pok-Son Kim and Arne Kutzner, "Stable Minimum // Storage Merging by Symmetric Comparisons", in Susanne Albers and Tomasz // Radzik, editors, Algorithms - ESA 2004, volume 3221 of Lecture Notes in // Computer Science, pages 714-723. Springer, 2004. // // Let M = m-a and N = b-n. Wolog M < N. // The recursion depth is bound by ceil(log(N+M)). // The algorithm needs O(M*log(N/M + 1)) calls to data.Less. // The algorithm needs O((M+N)*log(M)) calls to data.Swap. // // The paper gives O((M+N)*log(M)) as the number of assignments assuming a // rotation algorithm which uses O(M+N+gcd(M+N)) assignments. The argumentation // in the paper carries through for Swap operations, especially as the block // swapping rotate uses only O(M+N) Swaps. // // symMerge assumes non-degenerate arguments: a < m && m < b. // Having the caller check this condition eliminates many leaf recursion calls, // which improves performance. func symMergeCmpFunc[E any](data []E, a, m, b int, cmp func(a, b E) int) { // Avoid unnecessary recursions of symMerge // by direct insertion of data[a] into data[m:b] // if data[a:m] only contains one element. if m-a == 1 { // Use binary search to find the lowest index i // such that data[i] >= data[a] for m <= i < b. // Exit the search loop with i == b in case no such index exists. i := m j := b for i < j { h := int(uint(i+j) >> 1) if cmp(data[h], data[a]) < 0 { i = h + 1 } else { j = h } } // Swap values until data[a] reaches the position before i. for k := a; k < i-1; k++ { data[k], data[k+1] = data[k+1], data[k] } return } // Avoid unnecessary recursions of symMerge // by direct insertion of data[m] into data[a:m] // if data[m:b] only contains one element. if b-m == 1 { // Use binary search to find the lowest index i // such that data[i] > data[m] for a <= i < m. // Exit the search loop with i == m in case no such index exists. i := a j := m for i < j { h := int(uint(i+j) >> 1) if !(cmp(data[m], data[h]) < 0) { i = h + 1 } else { j = h } } // Swap values until data[m] reaches the position i. for k := m; k > i; k-- { data[k], data[k-1] = data[k-1], data[k] } return } mid := int(uint(a+b) >> 1) n := mid + m var start, r int if m > mid { start = n - b r = mid } else { start = a r = m } p := n - 1 for start < r { c := int(uint(start+r) >> 1) if !(cmp(data[p-c], data[c]) < 0) { start = c + 1 } else { r = c } } end := n - start if start < m && m < end { rotateCmpFunc(data, start, m, end, cmp) } if a < start && start < mid { symMergeCmpFunc(data, a, start, mid, cmp) } if mid < end && end < b { symMergeCmpFunc(data, mid, end, b, cmp) } } // rotateCmpFunc rotates two consecutive blocks u = data[a:m] and v = data[m:b] in data: // Data of the form 'x u v y' is changed to 'x v u y'. // rotate performs at most b-a many calls to data.Swap, // and it assumes non-degenerate arguments: a < m && m < b. func rotateCmpFunc[E any](data []E, a, m, b int, cmp func(a, b E) int) { i := m - a j := b - m for i != j { if i > j { swapRangeCmpFunc(data, m-i, m, j, cmp) i -= j } else { swapRangeCmpFunc(data, m-i, m+j-i, i, cmp) j -= i } } // i == j swapRangeCmpFunc(data, m-i, m, i, cmp) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/exp/slices/slices.go
vendor/golang.org/x/exp/slices/slices.go
// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package slices defines various functions useful with slices of any type. package slices import ( "unsafe" "golang.org/x/exp/constraints" ) // Equal reports whether two slices are equal: the same length and all // elements equal. If the lengths are different, Equal returns false. // Otherwise, the elements are compared in increasing index order, and the // comparison stops at the first unequal pair. // Floating point NaNs are not considered equal. func Equal[S ~[]E, E comparable](s1, s2 S) bool { if len(s1) != len(s2) { return false } for i := range s1 { if s1[i] != s2[i] { return false } } return true } // EqualFunc reports whether two slices are equal using an equality // function on each pair of elements. If the lengths are different, // EqualFunc returns false. Otherwise, the elements are compared in // increasing index order, and the comparison stops at the first index // for which eq returns false. func EqualFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, eq func(E1, E2) bool) bool { if len(s1) != len(s2) { return false } for i, v1 := range s1 { v2 := s2[i] if !eq(v1, v2) { return false } } return true } // Compare compares the elements of s1 and s2, using [cmp.Compare] on each pair // of elements. The elements are compared sequentially, starting at index 0, // until one element is not equal to the other. // The result of comparing the first non-matching elements is returned. // If both slices are equal until one of them ends, the shorter slice is // considered less than the longer one. // The result is 0 if s1 == s2, -1 if s1 < s2, and +1 if s1 > s2. func Compare[S ~[]E, E constraints.Ordered](s1, s2 S) int { for i, v1 := range s1 { if i >= len(s2) { return +1 } v2 := s2[i] if c := cmpCompare(v1, v2); c != 0 { return c } } if len(s1) < len(s2) { return -1 } return 0 } // CompareFunc is like [Compare] but uses a custom comparison function on each // pair of elements. // The result is the first non-zero result of cmp; if cmp always // returns 0 the result is 0 if len(s1) == len(s2), -1 if len(s1) < len(s2), // and +1 if len(s1) > len(s2). func CompareFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, cmp func(E1, E2) int) int { for i, v1 := range s1 { if i >= len(s2) { return +1 } v2 := s2[i] if c := cmp(v1, v2); c != 0 { return c } } if len(s1) < len(s2) { return -1 } return 0 } // Index returns the index of the first occurrence of v in s, // or -1 if not present. func Index[S ~[]E, E comparable](s S, v E) int { for i := range s { if v == s[i] { return i } } return -1 } // IndexFunc returns the first index i satisfying f(s[i]), // or -1 if none do. func IndexFunc[S ~[]E, E any](s S, f func(E) bool) int { for i := range s { if f(s[i]) { return i } } return -1 } // Contains reports whether v is present in s. func Contains[S ~[]E, E comparable](s S, v E) bool { return Index(s, v) >= 0 } // ContainsFunc reports whether at least one // element e of s satisfies f(e). func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool { return IndexFunc(s, f) >= 0 } // Insert inserts the values v... into s at index i, // returning the modified slice. // The elements at s[i:] are shifted up to make room. // In the returned slice r, r[i] == v[0], // and r[i+len(v)] == value originally at r[i]. // Insert panics if i is out of range. // This function is O(len(s) + len(v)). func Insert[S ~[]E, E any](s S, i int, v ...E) S { m := len(v) if m == 0 { return s } n := len(s) if i == n { return append(s, v...) } if n+m > cap(s) { // Use append rather than make so that we bump the size of // the slice up to the next storage class. // This is what Grow does but we don't call Grow because // that might copy the values twice. s2 := append(s[:i], make(S, n+m-i)...) copy(s2[i:], v) copy(s2[i+m:], s[i:]) return s2 } s = s[:n+m] // before: // s: aaaaaaaabbbbccccccccdddd // ^ ^ ^ ^ // i i+m n n+m // after: // s: aaaaaaaavvvvbbbbcccccccc // ^ ^ ^ ^ // i i+m n n+m // // a are the values that don't move in s. // v are the values copied in from v. // b and c are the values from s that are shifted up in index. // d are the values that get overwritten, never to be seen again. if !overlaps(v, s[i+m:]) { // Easy case - v does not overlap either the c or d regions. // (It might be in some of a or b, or elsewhere entirely.) // The data we copy up doesn't write to v at all, so just do it. copy(s[i+m:], s[i:]) // Now we have // s: aaaaaaaabbbbbbbbcccccccc // ^ ^ ^ ^ // i i+m n n+m // Note the b values are duplicated. copy(s[i:], v) // Now we have // s: aaaaaaaavvvvbbbbcccccccc // ^ ^ ^ ^ // i i+m n n+m // That's the result we want. return s } // The hard case - v overlaps c or d. We can't just shift up // the data because we'd move or clobber the values we're trying // to insert. // So instead, write v on top of d, then rotate. copy(s[n:], v) // Now we have // s: aaaaaaaabbbbccccccccvvvv // ^ ^ ^ ^ // i i+m n n+m rotateRight(s[i:], m) // Now we have // s: aaaaaaaavvvvbbbbcccccccc // ^ ^ ^ ^ // i i+m n n+m // That's the result we want. return s } // clearSlice sets all elements up to the length of s to the zero value of E. // We may use the builtin clear func instead, and remove clearSlice, when upgrading // to Go 1.21+. func clearSlice[S ~[]E, E any](s S) { var zero E for i := range s { s[i] = zero } } // Delete removes the elements s[i:j] from s, returning the modified slice. // Delete panics if j > len(s) or s[i:j] is not a valid slice of s. // Delete is O(len(s)-i), so if many items must be deleted, it is better to // make a single call deleting them all together than to delete one at a time. // Delete zeroes the elements s[len(s)-(j-i):len(s)]. func Delete[S ~[]E, E any](s S, i, j int) S { _ = s[i:j:len(s)] // bounds check if i == j { return s } oldlen := len(s) s = append(s[:i], s[j:]...) clearSlice(s[len(s):oldlen]) // zero/nil out the obsolete elements, for GC return s } // DeleteFunc removes any elements from s for which del returns true, // returning the modified slice. // DeleteFunc zeroes the elements between the new length and the original length. func DeleteFunc[S ~[]E, E any](s S, del func(E) bool) S { i := IndexFunc(s, del) if i == -1 { return s } // Don't start copying elements until we find one to delete. for j := i + 1; j < len(s); j++ { if v := s[j]; !del(v) { s[i] = v i++ } } clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC return s[:i] } // Replace replaces the elements s[i:j] by the given v, and returns the // modified slice. Replace panics if s[i:j] is not a valid slice of s. // When len(v) < (j-i), Replace zeroes the elements between the new length and the original length. func Replace[S ~[]E, E any](s S, i, j int, v ...E) S { _ = s[i:j] // verify that i:j is a valid subslice if i == j { return Insert(s, i, v...) } if j == len(s) { return append(s[:i], v...) } tot := len(s[:i]) + len(v) + len(s[j:]) if tot > cap(s) { // Too big to fit, allocate and copy over. s2 := append(s[:i], make(S, tot-i)...) // See Insert copy(s2[i:], v) copy(s2[i+len(v):], s[j:]) return s2 } r := s[:tot] if i+len(v) <= j { // Easy, as v fits in the deleted portion. copy(r[i:], v) if i+len(v) != j { copy(r[i+len(v):], s[j:]) } clearSlice(s[tot:]) // zero/nil out the obsolete elements, for GC return r } // We are expanding (v is bigger than j-i). // The situation is something like this: // (example has i=4,j=8,len(s)=16,len(v)=6) // s: aaaaxxxxbbbbbbbbyy // ^ ^ ^ ^ // i j len(s) tot // a: prefix of s // x: deleted range // b: more of s // y: area to expand into if !overlaps(r[i+len(v):], v) { // Easy, as v is not clobbered by the first copy. copy(r[i+len(v):], s[j:]) copy(r[i:], v) return r } // This is a situation where we don't have a single place to which // we can copy v. Parts of it need to go to two different places. // We want to copy the prefix of v into y and the suffix into x, then // rotate |y| spots to the right. // // v[2:] v[:2] // | | // s: aaaavvvvbbbbbbbbvv // ^ ^ ^ ^ // i j len(s) tot // // If either of those two destinations don't alias v, then we're good. y := len(v) - (j - i) // length of y portion if !overlaps(r[i:j], v) { copy(r[i:j], v[y:]) copy(r[len(s):], v[:y]) rotateRight(r[i:], y) return r } if !overlaps(r[len(s):], v) { copy(r[len(s):], v[:y]) copy(r[i:j], v[y:]) rotateRight(r[i:], y) return r } // Now we know that v overlaps both x and y. // That means that the entirety of b is *inside* v. // So we don't need to preserve b at all; instead we // can copy v first, then copy the b part of v out of // v to the right destination. k := startIdx(v, s[j:]) copy(r[i:], v) copy(r[i+len(v):], r[i+k:]) return r } // Clone returns a copy of the slice. // The elements are copied using assignment, so this is a shallow clone. func Clone[S ~[]E, E any](s S) S { // Preserve nil in case it matters. if s == nil { return nil } return append(S([]E{}), s...) } // Compact replaces consecutive runs of equal elements with a single copy. // This is like the uniq command found on Unix. // Compact modifies the contents of the slice s and returns the modified slice, // which may have a smaller length. // Compact zeroes the elements between the new length and the original length. func Compact[S ~[]E, E comparable](s S) S { if len(s) < 2 { return s } i := 1 for k := 1; k < len(s); k++ { if s[k] != s[k-1] { if i != k { s[i] = s[k] } i++ } } clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC return s[:i] } // CompactFunc is like [Compact] but uses an equality function to compare elements. // For runs of elements that compare equal, CompactFunc keeps the first one. // CompactFunc zeroes the elements between the new length and the original length. func CompactFunc[S ~[]E, E any](s S, eq func(E, E) bool) S { if len(s) < 2 { return s } i := 1 for k := 1; k < len(s); k++ { if !eq(s[k], s[k-1]) { if i != k { s[i] = s[k] } i++ } } clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC return s[:i] } // Grow increases the slice's capacity, if necessary, to guarantee space for // another n elements. After Grow(n), at least n elements can be appended // to the slice without another allocation. If n is negative or too large to // allocate the memory, Grow panics. func Grow[S ~[]E, E any](s S, n int) S { if n < 0 { panic("cannot be negative") } if n -= cap(s) - len(s); n > 0 { // TODO(https://go.dev/issue/53888): Make using []E instead of S // to workaround a compiler bug where the runtime.growslice optimization // does not take effect. Revert when the compiler is fixed. s = append([]E(s)[:cap(s)], make([]E, n)...)[:len(s)] } return s } // Clip removes unused capacity from the slice, returning s[:len(s):len(s)]. func Clip[S ~[]E, E any](s S) S { return s[:len(s):len(s)] } // Rotation algorithm explanation: // // rotate left by 2 // start with // 0123456789 // split up like this // 01 234567 89 // swap first 2 and last 2 // 89 234567 01 // join first parts // 89234567 01 // recursively rotate first left part by 2 // 23456789 01 // join at the end // 2345678901 // // rotate left by 8 // start with // 0123456789 // split up like this // 01 234567 89 // swap first 2 and last 2 // 89 234567 01 // join last parts // 89 23456701 // recursively rotate second part left by 6 // 89 01234567 // join at the end // 8901234567 // TODO: There are other rotate algorithms. // This algorithm has the desirable property that it moves each element exactly twice. // The triple-reverse algorithm is simpler and more cache friendly, but takes more writes. // The follow-cycles algorithm can be 1-write but it is not very cache friendly. // rotateLeft rotates b left by n spaces. // s_final[i] = s_orig[i+r], wrapping around. func rotateLeft[E any](s []E, r int) { for r != 0 && r != len(s) { if r*2 <= len(s) { swap(s[:r], s[len(s)-r:]) s = s[:len(s)-r] } else { swap(s[:len(s)-r], s[r:]) s, r = s[len(s)-r:], r*2-len(s) } } } func rotateRight[E any](s []E, r int) { rotateLeft(s, len(s)-r) } // swap swaps the contents of x and y. x and y must be equal length and disjoint. func swap[E any](x, y []E) { for i := 0; i < len(x); i++ { x[i], y[i] = y[i], x[i] } } // overlaps reports whether the memory ranges a[0:len(a)] and b[0:len(b)] overlap. func overlaps[E any](a, b []E) bool { if len(a) == 0 || len(b) == 0 { return false } elemSize := unsafe.Sizeof(a[0]) if elemSize == 0 { return false } // TODO: use a runtime/unsafe facility once one becomes available. See issue 12445. // Also see crypto/internal/alias/alias.go:AnyOverlap return uintptr(unsafe.Pointer(&a[0])) <= uintptr(unsafe.Pointer(&b[len(b)-1]))+(elemSize-1) && uintptr(unsafe.Pointer(&b[0])) <= uintptr(unsafe.Pointer(&a[len(a)-1]))+(elemSize-1) } // startIdx returns the index in haystack where the needle starts. // prerequisite: the needle must be aliased entirely inside the haystack. func startIdx[E any](haystack, needle []E) int { p := &needle[0] for i := range haystack { if p == &haystack[i] { return i } } // TODO: what if the overlap is by a non-integral number of Es? panic("needle not found") } // Reverse reverses the elements of the slice in place. func Reverse[S ~[]E, E any](s S) { for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { s[i], s[j] = s[j], s[i] } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/exp/slices/cmp.go
vendor/golang.org/x/exp/slices/cmp.go
// Copyright 2023 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package slices import "golang.org/x/exp/constraints" // min is a version of the predeclared function from the Go 1.21 release. func min[T constraints.Ordered](a, b T) T { if a < b || isNaN(a) { return a } return b } // max is a version of the predeclared function from the Go 1.21 release. func max[T constraints.Ordered](a, b T) T { if a > b || isNaN(a) { return a } return b } // cmpLess is a copy of cmp.Less from the Go 1.21 release. func cmpLess[T constraints.Ordered](x, y T) bool { return (isNaN(x) && !isNaN(y)) || x < y } // cmpCompare is a copy of cmp.Compare from the Go 1.21 release. func cmpCompare[T constraints.Ordered](x, y T) int { xNaN := isNaN(x) yNaN := isNaN(y) if xNaN && yNaN { return 0 } if xNaN || x < y { return -1 } if yNaN || x > y { return +1 } return 0 }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/exp/constraints/constraints.go
vendor/golang.org/x/exp/constraints/constraints.go
// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package constraints defines a set of useful constraints to be used // with type parameters. package constraints // Signed is a constraint that permits any signed integer type. // If future releases of Go add new predeclared signed integer types, // this constraint will be modified to include them. type Signed interface { ~int | ~int8 | ~int16 | ~int32 | ~int64 } // Unsigned is a constraint that permits any unsigned integer type. // If future releases of Go add new predeclared unsigned integer types, // this constraint will be modified to include them. type Unsigned interface { ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr } // Integer is a constraint that permits any integer type. // If future releases of Go add new predeclared integer types, // this constraint will be modified to include them. type Integer interface { Signed | Unsigned } // Float is a constraint that permits any floating-point type. // If future releases of Go add new predeclared floating-point types, // this constraint will be modified to include them. type Float interface { ~float32 | ~float64 } // Complex is a constraint that permits any complex numeric type. // If future releases of Go add new predeclared complex numeric types, // this constraint will be modified to include them. type Complex interface { ~complex64 | ~complex128 } // Ordered is a constraint that permits any ordered type: any type // that supports the operators < <= >= >. // If future releases of Go add new ordered types, // this constraint will be modified to include them. type Ordered interface { Integer | Float | ~string }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/net/proxy/proxy.go
vendor/golang.org/x/net/proxy/proxy.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package proxy provides support for a variety of protocols to proxy network // data. package proxy // import "golang.org/x/net/proxy" import ( "errors" "net" "net/url" "os" "sync" ) // A Dialer is a means to establish a connection. // Custom dialers should also implement ContextDialer. type Dialer interface { // Dial connects to the given address via the proxy. Dial(network, addr string) (c net.Conn, err error) } // Auth contains authentication parameters that specific Dialers may require. type Auth struct { User, Password string } // FromEnvironment returns the dialer specified by the proxy-related // variables in the environment and makes underlying connections // directly. func FromEnvironment() Dialer { return FromEnvironmentUsing(Direct) } // FromEnvironmentUsing returns the dialer specify by the proxy-related // variables in the environment and makes underlying connections // using the provided forwarding Dialer (for instance, a *net.Dialer // with desired configuration). func FromEnvironmentUsing(forward Dialer) Dialer { allProxy := allProxyEnv.Get() if len(allProxy) == 0 { return forward } proxyURL, err := url.Parse(allProxy) if err != nil { return forward } proxy, err := FromURL(proxyURL, forward) if err != nil { return forward } noProxy := noProxyEnv.Get() if len(noProxy) == 0 { return proxy } perHost := NewPerHost(proxy, forward) perHost.AddFromString(noProxy) return perHost } // proxySchemes is a map from URL schemes to a function that creates a Dialer // from a URL with such a scheme. var proxySchemes map[string]func(*url.URL, Dialer) (Dialer, error) // RegisterDialerType takes a URL scheme and a function to generate Dialers from // a URL with that scheme and a forwarding Dialer. Registered schemes are used // by FromURL. func RegisterDialerType(scheme string, f func(*url.URL, Dialer) (Dialer, error)) { if proxySchemes == nil { proxySchemes = make(map[string]func(*url.URL, Dialer) (Dialer, error)) } proxySchemes[scheme] = f } // FromURL returns a Dialer given a URL specification and an underlying // Dialer for it to make network requests. func FromURL(u *url.URL, forward Dialer) (Dialer, error) { var auth *Auth if u.User != nil { auth = new(Auth) auth.User = u.User.Username() if p, ok := u.User.Password(); ok { auth.Password = p } } switch u.Scheme { case "socks5", "socks5h": addr := u.Hostname() port := u.Port() if port == "" { port = "1080" } return SOCKS5("tcp", net.JoinHostPort(addr, port), auth, forward) } // If the scheme doesn't match any of the built-in schemes, see if it // was registered by another package. if proxySchemes != nil { if f, ok := proxySchemes[u.Scheme]; ok { return f(u, forward) } } return nil, errors.New("proxy: unknown scheme: " + u.Scheme) } var ( allProxyEnv = &envOnce{ names: []string{"ALL_PROXY", "all_proxy"}, } noProxyEnv = &envOnce{ names: []string{"NO_PROXY", "no_proxy"}, } ) // envOnce looks up an environment variable (optionally by multiple // names) once. It mitigates expensive lookups on some platforms // (e.g. Windows). // (Borrowed from net/http/transport.go) type envOnce struct { names []string once sync.Once val string } func (e *envOnce) Get() string { e.once.Do(e.init) return e.val } func (e *envOnce) init() { for _, n := range e.names { e.val = os.Getenv(n) if e.val != "" { return } } } // reset is used by tests func (e *envOnce) reset() { e.once = sync.Once{} e.val = "" }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/net/proxy/per_host.go
vendor/golang.org/x/net/proxy/per_host.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package proxy import ( "context" "net" "net/netip" "strings" ) // A PerHost directs connections to a default Dialer unless the host name // requested matches one of a number of exceptions. type PerHost struct { def, bypass Dialer bypassNetworks []*net.IPNet bypassIPs []net.IP bypassZones []string bypassHosts []string } // NewPerHost returns a PerHost Dialer that directs connections to either // defaultDialer or bypass, depending on whether the connection matches one of // the configured rules. func NewPerHost(defaultDialer, bypass Dialer) *PerHost { return &PerHost{ def: defaultDialer, bypass: bypass, } } // Dial connects to the address addr on the given network through either // defaultDialer or bypass. func (p *PerHost) Dial(network, addr string) (c net.Conn, err error) { host, _, err := net.SplitHostPort(addr) if err != nil { return nil, err } return p.dialerForRequest(host).Dial(network, addr) } // DialContext connects to the address addr on the given network through either // defaultDialer or bypass. func (p *PerHost) DialContext(ctx context.Context, network, addr string) (c net.Conn, err error) { host, _, err := net.SplitHostPort(addr) if err != nil { return nil, err } d := p.dialerForRequest(host) if x, ok := d.(ContextDialer); ok { return x.DialContext(ctx, network, addr) } return dialContext(ctx, d, network, addr) } func (p *PerHost) dialerForRequest(host string) Dialer { if nip, err := netip.ParseAddr(host); err == nil { ip := net.IP(nip.AsSlice()) for _, net := range p.bypassNetworks { if net.Contains(ip) { return p.bypass } } for _, bypassIP := range p.bypassIPs { if bypassIP.Equal(ip) { return p.bypass } } return p.def } for _, zone := range p.bypassZones { if strings.HasSuffix(host, zone) { return p.bypass } if host == zone[1:] { // For a zone ".example.com", we match "example.com" // too. return p.bypass } } for _, bypassHost := range p.bypassHosts { if bypassHost == host { return p.bypass } } return p.def } // AddFromString parses a string that contains comma-separated values // specifying hosts that should use the bypass proxy. Each value is either an // IP address, a CIDR range, a zone (*.example.com) or a host name // (localhost). A best effort is made to parse the string and errors are // ignored. func (p *PerHost) AddFromString(s string) { hosts := strings.Split(s, ",") for _, host := range hosts { host = strings.TrimSpace(host) if len(host) == 0 { continue } if strings.Contains(host, "/") { // We assume that it's a CIDR address like 127.0.0.0/8 if _, net, err := net.ParseCIDR(host); err == nil { p.AddNetwork(net) } continue } if nip, err := netip.ParseAddr(host); err == nil { p.AddIP(net.IP(nip.AsSlice())) continue } if strings.HasPrefix(host, "*.") { p.AddZone(host[1:]) continue } p.AddHost(host) } } // AddIP specifies an IP address that will use the bypass proxy. Note that // this will only take effect if a literal IP address is dialed. A connection // to a named host will never match an IP. func (p *PerHost) AddIP(ip net.IP) { p.bypassIPs = append(p.bypassIPs, ip) } // AddNetwork specifies an IP range that will use the bypass proxy. Note that // this will only take effect if a literal IP address is dialed. A connection // to a named host will never match. func (p *PerHost) AddNetwork(net *net.IPNet) { p.bypassNetworks = append(p.bypassNetworks, net) } // AddZone specifies a DNS suffix that will use the bypass proxy. A zone of // "example.com" matches "example.com" and all of its subdomains. func (p *PerHost) AddZone(zone string) { zone = strings.TrimSuffix(zone, ".") if !strings.HasPrefix(zone, ".") { zone = "." + zone } p.bypassZones = append(p.bypassZones, zone) } // AddHost specifies a host name that will use the bypass proxy. func (p *PerHost) AddHost(host string) { host = strings.TrimSuffix(host, ".") p.bypassHosts = append(p.bypassHosts, host) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/net/proxy/socks5.go
vendor/golang.org/x/net/proxy/socks5.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package proxy import ( "context" "net" "golang.org/x/net/internal/socks" ) // SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given // address with an optional username and password. // See RFC 1928 and RFC 1929. func SOCKS5(network, address string, auth *Auth, forward Dialer) (Dialer, error) { d := socks.NewDialer(network, address) if forward != nil { if f, ok := forward.(ContextDialer); ok { d.ProxyDial = func(ctx context.Context, network string, address string) (net.Conn, error) { return f.DialContext(ctx, network, address) } } else { d.ProxyDial = func(ctx context.Context, network string, address string) (net.Conn, error) { return dialContext(ctx, forward, network, address) } } } if auth != nil { up := socks.UsernamePassword{ Username: auth.User, Password: auth.Password, } d.AuthMethods = []socks.AuthMethod{ socks.AuthMethodNotRequired, socks.AuthMethodUsernamePassword, } d.Authenticate = up.Authenticate } return d, nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/net/proxy/direct.go
vendor/golang.org/x/net/proxy/direct.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package proxy import ( "context" "net" ) type direct struct{} // Direct implements Dialer by making network connections directly using net.Dial or net.DialContext. var Direct = direct{} var ( _ Dialer = Direct _ ContextDialer = Direct ) // Dial directly invokes net.Dial with the supplied parameters. func (direct) Dial(network, addr string) (net.Conn, error) { return net.Dial(network, addr) } // DialContext instantiates a net.Dialer and invokes its DialContext receiver with the supplied parameters. func (direct) DialContext(ctx context.Context, network, addr string) (net.Conn, error) { var d net.Dialer return d.DialContext(ctx, network, addr) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/net/proxy/dial.go
vendor/golang.org/x/net/proxy/dial.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package proxy import ( "context" "net" ) // A ContextDialer dials using a context. type ContextDialer interface { DialContext(ctx context.Context, network, address string) (net.Conn, error) } // Dial works like DialContext on net.Dialer but using a dialer returned by FromEnvironment. // // The passed ctx is only used for returning the Conn, not the lifetime of the Conn. // // Custom dialers (registered via RegisterDialerType) that do not implement ContextDialer // can leak a goroutine for as long as it takes the underlying Dialer implementation to timeout. // // A Conn returned from a successful Dial after the context has been cancelled will be immediately closed. func Dial(ctx context.Context, network, address string) (net.Conn, error) { d := FromEnvironment() if xd, ok := d.(ContextDialer); ok { return xd.DialContext(ctx, network, address) } return dialContext(ctx, d, network, address) } // WARNING: this can leak a goroutine for as long as the underlying Dialer implementation takes to timeout // A Conn returned from a successful Dial after the context has been cancelled will be immediately closed. func dialContext(ctx context.Context, d Dialer, network, address string) (net.Conn, error) { var ( conn net.Conn done = make(chan struct{}, 1) err error ) go func() { conn, err = d.Dial(network, address) close(done) if conn != nil && ctx.Err() != nil { conn.Close() } }() select { case <-ctx.Done(): err = ctx.Err() case <-done: } return conn, err }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/net/internal/socks/socks.go
vendor/golang.org/x/net/internal/socks/socks.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package socks provides a SOCKS version 5 client implementation. // // SOCKS protocol version 5 is defined in RFC 1928. // Username/Password authentication for SOCKS version 5 is defined in // RFC 1929. package socks import ( "context" "errors" "io" "net" "strconv" ) // A Command represents a SOCKS command. type Command int func (cmd Command) String() string { switch cmd { case CmdConnect: return "socks connect" case cmdBind: return "socks bind" default: return "socks " + strconv.Itoa(int(cmd)) } } // An AuthMethod represents a SOCKS authentication method. type AuthMethod int // A Reply represents a SOCKS command reply code. type Reply int func (code Reply) String() string { switch code { case StatusSucceeded: return "succeeded" case 0x01: return "general SOCKS server failure" case 0x02: return "connection not allowed by ruleset" case 0x03: return "network unreachable" case 0x04: return "host unreachable" case 0x05: return "connection refused" case 0x06: return "TTL expired" case 0x07: return "command not supported" case 0x08: return "address type not supported" default: return "unknown code: " + strconv.Itoa(int(code)) } } // Wire protocol constants. const ( Version5 = 0x05 AddrTypeIPv4 = 0x01 AddrTypeFQDN = 0x03 AddrTypeIPv6 = 0x04 CmdConnect Command = 0x01 // establishes an active-open forward proxy connection cmdBind Command = 0x02 // establishes a passive-open forward proxy connection AuthMethodNotRequired AuthMethod = 0x00 // no authentication required AuthMethodUsernamePassword AuthMethod = 0x02 // use username/password AuthMethodNoAcceptableMethods AuthMethod = 0xff // no acceptable authentication methods StatusSucceeded Reply = 0x00 ) // An Addr represents a SOCKS-specific address. // Either Name or IP is used exclusively. type Addr struct { Name string // fully-qualified domain name IP net.IP Port int } func (a *Addr) Network() string { return "socks" } func (a *Addr) String() string { if a == nil { return "<nil>" } port := strconv.Itoa(a.Port) if a.IP == nil { return net.JoinHostPort(a.Name, port) } return net.JoinHostPort(a.IP.String(), port) } // A Conn represents a forward proxy connection. type Conn struct { net.Conn boundAddr net.Addr } // BoundAddr returns the address assigned by the proxy server for // connecting to the command target address from the proxy server. func (c *Conn) BoundAddr() net.Addr { if c == nil { return nil } return c.boundAddr } // A Dialer holds SOCKS-specific options. type Dialer struct { cmd Command // either CmdConnect or cmdBind proxyNetwork string // network between a proxy server and a client proxyAddress string // proxy server address // ProxyDial specifies the optional dial function for // establishing the transport connection. ProxyDial func(context.Context, string, string) (net.Conn, error) // AuthMethods specifies the list of request authentication // methods. // If empty, SOCKS client requests only AuthMethodNotRequired. AuthMethods []AuthMethod // Authenticate specifies the optional authentication // function. It must be non-nil when AuthMethods is not empty. // It must return an error when the authentication is failed. Authenticate func(context.Context, io.ReadWriter, AuthMethod) error } // DialContext connects to the provided address on the provided // network. // // The returned error value may be a net.OpError. When the Op field of // net.OpError contains "socks", the Source field contains a proxy // server address and the Addr field contains a command target // address. // // See func Dial of the net package of standard library for a // description of the network and address parameters. func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) { if err := d.validateTarget(network, address); err != nil { proxy, dst, _ := d.pathAddrs(address) return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} } if ctx == nil { proxy, dst, _ := d.pathAddrs(address) return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: errors.New("nil context")} } var err error var c net.Conn if d.ProxyDial != nil { c, err = d.ProxyDial(ctx, d.proxyNetwork, d.proxyAddress) } else { var dd net.Dialer c, err = dd.DialContext(ctx, d.proxyNetwork, d.proxyAddress) } if err != nil { proxy, dst, _ := d.pathAddrs(address) return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} } a, err := d.connect(ctx, c, address) if err != nil { c.Close() proxy, dst, _ := d.pathAddrs(address) return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} } return &Conn{Conn: c, boundAddr: a}, nil } // DialWithConn initiates a connection from SOCKS server to the target // network and address using the connection c that is already // connected to the SOCKS server. // // It returns the connection's local address assigned by the SOCKS // server. func (d *Dialer) DialWithConn(ctx context.Context, c net.Conn, network, address string) (net.Addr, error) { if err := d.validateTarget(network, address); err != nil { proxy, dst, _ := d.pathAddrs(address) return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} } if ctx == nil { proxy, dst, _ := d.pathAddrs(address) return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: errors.New("nil context")} } a, err := d.connect(ctx, c, address) if err != nil { proxy, dst, _ := d.pathAddrs(address) return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} } return a, nil } // Dial connects to the provided address on the provided network. // // Unlike DialContext, it returns a raw transport connection instead // of a forward proxy connection. // // Deprecated: Use DialContext or DialWithConn instead. func (d *Dialer) Dial(network, address string) (net.Conn, error) { if err := d.validateTarget(network, address); err != nil { proxy, dst, _ := d.pathAddrs(address) return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} } var err error var c net.Conn if d.ProxyDial != nil { c, err = d.ProxyDial(context.Background(), d.proxyNetwork, d.proxyAddress) } else { c, err = net.Dial(d.proxyNetwork, d.proxyAddress) } if err != nil { proxy, dst, _ := d.pathAddrs(address) return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} } if _, err := d.DialWithConn(context.Background(), c, network, address); err != nil { c.Close() return nil, err } return c, nil } func (d *Dialer) validateTarget(network, address string) error { switch network { case "tcp", "tcp6", "tcp4": default: return errors.New("network not implemented") } switch d.cmd { case CmdConnect, cmdBind: default: return errors.New("command not implemented") } return nil } func (d *Dialer) pathAddrs(address string) (proxy, dst net.Addr, err error) { for i, s := range []string{d.proxyAddress, address} { host, port, err := splitHostPort(s) if err != nil { return nil, nil, err } a := &Addr{Port: port} a.IP = net.ParseIP(host) if a.IP == nil { a.Name = host } if i == 0 { proxy = a } else { dst = a } } return } // NewDialer returns a new Dialer that dials through the provided // proxy server's network and address. func NewDialer(network, address string) *Dialer { return &Dialer{proxyNetwork: network, proxyAddress: address, cmd: CmdConnect} } const ( authUsernamePasswordVersion = 0x01 authStatusSucceeded = 0x00 ) // UsernamePassword are the credentials for the username/password // authentication method. type UsernamePassword struct { Username string Password string } // Authenticate authenticates a pair of username and password with the // proxy server. func (up *UsernamePassword) Authenticate(ctx context.Context, rw io.ReadWriter, auth AuthMethod) error { switch auth { case AuthMethodNotRequired: return nil case AuthMethodUsernamePassword: if len(up.Username) == 0 || len(up.Username) > 255 || len(up.Password) > 255 { return errors.New("invalid username/password") } b := []byte{authUsernamePasswordVersion} b = append(b, byte(len(up.Username))) b = append(b, up.Username...) b = append(b, byte(len(up.Password))) b = append(b, up.Password...) // TODO(mikio): handle IO deadlines and cancellation if // necessary if _, err := rw.Write(b); err != nil { return err } if _, err := io.ReadFull(rw, b[:2]); err != nil { return err } if b[0] != authUsernamePasswordVersion { return errors.New("invalid username/password version") } if b[1] != authStatusSucceeded { return errors.New("username/password authentication failed") } return nil } return errors.New("unsupported authentication method " + strconv.Itoa(int(auth))) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/net/internal/socks/client.go
vendor/golang.org/x/net/internal/socks/client.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package socks import ( "context" "errors" "io" "net" "strconv" "time" ) var ( noDeadline = time.Time{} aLongTimeAgo = time.Unix(1, 0) ) func (d *Dialer) connect(ctx context.Context, c net.Conn, address string) (_ net.Addr, ctxErr error) { host, port, err := splitHostPort(address) if err != nil { return nil, err } if deadline, ok := ctx.Deadline(); ok && !deadline.IsZero() { c.SetDeadline(deadline) defer c.SetDeadline(noDeadline) } if ctx != context.Background() { errCh := make(chan error, 1) done := make(chan struct{}) defer func() { close(done) if ctxErr == nil { ctxErr = <-errCh } }() go func() { select { case <-ctx.Done(): c.SetDeadline(aLongTimeAgo) errCh <- ctx.Err() case <-done: errCh <- nil } }() } b := make([]byte, 0, 6+len(host)) // the size here is just an estimate b = append(b, Version5) if len(d.AuthMethods) == 0 || d.Authenticate == nil { b = append(b, 1, byte(AuthMethodNotRequired)) } else { ams := d.AuthMethods if len(ams) > 255 { return nil, errors.New("too many authentication methods") } b = append(b, byte(len(ams))) for _, am := range ams { b = append(b, byte(am)) } } if _, ctxErr = c.Write(b); ctxErr != nil { return } if _, ctxErr = io.ReadFull(c, b[:2]); ctxErr != nil { return } if b[0] != Version5 { return nil, errors.New("unexpected protocol version " + strconv.Itoa(int(b[0]))) } am := AuthMethod(b[1]) if am == AuthMethodNoAcceptableMethods { return nil, errors.New("no acceptable authentication methods") } if d.Authenticate != nil { if ctxErr = d.Authenticate(ctx, c, am); ctxErr != nil { return } } b = b[:0] b = append(b, Version5, byte(d.cmd), 0) if ip := net.ParseIP(host); ip != nil { if ip4 := ip.To4(); ip4 != nil { b = append(b, AddrTypeIPv4) b = append(b, ip4...) } else if ip6 := ip.To16(); ip6 != nil { b = append(b, AddrTypeIPv6) b = append(b, ip6...) } else { return nil, errors.New("unknown address type") } } else { if len(host) > 255 { return nil, errors.New("FQDN too long") } b = append(b, AddrTypeFQDN) b = append(b, byte(len(host))) b = append(b, host...) } b = append(b, byte(port>>8), byte(port)) if _, ctxErr = c.Write(b); ctxErr != nil { return } if _, ctxErr = io.ReadFull(c, b[:4]); ctxErr != nil { return } if b[0] != Version5 { return nil, errors.New("unexpected protocol version " + strconv.Itoa(int(b[0]))) } if cmdErr := Reply(b[1]); cmdErr != StatusSucceeded { return nil, errors.New("unknown error " + cmdErr.String()) } if b[2] != 0 { return nil, errors.New("non-zero reserved field") } l := 2 var a Addr switch b[3] { case AddrTypeIPv4: l += net.IPv4len a.IP = make(net.IP, net.IPv4len) case AddrTypeIPv6: l += net.IPv6len a.IP = make(net.IP, net.IPv6len) case AddrTypeFQDN: if _, err := io.ReadFull(c, b[:1]); err != nil { return nil, err } l += int(b[0]) default: return nil, errors.New("unknown address type " + strconv.Itoa(int(b[3]))) } if cap(b) < l { b = make([]byte, l) } else { b = b[:l] } if _, ctxErr = io.ReadFull(c, b); ctxErr != nil { return } if a.IP != nil { copy(a.IP, b) } else { a.Name = string(b[:len(b)-2]) } a.Port = int(b[len(b)-2])<<8 | int(b[len(b)-1]) return &a, nil } func splitHostPort(address string) (string, int, error) { host, port, err := net.SplitHostPort(address) if err != nil { return "", 0, err } portnum, err := strconv.Atoi(port) if err != nil { return "", 0, err } if 1 > portnum || portnum > 0xffff { return "", 0, errors.New("port number out of range " + port) } return host, portnum, nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/net/context/context.go
vendor/golang.org/x/net/context/context.go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package context has been superseded by the standard library [context] package. // // Deprecated: Use the standard library context package instead. package context import ( "context" // standard library's context, as of Go 1.7 "time" ) // A Context carries a deadline, a cancellation signal, and other values across // API boundaries. // // Context's methods may be called by multiple goroutines simultaneously. // //go:fix inline type Context = context.Context // Canceled is the error returned by [Context.Err] when the context is canceled // for some reason other than its deadline passing. // //go:fix inline var Canceled = context.Canceled // DeadlineExceeded is the error returned by [Context.Err] when the context is canceled // due to its deadline passing. // //go:fix inline var DeadlineExceeded = context.DeadlineExceeded // 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 // requests. // //go:fix inline func Background() Context { return context.Background() } // TODO returns a non-nil, empty Context. Code should use context.TODO when // it's unclear which Context to use or it is not yet available (because the // surrounding function has not yet been extended to accept a Context // parameter). // //go:fix inline func TODO() Context { return context.TODO() } // A CancelFunc tells an operation to abandon its work. // A CancelFunc does not wait for the work to stop. // A CancelFunc may be called by multiple goroutines simultaneously. // After the first call, subsequent calls to a CancelFunc do nothing. type CancelFunc = context.CancelFunc // WithCancel returns a derived context that points to the parent context // but has a new Done channel. The returned context's Done channel is closed // when the returned cancel function is called or when the parent context's // Done channel is closed, whichever happens first. // // Canceling this context releases resources associated with it, so code should // call cancel as soon as the operations running in this [Context] complete. // //go:fix inline func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { return context.WithCancel(parent) } // WithDeadline returns a derived context that points to the parent context // but has the deadline adjusted to be no later than d. If the parent's // deadline is already earlier than d, WithDeadline(parent, d) is semantically // equivalent to parent. The returned [Context.Done] channel is closed when // the deadline expires, when the returned cancel function is called, // or when the parent context's Done channel is closed, whichever happens first. // // Canceling this context releases resources associated with it, so code should // call cancel as soon as the operations running in this [Context] complete. // //go:fix inline func WithDeadline(parent Context, d time.Time) (Context, CancelFunc) { return context.WithDeadline(parent, d) } // WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). // // Canceling this context releases resources associated with it, so code should // call cancel as soon as the operations running in this [Context] complete: // // func slowOperationWithTimeout(ctx context.Context) (Result, error) { // ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) // defer cancel() // releases resources if slowOperation completes before timeout elapses // return slowOperation(ctx) // } // //go:fix inline func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { return context.WithTimeout(parent, timeout) } // WithValue returns a derived context that points to the parent Context. // In the derived context, the value associated with key is val. // // Use context Values only for request-scoped data that transits processes and // APIs, not for passing optional parameters to functions. // // The provided key must be comparable and should not be of type // string or any other built-in type to avoid collisions between // packages using context. Users of WithValue should define their own // types for keys. To avoid allocating when assigning to an // interface{}, context keys often have concrete type // struct{}. Alternatively, exported context key variables' static // type should be a pointer or interface. // //go:fix inline func WithValue(parent Context, key, val interface{}) Context { return context.WithValue(parent, key, val) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/term/term_plan9.go
vendor/golang.org/x/term/term_plan9.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package term import ( "fmt" "runtime" "golang.org/x/sys/plan9" ) type state struct{} func isTerminal(fd int) bool { path, err := plan9.Fd2path(fd) if err != nil { return false } return path == "/dev/cons" || path == "/mnt/term/dev/cons" } func makeRaw(fd int) (*State, error) { return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) } func getState(fd int) (*State, error) { return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) } func restore(fd int, state *State) error { return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) } func getSize(fd int) (width, height int, err error) { return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) } func readPassword(fd int) ([]byte, error) { return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/term/term_windows.go
vendor/golang.org/x/term/term_windows.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package term import ( "os" "golang.org/x/sys/windows" ) type state struct { mode uint32 } func isTerminal(fd int) bool { var st uint32 err := windows.GetConsoleMode(windows.Handle(fd), &st) return err == nil } // This is intended to be used on a console input handle. // See https://learn.microsoft.com/en-us/windows/console/setconsolemode func makeRaw(fd int) (*State, error) { var st uint32 if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil { return nil, err } raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT) raw |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil { return nil, err } return &State{state{st}}, nil } func getState(fd int) (*State, error) { var st uint32 if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil { return nil, err } return &State{state{st}}, nil } func restore(fd int, state *State) error { return windows.SetConsoleMode(windows.Handle(fd), state.mode) } func getSize(fd int) (width, height int, err error) { var info windows.ConsoleScreenBufferInfo if err := windows.GetConsoleScreenBufferInfo(windows.Handle(fd), &info); err != nil { return 0, 0, err } return int(info.Window.Right - info.Window.Left + 1), int(info.Window.Bottom - info.Window.Top + 1), nil } func readPassword(fd int) ([]byte, error) { var st uint32 if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil { return nil, err } old := st st &^= (windows.ENABLE_ECHO_INPUT | windows.ENABLE_LINE_INPUT) st |= (windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_PROCESSED_INPUT) if err := windows.SetConsoleMode(windows.Handle(fd), st); err != nil { return nil, err } defer windows.SetConsoleMode(windows.Handle(fd), old) var h windows.Handle p, _ := windows.GetCurrentProcess() if err := windows.DuplicateHandle(p, windows.Handle(fd), p, &h, 0, false, windows.DUPLICATE_SAME_ACCESS); err != nil { return nil, err } f := os.NewFile(uintptr(h), "stdin") defer f.Close() return readPasswordLine(f) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/term/term_unix_other.go
vendor/golang.org/x/term/term_unix_other.go
// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build aix || linux || solaris || zos package term import "golang.org/x/sys/unix" const ioctlReadTermios = unix.TCGETS const ioctlWriteTermios = unix.TCSETS
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/term/term_unsupported.go
vendor/golang.org/x/term/term_unsupported.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !zos && !windows && !solaris && !plan9 package term import ( "fmt" "runtime" ) type state struct{} func isTerminal(fd int) bool { return false } func makeRaw(fd int) (*State, error) { return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) } func getState(fd int) (*State, error) { return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) } func restore(fd int, state *State) error { return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) } func getSize(fd int) (width, height int, err error) { return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) } func readPassword(fd int) ([]byte, error) { return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/term/terminal.go
vendor/golang.org/x/term/terminal.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package term import ( "bytes" "fmt" "io" "runtime" "strconv" "sync" "unicode/utf8" ) // EscapeCodes contains escape sequences that can be written to the terminal in // order to achieve different styles of text. type EscapeCodes struct { // Foreground colors Black, Red, Green, Yellow, Blue, Magenta, Cyan, White []byte // Reset all attributes Reset []byte } var vt100EscapeCodes = EscapeCodes{ Black: []byte{keyEscape, '[', '3', '0', 'm'}, Red: []byte{keyEscape, '[', '3', '1', 'm'}, Green: []byte{keyEscape, '[', '3', '2', 'm'}, Yellow: []byte{keyEscape, '[', '3', '3', 'm'}, Blue: []byte{keyEscape, '[', '3', '4', 'm'}, Magenta: []byte{keyEscape, '[', '3', '5', 'm'}, Cyan: []byte{keyEscape, '[', '3', '6', 'm'}, White: []byte{keyEscape, '[', '3', '7', 'm'}, Reset: []byte{keyEscape, '[', '0', 'm'}, } // A History provides a (possibly bounded) queue of input lines read by [Terminal.ReadLine]. type History interface { // Add will be called by [Terminal.ReadLine] to add // a new, most recent entry to the history. // It is allowed to drop any entry, including // the entry being added (e.g., if it's deemed an invalid entry), // the least-recent entry (e.g., to keep the history bounded), // or any other entry. Add(entry string) // Len returns the number of entries in the history. Len() int // At returns an entry from the history. // Index 0 is the most-recently added entry and // index Len()-1 is the least-recently added entry. // If index is < 0 or >= Len(), it panics. At(idx int) string } // Terminal contains the state for running a VT100 terminal that is capable of // reading lines of input. type Terminal struct { // AutoCompleteCallback, if non-null, is called for each keypress with // the full input line and the current position of the cursor (in // bytes, as an index into |line|). If it returns ok=false, the key // press is processed normally. Otherwise it returns a replacement line // and the new cursor position. // // This will be disabled during ReadPassword. AutoCompleteCallback func(line string, pos int, key rune) (newLine string, newPos int, ok bool) // Escape contains a pointer to the escape codes for this terminal. // It's always a valid pointer, although the escape codes themselves // may be empty if the terminal doesn't support them. Escape *EscapeCodes // lock protects the terminal and the state in this object from // concurrent processing of a key press and a Write() call. lock sync.Mutex c io.ReadWriter prompt []rune // line is the current line being entered. line []rune // pos is the logical position of the cursor in line pos int // echo is true if local echo is enabled echo bool // pasteActive is true iff there is a bracketed paste operation in // progress. pasteActive bool // cursorX contains the current X value of the cursor where the left // edge is 0. cursorY contains the row number where the first row of // the current line is 0. cursorX, cursorY int // maxLine is the greatest value of cursorY so far. maxLine int termWidth, termHeight int // outBuf contains the terminal data to be sent. outBuf []byte // remainder contains the remainder of any partial key sequences after // a read. It aliases into inBuf. remainder []byte inBuf [256]byte // History records and retrieves lines of input read by [ReadLine] which // a user can retrieve and navigate using the up and down arrow keys. // // It is not safe to call ReadLine concurrently with any methods on History. // // [NewTerminal] sets this to a default implementation that records the // last 100 lines of input. History History // historyIndex stores the currently accessed history entry, where zero // means the immediately previous entry. historyIndex int // When navigating up and down the history it's possible to return to // the incomplete, initial line. That value is stored in // historyPending. historyPending string } // NewTerminal runs a VT100 terminal on the given ReadWriter. If the ReadWriter is // a local terminal, that terminal must first have been put into raw mode. // prompt is a string that is written at the start of each input line (i.e. // "> "). func NewTerminal(c io.ReadWriter, prompt string) *Terminal { return &Terminal{ Escape: &vt100EscapeCodes, c: c, prompt: []rune(prompt), termWidth: 80, termHeight: 24, echo: true, historyIndex: -1, History: &stRingBuffer{}, } } const ( keyCtrlC = 3 keyCtrlD = 4 keyCtrlU = 21 keyEnter = '\r' keyLF = '\n' keyEscape = 27 keyBackspace = 127 keyUnknown = 0xd800 /* UTF-16 surrogate area */ + iota keyUp keyDown keyLeft keyRight keyAltLeft keyAltRight keyHome keyEnd keyDeleteWord keyDeleteLine keyClearScreen keyPasteStart keyPasteEnd ) var ( crlf = []byte{'\r', '\n'} pasteStart = []byte{keyEscape, '[', '2', '0', '0', '~'} pasteEnd = []byte{keyEscape, '[', '2', '0', '1', '~'} ) // bytesToKey tries to parse a key sequence from b. If successful, it returns // the key and the remainder of the input. Otherwise it returns utf8.RuneError. func bytesToKey(b []byte, pasteActive bool) (rune, []byte) { if len(b) == 0 { return utf8.RuneError, nil } if !pasteActive { switch b[0] { case 1: // ^A return keyHome, b[1:] case 2: // ^B return keyLeft, b[1:] case 5: // ^E return keyEnd, b[1:] case 6: // ^F return keyRight, b[1:] case 8: // ^H return keyBackspace, b[1:] case 11: // ^K return keyDeleteLine, b[1:] case 12: // ^L return keyClearScreen, b[1:] case 23: // ^W return keyDeleteWord, b[1:] case 14: // ^N return keyDown, b[1:] case 16: // ^P return keyUp, b[1:] } } if b[0] != keyEscape { if !utf8.FullRune(b) { return utf8.RuneError, b } r, l := utf8.DecodeRune(b) return r, b[l:] } if !pasteActive && len(b) >= 3 && b[0] == keyEscape && b[1] == '[' { switch b[2] { case 'A': return keyUp, b[3:] case 'B': return keyDown, b[3:] case 'C': return keyRight, b[3:] case 'D': return keyLeft, b[3:] case 'H': return keyHome, b[3:] case 'F': return keyEnd, b[3:] } } if !pasteActive && len(b) >= 6 && b[0] == keyEscape && b[1] == '[' && b[2] == '1' && b[3] == ';' && b[4] == '3' { switch b[5] { case 'C': return keyAltRight, b[6:] case 'D': return keyAltLeft, b[6:] } } if !pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteStart) { return keyPasteStart, b[6:] } if pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteEnd) { return keyPasteEnd, b[6:] } // If we get here then we have a key that we don't recognise, or a // partial sequence. It's not clear how one should find the end of a // sequence without knowing them all, but it seems that [a-zA-Z~] only // appears at the end of a sequence. for i, c := range b[0:] { if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '~' { return keyUnknown, b[i+1:] } } return utf8.RuneError, b } // queue appends data to the end of t.outBuf func (t *Terminal) queue(data []rune) { t.outBuf = append(t.outBuf, []byte(string(data))...) } var space = []rune{' '} func isPrintable(key rune) bool { isInSurrogateArea := key >= 0xd800 && key <= 0xdbff return key >= 32 && !isInSurrogateArea } // moveCursorToPos appends data to t.outBuf which will move the cursor to the // given, logical position in the text. func (t *Terminal) moveCursorToPos(pos int) { if !t.echo { return } x := visualLength(t.prompt) + pos y := x / t.termWidth x = x % t.termWidth up := 0 if y < t.cursorY { up = t.cursorY - y } down := 0 if y > t.cursorY { down = y - t.cursorY } left := 0 if x < t.cursorX { left = t.cursorX - x } right := 0 if x > t.cursorX { right = x - t.cursorX } t.cursorX = x t.cursorY = y t.move(up, down, left, right) } func (t *Terminal) move(up, down, left, right int) { m := []rune{} // 1 unit up can be expressed as ^[[A or ^[A // 5 units up can be expressed as ^[[5A if up == 1 { m = append(m, keyEscape, '[', 'A') } else if up > 1 { m = append(m, keyEscape, '[') m = append(m, []rune(strconv.Itoa(up))...) m = append(m, 'A') } if down == 1 { m = append(m, keyEscape, '[', 'B') } else if down > 1 { m = append(m, keyEscape, '[') m = append(m, []rune(strconv.Itoa(down))...) m = append(m, 'B') } if right == 1 { m = append(m, keyEscape, '[', 'C') } else if right > 1 { m = append(m, keyEscape, '[') m = append(m, []rune(strconv.Itoa(right))...) m = append(m, 'C') } if left == 1 { m = append(m, keyEscape, '[', 'D') } else if left > 1 { m = append(m, keyEscape, '[') m = append(m, []rune(strconv.Itoa(left))...) m = append(m, 'D') } t.queue(m) } func (t *Terminal) clearLineToRight() { op := []rune{keyEscape, '[', 'K'} t.queue(op) } const maxLineLength = 4096 func (t *Terminal) setLine(newLine []rune, newPos int) { if t.echo { t.moveCursorToPos(0) t.writeLine(newLine) for i := len(newLine); i < len(t.line); i++ { t.writeLine(space) } t.moveCursorToPos(newPos) } t.line = newLine t.pos = newPos } func (t *Terminal) advanceCursor(places int) { t.cursorX += places t.cursorY += t.cursorX / t.termWidth if t.cursorY > t.maxLine { t.maxLine = t.cursorY } t.cursorX = t.cursorX % t.termWidth if places > 0 && t.cursorX == 0 { // Normally terminals will advance the current position // when writing a character. But that doesn't happen // for the last character in a line. However, when // writing a character (except a new line) that causes // a line wrap, the position will be advanced two // places. // // So, if we are stopping at the end of a line, we // need to write a newline so that our cursor can be // advanced to the next line. t.outBuf = append(t.outBuf, '\r', '\n') } } func (t *Terminal) eraseNPreviousChars(n int) { if n == 0 { return } if t.pos < n { n = t.pos } t.pos -= n t.moveCursorToPos(t.pos) copy(t.line[t.pos:], t.line[n+t.pos:]) t.line = t.line[:len(t.line)-n] if t.echo { t.writeLine(t.line[t.pos:]) for i := 0; i < n; i++ { t.queue(space) } t.advanceCursor(n) t.moveCursorToPos(t.pos) } } // countToLeftWord returns the number of characters from the cursor to the // start of the previous word. func (t *Terminal) countToLeftWord() int { if t.pos == 0 { return 0 } pos := t.pos - 1 for pos > 0 { if t.line[pos] != ' ' { break } pos-- } for pos > 0 { if t.line[pos] == ' ' { pos++ break } pos-- } return t.pos - pos } // countToRightWord returns the number of characters from the cursor to the // start of the next word. func (t *Terminal) countToRightWord() int { pos := t.pos for pos < len(t.line) { if t.line[pos] == ' ' { break } pos++ } for pos < len(t.line) { if t.line[pos] != ' ' { break } pos++ } return pos - t.pos } // visualLength returns the number of visible glyphs in s. func visualLength(runes []rune) int { inEscapeSeq := false length := 0 for _, r := range runes { switch { case inEscapeSeq: if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') { inEscapeSeq = false } case r == '\x1b': inEscapeSeq = true default: length++ } } return length } // historyAt unlocks the terminal and relocks it while calling History.At. func (t *Terminal) historyAt(idx int) (string, bool) { t.lock.Unlock() // Unlock to avoid deadlock if History methods use the output writer. defer t.lock.Lock() // panic in At (or Len) protection. if idx < 0 || idx >= t.History.Len() { return "", false } return t.History.At(idx), true } // historyAdd unlocks the terminal and relocks it while calling History.Add. func (t *Terminal) historyAdd(entry string) { t.lock.Unlock() // Unlock to avoid deadlock if History methods use the output writer. defer t.lock.Lock() // panic in Add protection. t.History.Add(entry) } // handleKey processes the given key and, optionally, returns a line of text // that the user has entered. func (t *Terminal) handleKey(key rune) (line string, ok bool) { if t.pasteActive && key != keyEnter && key != keyLF { t.addKeyToLine(key) return } switch key { case keyBackspace: if t.pos == 0 { return } t.eraseNPreviousChars(1) case keyAltLeft: // move left by a word. t.pos -= t.countToLeftWord() t.moveCursorToPos(t.pos) case keyAltRight: // move right by a word. t.pos += t.countToRightWord() t.moveCursorToPos(t.pos) case keyLeft: if t.pos == 0 { return } t.pos-- t.moveCursorToPos(t.pos) case keyRight: if t.pos == len(t.line) { return } t.pos++ t.moveCursorToPos(t.pos) case keyHome: if t.pos == 0 { return } t.pos = 0 t.moveCursorToPos(t.pos) case keyEnd: if t.pos == len(t.line) { return } t.pos = len(t.line) t.moveCursorToPos(t.pos) case keyUp: entry, ok := t.historyAt(t.historyIndex + 1) if !ok { return "", false } if t.historyIndex == -1 { t.historyPending = string(t.line) } t.historyIndex++ runes := []rune(entry) t.setLine(runes, len(runes)) case keyDown: switch t.historyIndex { case -1: return case 0: runes := []rune(t.historyPending) t.setLine(runes, len(runes)) t.historyIndex-- default: entry, ok := t.historyAt(t.historyIndex - 1) if ok { t.historyIndex-- runes := []rune(entry) t.setLine(runes, len(runes)) } } case keyEnter, keyLF: t.moveCursorToPos(len(t.line)) t.queue([]rune("\r\n")) line = string(t.line) ok = true t.line = t.line[:0] t.pos = 0 t.cursorX = 0 t.cursorY = 0 t.maxLine = 0 case keyDeleteWord: // Delete zero or more spaces and then one or more characters. t.eraseNPreviousChars(t.countToLeftWord()) case keyDeleteLine: // Delete everything from the current cursor position to the // end of line. for i := t.pos; i < len(t.line); i++ { t.queue(space) t.advanceCursor(1) } t.line = t.line[:t.pos] t.moveCursorToPos(t.pos) case keyCtrlD: // Erase the character under the current position. // The EOF case when the line is empty is handled in // readLine(). if t.pos < len(t.line) { t.pos++ t.eraseNPreviousChars(1) } case keyCtrlU: t.eraseNPreviousChars(t.pos) case keyClearScreen: // Erases the screen and moves the cursor to the home position. t.queue([]rune("\x1b[2J\x1b[H")) t.queue(t.prompt) t.cursorX, t.cursorY = 0, 0 t.advanceCursor(visualLength(t.prompt)) t.setLine(t.line, t.pos) default: if t.AutoCompleteCallback != nil { prefix := string(t.line[:t.pos]) suffix := string(t.line[t.pos:]) t.lock.Unlock() newLine, newPos, completeOk := t.AutoCompleteCallback(prefix+suffix, len(prefix), key) t.lock.Lock() if completeOk { t.setLine([]rune(newLine), utf8.RuneCount([]byte(newLine)[:newPos])) return } } if !isPrintable(key) { return } if len(t.line) == maxLineLength { return } t.addKeyToLine(key) } return } // addKeyToLine inserts the given key at the current position in the current // line. func (t *Terminal) addKeyToLine(key rune) { if len(t.line) == cap(t.line) { newLine := make([]rune, len(t.line), 2*(1+len(t.line))) copy(newLine, t.line) t.line = newLine } t.line = t.line[:len(t.line)+1] copy(t.line[t.pos+1:], t.line[t.pos:]) t.line[t.pos] = key if t.echo { t.writeLine(t.line[t.pos:]) } t.pos++ t.moveCursorToPos(t.pos) } func (t *Terminal) writeLine(line []rune) { for len(line) != 0 { remainingOnLine := t.termWidth - t.cursorX todo := len(line) if todo > remainingOnLine { todo = remainingOnLine } t.queue(line[:todo]) t.advanceCursor(visualLength(line[:todo])) line = line[todo:] } } // writeWithCRLF writes buf to w but replaces all occurrences of \n with \r\n. func writeWithCRLF(w io.Writer, buf []byte) (n int, err error) { for len(buf) > 0 { i := bytes.IndexByte(buf, '\n') todo := len(buf) if i >= 0 { todo = i } var nn int nn, err = w.Write(buf[:todo]) n += nn if err != nil { return n, err } buf = buf[todo:] if i >= 0 { if _, err = w.Write(crlf); err != nil { return n, err } n++ buf = buf[1:] } } return n, nil } func (t *Terminal) Write(buf []byte) (n int, err error) { t.lock.Lock() defer t.lock.Unlock() if t.cursorX == 0 && t.cursorY == 0 { // This is the easy case: there's nothing on the screen that we // have to move out of the way. return writeWithCRLF(t.c, buf) } // We have a prompt and possibly user input on the screen. We // have to clear it first. t.move(0 /* up */, 0 /* down */, t.cursorX /* left */, 0 /* right */) t.cursorX = 0 t.clearLineToRight() for t.cursorY > 0 { t.move(1 /* up */, 0, 0, 0) t.cursorY-- t.clearLineToRight() } if _, err = t.c.Write(t.outBuf); err != nil { return } t.outBuf = t.outBuf[:0] if n, err = writeWithCRLF(t.c, buf); err != nil { return } t.writeLine(t.prompt) if t.echo { t.writeLine(t.line) } t.moveCursorToPos(t.pos) if _, err = t.c.Write(t.outBuf); err != nil { return } t.outBuf = t.outBuf[:0] return } // ReadPassword temporarily changes the prompt and reads a password, without // echo, from the terminal. // // The AutoCompleteCallback is disabled during this call. func (t *Terminal) ReadPassword(prompt string) (line string, err error) { t.lock.Lock() defer t.lock.Unlock() oldPrompt := t.prompt t.prompt = []rune(prompt) t.echo = false oldAutoCompleteCallback := t.AutoCompleteCallback t.AutoCompleteCallback = nil defer func() { t.AutoCompleteCallback = oldAutoCompleteCallback }() line, err = t.readLine() t.prompt = oldPrompt t.echo = true return } // ReadLine returns a line of input from the terminal. func (t *Terminal) ReadLine() (line string, err error) { t.lock.Lock() defer t.lock.Unlock() return t.readLine() } func (t *Terminal) readLine() (line string, err error) { // t.lock must be held at this point if t.cursorX == 0 && t.cursorY == 0 { t.writeLine(t.prompt) t.c.Write(t.outBuf) t.outBuf = t.outBuf[:0] } lineIsPasted := t.pasteActive for { rest := t.remainder lineOk := false for !lineOk { var key rune key, rest = bytesToKey(rest, t.pasteActive) if key == utf8.RuneError { break } if !t.pasteActive { if key == keyCtrlD { if len(t.line) == 0 { return "", io.EOF } } if key == keyCtrlC { return "", io.EOF } if key == keyPasteStart { t.pasteActive = true if len(t.line) == 0 { lineIsPasted = true } continue } } else if key == keyPasteEnd { t.pasteActive = false continue } if !t.pasteActive { lineIsPasted = false } // If we have CR, consume LF if present (CRLF sequence) to avoid returning an extra empty line. if key == keyEnter && len(rest) > 0 && rest[0] == keyLF { rest = rest[1:] } line, lineOk = t.handleKey(key) } if len(rest) > 0 { n := copy(t.inBuf[:], rest) t.remainder = t.inBuf[:n] } else { t.remainder = nil } t.c.Write(t.outBuf) t.outBuf = t.outBuf[:0] if lineOk { if t.echo { t.historyIndex = -1 t.historyAdd(line) } if lineIsPasted { err = ErrPasteIndicator } return } // t.remainder is a slice at the beginning of t.inBuf // containing a partial key sequence readBuf := t.inBuf[len(t.remainder):] var n int t.lock.Unlock() n, err = t.c.Read(readBuf) t.lock.Lock() if err != nil { return } t.remainder = t.inBuf[:n+len(t.remainder)] } } // SetPrompt sets the prompt to be used when reading subsequent lines. func (t *Terminal) SetPrompt(prompt string) { t.lock.Lock() defer t.lock.Unlock() t.prompt = []rune(prompt) } func (t *Terminal) clearAndRepaintLinePlusNPrevious(numPrevLines int) { // Move cursor to column zero at the start of the line. t.move(t.cursorY, 0, t.cursorX, 0) t.cursorX, t.cursorY = 0, 0 t.clearLineToRight() for t.cursorY < numPrevLines { // Move down a line t.move(0, 1, 0, 0) t.cursorY++ t.clearLineToRight() } // Move back to beginning. t.move(t.cursorY, 0, 0, 0) t.cursorX, t.cursorY = 0, 0 t.queue(t.prompt) t.advanceCursor(visualLength(t.prompt)) t.writeLine(t.line) t.moveCursorToPos(t.pos) } func (t *Terminal) SetSize(width, height int) error { t.lock.Lock() defer t.lock.Unlock() if width == 0 { width = 1 } oldWidth := t.termWidth t.termWidth, t.termHeight = width, height switch { case width == oldWidth: // If the width didn't change then nothing else needs to be // done. return nil case len(t.line) == 0 && t.cursorX == 0 && t.cursorY == 0: // If there is nothing on current line and no prompt printed, // just do nothing return nil case width < oldWidth: // Some terminals (e.g. xterm) will truncate lines that were // too long when shinking. Others, (e.g. gnome-terminal) will // attempt to wrap them. For the former, repainting t.maxLine // works great, but that behaviour goes badly wrong in the case // of the latter because they have doubled every full line. // We assume that we are working on a terminal that wraps lines // and adjust the cursor position based on every previous line // wrapping and turning into two. This causes the prompt on // xterms to move upwards, which isn't great, but it avoids a // huge mess with gnome-terminal. if t.cursorX >= t.termWidth { t.cursorX = t.termWidth - 1 } t.cursorY *= 2 t.clearAndRepaintLinePlusNPrevious(t.maxLine * 2) case width > oldWidth: // If the terminal expands then our position calculations will // be wrong in the future because we think the cursor is // |t.pos| chars into the string, but there will be a gap at // the end of any wrapped line. // // But the position will actually be correct until we move, so // we can move back to the beginning and repaint everything. t.clearAndRepaintLinePlusNPrevious(t.maxLine) } _, err := t.c.Write(t.outBuf) t.outBuf = t.outBuf[:0] return err } type pasteIndicatorError struct{} func (pasteIndicatorError) Error() string { return "terminal: ErrPasteIndicator not correctly handled" } // ErrPasteIndicator may be returned from ReadLine as the error, in addition // to valid line data. It indicates that bracketed paste mode is enabled and // that the returned line consists only of pasted data. Programs may wish to // interpret pasted data more literally than typed data. var ErrPasteIndicator = pasteIndicatorError{} // SetBracketedPasteMode requests that the terminal bracket paste operations // with markers. Not all terminals support this but, if it is supported, then // enabling this mode will stop any autocomplete callback from running due to // pastes. Additionally, any lines that are completely pasted will be returned // from ReadLine with the error set to ErrPasteIndicator. func (t *Terminal) SetBracketedPasteMode(on bool) { if on { io.WriteString(t.c, "\x1b[?2004h") } else { io.WriteString(t.c, "\x1b[?2004l") } } // stRingBuffer is a ring buffer of strings. type stRingBuffer struct { // entries contains max elements. entries []string max int // head contains the index of the element most recently added to the ring. head int // size contains the number of elements in the ring. size int } func (s *stRingBuffer) Add(a string) { if s.entries == nil { const defaultNumEntries = 100 s.entries = make([]string, defaultNumEntries) s.max = defaultNumEntries } s.head = (s.head + 1) % s.max s.entries[s.head] = a if s.size < s.max { s.size++ } } func (s *stRingBuffer) Len() int { return s.size } // At returns the value passed to the nth previous call to Add. // If n is zero then the immediately prior value is returned, if one, then the // next most recent, and so on. If such an element doesn't exist then ok is // false. func (s *stRingBuffer) At(n int) string { if n < 0 || n >= s.size { panic(fmt.Sprintf("term: history index [%d] out of range [0,%d)", n, s.size)) } index := s.head - n if index < 0 { index += s.max } return s.entries[index] } // readPasswordLine reads from reader until it finds \n or io.EOF. // The slice returned does not include the \n. // readPasswordLine also ignores any \r it finds. // Windows uses \r as end of line. So, on Windows, readPasswordLine // reads until it finds \r and ignores any \n it finds during processing. func readPasswordLine(reader io.Reader) ([]byte, error) { var buf [1]byte var ret []byte for { n, err := reader.Read(buf[:]) if n > 0 { switch buf[0] { case '\b': if len(ret) > 0 { ret = ret[:len(ret)-1] } case '\n': if runtime.GOOS != "windows" { return ret, nil } // otherwise ignore \n case '\r': if runtime.GOOS == "windows" { return ret, nil } // otherwise ignore \r default: ret = append(ret, buf[0]) } continue } if err != nil { if err == io.EOF && len(ret) > 0 { return ret, nil } return ret, err } } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/term/term.go
vendor/golang.org/x/term/term.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package term provides support functions for dealing with terminals, as // commonly found on UNIX systems. // // Putting a terminal into raw mode is the most common requirement: // // oldState, err := term.MakeRaw(int(os.Stdin.Fd())) // if err != nil { // panic(err) // } // defer term.Restore(int(os.Stdin.Fd()), oldState) // // Note that on non-Unix systems os.Stdin.Fd() may not be 0. package term // State contains the state of a terminal. type State struct { state } // IsTerminal returns whether the given file descriptor is a terminal. func IsTerminal(fd int) bool { return isTerminal(fd) } // MakeRaw puts the terminal connected to the given file descriptor into raw // mode and returns the previous state of the terminal so that it can be // restored. func MakeRaw(fd int) (*State, error) { return makeRaw(fd) } // GetState returns the current state of a terminal which may be useful to // restore the terminal after a signal. func GetState(fd int) (*State, error) { return getState(fd) } // Restore restores the terminal connected to the given file descriptor to a // previous state. func Restore(fd int, oldState *State) error { return restore(fd, oldState) } // GetSize returns the visible dimensions of the given terminal. // // These dimensions don't include any scrollback buffer height. func GetSize(fd int) (width, height int, err error) { return getSize(fd) } // ReadPassword reads a line of input from a terminal without local echo. This // is commonly used for inputting passwords and other sensitive data. The slice // returned does not include the \n. func ReadPassword(fd int) ([]byte, error) { return readPassword(fd) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/term/term_unix_bsd.go
vendor/golang.org/x/term/term_unix_bsd.go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build darwin || dragonfly || freebsd || netbsd || openbsd package term import "golang.org/x/sys/unix" const ioctlReadTermios = unix.TIOCGETA const ioctlWriteTermios = unix.TIOCSETA
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/term/term_unix.go
vendor/golang.org/x/term/term_unix.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos package term import ( "golang.org/x/sys/unix" ) type state struct { termios unix.Termios } func isTerminal(fd int) bool { _, err := unix.IoctlGetTermios(fd, ioctlReadTermios) return err == nil } func makeRaw(fd int) (*State, error) { termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios) if err != nil { return nil, err } oldState := State{state{termios: *termios}} // This attempts to replicate the behaviour documented for cfmakeraw in // the termios(3) manpage. termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON termios.Oflag &^= unix.OPOST termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN termios.Cflag &^= unix.CSIZE | unix.PARENB termios.Cflag |= unix.CS8 termios.Cc[unix.VMIN] = 1 termios.Cc[unix.VTIME] = 0 if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, termios); err != nil { return nil, err } return &oldState, nil } func getState(fd int) (*State, error) { termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios) if err != nil { return nil, err } return &State{state{termios: *termios}}, nil } func restore(fd int, state *State) error { return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios) } func getSize(fd int) (width, height int, err error) { ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ) if err != nil { return 0, 0, err } return int(ws.Col), int(ws.Row), nil } // passwordReader is an io.Reader that reads from a specific file descriptor. type passwordReader int func (r passwordReader) Read(buf []byte) (int, error) { return unix.Read(int(r), buf) } func readPassword(fd int) ([]byte, error) { termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios) if err != nil { return nil, err } newState := *termios newState.Lflag &^= unix.ECHO newState.Lflag |= unix.ICANON | unix.ISIG newState.Iflag |= unix.ICRNL if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, &newState); err != nil { return nil, err } defer unix.IoctlSetTermios(fd, ioctlWriteTermios, termios) return readPasswordLine(passwordReader(fd)) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/encoding/encoding.go
vendor/golang.org/x/text/encoding/encoding.go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package encoding defines an interface for character encodings, such as Shift // JIS and Windows 1252, that can convert to and from UTF-8. // // Encoding implementations are provided in other packages, such as // golang.org/x/text/encoding/charmap and // golang.org/x/text/encoding/japanese. package encoding // import "golang.org/x/text/encoding" import ( "errors" "io" "strconv" "unicode/utf8" "golang.org/x/text/encoding/internal/identifier" "golang.org/x/text/transform" ) // TODO: // - There seems to be some inconsistency in when decoders return errors // and when not. Also documentation seems to suggest they shouldn't return // errors at all (except for UTF-16). // - Encoders seem to rely on or at least benefit from the input being in NFC // normal form. Perhaps add an example how users could prepare their output. // Encoding is a character set encoding that can be transformed to and from // UTF-8. type Encoding interface { // NewDecoder returns a Decoder. NewDecoder() *Decoder // NewEncoder returns an Encoder. NewEncoder() *Encoder } // A Decoder converts bytes to UTF-8. It implements transform.Transformer. // // Transforming source bytes that are not of that encoding will not result in an // error per se. Each byte that cannot be transcoded will be represented in the // output by the UTF-8 encoding of '\uFFFD', the replacement rune. type Decoder struct { transform.Transformer // This forces external creators of Decoders to use names in struct // initializers, allowing for future extendibility without having to break // code. _ struct{} } // Bytes converts the given encoded bytes to UTF-8. It returns the converted // bytes or nil, err if any error occurred. func (d *Decoder) Bytes(b []byte) ([]byte, error) { b, _, err := transform.Bytes(d, b) if err != nil { return nil, err } return b, nil } // String converts the given encoded string to UTF-8. It returns the converted // string or "", err if any error occurred. func (d *Decoder) String(s string) (string, error) { s, _, err := transform.String(d, s) if err != nil { return "", err } return s, nil } // Reader wraps another Reader to decode its bytes. // // The Decoder may not be used for any other operation as long as the returned // Reader is in use. func (d *Decoder) Reader(r io.Reader) io.Reader { return transform.NewReader(r, d) } // An Encoder converts bytes from UTF-8. It implements transform.Transformer. // // Each rune that cannot be transcoded will result in an error. In this case, // the transform will consume all source byte up to, not including the offending // rune. Transforming source bytes that are not valid UTF-8 will be replaced by // `\uFFFD`. To return early with an error instead, use transform.Chain to // preprocess the data with a UTF8Validator. type Encoder struct { transform.Transformer // This forces external creators of Encoders to use names in struct // initializers, allowing for future extendibility without having to break // code. _ struct{} } // Bytes converts bytes from UTF-8. It returns the converted bytes or nil, err if // any error occurred. func (e *Encoder) Bytes(b []byte) ([]byte, error) { b, _, err := transform.Bytes(e, b) if err != nil { return nil, err } return b, nil } // String converts a string from UTF-8. It returns the converted string or // "", err if any error occurred. func (e *Encoder) String(s string) (string, error) { s, _, err := transform.String(e, s) if err != nil { return "", err } return s, nil } // Writer wraps another Writer to encode its UTF-8 output. // // The Encoder may not be used for any other operation as long as the returned // Writer is in use. func (e *Encoder) Writer(w io.Writer) io.Writer { return transform.NewWriter(w, e) } // ASCIISub is the ASCII substitute character, as recommended by // https://unicode.org/reports/tr36/#Text_Comparison const ASCIISub = '\x1a' // Nop is the nop encoding. Its transformed bytes are the same as the source // bytes; it does not replace invalid UTF-8 sequences. var Nop Encoding = nop{} type nop struct{} func (nop) NewDecoder() *Decoder { return &Decoder{Transformer: transform.Nop} } func (nop) NewEncoder() *Encoder { return &Encoder{Transformer: transform.Nop} } // Replacement is the replacement encoding. Decoding from the replacement // encoding yields a single '\uFFFD' replacement rune. Encoding from UTF-8 to // the replacement encoding yields the same as the source bytes except that // invalid UTF-8 is converted to '\uFFFD'. // // It is defined at http://encoding.spec.whatwg.org/#replacement var Replacement Encoding = replacement{} type replacement struct{} func (replacement) NewDecoder() *Decoder { return &Decoder{Transformer: replacementDecoder{}} } func (replacement) NewEncoder() *Encoder { return &Encoder{Transformer: replacementEncoder{}} } func (replacement) ID() (mib identifier.MIB, other string) { return identifier.Replacement, "" } type replacementDecoder struct{ transform.NopResetter } func (replacementDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { if len(dst) < 3 { return 0, 0, transform.ErrShortDst } if atEOF { const fffd = "\ufffd" dst[0] = fffd[0] dst[1] = fffd[1] dst[2] = fffd[2] nDst = 3 } return nDst, len(src), nil } type replacementEncoder struct{ transform.NopResetter } func (replacementEncoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { r, size := rune(0), 0 for ; nSrc < len(src); nSrc += size { r = rune(src[nSrc]) // Decode a 1-byte rune. if r < utf8.RuneSelf { size = 1 } else { // Decode a multi-byte rune. r, size = utf8.DecodeRune(src[nSrc:]) if size == 1 { // All valid runes of size 1 (those below utf8.RuneSelf) were // handled above. We have invalid UTF-8 or we haven't seen the // full character yet. if !atEOF && !utf8.FullRune(src[nSrc:]) { err = transform.ErrShortSrc break } r = '\ufffd' } } if nDst+utf8.RuneLen(r) > len(dst) { err = transform.ErrShortDst break } nDst += utf8.EncodeRune(dst[nDst:], r) } return nDst, nSrc, err } // HTMLEscapeUnsupported wraps encoders to replace source runes outside the // repertoire of the destination encoding with HTML escape sequences. // // This wrapper exists to comply to URL and HTML forms requiring a // non-terminating legacy encoder. The produced sequences may lead to data // loss as they are indistinguishable from legitimate input. To avoid this // issue, use UTF-8 encodings whenever possible. func HTMLEscapeUnsupported(e *Encoder) *Encoder { return &Encoder{Transformer: &errorHandler{e, errorToHTML}} } // ReplaceUnsupported wraps encoders to replace source runes outside the // repertoire of the destination encoding with an encoding-specific // replacement. // // This wrapper is only provided for backwards compatibility and legacy // handling. Its use is strongly discouraged. Use UTF-8 whenever possible. func ReplaceUnsupported(e *Encoder) *Encoder { return &Encoder{Transformer: &errorHandler{e, errorToReplacement}} } type errorHandler struct { *Encoder handler func(dst []byte, r rune, err repertoireError) (n int, ok bool) } // TODO: consider making this error public in some form. type repertoireError interface { Replacement() byte } func (h errorHandler) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { nDst, nSrc, err = h.Transformer.Transform(dst, src, atEOF) for err != nil { rerr, ok := err.(repertoireError) if !ok { return nDst, nSrc, err } r, sz := utf8.DecodeRune(src[nSrc:]) n, ok := h.handler(dst[nDst:], r, rerr) if !ok { return nDst, nSrc, transform.ErrShortDst } err = nil nDst += n if nSrc += sz; nSrc < len(src) { var dn, sn int dn, sn, err = h.Transformer.Transform(dst[nDst:], src[nSrc:], atEOF) nDst += dn nSrc += sn } } return nDst, nSrc, err } func errorToHTML(dst []byte, r rune, err repertoireError) (n int, ok bool) { buf := [8]byte{} b := strconv.AppendUint(buf[:0], uint64(r), 10) if n = len(b) + len("&#;"); n >= len(dst) { return 0, false } dst[0] = '&' dst[1] = '#' dst[copy(dst[2:], b)+2] = ';' return n, true } func errorToReplacement(dst []byte, r rune, err repertoireError) (n int, ok bool) { if len(dst) == 0 { return 0, false } dst[0] = err.Replacement() return 1, true } // ErrInvalidUTF8 means that a transformer encountered invalid UTF-8. var ErrInvalidUTF8 = errors.New("encoding: invalid UTF-8") // UTF8Validator is a transformer that returns ErrInvalidUTF8 on the first // input byte that is not valid UTF-8. var UTF8Validator transform.Transformer = utf8Validator{} type utf8Validator struct{ transform.NopResetter } func (utf8Validator) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { n := len(src) if n > len(dst) { n = len(dst) } for i := 0; i < n; { if c := src[i]; c < utf8.RuneSelf { dst[i] = c i++ continue } _, size := utf8.DecodeRune(src[i:]) if size == 1 { // All valid runes of size 1 (those below utf8.RuneSelf) were // handled above. We have invalid UTF-8 or we haven't seen the // full character yet. err = ErrInvalidUTF8 if !atEOF && !utf8.FullRune(src[i:]) { err = transform.ErrShortSrc } return i, i, err } if i+size > len(dst) { return i, i, transform.ErrShortDst } for ; size > 0; size-- { dst[i] = src[i] i++ } } if len(src) > len(dst) { err = transform.ErrShortDst } return n, n, err }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/encoding/internal/identifier/mib.go
vendor/golang.org/x/text/encoding/internal/identifier/mib.go
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. package identifier const ( // ASCII is the MIB identifier with IANA name US-ASCII (MIME: US-ASCII). // // ANSI X3.4-1986 // Reference: RFC2046 ASCII MIB = 3 // ISOLatin1 is the MIB identifier with IANA name ISO_8859-1:1987 (MIME: ISO-8859-1). // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISOLatin1 MIB = 4 // ISOLatin2 is the MIB identifier with IANA name ISO_8859-2:1987 (MIME: ISO-8859-2). // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISOLatin2 MIB = 5 // ISOLatin3 is the MIB identifier with IANA name ISO_8859-3:1988 (MIME: ISO-8859-3). // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISOLatin3 MIB = 6 // ISOLatin4 is the MIB identifier with IANA name ISO_8859-4:1988 (MIME: ISO-8859-4). // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISOLatin4 MIB = 7 // ISOLatinCyrillic is the MIB identifier with IANA name ISO_8859-5:1988 (MIME: ISO-8859-5). // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISOLatinCyrillic MIB = 8 // ISOLatinArabic is the MIB identifier with IANA name ISO_8859-6:1987 (MIME: ISO-8859-6). // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISOLatinArabic MIB = 9 // ISOLatinGreek is the MIB identifier with IANA name ISO_8859-7:1987 (MIME: ISO-8859-7). // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1947 // Reference: RFC1345 ISOLatinGreek MIB = 10 // ISOLatinHebrew is the MIB identifier with IANA name ISO_8859-8:1988 (MIME: ISO-8859-8). // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISOLatinHebrew MIB = 11 // ISOLatin5 is the MIB identifier with IANA name ISO_8859-9:1989 (MIME: ISO-8859-9). // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISOLatin5 MIB = 12 // ISOLatin6 is the MIB identifier with IANA name ISO-8859-10 (MIME: ISO-8859-10). // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISOLatin6 MIB = 13 // ISOTextComm is the MIB identifier with IANA name ISO_6937-2-add. // // ISO-IR: International Register of Escape Sequences and ISO 6937-2:1983 // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISOTextComm MIB = 14 // HalfWidthKatakana is the MIB identifier with IANA name JIS_X0201. // // JIS X 0201-1976. One byte only, this is equivalent to // JIS/Roman (similar to ASCII) plus eight-bit half-width // Katakana // Reference: RFC1345 HalfWidthKatakana MIB = 15 // JISEncoding is the MIB identifier with IANA name JIS_Encoding. // // JIS X 0202-1991. Uses ISO 2022 escape sequences to // shift code sets as documented in JIS X 0202-1991. JISEncoding MIB = 16 // ShiftJIS is the MIB identifier with IANA name Shift_JIS (MIME: Shift_JIS). // // This charset is an extension of csHalfWidthKatakana by // adding graphic characters in JIS X 0208. The CCS's are // JIS X0201:1997 and JIS X0208:1997. The // complete definition is shown in Appendix 1 of JIS // X0208:1997. // This charset can be used for the top-level media type "text". ShiftJIS MIB = 17 // EUCPkdFmtJapanese is the MIB identifier with IANA name Extended_UNIX_Code_Packed_Format_for_Japanese (MIME: EUC-JP). // // Standardized by OSF, UNIX International, and UNIX Systems // Laboratories Pacific. Uses ISO 2022 rules to select // code set 0: US-ASCII (a single 7-bit byte set) // code set 1: JIS X0208-1990 (a double 8-bit byte set) // restricted to A0-FF in both bytes // code set 2: Half Width Katakana (a single 7-bit byte set) // requiring SS2 as the character prefix // code set 3: JIS X0212-1990 (a double 7-bit byte set) // restricted to A0-FF in both bytes // requiring SS3 as the character prefix EUCPkdFmtJapanese MIB = 18 // EUCFixWidJapanese is the MIB identifier with IANA name Extended_UNIX_Code_Fixed_Width_for_Japanese. // // Used in Japan. Each character is 2 octets. // code set 0: US-ASCII (a single 7-bit byte set) // 1st byte = 00 // 2nd byte = 20-7E // code set 1: JIS X0208-1990 (a double 7-bit byte set) // restricted to A0-FF in both bytes // code set 2: Half Width Katakana (a single 7-bit byte set) // 1st byte = 00 // 2nd byte = A0-FF // code set 3: JIS X0212-1990 (a double 7-bit byte set) // restricted to A0-FF in // the first byte // and 21-7E in the second byte EUCFixWidJapanese MIB = 19 // ISO4UnitedKingdom is the MIB identifier with IANA name BS_4730. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO4UnitedKingdom MIB = 20 // ISO11SwedishForNames is the MIB identifier with IANA name SEN_850200_C. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO11SwedishForNames MIB = 21 // ISO15Italian is the MIB identifier with IANA name IT. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO15Italian MIB = 22 // ISO17Spanish is the MIB identifier with IANA name ES. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO17Spanish MIB = 23 // ISO21German is the MIB identifier with IANA name DIN_66003. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO21German MIB = 24 // ISO60Norwegian1 is the MIB identifier with IANA name NS_4551-1. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO60Norwegian1 MIB = 25 // ISO69French is the MIB identifier with IANA name NF_Z_62-010. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO69French MIB = 26 // ISO10646UTF1 is the MIB identifier with IANA name ISO-10646-UTF-1. // // Universal Transfer Format (1), this is the multibyte // encoding, that subsets ASCII-7. It does not have byte // ordering issues. ISO10646UTF1 MIB = 27 // ISO646basic1983 is the MIB identifier with IANA name ISO_646.basic:1983. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO646basic1983 MIB = 28 // INVARIANT is the MIB identifier with IANA name INVARIANT. // // Reference: RFC1345 INVARIANT MIB = 29 // ISO2IntlRefVersion is the MIB identifier with IANA name ISO_646.irv:1983. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO2IntlRefVersion MIB = 30 // NATSSEFI is the MIB identifier with IANA name NATS-SEFI. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 NATSSEFI MIB = 31 // NATSSEFIADD is the MIB identifier with IANA name NATS-SEFI-ADD. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 NATSSEFIADD MIB = 32 // NATSDANO is the MIB identifier with IANA name NATS-DANO. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 NATSDANO MIB = 33 // NATSDANOADD is the MIB identifier with IANA name NATS-DANO-ADD. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 NATSDANOADD MIB = 34 // ISO10Swedish is the MIB identifier with IANA name SEN_850200_B. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO10Swedish MIB = 35 // KSC56011987 is the MIB identifier with IANA name KS_C_5601-1987. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 KSC56011987 MIB = 36 // ISO2022KR is the MIB identifier with IANA name ISO-2022-KR (MIME: ISO-2022-KR). // // rfc1557 (see also KS_C_5601-1987) // Reference: RFC1557 ISO2022KR MIB = 37 // EUCKR is the MIB identifier with IANA name EUC-KR (MIME: EUC-KR). // // rfc1557 (see also KS_C_5861-1992) // Reference: RFC1557 EUCKR MIB = 38 // ISO2022JP is the MIB identifier with IANA name ISO-2022-JP (MIME: ISO-2022-JP). // // rfc1468 (see also rfc2237 ) // Reference: RFC1468 ISO2022JP MIB = 39 // ISO2022JP2 is the MIB identifier with IANA name ISO-2022-JP-2 (MIME: ISO-2022-JP-2). // // rfc1554 // Reference: RFC1554 ISO2022JP2 MIB = 40 // ISO13JISC6220jp is the MIB identifier with IANA name JIS_C6220-1969-jp. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO13JISC6220jp MIB = 41 // ISO14JISC6220ro is the MIB identifier with IANA name JIS_C6220-1969-ro. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO14JISC6220ro MIB = 42 // ISO16Portuguese is the MIB identifier with IANA name PT. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO16Portuguese MIB = 43 // ISO18Greek7Old is the MIB identifier with IANA name greek7-old. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO18Greek7Old MIB = 44 // ISO19LatinGreek is the MIB identifier with IANA name latin-greek. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO19LatinGreek MIB = 45 // ISO25French is the MIB identifier with IANA name NF_Z_62-010_(1973). // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO25French MIB = 46 // ISO27LatinGreek1 is the MIB identifier with IANA name Latin-greek-1. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO27LatinGreek1 MIB = 47 // ISO5427Cyrillic is the MIB identifier with IANA name ISO_5427. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO5427Cyrillic MIB = 48 // ISO42JISC62261978 is the MIB identifier with IANA name JIS_C6226-1978. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO42JISC62261978 MIB = 49 // ISO47BSViewdata is the MIB identifier with IANA name BS_viewdata. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO47BSViewdata MIB = 50 // ISO49INIS is the MIB identifier with IANA name INIS. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO49INIS MIB = 51 // ISO50INIS8 is the MIB identifier with IANA name INIS-8. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO50INIS8 MIB = 52 // ISO51INISCyrillic is the MIB identifier with IANA name INIS-cyrillic. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO51INISCyrillic MIB = 53 // ISO54271981 is the MIB identifier with IANA name ISO_5427:1981. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO54271981 MIB = 54 // ISO5428Greek is the MIB identifier with IANA name ISO_5428:1980. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO5428Greek MIB = 55 // ISO57GB1988 is the MIB identifier with IANA name GB_1988-80. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO57GB1988 MIB = 56 // ISO58GB231280 is the MIB identifier with IANA name GB_2312-80. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO58GB231280 MIB = 57 // ISO61Norwegian2 is the MIB identifier with IANA name NS_4551-2. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO61Norwegian2 MIB = 58 // ISO70VideotexSupp1 is the MIB identifier with IANA name videotex-suppl. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO70VideotexSupp1 MIB = 59 // ISO84Portuguese2 is the MIB identifier with IANA name PT2. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO84Portuguese2 MIB = 60 // ISO85Spanish2 is the MIB identifier with IANA name ES2. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO85Spanish2 MIB = 61 // ISO86Hungarian is the MIB identifier with IANA name MSZ_7795.3. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO86Hungarian MIB = 62 // ISO87JISX0208 is the MIB identifier with IANA name JIS_C6226-1983. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO87JISX0208 MIB = 63 // ISO88Greek7 is the MIB identifier with IANA name greek7. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO88Greek7 MIB = 64 // ISO89ASMO449 is the MIB identifier with IANA name ASMO_449. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO89ASMO449 MIB = 65 // ISO90 is the MIB identifier with IANA name iso-ir-90. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO90 MIB = 66 // ISO91JISC62291984a is the MIB identifier with IANA name JIS_C6229-1984-a. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO91JISC62291984a MIB = 67 // ISO92JISC62991984b is the MIB identifier with IANA name JIS_C6229-1984-b. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO92JISC62991984b MIB = 68 // ISO93JIS62291984badd is the MIB identifier with IANA name JIS_C6229-1984-b-add. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO93JIS62291984badd MIB = 69 // ISO94JIS62291984hand is the MIB identifier with IANA name JIS_C6229-1984-hand. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO94JIS62291984hand MIB = 70 // ISO95JIS62291984handadd is the MIB identifier with IANA name JIS_C6229-1984-hand-add. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO95JIS62291984handadd MIB = 71 // ISO96JISC62291984kana is the MIB identifier with IANA name JIS_C6229-1984-kana. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO96JISC62291984kana MIB = 72 // ISO2033 is the MIB identifier with IANA name ISO_2033-1983. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO2033 MIB = 73 // ISO99NAPLPS is the MIB identifier with IANA name ANSI_X3.110-1983. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO99NAPLPS MIB = 74 // ISO102T617bit is the MIB identifier with IANA name T.61-7bit. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO102T617bit MIB = 75 // ISO103T618bit is the MIB identifier with IANA name T.61-8bit. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO103T618bit MIB = 76 // ISO111ECMACyrillic is the MIB identifier with IANA name ECMA-cyrillic. // // ISO registry ISO111ECMACyrillic MIB = 77 // ISO121Canadian1 is the MIB identifier with IANA name CSA_Z243.4-1985-1. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO121Canadian1 MIB = 78 // ISO122Canadian2 is the MIB identifier with IANA name CSA_Z243.4-1985-2. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO122Canadian2 MIB = 79 // ISO123CSAZ24341985gr is the MIB identifier with IANA name CSA_Z243.4-1985-gr. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO123CSAZ24341985gr MIB = 80 // ISO88596E is the MIB identifier with IANA name ISO_8859-6-E (MIME: ISO-8859-6-E). // // rfc1556 // Reference: RFC1556 ISO88596E MIB = 81 // ISO88596I is the MIB identifier with IANA name ISO_8859-6-I (MIME: ISO-8859-6-I). // // rfc1556 // Reference: RFC1556 ISO88596I MIB = 82 // ISO128T101G2 is the MIB identifier with IANA name T.101-G2. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO128T101G2 MIB = 83 // ISO88598E is the MIB identifier with IANA name ISO_8859-8-E (MIME: ISO-8859-8-E). // // rfc1556 // Reference: RFC1556 ISO88598E MIB = 84 // ISO88598I is the MIB identifier with IANA name ISO_8859-8-I (MIME: ISO-8859-8-I). // // rfc1556 // Reference: RFC1556 ISO88598I MIB = 85 // ISO139CSN369103 is the MIB identifier with IANA name CSN_369103. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO139CSN369103 MIB = 86 // ISO141JUSIB1002 is the MIB identifier with IANA name JUS_I.B1.002. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO141JUSIB1002 MIB = 87 // ISO143IECP271 is the MIB identifier with IANA name IEC_P27-1. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO143IECP271 MIB = 88 // ISO146Serbian is the MIB identifier with IANA name JUS_I.B1.003-serb. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO146Serbian MIB = 89 // ISO147Macedonian is the MIB identifier with IANA name JUS_I.B1.003-mac. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO147Macedonian MIB = 90 // ISO150GreekCCITT is the MIB identifier with IANA name greek-ccitt. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO150GreekCCITT MIB = 91 // ISO151Cuba is the MIB identifier with IANA name NC_NC00-10:81. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO151Cuba MIB = 92 // ISO6937Add is the MIB identifier with IANA name ISO_6937-2-25. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO6937Add MIB = 93 // ISO153GOST1976874 is the MIB identifier with IANA name GOST_19768-74. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO153GOST1976874 MIB = 94 // ISO8859Supp is the MIB identifier with IANA name ISO_8859-supp. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO8859Supp MIB = 95 // ISO10367Box is the MIB identifier with IANA name ISO_10367-box. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO10367Box MIB = 96 // ISO158Lap is the MIB identifier with IANA name latin-lap. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO158Lap MIB = 97 // ISO159JISX02121990 is the MIB identifier with IANA name JIS_X0212-1990. // // ISO-IR: International Register of Escape Sequences // Note: The current registration authority is IPSJ/ITSCJ, Japan. // Reference: RFC1345 ISO159JISX02121990 MIB = 98 // ISO646Danish is the MIB identifier with IANA name DS_2089. // // Danish Standard, DS 2089, February 1974 // Reference: RFC1345 ISO646Danish MIB = 99 // USDK is the MIB identifier with IANA name us-dk. // // Reference: RFC1345 USDK MIB = 100 // DKUS is the MIB identifier with IANA name dk-us. // // Reference: RFC1345 DKUS MIB = 101 // KSC5636 is the MIB identifier with IANA name KSC5636. // // Reference: RFC1345 KSC5636 MIB = 102 // Unicode11UTF7 is the MIB identifier with IANA name UNICODE-1-1-UTF-7. // // rfc1642 // Reference: RFC1642 Unicode11UTF7 MIB = 103 // ISO2022CN is the MIB identifier with IANA name ISO-2022-CN. // // rfc1922 // Reference: RFC1922 ISO2022CN MIB = 104 // ISO2022CNEXT is the MIB identifier with IANA name ISO-2022-CN-EXT. // // rfc1922 // Reference: RFC1922 ISO2022CNEXT MIB = 105 // UTF8 is the MIB identifier with IANA name UTF-8. // // rfc3629 // Reference: RFC3629 UTF8 MIB = 106 // ISO885913 is the MIB identifier with IANA name ISO-8859-13. // // ISO See https://www.iana.org/assignments/charset-reg/ISO-8859-13 https://www.iana.org/assignments/charset-reg/ISO-8859-13 ISO885913 MIB = 109 // ISO885914 is the MIB identifier with IANA name ISO-8859-14. // // ISO See https://www.iana.org/assignments/charset-reg/ISO-8859-14 ISO885914 MIB = 110 // ISO885915 is the MIB identifier with IANA name ISO-8859-15. // // ISO // Please see: https://www.iana.org/assignments/charset-reg/ISO-8859-15 ISO885915 MIB = 111 // ISO885916 is the MIB identifier with IANA name ISO-8859-16. // // ISO ISO885916 MIB = 112 // GBK is the MIB identifier with IANA name GBK. // // Chinese IT Standardization Technical Committee // Please see: https://www.iana.org/assignments/charset-reg/GBK GBK MIB = 113 // GB18030 is the MIB identifier with IANA name GB18030. // // Chinese IT Standardization Technical Committee // Please see: https://www.iana.org/assignments/charset-reg/GB18030 GB18030 MIB = 114 // OSDEBCDICDF0415 is the MIB identifier with IANA name OSD_EBCDIC_DF04_15. // // Fujitsu-Siemens standard mainframe EBCDIC encoding // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-15 OSDEBCDICDF0415 MIB = 115 // OSDEBCDICDF03IRV is the MIB identifier with IANA name OSD_EBCDIC_DF03_IRV. // // Fujitsu-Siemens standard mainframe EBCDIC encoding // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF03-IRV OSDEBCDICDF03IRV MIB = 116 // OSDEBCDICDF041 is the MIB identifier with IANA name OSD_EBCDIC_DF04_1. // // Fujitsu-Siemens standard mainframe EBCDIC encoding // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-1 OSDEBCDICDF041 MIB = 117 // ISO115481 is the MIB identifier with IANA name ISO-11548-1. // // See https://www.iana.org/assignments/charset-reg/ISO-11548-1 ISO115481 MIB = 118 // KZ1048 is the MIB identifier with IANA name KZ-1048. // // See https://www.iana.org/assignments/charset-reg/KZ-1048 KZ1048 MIB = 119 // Unicode is the MIB identifier with IANA name ISO-10646-UCS-2. // // the 2-octet Basic Multilingual Plane, aka Unicode // this needs to specify network byte order: the standard // does not specify (it is a 16-bit integer space) Unicode MIB = 1000 // UCS4 is the MIB identifier with IANA name ISO-10646-UCS-4. // // the full code space. (same comment about byte order, // these are 31-bit numbers. UCS4 MIB = 1001 // UnicodeASCII is the MIB identifier with IANA name ISO-10646-UCS-Basic. // // ASCII subset of Unicode. Basic Latin = collection 1 // See ISO 10646, Appendix A UnicodeASCII MIB = 1002 // UnicodeLatin1 is the MIB identifier with IANA name ISO-10646-Unicode-Latin1. // // ISO Latin-1 subset of Unicode. Basic Latin and Latin-1 // Supplement = collections 1 and 2. See ISO 10646, // Appendix A. See rfc1815 . UnicodeLatin1 MIB = 1003 // UnicodeJapanese is the MIB identifier with IANA name ISO-10646-J-1. // // ISO 10646 Japanese, see rfc1815 . UnicodeJapanese MIB = 1004 // UnicodeIBM1261 is the MIB identifier with IANA name ISO-Unicode-IBM-1261. // // IBM Latin-2, -3, -5, Extended Presentation Set, GCSGID: 1261 UnicodeIBM1261 MIB = 1005 // UnicodeIBM1268 is the MIB identifier with IANA name ISO-Unicode-IBM-1268. // // IBM Latin-4 Extended Presentation Set, GCSGID: 1268 UnicodeIBM1268 MIB = 1006 // UnicodeIBM1276 is the MIB identifier with IANA name ISO-Unicode-IBM-1276. // // IBM Cyrillic Greek Extended Presentation Set, GCSGID: 1276 UnicodeIBM1276 MIB = 1007 // UnicodeIBM1264 is the MIB identifier with IANA name ISO-Unicode-IBM-1264. // // IBM Arabic Presentation Set, GCSGID: 1264 UnicodeIBM1264 MIB = 1008 // UnicodeIBM1265 is the MIB identifier with IANA name ISO-Unicode-IBM-1265. // // IBM Hebrew Presentation Set, GCSGID: 1265 UnicodeIBM1265 MIB = 1009 // Unicode11 is the MIB identifier with IANA name UNICODE-1-1. // // rfc1641 // Reference: RFC1641 Unicode11 MIB = 1010 // SCSU is the MIB identifier with IANA name SCSU. // // SCSU See https://www.iana.org/assignments/charset-reg/SCSU SCSU MIB = 1011 // UTF7 is the MIB identifier with IANA name UTF-7. // // rfc2152 // Reference: RFC2152 UTF7 MIB = 1012 // UTF16BE is the MIB identifier with IANA name UTF-16BE. // // rfc2781 // Reference: RFC2781 UTF16BE MIB = 1013 // UTF16LE is the MIB identifier with IANA name UTF-16LE. // // rfc2781 // Reference: RFC2781 UTF16LE MIB = 1014 // UTF16 is the MIB identifier with IANA name UTF-16. // // rfc2781 // Reference: RFC2781 UTF16 MIB = 1015 // CESU8 is the MIB identifier with IANA name CESU-8. // // https://www.unicode.org/reports/tr26 CESU8 MIB = 1016 // UTF32 is the MIB identifier with IANA name UTF-32. // // https://www.unicode.org/reports/tr19/ UTF32 MIB = 1017 // UTF32BE is the MIB identifier with IANA name UTF-32BE. // // https://www.unicode.org/reports/tr19/ UTF32BE MIB = 1018 // UTF32LE is the MIB identifier with IANA name UTF-32LE. // // https://www.unicode.org/reports/tr19/ UTF32LE MIB = 1019 // BOCU1 is the MIB identifier with IANA name BOCU-1. // // https://www.unicode.org/notes/tn6/ BOCU1 MIB = 1020 // UTF7IMAP is the MIB identifier with IANA name UTF-7-IMAP. // // Note: This charset is used to encode Unicode in IMAP mailbox names; // see section 5.1.3 of rfc3501 . It should never be used // outside this context. A name has been assigned so that charset processing // implementations can refer to it in a consistent way. UTF7IMAP MIB = 1021 // Windows30Latin1 is the MIB identifier with IANA name ISO-8859-1-Windows-3.0-Latin-1. // // Extended ISO 8859-1 Latin-1 for Windows 3.0. // PCL Symbol Set id: 9U Windows30Latin1 MIB = 2000 // Windows31Latin1 is the MIB identifier with IANA name ISO-8859-1-Windows-3.1-Latin-1. // // Extended ISO 8859-1 Latin-1 for Windows 3.1. // PCL Symbol Set id: 19U Windows31Latin1 MIB = 2001 // Windows31Latin2 is the MIB identifier with IANA name ISO-8859-2-Windows-Latin-2. // // Extended ISO 8859-2. Latin-2 for Windows 3.1. // PCL Symbol Set id: 9E Windows31Latin2 MIB = 2002 // Windows31Latin5 is the MIB identifier with IANA name ISO-8859-9-Windows-Latin-5. // // Extended ISO 8859-9. Latin-5 for Windows 3.1 // PCL Symbol Set id: 5T Windows31Latin5 MIB = 2003 // HPRoman8 is the MIB identifier with IANA name hp-roman8. // // LaserJet IIP Printer User's Manual, // HP part no 33471-90901, Hewlet-Packard, June 1989. // Reference: RFC1345 HPRoman8 MIB = 2004 // AdobeStandardEncoding is the MIB identifier with IANA name Adobe-Standard-Encoding. // // PostScript Language Reference Manual // PCL Symbol Set id: 10J AdobeStandardEncoding MIB = 2005 // VenturaUS is the MIB identifier with IANA name Ventura-US. // // Ventura US. ASCII plus characters typically used in // publishing, like pilcrow, copyright, registered, trade mark, // section, dagger, and double dagger in the range A0 (hex) // to FF (hex). // PCL Symbol Set id: 14J VenturaUS MIB = 2006 // VenturaInternational is the MIB identifier with IANA name Ventura-International. // // Ventura International. ASCII plus coded characters similar // to Roman8. // PCL Symbol Set id: 13J VenturaInternational MIB = 2007 // DECMCS is the MIB identifier with IANA name DEC-MCS. // // VAX/VMS User's Manual, // Order Number: AI-Y517A-TE, April 1986. // Reference: RFC1345 DECMCS MIB = 2008 // PC850Multilingual is the MIB identifier with IANA name IBM850. // // IBM NLS RM Vol2 SE09-8002-01, March 1990 // Reference: RFC1345 PC850Multilingual MIB = 2009 // PC8DanishNorwegian is the MIB identifier with IANA name PC8-Danish-Norwegian. // // PC Danish Norwegian // 8-bit PC set for Danish Norwegian // PCL Symbol Set id: 11U PC8DanishNorwegian MIB = 2012 // PC862LatinHebrew is the MIB identifier with IANA name IBM862. // // IBM NLS RM Vol2 SE09-8002-01, March 1990 // Reference: RFC1345 PC862LatinHebrew MIB = 2013 // PC8Turkish is the MIB identifier with IANA name PC8-Turkish. // // PC Latin Turkish. PCL Symbol Set id: 9T PC8Turkish MIB = 2014
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go
vendor/golang.org/x/text/encoding/internal/identifier/identifier.go
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:generate go run gen.go // Package identifier defines the contract between implementations of Encoding // and Index by defining identifiers that uniquely identify standardized coded // character sets (CCS) and character encoding schemes (CES), which we will // together refer to as encodings, for which Encoding implementations provide // converters to and from UTF-8. This package is typically only of concern to // implementers of Indexes and Encodings. // // One part of the identifier is the MIB code, which is defined by IANA and // uniquely identifies a CCS or CES. Each code is associated with data that // references authorities, official documentation as well as aliases and MIME // names. // // Not all CESs are covered by the IANA registry. The "other" string that is // returned by ID can be used to identify other character sets or versions of // existing ones. // // It is recommended that each package that provides a set of Encodings provide // the All and Common variables to reference all supported encodings and // commonly used subset. This allows Index implementations to include all // available encodings without explicitly referencing or knowing about them. package identifier // Note: this package is internal, but could be made public if there is a need // for writing third-party Indexes and Encodings. // References: // - http://source.icu-project.org/repos/icu/icu/trunk/source/data/mappings/convrtrs.txt // - http://www.iana.org/assignments/character-sets/character-sets.xhtml // - http://www.iana.org/assignments/ianacharset-mib/ianacharset-mib // - http://www.ietf.org/rfc/rfc2978.txt // - https://www.unicode.org/reports/tr22/ // - http://www.w3.org/TR/encoding/ // - https://encoding.spec.whatwg.org/ // - https://encoding.spec.whatwg.org/encodings.json // - https://tools.ietf.org/html/rfc6657#section-5 // Interface can be implemented by Encodings to define the CCS or CES for which // it implements conversions. type Interface interface { // ID returns an encoding identifier. Exactly one of the mib and other // values should be non-zero. // // In the usual case it is only necessary to indicate the MIB code. The // other string can be used to specify encodings for which there is no MIB, // such as "x-mac-dingbat". // // The other string may only contain the characters a-z, A-Z, 0-9, - and _. ID() (mib MIB, other string) // NOTE: the restrictions on the encoding are to allow extending the syntax // with additional information such as versions, vendors and other variants. } // A MIB identifies an encoding. It is derived from the IANA MIB codes and adds // some identifiers for some encodings that are not covered by the IANA // standard. // // See http://www.iana.org/assignments/ianacharset-mib. type MIB uint16 // These additional MIB types are not defined in IANA. They are added because // they are common and defined within the text repo. const ( // Unofficial marks the start of encodings not registered by IANA. Unofficial MIB = 10000 + iota // Replacement is the WhatWG replacement encoding. Replacement // XUserDefined is the code for x-user-defined. XUserDefined // MacintoshCyrillic is the code for x-mac-cyrillic. MacintoshCyrillic )
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/forminfo.go
vendor/golang.org/x/text/unicode/norm/forminfo.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package norm import "encoding/binary" // This file contains Form-specific logic and wrappers for data in tables.go. // Rune info is stored in a separate trie per composing form. A composing form // and its corresponding decomposing form share the same trie. Each trie maps // a rune to a uint16. The values take two forms. For v >= 0x8000: // bits // 15: 1 (inverse of NFD_QC bit of qcInfo) // 13..7: qcInfo (see below). isYesD is always true (no decomposition). // 6..0: ccc (compressed CCC value). // For v < 0x8000, the respective rune has a decomposition and v is an index // into a byte array of UTF-8 decomposition sequences and additional info and // has the form: // <header> <decomp_byte>* [<tccc> [<lccc>]] // The header contains the number of bytes in the decomposition (excluding this // length byte). The two most significant bits of this length byte correspond // to bit 5 and 4 of qcInfo (see below). The byte sequence itself starts at v+1. // The byte sequence is followed by a trailing and leading CCC if the values // for these are not zero. The value of v determines which ccc are appended // to the sequences. For v < firstCCC, there are none, for v >= firstCCC, // the sequence is followed by a trailing ccc, and for v >= firstLeadingCC // there is an additional leading ccc. The value of tccc itself is the // trailing CCC shifted left 2 bits. The two least-significant bits of tccc // are the number of trailing non-starters. const ( qcInfoMask = 0x3F // to clear all but the relevant bits in a qcInfo headerLenMask = 0x3F // extract the length value from the header byte headerFlagsMask = 0xC0 // extract the qcInfo bits from the header byte ) // Properties provides access to normalization properties of a rune. type Properties struct { pos uint8 // start position in reorderBuffer; used in composition.go size uint8 // length of UTF-8 encoding of this rune ccc uint8 // leading canonical combining class (ccc if not decomposition) tccc uint8 // trailing canonical combining class (ccc if not decomposition) nLead uint8 // number of leading non-starters. flags qcInfo // quick check flags index uint16 } // functions dispatchable per form type lookupFunc func(b input, i int) Properties // formInfo holds Form-specific functions and tables. type formInfo struct { form Form composing, compatibility bool // form type info lookupFunc nextMain iterFunc } var formTable = []*formInfo{{ form: NFC, composing: true, compatibility: false, info: lookupInfoNFC, nextMain: nextComposed, }, { form: NFD, composing: false, compatibility: false, info: lookupInfoNFC, nextMain: nextDecomposed, }, { form: NFKC, composing: true, compatibility: true, info: lookupInfoNFKC, nextMain: nextComposed, }, { form: NFKD, composing: false, compatibility: true, info: lookupInfoNFKC, nextMain: nextDecomposed, }} // We do not distinguish between boundaries for NFC, NFD, etc. to avoid // unexpected behavior for the user. For example, in NFD, there is a boundary // after 'a'. However, 'a' might combine with modifiers, so from the application's // perspective it is not a good boundary. We will therefore always use the // boundaries for the combining variants. // BoundaryBefore returns true if this rune starts a new segment and // cannot combine with any rune on the left. func (p Properties) BoundaryBefore() bool { if p.ccc == 0 && !p.combinesBackward() { return true } // We assume that the CCC of the first character in a decomposition // is always non-zero if different from info.ccc and that we can return // false at this point. This is verified by maketables. return false } // BoundaryAfter returns true if runes cannot combine with or otherwise // interact with this or previous runes. func (p Properties) BoundaryAfter() bool { // TODO: loosen these conditions. return p.isInert() } // We pack quick check data in 4 bits: // // 5: Combines forward (0 == false, 1 == true) // 4..3: NFC_QC Yes(00), No (10), or Maybe (11) // 2: NFD_QC Yes (0) or No (1). No also means there is a decomposition. // 1..0: Number of trailing non-starters. // // When all 4 bits are zero, the character is inert, meaning it is never // influenced by normalization. type qcInfo uint8 func (p Properties) isYesC() bool { return p.flags&0x10 == 0 } func (p Properties) isYesD() bool { return p.flags&0x4 == 0 } func (p Properties) combinesForward() bool { return p.flags&0x20 != 0 } func (p Properties) combinesBackward() bool { return p.flags&0x8 != 0 } // == isMaybe func (p Properties) hasDecomposition() bool { return p.flags&0x4 != 0 } // == isNoD func (p Properties) isInert() bool { return p.flags&qcInfoMask == 0 && p.ccc == 0 } func (p Properties) multiSegment() bool { return p.index >= firstMulti && p.index < endMulti } func (p Properties) nLeadingNonStarters() uint8 { return p.nLead } func (p Properties) nTrailingNonStarters() uint8 { return uint8(p.flags & 0x03) } // Decomposition returns the decomposition for the underlying rune // or nil if there is none. func (p Properties) Decomposition() []byte { // TODO: create the decomposition for Hangul? if p.index == 0 { return nil } i := p.index n := decomps[i] & headerLenMask i++ return decomps[i : i+uint16(n)] } // Size returns the length of UTF-8 encoding of the rune. func (p Properties) Size() int { return int(p.size) } // CCC returns the canonical combining class of the underlying rune. func (p Properties) CCC() uint8 { if p.index >= firstCCCZeroExcept { return 0 } return ccc[p.ccc] } // LeadCCC returns the CCC of the first rune in the decomposition. // If there is no decomposition, LeadCCC equals CCC. func (p Properties) LeadCCC() uint8 { return ccc[p.ccc] } // TrailCCC returns the CCC of the last rune in the decomposition. // If there is no decomposition, TrailCCC equals CCC. func (p Properties) TrailCCC() uint8 { return ccc[p.tccc] } func buildRecompMap() { recompMap = make(map[uint32]rune, len(recompMapPacked)/8) var buf [8]byte for i := 0; i < len(recompMapPacked); i += 8 { copy(buf[:], recompMapPacked[i:i+8]) key := binary.BigEndian.Uint32(buf[:4]) val := binary.BigEndian.Uint32(buf[4:]) recompMap[key] = rune(val) } } // Recomposition // We use 32-bit keys instead of 64-bit for the two codepoint keys. // This clips off the bits of three entries, but we know this will not // result in a collision. In the unlikely event that changes to // UnicodeData.txt introduce collisions, the compiler will catch it. // Note that the recomposition map for NFC and NFKC are identical. // combine returns the combined rune or 0 if it doesn't exist. // // The caller is responsible for calling // recompMapOnce.Do(buildRecompMap) sometime before this is called. func combine(a, b rune) rune { key := uint32(uint16(a))<<16 + uint32(uint16(b)) if recompMap == nil { panic("caller error") // see func comment } return recompMap[key] } func lookupInfoNFC(b input, i int) Properties { v, sz := b.charinfoNFC(i) return compInfo(v, sz) } func lookupInfoNFKC(b input, i int) Properties { v, sz := b.charinfoNFKC(i) return compInfo(v, sz) } // Properties returns properties for the first rune in s. func (f Form) Properties(s []byte) Properties { if f == NFC || f == NFD { return compInfo(nfcData.lookup(s)) } return compInfo(nfkcData.lookup(s)) } // PropertiesString returns properties for the first rune in s. func (f Form) PropertiesString(s string) Properties { if f == NFC || f == NFD { return compInfo(nfcData.lookupString(s)) } return compInfo(nfkcData.lookupString(s)) } // compInfo converts the information contained in v and sz // to a Properties. See the comment at the top of the file // for more information on the format. func compInfo(v uint16, sz int) Properties { if v == 0 { return Properties{size: uint8(sz)} } else if v >= 0x8000 { p := Properties{ size: uint8(sz), ccc: uint8(v), tccc: uint8(v), flags: qcInfo(v >> 8), } if p.ccc > 0 || p.combinesBackward() { p.nLead = uint8(p.flags & 0x3) } return p } // has decomposition h := decomps[v] f := (qcInfo(h&headerFlagsMask) >> 2) | 0x4 p := Properties{size: uint8(sz), flags: f, index: v} if v >= firstCCC { v += uint16(h&headerLenMask) + 1 c := decomps[v] p.tccc = c >> 2 p.flags |= qcInfo(c & 0x3) if v >= firstLeadingCCC { p.nLead = c & 0x3 if v >= firstStarterWithNLead { // We were tricked. Remove the decomposition. p.flags &= 0x03 p.index = 0 return p } p.ccc = decomps[v+1] } } return p }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/trie.go
vendor/golang.org/x/text/unicode/norm/trie.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package norm type valueRange struct { value uint16 // header: value:stride lo, hi byte // header: lo:n } type sparseBlocks struct { values []valueRange offset []uint16 } var nfcSparse = sparseBlocks{ values: nfcSparseValues[:], offset: nfcSparseOffset[:], } var nfkcSparse = sparseBlocks{ values: nfkcSparseValues[:], offset: nfkcSparseOffset[:], } var ( nfcData = newNfcTrie(0) nfkcData = newNfkcTrie(0) ) // lookup determines the type of block n and looks up the value for b. // For n < t.cutoff, the block is a simple lookup table. Otherwise, the block // is a list of ranges with an accompanying value. Given a matching range r, // the value for b is by r.value + (b - r.lo) * stride. func (t *sparseBlocks) lookup(n uint32, b byte) uint16 { offset := t.offset[n] header := t.values[offset] lo := offset + 1 hi := lo + uint16(header.lo) for lo < hi { m := lo + (hi-lo)/2 r := t.values[m] if r.lo <= b && b <= r.hi { return r.value + uint16(b-r.lo)*header.value } if b < r.lo { hi = m } else { lo = m + 1 } } return 0 }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/composition.go
vendor/golang.org/x/text/unicode/norm/composition.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package norm import "unicode/utf8" const ( maxNonStarters = 30 // The maximum number of characters needed for a buffer is // maxNonStarters + 1 for the starter + 1 for the GCJ maxBufferSize = maxNonStarters + 2 maxNFCExpansion = 3 // NFC(0x1D160) maxNFKCExpansion = 18 // NFKC(0xFDFA) maxByteBufferSize = utf8.UTFMax * maxBufferSize // 128 ) // ssState is used for reporting the segment state after inserting a rune. // It is returned by streamSafe.next. type ssState int const ( // Indicates a rune was successfully added to the segment. ssSuccess ssState = iota // Indicates a rune starts a new segment and should not be added. ssStarter // Indicates a rune caused a segment overflow and a CGJ should be inserted. ssOverflow ) // streamSafe implements the policy of when a CGJ should be inserted. type streamSafe uint8 // first inserts the first rune of a segment. It is a faster version of next if // it is known p represents the first rune in a segment. func (ss *streamSafe) first(p Properties) { *ss = streamSafe(p.nTrailingNonStarters()) } // insert returns a ssState value to indicate whether a rune represented by p // can be inserted. func (ss *streamSafe) next(p Properties) ssState { if *ss > maxNonStarters { panic("streamSafe was not reset") } n := p.nLeadingNonStarters() if *ss += streamSafe(n); *ss > maxNonStarters { *ss = 0 return ssOverflow } // The Stream-Safe Text Processing prescribes that the counting can stop // as soon as a starter is encountered. However, there are some starters, // like Jamo V and T, that can combine with other runes, leaving their // successive non-starters appended to the previous, possibly causing an // overflow. We will therefore consider any rune with a non-zero nLead to // be a non-starter. Note that it always hold that if nLead > 0 then // nLead == nTrail. if n == 0 { *ss = streamSafe(p.nTrailingNonStarters()) return ssStarter } return ssSuccess } // backwards is used for checking for overflow and segment starts // when traversing a string backwards. Users do not need to call first // for the first rune. The state of the streamSafe retains the count of // the non-starters loaded. func (ss *streamSafe) backwards(p Properties) ssState { if *ss > maxNonStarters { panic("streamSafe was not reset") } c := *ss + streamSafe(p.nTrailingNonStarters()) if c > maxNonStarters { return ssOverflow } *ss = c if p.nLeadingNonStarters() == 0 { return ssStarter } return ssSuccess } func (ss streamSafe) isMax() bool { return ss == maxNonStarters } // GraphemeJoiner is inserted after maxNonStarters non-starter runes. const GraphemeJoiner = "\u034F" // reorderBuffer is used to normalize a single segment. Characters inserted with // insert are decomposed and reordered based on CCC. The compose method can // be used to recombine characters. Note that the byte buffer does not hold // the UTF-8 characters in order. Only the rune array is maintained in sorted // order. flush writes the resulting segment to a byte array. type reorderBuffer struct { rune [maxBufferSize]Properties // Per character info. byte [maxByteBufferSize]byte // UTF-8 buffer. Referenced by runeInfo.pos. nbyte uint8 // Number or bytes. ss streamSafe // For limiting length of non-starter sequence. nrune int // Number of runeInfos. f formInfo src input nsrc int tmpBytes input out []byte flushF func(*reorderBuffer) bool } func (rb *reorderBuffer) init(f Form, src []byte) { rb.f = *formTable[f] rb.src.setBytes(src) rb.nsrc = len(src) rb.ss = 0 } func (rb *reorderBuffer) initString(f Form, src string) { rb.f = *formTable[f] rb.src.setString(src) rb.nsrc = len(src) rb.ss = 0 } func (rb *reorderBuffer) setFlusher(out []byte, f func(*reorderBuffer) bool) { rb.out = out rb.flushF = f } // reset discards all characters from the buffer. func (rb *reorderBuffer) reset() { rb.nrune = 0 rb.nbyte = 0 } func (rb *reorderBuffer) doFlush() bool { if rb.f.composing { rb.compose() } res := rb.flushF(rb) rb.reset() return res } // appendFlush appends the normalized segment to rb.out. func appendFlush(rb *reorderBuffer) bool { for i := 0; i < rb.nrune; i++ { start := rb.rune[i].pos end := start + rb.rune[i].size rb.out = append(rb.out, rb.byte[start:end]...) } return true } // flush appends the normalized segment to out and resets rb. func (rb *reorderBuffer) flush(out []byte) []byte { for i := 0; i < rb.nrune; i++ { start := rb.rune[i].pos end := start + rb.rune[i].size out = append(out, rb.byte[start:end]...) } rb.reset() return out } // flushCopy copies the normalized segment to buf and resets rb. // It returns the number of bytes written to buf. func (rb *reorderBuffer) flushCopy(buf []byte) int { p := 0 for i := 0; i < rb.nrune; i++ { runep := rb.rune[i] p += copy(buf[p:], rb.byte[runep.pos:runep.pos+runep.size]) } rb.reset() return p } // insertOrdered inserts a rune in the buffer, ordered by Canonical Combining Class. // It returns false if the buffer is not large enough to hold the rune. // It is used internally by insert and insertString only. func (rb *reorderBuffer) insertOrdered(info Properties) { n := rb.nrune b := rb.rune[:] cc := info.ccc if cc > 0 { // Find insertion position + move elements to make room. for ; n > 0; n-- { if b[n-1].ccc <= cc { break } b[n] = b[n-1] } } rb.nrune += 1 pos := uint8(rb.nbyte) rb.nbyte += utf8.UTFMax info.pos = pos b[n] = info } // insertErr is an error code returned by insert. Using this type instead // of error improves performance up to 20% for many of the benchmarks. type insertErr int const ( iSuccess insertErr = -iota iShortDst iShortSrc ) // insertFlush inserts the given rune in the buffer ordered by CCC. // If a decomposition with multiple segments are encountered, they leading // ones are flushed. // It returns a non-zero error code if the rune was not inserted. func (rb *reorderBuffer) insertFlush(src input, i int, info Properties) insertErr { if rune := src.hangul(i); rune != 0 { rb.decomposeHangul(rune) return iSuccess } if info.hasDecomposition() { return rb.insertDecomposed(info.Decomposition()) } rb.insertSingle(src, i, info) return iSuccess } // insertUnsafe inserts the given rune in the buffer ordered by CCC. // It is assumed there is sufficient space to hold the runes. It is the // responsibility of the caller to ensure this. This can be done by checking // the state returned by the streamSafe type. func (rb *reorderBuffer) insertUnsafe(src input, i int, info Properties) { if rune := src.hangul(i); rune != 0 { rb.decomposeHangul(rune) } if info.hasDecomposition() { // TODO: inline. rb.insertDecomposed(info.Decomposition()) } else { rb.insertSingle(src, i, info) } } // insertDecomposed inserts an entry in to the reorderBuffer for each rune // in dcomp. dcomp must be a sequence of decomposed UTF-8-encoded runes. // It flushes the buffer on each new segment start. func (rb *reorderBuffer) insertDecomposed(dcomp []byte) insertErr { rb.tmpBytes.setBytes(dcomp) // As the streamSafe accounting already handles the counting for modifiers, // we don't have to call next. However, we do need to keep the accounting // intact when flushing the buffer. for i := 0; i < len(dcomp); { info := rb.f.info(rb.tmpBytes, i) if info.BoundaryBefore() && rb.nrune > 0 && !rb.doFlush() { return iShortDst } i += copy(rb.byte[rb.nbyte:], dcomp[i:i+int(info.size)]) rb.insertOrdered(info) } return iSuccess } // insertSingle inserts an entry in the reorderBuffer for the rune at // position i. info is the runeInfo for the rune at position i. func (rb *reorderBuffer) insertSingle(src input, i int, info Properties) { src.copySlice(rb.byte[rb.nbyte:], i, i+int(info.size)) rb.insertOrdered(info) } // insertCGJ inserts a Combining Grapheme Joiner (0x034f) into rb. func (rb *reorderBuffer) insertCGJ() { rb.insertSingle(input{str: GraphemeJoiner}, 0, Properties{size: uint8(len(GraphemeJoiner))}) } // appendRune inserts a rune at the end of the buffer. It is used for Hangul. func (rb *reorderBuffer) appendRune(r rune) { bn := rb.nbyte sz := utf8.EncodeRune(rb.byte[bn:], rune(r)) rb.nbyte += utf8.UTFMax rb.rune[rb.nrune] = Properties{pos: bn, size: uint8(sz)} rb.nrune++ } // assignRune sets a rune at position pos. It is used for Hangul and recomposition. func (rb *reorderBuffer) assignRune(pos int, r rune) { bn := rb.rune[pos].pos sz := utf8.EncodeRune(rb.byte[bn:], rune(r)) rb.rune[pos] = Properties{pos: bn, size: uint8(sz)} } // runeAt returns the rune at position n. It is used for Hangul and recomposition. func (rb *reorderBuffer) runeAt(n int) rune { inf := rb.rune[n] r, _ := utf8.DecodeRune(rb.byte[inf.pos : inf.pos+inf.size]) return r } // bytesAt returns the UTF-8 encoding of the rune at position n. // It is used for Hangul and recomposition. func (rb *reorderBuffer) bytesAt(n int) []byte { inf := rb.rune[n] return rb.byte[inf.pos : int(inf.pos)+int(inf.size)] } // For Hangul we combine algorithmically, instead of using tables. const ( hangulBase = 0xAC00 // UTF-8(hangulBase) -> EA B0 80 hangulBase0 = 0xEA hangulBase1 = 0xB0 hangulBase2 = 0x80 hangulEnd = hangulBase + jamoLVTCount // UTF-8(0xD7A4) -> ED 9E A4 hangulEnd0 = 0xED hangulEnd1 = 0x9E hangulEnd2 = 0xA4 jamoLBase = 0x1100 // UTF-8(jamoLBase) -> E1 84 00 jamoLBase0 = 0xE1 jamoLBase1 = 0x84 jamoLEnd = 0x1113 jamoVBase = 0x1161 jamoVEnd = 0x1176 jamoTBase = 0x11A7 jamoTEnd = 0x11C3 jamoTCount = 28 jamoVCount = 21 jamoVTCount = 21 * 28 jamoLVTCount = 19 * 21 * 28 ) const hangulUTF8Size = 3 func isHangul(b []byte) bool { if len(b) < hangulUTF8Size { return false } b0 := b[0] if b0 < hangulBase0 { return false } b1 := b[1] switch { case b0 == hangulBase0: return b1 >= hangulBase1 case b0 < hangulEnd0: return true case b0 > hangulEnd0: return false case b1 < hangulEnd1: return true } return b1 == hangulEnd1 && b[2] < hangulEnd2 } func isHangulString(b string) bool { if len(b) < hangulUTF8Size { return false } b0 := b[0] if b0 < hangulBase0 { return false } b1 := b[1] switch { case b0 == hangulBase0: return b1 >= hangulBase1 case b0 < hangulEnd0: return true case b0 > hangulEnd0: return false case b1 < hangulEnd1: return true } return b1 == hangulEnd1 && b[2] < hangulEnd2 } // Caller must ensure len(b) >= 2. func isJamoVT(b []byte) bool { // True if (rune & 0xff00) == jamoLBase return b[0] == jamoLBase0 && (b[1]&0xFC) == jamoLBase1 } func isHangulWithoutJamoT(b []byte) bool { c, _ := utf8.DecodeRune(b) c -= hangulBase return c < jamoLVTCount && c%jamoTCount == 0 } // decomposeHangul writes the decomposed Hangul to buf and returns the number // of bytes written. len(buf) should be at least 9. func decomposeHangul(buf []byte, r rune) int { const JamoUTF8Len = 3 r -= hangulBase x := r % jamoTCount r /= jamoTCount utf8.EncodeRune(buf, jamoLBase+r/jamoVCount) utf8.EncodeRune(buf[JamoUTF8Len:], jamoVBase+r%jamoVCount) if x != 0 { utf8.EncodeRune(buf[2*JamoUTF8Len:], jamoTBase+x) return 3 * JamoUTF8Len } return 2 * JamoUTF8Len } // decomposeHangul algorithmically decomposes a Hangul rune into // its Jamo components. // See https://unicode.org/reports/tr15/#Hangul for details on decomposing Hangul. func (rb *reorderBuffer) decomposeHangul(r rune) { r -= hangulBase x := r % jamoTCount r /= jamoTCount rb.appendRune(jamoLBase + r/jamoVCount) rb.appendRune(jamoVBase + r%jamoVCount) if x != 0 { rb.appendRune(jamoTBase + x) } } // combineHangul algorithmically combines Jamo character components into Hangul. // See https://unicode.org/reports/tr15/#Hangul for details on combining Hangul. func (rb *reorderBuffer) combineHangul(s, i, k int) { b := rb.rune[:] bn := rb.nrune for ; i < bn; i++ { cccB := b[k-1].ccc cccC := b[i].ccc if cccB == 0 { s = k - 1 } if s != k-1 && cccB >= cccC { // b[i] is blocked by greater-equal cccX below it b[k] = b[i] k++ } else { l := rb.runeAt(s) // also used to compare to hangulBase v := rb.runeAt(i) // also used to compare to jamoT switch { case jamoLBase <= l && l < jamoLEnd && jamoVBase <= v && v < jamoVEnd: // 11xx plus 116x to LV rb.assignRune(s, hangulBase+ (l-jamoLBase)*jamoVTCount+(v-jamoVBase)*jamoTCount) case hangulBase <= l && l < hangulEnd && jamoTBase < v && v < jamoTEnd && ((l-hangulBase)%jamoTCount) == 0: // ACxx plus 11Ax to LVT rb.assignRune(s, l+v-jamoTBase) default: b[k] = b[i] k++ } } } rb.nrune = k } // compose recombines the runes in the buffer. // It should only be used to recompose a single segment, as it will not // handle alternations between Hangul and non-Hangul characters correctly. func (rb *reorderBuffer) compose() { // Lazily load the map used by the combine func below, but do // it outside of the loop. recompMapOnce.Do(buildRecompMap) // UAX #15, section X5 , including Corrigendum #5 // "In any character sequence beginning with starter S, a character C is // blocked from S if and only if there is some character B between S // and C, and either B is a starter or it has the same or higher // combining class as C." bn := rb.nrune if bn == 0 { return } k := 1 b := rb.rune[:] for s, i := 0, 1; i < bn; i++ { if isJamoVT(rb.bytesAt(i)) { // Redo from start in Hangul mode. Necessary to support // U+320E..U+321E in NFKC mode. rb.combineHangul(s, i, k) return } ii := b[i] // We can only use combineForward as a filter if we later // get the info for the combined character. This is more // expensive than using the filter. Using combinesBackward() // is safe. if ii.combinesBackward() { cccB := b[k-1].ccc cccC := ii.ccc blocked := false // b[i] blocked by starter or greater or equal CCC? if cccB == 0 { s = k - 1 } else { blocked = s != k-1 && cccB >= cccC } if !blocked { combined := combine(rb.runeAt(s), rb.runeAt(i)) if combined != 0 { rb.assignRune(s, combined) continue } } } b[k] = b[i] k++ } rb.nrune = k }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/iter.go
vendor/golang.org/x/text/unicode/norm/iter.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package norm import ( "fmt" "unicode/utf8" ) // MaxSegmentSize is the maximum size of a byte buffer needed to consider any // sequence of starter and non-starter runes for the purpose of normalization. const MaxSegmentSize = maxByteBufferSize // An Iter iterates over a string or byte slice, while normalizing it // to a given Form. type Iter struct { rb reorderBuffer buf [maxByteBufferSize]byte info Properties // first character saved from previous iteration next iterFunc // implementation of next depends on form asciiF iterFunc p int // current position in input source multiSeg []byte // remainder of multi-segment decomposition } type iterFunc func(*Iter) []byte // Init initializes i to iterate over src after normalizing it to Form f. func (i *Iter) Init(f Form, src []byte) { i.p = 0 if len(src) == 0 { i.setDone() i.rb.nsrc = 0 return } i.multiSeg = nil i.rb.init(f, src) i.next = i.rb.f.nextMain i.asciiF = nextASCIIBytes i.info = i.rb.f.info(i.rb.src, i.p) i.rb.ss.first(i.info) } // InitString initializes i to iterate over src after normalizing it to Form f. func (i *Iter) InitString(f Form, src string) { i.p = 0 if len(src) == 0 { i.setDone() i.rb.nsrc = 0 return } i.multiSeg = nil i.rb.initString(f, src) i.next = i.rb.f.nextMain i.asciiF = nextASCIIString i.info = i.rb.f.info(i.rb.src, i.p) i.rb.ss.first(i.info) } // Seek sets the segment to be returned by the next call to Next to start // at position p. It is the responsibility of the caller to set p to the // start of a segment. func (i *Iter) Seek(offset int64, whence int) (int64, error) { var abs int64 switch whence { case 0: abs = offset case 1: abs = int64(i.p) + offset case 2: abs = int64(i.rb.nsrc) + offset default: return 0, fmt.Errorf("norm: invalid whence") } if abs < 0 { return 0, fmt.Errorf("norm: negative position") } if int(abs) >= i.rb.nsrc { i.setDone() return int64(i.p), nil } i.p = int(abs) i.multiSeg = nil i.next = i.rb.f.nextMain i.info = i.rb.f.info(i.rb.src, i.p) i.rb.ss.first(i.info) return abs, nil } // returnSlice returns a slice of the underlying input type as a byte slice. // If the underlying is of type []byte, it will simply return a slice. // If the underlying is of type string, it will copy the slice to the buffer // and return that. func (i *Iter) returnSlice(a, b int) []byte { if i.rb.src.bytes == nil { return i.buf[:copy(i.buf[:], i.rb.src.str[a:b])] } return i.rb.src.bytes[a:b] } // Pos returns the byte position at which the next call to Next will commence processing. func (i *Iter) Pos() int { return i.p } func (i *Iter) setDone() { i.next = nextDone i.p = i.rb.nsrc } // Done returns true if there is no more input to process. func (i *Iter) Done() bool { return i.p >= i.rb.nsrc } // Next returns f(i.input[i.Pos():n]), where n is a boundary of i.input. // For any input a and b for which f(a) == f(b), subsequent calls // to Next will return the same segments. // Modifying runes are grouped together with the preceding starter, if such a starter exists. // Although not guaranteed, n will typically be the smallest possible n. func (i *Iter) Next() []byte { return i.next(i) } func nextASCIIBytes(i *Iter) []byte { p := i.p + 1 if p >= i.rb.nsrc { p0 := i.p i.setDone() return i.rb.src.bytes[p0:p] } if i.rb.src.bytes[p] < utf8.RuneSelf { p0 := i.p i.p = p return i.rb.src.bytes[p0:p] } i.info = i.rb.f.info(i.rb.src, i.p) i.next = i.rb.f.nextMain return i.next(i) } func nextASCIIString(i *Iter) []byte { p := i.p + 1 if p >= i.rb.nsrc { i.buf[0] = i.rb.src.str[i.p] i.setDone() return i.buf[:1] } if i.rb.src.str[p] < utf8.RuneSelf { i.buf[0] = i.rb.src.str[i.p] i.p = p return i.buf[:1] } i.info = i.rb.f.info(i.rb.src, i.p) i.next = i.rb.f.nextMain return i.next(i) } func nextHangul(i *Iter) []byte { p := i.p next := p + hangulUTF8Size if next >= i.rb.nsrc { i.setDone() } else if i.rb.src.hangul(next) == 0 { i.rb.ss.next(i.info) i.info = i.rb.f.info(i.rb.src, i.p) i.next = i.rb.f.nextMain return i.next(i) } i.p = next return i.buf[:decomposeHangul(i.buf[:], i.rb.src.hangul(p))] } func nextDone(i *Iter) []byte { return nil } // nextMulti is used for iterating over multi-segment decompositions // for decomposing normal forms. func nextMulti(i *Iter) []byte { j := 0 d := i.multiSeg // skip first rune for j = 1; j < len(d) && !utf8.RuneStart(d[j]); j++ { } for j < len(d) { info := i.rb.f.info(input{bytes: d}, j) if info.BoundaryBefore() { i.multiSeg = d[j:] return d[:j] } j += int(info.size) } // treat last segment as normal decomposition i.next = i.rb.f.nextMain return i.next(i) } // nextMultiNorm is used for iterating over multi-segment decompositions // for composing normal forms. func nextMultiNorm(i *Iter) []byte { j := 0 d := i.multiSeg for j < len(d) { info := i.rb.f.info(input{bytes: d}, j) if info.BoundaryBefore() { i.rb.compose() seg := i.buf[:i.rb.flushCopy(i.buf[:])] i.rb.insertUnsafe(input{bytes: d}, j, info) i.multiSeg = d[j+int(info.size):] return seg } i.rb.insertUnsafe(input{bytes: d}, j, info) j += int(info.size) } i.multiSeg = nil i.next = nextComposed return doNormComposed(i) } // nextDecomposed is the implementation of Next for forms NFD and NFKD. func nextDecomposed(i *Iter) (next []byte) { outp := 0 inCopyStart, outCopyStart := i.p, 0 for { if sz := int(i.info.size); sz <= 1 { i.rb.ss = 0 p := i.p i.p++ // ASCII or illegal byte. Either way, advance by 1. if i.p >= i.rb.nsrc { i.setDone() return i.returnSlice(p, i.p) } else if i.rb.src._byte(i.p) < utf8.RuneSelf { i.next = i.asciiF return i.returnSlice(p, i.p) } outp++ } else if d := i.info.Decomposition(); d != nil { // Note: If leading CCC != 0, then len(d) == 2 and last is also non-zero. // Case 1: there is a leftover to copy. In this case the decomposition // must begin with a modifier and should always be appended. // Case 2: no leftover. Simply return d if followed by a ccc == 0 value. p := outp + len(d) if outp > 0 { i.rb.src.copySlice(i.buf[outCopyStart:], inCopyStart, i.p) // TODO: this condition should not be possible, but we leave it // in for defensive purposes. if p > len(i.buf) { return i.buf[:outp] } } else if i.info.multiSegment() { // outp must be 0 as multi-segment decompositions always // start a new segment. if i.multiSeg == nil { i.multiSeg = d i.next = nextMulti return nextMulti(i) } // We are in the last segment. Treat as normal decomposition. d = i.multiSeg i.multiSeg = nil p = len(d) } prevCC := i.info.tccc if i.p += sz; i.p >= i.rb.nsrc { i.setDone() i.info = Properties{} // Force BoundaryBefore to succeed. } else { i.info = i.rb.f.info(i.rb.src, i.p) } switch i.rb.ss.next(i.info) { case ssOverflow: i.next = nextCGJDecompose fallthrough case ssStarter: if outp > 0 { copy(i.buf[outp:], d) return i.buf[:p] } return d } copy(i.buf[outp:], d) outp = p inCopyStart, outCopyStart = i.p, outp if i.info.ccc < prevCC { goto doNorm } continue } else if r := i.rb.src.hangul(i.p); r != 0 { outp = decomposeHangul(i.buf[:], r) i.p += hangulUTF8Size inCopyStart, outCopyStart = i.p, outp if i.p >= i.rb.nsrc { i.setDone() break } else if i.rb.src.hangul(i.p) != 0 { i.next = nextHangul return i.buf[:outp] } } else { p := outp + sz if p > len(i.buf) { break } outp = p i.p += sz } if i.p >= i.rb.nsrc { i.setDone() break } prevCC := i.info.tccc i.info = i.rb.f.info(i.rb.src, i.p) if v := i.rb.ss.next(i.info); v == ssStarter { break } else if v == ssOverflow { i.next = nextCGJDecompose break } if i.info.ccc < prevCC { goto doNorm } } if outCopyStart == 0 { return i.returnSlice(inCopyStart, i.p) } else if inCopyStart < i.p { i.rb.src.copySlice(i.buf[outCopyStart:], inCopyStart, i.p) } return i.buf[:outp] doNorm: // Insert what we have decomposed so far in the reorderBuffer. // As we will only reorder, there will always be enough room. i.rb.src.copySlice(i.buf[outCopyStart:], inCopyStart, i.p) i.rb.insertDecomposed(i.buf[0:outp]) return doNormDecomposed(i) } func doNormDecomposed(i *Iter) []byte { for { i.rb.insertUnsafe(i.rb.src, i.p, i.info) if i.p += int(i.info.size); i.p >= i.rb.nsrc { i.setDone() break } i.info = i.rb.f.info(i.rb.src, i.p) if i.info.ccc == 0 { break } if s := i.rb.ss.next(i.info); s == ssOverflow { i.next = nextCGJDecompose break } } // new segment or too many combining characters: exit normalization return i.buf[:i.rb.flushCopy(i.buf[:])] } func nextCGJDecompose(i *Iter) []byte { i.rb.ss = 0 i.rb.insertCGJ() i.next = nextDecomposed i.rb.ss.first(i.info) buf := doNormDecomposed(i) return buf } // nextComposed is the implementation of Next for forms NFC and NFKC. func nextComposed(i *Iter) []byte { outp, startp := 0, i.p var prevCC uint8 for { if !i.info.isYesC() { goto doNorm } prevCC = i.info.tccc sz := int(i.info.size) if sz == 0 { sz = 1 // illegal rune: copy byte-by-byte } p := outp + sz if p > len(i.buf) { break } outp = p i.p += sz if i.p >= i.rb.nsrc { i.setDone() break } else if i.rb.src._byte(i.p) < utf8.RuneSelf { i.rb.ss = 0 i.next = i.asciiF break } i.info = i.rb.f.info(i.rb.src, i.p) if v := i.rb.ss.next(i.info); v == ssStarter { break } else if v == ssOverflow { i.next = nextCGJCompose break } if i.info.ccc < prevCC { goto doNorm } } return i.returnSlice(startp, i.p) doNorm: // reset to start position i.p = startp i.info = i.rb.f.info(i.rb.src, i.p) i.rb.ss.first(i.info) if i.info.multiSegment() { d := i.info.Decomposition() info := i.rb.f.info(input{bytes: d}, 0) i.rb.insertUnsafe(input{bytes: d}, 0, info) i.multiSeg = d[int(info.size):] i.next = nextMultiNorm return nextMultiNorm(i) } i.rb.ss.first(i.info) i.rb.insertUnsafe(i.rb.src, i.p, i.info) return doNormComposed(i) } func doNormComposed(i *Iter) []byte { // First rune should already be inserted. for { if i.p += int(i.info.size); i.p >= i.rb.nsrc { i.setDone() break } i.info = i.rb.f.info(i.rb.src, i.p) if s := i.rb.ss.next(i.info); s == ssStarter { break } else if s == ssOverflow { i.next = nextCGJCompose break } i.rb.insertUnsafe(i.rb.src, i.p, i.info) } i.rb.compose() seg := i.buf[:i.rb.flushCopy(i.buf[:])] return seg } func nextCGJCompose(i *Iter) []byte { i.rb.ss = 0 // instead of first i.rb.insertCGJ() i.next = nextComposed // Note that we treat any rune with nLeadingNonStarters > 0 as a non-starter, // even if they are not. This is particularly dubious for U+FF9E and UFF9A. // If we ever change that, insert a check here. i.rb.ss.first(i.info) i.rb.insertUnsafe(i.rb.src, i.p, i.info) return doNormComposed(i) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go
vendor/golang.org/x/text/unicode/norm/tables15.0.0.go
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.21 package norm import "sync" const ( // Version is the Unicode edition from which the tables are derived. Version = "15.0.0" // MaxTransformChunkSize indicates the maximum number of bytes that Transform // may need to write atomically for any Form. Making a destination buffer at // least this size ensures that Transform can always make progress and that // the user does not need to grow the buffer on an ErrShortDst. MaxTransformChunkSize = 35 + maxNonStarters*4 ) var ccc = [56]uint8{ 0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 84, 91, 103, 107, 118, 122, 129, 130, 132, 202, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 233, 234, 240, } const ( firstMulti = 0x199A firstCCC = 0x2DD5 endMulti = 0x30A1 firstLeadingCCC = 0x4AEF firstCCCZeroExcept = 0x4BB9 firstStarterWithNLead = 0x4BE0 lastDecomp = 0x4BE2 maxDecomp = 0x8000 ) // decomps: 19426 bytes var decomps = [...]byte{ // Bytes 0 - 3f 0x00, 0x41, 0x20, 0x41, 0x21, 0x41, 0x22, 0x41, 0x23, 0x41, 0x24, 0x41, 0x25, 0x41, 0x26, 0x41, 0x27, 0x41, 0x28, 0x41, 0x29, 0x41, 0x2A, 0x41, 0x2B, 0x41, 0x2C, 0x41, 0x2D, 0x41, 0x2E, 0x41, 0x2F, 0x41, 0x30, 0x41, 0x31, 0x41, 0x32, 0x41, 0x33, 0x41, 0x34, 0x41, 0x35, 0x41, 0x36, 0x41, 0x37, 0x41, 0x38, 0x41, 0x39, 0x41, 0x3A, 0x41, 0x3B, 0x41, 0x3C, 0x41, 0x3D, 0x41, 0x3E, 0x41, // Bytes 40 - 7f 0x3F, 0x41, 0x40, 0x41, 0x41, 0x41, 0x42, 0x41, 0x43, 0x41, 0x44, 0x41, 0x45, 0x41, 0x46, 0x41, 0x47, 0x41, 0x48, 0x41, 0x49, 0x41, 0x4A, 0x41, 0x4B, 0x41, 0x4C, 0x41, 0x4D, 0x41, 0x4E, 0x41, 0x4F, 0x41, 0x50, 0x41, 0x51, 0x41, 0x52, 0x41, 0x53, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, 0x57, 0x41, 0x58, 0x41, 0x59, 0x41, 0x5A, 0x41, 0x5B, 0x41, 0x5C, 0x41, 0x5D, 0x41, 0x5E, 0x41, // Bytes 80 - bf 0x5F, 0x41, 0x60, 0x41, 0x61, 0x41, 0x62, 0x41, 0x63, 0x41, 0x64, 0x41, 0x65, 0x41, 0x66, 0x41, 0x67, 0x41, 0x68, 0x41, 0x69, 0x41, 0x6A, 0x41, 0x6B, 0x41, 0x6C, 0x41, 0x6D, 0x41, 0x6E, 0x41, 0x6F, 0x41, 0x70, 0x41, 0x71, 0x41, 0x72, 0x41, 0x73, 0x41, 0x74, 0x41, 0x75, 0x41, 0x76, 0x41, 0x77, 0x41, 0x78, 0x41, 0x79, 0x41, 0x7A, 0x41, 0x7B, 0x41, 0x7C, 0x41, 0x7D, 0x41, 0x7E, 0x42, // Bytes c0 - ff 0xC2, 0xA2, 0x42, 0xC2, 0xA3, 0x42, 0xC2, 0xA5, 0x42, 0xC2, 0xA6, 0x42, 0xC2, 0xAC, 0x42, 0xC2, 0xB7, 0x42, 0xC3, 0x86, 0x42, 0xC3, 0xA6, 0x42,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DA, 0x80, 0x42, 0xDA, 0x83, 0x42, 0xDA, 0x84, 0x42, 0xDA, 0x86, 0x42, 0xDA, 0x87, 0x42, 0xDA, 0x88, 0x42, 0xDA, 0x8C, 0x42, 0xDA, 0x8D, 0x42, 0xDA, 0x8E, 0x42, 0xDA, 0x91, 0x42, 0xDA, 0x98, 0x42, // Bytes 3c0 - 3ff 0xDA, 0xA1, 0x42, 0xDA, 0xA4, 0x42, 0xDA, 0xA6, 0x42, 0xDA, 0xA9, 0x42, 0xDA, 0xAD, 0x42, 0xDA, 0xAF, 0x42, 0xDA, 0xB1, 0x42, 0xDA, 0xB3, 0x42, 0xDA, 0xBA, 0x42, 0xDA, 0xBB, 0x42, 0xDA, 0xBE, 0x42, 0xDB, 0x81, 0x42, 0xDB, 0x85, 0x42, 0xDB, 0x86, 0x42, 0xDB, 0x87, 0x42, 0xDB, 0x88, 0x42, 0xDB, 0x89, 0x42, 0xDB, 0x8B, 0x42, 0xDB, 0x8C, 0x42, 0xDB, 0x90, 0x42, 0xDB, 0x92, 0x43, 0xE0, // Bytes 400 - 43f 0xBC, 0x8B, 0x43, 0xE1, 0x83, 0x9C, 0x43, 0xE1, 0x84, 0x80, 0x43, 0xE1, 0x84, 0x81, 0x43, 0xE1, 0x84, 0x82, 0x43, 0xE1, 0x84, 0x83, 0x43, 0xE1, 0x84, 0x84, 0x43, 0xE1, 0x84, 0x85, 0x43, 0xE1, 0x84, 0x86, 0x43, 0xE1, 0x84, 0x87, 0x43, 0xE1, 0x84, 0x88, 0x43, 0xE1, 0x84, 0x89, 0x43, 0xE1, 0x84, 0x8A, 0x43, 0xE1, 0x84, 0x8B, 0x43, 0xE1, 0x84, 0x8C, 0x43, 0xE1, 0x84, 0x8D, 0x43, 0xE1, // Bytes 440 - 47f 0x84, 0x8E, 0x43, 0xE1, 0x84, 0x8F, 0x43, 0xE1, 0x84, 0x90, 0x43, 0xE1, 0x84, 0x91, 0x43, 0xE1, 0x84, 0x92, 0x43, 0xE1, 0x84, 0x94, 0x43, 0xE1, 0x84, 0x95, 0x43, 0xE1, 0x84, 0x9A, 0x43, 0xE1, 0x84, 0x9C, 0x43, 0xE1, 0x84, 0x9D, 0x43, 0xE1, 0x84, 0x9E, 0x43, 0xE1, 0x84, 0xA0, 0x43, 0xE1, 0x84, 0xA1, 0x43, 0xE1, 0x84, 0xA2, 0x43, 0xE1, 0x84, 0xA3, 0x43, 0xE1, 0x84, 0xA7, 0x43, 0xE1, // Bytes 480 - 4bf 0x84, 0xA9, 0x43, 0xE1, 0x84, 0xAB, 0x43, 0xE1, 0x84, 0xAC, 0x43, 0xE1, 0x84, 0xAD, 0x43, 0xE1, 0x84, 0xAE, 0x43, 0xE1, 0x84, 0xAF, 0x43, 0xE1, 0x84, 0xB2, 0x43, 0xE1, 0x84, 0xB6, 0x43, 0xE1, 0x85, 0x80, 0x43, 0xE1, 0x85, 0x87, 0x43, 0xE1, 0x85, 0x8C, 0x43, 0xE1, 0x85, 0x97, 0x43, 0xE1, 0x85, 0x98, 0x43, 0xE1, 0x85, 0x99, 0x43, 0xE1, 0x85, 0xA0, 0x43, 0xE1, 0x86, 0x84, 0x43, 0xE1, // Bytes 4c0 - 4ff 0x86, 0x85, 0x43, 0xE1, 0x86, 0x88, 0x43, 0xE1, 0x86, 0x91, 0x43, 0xE1, 0x86, 0x92, 0x43, 0xE1, 0x86, 0x94, 0x43, 0xE1, 0x86, 0x9E, 0x43, 0xE1, 0x86, 0xA1, 0x43, 0xE1, 0x87, 0x87, 0x43, 0xE1, 0x87, 0x88, 0x43, 0xE1, 0x87, 0x8C, 0x43, 0xE1, 0x87, 0x8E, 0x43, 0xE1, 0x87, 0x93, 0x43, 0xE1, 0x87, 0x97, 0x43, 0xE1, 0x87, 0x99, 0x43, 0xE1, 0x87, 0x9D, 0x43, 0xE1, 0x87, 0x9F, 0x43, 0xE1, // Bytes 500 - 53f 0x87, 0xB1, 0x43, 0xE1, 0x87, 0xB2, 0x43, 0xE1, 0xB4, 0x82, 0x43, 0xE1, 0xB4, 0x96, 0x43, 0xE1, 0xB4, 0x97, 0x43, 0xE1, 0xB4, 0x9C, 0x43, 0xE1, 0xB4, 0x9D, 0x43, 0xE1, 0xB4, 0xA5, 0x43, 0xE1, 0xB5, 0xBB, 0x43, 0xE1, 0xB6, 0x85, 0x43, 0xE1, 0xB6, 0x91, 0x43, 0xE2, 0x80, 0x82, 0x43, 0xE2, 0x80, 0x83, 0x43, 0xE2, 0x80, 0x90, 0x43, 0xE2, 0x80, 0x93, 0x43, 0xE2, 0x80, 0x94, 0x43, 0xE2, // Bytes 540 - 57f 0x82, 0xA9, 0x43, 0xE2, 0x86, 0x90, 0x43, 0xE2, 0x86, 0x91, 0x43, 0xE2, 0x86, 0x92, 0x43, 0xE2, 0x86, 0x93, 0x43, 0xE2, 0x88, 0x82, 0x43, 0xE2, 0x88, 0x87, 0x43, 0xE2, 0x88, 0x91, 0x43, 0xE2, 0x88, 0x92, 0x43, 0xE2, 0x94, 0x82, 0x43, 0xE2, 0x96, 0xA0, 0x43, 0xE2, 0x97, 0x8B, 0x43, 0xE2, 0xA6, 0x85, 0x43, 0xE2, 0xA6, 0x86, 0x43, 0xE2, 0xB1, 0xB1, 0x43, 0xE2, 0xB5, 0xA1, 0x43, 0xE3, // Bytes 580 - 5bf 0x80, 0x81, 0x43, 0xE3, 0x80, 0x82, 0x43, 0xE3, 0x80, 0x88, 0x43, 0xE3, 0x80, 0x89, 0x43, 0xE3, 0x80, 0x8A, 0x43, 0xE3, 0x80, 0x8B, 0x43, 0xE3, 0x80, 0x8C, 0x43, 0xE3, 0x80, 0x8D, 0x43, 0xE3, 0x80, 0x8E, 0x43, 0xE3, 0x80, 0x8F, 0x43, 0xE3, 0x80, 0x90, 0x43, 0xE3, 0x80, 0x91, 0x43, 0xE3, 0x80, 0x92, 0x43, 0xE3, 0x80, 0x94, 0x43, 0xE3, 0x80, 0x95, 0x43, 0xE3, 0x80, 0x96, 0x43, 0xE3, // Bytes 5c0 - 5ff 0x80, 0x97, 0x43, 0xE3, 0x82, 0xA1, 0x43, 0xE3, 0x82, 0xA2, 0x43, 0xE3, 0x82, 0xA3, 0x43, 0xE3, 0x82, 0xA4, 0x43, 0xE3, 0x82, 0xA5, 0x43, 0xE3, 0x82, 0xA6, 0x43, 0xE3, 0x82, 0xA7, 0x43, 0xE3, 0x82, 0xA8, 0x43, 0xE3, 0x82, 0xA9, 0x43, 0xE3, 0x82, 0xAA, 0x43, 0xE3, 0x82, 0xAB, 0x43, 0xE3, 0x82, 0xAD, 0x43, 0xE3, 0x82, 0xAF, 0x43, 0xE3, 0x82, 0xB1, 0x43, 0xE3, 0x82, 0xB3, 0x43, 0xE3, // Bytes 600 - 63f 0x82, 0xB5, 0x43, 0xE3, 0x82, 0xB7, 0x43, 0xE3, 0x82, 0xB9, 0x43, 0xE3, 0x82, 0xBB, 0x43, 0xE3, 0x82, 0xBD, 0x43, 0xE3, 0x82, 0xBF, 0x43, 0xE3, 0x83, 0x81, 0x43, 0xE3, 0x83, 0x83, 0x43, 0xE3, 0x83, 0x84, 0x43, 0xE3, 0x83, 0x86, 0x43, 0xE3, 0x83, 0x88, 0x43, 0xE3, 0x83, 0x8A, 0x43, 0xE3, 0x83, 0x8B, 0x43, 0xE3, 0x83, 0x8C, 0x43, 0xE3, 0x83, 0x8D, 0x43, 0xE3, 0x83, 0x8E, 0x43, 0xE3, // Bytes 640 - 67f 0x83, 0x8F, 0x43, 0xE3, 0x83, 0x92, 0x43, 0xE3, 0x83, 0x95, 0x43, 0xE3, 0x83, 0x98, 0x43, 0xE3, 0x83, 0x9B, 0x43, 0xE3, 0x83, 0x9E, 0x43, 0xE3, 0x83, 0x9F, 0x43, 0xE3, 0x83, 0xA0, 0x43, 0xE3, 0x83, 0xA1, 0x43, 0xE3, 0x83, 0xA2, 0x43, 0xE3, 0x83, 0xA3, 0x43, 0xE3, 0x83, 0xA4, 0x43, 0xE3, 0x83, 0xA5, 0x43, 0xE3, 0x83, 0xA6, 0x43, 0xE3, 0x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, 0x43, 0xE5, 0x85, 0x8D, 0x43, 0xE5, 0x85, 0x94, 0x43, 0xE5, 0x85, 0xA4, 0x43, 0xE5, 0x85, 0xA5, 0x43, 0xE5, 0x85, 0xA7, 0x43, 0xE5, 0x85, 0xA8, 0x43, 0xE5, 0x85, 0xA9, 0x43, 0xE5, 0x85, 0xAB, 0x43, 0xE5, 0x85, 0xAD, 0x43, 0xE5, 0x85, 0xB7, 0x43, 0xE5, 0x86, 0x80, 0x43, 0xE5, 0x86, 0x82, 0x43, 0xE5, 0x86, 0x8D, 0x43, 0xE5, // Bytes 8c0 - 8ff 0x86, 0x92, 0x43, 0xE5, 0x86, 0x95, 0x43, 0xE5, 0x86, 0x96, 0x43, 0xE5, 0x86, 0x97, 0x43, 0xE5, 0x86, 0x99, 0x43, 0xE5, 0x86, 0xA4, 0x43, 0xE5, 0x86, 0xAB, 0x43, 0xE5, 0x86, 0xAC, 0x43, 0xE5, 0x86, 0xB5, 0x43, 0xE5, 0x86, 0xB7, 0x43, 0xE5, 0x87, 0x89, 0x43, 0xE5, 0x87, 0x8C, 0x43, 0xE5, 0x87, 0x9C, 0x43, 0xE5, 0x87, 0x9E, 0x43, 0xE5, 0x87, 0xA0, 0x43, 0xE5, 0x87, 0xB5, 0x43, 0xE5, // Bytes 900 - 93f 0x88, 0x80, 0x43, 0xE5, 0x88, 0x83, 0x43, 0xE5, 0x88, 0x87, 0x43, 0xE5, 0x88, 0x97, 0x43, 0xE5, 0x88, 0x9D, 0x43, 0xE5, 0x88, 0xA9, 0x43, 0xE5, 0x88, 0xBA, 0x43, 0xE5, 0x88, 0xBB, 0x43, 0xE5, 0x89, 0x86, 0x43, 0xE5, 0x89, 0x8D, 0x43, 0xE5, 0x89, 0xB2, 0x43, 0xE5, 0x89, 0xB7, 0x43, 0xE5, 0x8A, 0x89, 0x43, 0xE5, 0x8A, 0x9B, 0x43, 0xE5, 0x8A, 0xA3, 0x43, 0xE5, 0x8A, 0xB3, 0x43, 0xE5, // Bytes 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 0xE5, 0x90, 0x86, 0x43, 0xE5, 0x90, 0x88, 0x43, 0xE5, 0x90, 0x8D, 0x43, 0xE5, 0x90, 0x8F, 0x43, 0xE5, // Bytes a00 - a3f 0x90, 0x9D, 0x43, 0xE5, 0x90, 0xB8, 0x43, 0xE5, 0x90, 0xB9, 0x43, 0xE5, 0x91, 0x82, 0x43, 0xE5, 0x91, 0x88, 0x43, 0xE5, 0x91, 0xA8, 0x43, 0xE5, 0x92, 0x9E, 0x43, 0xE5, 0x92, 0xA2, 0x43, 0xE5, 0x92, 0xBD, 0x43, 0xE5, 0x93, 0xB6, 0x43, 0xE5, 0x94, 0x90, 0x43, 0xE5, 0x95, 0x8F, 0x43, 0xE5, 0x95, 0x93, 0x43, 0xE5, 0x95, 0x95, 0x43, 0xE5, 0x95, 0xA3, 0x43, 0xE5, 0x96, 0x84, 0x43, 0xE5, // Bytes a40 - a7f 0x96, 0x87, 0x43, 0xE5, 0x96, 0x99, 0x43, 0xE5, 0x96, 0x9D, 0x43, 0xE5, 0x96, 0xAB, 0x43, 0xE5, 0x96, 0xB3, 0x43, 0xE5, 0x96, 0xB6, 0x43, 0xE5, 0x97, 0x80, 0x43, 0xE5, 0x97, 0x82, 0x43, 0xE5, 0x97, 0xA2, 0x43, 0xE5, 0x98, 0x86, 0x43, 0xE5, 0x99, 0x91, 0x43, 0xE5, 0x99, 0xA8, 0x43, 0xE5, 0x99, 0xB4, 0x43, 0xE5, 0x9B, 0x97, 0x43, 0xE5, 0x9B, 0x9B, 0x43, 0xE5, 0x9B, 0xB9, 0x43, 0xE5, // Bytes a80 - abf 0x9C, 0x96, 0x43, 0xE5, 0x9C, 0x97, 0x43, 0xE5, 0x9C, 0x9F, 0x43, 0xE5, 0x9C, 0xB0, 0x43, 0xE5, 0x9E, 0x8B, 0x43, 0xE5, 0x9F, 0x8E, 0x43, 0xE5, 0x9F, 0xB4, 0x43, 0xE5, 0xA0, 0x8D, 0x43, 0xE5, 0xA0, 0xB1, 0x43, 0xE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88, 0x43, 0xE6, 0x85, 0x84, 0x43, 0xE6, 0x85, 0x88, 0x43, 0xE6, 0x85, 0x8C, 0x43, 0xE6, // Bytes cc0 - cff 0x85, 0x8E, 0x43, 0xE6, 0x85, 0xA0, 0x43, 0xE6, 0x85, 0xA8, 0x43, 0xE6, 0x85, 0xBA, 0x43, 0xE6, 0x86, 0x8E, 0x43, 0xE6, 0x86, 0x90, 0x43, 0xE6, 0x86, 0xA4, 0x43, 0xE6, 0x86, 0xAF, 0x43, 0xE6, 0x86, 0xB2, 0x43, 0xE6, 0x87, 0x9E, 0x43, 0xE6, 0x87, 0xB2, 0x43, 0xE6, 0x87, 0xB6, 0x43, 0xE6, 0x88, 0x80, 0x43, 0xE6, 0x88, 0x88, 0x43, 0xE6, 0x88, 0x90, 0x43, 0xE6, 0x88, 0x9B, 0x43, 0xE6, // Bytes d00 - d3f 0x88, 0xAE, 0x43, 0xE6, 0x88, 0xB4, 0x43, 0xE6, 0x88, 0xB6, 0x43, 0xE6, 0x89, 0x8B, 0x43, 0xE6, 0x89, 0x93, 0x43, 0xE6, 0x89, 0x9D, 0x43, 0xE6, 0x8A, 0x95, 0x43, 0xE6, 0x8A, 0xB1, 0x43, 0xE6, 0x8B, 0x89, 0x43, 0xE6, 0x8B, 0x8F, 0x43, 0xE6, 0x8B, 0x93, 0x43, 0xE6, 0x8B, 0x94, 0x43, 0xE6, 0x8B, 0xBC, 0x43, 0xE6, 0x8B, 0xBE, 0x43, 0xE6, 0x8C, 0x87, 0x43, 0xE6, 0x8C, 0xBD, 0x43, 0xE6, // Bytes d40 - d7f 0x8D, 0x90, 0x43, 0xE6, 0x8D, 0x95, 0x43, 0xE6, 0x8D, 0xA8, 0x43, 0xE6, 0x8D, 0xBB, 0x43, 0xE6, 0x8E, 0x83, 0x43, 0xE6, 0x8E, 0xA0, 0x43, 0xE6, 0x8E, 0xA9, 0x43, 0xE6, 0x8F, 0x84, 0x43, 0xE6, 0x8F, 0x85, 0x43, 0xE6, 0x8F, 0xA4, 0x43, 0xE6, 0x90, 0x9C, 0x43, 0xE6, 0x90, 0xA2, 0x43, 0xE6, 0x91, 0x92, 0x43, 0xE6, 0x91, 0xA9, 0x43, 0xE6, 0x91, 0xB7, 0x43, 0xE6, 0x91, 0xBE, 0x43, 0xE6, // Bytes d80 - dbf 0x92, 0x9A, 0x43, 0xE6, 0x92, 0x9D, 0x43, 0xE6, 0x93, 0x84, 0x43, 0xE6, 0x94, 0xAF, 0x43, 0xE6, 0x94, 0xB4, 0x43, 0xE6, 0x95, 0x8F, 0x43, 0xE6, 0x95, 0x96, 0x43, 0xE6, 0x95, 0xAC, 0x43, 0xE6, 0x95, 0xB8, 0x43, 0xE6, 0x96, 0x87, 0x43, 0xE6, 0x96, 0x97, 0x43, 0xE6, 0x96, 0x99, 0x43, 0xE6, 0x96, 0xA4, 0x43, 0xE6, 0x96, 0xB0, 0x43, 0xE6, 0x96, 0xB9, 0x43, 0xE6, 0x97, 0x85, 0x43, 0xE6, // Bytes dc0 - dff 0x97, 0xA0, 0x43, 0xE6, 0x97, 0xA2, 0x43, 0xE6, 0x97, 0xA3, 0x43, 0xE6, 0x97, 0xA5, 0x43, 0xE6, 0x98, 0x93, 0x43, 0xE6, 0x98, 0xA0, 0x43, 0xE6, 0x99, 0x89, 0x43, 0xE6, 0x99, 0xB4, 0x43, 0xE6, 0x9A, 0x88, 0x43, 0xE6, 0x9A, 0x91, 0x43, 0xE6, 0x9A, 0x9C, 0x43, 0xE6, 0x9A, 0xB4, 0x43, 0xE6, 0x9B, 0x86, 0x43, 0xE6, 0x9B, 0xB0, 0x43, 0xE6, 0x9B, 0xB4, 0x43, 0xE6, 0x9B, 0xB8, 0x43, 0xE6, // Bytes e00 - e3f 0x9C, 0x80, 0x43, 0xE6, 0x9C, 0x88, 0x43, 0xE6, 0x9C, 0x89, 0x43, 0xE6, 0x9C, 0x97, 0x43, 0xE6, 0x9C, 0x9B, 0x43, 0xE6, 0x9C, 0xA1, 0x43, 0xE6, 0x9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 0xE6, 0xBF, 0xBE, 0x43, 0xE7, 0x80, 0x9B, 0x43, 0xE7, // Bytes f80 - fbf 0x80, 0x9E, 0x43, 0xE7, 0x80, 0xB9, 0x43, 0xE7, 0x81, 0x8A, 0x43, 0xE7, 0x81, 0xAB, 0x43, 0xE7, 0x81, 0xB0, 0x43, 0xE7, 0x81, 0xB7, 0x43, 0xE7, 0x81, 0xBD, 0x43, 0xE7, 0x82, 0x99, 0x43, 0xE7, 0x82, 0xAD, 0x43, 0xE7, 0x83, 0x88, 0x43, 0xE7, 0x83, 0x99, 0x43, 0xE7, 0x84, 0xA1, 0x43, 0xE7, 0x85, 0x85, 0x43, 0xE7, 0x85, 0x89, 0x43, 0xE7, 0x85, 0xAE, 0x43, 0xE7, 0x86, 0x9C, 0x43, 0xE7, // Bytes fc0 - fff 0x87, 0x8E, 0x43, 0xE7, 0x87, 0x90, 0x43, 0xE7, 0x88, 0x90, 0x43, 0xE7, 0x88, 0x9B, 0x43, 0xE7, 0x88, 0xA8, 0x43, 0xE7, 0x88, 0xAA, 0x43, 0xE7, 0x88, 0xAB, 0x43, 0xE7, 0x88, 0xB5, 0x43, 0xE7, 0x88, 0xB6, 0x43, 0xE7, 0x88, 0xBB, 0x43, 0xE7, 0x88, 0xBF, 0x43, 0xE7, 0x89, 0x87, 0x43, 0xE7, 0x89, 0x90, 0x43, 0xE7, 0x89, 0x99, 0x43, 0xE7, 0x89, 0x9B, 0x43, 0xE7, 0x89, 0xA2, 0x43, 0xE7, // Bytes 1000 - 103f 0x89, 0xB9, 0x43, 0xE7, 0x8A, 0x80, 0x43, 0xE7, 0x8A, 0x95, 0x43, 0xE7, 0x8A, 0xAC, 0x43, 0xE7, 0x8A, 0xAF, 0x43, 0xE7, 0x8B, 0x80, 0x43, 0xE7, 0x8B, 0xBC, 0x43, 0xE7, 0x8C, 0xAA, 0x43, 0xE7, 0x8D, 0xB5, 0x43, 0xE7, 0x8D, 0xBA, 0x43, 0xE7, 0x8E, 0x84, 0x43, 0xE7, 0x8E, 0x87, 0x43, 0xE7, 0x8E, 0x89, 0x43, 0xE7, 0x8E, 0x8B, 0x43, 0xE7, 0x8E, 0xA5, 0x43, 0xE7, 0x8E, 0xB2, 0x43, 0xE7, // Bytes 1040 - 107f 0x8F, 0x9E, 0x43, 0xE7, 0x90, 0x86, 0x43, 0xE7, 0x90, 0x89, 0x43, 0xE7, 0x90, 0xA2, 0x43, 0xE7, 0x91, 0x87, 0x43, 0xE7, 0x91, 0x9C, 0x43, 0xE7, 0x91, 0xA9, 0x43, 0xE7, 0x91, 0xB1, 0x43, 0xE7, 0x92, 0x85, 0x43, 0xE7, 0x92, 0x89, 0x43, 0xE7, 0x92, 0x98, 0x43, 0xE7, 0x93, 0x8A, 0x43, 0xE7, 0x93, 0x9C, 0x43, 0xE7, 0x93, 0xA6, 0x43, 0xE7, 0x94, 0x86, 0x43, 0xE7, 0x94, 0x98, 0x43, 0xE7, // Bytes 1080 - 10bf 0x94, 0x9F, 0x43, 0xE7, 0x94, 0xA4, 0x43, 0xE7, 0x94, 0xA8, 0x43, 0xE7, 0x94, 0xB0, 0x43, 0xE7, 0x94, 0xB2, 0x43, 0xE7, 0x94, 0xB3, 0x43, 0xE7, 0x94, 0xB7, 0x43, 0xE7, 0x94, 0xBB, 0x43, 0xE7, 0x94, 0xBE, 0x43, 0xE7, 0x95, 0x99, 0x43, 0xE7, 0x95, 0xA5, 0x43, 0xE7, 0x95, 0xB0, 0x43, 0xE7, 0x96, 0x8B, 0x43, 0xE7, 0x96, 0x92, 0x43, 0xE7, 0x97, 0xA2, 0x43, 0xE7, 0x98, 0x90, 0x43, 0xE7, // Bytes 10c0 - 10ff 0x98, 0x9D, 0x43, 0xE7, 0x98, 0x9F, 0x43, 0xE7, 0x99, 0x82, 0x43, 0xE7, 0x99, 0xA9, 0x43, 0xE7, 0x99, 0xB6, 0x43, 0xE7, 0x99, 0xBD, 0x43, 0xE7, 0x9A, 0xAE, 0x43, 0xE7, 0x9A, 0xBF, 0x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 0xE7, 0xB9, 0x81, 0x43, 0xE7, // Bytes 1240 - 127f 0xB9, 0x85, 0x43, 0xE7, 0xBC, 0xB6, 0x43, 0xE7, 0xBC, 0xBE, 0x43, 0xE7, 0xBD, 0x91, 0x43, 0xE7, 0xBD, 0xB2, 0x43, 0xE7, 0xBD, 0xB9, 0x43, 0xE7, 0xBD, 0xBA, 0x43, 0xE7, 0xBE, 0x85, 0x43, 0xE7, 0xBE, 0x8A, 0x43, 0xE7, 0xBE, 0x95, 0x43, 0xE7, 0xBE, 0x9A, 0x43, 0xE7, 0xBE, 0xBD, 0x43, 0xE7, 0xBF, 0xBA, 0x43, 0xE8, 0x80, 0x81, 0x43, 0xE8, 0x80, 0x85, 0x43, 0xE8, 0x80, 0x8C, 0x43, 0xE8, // Bytes 1280 - 12bf 0x80, 0x92, 0x43, 0xE8, 0x80, 0xB3, 0x43, 0xE8, 0x81, 0x86, 0x43, 0xE8, 0x81, 0xA0, 0x43, 0xE8, 0x81, 0xAF, 0x43, 0xE8, 0x81, 0xB0, 0x43, 0xE8, 0x81, 0xBE, 0x43, 0xE8, 0x81, 0xBF, 0x43, 0xE8, 0x82, 0x89, 0x43, 0xE8, 0x82, 0x8B, 0x43, 0xE8, 0x82, 0xAD, 0x43, 0xE8, 0x82, 0xB2, 0x43, 0xE8, 0x84, 0x83, 0x43, 0xE8, 0x84, 0xBE, 0x43, 0xE8, 0x87, 0x98, 0x43, 0xE8, 0x87, 0xA3, 0x43, 0xE8, // Bytes 12c0 - 12ff 0x87, 0xA8, 0x43, 0xE8, 0x87, 0xAA, 0x43, 0xE8, 0x87, 0xAD, 0x43, 0xE8, 0x87, 0xB3, 0x43, 0xE8, 0x87, 0xBC, 0x43, 0xE8, 0x88, 0x81, 0x43, 0xE8, 0x88, 0x84, 0x43, 0xE8, 0x88, 0x8C, 0x43, 0xE8, 0x88, 0x98, 0x43, 0xE8, 0x88, 0x9B, 0x43, 0xE8, 0x88, 0x9F, 0x43, 0xE8, 0x89, 0xAE, 0x43, 0xE8, 0x89, 0xAF, 0x43, 0xE8, 0x89, 0xB2, 0x43, 0xE8, 0x89, 0xB8, 0x43, 0xE8, 0x89, 0xB9, 0x43, 0xE8, // Bytes 1300 - 133f 0x8A, 0x8B, 0x43, 0xE8, 0x8A, 0x91, 0x43, 0xE8, 0x8A, 0x9D, 0x43, 0xE8, 0x8A, 0xB1, 0x43, 0xE8, 0x8A, 0xB3, 0x43, 0xE8, 0x8A, 0xBD, 0x43, 0xE8, 0x8B, 0xA5, 0x43, 0xE8, 0x8B, 0xA6, 0x43, 0xE8, 0x8C, 0x9D, 0x43, 0xE8, 0x8C, 0xA3, 0x43, 0xE8,
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/readwriter.go
vendor/golang.org/x/text/unicode/norm/readwriter.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package norm import "io" type normWriter struct { rb reorderBuffer w io.Writer buf []byte } // Write implements the standard write interface. If the last characters are // not at a normalization boundary, the bytes will be buffered for the next // write. The remaining bytes will be written on close. func (w *normWriter) Write(data []byte) (n int, err error) { // Process data in pieces to keep w.buf size bounded. const chunk = 4000 for len(data) > 0 { // Normalize into w.buf. m := len(data) if m > chunk { m = chunk } w.rb.src = inputBytes(data[:m]) w.rb.nsrc = m w.buf = doAppend(&w.rb, w.buf, 0) data = data[m:] n += m // Write out complete prefix, save remainder. // Note that lastBoundary looks back at most 31 runes. i := lastBoundary(&w.rb.f, w.buf) if i == -1 { i = 0 } if i > 0 { if _, err = w.w.Write(w.buf[:i]); err != nil { break } bn := copy(w.buf, w.buf[i:]) w.buf = w.buf[:bn] } } return n, err } // Close forces data that remains in the buffer to be written. func (w *normWriter) Close() error { if len(w.buf) > 0 { _, err := w.w.Write(w.buf) if err != nil { return err } } return nil } // Writer returns a new writer that implements Write(b) // by writing f(b) to w. The returned writer may use an // internal buffer to maintain state across Write calls. // Calling its Close method writes any buffered data to w. func (f Form) Writer(w io.Writer) io.WriteCloser { wr := &normWriter{rb: reorderBuffer{}, w: w} wr.rb.init(f, nil) return wr } type normReader struct { rb reorderBuffer r io.Reader inbuf []byte outbuf []byte bufStart int lastBoundary int err error } // Read implements the standard read interface. func (r *normReader) Read(p []byte) (int, error) { for { if r.lastBoundary-r.bufStart > 0 { n := copy(p, r.outbuf[r.bufStart:r.lastBoundary]) r.bufStart += n if r.lastBoundary-r.bufStart > 0 { return n, nil } return n, r.err } if r.err != nil { return 0, r.err } outn := copy(r.outbuf, r.outbuf[r.lastBoundary:]) r.outbuf = r.outbuf[0:outn] r.bufStart = 0 n, err := r.r.Read(r.inbuf) r.rb.src = inputBytes(r.inbuf[0:n]) r.rb.nsrc, r.err = n, err if n > 0 { r.outbuf = doAppend(&r.rb, r.outbuf, 0) } if err == io.EOF { r.lastBoundary = len(r.outbuf) } else { r.lastBoundary = lastBoundary(&r.rb.f, r.outbuf) if r.lastBoundary == -1 { r.lastBoundary = 0 } } } } // Reader returns a new reader that implements Read // by reading data from r and returning f(data). func (f Form) Reader(r io.Reader) io.Reader { const chunk = 4000 buf := make([]byte, chunk) rr := &normReader{rb: reorderBuffer{}, r: r, inbuf: buf} rr.rb.init(f, buf) return rr }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go
vendor/golang.org/x/text/unicode/norm/tables13.0.0.go
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.16 && !go1.21 package norm import "sync" const ( // Version is the Unicode edition from which the tables are derived. Version = "13.0.0" // MaxTransformChunkSize indicates the maximum number of bytes that Transform // may need to write atomically for any Form. Making a destination buffer at // least this size ensures that Transform can always make progress and that // the user does not need to grow the buffer on an ErrShortDst. MaxTransformChunkSize = 35 + maxNonStarters*4 ) var ccc = [56]uint8{ 0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 84, 91, 103, 107, 118, 122, 129, 130, 132, 202, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 233, 234, 240, } const ( firstMulti = 0x1870 firstCCC = 0x2CAB endMulti = 0x2F77 firstLeadingCCC = 0x49C5 firstCCCZeroExcept = 0x4A8F firstStarterWithNLead = 0x4AB6 lastDecomp = 0x4AB8 maxDecomp = 0x8000 ) // decomps: 19128 bytes var decomps = [...]byte{ // Bytes 0 - 3f 0x00, 0x41, 0x20, 0x41, 0x21, 0x41, 0x22, 0x41, 0x23, 0x41, 0x24, 0x41, 0x25, 0x41, 0x26, 0x41, 0x27, 0x41, 0x28, 0x41, 0x29, 0x41, 0x2A, 0x41, 0x2B, 0x41, 0x2C, 0x41, 0x2D, 0x41, 0x2E, 0x41, 0x2F, 0x41, 0x30, 0x41, 0x31, 0x41, 0x32, 0x41, 0x33, 0x41, 0x34, 0x41, 0x35, 0x41, 0x36, 0x41, 0x37, 0x41, 0x38, 0x41, 0x39, 0x41, 0x3A, 0x41, 0x3B, 0x41, 0x3C, 0x41, 0x3D, 0x41, 0x3E, 0x41, // Bytes 40 - 7f 0x3F, 0x41, 0x40, 0x41, 0x41, 0x41, 0x42, 0x41, 0x43, 0x41, 0x44, 0x41, 0x45, 0x41, 0x46, 0x41, 0x47, 0x41, 0x48, 0x41, 0x49, 0x41, 0x4A, 0x41, 0x4B, 0x41, 0x4C, 0x41, 0x4D, 0x41, 0x4E, 0x41, 0x4F, 0x41, 0x50, 0x41, 0x51, 0x41, 0x52, 0x41, 0x53, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, 0x57, 0x41, 0x58, 0x41, 0x59, 0x41, 0x5A, 0x41, 0x5B, 0x41, 0x5C, 0x41, 0x5D, 0x41, 0x5E, 0x41, // Bytes 80 - bf 0x5F, 0x41, 0x60, 0x41, 0x61, 0x41, 0x62, 0x41, 0x63, 0x41, 0x64, 0x41, 0x65, 0x41, 0x66, 0x41, 0x67, 0x41, 0x68, 0x41, 0x69, 0x41, 0x6A, 0x41, 0x6B, 0x41, 0x6C, 0x41, 0x6D, 0x41, 0x6E, 0x41, 0x6F, 0x41, 0x70, 0x41, 0x71, 0x41, 0x72, 0x41, 0x73, 0x41, 0x74, 0x41, 0x75, 0x41, 0x76, 0x41, 0x77, 0x41, 0x78, 0x41, 0x79, 0x41, 0x7A, 0x41, 0x7B, 0x41, 0x7C, 0x41, 0x7D, 0x41, 0x7E, 0x42, // Bytes c0 - ff 0xC2, 0xA2, 0x42, 0xC2, 0xA3, 0x42, 0xC2, 0xA5, 0x42, 0xC2, 0xA6, 0x42, 0xC2, 0xAC, 0x42, 0xC2, 0xB7, 0x42, 0xC3, 0x86, 0x42, 0xC3, 0xB0, 0x42, 0xC4, 0xA6, 0x42, 0xC4, 0xA7, 0x42, 0xC4, 0xB1, 0x42, 0xC5, 0x8B, 0x42, 0xC5, 0x93, 0x42, 0xC6, 0x8E, 0x42, 0xC6, 0x90, 0x42, 0xC6, 0xAB, 0x42, 0xC8, 0xA2, 0x42, 0xC8, 0xB7, 0x42, 0xC9, 0x90, 0x42, 0xC9, 0x91, 0x42, 0xC9, 0x92, 0x42, 0xC9, // Bytes 100 - 13f 0x94, 0x42, 0xC9, 0x95, 0x42, 0xC9, 0x99, 0x42, 0xC9, 0x9B, 0x42, 0xC9, 0x9C, 0x42, 0xC9, 0x9F, 0x42, 0xC9, 0xA1, 0x42, 0xC9, 0xA3, 0x42, 0xC9, 0xA5, 0x42, 0xC9, 0xA6, 0x42, 0xC9, 0xA8, 0x42, 0xC9, 0xA9, 0x42, 0xC9, 0xAA, 0x42, 0xC9, 0xAB, 0x42,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D9, 0x87, 0x42, 0xD9, 0x88, 0x42, 0xD9, 0x89, 0x42, 0xD9, 0x8A, 0x42, 0xD9, 0xAE, 0x42, 0xD9, 0xAF, 0x42, 0xD9, 0xB1, 0x42, 0xD9, 0xB9, 0x42, 0xD9, 0xBA, 0x42, 0xD9, 0xBB, 0x42, 0xD9, 0xBE, 0x42, 0xD9, 0xBF, 0x42, 0xDA, 0x80, 0x42, 0xDA, 0x83, 0x42, 0xDA, 0x84, 0x42, 0xDA, 0x86, 0x42, 0xDA, 0x87, 0x42, 0xDA, 0x88, // Bytes 2c0 - 2ff 0x42, 0xDA, 0x8C, 0x42, 0xDA, 0x8D, 0x42, 0xDA, 0x8E, 0x42, 0xDA, 0x91, 0x42, 0xDA, 0x98, 0x42, 0xDA, 0xA1, 0x42, 0xDA, 0xA4, 0x42, 0xDA, 0xA6, 0x42, 0xDA, 0xA9, 0x42, 0xDA, 0xAD, 0x42, 0xDA, 0xAF, 0x42, 0xDA, 0xB1, 0x42, 0xDA, 0xB3, 0x42, 0xDA, 0xBA, 0x42, 0xDA, 0xBB, 0x42, 0xDA, 0xBE, 0x42, 0xDB, 0x81, 0x42, 0xDB, 0x85, 0x42, 0xDB, 0x86, 0x42, 0xDB, 0x87, 0x42, 0xDB, 0x88, 0x42, // Bytes 300 - 33f 0xDB, 0x89, 0x42, 0xDB, 0x8B, 0x42, 0xDB, 0x8C, 0x42, 0xDB, 0x90, 0x42, 0xDB, 0x92, 0x43, 0xE0, 0xBC, 0x8B, 0x43, 0xE1, 0x83, 0x9C, 0x43, 0xE1, 0x84, 0x80, 0x43, 0xE1, 0x84, 0x81, 0x43, 0xE1, 0x84, 0x82, 0x43, 0xE1, 0x84, 0x83, 0x43, 0xE1, 0x84, 0x84, 0x43, 0xE1, 0x84, 0x85, 0x43, 0xE1, 0x84, 0x86, 0x43, 0xE1, 0x84, 0x87, 0x43, 0xE1, 0x84, 0x88, 0x43, 0xE1, 0x84, 0x89, 0x43, 0xE1, // Bytes 340 - 37f 0x84, 0x8A, 0x43, 0xE1, 0x84, 0x8B, 0x43, 0xE1, 0x84, 0x8C, 0x43, 0xE1, 0x84, 0x8D, 0x43, 0xE1, 0x84, 0x8E, 0x43, 0xE1, 0x84, 0x8F, 0x43, 0xE1, 0x84, 0x90, 0x43, 0xE1, 0x84, 0x91, 0x43, 0xE1, 0x84, 0x92, 0x43, 0xE1, 0x84, 0x94, 0x43, 0xE1, 0x84, 0x95, 0x43, 0xE1, 0x84, 0x9A, 0x43, 0xE1, 0x84, 0x9C, 0x43, 0xE1, 0x84, 0x9D, 0x43, 0xE1, 0x84, 0x9E, 0x43, 0xE1, 0x84, 0xA0, 0x43, 0xE1, // Bytes 380 - 3bf 0x84, 0xA1, 0x43, 0xE1, 0x84, 0xA2, 0x43, 0xE1, 0x84, 0xA3, 0x43, 0xE1, 0x84, 0xA7, 0x43, 0xE1, 0x84, 0xA9, 0x43, 0xE1, 0x84, 0xAB, 0x43, 0xE1, 0x84, 0xAC, 0x43, 0xE1, 0x84, 0xAD, 0x43, 0xE1, 0x84, 0xAE, 0x43, 0xE1, 0x84, 0xAF, 0x43, 0xE1, 0x84, 0xB2, 0x43, 0xE1, 0x84, 0xB6, 0x43, 0xE1, 0x85, 0x80, 0x43, 0xE1, 0x85, 0x87, 0x43, 0xE1, 0x85, 0x8C, 0x43, 0xE1, 0x85, 0x97, 0x43, 0xE1, // Bytes 3c0 - 3ff 0x85, 0x98, 0x43, 0xE1, 0x85, 0x99, 0x43, 0xE1, 0x85, 0xA0, 0x43, 0xE1, 0x86, 0x84, 0x43, 0xE1, 0x86, 0x85, 0x43, 0xE1, 0x86, 0x88, 0x43, 0xE1, 0x86, 0x91, 0x43, 0xE1, 0x86, 0x92, 0x43, 0xE1, 0x86, 0x94, 0x43, 0xE1, 0x86, 0x9E, 0x43, 0xE1, 0x86, 0xA1, 0x43, 0xE1, 0x87, 0x87, 0x43, 0xE1, 0x87, 0x88, 0x43, 0xE1, 0x87, 0x8C, 0x43, 0xE1, 0x87, 0x8E, 0x43, 0xE1, 0x87, 0x93, 0x43, 0xE1, // Bytes 400 - 43f 0x87, 0x97, 0x43, 0xE1, 0x87, 0x99, 0x43, 0xE1, 0x87, 0x9D, 0x43, 0xE1, 0x87, 0x9F, 0x43, 0xE1, 0x87, 0xB1, 0x43, 0xE1, 0x87, 0xB2, 0x43, 0xE1, 0xB4, 0x82, 0x43, 0xE1, 0xB4, 0x96, 0x43, 0xE1, 0xB4, 0x97, 0x43, 0xE1, 0xB4, 0x9C, 0x43, 0xE1, 0xB4, 0x9D, 0x43, 0xE1, 0xB4, 0xA5, 0x43, 0xE1, 0xB5, 0xBB, 0x43, 0xE1, 0xB6, 0x85, 0x43, 0xE2, 0x80, 0x82, 0x43, 0xE2, 0x80, 0x83, 0x43, 0xE2, // Bytes 440 - 47f 0x80, 0x90, 0x43, 0xE2, 0x80, 0x93, 0x43, 0xE2, 0x80, 0x94, 0x43, 0xE2, 0x82, 0xA9, 0x43, 0xE2, 0x86, 0x90, 0x43, 0xE2, 0x86, 0x91, 0x43, 0xE2, 0x86, 0x92, 0x43, 0xE2, 0x86, 0x93, 0x43, 0xE2, 0x88, 0x82, 0x43, 0xE2, 0x88, 0x87, 0x43, 0xE2, 0x88, 0x91, 0x43, 0xE2, 0x88, 0x92, 0x43, 0xE2, 0x94, 0x82, 0x43, 0xE2, 0x96, 0xA0, 0x43, 0xE2, 0x97, 0x8B, 0x43, 0xE2, 0xA6, 0x85, 0x43, 0xE2, // Bytes 480 - 4bf 0xA6, 0x86, 0x43, 0xE2, 0xB5, 0xA1, 0x43, 0xE3, 0x80, 0x81, 0x43, 0xE3, 0x80, 0x82, 0x43, 0xE3, 0x80, 0x88, 0x43, 0xE3, 0x80, 0x89, 0x43, 0xE3, 0x80, 0x8A, 0x43, 0xE3, 0x80, 0x8B, 0x43, 0xE3, 0x80, 0x8C, 0x43, 0xE3, 0x80, 0x8D, 0x43, 0xE3, 0x80, 0x8E, 0x43, 0xE3, 0x80, 0x8F, 0x43, 0xE3, 0x80, 0x90, 0x43, 0xE3, 0x80, 0x91, 0x43, 0xE3, 0x80, 0x92, 0x43, 0xE3, 0x80, 0x94, 0x43, 0xE3, // Bytes 4c0 - 4ff 0x80, 0x95, 0x43, 0xE3, 0x80, 0x96, 0x43, 0xE3, 0x80, 0x97, 0x43, 0xE3, 0x82, 0xA1, 0x43, 0xE3, 0x82, 0xA2, 0x43, 0xE3, 0x82, 0xA3, 0x43, 0xE3, 0x82, 0xA4, 0x43, 0xE3, 0x82, 0xA5, 0x43, 0xE3, 0x82, 0xA6, 0x43, 0xE3, 0x82, 0xA7, 0x43, 0xE3, 0x82, 0xA8, 0x43, 0xE3, 0x82, 0xA9, 0x43, 0xE3, 0x82, 0xAA, 0x43, 0xE3, 0x82, 0xAB, 0x43, 0xE3, 0x82, 0xAD, 0x43, 0xE3, 0x82, 0xAF, 0x43, 0xE3, // Bytes 500 - 53f 0x82, 0xB1, 0x43, 0xE3, 0x82, 0xB3, 0x43, 0xE3, 0x82, 0xB5, 0x43, 0xE3, 0x82, 0xB7, 0x43, 0xE3, 0x82, 0xB9, 0x43, 0xE3, 0x82, 0xBB, 0x43, 0xE3, 0x82, 0xBD, 0x43, 0xE3, 0x82, 0xBF, 0x43, 0xE3, 0x83, 0x81, 0x43, 0xE3, 0x83, 0x83, 0x43, 0xE3, 0x83, 0x84, 0x43, 0xE3, 0x83, 0x86, 0x43, 0xE3, 0x83, 0x88, 0x43, 0xE3, 0x83, 0x8A, 0x43, 0xE3, 0x83, 0x8B, 0x43, 0xE3, 0x83, 0x8C, 0x43, 0xE3, // Bytes 540 - 57f 0x83, 0x8D, 0x43, 0xE3, 0x83, 0x8E, 0x43, 0xE3, 0x83, 0x8F, 0x43, 0xE3, 0x83, 0x92, 0x43, 0xE3, 0x83, 0x95, 0x43, 0xE3, 0x83, 0x98, 0x43, 0xE3, 0x83, 0x9B, 0x43, 0xE3, 0x83, 0x9E, 0x43, 0xE3, 0x83, 0x9F, 0x43, 0xE3, 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E5, 0x83, 0x8F, 0x43, 0xE5, 0x83, 0x9A, 0x43, 0xE5, // Bytes 780 - 7bf 0x83, 0xA7, 0x43, 0xE5, 0x84, 0xAA, 0x43, 0xE5, 0x84, 0xBF, 0x43, 0xE5, 0x85, 0x80, 0x43, 0xE5, 0x85, 0x85, 0x43, 0xE5, 0x85, 0x8D, 0x43, 0xE5, 0x85, 0x94, 0x43, 0xE5, 0x85, 0xA4, 0x43, 0xE5, 0x85, 0xA5, 0x43, 0xE5, 0x85, 0xA7, 0x43, 0xE5, 0x85, 0xA8, 0x43, 0xE5, 0x85, 0xA9, 0x43, 0xE5, 0x85, 0xAB, 0x43, 0xE5, 0x85, 0xAD, 0x43, 0xE5, 0x85, 0xB7, 0x43, 0xE5, 0x86, 0x80, 0x43, 0xE5, // Bytes 7c0 - 7ff 0x86, 0x82, 0x43, 0xE5, 0x86, 0x8D, 0x43, 0xE5, 0x86, 0x92, 0x43, 0xE5, 0x86, 0x95, 0x43, 0xE5, 0x86, 0x96, 0x43, 0xE5, 0x86, 0x97, 0x43, 0xE5, 0x86, 0x99, 0x43, 0xE5, 0x86, 0xA4, 0x43, 0xE5, 0x86, 0xAB, 0x43, 0xE5, 0x86, 0xAC, 0x43, 0xE5, 0x86, 0xB5, 0x43, 0xE5, 0x86, 0xB7, 0x43, 0xE5, 0x87, 0x89, 0x43, 0xE5, 0x87, 0x8C, 0x43, 0xE5, 0x87, 0x9C, 0x43, 0xE5, 0x87, 0x9E, 0x43, 0xE5, // Bytes 800 - 83f 0x87, 0xA0, 0x43, 0xE5, 0x87, 0xB5, 0x43, 0xE5, 0x88, 0x80, 0x43, 0xE5, 0x88, 0x83, 0x43, 0xE5, 0x88, 0x87, 0x43, 0xE5, 0x88, 0x97, 0x43, 0xE5, 0x88, 0x9D, 0x43, 0xE5, 0x88, 0xA9, 0x43, 0xE5, 0x88, 0xBA, 0x43, 0xE5, 0x88, 0xBB, 0x43, 0xE5, 0x89, 0x86, 0x43, 0xE5, 0x89, 0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, 0x8F, 0x9F, 0x43, 0xE5, 0x8F, 0xA3, 0x43, 0xE5, 0x8F, 0xA5, 0x43, 0xE5, 0x8F, 0xAB, 0x43, 0xE5, 0x8F, 0xAF, 0x43, 0xE5, 0x8F, 0xB1, 0x43, 0xE5, 0x8F, 0xB3, 0x43, 0xE5, 0x90, 0x86, 0x43, 0xE5, 0x90, 0x88, 0x43, 0xE5, // Bytes 900 - 93f 0x90, 0x8D, 0x43, 0xE5, 0x90, 0x8F, 0x43, 0xE5, 0x90, 0x9D, 0x43, 0xE5, 0x90, 0xB8, 0x43, 0xE5, 0x90, 0xB9, 0x43, 0xE5, 0x91, 0x82, 0x43, 0xE5, 0x91, 0x88, 0x43, 0xE5, 0x91, 0xA8, 0x43, 0xE5, 0x92, 0x9E, 0x43, 0xE5, 0x92, 0xA2, 0x43, 0xE5, 0x92, 0xBD, 0x43, 0xE5, 0x93, 0xB6, 0x43, 0xE5, 0x94, 0x90, 0x43, 0xE5, 0x95, 0x8F, 0x43, 0xE5, 0x95, 0x93, 0x43, 0xE5, 0x95, 0x95, 0x43, 0xE5, // Bytes 940 - 97f 0x95, 0xA3, 0x43, 0xE5, 0x96, 0x84, 0x43, 0xE5, 0x96, 0x87, 0x43, 0xE5, 0x96, 0x99, 0x43, 0xE5, 0x96, 0x9D, 0x43, 0xE5, 0x96, 0xAB, 0x43, 0xE5, 0x96, 0xB3, 0x43, 0xE5, 0x96, 0xB6, 0x43, 0xE5, 0x97, 0x80, 0x43, 0xE5, 0x97, 0x82, 0x43, 0xE5, 0x97, 0xA2, 0x43, 0xE5, 0x98, 0x86, 0x43, 0xE5, 0x99, 0x91, 0x43, 0xE5, 0x99, 0xA8, 0x43, 0xE5, 0x99, 0xB4, 0x43, 0xE5, 0x9B, 0x97, 0x43, 0xE5, // Bytes 980 - 9bf 0x9B, 0x9B, 0x43, 0xE5, 0x9B, 0xB9, 0x43, 0xE5, 0x9C, 0x96, 0x43, 0xE5, 0x9C, 0x97, 0x43, 0xE5, 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6, 0x80, 0x9C, 0x43, 0xE6, 0x81, 0xB5, 0x43, 0xE6, 0x82, 0x81, 0x43, 0xE6, 0x82, 0x94, 0x43, 0xE6, 0x83, 0x87, 0x43, 0xE6, 0x83, 0x98, 0x43, 0xE6, 0x83, 0xA1, 0x43, 0xE6, 0x84, 0x88, 0x43, 0xE6, 0x85, 0x84, 0x43, 0xE6, // Bytes bc0 - bff 0x85, 0x88, 0x43, 0xE6, 0x85, 0x8C, 0x43, 0xE6, 0x85, 0x8E, 0x43, 0xE6, 0x85, 0xA0, 0x43, 0xE6, 0x85, 0xA8, 0x43, 0xE6, 0x85, 0xBA, 0x43, 0xE6, 0x86, 0x8E, 0x43, 0xE6, 0x86, 0x90, 0x43, 0xE6, 0x86, 0xA4, 0x43, 0xE6, 0x86, 0xAF, 0x43, 0xE6, 0x86, 0xB2, 0x43, 0xE6, 0x87, 0x9E, 0x43, 0xE6, 0x87, 0xB2, 0x43, 0xE6, 0x87, 0xB6, 0x43, 0xE6, 0x88, 0x80, 0x43, 0xE6, 0x88, 0x88, 0x43, 0xE6, // Bytes c00 - c3f 0x88, 0x90, 0x43, 0xE6, 0x88, 0x9B, 0x43, 0xE6, 0x88, 0xAE, 0x43, 0xE6, 0x88, 0xB4, 0x43, 0xE6, 0x88, 0xB6, 0x43, 0xE6, 0x89, 0x8B, 0x43, 0xE6, 0x89, 0x93, 0x43, 0xE6, 0x89, 0x9D, 0x43, 0xE6, 0x8A, 0x95, 0x43, 0xE6, 0x8A, 0xB1, 0x43, 0xE6, 0x8B, 0x89, 0x43, 0xE6, 0x8B, 0x8F, 0x43, 0xE6, 0x8B, 0x93, 0x43, 0xE6, 0x8B, 0x94, 0x43, 0xE6, 0x8B, 0xBC, 0x43, 0xE6, 0x8B, 0xBE, 0x43, 0xE6, // Bytes c40 - c7f 0x8C, 0x87, 0x43, 0xE6, 0x8C, 0xBD, 0x43, 0xE6, 0x8D, 0x90, 0x43, 0xE6, 0x8D, 0x95, 0x43, 0xE6, 0x8D, 0xA8, 0x43, 0xE6, 0x8D, 0xBB, 0x43, 0xE6, 0x8E, 0x83, 0x43, 0xE6, 0x8E, 0xA0, 0x43, 0xE6, 0x8E, 0xA9, 0x43, 0xE6, 0x8F, 0x84, 0x43, 0xE6, 0x8F, 0x85, 0x43, 0xE6, 0x8F, 0xA4, 0x43, 0xE6, 0x90, 0x9C, 0x43, 0xE6, 0x90, 0xA2, 0x43, 0xE6, 0x91, 0x92, 0x43, 0xE6, 0x91, 0xA9, 0x43, 0xE6, // Bytes c80 - cbf 0x91, 0xB7, 0x43, 0xE6, 0x91, 0xBE, 0x43, 0xE6, 0x92, 0x9A, 0x43, 0xE6, 0x92, 0x9D, 0x43, 0xE6, 0x93, 0x84, 0x43, 0xE6, 0x94, 0xAF, 0x43, 0xE6, 0x94, 0xB4, 0x43, 0xE6, 0x95, 0x8F, 0x43, 0xE6, 0x95, 0x96, 0x43, 0xE6, 0x95, 0xAC, 0x43, 0xE6, 0x95, 0xB8, 0x43, 0xE6, 0x96, 0x87, 0x43, 0xE6, 0x96, 0x97, 0x43, 0xE6, 0x96, 0x99, 0x43, 0xE6, 0x96, 0xA4, 0x43, 0xE6, 0x96, 0xB0, 0x43, 0xE6, // Bytes cc0 - cff 0x96, 0xB9, 0x43, 0xE6, 0x97, 0x85, 0x43, 0xE6, 0x97, 0xA0, 0x43, 0xE6, 0x97, 0xA2, 0x43, 0xE6, 0x97, 0xA3, 0x43, 0xE6, 0x97, 0xA5, 0x43, 0xE6, 0x98, 0x93, 0x43, 0xE6, 0x98, 0xA0, 0x43, 0xE6, 0x99, 0x89, 0x43, 0xE6, 0x99, 0xB4, 0x43, 0xE6, 0x9A, 0x88, 0x43, 0xE6, 0x9A, 0x91, 0x43, 0xE6, 0x9A, 0x9C, 0x43, 0xE6, 0x9A, 0xB4, 0x43, 0xE6, 0x9B, 0x86, 0x43, 0xE6, 0x9B, 0xB0, 0x43, 0xE6, // Bytes d00 - d3f 0x9B, 0xB4, 0x43, 0xE6, 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, 0xE6, 0xBC, 0x8F, 0x43, 0xE6, 0xBC, 0x94, 0x43, 0xE6, 0xBC, 0xA2, 0x43, 0xE6, 0xBC, 0xA3, 0x43, 0xE6, 0xBD, 0xAE, 0x43, 0xE6, 0xBF, 0x86, 0x43, 0xE6, 0xBF, 0xAB, 0x43, 0xE6, // Bytes e80 - ebf 0xBF, 0xBE, 0x43, 0xE7, 0x80, 0x9B, 0x43, 0xE7, 0x80, 0x9E, 0x43, 0xE7, 0x80, 0xB9, 0x43, 0xE7, 0x81, 0x8A, 0x43, 0xE7, 0x81, 0xAB, 0x43, 0xE7, 0x81, 0xB0, 0x43, 0xE7, 0x81, 0xB7, 0x43, 0xE7, 0x81, 0xBD, 0x43, 0xE7, 0x82, 0x99, 0x43, 0xE7, 0x82, 0xAD, 0x43, 0xE7, 0x83, 0x88, 0x43, 0xE7, 0x83, 0x99, 0x43, 0xE7, 0x84, 0xA1, 0x43, 0xE7, 0x85, 0x85, 0x43, 0xE7, 0x85, 0x89, 0x43, 0xE7, // Bytes ec0 - eff 0x85, 0xAE, 0x43, 0xE7, 0x86, 0x9C, 0x43, 0xE7, 0x87, 0x8E, 0x43, 0xE7, 0x87, 0x90, 0x43, 0xE7, 0x88, 0x90, 0x43, 0xE7, 0x88, 0x9B, 0x43, 0xE7, 0x88, 0xA8, 0x43, 0xE7, 0x88, 0xAA, 0x43, 0xE7, 0x88, 0xAB, 0x43, 0xE7, 0x88, 0xB5, 0x43, 0xE7, 0x88, 0xB6, 0x43, 0xE7, 0x88, 0xBB, 0x43, 0xE7, 0x88, 0xBF, 0x43, 0xE7, 0x89, 0x87, 0x43, 0xE7, 0x89, 0x90, 0x43, 0xE7, 0x89, 0x99, 0x43, 0xE7, // Bytes f00 - f3f 0x89, 0x9B, 0x43, 0xE7, 0x89, 0xA2, 0x43, 0xE7, 0x89, 0xB9, 0x43, 0xE7, 0x8A, 0x80, 0x43, 0xE7, 0x8A, 0x95, 0x43, 0xE7, 0x8A, 0xAC, 0x43, 0xE7, 0x8A, 0xAF, 0x43, 0xE7, 0x8B, 0x80, 0x43, 0xE7, 0x8B, 0xBC, 0x43, 0xE7, 0x8C, 0xAA, 0x43, 0xE7, 0x8D, 0xB5, 0x43, 0xE7, 0x8D, 0xBA, 0x43, 0xE7, 0x8E, 0x84, 0x43, 0xE7, 0x8E, 0x87, 0x43, 0xE7, 0x8E, 0x89, 0x43, 0xE7, 0x8E, 0x8B, 0x43, 0xE7, // Bytes f40 - f7f 0x8E, 0xA5, 0x43, 0xE7, 0x8E, 0xB2, 0x43, 0xE7, 0x8F, 0x9E, 0x43, 0xE7, 0x90, 0x86, 0x43, 0xE7, 0x90, 0x89, 0x43, 0xE7, 0x90, 0xA2, 0x43, 0xE7, 0x91, 0x87, 0x43, 0xE7, 0x91, 0x9C, 0x43, 0xE7, 0x91, 0xA9, 0x43, 0xE7, 0x91, 0xB1, 0x43, 0xE7, 0x92, 0x85, 0x43, 0xE7, 0x92, 0x89, 0x43, 0xE7, 0x92, 0x98, 0x43, 0xE7, 0x93, 0x8A, 0x43, 0xE7, 0x93, 0x9C, 0x43, 0xE7, 0x93, 0xA6, 0x43, 0xE7, // Bytes f80 - fbf 0x94, 0x86, 0x43, 0xE7, 0x94, 0x98, 0x43, 0xE7, 0x94, 0x9F, 0x43, 0xE7, 0x94, 0xA4, 0x43, 0xE7, 0x94, 0xA8, 0x43, 0xE7, 0x94, 0xB0, 0x43, 0xE7, 0x94, 0xB2, 0x43, 0xE7, 0x94, 0xB3, 0x43, 0xE7, 0x94, 0xB7, 0x43, 0xE7, 0x94, 0xBB, 0x43, 0xE7, 0x94, 0xBE, 0x43, 0xE7, 0x95, 0x99, 0x43, 0xE7, 0x95, 0xA5, 0x43, 0xE7, 0x95, 0xB0, 0x43, 0xE7, 0x96, 0x8B, 0x43, 0xE7, 0x96, 0x92, 0x43, 0xE7, // Bytes fc0 - fff 0x97, 0xA2, 0x43, 0xE7, 0x98, 0x90, 0x43, 0xE7, 0x98, 0x9D, 0x43,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, 0xB6, 0xA0, 0x43, 0xE7, 0xB6, 0xBE, 0x43, 0xE7, 0xB7, 0x87, 0x43, 0xE7, 0xB7, 0xB4, 0x43, 0xE7, 0xB8, 0x82, 0x43, 0xE7, 0xB8, 0x89, 0x43, 0xE7, // Bytes 1140 - 117f 0xB8, 0xB7, 0x43, 0xE7, 0xB9, 0x81, 0x43, 0xE7, 0xB9, 0x85, 0x43, 0xE7, 0xBC, 0xB6, 0x43, 0xE7, 0xBC, 0xBE, 0x43, 0xE7, 0xBD, 0x91, 0x43, 0xE7, 0xBD, 0xB2, 0x43, 0xE7, 0xBD, 0xB9, 0x43, 0xE7, 0xBD, 0xBA, 0x43, 0xE7, 0xBE, 0x85, 0x43, 0xE7, 0xBE, 0x8A, 0x43, 0xE7, 0xBE, 0x95, 0x43, 0xE7, 0xBE, 0x9A, 0x43, 0xE7, 0xBE, 0xBD, 0x43, 0xE7, 0xBF, 0xBA, 0x43, 0xE8, 0x80, 0x81, 0x43, 0xE8, // Bytes 1180 - 11bf 0x80, 0x85, 0x43, 0xE8, 0x80, 0x8C, 0x43, 0xE8, 0x80, 0x92, 0x43, 0xE8, 0x80, 0xB3, 0x43, 0xE8, 0x81, 0x86, 0x43, 0xE8, 0x81, 0xA0, 0x43, 0xE8, 0x81, 0xAF, 0x43, 0xE8, 0x81, 0xB0, 0x43, 0xE8, 0x81, 0xBE, 0x43, 0xE8, 0x81, 0xBF, 0x43, 0xE8, 0x82, 0x89, 0x43, 0xE8, 0x82, 0x8B, 0x43, 0xE8, 0x82, 0xAD, 0x43, 0xE8, 0x82, 0xB2, 0x43, 0xE8, 0x84, 0x83, 0x43, 0xE8, 0x84, 0xBE, 0x43, 0xE8, // Bytes 11c0 - 11ff 0x87, 0x98, 0x43, 0xE8, 0x87, 0xA3, 0x43, 0xE8, 0x87, 0xA8, 0x43, 0xE8, 0x87, 0xAA, 0x43, 0xE8, 0x87, 0xAD, 0x43, 0xE8, 0x87, 0xB3, 0x43, 0xE8, 0x87, 0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, 0x43, 0xE8, 0x97, 0xBA, 0x43, 0xE8, 0x98, 0x86, 0x43, 0xE8, 0x98, 0x92, 0x43, 0xE8, 0x98, 0xAD, 0x43, 0xE8, 0x98, 0xBF, 0x43, 0xE8, 0x99, 0x8D, 0x43, 0xE8, 0x99, 0x90, 0x43, 0xE8, 0x99, 0x9C, 0x43, 0xE8, 0x99, 0xA7, 0x43, 0xE8, 0x99, 0xA9, 0x43, 0xE8, 0x99, 0xAB, 0x43, 0xE8, 0x9A, 0x88, 0x43, 0xE8, 0x9A, 0xA9, 0x43, 0xE8, // Bytes 12c0 - 12ff 0x9B, 0xA2, 0x43, 0xE8, 0x9C, 0x8E, 0x43, 0xE8, 0x9C, 0xA8, 0x43, 0xE8, 0x9D, 0xAB, 0x43, 0xE8, 0x9D, 0xB9, 0x43, 0xE8, 0x9E, 0x86, 0x43, 0xE8, 0x9E, 0xBA, 0x43, 0xE8, 0x9F, 0xA1, 0x43, 0xE8, 0xA0, 0x81, 0x43, 0xE8, 0xA0, 0x9F, 0x43, 0xE8, 0xA1, 0x80, 0x43, 0xE8, 0xA1, 0x8C, 0x43, 0xE8, 0xA1, 0xA0, 0x43, 0xE8, 0xA1, 0xA3, 0x43, 0xE8, 0xA3, 0x82, 0x43, 0xE8, 0xA3, 0x8F, 0x43, 0xE8, // Bytes 1300 - 133f 0xA3, 0x97, 0x43, 0xE8, 0xA3, 0x9E, 0x43, 0xE8, 0xA3, 0xA1, 0x43, 0xE8, 0xA3, 0xB8, 0x43, 0xE8, 0xA3, 0xBA, 0x43, 0xE8, 0xA4, 0x90, 0x43, 0xE8, 0xA5, 0x81, 0x43, 0xE8, 0xA5, 0xA4, 0x43, 0xE8, 0xA5, 0xBE, 0x43, 0xE8, 0xA6, 0x86, 0x43, 0xE8,
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go
vendor/golang.org/x/text/unicode/norm/tables10.0.0.go
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.10 && !go1.13 package norm import "sync" const ( // Version is the Unicode edition from which the tables are derived. Version = "10.0.0" // MaxTransformChunkSize indicates the maximum number of bytes that Transform // may need to write atomically for any Form. Making a destination buffer at // least this size ensures that Transform can always make progress and that // the user does not need to grow the buffer on an ErrShortDst. MaxTransformChunkSize = 35 + maxNonStarters*4 ) var ccc = [55]uint8{ 0, 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 84, 91, 103, 107, 118, 122, 129, 130, 132, 202, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 233, 234, 240, } const ( firstMulti = 0x186D firstCCC = 0x2C9E endMulti = 0x2F60 firstLeadingCCC = 0x49AE firstCCCZeroExcept = 0x4A78 firstStarterWithNLead = 0x4A9F lastDecomp = 0x4AA1 maxDecomp = 0x8000 ) // decomps: 19105 bytes var decomps = [...]byte{ // Bytes 0 - 3f 0x00, 0x41, 0x20, 0x41, 0x21, 0x41, 0x22, 0x41, 0x23, 0x41, 0x24, 0x41, 0x25, 0x41, 0x26, 0x41, 0x27, 0x41, 0x28, 0x41, 0x29, 0x41, 0x2A, 0x41, 0x2B, 0x41, 0x2C, 0x41, 0x2D, 0x41, 0x2E, 0x41, 0x2F, 0x41, 0x30, 0x41, 0x31, 0x41, 0x32, 0x41, 0x33, 0x41, 0x34, 0x41, 0x35, 0x41, 0x36, 0x41, 0x37, 0x41, 0x38, 0x41, 0x39, 0x41, 0x3A, 0x41, 0x3B, 0x41, 0x3C, 0x41, 0x3D, 0x41, 0x3E, 0x41, // Bytes 40 - 7f 0x3F, 0x41, 0x40, 0x41, 0x41, 0x41, 0x42, 0x41, 0x43, 0x41, 0x44, 0x41, 0x45, 0x41, 0x46, 0x41, 0x47, 0x41, 0x48, 0x41, 0x49, 0x41, 0x4A, 0x41, 0x4B, 0x41, 0x4C, 0x41, 0x4D, 0x41, 0x4E, 0x41, 0x4F, 0x41, 0x50, 0x41, 0x51, 0x41, 0x52, 0x41, 0x53, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, 0x57, 0x41, 0x58, 0x41, 0x59, 0x41, 0x5A, 0x41, 0x5B, 0x41, 0x5C, 0x41, 0x5D, 0x41, 0x5E, 0x41, // Bytes 80 - bf 0x5F, 0x41, 0x60, 0x41, 0x61, 0x41, 0x62, 0x41, 0x63, 0x41, 0x64, 0x41, 0x65, 0x41, 0x66, 0x41, 0x67, 0x41, 0x68, 0x41, 0x69, 0x41, 0x6A, 0x41, 0x6B, 0x41, 0x6C, 0x41, 0x6D, 0x41, 0x6E, 0x41, 0x6F, 0x41, 0x70, 0x41, 0x71, 0x41, 0x72, 0x41, 0x73, 0x41, 0x74, 0x41, 0x75, 0x41, 0x76, 0x41, 0x77, 0x41, 0x78, 0x41, 0x79, 0x41, 0x7A, 0x41, 0x7B, 0x41, 0x7C, 0x41, 0x7D, 0x41, 0x7E, 0x42, // Bytes c0 - ff 0xC2, 0xA2, 0x42, 0xC2, 0xA3, 0x42, 0xC2, 0xA5, 0x42, 0xC2, 0xA6, 0x42, 0xC2, 0xAC, 0x42, 0xC2, 0xB7, 0x42, 0xC3, 0x86, 0x42, 0xC3, 0xB0, 0x42, 0xC4, 0xA6, 0x42, 0xC4, 0xA7, 0x42, 0xC4, 0xB1, 0x42, 0xC5, 0x8B, 0x42, 0xC5, 0x93, 0x42, 0xC6, 0x8E, 0x42, 0xC6, 0x90, 0x42, 0xC6, 0xAB, 0x42, 0xC8, 0xA2, 0x42, 0xC8, 0xB7, 0x42, 0xC9, 0x90, 0x42, 0xC9, 0x91, 0x42, 0xC9, 0x92, 0x42, 0xC9, // Bytes 100 - 13f 0x94, 0x42, 0xC9, 0x95, 0x42, 0xC9, 0x99, 0x42, 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, 0x42, 0xD8, 0xB8, 0x42, 0xD8, 0xB9, 0x42, 0xD8, 0xBA, 0x42, 0xD9, 0x81, 0x42, 0xD9, 0x82, 0x42, 0xD9, 0x83, 0x42, 0xD9, // Bytes 280 - 2bf 0x84, 0x42, 0xD9, 0x85, 0x42, 0xD9, 0x86, 0x42, 0xD9, 0x87, 0x42, 0xD9, 0x88, 0x42, 0xD9, 0x89, 0x42, 0xD9, 0x8A, 0x42, 0xD9, 0xAE, 0x42, 0xD9, 0xAF, 0x42, 0xD9, 0xB1, 0x42, 0xD9, 0xB9, 0x42, 0xD9, 0xBA, 0x42, 0xD9, 0xBB, 0x42, 0xD9, 0xBE, 0x42, 0xD9, 0xBF, 0x42, 0xDA, 0x80, 0x42, 0xDA, 0x83, 0x42, 0xDA, 0x84, 0x42, 0xDA, 0x86, 0x42, 0xDA, 0x87, 0x42, 0xDA, 0x88, 0x42, 0xDA, 0x8C, // Bytes 2c0 - 2ff 0x42, 0xDA, 0x8D, 0x42, 0xDA, 0x8E, 0x42, 0xDA, 0x91, 0x42, 0xDA, 0x98, 0x42, 0xDA, 0xA1, 0x42, 0xDA, 0xA4, 0x42, 0xDA, 0xA6, 0x42, 0xDA, 0xA9, 0x42, 0xDA, 0xAD, 0x42, 0xDA, 0xAF, 0x42, 0xDA, 0xB1, 0x42, 0xDA, 0xB3, 0x42, 0xDA, 0xBA, 0x42, 0xDA, 0xBB, 0x42, 0xDA, 0xBE, 0x42, 0xDB, 0x81, 0x42, 0xDB, 0x85, 0x42, 0xDB, 0x86, 0x42, 0xDB, 0x87, 0x42, 0xDB, 0x88, 0x42, 0xDB, 0x89, 0x42, // Bytes 300 - 33f 0xDB, 0x8B, 0x42, 0xDB, 0x8C, 0x42, 0xDB, 0x90, 0x42, 0xDB, 0x92, 0x43, 0xE0, 0xBC, 0x8B, 0x43, 0xE1, 0x83, 0x9C, 0x43, 0xE1, 0x84, 0x80, 0x43, 0xE1, 0x84, 0x81, 0x43, 0xE1, 0x84, 0x82, 0x43, 0xE1, 0x84, 0x83, 0x43, 0xE1, 0x84, 0x84, 0x43, 0xE1, 0x84, 0x85, 0x43, 0xE1, 0x84, 0x86, 0x43, 0xE1, 0x84, 0x87, 0x43, 0xE1, 0x84, 0x88, 0x43, 0xE1, 0x84, 0x89, 0x43, 0xE1, 0x84, 0x8A, 0x43, // Bytes 340 - 37f 0xE1, 0x84, 0x8B, 0x43, 0xE1, 0x84, 0x8C, 0x43, 0xE1, 0x84, 0x8D, 0x43, 0xE1, 0x84, 0x8E, 0x43, 0xE1, 0x84, 0x8F, 0x43, 0xE1, 0x84, 0x90, 0x43, 0xE1, 0x84, 0x91, 0x43, 0xE1, 0x84, 0x92, 0x43, 0xE1, 0x84, 0x94, 0x43, 0xE1, 0x84, 0x95, 0x43, 0xE1, 0x84, 0x9A, 0x43, 0xE1, 0x84, 0x9C, 0x43, 0xE1, 0x84, 0x9D, 0x43, 0xE1, 0x84, 0x9E, 0x43, 0xE1, 0x84, 0xA0, 0x43, 0xE1, 0x84, 0xA1, 0x43, // Bytes 380 - 3bf 0xE1, 0x84, 0xA2, 0x43, 0xE1, 0x84, 0xA3, 0x43, 0xE1, 0x84, 0xA7, 0x43, 0xE1, 0x84, 0xA9, 0x43, 0xE1, 0x84, 0xAB, 0x43, 0xE1, 0x84, 0xAC, 0x43, 0xE1, 0x84, 0xAD, 0x43, 0xE1, 0x84, 0xAE, 0x43, 0xE1, 0x84, 0xAF, 0x43, 0xE1, 0x84, 0xB2, 0x43, 0xE1, 0x84, 0xB6, 0x43, 0xE1, 0x85, 0x80, 0x43, 0xE1, 0x85, 0x87, 0x43, 0xE1, 0x85, 0x8C, 0x43, 0xE1, 0x85, 0x97, 0x43, 0xE1, 0x85, 0x98, 0x43, // Bytes 3c0 - 3ff 0xE1, 0x85, 0x99, 0x43, 0xE1, 0x85, 0xA0, 0x43, 0xE1, 0x86, 0x84, 0x43, 0xE1, 0x86, 0x85, 0x43, 0xE1, 0x86, 0x88, 0x43, 0xE1, 0x86, 0x91, 0x43, 0xE1, 0x86, 0x92, 0x43, 0xE1, 0x86, 0x94, 0x43, 0xE1, 0x86, 0x9E, 0x43, 0xE1, 0x86, 0xA1, 0x43, 0xE1, 0x87, 0x87, 0x43, 0xE1, 0x87, 0x88, 0x43, 0xE1, 0x87, 0x8C, 0x43, 0xE1, 0x87, 0x8E, 0x43, 0xE1, 0x87, 0x93, 0x43, 0xE1, 0x87, 0x97, 0x43, // Bytes 400 - 43f 0xE1, 0x87, 0x99, 0x43, 0xE1, 0x87, 0x9D, 0x43, 0xE1, 0x87, 0x9F, 0x43, 0xE1, 0x87, 0xB1, 0x43, 0xE1, 0x87, 0xB2, 0x43, 0xE1, 0xB4, 0x82, 0x43, 0xE1, 0xB4, 0x96, 0x43, 0xE1, 0xB4, 0x97, 0x43, 0xE1, 0xB4, 0x9C, 0x43, 0xE1, 0xB4, 0x9D, 0x43, 0xE1, 0xB4, 0xA5, 0x43, 0xE1, 0xB5, 0xBB, 0x43, 0xE1, 0xB6, 0x85, 0x43, 0xE2, 0x80, 0x82, 0x43, 0xE2, 0x80, 0x83, 0x43, 0xE2, 0x80, 0x90, 0x43, // Bytes 440 - 47f 0xE2, 0x80, 0x93, 0x43, 0xE2, 0x80, 0x94, 0x43, 0xE2, 0x82, 0xA9, 0x43, 0xE2, 0x86, 0x90, 0x43, 0xE2, 0x86, 0x91, 0x43, 0xE2, 0x86, 0x92, 0x43, 0xE2, 0x86, 0x93, 0x43, 0xE2, 0x88, 0x82, 0x43, 0xE2, 0x88, 0x87, 0x43, 0xE2, 0x88, 0x91, 0x43, 0xE2, 0x88, 0x92, 0x43, 0xE2, 0x94, 0x82, 0x43, 0xE2, 0x96, 0xA0, 0x43, 0xE2, 0x97, 0x8B, 0x43, 0xE2, 0xA6, 0x85, 0x43, 0xE2, 0xA6, 0x86, 0x43, // Bytes 480 - 4bf 0xE2, 0xB5, 0xA1, 0x43, 0xE3, 0x80, 0x81, 0x43, 0xE3, 0x80, 0x82, 0x43, 0xE3, 0x80, 0x88, 0x43, 0xE3, 0x80, 0x89, 0x43, 0xE3, 0x80, 0x8A, 0x43, 0xE3, 0x80, 0x8B, 0x43, 0xE3, 0x80, 0x8C, 0x43, 0xE3, 0x80, 0x8D, 0x43, 0xE3, 0x80, 0x8E, 0x43, 0xE3, 0x80, 0x8F, 0x43, 0xE3, 0x80, 0x90, 0x43, 0xE3, 0x80, 0x91, 0x43, 0xE3, 0x80, 0x92, 0x43, 0xE3, 0x80, 0x94, 0x43, 0xE3, 0x80, 0x95, 0x43, // Bytes 4c0 - 4ff 0xE3, 0x80, 0x96, 0x43, 0xE3, 0x80, 0x97, 0x43, 0xE3, 0x82, 0xA1, 0x43, 0xE3, 0x82, 0xA2, 0x43, 0xE3, 0x82, 0xA3, 0x43, 0xE3, 0x82, 0xA4, 0x43, 0xE3, 0x82, 0xA5, 0x43, 0xE3, 0x82, 0xA6, 0x43, 0xE3, 0x82, 0xA7, 0x43, 0xE3, 0x82, 0xA8, 0x43, 0xE3, 0x82, 0xA9, 0x43, 0xE3, 0x82, 0xAA, 0x43, 0xE3, 0x82, 0xAB, 0x43, 0xE3, 0x82, 0xAD, 0x43, 0xE3, 0x82, 0xAF, 0x43, 0xE3, 0x82, 0xB1, 0x43, // Bytes 500 - 53f 0xE3, 0x82, 0xB3, 0x43, 0xE3, 0x82, 0xB5, 0x43, 0xE3, 0x82, 0xB7, 0x43, 0xE3, 0x82, 0xB9, 0x43, 0xE3, 0x82, 0xBB, 0x43, 0xE3, 0x82, 0xBD, 0x43, 0xE3, 0x82, 0xBF, 0x43, 0xE3, 0x83, 0x81, 0x43, 0xE3, 0x83, 0x83, 0x43, 0xE3, 0x83, 0x84, 0x43, 0xE3, 0x83, 0x86, 0x43, 0xE3, 0x83, 0x88, 0x43, 0xE3, 0x83, 0x8A, 0x43, 0xE3, 0x83, 0x8B, 0x43, 0xE3, 0x83, 0x8C, 0x43, 0xE3, 0x83, 0x8D, 0x43, // Bytes 540 - 57f 0xE3, 0x83,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 0x8B, 0x43, 0xE4, 0xBE, 0xAE, 0x43, 0xE4, 0xBE, 0xBB, 0x43, 0xE4, 0xBE, 0xBF, 0x43, 0xE5, 0x80, 0x82, 0x43, 0xE5, 0x80, 0xAB, 0x43, 0xE5, 0x81, 0xBA, 0x43, 0xE5, 0x82, 0x99, 0x43, 0xE5, 0x83, 0x8F, 0x43, 0xE5, 0x83, 0x9A, 0x43, 0xE5, 0x83, 0xA7, 0x43, // Bytes 780 - 7bf 0xE5, 0x84, 0xAA, 0x43, 0xE5, 0x84, 0xBF, 0x43, 0xE5, 0x85, 0x80, 0x43, 0xE5, 0x85, 0x85, 0x43, 0xE5, 0x85, 0x8D, 0x43, 0xE5, 0x85, 0x94, 0x43, 0xE5, 0x85, 0xA4, 0x43, 0xE5, 0x85, 0xA5, 0x43, 0xE5, 0x85, 0xA7, 0x43, 0xE5, 0x85, 0xA8, 0x43, 0xE5, 0x85, 0xA9, 0x43, 0xE5, 0x85, 0xAB, 0x43, 0xE5, 0x85, 0xAD, 0x43, 0xE5, 0x85, 0xB7, 0x43, 0xE5, 0x86, 0x80, 0x43, 0xE5, 0x86, 0x82, 0x43, // Bytes 7c0 - 7ff 0xE5, 0x86, 0x8D, 0x43, 0xE5, 0x86, 0x92, 0x43, 0xE5, 0x86, 0x95, 0x43, 0xE5, 0x86, 0x96, 0x43, 0xE5, 0x86, 0x97, 0x43, 0xE5, 0x86, 0x99, 0x43, 0xE5, 0x86, 0xA4, 0x43, 0xE5, 0x86, 0xAB, 0x43, 0xE5, 0x86, 0xAC, 0x43, 0xE5, 0x86, 0xB5, 0x43, 0xE5, 0x86, 0xB7, 0x43, 0xE5, 0x87, 0x89, 0x43, 0xE5, 0x87, 0x8C, 0x43, 0xE5, 0x87, 0x9C, 0x43, 0xE5, 0x87, 0x9E, 0x43, 0xE5, 0x87, 0xA0, 0x43, // Bytes 800 - 83f 0xE5, 0x87, 0xB5, 0x43, 0xE5, 0x88, 0x80, 0x43, 0xE5, 0x88, 0x83,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8D, 0xBF, 0x43, // Bytes 8c0 - 8ff 0xE5, 0x8E, 0x82, 0x43, 0xE5, 0x8E, 0xB6, 0x43, 0xE5, 0x8F, 0x83, 0x43, 0xE5, 0x8F, 0x88, 0x43, 0xE5, 0x8F, 0x8A, 0x43, 0xE5, 0x8F, 0x8C, 0x43, 0xE5, 0x8F, 0x9F, 0x43, 0xE5, 0x8F, 0xA3, 0x43, 0xE5, 0x8F, 0xA5, 0x43, 0xE5, 0x8F, 0xAB, 0x43, 0xE5, 0x8F, 0xAF, 0x43, 0xE5, 0x8F, 0xB1, 0x43, 0xE5, 0x8F, 0xB3, 0x43, 0xE5, 0x90, 0x86, 0x43, 0xE5, 0x90, 0x88, 0x43, 0xE5, 0x90, 0x8D, 0x43, // Bytes 900 - 93f 0xE5, 0x90, 0x8F, 0x43, 0xE5, 0x90, 0x9D, 0x43, 0xE5, 0x90, 0xB8, 0x43, 0xE5, 0x90, 0xB9, 0x43, 0xE5, 0x91, 0x82, 0x43, 0xE5, 0x91, 0x88, 0x43, 0xE5, 0x91, 0xA8, 0x43, 0xE5, 0x92, 0x9E, 0x43, 0xE5, 0x92, 0xA2, 0x43, 0xE5, 0x92, 0xBD, 0x43, 0xE5, 0x93, 0xB6, 0x43, 0xE5, 0x94, 0x90, 0x43, 0xE5, 0x95, 0x8F, 0x43, 0xE5, 0x95, 0x93, 0x43, 0xE5, 0x95, 0x95, 0x43, 0xE5, 0x95, 0xA3, 0x43, // Bytes 940 - 97f 0xE5, 0x96, 0x84, 0x43, 0xE5, 0x96, 0x87, 0x43, 0xE5, 0x96, 0x99, 0x43, 0xE5, 0x96, 0x9D, 0x43, 0xE5, 0x96, 0xAB, 0x43, 0xE5, 0x96, 0xB3, 0x43, 0xE5, 0x96, 0xB6, 0x43, 0xE5, 0x97, 0x80, 0x43, 0xE5, 0x97, 0x82, 0x43, 0xE5, 0x97, 0xA2, 0x43, 0xE5, 0x98, 0x86, 0x43, 0xE5, 0x99, 0x91, 0x43, 0xE5, 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5, 0xBE, 0xAD, 0x43, // Bytes b80 - bbf 0xE5, 0xBF, 0x83, 0x43, 0xE5, 0xBF, 0x8D, 0x43, 0xE5, 0xBF, 0x97, 0x43, 0xE5, 0xBF, 0xB5, 0x43, 0xE5, 0xBF, 0xB9, 0x43, 0xE6, 0x80, 0x92, 0x43, 0xE6, 0x80, 0x9C, 0x43, 0xE6, 0x81, 0xB5, 0x43, 0xE6, 0x82, 0x81, 0x43, 0xE6, 0x82, 0x94, 0x43, 0xE6, 0x83, 0x87, 0x43, 0xE6, 0x83, 0x98, 0x43, 0xE6, 0x83, 0xA1, 0x43, 0xE6, 0x84, 0x88, 0x43, 0xE6, 0x85, 0x84, 0x43, 0xE6, 0x85, 0x88, 0x43, // Bytes bc0 - bff 0xE6, 0x85, 0x8C, 0x43, 0xE6, 0x85, 0x8E, 0x43, 0xE6, 0x85, 0xA0, 0x43, 0xE6, 0x85, 0xA8, 0x43, 0xE6, 0x85, 0xBA, 0x43, 0xE6, 0x86, 0x8E, 0x43, 0xE6, 0x86, 0x90, 0x43, 0xE6, 0x86, 0xA4, 0x43, 0xE6, 0x86, 0xAF, 0x43, 0xE6, 0x86, 0xB2, 0x43, 0xE6, 0x87, 0x9E, 0x43, 0xE6, 0x87, 0xB2, 0x43, 0xE6, 0x87, 0xB6, 0x43, 0xE6, 0x88, 0x80, 0x43, 0xE6, 0x88, 0x88, 0x43, 0xE6, 0x88, 0x90, 0x43, // Bytes c00 - c3f 0xE6, 0x88, 0x9B, 0x43, 0xE6, 0x88, 0xAE, 0x43, 0xE6, 0x88, 0xB4, 0x43, 0xE6, 0x88, 0xB6, 0x43, 0xE6, 0x89, 0x8B, 0x43, 0xE6, 0x89, 0x93, 0x43, 0xE6, 0x89, 0x9D, 0x43, 0xE6, 0x8A, 0x95, 0x43, 0xE6, 0x8A, 0xB1, 0x43, 0xE6, 0x8B, 0x89, 0x43, 0xE6, 0x8B, 0x8F, 0x43, 0xE6, 0x8B, 0x93, 0x43, 0xE6, 0x8B, 0x94, 0x43, 0xE6, 0x8B, 0xBC, 0x43, 0xE6, 0x8B, 0xBE, 0x43, 0xE6, 0x8C, 0x87, 0x43, // Bytes c40 - c7f 0xE6, 0x8C, 0xBD, 0x43, 0xE6, 0x8D, 0x90, 0x43, 0xE6, 0x8D, 0x95, 0x43, 0xE6, 0x8D, 0xA8, 0x43, 0xE6, 0x8D, 0xBB, 0x43, 0xE6, 0x8E, 0x83, 0x43, 0xE6, 0x8E, 0xA0, 0x43, 0xE6, 0x8E, 0xA9, 0x43, 0xE6, 0x8F, 0x84, 0x43, 0xE6, 0x8F, 0x85, 0x43, 0xE6, 0x8F, 0xA4, 0x43, 0xE6, 0x90, 0x9C, 0x43, 0xE6, 0x90, 0xA2, 0x43, 0xE6, 0x91, 0x92, 0x43, 0xE6, 0x91, 0xA9, 0x43, 0xE6, 0x91, 0xB7, 0x43, // Bytes c80 - cbf 0xE6, 0x91, 0xBE, 0x43, 0xE6, 0x92, 0x9A, 0x43, 0xE6, 0x92, 0x9D, 0x43, 0xE6, 0x93, 0x84, 0x43, 0xE6, 0x94, 0xAF, 0x43, 0xE6, 0x94, 0xB4, 0x43, 0xE6, 0x95, 0x8F, 0x43, 0xE6, 0x95, 0x96, 0x43, 0xE6, 0x95, 0xAC, 0x43, 0xE6, 0x95, 0xB8, 0x43, 0xE6, 0x96, 0x87, 0x43, 0xE6, 0x96, 0x97, 0x43, 0xE6, 0x96, 0x99, 0x43, 0xE6, 0x96, 0xA4, 0x43, 0xE6, 0x96, 0xB0, 0x43, 0xE6, 0x96, 0xB9, 0x43, // Bytes cc0 - cff 0xE6, 0x97, 0x85, 0x43, 0xE6, 0x97, 0xA0, 0x43, 0xE6, 0x97, 0xA2, 0x43, 0xE6, 0x97, 0xA3, 0x43, 0xE6, 0x97, 0xA5, 0x43, 0xE6, 0x98, 0x93, 0x43, 0xE6, 0x98, 0xA0, 0x43, 0xE6, 0x99, 0x89, 0x43, 0xE6, 0x99, 0xB4, 0x43, 0xE6, 0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, 0xAE, 0x43, 0xE6, 0xBA, 0x80, 0x43, 0xE6, 0xBA, 0x9C, 0x43, 0xE6, 0xBA, 0xBA, 0x43, 0xE6, 0xBB, 0x87, 0x43, 0xE6, 0xBB, 0x8B, 0x43, 0xE6, 0xBB, 0x91, 0x43, 0xE6, 0xBB, 0x9B, 0x43, 0xE6, 0xBC, 0x8F, 0x43, 0xE6, 0xBC, 0x94, 0x43, 0xE6, 0xBC, 0xA2, 0x43, 0xE6, 0xBC, 0xA3, 0x43, 0xE6, 0xBD, 0xAE, 0x43, 0xE6, 0xBF, 0x86, 0x43, 0xE6, 0xBF, 0xAB, 0x43, 0xE6, 0xBF, 0xBE, 0x43, // Bytes e80 - ebf 0xE7, 0x80, 0x9B, 0x43, 0xE7, 0x80, 0x9E, 0x43, 0xE7, 0x80, 0xB9, 0x43, 0xE7, 0x81, 0x8A, 0x43, 0xE7, 0x81, 0xAB, 0x43, 0xE7, 0x81, 0xB0, 0x43, 0xE7, 0x81, 0xB7, 0x43, 0xE7, 0x81, 0xBD, 0x43, 0xE7, 0x82, 0x99, 0x43, 0xE7, 0x82, 0xAD, 0x43, 0xE7, 0x83, 0x88, 0x43, 0xE7, 0x83, 0x99, 0x43, 0xE7, 0x84, 0xA1, 0x43, 0xE7, 0x85, 0x85, 0x43, 0xE7, 0x85, 0x89, 0x43, 0xE7, 0x85, 0xAE, 0x43, // Bytes ec0 - eff 0xE7, 0x86, 0x9C, 0x43, 0xE7, 0x87, 0x8E, 0x43, 0xE7, 0x87, 0x90, 0x43, 0xE7, 0x88, 0x90, 0x43, 0xE7, 0x88, 0x9B, 0x43, 0xE7, 0x88, 0xA8, 0x43, 0xE7, 0x88, 0xAA, 0x43, 0xE7, 0x88, 0xAB, 0x43, 0xE7, 0x88, 0xB5, 0x43, 0xE7, 0x88, 0xB6, 0x43, 0xE7, 0x88, 0xBB, 0x43, 0xE7, 0x88, 0xBF, 0x43, 0xE7, 0x89, 0x87, 0x43, 0xE7, 0x89, 0x90, 0x43, 0xE7, 0x89, 0x99, 0x43, 0xE7, 0x89, 0x9B, 0x43, // Bytes f00 - f3f 0xE7, 0x89, 0xA2, 0x43, 0xE7, 0x89, 0xB9, 0x43, 0xE7, 0x8A, 0x80, 0x43, 0xE7, 0x8A, 0x95, 0x43, 0xE7, 0x8A, 0xAC, 0x43, 0xE7, 0x8A, 0xAF, 0x43, 0xE7, 0x8B, 0x80, 0x43, 0xE7, 0x8B, 0xBC, 0x43, 0xE7, 0x8C, 0xAA, 0x43, 0xE7, 0x8D, 0xB5, 0x43, 0xE7, 0x8D, 0xBA, 0x43, 0xE7, 0x8E, 0x84, 0x43, 0xE7, 0x8E, 0x87, 0x43, 0xE7, 0x8E, 0x89, 0x43, 0xE7, 0x8E, 0x8B, 0x43, 0xE7, 0x8E, 0xA5, 0x43, // Bytes f40 - f7f 0xE7, 0x8E, 0xB2, 0x43, 0xE7, 0x8F, 0x9E, 0x43, 0xE7, 0x90, 0x86, 0x43, 0xE7, 0x90, 0x89, 0x43, 0xE7, 0x90, 0xA2, 0x43, 0xE7, 0x91, 0x87, 0x43, 0xE7, 0x91, 0x9C, 0x43, 0xE7, 0x91, 0xA9, 0x43, 0xE7, 0x91, 0xB1, 0x43, 0xE7, 0x92, 0x85, 0x43, 0xE7, 0x92, 0x89, 0x43, 0xE7, 0x92, 0x98, 0x43, 0xE7, 0x93, 0x8A, 0x43, 0xE7, 0x93, 0x9C, 0x43, 0xE7, 0x93, 0xA6, 0x43, 0xE7, 0x94, 0x86, 0x43, // Bytes f80 - fbf 0xE7, 0x94, 0x98, 0x43, 0xE7, 0x94, 0x9F, 0x43, 0xE7, 0x94, 0xA4, 0x43, 0xE7, 0x94, 0xA8, 0x43, 0xE7, 0x94, 0xB0, 0x43, 0xE7, 0x94, 0xB2, 0x43, 0xE7, 0x94, 0xB3, 0x43, 0xE7, 0x94, 0xB7, 0x43, 0xE7, 0x94, 0xBB, 0x43, 0xE7, 0x94, 0xBE, 0x43, 0xE7, 0x95, 0x99,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A4, 0x43, 0xE8, 0xA5, 0xBE, 0x43, 0xE8, 0xA6, 0x86, 0x43, 0xE8, 0xA6, 0x8B, 0x43,
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/transform.go
vendor/golang.org/x/text/unicode/norm/transform.go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package norm import ( "unicode/utf8" "golang.org/x/text/transform" ) // Reset implements the Reset method of the transform.Transformer interface. func (Form) Reset() {} // Transform implements the Transform method of the transform.Transformer // interface. It may need to write segments of up to MaxSegmentSize at once. // Users should either catch ErrShortDst and allow dst to grow or have dst be at // least of size MaxTransformChunkSize to be guaranteed of progress. func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { // Cap the maximum number of src bytes to check. b := src eof := atEOF if ns := len(dst); ns < len(b) { err = transform.ErrShortDst eof = false b = b[:ns] } i, ok := formTable[f].quickSpan(inputBytes(b), 0, len(b), eof) n := copy(dst, b[:i]) if !ok { nDst, nSrc, err = f.transform(dst[n:], src[n:], atEOF) return nDst + n, nSrc + n, err } if err == nil && n < len(src) && !atEOF { err = transform.ErrShortSrc } return n, n, err } func flushTransform(rb *reorderBuffer) bool { // Write out (must fully fit in dst, or else it is an ErrShortDst). if len(rb.out) < rb.nrune*utf8.UTFMax { return false } rb.out = rb.out[rb.flushCopy(rb.out):] return true } var errs = []error{nil, transform.ErrShortDst, transform.ErrShortSrc} // transform implements the transform.Transformer interface. It is only called // when quickSpan does not pass for a given string. func (f Form) transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { // TODO: get rid of reorderBuffer. See CL 23460044. rb := reorderBuffer{} rb.init(f, src) for { // Load segment into reorder buffer. rb.setFlusher(dst[nDst:], flushTransform) end := decomposeSegment(&rb, nSrc, atEOF) if end < 0 { return nDst, nSrc, errs[-end] } nDst = len(dst) - len(rb.out) nSrc = end // Next quickSpan. end = rb.nsrc eof := atEOF if n := nSrc + len(dst) - nDst; n < end { err = transform.ErrShortDst end = n eof = false } end, ok := rb.f.quickSpan(rb.src, nSrc, end, eof) n := copy(dst[nDst:], rb.src.bytes[nSrc:end]) nSrc += n nDst += n if ok { if err == nil && n < rb.nsrc && !atEOF { err = transform.ErrShortSrc } return nDst, nSrc, err } } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go
vendor/golang.org/x/text/unicode/norm/tables9.0.0.go
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build !go1.10 package norm import "sync" const ( // Version is the Unicode edition from which the tables are derived. Version = "9.0.0" // MaxTransformChunkSize indicates the maximum number of bytes that Transform // may need to write atomically for any Form. Making a destination buffer at // least this size ensures that Transform can always make progress and that // the user does not need to grow the buffer on an ErrShortDst. MaxTransformChunkSize = 35 + maxNonStarters*4 ) var ccc = [55]uint8{ 0, 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 84, 91, 103, 107, 118, 122, 129, 130, 132, 202, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 233, 234, 240, } const ( firstMulti = 0x186D firstCCC = 0x2C9E endMulti = 0x2F60 firstLeadingCCC = 0x49AE firstCCCZeroExcept = 0x4A78 firstStarterWithNLead = 0x4A9F lastDecomp = 0x4AA1 maxDecomp = 0x8000 ) // decomps: 19105 bytes var decomps = [...]byte{ // Bytes 0 - 3f 0x00, 0x41, 0x20, 0x41, 0x21, 0x41, 0x22, 0x41, 0x23, 0x41, 0x24, 0x41, 0x25, 0x41, 0x26, 0x41, 0x27, 0x41, 0x28, 0x41, 0x29, 0x41, 0x2A, 0x41, 0x2B, 0x41, 0x2C, 0x41, 0x2D, 0x41, 0x2E, 0x41, 0x2F, 0x41, 0x30, 0x41, 0x31, 0x41, 0x32, 0x41, 0x33, 0x41, 0x34, 0x41, 0x35, 0x41, 0x36, 0x41, 0x37, 0x41, 0x38, 0x41, 0x39, 0x41, 0x3A, 0x41, 0x3B, 0x41, 0x3C, 0x41, 0x3D, 0x41, 0x3E, 0x41, // Bytes 40 - 7f 0x3F, 0x41, 0x40, 0x41, 0x41, 0x41, 0x42, 0x41, 0x43, 0x41, 0x44, 0x41, 0x45, 0x41, 0x46, 0x41, 0x47, 0x41, 0x48, 0x41, 0x49, 0x41, 0x4A, 0x41, 0x4B, 0x41, 0x4C, 0x41, 0x4D, 0x41, 0x4E, 0x41, 0x4F, 0x41, 0x50, 0x41, 0x51, 0x41, 0x52, 0x41, 0x53, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, 0x57, 0x41, 0x58, 0x41, 0x59, 0x41, 0x5A, 0x41, 0x5B, 0x41, 0x5C, 0x41, 0x5D, 0x41, 0x5E, 0x41, // Bytes 80 - bf 0x5F, 0x41, 0x60, 0x41, 0x61, 0x41, 0x62, 0x41, 0x63, 0x41, 0x64, 0x41, 0x65, 0x41, 0x66, 0x41, 0x67, 0x41, 0x68, 0x41, 0x69, 0x41, 0x6A, 0x41, 0x6B, 0x41, 0x6C, 0x41, 0x6D, 0x41, 0x6E, 0x41, 0x6F, 0x41, 0x70, 0x41, 0x71, 0x41, 0x72, 0x41, 0x73, 0x41, 0x74, 0x41, 0x75, 0x41, 0x76, 0x41, 0x77, 0x41, 0x78, 0x41, 0x79, 0x41, 0x7A, 0x41, 0x7B, 0x41, 0x7C, 0x41, 0x7D, 0x41, 0x7E, 0x42, // Bytes c0 - ff 0xC2, 0xA2, 0x42, 0xC2, 0xA3, 0x42, 0xC2, 0xA5, 0x42, 0xC2, 0xA6,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 0x42, 0xDA, 0xB3, 0x42, 0xDA, 0xBA, 0x42, 0xDA, 0xBB, 0x42, 0xDA, 0xBE, 0x42, 0xDB, 0x81, 0x42, 0xDB, 0x85, 0x42, 0xDB, 0x86, 0x42, 0xDB, 0x87, 0x42, 0xDB, 0x88, 0x42, 0xDB, 0x89, 0x42, // Bytes 300 - 33f 0xDB, 0x8B, 0x42, 0xDB, 0x8C, 0x42, 0xDB, 0x90, 0x42, 0xDB, 0x92, 0x43, 0xE0, 0xBC, 0x8B, 0x43, 0xE1, 0x83, 0x9C, 0x43, 0xE1, 0x84, 0x80, 0x43, 0xE1, 0x84, 0x81, 0x43, 0xE1, 0x84, 0x82, 0x43, 0xE1, 0x84, 0x83, 0x43, 0xE1, 0x84, 0x84, 0x43, 0xE1, 0x84, 0x85, 0x43, 0xE1, 0x84, 0x86, 0x43, 0xE1, 0x84, 0x87, 0x43, 0xE1, 0x84, 0x88, 0x43, 0xE1, 0x84, 0x89, 0x43, 0xE1, 0x84, 0x8A, 0x43, // Bytes 340 - 37f 0xE1, 0x84, 0x8B, 0x43, 0xE1, 0x84, 0x8C, 0x43, 0xE1, 0x84, 0x8D, 0x43, 0xE1, 0x84, 0x8E, 0x43, 0xE1, 0x84, 0x8F, 0x43, 0xE1, 0x84, 0x90, 0x43, 0xE1, 0x84, 0x91, 0x43, 0xE1, 0x84, 0x92, 0x43, 0xE1, 0x84, 0x94, 0x43, 0xE1, 0x84, 0x95, 0x43, 0xE1, 0x84, 0x9A, 0x43, 0xE1, 0x84, 0x9C, 0x43, 0xE1, 0x84, 0x9D, 0x43, 0xE1, 0x84, 0x9E, 0x43, 0xE1, 0x84, 0xA0, 0x43, 0xE1, 0x84, 0xA1, 0x43, // Bytes 380 - 3bf 0xE1, 0x84, 0xA2, 0x43, 0xE1, 0x84, 0xA3, 0x43, 0xE1, 0x84, 0xA7, 0x43, 0xE1, 0x84, 0xA9, 0x43, 0xE1, 0x84, 0xAB, 0x43, 0xE1, 0x84, 0xAC, 0x43, 0xE1, 0x84, 0xAD, 0x43, 0xE1, 0x84, 0xAE, 0x43, 0xE1, 0x84, 0xAF, 0x43, 0xE1, 0x84, 0xB2, 0x43, 0xE1, 0x84, 0xB6, 0x43, 0xE1, 0x85, 0x80, 0x43, 0xE1, 0x85, 0x87, 0x43, 0xE1, 0x85, 0x8C, 0x43, 0xE1, 0x85, 0x97, 0x43, 0xE1, 0x85, 0x98, 0x43, // Bytes 3c0 - 3ff 0xE1, 0x85, 0x99, 0x43, 0xE1, 0x85, 0xA0, 0x43, 0xE1, 0x86, 0x84, 0x43, 0xE1, 0x86, 0x85, 0x43, 0xE1, 0x86, 0x88, 0x43, 0xE1, 0x86, 0x91, 0x43, 0xE1, 0x86, 0x92, 0x43, 0xE1, 0x86, 0x94, 0x43, 0xE1, 0x86, 0x9E, 0x43, 0xE1, 0x86, 0xA1, 0x43, 0xE1, 0x87, 0x87, 0x43, 0xE1, 0x87, 0x88, 0x43, 0xE1, 0x87, 0x8C, 0x43, 0xE1, 0x87, 0x8E, 0x43, 0xE1, 0x87, 0x93, 0x43, 0xE1, 0x87, 0x97, 0x43, // Bytes 400 - 43f 0xE1, 0x87, 0x99, 0x43, 0xE1, 0x87, 0x9D, 0x43, 0xE1, 0x87, 0x9F, 0x43, 0xE1, 0x87, 0xB1, 0x43, 0xE1, 0x87, 0xB2, 0x43, 0xE1, 0xB4, 0x82, 0x43, 0xE1, 0xB4, 0x96, 0x43, 0xE1, 0xB4, 0x97, 0x43, 0xE1, 0xB4, 0x9C, 0x43, 0xE1, 0xB4, 0x9D, 0x43, 0xE1, 0xB4, 0xA5, 0x43, 0xE1, 0xB5, 0xBB, 0x43, 0xE1, 0xB6, 0x85, 0x43, 0xE2, 0x80, 0x82, 0x43, 0xE2, 0x80, 0x83, 0x43, 0xE2, 0x80, 0x90, 0x43, // Bytes 440 - 47f 0xE2, 0x80, 0x93, 0x43, 0xE2, 0x80, 0x94, 0x43, 0xE2, 0x82, 0xA9, 0x43, 0xE2, 0x86, 0x90, 0x43, 0xE2, 0x86, 0x91, 0x43, 0xE2, 0x86, 0x92, 0x43, 0xE2, 0x86, 0x93, 0x43, 0xE2, 0x88, 0x82, 0x43, 0xE2, 0x88, 0x87, 0x43, 0xE2, 0x88, 0x91, 0x43, 0xE2, 0x88, 0x92, 0x43, 0xE2, 0x94, 0x82, 0x43, 0xE2, 0x96, 0xA0, 0x43, 0xE2, 0x97, 0x8B, 0x43, 0xE2, 0xA6, 0x85, 0x43, 0xE2, 0xA6, 0x86, 0x43, // Bytes 480 - 4bf 0xE2, 0xB5, 0xA1, 0x43, 0xE3, 0x80, 0x81, 0x43, 0xE3, 0x80, 0x82, 0x43, 0xE3, 0x80, 0x88, 0x43, 0xE3, 0x80, 0x89, 0x43, 0xE3, 0x80, 0x8A, 0x43, 0xE3, 0x80, 0x8B, 0x43, 0xE3, 0x80, 0x8C, 0x43, 0xE3, 0x80, 0x8D, 0x43, 0xE3, 0x80, 0x8E, 0x43, 0xE3, 0x80, 0x8F, 0x43, 0xE3, 0x80, 0x90, 0x43, 0xE3, 0x80, 0x91, 0x43, 0xE3, 0x80, 0x92, 0x43, 0xE3, 0x80, 0x94, 0x43, 0xE3, 0x80, 0x95, 0x43, // Bytes 4c0 - 4ff 0xE3, 0x80, 0x96, 0x43, 0xE3, 0x80, 0x97, 0x43, 0xE3, 0x82, 0xA1, 0x43, 0xE3, 0x82, 0xA2, 0x43, 0xE3, 0x82, 0xA3, 0x43, 0xE3, 0x82, 0xA4, 0x43, 0xE3, 0x82, 0xA5, 0x43, 0xE3, 0x82, 0xA6, 0x43, 0xE3, 0x82, 0xA7, 0x43, 0xE3, 0x82, 0xA8, 0x43, 0xE3, 0x82, 0xA9, 0x43, 0xE3, 0x82, 0xAA, 0x43, 0xE3, 0x82, 0xAB, 0x43, 0xE3, 0x82, 0xAD, 0x43, 0xE3, 0x82, 0xAF, 0x43, 0xE3, 0x82, 0xB1, 0x43, // Bytes 500 - 53f 0xE3, 0x82, 0xB3, 0x43, 0xE3, 0x82, 0xB5, 0x43, 0xE3, 0x82, 0xB7, 0x43, 0xE3, 0x82, 0xB9, 0x43, 0xE3, 0x82, 0xBB, 0x43, 0xE3, 0x82, 0xBD, 0x43, 0xE3, 0x82, 0xBF, 0x43, 0xE3, 0x83, 0x81, 0x43, 0xE3, 0x83, 0x83, 0x43, 0xE3, 0x83, 0x84, 0x43, 0xE3, 0x83, 0x86, 0x43, 0xE3, 0x83, 0x88, 0x43, 0xE3, 0x83, 0x8A, 0x43, 0xE3, 0x83, 0x8B, 0x43, 0xE3, 0x83, 0x8C, 0x43, 0xE3, 0x83, 0x8D, 0x43, // Bytes 540 - 57f 0xE3, 0x83, 0x8E, 0x43, 0xE3, 0x83, 0x8F, 0x43, 0xE3, 0x83, 0x92, 0x43, 0xE3, 0x83, 0x95, 0x43, 0xE3, 0x83, 0x98, 0x43, 0xE3, 0x83, 0x9B, 0x43, 0xE3, 0x83, 0x9E, 0x43, 0xE3, 0x83, 0x9F, 0x43, 0xE3, 0x83, 0xA0, 0x43, 0xE3, 0x83, 0xA1, 0x43, 0xE3, 0x83, 0xA2, 0x43, 0xE3, 0x83, 0xA3, 0x43, 0xE3, 0x83, 0xA4, 0x43, 0xE3, 0x83, 0xA5, 0x43, 0xE3, 0x83, 0xA6, 0x43, 0xE3, 0x83, 0xA7, 0x43, // Bytes 580 - 5bf 0xE3, 0x83, 0xA8, 0x43, 0xE3, 0x83, 0xA9, 0x43, 0xE3, 0x83, 0xAA, 0x43, 0xE3, 0x83, 0xAB, 0x43, 0xE3, 0x83, 0xAC, 0x43, 0xE3, 0x83, 0xAD, 0x43, 0xE3, 0x83, 0xAF, 0x43, 0xE3, 0x83, 0xB0, 0x43, 0xE3, 0x83, 0xB1, 0x43, 0xE3, 0x83, 0xB2, 0x43, 0xE3, 0x83, 0xB3, 0x43, 0xE3, 0x83, 0xBB, 0x43, 0xE3, 0x83, 0xBC, 0x43, 0xE3, 0x92, 0x9E, 0x43, 0xE3, 0x92, 0xB9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0x86, 0x43, 0xE4, 0xBA, 0x8C, 0x43, 0xE4, 0xBA, 0x94, 0x43, 0xE4, 0xBA, 0xA0, 0x43, 0xE4, 0xBA, 0xA4, 0x43, 0xE4, 0xBA, 0xAE, 0x43, 0xE4, 0xBA, 0xBA, 0x43, 0xE4, 0xBB, 0x80, 0x43, 0xE4, 0xBB, 0x8C, 0x43, 0xE4, 0xBB, 0xA4, 0x43, // Bytes 740 - 77f 0xE4, 0xBC, 0x81, 0x43, 0xE4, 0xBC, 0x91, 0x43, 0xE4, 0xBD, 0xA0, 0x43, 0xE4, 0xBE, 0x80, 0x43, 0xE4, 0xBE, 0x86, 0x43, 0xE4, 0xBE, 0x8B, 0x43, 0xE4, 0xBE, 0xAE, 0x43, 0xE4, 0xBE, 0xBB, 0x43, 0xE4, 0xBE, 0xBF, 0x43, 0xE5, 0x80, 0x82, 0x43, 0xE5, 0x80, 0xAB, 0x43, 0xE5, 0x81, 0xBA, 0x43, 0xE5, 0x82, 0x99, 0x43, 0xE5, 0x83, 0x8F, 0x43, 0xE5, 0x83, 0x9A, 0x43, 0xE5, 0x83, 0xA7, 0x43, // Bytes 780 - 7bf 0xE5, 0x84, 0xAA, 0x43, 0xE5, 0x84, 0xBF, 0x43, 0xE5, 0x85, 0x80, 0x43, 0xE5, 0x85, 0x85, 0x43, 0xE5, 0x85, 0x8D, 0x43, 0xE5, 0x85, 0x94, 0x43, 0xE5, 0x85, 0xA4, 0x43, 0xE5, 0x85, 0xA5, 0x43, 0xE5, 0x85, 0xA7, 0x43, 0xE5, 0x85, 0xA8, 0x43, 0xE5, 0x85, 0xA9, 0x43, 0xE5, 0x85, 0xAB, 0x43, 0xE5, 0x85, 0xAD, 0x43, 0xE5, 0x85, 0xB7, 0x43, 0xE5, 0x86, 0x80, 0x43, 0xE5, 0x86, 0x82, 0x43, // Bytes 7c0 - 7ff 0xE5, 0x86, 0x8D, 0x43, 0xE5, 0x86, 0x92, 0x43, 0xE5, 0x86, 0x95, 0x43, 0xE5, 0x86, 0x96, 0x43, 0xE5, 0x86, 0x97, 0x43, 0xE5, 0x86, 0x99, 0x43, 0xE5, 0x86, 0xA4, 0x43, 0xE5, 0x86, 0xAB, 0x43, 0xE5, 0x86, 0xAC, 0x43, 0xE5, 0x86, 0xB5, 0x43, 0xE5, 0x86, 0xB7, 0x43, 0xE5, 0x87, 0x89, 0x43, 0xE5, 0x87, 0x8C, 0x43, 0xE5, 0x87, 0x9C, 0x43, 0xE5, 0x87, 0x9E, 0x43, 0xE5, 0x87, 0xA0, 0x43, // Bytes 800 - 83f 0xE5, 0x87, 0xB5, 0x43, 0xE5, 0x88, 0x80, 0x43, 0xE5, 0x88, 0x83, 0x43, 0xE5, 0x88, 0x87, 0x43, 0xE5, 0x88, 0x97, 0x43, 0xE5, 0x88, 0x9D, 0x43, 0xE5, 0x88, 0xA9, 0x43, 0xE5, 0x88, 0xBA, 0x43, 0xE5, 0x88, 0xBB, 0x43, 0xE5, 0x89, 0x86, 0x43, 0xE5, 0x89, 0x8D, 0x43, 0xE5, 0x89, 0xB2, 0x43, 0xE5, 0x89, 0xB7, 0x43, 0xE5, 0x8A, 0x89, 0x43, 0xE5, 0x8A, 0x9B, 0x43, 0xE5, 0x8A, 0xA3, 0x43, // Bytes 840 - 87f 0xE5, 0x8A, 0xB3, 0x43, 0xE5, 0x8A, 0xB4, 0x43, 0xE5, 0x8B, 0x87, 0x43, 0xE5, 0x8B, 0x89, 0x43, 0xE5, 0x8B, 0x92, 0x43, 0xE5, 0x8B, 0x9E, 0x43, 0xE5, 0x8B, 0xA4, 0x43, 0xE5, 0x8B, 0xB5, 0x43, 0xE5, 0x8B, 0xB9, 0x43, 0xE5, 0x8B, 0xBA, 0x43, 0xE5, 0x8C, 0x85, 0x43, 0xE5, 0x8C, 0x86, 0x43, 0xE5, 0x8C, 0x95, 0x43, 0xE5, 0x8C, 0x97, 0x43, 0xE5, 0x8C, 0x9A, 0x43, 0xE5, 0x8C, 0xB8, 0x43, // Bytes 880 - 8b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 0xE6, 0x88, 0x80, 0x43, 0xE6, 0x88, 0x88, 0x43, 0xE6, 0x88, 0x90, 0x43, // Bytes c00 - c3f 0xE6, 0x88, 0x9B, 0x43, 0xE6, 0x88, 0xAE, 0x43, 0xE6, 0x88, 0xB4, 0x43, 0xE6, 0x88, 0xB6, 0x43, 0xE6, 0x89, 0x8B, 0x43, 0xE6, 0x89, 0x93, 0x43, 0xE6, 0x89, 0x9D, 0x43, 0xE6, 0x8A, 0x95, 0x43, 0xE6, 0x8A, 0xB1, 0x43, 0xE6, 0x8B, 0x89, 0x43, 0xE6, 0x8B, 0x8F, 0x43, 0xE6, 0x8B, 0x93, 0x43, 0xE6, 0x8B, 0x94, 0x43, 0xE6, 0x8B, 0xBC, 0x43, 0xE6, 0x8B, 0xBE, 0x43, 0xE6, 0x8C, 0x87, 0x43, // Bytes c40 - c7f 0xE6, 0x8C, 0xBD, 0x43, 0xE6, 0x8D, 0x90, 0x43, 0xE6, 0x8D, 0x95, 0x43, 0xE6, 0x8D, 0xA8, 0x43, 0xE6, 0x8D, 0xBB, 0x43, 0xE6, 0x8E, 0x83, 0x43, 0xE6, 0x8E, 0xA0, 0x43, 0xE6, 0x8E, 0xA9, 0x43, 0xE6, 0x8F, 0x84, 0x43, 0xE6, 0x8F, 0x85, 0x43, 0xE6, 0x8F, 0xA4, 0x43, 0xE6, 0x90, 0x9C, 0x43, 0xE6, 0x90, 0xA2, 0x43, 0xE6, 0x91, 0x92, 0x43, 0xE6, 0x91, 0xA9, 0x43, 0xE6, 0x91, 0xB7, 0x43, // Bytes c80 - cbf 0xE6, 0x91, 0xBE, 0x43, 0xE6, 0x92, 0x9A, 0x43, 0xE6, 0x92, 0x9D, 0x43, 0xE6, 0x93, 0x84, 0x43, 0xE6, 0x94, 0xAF, 0x43, 0xE6, 0x94, 0xB4, 0x43, 0xE6, 0x95, 0x8F, 0x43, 0xE6, 0x95, 0x96, 0x43, 0xE6, 0x95, 0xAC, 0x43, 0xE6, 0x95, 0xB8,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0x85, 0x89, 0x43, 0xE7, 0x85, 0xAE, 0x43, // Bytes ec0 - eff 0xE7, 0x86, 0x9C, 0x43, 0xE7, 0x87, 0x8E, 0x43, 0xE7, 0x87, 0x90, 0x43, 0xE7, 0x88, 0x90, 0x43, 0xE7, 0x88, 0x9B, 0x43, 0xE7, 0x88, 0xA8, 0x43, 0xE7, 0x88, 0xAA, 0x43, 0xE7, 0x88, 0xAB, 0x43, 0xE7, 0x88, 0xB5, 0x43, 0xE7, 0x88, 0xB6, 0x43, 0xE7, 0x88, 0xBB, 0x43, 0xE7, 0x88, 0xBF, 0x43, 0xE7, 0x89, 0x87, 0x43, 0xE7, 0x89, 0x90, 0x43, 0xE7, 0x89, 0x99, 0x43, 0xE7, 0x89, 0x9B, 0x43, // Bytes f00 - f3f 0xE7, 0x89, 0xA2, 0x43, 0xE7, 0x89, 0xB9, 0x43, 0xE7, 0x8A, 0x80, 0x43, 0xE7, 0x8A, 0x95, 0x43, 0xE7, 0x8A, 0xAC, 0x43, 0xE7, 0x8A, 0xAF, 0x43, 0xE7, 0x8B, 0x80, 0x43, 0xE7, 0x8B, 0xBC, 0x43, 0xE7, 0x8C, 0xAA, 0x43, 0xE7, 0x8D, 0xB5, 0x43, 0xE7, 0x8D, 0xBA, 0x43, 0xE7, 0x8E, 0x84, 0x43, 0xE7, 0x8E, 0x87, 0x43, 0xE7, 0x8E, 0x89, 0x43, 0xE7, 0x8E, 0x8B, 0x43, 0xE7, 0x8E, 0xA5, 0x43, // Bytes f40 - f7f 0xE7, 0x8E, 0xB2, 0x43, 0xE7, 0x8F, 0x9E, 0x43, 0xE7, 0x90, 0x86, 0x43, 0xE7, 0x90, 0x89, 0x43, 0xE7, 0x90, 0xA2, 0x43, 0xE7, 0x91, 0x87, 0x43, 0xE7, 0x91, 0x9C, 0x43, 0xE7, 0x91, 0xA9, 0x43, 0xE7, 0x91, 0xB1, 0x43, 0xE7, 0x92, 0x85, 0x43, 0xE7, 0x92, 0x89, 0x43, 0xE7, 0x92, 0x98, 0x43, 0xE7, 0x93, 0x8A, 0x43, 0xE7, 0x93, 0x9C, 0x43, 0xE7, 0x93, 0xA6, 0x43, 0xE7, 0x94, 0x86, 0x43, // Bytes f80 - fbf 0xE7, 0x94, 0x98, 0x43, 0xE7, 0x94, 0x9F, 0x43, 0xE7, 0x94, 0xA4, 0x43, 0xE7, 0x94, 0xA8, 0x43, 0xE7, 0x94, 0xB0, 0x43, 0xE7, 0x94, 0xB2, 0x43, 0xE7, 0x94, 0xB3, 0x43, 0xE7, 0x94, 0xB7, 0x43, 0xE7, 0x94, 0xBB, 0x43, 0xE7, 0x94, 0xBE, 0x43, 0xE7, 0x95, 0x99, 0x43, 0xE7, 0x95, 0xA5, 0x43, 0xE7, 0x95, 0xB0, 0x43, 0xE7, 0x96, 0x8B, 0x43, 0xE7, 0x96, 0x92, 0x43, 0xE7, 0x97, 0xA2, 0x43, // Bytes fc0 - fff 0xE7, 0x98, 0x90, 0x43, 0xE7, 0x98, 0x9D, 0x43, 0xE7, 0x98, 0x9F, 0x43, 0xE7, 0x99, 0x82, 0x43, 0xE7, 0x99, 0xA9, 0x43, 0xE7, 0x99, 0xB6, 0x43, 0xE7, 0x99, 0xBD, 0x43, 0xE7, 0x9A, 0xAE, 0x43, 0xE7, 0x9A, 0xBF, 0x43, 0xE7, 0x9B, 0x8A, 0x43, 0xE7, 0x9B, 0x9B, 0x43, 0xE7, 0x9B, 0xA3, 0x43, 0xE7, 0x9B, 0xA7, 0x43, 0xE7, 0x9B, 0xAE, 0x43, 0xE7, 0x9B, 0xB4, 0x43, 0xE7, 0x9C, 0x81, 0x43, // Bytes 1000 - 103f 0xE7, 0x9C, 0x9E, 0x43, 0xE7, 0x9C, 0x9F, 0x43, 0xE7, 0x9D, 0x80, 0x43, 0xE7, 0x9D, 0x8A, 0x43, 0xE7, 0x9E, 0x8B, 0x43, 0xE7, 0x9E, 0xA7, 0x43, 0xE7, 0x9F, 0x9B, 0x43, 0xE7, 0x9F, 0xA2,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xE8, 0x80, 0x85, 0x43, // Bytes 1180 - 11bf 0xE8, 0x80, 0x8C, 0x43, 0xE8, 0x80, 0x92, 0x43, 0xE8, 0x80, 0xB3, 0x43, 0xE8, 0x81, 0x86, 0x43, 0xE8, 0x81, 0xA0, 0x43, 0xE8, 0x81, 0xAF, 0x43, 0xE8, 0x81, 0xB0, 0x43, 0xE8, 0x81, 0xBE, 0x43, 0xE8, 0x81, 0xBF, 0x43, 0xE8, 0x82, 0x89, 0x43, 0xE8, 0x82, 0x8B, 0x43, 0xE8, 0x82, 0xAD, 0x43, 0xE8, 0x82, 0xB2, 0x43, 0xE8, 0x84, 0x83, 0x43, 0xE8, 0x84, 0xBE, 0x43, 0xE8, 0x87, 0x98, 0x43, // Bytes 11c0 - 11ff 0xE8, 0x87, 0xA3, 0x43, 0xE8, 0x87, 0xA8, 0x43, 0xE8, 0x87, 0xAA, 0x43, 0xE8, 0x87, 0xAD, 0x43, 0xE8, 0x87, 0xB3, 0x43, 0xE8, 0x87, 0xBC, 0x43, 0xE8, 0x88, 0x81, 0x43, 0xE8, 0x88, 0x84, 0x43, 0xE8, 0x88, 0x8C, 0x43, 0xE8, 0x88, 0x98, 0x43, 0xE8, 0x88, 0x9B, 0x43, 0xE8, 0x88, 0x9F, 0x43, 0xE8, 0x89, 0xAE, 0x43, 0xE8, 0x89, 0xAF, 0x43, 0xE8, 0x89, 0xB2, 0x43, 0xE8, 0x89, 0xB8, 0x43, // Bytes 1200 - 123f 0xE8, 0x89, 0xB9, 0x43, 0xE8, 0x8A, 0x8B, 0x43, 0xE8, 0x8A, 0x91, 0x43, 0xE8, 0x8A, 0x9D, 0x43, 0xE8, 0x8A, 0xB1, 0x43, 0xE8, 0x8A, 0xB3, 0x43, 0xE8, 0x8A, 0xBD, 0x43, 0xE8, 0x8B, 0xA5, 0x43, 0xE8, 0x8B, 0xA6, 0x43, 0xE8, 0x8C, 0x9D, 0x43, 0xE8, 0x8C, 0xA3, 0x43, 0xE8, 0x8C, 0xB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0x43, 0xE8, 0xA0, 0x9F, 0x43, 0xE8, 0xA1, 0x80, 0x43, 0xE8, 0xA1, 0x8C, 0x43, 0xE8, 0xA1, 0xA0, 0x43, 0xE8, 0xA1, 0xA3, 0x43, 0xE8, 0xA3, 0x82, 0x43, 0xE8, 0xA3, 0x8F, 0x43, 0xE8, 0xA3, 0x97, 0x43, // Bytes 1300 - 133f 0xE8, 0xA3, 0x9E, 0x43, 0xE8, 0xA3, 0xA1, 0x43, 0xE8, 0xA3, 0xB8, 0x43, 0xE8, 0xA3, 0xBA, 0x43, 0xE8, 0xA4, 0x90, 0x43, 0xE8, 0xA5, 0x81, 0x43, 0xE8, 0xA5, 0xA4, 0x43, 0xE8, 0xA5, 0xBE, 0x43, 0xE8, 0xA6, 0x86, 0x43, 0xE8, 0xA6, 0x8B, 0x43,
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/normalize.go
vendor/golang.org/x/text/unicode/norm/normalize.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Note: the file data_test.go that is generated should not be checked in. //go:generate go run maketables.go triegen.go //go:generate go test -tags test // Package norm contains types and functions for normalizing Unicode strings. package norm // import "golang.org/x/text/unicode/norm" import ( "unicode/utf8" "golang.org/x/text/transform" ) // A Form denotes a canonical representation of Unicode code points. // The Unicode-defined normalization and equivalence forms are: // // NFC Unicode Normalization Form C // NFD Unicode Normalization Form D // NFKC Unicode Normalization Form KC // NFKD Unicode Normalization Form KD // // For a Form f, this documentation uses the notation f(x) to mean // the bytes or string x converted to the given form. // A position n in x is called a boundary if conversion to the form can // proceed independently on both sides: // // f(x) == append(f(x[0:n]), f(x[n:])...) // // References: https://unicode.org/reports/tr15/ and // https://unicode.org/notes/tn5/. type Form int const ( NFC Form = iota NFD NFKC NFKD ) // Bytes returns f(b). May return b if f(b) = b. func (f Form) Bytes(b []byte) []byte { src := inputBytes(b) ft := formTable[f] n, ok := ft.quickSpan(src, 0, len(b), true) if ok { return b } out := make([]byte, n, len(b)) copy(out, b[0:n]) rb := reorderBuffer{f: *ft, src: src, nsrc: len(b), out: out, flushF: appendFlush} return doAppendInner(&rb, n) } // String returns f(s). func (f Form) String(s string) string { src := inputString(s) ft := formTable[f] n, ok := ft.quickSpan(src, 0, len(s), true) if ok { return s } out := make([]byte, n, len(s)) copy(out, s[0:n]) rb := reorderBuffer{f: *ft, src: src, nsrc: len(s), out: out, flushF: appendFlush} return string(doAppendInner(&rb, n)) } // IsNormal returns true if b == f(b). func (f Form) IsNormal(b []byte) bool { src := inputBytes(b) ft := formTable[f] bp, ok := ft.quickSpan(src, 0, len(b), true) if ok { return true } rb := reorderBuffer{f: *ft, src: src, nsrc: len(b)} rb.setFlusher(nil, cmpNormalBytes) for bp < len(b) { rb.out = b[bp:] if bp = decomposeSegment(&rb, bp, true); bp < 0 { return false } bp, _ = rb.f.quickSpan(rb.src, bp, len(b), true) } return true } func cmpNormalBytes(rb *reorderBuffer) bool { b := rb.out for i := 0; i < rb.nrune; i++ { info := rb.rune[i] if int(info.size) > len(b) { return false } p := info.pos pe := p + info.size for ; p < pe; p++ { if b[0] != rb.byte[p] { return false } b = b[1:] } } return true } // IsNormalString returns true if s == f(s). func (f Form) IsNormalString(s string) bool { src := inputString(s) ft := formTable[f] bp, ok := ft.quickSpan(src, 0, len(s), true) if ok { return true } rb := reorderBuffer{f: *ft, src: src, nsrc: len(s)} rb.setFlusher(nil, func(rb *reorderBuffer) bool { for i := 0; i < rb.nrune; i++ { info := rb.rune[i] if bp+int(info.size) > len(s) { return false } p := info.pos pe := p + info.size for ; p < pe; p++ { if s[bp] != rb.byte[p] { return false } bp++ } } return true }) for bp < len(s) { if bp = decomposeSegment(&rb, bp, true); bp < 0 { return false } bp, _ = rb.f.quickSpan(rb.src, bp, len(s), true) } return true } // patchTail fixes a case where a rune may be incorrectly normalized // if it is followed by illegal continuation bytes. It returns the // patched buffer and whether the decomposition is still in progress. func patchTail(rb *reorderBuffer) bool { info, p := lastRuneStart(&rb.f, rb.out) if p == -1 || info.size == 0 { return true } end := p + int(info.size) extra := len(rb.out) - end if extra > 0 { // Potentially allocating memory. However, this only // happens with ill-formed UTF-8. x := make([]byte, 0) x = append(x, rb.out[len(rb.out)-extra:]...) rb.out = rb.out[:end] decomposeToLastBoundary(rb) rb.doFlush() rb.out = append(rb.out, x...) return false } buf := rb.out[p:] rb.out = rb.out[:p] decomposeToLastBoundary(rb) if s := rb.ss.next(info); s == ssStarter { rb.doFlush() rb.ss.first(info) } else if s == ssOverflow { rb.doFlush() rb.insertCGJ() rb.ss = 0 } rb.insertUnsafe(inputBytes(buf), 0, info) return true } func appendQuick(rb *reorderBuffer, i int) int { if rb.nsrc == i { return i } end, _ := rb.f.quickSpan(rb.src, i, rb.nsrc, true) rb.out = rb.src.appendSlice(rb.out, i, end) return end } // Append returns f(append(out, b...)). // The buffer out must be nil, empty, or equal to f(out). func (f Form) Append(out []byte, src ...byte) []byte { return f.doAppend(out, inputBytes(src), len(src)) } func (f Form) doAppend(out []byte, src input, n int) []byte { if n == 0 { return out } ft := formTable[f] // Attempt to do a quickSpan first so we can avoid initializing the reorderBuffer. if len(out) == 0 { p, _ := ft.quickSpan(src, 0, n, true) out = src.appendSlice(out, 0, p) if p == n { return out } rb := reorderBuffer{f: *ft, src: src, nsrc: n, out: out, flushF: appendFlush} return doAppendInner(&rb, p) } rb := reorderBuffer{f: *ft, src: src, nsrc: n} return doAppend(&rb, out, 0) } func doAppend(rb *reorderBuffer, out []byte, p int) []byte { rb.setFlusher(out, appendFlush) src, n := rb.src, rb.nsrc doMerge := len(out) > 0 if q := src.skipContinuationBytes(p); q > p { // Move leading non-starters to destination. rb.out = src.appendSlice(rb.out, p, q) p = q doMerge = patchTail(rb) } fd := &rb.f if doMerge { var info Properties if p < n { info = fd.info(src, p) if !info.BoundaryBefore() || info.nLeadingNonStarters() > 0 { if p == 0 { decomposeToLastBoundary(rb) } p = decomposeSegment(rb, p, true) } } if info.size == 0 { rb.doFlush() // Append incomplete UTF-8 encoding. return src.appendSlice(rb.out, p, n) } if rb.nrune > 0 { return doAppendInner(rb, p) } } p = appendQuick(rb, p) return doAppendInner(rb, p) } func doAppendInner(rb *reorderBuffer, p int) []byte { for n := rb.nsrc; p < n; { p = decomposeSegment(rb, p, true) p = appendQuick(rb, p) } return rb.out } // AppendString returns f(append(out, []byte(s))). // The buffer out must be nil, empty, or equal to f(out). func (f Form) AppendString(out []byte, src string) []byte { return f.doAppend(out, inputString(src), len(src)) } // QuickSpan returns a boundary n such that b[0:n] == f(b[0:n]). // It is not guaranteed to return the largest such n. func (f Form) QuickSpan(b []byte) int { n, _ := formTable[f].quickSpan(inputBytes(b), 0, len(b), true) return n } // Span implements transform.SpanningTransformer. It returns a boundary n such // that b[0:n] == f(b[0:n]). It is not guaranteed to return the largest such n. func (f Form) Span(b []byte, atEOF bool) (n int, err error) { n, ok := formTable[f].quickSpan(inputBytes(b), 0, len(b), atEOF) if n < len(b) { if !ok { err = transform.ErrEndOfSpan } else { err = transform.ErrShortSrc } } return n, err } // SpanString returns a boundary n such that s[0:n] == f(s[0:n]). // It is not guaranteed to return the largest such n. func (f Form) SpanString(s string, atEOF bool) (n int, err error) { n, ok := formTable[f].quickSpan(inputString(s), 0, len(s), atEOF) if n < len(s) { if !ok { err = transform.ErrEndOfSpan } else { err = transform.ErrShortSrc } } return n, err } // quickSpan returns a boundary n such that src[0:n] == f(src[0:n]) and // whether any non-normalized parts were found. If atEOF is false, n will // not point past the last segment if this segment might be become // non-normalized by appending other runes. func (f *formInfo) quickSpan(src input, i, end int, atEOF bool) (n int, ok bool) { var lastCC uint8 ss := streamSafe(0) lastSegStart := i for n = end; i < n; { if j := src.skipASCII(i, n); i != j { i = j lastSegStart = i - 1 lastCC = 0 ss = 0 continue } info := f.info(src, i) if info.size == 0 { if atEOF { // include incomplete runes return n, true } return lastSegStart, true } // This block needs to be before the next, because it is possible to // have an overflow for runes that are starters (e.g. with U+FF9E). switch ss.next(info) { case ssStarter: lastSegStart = i case ssOverflow: return lastSegStart, false case ssSuccess: if lastCC > info.ccc { return lastSegStart, false } } if f.composing { if !info.isYesC() { break } } else { if !info.isYesD() { break } } lastCC = info.ccc i += int(info.size) } if i == n { if !atEOF { n = lastSegStart } return n, true } return lastSegStart, false } // QuickSpanString returns a boundary n such that s[0:n] == f(s[0:n]). // It is not guaranteed to return the largest such n. func (f Form) QuickSpanString(s string) int { n, _ := formTable[f].quickSpan(inputString(s), 0, len(s), true) return n } // FirstBoundary returns the position i of the first boundary in b // or -1 if b contains no boundary. func (f Form) FirstBoundary(b []byte) int { return f.firstBoundary(inputBytes(b), len(b)) } func (f Form) firstBoundary(src input, nsrc int) int { i := src.skipContinuationBytes(0) if i >= nsrc { return -1 } fd := formTable[f] ss := streamSafe(0) // We should call ss.first here, but we can't as the first rune is // skipped already. This means FirstBoundary can't really determine // CGJ insertion points correctly. Luckily it doesn't have to. for { info := fd.info(src, i) if info.size == 0 { return -1 } if s := ss.next(info); s != ssSuccess { return i } i += int(info.size) if i >= nsrc { if !info.BoundaryAfter() && !ss.isMax() { return -1 } return nsrc } } } // FirstBoundaryInString returns the position i of the first boundary in s // or -1 if s contains no boundary. func (f Form) FirstBoundaryInString(s string) int { return f.firstBoundary(inputString(s), len(s)) } // NextBoundary reports the index of the boundary between the first and next // segment in b or -1 if atEOF is false and there are not enough bytes to // determine this boundary. func (f Form) NextBoundary(b []byte, atEOF bool) int { return f.nextBoundary(inputBytes(b), len(b), atEOF) } // NextBoundaryInString reports the index of the boundary between the first and // next segment in b or -1 if atEOF is false and there are not enough bytes to // determine this boundary. func (f Form) NextBoundaryInString(s string, atEOF bool) int { return f.nextBoundary(inputString(s), len(s), atEOF) } func (f Form) nextBoundary(src input, nsrc int, atEOF bool) int { if nsrc == 0 { if atEOF { return 0 } return -1 } fd := formTable[f] info := fd.info(src, 0) if info.size == 0 { if atEOF { return 1 } return -1 } ss := streamSafe(0) ss.first(info) for i := int(info.size); i < nsrc; i += int(info.size) { info = fd.info(src, i) if info.size == 0 { if atEOF { return i } return -1 } // TODO: Using streamSafe to determine the boundary isn't the same as // using BoundaryBefore. Determine which should be used. if s := ss.next(info); s != ssSuccess { return i } } if !atEOF && !info.BoundaryAfter() && !ss.isMax() { return -1 } return nsrc } // LastBoundary returns the position i of the last boundary in b // or -1 if b contains no boundary. func (f Form) LastBoundary(b []byte) int { return lastBoundary(formTable[f], b) } func lastBoundary(fd *formInfo, b []byte) int { i := len(b) info, p := lastRuneStart(fd, b) if p == -1 { return -1 } if info.size == 0 { // ends with incomplete rune if p == 0 { // starts with incomplete rune return -1 } i = p info, p = lastRuneStart(fd, b[:i]) if p == -1 { // incomplete UTF-8 encoding or non-starter bytes without a starter return i } } if p+int(info.size) != i { // trailing non-starter bytes: illegal UTF-8 return i } if info.BoundaryAfter() { return i } ss := streamSafe(0) v := ss.backwards(info) for i = p; i >= 0 && v != ssStarter; i = p { info, p = lastRuneStart(fd, b[:i]) if v = ss.backwards(info); v == ssOverflow { break } if p+int(info.size) != i { if p == -1 { // no boundary found return -1 } return i // boundary after an illegal UTF-8 encoding } } return i } // decomposeSegment scans the first segment in src into rb. It inserts 0x034f // (Grapheme Joiner) when it encounters a sequence of more than 30 non-starters // and returns the number of bytes consumed from src or iShortDst or iShortSrc. func decomposeSegment(rb *reorderBuffer, sp int, atEOF bool) int { // Force one character to be consumed. info := rb.f.info(rb.src, sp) if info.size == 0 { return 0 } if s := rb.ss.next(info); s == ssStarter { // TODO: this could be removed if we don't support merging. if rb.nrune > 0 { goto end } } else if s == ssOverflow { rb.insertCGJ() goto end } if err := rb.insertFlush(rb.src, sp, info); err != iSuccess { return int(err) } for { sp += int(info.size) if sp >= rb.nsrc { if !atEOF && !info.BoundaryAfter() { return int(iShortSrc) } break } info = rb.f.info(rb.src, sp) if info.size == 0 { if !atEOF { return int(iShortSrc) } break } if s := rb.ss.next(info); s == ssStarter { break } else if s == ssOverflow { rb.insertCGJ() break } if err := rb.insertFlush(rb.src, sp, info); err != iSuccess { return int(err) } } end: if !rb.doFlush() { return int(iShortDst) } return sp } // lastRuneStart returns the runeInfo and position of the last // rune in buf or the zero runeInfo and -1 if no rune was found. func lastRuneStart(fd *formInfo, buf []byte) (Properties, int) { p := len(buf) - 1 for ; p >= 0 && !utf8.RuneStart(buf[p]); p-- { } if p < 0 { return Properties{}, -1 } return fd.info(inputBytes(buf), p), p } // decomposeToLastBoundary finds an open segment at the end of the buffer // and scans it into rb. Returns the buffer minus the last segment. func decomposeToLastBoundary(rb *reorderBuffer) { fd := &rb.f info, i := lastRuneStart(fd, rb.out) if int(info.size) != len(rb.out)-i { // illegal trailing continuation bytes return } if info.BoundaryAfter() { return } var add [maxNonStarters + 1]Properties // stores runeInfo in reverse order padd := 0 ss := streamSafe(0) p := len(rb.out) for { add[padd] = info v := ss.backwards(info) if v == ssOverflow { // Note that if we have an overflow, it the string we are appending to // is not correctly normalized. In this case the behavior is undefined. break } padd++ p -= int(info.size) if v == ssStarter || p < 0 { break } info, i = lastRuneStart(fd, rb.out[:p]) if int(info.size) != p-i { break } } rb.ss = ss // Copy bytes for insertion as we may need to overwrite rb.out. var buf [maxBufferSize * utf8.UTFMax]byte cp := buf[:copy(buf[:], rb.out[p:])] rb.out = rb.out[:p] for padd--; padd >= 0; padd-- { info = add[padd] rb.insertUnsafe(inputBytes(cp), 0, info) cp = cp[info.size:] } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go
vendor/golang.org/x/text/unicode/norm/tables12.0.0.go
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.14 && !go1.16 package norm import "sync" const ( // Version is the Unicode edition from which the tables are derived. Version = "12.0.0" // MaxTransformChunkSize indicates the maximum number of bytes that Transform // may need to write atomically for any Form. Making a destination buffer at // least this size ensures that Transform can always make progress and that // the user does not need to grow the buffer on an ErrShortDst. MaxTransformChunkSize = 35 + maxNonStarters*4 ) var ccc = [55]uint8{ 0, 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 84, 91, 103, 107, 118, 122, 129, 130, 132, 202, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 233, 234, 240, } const ( firstMulti = 0x186D firstCCC = 0x2CA1 endMulti = 0x2F63 firstLeadingCCC = 0x49B1 firstCCCZeroExcept = 0x4A7B firstStarterWithNLead = 0x4AA2 lastDecomp = 0x4AA4 maxDecomp = 0x8000 ) // decomps: 19108 bytes var decomps = [...]byte{ // Bytes 0 - 3f 0x00, 0x41, 0x20, 0x41, 0x21, 0x41, 0x22, 0x41, 0x23, 0x41, 0x24, 0x41, 0x25, 0x41, 0x26, 0x41, 0x27, 0x41, 0x28, 0x41, 0x29, 0x41, 0x2A, 0x41, 0x2B, 0x41, 0x2C, 0x41, 0x2D, 0x41, 0x2E, 0x41, 0x2F, 0x41, 0x30, 0x41, 0x31, 0x41, 0x32, 0x41, 0x33, 0x41, 0x34, 0x41, 0x35, 0x41, 0x36, 0x41, 0x37, 0x41, 0x38, 0x41, 0x39, 0x41, 0x3A, 0x41, 0x3B, 0x41, 0x3C, 0x41, 0x3D, 0x41, 0x3E, 0x41, // Bytes 40 - 7f 0x3F, 0x41, 0x40, 0x41, 0x41, 0x41, 0x42, 0x41, 0x43, 0x41, 0x44, 0x41, 0x45, 0x41, 0x46, 0x41, 0x47, 0x41, 0x48, 0x41, 0x49, 0x41, 0x4A, 0x41, 0x4B, 0x41, 0x4C, 0x41, 0x4D, 0x41, 0x4E, 0x41, 0x4F, 0x41, 0x50, 0x41, 0x51, 0x41, 0x52, 0x41, 0x53, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, 0x57, 0x41, 0x58, 0x41, 0x59, 0x41, 0x5A, 0x41, 0x5B, 0x41, 0x5C, 0x41, 0x5D, 0x41, 0x5E, 0x41, // Bytes 80 - bf 0x5F, 0x41, 0x60, 0x41, 0x61, 0x41, 0x62, 0x41, 0x63, 0x41, 0x64, 0x41, 0x65, 0x41, 0x66, 0x41, 0x67, 0x41, 0x68, 0x41, 0x69, 0x41, 0x6A, 0x41, 0x6B, 0x41, 0x6C, 0x41, 0x6D, 0x41, 0x6E, 0x41, 0x6F, 0x41, 0x70, 0x41, 0x71, 0x41, 0x72, 0x41, 0x73, 0x41, 0x74, 0x41, 0x75, 0x41, 0x76, 0x41, 0x77, 0x41, 0x78, 0x41, 0x79, 0x41, 0x7A, 0x41, 0x7B, 0x41, 0x7C, 0x41, 0x7D, 0x41, 0x7E, 0x42, // Bytes c0 - ff 0xC2, 0xA2, 0x42, 0xC2, 0xA3, 0x42, 0xC2, 0xA5, 0x42, 0xC2, 0xA6, 0x42, 0xC2, 0xAC, 0x42, 0xC2, 0xB7, 0x42, 0xC3, 0x86, 0x42, 0xC3, 0xB0, 0x42, 0xC4, 0xA6, 0x42, 0xC4, 0xA7, 0x42, 0xC4, 0xB1, 0x42, 0xC5, 0x8B, 0x42, 0xC5, 0x93, 0x42, 0xC6, 0x8E, 0x42, 0xC6, 0x90, 0x42, 0xC6, 0xAB, 0x42, 0xC8, 0xA2, 0x42, 0xC8, 0xB7, 0x42, 0xC9, 0x90, 0x42, 0xC9, 0x91, 0x42, 0xC9, 0x92, 0x42, 0xC9, // Bytes 100 - 13f 0x94, 0x42, 0xC9, 0x95, 0x42, 0xC9, 0x99, 0x42, 0xC9, 0x9B, 0x42, 0xC9, 0x9C, 0x42, 0xC9, 0x9F, 0x42, 0xC9, 0xA1, 0x42, 0xC9, 0xA3, 0x42, 0xC9, 0xA5, 0x42, 0xC9, 0xA6, 0x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 280 - 2bf 0x84, 0x42, 0xD9, 0x85, 0x42, 0xD9, 0x86, 0x42, 0xD9, 0x87, 0x42, 0xD9, 0x88, 0x42, 0xD9, 0x89, 0x42, 0xD9, 0x8A, 0x42, 0xD9, 0xAE, 0x42, 0xD9, 0xAF, 0x42, 0xD9, 0xB1, 0x42, 0xD9, 0xB9, 0x42, 0xD9, 0xBA, 0x42, 0xD9, 0xBB, 0x42, 0xD9, 0xBE, 0x42, 0xD9, 0xBF, 0x42, 0xDA, 0x80, 0x42, 0xDA, 0x83, 0x42, 0xDA, 0x84, 0x42, 0xDA, 0x86, 0x42, 0xDA, 0x87, 0x42, 0xDA, 0x88, 0x42, 0xDA, 0x8C, // Bytes 2c0 - 2ff 0x42, 0xDA, 0x8D, 0x42, 0xDA, 0x8E, 0x42, 0xDA, 0x91, 0x42, 0xDA, 0x98, 0x42, 0xDA, 0xA1, 0x42, 0xDA, 0xA4, 0x42, 0xDA, 0xA6, 0x42, 0xDA, 0xA9, 0x42, 0xDA, 0xAD, 0x42, 0xDA, 0xAF, 0x42, 0xDA, 0xB1, 0x42, 0xDA, 0xB3, 0x42, 0xDA, 0xBA, 0x42, 0xDA, 0xBB, 0x42, 0xDA, 0xBE, 0x42, 0xDB, 0x81, 0x42, 0xDB, 0x85, 0x42, 0xDB, 0x86, 0x42, 0xDB, 0x87, 0x42, 0xDB, 0x88, 0x42, 0xDB, 0x89, 0x42, // Bytes 300 - 33f 0xDB, 0x8B, 0x42, 0xDB, 0x8C, 0x42, 0xDB, 0x90, 0x42, 0xDB, 0x92, 0x43, 0xE0, 0xBC, 0x8B, 0x43, 0xE1, 0x83, 0x9C, 0x43, 0xE1, 0x84, 0x80, 0x43, 0xE1, 0x84, 0x81, 0x43, 0xE1, 0x84, 0x82, 0x43, 0xE1, 0x84, 0x83, 0x43, 0xE1, 0x84, 0x84, 0x43, 0xE1, 0x84, 0x85, 0x43, 0xE1, 0x84, 0x86, 0x43, 0xE1, 0x84, 0x87, 0x43, 0xE1, 0x84, 0x88, 0x43, 0xE1, 0x84, 0x89, 0x43, 0xE1, 0x84, 0x8A, 0x43, // Bytes 340 - 37f 0xE1, 0x84, 0x8B, 0x43, 0xE1, 0x84, 0x8C, 0x43, 0xE1, 0x84, 0x8D, 0x43, 0xE1, 0x84, 0x8E, 0x43, 0xE1, 0x84, 0x8F, 0x43, 0xE1, 0x84, 0x90, 0x43, 0xE1, 0x84, 0x91, 0x43, 0xE1, 0x84, 0x92, 0x43, 0xE1, 0x84, 0x94, 0x43, 0xE1, 0x84, 0x95, 0x43, 0xE1, 0x84, 0x9A, 0x43, 0xE1, 0x84, 0x9C, 0x43, 0xE1, 0x84, 0x9D, 0x43, 0xE1, 0x84, 0x9E, 0x43, 0xE1, 0x84, 0xA0, 0x43, 0xE1, 0x84, 0xA1, 0x43, // Bytes 380 - 3bf 0xE1, 0x84, 0xA2, 0x43, 0xE1, 0x84, 0xA3, 0x43, 0xE1, 0x84, 0xA7, 0x43, 0xE1, 0x84, 0xA9, 0x43, 0xE1, 0x84, 0xAB, 0x43, 0xE1, 0x84, 0xAC, 0x43, 0xE1, 0x84, 0xAD, 0x43, 0xE1, 0x84, 0xAE, 0x43, 0xE1, 0x84, 0xAF, 0x43, 0xE1, 0x84, 0xB2, 0x43, 0xE1, 0x84, 0xB6, 0x43, 0xE1, 0x85, 0x80, 0x43, 0xE1, 0x85, 0x87, 0x43, 0xE1, 0x85, 0x8C, 0x43, 0xE1, 0x85, 0x97, 0x43, 0xE1, 0x85, 0x98, 0x43, // Bytes 3c0 - 3ff 0xE1, 0x85, 0x99, 0x43, 0xE1, 0x85, 0xA0, 0x43, 0xE1, 0x86, 0x84, 0x43, 0xE1, 0x86, 0x85, 0x43, 0xE1, 0x86, 0x88, 0x43, 0xE1, 0x86, 0x91, 0x43, 0xE1, 0x86, 0x92, 0x43, 0xE1, 0x86, 0x94, 0x43, 0xE1, 0x86, 0x9E, 0x43, 0xE1, 0x86, 0xA1, 0x43, 0xE1, 0x87, 0x87, 0x43, 0xE1, 0x87, 0x88, 0x43, 0xE1, 0x87, 0x8C, 0x43, 0xE1, 0x87, 0x8E, 0x43, 0xE1, 0x87, 0x93, 0x43, 0xE1, 0x87, 0x97, 0x43, // Bytes 400 - 43f 0xE1, 0x87, 0x99, 0x43, 0xE1, 0x87, 0x9D, 0x43, 0xE1, 0x87, 0x9F, 0x43, 0xE1, 0x87, 0xB1, 0x43, 0xE1, 0x87, 0xB2, 0x43, 0xE1, 0xB4, 0x82, 0x43, 0xE1, 0xB4, 0x96, 0x43, 0xE1, 0xB4, 0x97, 0x43, 0xE1, 0xB4, 0x9C, 0x43, 0xE1, 0xB4, 0x9D, 0x43, 0xE1, 0xB4, 0xA5, 0x43, 0xE1, 0xB5, 0xBB, 0x43, 0xE1, 0xB6, 0x85, 0x43, 0xE2, 0x80, 0x82, 0x43, 0xE2, 0x80, 0x83, 0x43, 0xE2, 0x80, 0x90, 0x43, // Bytes 440 - 47f 0xE2, 0x80, 0x93, 0x43, 0xE2, 0x80, 0x94, 0x43, 0xE2, 0x82, 0xA9, 0x43, 0xE2, 0x86, 0x90, 0x43, 0xE2, 0x86, 0x91, 0x43, 0xE2, 0x86, 0x92, 0x43, 0xE2, 0x86, 0x93, 0x43, 0xE2, 0x88, 0x82, 0x43, 0xE2, 0x88, 0x87, 0x43, 0xE2, 0x88, 0x91, 0x43, 0xE2, 0x88, 0x92, 0x43, 0xE2, 0x94, 0x82, 0x43, 0xE2, 0x96, 0xA0, 0x43, 0xE2, 0x97, 0x8B, 0x43, 0xE2, 0xA6, 0x85, 0x43, 0xE2, 0xA6, 0x86, 0x43, // Bytes 480 - 4bf 0xE2, 0xB5, 0xA1, 0x43, 0xE3, 0x80, 0x81, 0x43, 0xE3, 0x80, 0x82, 0x43, 0xE3, 0x80, 0x88, 0x43, 0xE3, 0x80, 0x89, 0x43, 0xE3, 0x80, 0x8A, 0x43, 0xE3, 0x80, 0x8B, 0x43, 0xE3, 0x80, 0x8C, 0x43, 0xE3, 0x80, 0x8D, 0x43, 0xE3, 0x80, 0x8E, 0x43, 0xE3, 0x80, 0x8F, 0x43, 0xE3, 0x80, 0x90, 0x43, 0xE3, 0x80, 0x91, 0x43, 0xE3, 0x80, 0x92, 0x43, 0xE3, 0x80, 0x94, 0x43, 0xE3, 0x80, 0x95, 0x43, // Bytes 4c0 - 4ff 0xE3, 0x80, 0x96, 0x43, 0xE3, 0x80, 0x97, 0x43, 0xE3, 0x82, 0xA1, 0x43, 0xE3, 0x82, 0xA2, 0x43, 0xE3, 0x82, 0xA3, 0x43, 0xE3, 0x82, 0xA4, 0x43, 0xE3, 0x82, 0xA5, 0x43, 0xE3, 0x82, 0xA6, 0x43, 0xE3, 0x82, 0xA7, 0x43, 0xE3, 0x82, 0xA8, 0x43, 0xE3, 0x82, 0xA9, 0x43, 0xE3, 0x82, 0xAA, 0x43, 0xE3, 0x82, 0xAB, 0x43, 0xE3, 0x82, 0xAD, 0x43, 0xE3, 0x82, 0xAF, 0x43, 0xE3, 0x82, 0xB1, 0x43, // Bytes 500 - 53f 0xE3, 0x82, 0xB3, 0x43, 0xE3, 0x82, 0xB5, 0x43, 0xE3, 0x82, 0xB7, 0x43, 0xE3, 0x82, 0xB9, 0x43, 0xE3, 0x82, 0xBB, 0x43, 0xE3, 0x82, 0xBD, 0x43, 0xE3, 0x82, 0xBF, 0x43, 0xE3, 0x83, 0x81, 0x43, 0xE3, 0x83, 0x83, 0x43, 0xE3, 0x83, 0x84, 0x43, 0xE3, 0x83, 0x86, 0x43, 0xE3, 0x83, 0x88, 0x43, 0xE3, 0x83, 0x8A, 0x43, 0xE3, 0x83, 0x8B, 0x43, 0xE3, 0x83, 0x8C, 0x43, 0xE3, 0x83, 0x8D, 0x43, // Bytes 540 - 57f 0xE3, 0x83, 0x8E, 0x43, 0xE3, 0x83, 0x8F, 0x43, 0xE3, 0x83, 0x92, 0x43, 0xE3, 0x83, 0x95, 0x43, 0xE3, 0x83, 0x98, 0x43, 0xE3, 0x83, 0x9B, 0x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B, 0x43, 0xE5, 0x81, 0xBA, 0x43, 0xE5, 0x82, 0x99, 0x43, 0xE5, 0x83, 0x8F, 0x43, 0xE5, 0x83, 0x9A, 0x43, 0xE5, 0x83, 0xA7, 0x43, // Bytes 780 - 7bf 0xE5, 0x84, 0xAA, 0x43, 0xE5, 0x84, 0xBF, 0x43, 0xE5, 0x85, 0x80, 0x43, 0xE5, 0x85, 0x85, 0x43, 0xE5, 0x85, 0x8D, 0x43, 0xE5, 0x85, 0x94, 0x43, 0xE5, 0x85, 0xA4, 0x43, 0xE5, 0x85, 0xA5, 0x43, 0xE5, 0x85, 0xA7, 0x43, 0xE5, 0x85, 0xA8, 0x43, 0xE5, 0x85, 0xA9, 0x43, 0xE5, 0x85, 0xAB, 0x43, 0xE5, 0x85, 0xAD, 0x43, 0xE5, 0x85, 0xB7, 0x43, 0xE5, 0x86, 0x80, 0x43, 0xE5, 0x86, 0x82, 0x43, // Bytes 7c0 - 7ff 0xE5, 0x86, 0x8D, 0x43, 0xE5, 0x86, 0x92, 0x43, 0xE5, 0x86, 0x95, 0x43, 0xE5, 0x86, 0x96, 0x43, 0xE5, 0x86, 0x97, 0x43, 0xE5, 0x86, 0x99, 0x43, 0xE5, 0x86, 0xA4, 0x43, 0xE5, 0x86, 0xAB, 0x43, 0xE5, 0x86, 0xAC, 0x43, 0xE5, 0x86, 0xB5, 0x43, 0xE5, 0x86, 0xB7, 0x43, 0xE5, 0x87, 0x89, 0x43, 0xE5, 0x87, 0x8C, 0x43, 0xE5, 0x87, 0x9C, 0x43, 0xE5, 0x87, 0x9E, 0x43, 0xE5, 0x87, 0xA0, 0x43, // Bytes 800 - 83f 0xE5, 0x87, 0xB5, 0x43, 0xE5, 0x88, 0x80, 0x43, 0xE5, 0x88, 0x83, 0x43, 0xE5, 0x88, 0x87, 0x43, 0xE5, 0x88, 0x97, 0x43, 0xE5, 0x88, 0x9D, 0x43, 0xE5, 0x88, 0xA9, 0x43, 0xE5, 0x88, 0xBA, 0x43, 0x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43, 0xE5, 0x8F, 0x8A, 0x43, 0xE5, 0x8F, 0x8C, 0x43, 0xE5, 0x8F, 0x9F, 0x43, 0xE5, 0x8F, 0xA3, 0x43, 0xE5, 0x8F, 0xA5, 0x43, 0xE5, 0x8F, 0xAB, 0x43, 0xE5, 0x8F, 0xAF, 0x43, 0xE5, 0x8F, 0xB1, 0x43, 0xE5, 0x8F, 0xB3, 0x43, 0xE5, 0x90, 0x86, 0x43, 0xE5, 0x90, 0x88, 0x43, 0xE5, 0x90, 0x8D, 0x43, // Bytes 900 - 93f 0xE5, 0x90, 0x8F, 0x43, 0xE5, 0x90, 0x9D, 0x43, 0xE5, 0x90, 0xB8, 0x43, 0xE5, 0x90, 0xB9, 0x43, 0xE5, 0x91, 0x82, 0x43, 0xE5, 0x91, 0x88, 0x43, 0xE5, 0x91, 0xA8, 0x43, 0xE5, 0x92, 0x9E, 0x43, 0xE5, 0x92, 0xA2, 0x43, 0xE5, 0x92, 0xBD, 0x43, 0xE5, 0x93, 0xB6, 0x43, 0xE5, 0x94, 0x90, 0x43, 0xE5, 0x95, 0x8F, 0x43, 0xE5, 0x95, 0x93, 0x43, 0xE5, 0x95, 0x95, 0x43, 0xE5, 0x95, 0xA3, 0x43, // Bytes 940 - 97f 0xE5, 0x96, 0x84, 0x43, 0xE5, 0x96, 0x87, 0x43, 0xE5, 0x96, 0x99, 0x43, 0xE5, 0x96, 0x9D, 0x43, 0xE5, 0x96, 0xAB, 0x43, 0xE5, 0x96, 0xB3, 0x43, 0xE5, 0x96, 0xB6, 0x43, 0xE5, 0x97, 0x80, 0x43, 0xE5, 0x97, 0x82, 0x43, 0xE5, 0x97, 0xA2, 0x43, 0xE5, 0x98, 0x86, 0x43, 0xE5, 0x99, 0x91, 0x43, 0xE5, 0x99, 0xA8, 0x43, 0xE5, 0x99, 0xB4, 0x43, 0xE5, 0x9B, 0x97, 0x43, 0xE5, 0x9B, 0x9B, 0x43, // Bytes 980 - 9bf 0xE5, 0x9B, 0xB9, 0x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 0x43, 0xE5, 0xBF, 0xB9, 0x43, 0xE6, 0x80, 0x92, 0x43, 0xE6, 0x80, 0x9C, 0x43, 0xE6, 0x81, 0xB5, 0x43, 0xE6, 0x82, 0x81, 0x43, 0xE6, 0x82, 0x94, 0x43, 0xE6, 0x83, 0x87, 0x43, 0xE6, 0x83, 0x98, 0x43, 0xE6, 0x83, 0xA1, 0x43, 0xE6, 0x84, 0x88, 0x43, 0xE6, 0x85, 0x84, 0x43, 0xE6, 0x85, 0x88, 0x43, // Bytes bc0 - bff 0xE6, 0x85, 0x8C, 0x43, 0xE6, 0x85, 0x8E, 0x43, 0xE6, 0x85, 0xA0, 0x43, 0xE6, 0x85, 0xA8, 0x43, 0xE6, 0x85, 0xBA, 0x43, 0xE6, 0x86, 0x8E, 0x43, 0xE6, 0x86, 0x90, 0x43, 0xE6, 0x86, 0xA4, 0x43, 0xE6, 0x86, 0xAF, 0x43, 0xE6, 0x86, 0xB2, 0x43, 0xE6, 0x87, 0x9E, 0x43, 0xE6, 0x87, 0xB2, 0x43, 0xE6, 0x87, 0xB6, 0x43, 0xE6, 0x88, 0x80, 0x43, 0xE6, 0x88, 0x88, 0x43, 0xE6, 0x88, 0x90, 0x43, // Bytes c00 - c3f 0xE6, 0x88, 0x9B, 0x43, 0xE6, 0x88, 0xAE, 0x43, 0xE6, 0x88, 0xB4, 0x43, 0xE6, 0x88, 0xB6, 0x43, 0xE6, 0x89, 0x8B, 0x43, 0xE6, 0x89, 0x93, 0x43, 0xE6, 0x89, 0x9D, 0x43, 0xE6, 0x8A, 0x95, 0x43, 0xE6, 0x8A, 0xB1, 0x43, 0xE6, 0x8B, 0x89, 0x43, 0xE6, 0x8B, 0x8F, 0x43, 0xE6, 0x8B, 0x93, 0x43, 0xE6, 0x8B, 0x94, 0x43, 0xE6, 0x8B, 0xBC, 0x43, 0xE6, 0x8B, 0xBE, 0x43, 0xE6, 0x8C, 0x87, 0x43, // Bytes c40 - c7f 0xE6, 0x8C, 0xBD, 0x43, 0xE6, 0x8D, 0x90, 0x43, 0xE6, 0x8D, 0x95, 0x43, 0xE6, 0x8D, 0xA8, 0x43, 0xE6, 0x8D, 0xBB, 0x43, 0xE6, 0x8E, 0x83, 0x43, 0xE6, 0x8E, 0xA0, 0x43, 0xE6, 0x8E, 0xA9, 0x43, 0xE6, 0x8F, 0x84, 0x43, 0xE6, 0x8F, 0x85, 0x43, 0xE6, 0x8F, 0xA4, 0x43, 0xE6, 0x90, 0x9C, 0x43, 0xE6, 0x90, 0xA2, 0x43, 0xE6, 0x91, 0x92, 0x43, 0xE6, 0x91, 0xA9, 0x43, 0xE6, 0x91, 0xB7, 0x43, // Bytes c80 - cbf 0xE6, 0x91, 0xBE, 0x43, 0xE6, 0x92, 0x9A, 0x43, 0xE6, 0x92, 0x9D, 0x43, 0xE6, 0x93, 0x84, 0x43, 0xE6, 0x94, 0xAF, 0x43, 0xE6, 0x94, 0xB4, 0x43, 0xE6, 0x95, 0x8F, 0x43, 0xE6, 0x95, 0x96, 0x43, 0xE6, 0x95, 0xAC, 0x43, 0xE6, 0x95, 0xB8, 0x43, 0xE6, 0x96, 0x87, 0x43, 0xE6, 0x96, 0x97, 0x43, 0xE6, 0x96, 0x99, 0x43, 0xE6, 0x96, 0xA4, 0x43, 0xE6, 0x96, 0xB0, 0x43, 0xE6, 0x96, 0xB9, 0x43, // Bytes cc0 - cff 0xE6, 0x97, 0x85, 0x43, 0xE6, 0x97, 0xA0, 0x43, 0xE6, 0x97, 0xA2, 0x43, 0xE6, 0x97, 0xA3, 0x43, 0xE6, 0x97, 0xA5, 0x43, 0xE6, 0x98, 0x93, 0x43, 0xE6, 0x98, 0xA0, 0x43, 0xE6, 0x99, 0x89, 0x43, 0xE6, 0x99, 0xB4, 0x43, 0xE6, 0x9A, 0x88, 0x43, 0xE6, 0x9A, 0x91, 0x43, 0xE6, 0x9A, 0x9C, 0x43, 0xE6, 0x9A, 0xB4, 0x43, 0xE6, 0x9B, 0x86, 0x43, 0xE6, 0x9B,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x8B, 0x43, 0xE6, 0xBB, 0x91, 0x43, 0xE6, 0xBB, 0x9B, 0x43, 0xE6, 0xBC, 0x8F, 0x43, 0xE6, 0xBC, 0x94, 0x43, 0xE6, 0xBC, 0xA2, 0x43, 0xE6, 0xBC, 0xA3, 0x43, 0xE6, 0xBD, 0xAE, 0x43, 0xE6, 0xBF, 0x86, 0x43, 0xE6, 0xBF, 0xAB, 0x43, 0xE6, 0xBF, 0xBE, 0x43, // Bytes e80 - ebf 0xE7, 0x80, 0x9B, 0x43, 0xE7, 0x80, 0x9E, 0x43, 0xE7, 0x80, 0xB9, 0x43, 0xE7, 0x81, 0x8A, 0x43, 0xE7, 0x81, 0xAB, 0x43, 0xE7, 0x81, 0xB0, 0x43, 0xE7, 0x81, 0xB7, 0x43, 0xE7, 0x81, 0xBD, 0x43, 0xE7, 0x82, 0x99, 0x43, 0xE7, 0x82, 0xAD, 0x43, 0xE7, 0x83, 0x88, 0x43, 0xE7, 0x83, 0x99, 0x43, 0xE7, 0x84, 0xA1, 0x43, 0xE7, 0x85, 0x85, 0x43, 0xE7, 0x85, 0x89, 0x43, 0xE7, 0x85, 0xAE, 0x43, // Bytes ec0 - eff 0xE7, 0x86, 0x9C, 0x43, 0xE7, 0x87, 0x8E, 0x43, 0xE7, 0x87, 0x90, 0x43, 0xE7, 0x88, 0x90, 0x43, 0xE7, 0x88, 0x9B, 0x43, 0xE7, 0x88, 0xA8, 0x43, 0xE7, 0x88, 0xAA, 0x43, 0xE7, 0x88, 0xAB, 0x43, 0xE7, 0x88, 0xB5, 0x43, 0xE7, 0x88, 0xB6, 0x43, 0xE7, 0x88, 0xBB, 0x43, 0xE7, 0x88, 0xBF, 0x43, 0xE7, 0x89, 0x87, 0x43, 0xE7, 0x89, 0x90, 0x43, 0xE7, 0x89, 0x99, 0x43, 0xE7, 0x89, 0x9B, 0x43, // Bytes f00 - f3f 0xE7, 0x89, 0xA2, 0x43, 0xE7, 0x89, 0xB9, 0x43, 0xE7, 0x8A, 0x80, 0x43, 0xE7, 0x8A, 0x95, 0x43, 0xE7, 0x8A, 0xAC, 0x43, 0xE7, 0x8A, 0xAF, 0x43, 0xE7, 0x8B, 0x80, 0x43, 0xE7, 0x8B, 0xBC, 0x43, 0xE7, 0x8C, 0xAA, 0x43, 0xE7, 0x8D, 0xB5, 0x43, 0xE7, 0x8D, 0xBA, 0x43, 0xE7, 0x8E, 0x84, 0x43, 0xE7, 0x8E, 0x87, 0x43, 0xE7, 0x8E, 0x89, 0x43, 0xE7, 0x8E, 0x8B, 0x43, 0xE7, 0x8E, 0xA5, 0x43, // Bytes f40 - f7f 0xE7, 0x8E, 0xB2, 0x43, 0xE7, 0x8F, 0x9E, 0x43, 0xE7, 0x90, 0x86, 0x43, 0xE7, 0x90, 0x89, 0x43, 0xE7, 0x90, 0xA2, 0x43, 0xE7, 0x91, 0x87, 0x43, 0xE7, 0x91, 0x9C, 0x43, 0xE7, 0x91, 0xA9, 0x43, 0xE7, 0x91, 0xB1, 0x43, 0xE7, 0x92, 0x85, 0x43, 0xE7, 0x92, 0x89, 0x43, 0xE7, 0x92, 0x98, 0x43, 0xE7, 0x93, 0x8A, 0x43, 0xE7, 0x93, 0x9C, 0x43, 0xE7, 0x93, 0xA6, 0x43, 0xE7, 0x94, 0x86, 0x43, // Bytes f80 - fbf 0xE7, 0x94, 0x98, 0x43, 0xE7, 0x94, 0x9F, 0x43, 0xE7, 0x94, 0xA4, 0x43, 0xE7, 0x94, 0xA8, 0x43, 0xE7, 0x94, 0xB0, 0x43, 0xE7, 0x94, 0xB2, 0x43, 0xE7, 0x94, 0xB3, 0x43, 0xE7, 0x94, 0xB7, 0x43, 0xE7, 0x94, 0xBB, 0x43, 0xE7, 0x94, 0xBE, 0x43, 0xE7, 0x95, 0x99, 0x43, 0xE7, 0x95, 0xA5, 0x43, 0xE7, 0x95, 0xB0, 0x43, 0xE7, 0x96, 0x8B, 0x43, 0xE7, 0x96, 0x92, 0x43, 0xE7, 0x97, 0xA2, 0x43, //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, // Bytes 1280 - 12bf 0xE8, 0x95, 0xA4, 0x43, 0xE8, 0x97, 0x8D, 0x43, 0xE8, 0x97, 0xBA, 0x43, 0xE8, 0x98, 0x86, 0x43, 0xE8, 0x98, 0x92, 0x43, 0xE8, 0x98, 0xAD, 0x43, 0xE8, 0x98, 0xBF, 0x43, 0xE8, 0x99, 0x8D, 0x43, 0xE8, 0x99, 0x90, 0x43, 0xE8, 0x99, 0x9C, 0x43, 0xE8, 0x99, 0xA7, 0x43, 0xE8, 0x99, 0xA9, 0x43, 0xE8, 0x99, 0xAB, 0x43, 0xE8, 0x9A, 0x88, 0x43, 0xE8, 0x9A, 0xA9, 0x43, 0xE8, 0x9B, 0xA2, 0x43, // Bytes 12c0 - 12ff 0xE8, 0x9C, 0x8E, 0x43, 0xE8, 0x9C, 0xA8, 0x43, 0xE8, 0x9D, 0xAB, 0x43, 0xE8, 0x9D, 0xB9, 0x43, 0xE8, 0x9E, 0x86, 0x43, 0xE8, 0x9E, 0xBA, 0x43, 0xE8, 0x9F, 0xA1, 0x43, 0xE8, 0xA0, 0x81, 0x43, 0xE8, 0xA0, 0x9F, 0x43, 0xE8, 0xA1, 0x80, 0x43, 0xE8, 0xA1, 0x8C, 0x43, 0xE8, 0xA1, 0xA0, 0x43, 0xE8, 0xA1, 0xA3, 0x43, 0xE8, 0xA3, 0x82, 0x43, 0xE8, 0xA3, 0x8F, 0x43, 0xE8, 0xA3, 0x97, 0x43, // Bytes 1300 - 133f 0xE8, 0xA3, 0x9E, 0x43, 0xE8, 0xA3, 0xA1, 0x43, 0xE8, 0xA3, 0xB8, 0x43, 0xE8, 0xA3, 0xBA, 0x43, 0xE8, 0xA4, 0x90, 0x43, 0xE8, 0xA5, 0x81, 0x43, 0xE8, 0xA5, 0xA4, 0x43, 0xE8, 0xA5, 0xBE, 0x43, 0xE8, 0xA6, 0x86, 0x43, 0xE8, 0xA6, 0x8B, 0x43,
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/input.go
vendor/golang.org/x/text/unicode/norm/input.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package norm import "unicode/utf8" type input struct { str string bytes []byte } func inputBytes(str []byte) input { return input{bytes: str} } func inputString(str string) input { return input{str: str} } func (in *input) setBytes(str []byte) { in.str = "" in.bytes = str } func (in *input) setString(str string) { in.str = str in.bytes = nil } func (in *input) _byte(p int) byte { if in.bytes == nil { return in.str[p] } return in.bytes[p] } func (in *input) skipASCII(p, max int) int { if in.bytes == nil { for ; p < max && in.str[p] < utf8.RuneSelf; p++ { } } else { for ; p < max && in.bytes[p] < utf8.RuneSelf; p++ { } } return p } func (in *input) skipContinuationBytes(p int) int { if in.bytes == nil { for ; p < len(in.str) && !utf8.RuneStart(in.str[p]); p++ { } } else { for ; p < len(in.bytes) && !utf8.RuneStart(in.bytes[p]); p++ { } } return p } func (in *input) appendSlice(buf []byte, b, e int) []byte { if in.bytes != nil { return append(buf, in.bytes[b:e]...) } for i := b; i < e; i++ { buf = append(buf, in.str[i]) } return buf } func (in *input) copySlice(buf []byte, b, e int) int { if in.bytes == nil { return copy(buf, in.str[b:e]) } return copy(buf, in.bytes[b:e]) } func (in *input) charinfoNFC(p int) (uint16, int) { if in.bytes == nil { return nfcData.lookupString(in.str[p:]) } return nfcData.lookup(in.bytes[p:]) } func (in *input) charinfoNFKC(p int) (uint16, int) { if in.bytes == nil { return nfkcData.lookupString(in.str[p:]) } return nfkcData.lookup(in.bytes[p:]) } func (in *input) hangul(p int) (r rune) { var size int if in.bytes == nil { if !isHangulString(in.str[p:]) { return 0 } r, size = utf8.DecodeRuneInString(in.str[p:]) } else { if !isHangul(in.bytes[p:]) { return 0 } r, size = utf8.DecodeRune(in.bytes[p:]) } if size != hangulUTF8Size { return 0 } return r }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go
vendor/golang.org/x/text/unicode/norm/tables11.0.0.go
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.13 && !go1.14 package norm import "sync" const ( // Version is the Unicode edition from which the tables are derived. Version = "11.0.0" // MaxTransformChunkSize indicates the maximum number of bytes that Transform // may need to write atomically for any Form. Making a destination buffer at // least this size ensures that Transform can always make progress and that // the user does not need to grow the buffer on an ErrShortDst. MaxTransformChunkSize = 35 + maxNonStarters*4 ) var ccc = [55]uint8{ 0, 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 84, 91, 103, 107, 118, 122, 129, 130, 132, 202, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 233, 234, 240, } const ( firstMulti = 0x186D firstCCC = 0x2C9E endMulti = 0x2F60 firstLeadingCCC = 0x49AE firstCCCZeroExcept = 0x4A78 firstStarterWithNLead = 0x4A9F lastDecomp = 0x4AA1 maxDecomp = 0x8000 ) // decomps: 19105 bytes var decomps = [...]byte{ // Bytes 0 - 3f 0x00, 0x41, 0x20, 0x41, 0x21, 0x41, 0x22, 0x41, 0x23, 0x41, 0x24, 0x41, 0x25, 0x41, 0x26, 0x41, 0x27, 0x41, 0x28, 0x41, 0x29, 0x41, 0x2A, 0x41, 0x2B, 0x41, 0x2C, 0x41, 0x2D, 0x41, 0x2E, 0x41, 0x2F, 0x41, 0x30, 0x41, 0x31, 0x41, 0x32, 0x41, 0x33, 0x41, 0x34, 0x41, 0x35, 0x41, 0x36, 0x41, 0x37, 0x41, 0x38, 0x41, 0x39, 0x41, 0x3A, 0x41, 0x3B, 0x41, 0x3C, 0x41, 0x3D, 0x41, 0x3E, 0x41, // Bytes 40 - 7f 0x3F, 0x41, 0x40, 0x41, 0x41, 0x41, 0x42, 0x41, 0x43, 0x41, 0x44, 0x41, 0x45, 0x41, 0x46, 0x41, 0x47, 0x41, 0x48, 0x41, 0x49, 0x41, 0x4A, 0x41, 0x4B, 0x41, 0x4C, 0x41, 0x4D, 0x41, 0x4E, 0x41, 0x4F, 0x41, 0x50, 0x41, 0x51, 0x41, 0x52, 0x41, 0x53, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, 0x57, 0x41, 0x58, 0x41, 0x59, 0x41, 0x5A, 0x41, 0x5B, 0x41, 0x5C, 0x41, 0x5D, 0x41, 0x5E, 0x41, // Bytes 80 - bf 0x5F, 0x41, 0x60, 0x41, 0x61, 0x41, 0x62, 0x41, 0x63, 0x41, 0x64, 0x41, 0x65, 0x41, 0x66, 0x41, 0x67, 0x41, 0x68, 0x41, 0x69, 0x41, 0x6A, 0x41, 0x6B, 0x41, 0x6C, 0x41, 0x6D, 0x41, 0x6E, 0x41, 0x6F, 0x41, 0x70, 0x41, 0x71, 0x41, 0x72, 0x41, 0x73, 0x41, 0x74, 0x41, 0x75, 0x41, 0x76, 0x41, 0x77, 0x41, 0x78, 0x41, 0x79, 0x41, 0x7A, 0x41, 0x7B, 0x41, 0x7C, 0x41, 0x7D, 0x41, 0x7E, 0x42, // Bytes c0 - ff 0xC2, 0xA2, 0x42, 0xC2, 0xA3, 0x42, 0xC2, 0xA5, 0x42, 0xC2, 0xA6, 0x42, 0xC2, 0xAC, 0x42, 0xC2, 0xB7, 0x42, 0xC3, 0x86, 0x42, 0xC3, 0xB0, 0x42, 0xC4, 0xA6, 0x42, 0xC4, 0xA7, 0x42, 0xC4, 0xB1, 0x42, 0xC5, 0x8B, 0x42, 0xC5, 0x93, 0x42, 0xC6, 0x8E, 0x42, 0xC6, 0x90, 0x42, 0xC6, 0xAB, 0x42, 0xC8, 0xA2, 0x42, 0xC8, 0xB7, 0x42,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92, 0x43, 0xE0, 0xBC, 0x8B, 0x43, 0xE1, 0x83, 0x9C, 0x43, 0xE1, 0x84, 0x80, 0x43, 0xE1, 0x84, 0x81, 0x43, 0xE1, 0x84, 0x82, 0x43, 0xE1, 0x84, 0x83, 0x43, 0xE1, 0x84, 0x84, 0x43, 0xE1, 0x84, 0x85, 0x43, 0xE1, 0x84, 0x86, 0x43, 0xE1, 0x84, 0x87, 0x43, 0xE1, 0x84, 0x88, 0x43, 0xE1, 0x84, 0x89, 0x43, 0xE1, 0x84, 0x8A, 0x43, // Bytes 340 - 37f 0xE1, 0x84, 0x8B, 0x43, 0xE1, 0x84, 0x8C, 0x43, 0xE1, 0x84, 0x8D, 0x43, 0xE1, 0x84, 0x8E, 0x43, 0xE1, 0x84, 0x8F, 0x43, 0xE1, 0x84, 0x90, 0x43, 0xE1, 0x84, 0x91, 0x43, 0xE1, 0x84, 0x92, 0x43, 0xE1, 0x84, 0x94, 0x43, 0xE1, 0x84, 0x95, 0x43, 0xE1, 0x84, 0x9A, 0x43, 0xE1, 0x84, 0x9C, 0x43, 0xE1, 0x84, 0x9D, 0x43, 0xE1, 0x84, 0x9E, 0x43, 0xE1, 0x84, 0xA0, 0x43, 0xE1, 0x84, 0xA1, 0x43, // Bytes 380 - 3bf 0xE1, 0x84, 0xA2, 0x43, 0xE1, 0x84, 0xA3, 0x43, 0xE1, 0x84, 0xA7, 0x43, 0xE1, 0x84, 0xA9, 0x43, 0xE1, 0x84, 0xAB, 0x43, 0xE1, 0x84, 0xAC, 0x43, 0xE1, 0x84, 0xAD, 0x43, 0xE1, 0x84, 0xAE, 0x43, 0xE1, 0x84, 0xAF, 0x43, 0xE1, 0x84, 0xB2, 0x43, 0xE1, 0x84, 0xB6, 0x43, 0xE1, 0x85, 0x80, 0x43, 0xE1, 0x85, 0x87, 0x43, 0xE1, 0x85, 0x8C, 0x43, 0xE1, 0x85, 0x97, 0x43, 0xE1, 0x85, 0x98, 0x43, // Bytes 3c0 - 3ff 0xE1, 0x85, 0x99, 0x43, 0xE1, 0x85, 0xA0, 0x43, 0xE1, 0x86, 0x84, 0x43, 0xE1, 0x86, 0x85, 0x43, 0xE1, 0x86, 0x88, 0x43, 0xE1, 0x86, 0x91, 0x43, 0xE1, 0x86, 0x92, 0x43, 0xE1, 0x86, 0x94, 0x43, 0xE1, 0x86, 0x9E, 0x43, 0xE1, 0x86, 0xA1, 0x43, 0xE1, 0x87, 0x87, 0x43, 0xE1, 0x87, 0x88, 0x43, 0xE1, 0x87, 0x8C, 0x43, 0xE1, 0x87, 0x8E, 0x43, 0xE1, 0x87, 0x93, 0x43, 0xE1, 0x87, 0x97, 0x43, // Bytes 400 - 43f 0xE1, 0x87, 0x99, 0x43, 0xE1, 0x87, 0x9D, 0x43, 0xE1, 0x87, 0x9F, 0x43, 0xE1, 0x87, 0xB1, 0x43, 0xE1, 0x87, 0xB2, 0x43, 0xE1, 0xB4, 0x82, 0x43, 0xE1, 0xB4, 0x96, 0x43, 0xE1, 0xB4, 0x97, 0x43, 0xE1, 0xB4, 0x9C, 0x43, 0xE1, 0xB4, 0x9D, 0x43, 0xE1, 0xB4, 0xA5, 0x43, 0xE1, 0xB5, 0xBB, 0x43, 0xE1, 0xB6, 0x85, 0x43, 0xE2, 0x80, 0x82, 0x43, 0xE2, 0x80, 0x83, 0x43, 0xE2, 0x80, 0x90, 0x43, // Bytes 440 - 47f 0xE2, 0x80, 0x93, 0x43, 0xE2, 0x80, 0x94, 0x43, 0xE2, 0x82, 0xA9, 0x43, 0xE2, 0x86, 0x90, 0x43, 0xE2, 0x86, 0x91, 0x43, 0xE2, 0x86, 0x92, 0x43, 0xE2, 0x86, 0x93, 0x43, 0xE2, 0x88, 0x82, 0x43, 0xE2, 0x88, 0x87, 0x43, 0xE2, 0x88, 0x91, 0x43, 0xE2, 0x88, 0x92, 0x43, 0xE2, 0x94, 0x82, 0x43, 0xE2, 0x96, 0xA0, 0x43, 0xE2, 0x97, 0x8B, 0x43, 0xE2, 0xA6, 0x85, 0x43, 0xE2, 0xA6, 0x86, 0x43, // Bytes 480 - 4bf 0xE2, 0xB5, 0xA1, 0x43, 0xE3, 0x80, 0x81, 0x43, 0xE3, 0x80, 0x82, 0x43, 0xE3, 0x80, 0x88, 0x43, 0xE3, 0x80, 0x89, 0x43, 0xE3, 0x80, 0x8A, 0x43, 0xE3, 0x80, 0x8B, 0x43, 0xE3, 0x80, 0x8C, 0x43, 0xE3, 0x80, 0x8D, 0x43, 0xE3, 0x80, 0x8E, 0x43, 0xE3, 0x80, 0x8F, 0x43, 0xE3, 0x80, 0x90, 0x43, 0xE3, 0x80, 0x91, 0x43, 0xE3, 0x80, 0x92, 0x43, 0xE3, 0x80, 0x94, 0x43, 0xE3, 0x80, 0x95, 0x43, // Bytes 4c0 - 4ff 0xE3, 0x80, 0x96, 0x43, 0xE3, 0x80, 0x97, 0x43, 0xE3, 0x82, 0xA1, 0x43, 0xE3, 0x82, 0xA2, 0x43, 0xE3, 0x82, 0xA3, 0x43, 0xE3, 0x82, 0xA4, 0x43, 0xE3, 0x82, 0xA5, 0x43, 0xE3, 0x82, 0xA6, 0x43, 0xE3, 0x82, 0xA7, 0x43, 0xE3, 0x82, 0xA8, 0x43, 0xE3, 0x82, 0xA9, 0x43, 0xE3, 0x82, 0xAA, 0x43, 0xE3, 0x82, 0xAB, 0x43, 0xE3, 0x82, 0xAD, 0x43, 0xE3, 0x82, 0xAF, 0x43, 0xE3, 0x82, 0xB1, 0x43, // Bytes 500 - 53f 0xE3, 0x82, 0xB3, 0x43, 0xE3, 0x82, 0xB5, 0x43, 0xE3, 0x82, 0xB7, 0x43, 0xE3, 0x82, 0xB9, 0x43, 0xE3, 0x82, 0xBB, 0x43, 0xE3, 0x82, 0xBD, 0x43, 0xE3, 0x82, 0xBF, 0x43, 0xE3, 0x83, 0x81, 0x43, 0xE3, 0x83, 0x83, 0x43, 0xE3, 0x83, 0x84, 0x43, 0xE3, 0x83, 0x86, 0x43, 0xE3, 0x83, 0x88, 0x43, 0xE3, 0x83, 0x8A, 0x43, 0xE3, 0x83, 0x8B, 0x43, 0xE3, 0x83, 0x8C, 0x43, 0xE3, 0x83, 0x8D, 0x43, // Bytes 540 - 57f 0xE3, 0x83, 0x8E, 0x43, 0xE3, 0x83, 0x8F, 0x43, 0xE3, 0x83, 0x92, 0x43, 0xE3, 0x83, 0x95, 0x43, 0xE3, 0x83, 0x98, 0x43, 0xE3, 0x83, 0x9B, 0x43, 0xE3, 0x83, 0x9E, 0x43, 0xE3, 0x83, 0x9F, 0x43, 0xE3, 0x83, 0xA0, 0x43, 0xE3, 0x83, 0xA1, 0x43, 0xE3, 0x83, 0xA2, 0x43, 0xE3, 0x83, 0xA3, 0x43, 0xE3, 0x83, 0xA4, 0x43, 0xE3, 0x83, 0xA5, 0x43, 0xE3, 0x83, 0xA6, 0x43, 0xE3, 0x83, 0xA7, 0x43, // Bytes 580 - 5bf 0xE3, 0x83, 0xA8, 0x43, 0xE3, 0x83, 0xA9, 0x43, 0xE3, 0x83, 0xAA, 0x43, 0xE3, 0x83, 0xAB, 0x43, 0xE3, 0x83, 0xAC, 0x43, 0xE3, 0x83, 0xAD, 0x43, 0xE3, 0x83, 0xAF, 0x43, 0xE3, 0x83, 0xB0, 0x43, 0xE3, 0x83, 0xB1, 0x43, 0xE3, 0x83, 0xB2, 0x43, 0xE3, 0x83, 0xB3, 0x43, 0xE3, 0x83, 0xBB, 0x43, 0xE3, 0x83, 0xBC, 0x43, 0xE3, 0x92, 0x9E, 0x43, 0xE3, 0x92, 0xB9, 0x43, 0xE3, 0x92, 0xBB, 0x43, // Bytes 5c0 - 5ff 0xE3, 0x93, 0x9F, 0x43, 0xE3, 0x94, 0x95, 0x43, 0xE3, 0x9B, 0xAE, 0x43, 0xE3, 0x9B, 0xBC, 0x43, 0xE3, 0x9E, 0x81, 0x43, 0xE3, 0xA0, 0xAF, 0x43, 0xE3, 0xA1, 0xA2, 0x43, 0xE3, 0xA1, 0xBC, 0x43, 0xE3, 0xA3, 0x87,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x81, 0x43, 0xE4, 0xBC, 0x91, 0x43, 0xE4, 0xBD, 0xA0, 0x43, 0xE4, 0xBE, 0x80, 0x43, 0xE4, 0xBE, 0x86, 0x43, 0xE4, 0xBE, 0x8B, 0x43, 0xE4, 0xBE, 0xAE, 0x43, 0xE4, 0xBE, 0xBB, 0x43, 0xE4, 0xBE, 0xBF, 0x43, 0xE5, 0x80, 0x82, 0x43, 0xE5, 0x80, 0xAB, 0x43, 0xE5, 0x81, 0xBA, 0x43, 0xE5, 0x82, 0x99, 0x43, 0xE5, 0x83, 0x8F, 0x43, 0xE5, 0x83, 0x9A, 0x43, 0xE5, 0x83, 0xA7, 0x43, // Bytes 780 - 7bf 0xE5, 0x84, 0xAA, 0x43, 0xE5, 0x84, 0xBF, 0x43, 0xE5, 0x85, 0x80, 0x43, 0xE5, 0x85, 0x85, 0x43, 0xE5, 0x85, 0x8D, 0x43, 0xE5, 0x85, 0x94, 0x43, 0xE5, 0x85, 0xA4, 0x43, 0xE5, 0x85, 0xA5, 0x43, 0xE5, 0x85, 0xA7, 0x43, 0xE5, 0x85, 0xA8, 0x43, 0xE5, 0x85, 0xA9, 0x43, 0xE5, 0x85, 0xAB, 0x43, 0xE5, 0x85, 0xAD, 0x43, 0xE5, 0x85, 0xB7, 0x43, 0xE5, 0x86, 0x80, 0x43, 0xE5, 0x86, 0x82, 0x43, // Bytes 7c0 - 7ff 0xE5, 0x86, 0x8D, 0x43, 0xE5, 0x86, 0x92, 0x43, 0xE5, 0x86, 0x95, 0x43, 0xE5, 0x86, 0x96, 0x43, 0xE5, 0x86, 0x97, 0x43, 0xE5, 0x86, 0x99, 0x43, 0xE5, 0x86, 0xA4, 0x43, 0xE5, 0x86, 0xAB, 0x43, 0xE5, 0x86, 0xAC, 0x43, 0xE5, 0x86, 0xB5, 0x43, 0xE5, 0x86, 0xB7, 0x43, 0xE5, 0x87, 0x89, 0x43, 0xE5, 0x87, 0x8C, 0x43, 0xE5, 0x87, 0x9C, 0x43, 0xE5,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BE, 0x8B, 0x43, 0xE5, 0xBE, 0x8C, 0x43, 0xE5, 0xBE, 0x97, 0x43, 0xE5, 0xBE, 0x9A, 0x43, 0xE5, 0xBE, 0xA9, 0x43, 0xE5, 0xBE, 0xAD, 0x43, // Bytes b80 - bbf 0xE5, 0xBF, 0x83, 0x43, 0xE5, 0xBF, 0x8D, 0x43, 0xE5, 0xBF, 0x97, 0x43, 0xE5, 0xBF, 0xB5, 0x43, 0xE5, 0xBF, 0xB9, 0x43, 0xE6, 0x80, 0x92, 0x43, 0xE6, 0x80, 0x9C, 0x43, 0xE6, 0x81, 0xB5, 0x43, 0xE6, 0x82, 0x81, 0x43, 0xE6, 0x82, 0x94, 0x43, 0xE6, 0x83, 0x87, 0x43, 0xE6, 0x83, 0x98, 0x43, 0xE6, 0x83, 0xA1, 0x43, 0xE6, 0x84, 0x88, 0x43, 0xE6, 0x85, 0x84, 0x43, 0xE6, 0x85, 0x88, 0x43, // Bytes bc0 - bff 0xE6, 0x85, 0x8C, 0x43, 0xE6, 0x85, 0x8E, 0x43, 0xE6, 0x85, 0xA0, 0x43, 0xE6, 0x85, 0xA8, 0x43, 0xE6, 0x85, 0xBA, 0x43, 0xE6, 0x86, 0x8E, 0x43, 0xE6, 0x86, 0x90, 0x43, 0xE6, 0x86, 0xA4, 0x43, 0xE6, 0x86, 0xAF, 0x43, 0xE6, 0x86, 0xB2, 0x43, 0xE6, 0x87, 0x9E, 0x43, 0xE6, 0x87, 0xB2, 0x43, 0xE6, 0x87, 0xB6, 0x43, 0xE6, 0x88, 0x80, 0x43, 0xE6, 0x88, 0x88, 0x43, 0xE6, 0x88, 0x90, 0x43, // Bytes c00 - c3f 0xE6, 0x88, 0x9B, 0x43, 0xE6, 0x88, 0xAE, 0x43, 0xE6, 0x88, 0xB4, 0x43, 0xE6, 0x88, 0xB6, 0x43, 0xE6, 0x89, 0x8B, 0x43, 0xE6, 0x89, 0x93, 0x43, 0xE6, 0x89, 0x9D, 0x43, 0xE6, 0x8A, 0x95, 0x43, 0xE6, 0x8A, 0xB1, 0x43, 0xE6, 0x8B, 0x89, 0x43, 0xE6, 0x8B, 0x8F, 0x43, 0xE6, 0x8B, 0x93, 0x43, 0xE6, 0x8B, 0x94, 0x43, 0xE6, 0x8B, 0xBC, 0x43, 0xE6, 0x8B, 0xBE, 0x43, 0xE6, 0x8C, 0x87, 0x43, // Bytes c40 - c7f 0xE6, 0x8C, 0xBD, 0x43, 0xE6, 0x8D, 0x90, 0x43, 0xE6, 0x8D, 0x95, 0x43, 0xE6, 0x8D, 0xA8, 0x43, 0xE6, 0x8D, 0xBB, 0x43, 0xE6, 0x8E, 0x83, 0x43, 0xE6, 0x8E, 0xA0, 0x43, 0xE6, 0x8E, 0xA9, 0x43, 0xE6, 0x8F, 0x84, 0x43, 0xE6, 0x8F, 0x85, 0x43, 0xE6, 0x8F, 0xA4, 0x43, 0xE6, 0x90, 0x9C, 0x43, 0xE6, 0x90, 0xA2, 0x43, 0xE6, 0x91, 0x92, 0x43, 0xE6, 0x91, 0xA9, 0x43, 0xE6, 0x91, 0xB7, 0x43, // Bytes c80 - cbf 0xE6, 0x91, 0xBE, 0x43, 0xE6, 0x92, 0x9A, 0x43, 0xE6, 0x92, 0x9D, 0x43, 0xE6, 0x93, 0x84, 0x43, 0xE6, 0x94, 0xAF, 0x43, 0xE6, 0x94, 0xB4, 0x43, 0xE6, 0x95, 0x8F, 0x43, 0xE6, 0x95, 0x96, 0x43, 0xE6, 0x95, 0xAC, 0x43, 0xE6, 0x95, 0xB8, 0x43, 0xE6, 0x96, 0x87, 0x43, 0xE6, 0x96, 0x97, 0x43, 0xE6, 0x96, 0x99, 0x43, 0xE6, 0x96, 0xA4, 0x43, 0xE6, 0x96, 0xB0, 0x43, 0xE6, 0x96, 0xB9, 0x43, // Bytes cc0 - cff 0xE6, 0x97, 0x85, 0x43, 0xE6, 0x97, 0xA0, 0x43, 0xE6, 0x97, 0xA2, 0x43, 0xE6, 0x97, 0xA3, 0x43, 0xE6, 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0x43, 0xE7, 0x88, 0xB6, 0x43, 0xE7, 0x88, 0xBB, 0x43, 0xE7, 0x88, 0xBF, 0x43, 0xE7, 0x89, 0x87, 0x43, 0xE7, 0x89, 0x90, 0x43, 0xE7, 0x89, 0x99, 0x43, 0xE7, 0x89, 0x9B, 0x43, // Bytes f00 - f3f 0xE7, 0x89, 0xA2, 0x43, 0xE7, 0x89, 0xB9, 0x43, 0xE7, 0x8A, 0x80, 0x43, 0xE7, 0x8A, 0x95, 0x43, 0xE7, 0x8A, 0xAC, 0x43, 0xE7, 0x8A, 0xAF, 0x43, 0xE7, 0x8B, 0x80, 0x43, 0xE7, 0x8B, 0xBC, 0x43, 0xE7, 0x8C, 0xAA, 0x43, 0xE7, 0x8D, 0xB5, 0x43, 0xE7, 0x8D, 0xBA, 0x43, 0xE7, 0x8E, 0x84, 0x43, 0xE7, 0x8E, 0x87, 0x43, 0xE7, 0x8E, 0x89, 0x43, 0xE7, 0x8E, 0x8B, 0x43, 0xE7, 0x8E, 0xA5, 0x43, // Bytes f40 - f7f 0xE7, 0x8E, 0xB2, 0x43, 0xE7, 0x8F, 0x9E, 0x43, 0xE7, 0x90, 0x86, 0x43, 0xE7, 0x90, 0x89, 0x43, 0xE7, 0x90, 0xA2, 0x43, 0xE7, 0x91, 0x87, 0x43, 0xE7, 0x91, 0x9C, 0x43, 0xE7, 0x91, 0xA9, 0x43, 0xE7, 0x91, 0xB1, 0x43, 0xE7, 0x92, 0x85, 0x43, 0xE7, 0x92, 0x89, 0x43, 0xE7, 0x92, 0x98, 0x43, 0xE7, 0x93, 0x8A, 0x43, 0xE7, 0x93, 0x9C, 0x43, 0xE7, 0x93, 0xA6, 0x43, 0xE7, 0x94, 0x86, 0x43, // Bytes f80 - fbf 0xE7, 0x94, 0x98, 0x43, 0xE7, 0x94, 0x9F, 0x43, 0xE7, 0x94, 0xA4, 0x43, 0xE7, 0x94, 0xA8, 0x43, 0xE7, 0x94, 0xB0, 0x43, 0xE7, 0x94, 0xB2,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0x43, 0xE8, 0xA3, 0xB8, 0x43, 0xE8, 0xA3, 0xBA, 0x43, 0xE8, 0xA4, 0x90, 0x43, 0xE8, 0xA5, 0x81, 0x43, 0xE8, 0xA5, 0xA4, 0x43, 0xE8, 0xA5, 0xBE, 0x43, 0xE8, 0xA6, 0x86, 0x43, 0xE8, 0xA6, 0x8B, 0x43,
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
true
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/transform/transform.go
vendor/golang.org/x/text/transform/transform.go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package transform provides reader and writer wrappers that transform the // bytes passing through as well as various transformations. Example // transformations provided by other packages include normalization and // conversion between character sets. package transform // import "golang.org/x/text/transform" import ( "bytes" "errors" "io" "unicode/utf8" ) var ( // ErrShortDst means that the destination buffer was too short to // receive all of the transformed bytes. ErrShortDst = errors.New("transform: short destination buffer") // ErrShortSrc means that the source buffer has insufficient data to // complete the transformation. ErrShortSrc = errors.New("transform: short source buffer") // ErrEndOfSpan means that the input and output (the transformed input) // are not identical. ErrEndOfSpan = errors.New("transform: input and output are not identical") // errInconsistentByteCount means that Transform returned success (nil // error) but also returned nSrc inconsistent with the src argument. errInconsistentByteCount = errors.New("transform: inconsistent byte count returned") // errShortInternal means that an internal buffer is not large enough // to make progress and the Transform operation must be aborted. errShortInternal = errors.New("transform: short internal buffer") ) // Transformer transforms bytes. type Transformer interface { // Transform writes to dst the transformed bytes read from src, and // returns the number of dst bytes written and src bytes read. The // atEOF argument tells whether src represents the last bytes of the // input. // // Callers should always process the nDst bytes produced and account // for the nSrc bytes consumed before considering the error err. // // A nil error means that all of the transformed bytes (whether freshly // transformed from src or left over from previous Transform calls) // were written to dst. A nil error can be returned regardless of // whether atEOF is true. If err is nil then nSrc must equal len(src); // the converse is not necessarily true. // // ErrShortDst means that dst was too short to receive all of the // transformed bytes. ErrShortSrc means that src had insufficient data // to complete the transformation. If both conditions apply, then // either error may be returned. Other than the error conditions listed // here, implementations are free to report other errors that arise. Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) // Reset resets the state and allows a Transformer to be reused. Reset() } // SpanningTransformer extends the Transformer interface with a Span method // that determines how much of the input already conforms to the Transformer. type SpanningTransformer interface { Transformer // Span returns a position in src such that transforming src[:n] results in // identical output src[:n] for these bytes. It does not necessarily return // the largest such n. The atEOF argument tells whether src represents the // last bytes of the input. // // Callers should always account for the n bytes consumed before // considering the error err. // // A nil error means that all input bytes are known to be identical to the // output produced by the Transformer. A nil error can be returned // regardless of whether atEOF is true. If err is nil, then n must // equal len(src); the converse is not necessarily true. // // ErrEndOfSpan means that the Transformer output may differ from the // input after n bytes. Note that n may be len(src), meaning that the output // would contain additional bytes after otherwise identical output. // ErrShortSrc means that src had insufficient data to determine whether the // remaining bytes would change. Other than the error conditions listed // here, implementations are free to report other errors that arise. // // Calling Span can modify the Transformer state as a side effect. In // effect, it does the transformation just as calling Transform would, only // without copying to a destination buffer and only up to a point it can // determine the input and output bytes are the same. This is obviously more // limited than calling Transform, but can be more efficient in terms of // copying and allocating buffers. Calls to Span and Transform may be // interleaved. Span(src []byte, atEOF bool) (n int, err error) } // NopResetter can be embedded by implementations of Transformer to add a nop // Reset method. type NopResetter struct{} // Reset implements the Reset method of the Transformer interface. func (NopResetter) Reset() {} // Reader wraps another io.Reader by transforming the bytes read. type Reader struct { r io.Reader t Transformer err error // dst[dst0:dst1] contains bytes that have been transformed by t but // not yet copied out via Read. dst []byte dst0, dst1 int // src[src0:src1] contains bytes that have been read from r but not // yet transformed through t. src []byte src0, src1 int // transformComplete is whether the transformation is complete, // regardless of whether or not it was successful. transformComplete bool } const defaultBufSize = 4096 // NewReader returns a new Reader that wraps r by transforming the bytes read // via t. It calls Reset on t. func NewReader(r io.Reader, t Transformer) *Reader { t.Reset() return &Reader{ r: r, t: t, dst: make([]byte, defaultBufSize), src: make([]byte, defaultBufSize), } } // Read implements the io.Reader interface. func (r *Reader) Read(p []byte) (int, error) { n, err := 0, error(nil) for { // Copy out any transformed bytes and return the final error if we are done. if r.dst0 != r.dst1 { n = copy(p, r.dst[r.dst0:r.dst1]) r.dst0 += n if r.dst0 == r.dst1 && r.transformComplete { return n, r.err } return n, nil } else if r.transformComplete { return 0, r.err } // Try to transform some source bytes, or to flush the transformer if we // are out of source bytes. We do this even if r.r.Read returned an error. // As the io.Reader documentation says, "process the n > 0 bytes returned // before considering the error". if r.src0 != r.src1 || r.err != nil { r.dst0 = 0 r.dst1, n, err = r.t.Transform(r.dst, r.src[r.src0:r.src1], r.err == io.EOF) r.src0 += n switch { case err == nil: if r.src0 != r.src1 { r.err = errInconsistentByteCount } // The Transform call was successful; we are complete if we // cannot read more bytes into src. r.transformComplete = r.err != nil continue case err == ErrShortDst && (r.dst1 != 0 || n != 0): // Make room in dst by copying out, and try again. continue case err == ErrShortSrc && r.src1-r.src0 != len(r.src) && r.err == nil: // Read more bytes into src via the code below, and try again. default: r.transformComplete = true // The reader error (r.err) takes precedence over the // transformer error (err) unless r.err is nil or io.EOF. if r.err == nil || r.err == io.EOF { r.err = err } continue } } // Move any untransformed source bytes to the start of the buffer // and read more bytes. if r.src0 != 0 { r.src0, r.src1 = 0, copy(r.src, r.src[r.src0:r.src1]) } n, r.err = r.r.Read(r.src[r.src1:]) r.src1 += n } } // TODO: implement ReadByte (and ReadRune??). // Writer wraps another io.Writer by transforming the bytes read. // The user needs to call Close to flush unwritten bytes that may // be buffered. type Writer struct { w io.Writer t Transformer dst []byte // src[:n] contains bytes that have not yet passed through t. src []byte n int } // NewWriter returns a new Writer that wraps w by transforming the bytes written // via t. It calls Reset on t. func NewWriter(w io.Writer, t Transformer) *Writer { t.Reset() return &Writer{ w: w, t: t, dst: make([]byte, defaultBufSize), src: make([]byte, defaultBufSize), } } // Write implements the io.Writer interface. If there are not enough // bytes available to complete a Transform, the bytes will be buffered // for the next write. Call Close to convert the remaining bytes. func (w *Writer) Write(data []byte) (n int, err error) { src := data if w.n > 0 { // Append bytes from data to the last remainder. // TODO: limit the amount copied on first try. n = copy(w.src[w.n:], data) w.n += n src = w.src[:w.n] } for { nDst, nSrc, err := w.t.Transform(w.dst, src, false) if _, werr := w.w.Write(w.dst[:nDst]); werr != nil { return n, werr } src = src[nSrc:] if w.n == 0 { n += nSrc } else if len(src) <= n { // Enough bytes from w.src have been consumed. We make src point // to data instead to reduce the copying. w.n = 0 n -= len(src) src = data[n:] if n < len(data) && (err == nil || err == ErrShortSrc) { continue } } switch err { case ErrShortDst: // This error is okay as long as we are making progress. if nDst > 0 || nSrc > 0 { continue } case ErrShortSrc: if len(src) < len(w.src) { m := copy(w.src, src) // If w.n > 0, bytes from data were already copied to w.src and n // was already set to the number of bytes consumed. if w.n == 0 { n += m } w.n = m err = nil } else if nDst > 0 || nSrc > 0 { // Not enough buffer to store the remainder. Keep processing as // long as there is progress. Without this case, transforms that // require a lookahead larger than the buffer may result in an // error. This is not something one may expect to be common in // practice, but it may occur when buffers are set to small // sizes during testing. continue } case nil: if w.n > 0 { err = errInconsistentByteCount } } return n, err } } // Close implements the io.Closer interface. func (w *Writer) Close() error { src := w.src[:w.n] for { nDst, nSrc, err := w.t.Transform(w.dst, src, true) if _, werr := w.w.Write(w.dst[:nDst]); werr != nil { return werr } if err != ErrShortDst { return err } src = src[nSrc:] } } type nop struct{ NopResetter } func (nop) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { n := copy(dst, src) if n < len(src) { err = ErrShortDst } return n, n, err } func (nop) Span(src []byte, atEOF bool) (n int, err error) { return len(src), nil } type discard struct{ NopResetter } func (discard) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { return 0, len(src), nil } var ( // Discard is a Transformer for which all Transform calls succeed // by consuming all bytes and writing nothing. Discard Transformer = discard{} // Nop is a SpanningTransformer that copies src to dst. Nop SpanningTransformer = nop{} ) // chain is a sequence of links. A chain with N Transformers has N+1 links and // N+1 buffers. Of those N+1 buffers, the first and last are the src and dst // buffers given to chain.Transform and the middle N-1 buffers are intermediate // buffers owned by the chain. The i'th link transforms bytes from the i'th // buffer chain.link[i].b at read offset chain.link[i].p to the i+1'th buffer // chain.link[i+1].b at write offset chain.link[i+1].n, for i in [0, N). type chain struct { link []link err error // errStart is the index at which the error occurred plus 1. Processing // errStart at this level at the next call to Transform. As long as // errStart > 0, chain will not consume any more source bytes. errStart int } func (c *chain) fatalError(errIndex int, err error) { if i := errIndex + 1; i > c.errStart { c.errStart = i c.err = err } } type link struct { t Transformer // b[p:n] holds the bytes to be transformed by t. b []byte p int n int } func (l *link) src() []byte { return l.b[l.p:l.n] } func (l *link) dst() []byte { return l.b[l.n:] } // Chain returns a Transformer that applies t in sequence. func Chain(t ...Transformer) Transformer { if len(t) == 0 { return nop{} } c := &chain{link: make([]link, len(t)+1)} for i, tt := range t { c.link[i].t = tt } // Allocate intermediate buffers. b := make([][defaultBufSize]byte, len(t)-1) for i := range b { c.link[i+1].b = b[i][:] } return c } // Reset resets the state of Chain. It calls Reset on all the Transformers. func (c *chain) Reset() { for i, l := range c.link { if l.t != nil { l.t.Reset() } c.link[i].p, c.link[i].n = 0, 0 } } // TODO: make chain use Span (is going to be fun to implement!) // Transform applies the transformers of c in sequence. func (c *chain) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { // Set up src and dst in the chain. srcL := &c.link[0] dstL := &c.link[len(c.link)-1] srcL.b, srcL.p, srcL.n = src, 0, len(src) dstL.b, dstL.n = dst, 0 var lastFull, needProgress bool // for detecting progress // i is the index of the next Transformer to apply, for i in [low, high]. // low is the lowest index for which c.link[low] may still produce bytes. // high is the highest index for which c.link[high] has a Transformer. // The error returned by Transform determines whether to increase or // decrease i. We try to completely fill a buffer before converting it. for low, i, high := c.errStart, c.errStart, len(c.link)-2; low <= i && i <= high; { in, out := &c.link[i], &c.link[i+1] nDst, nSrc, err0 := in.t.Transform(out.dst(), in.src(), atEOF && low == i) out.n += nDst in.p += nSrc if i > 0 && in.p == in.n { in.p, in.n = 0, 0 } needProgress, lastFull = lastFull, false switch err0 { case ErrShortDst: // Process the destination buffer next. Return if we are already // at the high index. if i == high { return dstL.n, srcL.p, ErrShortDst } if out.n != 0 { i++ // If the Transformer at the next index is not able to process any // source bytes there is nothing that can be done to make progress // and the bytes will remain unprocessed. lastFull is used to // detect this and break out of the loop with a fatal error. lastFull = true continue } // The destination buffer was too small, but is completely empty. // Return a fatal error as this transformation can never complete. c.fatalError(i, errShortInternal) case ErrShortSrc: if i == 0 { // Save ErrShortSrc in err. All other errors take precedence. err = ErrShortSrc break } // Source bytes were depleted before filling up the destination buffer. // Verify we made some progress, move the remaining bytes to the errStart // and try to get more source bytes. if needProgress && nSrc == 0 || in.n-in.p == len(in.b) { // There were not enough source bytes to proceed while the source // buffer cannot hold any more bytes. Return a fatal error as this // transformation can never complete. c.fatalError(i, errShortInternal) break } // in.b is an internal buffer and we can make progress. in.p, in.n = 0, copy(in.b, in.src()) fallthrough case nil: // if i == low, we have depleted the bytes at index i or any lower levels. // In that case we increase low and i. In all other cases we decrease i to // fetch more bytes before proceeding to the next index. if i > low { i-- continue } default: c.fatalError(i, err0) } // Exhausted level low or fatal error: increase low and continue // to process the bytes accepted so far. i++ low = i } // If c.errStart > 0, this means we found a fatal error. We will clear // all upstream buffers. At this point, no more progress can be made // downstream, as Transform would have bailed while handling ErrShortDst. if c.errStart > 0 { for i := 1; i < c.errStart; i++ { c.link[i].p, c.link[i].n = 0, 0 } err, c.errStart, c.err = c.err, 0, nil } return dstL.n, srcL.p, err } // Deprecated: Use runes.Remove instead. func RemoveFunc(f func(r rune) bool) Transformer { return removeF(f) } type removeF func(r rune) bool func (removeF) Reset() {} // Transform implements the Transformer interface. func (t removeF) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { for r, sz := rune(0), 0; len(src) > 0; src = src[sz:] { if r = rune(src[0]); r < utf8.RuneSelf { sz = 1 } else { r, sz = utf8.DecodeRune(src) if sz == 1 { // Invalid rune. if !atEOF && !utf8.FullRune(src) { err = ErrShortSrc break } // We replace illegal bytes with RuneError. Not doing so might // otherwise turn a sequence of invalid UTF-8 into valid UTF-8. // The resulting byte sequence may subsequently contain runes // for which t(r) is true that were passed unnoticed. if !t(r) { if nDst+3 > len(dst) { err = ErrShortDst break } nDst += copy(dst[nDst:], "\uFFFD") } nSrc++ continue } } if !t(r) { if nDst+sz > len(dst) { err = ErrShortDst break } nDst += copy(dst[nDst:], src[:sz]) } nSrc += sz } return } // grow returns a new []byte that is longer than b, and copies the first n bytes // of b to the start of the new slice. func grow(b []byte, n int) []byte { m := len(b) if m <= 32 { m = 64 } else if m <= 256 { m *= 2 } else { m += m >> 1 } buf := make([]byte, m) copy(buf, b[:n]) return buf } const initialBufSize = 128 // String returns a string with the result of converting s[:n] using t, where // n <= len(s). If err == nil, n will be len(s). It calls Reset on t. func String(t Transformer, s string) (result string, n int, err error) { t.Reset() if s == "" { // Fast path for the common case for empty input. Results in about a // 86% reduction of running time for BenchmarkStringLowerEmpty. if _, _, err := t.Transform(nil, nil, true); err == nil { return "", 0, nil } } // Allocate only once. Note that both dst and src escape when passed to // Transform. buf := [2 * initialBufSize]byte{} dst := buf[:initialBufSize:initialBufSize] src := buf[initialBufSize : 2*initialBufSize] // The input string s is transformed in multiple chunks (starting with a // chunk size of initialBufSize). nDst and nSrc are per-chunk (or // per-Transform-call) indexes, pDst and pSrc are overall indexes. nDst, nSrc := 0, 0 pDst, pSrc := 0, 0 // pPrefix is the length of a common prefix: the first pPrefix bytes of the // result will equal the first pPrefix bytes of s. It is not guaranteed to // be the largest such value, but if pPrefix, len(result) and len(s) are // all equal after the final transform (i.e. calling Transform with atEOF // being true returned nil error) then we don't need to allocate a new // result string. pPrefix := 0 for { // Invariant: pDst == pPrefix && pSrc == pPrefix. n := copy(src, s[pSrc:]) nDst, nSrc, err = t.Transform(dst, src[:n], pSrc+n == len(s)) pDst += nDst pSrc += nSrc // TODO: let transformers implement an optional Spanner interface, akin // to norm's QuickSpan. This would even allow us to avoid any allocation. if !bytes.Equal(dst[:nDst], src[:nSrc]) { break } pPrefix = pSrc if err == ErrShortDst { // A buffer can only be short if a transformer modifies its input. break } else if err == ErrShortSrc { if nSrc == 0 { // No progress was made. break } // Equal so far and !atEOF, so continue checking. } else if err != nil || pPrefix == len(s) { return string(s[:pPrefix]), pPrefix, err } } // Post-condition: pDst == pPrefix + nDst && pSrc == pPrefix + nSrc. // We have transformed the first pSrc bytes of the input s to become pDst // transformed bytes. Those transformed bytes are discontiguous: the first // pPrefix of them equal s[:pPrefix] and the last nDst of them equal // dst[:nDst]. We copy them around, into a new dst buffer if necessary, so // that they become one contiguous slice: dst[:pDst]. if pPrefix != 0 { newDst := dst if pDst > len(newDst) { newDst = make([]byte, len(s)+nDst-nSrc) } copy(newDst[pPrefix:pDst], dst[:nDst]) copy(newDst[:pPrefix], s[:pPrefix]) dst = newDst } // Prevent duplicate Transform calls with atEOF being true at the end of // the input. Also return if we have an unrecoverable error. if (err == nil && pSrc == len(s)) || (err != nil && err != ErrShortDst && err != ErrShortSrc) { return string(dst[:pDst]), pSrc, err } // Transform the remaining input, growing dst and src buffers as necessary. for { n := copy(src, s[pSrc:]) atEOF := pSrc+n == len(s) nDst, nSrc, err := t.Transform(dst[pDst:], src[:n], atEOF) pDst += nDst pSrc += nSrc // If we got ErrShortDst or ErrShortSrc, do not grow as long as we can // make progress. This may avoid excessive allocations. if err == ErrShortDst { if nDst == 0 { dst = grow(dst, pDst) } } else if err == ErrShortSrc { if atEOF { return string(dst[:pDst]), pSrc, err } if nSrc == 0 { src = grow(src, 0) } } else if err != nil || pSrc == len(s) { return string(dst[:pDst]), pSrc, err } } } // Bytes returns a new byte slice with the result of converting b[:n] using t, // where n <= len(b). If err == nil, n will be len(b). It calls Reset on t. func Bytes(t Transformer, b []byte) (result []byte, n int, err error) { return doAppend(t, 0, make([]byte, len(b)), b) } // Append appends the result of converting src[:n] using t to dst, where // n <= len(src), If err == nil, n will be len(src). It calls Reset on t. func Append(t Transformer, dst, src []byte) (result []byte, n int, err error) { if len(dst) == cap(dst) { n := len(src) + len(dst) // It is okay for this to be 0. b := make([]byte, n) dst = b[:copy(b, dst)] } return doAppend(t, len(dst), dst[:cap(dst)], src) } func doAppend(t Transformer, pDst int, dst, src []byte) (result []byte, n int, err error) { t.Reset() pSrc := 0 for { nDst, nSrc, err := t.Transform(dst[pDst:], src[pSrc:], true) pDst += nDst pSrc += nSrc if err != ErrShortDst { return dst[:pDst], pSrc, err } // Grow the destination buffer, but do not grow as long as we can make // progress. This may avoid excessive allocations. if nDst == 0 { dst = grow(dst, pDst) } } }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/runes/runes.go
vendor/golang.org/x/text/runes/runes.go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package runes provide transforms for UTF-8 encoded text. package runes // import "golang.org/x/text/runes" import ( "unicode" "unicode/utf8" "golang.org/x/text/transform" ) // A Set is a collection of runes. type Set interface { // Contains returns true if r is contained in the set. Contains(r rune) bool } type setFunc func(rune) bool func (s setFunc) Contains(r rune) bool { return s(r) } // Note: using funcs here instead of wrapping types result in cleaner // documentation and a smaller API. // In creates a Set with a Contains method that returns true for all runes in // the given RangeTable. func In(rt *unicode.RangeTable) Set { return setFunc(func(r rune) bool { return unicode.Is(rt, r) }) } // NotIn creates a Set with a Contains method that returns true for all runes not // in the given RangeTable. func NotIn(rt *unicode.RangeTable) Set { return setFunc(func(r rune) bool { return !unicode.Is(rt, r) }) } // Predicate creates a Set with a Contains method that returns f(r). func Predicate(f func(rune) bool) Set { return setFunc(f) } // Transformer implements the transform.Transformer interface. type Transformer struct { t transform.SpanningTransformer } func (t Transformer) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { return t.t.Transform(dst, src, atEOF) } func (t Transformer) Span(b []byte, atEOF bool) (n int, err error) { return t.t.Span(b, atEOF) } func (t Transformer) Reset() { t.t.Reset() } // Bytes returns a new byte slice with the result of converting b using t. It // calls Reset on t. It returns nil if any error was found. This can only happen // if an error-producing Transformer is passed to If. func (t Transformer) Bytes(b []byte) []byte { b, _, err := transform.Bytes(t, b) if err != nil { return nil } return b } // String returns a string with the result of converting s using t. It calls // Reset on t. It returns the empty string if any error was found. This can only // happen if an error-producing Transformer is passed to If. func (t Transformer) String(s string) string { s, _, err := transform.String(t, s) if err != nil { return "" } return s } // TODO: // - Copy: copying strings and bytes in whole-rune units. // - Validation (maybe) // - Well-formed-ness (maybe) const runeErrorString = string(utf8.RuneError) // Remove returns a Transformer that removes runes r for which s.Contains(r). // Illegal input bytes are replaced by RuneError before being passed to f. func Remove(s Set) Transformer { if f, ok := s.(setFunc); ok { // This little trick cuts the running time of BenchmarkRemove for sets // created by Predicate roughly in half. // TODO: special-case RangeTables as well. return Transformer{remove(f)} } return Transformer{remove(s.Contains)} } // TODO: remove transform.RemoveFunc. type remove func(r rune) bool func (remove) Reset() {} // Span implements transform.Spanner. func (t remove) Span(src []byte, atEOF bool) (n int, err error) { for r, size := rune(0), 0; n < len(src); { if r = rune(src[n]); r < utf8.RuneSelf { size = 1 } else if r, size = utf8.DecodeRune(src[n:]); size == 1 { // Invalid rune. if !atEOF && !utf8.FullRune(src[n:]) { err = transform.ErrShortSrc } else { err = transform.ErrEndOfSpan } break } if t(r) { err = transform.ErrEndOfSpan break } n += size } return } // Transform implements transform.Transformer. func (t remove) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { for r, size := rune(0), 0; nSrc < len(src); { if r = rune(src[nSrc]); r < utf8.RuneSelf { size = 1 } else if r, size = utf8.DecodeRune(src[nSrc:]); size == 1 { // Invalid rune. if !atEOF && !utf8.FullRune(src[nSrc:]) { err = transform.ErrShortSrc break } // We replace illegal bytes with RuneError. Not doing so might // otherwise turn a sequence of invalid UTF-8 into valid UTF-8. // The resulting byte sequence may subsequently contain runes // for which t(r) is true that were passed unnoticed. if !t(utf8.RuneError) { if nDst+3 > len(dst) { err = transform.ErrShortDst break } dst[nDst+0] = runeErrorString[0] dst[nDst+1] = runeErrorString[1] dst[nDst+2] = runeErrorString[2] nDst += 3 } nSrc++ continue } if t(r) { nSrc += size continue } if nDst+size > len(dst) { err = transform.ErrShortDst break } for i := 0; i < size; i++ { dst[nDst] = src[nSrc] nDst++ nSrc++ } } return } // Map returns a Transformer that maps the runes in the input using the given // mapping. Illegal bytes in the input are converted to utf8.RuneError before // being passed to the mapping func. func Map(mapping func(rune) rune) Transformer { return Transformer{mapper(mapping)} } type mapper func(rune) rune func (mapper) Reset() {} // Span implements transform.Spanner. func (t mapper) Span(src []byte, atEOF bool) (n int, err error) { for r, size := rune(0), 0; n < len(src); n += size { if r = rune(src[n]); r < utf8.RuneSelf { size = 1 } else if r, size = utf8.DecodeRune(src[n:]); size == 1 { // Invalid rune. if !atEOF && !utf8.FullRune(src[n:]) { err = transform.ErrShortSrc } else { err = transform.ErrEndOfSpan } break } if t(r) != r { err = transform.ErrEndOfSpan break } } return n, err } // Transform implements transform.Transformer. func (t mapper) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { var replacement rune var b [utf8.UTFMax]byte for r, size := rune(0), 0; nSrc < len(src); { if r = rune(src[nSrc]); r < utf8.RuneSelf { if replacement = t(r); replacement < utf8.RuneSelf { if nDst == len(dst) { err = transform.ErrShortDst break } dst[nDst] = byte(replacement) nDst++ nSrc++ continue } size = 1 } else if r, size = utf8.DecodeRune(src[nSrc:]); size == 1 { // Invalid rune. if !atEOF && !utf8.FullRune(src[nSrc:]) { err = transform.ErrShortSrc break } if replacement = t(utf8.RuneError); replacement == utf8.RuneError { if nDst+3 > len(dst) { err = transform.ErrShortDst break } dst[nDst+0] = runeErrorString[0] dst[nDst+1] = runeErrorString[1] dst[nDst+2] = runeErrorString[2] nDst += 3 nSrc++ continue } } else if replacement = t(r); replacement == r { if nDst+size > len(dst) { err = transform.ErrShortDst break } for i := 0; i < size; i++ { dst[nDst] = src[nSrc] nDst++ nSrc++ } continue } n := utf8.EncodeRune(b[:], replacement) if nDst+n > len(dst) { err = transform.ErrShortDst break } for i := 0; i < n; i++ { dst[nDst] = b[i] nDst++ } nSrc += size } return } // ReplaceIllFormed returns a transformer that replaces all input bytes that are // not part of a well-formed UTF-8 code sequence with utf8.RuneError. func ReplaceIllFormed() Transformer { return Transformer{&replaceIllFormed{}} } type replaceIllFormed struct{ transform.NopResetter } func (t replaceIllFormed) Span(src []byte, atEOF bool) (n int, err error) { for n < len(src) { // ASCII fast path. if src[n] < utf8.RuneSelf { n++ continue } r, size := utf8.DecodeRune(src[n:]) // Look for a valid non-ASCII rune. if r != utf8.RuneError || size != 1 { n += size continue } // Look for short source data. if !atEOF && !utf8.FullRune(src[n:]) { err = transform.ErrShortSrc break } // We have an invalid rune. err = transform.ErrEndOfSpan break } return n, err } func (t replaceIllFormed) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { for nSrc < len(src) { // ASCII fast path. if r := src[nSrc]; r < utf8.RuneSelf { if nDst == len(dst) { err = transform.ErrShortDst break } dst[nDst] = r nDst++ nSrc++ continue } // Look for a valid non-ASCII rune. if _, size := utf8.DecodeRune(src[nSrc:]); size != 1 { if size != copy(dst[nDst:], src[nSrc:nSrc+size]) { err = transform.ErrShortDst break } nDst += size nSrc += size continue } // Look for short source data. if !atEOF && !utf8.FullRune(src[nSrc:]) { err = transform.ErrShortSrc break } // We have an invalid rune. if nDst+3 > len(dst) { err = transform.ErrShortDst break } dst[nDst+0] = runeErrorString[0] dst[nDst+1] = runeErrorString[1] dst[nDst+2] = runeErrorString[2] nDst += 3 nSrc++ } return nDst, nSrc, err }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/text/runes/cond.go
vendor/golang.org/x/text/runes/cond.go
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package runes import ( "unicode/utf8" "golang.org/x/text/transform" ) // Note: below we pass invalid UTF-8 to the tIn and tNotIn transformers as is. // This is done for various reasons: // - To retain the semantics of the Nop transformer: if input is passed to a Nop // one would expect it to be unchanged. // - It would be very expensive to pass a converted RuneError to a transformer: // a transformer might need more source bytes after RuneError, meaning that // the only way to pass it safely is to create a new buffer and manage the // intermingling of RuneErrors and normal input. // - Many transformers leave ill-formed UTF-8 as is, so this is not // inconsistent. Generally ill-formed UTF-8 is only replaced if it is a // logical consequence of the operation (as for Map) or if it otherwise would // pose security concerns (as for Remove). // - An alternative would be to return an error on ill-formed UTF-8, but this // would be inconsistent with other operations. // If returns a transformer that applies tIn to consecutive runes for which // s.Contains(r) and tNotIn to consecutive runes for which !s.Contains(r). Reset // is called on tIn and tNotIn at the start of each run. A Nop transformer will // substitute a nil value passed to tIn or tNotIn. Invalid UTF-8 is translated // to RuneError to determine which transformer to apply, but is passed as is to // the respective transformer. func If(s Set, tIn, tNotIn transform.Transformer) Transformer { if tIn == nil && tNotIn == nil { return Transformer{transform.Nop} } if tIn == nil { tIn = transform.Nop } if tNotIn == nil { tNotIn = transform.Nop } sIn, ok := tIn.(transform.SpanningTransformer) if !ok { sIn = dummySpan{tIn} } sNotIn, ok := tNotIn.(transform.SpanningTransformer) if !ok { sNotIn = dummySpan{tNotIn} } a := &cond{ tIn: sIn, tNotIn: sNotIn, f: s.Contains, } a.Reset() return Transformer{a} } type dummySpan struct{ transform.Transformer } func (d dummySpan) Span(src []byte, atEOF bool) (n int, err error) { return 0, transform.ErrEndOfSpan } type cond struct { tIn, tNotIn transform.SpanningTransformer f func(rune) bool check func(rune) bool // current check to perform t transform.SpanningTransformer // current transformer to use } // Reset implements transform.Transformer. func (t *cond) Reset() { t.check = t.is t.t = t.tIn t.t.Reset() // notIn will be reset on first usage. } func (t *cond) is(r rune) bool { if t.f(r) { return true } t.check = t.isNot t.t = t.tNotIn t.tNotIn.Reset() return false } func (t *cond) isNot(r rune) bool { if !t.f(r) { return true } t.check = t.is t.t = t.tIn t.tIn.Reset() return false } // This implementation of Span doesn't help all too much, but it needs to be // there to satisfy this package's Transformer interface. // TODO: there are certainly room for improvements, though. For example, if // t.t == transform.Nop (which will a common occurrence) it will save a bundle // to special-case that loop. func (t *cond) Span(src []byte, atEOF bool) (n int, err error) { p := 0 for n < len(src) && err == nil { // Don't process too much at a time as the Spanner that will be // called on this block may terminate early. const maxChunk = 4096 max := len(src) if v := n + maxChunk; v < max { max = v } atEnd := false size := 0 current := t.t for ; p < max; p += size { r := rune(src[p]) if r < utf8.RuneSelf { size = 1 } else if r, size = utf8.DecodeRune(src[p:]); size == 1 { if !atEOF && !utf8.FullRune(src[p:]) { err = transform.ErrShortSrc break } } if !t.check(r) { // The next rune will be the start of a new run. atEnd = true break } } n2, err2 := current.Span(src[n:p], atEnd || (atEOF && p == len(src))) n += n2 if err2 != nil { return n, err2 } // At this point either err != nil or t.check will pass for the rune at p. p = n + size } return n, err } func (t *cond) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { p := 0 for nSrc < len(src) && err == nil { // Don't process too much at a time, as the work might be wasted if the // destination buffer isn't large enough to hold the result or a // transform returns an error early. const maxChunk = 4096 max := len(src) if n := nSrc + maxChunk; n < len(src) { max = n } atEnd := false size := 0 current := t.t for ; p < max; p += size { r := rune(src[p]) if r < utf8.RuneSelf { size = 1 } else if r, size = utf8.DecodeRune(src[p:]); size == 1 { if !atEOF && !utf8.FullRune(src[p:]) { err = transform.ErrShortSrc break } } if !t.check(r) { // The next rune will be the start of a new run. atEnd = true break } } nDst2, nSrc2, err2 := current.Transform(dst[nDst:], src[nSrc:p], atEnd || (atEOF && p == len(src))) nDst += nDst2 nSrc += nSrc2 if err2 != nil { return nDst, nSrc, err2 } // At this point either err != nil or t.check will pass for the rune at p. p = nSrc + size } return nDst, nSrc, err }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/crypto/argon2/argon2.go
vendor/golang.org/x/crypto/argon2/argon2.go
// Copyright 2017 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package argon2 implements the key derivation function Argon2. // Argon2 was selected as the winner of the Password Hashing Competition and can // be used to derive cryptographic keys from passwords. // // For a detailed specification of Argon2 see [argon2-specs.pdf]. // // If you aren't sure which function you need, use Argon2id (IDKey) and // the parameter recommendations for your scenario. // // # Argon2i // // Argon2i (implemented by Key) is the side-channel resistant version of Argon2. // It uses data-independent memory access, which is preferred for password // hashing and password-based key derivation. Argon2i requires more passes over // memory than Argon2id to protect from trade-off attacks. The recommended // parameters (taken from [RFC 9106 Section 7.3]) for non-interactive operations are time=3 and to // use the maximum available memory. // // # Argon2id // // Argon2id (implemented by IDKey) is a hybrid version of Argon2 combining // Argon2i and Argon2d. It uses data-independent memory access for the first // half of the first iteration over the memory and data-dependent memory access // for the rest. Argon2id is side-channel resistant and provides better brute- // force cost savings due to time-memory tradeoffs than Argon2i. The recommended // parameters for non-interactive operations (taken from [RFC 9106 Section 7.3]) are time=1 and to // use the maximum available memory. // // [argon2-specs.pdf]: https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf // [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3 package argon2 import ( "encoding/binary" "sync" "golang.org/x/crypto/blake2b" ) // The Argon2 version implemented by this package. const Version = 0x13 const ( argon2d = iota argon2i argon2id ) // Key derives a key from the password, salt, and cost parameters using Argon2i // returning a byte slice of length keyLen that can be used as cryptographic // key. The CPU cost and parallelism degree must be greater than zero. // // For example, you can get a derived key for e.g. AES-256 (which needs a // 32-byte key) by doing: // // key := argon2.Key([]byte("some password"), salt, 3, 32*1024, 4, 32) // // [RFC 9106 Section 7.3] recommends time=3, and memory=32*1024 as a sensible number. // If using that amount of memory (32 MB) is not possible in some contexts then // the time parameter can be increased to compensate. // // The time parameter specifies the number of passes over the memory and the // memory parameter specifies the size of the memory in KiB. For example // memory=32*1024 sets the memory cost to ~32 MB. The number of threads can be // adjusted to the number of available CPUs. The cost parameters should be // increased as memory latency and CPU parallelism increases. Remember to get a // good random salt. // // [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3 func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte { return deriveKey(argon2i, password, salt, nil, nil, time, memory, threads, keyLen) } // IDKey derives a key from the password, salt, and cost parameters using // Argon2id returning a byte slice of length keyLen that can be used as // cryptographic key. The CPU cost and parallelism degree must be greater than // zero. // // For example, you can get a derived key for e.g. AES-256 (which needs a // 32-byte key) by doing: // // key := argon2.IDKey([]byte("some password"), salt, 1, 64*1024, 4, 32) // // [RFC 9106 Section 7.3] recommends time=1, and memory=64*1024 as a sensible number. // If using that amount of memory (64 MB) is not possible in some contexts then // the time parameter can be increased to compensate. // // The time parameter specifies the number of passes over the memory and the // memory parameter specifies the size of the memory in KiB. For example // memory=64*1024 sets the memory cost to ~64 MB. The number of threads can be // adjusted to the numbers of available CPUs. The cost parameters should be // increased as memory latency and CPU parallelism increases. Remember to get a // good random salt. // // [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3 func IDKey(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte { return deriveKey(argon2id, password, salt, nil, nil, time, memory, threads, keyLen) } func deriveKey(mode int, password, salt, secret, data []byte, time, memory uint32, threads uint8, keyLen uint32) []byte { if time < 1 { panic("argon2: number of rounds too small") } if threads < 1 { panic("argon2: parallelism degree too low") } h0 := initHash(password, salt, secret, data, time, memory, uint32(threads), keyLen, mode) memory = memory / (syncPoints * uint32(threads)) * (syncPoints * uint32(threads)) if memory < 2*syncPoints*uint32(threads) { memory = 2 * syncPoints * uint32(threads) } B := initBlocks(&h0, memory, uint32(threads)) processBlocks(B, time, memory, uint32(threads), mode) return extractKey(B, memory, uint32(threads), keyLen) } const ( blockLength = 128 syncPoints = 4 ) type block [blockLength]uint64 func initHash(password, salt, key, data []byte, time, memory, threads, keyLen uint32, mode int) [blake2b.Size + 8]byte { var ( h0 [blake2b.Size + 8]byte params [24]byte tmp [4]byte ) b2, _ := blake2b.New512(nil) binary.LittleEndian.PutUint32(params[0:4], threads) binary.LittleEndian.PutUint32(params[4:8], keyLen) binary.LittleEndian.PutUint32(params[8:12], memory) binary.LittleEndian.PutUint32(params[12:16], time) binary.LittleEndian.PutUint32(params[16:20], uint32(Version)) binary.LittleEndian.PutUint32(params[20:24], uint32(mode)) b2.Write(params[:]) binary.LittleEndian.PutUint32(tmp[:], uint32(len(password))) b2.Write(tmp[:]) b2.Write(password) binary.LittleEndian.PutUint32(tmp[:], uint32(len(salt))) b2.Write(tmp[:]) b2.Write(salt) binary.LittleEndian.PutUint32(tmp[:], uint32(len(key))) b2.Write(tmp[:]) b2.Write(key) binary.LittleEndian.PutUint32(tmp[:], uint32(len(data))) b2.Write(tmp[:]) b2.Write(data) b2.Sum(h0[:0]) return h0 } func initBlocks(h0 *[blake2b.Size + 8]byte, memory, threads uint32) []block { var block0 [1024]byte B := make([]block, memory) for lane := uint32(0); lane < threads; lane++ { j := lane * (memory / threads) binary.LittleEndian.PutUint32(h0[blake2b.Size+4:], lane) binary.LittleEndian.PutUint32(h0[blake2b.Size:], 0) blake2bHash(block0[:], h0[:]) for i := range B[j+0] { B[j+0][i] = binary.LittleEndian.Uint64(block0[i*8:]) } binary.LittleEndian.PutUint32(h0[blake2b.Size:], 1) blake2bHash(block0[:], h0[:]) for i := range B[j+1] { B[j+1][i] = binary.LittleEndian.Uint64(block0[i*8:]) } } return B } func processBlocks(B []block, time, memory, threads uint32, mode int) { lanes := memory / threads segments := lanes / syncPoints processSegment := func(n, slice, lane uint32, wg *sync.WaitGroup) { var addresses, in, zero block if mode == argon2i || (mode == argon2id && n == 0 && slice < syncPoints/2) { in[0] = uint64(n) in[1] = uint64(lane) in[2] = uint64(slice) in[3] = uint64(memory) in[4] = uint64(time) in[5] = uint64(mode) } index := uint32(0) if n == 0 && slice == 0 { index = 2 // we have already generated the first two blocks if mode == argon2i || mode == argon2id { in[6]++ processBlock(&addresses, &in, &zero) processBlock(&addresses, &addresses, &zero) } } offset := lane*lanes + slice*segments + index var random uint64 for index < segments { prev := offset - 1 if index == 0 && slice == 0 { prev += lanes // last block in lane } if mode == argon2i || (mode == argon2id && n == 0 && slice < syncPoints/2) { if index%blockLength == 0 { in[6]++ processBlock(&addresses, &in, &zero) processBlock(&addresses, &addresses, &zero) } random = addresses[index%blockLength] } else { random = B[prev][0] } newOffset := indexAlpha(random, lanes, segments, threads, n, slice, lane, index) processBlockXOR(&B[offset], &B[prev], &B[newOffset]) index, offset = index+1, offset+1 } wg.Done() } for n := uint32(0); n < time; n++ { for slice := uint32(0); slice < syncPoints; slice++ { var wg sync.WaitGroup for lane := uint32(0); lane < threads; lane++ { wg.Add(1) go processSegment(n, slice, lane, &wg) } wg.Wait() } } } func extractKey(B []block, memory, threads, keyLen uint32) []byte { lanes := memory / threads for lane := uint32(0); lane < threads-1; lane++ { for i, v := range B[(lane*lanes)+lanes-1] { B[memory-1][i] ^= v } } var block [1024]byte for i, v := range B[memory-1] { binary.LittleEndian.PutUint64(block[i*8:], v) } key := make([]byte, keyLen) blake2bHash(key, block[:]) return key } func indexAlpha(rand uint64, lanes, segments, threads, n, slice, lane, index uint32) uint32 { refLane := uint32(rand>>32) % threads if n == 0 && slice == 0 { refLane = lane } m, s := 3*segments, ((slice+1)%syncPoints)*segments if lane == refLane { m += index } if n == 0 { m, s = slice*segments, 0 if slice == 0 || lane == refLane { m += index } } if index == 0 || lane == refLane { m-- } return phi(rand, uint64(m), uint64(s), refLane, lanes) } func phi(rand, m, s uint64, lane, lanes uint32) uint32 { p := rand & 0xFFFFFFFF p = (p * p) >> 32 p = (p * m) >> 32 return lane*lanes + uint32((s+m-(p+1))%uint64(lanes)) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/crypto/argon2/blamka_generic.go
vendor/golang.org/x/crypto/argon2/blamka_generic.go
// Copyright 2017 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package argon2 var useSSE4 bool func processBlockGeneric(out, in1, in2 *block, xor bool) { var t block for i := range t { t[i] = in1[i] ^ in2[i] } for i := 0; i < blockLength; i += 16 { blamkaGeneric( &t[i+0], &t[i+1], &t[i+2], &t[i+3], &t[i+4], &t[i+5], &t[i+6], &t[i+7], &t[i+8], &t[i+9], &t[i+10], &t[i+11], &t[i+12], &t[i+13], &t[i+14], &t[i+15], ) } for i := 0; i < blockLength/8; i += 2 { blamkaGeneric( &t[i], &t[i+1], &t[16+i], &t[16+i+1], &t[32+i], &t[32+i+1], &t[48+i], &t[48+i+1], &t[64+i], &t[64+i+1], &t[80+i], &t[80+i+1], &t[96+i], &t[96+i+1], &t[112+i], &t[112+i+1], ) } if xor { for i := range t { out[i] ^= in1[i] ^ in2[i] ^ t[i] } } else { for i := range t { out[i] = in1[i] ^ in2[i] ^ t[i] } } } func blamkaGeneric(t00, t01, t02, t03, t04, t05, t06, t07, t08, t09, t10, t11, t12, t13, t14, t15 *uint64) { v00, v01, v02, v03 := *t00, *t01, *t02, *t03 v04, v05, v06, v07 := *t04, *t05, *t06, *t07 v08, v09, v10, v11 := *t08, *t09, *t10, *t11 v12, v13, v14, v15 := *t12, *t13, *t14, *t15 v00 += v04 + 2*uint64(uint32(v00))*uint64(uint32(v04)) v12 ^= v00 v12 = v12>>32 | v12<<32 v08 += v12 + 2*uint64(uint32(v08))*uint64(uint32(v12)) v04 ^= v08 v04 = v04>>24 | v04<<40 v00 += v04 + 2*uint64(uint32(v00))*uint64(uint32(v04)) v12 ^= v00 v12 = v12>>16 | v12<<48 v08 += v12 + 2*uint64(uint32(v08))*uint64(uint32(v12)) v04 ^= v08 v04 = v04>>63 | v04<<1 v01 += v05 + 2*uint64(uint32(v01))*uint64(uint32(v05)) v13 ^= v01 v13 = v13>>32 | v13<<32 v09 += v13 + 2*uint64(uint32(v09))*uint64(uint32(v13)) v05 ^= v09 v05 = v05>>24 | v05<<40 v01 += v05 + 2*uint64(uint32(v01))*uint64(uint32(v05)) v13 ^= v01 v13 = v13>>16 | v13<<48 v09 += v13 + 2*uint64(uint32(v09))*uint64(uint32(v13)) v05 ^= v09 v05 = v05>>63 | v05<<1 v02 += v06 + 2*uint64(uint32(v02))*uint64(uint32(v06)) v14 ^= v02 v14 = v14>>32 | v14<<32 v10 += v14 + 2*uint64(uint32(v10))*uint64(uint32(v14)) v06 ^= v10 v06 = v06>>24 | v06<<40 v02 += v06 + 2*uint64(uint32(v02))*uint64(uint32(v06)) v14 ^= v02 v14 = v14>>16 | v14<<48 v10 += v14 + 2*uint64(uint32(v10))*uint64(uint32(v14)) v06 ^= v10 v06 = v06>>63 | v06<<1 v03 += v07 + 2*uint64(uint32(v03))*uint64(uint32(v07)) v15 ^= v03 v15 = v15>>32 | v15<<32 v11 += v15 + 2*uint64(uint32(v11))*uint64(uint32(v15)) v07 ^= v11 v07 = v07>>24 | v07<<40 v03 += v07 + 2*uint64(uint32(v03))*uint64(uint32(v07)) v15 ^= v03 v15 = v15>>16 | v15<<48 v11 += v15 + 2*uint64(uint32(v11))*uint64(uint32(v15)) v07 ^= v11 v07 = v07>>63 | v07<<1 v00 += v05 + 2*uint64(uint32(v00))*uint64(uint32(v05)) v15 ^= v00 v15 = v15>>32 | v15<<32 v10 += v15 + 2*uint64(uint32(v10))*uint64(uint32(v15)) v05 ^= v10 v05 = v05>>24 | v05<<40 v00 += v05 + 2*uint64(uint32(v00))*uint64(uint32(v05)) v15 ^= v00 v15 = v15>>16 | v15<<48 v10 += v15 + 2*uint64(uint32(v10))*uint64(uint32(v15)) v05 ^= v10 v05 = v05>>63 | v05<<1 v01 += v06 + 2*uint64(uint32(v01))*uint64(uint32(v06)) v12 ^= v01 v12 = v12>>32 | v12<<32 v11 += v12 + 2*uint64(uint32(v11))*uint64(uint32(v12)) v06 ^= v11 v06 = v06>>24 | v06<<40 v01 += v06 + 2*uint64(uint32(v01))*uint64(uint32(v06)) v12 ^= v01 v12 = v12>>16 | v12<<48 v11 += v12 + 2*uint64(uint32(v11))*uint64(uint32(v12)) v06 ^= v11 v06 = v06>>63 | v06<<1 v02 += v07 + 2*uint64(uint32(v02))*uint64(uint32(v07)) v13 ^= v02 v13 = v13>>32 | v13<<32 v08 += v13 + 2*uint64(uint32(v08))*uint64(uint32(v13)) v07 ^= v08 v07 = v07>>24 | v07<<40 v02 += v07 + 2*uint64(uint32(v02))*uint64(uint32(v07)) v13 ^= v02 v13 = v13>>16 | v13<<48 v08 += v13 + 2*uint64(uint32(v08))*uint64(uint32(v13)) v07 ^= v08 v07 = v07>>63 | v07<<1 v03 += v04 + 2*uint64(uint32(v03))*uint64(uint32(v04)) v14 ^= v03 v14 = v14>>32 | v14<<32 v09 += v14 + 2*uint64(uint32(v09))*uint64(uint32(v14)) v04 ^= v09 v04 = v04>>24 | v04<<40 v03 += v04 + 2*uint64(uint32(v03))*uint64(uint32(v04)) v14 ^= v03 v14 = v14>>16 | v14<<48 v09 += v14 + 2*uint64(uint32(v09))*uint64(uint32(v14)) v04 ^= v09 v04 = v04>>63 | v04<<1 *t00, *t01, *t02, *t03 = v00, v01, v02, v03 *t04, *t05, *t06, *t07 = v04, v05, v06, v07 *t08, *t09, *t10, *t11 = v08, v09, v10, v11 *t12, *t13, *t14, *t15 = v12, v13, v14, v15 }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/crypto/argon2/blamka_ref.go
vendor/golang.org/x/crypto/argon2/blamka_ref.go
// Copyright 2017 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build !amd64 || purego || !gc package argon2 func processBlock(out, in1, in2 *block) { processBlockGeneric(out, in1, in2, false) } func processBlockXOR(out, in1, in2 *block) { processBlockGeneric(out, in1, in2, true) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/crypto/argon2/blamka_amd64.go
vendor/golang.org/x/crypto/argon2/blamka_amd64.go
// Copyright 2017 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build amd64 && gc && !purego package argon2 import "golang.org/x/sys/cpu" func init() { useSSE4 = cpu.X86.HasSSE41 } //go:noescape func mixBlocksSSE2(out, a, b, c *block) //go:noescape func xorBlocksSSE2(out, a, b, c *block) //go:noescape func blamkaSSE4(b *block) func processBlockSSE(out, in1, in2 *block, xor bool) { var t block mixBlocksSSE2(&t, in1, in2, &t) if useSSE4 { blamkaSSE4(&t) } else { for i := 0; i < blockLength; i += 16 { blamkaGeneric( &t[i+0], &t[i+1], &t[i+2], &t[i+3], &t[i+4], &t[i+5], &t[i+6], &t[i+7], &t[i+8], &t[i+9], &t[i+10], &t[i+11], &t[i+12], &t[i+13], &t[i+14], &t[i+15], ) } for i := 0; i < blockLength/8; i += 2 { blamkaGeneric( &t[i], &t[i+1], &t[16+i], &t[16+i+1], &t[32+i], &t[32+i+1], &t[48+i], &t[48+i+1], &t[64+i], &t[64+i+1], &t[80+i], &t[80+i+1], &t[96+i], &t[96+i+1], &t[112+i], &t[112+i+1], ) } } if xor { xorBlocksSSE2(out, in1, in2, &t) } else { mixBlocksSSE2(out, in1, in2, &t) } } func processBlock(out, in1, in2 *block) { processBlockSSE(out, in1, in2, false) } func processBlockXOR(out, in1, in2 *block) { processBlockSSE(out, in1, in2, true) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/crypto/argon2/blake2b.go
vendor/golang.org/x/crypto/argon2/blake2b.go
// Copyright 2017 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package argon2 import ( "encoding/binary" "hash" "golang.org/x/crypto/blake2b" ) // blake2bHash computes an arbitrary long hash value of in // and writes the hash to out. func blake2bHash(out []byte, in []byte) { var b2 hash.Hash if n := len(out); n < blake2b.Size { b2, _ = blake2b.New(n, nil) } else { b2, _ = blake2b.New512(nil) } var buffer [blake2b.Size]byte binary.LittleEndian.PutUint32(buffer[:4], uint32(len(out))) b2.Write(buffer[:4]) b2.Write(in) if len(out) <= blake2b.Size { b2.Sum(out[:0]) return } outLen := len(out) b2.Sum(buffer[:0]) b2.Reset() copy(out, buffer[:32]) out = out[32:] for len(out) > blake2b.Size { b2.Write(buffer[:]) b2.Sum(buffer[:0]) copy(out, buffer[:32]) out = out[32:] b2.Reset() } if outLen%blake2b.Size > 0 { // outLen > 64 r := ((outLen + 31) / 32) - 2 // ⌈τ /32⌉-2 b2, _ = blake2b.New(outLen-32*r, nil) } b2.Write(buffer[:]) b2.Sum(out[:0]) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/crypto/curve25519/curve25519.go
vendor/golang.org/x/crypto/curve25519/curve25519.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package curve25519 provides an implementation of the X25519 function, which // performs scalar multiplication on the elliptic curve known as Curve25519 // according to [RFC 7748]. // // The curve25519 package is a wrapper for the X25519 implementation in the // crypto/ecdh package. It is [frozen] and is not accepting new features. // // [RFC 7748]: https://datatracker.ietf.org/doc/html/rfc7748 // [frozen]: https://go.dev/wiki/Frozen package curve25519 import "crypto/ecdh" // ScalarMult sets dst to the product scalar * point. // // Deprecated: when provided a low-order point, ScalarMult will set dst to all // zeroes, irrespective of the scalar. Instead, use the X25519 function, which // will return an error. func ScalarMult(dst, scalar, point *[32]byte) { if _, err := x25519(dst, scalar[:], point[:]); err != nil { // The only error condition for x25519 when the inputs are 32 bytes long // is if the output would have been the all-zero value. for i := range dst { dst[i] = 0 } } } // ScalarBaseMult sets dst to the product scalar * base where base is the // standard generator. // // It is recommended to use the X25519 function with Basepoint instead, as // copying into fixed size arrays can lead to unexpected bugs. func ScalarBaseMult(dst, scalar *[32]byte) { curve := ecdh.X25519() priv, err := curve.NewPrivateKey(scalar[:]) if err != nil { panic("curve25519: " + err.Error()) } copy(dst[:], priv.PublicKey().Bytes()) } const ( // ScalarSize is the size of the scalar input to X25519. ScalarSize = 32 // PointSize is the size of the point input to X25519. PointSize = 32 ) // Basepoint is the canonical Curve25519 generator. var Basepoint []byte var basePoint = [32]byte{9} func init() { Basepoint = basePoint[:] } // X25519 returns the result of the scalar multiplication (scalar * point), // according to RFC 7748, Section 5. scalar, point and the return value are // slices of 32 bytes. // // scalar can be generated at random, for example with crypto/rand. point should // be either Basepoint or the output of another X25519 call. // // If point is Basepoint (but not if it's a different slice with the same // contents) a precomputed implementation might be used for performance. func X25519(scalar, point []byte) ([]byte, error) { // Outline the body of function, to let the allocation be inlined in the // caller, and possibly avoid escaping to the heap. var dst [32]byte return x25519(&dst, scalar, point) } func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) { curve := ecdh.X25519() pub, err := curve.NewPublicKey(point) if err != nil { return nil, err } priv, err := curve.NewPrivateKey(scalar) if err != nil { return nil, err } out, err := priv.ECDH(pub) if err != nil { return nil, err } copy(dst[:], out) return dst[:], nil }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/crypto/blowfish/block.go
vendor/golang.org/x/crypto/blowfish/block.go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package blowfish // getNextWord returns the next big-endian uint32 value from the byte slice // at the given position in a circular manner, updating the position. func getNextWord(b []byte, pos *int) uint32 { var w uint32 j := *pos for i := 0; i < 4; i++ { w = w<<8 | uint32(b[j]) j++ if j >= len(b) { j = 0 } } *pos = j return w } // ExpandKey performs a key expansion on the given *Cipher. Specifically, it // performs the Blowfish algorithm's key schedule which sets up the *Cipher's // pi and substitution tables for calls to Encrypt. This is used, primarily, // by the bcrypt package to reuse the Blowfish key schedule during its // set up. It's unlikely that you need to use this directly. func ExpandKey(key []byte, c *Cipher) { j := 0 for i := 0; i < 18; i++ { // Using inlined getNextWord for performance. var d uint32 for k := 0; k < 4; k++ { d = d<<8 | uint32(key[j]) j++ if j >= len(key) { j = 0 } } c.p[i] ^= d } var l, r uint32 for i := 0; i < 18; i += 2 { l, r = encryptBlock(l, r, c) c.p[i], c.p[i+1] = l, r } for i := 0; i < 256; i += 2 { l, r = encryptBlock(l, r, c) c.s0[i], c.s0[i+1] = l, r } for i := 0; i < 256; i += 2 { l, r = encryptBlock(l, r, c) c.s1[i], c.s1[i+1] = l, r } for i := 0; i < 256; i += 2 { l, r = encryptBlock(l, r, c) c.s2[i], c.s2[i+1] = l, r } for i := 0; i < 256; i += 2 { l, r = encryptBlock(l, r, c) c.s3[i], c.s3[i+1] = l, r } } // This is similar to ExpandKey, but folds the salt during the key // schedule. While ExpandKey is essentially expandKeyWithSalt with an all-zero // salt passed in, reusing ExpandKey turns out to be a place of inefficiency // and specializing it here is useful. func expandKeyWithSalt(key []byte, salt []byte, c *Cipher) { j := 0 for i := 0; i < 18; i++ { c.p[i] ^= getNextWord(key, &j) } j = 0 var l, r uint32 for i := 0; i < 18; i += 2 { l ^= getNextWord(salt, &j) r ^= getNextWord(salt, &j) l, r = encryptBlock(l, r, c) c.p[i], c.p[i+1] = l, r } for i := 0; i < 256; i += 2 { l ^= getNextWord(salt, &j) r ^= getNextWord(salt, &j) l, r = encryptBlock(l, r, c) c.s0[i], c.s0[i+1] = l, r } for i := 0; i < 256; i += 2 { l ^= getNextWord(salt, &j) r ^= getNextWord(salt, &j) l, r = encryptBlock(l, r, c) c.s1[i], c.s1[i+1] = l, r } for i := 0; i < 256; i += 2 { l ^= getNextWord(salt, &j) r ^= getNextWord(salt, &j) l, r = encryptBlock(l, r, c) c.s2[i], c.s2[i+1] = l, r } for i := 0; i < 256; i += 2 { l ^= getNextWord(salt, &j) r ^= getNextWord(salt, &j) l, r = encryptBlock(l, r, c) c.s3[i], c.s3[i+1] = l, r } } func encryptBlock(l, r uint32, c *Cipher) (uint32, uint32) { xl, xr := l, r xl ^= c.p[0] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[1] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[2] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[3] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[4] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[5] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[6] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[7] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[8] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[9] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[10] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[11] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[12] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[13] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[14] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[15] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[16] xr ^= c.p[17] return xr, xl } func decryptBlock(l, r uint32, c *Cipher) (uint32, uint32) { xl, xr := l, r xl ^= c.p[17] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[16] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[15] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[14] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[13] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[12] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[11] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[10] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[9] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[8] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[7] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[6] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[5] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[4] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[3] xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[2] xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[1] xr ^= c.p[0] return xr, xl }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/crypto/blowfish/cipher.go
vendor/golang.org/x/crypto/blowfish/cipher.go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package blowfish implements Bruce Schneier's Blowfish encryption algorithm. // // Blowfish is a legacy cipher and its short block size makes it vulnerable to // birthday bound attacks (see https://sweet32.info). It should only be used // where compatibility with legacy systems, not security, is the goal. // // Deprecated: any new system should use AES (from crypto/aes, if necessary in // an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from // golang.org/x/crypto/chacha20poly1305). package blowfish // The code is a port of Bruce Schneier's C implementation. // See https://www.schneier.com/blowfish.html. import "strconv" // The Blowfish block size in bytes. const BlockSize = 8 // A Cipher is an instance of Blowfish encryption using a particular key. type Cipher struct { p [18]uint32 s0, s1, s2, s3 [256]uint32 } type KeySizeError int func (k KeySizeError) Error() string { return "crypto/blowfish: invalid key size " + strconv.Itoa(int(k)) } // NewCipher creates and returns a Cipher. // The key argument should be the Blowfish key, from 1 to 56 bytes. func NewCipher(key []byte) (*Cipher, error) { var result Cipher if k := len(key); k < 1 || k > 56 { return nil, KeySizeError(k) } initCipher(&result) ExpandKey(key, &result) return &result, nil } // NewSaltedCipher creates a returns a Cipher that folds a salt into its key // schedule. For most purposes, NewCipher, instead of NewSaltedCipher, is // sufficient and desirable. For bcrypt compatibility, the key can be over 56 // bytes. func NewSaltedCipher(key, salt []byte) (*Cipher, error) { if len(salt) == 0 { return NewCipher(key) } var result Cipher if k := len(key); k < 1 { return nil, KeySizeError(k) } initCipher(&result) expandKeyWithSalt(key, salt, &result) return &result, nil } // BlockSize returns the Blowfish block size, 8 bytes. // It is necessary to satisfy the Block interface in the // package "crypto/cipher". func (c *Cipher) BlockSize() int { return BlockSize } // Encrypt encrypts the 8-byte buffer src using the key k // and stores the result in dst. // Note that for amounts of data larger than a block, // it is not safe to just call Encrypt on successive blocks; // instead, use an encryption mode like CBC (see crypto/cipher/cbc.go). func (c *Cipher) Encrypt(dst, src []byte) { l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3]) r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7]) l, r = encryptBlock(l, r, c) dst[0], dst[1], dst[2], dst[3] = byte(l>>24), byte(l>>16), byte(l>>8), byte(l) dst[4], dst[5], dst[6], dst[7] = byte(r>>24), byte(r>>16), byte(r>>8), byte(r) } // Decrypt decrypts the 8-byte buffer src using the key k // and stores the result in dst. func (c *Cipher) Decrypt(dst, src []byte) { l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3]) r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7]) l, r = decryptBlock(l, r, c) dst[0], dst[1], dst[2], dst[3] = byte(l>>24), byte(l>>16), byte(l>>8), byte(l) dst[4], dst[5], dst[6], dst[7] = byte(r>>24), byte(r>>16), byte(r>>8), byte(r) } func initCipher(c *Cipher) { copy(c.p[0:], p[0:]) copy(c.s0[0:], s0[0:]) copy(c.s1[0:], s1[0:]) copy(c.s2[0:], s2[0:]) copy(c.s3[0:], s3[0:]) }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false
jesseduffield/lazygit
https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/vendor/golang.org/x/crypto/blowfish/const.go
vendor/golang.org/x/crypto/blowfish/const.go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // The startup permutation array and substitution boxes. // They are the hexadecimal digits of PI; see: // https://www.schneier.com/code/constants.txt. package blowfish var s0 = [256]uint32{ 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a, } var s1 = [256]uint32{ 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7, } var s2 = [256]uint32{ 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0, } var s3 = [256]uint32{ 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6, } var p = [18]uint32{ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b, }
go
MIT
80dd695d7a8d32714603f5a6307f26f589802b1d
2026-01-07T08:35:43.445894Z
false