changed the meaning of one of the pretty-print parameters slightly and used that to fix redex's stepper

svn: r15419
This commit is contained in:
Robby Findler 2009-07-09 15:55:11 +00:00
parent ac2367b441
commit 5adb4eb004
3 changed files with 16 additions and 8 deletions

View File

@ -1186,7 +1186,7 @@
(define (read-macro? l pair? car cdr)
(define (length1? l) (and (pair? l) (null? (cdr l))))
(and (pretty-print-abbreviate-read-macros)
(let ((head (car l)) (tail (cdr l)))
(let ((head (do-remap (car l))) (tail (cdr l)))
(case head
((quote quasiquote unquote unquote-splicing syntax unsyntax unsyntax-splicing)
(length1? tail))
@ -1196,7 +1196,7 @@
(car (cdr l)))
(define (read-macro-prefix l car)
(let ((head (car l)))
(let ((head (do-remap (car l))))
(case head
((quote) "'")
((quasiquote) "`")

View File

@ -56,6 +56,7 @@
(list->vector (map loop (vector->list s)))]
[(box? s)
(box (loop (unbox s)))]
[(syntax? s) (datum->syntax s (unkink (loop (syntax-e s))) s)]
[(number? s) (make-wrap s)]
[(symbol? s) (make-wrap s)]
[else s])))
@ -89,8 +90,7 @@
;; render-sexp/colors : sexp ht text -> void
(define (render-sexp/colors sexp to-color text columns)
(let ([start '()])
(parameterize ([pretty-print-columns columns]
[pretty-print-abbreviate-read-macros #f])
(parameterize ([pretty-print-columns columns])
(pretty-print sexp (open-output-text-editor text)))
(for-each
(λ (p) (send text highlight-range (car p) (cdr p) (send the-color-database find-color "NavajoWhite")))
@ -122,7 +122,6 @@
1]))
void)])
(parameterize ([pretty-print-columns columns]
[pretty-print-abbreviate-read-macros #f]
[pretty-print-remap-stylable
(λ (val)
(and (wrap? val)

View File

@ -117,7 +117,10 @@ printed with a leading @litchar{#i}. The initial value is @scheme[#f].}
A parameter that controls whether or not @schemeidfont{quote},
@schemeidfont{unquote}, @schemeidfont{unquote-splicing}, @|etc| are
abbreviated with @litchar{'}, @litchar{,}, @litchar[",@"], etc.
By default, the abbreviations are enabled.}
By default, the abbreviations are enabled.
See also @scheme[pretty-print-remap-stylable].
}
@defproc[(pretty-print-style-table? [v any/c]) boolean?]{
@ -179,11 +182,17 @@ so that the output follows popular code-formatting rules:
proc
(any/c . -> . (or/c symbol? #f))]{
A parameter that controls remapping for styles. This procedure is
A parameter that controls remapping for styles and for the determination of
the reader shorthands.
This procedure is
called with each subexpression that appears as the first element in a
sequence. If it returns a symbol, the style table is used, as if that
symbol were at the head of the sequence. If it returns @scheme[#f],
the style table is treated normally.}
the style table is treated normally.
Similarly, when determining whether or not to abbreviate reader macros,
the parameter is consulted.
}
@; ----------------------------------------------------------------------