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

View File

@@ -836,9 +836,11 @@ 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
yield substr(s, i, i+L-1)
inc(i, L)
if L < 0:
inc(i, 1)
else:
yield substr(s, i, i+L-1)
inc(i, L)
proc findAll*(s: string, pattern: TPeg, start = 0): seq[string] {.
nosideEffect, rtl, extern: "npegs$1".} =