Function: c-font-lock-complex-decl-prepare

c-font-lock-complex-decl-prepare is a byte-compiled function defined in cc-fonts.el.gz.

Signature

(c-font-lock-complex-decl-prepare LIMIT)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-fonts.el.gz
(defun c-font-lock-complex-decl-prepare (limit)
  ;; 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".
  ;;
  ;; Called before any of the matchers in `c-complex-decl-matchers'.
  ;;
  ;; This function does hidden buffer changes.

  ;;(message "c-font-lock-complex-decl-prepare %s %s" (point) limit)
  (c-skip-comments-and-strings limit)
  (when (< (point) limit)

    ;; Clear the c-type char properties which mark the region, to recalculate
    ;; them properly.  The most interesting properties are those put on the
    ;; closest token before the region.
    (save-excursion
      (let ((pos (point)))
	(c-backward-syntactic-ws (max (- (point) 500) (point-min)))
	(when (and (not (bobp))
		   (memq (c-get-char-property (1- (point)) 'c-type)
			 '(c-decl-arg-start
			   c-decl-end
			   c-decl-id-start
			   c-decl-type-start
			   c-not-decl)))
	  (setq pos (1- (point))))
	(c-clear-char-properties pos limit 'c-type)
	(c-clear-char-properties pos limit 'c-<>-c-types-set)))

    ;; Update `c-state-cache' to the beginning of the region.  This will
    ;; make `c-beginning-of-syntax' go faster when it's used later on,
    ;; and it's near the point most of the time.
    (c-parse-state)

    ;; Check if the fontified region starts inside a declarator list so
    ;; that `c-font-lock-declarators' should be called at the start.
    ;; The declared identifiers are font-locked correctly as types, if
    ;; that is what they are.
    (let ((prop (save-excursion
		  (c-backward-syntactic-ws (max (- (point) 500) (point-min)))
		  (unless (bobp)
		    (c-get-char-property (1- (point)) 'c-type)))))
      (when (memq prop '(c-decl-id-start c-decl-type-start))
	(c-forward-syntactic-ws limit)
	(c-font-lock-declarators limit t (eq prop 'c-decl-type-start)
				 (not (c-bs-at-toplevel-p (point))))))

    (setq c-font-lock-context ;; (c-guess-font-lock-context)
	  (save-excursion
	    (if (and c-cpp-expr-intro-re
		     (c-beginning-of-macro)
		     (looking-at c-cpp-expr-intro-re))
		'in-cpp-expr)))
    nil))