~ chicken-core (chicken-5) 503b7905da0855e08c47534a9f35b87dc989e45c
commit 503b7905da0855e08c47534a9f35b87dc989e45c
Author: Peter Bex <peter@more-magic.net>
AuthorDate: Sat Sep 10 11:29:55 2016 +0200
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Sat Sep 10 22:46:55 2016 +1200
Update irregex to upstream version 0.9.5
This fixes a bug with matching "bow" occurrances after the first match
with irregex-fold (or irregex-extract).
This is upstream issue #14: https://github.com/ashinn/irregex/issues/14
Signed-off-by: Evan Hanson <evhan@foldling.org>
diff --git a/NEWS b/NEWS
index 629a12ca..4b8d797d 100644
--- a/NEWS
+++ b/NEWS
@@ -31,6 +31,10 @@
- The let-optionals* macro no longer needs "quote", "car" and "cdr"
to be imported and bound to their default values (#806).
+- Core libraries
+ - Irregex has been updated to 0.9.5, which fixes matching of all "bow"
+ occurrances beyond the first with irregex-fold (upstream issue #14).
+
4.11.0
- Security fixes
diff --git a/irregex-core.scm b/irregex-core.scm
index bae78d99..2d6058ce 100644
--- a/irregex-core.scm
+++ b/irregex-core.scm
@@ -1,6 +1,6 @@
;;;; irregex.scm -- IrRegular Expressions
;;
-;; Copyright (c) 2005-2015 Alex Shinn. All rights reserved.
+;; Copyright (c) 2005-2016 Alex Shinn. All rights reserved.
;; BSD-style license: http://synthcode.com/license.txt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -30,6 +30,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; History
+;; 0.9.5: 2016/09/10 - fixed a bug in irregex-fold handling of bow
;; 0.9.4: 2015/12/14 - performance improvement for {n,m} matches
;; 0.9.3: 2014/07/01 - R7RS library
;; 0.9.2: 2012/11/29 - fixed a bug in -fold on conditional bos patterns
@@ -3486,11 +3487,10 @@
(fail))))
((bow)
(lambda (cnk init src str i end matches fail)
- (if (and (or (if (> i ((chunker-get-start cnk) src))
- (not (char-alphanumeric? (string-ref str (- i 1))))
- (let ((ch (chunker-prev-char cnk src end)))
- (and ch (not (char-alphanumeric? ch)))))
- (and (eq? src (car init)) (eqv? i (cdr init))))
+ (if (and (if (> i ((chunker-get-start cnk) src))
+ (not (char-alphanumeric? (string-ref str (- i 1))))
+ (let ((ch (chunker-prev-char cnk init src)))
+ (or (not ch) (not (char-alphanumeric? ch)))))
(if (< i end)
(char-alphanumeric? (string-ref str i))
(let ((next ((chunker-get-next cnk) src)))
diff --git a/tests/test-irregex.scm b/tests/test-irregex.scm
index d2754218..1a460549 100644
--- a/tests/test-irregex.scm
+++ b/tests/test-irregex.scm
@@ -387,6 +387,8 @@
(test-equal "xaac"
(irregex-replace/all (irregex '(or (seq bos "a") "b") 'dfa)
"aaac" "x"))
+ (test-equal '("foo" " " "foo" " " "b" "a" "r" " " "foo")
+ (irregex-extract '(or (: bow "foo" eow) any) "foo foo bar foo"))
)
Trap