Skip to content

Commit

Permalink
when searching don't assume the match started at the search start (fixes
Browse files Browse the repository at this point in the history
 #25)
  • Loading branch information
ashinn committed Jul 6, 2021
1 parent ff3b5b7 commit 29334af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions irregex.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3827,13 +3827,14 @@
matches)))
(if (not m)
(finish from acc)
(let ((j (%irregex-match-end-index m 0))
(let ((j-start (%irregex-match-start-index m 0))
(j (%irregex-match-end-index m 0))
(acc (kons from m acc)))
(irregex-reset-matches! matches)
(cond
((flag-set? (irregex-flags irx) ~consumer?)
(finish j acc))
((= j i)
((= j j-start)
;; skip one char forward if we match the empty string
(lp (list str j end) j (+ j 1) acc))
(else
Expand Down

0 comments on commit 29334af

Please sign in to comment.