summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-04-27 21:07:29 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-04-27 21:07:29 +0000
commit1c3923b3a96ff7f6cc3c12f9f8554b36d12daf1b (patch)
treedd1a34668db53ec127da52a0c2d831fa9340c2cc /toke.c
parent88c74d4bc751d901cc16d8775bf5f51c45cc0228 (diff)
downloadperl-1c3923b3a96ff7f6cc3c12f9f8554b36d12daf1b.tar.gz
autoquote barewords followed by newline and arrow properly
(variant of fix suggested by Rick Delaney and M.J.T. Guy) p4raw-id: //depot/perl@5977
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/toke.c b/toke.c
index 2035c3f1d9..7d4e937aa1 100644
--- a/toke.c
+++ b/toke.c
@@ -3619,7 +3619,7 @@ Perl_yylex(pTHX)
tmp = keyword(PL_tokenbuf, len);
/* Is this a word before a => operator? */
- if (strnEQ(d,"=>",2)) {
+ if (*d == '=' && d[1] == '>') {
CLINE;
yylval.opval = (OP*)newSVOP(OP_CONST, 0, newSVpv(PL_tokenbuf,0));
yylval.opval->op_private = OPpCONST_BARE;
@@ -3774,10 +3774,18 @@ Perl_yylex(pTHX)
}
}
- /* If followed by a paren, it's certainly a subroutine. */
PL_expect = XOPERATOR;
s = skipspace(s);
+
+ /* Is this a word before a => operator? */
+ if (*s == '=' && s[1] == '>') {
+ CLINE;
+ sv_setpv(((SVOP*)yylval.opval)->op_sv, PL_tokenbuf);
+ TERM(WORD);
+ }
+
+ /* If followed by a paren, it's certainly a subroutine. */
if (*s == '(') {
CLINE;
if (gv && GvCVu(gv)) {