mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
sxml-match: Handle multiple-value returns.
* module/sxml/sxml-match.ss (sxml-match1): Invoke ESCAPE via `call-with-values'. * test-suite/tests/sxml-match-tests.ss ("test multiple value returns"): New test. * module/sxml/match.scm: Mention the modification.
This commit is contained in:
parent
40b19fda5c
commit
01fded8c77
3 changed files with 17 additions and 2 deletions
|
@ -81,11 +81,14 @@
|
|||
;;; Include upstream source file.
|
||||
;;;
|
||||
|
||||
;; This file was taken unmodified from
|
||||
;; This file was taken from
|
||||
;; <http://planet.plt-scheme.org/package-source/jim/sxml-match.plt/1/1/> on
|
||||
;; 2010-05-24. It was written by Jim Bender <benderjg2@aol.com> and released
|
||||
;; under the MIT/X11 license
|
||||
;; <http://www.gnu.org/licenses/license-list.html#X11License>.
|
||||
;;
|
||||
;; Modified the `sxml-match1' macro to allow multiple-value returns (upstream
|
||||
;; was notified.)
|
||||
|
||||
(include-from-path "sxml/sxml-match.ss")
|
||||
|
||||
|
|
|
@ -1124,7 +1124,10 @@
|
|||
[(sxml-match1 exp cata-fun clause0 clause ...)
|
||||
(let/ec escape
|
||||
(compile-clause clause0 exp cata-fun
|
||||
(lambda () (escape (sxml-match1 exp cata-fun clause ...)))))]))
|
||||
(lambda () (call-with-values
|
||||
(lambda () (sxml-match1 exp cata-fun
|
||||
clause ...))
|
||||
escape))))]))
|
||||
|
||||
(define-syntax sxml-match
|
||||
(syntax-rules ()
|
||||
|
|
|
@ -299,3 +299,12 @@
|
|||
[(a (@ . ,qqq) ,t ...)
|
||||
(list qqq t ...)])
|
||||
'(((z 1) (y 2) (x 3)) 4 5 6))
|
||||
|
||||
(run-test "test multiple value returns"
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(sxml-match '(foo)
|
||||
((foo) (values 'x 'y))))
|
||||
(lambda (x y)
|
||||
(cons x y)))
|
||||
'(x . y))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue