In Part 05 of the Code Indexer series, we tackle some of the trickiest C++ parsing edge cases using Tree-sitter.
We implement:
* Friend function detection
* Friend-aware FQN scoping
* Anonymous struct parsing
* Out-of-line method parsing
* Destructor detection
* Nested anonymous namespace handling
This episode focuses heavily on iterative parser debugging and understanding how Tree-sitter actually represents complex C++ constructs internally.
By the end, our parser can correctly identify:
* methods
* constructors
* destructors
* operators
* friend operators
* free functions
* anonymous namespace functions
We also explore why certain bugs happen, how AST traversal can silently fail, and how small recursive changes completely alter parser behavior.
If you're building developer tools, code intelligence systems, static analyzers, or AI-powered code understanding systems, this episode goes very deep into practical AST engineering.