branch: elpa/raku-mode
commit a01e71cde720e2e2575a37e0f126cfeb5d732e10
Author: Hinrik Örn Sigurðsson <[email protected]>
Commit: Hinrik Örn Sigurðsson <[email protected]>
Avoid highlighting numbers and type constraints in strings/comments
---
perl6-font-lock.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/perl6-font-lock.el b/perl6-font-lock.el
index 7b801951c3..8c0c446517 100644
--- a/perl6-font-lock.el
+++ b/perl6-font-lock.el
@@ -435,8 +435,13 @@ GROUPS is allowed to reference optional match groups."
(let ((group-num (car group))
(group-face (cdr group)))
(when (match-string group-num)
- (put-text-property (match-beginning group-num) (match-end group-num)
- 'face group-face)))))
+ (let* ((state (save-excursion
+ (syntax-ppss (match-beginning group-num))))
+ (in-string (nth 3 state))
+ (in-comment (nth 4 state)))
+ (unless (or in-string in-comment)
+ (put-text-property (match-beginning group-num) (match-end
group-num)
+ 'face group-face)))))))
(defun perl6-match-property (property context limit)
(when (symbolp context)