[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/raku-mode 2a9e959a24 092/253: Improve highlighting of brac
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/raku-mode 2a9e959a24 092/253: Improve highlighting of bracketed strings/comments |
Date: |
Sat, 29 Jan 2022 08:28:45 -0500 (EST) |
branch: elpa/raku-mode
commit 2a9e959a24ba638aff11fcf3f3ebbddb0a0399ec
Author: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Commit: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Improve highlighting of bracketed strings/comments
Now we won't try to add syntax properties to <foo> strings inside
comments.
We now pay attention to backslashes when looking for the closing
delimiter or nested opening/closing delimiters.
---
perl6-font-lock.el | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/perl6-font-lock.el b/perl6-font-lock.el
index b6e4816d8d..90bc64544a 100644
--- a/perl6-font-lock.el
+++ b/perl6-font-lock.el
@@ -292,21 +292,24 @@ Skips over any nested balanced brackets.
OPEN and CLOSE are the bracketing characters (e.g. ?< and ?>).
LENGTH is the length of the brackets (e.g. 2 for a <<foo>>)."
- (let ((pattern (rx-to-string `(or (group (= ,length ,open))
- (group (= ,length ,close)))))
+ (let ((pattern (rx-to-string `(and (group (0+ "\\"))
+ (or (group (= ,length ,open))
+ (group (= ,length ,close))))))
(found-closing nil)
(depth 1))
(while (and (not found-closing)
(< (point) (point-max)))
(re-search-forward pattern (point-max) 'noerror)
- (cond ((match-string 1)
- (if (looking-at (rx-to-string open))
- (re-search-forward (rx-to-string `(1+ ,open)))
- (setq depth (1+ depth))))
- ((match-string 2)
- (setq depth (1- depth))
- (when (eq depth 0)
- (setq found-closing t)))))))
+ (when (or (not (match-string 1))
+ (= 0 (% (length (match-string 1)) 2)))
+ (cond ((match-string 2)
+ (if (looking-at (rx-to-string open))
+ (re-search-forward (rx-to-string `(1+ ,open)))
+ (setq depth (1+ depth))))
+ ((match-string 3)
+ (setq depth (1- depth))
+ (when (eq depth 0)
+ (setq found-closing t))))))))
(defun perl6-syntax-propertize-embedded-comment ()
"Add syntax properties to embedded comments \(#`<<foo>>\)."
@@ -384,6 +387,8 @@ Takes arguments START and END which delimit the region to
propertize."
(0 "_"))
((rx "#" (any "`|="))
(0 (ignore (perl6-syntax-propertize-embedded-comment))))
+ ((rx "#" (0+ not-newline))
+ (0 (ignore)))
((perl6-rx (or set-operator rsxz-operator))
(0 (ignore (perl6-add-font-lock-hint 'perl6-metaoperator 0))))
((rx (1+ (char "<«")))
- [nongnu] elpa/raku-mode 9fa9e3968e 091/253: pcase is more straightforward than let+cond here, (continued)
- [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, 2022/01/29
- [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 <=
- [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
- [nongnu] elpa/raku-mode c8e8ebe289 150/253: fix the range of choices more completely, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 8319cebe75 147/253: remove imenu item, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode fbac3c871d 196/253: Merge branch 'repl' of github.com:matiaslina/perl6-mode into repl, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 92c9915396 160/253: More fixes for highlighting of angled strings, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode cf8119a28a 184/253: add reference for indentation support, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 5b9c5b29b6 179/253: List link to original author's code, ELPA Syncer, 2022/01/29