[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 87bd14c: ; perl-mode.el: Allow newline between quote-likes and de
From: |
Harald Jrg |
Subject: |
master 87bd14c: ; perl-mode.el: Allow newline between quote-likes and delimiter |
Date: |
Fri, 11 Jun 2021 07:55:52 -0400 (EDT) |
branch: master
commit 87bd14ca8bdecda6964aeb3c323faee846a8c1b8
Author: Harald Jörg <haj@posteo.de>
Commit: Harald Jörg <haj@posteo.de>
; perl-mode.el: Allow newline between quote-likes and delimiter
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function):
Allow newline between a quote-like operator and its delimiter
(Bug#22355).
* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-22355):
Test case for the fix.
* test/lisp/progmodes/cperl-mode-resources/cperl-bug-22355.pl:
Test resource for a quote-like with newline before the delimiter.
---
lisp/progmodes/perl-mode.el | 2 +-
.../lisp/progmodes/cperl-mode-resources/cperl-bug-22355.pl | 14 ++++++++++++++
test/lisp/progmodes/cperl-mode-tests.el | 11 +++++++++++
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index a208876..f49ee4c 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -285,7 +285,7 @@
(put-text-property (match-beginning 2) (match-end 2)
'syntax-table (string-to-syntax "\""))
(perl-syntax-propertize-special-constructs end)))))
- ("\\(^\\|[?:.,;=|&!~({[
\t]\\|=>\\)\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\s-*\\(?:\\([^])}>=
\n\t]\\)\\|\\(?3:=\\)[^>]\\)"
+ ("\\(^\\|[?:.,;=|&!~({[
\t]\\|=>\\)\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\(?:\\s-\\|\n\\)*\\(?:\\([^])}>=
\n\t]\\)\\|\\(?3:=\\)[^>]\\)"
;; Nasty cases:
;; /foo/m $a->m $#m $m @m %m
;; \s (appears often in regexps).
diff --git a/test/lisp/progmodes/cperl-mode-resources/cperl-bug-22355.pl
b/test/lisp/progmodes/cperl-mode-resources/cperl-bug-22355.pl
new file mode 100644
index 0000000..f54d552
--- /dev/null
+++ b/test/lisp/progmodes/cperl-mode-resources/cperl-bug-22355.pl
@@ -0,0 +1,14 @@
+# The source file contains non-ASCII characters, supposed to be saved
+# in UTF-8 encoding. Tell Perl about that, just in case.
+use utf8;
+
+# Following code is the example from the report Bug#22355 which needed
+# attention in perl-mode.
+
+printf qq
+{<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+ <Document>
+ <Folder><name>台灣 %s 廣播電台</name>
+ <description><![CDATA[http://radioscanningtw.wikia.com/wiki/台描:地圖
%d-%02d-%02d]]></description>
+}, uc( substr( $ARGV[0], 0, 2 ) ), $year + 1900, $mon + 1, $mday;
diff --git a/test/lisp/progmodes/cperl-mode-tests.el
b/test/lisp/progmodes/cperl-mode-tests.el
index dcf4f39..4d2bac6 100644
--- a/test/lisp/progmodes/cperl-mode-tests.el
+++ b/test/lisp/progmodes/cperl-mode-tests.el
@@ -377,6 +377,17 @@ documentation it does the right thing anyway."
(cperl-indent-command)
(forward-line 1))))
+(ert-deftest cperl-test-bug-22355 ()
+ "Verify that substitutions are fontified directly after \"|&\".
+Regular expressions are strings in both perl-mode and cperl-mode."
+ (with-temp-buffer
+ (insert-file-contents (ert-resource-file "cperl-bug-22355.pl"))
+ (funcall cperl-test-mode)
+ (goto-char (point-min))
+ ;; Just check for the start of the string
+ (search-forward "{")
+ (should (nth 3 (syntax-ppss)))))
+
(ert-deftest cperl-test-bug-23992 ()
"Verify that substitutions are fontified directly after \"|&\".
Regular expressions are strings in both perl-mode and cperl-mode."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 87bd14c: ; perl-mode.el: Allow newline between quote-likes and delimiter,
Harald Jrg <=