|
14 | 14 | ;; Dynamic Vars for Configuration ;;
|
15 | 15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
16 | 16 |
|
17 |
| -(def ^{:doc "The base used for printing integer literals and rationals. Default is 10." |
| 17 | +(def ^{:doc "The base used for printing integer literals and rationals. |
| 18 | + |
| 19 | + Default is 10." |
18 | 20 | :dynamic true}
|
19 | 21 | *print-base*
|
20 | 22 | 10)
|
|
37 | 39 | nil)
|
38 | 40 |
|
39 | 41 | (def ^{:doc "If bound to ``true``, calls to :lpy:fn:`write` will use pretty printing.
|
| 42 | + |
40 | 43 | Default is ``false``, but :lpy:fn:`pprint` binds the value to ``true``."
|
41 | 44 | :dynamic true}
|
42 | 45 | *print-pretty*
|
|
45 | 48 | (def ^{:doc "If bound to ``true``, integers and rationals will be printed with a radix
|
46 | 49 | prefix. For bases 2, 8, and 16 the prefix will be ``#b``, ``#o`` and ``#x``
|
47 | 50 | respectively. All other bases will be specified as ``#XXr`` where ``XX`` is
|
48 |
| - the decimal value of :lpy:var:`*print-base*`." |
| 51 | + the decimal value of :lpy:var:`*print-base*`. |
| 52 | + |
| 53 | + Default is ``false``." |
49 | 54 | :dynamic true}
|
50 | 55 | *print-radix*
|
51 | 56 | false)
|
52 | 57 |
|
53 |
| -(def ^{:doc "The soft upper limit for the length of the right margin. Default is 72." |
| 58 | +(def ^{:doc "The soft upper limit for the length of the right margin. |
| 59 | + |
| 60 | + Default is 72." |
54 | 61 | :dynamic true}
|
55 | 62 | *print-right-margin*
|
56 | 63 | 72)
|
|
222 | 229 | (split-queue-with comparator (pop buffer))))
|
223 | 230 |
|
224 | 231 | (defprotocol PrettyWriter
|
225 |
| - "Protocol defining a writer type for pretty printing with the XP algorithm." |
| 232 | + "Protocol defining a writer type for pretty printing with the XP algorithm. |
| 233 | + |
| 234 | + Callers should generally not be calling ``PrettyWriter`` protocol methods directly, |
| 235 | + but should instead call the other helper functions and macros directly. |
| 236 | + |
| 237 | + .. seealso:: |
| 238 | + |
| 239 | + :lpy:fn:`pprint-logical-block`, :lpy:fn:`print-length-loop`, |
| 240 | + :lpy:fn:`pprint-newline`, :lpy:fn:`pprint-indent`" |
226 | 241 | (start-block [this prefix per-line-prefix suffix])
|
227 | 242 | (end-block [this])
|
228 | 243 | (pp-indent [this relative-to offset])
|
|
287 | 302 | (and miser-width
|
288 | 303 | max-col
|
289 | 304 | (>= (.-start-col (.-block token)) (- max-col miser-width))
|
290 |
| - (emit-linear-nl? token section))) |
291 |
| - ;; TODO: figure out how to handle these newline types |
292 |
| - :fill nil)) |
| 305 | + (emit-linear-nl? token section))))) |
293 | 306 |
|
294 | 307 | ;; Generate the newline and subsequent indent from a newline token token.
|
295 | 308 | (gen-nl [token]
|
|
0 commit comments