From: ludovic.courtes@laas.fr (Ludovic Courtès)
To: Kevin Ryde <user42@zip.com.au>
Cc: guile-devel@gnu.org
Subject: Re: Improved (and faster) reader
Date: Mon, 03 Sep 2007 18:59:58 +0200 [thread overview]
Message-ID: <878x7nofap.fsf@laas.fr> (raw)
In-Reply-To: <87hcmr83d4.fsf@zip.com.au> (Kevin Ryde's message of "Thu\, 23 Aug 2007 11\:08\:07 +1000")
[-- Attachment #1: Type: text/plain, Size: 134 bytes --]
Hi,
I just came across another reader regression (corner case with SCSH
comments). I applied the attached patch.
Thanks,
Ludovic.
[-- Attachment #2: The patch --]
[-- Type: text/x-patch, Size: 1998 bytes --]
--- orig/libguile/ChangeLog
+++ mod/libguile/ChangeLog
@@ -1,5 +1,9 @@
2007-09-03 Ludovic Courtès <ludo@gnu.org>
+ * read.c (flush_ws): Handle SCSH block comments.
+
+2007-09-03 Ludovic Courtès <ludo@gnu.org>
+
Fix alignment issues which showed up at least on SPARC.
* socket.c (scm_t_max_sockaddr, scm_t_getsockopt_result): New.
--- orig/libguile/read.c
+++ mod/libguile/read.c
@@ -179,6 +179,9 @@
(((_chr) <= UCHAR_MAX) ? tolower (_chr) : (_chr))
+/* Read an SCSH block comment. */
+static inline SCM scm_read_scsh_block_comment (int chr, SCM port);
+
/* Helper function similar to `scm_read_token ()'. Read from PORT until a
whitespace is read. Return zero if the whole token could fit in BUF,
non-zero otherwise. */
@@ -245,6 +248,21 @@
}
break;
+ case '#':
+ switch (c = scm_getc (port))
+ {
+ case EOF:
+ eoferr = "read_sharp";
+ goto goteof;
+ case '!':
+ scm_read_scsh_block_comment (c, port);
+ break;
+ default:
+ scm_ungetc (c, port);
+ return '#';
+ }
+ break;
+
case SCM_LINE_INCREMENTORS:
case SCM_SINGLE_SPACES:
case '\t':
--- orig/test-suite/ChangeLog
+++ mod/test-suite/ChangeLog
@@ -1,3 +1,8 @@
+2007-09-03 Ludovic Courtès <ludo@gnu.org>
+
+ * tests/reader.test (reading)[block comment finishing sexp]: New
+ test.
+
2007-08-26 Han-Wen Nienhuys <hanwen@lilypond.org>
* tests/ports.test ("port-for-each"): remove unresolved for
--- orig/test-suite/tests/reader.test
+++ mod/test-suite/tests/reader.test
@@ -77,6 +77,10 @@
(equal? '(+ 1 2 3)
(read-string "(+ 1 #! this is a\ncomment !# 2 3)")))
+ (pass-if "block comment finishing s-exp"
+ (equal? '(+ 2)
+ (read-string "(+ 2 #! a comment\n!#\n) ")))
+
(pass-if "unprintable symbol"
;; The reader tolerates unprintable characters for symbols.
(equal? (string->symbol "\001\002\003")
[-- Attachment #3: Type: text/plain, Size: 143 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
prev parent reply other threads:[~2007-09-03 16:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-14 18:21 Further profiling, including howto Andy Wingo
2007-07-22 16:46 ` Improved (and faster) reader Ludovic Courtès
2007-08-11 10:52 ` Ludovic Courtès
2007-08-23 1:08 ` Kevin Ryde
2007-08-23 21:19 ` Ludovic Courtès
2007-08-25 0:45 ` Kevin Ryde
2007-08-25 8:23 ` Ludovic Courtès
2007-08-25 13:15 ` Andy Wingo
2007-08-26 17:05 ` Ludovic Courtès
2007-09-03 16:59 ` Ludovic Courtès [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878x7nofap.fsf@laas.fr \
--to=ludovic.courtes@laas.fr \
--cc=guile-devel@gnu.org \
--cc=user42@zip.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).