Function: c-font-lock-cut-off-declarators

c-font-lock-cut-off-declarators is a byte-compiled function defined in cc-fonts.el.gz.

Signature

(c-font-lock-cut-off-declarators LIMIT)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-fonts.el.gz
(defun c-font-lock-cut-off-declarators (limit)
  ;; Fontify any declarators "cut off" from their declaring type at the start
  ;; of the region being fontified.
  ;;
  ;; 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 ((here (point))
	  (decl-search-lim (c-determine-limit 1000))
	  paren-state encl-pos token-end context decl-or-cast
	  start-pos top-level c-restricted-<>-arglists
	  c-recognize-knr-p)		; Strictly speaking, bogus, but it
					; speeds up lisp.h tremendously.
      (save-excursion
	(when (not (c-back-over-member-initializers decl-search-lim))
	  (setq paren-state (c-parse-state))
	  (unless (or (eobp)
		      (looking-at "\\s(\\|\\s)"))
	    (forward-char))
	  (c-syntactic-skip-backward "^;{}" decl-search-lim t)
	  ;; Do we have the brace block of a struct, etc.?
	  (when (cond
		 ((and (consp (car paren-state))
		       (eq (char-before) ?}))
		  (goto-char (caar paren-state))
		  t)
		 ((and (numberp (car paren-state))
		       (eq (char-after (car paren-state)) ?{))
		  (goto-char (car paren-state))
		  t))
	    (c-syntactic-skip-backward "^;{}" decl-search-lim t))
	  (when (or (bobp)
		    (memq (char-before) '(?\; ?{ ?})))
	    (setq token-end (point))
	    (c-forward-syntactic-ws here)
	    (when (< (point) here)
	      ;; We're now putatively at the declaration.
	      (setq start-pos (point))
	      (setq paren-state (c-parse-state))
	      ;; At top level or inside a "{"?
	      (if (or (not (setq encl-pos
				 (c-most-enclosing-brace paren-state)))
		      (eq (char-after encl-pos) ?\{))
		  (progn
		    (setq top-level (c-at-toplevel-p))
		    (let ((got-context (c-get-fontification-context
					token-end nil top-level)))
		      (setq context (car got-context)
			    c-restricted-<>-arglists (cdr got-context)))
		    (setq decl-or-cast
			  (c-forward-decl-or-cast-1 token-end context nil))
		    (when (consp decl-or-cast)
		      (goto-char start-pos)
		      (c-font-lock-single-decl limit decl-or-cast token-end
					       context top-level))))))))
      nil)))