From 781c7b45b0e20f48fcfa2d1b88d712321a2a0852 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Wed, 24 Jul 2013 22:03:43 +0900 Subject: [PATCH] Fixing a bug in regexp-match not properly matching to the end of the string. --- lib/chibi/regexp.scm | 7 ++++--- lib/chibi/regexp.sld | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/chibi/regexp.scm b/lib/chibi/regexp.scm index e9ec3789..a80b82d4 100644 --- a/lib/chibi/regexp.scm +++ b/lib/chibi/regexp.scm @@ -397,9 +397,10 @@ ;; Terminate when the string is done or there are no more ;; searchers. If we terminate prematurely and are not ;; searching, return false. - (and (or search? (string-cursor>=? i end)) - (searcher? (cdr accept)) - (searcher-matches (cdr accept)))) + (and (searcher? (cdr accept)) + (let ((matches (searcher-matches (cdr accept)))) + (and (or search? (>= (rx-match-ref matches 1) end)) + (searcher-matches (cdr accept)))))) (else ;; Otherwise advance normally. (let ((ch (string-cursor-ref str i)) diff --git a/lib/chibi/regexp.sld b/lib/chibi/regexp.sld index 34266a71..d813e30c 100644 --- a/lib/chibi/regexp.sld +++ b/lib/chibi/regexp.sld @@ -6,7 +6,7 @@ rx-match? rx-match-num-matches rx-match-submatch rx-match-submatch/list rx-match->list rx-match->sexp) - (import (scheme base) (srfi 9) (srfi 33) (srfi 38) (srfi 69)) + (import (srfi 9) (srfi 33) (srfi 38) (srfi 69)) ;; Chibi's char-set library is more factored than SRFI-14. (cond-expand (chibi