Wrote some Slice tests

This commit is contained in:
2024-09-09 10:27:54 -06:00
parent 727426d704
commit ef74691415
3 changed files with 61 additions and 0 deletions

View File

@ -48,6 +48,13 @@ func (s State[T]) Pos() uint64 {
return s.cursor.Pos()
}
func Parse[In, Out any](p Parser[In, Out], c cursor.Cursor[In]) (result Out, err error) {
st := State[In]{cursor: c}
var reply Result[In, Out]
_, reply, err = p(st)
return reply.Value, err
}
type Parser[In, Out any] func(State[In]) (consumed bool, reply Result[In, Out], err error)
func Return[In, Out any](value Out) Parser[In, Out] {