diff --git a/collects/scribble/reader.rkt b/collects/scribble/reader.rkt index 442f7b76a1..b0689ffe52 100644 --- a/collects/scribble/reader.rkt +++ b/collects/scribble/reader.rkt @@ -154,11 +154,9 @@ (+ w (if (eq? 9 (bytes-ref bs i)) (- 8 (modulo w 8)) 1)))))))) ;; a unique eol string -(define eol-token "\n") -(define (eol-syntax? x) (and (syntax? x) (eq? eol-token (syntax-e x)))) -;; sanity check, in case this property gets violated in the future -(unless (eol-syntax? (datum->syntax #f eol-token)) - (internal-error 'invalid-assumption)) +(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"))) @@ -265,8 +263,8 @@ (let* ([2nd (and (syntax? stx) (syntax-e stx))] [stx0 (and (pair? stxs) (car stxs))] [1st (and (syntax? stx0) (syntax-e stx0))]) - (if (and (string? 1st) (not (eq? eol-token 1st)) - (string? 2nd) (not (eq? eol-token 2nd))) + (if (and (string? 1st) (not (eol-syntax? stx0)) + (string? 2nd) (not (eol-syntax? stx))) (cons (datum->syntax stx0 (string-append 1st 2nd) (vector (syntax-source stx0) @@ -318,7 +316,7 @@ (loop lvl (list* ; no merge needed (bytes-width m (cdr n)) (syntax-property - (make-stx eol-token) + (syntax-property (make-stx "\n") at-exp-prop #t) 'scribble `(newline ,(bytes->string/utf-8 m))) (maybe-drop-marker r)))))] [(if re:cmd-pfx diff --git a/collects/scribblings/scribble/reader.scrbl b/collects/scribblings/scribble/reader.scrbl index d84bccc275..680df5dc9f 100644 --- a/collects/scribblings/scribble/reader.scrbl +++ b/collects/scribblings/scribble/reader.scrbl @@ -629,29 +629,6 @@ newlines are read as a @racket["\n"] string baz } }===| -In the parsed S-expression syntax, a single newline string is used for -all newlines; you can use @racket[eq?] to identify this line. This -can be used to identify newlines in the original @nonterm{text-body}. - -@; FIXME: unfortunate code duplication (again): -@interaction[ -(eval:alts - (let ([nl (car @#,tt["@'{"] - @#,tt[" }"])]) - (for-each (lambda (x) (display (if (eq? x nl) "\n... " x))) - @#,tt["@`{foo"] - @#,elem[@tt[" @"] @racket[,@(list "bar" "\n" "baz")]] - @#,tt[" blah}}"]) - (newline)) - (let ([nl (car @'{ - })]) - (for-each (lambda (x) (display (if (eq? x nl) "\n... " x))) - @`{foo - @,@(list "bar" "\n" "baz") - blah}) - (newline))) -] - Spaces at the beginning of body lines do not appear in the resulting S-expressions, but the column of each line is noticed, and all-space indentation strings are added so the result has the same indentation. diff --git a/collects/tests/scribble/reader.rkt b/collects/tests/scribble/reader.rkt index 0b5c100649..bc10536ece 100644 --- a/collects/tests/scribble/reader.rkt +++ b/collects/tests/scribble/reader.rkt @@ -744,18 +744,6 @@ foo -@eval-> "/Note/: *This is _not_ a pipe*." --- -(let ([nl (car @'{ - })] - [o (open-output-string)]) - (for-each (lambda (x) (display (if (eq? x nl) "\n... " x) o)) - @`{foo - @,@(list "bar" "\n" "baz") - blah}) - (newline o) - (get-output-string o)) --@eval-> -"foo\n... bar\nbaz\n... blah\n" ---- (require (for-syntax scheme/base)) (let-syntax ([foo (lambda (stx) diff --git a/doc/release-notes/racket/HISTORY.txt b/doc/release-notes/racket/HISTORY.txt index d7a85186df..851dcc51e3 100644 --- a/doc/release-notes/racket/HISTORY.txt +++ b/doc/release-notes/racket/HISTORY.txt @@ -8,6 +8,7 @@ racket/draw: added get-names to color-database<%> mzlib/pconvert: added add-make-prefix-to-constructor parameter, which changes the default constructor-style printing in DrRacket to avoid a make- prefix; the HtDP languages set the parameter to #t +at-exp, scribble: dropped distinctness of @{}-introduced newline strings Version 5.2.0.3 Added module-predefined?