summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/cc-engine.el13
-rw-r--r--lisp/progmodes/cc-langs.el2
-rw-r--r--lisp/progmodes/cc-mode.el5
3 files changed, 11 insertions, 9 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 086166c822b..9e09e5150d9 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -4951,30 +4951,31 @@ comment at the start of cc-engine.el for more info."
"\\w\\|\\s_\\|\\s\"\\|\\s|"
"\\w\\|\\s_\\|\\s\""))
-(defun c-forward-over-token (&optional balanced)
+(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."
+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)))
+ (here (point))
+ (limit (or limit (point-max))))
(condition-case nil
(cond
((/= (point)
- (progn (c-forward-syntactic-ws) (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 (scan-sexps (point) 1))
+ (goto-char (min limit (scan-sexps (point) 1)))
t)
((looking-at c-nonsymbol-token-regexp)
- (goto-char (match-end 0))
+ (goto-char (min (match-end 0) limit))
t)
((save-restriction
(widen)
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 47e05438ea3..581685cad70 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1188,7 +1188,7 @@ definition, or nil if the language doesn't have any."
t (if (c-lang-const c-opt-cpp-macro-define)
(concat (c-lang-const c-anchored-cpp-prefix)
(c-lang-const c-opt-cpp-macro-define)
- "[ \t]+\\(\\sw\\|_\\)+\\([^(a-zA-Z0-9_]\\|$\\)")))
+ "[ \t]+[a-zA-Z0-9_]+\\([^(a-zA-Z0-9_]\\|$\\)")))
(c-lang-defconst c-cpp-expr-directives
"List of cpp directives (without the prefix) that are followed by an
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 99067e47618..6a2c2f2911e 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -2482,7 +2482,8 @@ with // and /*, not more generic line and block comments."
(let* ((lim1 (save-excursion
(and (c-beginning-of-macro)
(progn (c-end-of-macro) (point)))))
- (decl-res (c-forward-declarator)))
+ (lim+ (c-determine-+ve-limit 200))
+ (decl-res (c-forward-declarator lim+)))
(if (or (cadr (cddr (cddr decl-res))) ; We scanned an arglist.
(and (eq (char-after) ?\() ; Move over a non arglist (...).
(prog1 (c-go-list-forward)
@@ -2499,7 +2500,7 @@ with // and /*, not more generic line and block comments."
(c-backward-syntactic-ws lim1)
(eq (char-before) ?\())
(c-fl-decl-end (1- (point))))
- (c-forward-over-token)
+ (c-forward-over-token nil lim+) ; The , or ) after the declarator.
(point))
(if (progn (c-forward-syntactic-ws)
(not (eobp)))