github.com/mdaxf/iac@v0.0.0-20240519030858-58a061660378/vendor_skip/golang.org/x/text/cases/fold.go (about) 1 // Copyright 2016 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package cases 6 7 import "golang.org/x/text/transform" 8 9 type caseFolder struct{ transform.NopResetter } 10 11 // caseFolder implements the Transformer interface for doing case folding. 12 func (t *caseFolder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { 13 c := context{dst: dst, src: src, atEOF: atEOF} 14 for c.next() { 15 foldFull(&c) 16 c.checkpoint() 17 } 18 return c.ret() 19 } 20 21 func (t *caseFolder) Span(src []byte, atEOF bool) (n int, err error) { 22 c := context{src: src, atEOF: atEOF} 23 for c.next() && isFoldFull(&c) { 24 c.checkpoint() 25 } 26 return c.retSpan() 27 } 28 29 func makeFold(o options) transform.SpanningTransformer { 30 // TODO: Special case folding, through option Language, Special/Turkic, or 31 // both. 32 // TODO: Implement Compact options. 33 return &caseFolder{} 34 }