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

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

[nongnu] elpa/raku-mode 21af6e8398 224/253: Add comment-style highlighti


From: ELPA Syncer
Subject: [nongnu] elpa/raku-mode 21af6e8398 224/253: Add comment-style highlighting to POD.
Date: Sat, 29 Jan 2022 08:29:01 -0500 (EST)

branch: elpa/raku-mode
commit 21af6e839842a1be67db3141ae23fc3f1cb7961d
Author: Tim Van den Langenbergh <tmt_vdl@gmx.com>
Commit: Tim Van den Langenbergh <tmt_vdl@gmx.com>

    Add comment-style highlighting to POD.
    
    Fixes #24.
---
 raku-font-lock.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/raku-font-lock.el b/raku-font-lock.el
index 65f17c392b..b39ff7bb4d 100644
--- a/raku-font-lock.el
+++ b/raku-font-lock.el
@@ -372,6 +372,17 @@ opening delimiter."
         (put-text-property (1- (point)) (point)
                            'syntax-table (string-to-syntax ">")))))
 
+(defun raku-syntax-propertize-pod (limit)
+  "Add syntax properties to POD."
+  (let ((pod-beg (- (point) (length "=begin pod"))))
+    (put-text-property pod-beg (1+ pod-beg)
+                       'syntax-table (string-to-syntax "<"))
+    (if (re-search-forward "=end pod" limit 'noerror)
+        (let ((pod-end (point)))
+          (put-text-property pod-beg pod-end 'syntax-multiline t)
+          (put-text-property (1- pod-end) pod-end
+                             'syntax-table (string-to-syntax ">"))))))
+
 (defun raku-syntax-propertize-angles (open-angles)
   "Add syntax properties to angle-bracketed quotes (e.g. <foo> and «bar»).
 
@@ -434,6 +445,9 @@ Takes arguments START and END which delimit the region to 
propertize."
       ;; comments
       ((rx "#")
        (0 (ignore (raku-syntax-propertize-comment end))))
+      ;; pod
+      ((rx "=begin pod")
+       (0 (ignore (raku-syntax-propertize-pod end))))
       ;; postfix hyper operators
       ((raku-rx (or identifier "]" ")") (group (or "»" ">>")))
        (0 nil))



reply via email to

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