diff --git a/src/parse/value/parse.rs b/src/parse/value/parse.rs index 67f808f..4e96042 100644 --- a/src/parse/value/parse.rs +++ b/src/parse/value/parse.rs @@ -850,6 +850,13 @@ impl<'a> Parser<'a> { IntermediateValue::Op(Op::Plus).span(span) } '-' => { + if matches!(self.toks.peek(), Some(Token { kind: '#', .. })) + && matches!(self.toks.peek_next(), Some(Token { kind: '{', .. })) + { + self.toks.reset_cursor(); + return Some(self.parse_ident_value(predicate)); + } + self.toks.reset_cursor(); let span = self.toks.next().unwrap().pos(); IntermediateValue::Op(Op::Minus).span(span) } diff --git a/tests/subtraction.rs b/tests/subtraction.rs index 3e7ce15..f883fe8 100644 --- a/tests/subtraction.rs +++ b/tests/subtraction.rs @@ -192,7 +192,6 @@ test!( "a {\n color: 0;\n}\n" ); test!( - #[ignore] sub_no_space_interpolation, "a {\n color: 10-#{10};\n}\n", "a {\n color: 10 -10;\n}\n" @@ -287,6 +286,10 @@ error!( number_minus_color, "a {\n color: 1 - #abc;\n}\n", "Error: Undefined operation \"1 - #abc\"." ); +error!( + number_minus_hex_color_no_space, + "a {\n color: 1-#abc;\n}\n", "Error: Undefined operation \"1 - #abc\"." +); error!( null_minus_function, "a {\n color: null - get-function(lighten);\n}\n",