cmake-mode.el: Add font-lock for keywords and variables

Control flow keywords will now be highlighted as such.  Variable names
will be also be recognized.  Adjust function name highlighting to work
in places other than the start of a line.
This commit is contained in:
Roy Crihfield 2015-03-06 16:34:37 -05:00 committed by Brad King
parent 7987d9857e
commit 41d6044bcf
1 changed files with 11 additions and 3 deletions

View File

@ -193,9 +193,17 @@ the indentation. Otherwise it retains the same position on the line"
;; Keyword highlighting regex-to-face map. ;; Keyword highlighting regex-to-face map.
;; ;;
(defconst cmake-font-lock-keywords (defconst cmake-font-lock-keywords
(list '("^[ \t]*\\([[:word:]_]+\\)[ \t]*(" 1 font-lock-function-name-face)) `((,(rx-to-string `(and symbol-start
"Highlighting expressions for CMAKE mode." (or ,@cmake-keywords
) ,@(mapcar #'downcase cmake-keywords))
symbol-end))
. font-lock-keyword-face)
(,(rx symbol-start (group (+ (or word (syntax symbol)))) ?\()
1 font-lock-function-name-face)
("\\${?\\([[:alpha:]_][[:alnum:]_]*\\|[0-9]+\\|[$*_]\\)"
1 font-lock-variable-name-face t)
)
"Highlighting expressions for CMake mode.")
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------