more liberal text conversion in decode

pull/9/head
Matthew Butterick 11 years ago
parent 0604300a7d
commit 7901b76d6d

@ -7,15 +7,14 @@
(define+provide (to-string x) (define+provide (to-string x)
(if (string? x) (if (string? x)
x ; fast exit for strings x ; fast exit for strings
(with-handlers ([exn:fail? (λ(exn) (error (format "Pollen parser: can't convert ~v to ~a" x 'string)))]) (with-handlers ([exn:fail? (λ(exn) (error (format "Pollen decoder: can't convert ~v to ~a" x 'string)))])
(cond (cond
[(equal? '() x) ""] [(equal? '() x) ""]
[(symbol? x) (symbol->string x)] [(symbol? x) (symbol->string x)]
[(number? x) (number->string x)] [(number? x) (number->string x)]
[(path? x) (path->string x)] [(path? x) (path->string x)]
[(char? x) (format "~a" x)] [(char? x) (format "~a" x)]
[(txexpr? x) (format "~v" x)] ; todo: good or bad idea? will print expressions in preproc mode [else (format "~v" x)]))))
[else (error)])))) ; put this last so other xexprish things don't get caught
;; decoder wireframe ;; decoder wireframe

Loading…
Cancel
Save