defconst, defvar: proclaim special at compile-time
[bpt/guile.git] / module / language / elisp / lexer.scm
index 5a0e6b3..826f6df 100644 (file)
@@ -20,6 +20,7 @@
 
 (define-module (language elisp lexer)
   #:use-module (ice-9 regex)
+  #:use-module (language elisp runtime)
   #:export (get-lexer get-lexer/1))
 
 ;;; This is the lexical analyzer for the elisp reader.  It is
            (let ((cur (read-char port)))
              (case cur
                ((#\")
-                (return 'string (list->string (reverse result-chars))))
+                (return 'string
+                        (make-lisp-string
+                         (list->string (reverse result-chars)))))
                ((#\\)
                 (let ((escaped (read-char port)))
                   (case escaped
            (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