make racket' preserve
#t' versus `#true'
original commit: c7e7d0d8ffe94221573b5bd0e9b6c9bd53dcad9a
This commit is contained in:
parent
4b7c597f04
commit
97bf4968a3
|
@ -122,7 +122,11 @@
|
|||
(make-element symbol-color (list (to-element/no-color s))))
|
||||
|
||||
(define-syntax (keep-s-expr stx)
|
||||
(syntax-case stx ()
|
||||
(syntax-case stx (quote)
|
||||
[(_ ctx '#t #(src line col pos 5))
|
||||
#'(make-long-boolean #t)]
|
||||
[(_ ctx '#f #(src line col pos 6))
|
||||
#'(make-long-boolean #f)]
|
||||
[(_ ctx s srcloc)
|
||||
(let ([sv (syntax-e
|
||||
(syntax-case #'s (quote)
|
||||
|
@ -134,10 +138,10 @@
|
|||
(identifier? (car sv))
|
||||
(or (free-identifier=? #'cons (car sv))
|
||||
(free-identifier=? #'list (car sv)))))
|
||||
;; We know that the context is irrelvant
|
||||
#'s
|
||||
;; Context may be relevant:
|
||||
#'(*keep-s-expr s ctx)))]))
|
||||
;; We know that the context is irrelvant
|
||||
#'s
|
||||
;; Context may be relevant:
|
||||
#'(*keep-s-expr s ctx)))]))
|
||||
(define (*keep-s-expr s ctx)
|
||||
(if (symbol? s)
|
||||
(make-just-context s ctx)
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
|
||||
(struct-out var-id)
|
||||
(struct-out shaped-parens)
|
||||
(struct-out long-boolean)
|
||||
(struct-out just-context)
|
||||
(struct-out alternate-display)
|
||||
(struct-out literal-syntax)
|
||||
|
@ -1010,6 +1011,7 @@
|
|||
|
||||
(define-struct var-id (sym))
|
||||
(define-struct shaped-parens (val shape))
|
||||
(define-struct long-boolean (val))
|
||||
(define-struct just-context (val ctx))
|
||||
(define-struct alternate-display (id string))
|
||||
(define-struct literal-syntax (stx))
|
||||
|
@ -1069,6 +1071,10 @@
|
|||
(syntax-property (do-syntax-ize (shaped-parens-val v) col line ht #f qq #f)
|
||||
'paren-shape
|
||||
(shaped-parens-shape v))]
|
||||
[(long-boolean? v)
|
||||
(datum->syntax #f
|
||||
(and (long-boolean-val v) #t)
|
||||
(vector #f line col (+ 1 col) (if (long-boolean-val v) 5 6)))]
|
||||
[(just-context? v)
|
||||
(let ([s (do-syntax-ize (just-context-val v) col line ht #f qq #f)])
|
||||
(datum->syntax (just-context-ctx v)
|
||||
|
|
|
@ -126,6 +126,13 @@ When @racket[to-paragraph] and variants encounter a
|
|||
that has a @racket['paren-shape] property with value @racket[shape].}
|
||||
|
||||
|
||||
@defstruct[long-boolean ([val boolean?])]{
|
||||
|
||||
When @racket[to-paragraph] and variants encounter a
|
||||
@racket[long-boolean] structure, it is typeset as @racket[#true] or @racket[#false],
|
||||
as opposed to @racket[#t] or @racket[#f].}
|
||||
|
||||
|
||||
@defstruct[just-context ([val any/c]
|
||||
[context syntax?])]{
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user