Christophe Weblog Wiki Code Publications Music
support translation of t and nil
[swankr.git] / swank.R
diff --git a/swank.R b/swank.R
index 00967c558d916290739138a0c4177267fe697e57..7dd9d5c0a07676a70d433919acd376495b619ccc 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -210,7 +210,14 @@ readSexpFromString <- function(string) {
     } else if(grepl("^[0-9]+\\.[0-9]+$", token)) {
       as.double(token)
     } else {
-      as.name(token)
+      name <- as.name(token)
+      if(name == quote(t)) {
+        TRUE
+      } else if(name == quote(nil)) {
+        FALSE
+      } else {
+        name
+      }
     }
   }
   readToken <- function() {