summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorFabio Cevasco <h3rald@h3rald.com>2014-02-21 14:14:43 +0100
committerFabio Cevasco <h3rald@h3rald.com>2014-02-21 14:14:43 +0100
commit6621454dec0492044f76d1c78e9df7682048b83b (patch)
treedc23ea99ca9337838691b82a73e816086829e3e7 /lib
parent1a6d05515ff96e8bba294b352493cb7da2794a96 (diff)
downloadNim-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.nim4
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)