pegs.findAll iterator fix

Modified the findAll iterator so that it continues looking for a match within the input string (bug?).
This commit is contained in:
Fabio Cevasco 2014-02-21 14:14:43 +01:00
commit 6621454dec

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)
continue
yield substr(s, i, i+L-1) yield substr(s, i, i+L-1)
inc(i, L) inc(i, L)