more comment-reader spacing adjustments
svn: r14447
This commit is contained in:
parent
de3d090f1a
commit
9d563bf4f4
|
@ -32,6 +32,8 @@
|
||||||
(when (equal? #\; (peek-char port))
|
(when (equal? #\; (peek-char port))
|
||||||
(read-char port)
|
(read-char port)
|
||||||
(loop)))
|
(loop)))
|
||||||
|
(when (equal? #\space (peek-char port))
|
||||||
|
(read-char port))
|
||||||
`(code:comment
|
`(code:comment
|
||||||
(unsyntax
|
(unsyntax
|
||||||
(t
|
(t
|
||||||
|
@ -53,18 +55,21 @@
|
||||||
(cond
|
(cond
|
||||||
[(null? l) (if (null? s)
|
[(null? l) (if (null? s)
|
||||||
null
|
null
|
||||||
(list (apply string-append (reverse s))))]
|
(preserve-space (apply string-append (reverse s))))]
|
||||||
[(and (equal? " " (car l))
|
|
||||||
(pair? s)
|
|
||||||
(equal? " " (car s)))
|
|
||||||
(append (loop null s)
|
|
||||||
(cons ''nbsp
|
|
||||||
(loop (cdr l) null)))]
|
|
||||||
[(string? (car l))
|
[(string? (car l))
|
||||||
(loop (cdr l) (cons (car l) s))]
|
(loop (cdr l) (cons (car l) s))]
|
||||||
[else
|
[else
|
||||||
(append (loop null s)
|
(append (loop null s)
|
||||||
(cons
|
(cons
|
||||||
(car l)
|
(car l)
|
||||||
(loop (cdr l) null)))]))))
|
(loop (cdr l) null)))])))
|
||||||
|
|
||||||
|
(define (preserve-space s)
|
||||||
|
(let ([m (regexp-match-positions #rx" +" s)])
|
||||||
|
(if m
|
||||||
|
(append (preserve-space (substring s 0 (caar m)))
|
||||||
|
(list `(hspace ,(- (cdar m) (caar m))))
|
||||||
|
(preserve-space (substring s (cdar m))))
|
||||||
|
(list s)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,8 @@
|
||||||
"does not have a single sub-form"
|
"does not have a single sub-form"
|
||||||
c)))
|
c)))
|
||||||
(advance c init-line!)
|
(advance c init-line!)
|
||||||
(out "; " comment-color)
|
(out ";" comment-color)
|
||||||
|
(out 'nbsp comment-color)
|
||||||
(let ([v (syntax->datum (cadr (syntax->list c)))])
|
(let ([v (syntax->datum (cadr (syntax->list c)))])
|
||||||
(if (paragraph? v)
|
(if (paragraph? v)
|
||||||
(map (lambda (v)
|
(map (lambda (v)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user