~ chicken-core (chicken-5) a935874b93cbca504682852dc107de08d5c11717
commit a935874b93cbca504682852dc107de08d5c11717 Author: felix <felix@call-with-current-continuation.org> AuthorDate: Tue Mar 9 13:00:59 2010 +0100 Commit: felix <felix@call-with-current-continuation.org> CommitDate: Tue Mar 9 13:00:59 2010 +0100 regexp didn't handle regexp arguments properly diff --git a/regex.scm b/regex.scm index 7a3ebeb6..95f9819c 100644 --- a/regex.scm +++ b/regex.scm @@ -72,15 +72,17 @@ (define-record regexp x) (define (regexp pat #!optional caseless extended utf8) - (make-regexp - (apply - irregex - pat - (let ((opts '())) - (when caseless (set! opts (cons 'i opts))) - (when extended (set! opts (cons 'x opts))) - (when utf8 (set! opts (cons 'utf8 opts))) - opts))) ) + (if (regexp? pat) + pat + (make-regexp + (apply + irregex + pat + (let ((opts '())) + (when caseless (set! opts (cons 'i opts))) + (when extended (set! opts (cons 'x opts))) + (when utf8 (set! opts (cons 'utf8 opts))) + opts))) ) ) (define (unregexp x) (cond ((regexp? x) (regexp-x x))Trap