summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-10-18 20:57:43 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-10-18 20:57:43 +0000
commit7294df96f6c174861cfdbe3e109c745792c2be60 (patch)
treede94cc8b217405f10011ed73905e1cf78426f23f /toke.c
parent4e577f8b7504b9d2fd0f1c34f337e0edce2c4b9b (diff)
downloadperl-7294df96f6c174861cfdbe3e109c745792c2be60.tar.gz
Force _ to be always a bareword after filetest operators
p4raw-id: //depot/perl@25799
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index 4970df8aaf..287aa943fd 100644
--- a/toke.c
+++ b/toke.c
@@ -4272,11 +4272,16 @@ Perl_yylex(pTHX)
/* If not a declared subroutine, it's an indirect object. */
/* (But it's an indir obj regardless for sort.) */
+ /* Also, if "_" follows a filetest operator, it's a bareword */
- if ( !immediate_paren && (PL_last_lop_op == OP_SORT ||
+ if (
+ ( !immediate_paren && (PL_last_lop_op == OP_SORT ||
((!gv || !GvCVu(gv)) &&
(PL_last_lop_op != OP_MAPSTART &&
PL_last_lop_op != OP_GREPSTART))))
+ || (PL_tokenbuf[0] == '_' && PL_tokenbuf[1] == '\0'
+ && ((PL_opargs[PL_last_lop_op] & OA_CLASS_MASK) == OA_FILESTATOP))
+ )
{
PL_expect = (PL_last_lop == PL_oldoldbufptr) ? XTERM : XOPERATOR;
goto bareword;