The prefix optimization applies only to the first iteration.

Fixes #596.

R=rsc
CC=golang-dev
https://golang.org/cl/206101
This commit is contained in:
Rob Pike 2010-02-17 08:49:00 +11:00
parent ca075494a6
commit 7db472fd34
2 changed files with 17 additions and 6 deletions

View file

@ -30,7 +30,6 @@ var good_re = []string{
`[^\n]`,
}
// TODO: nice to do this with a map
type stringError struct {
re string
err os.Error
@ -97,6 +96,10 @@ var matches = []tester{
tester{`[.]`, ".", vec{0, 1}},
tester{`/$`, "/abc/", vec{4, 5}},
tester{`/$`, "/abc", vec{}},
// fixed bugs
tester{`ab$`, "cab", vec{1, 3}},
tester{`axxb$`, "axxcb", vec{}},
}
func compileTest(t *testing.T, expr string, error os.Error) *Regexp {