diff options
author | Fabio Cevasco <h3rald@h3rald.com> | 2014-02-21 14:14:43 +0100 |
---|---|---|
committer | Fabio Cevasco <h3rald@h3rald.com> | 2014-02-21 14:14:43 +0100 |
commit | 6621454dec0492044f76d1c78e9df7682048b83b (patch) | |
tree | dc23ea99ca9337838691b82a73e816086829e3e7 /lib | |
parent | 1a6d05515ff96e8bba294b352493cb7da2794a96 (diff) | |
download | Nim-6621454dec0492044f76d1c78e9df7682048b83b.tar.gz |
pegs.findAll iterator fix
Modified the findAll iterator so that it continues looking for a match within the input string (bug?).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/pegs.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/pure/pegs.nim b/lib/pure/pegs.nim index 70b617393..3b1516e17 100644 --- a/lib/pure/pegs.nim +++ b/lib/pure/pegs.nim @@ -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) |