Improve docstring handling #30
Reference in New Issue
Block a user
Delete Branch "pkulev/sex:feature/docstrings"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
fn/struct/union/enumis a docstring, lifted by semen into a comment form so the writer prints it above the C declaration rather than inside the body.pubfunction docstrings survive--public-interfaceand imports (the prototype keeps the string; the importer's semen pass emits the comment).sex-fn-*accessors now follow current(fn name args ret …)syntax, includingextern fn.A string later in a function body is left as a statement.
varanddefineare unchanged: a string there is already an initializer or#definevalue (;comments still work above them).Comments are
/* … */, same as;comments, not the//from the original ticket.A docstring-only
fnstays a prototype.Test plan
make checksexc file.sex -C --line-directives=noneon a function with a one-line docstring: comment sits above the declaration, not in the body(fn helper ((a int)) int "Forward.")still emits a prototypestruct/enum/unionnamesexc tests/modules/greet.sex --public-interfacestill shows the greet docstring on the prototype🤯
78862cfe4fto434086ade8WIP: Improve docstring handlingto Improve docstring handling🔥
Looks very good! Thanks!