[armedbear-cvs] r14211 - trunk/abcl/src/org/armedbear/lisp
ehuelsmann at common-lisp.net
ehuelsmann at common-lisp.net
Sun Oct 21 18:18:20 UTC 2012
Author: ehuelsmann
Date: Sun Oct 21 11:18:20 2012
New Revision: 14211
Log:
Re #253: Prevent unreading eofValue if eofValue happens to be a LispCharacter.
Modified:
trunk/abcl/src/org/armedbear/lisp/peek_char.java
Modified: trunk/abcl/src/org/armedbear/lisp/peek_char.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/peek_char.java Sun Oct 21 09:50:18 2012 (r14210)
+++ trunk/abcl/src/org/armedbear/lisp/peek_char.java Sun Oct 21 11:18:20 2012 (r14211)
@@ -38,6 +38,8 @@
// ### peek-char
public final class peek_char extends Primitive
{
+ private static LispObject internalEOF = new LispObject();
+
private peek_char()
{
super("peek-char",
@@ -68,7 +70,9 @@
in = ((EchoStream)stream).getInputStream();
else
in = stream;
- final LispObject result = in.readChar(eofError, eofValue);
+ final LispObject result = in.readChar(eofError, internalEOF);
+ if (result == internalEOF)
+ return eofValue;
if (result instanceof LispCharacter)
in.unreadChar((LispCharacter)result);
return result;
@@ -79,7 +83,10 @@
// operation on the next character."
Readtable rt = currentReadtable();
while (true) {
- LispObject result = stream.readChar(eofError, eofValue);
+ LispObject result = stream.readChar(eofError, internalEOF);
+ if (result == internalEOF)
+ return eofValue;
+
if (result instanceof LispCharacter) {
char c = ((LispCharacter)result).value;
if (!rt.isWhitespace(c)) {
@@ -96,7 +103,10 @@
// found; that character is left in INPUT-STREAM."
char c = ((LispCharacter)peekType).value;
while (true) {
- LispObject result = stream.readChar(eofError, eofValue);
+ LispObject result = stream.readChar(eofError, internalEOF);
+ if (result == internalEOF)
+ return eofValue;
+
if (result instanceof LispCharacter) {
if (((LispCharacter)result).value == c) {
stream.unreadChar((LispCharacter)result);
More information about the armedbear-cvs
mailing list