Repository navigation
docs: template type alias docs generation and expression stringification - #262
Open
AkiSakurai wants to merge 1 commit into
Open
AkiSakurai wants to merge 1 commit into
AkiSakurai wants to merge 1 commit into
Conversation
The docs command has a regression where it outputs incomplete types. The generated documentation on https://docs.werwolv.net/pattern-language/libraries/type/base.pat renders the template type aliases as using Dec<T> = ??? [[format(...)]];; while the actual declaration is using Dec<T> = T [[format("type::impl::format_dec")]]; Template parameter references print as '???' and attribute arguments are dropped entirely. This broke when type applications (ASTNodeTypeApplication) were introduced in WerWolv#204: the docs generator was ported to the new node but never learned to print its template arguments. Before WerWolv#204 the same declaration still rendered the complete using Dec<T> = T [[format]]; with only the attribute arguments missing. - Split docs type helpers into docs_types.cpp (no CLI11 dependency for tests) - Implement expression and type name stringification as ASTStringifier, a visitor built on the AST visitor framework instead of dynamic_cast dispatch - Add stringifyTypeName/stringifyExpression with parent template param resolution - Precedence-aware parenthesization for math/ternary/cast expressions - Angle-bracket ambiguity parens for < > <= >= >> in template args - Preserve endianness (be/le) inside and outside template arguments - Keep unsigned literal suffixes (0u) in docs output so it round-trips back to the same literal; pattern type names keep their previous display format - Only fold "0 <op> expr" back into unary "<op>x" for the parser's signed-zero encoding, so a user-written "0u - x" keeps its value - Print attribute arguments via stringifyExpression (e.g. [[pack(1)]]) - Skip invalid type decls in docs generation - Expand UsingDocs test coverage Co-Authored-By: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docs command has a regression where it outputs incomplete types. The generated documentation on https://docs.werwolv.net/pattern-language/libraries/type/base.pat renders the template type aliases as
while the actual declaration is
Template parameter references print as '???' and attribute arguments are dropped entirely. This broke when type applications (ASTNodeTypeApplication) were introduced in #204: the docs generator was ported to the new node but never learned to print its template arguments. Before #204 the same declaration still rendered the complete
with only the attribute arguments missing.