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

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

[nongnu] elpa/raku-mode 3cf99d162f 088/253: Treat backslashes outside st


From: ELPA Syncer
Subject: [nongnu] elpa/raku-mode 3cf99d162f 088/253: Treat backslashes outside strings as punctuation
Date: Sat, 29 Jan 2022 08:28:45 -0500 (EST)

branch: elpa/raku-mode
commit 3cf99d162f054f6a7cc3515e42a7792175bba402
Author: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Commit: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>

    Treat backslashes outside strings as punctuation
    
    This makes SMIE not choke on backslashes when indenting.
---
 perl6-font-lock.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/perl6-font-lock.el b/perl6-font-lock.el
index 441786b472..1b79c44244 100644
--- a/perl6-font-lock.el
+++ b/perl6-font-lock.el
@@ -343,6 +343,14 @@ OPEN-ANGLES is the opening delimiter (e.g. \"«\" or 
\"<<\")."
             (put-text-property quote-end (1+ quote-end)
                                'syntax-table (string-to-syntax "|"))))))))
 
+(defun perl6-syntax-propertize-backslash ()
+  (let* ((state (syntax-ppss))
+            (in-string (nth 3 state))
+            (in-comment (nth 4 state)))
+    (unless (or in-string in-comment)
+      (put-text-property (match-beginning 0) (match-end 0)
+                         'syntax-table (string-to-syntax ".")))))
+
 (defun perl6-add-font-lock-hint (property &optional group)
   (let ((beg (match-beginning (or group 1)))
         context)
@@ -370,7 +378,9 @@ Takes arguments START and END which delimit the region to 
propertize."
       ((perl6-rx (or set-operator rsxz-operator))
        (0 (ignore (perl6-add-font-lock-hint 'perl6-metaoperator 0))))
       ((rx (1+ (char "<«")))
-       (0 (ignore (perl6-syntax-propertize-angles (match-string 0))))))
+       (0 (ignore (perl6-syntax-propertize-angles (match-string 0)))))
+      ((rx "\\")
+       (0 (ignore (perl6-syntax-propertize-backslash)))))
       start end)))
 
 (defun perl6-font-lock-syntactic-face (state)



reply via email to

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