Function: c-forward-over-token

c-forward-over-token is a byte-compiled function defined in cc-engine.el.gz.

Signature

(c-forward-over-token &optional BALANCED LIMIT)

Documentation

Move forward over a token.

Return t if we moved, nil otherwise (i.e. we were at EOB, or a non-token or BALANCED is non-nil and we can't move). If we are at syntactic whitespace, move over this in place of a token.

If BALANCED is non-nil move over any balanced parens we are at, and never move out of an enclosing paren. LIMIT is the limit to where we might move to.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defun c-forward-over-token (&optional balanced limit)
  "Move forward over a token.
Return t if we moved, nil otherwise (i.e. we were at EOB, or a
non-token or BALANCED is non-nil and we can't move).  If we
are at syntactic whitespace, move over this in place of a token.

If BALANCED is non-nil move over any balanced parens we are at, and never move
out of an enclosing paren.  LIMIT is the limit to where we might move to."
  (let ((jump-syntax (if balanced
			 c-jump-syntax-balanced
		       c-jump-syntax-unbalanced))
	(here (point))
	(limit (or limit (point-max))))
    (condition-case nil
	(cond
	 ((/= (point)
	      (progn (c-forward-syntactic-ws limit) (point)))
	  ;; If we're at whitespace, count this as the token.
	  t)
	 ((eobp) nil)
	 ((looking-at jump-syntax)
	  (goto-char (min limit (scan-sexps (point) 1)))
	  t)
	 ((looking-at c-nonsymbol-token-regexp)
	  (goto-char (min (match-end 0) limit))
	  t)
	 ((save-restriction
	    (widen)
	    (looking-at c-nonsymbol-token-regexp))
	  nil)
	 (t
	  (forward-char)
	  t))
      (error (goto-char here)
	     nil))))