(let ((chars (char-set-members char-set)))
(if (pair? chars)
(if (pair? (cdr chars))
- (let ((ranges
- (push #\^ (pull #\- (pull #\] (compute-ranges chars))))))
- (let ((n
- (let loop ((ranges ranges) (n 2))
- (if (pair? ranges)
- (loop (cdr ranges)
- (fix:+ n (if (pair? (car ranges)) 3 1)))
- n))))
- (let ((builder (string-builder)))
- (builder #\[)
- (let loop ((ranges ranges))
- (if (pair? ranges)
- (let ((range (car ranges)))
- (if (pair? range)
- (begin
- (builder (car range))
- (builder #\-)
- (builder (cdr range)))
- (builder range)))
- (loop (cdr ranges))))
- (builder #\])
- (builder))))
+ (let ((builder (string-builder)))
+ (builder #\[)
+ (let loop
+ ((ranges
+ (push #\^ (pull #\- (pull #\] (compute-ranges chars))))))
+ (if (pair? ranges)
+ (begin
+ (let ((range (car ranges)))
+ (if (pair? range)
+ (begin
+ (builder (car range))
+ (builder #\-)
+ (builder (cdr range)))
+ (builder range)))
+ (loop (cdr ranges)))))
+ (builder #\])
+ (builder))
(re-quote-string (string (car chars))))
"")))
\ No newline at end of file