-
Notifications
You must be signed in to change notification settings - Fork 6
Write YAML in-line with class definition #1
Comments
Yes, extracting the YAML from the source would keep things nicely together. But as you say, because that could write it into the YAML file itself it can be done in a way that's backwards compatible with what is currently there, so getting that right is my focus. But it should be really easy to do, and is definitely on my radar. The second version is a bit harder to get right: I'm trying as much as possible to avoid write anything that looks like a C++ parser. But if I can get something like libclang integration working then it'd be possible to haul out enough information to make that work. This article shows what might be possible. One reason why neither of these has been part of the first bit of coding is my interest is largely in wrapping library code that is defined elsewhere and so annotating it is not possible. |
OK, having a bit of success with gcc-xml. This might actually be useful for Rcpp attributes and remove some of the issues it has with parsing prototypes and the root namespace restriction. |
It looks really easy to get type information with gcc-xml except for templated types (item 5). Unfortunately, that's one of the things I'm trying to get working nicely, and no information about templates is emitted in the output. That kind of makes sense because it would be a huge amount of information. libclang promises to be able to get that working, but there is almost no documentation and nothing particularly nice to use. |
That's a shame :( Very excited to see the work you're doing here, I think that this package could really be the modern reboot that Rcpp modules needs :) |
I think I can get everything needed from doxygen, which is at least easy to install. I'm going to try and wire it up so that it can be swapped out for libclang though, if I can get that working (I might use RcppR6 generate an interface to libclang, even 😛). |
Another update: I think I can get all the required information using doxygen, gccxml or libclang,with varying levels of hassle and corner cases where one or the other won't work. I'm doing this in richfitz/cppinfo to keep this repo tidy. However, it looks pretty straightforward to do all sorts of fun things with this information:
|
Perhaps instead of maintaining a YAML file separately, one could include it as a comment block alongside the class definition. For example:
Or, depending on how ambitious you are, you could imagine annotating specific fields and parsing from that:
but that would be a more long-term goal.
The text was updated successfully, but these errors were encountered: