mirror of
https://github.com/diamondburned/cchat.git
synced 2024-10-31 20:04:33 +00:00
Added SplitFunc helper type
This commit adds the SplitFunc helper type which has a function signature matching that of ArgsIndexer and SplitIndexer. Implementations can use this type to provide pluggable splitters.
This commit is contained in:
parent
289eda1c25
commit
10549e49e1
|
@ -4,6 +4,15 @@ package split
|
||||||
|
|
||||||
import "unicode/utf8"
|
import "unicode/utf8"
|
||||||
|
|
||||||
|
// SplitFunc is the type that describes the two splitter functions, SpaceIndexed
|
||||||
|
// and ArgsIndexed.
|
||||||
|
type SplitFunc = func(text string, offset int64) ([]string, int64)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ SplitFunc = SpaceIndexed
|
||||||
|
_ SplitFunc = ArgsIndexed
|
||||||
|
)
|
||||||
|
|
||||||
// just helper functions here
|
// just helper functions here
|
||||||
|
|
||||||
var asciiSpace = [256]uint8{'\t': 1, '\n': 1, '\v': 1, '\f': 1, '\r': 1, ' ': 1}
|
var asciiSpace = [256]uint8{'\t': 1, '\n': 1, '\v': 1, '\f': 1, '\r': 1, ' ': 1}
|
||||||
|
|
Loading…
Reference in a new issue