Compare commits
2 Commits
981edc92f7
...
4e157f7a0e
Author | SHA1 | Date | |
---|---|---|---|
4e157f7a0e | |||
1892a97070 |
4
TODO.txt
4
TODO.txt
@ -4,4 +4,6 @@ Rename Seq2 to Seq
|
||||
Document Seq
|
||||
Should MakeState be private now that there's Run?
|
||||
What's Megaparsec got that we ain't got?
|
||||
Add and benchmark naïve Seq
|
||||
Add and benchmark naïve Seq
|
||||
chainl
|
||||
whitespace handling
|
||||
|
@ -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)
|
||||
|
@ -61,6 +61,14 @@ func TestRegexp(t *testing.T) {
|
||||
must.NoError(t, err)
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user