Skip to content
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

Add support for Microsoft-specific modifiers #40

Merged
merged 2 commits into from
Mar 30, 2020

Conversation

MathieuNls
Copy link
Contributor

@MathieuNls MathieuNls commented Mar 5, 2020

Microsoft-specific modifiers are keywords can be used to modify declarators to form derived types.

The specification for the modifiers themselves is here:
https://docs.microsoft.com/en-us/cpp/cpp/microsoft-specific-modifiers?view=vs-2019.

If you are OK with these changes, I'll go ahead and open a synchronized PR on the cpp grammar to add the Microsoft modifiers there and fix the error that this PR introduces:

tree-sitter-cpp# ./tree-sitter-linux-x64 generate

Unresolved conflict for symbol sequence:

  attribute_specifier  •  'extern'  …

Possible interpretations:

  1:  (_declaration_specifiers_repeat1  attribute_specifier)  •  'extern'  …
  2:  (constructor_or_destructor_definition_repeat1  attribute_specifier)  •  'extern'  …

Possible resolutions:

  1:  Specify a higher precedence in `_declaration_specifiers_repeat1` than in the other rules.
  2:  Specify a higher precedence in `constructor_or_destructor_definition_repeat1` than in the other rules.
  3:  Add a conflict for these rules: `_declaration_specifiers`, `constructor_or_destructor_definition`

Fixes #41

@calixteman
Copy link
Contributor

@maxbrunsfeld ping

Copy link
Contributor

@maxbrunsfeld maxbrunsfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very well done, and thanks for the reference link and the thorough tests. I left some feedback which is related to code size optimization and naming.

@MathieuNls MathieuNls force-pushed the microsoft_modifiers branch from 57cfbfd to 9fc2289 Compare March 21, 2020 15:55
Microsoft-specific modifiers are keywords can be used to modify declarators to form derived types.

The specification for the modifiers themselves is here:
https://docs.microsoft.com/en-us/cpp/cpp/microsoft-specific-modifiers?view=vs-2019
@MathieuNls
Copy link
Contributor Author

@maxbrunsfeld ; I've addressed the comments and opened tree-sitter/tree-sitter-cpp#79 to reflect the changes on the cpp project.

Note that the test on tree-sitter/tree-sitter-cpp#79 won't pass until this is closed as it relies on the 0.17.0 version that I propose here.

@MathieuNls
Copy link
Contributor Author

@maxbrunsfeld ping

@MathieuNls MathieuNls force-pushed the microsoft_modifiers branch from dfe8679 to 8b84196 Compare March 30, 2020 16:56
@MathieuNls MathieuNls force-pushed the microsoft_modifiers branch from 8b84196 to 130dcc5 Compare March 30, 2020 16:57
@maxbrunsfeld
Copy link
Contributor

Thanks so much; great work on this. I will try to look at the C++ PR later today.

@maxbrunsfeld maxbrunsfeld merged commit 88592f1 into tree-sitter:master Mar 30, 2020
@MathieuNls
Copy link
Contributor Author

The last thing required for tree-sitter/tree-sitter-cpp#79 tests to pass is to tag 88592f1 as 0.16.1

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.

Microsoft modifiers are not handled
3 participants