From 065bb70138faf1330b566258e2a56352787f1993 Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Wed, 11 Sep 2024 11:46:47 -0600 Subject: [PATCH] Return End parser from a function for better doc generation --- gigaparsec.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gigaparsec.go b/gigaparsec.go index 0f286e9..0538ce3 100644 --- a/gigaparsec.go +++ b/gigaparsec.go @@ -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 +}