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

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

[nongnu] elpa/d-mode fd8e70a 209/346: Partially implement D type modifie


From: ELPA Syncer
Subject: [nongnu] elpa/d-mode fd8e70a 209/346: Partially implement D type modifiers (const/immutable/etc.)
Date: Sun, 29 Aug 2021 11:00:32 -0400 (EDT)

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

    Partially implement D type modifiers (const/immutable/etc.)
    
    Fixes fontification of types wrapped by the modifier.
    
    Fixes issue #95.
---
 d-mode.el          | 20 ++++++++++++++++++--
 tests/I0095.d      |  8 ++++++++
 tests/I0095.d.html |  8 ++++++++
 3 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/d-mode.el b/d-mode.el
index e4ac593..23dc60c 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:  201909081431
+;; Version:  201909081643
 ;; Keywords:  D programming language emacs cc-mode
 ;; Package-Requires: ((emacs "24.3"))
 
@@ -329,10 +329,26 @@ The expression is added to 
`compilation-error-regexp-alist' and
   ;; contain type identifiers.
   d '("version" "debug" "extern" "macro" "mixin" "pragma"))
 
+(c-lang-defconst d-type-modifier-kwds
+  ;; D's type modifiers.
+  d '("const" "immutable" "inout" "shared"))
+
 (c-lang-defconst c-paren-type-kwds
   ;; Keywords that may be followed by a parenthesis expression containing
   ;; type identifiers separated by arbitrary tokens.
-  d  '("delete" "throw"))
+  d (append (list "delete" "throw")
+           (c-lang-const d-type-modifier-kwds)))
+
+;; D: Also exclude d-type-modifier-kwds
+(c-lang-defconst c-regular-keywords-regexp
+  ;; Adorned regexp matching all keywords that should be fontified
+  ;; with the keywords face.  I.e. that aren't types or constants.
+  d (c-make-keywords-re t
+      (c--set-difference (c-lang-const c-keywords)
+                        (append (c-lang-const c-primitive-type-kwds)
+                                (c-lang-const c-constant-kwds)
+                                (c-lang-const d-type-modifier-kwds))
+                        :test 'string-equal)))
 
 (c-lang-defconst c-block-stmt-1-kwds
   ;; Statement keywords followed directly by a substatement.
diff --git a/tests/I0095.d b/tests/I0095.d
new file mode 100644
index 0000000..9d49ded
--- /dev/null
+++ b/tests/I0095.d
@@ -0,0 +1,8 @@
+// #run: (d-test-fontification)
+// TODO: fontify param as variable-name
+
+alias Type = int;
+
+void foo(const(Type) param);
+
+const(Type) bar(const(Type) param);
diff --git a/tests/I0095.d.html b/tests/I0095.d.html
new file mode 100644
index 0000000..1eaa37d
--- /dev/null
+++ b/tests/I0095.d.html
@@ -0,0 +1,8 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span><span class="comment-delimiter">// </span><span class="comment">TODO: 
fontify param as variable-name
+</span>
+<span class="keyword">alias</span> <span class="type">Type</span> = <span 
class="type">int</span>;
+
+<span class="type">void</span> <span class="function-name">foo</span>(<span 
class="keyword">const</span>(<span class="type">Type</span>) param);
+
+<span class="keyword">const</span>(<span class="type">Type</span>) bar(<span 
class="keyword">const</span>(<span class="type">Type</span>) param);



reply via email to

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