[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/raku-mode 6d4ef1743a 118/253: More robust comment highligh
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/raku-mode 6d4ef1743a 118/253: More robust comment highlighting |
Date: |
Sat, 29 Jan 2022 08:28:47 -0500 (EST) |
branch: elpa/raku-mode
commit 6d4ef1743a57da649356022cbbf035475994a28a
Author: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Commit: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
More robust comment highlighting
---
perl6-font-lock.el | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/perl6-font-lock.el b/perl6-font-lock.el
index 828f2ee428..2e1fddb80c 100644
--- a/perl6-font-lock.el
+++ b/perl6-font-lock.el
@@ -264,9 +264,6 @@
(defconst perl6-mode-syntax-table
(let ((table (make-syntax-table)))
- ;; single-line comments
- (modify-syntax-entry ?# "<" table)
- (modify-syntax-entry ?\n ">" table)
;; single-quoted strings
(modify-syntax-entry ?' "\"" table)
;; these are all punctuation chars, not word or symbol chars
@@ -364,6 +361,21 @@ opening delimiter."
(put-text-property (- delim-end 1) delim-end
'syntax-table (string-to-syntax syntax)))))))
+(defun perl6-syntax-propertize-comment (limit)
+ "Add syntax properties to comments."
+ (with-syntax-table perl6-bracket-syntax-table
+ (let ((comment-start (1- (point))))
+ (if (and (re-search-forward "\\=[`|=]" (1+ (point)) 'noerror)
+ (eq ?\( (char-syntax (following-char))))
+ ;; embedded/multiline comment
+ (perl6-syntax-propertize-delimiters "!" -2)
+ ;; single-line comment
+ (put-text-property comment-start (1+ comment-start)
+ 'syntax-table (string-to-syntax "<"))
+ (if (re-search-forward "\n" limit 'noerror)
+ (put-text-property (1- (point)) (point)
+ 'syntax-table (string-to-syntax ">")))))))
+
(defun perl6-syntax-propertize-angles (open-angles)
"Add syntax properties to angle-bracketed quotes (e.g. <foo> and «bar»).
@@ -421,13 +433,10 @@ Takes arguments START and END which delimit the region to
propertize."
(and identifier (group "::"))))
(1 "_")
(2 "_"))
- ;; embedded comments, like #|{ ... }
- ((rx "#" (any "`|="))
- (0 (ignore (with-syntax-table perl6-bracket-syntax-table
- (perl6-syntax-propertize-delimiters "!" -2)))))
- ;; regular end-of-line comments
- ((rx "#" (0+ not-newline))
- (0 (ignore)))
+ ;; comments
+ ((rx "#")
+ (0 (ignore (if (eq (perl6-syntax-context) nil)
+ (perl6-syntax-propertize-comment end)))))
;; postfix hyper operators
((perl6-rx (or identifier "]" ")") (group (or "»" ">>")))
(0 nil))
- [nongnu] elpa/raku-mode 992d8af9de 164/253: add test for private methods, (continued)
- [nongnu] elpa/raku-mode 992d8af9de 164/253: add test for private methods, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 27b90214e3 211/253: Auto insert skeletons., ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 04f458529e 206/253: Rename perl6 -> raku in test files, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode ed816f0ce3 214/253: Add a new item, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 0968a528bb 216/253: Fix wrong slashes., ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 21af6e8398 224/253: Add comment-style highlighting to POD., ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 9fa9e3968e 091/253: pcase is more straightforward than let+cond here, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode aa5078f9cc 112/253: Mention test suite in README.md, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 299099e246 102/253: Simplify variable fontification, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 8ecc3daa40 113/253: Expand comment, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 6d4ef1743a 118/253: More robust comment highlighting,
ELPA Syncer <=
- [nongnu] elpa/raku-mode 07b36e8506 114/253: Amend comment about magic-mode-alist a bit, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 730155c851 103/253: Apply prefix syntax property to sigils and twigils, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 2b5f69ade1 094/253: Fix highlighting of some non-alphanumberic RSXZ metaops, like C«R<», ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode cf09f024a3 099/253: Support some unicode quote delimiters, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 87fdf3d563 085/253: Highlight numbered match variables ($1, $2, ...), ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 2a9e959a24 092/253: Improve highlighting of bracketed strings/comments, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode aa57012ec3 138/253: Minor change to magic pattern, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 4aa7fde34b 134/253: Separate syntax flags, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 3d4a45d644 128/253: No identifiers in comments after recent changes, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 883a60e8ef 127/253: Clean up label pattern, ELPA Syncer, 2022/01/29