(define %null-char-set
(%make-char-set (%make-low 0) '#()))
+
+(define (8-bit-char-set? char-set)
+ (and (char-set? char-set)
+ (fix:= (vector-length (%char-set-high char-set)) 0)
+ (let ((low (%char-set-low char-set)))
+ (let loop ((i #x20))
+ (or (fix:= i %low-length)
+ (and (fix:= (vector-8b-ref low i) 0)
+ (loop (fix:+ i 1))))))))
+
+(define-guarantee 8-bit-char-set "an 8-bit char-set")
\f
;;;; Conversion to and from scalar-values list
(if (pair? range)
(and (index-fixnum? (car range))
(index-fixnum? (cdr range))
- (fix:< (car range) (cdr range))
+ (fix:<= (car range) (cdr range))
(fix:<= (cdr range) char-code-limit))
(and (index-fixnum? range)
(fix:< range char-code-limit))))
(loop (fix:+ i 1)))
#t)))))
\f
-;;;; 8-bit character sets
-
-(define (8-bit-char-set? char-set)
- (and (char-set? char-set)
- (fix:= (vector-length (%char-set-high char-set)) 0)
- (let ((low (%char-set-low char-set)))
- (let loop ((i #x20))
- (or (fix:= i %low-length)
- (and (fix:= (vector-8b-ref low i) 0)
- (loop (fix:+ i 1))))))))
-
-(define-guarantee 8-bit-char-set "an 8-bit char-set")
-\f
;;;; Mapping operations
(define (char-set-invert char-set)
(error:bad-range-argument start 'ASCII-RANGE->CHAR-SET))
(if (not (fix:<= end #x100))
(error:bad-range-argument end 'ASCII-RANGE->CHAR-SET))
- (%scalar-values->char-set (list (cons start (fix:- end 1)))))
\ No newline at end of file
+ (%scalar-values->char-set (list (cons start (fix:- end 1)))))
+
+(define (alphabet->char-set char-set)
+ char-set)
+
+(define (char-set->alphabet char-set)
+ char-set)
+
+(define (char-in-alphabet? char char-set)
+ (char-set-member? char-set char))
+
+(define (alphabet->scalar-values char-set)
+ (map (lambda (range)
+ (if (pair? range)
+ (cons (car range)
+ (fix:- (cdr range) 1))
+ range))
+ (char-set->scalar-values char-set)))
+
+(define (scalar-values->alphabet ranges)
+ (guarantee-well-formed-scalar-value-list ranges 'SCALAR-VALUES->ALPHABET)
+ (%scalar-values->char-set
+ (map (lambda (range)
+ (if (pair? range)
+ (cons (car range)
+ (if (fix:< (cdr range) char-code-limit)
+ (fix:+ (cdr range) 1)
+ (error:bad-range-argument (cdr range)
+ 'SCALAR-VALUES->ALPHABET)))
+ range))
+ ranges)))
\ No newline at end of file
(files "chrset")
(parent (runtime))
(export ()
+ (8-bit-alphabet? 8-bit-char-set?)
+ (<alphabet> <char-set>)
+ (alphabet char-set)
+ (alphabet+ char-set-union)
+ (alphabet- char-set-difference)
+ (alphabet->string char-set->string)
+ (alphabet-predicate char-set-predicate)
+ (alphabet? char-set?)
+ (error:not-8-bit-alphabet error:not-8-bit-char-set)
+ (error:not-alphabet error:not-char-set)
+ (guarantee-8-bit-alphabet guarantee-8-bit-char-set)
+ (guarantee-alphabet guarantee-char-set)
+ (string->alphabet string->char-set)
8-bit-char-set?
<char-set>
+ alphabet->char-set
+ alphabet->scalar-values
ascii-range->char-set
char-alphabetic?
char-alphanumeric?
char-ctl?
char-graphic?
+ char-in-alphabet?
char-lower-case?
char-numeric?
char-set
+ char-set->alphabet
char-set->scalar-values
char-set-difference
char-set-intersection
guarantee-well-formed-scalar-value-list
guarantee-well-formed-scalar-value-range
scalar-value-in-char-set?
+ scalar-values->alphabet
scalar-values->char-set
string->char-set
well-formed-scalar-value-list?
(files "parser-buffer")
(parent (runtime))
(export ()
+ (match-parser-buffer-char-in-alphabet match-parser-buffer-char-in-set)
+ (match-parser-buffer-char-in-alphabet-no-advance
+ match-parser-buffer-char-in-set-no-advance)
+ (match-parser-buffer-char-not-in-alphabet
+ match-parser-buffer-char-not-in-set)
+ (match-parser-buffer-char-not-in-alphabet-no-advance
+ match-parser-buffer-char-not-in-set-no-advance)
+ (match-utf8-char-in-alphabet match-parser-buffer-char-in-set)
*match-string
*match-symbol
*match-utf8-string
match-parser-buffer-char
match-parser-buffer-char-ci
match-parser-buffer-char-ci-no-advance
-
-
match-parser-buffer-char-in-set
match-parser-buffer-char-in-set-no-advance
match-parser-buffer-char-no-advance
-
match-parser-buffer-char-not-in-set
match-parser-buffer-char-not-in-set-no-advance
match-parser-buffer-not-char