[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, master, updated. release_1-9-12-214-gd
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, master, updated. release_1-9-12-214-gdf6336c |
Date: |
Thu, 14 Oct 2010 14:18:35 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=df6336c0a0bdb6dbdad7d8ba407a7c0377579d9b
The branch, master has been updated
via df6336c0a0bdb6dbdad7d8ba407a7c0377579d9b (commit)
via 4aaa0650e04d17c86f6e9b47294ca9b623bea029 (commit)
from 37d6f737e7accdfb7ee97a55fb764699e4d27f8a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit df6336c0a0bdb6dbdad7d8ba407a7c0377579d9b
Author: Andy Wingo <address@hidden>
Date: Thu Oct 14 16:13:57 2010 +0200
re-implement srfi-34's guard with syntax-case
* module/srfi/srfi-34.scm (guard): Re-implement using syntax-case.
commit 4aaa0650e04d17c86f6e9b47294ca9b623bea029
Author: Andy Wingo <address@hidden>
Date: Thu Oct 14 12:37:31 2010 +0200
ssax: add procs to define parsed entities
* module/sxml/ssax.scm (reset-parsed-entity-definitions!)
(define-parsed-entity!): New heavy-handed knobs for adding to the set
of parsed entity definitions.
-----------------------------------------------------------------------
Summary of changes:
module/srfi/srfi-34.scm | 28 ++++++++++++++++------------
module/sxml/ssax.scm | 23 ++++++++++++++++++++++-
2 files changed, 38 insertions(+), 13 deletions(-)
diff --git a/module/srfi/srfi-34.scm b/module/srfi/srfi-34.scm
index f30bdfd..05bbdfa 100644
--- a/module/srfi/srfi-34.scm
+++ b/module/srfi/srfi-34.scm
@@ -53,8 +53,9 @@ with-exception-handler that installed the handler being
called. The
handler's continuation is otherwise unspecified."
(throw throw-key obj))
-(define-macro (guard var+clauses . body)
- "Syntax: (guard (<var> <clause1> <clause2> ...) <body>)
+(define-syntax guard
+ (syntax-rules (else)
+ "Syntax: (guard (<var> <clause1> <clause2> ...) <body>)
Each <clause> should have the same form as a `cond' clause.
Semantics: Evaluating a guard form evaluates <body> with an exception
@@ -66,15 +67,18 @@ every <clause>'s <test> evaluates to false and there is no
else
clause, then raise is re-invoked on the raised object within the
dynamic environment of the original call to raise except that the
current exception handler is that of the guard expression."
- (let ((var (car var+clauses))
- (clauses (cdr var+clauses)))
- `(catch ',throw-key
- (lambda ()
- ,@body)
- (lambda (key ,var)
- (cond ,@(if (eq? (caar (last-pair clauses)) 'else)
- clauses
- (append clauses
- `((else (throw key ,var))))))))))
+ ((guard (var clause ... (else e e* ...)) body body* ...)
+ (catch throw-key
+ (lambda () body body* ...)
+ (lambda (key var)
+ (cond clause ...
+ (else e e* ...)))))
+ ((guard (var clause clause* ...) body body* ...)
+ (catch throw-key
+ (lambda () body body* ...)
+ (lambda (key var)
+ (cond clause clause* ...
+ (else (throw key var))))))))
+
;;; (srfi srfi-34) ends here.
diff --git a/module/sxml/ssax.scm b/module/sxml/ssax.scm
index 8794927..9709641 100644
--- a/module/sxml/ssax.scm
+++ b/module/sxml/ssax.scm
@@ -1,6 +1,6 @@
;;;; (sxml ssax) -- the SSAX parser
;;;;
-;;;; Copyright (C) 2009 Free Software Foundation, Inc.
+;;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
;;;; Modified 2004 by Andy Wingo <wingo at pobox dot com>.
;;;; Written 2001,2002,2003,2004 by Oleg Kiselyov <oleg at pobox dot com>
as SSAX.scm.
;;;;
@@ -147,6 +147,8 @@
attlist-null?
attlist-remove-top
attlist->alist attlist-fold
+ define-parsed-entity!
+ reset-parsed-entity-definitions!
ssax:uri-string->symbol
ssax:skip-internal-dtd
ssax:read-pi-body-as-string
@@ -188,6 +190,25 @@
(define char-tab #\tab)
(define nl "\n")
+;; This isn't a great API, but a more proper fix will involve hacking
+;; SSAX.
+(define (reset-parsed-entity-definitions!)
+ "Restore the set of parsed entity definitions to its initial state."
+ (set! ssax:predefined-parsed-entities
+ '((amp . "&")
+ (lt . "<")
+ (gt . ">")
+ (apos . "'")
+ (quot . "\""))))
+
+(define (define-parsed-entity! entity str)
+ "Define a new parsed entity. @var{entity} should be a symbol.
+
+Instances of &@var{entity}; in XML text will be replaced with the
+string @var{str}, which will then be parsed."
+ (set! ssax:predefined-parsed-entities
+ (acons entity str ssax:predefined-parsed-entities)))
+
;; if condition is true, execute stmts in turn and return the result of
;; the last statement otherwise, return #f
(define-syntax when
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, master, updated. release_1-9-12-214-gdf6336c,
Andy Wingo <=