Closes FB case 173 Fix arrows in hyper-literate. I Used a module-like scope when nesting the whole module body to allow overriding build-ins, as DrRacket doesn't draw the arrows properly when a (make-syntax-introducer) is used.

This commit is contained in:
Georges Dupéron 2017-01-20 13:45:30 +01:00
parent 40068c6410
commit 835e565e0e
2 changed files with 17 additions and 10 deletions

View File

@ -11,7 +11,8 @@
"scribble-enhanced" "scribble-enhanced"
"sexp-diff" "sexp-diff"
"tr-immutable" "tr-immutable"
"typed-map-lib")) "typed-map-lib"
"debug-scopes"))
(define build-deps '("scribble-lib" (define build-deps '("scribble-lib"
"racket-doc" "racket-doc"
"rackunit-doc" "rackunit-doc"

View File

@ -9,7 +9,8 @@
syntax/strip-context syntax/strip-context
syntax/srcloc syntax/srcloc
racket/struct racket/struct
syntax/srcloc)) syntax/srcloc
debug-scopes/named-scopes/exptime))
(begin-for-syntax (begin-for-syntax
(define first-id #f) (define first-id #f)
@ -151,18 +152,23 @@
(define-syntax (continue stx) (define-syntax (continue stx)
(syntax-case stx () (syntax-case stx ()
[(_self lang-module-begin . body) [(_self lang-module-begin . body)
(let ([expanded (local-expand (let ()
(datum->syntax stx (define expanded (local-expand
`(,#'lang-module-begin . ,#'body) (datum->syntax stx
stx `(,#'lang-module-begin . ,#'body)
stx) stx
'module-begin stx)
(list))]) 'module-begin
(list)))
(define meta-language-nesting
;; Use a module-like scope here, instead of (make-syntax-introducer),
;; otherwise DrRacket stops drawing some arrows (why?).
(make-module-like-named-scope 'meta-language-nesting))
(syntax-case expanded (#%plain-module-begin) (syntax-case expanded (#%plain-module-begin)
[(#%plain-module-begin . expanded-body) [(#%plain-module-begin . expanded-body)
#`(begin #`(begin
. .
#,((make-syntax-introducer) #'expanded-body))]))])) #,(meta-language-nesting #'expanded-body))]))]))
(define-for-syntax ((make-module-begin submod?) stx) (define-for-syntax ((make-module-begin submod?) stx)
(syntax-parse stx (syntax-parse stx