css-mode: Don't confuse variable names with class names

This fixes highlighting for class names that contain --, for example:

.foo--bar {
    display: none;
}

* lisp/textmodes/css-mode.el (css--font-lock-keywords): Make regular
  expression stricter.
This commit is contained in:
Wilfred Hughes 2017-10-20 15:04:37 +01:00
parent f546c7fa75
commit 900ede244c

View file

@ -896,7 +896,7 @@ cannot be completed sensibly: `custom-ident',
;; No face.
nil)))
;; Variables.
(,(concat "--" css-ident-re) (0 font-lock-variable-name-face))
(,(concat (rx symbol-start) "--" css-ident-re) (0 font-lock-variable-name-face))
;; Properties. Again, we don't limit ourselves to css-property-ids.
(,(concat "\\(?:[{;]\\|^\\)[ \t]*\\("
"\\(?:\\(" css-proprietary-nmstart-re "\\)\\|"