No need to use a new 'at-exp-prop property to identify newlines

The information is already present in the 'scribble property, so use it
instead.
This commit is contained in:
Eli Barzilay 2012-05-02 20:19:13 -04:00
parent 5fd13c82c3
commit 97850b5002

View File

@ -153,11 +153,6 @@
(loop (add1 i)
(+ w (if (eq? 9 (bytes-ref bs i)) (- 8 (modulo w 8)) 1))))))))
;; a unique eol string
(define at-exp-prop (gensym 'at-exp-eol))
(define (eol-syntax? x)
(and (syntax? x) (syntax-property x at-exp-prop)))
;; A syntax object that has the "original?" property:
(define orig-stx (read-syntax #f (open-input-string "dummy")))
@ -207,6 +202,11 @@
(read-error line col pos 'eof "expected a '~a'" end-ch)
(loop (if (special-comment? x) r (cons x r))))))))))
;; identifies newlines in text
(define (eol-syntax? x)
(let ([p (and (syntax? x) (syntax-property x 'scribble))])
(and (pair? p) (eq? 'newline (car p)))))
;; gets an accumulated (reversed) list of syntaxes and column markers, and
;; sorts things out (remove prefix and suffix newlines, adds indentation if
;; needed)
@ -316,7 +316,7 @@
(loop lvl (list* ; no merge needed
(bytes-width m (cdr n))
(syntax-property
(syntax-property (make-stx "\n") at-exp-prop #t)
(make-stx "\n")
'scribble `(newline ,(bytes->string/utf-8 m)))
(maybe-drop-marker r)))))]
[(if re:cmd-pfx