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

Tree-sitter: Extract non-whitespace tokens between sibling nodes #16433

Closed
wants to merge 2 commits into from

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented May 6, 2024

This change to the C# tree-sitter grammar means that for non-escaped character literals, such as 'c', we would not extract the character content c. This PR tries to solve the underlying issue in general, by always extracting "extra" non-whitespace tokens that sit in between two other nodes. I have verified that with this change, we are able to extract character literals correctly.

A similar situation happens for the JSON Tree-sitter grammar.

@hvitved hvitved force-pushed the tree-sitter/extra-tokens branch from 794a632 to dc5fb30 Compare May 6, 2024 11:00
@github-actions github-actions bot removed the QL-for-QL label May 6, 2024
@hvitved hvitved changed the title Tree-sitter: Write non-whitespace tokens between sibling nodes Tree-sitter: Extract non-whitespace tokens between sibling nodes May 6, 2024
@hvitved hvitved added no-change-note-required This PR does not need a change note Ruby labels May 6, 2024
@hvitved hvitved marked this pull request as ready for review May 6, 2024 12:14
@aibaars
Copy link
Contributor

aibaars commented May 6, 2024

I think this is not the right fix. The problem is that the tree-sitter grammar declares the contents of a character literal to be uninteresting. Better fix the grammar instead of working around this in the extractor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Ruby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants