[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/d-mode f4b3d8a 267/346: Precompute regular expressions for
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/d-mode f4b3d8a 267/346: Precompute regular expressions for inline keyword lists |
Date: |
Sun, 29 Aug 2021 11:00:43 -0400 (EDT) |
branch: elpa/d-mode
commit f4b3d8a15fb1cd295e7518dc43c08c07cf3d502e
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>
Precompute regular expressions for inline keyword lists
14% speed-up.
---
d-mode.el | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index fb8f534..d36c024 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: 201909121829
+;; Version: 201909121912
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "25.1"))
@@ -417,6 +417,10 @@ operators."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ----------------------------------------------------------------------------
+(defmacro d-make-keywords-re (adorn list)
+ "Helper to precompute regular expressions for inline keyword lists." ;;
checkdoc-params: (adorn list)
+ (eval `(c-make-keywords-re ,adorn ,list 'd)))
+
;;----------------------------------------------------------------------------
;;; Workaround for special case of 'else static if' not being handled properly
(defun d-special-case-looking-at (orig-fun &rest args)
@@ -454,7 +458,7 @@ operators."
(defun d-special-case-c-forward-name (orig-fun &rest args)
;; checkdoc-params: (orig-fun args)
"Advice function for fixing cc-mode handling of D constructors."
- (if (not (looking-at (c-make-keywords-re t '("this" "~this"))))
+ (if (not (looking-at (d-make-keywords-re t '("this" "~this"))))
(apply orig-fun args)
(goto-char (match-end 1))
t))
@@ -476,7 +480,7 @@ operators."
(looking-at c-identifier-start)
(progn
(c-forward-token-2)
- (looking-at (c-make-keywords-re t '("in"))))))
+ (looking-at (d-make-keywords-re t '("in"))))))
nil)
;; D: cc-mode gets confused due to "scope" being a keyword that can
@@ -484,7 +488,7 @@ operators."
;; statement (e.g. "scope(exit)"). Disambiguate them here.
((save-excursion
(and
- (looking-at (c-make-keywords-re t '("scope")))
+ (looking-at (d-make-keywords-re t '("scope")))
(progn
(c-forward-token-2)
(looking-at "("))))
@@ -498,7 +502,7 @@ operators."
;; is mis-parsed as a function declaration.
;; Fix this by moving point forward, past the "else" keyword, to
;; put cc-mode on the right track.
- ((looking-at (c-make-keywords-re t '("else")))
+ ((looking-at (d-make-keywords-re t '("else")))
(goto-char (match-end 1))
(c-forward-syntactic-ws)
(apply orig-fun args))
@@ -545,7 +549,7 @@ operators."
"Advice function for fixing cc-mode handling of D constructors."
(if (and
(eq regexp c-not-decl-init-keywords)
- (apply orig-fun (c-make-keywords-re t '("this")) nil)) ; looking-at
"this"
+ (apply orig-fun (d-make-keywords-re t '("this")) nil)) ; looking-at
"this"
nil
(apply orig-fun regexp nil)))
@@ -600,7 +604,7 @@ Currently handles `-delimited string literals."
;; Check for a normal (non-keyword) identifier.
(and (looking-at c-symbol-start)
(or
- (looking-at (c-make-keywords-re t '("this" "~this")))
+ (looking-at (d-make-keywords-re t '("this" "~this")))
(not (looking-at c-keywords-regexp)))
(point)))))
@@ -752,7 +756,7 @@ Currently handles `-delimited string literals."
(cond
;; D: "this" is not a type, even though it appears at the
;; beginning of a "function" (constructor) declaration.
- ((looking-at (c-make-keywords-re t '("this")))
+ ((looking-at (d-make-keywords-re t '("this")))
nil)
;; D: Storage class substituting the type (e.g. auto)
- [nongnu] elpa/d-mode 2f7adb1 319/346: Fontify sole lambda params, (continued)
- [nongnu] elpa/d-mode 2f7adb1 319/346: Fontify sole lambda params, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode b40a7ab 328/346: Unbundle undercover.el, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode a9c05fd 331/346: tests/I0102: Remove #min-version, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 32446a7 338/346: Merge pull request #107 from CyberShadow/github-actions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode c3be102 344/346: Cask: Fetch undercover.el directly from git, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 7fdd7b2 343/346: .github/workflows/test.yml: Add final step to call the Coveralls webhook, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 505022e 341/346: tests: New testcase, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 199743d 346/346: tests/I0021: Update condition, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 66796d0 247/346: Rename gplv2.txt -> COPYING, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 51dcd68 251/346: Improve comprehension of D constructors and destructors, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f4b3d8a 267/346: Precompute regular expressions for inline keyword lists,
ELPA Syncer <=
- [nongnu] elpa/d-mode 809586a 266/346: Reorganize code, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 4851fc2 270/346: Fix fontification of "enum" in string literals, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 49cb5a8 275/346: Consolidate c-forward-decl-or-cast-1 annotation patch, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 45c60e0 286/346: Fix fontification of variable declarations with top-level types, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e9a034e 283/346: Tighten decl/arglist recognition, obsoleting another patch, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 05fc5f1 284/346: Consolidate c-forward-decl-or-cast-1 "scope" patch, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 44cf02b 287/346: tests: New testcase, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 73f4bdc 292/346: Emacs 25 compatibility, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 8e77187 293/346: Fix fontification of return statements, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode cb97457 297/346: Remove another obsolete hack, ELPA Syncer, 2021/08/29