]> git.eshelyaron.com Git - emacs.git/commitdiff
(c-parse-state): Fixed bug that could cause errors when the state
authorMartin Stjernholm <mast@lysator.liu.se>
Wed, 24 Sep 2003 13:55:23 +0000 (13:55 +0000)
committerMartin Stjernholm <mast@lysator.liu.se>
Wed, 24 Sep 2003 13:55:23 +0000 (13:55 +0000)
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.

lisp/progmodes/cc-engine.el

index 0abb5121d5bea600651dab1c5920829328f828e3..51e58c76ba127b87c427e535508fe315f6e5a6db 100644 (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