dev-validator
Matthew Butterick 11 years ago
parent 204d8e0f29
commit e12036d7d6

@ -27,8 +27,8 @@
[else #f]))
(define+provide+safe (validate-txexpr-attrs? x #:context [txexpr-context #f])
((any/c) (#:context (or/c #f txexpr?)) . ->* . txexpr-attrs?)
(define (validate-txexpr-attrs? x #:context [txexpr-context #f])
; ((any/c) (#:context (or/c #f txexpr?)) . ->* . txexpr-attrs?)
(define (make-reason)
(if (not (list? x))
(format "because ~v is not a list" x)
@ -54,8 +54,8 @@
[(list elem ...) (andmap txexpr-element? elem)]
[else #f]))
(define+provide+safe (validate-txexpr-element? x #:context [txexpr-context #f])
((any/c) (#:context (or/c #f txexpr?)) . ->* . txexpr-element?)
(define (validate-txexpr-element? x #:context [txexpr-context #f])
; ((any/c) (#:context (or/c #f txexpr?)) . ->* . txexpr-element?)
(cond
[(or (string? x) (txexpr? x) (symbol? x)
(valid-char? x) (cdata? x)) x]

@ -146,6 +146,23 @@ boolean?]
Shorthand for @code{(listof txexpr-attr?)} and @code{(listof txexpr-element?)}.
@deftogether[(
@defproc[
(validate-txexpr?
[possible-txexpr any/c])
txexpr?]
@defproc[
(can-be-txexpr-attr-value?
[v any/c])
boolean?]
)]
Predicates for input arguments that are trivially converted to an attribute @racket[_key] or @racket[_value]…
@deftogether[(
@defproc[

Loading…
Cancel
Save