bug#47598: cperl-mode: Highlighting confused with ternary and -x [PATCH]
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.