Fix over-eager parsing of plain values

This commit is contained in:
Max Brunsfeld 2018-10-29 15:45:05 -07:00
parent 3c2035e98e
commit 5318a21441
5 changed files with 684 additions and 622 deletions

View File

@ -202,3 +202,30 @@ a {
(block (block
(declaration (property_name) (plain_value)) (declaration (property_name) (plain_value))
(declaration (property_name) (plain_value))))) (declaration (property_name) (plain_value)))))
=======================================
Comments right after numbers
=======================================
a {
shape-outside: circle(20em/*=*/at 50% 50%);
shape-outside: inset(1em, 1em, 1em, 1em);
}
---
(stylesheet
(rule_set
(selectors (tag_name))
(block
(declaration (property_name) (call_expression (function_name) (arguments
(integer_value (unit))
(comment)
(plain_value)
(integer_value (unit))
(integer_value (unit)))))
(declaration (property_name) (call_expression (function_name) (arguments
(integer_value (unit))
(integer_value (unit))
(integer_value (unit))
(integer_value (unit))))))))

View File

@ -120,7 +120,7 @@ Supports statements
(supports_statement (supports_statement
(negated_query (selector_query (pseudo_class_selector (negated_query (selector_query (pseudo_class_selector
(class_name) (class_name)
(arguments (plain_value) (plain_value))))) (arguments (tag_name) (tag_name)))))
(block))) (block)))
============================== ==============================

View File

@ -328,7 +328,7 @@ module.exports = grammar({
'/' '/'
)), )),
plain_value: $ => /[-_]*[a-zA-Z][^;()\[\]\s]*/ plain_value: $ => /[-_]*[a-zA-Z]([^/,;()\[\]\s]|\/[^\*])*/
} }
}) })

2
src/grammar.json vendored
View File

@ -1607,7 +1607,7 @@
}, },
"plain_value": { "plain_value": {
"type": "PATTERN", "type": "PATTERN",
"value": "[-_]*[a-zA-Z][^;()\\[\\]\\s]*" "value": "[-_]*[a-zA-Z]([^\\/,;()\\[\\]\\s]|\\/[^\\*])*"
} }
}, },
"extras": [ "extras": [

1273
src/parser.c vendored

File diff suppressed because it is too large Load Diff