diff options
author | Zefram <zefram@fysh.org> | 2017-12-06 00:09:42 +0000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2017-12-06 00:09:42 +0000 |
commit | f68519ee3f12e5ba41a022ef88ce3d6c3901807f (patch) | |
tree | d28e0491a89f13c137a35d52c17fb0f6e37af773 /perly.y | |
parent | 84ac76a7475419f4ac6e5a6935522f7b7ebb0e2c (diff) | |
download | perl-f68519ee3f12e5ba41a022ef88ce3d6c3901807f.tar.gz |
add "whereis"
"whereis" is like "whereso" except that it performs an implicit
smartmatch.
Diffstat (limited to 'perly.y')
-rw-r--r-- | perly.y | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -379,7 +379,13 @@ barestmt: PLUGSTMT parser->copline = (line_t)$1; } | WHERESO '(' remember mexpr ')' mblock - { $$ = block_end($3, newWHERESOOP($4, op_scope($6))); } + { + OP *cond = $4; + if ($1) + cond = newBINOP(OP_SMARTMATCH, 0, newDEFSVOP(), + scalar(cond)); + $$ = block_end($3, newWHERESOOP(cond, op_scope($6))); + } | WHILE '(' remember texpr ')' mintro mblock cont { $$ = block_end($3, @@ -532,7 +538,13 @@ sideff : error { $$ = newFOROP(0, NULL, $3, $1, NULL); parser->copline = (line_t)$2; } | expr WHERESO expr - { $$ = newWHERESOOP($3, op_scope($1)); } + { + OP *cond = $3; + if ($2) + cond = newBINOP(OP_SMARTMATCH, 0, newDEFSVOP(), + scalar(cond)); + $$ = newWHERESOOP(cond, op_scope($1)); + } ; /* else and elsif blocks */ |