make feature guard produce nothing on eof/closing bracket/paren

A dropped datum is replaced by whatever follows it, but what follows
may be the end of the file or the paren closing the list we are
in. Hand the token back to the caller instead: read-list closes its
list with it and the toplevel loop stops.

A `;' comment between a guard and the form it guards was also taken for
the guarded datum, so the form stayed unconditional and the guard did
nothing. Skip comments when reading the guard.

comment-form? was defined three times over; it moves to utils.
This commit is contained in:
2026-09-21 00:44:22 +03:00
parent d0e2c699e3
commit e0a228c66e
7 changed files with 53 additions and 12 deletions

View File

@@ -145,9 +145,6 @@
;;; C code it will be placed as a C commentary just before the function
;;; definition (actually that works for all blocky things: enum, struct, union as well).
(define (comment-form? f)
(and (pair? f) (eq? (car f) 'comment)))
(define (fn-header-length fn-form)
(if (memq (first fn-form) '(pub extern)) 5 4))