srfi-14-char-sets.scm 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ; Copyright (c) 1993-2007 by Richard Kelsey and Jonathan Rees. See file COPYING.
  2. ; This constructs the SRFI 14 char sets from thin air and what's defined in
  3. ; srfi-14-base-char-sets.scm.
  4. ; Defined there:
  5. ; lower-case, upper-case, title-case, letter, digit, punctuation, symbol
  6. (define char-set:empty (char-set))
  7. (define char-set:full (char-set-complement char-set:empty))
  8. (define char-set:letter+digit
  9. (char-set-union char-set:letter char-set:digit))
  10. (define char-set:graphic
  11. (char-set-union char-set:mark
  12. char-set:letter
  13. char-set:digit
  14. char-set:symbol
  15. char-set:punctuation))
  16. (define char-set:whitespace
  17. (char-set-union char-set:separator
  18. (list->char-set (map scalar-value->char
  19. '(9 ; tab
  20. 10 ; newline
  21. 11 ; vtab
  22. 12 ; page
  23. 13 ; return
  24. )))))
  25. (define char-set:printing
  26. (char-set-union char-set:whitespace char-set:graphic))
  27. (define char-set:iso-control
  28. (char-set-union (ucs-range->char-set 0 #x20)
  29. (ucs-range->char-set #x7f #xa0)))
  30. (define char-set:blank
  31. (char-set-union char-set:space-separator
  32. (char-set (scalar-value->char 9)))) ; tab
  33. (define char-set:ascii (ucs-range->char-set 0 128))
  34. (define char-set:hex-digit (string->char-set "0123456789abcdefABCDEF"))
  35. (make-char-set-immutable! char-set:empty)
  36. (make-char-set-immutable! char-set:full)
  37. (make-char-set-immutable! char-set:lower-case)
  38. (make-char-set-immutable! char-set:upper-case)
  39. (make-char-set-immutable! char-set:letter)
  40. (make-char-set-immutable! char-set:digit)
  41. (make-char-set-immutable! char-set:hex-digit)
  42. (make-char-set-immutable! char-set:letter+digit)
  43. (make-char-set-immutable! char-set:punctuation)
  44. (make-char-set-immutable! char-set:symbol)
  45. (make-char-set-immutable! char-set:graphic)
  46. (make-char-set-immutable! char-set:whitespace)
  47. (make-char-set-immutable! char-set:printing)
  48. (make-char-set-immutable! char-set:blank)
  49. (make-char-set-immutable! char-set:iso-control)
  50. (make-char-set-immutable! char-set:ascii)