Commit 2219fe78 authored by mevenson@1c010e3e-69d0-11dd-93a8-456734b0d56f's avatar mevenson@1c010e3e-69d0-11dd-93a8-456734b0d56f
Browse files

Fixes #294: Reader doesn't recognize terminating characters in some cases.

Patch and test by Stas.
parent 5651c144
......@@ -739,18 +739,11 @@ public class Stream extends StructureObject {
private static final boolean isTokenDelimiter(char c, Readtable rt)
{
switch (c) {
case '"':
case '\'':
case '(':
case ')':
case ',':
case ';':
case '`':
return true;
default:
return rt.isWhitespace(c);
}
byte type = rt.getSyntaxType(c);
return type == Readtable.SYNTAX_TYPE_TERMINATING_MACRO ||
type == Readtable.SYNTAX_TYPE_WHITESPACE;
}
public LispObject readDispatchChar(char dispChar,
......@@ -909,7 +902,8 @@ public class Stream extends StructureObject {
c = (char) n; // ### BUG: Codepoint conversion
if (rt.isWhitespace(c))
break;
if (c == '(' || c == ')') {
if (rt.getSyntaxType(c) ==
Readtable.SYNTAX_TYPE_TERMINATING_MACRO) {
_unreadChar(c);
break;
}
......
......@@ -133,3 +133,11 @@ nil)
:collecting (cons x y))
((0.0 . 0) (0.0 . 1)))
;; http://trac.common-lisp.net/armedbear/ticket/294
(deftest bugs.reader.1
(let ((*readtable* *readtable*))
(set-macro-character #\? (lambda (stream char) (code-char (read stream nil nil t))))
'(a .?0))
(A . #\Null))
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