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:
parent
cf5e02f1a6
commit
1099c7c6b6
1 changed files with 18 additions and 12 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue