Don't evaluate format control string in ReaderError

(Javier Olaechea)

To do so we extend the ReaderError with a new constructor that takes two
extra arguments.

Merges <https://github.com/armedbear/abcl/pull/86>.

Addresses <https://github.com/armedbear/abcl/issues/85>.
parent 67d31a72
......@@ -52,6 +52,14 @@ public final class ReaderError extends StreamError
setStream(stream);
}
public ReaderError(String message, Stream stream, LispObject arg1, LispObject arg2)
{
super(StandardClass.READER_ERROR);
setFormatControl(message);
setFormatArguments(list(arg1, arg2));
setStream(stream);
}
public ReaderError(LispObject initArgs)
{
super(StandardClass.READER_ERROR);
......
......@@ -1190,16 +1190,17 @@ public class Stream extends StructureObject {
return symbol;
// Error!
if (pkg.findInternalSymbol(symbolName) != null)
return error(new ReaderError("The symbol \"" + symbolName +
"\" is not external in package " +
packageName + '.',
this));
else
return error(new ReaderError("The symbol \"" + symbolName +
"\" was not found in package " +
packageName + '.',
this));
if (pkg.findInternalSymbol(symbolName) != null) {
return error(new ReaderError("The symbol \"~A\" is not external in package ~A.",
this,
new SimpleString(symbolName),
new SimpleString(packageName)));
} else {
return error(new ReaderError("The symbol \"~A\" was not found in package ~A.",
this,
new SimpleString(symbolName),
new SimpleString(packageName)));
}
}
} else { // token.length == 0
Package pkg = (Package)Symbol._PACKAGE_.symbolValue(thread);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment