(c-parse-state): Fixed bug that could cause errors when the state

cache contains info on parts that have been narrowed out.

(c-forward-keyword-clause): Fixed error handling.  This bug could
cause interactive font locking to bail out.

(c-just-after-func-arglist-p): Handle paren-style types in Pike.  Also
fixed some cases of insufficient handling of unbalanced parens.
This commit is contained in:
Martin Stjernholm
2003-09-24 13:55:23 +00:00
parent d858963e6b
commit 449a2b0d2e

View File

@@ -1740,10 +1740,10 @@ This function does not do any hidden buffer changes."
;; If point-min has moved forward then we just need to cut
;; off a bit of the tail.
(let ((ptr (cons nil c-state-cache)) elem)
(while (and (setq elem (cdr ptr))
(while (and (setq elem (car-safe (cdr ptr)))
(>= (if (consp elem) (car elem) elem)
(point-min)))
(setq ptr elem))
(setq ptr (cdr ptr)))
(when (consp ptr)
(if (eq (cdr ptr) c-state-cache)
(setq c-state-cache nil)
@@ -3499,8 +3499,8 @@ This function does not do any hidden buffer changes."
(setq safe-pos (point)))
((and (c-keyword-member kwd-sym 'c-nonsymbol-sexp-kwds)
(not (looking-at c-symbol-start)))
(c-forward-sexp)
(not (looking-at c-symbol-start))
(c-safe (c-forward-sexp) t))
(c-forward-syntactic-ws)
(setq safe-pos (point))))
@@ -4251,7 +4251,7 @@ brace."
(c-search-uplist-for-classkey paren-state))))
(defun c-just-after-func-arglist-p (&optional lim)
;; Return t if we are between a function's argument list closing
;; Return non-nil if we are between a function's argument list closing
;; paren and its opening brace. Note that the list close brace
;; could be followed by a "const" specifier or a member init hanging
;; colon. LIM is used as bound for some backward buffer searches;
@@ -4299,20 +4299,25 @@ brace."
(or (not (c-beginning-of-macro))
(and (c-forward-to-cpp-define-body)
(< (point) checkpoint)))
;; check if we are looking at an ObjC method def
(or (not c-opt-method-key)
(progn
(goto-char checkpoint)
(c-forward-sexp -1)
(forward-char -1)
(c-backward-syntactic-ws lim)
(not (or (memq (char-before) '(?- ?+))
;; or a class category
(progn
(c-forward-sexp -2)
(looking-at c-class-key))
)))))
)))
;; Check if we are looking at an ObjC method def or a class
;; category.
(not (and c-opt-method-key
(progn
(goto-char checkpoint)
(c-safe (c-backward-sexp) t))
(progn
(c-backward-syntactic-ws lim)
(or (memq (char-before) '(?- ?+))
(and (c-safe (c-forward-sexp -2) t)
(looking-at c-class-key))))))
;; Pike has compound types that include parens,
;; e.g. "array(string)". Check that we aren't after one.
(not (and (c-major-mode-is 'pike-mode)
(progn
(goto-char checkpoint)
(c-safe (c-backward-sexp 2) t))
(looking-at c-primitive-type-key)))
))))
(defun c-in-knr-argdecl (&optional lim)
;; Return the position of the first argument declaration if point is