pegs.findAll iterator fix
Modified the findAll iterator so that it continues looking for a match within the input string (bug?).
This commit is contained in:
parent
1a6d05515f
commit
6621454dec
1 changed files with 3 additions and 1 deletions
|
|
@ -836,7 +836,9 @@ 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:
|
||||||
|
inc(i, 1)
|
||||||
|
continue
|
||||||
yield substr(s, i, i+L-1)
|
yield substr(s, i, i+L-1)
|
||||||
inc(i, L)
|
inc(i, L)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue