Add selectors as arguments to :not
This commit is contained in:
parent
c8a95409ae
commit
034eda815e
|
@ -179,3 +179,26 @@ a.b ~ c.d {}
|
|||
(class_selector (class_selector (class_name)) (class_name))
|
||||
(class_selector (class_selector (class_name)) (class_name))))
|
||||
(block)))
|
||||
|
||||
===========================
|
||||
The :not selector
|
||||
===========================
|
||||
|
||||
a:not(:hover) {}
|
||||
.b:not(c > .d) {}
|
||||
|
||||
---
|
||||
|
||||
(stylesheet
|
||||
(rule_set
|
||||
(selectors (pseudo_class_selector
|
||||
(tag_name)
|
||||
(class_name)
|
||||
(arguments (pseudo_class_selector (class_name)))))
|
||||
(block))
|
||||
(rule_set
|
||||
(selectors (pseudo_class_selector
|
||||
(class_selector (class_name))
|
||||
(class_name)
|
||||
(arguments (child_selector (tag_name) (class_selector (class_name))))))
|
||||
(block)))
|
||||
|
|
12
grammar.js
12
grammar.js
|
@ -137,7 +137,7 @@ module.exports = grammar({
|
|||
optional($._selector),
|
||||
':',
|
||||
alias($.identifier, $.class_name),
|
||||
optional($.arguments)
|
||||
optional(alias($.pseudo_class_arguments, $.arguments))
|
||||
),
|
||||
|
||||
pseudo_element_selector: $ => seq(
|
||||
|
@ -171,6 +171,12 @@ module.exports = grammar({
|
|||
|
||||
adjacent_sibling_selector: $ => prec.left(seq($._selector, '+', $._selector)),
|
||||
|
||||
pseudo_class_arguments: $ => seq(
|
||||
token.immediate('('),
|
||||
commaSep(choice($._selector, repeat1($._value))),
|
||||
')'
|
||||
),
|
||||
|
||||
// Declarations
|
||||
|
||||
declaration: $ => prec(1, seq(
|
||||
|
@ -232,7 +238,7 @@ module.exports = grammar({
|
|||
|
||||
// Property Values
|
||||
|
||||
_value: $ => choice(
|
||||
_value: $ => prec(-1, choice(
|
||||
alias($.identifier, $.plain_value),
|
||||
$.plain_value,
|
||||
$.color_value,
|
||||
|
@ -241,7 +247,7 @@ module.exports = grammar({
|
|||
$.string_value,
|
||||
$.binary_expression,
|
||||
$.call_expression
|
||||
),
|
||||
)),
|
||||
|
||||
color_value: $ => /#[0-9a-fA-F]{3,8}/,
|
||||
|
||||
|
|
|
@ -548,8 +548,13 @@
|
|||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "arguments"
|
||||
"name": "pseudo_class_arguments"
|
||||
},
|
||||
"named": true,
|
||||
"value": "arguments"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
|
@ -782,6 +787,79 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"pseudo_class_arguments": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "IMMEDIATE_TOKEN",
|
||||
"content": {
|
||||
"type": "STRING",
|
||||
"value": "("
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_selector"
|
||||
},
|
||||
{
|
||||
"type": "REPEAT1",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_value"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": ","
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_selector"
|
||||
},
|
||||
{
|
||||
"type": "REPEAT1",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_value"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": ")"
|
||||
}
|
||||
]
|
||||
},
|
||||
"declaration": {
|
||||
"type": "PREC",
|
||||
"value": 1,
|
||||
|
@ -1002,6 +1080,9 @@
|
|||
]
|
||||
},
|
||||
"_value": {
|
||||
"type": "PREC",
|
||||
"value": -1,
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
|
@ -1042,6 +1123,7 @@
|
|||
"name": "call_expression"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"color_value": {
|
||||
"type": "PATTERN",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue