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
fix(cpp) fix class/template parsing issues #2752
fix(cpp) fix class/template parsing issues #2752
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still doesn’t handle attributes, e.g.
struct [[deprecated]] foobar {};
Of course a simple fix would be to add |\[\[
to end
but handling them properly isn’t actually much harder: we might just need a nested rule {begin: /\[\[/, end: /]]/, keywords: 'using'}
.
But I wouldn’t increase the scope of this PR, as such attributes still relatively rare in C++ code (and even rarer on type declarations).
Thanks! |
@klmr Better? |
This fixes #2716 and it fixes #2102.
This solves the problem simply by aborting the class mode whenever we see a
<
,>
or=
, and returning to the regular rule matching. This is a much simpler solution that trying to process deeply nested templates and count subexpressions of<
vs(
- all the while trying to figure out what is perhaps simple a less than (or greater than) vs a template delimiter.This also adds support for
enum struct
andenum class
. This actually mostly worked before but now the "class" block extends around the "enum" as well which is slightly more correct I think.See tests.
@klmr