make racket' preserve
#t' versus `#true'
This commit is contained in:
parent
a1eaecb337
commit
c7e7d0d8ff
|
@ -122,7 +122,11 @@
|
||||||
(make-element symbol-color (list (to-element/no-color s))))
|
(make-element symbol-color (list (to-element/no-color s))))
|
||||||
|
|
||||||
(define-syntax (keep-s-expr stx)
|
(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)
|
[(_ ctx s srcloc)
|
||||||
(let ([sv (syntax-e
|
(let ([sv (syntax-e
|
||||||
(syntax-case #'s (quote)
|
(syntax-case #'s (quote)
|
||||||
|
@ -134,10 +138,10 @@
|
||||||
(identifier? (car sv))
|
(identifier? (car sv))
|
||||||
(or (free-identifier=? #'cons (car sv))
|
(or (free-identifier=? #'cons (car sv))
|
||||||
(free-identifier=? #'list (car sv)))))
|
(free-identifier=? #'list (car sv)))))
|
||||||
;; We know that the context is irrelvant
|
;; We know that the context is irrelvant
|
||||||
#'s
|
#'s
|
||||||
;; Context may be relevant:
|
;; Context may be relevant:
|
||||||
#'(*keep-s-expr s ctx)))]))
|
#'(*keep-s-expr s ctx)))]))
|
||||||
(define (*keep-s-expr s ctx)
|
(define (*keep-s-expr s ctx)
|
||||||
(if (symbol? s)
|
(if (symbol? s)
|
||||||
(make-just-context s ctx)
|
(make-just-context s ctx)
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
|
|
||||||
(struct-out var-id)
|
(struct-out var-id)
|
||||||
(struct-out shaped-parens)
|
(struct-out shaped-parens)
|
||||||
|
(struct-out long-boolean)
|
||||||
(struct-out just-context)
|
(struct-out just-context)
|
||||||
(struct-out alternate-display)
|
(struct-out alternate-display)
|
||||||
(struct-out literal-syntax)
|
(struct-out literal-syntax)
|
||||||
|
@ -1010,6 +1011,7 @@
|
||||||
|
|
||||||
(define-struct var-id (sym))
|
(define-struct var-id (sym))
|
||||||
(define-struct shaped-parens (val shape))
|
(define-struct shaped-parens (val shape))
|
||||||
|
(define-struct long-boolean (val))
|
||||||
(define-struct just-context (val ctx))
|
(define-struct just-context (val ctx))
|
||||||
(define-struct alternate-display (id string))
|
(define-struct alternate-display (id string))
|
||||||
(define-struct literal-syntax (stx))
|
(define-struct literal-syntax (stx))
|
||||||
|
@ -1069,6 +1071,10 @@
|
||||||
(syntax-property (do-syntax-ize (shaped-parens-val v) col line ht #f qq #f)
|
(syntax-property (do-syntax-ize (shaped-parens-val v) col line ht #f qq #f)
|
||||||
'paren-shape
|
'paren-shape
|
||||||
(shaped-parens-shape v))]
|
(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)
|
[(just-context? v)
|
||||||
(let ([s (do-syntax-ize (just-context-val v) col line ht #f qq #f)])
|
(let ([s (do-syntax-ize (just-context-val v) col line ht #f qq #f)])
|
||||||
(datum->syntax (just-context-ctx v)
|
(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].}
|
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]
|
@defstruct[just-context ([val any/c]
|
||||||
[context syntax?])]{
|
[context syntax?])]{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user