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

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

[nongnu] elpa/swift-mode d053d31 109/496: Use greedy regex in interpolat


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode d053d31 109/496: Use greedy regex in interpolation highlighting to prevent issues with
Date: Sun, 29 Aug 2021 11:33:17 -0400 (EDT)

branch: elpa/swift-mode
commit d053d31595051c9d4feaf0ec1119f259f8a2a8f9
Author: ap4y <lod@pisem.net>
Commit: ap4y <lod@pisem.net>

    Use greedy regex in interpolation highlighting to prevent issues with
    expression nested in function calls
---
 swift-mode.el           | 4 +---
 test/font-lock-tests.el | 2 ++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/swift-mode.el b/swift-mode.el
index 24bdff4..a1eccc2 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -355,9 +355,7 @@
     (remove-text-properties start end '(swift-interpolation-match-data))
     (funcall
      (syntax-propertize-rules
-      ((rx (or line-start (not (any "\\")))
-           (zero-or-more "\\\\")
-           (group "\\(" (zero-or-more any) ")"))
+      ((rx (group "\\(" (*? any) ")"))
        (0 (ignore (swift-syntax-propertize-interpolation)))))
      start end)))
 
diff --git a/test/font-lock-tests.el b/test/font-lock-tests.el
index 3bdaa4e..d1ddafc 100644
--- a/test/font-lock-tests.el
+++ b/test/font-lock-tests.el
@@ -187,6 +187,8 @@ test will fail."
 (check-face class/base-type-colon-has-default-face/1 nil "class T {{:}} Base")
 
 (check-face string-interpolation/has-variable-face/1 
font-lock-variable-name-face "\"foo {{\\\(bar)}}\"")
+(check-face string-interpolation/has-variable-face/2 
font-lock-variable-name-face "\"{{\\\(bar)}}\"")
+(check-face string-interpolation/after-has-string-face/2 font-lock-string-face 
"\"(foo \\\(bar){{baz}}\")")
 
 (check-face self/has-keyword-face/1 font-lock-keyword-face "{{self}}.foo")
 (check-face super/has-keyword-face/1 font-lock-keyword-face "{{super}}.foo")



reply via email to

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