initial commits

master
Charles Iliya Krempeaux 2023-11-22 06:52:49 -08:00
parent f6ef5f92b9
commit 3aba2c3779
1 changed files with 25 additions and 0 deletions

25
parsetowriter.go 100644
View File

@ -0,0 +1,25 @@
package brace
import (
"io"
"sourcecode.social/reiver/go-utf8"
)
// ParseToBytes is similar to Parse except it writes the brace-string literal as an io.Writer.
func ParseToWriter(writer io.Writer, runescanner io.RuneScanner) error {
if nil == writer {
return errNilWriter
}
fn := func(r rune) error {
_, err := utf8.WriteRune(writer, r)
if nil != err {
return err
}
return nil
}
return Parse(fn, runescanner)
}