From e2a44c96500e5d8cce0cd191ff86a7c874314a37 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 29 Oct 2018 15:35:40 -0700 Subject: [PATCH] Fix conflict between plain values and numbers --- corpus/declarations.txt | 4 ++++ grammar.js | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/corpus/declarations.txt b/corpus/declarations.txt index 79e6d73..d32d0e3 100644 --- a/corpus/declarations.txt +++ b/corpus/declarations.txt @@ -85,6 +85,8 @@ a { b: 0.5%; c: 5em; margin: 10E3px; + margin: -456.8px; + margin: -0.0px; } --- @@ -93,6 +95,8 @@ a { (rule_set (selectors (tag_name)) (block (declaration (property_name) (float_value (unit))) (declaration (property_name) (integer_value (unit))) + (declaration (property_name) (float_value (unit))) + (declaration (property_name) (float_value (unit))) (declaration (property_name) (float_value (unit)))))) ============================ diff --git a/grammar.js b/grammar.js index d88c1bc..347801f 100644 --- a/grammar.js +++ b/grammar.js @@ -313,15 +313,15 @@ module.exports = grammar({ identifier: $ => /[a-zA-Z-_][a-zA-Z0-9-_]*/, - plain_value: $ => /[a-zA-Z-_][^;()\[\]\s]*/, - at_keyword: $ => /@[a-zA-Z-_]+/, comment: $ => token(seq( '/*', /[^*]*\*+([^/*][^*]*\*+)*/, '/' - )) + )), + + plain_value: $ => /[-_]*[a-zA-Z][^;()\[\]\s]*/ } })