-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add comments extraction support #61
Add comments extraction support #61
Conversation
Note: tests are working fine but I didn't manage to get it working with a real example yet, I'm waiting for your feedbacks on the idea of this PR before investigating further. Also, this change depends on crystal-lang/clang.cr#7. |
6ee803d
to
0d27769
Compare
(I think that the failed CI job should just be restarted for it to pass) |
I was able to try out this branch and it was able to extract some of the comments from my header file 👍. It doesn't get all of them but that might be due to multiple valid comment formats in the example I tried. |
f3f63b2
to
8ae1e2d
Compare
@zph so far I could only parse Doxygen comments but I think there might be an option somewhere to make it possible to parse every type of comments because there are some tests for that in LLVM sources. |
035ff65
to
1e7d91a
Compare
This change introduces a new option to import C doctrings comments at parsing time. It also introduce a new "import_docstrings" parameter to import C doctrings as Crystal comments when generating a lib. This parameter can take two values: "brief" to extract the brief part of doctrings or "full" to extract the whole docstring. (see http://www.doxygen.nl/manual/docblocks.html https://clang.llvm.org/doxygen/group__CINDEX__COMMENT.html) A bunch of changes have been made to the core lib to make it possible: - an Option enum has been added to CrystalLib::Parser - an @options attribute has been added to CrystalLib::Parser - a @doc attribute has been added to CrystalLib::AST nodes
1e7d91a
to
60cb5fe
Compare
Is it ready to be merged, are still some stuffs to be fixed/improved? |
This change introduces a new option to import C doctrings comments at
parsing time. It also introduce a new "import_docstrings" parameter to
import C doctrings as Crystal comments when generating a lib.
This parameter can take two values: "brief" to extract the brief part of
doctrings or "full" to extract the whole docstring 1,2.
A bunch of changes have been made to the core lib to make it possible: