]> git.eshelyaron.com Git - emacs.git/commitdiff
CPerl-mode: don't treat <<>> as starting a here-doc
authorHarald Jörg <haj@posteo.de>
Tue, 15 Dec 2020 17:53:03 +0000 (18:53 +0100)
committerStefan Kangas <stefan@marxist.se>
Wed, 16 Dec 2020 15:31:02 +0000 (16:31 +0100)
* lisp/progmodes/cperl-mode.el (cperl-find-pods-heres): Detect
the "<<>>" operator (Bug#42455).

* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test-bug-45255): Verify that <<>> does not start a
HERE-doc.

lisp/progmodes/cperl-mode.el
test/lisp/progmodes/cperl-mode-tests.el

index 5cf40fe959aaa0d107b2eba1462c172e9e630572..15987a3b9b163e10640adb72a79465dc75e60003 100644 (file)
@@ -3694,13 +3694,14 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
               ;;    ;; "\\([^= \t0-9$@%&]\\|[ \t]+[^ \t\n0-9$@%&]\\)" ; 6 + 1
               ;;    "\\(\\)"           ; To preserve count of pars :-( 6 + 1
               ;;  "\\)"
-              ((match-beginning 3)     ; 2 + 1
+              ((match-beginning 3)     ; 2 + 1: found "<<", detect its type
                (setq b (point)
                      tb (match-beginning 0)
                      c (and            ; not HERE-DOC
                         (match-beginning 6)
                         (save-match-data
                           (or (looking-at "[ \t]*(") ; << function_call()
+                              (looking-at ">>")      ; <<>> operator
                               (save-excursion ; 1 << func_name, or $foo << 10
                                 (condition-case nil
                                     (progn
index 896160bb88359a2119a135f13e9eae019c7b901d..cb2d067a61061eb98fd19ae164eb7e4322dff6ef 100644 (file)
@@ -312,4 +312,12 @@ have a face property."
   (let ((code "{ $a- / $b } # /"))
     (should (equal (nth 8 (cperl-test-ppss code "/")) 7))))
 
+(ert-deftest cperl-test-bug-45255 ()
+  "Verify that \"<<>>\" is recognized as not starting a HERE-doc."
+  (let ((code (concat "while (<<>>) {\n"
+                      "   ...;\n"
+                      "}\n")))
+    ;; The yadda-yadda operator should not be in a string.
+    (should (equal (nth 8 (cperl-test-ppss code "\\.")) nil))))
+
 ;;; cperl-mode-tests.el ends here