C++20 modules support
As discussed in #173, this PR implements the C++20 modules grammar after the last contributor time restraints. It Closes #174.
Parser states
before:
#define STATE_COUNT 9798
#define LARGE_STATE_COUNT 2603
after:
#define STATE_COUNT 10516
#define LARGE_STATE_COUNT 2971
Implementation
The most complex rules in the grammar are:
export declaration (2)
export { declaration-seq (optional) } (3)
Declarations, in turn, can be any one of those discussed in https://en.cppreference.com/w/cpp/language/declarations. Said that, due to the inerent complexity of c++20 modules, I think that the state count can't go much lower than that. I'm open to suggestions tho.
@amaanq could you please take a look?
Support for parsing C++20 modules related syntax is something we'll be interested in using soon -- is there anything we can do to help get this merged? (maybe a question for @amaanq, since they seem to be the current POC for handling incoming PRs)
@jdrouhard is this PR something you can help out with, or point me to what I can do to help get C++20 modules support added?
Probably late spring/early summer if this still seems to be stalled with no guidance on how it can be helped along, I might need to look into what it would take to create a tree-sitter-cpp20modules fork that I can include as a dependency in other projects until the main repository gets support for c++ 20 modules.
@jdrouhard is this PR something you can help out with, or point me to what I can do to help get C++20 modules support added?
Probably late spring/early summer if this still seems to be stalled with no guidance on how it can be helped along, I might need to look into what it would take to create a tree-sitter-cpp20modules fork that I can include as a dependency in other projects until the main repository gets support for c++ 20 modules.
I don't know why this is stalled; this repo seems to have been unmaintained for some time.
I've actually been using this PR locally in Neovim for a while and have had zero issues.
I made some changes:
- Reduce the state count and parser size growth
- Improved the exportable item stuff a bit
- Removed the seemingly unrelated "constants" highlight
- Rewrote the commits to be by you instead of "Your Name"
I hadn't gotten around to looking at this because I knew it needed a little tweaking--thanks for the reminder to look at it.
Nice @jdrouhard , thanks for your time
Thanks @jdrouhard and @Tomcat-42 for getting this feature added 😄