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