Merge pull request #948 from h3rald/patch-1

pegs.findAll iterator fix
This commit is contained in:
Andreas Rumpf 2014-02-22 10:45:25 +01:00
commit b89c8df35e

View file

@ -836,7 +836,9 @@ iterator findAll*(s: string, pattern: TPeg, start = 0): string =
while i < s.len: while i < s.len:
c.ml = 0 c.ml = 0
var L = rawMatch(s, pattern, i, c) var L = rawMatch(s, pattern, i, c)
if L < 0: break if L < 0:
inc(i, 1)
else:
yield substr(s, i, i+L-1) yield substr(s, i, i+L-1)
inc(i, L) inc(i, L)