(list->string
(let loop ((char char))
(if (or (eof-object? char)
- (char-set-member? char-set char))
+ (char-in-set? char char-set))
'()
(begin
(read-char port)
@deffn procedure match-parser-buffer-char-in-set buffer char-set
@deffnx procedure match-parser-buffer-char-in-set-no-advance buffer char-set
These procedures compare the next character in @var{buffer} against
-@var{char-set} using @code{char-set-member?}.
+@var{char-set} using @code{char-in-set?}.
@end deffn
@deffn procedure match-parser-buffer-string buffer string
;; convention for the named characters when they appear in strings.
(define (C-quotify-string-char char next)
- (cond ((char-set-member? char-set:C-named-chars char)
+ (cond ((char-in-set? char char-set:C-named-chars)
(let ((result (write-to-string (string char))))
(substring result 1 (-1+ (string-length result)))))
((char=? char #\NUL)
;; Avoid ambiguities
(if (or (not next)
- (not (char-set-member? char-set:numeric next)))
+ (not (char-in-set? next char-set:numeric)))
"\\0"
"\\000"))
((char=? char #\?)
1
0)))
(if (fix:< i n)
- (and (char-set-member? c:decimal-chars (string-ref e i))
+ (and (char-in-set? (string-ref e i) c:decimal-chars)
(loop (fix:+ i 1)))
#t))))
(let ((n (string-length e)))
(let loop ((i 0))
(if (fix:< i n)
- (and (char-set-member? c:identifier-chars (string-ref e i))
+ (and (char-in-set? (string-ref e i) c:identifier-chars)
(loop (fix:+ i 1)))
#t))))
(string-set!
copy i
(let ((char (string-ref name i)))
- (if (char-set-member? valid-chars char)
+ (if (char-in-set? char valid-chars)
char
#\_))))
copy))))
(let loop ((chars (string->list (buffer-name buffer))))
(cond ((null? chars)
'())
- ((char-set-member? valid-chars (car chars))
+ ((char-in-set? (car chars) valid-chars)
(cons (car chars) (loop (cdr chars))))
(else
(loop (cdr chars))))))))
(let ((atom-chars
(char-set-difference (ascii-range->char-set #x21 #x7F)
special-chars)))
- (define (special-char? char) (char-set-member? special-chars char))
- (define (atom-char? char) (char-set-member? atom-chars char))
+ (define (special-char? char) (char-in-set? char special-chars))
+ (define (atom-char? char) (char-in-set? char atom-chars))
(define (lose chars char-count)
(list (cons 'UNTERMINATED
(do ((i 0 (fix:+ i 1)))
((fix:= i n))
(let ((char (string-ref string i)))
- (cond ((char-set-member? char-set:cache-namestring-safe char)
+ (cond ((char-in-set? char char-set:cache-namestring-safe)
(write-char char port))
((char=? char #\/)
(write-char #\# port))
(char-set-union url:char-set:unreserved (string->char-set "&=~")))
\f
(define (imap:atom-char? char)
- (char-set-member? imap:char-set:atom-char char))
+ (char-in-set? char imap:char-set:atom-char))
(define (imap:quoted-special? char)
- (char-set-member? imap:char-set:quoted-specials char))
+ (char-in-set? char imap:char-set:quoted-specials))
(define (imap:quoted-char? char)
- (char-set-member? imap:char-set:quoted-char char))
+ (char-in-set? char imap:char-set:quoted-char))
(define ((string-matching-procedure matcher) string)
(matcher (string->parser-buffer string)))
(define (char-set-predicate char-set)
(guarantee char-set? char-set 'CHAR-SET-PREDICATE)
(lambda (char)
- (char-set-member? char-set char)))
+ (char-in-set? char char-set)))
(define (char-set=? char-set . char-sets)
(every (lambda (char-set*)
(string-prefix-ci? "a " type)
(string-prefix-ci? "an " type)))
(write-string
- (if (char-set-member? char-set:vowels
- (string-ref type 0))
+ (if (char-in-set? (string-ref type 0) char-set:vowels)
"an "
"a ")
port))
(write-char (digit->char (fix:and octet #x0F) 16) port)))))
(define (char-unreserved? char)
- (char-set-member? char-set:unreserved char))
+ (char-in-set? char char-set:unreserved))
(define char-set:unreserved)
(do ((i 0 (fix:+ i 1)))
((not (fix:< i n)))
(let ((char (string-ref string i)))
- (if (not (char-set-member? unquoted char))
+ (if (not (char-in-set? char unquoted))
(write-char #\\ port))
(write-char char port)))))
(define (separator-token? object)
(and (char? object)
- (char-set-member? char-set:http-separators object)))
+ (char-in-set? object char-set:http-separators)))
(define (separator-token->char token)
token)
((char=? char #\\)
(fifo (rc))
(loop level))
- ((char-set-member? char-set:http-text char)
+ ((char-in-set? char char-set:http-text)
(fifo char)
(loop level))
(else
(let ((end (string-length s)))
(do ((i 0 (+ i 1)))
((not (< i end)))
- (if (not (char-set-member? char-set:http-token
- (string-ref s i)))
+ (if (not (char-in-set? (string-ref s i) char-set:http-token))
(string-set! s i #\_))))
s))))
(if (builder 'empty?)
char
(builder)))
- ((char-set-member? delimiters char)
+ ((char-in-set? char delimiters)
(input-port/unread-char port char)
(builder))
(else
(let ((char (read-char port)))
(cond ((eof-object? char)
unspecific)
- ((char-set-member? delimiters char)
+ ((char-in-set? char delimiters)
(input-port/unread-char port char))
(else
(loop)))))))))
(let ((char (string-ref string start))
(start (fix:+ start 1)))
(cond ((not (char-lwsp? char))
- (if (char-set-member? char-set:qp-encoded char)
+ (if (char-in-set? char char-set:qp-encoded)
(write-qp-encoded context char)
(write-qp-clear context char))
(loop start))
(lambda ()
(let ((char (%peek-char port db)))
(or (eof-object? char)
- (char-set-member? (db-atom-delimiters db) char))))))
- (if (or (char-set-member? (db-atom-delimiters db) char)
+ (char-in-set? char (db-atom-delimiters db)))))))
+ (if (or (char-in-set? char (db-atom-delimiters db))
(at-end?))
char
(name->char
(define (match-parser-buffer-char-not-in-set-no-advance buffer set)
(match-char-not-no-advance buffer set char-in-set?))
-(define-integrable (char-in-set? char set)
- (char-set-member? set char))
-
(define-integrable (match-char buffer reference compare)
(and (guarantee-buffer-chars buffer 1)
(let ((char
(lambda (position groups fail)
(if (let ((char (next-char position)))
(and char
- (char-set-member? char-set char)))
+ (char-in-set? char char-set)))
(succeed (next-position position) groups fail)
(fail)))))
(lambda (position groups fail)
(if (let ((char (next-char position)))
(and char
- (not (char-set-member? char-set char))))
+ (not (char-in-set? char char-set))))
(succeed (next-position position) groups fail)
(fail)))))
\f
(let ((end (string-length string)))
(let loop ((i 0))
(if (fix:< i end)
- (and (char-set-member? char-set (string-ref string i))
+ (and (char-in-set? (string-ref string i) char-set)
(loop (fix:+ i 1)))
#t))))
(if quote?
(string-append "\"" s "\"")
s)))
- ((char-set-member? char-set:rfc2822-qtext char)
+ ((char-in-set? char char-set:rfc2822-qtext)
(write-char char output)
(loop quote?))
- ((char-set-member? char-set:rfc2822-text char)
+ ((char-in-set? char char-set:rfc2822-text)
(write-char #\\ output)
(write-char char output)
(loop #t))
(do ((i start (fix:+ i 1)))
((not (fix:< i end)))
(let ((char (string-ref string i)))
- (if (char-set-member? unescaped char)
+ (if (char-in-set? char unescaped)
(write-char char port)
(begin
(write-char #\% port)
((fix:= 1 (string-length (symbol->string key)))
`(CHAR=? CHAR ,(string-ref (symbol->string key) 0)))
(else
- `(CHAR-SET-MEMBER? ,(symbol 'CHAR-SET:URI- key) CHAR)))
+ `(CHAR-in-SET? CHAR ,(symbol 'CHAR-SET:URI- key))))
,@(map (lambda (action)
(cond ((action:push? action) (expand:push action))
((action:set? action) (expand:set action))
(define (skip-white i)
(if (and (fix:< i end)
- (char-set-member? char-set:whitespace (string-ref text i)))
+ (char-in-set? (string-ref text i) char-set:whitespace))
(skip-white (fix:+ i 1))
i))
(define (skip-non-white i)
(if (and (fix:< i end)
- (not (char-set-member? char-set:whitespace
- (string-ref text i))))
+ (not (char-in-set? (string-ref text i) char-set:whitespace)))
(skip-non-white (fix:+ i 1))
i))
(write-string "\"" port)))
(define (write-literal-char char port)
- (if (char-set-member? char-set:unescaped char)
+ (if (char-in-set? char char-set:unescaped)
(write-char char port)
(begin
(write-char #\\ port)
(let ((text (xml-processing-instructions-text pi)))
(if (fix:> (string-length text) 0)
(begin
- (if (not (char-set-member? char-set:xml-whitespace
- (string-ref text 0)))
+ (if (not (char-in-set? (string-ref text 0)
+ char-set:xml-whitespace))
(emit-string " " ctx))
(emit-string text ctx))))
(emit-string "?>" ctx))
(if (not (unicode-scalar-value? n))
(perror p "Invalid code point" n))
(let ((char (integer->char n)))
- (if (not (char-set-member? char-set:xml-char char))
+ (if (not (char-in-set? char char-set:xml-char))
(perror p "Disallowed Unicode character" char))
(call-with-output-string
(lambda (port)
(define (substring-composed-of? string start end char-set)
(let loop ((index start))
(or (fix:= index end)
- (and (char-set-member? char-set (string-ref string index))
+ (and (char-in-set? (string-ref string index) char-set)
(loop (fix:+ index 1))))))
(define-xml-type declaration