From 65a41a57c925870c101729095947476837f51525 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 3 May 2017 00:50:33 -0700 Subject: [PATCH] Add named character sets. --- src/runtime/chrset.scm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/runtime/chrset.scm b/src/runtime/chrset.scm index 49c55f918..dd33e8b95 100644 --- a/src/runtime/chrset.scm +++ b/src/runtime/chrset.scm @@ -278,6 +278,11 @@ USA. (loop (cdr cpl) ranges (cons (car cpl) char-sets))) + ((name->char-set (car cpl)) + => (lambda (char-set) + (loop (cdr cpl) + ranges + (cons char-set char-sets)))) (else (error:not-a cpl-element? (car cpl)))))) @@ -337,7 +342,20 @@ USA. (or (%range? object) (bitless-char? object) (string? object) - (char-set? object))) + (char-set? object) + (name->char-set object))) + +(define (name->char-set name) + (case name + ((alphabetic) char-set:alphabetic) + ((alphanumeric) char-set:alphanumeric) + ((cased) char-set:cased) + ((lower-case) char-set:lower-case) + ((numeric) char-set:numeric) + ((unicode) char-set:unicode) + ((upper-case) char-set:upper-case) + ((whitespace) char-set:whitespace) + (else #f))) (define (%range? object) (or (and (pair? object) -- 2.25.1