[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);
- [nongnu] elpa/d-mode 2964263 184/346: Fix imenu with alias templates, (continued)
- [nongnu] elpa/d-mode 2964263 184/346: Fix imenu with alias templates, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 71e8bda 196/346: Improve constructor handling and fix constructor contract indentation, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 28810ef 194/346: Add test for function contracts, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 1bce6c4 191/346: Somewhat improve fontification of module names, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode b413942 198/346: Tighten K&R region detection, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 07cb4d0 199/346: Add d-lineup-arglists, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode d3ceb14 200/346: Make d--imenu-rx-def-start a compile-time constant, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 0b6a089 217/346: .travis.yml: Try using a emacs-travis.mk which does not use FTP, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 653661e 220/346: Fix parsing qualified types, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f07f365 201/346: Fix fontification of constructor parameters, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode fd8e70a 209/346: Partially implement D type modifiers (const/immutable/etc.),
ELPA Syncer <=
- [nongnu] elpa/d-mode 8647147 208/346: Fix tests' minimum Emacs versions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 9ad04a1 213/346: Fix parsing/fontification of some expressions with periods, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 5146f2d 215/346: Clear some cc-mode constants, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 3f669a1 231/346: Replace regex-based imenu implementation with cc-mode-based, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode db2c33f 225/346: Fix parsing of D lambda literals' parameter lists, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 1598b12 248/346: Switch to GPL v3 (or later), ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 24fffad 242/346: Fix parsing of declarations after "static else", ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode a8aad35 241/346: Fix imenu false positive with "static if", ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 6a19457 244/346: Fix function calls being mis-parsed as declarations after static else, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 3077252 238/346: Correctness fix in d-forward-type, ELPA Syncer, 2021/08/29