-
Notifications
You must be signed in to change notification settings - Fork 36
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
bug: Some selectors in :has
are treated as plain values
#45
Comments
So I think I understand the problem:
So this is a lexical precedence issue. I can think of a few solutions:
But the simplest thing I can think of — use I could demote plain_value: _ => token(prec(-1, seq(
repeat(choice(
/[-_]/,
/\/[^\*\s,;!{}()\[\]]/, // Slash not followed by a '*' (which would be a comment)
)),
/[a-zA-Z]/,
repeat(choice(
/[^/\s,;!{}()\[\]]/, // Not a slash, not a delimiter character
/\/[^\*\s,;!{}()\[\]]/, // Slash not followed by a '*' (which would be a comment)
)),
))), …but breaks three other tests. I'd much rather boost the precedence of I think I'm pretty close on this one and just need a nudge to find the right answer. |
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version
)No response
Describe the bug
Only certain kinds of selectors fail to be parsed within a
:has
—class_selector
andid_selector
when they have tag names.Steps To Reproduce/Bad Parse Tree
This parses correctly:
This does not:
Here are some other examples that parse exactly as expected:
And here are some which are interpreted as
plain_value
:Expected Behavior/Parse Tree
In each of these cases, the
plain_value
should instead be aselectors
node.:has
can accept selectors of arbitrary complexity, much like:not
.Repro
No response
The text was updated successfully, but these errors were encountered: