-
-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Did you check existing issues?
- I have read all the tree-sitter docs if it relates to using the parser
- I have searched the existing issues of tree-sitter-css
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
tree-sitter 0.25.10 (da6fe9beb4f7f67beb75914ca8e0d48ae48d6406)
Describe the bug
Description
The CSS parser fails to correctly parse the typed attr() function when using angle brackets (<>) in the type notation, which is required by the CSS Values and Units Module Level 5 specification.
Minimal reproduction
.test {
--x: attr(foo type(<number>), 0);
}Expected behavior
The parser should successfully parse this syntax, as it conforms to the CSS Values and Units Module Level 5 spec.
According to the spec:
attr() = attr( <attr-name> <attr-type>? , <declaration-value>? )
<attr-type> = type( <syntax> )
Where <syntax> uses angle brackets to denote CSS type definitions like <number>, <length>, <color>, etc.
Actual behavior
The parser fails when encountering type(<number>) - specifically the angle brackets inside the type() function.
Additional context
Other valid examples that should parse:
Steps To Reproduce/Bad Parse Tree
(stylesheet [0, 0] - [3, 0]
(rule_set [0, 0] - [2, 1]
(selectors [0, 0] - [0, 4]
(class_selector [0, 0] - [0, 4]
(class_name [0, 1] - [0, 4]
(identifier [0, 1] - [0, 4]))))
(block [0, 5] - [2, 1]
(declaration [1, 2] - [1, 35]
(property_name [1, 2] - [1, 5])
(call_expression [1, 7] - [1, 34]
(function_name [1, 7] - [1, 11])
(arguments [1, 11] - [1, 34]
(plain_value [1, 12] - [1, 15])
(call_expression [1, 16] - [1, 30]
(function_name [1, 16] - [1, 20])
(arguments [1, 20] - [1, 30]
(ERROR [1, 21] - [1, 29]
(ERROR [1, 21] - [1, 28]))))
(integer_value [1, 32] - [1, 33])))))))
Expected Behavior/Parse Tree
Maybe plain_value instead of ERROR?
Repro
.foo {
--x: attr(foo type(<number>), 0);
}Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working