mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 06:39:17 +02:00
Add missing (scheme char) import for non-chibi implementations.
Prefer Unicode-aware (scheme char) to (chibi) char-up/downcase. Use char-set:title-case from SRFI-14 for non-chibi implementations. Fixes issue #233.
This commit is contained in:
parent
6f57be54ea
commit
a2ca973c4f
3 changed files with 17 additions and 10 deletions
|
@ -494,12 +494,6 @@
|
|||
(char-set-union %char-set:letter %char-set:digit (char-set #\_)))
|
||||
(define (char-word-constituent? ch)
|
||||
(char-set-contains? char-set:word-constituent ch))
|
||||
(define char-set:title-case
|
||||
(char-set-union
|
||||
(ucs-range->char-set #x1F88 #x1F90)
|
||||
(ucs-range->char-set #x1F98 #x1FA0)
|
||||
(ucs-range->char-set #x1FA8 #x1FB0)
|
||||
(char-set #\x01C5 #\x01C8 #\x01CB #\x01F2 #\x1FBC #\x1FCC #\x1FFC)))
|
||||
(define get-char-set:cased
|
||||
(let ((char-set:cased #f))
|
||||
(lambda ()
|
||||
|
|
|
@ -12,12 +12,24 @@
|
|||
;; Chibi's char-set library is more factored than SRFI-14.
|
||||
(cond-expand
|
||||
(chibi
|
||||
(import (rename (chibi) (protect guard))
|
||||
(srfi 9) (chibi char-set)
|
||||
(import (rename (chibi)
|
||||
(protect guard)
|
||||
(char-downcase %char-downcase)
|
||||
(char-upcase %char-upcase))
|
||||
(only (scheme char) char-downcase char-upcase)
|
||||
(srfi 9)
|
||||
(chibi char-set)
|
||||
(chibi char-set full)
|
||||
(prefix (chibi char-set ascii) %)))
|
||||
(prefix (chibi char-set ascii) %))
|
||||
(begin
|
||||
(define char-set:title-case
|
||||
(char-set-union
|
||||
(ucs-range->char-set #x1F88 #x1F90)
|
||||
(ucs-range->char-set #x1F98 #x1FA0)
|
||||
(ucs-range->char-set #x1FA8 #x1FB0)
|
||||
(char-set #\x01C5 #\x01C8 #\x01CB #\x01F2 #\x1FBC #\x1FCC #\x1FFC)))))
|
||||
(else
|
||||
(import (scheme base) (srfi 14))
|
||||
(import (scheme base) (scheme char) (srfi 14))
|
||||
(begin
|
||||
(define %char-set:letter
|
||||
(char-set-intersection char-set:ascii char-set:letter))
|
||||
|
|
|
@ -179,6 +179,7 @@
|
|||
|
||||
(test-re '("кириллица") '(* alpha) "кириллица")
|
||||
(test-re #f '(w/ascii (* alpha)) "кириллица")
|
||||
(test-re '("кириллица") '(w/nocase "КИРИЛЛИЦА") "кириллица")
|
||||
|
||||
(test-re '("12345") '(* digit) "12345")
|
||||
(test-re #f '(w/ascii (* digit)) "12345")
|
||||
|
|
Loading…
Add table
Reference in a new issue