OCD ..OCD ...OCD ...
This commit is contained in:
parent
1e7ec7553a
commit
2fa5b8d0f4
|
@ -13,9 +13,9 @@ import (
|
||||||
"git.makaay.nl/mauricem/go-parsekit"
|
"git.makaay.nl/mauricem/go-parsekit"
|
||||||
)
|
)
|
||||||
|
|
||||||
type chunks []string
|
type Chunks []string
|
||||||
|
|
||||||
func (l *chunks) AddChopped(s string, chunkSize int) *parsekit.Error {
|
func (l *Chunks) AddChopped(s string, chunkSize int) *parsekit.Error {
|
||||||
parser := parsekit.NewParser(func(p *parsekit.ParseAPI) {
|
parser := parsekit.NewParser(func(p *parsekit.ParseAPI) {
|
||||||
for p.On(parsekit.C.MinMax(1, chunkSize, parsekit.A.AnyRune)).Accept() {
|
for p.On(parsekit.C.MinMax(1, chunkSize, parsekit.A.AnyRune)).Accept() {
|
||||||
*l = append(*l, p.BufLiteral())
|
*l = append(*l, p.BufLiteral())
|
||||||
|
@ -26,7 +26,7 @@ func (l *chunks) AddChopped(s string, chunkSize int) *parsekit.Error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Example_usingSliceAsParserState() {
|
func Example_usingSliceAsParserState() {
|
||||||
chunks := &chunks{}
|
chunks := &Chunks{}
|
||||||
chunks.AddChopped("This string will", 4)
|
chunks.AddChopped("This string will", 4)
|
||||||
chunks.AddChopped("be cut to bits!!!!!!", 8)
|
chunks.AddChopped("be cut to bits!!!!!!", 8)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue