Subject: bug#42168: 26.1; cperl-mode: Bad interpretation of $a++ / $b

From: Eli Zaretskii <[email-masked]>
Date: Sat, 11 Jul 2020 12:53:49 +0300

> From: Harald Jörg <[email-masked]>
> Date: Thu, 2 Jul 2020 20:19:21 +0200
> 
> How to reproduce:
> In a buffer, activate cperl-mode (M-x cperl-mode), then enter:
> 
> $a++ / $b;
> 
> This is supposed to be a division.  However, cperl-mode interprets the
> slash as the start of a regular expression.  Accordingly, the following
> text is displayed with the wrong face, and also cperl-mode might
> complain that it can't find the end of the regular expression.
> 
> Emacs does not crash.
> 
> Attached: A patch which fixes the issue for $a++ and $a--, and also
> includes a test to verify that the very similar text "$a+ / $b" is still
> correctly interpreted as a regular expression.

Thanks.

To accept a substantial contribution such as this one, we will need
you to assign the copyright of your code to the FSF.  If you are okay
with starting your legal paperwork, I will send you the form to sign
and email.

Thank you for your interest in Emacs.