[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/d-mode 46a57f4 310/346: Fontify the special words inside v
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/d-mode 46a57f4 310/346: Fontify the special words inside version/debug/extern/pragma/__traits/scope |
Date: |
Sun, 29 Aug 2021 11:00:51 -0400 (EDT) |
branch: elpa/d-mode
commit 46a57f4df340bcf3f354515ed9e11a2ff362b942
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>
Fontify the special words inside version/debug/extern/pragma/__traits/scope
---
d-mode.el | 34 ++++++++++++++++++++++++++++++++--
tests/fonts.d | 3 +++
tests/fonts.d.html | 9 ++++++---
3 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index 2752529..9977ff1 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: 201911112326
+;; Version: 201911120023
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "25.1"))
@@ -282,7 +282,7 @@ operators."
(c-lang-defconst c-paren-nontype-kwds
;;Keywords that may be followed by a parenthesis expression that doesn't
;; contain type identifiers.
- d '("version" "debug" "extern" "macro" "mixin" "pragma"))
+ d '("version" "debug" "extern" "pragma" "__traits" "scope"))
(c-lang-defconst d-type-modifier-kwds
;; D's type modifiers.
@@ -465,6 +465,29 @@ Evaluate OLD-FORM if the Emacs version is older than
MIN-VERSION,
;;----------------------------------------------------------------------------
+(defun d-forward-keyword-clause (match)
+ "D version (complement) of `c-forward-keyword-clause'." ;; checkdoc-params:
match
+
+ (let ((kwd-sym (c-keyword-sym (match-string match))) safe-pos pos)
+
+ (when kwd-sym
+ (goto-char (match-end match))
+ (c-forward-syntactic-ws)
+ (setq safe-pos (point))
+
+ (cond
+ ((and (c-keyword-member kwd-sym 'c-paren-nontype-kwds)
+ (eq (char-after) ?\())
+ (forward-char)
+ (c-forward-syntactic-ws)
+ (c-forward-keyword-prefixed-id ref)
+ (goto-char safe-pos)
+ (c-forward-sexp)
+ (c-forward-syntactic-ws)
+ t)))))
+
+;----------------------------------------------------------------------------
+
(defun d-forward-decl-or-cast-1 (preceding-token-end context last-cast-end)
"D version of `c-forward-decl-or-cast-1'." ;; checkdoc-params:
(preceding-token-end context last-cast-end)
;; (message "(d-forward-decl-or-cast-1 %S %S %S) @ %S" preceding-token-end
context last-cast-end (point))
@@ -1694,6 +1717,13 @@ Each list item should be a regexp matching a single
identifier."
(c-make-keywords-re t (c-lang-const c-ref-list-kwds d) 'd))
'((c-fontify-types-and-refs ()
(d-forward-module-clause)
+ (if (> (point) limit) (goto-char limit)))))
+
+ (c-make-font-lock-BO-decl-search-function
+ (concat "\\_<"
+ (c-make-keywords-re t (c-lang-const c-paren-nontype-kwds d)
'd))
+ '((c-fontify-types-and-refs ()
+ (d-forward-keyword-clause 1)
(if (> (point) limit) (goto-char limit))))))
;; cc-mode defaults
(c-lang-const c-basic-matchers-after)))
diff --git a/tests/fonts.d b/tests/fonts.d
index 4081f79..509c798 100644
--- a/tests/fonts.d
+++ b/tests/fonts.d
@@ -19,6 +19,9 @@ static if (true) {} else void fun();
scope(exit) fun();
scope(exit) void fun();
+version(all) void fun();
+pragma(msg, "Hi!");
+enum x = true && __traits(compiles, true) && true;
@property empty() { return false; }
diff --git a/tests/fonts.d.html b/tests/fonts.d.html
index 1f27fae..de7f887 100644
--- a/tests/fonts.d.html
+++ b/tests/fonts.d.html
@@ -12,13 +12,16 @@
run(a ~ b);
}
-<span class="keyword">version</span>(none) <span class="type">string</span>
<span class="function-name">readLink</span>();
+<span class="keyword">version</span>(<span class="constant">none</span>) <span
class="type">string</span> <span class="function-name">readLink</span>();
<span class="keyword">static if</span> (<span class="constant">true</span>) {}
<span class="keyword">else</span> fun();
<span class="keyword">static if</span> (<span class="constant">true</span>) {}
<span class="keyword">else</span> <span class="type">void</span> <span
class="function-name">fun</span>();
-<span class="keyword">scope</span>(exit) fun();
-<span class="keyword">scope</span>(exit) <span class="type">void</span> <span
class="function-name">fun</span>();
+<span class="keyword">scope</span>(<span class="constant">exit</span>) fun();
+<span class="keyword">scope</span>(<span class="constant">exit</span>) <span
class="type">void</span> <span class="function-name">fun</span>();
+<span class="keyword">version</span>(<span class="constant">all</span>) <span
class="type">void</span> <span class="function-name">fun</span>();
+<span class="keyword">pragma</span>(<span class="constant">msg</span>, <span
class="string">"Hi!"</span>);
+<span class="keyword">enum</span> <span class="variable-name">x</span> = <span
class="constant">true</span> && <span
class="keyword">__traits</span>(<span class="constant">compiles</span>, <span
class="constant">true</span>) && <span class="constant">true</span>;
<span class="c-annotation-face">@property</span> <span
class="function-name">empty</span>() { <span class="keyword">return</span>
<span class="constant">false</span>; }
- [nongnu] elpa/d-mode f69e94e 207/346: Change test suite enumeration and activation, (continued)
- [nongnu] elpa/d-mode f69e94e 207/346: Change test suite enumeration and activation, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode b0a59de 214/346: Fix mis-parsing of concatenating two variables, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 445c696 210/346: Implement a more complete description for D type syntax, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode ed0de34 222/346: Refactor "this" (constructor) handling, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode aaa704a 216/346: Fix coverage issues in d-forward-type, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 572d707 221/346: Improve comprehension of constness and storage classes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 64afe5f 206/346: .travis.yml: Test against more Emacs versions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 02733b0 223/346: Remove some redundant progns, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode c9febb3 299/346: d-mode-test: Always ignore .res files, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 2d4bc7d 318/346: Update comments, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 46a57f4 310/346: Fontify the special words inside version/debug/extern/pragma/__traits/scope,
ELPA Syncer <=
- [nongnu] elpa/d-mode 805eeba 078/346: Add links to build and coverage status to README., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 8076559 081/346: Replace obsolete defadvice by the new advice-add., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode ee38763 083/346: Use the new advising mechanism on new emacs versions., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 5c06e99 087/346: add d-exceptions compilation error regexp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 5501b77 096/346: Prepare for a formal release., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 89339fa 100/346: Fix typo in comment, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 14e2e3b 105/346: Fix exponential fontification time of backslashes in WYSIWYG-literals, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 438cf53 109/346: fixed missing keyword "idouble", ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f6bf2b7 141/346: tests: Split test into individual ert tests, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 23d7a1a 148/346: tests: Fix testing compilation-mode buffers with Emacs 26, ELPA Syncer, 2021/08/29