[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/d-mode db2c33f 225/346: Fix parsing of D lambda literals'
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/d-mode db2c33f 225/346: Fix parsing of D lambda literals' parameter lists |
Date: |
Sun, 29 Aug 2021 11:00:35 -0400 (EDT) |
branch: elpa/d-mode
commit db2c33f85d66c870e4057787dd46d1b40774d09d
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>
Fix parsing of D lambda literals' parameter lists
Watch me - this might be too relaxed as well.
---
d-mode.el | 19 ++++++++++++++++++-
tests/fonts_lambda_params.d | 3 +++
tests/fonts_lambda_params.d.html | 3 +++
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/d-mode.el b/d-mode.el
index 24f081a..f2d4826 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: 201909091520
+;; Version: 201909091656
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "25.1"))
@@ -902,6 +902,23 @@ Each list item should be a regexp matching a single
identifier."
(advice-add 'c-forward-decl-or-cast-1 :around
#'d-around--c-forward-decl-or-cast-1)
;;----------------------------------------------------------------------------
+
+(defun d-around--c-get-fontification-context (orig-fun match-pos &rest args)
+ ;; checkdoc-params: (orig-fun match-pos args)
+ "Advice function for fixing cc-mode handling of D lambda parameter lists."
+ (let ((res (apply orig-fun match-pos args)))
+ (when (and
+ (c-major-mode-is 'd-mode)
+ (eq (car res) nil)
+ (save-excursion
+ (goto-char match-pos )
+ (c-backward-syntactic-ws)
+ (eq (char-before) ?\()))
+ (setq res (cons 'arglist t)))
+ res))
+(advice-add 'c-get-fontification-context :around
#'d-around--c-get-fontification-context)
+
+;;----------------------------------------------------------------------------
;;; Fixes fontification of constructor parameter lists in D code.
(defun d-special-case-looking-at-2 (orig-fun regexp)
diff --git a/tests/fonts_lambda_params.d b/tests/fonts_lambda_params.d
new file mode 100644
index 0000000..a906122
--- /dev/null
+++ b/tests/fonts_lambda_params.d
@@ -0,0 +1,3 @@
+// #run: (d-test-fontification)
+
+auto dg = (Object a, Object b) {};
diff --git a/tests/fonts_lambda_params.d.html b/tests/fonts_lambda_params.d.html
new file mode 100644
index 0000000..d99a24e
--- /dev/null
+++ b/tests/fonts_lambda_params.d.html
@@ -0,0 +1,3 @@
+<span class="comment-delimiter">// </span><span class="comment">#run:
(d-test-fontification)
+</span>
+<span class="keyword">auto</span> <span class="variable-name">dg</span> =
(<span class="type">Object</span> <span class="variable-name">a</span>, <span
class="type">Object</span> <span class="variable-name">b</span>) {};
- [nongnu] elpa/d-mode 07cb4d0 199/346: Add d-lineup-arglists, (continued)
- [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, 2021/08/29
- [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 <=
- [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
- [nongnu] elpa/d-mode 1e5c7c3 227/346: Fix parsing of declarations following protection group, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f8c37b9 260/346: Implement parsing module names in import and module declarations, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 3c7db4a 255/346: Fix imenu context with multiple nesting, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 3ed3b7b 257/346: Simplify imenu testing code, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f1d37dd 263/346: Fix byte-compiled version, ELPA Syncer, 2021/08/29