more doc fixes

svn: r7881

original commit: c9545a836b2f9a7128cf632e2222dbe9d84de8fc
This commit is contained in:
Matthew Flatt 2007-12-01 02:47:17 +00:00
parent f8be6eb9db
commit 94fce663e9
2 changed files with 14 additions and 10 deletions

View File

@ -45,14 +45,18 @@
(define-struct (sized-element element) (length)) (define-struct (sized-element element) (length))
(define-struct spaces (pre cnt post)) (define-struct (spaces element) (cnt))
(define (literalize-spaces i) (define (literalize-spaces i)
(let ([m (regexp-match-positions #rx" +" i)]) (let ([m (regexp-match-positions #rx" +" i)])
(if m (if m
(make-spaces (literalize-spaces (substring i 0 (caar m))) (let ([cnt (- (cdar m) (caar m))])
(- (cdar m) (caar m)) (make-spaces #f
(literalize-spaces (substring i (cdar m)))) (list
(literalize-spaces (substring i 0 (caar m)))
(make-element 'hspace (list (make-string cnt #\space)))
(literalize-spaces (substring i (cdar m))))
cnt))
i))) i)))
(define (typeset-atom c out color? quote-depth) (define (typeset-atom c out color? quote-depth)
@ -150,17 +154,17 @@
[(delayed-element? v) [(delayed-element? v)
(element-width v)] (element-width v)]
[(spaces? v) [(spaces? v)
(+ (sz-loop (spaces-pre v)) (+ (sz-loop (car (element-content v)))
(spaces-cnt v) (spaces-cnt v)
(sz-loop (spaces-post v)))] (sz-loop (caddr (element-content v))))]
[else 1])))] [else 1])))]
[(v cls len) [(v cls len)
(unless (equal? v "") (unless (equal? v "")
(cond (cond
[(spaces? v) [(spaces? v)
(out (spaces-pre v) cls 0) (out (car (element-content v)) cls 0)
(out (make-element 'hspace (list (make-string (spaces-cnt v) #\space))) #f 0) (out (cadr (element-content v)) #f 0)
(out (spaces-post v) cls len)] (out (caddr (element-content v)) cls len)]
[(equal? v "\n") [(equal? v "\n")
(if multi-line? (if multi-line?
(begin (begin

View File

@ -66,7 +66,7 @@
(syntax-case stx () (syntax-case stx ()
[(_ (id ([field ct] ...)) ...) [(_ (id ([field ct] ...)) ...)
#`(begin #`(begin
(define-serializable-struct id (field ...) #:mutable) ... (define-serializable-struct id (field ...)) ...
(provide/contract (provide/contract
#,@(let ([ids (syntax->list #'(id ...))] #,@(let ([ids (syntax->list #'(id ...))]
[fields+cts (syntax->list #'(([field ct] ...) ...))]) [fields+cts (syntax->list #'(([field ct] ...) ...))])