From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: haj@posteo.de (Harald =?UTF-8?Q?J=C3=B6rg?=) Newsgroups: gmane.emacs.bugs Subject: bug#45255: [PATCH] cperl-mode: Don't mistreat <<>> as starting a here-doc Date: Tue, 15 Dec 2020 18:55:07 +0100 Message-ID: <87wnxjar9g.fsf@hajtower> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3842"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: 45255@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 15 19:29:37 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpF4q-0000uU-5C for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Dec 2020 19:29:36 +0100 Original-Received: from localhost ([::1]:40964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpF4o-0007V8-6u for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Dec 2020 13:29:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpEYM-0004D8-83 for bug-gnu-emacs@gnu.org; Tue, 15 Dec 2020 12:56:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47495) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpEYL-0001o5-Vg for bug-gnu-emacs@gnu.org; Tue, 15 Dec 2020 12:56:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kpEYL-00084o-TR for bug-gnu-emacs@gnu.org; Tue, 15 Dec 2020 12:56:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: haj@posteo.de (Harald =?UTF-8?Q?J=C3=B6rg?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Dec 2020 17:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45255 X-GNU-PR-Package: emacs Original-Received: via spool by 45255-submit@debbugs.gnu.org id=B45255.160805491630983 (code B ref 45255); Tue, 15 Dec 2020 17:56:01 +0000 Original-Received: (at 45255) by debbugs.gnu.org; 15 Dec 2020 17:55:16 +0000 Original-Received: from localhost ([127.0.0.1]:59041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kpEXc-00083e-DS for submit@debbugs.gnu.org; Tue, 15 Dec 2020 12:55:16 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:43307) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kpEXa-00083R-Lu for 45255@debbugs.gnu.org; Tue, 15 Dec 2020 12:55:15 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 29FD82400FB for <45255@debbugs.gnu.org>; Tue, 15 Dec 2020 18:55:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1608054908; bh=kdU/xcl9DXqFjwRG+xQblFYGpeeh/cltDI9HMwUo/ok=; h=From:To:Subject:Date:From; b=OjgEA+krNewRNRh/7Dx0UUipd11Vmg2crhGJzKuHMVSxVge8Vj4M7inVDrmS3kujN Juzw+crhq34vl7Y0FOyS4wNs9Ymi0MH3ThGHzOSZUgH6ghnvMKwgHb1x6DTNKYmjAY tcd97B4nchgoGXO+EAmBhuMeK2pGgdOu4+Dw2uAiN+zhEUl1aQureOQ8RvFW3E0Saf tepWwrQ/J4EQ2dy6EAu5Qiq6a4Gn1K/+n/MZynAM/QPbdwcIbHmCDM0Scpij0xupCw w/5sdInRITb5R9haF0E0KmrWDYnDYqJ5Y+PRlwSvVKZu5+rgm1EIyaNf6J/TDyki51 6ZUPGr8hHUlog== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4CwQrq4Zqdz9rxb for <45255@debbugs.gnu.org>; Tue, 15 Dec 2020 18:55:07 +0100 (CET) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:196172 Archived-At: --=-=-= Content-Type: text/plain The patch includes "<<>>" in the list of checks for stuff which does not start a here-doc after "<<", and adds a test. -- Cheers, haj --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-CPerl-mode-don-t-treat-as-starting-a-here-doc.patch Content-Description: Don't treat <<>> as here-doc >From 80c7ba0cb9ffc71b5d3ebd389f668d1c8fd86462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20J=C3=B6rg?= Date: Tue, 15 Dec 2020 18:53:03 +0100 Subject: [PATCH] ; CPerl-mode: don't treat <<>> as starting a here-doc * 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 | 3 ++- test/lisp/progmodes/cperl-mode-tests.el | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index ae839a6622..a9edb42b15 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -3694,13 +3694,14 @@ cperl-find-pods-heres ;; ;; "\\([^= \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 diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 896160bb88..cb2d067a61 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -312,4 +312,12 @@ cperl-test-bug-42168 (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 -- 2.20.1 --=-=-=--