Changeset 10214


Ignore:
Timestamp:
Jul 27, 2008, 4:09:41 PM (11 years ago)
Author:
gz
Message:

Fix pretty printer to not remove quoted spaces at end of line

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lib/pprint.lisp

    r9917 r10214  
    969969
    970970(defun output-line (xp Qentry)
    971   (flet ((find-not-char-reverse (char buffer out-point)
    972            (do ((i (%i- out-point 1) (%i- i 1)))
    973                (nil)
    974              (cond ((%i< i 0)(return nil))
    975                    ((neq (schar buffer i) char)
    976                     (return i))))))
     971  (flet ((find-not-char-reverse (buffer out-point)
     972           (declare (type simple-base-string buffer) (type fixnum out-point))
     973           (do ((i (%i- out-point 1) (%i- i 1)))
     974               ((%i< i 0) nil)
     975             (when (or (neq (schar buffer i) #\Space)
     976                       ;; Don't match possibly-quoted space ("possibly" because the #\\ itself might be
     977                       ;; quoted; don't bother checking for that, no big harm leaving the space even if
     978                       ;; not totally necessary).
     979                       (and (%i< 0 i) (eq (schar buffer (%i- i 1)) #\\)))
     980               (return i)))))
    977981    (let* ((queue (xp-queue xp))
    978982           (out-point (BP<-TP xp (xpq-pos queue Qentry)))
    979            (last-non-blank (find-not-char-reverse #\space (xp-buffer xp) out-point))
     983           (last-non-blank (find-not-char-reverse (xp-buffer xp) out-point))
    980984           (end (cond ((memq (xpq-kind queue Qentry) '(:fresh :unconditional)) out-point)
    981985                      (last-non-blank (%i+ 1 last-non-blank))
Note: See TracChangeset for help on using the changeset viewer.