1
2
3
4
5 package cases
6
7 import "golang.org/x/text/transform"
8
9 type caseFolder struct{ transform.NopResetter }
10
11
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
31
32
33 return &caseFolder{}
34 }
35
View as plain text