[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#47598: cperl-mode: Highlighting confused with ternary and -x [PATCH]
From: |
Harald Jörg |
Subject: |
bug#47598: cperl-mode: Highlighting confused with ternary and -x [PATCH] |
Date: |
Tue, 06 Apr 2021 20:33:07 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
E. Choroba writes:
> When combining the ternary operator with file tests using the default
> argument, cperl-mode gets confused.
>
> For example:
>
> my $f = -f ? 'file'
> : -l ? [readlink]
> : -d ? 'dir'
> : 'unknown';
>
> It seems to think the ?'s are not part of a ternary operator, but
> rather a match-once operator. ...
Exactly, that is what is happening here.
> ... Note that m?? without m results in a
> syntax error since Perl 5.22.
Because of that it seems appropriate to stop dealing with bare ?foo?
altogether. So, the patch eliminates the recognition of bare ?foo?, and
also deletes the corresponding lines from CPerl's builtin short
documentation. The test in the patch uses the text from the bug report,
and also checks that m?foo? is still processed as a regular expression,
and a bare ?foo? isn't.
--
Cheers,
haj
0001-cperl-mode-Eliminate-bad-interpretation-of-foo-bug-4.patch
Description: Don't support ?foo?