Wrote some Slice tests
This commit is contained in:
@ -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] {
|
||||
|
Reference in New Issue
Block a user