at-exp, scribble: remove distinctness of @{}-introduced newlines
This commit is contained in:
parent
c87cd47c64
commit
fe3b6ea003
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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?
|
||||
|
|
Loading…
Reference in New Issue
Block a user