[cfe-commits] [PATCH] Add Python bindings to comment AST introspection APIs

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Dec 20 15:07:00 PST 2012


On Dec 20, 2012, at 2:06 PM, Ben Gertzfield <bgertzfield at gmail.com> wrote:

> Exposes Dmitri's new comment AST introspection APIs ( http://clang.llvm.org/doxygen/group__CINDEX__COMMENT.html ) via the existing Python bindings.
> 
> Unit tests included.
> 
> Open questions:
> 
> 1) For the comment AST methods, they're currently all in one (way-too-large) Comment class.
> 
> Should I split these into multiple Python classes, or leave them in a flat hierarchy to match the libclang API?
> 
> Splitting it up may make it easier to read the API, but makes it more fragile when the AST logic changes (and it probably will change over time).
> 
> Keeping it in one class makes it simpler to handle AST logic changes in the future, but the class is pretty bloated, and has a number of is_foo_type() methods.

My suggestion is to keep it close to the libclang API, one can always build better abstractions on top.

> 
> 2) For the methods that return HTML and XML, should they just return strings, or should I make the API return parser objects? (It seems like introducing a dependency on those modules is probably not the best idea, but I'm not sure what the state of the art is in HTML and XML in Python.)

Again, I suggest going with simplicity and returning strings, one can utilize the relevant python modules using the string.

> 
> <clang-py-comments-v1.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121220/c4999688/attachment.html>


More information about the cfe-commits mailing list