emacs-diffs
[Top][All Lists]
Advanced

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

master eb34c10 3/3: Merge from origin/emacs-27


From: Glenn Morris
Subject: master eb34c10 3/3: Merge from origin/emacs-27
Date: Sun, 23 Feb 2020 10:55:32 -0500 (EST)

branch: master
commit eb34c108e234c3195ae75f14ec6c5b0964f022ad
Merge: 4332964 ba7004b
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    Merge from origin/emacs-27
    
    ba7004b2a7 (origin/emacs-27) Shorten some ppss struct field names
    693749c60f Java Mode: Fix fontification of variable decl inside `for'
    884b68ca2c CC Mode: Fontify foo in "const auto foo :" correctly
    
    # Conflicts:
    #   etc/NEWS
---
 etc/NEWS.27                 |  8 ++++++++
 lisp/emacs-lisp/syntax.el   | 26 +++++++++++++-------------
 lisp/progmodes/cc-engine.el | 30 +++++++++++++++++++++++++-----
 3 files changed, 46 insertions(+), 18 deletions(-)

diff --git a/etc/NEWS.27 b/etc/NEWS.27
index 380ac71..e9dfd26 100644
--- a/etc/NEWS.27
+++ b/etc/NEWS.27
@@ -3352,6 +3352,14 @@ backslash, although there is no harm in doing so to make 
the code
 easier to edit with an older Emacs version.
 
 ---
+** New symbolic accessor functions for a parse state list.
+The new accessor functions 'ppss-depth', 'ppss-list-start',
+'ppss-last-sexp-start', 'ppss-string-terminator', 'comment-depth',
+'quoted-p', 'comment-style', 'comment-or-string-start', 'open-parens',
+and 'two-character-syntax' can be used on the list value returned by
+'parse-partial-sexp' and 'syntax-ppss'.
+
+---
 ** The 'server-name' and 'server-socket-dir' variables are set when a
 socket has been passed to Emacs.
 
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index 6b464bc..11cc198 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -89,33 +89,33 @@ Put first the functions more likely to cause a change and 
cheaper to compute.")
                (:constructor make-ppss)
                (:copier nil)
                (:type list))
-  (depth nil :documentation "depth in parens")
+  (depth nil :documentation "Depth in parens.")
   (innermost-start
    nil :documentation
-   "character address of start of innermost containing list; nil if none.")
+   "Character address of start of innermost containing list; nil if none.")
   (last-complete-sexp-start
    nil :documentation
-   "character address of start of last complete sexp terminated.")
+   "Character address of start of last complete sexp terminated.")
   (string-terminator nil :documentation "\
-non-nil if inside a string.
-(it is the character that will terminate the string, or t if the
+Non-nil if inside a string.
+\(it is the character that will terminate the string, or t if the
 string should be terminated by a generic string delimiter.)")
-  (comment-nesting nil :documentation "\
+  (comment-depth nil :documentation "\
 nil if outside a comment, t if inside a non-nestable comment,
 else an integer (the current comment nesting).")
-  (after-quote-p nil :documentation "t if following a quote character.")
-  (minimum-paren-depth
-   nil :documentation "the minimum paren-depth encountered during this scan.")
-  (comment-style nil :documentation "style of comment, if any.")
+  (quoted-p nil :documentation "t if following a quote character.")
+  (min-depth
+   nil :documentation "The minimum depth in parens encountered during this 
scan.")
+  (comment-style nil :documentation "Style of comment, if any.")
   (comment-or-string-start
    nil :documentation
-   "character address of start of comment or string; nil if not in one.")
-  (open-paren-positions
+   "Character address of start of comment or string; nil if not in one.")
+  (open-parens
    nil :documentation
    "List of positions of currently open parens, outermost first.")
   (two-character-syntax nil :documentation "\
 When the last position scanned holds the first character of a
-(potential) two character construct, the syntax of that position,
+\(potential) two character construct, the syntax of that position,
 otherwise nil.  That construct can be a two character comment
 delimiter or an Escaped or Char-quoted character."))
 
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 0c338fa..bccef68 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -9034,7 +9034,7 @@ point unchanged and return nil."
                           (if (looking-at c-:-op-cont-regexp)
                               (progn (goto-char (match-end 0)) t)
                             (not
-                             (and (c-major-mode-is 'c++-mode)
+                             (and (c-major-mode-is '(c++-mode java-mode))
                                   (save-excursion
                                     (and
                                      (c-go-up-list-backward)
@@ -9275,9 +9275,10 @@ This function might do hidden buffer changes."
   ;;
   ;;   The third element of the return value is non-nil when the declaration
   ;;   parsed might be an expression.  The fourth element is the position of
-  ;;   the start of the type identifier.  The fifth element is t if either
-  ;;   CONTEXT was 'top, or the declaration is detected to be treated as top
-  ;;   level (e.g. with the keyword "extern").
+  ;;   the start of the type identifier, or the same as the first element when
+  ;;   there is no type identifier.  The fifth element is t if either CONTEXT
+  ;;   was 'top, or the declaration is detected to be treated as top level
+  ;;   (e.g. with the keyword "extern").
   ;;
   ;; If a cast is parsed:
   ;;
@@ -9680,7 +9681,26 @@ This function might do hidden buffer changes."
               (setq got-identifier (c-forward-name))
               (setq name-start pos))
          (when (looking-at "[0-9]")
-           (setq got-number t))) ; We've probably got an arithmetic expression.
+           (setq got-number t)) ; We probably have an arithmetic expression.
+         (and maybe-typeless
+              (or (eq at-type 'maybe)
+                  (when (eq at-type 'found)
+                    ;; Remove the ostensible type from the found types list.
+                    (when type-start
+                      (c-unfind-type
+                       (buffer-substring-no-properties
+                        type-start
+                        (save-excursion
+                          (goto-char type-start)
+                          (c-end-of-token)
+                          (point)))))
+                    t))
+              ;; The token which we assumed to be a type is actually the
+              ;; identifier, and we have no explicit type.
+              (setq at-type nil
+                    name-start type-start
+                    id-start type-start
+                    got-identifier t)))
 
       ;; Skip over type decl suffix operators and trailing noise macros.
       (while



reply via email to

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