[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/d-mode 0b8ed61 152/346: Fix highlighting of const variable
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/d-mode 0b8ed61 152/346: Fix highlighting of const variable declarations |
Date: |
Sun, 29 Aug 2021 11:00:20 -0400 (EDT) |
branch: elpa/d-mode
commit 0b8ed61236f3d6f56c0b63b44d31336a1071518e
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>
Fix highlighting of const variable declarations
Move the "const" keyword to the same mechanism used for "auto" and
"immutable".
Fixes #30.
---
d-mode-test.el | 1 +
d-mode.el | 12 ++++++------
tests/I0030.d | 12 ++++++++++++
tests/I0030.d.html | 12 ++++++++++++
4 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/d-mode-test.el b/d-mode-test.el
index 56b4f04..1026016 100644
--- a/d-mode-test.el
+++ b/d-mode-test.el
@@ -296,6 +296,7 @@ is expected to succeed, and nil otherwise."
(d-test-deftest fonts "tests/fonts.d" t)
(d-test-deftest i0021 "tests/I0021.d" t)
(d-test-deftest i0026 "tests/I0026.d" t)
+(d-test-deftest i0030 "tests/I0030.d" t)
(d-test-deftest i0035 "tests/I0035.d" (version< "24.4" emacs-version))
(d-test-deftest i0039 "tests/I0039.d" (version< "24.4" emacs-version))
(d-test-deftest i0064 "tests/I0064.d" t)
diff --git a/d-mode.el b/d-mode.el
index 9724631..a231662 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: 201610111435
+;; Version: 201610111813
;; Keywords: D programming language emacs cc-mode
;;;; NB Version number is date and time yyyymmddhhMM UTC.
@@ -245,7 +245,7 @@ The expression is added to `compilation-error-regexp-alist'
and
;; Keywords that can prefix normal declarations of identifiers
(c-lang-defconst c-modifier-kwds
- d '("__gshared" "abstract" "const" "deprecated" "extern"
+ d '("__gshared" "abstract" "deprecated" "extern"
"final" "in" "out" "inout" "lazy" "mixin" "override" "private"
"protected" "public" "ref" "scope" "shared" "static" "synchronized"
"volatile" "__vector"))
@@ -259,7 +259,7 @@ The expression is added to `compilation-error-regexp-alist'
and
;; d '("enum"))
(c-lang-defconst c-type-modifier-kwds
- d '("__gshared" "const" "inout" "lazy" "shared" "volatile"
+ d '("__gshared" "inout" "lazy" "shared" "volatile"
"invariant" "enum" "__vector"))
(c-lang-defconst c-type-prefix-kwds
@@ -288,7 +288,7 @@ The expression is added to `compilation-error-regexp-alist'
and
(c-lang-defconst c-protection-kwds
;; Access protection label keywords in classes.
d '("deprecated" "static" "extern" "final" "synchronized" "override"
- "abstract" "scope" "const" "inout" "shared" "__gshared"
+ "abstract" "scope" "inout" "shared" "__gshared"
"private" "package" "protected" "public" "export"))
;;(c-lang-defconst c-postfix-decl-spec-kwds
@@ -624,7 +624,7 @@ Key bindings:
;;----------------------------------------------------------------------------
;; "Hideous hacks" to support appropriate font-lock behaviour.
;;
-;; * auto/immutable: If we leave them in c-modifier-kwds (like
+;; * auto/const/immutable: If we leave them in c-modifier-kwds (like
;; c++-mode) then in the form "auto var;" var will be highlighted in
;; type name face. Moving auto/immutable to font-lock-add-keywords
;; lets cc-mode seeing them as a type name, so the next symbol can
@@ -657,7 +657,7 @@ Key bindings:
(defun d-match-fun-decl (limit)
(d-try-match-decl d-fun-decl-pattern))
(defun d-match-auto (limit)
- (c-syntactic-re-search-forward "\\<\\(auto\\|immutable\\)\\>" limit t))
+ (c-syntactic-re-search-forward "\\<\\(auto\\|const\\|immutable\\)\\>" limit
t))
(font-lock-add-keywords
'd-mode
diff --git a/tests/I0030.d b/tests/I0030.d
new file mode 100644
index 0000000..e269971
--- /dev/null
+++ b/tests/I0030.d
@@ -0,0 +1,12 @@
+// #run: (d-test-fontification)
+
+const class C
+{
+ int getFoo() const { return 42; }
+
+ const void bar()
+ {
+ auto foo = getFoo();
+ const baz = getFoo();
+ }
+}
diff --git a/tests/I0030.d.html b/tests/I0030.d.html
new file mode 100644
index 0000000..463753e
--- /dev/null
+++ b/tests/I0030.d.html
@@ -0,0 +1,12 @@
+<span class="comment-delimiter">// </span><span class="comment">#run:
(d-test-fontification)
+</span>
+<span class="keyword">const class</span> C
+{
+ <span class="type">int</span> <span
class="function-name">getFoo</span>() <span class="keyword">const</span> {
<span class="keyword">return</span> 42; }
+
+ <span class="keyword">const</span> <span class="type">void</span> <span
class="function-name">bar</span>()
+ {
+ <span class="keyword">auto</span> <span
class="variable-name">foo</span> = getFoo();
+ <span class="keyword">const</span> <span
class="variable-name">baz</span> = getFoo();
+ }
+}
- [nongnu] elpa/d-mode 1908f59 236/346: Speed up imenu a bit, (continued)
- [nongnu] elpa/d-mode 1908f59 236/346: Speed up imenu a bit, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 627a6f8 273/346: Move c-forward-decl-or-cast-1 into d-mode.el, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e9278a9 114/346: Reimplement compilation-mode error message detection for DMD, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode aff84c6 115/346: update support for Emacs 25, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode a564656 116/346: Merge pull request #71 from brdjns/patch-1, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 23a3661 119/346: Merge pull request #72 from nordlow/fix-d-exceptions-regexp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e5d21be 121/346: README: Update shield images and links to use official project repository, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 576dd29 123/346: tests: Actually test compilation-mode error list correctness, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 7817dbc 122/346: d-mode-test: Announce mismatched values of inline tests, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 8ccad32 136/346: Simplify cascaded call indentation setup, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 0b8ed61 152/346: Fix highlighting of const variable declarations,
ELPA Syncer <=
- [nongnu] elpa/d-mode 593e3f5 155/346: Fix extern(C) functions omitted from imenu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 93a62b3 158/346: Fix imenu for functions returning types containing parens, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode a4f0b2d 161/346: Fix imenu for functions prefixed with a version/else, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 8771a86 162/346: Convert d-imenu-generic-expression to rx, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 908d55b 170/346: fix #49 - Occasional incorrect fontification of string literals due, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode dea775a 066/346: Merge pull request #35 from wrzoski/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 01997e0 070/346: Add LDC compiler message pattern to be recognized in compilation mode., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 38ddb5a 076/346: Merge pull request #41 from dmakarov/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 2b0b84f 073/346: Merge pull request #38 from TOGoS/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode c4d8ba8 099/346: Fix omission of final/abstract classes in imenu, ELPA Syncer, 2021/08/29