// 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 { … } type dummySpan … func (d dummySpan) Span(src []byte, atEOF bool) (n int, err error) { … } type cond … // Reset implements transform.Transformer. func (t *cond) Reset() { … } func (t *cond) is(r rune) bool { … } func (t *cond) isNot(r rune) bool { … } // 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) { … } func (t *cond) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { … }