racket/serialize: support keywords and regexp values
This commit is contained in:
parent
b243ce894a
commit
a134d0c0a3
|
@ -42,8 +42,8 @@ The following kinds of values are serializable:
|
|||
or @racket[define-serializable-class*];}
|
||||
|
||||
@item{@tech{booleans}, @tech{numbers}, @tech{characters}, @tech{interned} symbols,
|
||||
@tech{unreadable symbols}, @tech{strings}, @tech{byte strings}, @tech{paths} (for a
|
||||
specific convention), @|void-const|, and the empty list;}
|
||||
@tech{unreadable symbols}, @tech{keywords}, @tech{strings}, @tech{byte strings}, @tech{paths} (for a
|
||||
specific convention), @tech{regexp values}, @|void-const|, and the empty list;}
|
||||
|
||||
@item{@tech{pairs}, @tech{mutable pairs}, @tech{vectors}, @tech{flvectors}, @tech{fxvectors},
|
||||
@tech{box}es, @tech{hash tables}, and @tech{sets};}
|
||||
|
@ -70,7 +70,9 @@ currently do not handle certain cyclic values that @racket[read] and
|
|||
@racket[write] can handle, such as @racket['@#,read[(open-input-string "#0=(#0#)")]].}
|
||||
|
||||
See @racket[deserialize] for information on the format of serialized
|
||||
data.}
|
||||
data.
|
||||
|
||||
@history[#:changed "6.5.0.4" @elem{Added keywords and regexp values as serializable}]}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
(and (symbol? v)
|
||||
(or (symbol-interned? v)
|
||||
(eq? v (string->unreadable-symbol (symbol->string v)))))
|
||||
(keyword? v)
|
||||
(regexp? v)
|
||||
(byte-regexp? v)
|
||||
(string? v)
|
||||
(path-for-some-system? v)
|
||||
(bytes? v)
|
||||
|
@ -201,6 +204,7 @@
|
|||
(number? v)
|
||||
(char? v)
|
||||
(symbol? v)
|
||||
(keyword? v)
|
||||
(null? v)
|
||||
(void? v)
|
||||
(srcloc? v))
|
||||
|
@ -239,6 +243,8 @@
|
|||
(for-each loop (struct->list v))]
|
||||
[(or (string? v)
|
||||
(bytes? v)
|
||||
(regexp? v)
|
||||
(byte-regexp? v)
|
||||
(path-for-some-system? v))
|
||||
;; No sub-structure
|
||||
(void)]
|
||||
|
@ -286,6 +292,9 @@
|
|||
(null? v)
|
||||
(string? v)
|
||||
(symbol? v)
|
||||
(keyword? v)
|
||||
(regexp? v)
|
||||
(byte-regexp? v)
|
||||
(bytes? v))))
|
||||
|
||||
(define (serialize-one v share check-share? mod-map mod-map-cache)
|
||||
|
@ -294,7 +303,8 @@
|
|||
[(or (boolean? v)
|
||||
(number? v)
|
||||
(char? v)
|
||||
(null? v))
|
||||
(null? v)
|
||||
(keyword? v))
|
||||
v]
|
||||
[(symbol? v)
|
||||
(if (symbol-interned? v)
|
||||
|
@ -309,6 +319,9 @@
|
|||
(bytes? v))
|
||||
(immutable? v))
|
||||
v]
|
||||
[(or (regexp? v)
|
||||
(byte-regexp? v))
|
||||
v]
|
||||
[(serializable-struct? v)
|
||||
(let ([info (serializable-info v)])
|
||||
(cons (mod-to-id info mod-map mod-map-cache)
|
||||
|
@ -492,6 +505,9 @@
|
|||
(number? v)
|
||||
(char? v)
|
||||
(symbol? v)
|
||||
(keyword? v)
|
||||
(regexp? v)
|
||||
(byte-regexp? v)
|
||||
(null? v))
|
||||
v]
|
||||
[(string? v)
|
||||
|
|
|
@ -176,12 +176,12 @@
|
|||
(lambda (s)
|
||||
#,@(if super-info
|
||||
(map (lambda (set get)
|
||||
#`(#,set s0 (#,get s)))
|
||||
#`((or #,set void) s0 (#,get s)))
|
||||
(list-ref super-info 4)
|
||||
(list-ref super-info 3))
|
||||
null)
|
||||
#,@(map (lambda (getter setter)
|
||||
#`(#,setter s0 (#,getter s)))
|
||||
#`((or #,setter void) s0 (#,getter s)))
|
||||
getters
|
||||
setters)
|
||||
(void))))))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user