[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 08/36: read nil/t as #nil/#t
From: |
Robin Templeton |
Subject: |
[Guile-commits] 08/36: read nil/t as #nil/#t |
Date: |
Sun, 26 Jan 2025 17:49:13 -0500 (EST) |
bpt pushed a commit to branch wip-elisp-rebased
in repository guile.
commit ddd76b738ce4506a08ce356f46fde18998b5a187
Author: Robin Templeton <robin@terpri.org>
AuthorDate: Thu Jun 19 23:37:36 2014 -0400
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.
---
module/language/elisp/lexer.scm | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/module/language/elisp/lexer.scm b/module/language/elisp/lexer.scm
index 8152a1182..826f6df87 100644
--- a/module/language/elisp/lexer.scm
+++ b/module/language/elisp/lexer.scm
@@ -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
- [Guile-commits] 23/36: degenerate let forms, (continued)
- [Guile-commits] 23/36: degenerate let forms, Robin Templeton, 2025/01/26
- [Guile-commits] 01/36: intern arbitrary constants, Robin Templeton, 2025/01/26
- [Guile-commits] 05/36: allow arbitrary constants in cps, Robin Templeton, 2025/01/26
- [Guile-commits] 10/36: defvar affects default value, Robin Templeton, 2025/01/26
- [Guile-commits] 18/36: compiler macros, Robin Templeton, 2025/01/26
- [Guile-commits] 19/36: defsubst, Robin Templeton, 2025/01/26
- [Guile-commits] 14/36: fix symbol-function, Robin Templeton, 2025/01/26
- [Guile-commits] 21/36: fset macro, Robin Templeton, 2025/01/26
- [Guile-commits] 28/36: use guile eval for elisp tree-il, Robin Templeton, 2025/01/26
- [Guile-commits] 30/36: use standard evaluator, Robin Templeton, 2025/01/26
- [Guile-commits] 08/36: read nil/t as #nil/#t,
Robin Templeton <=
- [Guile-commits] 03/36: multiple obarrays, Robin Templeton, 2025/01/26
- [Guile-commits] 06/36: guile-snarf fix, Robin Templeton, 2025/01/26
- [Guile-commits] 22/36: eval-when, Robin Templeton, 2025/01/26
- [Guile-commits] 34/36: loader: Handle interned constants as well as plain bytevectors., Robin Templeton, 2025/01/26
- [Guile-commits] 26/36: execute top level require forms, Robin Templeton, 2025/01/26
- [Guile-commits] 32/36: ignore 'expect-fail' forms in elisp tests, Robin Templeton, 2025/01/26
- [Guile-commits] 16/36: elisp @@ macro, Robin Templeton, 2025/01/26
- [Guile-commits] 35/36: elisp: boot: Replace removed FRAME-PROCEDURE with FRAME-PROCEDURE-NAME., Robin Templeton, 2025/01/26
- [Guile-commits] 25/36: top level fixes, Robin Templeton, 2025/01/26
- [Guile-commits] 29/36: guile-backtrace function, Robin Templeton, 2025/01/26