[Kde-bindings] Twine2 (PyKDE* code generation tool) Naming
Simon Edwards
simon at simonzone.com
Tue Apr 21 07:56:28 UTC 2015
On 2015-04-19 22:07, Scott Kitterman wrote:
> I do have some additional ideas in terms of making is easier to use,
> but the
> biggest thing that would make it easier to use is if it could actually
> successfully parse everything.
This is just a general comment about how to approach this task. When it
comes the parsing of C++ headers you will need to pick your fights
carefully. C++ is so big and has so many special constructions that it
isn't an economical use of time to try to support everything. If you hit
a .h file which chokes the parser, you need to have a look at what is
inside it and whether it makes sense to pursue it. It might not even
have stuff which is relevant to Python, in which case you can skip it.
It might be full of templates which you can't directly map to Python, in
which case you may have to skip it and write some custom binding code in
C++ for SIP.
It is par for the course that something new comes along every 6 months
which the parse can't handle. What twine2 does is also unlike a
compiler. It tries to parse C++ and handle preprocessor macros etc at
the same time. A C++ compiler has a two step parser, preprocessor then
C++ parsing.
Also, it is possible to turn on tracing the parser by passing in some
debug=3 or something option. The docs for the parser library twine2
should say exactly what to do.
cheers,
--
Simon Edwards
simon at simonzone.com
Nijmegen, The Netherlands
More information about the Kde-bindings
mailing list