-
Notifications
You must be signed in to change notification settings - Fork 1
fix(docs): repair Doxygen SQL extraction — coverage gaps + private split #369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,50 @@ | ||
| #!/usr/bin/env bash | ||
| #MISE description="Doxygen input filter for SQL files" | ||
| set -euo pipefail | ||
|
|
||
| # Converts SQL-style comments (--!) to C++-style comments (//!) | ||
| sed 's/^--!/\/\/!/g' "$1" | ||
| # Doxygen always calls an INPUT_FILTER with exactly one filename. Guard it so a | ||
| # stray invocation fails fast instead of `awk` blocking on stdin and hanging the | ||
| # docs job. | ||
| if [ "$#" -ne 1 ]; then | ||
| echo "usage: $(basename "$0") <file.sql>" >&2 | ||
| exit 2 | ||
| fi | ||
|
|
||
| # Prepares SQL for Doxygen's C++ parser. Two transforms: | ||
| # | ||
| # 1. `--!` doc comments -> `//!` so Doxygen sees them. | ||
| # 2. Strip dollar-quoted function bodies (`$$ ... $$`), leaving just the | ||
| # declaration and its trailing clauses. Doxygen parses SQL heuristically as | ||
| # C++, and body SQL derails it: a `::type` cast reads as C++ scope | ||
| # resolution and drops the whole enclosing CREATE FUNCTION memberdef (this | ||
| # silently lost jsonb_path_query and ~hundreds of generated extractor | ||
| # overloads), while keywords/calls in bodies (`SELECT`, `RETURN NEXT`, | ||
| # `array_length(...)`) get mis-parsed as spurious functions. Bodies carry no | ||
| # documentation, so removing them is lossless for the generated reference | ||
| # and leaves Doxygen only clean `CREATE FUNCTION name(args) RETURNS ...` | ||
| # declarations to read. Only bare `$$` quoting is used in this codebase. | ||
| awk ' | ||
| /^--!/ { print "//!" substr($0, 4); next } | ||
| { | ||
| out = "" | ||
| s = $0 | ||
| while (length(s) > 0) { | ||
| p = index(s, "$$") | ||
| if (inbody) { | ||
| if (p == 0) { s = ""; break } # whole remainder is body: drop | ||
| s = substr(s, p + 2) # resume after the closing $$ | ||
| inbody = 0 | ||
| } else { | ||
| if (p == 0) { out = out s; break } # no body marker: keep as-is | ||
| out = out substr(s, 1, p - 1) # keep code before opening $$ | ||
| s = substr(s, p + 2) | ||
| inbody = 1 | ||
| } | ||
| } | ||
| # Regular SQL `--` comments read as C++ code to Doxygen (e.g. | ||
| # `-- per-entry overloads (...)` mints a phantom `overloads(...)` function), | ||
| # so neutralize them to C++ line comments on the (body-stripped) code. | ||
| gsub(/--/, "//", out) | ||
| print out | ||
| } | ||
| ' "$1" | ||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.