Merge pull request #4328 from thaJeztah/bump_x_text
vendor: golang.org/x/text v0.3.3 (CVE-2020-14040)
This commit is contained in:
commit
bf672cccee
@ -47,7 +47,7 @@ go.opencensus.io v0.22.0
|
|||||||
golang.org/x/net f3200d17e092c607f615320ecaad13d87ad9a2b3
|
golang.org/x/net f3200d17e092c607f615320ecaad13d87ad9a2b3
|
||||||
golang.org/x/sync 42b317875d0fa942474b76e1b46a6060d720ae6e
|
golang.org/x/sync 42b317875d0fa942474b76e1b46a6060d720ae6e
|
||||||
golang.org/x/sys 5c8b2ff67527cb88b770f693cebf3799036d8bc0
|
golang.org/x/sys 5c8b2ff67527cb88b770f693cebf3799036d8bc0
|
||||||
golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4
|
golang.org/x/text v0.3.3
|
||||||
google.golang.org/genproto e50cd9704f63023d62cd06a1994b98227fc4d21a
|
google.golang.org/genproto e50cd9704f63023d62cd06a1994b98227fc4d21a
|
||||||
google.golang.org/grpc v1.27.1
|
google.golang.org/grpc v1.27.1
|
||||||
gotest.tools/v3 v3.0.2
|
gotest.tools/v3 v3.0.2
|
||||||
|
23
vendor/golang.org/x/text/README
generated
vendored
23
vendor/golang.org/x/text/README
generated
vendored
@ -1,23 +0,0 @@
|
|||||||
This repository holds supplementary Go libraries for text processing, many involving Unicode.
|
|
||||||
|
|
||||||
To submit changes to this repository, see http://golang.org/doc/contribute.html.
|
|
||||||
|
|
||||||
To generate the tables in this repository (except for the encoding tables),
|
|
||||||
run go generate from this directory. By default tables are generated for the
|
|
||||||
Unicode version in core and the CLDR version defined in
|
|
||||||
golang.org/x/text/unicode/cldr.
|
|
||||||
|
|
||||||
Running go generate will as a side effect create a DATA subdirectory in this
|
|
||||||
directory which holds all files that are used as a source for generating the
|
|
||||||
tables. This directory will also serve as a cache.
|
|
||||||
|
|
||||||
Run
|
|
||||||
|
|
||||||
go test ./...
|
|
||||||
|
|
||||||
from this directory to run all tests. Add the "-tags icu" flag to also run
|
|
||||||
ICU conformance tests (if available). This requires that you have the correct
|
|
||||||
ICU version installed on your system.
|
|
||||||
|
|
||||||
TODO:
|
|
||||||
- updating unversioned source files.
|
|
93
vendor/golang.org/x/text/README.md
generated
vendored
Normal file
93
vendor/golang.org/x/text/README.md
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
# Go Text
|
||||||
|
|
||||||
|
This repository holds supplementary Go libraries for text processing, many involving Unicode.
|
||||||
|
|
||||||
|
## Semantic Versioning
|
||||||
|
This repo uses Semantic versioning (http://semver.org/), so
|
||||||
|
1. MAJOR version when you make incompatible API changes,
|
||||||
|
1. MINOR version when you add functionality in a backwards-compatible manner,
|
||||||
|
and
|
||||||
|
1. PATCH version when you make backwards-compatible bug fixes.
|
||||||
|
|
||||||
|
Until version 1.0.0 of x/text is reached, the minor version is considered a
|
||||||
|
major version. So going from 0.1.0 to 0.2.0 is considered to be a major version
|
||||||
|
bump.
|
||||||
|
|
||||||
|
A major new CLDR version is mapped to a minor version increase in x/text.
|
||||||
|
Any other new CLDR version is mapped to a patch version increase in x/text.
|
||||||
|
|
||||||
|
It is important that the Unicode version used in `x/text` matches the one used
|
||||||
|
by your Go compiler. The `x/text` repository supports multiple versions of
|
||||||
|
Unicode and will match the version of Unicode to that of the Go compiler. At the
|
||||||
|
moment this is supported for Go compilers from version 1.7.
|
||||||
|
|
||||||
|
## Download/Install
|
||||||
|
|
||||||
|
The easiest way to install is to run `go get -u golang.org/x/text`. You can
|
||||||
|
also manually git clone the repository to `$GOPATH/src/golang.org/x/text`.
|
||||||
|
|
||||||
|
## Contribute
|
||||||
|
To submit changes to this repository, see http://golang.org/doc/contribute.html.
|
||||||
|
|
||||||
|
To generate the tables in this repository (except for the encoding tables),
|
||||||
|
run go generate from this directory. By default tables are generated for the
|
||||||
|
Unicode version in core and the CLDR version defined in
|
||||||
|
golang.org/x/text/unicode/cldr.
|
||||||
|
|
||||||
|
Running go generate will as a side effect create a DATA subdirectory in this
|
||||||
|
directory, which holds all files that are used as a source for generating the
|
||||||
|
tables. This directory will also serve as a cache.
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
Run
|
||||||
|
|
||||||
|
go test ./...
|
||||||
|
|
||||||
|
from this directory to run all tests. Add the "-tags icu" flag to also run
|
||||||
|
ICU conformance tests (if available). This requires that you have the correct
|
||||||
|
ICU version installed on your system.
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
- updating unversioned source files.
|
||||||
|
|
||||||
|
## Generating Tables
|
||||||
|
|
||||||
|
To generate the tables in this repository (except for the encoding
|
||||||
|
tables), run `go generate` from this directory. By default tables are
|
||||||
|
generated for the Unicode version in core and the CLDR version defined in
|
||||||
|
golang.org/x/text/unicode/cldr.
|
||||||
|
|
||||||
|
Running go generate will as a side effect create a DATA subdirectory in this
|
||||||
|
directory which holds all files that are used as a source for generating the
|
||||||
|
tables. This directory will also serve as a cache.
|
||||||
|
|
||||||
|
## Versions
|
||||||
|
To update a Unicode version run
|
||||||
|
|
||||||
|
UNICODE_VERSION=x.x.x go generate
|
||||||
|
|
||||||
|
where `x.x.x` must correspond to a directory in https://www.unicode.org/Public/.
|
||||||
|
If this version is newer than the version in core it will also update the
|
||||||
|
relevant packages there. The idna package in x/net will always be updated.
|
||||||
|
|
||||||
|
To update a CLDR version run
|
||||||
|
|
||||||
|
CLDR_VERSION=version go generate
|
||||||
|
|
||||||
|
where `version` must correspond to a directory in
|
||||||
|
https://www.unicode.org/Public/cldr/.
|
||||||
|
|
||||||
|
Note that the code gets adapted over time to changes in the data and that
|
||||||
|
backwards compatibility is not maintained.
|
||||||
|
So updating to a different version may not work.
|
||||||
|
|
||||||
|
The files in DATA/{iana|icu|w3|whatwg} are currently not versioned.
|
||||||
|
|
||||||
|
## Report Issues / Send Patches
|
||||||
|
|
||||||
|
This repository uses Gerrit for code changes. To learn how to submit changes to
|
||||||
|
this repository, see https://golang.org/doc/contribute.html.
|
||||||
|
|
||||||
|
The main issue tracker for the image repository is located at
|
||||||
|
https://github.com/golang/go/issues. Prefix your issue with "x/text:" in the
|
||||||
|
subject line, so it is easy to find.
|
5
vendor/golang.org/x/text/go.mod
generated
vendored
Normal file
5
vendor/golang.org/x/text/go.mod
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module golang.org/x/text
|
||||||
|
|
||||||
|
require golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e
|
||||||
|
|
||||||
|
go 1.11
|
8
vendor/golang.org/x/text/secure/bidirule/bidirule.go
generated
vendored
8
vendor/golang.org/x/text/secure/bidirule/bidirule.go
generated
vendored
@ -155,6 +155,7 @@ func DirectionString(s string) bidi.Direction {
|
|||||||
e, sz := bidi.LookupString(s[i:])
|
e, sz := bidi.LookupString(s[i:])
|
||||||
if sz == 0 {
|
if sz == 0 {
|
||||||
i++
|
i++
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
c := e.Class()
|
c := e.Class()
|
||||||
if c == bidi.R || c == bidi.AL || c == bidi.AN {
|
if c == bidi.R || c == bidi.AL || c == bidi.AN {
|
||||||
@ -202,13 +203,6 @@ func (t *Transformer) isRTL() bool {
|
|||||||
return t.seen&isRTL != 0
|
return t.seen&isRTL != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Transformer) isFinal() bool {
|
|
||||||
if !t.isRTL() {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset implements transform.Transformer.
|
// Reset implements transform.Transformer.
|
||||||
func (t *Transformer) Reset() { *t = Transformer{} }
|
func (t *Transformer) Reset() { *t = Transformer{} }
|
||||||
|
|
||||||
|
11
vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go
generated
vendored
Normal file
11
vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright 2016 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build go1.10
|
||||||
|
|
||||||
|
package bidirule
|
||||||
|
|
||||||
|
func (t *Transformer) isFinal() bool {
|
||||||
|
return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial
|
||||||
|
}
|
14
vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go
generated
vendored
Normal file
14
vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// Copyright 2016 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !go1.10
|
||||||
|
|
||||||
|
package bidirule
|
||||||
|
|
||||||
|
func (t *Transformer) isFinal() bool {
|
||||||
|
if !t.isRTL() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial
|
||||||
|
}
|
12
vendor/golang.org/x/text/transform/transform.go
generated
vendored
12
vendor/golang.org/x/text/transform/transform.go
generated
vendored
@ -78,8 +78,8 @@ type SpanningTransformer interface {
|
|||||||
// considering the error err.
|
// considering the error err.
|
||||||
//
|
//
|
||||||
// A nil error means that all input bytes are known to be identical to the
|
// 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 be returned
|
// output produced by the Transformer. A nil error can be returned
|
||||||
// regardless of whether atEOF is true. If err is nil, then then n must
|
// regardless of whether atEOF is true. If err is nil, then n must
|
||||||
// equal len(src); the converse is not necessarily true.
|
// equal len(src); the converse is not necessarily true.
|
||||||
//
|
//
|
||||||
// ErrEndOfSpan means that the Transformer output may differ from the
|
// ErrEndOfSpan means that the Transformer output may differ from the
|
||||||
@ -493,7 +493,7 @@ func (c *chain) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err erro
|
|||||||
return dstL.n, srcL.p, err
|
return dstL.n, srcL.p, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: use runes.Remove instead.
|
// Deprecated: Use runes.Remove instead.
|
||||||
func RemoveFunc(f func(r rune) bool) Transformer {
|
func RemoveFunc(f func(r rune) bool) Transformer {
|
||||||
return removeF(f)
|
return removeF(f)
|
||||||
}
|
}
|
||||||
@ -648,7 +648,8 @@ func String(t Transformer, s string) (result string, n int, err error) {
|
|||||||
// Transform the remaining input, growing dst and src buffers as necessary.
|
// Transform the remaining input, growing dst and src buffers as necessary.
|
||||||
for {
|
for {
|
||||||
n := copy(src, s[pSrc:])
|
n := copy(src, s[pSrc:])
|
||||||
nDst, nSrc, err := t.Transform(dst[pDst:], src[:n], pSrc+n == len(s))
|
atEOF := pSrc+n == len(s)
|
||||||
|
nDst, nSrc, err := t.Transform(dst[pDst:], src[:n], atEOF)
|
||||||
pDst += nDst
|
pDst += nDst
|
||||||
pSrc += nSrc
|
pSrc += nSrc
|
||||||
|
|
||||||
@ -659,6 +660,9 @@ func String(t Transformer, s string) (result string, n int, err error) {
|
|||||||
dst = grow(dst, pDst)
|
dst = grow(dst, pDst)
|
||||||
}
|
}
|
||||||
} else if err == ErrShortSrc {
|
} else if err == ErrShortSrc {
|
||||||
|
if atEOF {
|
||||||
|
return string(dst[:pDst]), pSrc, err
|
||||||
|
}
|
||||||
if nSrc == 0 {
|
if nSrc == 0 {
|
||||||
src = grow(src, 0)
|
src = grow(src, 0)
|
||||||
}
|
}
|
||||||
|
2
vendor/golang.org/x/text/unicode/bidi/bidi.go
generated
vendored
2
vendor/golang.org/x/text/unicode/bidi/bidi.go
generated
vendored
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// Package bidi contains functionality for bidirectional text support.
|
// Package bidi contains functionality for bidirectional text support.
|
||||||
//
|
//
|
||||||
// See http://www.unicode.org/reports/tr9.
|
// See https://www.unicode.org/reports/tr9.
|
||||||
//
|
//
|
||||||
// NOTE: UNDER CONSTRUCTION. This API may change in backwards incompatible ways
|
// NOTE: UNDER CONSTRUCTION. This API may change in backwards incompatible ways
|
||||||
// and without notice.
|
// and without notice.
|
||||||
|
4
vendor/golang.org/x/text/unicode/bidi/bracket.go
generated
vendored
4
vendor/golang.org/x/text/unicode/bidi/bracket.go
generated
vendored
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
// This file contains a port of the reference implementation of the
|
// This file contains a port of the reference implementation of the
|
||||||
// Bidi Parentheses Algorithm:
|
// Bidi Parentheses Algorithm:
|
||||||
// http://www.unicode.org/Public/PROGRAMS/BidiReferenceJava/BidiPBAReference.java
|
// https://www.unicode.org/Public/PROGRAMS/BidiReferenceJava/BidiPBAReference.java
|
||||||
//
|
//
|
||||||
// The implementation in this file covers definitions BD14-BD16 and rule N0
|
// The implementation in this file covers definitions BD14-BD16 and rule N0
|
||||||
// of UAX#9.
|
// of UAX#9.
|
||||||
@ -246,7 +246,7 @@ func (p *bracketPairer) getStrongTypeN0(index int) Class {
|
|||||||
// assuming the given embedding direction.
|
// assuming the given embedding direction.
|
||||||
//
|
//
|
||||||
// It returns ON if no strong type is found. If a single strong type is found,
|
// It returns ON if no strong type is found. If a single strong type is found,
|
||||||
// it returns this this type. Otherwise it returns the embedding direction.
|
// it returns this type. Otherwise it returns the embedding direction.
|
||||||
//
|
//
|
||||||
// TODO: use separate type for "strong" directionality.
|
// TODO: use separate type for "strong" directionality.
|
||||||
func (p *bracketPairer) classifyPairContent(loc bracketPair, dirEmbed Class) Class {
|
func (p *bracketPairer) classifyPairContent(loc bracketPair, dirEmbed Class) Class {
|
||||||
|
10
vendor/golang.org/x/text/unicode/bidi/core.go
generated
vendored
10
vendor/golang.org/x/text/unicode/bidi/core.go
generated
vendored
@ -7,7 +7,7 @@ package bidi
|
|||||||
import "log"
|
import "log"
|
||||||
|
|
||||||
// This implementation is a port based on the reference implementation found at:
|
// This implementation is a port based on the reference implementation found at:
|
||||||
// http://www.unicode.org/Public/PROGRAMS/BidiReferenceJava/
|
// https://www.unicode.org/Public/PROGRAMS/BidiReferenceJava/
|
||||||
//
|
//
|
||||||
// described in Unicode Bidirectional Algorithm (UAX #9).
|
// described in Unicode Bidirectional Algorithm (UAX #9).
|
||||||
//
|
//
|
||||||
@ -480,15 +480,15 @@ func (s *isolatingRunSequence) resolveWeakTypes() {
|
|||||||
|
|
||||||
// Rule W1.
|
// Rule W1.
|
||||||
// Changes all NSMs.
|
// Changes all NSMs.
|
||||||
preceedingCharacterType := s.sos
|
precedingCharacterType := s.sos
|
||||||
for i, t := range s.types {
|
for i, t := range s.types {
|
||||||
if t == NSM {
|
if t == NSM {
|
||||||
s.types[i] = preceedingCharacterType
|
s.types[i] = precedingCharacterType
|
||||||
} else {
|
} else {
|
||||||
if t.in(LRI, RLI, FSI, PDI) {
|
if t.in(LRI, RLI, FSI, PDI) {
|
||||||
preceedingCharacterType = ON
|
precedingCharacterType = ON
|
||||||
}
|
}
|
||||||
preceedingCharacterType = t
|
precedingCharacterType = t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1815
vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go
generated
vendored
Normal file
1815
vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1887
vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go
generated
vendored
Normal file
1887
vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1923
vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go
generated
vendored
Normal file
1923
vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,7 @@
|
|||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build !go1.10
|
||||||
|
|
||||||
package bidi
|
package bidi
|
||||||
|
|
||||||
// UnicodeVersion is the Unicode version from which the tables in this package are derived.
|
// UnicodeVersion is the Unicode version from which the tables in this package are derived.
|
8
vendor/golang.org/x/text/unicode/norm/composition.go
generated
vendored
8
vendor/golang.org/x/text/unicode/norm/composition.go
generated
vendored
@ -407,7 +407,7 @@ func decomposeHangul(buf []byte, r rune) int {
|
|||||||
|
|
||||||
// decomposeHangul algorithmically decomposes a Hangul rune into
|
// decomposeHangul algorithmically decomposes a Hangul rune into
|
||||||
// its Jamo components.
|
// its Jamo components.
|
||||||
// See http://unicode.org/reports/tr15/#Hangul for details on decomposing Hangul.
|
// See https://unicode.org/reports/tr15/#Hangul for details on decomposing Hangul.
|
||||||
func (rb *reorderBuffer) decomposeHangul(r rune) {
|
func (rb *reorderBuffer) decomposeHangul(r rune) {
|
||||||
r -= hangulBase
|
r -= hangulBase
|
||||||
x := r % jamoTCount
|
x := r % jamoTCount
|
||||||
@ -420,7 +420,7 @@ func (rb *reorderBuffer) decomposeHangul(r rune) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// combineHangul algorithmically combines Jamo character components into Hangul.
|
// combineHangul algorithmically combines Jamo character components into Hangul.
|
||||||
// See http://unicode.org/reports/tr15/#Hangul for details on combining Hangul.
|
// See https://unicode.org/reports/tr15/#Hangul for details on combining Hangul.
|
||||||
func (rb *reorderBuffer) combineHangul(s, i, k int) {
|
func (rb *reorderBuffer) combineHangul(s, i, k int) {
|
||||||
b := rb.rune[:]
|
b := rb.rune[:]
|
||||||
bn := rb.nrune
|
bn := rb.nrune
|
||||||
@ -461,6 +461,10 @@ func (rb *reorderBuffer) combineHangul(s, i, k int) {
|
|||||||
// It should only be used to recompose a single segment, as it will not
|
// It should only be used to recompose a single segment, as it will not
|
||||||
// handle alternations between Hangul and non-Hangul characters correctly.
|
// handle alternations between Hangul and non-Hangul characters correctly.
|
||||||
func (rb *reorderBuffer) compose() {
|
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
|
// UAX #15, section X5 , including Corrigendum #5
|
||||||
// "In any character sequence beginning with starter S, a character C is
|
// "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
|
// blocked from S if and only if there is some character B between S
|
||||||
|
19
vendor/golang.org/x/text/unicode/norm/forminfo.go
generated
vendored
19
vendor/golang.org/x/text/unicode/norm/forminfo.go
generated
vendored
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
package norm
|
package norm
|
||||||
|
|
||||||
|
import "encoding/binary"
|
||||||
|
|
||||||
// This file contains Form-specific logic and wrappers for data in tables.go.
|
// 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
|
// Rune info is stored in a separate trie per composing form. A composing form
|
||||||
@ -178,6 +180,17 @@ func (p Properties) TrailCCC() uint8 {
|
|||||||
return ccc[p.tccc]
|
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
|
// Recomposition
|
||||||
// We use 32-bit keys instead of 64-bit for the two codepoint keys.
|
// 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
|
// This clips off the bits of three entries, but we know this will not
|
||||||
@ -186,8 +199,14 @@ func (p Properties) TrailCCC() uint8 {
|
|||||||
// Note that the recomposition map for NFC and NFKC are identical.
|
// Note that the recomposition map for NFC and NFKC are identical.
|
||||||
|
|
||||||
// combine returns the combined rune or 0 if it doesn't exist.
|
// 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 {
|
func combine(a, b rune) rune {
|
||||||
key := uint32(uint16(a))<<16 + uint32(uint16(b))
|
key := uint32(uint16(a))<<16 + uint32(uint16(b))
|
||||||
|
if recompMap == nil {
|
||||||
|
panic("caller error") // see func comment
|
||||||
|
}
|
||||||
return recompMap[key]
|
return recompMap[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
vendor/golang.org/x/text/unicode/norm/iter.go
generated
vendored
3
vendor/golang.org/x/text/unicode/norm/iter.go
generated
vendored
@ -128,8 +128,9 @@ func (i *Iter) Next() []byte {
|
|||||||
func nextASCIIBytes(i *Iter) []byte {
|
func nextASCIIBytes(i *Iter) []byte {
|
||||||
p := i.p + 1
|
p := i.p + 1
|
||||||
if p >= i.rb.nsrc {
|
if p >= i.rb.nsrc {
|
||||||
|
p0 := i.p
|
||||||
i.setDone()
|
i.setDone()
|
||||||
return i.rb.src.bytes[i.p:p]
|
return i.rb.src.bytes[p0:p]
|
||||||
}
|
}
|
||||||
if i.rb.src.bytes[p] < utf8.RuneSelf {
|
if i.rb.src.bytes[p] < utf8.RuneSelf {
|
||||||
p0 := i.p
|
p0 := i.p
|
||||||
|
4
vendor/golang.org/x/text/unicode/norm/normalize.go
generated
vendored
4
vendor/golang.org/x/text/unicode/norm/normalize.go
generated
vendored
@ -29,8 +29,8 @@ import (
|
|||||||
// proceed independently on both sides:
|
// proceed independently on both sides:
|
||||||
// f(x) == append(f(x[0:n]), f(x[n:])...)
|
// f(x) == append(f(x[0:n]), f(x[n:])...)
|
||||||
//
|
//
|
||||||
// References: http://unicode.org/reports/tr15/ and
|
// References: https://unicode.org/reports/tr15/ and
|
||||||
// http://unicode.org/notes/tn5/.
|
// https://unicode.org/notes/tn5/.
|
||||||
type Form int
|
type Form int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
4
vendor/golang.org/x/text/unicode/norm/readwriter.go
generated
vendored
4
vendor/golang.org/x/text/unicode/norm/readwriter.go
generated
vendored
@ -60,8 +60,8 @@ func (w *normWriter) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Writer returns a new writer that implements Write(b)
|
// Writer returns a new writer that implements Write(b)
|
||||||
// by writing f(b) to w. The returned writer may use an
|
// by writing f(b) to w. The returned writer may use an
|
||||||
// an internal buffer to maintain state across Write calls.
|
// internal buffer to maintain state across Write calls.
|
||||||
// Calling its Close method writes any buffered data to w.
|
// Calling its Close method writes any buffered data to w.
|
||||||
func (f Form) Writer(w io.Writer) io.WriteCloser {
|
func (f Form) Writer(w io.Writer) io.WriteCloser {
|
||||||
wr := &normWriter{rb: reorderBuffer{}, w: w}
|
wr := &normWriter{rb: reorderBuffer{}, w: w}
|
||||||
|
7657
vendor/golang.org/x/text/unicode/norm/tables10.0.0.go
generated
vendored
Normal file
7657
vendor/golang.org/x/text/unicode/norm/tables10.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7693
vendor/golang.org/x/text/unicode/norm/tables11.0.0.go
generated
vendored
Normal file
7693
vendor/golang.org/x/text/unicode/norm/tables11.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7710
vendor/golang.org/x/text/unicode/norm/tables12.0.0.go
generated
vendored
Normal file
7710
vendor/golang.org/x/text/unicode/norm/tables12.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
12
vendor/golang.org/x/text/unicode/norm/transform.go
generated
vendored
12
vendor/golang.org/x/text/unicode/norm/transform.go
generated
vendored
@ -18,7 +18,6 @@ func (Form) Reset() {}
|
|||||||
// Users should either catch ErrShortDst and allow dst to grow or have dst be at
|
// Users should either catch ErrShortDst and allow dst to grow or have dst be at
|
||||||
// least of size MaxTransformChunkSize to be guaranteed of progress.
|
// least of size MaxTransformChunkSize to be guaranteed of progress.
|
||||||
func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
|
func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
|
||||||
n := 0
|
|
||||||
// Cap the maximum number of src bytes to check.
|
// Cap the maximum number of src bytes to check.
|
||||||
b := src
|
b := src
|
||||||
eof := atEOF
|
eof := atEOF
|
||||||
@ -27,20 +26,21 @@ func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error)
|
|||||||
eof = false
|
eof = false
|
||||||
b = b[:ns]
|
b = b[:ns]
|
||||||
}
|
}
|
||||||
i, ok := formTable[f].quickSpan(inputBytes(b), n, len(b), eof)
|
i, ok := formTable[f].quickSpan(inputBytes(b), 0, len(b), eof)
|
||||||
n += copy(dst[n:], b[n:i])
|
n := copy(dst, b[:i])
|
||||||
if !ok {
|
if !ok {
|
||||||
nDst, nSrc, err = f.transform(dst[n:], src[n:], atEOF)
|
nDst, nSrc, err = f.transform(dst[n:], src[n:], atEOF)
|
||||||
return nDst + n, nSrc + n, err
|
return nDst + n, nSrc + n, err
|
||||||
}
|
}
|
||||||
if n < len(src) && !atEOF {
|
|
||||||
|
if err == nil && n < len(src) && !atEOF {
|
||||||
err = transform.ErrShortSrc
|
err = transform.ErrShortSrc
|
||||||
}
|
}
|
||||||
return n, n, err
|
return n, n, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func flushTransform(rb *reorderBuffer) bool {
|
func flushTransform(rb *reorderBuffer) bool {
|
||||||
// Write out (must fully fit in dst, or else it is a ErrShortDst).
|
// Write out (must fully fit in dst, or else it is an ErrShortDst).
|
||||||
if len(rb.out) < rb.nrune*utf8.UTFMax {
|
if len(rb.out) < rb.nrune*utf8.UTFMax {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ func (f Form) transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error)
|
|||||||
nSrc += n
|
nSrc += n
|
||||||
nDst += n
|
nDst += n
|
||||||
if ok {
|
if ok {
|
||||||
if n < rb.nsrc && !atEOF {
|
if err == nil && n < rb.nsrc && !atEOF {
|
||||||
err = transform.ErrShortSrc
|
err = transform.ErrShortSrc
|
||||||
}
|
}
|
||||||
return nDst, nSrc, err
|
return nDst, nSrc, err
|
||||||
|
Loading…
Reference in New Issue
Block a user