Function: c-font-lock-enclosing-decls

c-font-lock-enclosing-decls is a byte-compiled function defined in cc-fonts.el.gz.

Signature

(c-font-lock-enclosing-decls LIMIT)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-fonts.el.gz
(defun c-font-lock-enclosing-decls (limit)
  ;; Fontify the declarators of (nested) declarations we're in the middle of.
  ;; This is mainly for when a jit-lock etc. chunk starts inside the brace
  ;; block of a struct/union/class, etc.
  ;;
  ;; This function will be called from font-lock for a region bounded by POINT
  ;; and LIMIT, as though it were to identify a keyword for
  ;; font-lock-keyword-face.  It always returns NIL to inhibit this and
  ;; prevent a repeat invocation.  See elisp/lispref page "Search-based
  ;; Fontification".
  (c-skip-comments-and-strings limit)
  (when (< (point) limit)
    (let* ((paren-state (c-parse-state))
	   (decl-search-lim (c-determine-limit 1000))
	   in-typedef ps-elt)
      ;; Are we in any nested struct/union/class/etc. braces?
      (while paren-state
	(setq ps-elt (car paren-state)
	      paren-state (cdr paren-state))
	(when (and (atom ps-elt)
		   (eq (char-after ps-elt) ?\{))
	  (goto-char ps-elt)
	  (c-syntactic-skip-backward "^;{}" decl-search-lim)
	  (c-forward-syntactic-ws)
	  (setq in-typedef (looking-at c-typedef-key))
	  (if in-typedef (c-forward-over-token-and-ws))
	  (when (and c-opt-block-decls-with-vars-key
		     (looking-at c-opt-block-decls-with-vars-key))
	    (goto-char ps-elt)
	    (when (c-safe (c-forward-sexp))
	      (c-forward-syntactic-ws)
	      (c-font-lock-declarators limit t in-typedef
				       (not (c-bs-at-toplevel-p (point)))))))))))