racket/sandbox: change syntax-object wrappers generated for locations

Generate wrappers consistent with a reader-level absence of `.'s,
instead of wrapping every pair. This change fixes the `syntax-e'
example in the Guide's description of syntax objects.
This commit is contained in:
Matthew Flatt 2012-05-01 14:49:10 -06:00
parent 23296615ec
commit 54a6ba8d36
3 changed files with 14 additions and 0 deletions

View File

@ -503,6 +503,12 @@
(define (add-location x loc)
(cond [(null? x) null]
[(list? x)
;; For a list, generate a syntax-object wrapper consistent with
;; an absence of `.'s in the reader's input:
(make-orig (for/list ([i (in-list x)])
(add-location i loc))
loc)]
[(pair? x) (make-orig (cons (add-location (car x) loc)
(add-location (cdr x) loc))
loc)]

View File

@ -0,0 +1,6 @@
#lang scribble/manual
@(require scribble/eval)
@interaction[
(syntax-e #'(+ 1 2))
]

View File

@ -0,0 +1,2 @@
> (syntax-e #'(+ 1 2))
'(#<syntax:1:0 +> #<syntax:1:0 1> #<syntax:1:0 2>)