diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2014-02-22 10:45:25 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2014-02-22 10:45:25 +0100 |
commit | b89c8df35e13c0be0252c17fddbadab4a5135ff4 (patch) | |
tree | 5496de78c00166885a2fe65235fb8d59f83a92fc | |
parent | 1a6d05515ff96e8bba294b352493cb7da2794a96 (diff) | |
parent | 067c3816ba317d2d2bcafdd3c2806df886b855b2 (diff) | |
download | Nim-b89c8df35e13c0be0252c17fddbadab4a5135ff4.tar.gz |
Merge pull request #948 from h3rald/patch-1
pegs.findAll iterator fix
-rw-r--r-- | lib/pure/pegs.nim | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/pure/pegs.nim b/lib/pure/pegs.nim index 70b617393..68b1ab223 100644 --- a/lib/pure/pegs.nim +++ b/lib/pure/pegs.nim @@ -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".} = |