summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2015-08-24 11:46:35 +1000
committerTony Cook <tony@develop-help.com>2015-08-27 14:00:05 +1000
commite6b2cf838e87ec34b3a2043c947b4f723d6efcca (patch)
tree72bbf1f7460d40c7d2a4d39543e646e0e146c7fe /toke.c
parenta9b708ba5552bfe8ce5d5a0291df60aca3b2e883 (diff)
downloadperl-e6b2cf838e87ec34b3a2043c947b4f723d6efcca.tar.gz
[perl #125341] check for unexpected trash after any sub start
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index d30bfe69da..9e332fc290 100644
--- a/toke.c
+++ b/toke.c
@@ -8102,7 +8102,13 @@ Perl_yylex(pTHX)
if (*s == ':' && s[1] != ':')
PL_expect = attrful;
- else if ((*s != '{' && *s != '(') && key == KEY_sub) {
+ else if ((*s != '{' && *s != '(') && key != KEY_format) {
+ assert(key == KEY_sub || key == KEY_AUTOLOAD ||
+ key == KEY_DESTROY || key == KEY_BEGIN ||
+ key == KEY_UNITCHECK || key == KEY_CHECK ||
+ key == KEY_INIT || key == KEY_END ||
+ key == KEY_my || key == KEY_state ||
+ key == KEY_our);
if (!have_name)
Perl_croak(aTHX_ "Illegal declaration of anonymous subroutine");
else if (*s != ';' && *s != '}')