Compare commits

..

No commits in common. "4e157f7a0e200c4ce304ff32844a53d65c210993" and "981edc92f718646f630de6d0096bc073f96f772a" have entirely different histories.

3 changed files with 2 additions and 12 deletions

View File

@ -4,6 +4,4 @@ Rename Seq2 to Seq
Document Seq Document Seq
Should MakeState be private now that there's Run? Should MakeState be private now that there's Run?
What's Megaparsec got that we ain't got? What's Megaparsec got that we ain't got?
Add and benchmark naïve Seq Add and benchmark naïve Seq
chainl
whitespace handling

View File

@ -80,7 +80,7 @@ func Regexp(pattern string) gigaparsec.Parser[byte, string] {
// when searching a RuneReader. // when searching a RuneReader.
dst := make([]byte, idx[1]-idx[0]) dst := make([]byte, idx[1]-idx[0])
n, _, err := input.Read(dst) n, _, err := input.Read(dst)
if err != nil && (!errors.Is(err, io.EOF) || n < uint64(len(dst))) { if err != nil {
return gigaparsec.Result[byte, string]{}, fmt.Errorf("Regexp: unexpected error: %w", err) return gigaparsec.Result[byte, string]{}, fmt.Errorf("Regexp: unexpected error: %w", err)
} }
next := input.At(input.Pos() + n) next := input.At(input.Pos() + n)

View File

@ -61,14 +61,6 @@ func TestRegexp(t *testing.T) {
must.NoError(t, err) must.NoError(t, err)
test.StrContains(t, result.Message().Got(), "hella") test.StrContains(t, result.Message().Got(), "hella")
}) })
t.Run("succeeds on empty matches", func(t *testing.T) {
p := pbytes.Regexp(".*")
result, err := p(gigaparsec.MakeState(strings.NewReader("")))
succeeded, value, _ := result.Status()
must.NoError(t, err)
must.True(t, succeeded)
must.EqOp(t, "", value)
})
} }
func TestRuneReader(t *testing.T) { func TestRuneReader(t *testing.T) {