Skip to content

Commit e9288f6

Browse files
use named regexes in font-lock-keywords list
1 parent f9522fc commit e9288f6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

jade-mode.el

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
(defvar jade-class-re "[.][a-zA-Z][0-9a-zA-Z_\\-]*"
7373
"Regexp used to match a class literal, e.g. .class, .class_name-123")
7474

75+
(defvar jade-mixin-re "[+][a-zA-Z][0-9a-zA-Z_\\-]*"
76+
"Regexp used to match a mixin name")
77+
7578
(defvar jade-double-quote-string-re "[\"]\\(\\\\.\\|[^\"\n]\\)*[\"]"
7679
"Regexp used to match a double-quoted string literal")
7780

@@ -84,11 +87,11 @@
8487
(defvar jade-font-lock-keywords
8588
`(
8689
(,jade-keywords . font-lock-keyword-face) ;; keywords
87-
("#\\(\\w\\|_\\|-\\)*" . font-lock-variable-name-face) ;; id
88-
("\\(?:^[ {2,}]*\\(?:[a-z0-9_:\\-]*\\)\\)?\\(#[A-Za-z0-9\-\_]*[^ ]\\)" 1 font-lock-variable-name-face) ;; id
89-
("\\(?:^[ {2,}]*\\(?:[a-z0-9_:\\-]*\\)\\)?\\(\\.[A-Za-z0-9\-\_]*\\)" 1 font-lock-type-face) ;; class name
90-
("^[ \t]*\\([a-zA-Z0-9]+\\)" 1 font-lock-function-name-face) ;; tag name
91-
("^[ \t]*\\(-?//.*\\)" 1 font-lock-comment-face t) ;; jade block comments
90+
(,jade-id-re . font-lock-variable-name-face) ;; id
91+
(,jade-class-re . font-lock-type-face) ;; class name
92+
("\\(-?//.*\\)" . font-lock-comment-face) ;; jade block comments
93+
(,jade-tag-re . font-lock-function-name-face)
94+
;; tag name
9295

9396
;; remove highlighting from literal content following tag/class/id
9497
;; e.g. tag Inner text

0 commit comments

Comments
 (0)