X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/295222340ad6893caa0a1c3479155f88ea290dc3..ce0e211a90da72f1344099dc2e538e0b466a3641:/perly.y diff --git a/perly.y b/perly.y index e4515da..aad4dd7 100644 --- a/perly.y +++ b/perly.y @@ -1,6 +1,7 @@ /* perly.y * * Copyright (c) 1991-2002, 2003, 2004, 2005, 2006 Larry Wall + * Copyright (c) 2007, 2008 by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -9,8 +10,12 @@ /* * 'I see,' laughed Strider. 'I look foul and feel fair. Is that it? - * All that is gold does not glitter, not all those who wander are lost.' + * All that is gold does not glitter, not all those who wander are lost.' * + * [p.171 of _The Lord of the Rings_, I/x: "Strider"] + */ + +/* * This file holds the grammar for the Perl language. If edited, you need * to run regen_perly.pl, which re-creates the files perly.h, perly.tab * and perly.act which are derived from this. @@ -72,14 +77,14 @@ %token FORMAT SUB ANONSUB PACKAGE USE %token WHILE UNTIL IF UNLESS ELSE ELSIF CONTINUE FOR %token GIVEN WHEN DEFAULT -%token LOOPEX DOTDOT +%token LOOPEX DOTDOT YADAYADA %token FUNC0 FUNC1 FUNC UNIOP LSTOP %token RELOP EQOP MULOP ADDOP %token DOLSHARP DO HASHBRACK NOAMP %token LOCAL MY MYSUB REQUIRE %token COLONATTR -%type prog progstart remember mremember savescope +%type prog progstart remember mremember %type startsub startanonsub startformsub /* FIXME for MAD - are these two ival? */ %type mydefsv mintro @@ -106,7 +111,7 @@ %left ',' %right ASSIGNOP %right '?' ':' -%nonassoc DOTDOT +%nonassoc DOTDOT YADAYADA %left OROR DORDOR %left ANDAND %left BITOROP @@ -139,8 +144,8 @@ prog : progstart /* An ordinary block */ block : '{' remember lineseq '}' - { if (PL_copline > (line_t)IVAL($1)) - PL_copline = (line_t)IVAL($1); + { if (PL_parser->copline > (line_t)IVAL($1)) + PL_parser->copline = (line_t)IVAL($1); $$ = block_end($2, $3); TOKEN_GETMAD($1,$$,'{'); TOKEN_GETMAD($4,$$,'}'); @@ -157,14 +162,14 @@ mydefsv: /* NULL */ /* lexicalize $_ */ progstart: { - PL_expect = XSTATE; $$ = block_start(TRUE); + PL_parser->expect = XSTATE; $$ = block_start(TRUE); } ; mblock : '{' mremember lineseq '}' - { if (PL_copline > (line_t)IVAL($1)) - PL_copline = (line_t)IVAL($1); + { if (PL_parser->copline > (line_t)IVAL($1)) + PL_parser->copline = (line_t)IVAL($1); $$ = block_end($2, $3); TOKEN_GETMAD($1,$$,'{'); TOKEN_GETMAD($4,$$,'}'); @@ -175,12 +180,9 @@ mremember: /* NULL */ /* start a partial lexical scope */ { $$ = block_start(FALSE); } ; -savescope: /* NULL */ /* remember stack pos in case of error */ - { $$ = PL_savestack_ix; } - /* A collection of "lines" in the program */ lineseq : /* NULL */ - { $$ = Nullop; } + { $$ = (OP*)NULL; } | lineseq decl { $$ = IF_MAD( @@ -188,12 +190,13 @@ lineseq : /* NULL */ (LISTOP*)$1, (LISTOP*)$2), $1); } - | lineseq savescope line - { LEAVE_SCOPE($2); - $$ = append_list(OP_LINESEQ, - (LISTOP*)$1, (LISTOP*)$3); + | lineseq line + { $$ = append_list(OP_LINESEQ, + (LISTOP*)$1, (LISTOP*)$2); PL_pad_reset_pending = TRUE; - if ($1 && $3) PL_hints |= HINT_BLOCK_SCOPE; } + if ($1 && $2) + PL_hints |= HINT_BLOCK_SCOPE; + } ; /* A "line" in the program */ @@ -215,18 +218,18 @@ line : label cond else { $$ = IF_MAD( newOP(OP_NULL, 0), - Nullop); - PL_copline = NOLINE; + (OP*)NULL); + PL_parser->copline = NOLINE; TOKEN_FREE($1); TOKEN_GETMAD($2,$$,';'); } - PL_expect = XSTATE; + PL_parser->expect = XSTATE; } | label sideff ';' { $$ = newSTATEOP(0, PVAL($1), $2); - PL_expect = XSTATE; - DO_MAD( + PL_parser->expect = XSTATE; + DO_MAD({ /* sideff might already have a nexstate */ OP* op = ((LISTOP*)$$)->op_first; if (op) { @@ -236,13 +239,13 @@ line : label cond token_getmad($1,op,'L'); token_getmad($3,op,';'); } - ) + }) } ; /* An expression which may have a side-effect */ sideff : error - { $$ = Nullop; } + { $$ = (OP*)NULL; } | expr { $$ = $1; } | expr IF expr @@ -262,22 +265,22 @@ sideff : error TOKEN_GETMAD($2,$$,'w'); } | expr FOR expr - { $$ = newFOROP(0, Nullch, (line_t)IVAL($2), - Nullop, $3, $1, Nullop); + { $$ = newFOROP(0, NULL, (line_t)IVAL($2), + (OP*)NULL, $3, $1, (OP*)NULL); TOKEN_GETMAD($2,((LISTOP*)$$)->op_first->op_sibling,'w'); } ; /* else and elsif blocks */ else : /* NULL */ - { $$ = Nullop; } + { $$ = (OP*)NULL; } | ELSE mblock { ($2)->op_flags |= OPf_PARENS; $$ = scope($2); TOKEN_GETMAD($1,$$,'o'); } | ELSIF '(' mexpr ')' mblock else - { PL_copline = (line_t)IVAL($1); - $$ = newCONDOP(0, $3, scope($5), $6); + { PL_parser->copline = (line_t)IVAL($1); + $$ = newCONDOP(0, newSTATEOP(OPf_SPECIAL,NULL,$3), scope($5), $6); PL_hints |= HINT_BLOCK_SCOPE; TOKEN_GETMAD($1,$$,'I'); TOKEN_GETMAD($2,$$,'('); @@ -287,7 +290,7 @@ else : /* NULL */ /* Real conditional expressions */ cond : IF '(' remember mexpr ')' mblock else - { PL_copline = (line_t)IVAL($1); + { PL_parser->copline = (line_t)IVAL($1); $$ = block_end($3, newCONDOP(0, $4, scope($6), $7)); TOKEN_GETMAD($1,$$,'I'); @@ -295,7 +298,7 @@ cond : IF '(' remember mexpr ')' mblock else TOKEN_GETMAD($5,$$,')'); } | UNLESS '(' remember miexpr ')' mblock else - { PL_copline = (line_t)IVAL($1); + { PL_parser->copline = (line_t)IVAL($1); $$ = block_end($3, newCONDOP(0, $4, scope($6), $7)); TOKEN_GETMAD($1,$$,'I'); @@ -314,7 +317,7 @@ case : WHEN '(' remember mexpr ')' mblock /* Continue blocks */ cont : /* NULL */ - { $$ = Nullop; } + { $$ = (OP*)NULL; } | CONTINUE block { $$ = scope($2); TOKEN_GETMAD($1,$$,'o'); @@ -324,10 +327,10 @@ cont : /* NULL */ /* Loops: while, until, for, and a bare block */ loop : label WHILE '(' remember texpr ')' mintro mblock cont { OP *innerop; - PL_copline = (line_t)$2; + PL_parser->copline = (line_t)$2; $$ = block_end($4, newSTATEOP(0, PVAL($1), - innerop = newWHILEOP(0, 1, (LOOP*)Nullop, + innerop = newWHILEOP(0, 1, (LOOP*)(OP*)NULL, IVAL($2), $5, $8, $9, $7))); TOKEN_GETMAD($1,innerop,'L'); TOKEN_GETMAD($2,innerop,'W'); @@ -337,10 +340,10 @@ loop : label WHILE '(' remember texpr ')' mintro mblock cont | label UNTIL '(' remember iexpr ')' mintro mblock cont { OP *innerop; - PL_copline = (line_t)$2; + PL_parser->copline = (line_t)$2; $$ = block_end($4, newSTATEOP(0, PVAL($1), - innerop = newWHILEOP(0, 1, (LOOP*)Nullop, + innerop = newWHILEOP(0, 1, (LOOP*)(OP*)NULL, IVAL($2), $5, $8, $9, $7))); TOKEN_GETMAD($1,innerop,'L'); TOKEN_GETMAD($2,innerop,'W'); @@ -372,7 +375,7 @@ loop : label WHILE '(' remember texpr ')' mintro mblock cont { OP *innerop; $$ = block_end($4, innerop = newFOROP(0, PVAL($1), (line_t)IVAL($2), - Nullop, $5, $7, $8)); + (OP*)NULL, $5, $7, $8)); TOKEN_GETMAD($1,((LISTOP*)innerop)->op_first,'L'); TOKEN_GETMAD($2,((LISTOP*)innerop)->op_first->op_sibling,'W'); TOKEN_GETMAD($3,((LISTOP*)innerop)->op_first->op_sibling,'('); @@ -382,17 +385,16 @@ loop : label WHILE '(' remember texpr ')' mintro mblock cont mblock /* basically fake up an initialize-while lineseq */ { OP *forop; - PL_copline = (line_t)IVAL($2); + PL_parser->copline = (line_t)IVAL($2); forop = newSTATEOP(0, PVAL($1), - newWHILEOP(0, 1, (LOOP*)Nullop, + newWHILEOP(0, 1, (LOOP*)(OP*)NULL, IVAL($2), scalar($7), $12, $10, $9)); #ifdef MAD forop = newUNOP(OP_NULL, 0, append_elem(OP_LINESEQ, newSTATEOP(0, - (($1)->tk_lval.pval - ?savepv(($1)->tk_lval.pval):Nullch), - ($5 ? newOP(OP_NULL, 0) : $5) ), + CopLABEL_alloc(($1)->tk_lval.pval), + ($5 ? $5 : newOP(OP_NULL, 0)) ), forop)); token_getmad($2,forop,'3'); @@ -404,8 +406,7 @@ loop : label WHILE '(' remember texpr ')' mintro mblock cont #else if ($5) { forop = append_elem(OP_LINESEQ, - newSTATEOP(0, ($1?savepv($1):Nullch), - $5), + newSTATEOP(0, CopLABEL_alloc($1), $5), forop); } @@ -414,14 +415,14 @@ loop : label WHILE '(' remember texpr ')' mintro mblock cont $$ = block_end($4, forop); } | label block cont /* a block is a loop that happens once */ { $$ = newSTATEOP(0, PVAL($1), - newWHILEOP(0, 1, (LOOP*)Nullop, - NOLINE, Nullop, $2, $3, 0)); + newWHILEOP(0, 1, (LOOP*)(OP*)NULL, + NOLINE, (OP*)NULL, $2, $3, 0)); TOKEN_GETMAD($1,((LISTOP*)$$)->op_first,'L'); } ; /* Switch blocks */ switch : label GIVEN '(' remember mydefsv mexpr ')' mblock - { PL_copline = (line_t) $2; + { PL_parser->copline = (line_t) $2; $$ = block_end($4, newSTATEOP(0, PVAL($1), newGIVENOP($6, scope($8), @@ -436,7 +437,7 @@ mintro : /* NULL */ /* Normal expression */ nexpr : /* NULL */ - { $$ = Nullop; } + { $$ = (OP*)NULL; } | sideff ; @@ -471,10 +472,10 @@ label : /* empty */ { #ifdef MAD YYSTYPE tmplval; - tmplval.pval = Nullch; + tmplval.pval = NULL; $$ = newTOKEN(OP_NULL, tmplval, 0); #else - $$ = Nullch; + $$ = NULL; #endif } | LABEL @@ -505,7 +506,7 @@ peg : PEG ; format : FORMAT startformsub formname block - { SvREFCNT_inc(PL_compcv); + { SvREFCNT_inc_simple_void(PL_compcv); #ifdef MAD $$ = newFORM($2, $3, $4); prepend_madprops($1->tk_mad, $$, 'F'); @@ -513,45 +514,47 @@ format : FORMAT startformsub formname block token_free($1); #else newFORM($2, $3, $4); - $$ = Nullop; + $$ = (OP*)NULL; #endif } ; formname: WORD { $$ = $1; } - | /* NULL */ { $$ = Nullop; } + | /* NULL */ { $$ = (OP*)NULL; } ; /* Unimplemented "my sub foo { }" */ mysubrout: MYSUB startsub subname proto subattrlist subbody - { SvREFCNT_inc(PL_compcv); + { SvREFCNT_inc_simple_void(PL_compcv); #ifdef MAD $$ = newMYSUB($2, $3, $4, $5, $6); token_getmad($1,$$,'d'); #else newMYSUB($2, $3, $4, $5, $6); - $$ = Nullop; + $$ = (OP*)NULL; #endif } ; /* Subroutine definition */ subrout : SUB startsub subname proto subattrlist subbody - { SvREFCNT_inc(PL_compcv); + { SvREFCNT_inc_simple_void(PL_compcv); #ifdef MAD - OP* o = newSVOP(OP_ANONCODE, 0, - (SV*)newATTRSUB($2, $3, $4, $5, $6)); - $$ = newOP(OP_NULL,0); - op_getmad(o,$$,'&'); - op_getmad($3,$$,'n'); - op_getmad($4,$$,'s'); - op_getmad($5,$$,'a'); - token_getmad($1,$$,'d'); - append_madprops($6->op_madprop, $$, 0); - $6->op_madprop = 0; + { + OP* o = newSVOP(OP_ANONCODE, 0, + (SV*)newATTRSUB($2, $3, $4, $5, $6)); + $$ = newOP(OP_NULL,0); + op_getmad(o,$$,'&'); + op_getmad($3,$$,'n'); + op_getmad($4,$$,'s'); + op_getmad($5,$$,'a'); + token_getmad($1,$$,'d'); + append_madprops($6->op_madprop, $$, 0); + $6->op_madprop = 0; + } #else newATTRSUB($2, $3, $4, $5, $6); - $$ = Nullop; + $$ = (OP*)NULL; #endif } ; @@ -583,13 +586,13 @@ subname : WORD { const char *const name = SvPV_nolen_const(((SVOP*)$1)->op_sv); /* Subroutine prototype */ proto : /* NULL */ - { $$ = Nullop; } + { $$ = (OP*)NULL; } | THING ; /* Optional list of subroutine attributes */ subattrlist: /* NULL */ - { $$ = Nullop; } + { $$ = (OP*)NULL; } | COLONATTR THING { $$ = $2; TOKEN_GETMAD($1,$$,':'); @@ -597,7 +600,7 @@ subattrlist: /* NULL */ | COLONATTR { $$ = IF_MAD( newOP(OP_NULL, 0), - Nullop + (OP*)NULL ); TOKEN_GETMAD($1,$$,':'); } @@ -611,7 +614,7 @@ myattrlist: COLONATTR THING | COLONATTR { $$ = IF_MAD( newOP(OP_NULL, 0), - Nullop + (OP*)NULL ); TOKEN_GETMAD($1,$$,':'); } @@ -621,9 +624,9 @@ myattrlist: COLONATTR THING subbody : block { $$ = $1; } | ';' { $$ = IF_MAD( newOP(OP_NULL,0), - Nullop + (OP*)NULL ); - PL_expect = XSTATE; + PL_parser->expect = XSTATE; TOKEN_GETMAD($1,$$,';'); } ; @@ -636,7 +639,7 @@ package : PACKAGE WORD ';' token_getmad($3,$$,';'); #else package($2); - $$ = Nullop; + $$ = (OP*)NULL; #endif } ; @@ -644,16 +647,17 @@ package : PACKAGE WORD ';' use : USE startsub { CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ } WORD WORD listexpr ';' - { SvREFCNT_inc(PL_compcv); + { SvREFCNT_inc_simple_void(PL_compcv); #ifdef MAD $$ = utilize(IVAL($1), $2, $4, $5, $6); token_getmad($1,$$,'o'); token_getmad($7,$$,';'); - if (PL_rsfp_filters && AvFILLp(PL_rsfp_filters) >= 0) + if (PL_parser->rsfp_filters && + AvFILLp(PL_parser->rsfp_filters) >= 0) append_madprops(newMADPROP('!', MAD_PV, "", 0), $$, 0); #else utilize(IVAL($1), $2, $4, $5, $6); - $$ = Nullop; + $$ = (OP*)NULL; #endif } ; @@ -750,8 +754,8 @@ listop : LSTOP indirob argexpr /* map {...} @args or print $fh @args */ TOKEN_GETMAD($4,$$,')'); } | LSTOPSUB startanonsub block /* sub f(&@); f { foo } ... */ - { SvREFCNT_inc(PL_compcv); - $$ = newANONATTRSUB($2, 0, Nullop, $3); } + { SvREFCNT_inc_simple_void(PL_compcv); + $$ = newANONATTRSUB($2, 0, (OP*)NULL, $3); } listexpr %prec LSTOP /* ... @bar */ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, @@ -769,7 +773,7 @@ subscripted: star '{' expr ';' '}' /* *main::{something} */ /* In this and all the hash accessors, ';' is * provided by the tokeniser */ { $$ = newBINOP(OP_GELEM, 0, $1, scalar($3)); - PL_expect = XOPERATOR; + PL_parser->expect = XOPERATOR; TOKEN_GETMAD($2,$$,'{'); TOKEN_GETMAD($4,$$,';'); TOKEN_GETMAD($5,$$,'}'); @@ -796,7 +800,7 @@ subscripted: star '{' expr ';' '}' /* *main::{something} */ } | scalar '{' expr ';' '}' /* $foo->{bar();} */ { $$ = newBINOP(OP_HELEM, 0, oopsHV($1), jmaybe($3)); - PL_expect = XOPERATOR; + PL_parser->expect = XOPERATOR; TOKEN_GETMAD($2,$$,'{'); TOKEN_GETMAD($4,$$,';'); TOKEN_GETMAD($5,$$,'}'); @@ -805,7 +809,7 @@ subscripted: star '{' expr ';' '}' /* *main::{something} */ { $$ = newBINOP(OP_HELEM, 0, ref(newHVREF($1),OP_RV2HV), jmaybe($4)); - PL_expect = XOPERATOR; + PL_parser->expect = XOPERATOR; TOKEN_GETMAD($2,$$,'a'); TOKEN_GETMAD($3,$$,'{'); TOKEN_GETMAD($5,$$,';'); @@ -815,7 +819,7 @@ subscripted: star '{' expr ';' '}' /* *main::{something} */ { $$ = newBINOP(OP_HELEM, 0, ref(newHVREF($1),OP_RV2HV), jmaybe($3)); - PL_expect = XOPERATOR; + PL_parser->expect = XOPERATOR; TOKEN_GETMAD($2,$$,'{'); TOKEN_GETMAD($4,$$,';'); TOKEN_GETMAD($5,$$,'}'); @@ -857,7 +861,7 @@ subscripted: star '{' expr ';' '}' /* *main::{something} */ TOKEN_GETMAD($6,$$,']'); } | '(' ')' '[' expr ']' /* empty list slice! */ - { $$ = newSLICEOP(0, $4, Nullop); + { $$ = newSLICEOP(0, $4, (OP*)NULL); TOKEN_GETMAD($1,$$,'('); TOKEN_GETMAD($2,$$,')'); TOKEN_GETMAD($3,$$,'['); @@ -907,14 +911,14 @@ termbinop: term ASSIGNOP term /* $x = $y */ | term DOTDOT term /* $x..$y, $x...$y */ { $$ = newRANGE(IVAL($2), scalar($1), scalar($3)); - DO_MAD( + DO_MAD({ UNOP *op; op = (UNOP*)$$; op = (UNOP*)op->op_first; /* get to flop */ op = (UNOP*)op->op_first; /* get to flip */ op = (UNOP*)op->op_first; /* get to range */ token_getmad($2,(OP*)op,'o'); - ) + }) } | term ANDAND term /* $x && $y */ { $$ = newLOGOP(OP_AND, 0, $1, $3); @@ -987,7 +991,7 @@ anonymous: '[' expr ']' TOKEN_GETMAD($3,$$,']'); } | '[' ']' - { $$ = newANONLIST(Nullop); + { $$ = newANONLIST((OP*)NULL); TOKEN_GETMAD($1,$$,'['); TOKEN_GETMAD($2,$$,']'); } @@ -998,13 +1002,13 @@ anonymous: '[' expr ']' TOKEN_GETMAD($4,$$,'}'); } | HASHBRACK ';' '}' %prec '(' /* { } (';' by tokener) */ - { $$ = newANONHASH(Nullop); + { $$ = newANONHASH((OP*)NULL); TOKEN_GETMAD($1,$$,'{'); TOKEN_GETMAD($2,$$,';'); TOKEN_GETMAD($3,$$,'}'); } | ANONSUB startanonsub proto subattrlist block %prec '(' - { SvREFCNT_inc(PL_compcv); + { SvREFCNT_inc_simple_void(PL_compcv); $$ = newANONATTRSUB($2, $3, $4, $5); TOKEN_GETMAD($1,$$,'o'); OP_GETMAD($3,$$,'s'); @@ -1029,7 +1033,7 @@ termdo : DO term %prec UNIOP /* do $filename */ scalar(newCVREF( (OPpENTERSUB_AMPER<<8), scalar($2) - )),Nullop)); dep(); + )),(OP*)NULL)); dep(); TOKEN_GETMAD($1,$$,'o'); TOKEN_GETMAD($3,$$,'('); TOKEN_GETMAD($4,$$,')'); @@ -1050,7 +1054,7 @@ termdo : DO term %prec UNIOP /* do $filename */ | DO scalar '(' ')' /* do $subref () */ { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, prepend_elem(OP_LIST, - scalar(newCVREF(0,scalar($2))), Nullop)); dep(); + scalar(newCVREF(0,scalar($2))), (OP*)NULL)); dep(); TOKEN_GETMAD($1,$$,'o'); TOKEN_GETMAD($3,$$,'('); TOKEN_GETMAD($4,$$,')'); @@ -1084,7 +1088,7 @@ term : termbinop { $$ = $1; } | LOCAL term %prec UNIOP { $$ = localize($2,IVAL($1)); - TOKEN_GETMAD($1,$$,'d'); + TOKEN_GETMAD($1,$$,'k'); } | '(' expr ')' { $$ = sawparens(IF_MAD(newUNOP(OP_NULL,0,$2), $2)); @@ -1123,7 +1127,7 @@ term : termbinop newLISTOP(OP_HSLICE, 0, list($3), ref(oopsHV($1), OP_HSLICE))); - PL_expect = XOPERATOR; + PL_parser->expect = XOPERATOR; TOKEN_GETMAD($2,$$,'{'); TOKEN_GETMAD($4,$$,';'); TOKEN_GETMAD($5,$$,'}'); @@ -1141,14 +1145,14 @@ term : termbinop { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, $3, scalar($1))); - DO_MAD( + DO_MAD({ OP* op = $$; if (op->op_type == OP_CONST) { /* defeat const fold */ op = (OP*)op->op_madprop->mad_val; } token_getmad($2,op,'('); token_getmad($4,op,')'); - ) + }) } | NOAMP WORD listexpr /* foo(@args) */ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, @@ -1180,10 +1184,14 @@ term : termbinop { $$ = newUNOP(IVAL($1), 0, $2); TOKEN_GETMAD($1,$$,'o'); } - | REQUIRE /* require, $_ implied *//* FIMXE for MAD needed? */ - { $$ = newOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0); } - | REQUIRE term /* require Foo *//* FIMXE for MAD needed? */ - { $$ = newUNOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0, $2); } + | REQUIRE /* require, $_ implied */ + { $$ = newOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0); + TOKEN_GETMAD($1,$$,'o'); + } + | REQUIRE term /* require Foo */ + { $$ = newUNOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0, $2); + TOKEN_GETMAD($1,$$,'o'); + } | UNIOPSUB { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); } | UNIOPSUB term /* Sub treated as unop */ @@ -1224,6 +1232,11 @@ term : termbinop } | WORD | listop + | YADAYADA + { + $$ = newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0), + newSVOP(OP_CONST, 0, newSVpvs("Unimplemented"))); + } ; /* "my" declarations, with optional attributes */ @@ -1262,13 +1275,13 @@ myterm : '(' expr ')' /* Basic list expressions */ listexpr: /* NULL */ %prec PREC_LOW - { $$ = Nullop; } + { $$ = (OP*)NULL; } | argexpr %prec PREC_LOW { $$ = $1; } ; listexprcom: /* NULL */ - { $$ = Nullop; } + { $$ = (OP*)NULL; } | expr { $$ = $1; } | expr ',' @@ -1287,7 +1300,7 @@ listexprcom: /* NULL */ /* A little bit of trickery to make "for my $foo (@bar)" actually be lexical */ my_scalar: scalar - { PL_in_my = 0; $$ = my($1); } + { PL_parser->in_my = 0; $$ = my($1); } ; amper : '&' indirob