diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-07-30 23:19:13 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-07-30 23:19:13 +0200 |
commit | 28ccebc469d90664106fcc1cb73d7321c4b60716 (patch) | |
tree | b7b7698a545a537ffdff256440c9aa5c5f1a6daf /toke.c | |
parent | 8cf77941f2751a20a52ac4bbbcff354f82ac4c91 (diff) | |
download | perl-28ccebc469d90664106fcc1cb73d7321c4b60716.tar.gz |
Add new error "Can't use keyword '%s' as a label"
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -5275,17 +5275,20 @@ Perl_yylex(pTHX) while (d < PL_bufend && isSPACE(*d)) d++; /* no comments skipped here, or s### is misparsed */ - /* Check for keywords */ - tmp = keyword(PL_tokenbuf, len, 0); - /* 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); } + else + /* Check for keywords */ + tmp = keyword(PL_tokenbuf, len, 0); /* Is this a word before a => operator? */ if (*d == '=' && d[1] == '>') { |