Regexp: succeed on empty match at end of input
This commit is contained in:
@ -80,7 +80,7 @@ func Regexp(pattern string) gigaparsec.Parser[byte, string] {
|
||||
// when searching a RuneReader.
|
||||
dst := make([]byte, idx[1]-idx[0])
|
||||
n, _, err := input.Read(dst)
|
||||
if err != nil {
|
||||
if err != nil && (!errors.Is(err, io.EOF) || n < uint64(len(dst))) {
|
||||
return gigaparsec.Result[byte, string]{}, fmt.Errorf("Regexp: unexpected error: %w", err)
|
||||
}
|
||||
next := input.At(input.Pos() + n)
|
||||
|
Reference in New Issue
Block a user