develooper Front page | perl.perl5.porters | Postings from February 2019

[perl #133825] expression "... unless $condition" is broken in 5.28+

From:
James E Keenan via RT
Date:
February 5, 2019 13:46
Subject:
[perl #133825] expression "... unless $condition" is broken in 5.28+
Message ID:
rt-4.0.24-11150-1549374373-1465.133825-15-0@perl.org
On Tue, 05 Feb 2019 12:32:00 GMT, the.dmol@yandex.by wrote:
> This is a bug report for perl from the.dmol@yandex.by,
> generated with the help of perlbug 1.41 running under perl 5.28.0.
> 
> 
> -----------------------------------------------------------------
> 
> The script:
> 
> my $x = 11;
> ... unless $x;
> 
> Leads to error: syntax error at /tmp/1.pl line 3, near "... unless"
> 
> In the community it is said that it works fine with perl 5.26,
> 5.18; however it has the same failure on perl 5.19.2.
> 

Bisection results:

#####
29d69c3c41c7e93f884256b1087face64d5fdd1e is the first bad commit
commit 29d69c3c41c7e93f884256b1087face64d5fdd1e
Author: Zefram <zefram@fysh.org>
Date:   Fri Nov 10 02:07:46 2017 +0000

parse yada-yada only as a statement

Commit f5727a1c71878a34f6255eb1a506c0b21af7d36f tried to make yada-yada be parsed consistently as a term expression, but actually things are more complicated than that.  The tokeniser didn't accept yada-yada in the right contexts to make it usable as an expression, and changing that would require decisions on resolving ambiguities between yada-yada and flip-flop.  It's also documented as being a statement rather than an expression, though with some incorrect information about ambiguities.

Overall it looks more like the intent was for yada-yada to be a statement.  This commit makes it grammatically treated as such, and also fixes up the dubious parts of the documentation.  [perl #132150]

:100644 100644 bd778164b46127635824789e3342c6c0231bfec5 e5baa09042f1310c3387467d092d412f9fa5dd93 M	perly.act
:100644 100644 121fa1d97884458ca77467331b8bfcd6f6810cb9 43b8885f13257de05810e9eac067b55090695cdc M	perly.h
:100644 100644 796c9d790b1a1ec56afb92109a430bba219f6e62 bf47bc3815240bc7f22385a08dfabdd4c652ce0d M	perly.tab
:100644 100644 56e34da7b4cc4cc9547afd541c297d4146e0f2c4 0a7c30c0421c0f3e9a531caf13c6115429e2a03f M	perly.y
:040000 040000 e7c7155568b9ce588ebb1b3b3a953831c6453e06 e60b2f99b77d7136147d09ab52d477c61c18fc25 M	pod
:040000 040000 1e7f43b0720982ee94673a2ce945b46d0945d0f4 d7d743638312e071fc6ea99049468da4879bcac7 M	t
:100644 100644 79df0bcbc52f49f513786b013375684bd5bdff6f 18eda7a3c10a736670e269ad2481eec070d1d526 M	toke.c

#####

Thank you very much.
-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=133825



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About