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:
parent
23296615ec
commit
54a6ba8d36
|
@ -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)]
|
||||
|
|
6
collects/tests/scribble/docs/stxobj.scrbl
Normal file
6
collects/tests/scribble/docs/stxobj.scrbl
Normal file
|
@ -0,0 +1,6 @@
|
|||
#lang scribble/manual
|
||||
@(require scribble/eval)
|
||||
|
||||
@interaction[
|
||||
(syntax-e #'(+ 1 2))
|
||||
]
|
2
collects/tests/scribble/docs/stxobj.txt
Normal file
2
collects/tests/scribble/docs/stxobj.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
> (syntax-e #'(+ 1 2))
|
||||
'(#<syntax:1:0 +> #<syntax:1:0 1> #<syntax:1:0 2>)
|
Loading…
Reference in New Issue
Block a user