bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange string-append and string-match behaviour


From: Andy Wingo
Subject: Re: Strange string-append and string-match behaviour
Date: Sun, 27 Feb 2011 23:27:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

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 <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]