1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-18 02:00:20 +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) (lambda (type str)
(case type (case type
((symbol) ((symbol)
;; str could be empty if the first character is already (cond
;; something not allowed in a symbol (and not escaped)! ((equal? str "nil")
;; Take care about that, it is an error because that (return 'symbol #nil))
;; character should have been handled elsewhere or is ((equal? str "t")
;; invalid in the input. (return 'symbol #t))
(if (zero? (string-length str)) (else
(begin ;; str could be empty if the first character is already
;; Take it out so the REPL might not get into an ;; something not allowed in a symbol (and not escaped)!
;; infinite loop with further reading attempts. ;; Take care about that, it is an error because that
(read-char port) ;; character should have been handled elsewhere or is
(error "invalid character in input" c)) ;; invalid in the input.
(return 'symbol (string->symbol str)))) (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) ((integer)
;; In elisp, something like "1." is an integer, while ;; In elisp, something like "1." is an integer, while
;; string->number returns an inexact real. Thus we need ;; string->number returns an inexact real. Thus we need