Skip to content

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

Merged
LeonMatthesKDAB merged 3 commits into
KDAB:mainfrom
LeonMatthesKDAB:30-macro-parsing
Jul 19, 2024
Merged

feat: Skip macros in C++ during parsing#116
LeonMatthesKDAB merged 3 commits into
KDAB:mainfrom
LeonMatthesKDAB:30-macro-parsing

Conversation

@LeonMatthesKDAB

Copy link
Copy Markdown

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

Leon Matthes added 2 commits July 17, 2024 16:45
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
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