[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] unterminated string error
From: |
Peter Keller |
Subject: |
[Chicken-users] unterminated string error |
Date: |
Tue, 3 Sep 2002 22:10:30 -0500 |
User-agent: |
Mutt/1.2i |
Hello,
I was getting an unterminated string error in my code and the error was
pretty bad in telling me where it happened. So I decided to fix it....
It turned out to be a lot harder than I thought because so much stuff
(like newlines, etc) can be inside a string.
Example:
(define str "this
is
a big
(valid string).")
The trouble is, what happens if you do this:
(define str "this
is
a big
(valid string).)
(display (+ 2 3))
(display "\n")
You get an "Error: unterminated string" message. :) I tried to fix up
this message by telling me the possible real start of the unterminated
string, but I couldn't do it because basically EVERYTHING is allowed in
a string until the next " is read all by itself. This means the second "
in the last display line was being marked as the start of the unterminated
string since technically, it is. In other languages that usually forbid
newlines in literal string constants, you can do this pretty easily. But
how would you do it here? Having to spend a long time debugging an
unterminated string error in a huge body of code is mind numbing.
Also, in library.scm: the r-string function, why isn't #\" also taken care
of in the #\\ case when reading a string? This would leave me to believe
that in certain situations you cannot read "\"these\"" kinds of strings.
Thanks.
-pete
- [Chicken-users] unterminated string error,
Peter Keller <=