look past comments in a public form's header

This commit is contained in:
2026-09-21 00:56:26 +03:00
parent 05bab57867
commit 1195e5c191
7 changed files with 38 additions and 19 deletions

View File

@@ -79,10 +79,16 @@
;; A function is reduced to a prototype and keeps its `pub', so
;; the importing unit declares it with external linkage
((fn)
(cons (copy-form-source! form (take form 5)) acc))
(cons (copy-form-source!
form
(take (strip-header-comments form 5) 5))
acc))
;; A variable becomes an `extern' declaration
((var)
(cons (copy-form-source! form (cons 'extern (take (cdr form) 3))) acc))
(cons (copy-form-source!
form
(cons 'extern (take (cdr (strip-header-comments form 4)) 3)))
acc))
((define defmacro enum import include struct typedef union)
(cons (copy-form-source! form (cdr form)) acc))
(else (sex-error form "pub must be followed by a definition" form))))