Debian Codegraph @

autoversion/textseg/version_agnostic.go

raw
1 package textseg
2
3 // The functions in this file are not currently specific to a given version of
4 // go-textseg and so we just call into the version from the latest upstream
5 // major version in all cases.
6
7 import (
8 "bufio"
9
10 realImpl "github.com/apparentlymart/go-textseg/v12/textseg"
11 )
12
13 // ScanUTF8Sequences is a split function for bufio.Scanner that splits on UTF8 sequence boundaries.
14 //
15 // This is included largely for completeness, since this behavior is already built in to Go when ranging over a string.
16 func ScanUTF8Sequences(data []byte, atEOF bool) (int, []byte, error) {
17 return realImpl.ScanUTF8Sequences(data, atEOF)
18 }
19
20 // TokenCount is a utility that uses a bufio.SplitFunc to count the number of recognized tokens in the given buffer.
21 func TokenCount(buf []byte, splitFunc bufio.SplitFunc) (int, error) {
22 return realImpl.TokenCount(buf, splitFunc)
23 }
24
25 // AllTokens is a utility that uses a bufio.SplitFunc to produce a slice of all of the recognized tokens in the given buffer.
26 func AllTokens(buf []byte, splitFunc bufio.SplitFunc) ([][]byte, error) {
27 return realImpl.AllTokens(buf, splitFunc)
28 }