[armedbear-cvs] r14357 - in trunk/abcl: src/org/armedbear/lisp test/lisp/abcl

mevenson at common-lisp.net mevenson at common-lisp.net
Wed Jan 16 12:27:34 UTC 2013


Author: mevenson
Date: Wed Jan 16 04:27:33 2013
New Revision: 14357

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

Patch and test by Stas.

Modified:
   trunk/abcl/src/org/armedbear/lisp/Stream.java
   trunk/abcl/test/lisp/abcl/bugs.lisp

Modified: trunk/abcl/src/org/armedbear/lisp/Stream.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Stream.java	Wed Jan 16 02:48:24 2013	(r14356)
+++ trunk/abcl/src/org/armedbear/lisp/Stream.java	Wed Jan 16 04:27:33 2013	(r14357)
@@ -739,18 +739,11 @@
     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 @@
                 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;
                 }

Modified: trunk/abcl/test/lisp/abcl/bugs.lisp
==============================================================================
--- trunk/abcl/test/lisp/abcl/bugs.lisp	Wed Jan 16 02:48:24 2013	(r14356)
+++ trunk/abcl/test/lisp/abcl/bugs.lisp	Wed Jan 16 04:27:33 2013	(r14357)
@@ -133,3 +133,11 @@
        :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))
+      




More information about the armedbear-cvs mailing list