(define (%compile-char-set items)
(scalar-values->alphabet
- (map (lambda (item)
- (cond ((or (unicode-scalar-value? item)
- (and (pair? item)
- (pair? (cdr item))
- (null? (cddr item))
- (unicode-scalar-value? (car item))
- (unicode-scalar-value? (cadr item))
- (< (car item) (cadr item))))
- (list item))
- ((unicode-char? item)
- (list (char->integer item)))
- ((alphabet? item)
- (alphabet->scalar-values item))
- ((string? item)
- (map char->integer (string->list item)))
- (else
- (error:wrong-type-argument item "char-set item"
- 'COMPILE-REGSEXP))))
- items)))
+ (append-map (lambda (item)
+ (cond ((well-formed-scalar-value-range? item)
+ (list item))
+ ((unicode-char? item)
+ (list (char->integer item)))
+ ((alphabet? item)
+ (alphabet->scalar-values item))
+ ((string? item)
+ (map char->integer (string->list item)))
+ (else
+ (error:wrong-type-argument item "char-set item"
+ 'COMPILE-REGSEXP))))
+ items)))
(define (%compile-group-key key)
(if (not (or (fix:fixnum? key)
error:not-utf32-string
error:not-utf8-string
error:not-well-formed-scalar-value-list
+ error:not-well-formed-scalar-value-range
error:not-wide-string
for-all-chars-in-string?
for-any-char-in-string?
guarantee-utf32-string
guarantee-utf8-string
guarantee-well-formed-scalar-value-list
+ guarantee-well-formed-scalar-value-range
guarantee-wide-string
guarantee-wide-string-index
guarantee-wide-substring
utf8-string-valid?
utf8-string?
well-formed-scalar-value-list?
+ well-formed-scalar-value-range?
wide-string
wide-string->string
wide-string-index?
(else #t))))))))
(define (well-formed-scalar-value-list? items)
- (list-of-type? items well-formed-item?))
+ (list-of-type? items well-formed-scalar-value-range?))
-(define (well-formed-item? item)
+(define (well-formed-scalar-value-range? item)
(if (pair? item)
(and (unicode-scalar-value? (car item))
(unicode-scalar-value? (cdr item))
(unicode-scalar-value? item)))
(define-guarantee well-formed-scalar-value-list "a Unicode scalar-value list")
+(define-guarantee well-formed-scalar-value-range "a Unicode scalar-value range")
\f
(define (scalar-values->alphabet items)
(guarantee-well-formed-scalar-value-list items 'SCALAR-VALUES->ALPHABET)