1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-17 22:12:25 +02:00

read nil/t as #nil/#t

(Best-ability ChangeLog annotation added by Christine Lemmer-Webber.)

* module/language/elisp/lexer.scm (lex): Update to handle #nil / #t.
This commit is contained in:
Robin Templeton 2014-06-19 23:37:36 -04:00 committed by Christine Lemmer-Webber
parent cf5e02f1a6
commit 1099c7c6b6
No known key found for this signature in database
GPG key ID: 4BC025925FF8F4D3

View file

@ -370,18 +370,24 @@
(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