fix: Switch from grammar_name
to kind
#561
No reviewers
Labels
No labels
Compat/Breaking
Kind
Bad merge
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
New language
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: mergiraf/mergiraf#561
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "lang_profile_name_validation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Work in progress because this seems to be rejecting node names that are actually valid (they can be returned with
mgf_dev parse
). More investigation is required.For #489.
97dca8af1d
tobc8a83ff25
WIP: tests: validate node type and field names from language profilesto fix: Switch fromgrammar_name
tokind
So, this was a rather big can of worms.
The reason why some grammar names couldn't be looked up is that there is indeed a difference between the kind of a node (the user-facing string that determines the node type) and its grammar name which is the internal naming of the rule that generated it. In most cases, those names are the same, but in general they aren't (for instance when using aliases in the grammar definition).
For some reason, I chose to use the "grammar name" when building
AstNode
s, but it was a bad idea since those names are not the ones that grammar authors intend to expose to grammar users. For instance, this creates an inconsistency with the tree-sitter queries we use, since they rely on kinds, not grammar names.So, the first steps of this PR consist in migrating to use kinds instead of grammar names. It's a rather annoying change to do, since we refer to grammar names in a lot of places. I have tried to fix the language profiles accordingly, but it's not an easy change to make, and it can well be that I forgot some updates.
The second step of this PR consists in introducing the check I wanted to do in the first place, validating that the kinds we use are indeed valid.