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
parent 1a6d05515f
commit 6621454dec

View File

@@ -836,7 +836,9 @@ iterator findAll*(s: string, pattern: TPeg, start = 0): string =
while i < s.len:
c.ml = 0
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)
inc(i, L)