Allow more characters in unquoted property values

This commit is contained in:
Max Brunsfeld 2018-10-26 11:41:14 -07:00
parent a61bc61c74
commit b2c8e4a547
6 changed files with 1977 additions and 1663 deletions

View File

@ -95,3 +95,19 @@ a {
(block
(declaration (property_name) (string_value))
(declaration (property_name) (string_value)))))
============================
URLs
============================
a {
b: http://something-else?foo=bar;
}
---
(stylesheet
(rule_set
(selectors (tag_name))
(block
(declaration (property_name) (plain_value)))))

View File

@ -67,8 +67,8 @@ a[b] {}
(stylesheet
(rule_set (selectors (attribute_selector (attribute_name))) (block))
(rule_set (selectors (attribute_selector (attribute_name) (keyword_value))) (block))
(rule_set (selectors (attribute_selector (attribute_name) (keyword_value))) (block))
(rule_set (selectors (attribute_selector (attribute_name) (plain_value))) (block))
(rule_set (selectors (attribute_selector (attribute_name) (plain_value))) (block))
(rule_set (selectors (attribute_selector (tag_name) (attribute_name))) (block)))
=========================

View File

@ -33,11 +33,11 @@ Media statements
(binary_query
(keyword_query)
(feature_query (feature_name) (integer_value (unit))))
(feature_query (feature_name) (keyword_value)))
(feature_query (feature_name) (plain_value)))
(block))
(media_statement
(feature_query (feature_name) (integer_value (unit)))
(binary_query (keyword_query) (feature_query (feature_name) (keyword_value)))
(binary_query (keyword_query) (feature_query (feature_name) (plain_value)))
(block))
(media_statement
(binary_query (negated_query (keyword_query)) (parenthesized_query (keyword_query)))

View File

@ -180,7 +180,8 @@ module.exports = grammar({
// Property Values
_value: $ => choice(
alias($.identifier, $.keyword_value),
alias($.identifier, $.plain_value),
$.plain_value,
$.color_value,
$.integer_value,
$.float_value,
@ -238,6 +239,8 @@ module.exports = grammar({
identifier: $ => /[a-zA-Z-_][a-zA-Z0-9-_]*/,
plain_value: $ => /[a-zA-Z-_][^;()\[\]\s]*/,
at_keyword: $ => /@[a-zA-Z-_]+/,
comment: $ => token(choice(

10
src/grammar.json vendored
View File

@ -768,7 +768,11 @@
"name": "identifier"
},
"named": true,
"value": "keyword_value"
"value": "plain_value"
},
{
"type": "SYMBOL",
"name": "plain_value"
},
{
"type": "SYMBOL",
@ -1134,6 +1138,10 @@
"type": "PATTERN",
"value": "[a-zA-Z-_][a-zA-Z0-9-_]*"
},
"plain_value": {
"type": "PATTERN",
"value": "[a-zA-Z-_][^;()\\[\\]\\s]*"
},
"at_keyword": {
"type": "PATTERN",
"value": "@[a-zA-Z-_]+"

3601
src/parser.c vendored

File diff suppressed because it is too large Load Diff