unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: 9672@debbugs.gnu.org
Subject: bug#9672: bug in SRFI-30 comment parser
Date: Tue, 4 Oct 2011 23:45:19 +0200	[thread overview]
Message-ID: <201110042345.19228.bruno@clisp.org> (raw)

Hi,

Block comments whose contents end with an odd number of vertical bars are not
parsed correctly by guile-2.0.2.

The guile manual [1] says:
  "Guile (starting from version 2.0) supports nested block comments
   as specified by R6RS and SRFI-30"

R6RS [2] says:
  "Block comments may be indicated with properly nested #|and |# pairs."

More formally, SRFI-30 [3] implies that in particular

  #| <comment-text> |#

is a comment, where

  <comment-text> ---> <character sequence not containing #| or |#>

Now look at this guile session: When I use a <comment-text> that ends in
1 or 3 or 5 ... trailing vertical bars, guile misses the end of the
block comment and hangs.

scheme@(guile-user)> '(a #|foo|# b)
$1 = (a b)
scheme@(guile-user)> '(a #|foo|||# b)
$2 = (a b)
scheme@(guile-user)> '(a #|foo|||||# b)
$3 = (a b)
scheme@(guile-user)> '(a #|foo||# b)
[hangs]

scheme@(guile-user)> '(a #|foo||||# b)
[hangs]

The bug is most likely located in libguile/read.c,
function scm_read_r6rs_block_comment, line 1204.

Bruno

[1] http://www.gnu.org/software/guile/manual/html_node/Block-Comments.html
[2] http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-7.html#node_sec_4.2.3
[3] http://srfi.schemers.org/srfi-30/srfi-30.html
--
In memoriam Irena Iłłakowicz <http://en.wikipedia.org/wiki/Irena_Iłłakowicz>





             reply	other threads:[~2011-10-04 21:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-04 21:45 Bruno Haible [this message]
2011-10-05 18:49 ` bug#9672: bug in SRFI-30 comment parser Andy Wingo

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=201110042345.19228.bruno@clisp.org \
    --to=bruno@clisp.org \
    --cc=9672@debbugs.gnu.org \
    /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).