Function: vhdl-font-lock-init

vhdl-font-lock-init is a byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-font-lock-init)

Documentation

Initialize fontification.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Font lock initialization

(defun vhdl-font-lock-init ()
  "Initialize fontification."
  ;; highlight template prompts and directives
  (setq vhdl-font-lock-keywords-0
	(list (list (concat "\\(^\\|[ \t(.']\\)\\(<"
			    vhdl-template-prompt-syntax ">\\)")
		    2 'vhdl-font-lock-prompt-face t)
	      (list (concat "--\\s-*"
                            "\\<"
                            (regexp-opt vhdl-directive-keywords t)
                            "\\>"
			     "\\s-+\\(.*\\)$")
		    2 'vhdl-font-lock-directive-face t)
	      ;; highlight c-preprocessor directives
	      (list "^#[ \t]*\\(\\w+\\)\\([ \t]+\\(\\w+\\)\\)?"
		    '(1 font-lock-builtin-face)
		    '(3 font-lock-variable-name-face nil t))))
  ;; highlight keywords and standardized types, attributes, enumeration
  ;; values, and subprograms
  (setq vhdl-font-lock-keywords-1
	(list
	 (list (concat "'" vhdl-attributes-regexp)
	       1 'vhdl-font-lock-attribute-face)
	 (list vhdl-types-regexp       1 'font-lock-type-face)
	 (list vhdl-functions-regexp   1 'vhdl-font-lock-function-face)
	 (list vhdl-packages-regexp    1 'vhdl-font-lock-function-face)
	 (list vhdl-enum-values-regexp 1 'vhdl-font-lock-enumvalue-face)
	 (list vhdl-constants-regexp   1 'font-lock-constant-face)
	 (list vhdl-keywords-regexp    1 'font-lock-keyword-face)))
  ;; highlight words with special syntax.
  (setq vhdl-font-lock-keywords-3
	(let ((syntax-alist vhdl-special-syntax-alist)
	      keywords)
	  (while syntax-alist
	    (setq keywords
		  (cons
		   (list (concat "\\(" (nth 1 (car syntax-alist)) "\\)") 1
			 (vhdl-function-name
			  "vhdl-font-lock" (nth 0 (car syntax-alist)) "face")
			 (nth 4 (car syntax-alist)))
		   keywords))
	    (setq syntax-alist (cdr syntax-alist)))
	  keywords))
  ;; highlight additional reserved words
  (setq vhdl-font-lock-keywords-4
	(list (list vhdl-reserved-words-regexp 1
		    'vhdl-font-lock-reserved-words-face)))
  ;; highlight everything together
  (setq vhdl-font-lock-keywords
	(append
	 vhdl-font-lock-keywords-0
	 (when vhdl-highlight-keywords vhdl-font-lock-keywords-1)
	 (when (or vhdl-highlight-forbidden-words
		   vhdl-highlight-verilog-keywords) vhdl-font-lock-keywords-4)
	 (when vhdl-highlight-special-words vhdl-font-lock-keywords-3)
	 (when vhdl-highlight-names vhdl-font-lock-keywords-2)
	 (when vhdl-highlight-translate-off vhdl-font-lock-keywords-5))))