Improve verbose printer.
- Fewer newlines. - Avoid printing hidden fields.
This commit is contained in:
parent
16affcd86d
commit
fac0e197cf
|
@ -1,7 +1,7 @@
|
|||
#lang scheme/base
|
||||
(require "../utils/utils.rkt")
|
||||
|
||||
(require mzlib/struct
|
||||
(require mzlib/struct mzlib/pconvert
|
||||
scheme/match
|
||||
syntax/boundmap
|
||||
"free-variance.rkt"
|
||||
|
@ -265,4 +265,20 @@
|
|||
(apply maker (list-update flds idx new-val)))
|
||||
|
||||
(define (replace-syntax rep stx)
|
||||
(replace-field rep stx 3))
|
||||
(replace-field rep stx 3))
|
||||
|
||||
(define (converter v basic sub)
|
||||
(define (gen-constructor sym)
|
||||
(string->symbol (string-append "make-" (substring (symbol->string sym) 7))))
|
||||
(match v
|
||||
[(? (lambda (e) (or (Filter? e)
|
||||
(Object? e)
|
||||
(PathElem? e)))
|
||||
(app (lambda (v) (vector->list (struct->vector v))) (list-rest tag seq fv fi stx vals)))
|
||||
`(,(gen-constructor tag) ,@(map sub vals))]
|
||||
[(? Type?
|
||||
(app (lambda (v) (vector->list (struct->vector v))) (list-rest tag seq fv fi stx key vals)))
|
||||
`(,(gen-constructor tag) ,@(map sub vals))]
|
||||
[_ (basic v)]))
|
||||
|
||||
(current-print-convert-hook converter)
|
|
@ -139,15 +139,12 @@ at least theoretically.
|
|||
print-type* print-filter* print-latentfilter* print-object* print-latentobject*
|
||||
print-pathelem*)
|
||||
|
||||
(define pseudo-printer
|
||||
(lambda (s port mode)
|
||||
(parameterize ([current-output-port port]
|
||||
[show-sharing #f]
|
||||
[booleans-as-true/false #f]
|
||||
[constructor-style-printing #t])
|
||||
(newline)
|
||||
(pretty-print (print-convert s))
|
||||
(newline))))
|
||||
(define (pseudo-printer s port mode)
|
||||
(parameterize ([current-output-port port]
|
||||
[show-sharing #f]
|
||||
[booleans-as-true/false #f]
|
||||
[constructor-style-printing #t])
|
||||
(pretty-print (print-convert s))))
|
||||
|
||||
(define custom-printer (make-parameter #t))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user