unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Francis Southern <francis.southern@gmail.com>
Cc: bug-guile@gnu.org
Subject: Re: Strange string-append and string-match behaviour
Date: Sun, 27 Feb 2011 23:27:39 +0100	[thread overview]
Message-ID: <m3aahhru3o.fsf@unquote.localdomain> (raw)
In-Reply-To: <AANLkTi=8XpEM5oAWnR+kNz=Jynx73Cim=gQnDKuhxXH8@mail.gmail.com> (Francis Southern's message of "Thu, 17 Feb 2011 22:11:29 -0600")

Hi Francis,

The (most unfortunately indicated!) error is actually a read error due
to malformed input and not related to any of these procedures.

On Fri 18 Feb 2011 05:11, Francis Southern <francis.southern@gmail.com> writes:

> scheme@(guile-user)> (string-match "?.*" "?wobble")
> ERROR: In procedure make-regexp:
> ERROR: In procedure make-regexp: Error while printing exception.

Heh.  Fixed this error message to at least not print an exception:

  ERROR: In procedure make-regexp:
  ERROR: In procedure make-regexp: Invalid preceding regular expression

Still not very good, but it's what libc gives us.

> scheme@(guile-user)> (string-match "\?.*" "?wobble")
> While reading expression:
> ERROR: In procedure scm_lreadr: standard input:3:18: illegal character
> in escape sequence: #\?

OK! At this point "\? was read.  It was determined that ? was an invalid
escape char, so the read was aborted.  Unfortunately we were inside a
string.  What's left is .*" "?wobble", and thus the following errors:

> ;;; <unknown-location>: warning: possibly unbound variable `.*'
> ERROR: In procedure #<procedure 2183020 ()>:
> ERROR: In procedure module-lookup: Unbound variable: .*

Because we read the symbol `.*'.

> $1 = " "

Because we read the string " ".

> ;;; <unknown-location>: warning: possibly unbound variable `?wobble'
> ERROR: In procedure #<procedure 21ac020 ()>:
> ERROR: In procedure module-lookup: Unbound variable: ?wobble

Because we read ?wobble.

> And then it just hung and I needed to C-c C-c my way out.

Because we're inside a string, waiting for the ending ".

Ironically you could have ended it with a \? ;-)

I think the right thing to do here at the REPL is to flush all pending
input when a read error occurs.  I have pushed a patch to do that, I
believe.  Thanks for the report :)

Andy
-- 
http://wingolog.org/



      reply	other threads:[~2011-02-27 22:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-18  4:11 Strange string-append and string-match behaviour Francis Southern
2011-02-27 22:27 ` Andy Wingo [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=m3aahhru3o.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=bug-guile@gnu.org \
    --cc=francis.southern@gmail.com \
    /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).