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

Adjust string rules to flatten parser tree to one node per string lit… #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nordlow
Copy link
Contributor

@nordlow nordlow commented Oct 1, 2024

…eral instance and enforce suffix _literal for all string literal rules.

This makes D's grammar harmonize more with tree-sitter-c and tree-sitter-cpp.

Will regenerate parser if and when this gets approved.

It might be more suitable to just name regular_string_literal for string_literal as these exist in tree-sitter-c and tree-sitter-cpp.

Note that _any_string_literal corresponds to tree-sitter-cpp's _string.

@nordlow nordlow force-pushed the flat-string-parse-tree branch 2 times, most recently from 4f27249 to 5d5016b Compare October 1, 2024 14:44
…eral instance and enforce suffix _literal for all string literal rules
@nordlow nordlow force-pushed the flat-string-parse-tree branch from 5d5016b to 33fea5f Compare October 1, 2024 14:47
@gdamore
Copy link
Owner

gdamore commented Nov 21, 2024

So I'm not sure about the motivation for matching other tree-sitter grammars. D's grammar for strings is quite a lot more complex than either C or C++. Conversely, these rules are now coded into quite a number of queries across a swathe of editors, so changing this will break things for them.

I'm not saying I won't do it, but I'm not convinced the benefit here is worth it.

The fact that these are all classes of string_literal actually helps some of the queries for simpler editors, because you don't have to know all the varieties of string literal to get a reasonable highlighting.

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.

2 participants