scribble/eval: strip away code:contract
s
Make `code:contract` handled like `code:comment` for evaluation. Relevant to PR 15161
This commit is contained in:
parent
26eff4c03a
commit
a2f430020a
|
@ -49,7 +49,7 @@ Certain patterns in @racket[datum] are treated specially:
|
|||
@racket[(@#,indexed-racket[code:line] _code-datum (@#,racketidfont{code:comment} _comment-datum ...))]
|
||||
is treated as @racket[_code-datum] for evaluation.}
|
||||
|
||||
@item{Other uses of @racketidfont{code:comment} and
|
||||
@item{Other uses of @racketidfont{code:comment}, @racketidfont{code:contract}, and
|
||||
@racketidfont{code:blank} are stripped from each @racket[datum]
|
||||
before evaluation.}
|
||||
|
||||
|
|
|
@ -206,11 +206,13 @@
|
|||
|
||||
(define (extract-to-evaluate s)
|
||||
(let loop ([s s] [expect #f])
|
||||
(syntax-case s (code:line code:comment eval:alts eval:check)
|
||||
(syntax-case s (code:line code:comment code:contract eval:alts eval:check)
|
||||
[(code:line v (code:comment . rest))
|
||||
(loop (extract s cdr car) expect)]
|
||||
[(code:comment . rest)
|
||||
(values (nothing-to-eval) expect)]
|
||||
[(code:contract . rest)
|
||||
(values (nothing-to-eval) expect)]
|
||||
[(eval:alts p e)
|
||||
(loop (extract s cdr cdr car) expect)]
|
||||
[(eval:check e expect)
|
||||
|
@ -346,8 +348,10 @@
|
|||
(define (comment? a)
|
||||
(and (pair? a)
|
||||
(or (eq? (car a) 'code:comment)
|
||||
(eq? (car a) 'code:contract)
|
||||
(and (identifier? (car a))
|
||||
(eq? (syntax-e (car a)) 'code:comment)))))
|
||||
(or (eq? (syntax-e (car a)) 'code:comment)
|
||||
(eq? (syntax-e (car a)) 'code:contract))))))
|
||||
(if (or (comment? a) (and (syntax? a) (comment? (syntax-e a))))
|
||||
(strip-comments (cdr stx))
|
||||
(cons (strip-comments a)
|
||||
|
|
Loading…
Reference in New Issue
Block a user