-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Include Haddocks for exported (low-level) bindings #26
Comments
All `libclang` parameter names are capitalized. The header documentation is updated.
I defined the wrappers in Of the content in
Please feel free to let me know if we will need something that I have not implemented, though I will no doubt find out when I proceed with implementation. |
I am currently implementing an Just to get started quickly, I started implementing it as a BTW, output is currently formatted in Markdown I have not committed the code yet, but I should be able to do so tomorrow. |
I wonder if it is worth adding |
Would the existing |
I hadn't seen that yet! Nice! Currently, I am inspecting the parsed comments in detail. (WIP) Example
|
This commit is a squashed version of a number of previous commits, rebased to work with a recent redesign of `Fold`. `FoldM` uses `MonadIO`, and I refactored the code to call `liftIO` minimizing changes. Now that we can use a `Reader`, it is possible to track indentation within the `Reader` environment, using `local` for indentation, but I have not implemented that. The new version of `Fold` no longer provides `parent`, as the parent cursor can be queried using the API. I rewrote the code to query both the semantic and lexical parents. When they are equal and are not the target file, just "parent" is displayed. Otherwise, "semantic parent" and "lexical parent" are displayed separately. This program uses features added in the `doxygen` branch (#26), but I am referencing the new `clang-ast-dump` issue (#212).
Keeping a small dependency footprint is not unimportant, especially since this may run as a TH splice. However, I also don't think we should be overly worried about it. Most of the dependencies of |
All `libclang` parameter names are capitalized. The header documentation is updated.
I investigated how we might output Haddock comments in the preprocessor case. We generate the Haskell AST using Package
The package is not maintained. The version in Hackage fails to build (with GHC 9.6.6) because it does not load the My test produced broken output, as a comment was inserted immediately after a brace, starting a multi-line comment. -- | This is some module documentation.
module Demo where
-- | Foo is a data type
data Foo = Foo{-- | It has a bar!
bar :: Int, -- | It has a baz!
baz :: Int} The algorithm used for inserting comments is simple, and I think it would work pretty well if the non-commented code put each field (etc.) on a separate line (as they should be with comments). If we want to fix this, I think it would involve forking the Alternatives include using At any rate, I now have a much better idea of how the translated documentation will be consumed. |
Doxygen documentation may contain references to identifiers. We translate from C names to Haskell names using a local context. For example, record field names translate to names that include the data type name or constructor name, according to configured options. When we run across an identifier in the documentation, we are not able to perform the same translation without context. If we want to translate references, perhaps we can accumulate a reference map (from C names to Haskell names) during code translation and then pass that map to a subsequent step that translates the documentation. Any identifier that is in the reference map would then be able to be translated. An easy yet unhelpful alternative is to not translate references. All references could be rendered as code ( |
I ran into what seemed to be strange behavior, and I finally realized that it is not strange but rather a mistake in the documentation in /**
* Convert a given full parsed comment to an HTML fragment.
*
...
* \li "para-brief" for \paragraph and equivalent commands;
...
*/
CINDEX_LINKAGE CXString clang_FullComment_getAsHTML(CXComment Comment); The mistake is in the middle line, which should have
It is in one of the "other documentation blocks" here. Not only does it serve as a no-op, it breaks the list item so that the following text is parsed as a verbatim line in between list items. In documentation where an escaped backslash is used to reference a command, the escaped backslash and following text are represented in separate (adjacent) text elements. EDIT In /**
* @}
*/
/**
* \defgroup CINDEX_MODULE Module introspection
*
* The functions in this group provide access to information about modules.
*
* @{
*/ The Such issues are the only places where I see verbatim lines in the parsed ASTs. I am not even sure how to create a verbatim line aside from this, and the documentation does not provide any clues. |
I am switching back to other priorities, but I was really close to finishing the first implementation of the reifying of the The "kind" of a Haskell type Kind The rest of the |
We decided against lenient parsing of `libclang` comments and now throw an error upon encountering an unexpected comment kind, such as block content within inline content. We will of course need to test this against various real-world code. Error messages include the cursor display name, the file name, and the extent. We can investigate the `libclang` comment AST for any errors using the `clang-ast-dump` utility. Note that this internal module is not used anywhere yet, so it is therefore untested. I will test it when returning to the documentation task.
Reify libclang documentation AST (#26)
When we generate foreign imports from C headers, if the declarations in those headers have documentation attached, then we should include that documentation in the generated bindings also. Ideally we would be using Haddock formatting here, but given the absence of a general agreed standard for the documentation of C headers, that might be hard to do in general. Nonetheless, we could at least support common formats.
foreign imports
for all function definitions #25, it might also be useful to include C variable names in as part of the Haddocks.The text was updated successfully, but these errors were encountered: