This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #133850) fix parsing hints for print $fh "foo" in s///e
authorTony Cook <tony@develop-help.com>
Tue, 19 Feb 2019 04:38:39 +0000 (15:38 +1100)
committerTony Cook <tony@develop-help.com>
Tue, 11 Jun 2019 06:08:36 +0000 (16:08 +1000)
commiteec88220688fefa843e3f46b6b454fe090ee7568
treef479e1e3d5b3eaf08e92245282ce9a2759e69a91
parent2fe0d7f40a94163d6c242c3e695fdcd19e387422
(perl #133850) fix parsing hints for print $fh "foo" in s///e

The replacement code in s///e is parsed using a sublex, similarly
to double-quotish replacement.

The code that handles C< $id > tries to detect what the next token
should be, but only special cased code similar to C< print $fh ... >
in a non-sublex, so s/../print $fh $1/e set PL_expect to XOPERATOR
which caused the parser to complain when the $1 wasn't an operator.

The fix here handles two cases:

 s/.../code here/e

In this case the code is inserted into a do {} block like:

  do { code here }

so PL_lex_brackets ends up non-zero.

The second case is code like:

  "xxx${code here}"

which had the same problem, which this also fixes.
t/lib/warnings/toke
toke.c