From e516be8dd41e2d49444725f12ff6edde81e33d14 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 22 May 2008 16:12:51 +0000 Subject: [PATCH] macros chapter in guide svn: r9927 original commit: 6a93d0c531c75aba685ad31644317e4f8d819cfd --- collects/scribble/eval.ss | 1 + collects/scribble/manual.ss | 2 +- collects/scribble/scheme.ss | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/collects/scribble/eval.ss b/collects/scribble/eval.ss index dbde375c..765793bb 100644 --- a/collects/scribble/eval.ss +++ b/collects/scribble/eval.ss @@ -173,6 +173,7 @@ (cond [(and v (hash-ref ht v #f)) => (lambda (v) v)] + [(syntax? v) (make-literal-syntax v)] [(string? v) (install ht v (string-copy v))] [(bytes? v) (install ht v (bytes-copy v))] [(pair? v) diff --git a/collects/scribble/manual.ss b/collects/scribble/manual.ss index 4c00bc3f..4a1d7e23 100644 --- a/collects/scribble/manual.ss +++ b/collects/scribble/manual.ss @@ -66,7 +66,7 @@ (list (datum->syntax #'filename - `(code:comment (unsyntax (t "In \"" ,#'filename "\":"))) + `(code:comment (unsyntax (t "In \"" ,(syntax-e #'filename) "\":"))) #'filename)) null)]) (syntax/loc stx (schemeblock file ... modtag rest ...)))] diff --git a/collects/scribble/scheme.ss b/collects/scribble/scheme.ss index df493dbc..4adf2cf5 100644 --- a/collects/scribble/scheme.ss +++ b/collects/scribble/scheme.ss @@ -21,7 +21,8 @@ current-meta-list (struct-out shaped-parens) - (struct-out just-context)) + (struct-out just-context) + (struct-out literal-syntax)) (define no-color "schemeplain") (define reader-color "schemereader") @@ -121,7 +122,9 @@ (memq (syntax-e c) (current-variable-list)))] [(s it? sub?) (let ([sc (syntax-e c)]) - (let ([s (format "~s" sc)]) + (let ([s (format "~s" (if (literal-syntax? sc) + (literal-syntax-stx sc) + sc))]) (if (and (symbol? sc) ((string-length s) . > . 1) (char=? (string-ref s 0) #\_) @@ -654,6 +657,7 @@ (define-struct shaped-parens (val shape)) (define-struct just-context (val ctx)) + (define-struct literal-syntax (stx)) (define-struct graph-reference (bx)) (define-struct graph-defn (r bx))