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:
parent
5fd13c82c3
commit
97850b5002
|
@ -153,11 +153,6 @@
|
||||||
(loop (add1 i)
|
(loop (add1 i)
|
||||||
(+ w (if (eq? 9 (bytes-ref bs i)) (- 8 (modulo w 8)) 1))))))))
|
(+ 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:
|
;; A syntax object that has the "original?" property:
|
||||||
(define orig-stx (read-syntax #f (open-input-string "dummy")))
|
(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)
|
(read-error line col pos 'eof "expected a '~a'" end-ch)
|
||||||
(loop (if (special-comment? x) r (cons x r))))))))))
|
(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
|
;; gets an accumulated (reversed) list of syntaxes and column markers, and
|
||||||
;; sorts things out (remove prefix and suffix newlines, adds indentation if
|
;; sorts things out (remove prefix and suffix newlines, adds indentation if
|
||||||
;; needed)
|
;; needed)
|
||||||
|
@ -316,7 +316,7 @@
|
||||||
(loop lvl (list* ; no merge needed
|
(loop lvl (list* ; no merge needed
|
||||||
(bytes-width m (cdr n))
|
(bytes-width m (cdr n))
|
||||||
(syntax-property
|
(syntax-property
|
||||||
(syntax-property (make-stx "\n") at-exp-prop #t)
|
(make-stx "\n")
|
||||||
'scribble `(newline ,(bytes->string/utf-8 m)))
|
'scribble `(newline ,(bytes->string/utf-8 m)))
|
||||||
(maybe-drop-marker r)))))]
|
(maybe-drop-marker r)))))]
|
||||||
[(if re:cmd-pfx
|
[(if re:cmd-pfx
|
||||||
|
|
Loading…
Reference in New Issue
Block a user