emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/lua-mode b4943f6 313/468: Add luadoc keyword fontification


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode b4943f6 313/468: Add luadoc keyword fontification (issue #71)
Date: Thu, 5 Aug 2021 04:59:00 -0400 (EDT)

branch: elpa/lua-mode
commit b4943f685d0056fb960ac3399b8f54ad89c93196
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>

    Add luadoc keyword fontification (issue #71)
---
 lua-mode.el            | 10 +++++++++-
 test/test-font-lock.el | 31 +++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/lua-mode.el b/lua-mode.el
index 2fd79e6..e2e1ac7 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -646,7 +646,15 @@ Groups 6-9 can be used in any of argument regexps."
       (3 font-lock-warning-face t noerror)))
 
     (,(lua-rx (or bol ";") ws lua-funcheader)
-     (1 font-lock-function-name-face)))
+     (1 font-lock-function-name-face))
+
+    (,(lua-rx (or (group-n 1
+                           "@" (symbol "author" "copyright" "field" "release"
+                                       "return" "see" "usage" "description"))
+                  (seq (group-n 1 "@" (symbol "param" "class" "name")) ws+
+                       (group-n 2 lua-name))))
+     (1 font-lock-keyword-face t)
+     (2 font-lock-variable-name-face t noerror)))
 
   "Default expressions to highlight in Lua mode.")
 
diff --git a/test/test-font-lock.el b/test/test-font-lock.el
index 9009555..b89037d 100644
--- a/test/test-font-lock.el
+++ b/test/test-font-lock.el
@@ -181,3 +181,34 @@ goto f12o"
   ;; of another variable
   (it "does not fontify after symbols ending with \"goto\""
     (expect "JUNKgoto foo" :to-be-fontified-as '(nil))))
+
+
+(describe "Fontification of LuaDoc keywords"
+  (it "works"
+    (expect "\
+-- @author foo baz
+-- @copyright foo baz
+-- @field foo baz
+-- @param foo baz
+-- @release foo baz
+-- @return foo baz
+-- @see foo baz
+-- @usage foo baz
+-- @class foo baz
+-- @description foo baz
+-- @name foo baz"
+            :to-be-fontified-as
+            '(("-- " comment-delimiter "@author" keyword " foo baz" comment)
+              ("-- " comment-delimiter "@copyright" keyword " foo baz" comment)
+              ("-- " comment-delimiter "@field" keyword " foo baz" comment)
+              ("-- " comment-delimiter "@param" keyword " " comment
+               "foo" variable-name " baz" comment)
+              ("-- " comment-delimiter "@release" keyword " foo baz" comment)
+              ("-- " comment-delimiter "@return" keyword " foo baz" comment)
+              ("-- " comment-delimiter "@see" keyword " foo baz" comment)
+              ("-- " comment-delimiter "@usage" keyword " foo baz" comment)
+              ("-- " comment-delimiter "@class" keyword
+               " " comment "foo" variable-name " baz" comment)
+              ("-- " comment-delimiter "@description" keyword " foo baz" 
comment)
+              ("-- " comment-delimiter "@name" keyword " " comment
+               "foo" variable-name " baz" comment)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]