]> rhodes.io Git - swankr.git/commitdiff
Christophe Weblog Wiki Code Publications Music
support translation of t and nil
authorChristophe Rhodes <csr21@cantab.net>
Wed, 6 Apr 2011 07:57:45 +0000 (08:57 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Wed, 6 Apr 2011 07:57:45 +0000 (08:57 +0100)
Parse them into TRUE and FALSE in the lisp->R translator

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() {