diff options
Diffstat (limited to 'libgo/go/regexp/exec.go')
-rw-r--r-- | libgo/go/regexp/exec.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libgo/go/regexp/exec.go b/libgo/go/regexp/exec.go index f8fe7b5..84cb3e6 100644 --- a/libgo/go/regexp/exec.go +++ b/libgo/go/regexp/exec.go @@ -16,7 +16,7 @@ type queue struct { dense []entry } -// A entry is an entry on a queue. +// An entry is an entry on a queue. // It holds both the instruction pc and the actual thread. // Some queue entries are just place holders so that the machine // knows it has considered that pc. Such entries have t == nil. @@ -338,15 +338,14 @@ func (m *machine) onepass(i input, pos, ncap int) bool { if pos == 0 && syntax.EmptyOp(inst.Arg)&^flag == 0 && len(m.re.prefix) > 0 && i.canCheckPrefix() { // Match requires literal prefix; fast search for it. - if i.hasPrefix(m.re) { - pos += len(m.re.prefix) - r, width = i.step(pos) - r1, width1 = i.step(pos + width) - flag = i.context(pos) - pc = int(m.re.prefixEnd) - } else { + if !i.hasPrefix(m.re) { return m.matched } + pos += len(m.re.prefix) + r, width = i.step(pos) + r1, width1 = i.step(pos + width) + flag = i.context(pos) + pc = int(m.re.prefixEnd) } for { inst = m.op.Inst[pc] |