emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d3090a3: CC Mode: Fix an enum intro being parsed as


From: Alan Mackenzie
Subject: [Emacs-diffs] master d3090a3: CC Mode: Fix an enum intro being parsed as defun-block-intro
Date: Fri, 2 Feb 2018 15:58:00 -0500 (EST)

branch: master
commit d3090a3a3e22c4b0f4e0e833942f5942eb392c51
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    CC Mode: Fix an enum intro being parsed as defun-block-intro
    
    * lisp/progmodes/cc-engine.el (c-inside-bracelist-p): Return a bufpos rather
    than t for the enum case.
    (c-add-stmt-syntax, c-guess-continued-construct): Replace
    c-looking-at-or-maybe-in-bracelist by c-inside-bracelist-p, since the former
    does not recognize enum brace lists, but the latter does.
    
    * lisp/progmodes/cc-fonts.el (c-get-fontification-context): Replace
    c-looking-at-or-maybe-in-bracelist by c-inside-bracelist-p.
---
 lisp/progmodes/cc-engine.el | 14 ++++++--------
 lisp/progmodes/cc-fonts.el  |  7 +++----
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index ceeee6b..be7e86b 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -10665,7 +10665,8 @@ comment at the start of cc-engine.el for more info."
    ;; This will pick up brace list declarations.
    (save-excursion
      (goto-char containing-sexp)
-     (c-backward-over-enum-header))
+     (and (c-backward-over-enum-header)
+         (point)))
    ;; this will pick up array/aggregate init lists, even if they are nested.
    (save-excursion
      (let ((bufpos t)
@@ -11290,9 +11291,7 @@ comment at the start of cc-engine.el for more info."
                     (cdr (assoc (match-string 1)
                                 c-other-decl-block-key-in-symbols-alist))
                     (max (c-point 'boi paren-pos) (point))))
-                  ((save-excursion
-                     (goto-char paren-pos)
-                     (c-looking-at-or-maybe-in-bracelist containing-sexp))
+                  ((c-inside-bracelist-p paren-pos paren-state nil)
                    (if (save-excursion
                          (goto-char paren-pos)
                          (c-looking-at-statement-block))
@@ -11384,10 +11383,9 @@ comment at the start of cc-engine.el for more info."
 
        ;; CASE B.2: brace-list-open
        ((or (consp special-brace-list)
-           (consp
-            (c-looking-at-or-maybe-in-bracelist
-             containing-sexp beg-of-same-or-containing-stmt))
-           )
+           (c-inside-bracelist-p (point)
+                                 (cons containing-sexp paren-state)
+                                 nil))
        ;; The most semantically accurate symbol here is
        ;; brace-list-open, but we normally report it simply as a
        ;; statement-cont.  The reason is that one normally adjusts
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index fa9b8f3..7cac55e 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1234,10 +1234,9 @@ casts and declarations are fontified.  Used on level 2 
and higher."
           (cons 'decl nil))
          ;; We're inside a brace list.
          ((and (eq (char-before match-pos) ?{)
-               (save-excursion
-                 (goto-char (1- match-pos))
-                 (consp
-                  (c-looking-at-or-maybe-in-bracelist))))
+               (c-inside-bracelist-p (1- match-pos)
+                                     (cdr (c-parse-state))
+                                     nil))
           (c-put-char-property (1- match-pos) 'c-type
                                'c-not-decl)
           (cons 'not-decl nil))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]