Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Skip macros in C++ during parsing #116

Merged
merged 3 commits into from
Jul 19, 2024

Conversation

LeonMatthesKDAB
Copy link
Collaborator

We can use TreeSitters "included ranges" to specify which parts of the document to include when parsing.

In our case we actually use this to exclude certain ranges, which are C++ pre-processor macros that would otherwise screw up our parsing.

Fix #30

We can use TreeSitters includedRanges feature to only parse the
specified ranges.
This allows us to exclude certain macros like the AFX_EXT_CLASS macro
which was causing issues previously.
@LeonMatthesKDAB LeonMatthesKDAB marked this pull request as ready for review July 18, 2024 07:31
@LeonMatthesKDAB LeonMatthesKDAB requested a review from narnaud July 18, 2024 07:32
Users can now specify a list of macros to exclude from the C++ parser
through the options dialog.
By default the list is pre-filled with:
- AFX_EXT_CLASS
- [A-Z_]*EXPORT[A-Z_]*
- Q_OBJECT
@LeonMatthesKDAB LeonMatthesKDAB merged commit c6d50a7 into KDAB:main Jul 19, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Macros can break Tree-Sitter parsing
2 participants