macros chapter in guide

svn: r9927

original commit: 6a93d0c531c75aba685ad31644317e4f8d819cfd
This commit is contained in:
Matthew Flatt 2008-05-22 16:12:51 +00:00
parent 84d05633df
commit e516be8dd4
3 changed files with 8 additions and 3 deletions

View File

@ -173,6 +173,7 @@
(cond (cond
[(and v (hash-ref ht v #f)) [(and v (hash-ref ht v #f))
=> (lambda (v) v)] => (lambda (v) v)]
[(syntax? v) (make-literal-syntax v)]
[(string? v) (install ht v (string-copy v))] [(string? v) (install ht v (string-copy v))]
[(bytes? v) (install ht v (bytes-copy v))] [(bytes? v) (install ht v (bytes-copy v))]
[(pair? v) [(pair? v)

View File

@ -66,7 +66,7 @@
(list (list
(datum->syntax (datum->syntax
#'filename #'filename
`(code:comment (unsyntax (t "In \"" ,#'filename "\":"))) `(code:comment (unsyntax (t "In \"" ,(syntax-e #'filename) "\":")))
#'filename)) #'filename))
null)]) null)])
(syntax/loc stx (schemeblock file ... modtag rest ...)))] (syntax/loc stx (schemeblock file ... modtag rest ...)))]

View File

@ -21,7 +21,8 @@
current-meta-list current-meta-list
(struct-out shaped-parens) (struct-out shaped-parens)
(struct-out just-context)) (struct-out just-context)
(struct-out literal-syntax))
(define no-color "schemeplain") (define no-color "schemeplain")
(define reader-color "schemereader") (define reader-color "schemereader")
@ -121,7 +122,9 @@
(memq (syntax-e c) (current-variable-list)))] (memq (syntax-e c) (current-variable-list)))]
[(s it? sub?) [(s it? sub?)
(let ([sc (syntax-e c)]) (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) (if (and (symbol? sc)
((string-length s) . > . 1) ((string-length s) . > . 1)
(char=? (string-ref s 0) #\_) (char=? (string-ref s 0) #\_)
@ -654,6 +657,7 @@
(define-struct shaped-parens (val shape)) (define-struct shaped-parens (val shape))
(define-struct just-context (val ctx)) (define-struct just-context (val ctx))
(define-struct literal-syntax (stx))
(define-struct graph-reference (bx)) (define-struct graph-reference (bx))
(define-struct graph-defn (r bx)) (define-struct graph-defn (r bx))