From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: Improved (and faster) reader Date: Mon, 03 Sep 2007 18:59:58 +0200 Organization: LAAS-CNRS Message-ID: <878x7nofap.fsf@laas.fr> References: <1181845261.4156.1.camel@localhost.localdomain> <87zm1ojsie.fsf@chbouib.org> <87hcmr83d4.fsf@zip.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1188838787 9851 80.91.229.12 (3 Sep 2007 16:59:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 3 Sep 2007 16:59:47 +0000 (UTC) Cc: guile-devel@gnu.org To: Kevin Ryde Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Sep 03 18:59:46 2007 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ISFH7-0001jt-7f for guile-devel@m.gmane.org; Mon, 03 Sep 2007 18:59:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ISFH6-0004h7-2B for guile-devel@m.gmane.org; Mon, 03 Sep 2007 12:59:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ISFH3-0004gx-IZ for guile-devel@gnu.org; Mon, 03 Sep 2007 12:59:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ISFH2-0004gf-72 for guile-devel@gnu.org; Mon, 03 Sep 2007 12:59:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ISFH2-0004gc-0j for guile-devel@gnu.org; Mon, 03 Sep 2007 12:59:40 -0400 Original-Received: from laas.laas.fr ([140.93.0.15]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ISFH1-00046E-Bu for guile-devel@gnu.org; Mon, 03 Sep 2007 12:59:39 -0400 Original-Received: from messiaen.laas.fr (messiaen [IPv6:2001:660:6602:0:230:65ff:fed4:9d20]) by laas.laas.fr (8.13.8/8.13.8) with SMTP id l83GxZbV001125; Mon, 3 Sep 2007 18:59:36 +0200 (MEST) Original-Received: by messiaen.laas.fr (sSMTP sendmail emulation); Mon, 03 Sep 2007 18:59:58 +0200 X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 17 Fructidor an 215 de la =?iso-8859-1?Q?R=E9volutio?= =?iso-8859-1?Q?n?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: Kevin Ryde , guile-devel@gnu.org In-Reply-To: <87hcmr83d4.fsf@zip.com.au> (Kevin Ryde's message of "Thu\, 23 Aug 2007 11\:08\:07 +1000") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Spam-Score: -0.001 () NO_RELAYS X-Scanned-By: MIMEDefang at CNRS-LAAS on IPv6:2001:660:6602::2 X-Detected-Kernel: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:6768 Archived-At: --=-=-= Hi, I just came across another reader regression (corner case with SCSH comments). I applied the attached patch. Thanks, Ludovic. --=-=-= Content-Type: text/x-patch; charset=iso-8859-1 Content-Disposition: inline; filename*=us-ascii''%2c%2creader-scsh.diff Content-Description: The patch Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by laas.laas.fr id l83GxZbV001125 --- orig/libguile/ChangeLog +++ mod/libguile/ChangeLog @@ -1,5 +1,9 @@ 2007-09-03 Ludovic Court=C3=A8s =20 + * read.c (flush_ws): Handle SCSH block comments. + +2007-09-03 Ludovic Court=C3=A8s + Fix alignment issues which showed up at least on SPARC. =20 * socket.c (scm_t_max_sockaddr, scm_t_getsockopt_result): New. --- orig/libguile/read.c +++ mod/libguile/read.c @@ -179,6 +179,9 @@ (((_chr) <=3D UCHAR_MAX) ? tolower (_chr) : (_chr)) =20 =20 +/* 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; =20 + case '#': + switch (c =3D scm_getc (port)) + { + case EOF: + eoferr =3D "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=C3=A8s + + * tests/reader.test (reading)[block comment finishing sexp]: New + test. + 2007-08-26 Han-Wen Nienhuys =20 * 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)"))) =20 + (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") --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel --=-=-=--