#| -*-Scheme-*-
-$Id: rexp.scm,v 1.20 2002/12/19 21:31:29 cph Exp $
+$Id: rexp.scm,v 1.21 2002/12/19 21:35:34 cph Exp $
Copyright (c) 2000, 2001, 2002 Massachusetts Institute of Technology
((*) (string-append (rexp-arg) "*"))
((+) (string-append (rexp-arg) "+"))
((CASE-FOLD)
- (let ((arg (one-arg)))
- (cond ((string? arg) (case-fold-string arg))
- ((char-set? arg) (case-fold-char-set arg))
- (else (lose)))))
+ (rexp->regexp
+ (let ((arg (one-arg)))
+ (cond ((string? arg) (case-fold-string arg))
+ ((char-set? arg) (case-fold-char-set arg))
+ (else (lose))))))
((ANY-CHAR) ".")
((LINE-START) "^")
((LINE-END) "$")
((NOT-SYNTAX-CHAR) (string-append "\\S" (syntax-type)))
(else (lose))))))
(else (lose)))))
-
+\f
(define (case-fold-string s)
(let ((end (string-length s)))
(let loop ((start 0) (parts '()))
(let loop ((chars (char-set-members c)) (chars* '()))
(if (pair? chars)
(loop (cdr chars)
- (let ((c (car chars)))
- (if (char-alphabetic? c)
- (cons* (char-upcase c) (char-downcase c) chars*)
- chars*)))
+ (if (char-alphabetic? (car chars))
+ (cons* (char-upcase (car chars))
+ (char-downcase (car chars))
+ chars*)
+ chars*))
(apply char-set chars*))))
\ No newline at end of file