branch: elpa/d-mode
commit 5691b703f340997ba20601a7a9fd7b71a3805d55
Merge: dea775a 781a94d
Author: Russel Winder <[email protected]>
Commit: Russel Winder <[email protected]>
Merge pull request #36 from dmakarov/master
new doc-comment style that recognizes /*!, //!, ///, /++, and /+! prefixes
---
d-mode.el | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index 49edee9..2dabd7a 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -137,16 +137,29 @@ operators."
(c-lang-defconst c-literal-start-regexp
;; Regexp to match the start of comments and string literals.
d "/[*+/]\\|\"\\|`")
-;;(c-lang-defconst c-comment-prefix-regexp d "//+\\|\\**")
-
-(c-lang-defconst c-doc-comment-start-regexp
- ;; doc comments for D use "///", "/**" or doxygen's "/*!" "//!"
- d "/\\*[*!]\\|//[/!]")
(c-lang-defconst c-block-prefix-disallowed-chars
;; Allow ':' for inherit list starters.
d (set-difference (c-lang-const c-block-prefix-disallowed-chars)
- '(?:)))
+ '(?:)))
+
+(defconst doxygen-font-lock-doc-comments
+ (let ((symbol "[a-zA-Z0-9_]+")
+ (header "^ \\* "))
+ `((,(concat header "\\(" symbol "\\):[ \t]*$")
+ 1 ,c-doc-markup-face-name prepend nil)
+ (,(concat symbol "()")
+ 0 ,c-doc-markup-face-name prepend nil)
+ (,(concat header "\\(" "@" symbol "\\):")
+ 1 ,c-doc-markup-face-name prepend nil)
+ (,(concat "[#%@]" symbol)
+ 0 ,c-doc-markup-face-name prepend nil))
+ ))
+
+(defconst doxygen-font-lock-keywords
+ `((,(lambda (limit)
+ (c-font-lock-doc-comments "/\\+[+!]\\|/\\*[*!]\\|//[/!]" limit
+ doxygen-font-lock-doc-comments)))))
;;----------------------------------------------------------------------------
@@ -456,7 +469,7 @@ operators."
(define-derived-mode d-mode d-parent-mode "D"
"Major mode for editing code written in the D Programming Language.
-See http://www.digitalmars.com/d for more information about the D language.
+See http://dlang.org for more information about the D language.
The hook `c-mode-common-hook' is run with no args at mode
initialization, then `d-mode-hook'.