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: Block comments and `read-hash-extend' Date: Fri, 19 Aug 2005 10:11:05 +0200 Organization: LAAS-CNRS Message-ID: <87k6iis5wm.fsf@laas.fr> References: <87k6kumykq.fsf@laas.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1124443102 6327 80.91.229.2 (19 Aug 2005 09:18:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 19 Aug 2005 09:18:22 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Aug 19 11:18:13 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E630r-0002Dw-J3 for guile-devel@m.gmane.org; Fri, 19 Aug 2005 11:18:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E634P-0005IU-Pe for guile-devel@m.gmane.org; Fri, 19 Aug 2005 05:21:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E628b-0004pV-2s for guile-devel@gnu.org; Fri, 19 Aug 2005 04:22:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E625y-0003vU-Rk for guile-devel@gnu.org; Fri, 19 Aug 2005 04:19:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E6217-00037c-Us for guile-devel@gnu.org; Fri, 19 Aug 2005 04:14:23 -0400 Original-Received: from [140.93.0.15] (helo=laas.laas.fr) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1E62C8-0006r9-L4 for guile-devel@gnu.org; Fri, 19 Aug 2005 04:25:45 -0400 Original-Received: by laas.laas.fr (8.13.1/8.13.1) with SMTP id j7J8917O001321; Fri, 19 Aug 2005 10:09:02 +0200 (CEST) Original-To: guile-devel@gnu.org X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 2 Fructidor an 213 de la =?iso-8859-1?Q?R=E9volution?= 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 In-Reply-To: <87k6kumykq.fsf@laas.fr> (Ludovic =?iso-8859-1?Q?Court=E8s's?= message of "Thu, 16 Jun 2005 11:37:57 +0200") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) X-Spam-Score: 0 () X-Scanned-By: MIMEDefang at CNRS-LAAS X-MIME-Autoconverted: from 8bit to quoted-printable by laas.laas.fr id j7J8917O001321 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:5194 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:5194 The patch below (<87k6kumykq.fsf@laas.fr>) also failed to live through the summer. ;-) Is it acceptable? Thanks, Ludovic. ludovic.courtes@laas.fr (Ludovic Court=E8s) writes: > Hi, > > The patch below (1) fixes `#! ... !#' block comments and (2) allows to > override them with `read-hash-extend'. > > > (1) This example makes Guile 1.6 and the current Guile 1.7 hang (for > some reason which I did not track down): > > guile> #! this is a comment !# (+ 2 2) > [wait forever] > > Once the patch is applied: > > guile> #! this is a comment !# (+ 2 2) > 4 > > I guess block comments have not been widely used over the past > years. ;-) > > > (2) It makes it possible to discard the block comment syntax with > `read-hash-extend'. The example below allows to recognize the > DSSSL keyword syntax[*], at the expense of losing the block > comment syntax: > > (read-hash-extend #\! (lambda (chr port) > (symbol->keyword (read port)))) > > I find this particular example useful since, even if DSSSL is > apparently not widely used, other Scheme implementations such as > Bigloo do support this syntax, and allowing such extensions is wha= t > `read-hash-extend' is for. > > > Comments? > > Thanks, > Ludovic. > > [*] http://www.ibiblio.org/pub/sun-info/standards/dsssl/dssslo/do960816= .htm > > > 2005-06-16 Ludovic Court=E8s > > * read.c (scm_flush_ws): Do not handle `#! .. !#' block > comments here so that the behavior of `#!' can be extended with > `read-hash-extend'. > (scm_lreadr): Handle the `#!' case here instead of in > `scm_flush_ws ()' after making sure that no hash reader > extension exists for `!'. Jump to `tryagain' after call to > `skip_scsh_block_comment ()', which fixes a bug in block > comments handling (where Guile would hang). > > > > Index: read.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvsroot/guile/guile/guile-core/libguile/read.c,v > retrieving revision 1.117 > diff -u -B -b -p -r1.117 read.c > --- read.c 23 May 2005 19:57:21 -0000 1.117 > +++ read.c 16 Jun 2005 09:13:28 -0000 > @@ -227,9 +227,6 @@ scm_flush_ws (SCM port, const char *eofe > case EOF: > eoferr =3D "read_sharp"; > goto goteof; > - case '!': > - skip_scsh_block_comment (port); > - break; > default: > scm_ungetc (c, port); > return '#'; > @@ -478,9 +475,10 @@ scm_lreadr (SCM *tok_buf, SCM port, SCM=20 > goto num; > =20 > case '!': > - /* should never happen, #!...!# block comments are skipped > - over in scm_flush_ws. */ > - abort (); > + /* Only handle `#! ... !#' block comments if no user extension was > + defined for `!' using `read-hash-extend'. */ > + skip_scsh_block_comment (port); > + goto tryagain; > =20 > case '*': > j =3D scm_read_token (c, tok_buf, port, 0); > > > > _______________________________________________ > Guile-devel mailing list > Guile-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/guile-devel _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel