1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-19 11:10:25 +02:00

support source-level annotations in syncase

* module/ice-9/annotate.scm (<annotation>): Slightly more concise
  printing.
  (annotate): Don't create annotations if we have no source info.

* module/ice-9/psyntax.scm (annotation?): Remove this definition, as we
  now provide annotation support.

* module/ice-9/psyntax-pp.scm: Regenerated.

* module/ice-9/syncase.scm: Use (ice-9 annotate).

* module/language/scheme/expand.scm (eval-when): Define the eval-when
  transformer.
This commit is contained in:
Andy Wingo 2009-03-06 17:01:47 +01:00
parent 25d8cd3a0c
commit 52381a17c4
5 changed files with 29 additions and 25 deletions

View file

@ -24,7 +24,7 @@
(define <annotation>
(make-vtable "prprpw"
(lambda (struct port)
(display "#<annotation of " port)
(display "#<annotated " port)
(display (struct-ref struct 0) port)
(display ">" port))))
@ -46,12 +46,15 @@
(struct-set! a 2 #t))
(define (annotate e)
(cond ((and (list? e) (not (null? e)))
(make-annotation (map annotate e) (source-properties e) #f))
((pair? e)
(make-annotation (cons (annotate (car e)) (annotate (cdr e)))
(source-properties e) #f))
(else e)))
(let ((p (if (pair? e) (source-properties e) #f))
(out (cond ((and (list? e) (not (null? e)))
(map annotate e))
((pair? e)
(cons (annotate (car e)) (annotate (cdr e))))
(else e))))
(if (pair? p)
(make-annotation out p #f)
out)))
(define (deannotate e)
(cond ((list? e)