Function: c-forward-primary-expression

c-forward-primary-expression is a byte-compiled function defined in cc-engine.el.gz.

Signature

(c-forward-primary-expression &optional LIMIT STOP-AT-END)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
;; Handling of large scale constructs like statements and declarations.

(defun c-forward-primary-expression (&optional limit stop-at-end)
  ;; Go over the primary expression (if any) at point, and unless STOP-AT-END
  ;; is non-nil, move to the next token then return non-nil.  If we're not at
  ;; a primary expression leave point unchanged and return nil.
  ;;
  ;; Note that this function is incomplete, handling only those cases expected
  ;; to be common in a C++20 requires clause.
  (let ((here (point))
	(c-restricted-<>-arglists t)
	(c-parse-and-markup-<>-arglists nil)
	)
    (if	(cond
	 ((looking-at c-constant-key)
	  (goto-char (match-end 1))
	  (unless stop-at-end (c-forward-syntactic-ws limit))
	  t)
	 ((eq (char-after) ?\()
	  (and (c-go-list-forward (point) limit)
	       (eq (char-before) ?\))
	       (progn
		 (unless stop-at-end
		   (c-forward-syntactic-ws limit))
		 t)))
	 ((c-forward-over-compound-identifier)
	  (let ((after-id (point)))
	    (c-forward-syntactic-ws limit)
	    (while (cond
		    ((and
		      (looking-at "<")
		      (prog1
			  (and
			   (c-forward-<>-arglist nil)
			   (setq after-id (point)))))
		     (c-forward-syntactic-ws limit))
		    ((looking-at c-opt-identifier-concat-key)
		     (and
		      (zerop (c-forward-token-2 1 nil limit))
		      (prog1
			  (c-forward-over-compound-identifier)
			(c-forward-syntactic-ws limit))))))
	    (goto-char after-id)))
	 ((looking-at c-fun-name-substitute-key) ; "requires"
	  (goto-char (match-end 1))
	  (c-forward-syntactic-ws limit)
	  (and
	   (or (not (eq (char-after) ?\())
	       (prog1
		   (and (c-go-list-forward (point) limit)
			(eq (char-before) ?\)))
		 (c-forward-syntactic-ws)))
	   (eq (char-after) ?{)
	   (and (c-go-list-forward (point) limit)
		(eq (char-before) ?}))
	   (progn
	     (unless stop-at-end (c-forward-syntactic-ws limit))
	     t))))
	t
      (goto-char here)
      nil)))