[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-142-g6d5f8
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-142-g6d5f8c3 |
Date: |
Wed, 05 Oct 2011 18:41:38 +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=6d5f8c324e6c5f4fda155329eab6dade43ac5ffe
The branch, stable-2.0 has been updated
via 6d5f8c324e6c5f4fda155329eab6dade43ac5ffe (commit)
from 21524430e9d821014d6c0efbe4df74c12179c072 (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 6d5f8c324e6c5f4fda155329eab6dade43ac5ffe
Author: Andy Wingo <address@hidden>
Date: Wed Oct 5 20:41:11 2011 +0200
fix reading of #||||#
* libguile/read.c (scm_read_r6rs_block_comment):
* test-suite/tests/reader.test ("reading"): Fix reading of #||||#,
originally reported in bug debbugs.gnu.org/9672, by Bruno Haible.
Thanks, Bruno!
-----------------------------------------------------------------------
Summary of changes:
libguile/read.c | 41 ++++++++++++++++++++---------------------
test-suite/tests/reader.test | 8 ++++++++
2 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/libguile/read.c b/libguile/read.c
index 6fee118..a9404b1 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -1133,34 +1133,33 @@ scm_read_r6rs_block_comment (scm_t_wchar chr, SCM port)
/* Unlike SCSH-style block comments, SRFI-30/R6RS block comments may be
nested. So care must be taken. */
int nesting_level = 1;
- int opening_seen = 0, closing_seen = 0;
+
+ int a = scm_getc (port);
+
+ if (a == EOF)
+ scm_i_input_error ("scm_read_r6rs_block_comment", port,
+ "unterminated `#| ... |#' comment", SCM_EOL);
while (nesting_level > 0)
{
- int c = scm_getc (port);
+ int b = scm_getc (port);
- if (c == EOF)
+ if (b == EOF)
scm_i_input_error ("scm_read_r6rs_block_comment", port,
"unterminated `#| ... |#' comment", SCM_EOL);
- if (opening_seen)
- {
- if (c == '|')
- nesting_level++;
- opening_seen = 0;
- }
- else if (closing_seen)
- {
- if (c == '#')
- nesting_level--;
- closing_seen = 0;
- }
- else if (c == '|')
- closing_seen = 1;
- else if (c == '#')
- opening_seen = 1;
- else
- opening_seen = closing_seen = 0;
+ if (a == '|' && b == '#')
+ {
+ nesting_level--;
+ b = EOF;
+ }
+ else if (a == '#' && b == '|')
+ {
+ nesting_level++;
+ b = EOF;
+ }
+
+ a = b;
}
return SCM_UNSPECIFIED;
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index 437706b..60c853c 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -110,6 +110,14 @@
(equal? '(a b c)
(read-string "(a b c #| d #| e |# f |#)")))
+ (pass-if "R6RS/SRFI-30 nested block comment (2)"
+ (equal? '(a b c)
+ (read-string "(a b c #|||||||#)")))
+
+ (pass-if "R6RS/SRFI-30 nested block comment (3)"
+ (equal? '(a b c)
+ (read-string "(a b c #||||||||#)")))
+
(pass-if "R6RS/SRFI-30 block comment syntax overridden"
;; To be compatible with 1.8 and earlier, we should be able to override
;; this syntax.
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-142-g6d5f8c3,
Andy Wingo <=