In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/12d22d1fe17e8471834a01cd417792ac5c022d62?hp=ecd53122b3f30475da92b2d8c5c741e1d28cc863>

- Log -----------------------------------------------------------------
commit 12d22d1fe17e8471834a01cd417792ac5c022d62
Author: James E Keenan <[email protected]>
Date:   Sat Sep 13 08:51:48 2014 -0400

    Semicolon before ellipsis inside block disambiguates.
    
    Correct documentation which indicated that, inside a block, a semicolon 
after
    an ellipsis statement would disambiguate between a block and a hash 
reference
    constructor.  The semicolon must precede the ellipsis to perform this
    disambiguation.
    
    Add tests to demonstrate that whitespace around the ellipsis statement does
    not impeded the disambiguation.  Add perldelta entry.
    
    For: RT #122661
-----------------------------------------------------------------------

Summary of changes:
 pod/perldelta.pod |  5 +++++
 pod/perlsyn.pod   | 11 +++++------
 t/op/yadayada.t   | 31 ++++++++++++++++++++++++++++---
 3 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index d15e786..4418bba 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -226,6 +226,11 @@ section.
 
 XXX Description of the change here
 
+=item *
+
+L<perlsyn>: An ambiguity in the documentation of the Ellipsis statement has
+been corrected. [perl #122661]
+
 =back
 
 =head1 Diagnostics
diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod
index cea4d50..73421a4 100644
--- a/pod/perlsyn.pod
+++ b/pod/perlsyn.pod
@@ -788,14 +788,13 @@ syntax error if Perl doesn't guess that the C<{ ... }> is 
a block.  In that
 case, it doesn't think the C<...> is an ellipsis because it's expecting an
 expression instead of a statement:
 
-    @transformed = map { ... } @input;  # syntax error
+    @transformed = map { ... } @input;    # syntax error
 
-You can use a C<;> inside your block to denote that the C<{ ...  }> is a
-block and not a hash reference constructor.  Now the ellipsis works:
+Inside your block, you can use a C<;> before the ellipsis to denote that the
+C<{ ... }> is a block and not a hash reference constructor.  Now the ellipsis
+works:
 
-    @transformed = map {; ... } @input; # ; disambiguates
-
-    @transformed = map { ...; } @input; # ; disambiguates
+    @transformed = map {; ... } @input;   # ';' disambiguates
 
 Note: Some folks colloquially refer to this bit of punctuation as a
 "yada-yada" or "triple-dot", but its true name
diff --git a/t/op/yadayada.t b/t/op/yadayada.t
index 770a51e..a213bec 100644
--- a/t/op/yadayada.t
+++ b/t/op/yadayada.t
@@ -8,14 +8,39 @@ BEGIN {
 
 use strict;
 
-plan 5;
+plan 9;
 
-my $err = "Unimplemented at $0 line " . ( __LINE__ + 2 ) . ".\n";
+my $err;
+my $err1 = "Unimplemented at $0 line ";
+my $err2 = ".\n";
 
+$err = $err1 . ( __LINE__ + 1 ) . $err2;
 eval { ... };
+is $@, $err, "Execution of ellipsis statement reported 'Unimplemented' code";
+$@ = '';
 
-is $@, $err;
+note("RT #122661: Semicolon before ellipsis statement disambiguates to 
indicate block rather than hash reference");
+my @input = (3..5);
+my @transformed;
+$err = $err1 . ( __LINE__ + 1 ) . $err2;
+eval { @transformed = map {; ... } @input; };
+is $@, $err, "Disambiguation case 1";
+$@ = '';
 
+$err = $err1 . ( __LINE__ + 1 ) . $err2;
+eval { @transformed = map {;...} @input; };
+is $@, $err, "Disambiguation case 2";
+$@ = '';
+
+$err = $err1 . ( __LINE__ + 1 ) . $err2;
+eval { @transformed = map {; ...} @input; };
+is $@, $err, "Disambiguation case 3";
+$@ = '';
+
+$err = $err1 . ( __LINE__ + 1 ) . $err2;
+eval { @transformed = map {;... } @input; };
+is $@, $err, "Disambiguation case 4";
+$@ = '';
 
 #
 # Regression tests, making sure ... is still parsable as an operator.

--
Perl5 Master Repository

Reply via email to