1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 16:50:21 +02:00

add quasisyntax

* module/Makefile.am:
* module/ice-9/boot-9.scm:
* module/ice-9/quasisyntax.scm: Add quasisyntax. Implementation by Andre
  van Tonder, patch by Andreas Rottmann.
* test-suite/tests/srfi-10.test: Hack to remove srfi-10's clobbering of
  #,.
* test-suite/tests/syncase.test: Add a quasisyntax test.
This commit is contained in:
Andreas Rottmann 2009-11-14 17:25:12 +01:00 committed by Andy Wingo
parent d89fae24f5
commit cb65f76c74
5 changed files with 161 additions and 3 deletions

View file

@ -1,7 +1,7 @@
;;;; srfi-10.test --- Test suite for Guile's SRFI-10 functions. -*- scheme -*-
;;;; Martin Grabmueller, 2001-05-10
;;;;
;;;; Copyright (C) 2001, 2006 Free Software Foundation, Inc.
;;;; Copyright (C) 2001, 2006, 2009 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -27,3 +27,7 @@
(let* ((rx #,(rx "^foo$")))
(and (->bool (regexp-exec rx "foo"))
(not (regexp-exec rx "bar foo frob"))))))
;; Disable SRFI-10 reader syntax again, to avoid messing up
;; syntax-case's unsyntax
(read-hash-extend #\, #f)

View file

@ -1,6 +1,6 @@
;;;; syncase.test --- test suite for (ice-9 syncase) -*- scheme -*-
;;;;
;;;; Copyright (C) 2001, 2006 Free Software Foundation, Inc.
;;;; Copyright (C) 2001, 2006, 2009 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -31,3 +31,15 @@
(pass-if "@ works with syncase"
(eq? run-test (@ (test-suite lib) run-test)))
(define-syntax string-let
(lambda (stx)
(syntax-case stx ()
((_ id body ...)
#`(let ((id #,(symbol->string
(syntax->datum #'id))))
body ...)))))
(pass-if "macro using quasisyntax"
(equal? (string-let foo (list foo foo))
'("foo" "foo")))