Return End parser from a function for better doc generation
This commit is contained in:
parent
1d970026b3
commit
065bb70138
@ -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{})
|
_, _, err := s.cursor.Read([]In{})
|
||||||
if errors.Is(err, io.EOF) {
|
if errors.Is(err, io.EOF) {
|
||||||
return Succeed(true, struct{}{}, s, MessageOK(s.Pos())), nil
|
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"},
|
Expected: []string{"end of input"},
|
||||||
}), nil
|
}), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func End[In any]() Parser[In, struct{}] {
|
||||||
|
return end
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user