Skip to content

Update Enum Grammar for Attribute Support (#314)#354

Open
Muppetsg2 wants to merge 1 commit into
tree-sitter:masterfrom
Muppetsg2:enum-attributes
Open

Update Enum Grammar for Attribute Support (#314)#354
Muppetsg2 wants to merge 1 commit into
tree-sitter:masterfrom
Muppetsg2:enum-attributes

Conversation

@Muppetsg2
Copy link
Copy Markdown

Resolves #314

This PR updates the C++ grammar to correctly align with the standard regarding attribute positioning:

  • Enum Headers: Moved attribute support to the correct position (after enum class/struct but before the identifier) (C++11).
  • Enumerators: Added support for attributes on individual enum constants (C++17).
  • Security & Dependencies:
    • Updated tree-sitter-c to ensure core grammar stability.
    • Bumped eslint to the latest version to resolve known security vulnerabilities.
  • Testing: Introduced new test cases covering various enum attribute configurations to prevent regressions.

The grammar now correctly parses:

enum class [[maybe_unused]] MyEnum { 
  Value [[deprecated]] 
};

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.

bug: Parses [[deprecated]] on enumerator incorrectly

1 participant