Get rid of the old name 'reply'
This commit is contained in:
parent
ef26d9496f
commit
1d970026b3
@ -136,7 +136,7 @@ func Satisfy[T any](pred func(T) bool) Parser[T, T] {
|
|||||||
|
|
||||||
func Slice[T comparable](s []T) Parser[T, []T] {
|
func Slice[T comparable](s []T) Parser[T, []T] {
|
||||||
expected := fmt.Sprint(s)
|
expected := fmt.Sprint(s)
|
||||||
return func(state State[T]) (reply Result[T, []T], err error) {
|
return func(state State[T]) (Result[T, []T], error) {
|
||||||
token := make([]T, len(s))
|
token := make([]T, len(s))
|
||||||
_, next, err := state.Read(token)
|
_, next, err := state.Read(token)
|
||||||
if errors.Is(err, io.EOF) {
|
if errors.Is(err, io.EOF) {
|
||||||
@ -234,7 +234,7 @@ func Try[In, Out any](p Parser[In, Out]) Parser[In, Out] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Label[In, Out any](p Parser[In, Out], l string) Parser[In, Out] {
|
func Label[In, Out any](p Parser[In, Out], l string) Parser[In, Out] {
|
||||||
return func(input State[In]) (reply Result[In, Out], err error) {
|
return func(input State[In]) (Result[In, Out], error) {
|
||||||
result, err := p(input)
|
result, err := p(input)
|
||||||
if err != nil || result.Consumed() {
|
if err != nil || result.Consumed() {
|
||||||
return result, err
|
return result, err
|
||||||
@ -253,8 +253,8 @@ func Map[In, Out1, Out2 any](p Parser[In, Out1], f func(Out1) Out2) Parser[In, O
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func End[In any](s State[In]) (reply Result[In, struct{}], err 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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user