|
471 | 471 | (if qmode |
472 | 472 | (recur r2 (not= c2 \E)) |
473 | 473 | (recur r2 (= c2 \Q)))) |
474 | | - (= c \") (do |
| 474 | + (= c \") (do;;; " (Just to keep the display happy in the editor) |
475 | 475 | (if qmode |
476 | 476 | (.Write w "\\E\\\"\\Q") |
477 | 477 | (.Write w "\\\"")) |
478 | 478 | (recur r qmode)) |
479 | 479 | :else (do |
480 | 480 | (.Write w c) |
481 | 481 | (recur r qmode))))) |
482 | | - (.Write w \")) |
| 482 | + (.Write w \")) ;;; " (Just to keep the display happy in the editor) |
483 | 483 |
|
484 | 484 | (defmethod print-dup System.Text.RegularExpressions.Regex [p ^System.IO.TextWriter w] (print-method p w)) ;;; java.util.regex.Pattern => |
485 | 485 |
|
|
621 | 621 | ;;;(defn ^java.io.PrintWriter PrintWriter-on |
622 | 622 | ;;; "implements java.io.PrintWriter given flush-fn, which will be called |
623 | 623 | ;;; when .flush() is called, with a string built up since the last call to .flush(). |
624 | | -;;; if not nil, close-fn will be called with no arguments when .close is called" |
| 624 | +;;; if not nil, close-fn will be called with no arguments when .close is called. |
| 625 | +;;; autoflush? determines if the PrintWriter will autoflush, false by default." |
625 | 626 | ;;; {:added "1.10"} |
626 | | -;;; [flush-fn close-fn] |
627 | | -;;; (let [sb (StringBuilder.)] |
| 627 | +;;; ([flush-fn close-fn] |
| 628 | +;;; (PrintWriter-on flush-fn close-fn false)) |
| 629 | +;;; ([flush-fn close-fn autoflush?] |
| 630 | +;;; (let [sb (StringBuilder.)] |
628 | 631 | ;;; (-> (proxy [Writer] [] |
629 | 632 | ;;; (flush [] |
630 | 633 | ;;; (when (pos? (.length sb)) |
|
643 | 646 | ;;; java.io.PrintWriter.))) |
644 | 647 |
|
645 | 648 | (defn ^System.IO.TextWriter PrintWriter-on |
646 | | - [flush-fn close-fn] |
647 | | - (proxy [System.IO.StringWriter] [] |
648 | | - (Flush [] |
| 649 | + ([flush-fn close-fn] |
| 650 | + (PrintWriter-on flush-fn close-fn false)) |
| 651 | + ([flush-fn close-fn autoflush?] ;;; there is no autflush property for StringWriter |
| 652 | + (proxy [System.IO.StringWriter] [] |
| 653 | + (Flush [] |
649 | 654 | (let [^System.IO.StringWriter this this] |
650 | 655 | (proxy-super Flush)) |
651 | 656 | (let [sb (.GetStringBuilder ^System.IO.StringWriter this)] |
652 | 657 | (when (pos? (.Length sb)) |
653 | 658 | (flush-fn (.ToString sb))) |
654 | 659 | (.set_Length sb 0))) |
655 | | - (Close [] |
| 660 | + (Close [] |
656 | 661 | (.Flush ^System.IO.StringWriter this) |
657 | 662 | (when close-fn (close-fn)) |
658 | 663 | (let [^System.IO.StringWriter this this] |
659 | 664 | (proxy-super Close)) |
660 | | - nil))) |
| 665 | + nil)))) |
661 | 666 |
|
662 | 667 |
|
0 commit comments