Return End parser from a function for better doc generation

This commit is contained in:
Brandon Dyck 2024-09-11 11:46:47 -06:00
parent 1d970026b3
commit 065bb70138

View File

@ -253,7 +253,7 @@ func Map[In, Out1, Out2 any](p Parser[In, Out1], f func(Out1) Out2) Parser[In, O
})
}
func End[In any](s State[In]) (Result[In, struct{}], error) {
func end[In any](s State[In]) (Result[In, struct{}], error) {
_, _, err := s.cursor.Read([]In{})
if errors.Is(err, io.EOF) {
return Succeed(true, struct{}{}, s, MessageOK(s.Pos())), nil
@ -267,3 +267,7 @@ func End[In any](s State[In]) (Result[In, struct{}], error) {
Expected: []string{"end of input"},
}), nil
}
func End[In any]() Parser[In, struct{}] {
return end
}