| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Note: This is still a work in progress, but should be stable in a few weeks once I port robotpy-build over to use it. Someday I'll do that, probably!
A pure python C++ header parser that parses C++ headers in a mildly naive manner that allows it to handle many C++ constructs, including many modern (C++11 and beyond) features.
This is a complete rewrite of the CppHeaderParser library. CppHeaderParser is really useful for some tasks, but it's implementation is a truly terrible ugly hack built on top of other terrible hacks. This rewrite tries to learn from CppHeaderParser and leave its ugly baggage behind.
Goals:
Non-goals:
There are two APIs available:
A pyodide-powered interactive demo is at https://robotpy.github.io/cxxheaderparser/
Documentation can be found at https://cxxheaderparser.readthedocs.io
Requires Python 3.6+, no non-stdlib dependencies if using Python 3.7+.
TODO: distribute on pip
To see a dump of the data parsed from a header:
# pprint format python -m cxxheaderparser myheader.h # JSON format python -m cxxheaderparser --mode=json myheader.h # dataclasses repr format python -m cxxheaderparser --mode=repr myheader.h # dataclasses repr format (formatted with black) python -m cxxheaderparser --mode=brepr myheader.h
See the documentation for anything more complex.
This should handle even complex C++ code with few problems, but there are almost certainly weird edge cases that it doesn't handle. Additionally, not all C++17/20 constructs are supported yet (but contributions welcome!).
If you find an bug, we encourage you to submit a pull request! New changes will only be accepted if there are tests to cover the change you made (and if they don’t break existing tests).
cxxheaderparser was created by Dustin Spicuzza
BSD License
| Back | FazBrowse Home | New Git URL |