emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/d-mode 8e77187 293/346: Fix fontification of return statem


From: ELPA Syncer
Subject: [nongnu] elpa/d-mode 8e77187 293/346: Fix fontification of return statements
Date: Sun, 29 Aug 2021 11:00:48 -0400 (EDT)

branch: elpa/d-mode
commit 8e771871127d9cdb4b52cd4487741eab59ed39d0
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>

    Fix fontification of return statements
---
 d-mode.el          | 13 +++++++++----
 tests/fonts.d      |  5 +++++
 tests/fonts.d.html |  5 +++++
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/d-mode.el b/d-mode.el
index f20ff4f..52a8e10 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -7,7 +7,7 @@
 ;; Maintainer:  Russel Winder <russel@winder.org.uk>
 ;;              Vladimir Panteleev <vladimir@thecybershadow.net>
 ;; Created:  March 2007
-;; Version:  201911111451
+;; Version:  201911111459
 ;; Keywords:  D programming language emacs cc-mode
 ;; Package-Requires: ((emacs "25.1"))
 
@@ -476,7 +476,7 @@ operators."
   (let (maybe-auto enum decl-start type-start id-start make-top)
 
     (let (kind)
-      (while (setq kind (d-forward-attribute-or-storage-class))
+      (while (setq kind (d-forward-attribute-or-storage-class context))
        (setq maybe-auto t
              enum (eq kind 'enum))
        ;; Skip over "public:" and similar specifiers.
@@ -663,11 +663,13 @@ operators."
     t))
 
 
-(defun d-forward-attribute-or-storage-class ()
+(defun d-forward-attribute-or-storage-class (context)
   "Handle D attributes and storage classes in declarations.
 
 Advance point and return non-nil if looking at something that may prefix a
-declaration (or follow the argument list, in case of functions)."
+declaration (or follow the argument list, in case of functions).
+
+CONTEXT is as in `c-forward-decl-or-cast-1'."
   ;; Note that this includes UDAs.
   (let ((start (point))
        (kind t)
@@ -680,6 +682,9 @@ declaration (or follow the argument list, in case of 
functions)."
         ((looking-at (d-make-keywords-re t '("scope")))
          (setq match-index 1
                kind 'scope))
+        ((and (eq context nil)
+              (looking-at (d-make-keywords-re t '("return"))))
+         nil)
         ((looking-at (d-make-keywords-re t (c-lang-const d-type-modifier-kwds 
d)))
          (setq match-index 1
                kind 'type-modifier))
diff --git a/tests/fonts.d b/tests/fonts.d
index 4ffec8f..ea6961a 100644
--- a/tests/fonts.d
+++ b/tests/fonts.d
@@ -38,3 +38,8 @@ enum Foo : Bar {}
 .TopLevelType var;
 
 debug bool resolveNeeded = false;
+
+void fun()
+{
+       return gun();
+}
diff --git a/tests/fonts.d.html b/tests/fonts.d.html
index 5742133..0c76899 100644
--- a/tests/fonts.d.html
+++ b/tests/fonts.d.html
@@ -38,3 +38,8 @@ write(s ~ <span class="string">&quot;&quot;</span>);
 .<span class="type">TopLevelType</span> <span class="variable-name">var</span>;
 
 <span class="keyword">debug</span> <span class="type">bool</span> <span 
class="variable-name">resolveNeeded</span> = <span 
class="constant">false</span>;
+
+<span class="type">void</span> <span class="function-name">fun</span>()
+{
+       <span class="keyword">return</span> gun();
+}



reply via email to

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