Function: c-forward-keyword-prefixed-id

c-forward-keyword-prefixed-id is a macro defined in cc-engine.el.gz.

Signature

(c-forward-keyword-prefixed-id TYPE &optional STOP-AT-END)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defmacro c-forward-keyword-prefixed-id (type &optional stop-at-end)
  ;; Used internally in `c-forward-keyword-clause' to move forward
  ;; over a type (if TYPE is 'type) or a name (otherwise) which
  ;; possibly is prefixed by keywords and their associated clauses.
  ;; Point should be at the type/name or a preceding keyword at the start of
  ;; the macro, and it is left at the first token following the type/name,
  ;; or (when STOP-AT-END is non-nil) immediately after that type/name.
  ;;
  ;; Note that both parameters are evaluated at compile time, not run time,
  ;; so they must be constants.
  ;;
  ;; Try with a type/name first to not trip up on those that begin
  ;; with a keyword.  Return t if a known or found type is moved
  ;; over.  The point is clobbered if nil is returned.  If range
  ;; recording is enabled, the identifier is recorded on as a type
  ;; if TYPE is 'type or as a reference if TYPE is 'ref.
  ;;
  ;; This macro might do hidden buffer changes.
  (declare (debug t))
  `(let (res pos)
     (setq c-last-identifier-range nil)
     (while (if (setq res ,(if (eq type 'type)
			       `(c-forward-type nil ,stop-at-end)
			     `(c-forward-name ,stop-at-end)))
		(progn
		  (setq pos (point))
		  nil)
	      (and
	       (cond ((looking-at c-keywords-regexp)
		      (c-forward-keyword-clause 1 t))
		     ((and c-opt-cpp-prefix
			   (looking-at c-noise-macro-with-parens-name-re))
		      (c-forward-noise-clause t)))
	       (progn
		 (setq pos (point))
		 (c-forward-syntactic-ws)
		 t))))
     (when (memq res '(t known found prefix maybe))
       (when c-record-type-identifiers
	 ,(if (eq type 'type)
	      '(c-record-type-id c-last-identifier-range)
	    '(c-record-ref-id c-last-identifier-range)))
       (when pos
	 (goto-char pos)
	 ,(unless stop-at-end
	    `(c-forward-syntactic-ws)))
       t)))