From 54a6ba8d363f441d0bf3d4b15df0170215b84b8e Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 1 May 2012 14:49:10 -0600 Subject: [PATCH] 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. --- collects/racket/sandbox.rkt | 6 ++++++ collects/tests/scribble/docs/stxobj.scrbl | 6 ++++++ collects/tests/scribble/docs/stxobj.txt | 2 ++ 3 files changed, 14 insertions(+) create mode 100644 collects/tests/scribble/docs/stxobj.scrbl create mode 100644 collects/tests/scribble/docs/stxobj.txt diff --git a/collects/racket/sandbox.rkt b/collects/racket/sandbox.rkt index b4097773c5..3bc3e80da1 100644 --- a/collects/racket/sandbox.rkt +++ b/collects/racket/sandbox.rkt @@ -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)] diff --git a/collects/tests/scribble/docs/stxobj.scrbl b/collects/tests/scribble/docs/stxobj.scrbl new file mode 100644 index 0000000000..330cdfb3b5 --- /dev/null +++ b/collects/tests/scribble/docs/stxobj.scrbl @@ -0,0 +1,6 @@ +#lang scribble/manual +@(require scribble/eval) + +@interaction[ +(syntax-e #'(+ 1 2)) +] diff --git a/collects/tests/scribble/docs/stxobj.txt b/collects/tests/scribble/docs/stxobj.txt new file mode 100644 index 0000000000..bab5ef768a --- /dev/null +++ b/collects/tests/scribble/docs/stxobj.txt @@ -0,0 +1,2 @@ + > (syntax-e #'(+ 1 2)) + '(# # #)