tree-sitter / tree-sitter-rust

Rust grammar for tree-sitter
MIT License
340 stars 97 forks source link

Remove special-cased parsing for built-in attributes #163

Closed maxbrunsfeld closed 1 year ago

maxbrunsfeld commented 1 year ago

This is a follow-up to https://github.com/tree-sitter/tree-sitter-rust/pull/93. Apologies for not weighing in on the initial discussion of that PR.

I believe pretty strongly that special handling of specific language builtins shouldn't be implemented in the parser itself. Over time, that approach will bloat the binary size of the parser, thereby making it less useful to most consumers. It will also make the parser more tightly-coupled to small changes to the language, like adding new built-in attributes.

I think the right approach was option 3. proposed in the PR body by @ninevra (which @resolritter also argued for). In this PR, I've adopted that approach.

Let me know if anyone has concerns about this, and sorry for the churn.