branch: elpa/d-mode
commit 0d45ab266f92a672af478473681977727a99e7a7
Author: Vladimir Panteleev <[email protected]>
Commit: Vladimir Panteleev <[email protected]>
Fix brace stack logic creating unbalanced stacks
The old logic simply ignored the '{' when it occurred in a context
which carried over the toplevel-ness (static if), which caused the
matching '}' to be mis-parsed as belonging to a different '{'.
---
d-mode.el | 6 ++++--
tests/fonts.d | 6 ++++++
tests/fonts.d.html | 6 ++++++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index 4d8f7aa..a6a084d 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -7,7 +7,7 @@
;; Maintainer: Russel Winder <[email protected]>
;; Vladimir Panteleev <[email protected]>
;; Created: March 2007
-;; Version: 201911121047
+;; Version: 201911121107
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "25.1"))
@@ -1190,7 +1190,9 @@ Currently handles `-delimited string literals."
;; context. I.e., the contents of a "static if"
at the
;; top level should remain top-level, but in a
function,
;; it should remain non-top-level.
- s
+ (if (<= (car s) 1)
+ (cons 1 s)
+ (cons (1+ (car s)) (cdr s)))
(cons (if (<= (car s) 0)
1
(1+ (car s)))
diff --git a/tests/fonts.d b/tests/fonts.d
index a32295d..666ab3e 100644
--- a/tests/fonts.d
+++ b/tests/fonts.d
@@ -59,3 +59,9 @@ void fun()
synchronized (a) {}
debug (a) {}
}
+
+void fun()
+{
+ if (a) {}
+ return gun();
+}
diff --git a/tests/fonts.d.html b/tests/fonts.d.html
index 9508e08..5dee5df 100644
--- a/tests/fonts.d.html
+++ b/tests/fonts.d.html
@@ -59,3 +59,9 @@ write(s ~ <span class="string">""</span>);
<span class="keyword">synchronized</span> (a) {}
<span class="keyword">debug</span> (<span class="constant">a</span>) {}
}
+
+<span class="type">void</span> <span class="function-name">fun</span>()
+{
+ <span class="keyword">if</span> (a) {}
+ <span class="keyword">return</span> gun();
+}