summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-08-18 09:53:11 +0100
committerDavid Mitchell <davem@iabyn.com>2016-08-18 18:55:09 +0100
commit49fb862041f1f74fafbc91afa553624c43078261 (patch)
tree8cd973987dc238b0111a66e1232286ebde339f5e /pad.c
parent0cf18b74ec1005ca929e64dd9158674d5163ff0a (diff)
downloadperl-49fb862041f1f74fafbc91afa553624c43078261.tar.gz
signatures: eliminate XSIGVAR, add KEY_sigvar
When I moved subroutine signature processing into perly.y with v5.25.3-101-gd3d9da4, I added a new lexer PL_expect state, XSIGVAR. This indicated, when about to parse a variable, that it was a signature element rather than a my variable; in particular, it makes ($,...) be toked as the lone sigil '$' rather than the punctuation variable '$,'. However this is a bit heavy-handled; so instead this commit adds a new allowed pseudo-keyword value to PL_in_my: as well as KEY_my, KEY_our and KEY_state, it can now be KEY_sigvar. This is a less intrusive change to the lexer.
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pad.c b/pad.c
index 9773a25e8d..a41d2c7491 100644
--- a/pad.c
+++ b/pad.c
@@ -898,7 +898,10 @@ S_pad_check_dup(pTHX_ PADNAME *name, U32 flags, const HV *ourstash)
/* diag_listed_as: "%s" variable %s masks earlier declaration in same %s */
Perl_warner(aTHX_ packWARN(WARN_MISC),
"\"%s\" %s %"PNf" masks earlier declaration in same %s",
- (is_our ? "our" : PL_parser->in_my == KEY_my ? "my" : "state"),
+ ( is_our ? "our" :
+ PL_parser->in_my == KEY_my ? "my" :
+ PL_parser->in_my == KEY_sigvar ? "my" :
+ "state" ),
*PadnamePV(sv) == '&' ? "subroutine" : "variable",
PNfARG(sv),
(COP_SEQ_RANGE_HIGH(sv) == PERL_PADSEQ_INTRO