read nil/t as #nil/#t
authorRobin Templeton <robin@terpri.org>
Fri, 20 Jun 2014 03:37:36 +0000 (23:37 -0400)
committerRobin Templeton <robin@terpri.org>
Tue, 21 Apr 2015 23:36:29 +0000 (19:36 -0400)
module/language/elisp/lexer.scm

index 8152a11..826f6df 100644 (file)
            (lambda (type str)
              (case type
                ((symbol)
-                ;; str could be empty if the first character is already
-                ;; something not allowed in a symbol (and not escaped)!
-                ;; Take care about that, it is an error because that
-                ;; character should have been handled elsewhere or is
-                ;; invalid in the input.
-                (if (zero? (string-length str))
-                    (begin
-                      ;; Take it out so the REPL might not get into an
-                      ;; infinite loop with further reading attempts.
-                      (read-char port)
-                      (error "invalid character in input" c))
-                    (return 'symbol (string->symbol str))))
+                (cond
+                 ((equal? str "nil")
+                  (return 'symbol #nil))
+                 ((equal? str "t")
+                  (return 'symbol #t))
+                 (else
+                  ;; str could be empty if the first character is already
+                  ;; something not allowed in a symbol (and not escaped)!
+                  ;; Take care about that, it is an error because that
+                  ;; character should have been handled elsewhere or is
+                  ;; invalid in the input.
+                  (if (zero? (string-length str))
+                      (begin
+                        ;; Take it out so the REPL might not get into an
+                        ;; infinite loop with further reading attempts.
+                        (read-char port)
+                        (error "invalid character in input" c))
+                      (return 'symbol (string->symbol str))))))
                ((integer)
                 ;; In elisp, something like "1." is an integer, while
                 ;; string->number returns an inexact real.  Thus we need