[armedbear-cvs] r12645 - trunk/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Sat May 1 20:21:51 UTC 2010


Author: ehuelsmann
Date: Sat May  1 16:21:50 2010
New Revision: 12645

Log:
Fix #93: Empty VALUES set in the reader treated as NIL.


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

Modified: trunk/abcl/src/org/armedbear/lisp/Stream.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Stream.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Stream.java	Sat May  1 16:21:50 2010
@@ -657,18 +657,26 @@
                     // normal token beginning with '.'
                     _unreadChar(nextChar);
                 }
+
+                thread._values = null;
                 LispObject obj = processChar(c, rt);
                 if (obj == null) {
                     // A comment.
                     continue;
                 }
-                if (first == null) {
-                    first = new Cons(obj);
-                    last = first;
-                } else {
-                    Cons newCons = new Cons(obj);
-                    last.cdr = newCons;
-                    last = newCons;
+
+                if (! (obj == NIL && thread._values != null
+                       && thread._values.length == 0)) {
+                    // Don't add the return value NIL to the list
+                    // if the _values array indicates no values have been returned
+                    if (first == null) {
+                        first = new Cons(obj);
+                        last = first;
+                    } else {
+                        Cons newCons = new Cons(obj);
+                        last.cdr = newCons;
+                        last = newCons;
+                    }
                 }
             }
         } catch (IOException e) {
@@ -1439,8 +1447,14 @@
             char c = flushWhitespace(rt);
             if (c == delimiter)
                 break;
+
+            thread._values = null;
             LispObject obj = processChar(c, rt);
-            if (obj != null)
+            if (obj != null &&
+                ! (obj == NIL && thread._values != null
+                   && thread._values.length == 0))
+                // Don't add 'obj' to the list, if _values indicates
+                // no values have been returned
                 result = new Cons(obj, result);
         }
         if (Symbol.READ_SUPPRESS.symbolValue(thread) != NIL)




More information about the armedbear-cvs mailing list