[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-11-179-g5
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, master, updated. release_1-9-11-179-g5b69315 |
Date: |
Tue, 13 Jul 2010 19:51:03 +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=5b69315ed3993cceb498f0e05183e4da03dbc1c3
The branch, master has been updated
via 5b69315ed3993cceb498f0e05183e4da03dbc1c3 (commit)
from aa77dace400a1714e5ee98c01a799325e6dd6131 (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 5b69315ed3993cceb498f0e05183e4da03dbc1c3
Author: Andy Wingo <address@hidden>
Date: Tue Jul 13 21:53:41 2010 +0200
fix '(] infinite loop
* libguile/read.c (scm_read_sexp): Fix reader infinite loop. Thanks to
Bill Schottstaedt for the report.
* test-suite/tests/reader.test: Add test.
-----------------------------------------------------------------------
Summary of changes:
libguile/read.c | 10 ++++++++--
test-suite/tests/reader.test | 14 +++++++++++++-
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/libguile/read.c b/libguile/read.c
index d169167..df987c7 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -392,9 +392,15 @@ scm_read_sexp (scm_t_wchar chr, SCM port)
{
SCM new_tail;
+ if (c == ')' || (SCM_SQUARE_BRACKETS_P && c == ']'))
+ scm_i_input_error (FUNC_NAME, port,
+ "in pair: mismatched close paren: ~A",
+ scm_list_1 (SCM_MAKE_CHAR (c)));
+
scm_ungetc (c, port);
- if (scm_is_eq (scm_sym_dot,
- (tmp = scm_read_expression (port))))
+ tmp = scm_read_expression (port);
+
+ if (scm_is_eq (scm_sym_dot, tmp))
{
SCM_SETCDR (tl, tmp = scm_read_expression (port));
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index d1b9dda..b657861 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -38,6 +38,8 @@
(cons 'read-error "illegal character in escape sequence: .*$"))
(define exception:missing-expression
(cons 'read-error "no expression after #;"))
+(define exception:mismatched-paren
+ (cons 'read-error "mismatched close paren"))
(define (read-string s)
@@ -131,7 +133,17 @@
;; mutable objects.
(let ((str (with-input-from-string "\"hello, world\"" read)))
(string-set! str 0 #\H)
- (string=? str "Hello, world"))))
+ (string=? str "Hello, world")))
+
+ (pass-if "square brackets are parens"
+ (equal? '() (read-string "[]")))
+
+ (pass-if-exception "paren mismatch" exception:unexpected-rparen
+ (read-string "'[)"))
+
+ (pass-if-exception "paren mismatch (2)" exception:mismatched-paren
+ (read-string "'(]")))
+
(pass-if-exception "radix passed to number->string can't be zero"
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, master, updated. release_1-9-11-179-g5b69315,
Andy Wingo <=