Add only operator query operator

This commit is contained in:
Max Brunsfeld 2018-10-29 15:46:58 -07:00
parent 5318a21441
commit b0d6e676cb
4 changed files with 1417 additions and 1244 deletions

View File

@ -69,6 +69,7 @@ Media statements
@media screen and (min-width: 30em) and (orientation: landscape) {}
@media (min-height: 680px), screen and (orientation: portrait) {}
@media not all and (monochrome) {}
@media only screen {}
---
@ -85,8 +86,9 @@ Media statements
(binary_query (keyword_query) (feature_query (feature_name) (plain_value)))
(block))
(media_statement
(binary_query (negated_query (keyword_query)) (parenthesized_query (keyword_query)))
(block)))
(binary_query (unary_query (keyword_query)) (parenthesized_query (keyword_query)))
(block))
(media_statement (unary_query (keyword_query)) (block)))
==============================
Supports statements
@ -113,12 +115,12 @@ Supports statements
(feature_query (feature_name) (plain_value)))
(block))
(supports_statement
(negated_query (parenthesized_query (binary_query
(unary_query (parenthesized_query (binary_query
(feature_query (feature_name) (plain_value))
(feature_query (feature_name) (plain_value)))))
(block))
(supports_statement
(negated_query (selector_query (pseudo_class_selector
(unary_query (selector_query (pseudo_class_selector
(class_name)
(arguments (tag_name) (tag_name)))))
(block)))

View File

@ -214,7 +214,7 @@ module.exports = grammar({
alias($.identifier, $.keyword_query),
$.feature_query,
$.binary_query,
$.negated_query,
$.unary_query,
$.selector_query,
$.parenthesized_query
),
@ -239,8 +239,8 @@ module.exports = grammar({
$._query
)),
negated_query: $ => prec(1, seq(
'not',
unary_query: $ => prec(1, seq(
choice('not', 'only'),
$._query
)),

13
src/grammar.json vendored
View File

@ -1031,7 +1031,7 @@
},
{
"type": "SYMBOL",
"name": "negated_query"
"name": "unary_query"
},
{
"type": "SYMBOL",
@ -1120,16 +1120,25 @@
]
}
},
"negated_query": {
"unary_query": {
"type": "PREC",
"value": 1,
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "not"
},
{
"type": "STRING",
"value": "only"
}
]
},
{
"type": "SYMBOL",
"name": "_query"

2628
src/parser.c vendored

File diff suppressed because it is too large Load Diff