branch: elpa/raku-mode
commit ec9d721334befa81c782dbf336d33944d2ce024a
Author: Hinrik Örn Sigurðsson <[email protected]>
Commit: Hinrik Örn Sigurðsson <[email protected]>
Simpler approach for double-quote-words
---
perl6-font-lock.el | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/perl6-font-lock.el b/perl6-font-lock.el
index 10c5a8d44b..b060be4f94 100644
--- a/perl6-font-lock.el
+++ b/perl6-font-lock.el
@@ -227,21 +227,6 @@ LENGTH is the length of the brackets (e.g. 2 for a
<<foo>>)."
(put-text-property (- comment-end 1) comment-end
'syntax-table (string-to-syntax "!"))))))))
-(defun perl6-syntax-propertize-dq-words ()
- "Add syntax properties to double-quoted word lists \(«foo $bar baz»\)."
- (with-syntax-table perl6-bracket-syntax-table
- (let* ((quote-beg (match-beginning 0))
- (quote-chars (match-string 0))
- (quote-length (length quote-chars))
- (open-quote (string-to-char (car (split-string quote-chars "" t))))
- (close-quote (matching-paren open-quote)))
- (put-text-property quote-beg (1+ quote-beg) 'syntax-table
(string-to-syntax "|"))
- (perl6-forward-brackets open-quote close-quote quote-length)
- (let ((quote-end (point)))
- (put-text-property quote-beg quote-end 'syntax-multiline t)
- (put-text-property (- quote-end 1) quote-end
- 'syntax-table (string-to-syntax "|"))))))
-
(defun perl6-syntax-propertize (start end)
"Add context-specific syntax properties to code.
@@ -259,8 +244,14 @@ Takes arguments START and END which delimit the region to
propertize."
(0 "_"))
((rx "#`")
(0 (ignore (perl6-syntax-propertize-embedded-comment))))
- ((rx (or "«" "<<"))
- (0 (ignore (perl6-syntax-propertize-dq-words)))))
+ ((rx (group "«") (group (0+ (not-char "»"))) (group "»"))
+ (1 "|")
+ (2 (ignore (put-text-property (match-beginning 2) (match-end 2)
'syntax-multiline t)))
+ (3 "|"))
+ ((rx (group "<") "<" (group (0+ (not-char ">"))) ">" (group ">"))
+ (1 "|")
+ (2 (ignore (put-text-property (match-beginning 2) (match-end 2)
'syntax-multiline t)))
+ (3 "|")))
start end)))
(defun perl6-font-lock-syntactic-face (state)