This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
allow perlbug -ok when STDIN it not a tty
[perl5.git]
/
perly.y
diff --git
a/perly.y
b/perly.y
index
6010a89
..
a1a1f0d
100644
(file)
--- a/
perly.y
+++ b/
perly.y
@@
-1,6
+1,6
@@
/* perly.y
*
/* perly.y
*
- * Copyright (c) 1991-199
4
, Larry Wall
+ * Copyright (c) 1991-199
7
, Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
@@
-17,7
+17,7
@@
#include "perl.h"
static void
#include "perl.h"
static void
-dep()
+dep(
void
)
{
deprecate("\"do\" to call subroutines");
}
{
deprecate("\"do\" to call subroutines");
}
@@
-153,6
+153,9
@@
sideff : error
{ $$ = newLOOPOP(OPf_PARENS, 1, scalar($3), $1); }
| expr UNTIL iexpr
{ $$ = newLOOPOP(OPf_PARENS, 1, $3, $1);}
{ $$ = newLOOPOP(OPf_PARENS, 1, scalar($3), $1); }
| expr UNTIL iexpr
{ $$ = newLOOPOP(OPf_PARENS, 1, $3, $1);}
+ | expr FOR expr
+ { $$ = newFOROP(0, Nullch, $2,
+ Nullop, $3, $1, Nullop); }
;
else : /* NULL */
;
else : /* NULL */
@@
-187,13
+190,13
@@
loop : label WHILE '(' remember mtexpr ')' mblock cont
$$ = block_end($4,
newSTATEOP(0, $1,
newWHILEOP(0, 1, (LOOP*)Nullop,
$$ = block_end($4,
newSTATEOP(0, $1,
newWHILEOP(0, 1, (LOOP*)Nullop,
- $5, $7, $8))); }
+ $
2, $
5, $7, $8))); }
| label UNTIL '(' remember miexpr ')' mblock cont
{ copline = $2;
$$ = block_end($4,
newSTATEOP(0, $1,
newWHILEOP(0, 1, (LOOP*)Nullop,
| label UNTIL '(' remember miexpr ')' mblock cont
{ copline = $2;
$$ = block_end($4,
newSTATEOP(0, $1,
newWHILEOP(0, 1, (LOOP*)Nullop,
- $5, $7, $8))); }
+ $
2, $
5, $7, $8))); }
| label FOR MY remember my_scalar '(' mexpr ')' mblock cont
{ $$ = block_end($4,
newFOROP(0, $1, $2, $5, $7, $9, $10)); }
| label FOR MY remember my_scalar '(' mexpr ')' mblock cont
{ $$ = block_end($4,
newFOROP(0, $1, $2, $5, $7, $9, $10)); }
@@
-206,17
+209,17
@@
loop : label WHILE '(' remember mtexpr ')' mblock cont
newFOROP(0, $1, $2, Nullop, $5, $7, $8)); }
| label FOR '(' remember mnexpr ';' mtexpr ';' mnexpr ')' mblock
/* basically fake up an initialize-while lineseq */
newFOROP(0, $1, $2, Nullop, $5, $7, $8)); }
| label FOR '(' remember mnexpr ';' mtexpr ';' mnexpr ')' mblock
/* basically fake up an initialize-while lineseq */
- {
copline = $2;
-
$$ = block_end($4
,
-
append_elem(OP_LINESEQ, scalar($5)
,
-
newSTATEOP(0, $1
,
- newWHILEOP(0, 1, (LOOP*)Nullop,
- scalar($7),
-
$11, scalar($9)))
)); }
+ {
OP *forop = append_elem(OP_LINESEQ,
+
scalar($5)
,
+
newWHILEOP(0, 1, (LOOP*)Nullop
,
+
$2, scalar($7)
,
+ $11, scalar($9)));
+ copline = $2;
+
$$ = block_end($4, newSTATEOP(0, $1, forop
)); }
| label block cont /* a block is a loop that happens once */
| label block cont /* a block is a loop that happens once */
- { $$ = newSTATEOP(0,
-
$1,
newWHILEOP(0, 1, (LOOP*)Nullop,
- Nullop, $2, $3)); }
+ { $$ = newSTATEOP(0,
$1,
+ newWHILEOP(0, 1, (LOOP*)Nullop,
+
NOLINE,
Nullop, $2, $3)); }
;
nexpr : /* NULL */
;
nexpr : /* NULL */
@@
-288,8
+291,9
@@
startformsub: /* NULL */ /* start a format subroutine scope */
{ $$ = start_subparse(TRUE, 0); }
;
{ $$ = start_subparse(TRUE, 0); }
;
-subname : WORD { char *name = SvPVx(((SVOP*)$1)->op_sv, na);
- if (strEQ(name, "BEGIN") || strEQ(name, "END"))
+subname : WORD { char *name = SvPV(((SVOP*)$1)->op_sv, na);
+ if (strEQ(name, "BEGIN") || strEQ(name, "END")
+ || strEQ(name, "INIT"))
CvUNIQUE_on(compcv);
$$ = $1; }
;
CvUNIQUE_on(compcv);
$$ = $1; }
;
@@
-438,7
+442,7
@@
term : term ASSIGNOP term
| scalar %prec '('
{ $$ = $1; }
| star '{' expr ';' '}'
| scalar %prec '('
{ $$ = $1; }
| star '{' expr ';' '}'
- { $$ = newBINOP(OP_GELEM, 0,
newGVREF(0,$1), $3
); }
+ { $$ = newBINOP(OP_GELEM, 0,
$1, scalar($3)
); }
| star %prec '('
{ $$ = $1; }
| scalar '[' expr ']' %prec '('
| star %prec '('
{ $$ = $1; }
| scalar '[' expr ']' %prec '('
@@
-529,6
+533,13
@@
term : term ASSIGNOP term
prepend_elem(OP_LIST,
$4,
scalar(newCVREF(0,scalar($2))))); dep();}
prepend_elem(OP_LIST,
$4,
scalar(newCVREF(0,scalar($2))))); dep();}
+ | term ARROW '(' ')' %prec '('
+ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ newCVREF(0, scalar($1))); }
+ | term ARROW '(' expr ')' %prec '('
+ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST, $4,
+ newCVREF(0, scalar($1)))); }
| LOOPEX
{ $$ = newOP($1, OPf_SPECIAL);
hints |= HINT_BLOCK_SCOPE; }
| LOOPEX
{ $$ = newOP($1, OPf_SPECIAL);
hints |= HINT_BLOCK_SCOPE; }