X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/bd0ab00df494c0f393ee5623b3a949ae9e0ae15e..d5713896ec:/toke.c diff --git a/toke.c b/toke.c index 658d163..b264279 100644 --- a/toke.c +++ b/toke.c @@ -5278,14 +5278,17 @@ Perl_yylex(pTHX) /* Is this a label? */ if (!tmp && PL_expect == XSTATE && d < PL_bufend && *d == ':' && *(d + 1) != ':') { + tmp = keyword(PL_tokenbuf, len, 0); + 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; TOKEN(LABEL); } - - /* Check for keywords */ - tmp = keyword(PL_tokenbuf, len, 0); + else + /* Check for keywords */ + tmp = keyword(PL_tokenbuf, len, 0); /* Is this a word before a => operator? */ if (*d == '=' && d[1] == '>') {