diff options
author | Jan Dubois <jand@activestate.com> | 2010-03-02 16:24:23 -0800 |
---|---|---|
committer | Jan Dubois <jand@activestate.com> | 2010-03-02 22:24:37 -0800 |
commit | 10517af500e340b88209d95ddbb26f6252464272 (patch) | |
tree | 12d03dce1d8f7d0e01a07f007647b91797d0f7e6 | |
parent | c06820fb26255c7ec0b8366ded45c6d7f2caf6b1 (diff) | |
download | perl-10517af500e340b88209d95ddbb26f6252464272.tar.gz |
Revert "Forbid labels with keyword names"
This reverts commit f71d6157c7933c0d3df645f0411d97d7e2b66b2f.
Revert "Add new error "Can't use keyword '%s' as a label""
This reverts commit 28ccebc469d90664106fcc1cb73d7321c4b60716.
-rw-r--r-- | pod/perldiag.pod | 5 | ||||
-rw-r--r-- | pod/perltodo.pod | 9 | ||||
-rw-r--r-- | t/comp/colon.t | 6 | ||||
-rw-r--r-- | toke.c | 2 |
4 files changed, 12 insertions, 10 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index fbbf907f4f..f0695ea174 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -1159,11 +1159,6 @@ that is already inside a group with a byte-order modifier. For example you cannot force little-endianness on a type that is inside a big-endian group. -=item Can't use keyword '%s' as a label - -(F) You attempted to use a reserved keyword, such as C<print> or C<BEGIN>, -as a statement label. This is disallowed since Perl 5.11.0. - =item Can't use "my %s" in sort comparison (F) The global variables $a and $b are reserved for sort comparisons. diff --git a/pod/perltodo.pod b/pod/perltodo.pod index 56d5045205..d9d0807762 100644 --- a/pod/perltodo.pod +++ b/pod/perltodo.pod @@ -920,6 +920,15 @@ also the warning messages (see L<perllexwarn>, C<warnings.pl>). These tasks would need C knowledge, and knowledge of how the interpreter works, or a willingness to learn. +=head2 forbid labels with keyword names + +Currently C<goto keyword> "computes" the label value: + + $ perl -e 'goto print' + Can't find label 1 at -e line 1. + +It would be nice to forbid labels with keyword names, to avoid confusion. + =head2 truncate() prototype The prototype of truncate() is currently C<$$>. It should probably diff --git a/t/comp/colon.t b/t/comp/colon.t index 91b2e3667c..e43af3b8e2 100644 --- a/t/comp/colon.t +++ b/t/comp/colon.t @@ -122,14 +122,14 @@ ok 22, (not eval "y:1" and not eval "y:echo: eq y|echo|" and eval "y:echo:ohce: >= 0"); -ok 23, (not eval "AUTOLOAD:1" and +ok 23, (eval "AUTOLOAD:1" and not eval "AUTOLOAD:echo: eq AUTOLOAD|echo|" and not eval "AUTOLOAD:echo:ohce: >= 0"); -ok 24, (not eval "and:1" and +ok 24, (eval "and:1" and not eval "and:echo: eq and|echo|" and not eval "and:echo:ohce: >= 0"); -ok 25, (not eval "alarm:1" and +ok 25, (eval "alarm:1" and not eval "alarm:echo: eq alarm|echo|" and not eval "alarm:echo:ohce: >= 0"); @@ -6143,8 +6143,6 @@ Perl_yylex(pTHX) /* Is this a label? */ if (!anydelim && PL_expect == XSTATE && d < PL_bufend && *d == ':' && *(d + 1) != ':') { - if (tmp) - Perl_croak(aTHX_ "Can't use keyword '%s' as a label", PL_tokenbuf); s = d + 1; pl_yylval.pval = CopLABEL_alloc(PL_tokenbuf); CLINE; |