3 * Copyright (c) 1991-2002, 2003, 2004 Larry Wall
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
11 * 'I see,' laughed Strider. 'I look foul and feel fair. Is that it?
12 * All that is gold does not glitter, not all those who wander are lost.'
15 /* This file holds the grammar for the Perl language. If edited, you need
16 * to run regen_perly.pl, which re-creates the files perly.h, perly.tab
17 * and perly.act which are derived from this.
19 * The main job of of this grammar is to call the various newFOO()
20 * functions in op.c to build a syntax tree of OP structs.
21 * It relies on the lexer in toke.c to do the tokenizing.
24 /* Make the parser re-entrant. */
42 %token <opval> WORD METHOD FUNCMETH THING PMFUNC PRIVATEREF
43 %token <opval> FUNC0SUB UNIOPSUB LSTOPSUB
45 %token <ival> FORMAT SUB ANONSUB PACKAGE USE
46 %token <ival> WHILE UNTIL IF UNLESS ELSE ELSIF CONTINUE FOR
47 %token <ival> GIVEN WHEN DEFAULT
48 %token <ival> LOOPEX DOTDOT
49 %token <ival> FUNC0 FUNC1 FUNC UNIOP LSTOP
50 %token <ival> RELOP EQOP MULOP ADDOP
51 %token <ival> DOLSHARP DO HASHBRACK NOAMP
52 %token <ival> LOCAL MY MYSUB REQUIRE
55 %type <ival> prog decl format startsub startanonsub startformsub mintro
56 %type <ival> progstart remember mremember '&' savescope mydefsv
57 %type <opval> block mblock lineseq line loop cond else
58 %type <opval> expr term subscripted scalar ary hsh arylen star amper sideff
59 %type <opval> argexpr nexpr texpr iexpr mexpr mnexpr miexpr
60 %type <opval> listexpr listexprcom indirob listop method
61 %type <opval> formname subname proto subbody cont my_scalar
62 %type <opval> subattrlist myattrlist mysubrout myattrterm myterm
63 %type <opval> termbinop termunop anonymous termdo
64 %type <opval> switch case
70 %left <ival> OROP DOROP
73 %nonassoc LSTOP LSTOPSUB
75 %right <ival> ASSIGNOP
84 %nonassoc UNIOP UNIOPSUB
90 %right '!' '~' UMINUS REFGEN
92 %nonassoc PREINC PREDEC POSTINC POSTDEC
102 /* The whole program */
104 /*CONTINUED*/ lineseq
105 { $$ = $1; newPROG(block_end($1,$2)); }
108 /* An ordinary block */
109 block : '{' remember lineseq '}'
110 { if (PL_copline > (line_t)$1)
111 PL_copline = (line_t)$1;
112 $$ = block_end($2, $3); }
115 remember: /* NULL */ /* start a full lexical scope */
116 { $$ = block_start(TRUE); }
119 mydefsv: /* NULL */ /* lexicalize $_ */
120 { $$ = (I32) allocmy("$_"); }
125 PL_expect = XSTATE; $$ = block_start(TRUE);
130 mblock : '{' mremember lineseq '}'
131 { if (PL_copline > (line_t)$1)
132 PL_copline = (line_t)$1;
133 $$ = block_end($2, $3); }
136 mremember: /* NULL */ /* start a partial lexical scope */
137 { $$ = block_start(FALSE); }
140 savescope: /* NULL */ /* remember stack pos in case of error */
141 { $$ = PL_savestack_ix; }
143 /* A collection of "lines" in the program */
148 | lineseq savescope line
150 $$ = append_list(OP_LINESEQ,
151 (LISTOP*)$1, (LISTOP*)$3);
152 PL_pad_reset_pending = TRUE;
153 if ($1 && $3) PL_hints |= HINT_BLOCK_SCOPE; }
156 /* A "line" in the program */
158 { $$ = newSTATEOP(0, $1, $2); }
159 | loop /* loops add their own labels */
160 | switch /* ... and so do switches */
163 { $$ = newSTATEOP(0, $1, $2); }
165 { if ($1 != Nullch) {
166 $$ = newSTATEOP(0, $1, newOP(OP_NULL, 0));
172 PL_expect = XSTATE; }
174 { $$ = newSTATEOP(0, $1, $2);
175 PL_expect = XSTATE; }
178 /* An expression which may have a side-effect */
184 { $$ = newLOGOP(OP_AND, 0, $3, $1); }
186 { $$ = newLOGOP(OP_OR, 0, $3, $1); }
188 { $$ = newLOOPOP(OPf_PARENS, 1, scalar($3), $1); }
190 { $$ = newLOOPOP(OPf_PARENS, 1, $3, $1);}
192 { $$ = newFOROP(0, Nullch, (line_t)$2,
193 Nullop, $3, $1, Nullop); }
196 /* else and elsif blocks */
200 { ($2)->op_flags |= OPf_PARENS; $$ = scope($2); }
201 | ELSIF '(' mexpr ')' mblock else
202 { PL_copline = (line_t)$1;
203 $$ = newCONDOP(0, $3, scope($5), $6);
204 PL_hints |= HINT_BLOCK_SCOPE; }
207 /* Real conditional expressions */
208 cond : IF '(' remember mexpr ')' mblock else
209 { PL_copline = (line_t)$1;
211 newCONDOP(0, $4, scope($6), $7)); }
212 | UNLESS '(' remember miexpr ')' mblock else
213 { PL_copline = (line_t)$1;
215 newCONDOP(0, $4, scope($6), $7)); }
218 /* Cases for a switch statement */
219 case : WHEN '(' remember mexpr ')' mblock
221 newWHENOP($4, scope($6))); }
223 { $$ = newWHENOP(0, scope($2)); }
226 /* Continue blocks */
233 /* Loops: while, until, for, and a bare block */
234 loop : label WHILE '(' remember texpr ')' mintro mblock cont
235 { PL_copline = (line_t)$2;
238 newWHILEOP(0, 1, (LOOP*)Nullop,
239 $2, $5, $8, $9, $7))); }
240 | label UNTIL '(' remember iexpr ')' mintro mblock cont
241 { PL_copline = (line_t)$2;
244 newWHILEOP(0, 1, (LOOP*)Nullop,
245 $2, $5, $8, $9, $7))); }
246 | label FOR MY remember my_scalar '(' mexpr ')' mblock cont
248 newFOROP(0, $1, (line_t)$2, $5, $7, $9, $10)); }
249 | label FOR scalar '(' remember mexpr ')' mblock cont
251 newFOROP(0, $1, (line_t)$2, mod($3, OP_ENTERLOOP),
253 | label FOR '(' remember mexpr ')' mblock cont
255 newFOROP(0, $1, (line_t)$2, Nullop, $5, $7, $8)); }
256 | label FOR '(' remember mnexpr ';' texpr ';' mintro mnexpr ')'
258 /* basically fake up an initialize-while lineseq */
260 PL_copline = (line_t)$2;
261 forop = newSTATEOP(0, $1,
262 newWHILEOP(0, 1, (LOOP*)Nullop,
266 forop = append_elem(OP_LINESEQ,
267 newSTATEOP(0, ($1?savepv($1):Nullch),
272 $$ = block_end($4, forop); }
273 | label block cont /* a block is a loop that happens once */
274 { $$ = newSTATEOP(0, $1,
275 newWHILEOP(0, 1, (LOOP*)Nullop,
276 NOLINE, Nullop, $2, $3, 0)); }
280 switch : label GIVEN '(' remember mydefsv mexpr ')' mblock
281 { PL_copline = (line_t) $2;
284 newGIVENOP($6, scope($8),
285 (PADOFFSET) $5) )); }
288 /* determine whether there are any new my declarations */
290 { $$ = (PL_min_intro_pending &&
291 PL_max_intro_pending >= PL_min_intro_pending);
294 /* Normal expression */
300 /* Boolean expression */
301 texpr : /* NULL means true */
302 { (void)scan_num("1", &yylval); $$ = yylval.opval; }
306 /* Inverted boolean expression */
308 { $$ = invert(scalar($1)); }
311 /* Expression with its own lexical scope */
313 { $$ = $1; intro_my(); }
317 { $$ = $1; intro_my(); }
321 { $$ = $1; intro_my(); }
324 /* Optional "MAIN:"-style loop labels */
330 /* Some kind of declaration - does not take part in the parse tree */
343 format : FORMAT startformsub formname block
344 { SvREFCNT_inc(PL_compcv);
345 newFORM($2, $3, $4); }
348 formname: WORD { $$ = $1; }
349 | /* NULL */ { $$ = Nullop; }
352 /* Unimplemented "my sub foo { }" */
353 mysubrout: MYSUB startsub subname proto subattrlist subbody
354 { SvREFCNT_inc(PL_compcv);
355 newMYSUB($2, $3, $4, $5, $6); }
358 /* Subroutine definition */
359 subrout : SUB startsub subname proto subattrlist subbody
360 { SvREFCNT_inc(PL_compcv);
361 newATTRSUB($2, $3, $4, $5, $6); }
364 startsub: /* NULL */ /* start a regular subroutine scope */
365 { $$ = start_subparse(FALSE, 0);
366 SAVEFREESV(PL_compcv); }
369 startanonsub: /* NULL */ /* start an anonymous subroutine scope */
370 { $$ = start_subparse(FALSE, CVf_ANON);
371 SAVEFREESV(PL_compcv); }
374 startformsub: /* NULL */ /* start a format subroutine scope */
375 { $$ = start_subparse(TRUE, 0);
376 SAVEFREESV(PL_compcv); }
379 /* Name of a subroutine - must be a bareword, could be special */
380 subname : WORD { const char *const name = SvPV_nolen_const(((SVOP*)$1)->op_sv);
381 if (strEQ(name, "BEGIN") || strEQ(name, "END")
382 || strEQ(name, "INIT") || strEQ(name, "CHECK"))
383 CvSPECIAL_on(PL_compcv);
387 /* Subroutine prototype */
393 /* Optional list of subroutine attributes */
394 subattrlist: /* NULL */
402 /* List of attributes for a "my" variable declaration */
403 myattrlist: COLONATTR THING
409 /* Subroutine body - either null or a block */
410 subbody : block { $$ = $1; }
411 | ';' { $$ = Nullop; PL_expect = XSTATE; }
414 package : PACKAGE WORD ';'
419 { CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ }
420 WORD WORD listexpr ';'
421 { SvREFCNT_inc(PL_compcv);
422 utilize($1, $2, $4, $5, $6); }
425 /* Ordinary expressions; logical combinations */
426 expr : expr ANDOP expr
427 { $$ = newLOGOP(OP_AND, 0, $1, $3); }
429 { $$ = newLOGOP($2, 0, $1, $3); }
431 { $$ = newLOGOP(OP_DOR, 0, $1, $3); }
432 | argexpr %prec PREC_LOW
435 /* Expressions are a list of terms joined by commas */
436 argexpr : argexpr ','
439 { $$ = append_elem(OP_LIST, $1, $3); }
440 | term %prec PREC_LOW
444 listop : LSTOP indirob argexpr /* map {...} @args or print $fh @args */
445 { $$ = convert($1, OPf_STACKED,
446 prepend_elem(OP_LIST, newGVREF($1,$2), $3) ); }
447 | FUNC '(' indirob expr ')' /* print ($fh @args */
448 { $$ = convert($1, OPf_STACKED,
449 prepend_elem(OP_LIST, newGVREF($1,$3), $4) ); }
450 | term ARROW method '(' listexprcom ')' /* $foo->bar(list) */
451 { $$ = convert(OP_ENTERSUB, OPf_STACKED,
453 prepend_elem(OP_LIST, scalar($1), $5),
454 newUNOP(OP_METHOD, 0, $3))); }
455 | term ARROW method /* $foo->bar */
456 { $$ = convert(OP_ENTERSUB, OPf_STACKED,
457 append_elem(OP_LIST, scalar($1),
458 newUNOP(OP_METHOD, 0, $3))); }
459 | METHOD indirob listexpr /* new Class @args */
460 { $$ = convert(OP_ENTERSUB, OPf_STACKED,
462 prepend_elem(OP_LIST, $2, $3),
463 newUNOP(OP_METHOD, 0, $1))); }
464 | FUNCMETH indirob '(' listexprcom ')' /* method $object (@args) */
465 { $$ = convert(OP_ENTERSUB, OPf_STACKED,
467 prepend_elem(OP_LIST, $2, $4),
468 newUNOP(OP_METHOD, 0, $1))); }
469 | LSTOP listexpr /* print @args */
470 { $$ = convert($1, 0, $2); }
471 | FUNC '(' listexprcom ')' /* print (@args) */
472 { $$ = convert($1, 0, $3); }
473 | LSTOPSUB startanonsub block /* sub f(&@); f { foo } ... */
474 { SvREFCNT_inc(PL_compcv);
475 $3 = newANONATTRSUB($2, 0, Nullop, $3); }
476 listexpr %prec LSTOP /* ... @bar */
477 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
479 prepend_elem(OP_LIST, $3, $5), $1)); }
482 /* Names of methods. May use $object->$methodname */
487 /* Some kind of subscripted expression */
488 subscripted: star '{' expr ';' '}' /* *main::{something} */
489 /* In this and all the hash accessors, ';' is
490 * provided by the tokeniser */
491 { $$ = newBINOP(OP_GELEM, 0, $1, scalar($3));
492 PL_expect = XOPERATOR; }
493 | scalar '[' expr ']' /* $array[$element] */
494 { $$ = newBINOP(OP_AELEM, 0, oopsAV($1), scalar($3)); }
495 | term ARROW '[' expr ']' /* somearef->[$element] */
496 { $$ = newBINOP(OP_AELEM, 0,
497 ref(newAVREF($1),OP_RV2AV),
499 | subscripted '[' expr ']' /* $foo->[$bar]->[$baz] */
500 { $$ = newBINOP(OP_AELEM, 0,
501 ref(newAVREF($1),OP_RV2AV),
503 | scalar '{' expr ';' '}' /* $foo->{bar();} */
504 { $$ = newBINOP(OP_HELEM, 0, oopsHV($1), jmaybe($3));
505 PL_expect = XOPERATOR; }
506 | term ARROW '{' expr ';' '}' /* somehref->{bar();} */
507 { $$ = newBINOP(OP_HELEM, 0,
508 ref(newHVREF($1),OP_RV2HV),
510 PL_expect = XOPERATOR; }
511 | subscripted '{' expr ';' '}' /* $foo->[bar]->{baz;} */
512 { $$ = newBINOP(OP_HELEM, 0,
513 ref(newHVREF($1),OP_RV2HV),
515 PL_expect = XOPERATOR; }
516 | term ARROW '(' ')' /* $subref->() */
517 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
518 newCVREF(0, scalar($1))); }
519 | term ARROW '(' expr ')' /* $subref->(@args) */
520 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
521 append_elem(OP_LIST, $4,
522 newCVREF(0, scalar($1)))); }
524 | subscripted '(' expr ')' /* $foo->{bar}->(@args) */
525 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
526 append_elem(OP_LIST, $3,
527 newCVREF(0, scalar($1)))); }
528 | subscripted '(' ')' /* $foo->{bar}->() */
529 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
530 newCVREF(0, scalar($1))); }
531 | '(' expr ')' '[' expr ']' /* list slice */
532 { $$ = newSLICEOP(0, $5, $2); }
533 | '(' ')' '[' expr ']' /* empty list slice! */
534 { $$ = newSLICEOP(0, $4, Nullop); }
537 /* Binary operators between terms */
538 termbinop : term ASSIGNOP term /* $x = $y */
539 { $$ = newASSIGNOP(OPf_STACKED, $1, $2, $3); }
540 | term POWOP term /* $x ** $y */
541 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
542 | term MULOP term /* $x * $y, $x x $y */
543 { if ($2 != OP_REPEAT)
545 $$ = newBINOP($2, 0, $1, scalar($3)); }
546 | term ADDOP term /* $x + $y */
547 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
548 | term SHIFTOP term /* $x >> $y, $x << $y */
549 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
550 | term RELOP term /* $x > $y, etc. */
551 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
552 | term EQOP term /* $x == $y, $x eq $y */
553 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
554 | term BITANDOP term /* $x & $y */
555 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
556 | term BITOROP term /* $x | $y */
557 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
558 | term DOTDOT term /* $x..$y, $x...$y */
559 { $$ = newRANGE($2, scalar($1), scalar($3));}
560 | term ANDAND term /* $x && $y */
561 { $$ = newLOGOP(OP_AND, 0, $1, $3); }
562 | term OROR term /* $x || $y */
563 { $$ = newLOGOP(OP_OR, 0, $1, $3); }
564 | term DORDOR term /* $x // $y */
565 { $$ = newLOGOP(OP_DOR, 0, $1, $3); }
566 | term MATCHOP term /* $x =~ /$y/ */
567 { $$ = bind_match($2, $1, $3); }
570 /* Unary operators and terms */
571 termunop : '-' term %prec UMINUS /* -$x */
572 { $$ = newUNOP(OP_NEGATE, 0, scalar($2)); }
573 | '+' term %prec UMINUS /* +$x */
576 { $$ = newUNOP(OP_NOT, 0, scalar($2)); }
578 { $$ = newUNOP(OP_COMPLEMENT, 0, scalar($2));}
579 | term POSTINC /* $x++ */
580 { $$ = newUNOP(OP_POSTINC, 0,
581 mod(scalar($1), OP_POSTINC)); }
582 | term POSTDEC /* $x-- */
583 { $$ = newUNOP(OP_POSTDEC, 0,
584 mod(scalar($1), OP_POSTDEC)); }
585 | PREINC term /* ++$x */
586 { $$ = newUNOP(OP_PREINC, 0,
587 mod(scalar($2), OP_PREINC)); }
588 | PREDEC term /* --$x */
589 { $$ = newUNOP(OP_PREDEC, 0,
590 mod(scalar($2), OP_PREDEC)); }
594 /* Constructors for anonymous data */
595 anonymous: '[' expr ']'
596 { $$ = newANONLIST($2); }
598 { $$ = newANONLIST(Nullop); }
599 | HASHBRACK expr ';' '}' %prec '(' /* { foo => "Bar" } */
600 { $$ = newANONHASH($2); }
601 | HASHBRACK ';' '}' %prec '(' /* { } (';' by tokener) */
602 { $$ = newANONHASH(Nullop); }
603 | ANONSUB startanonsub proto subattrlist block %prec '('
604 { SvREFCNT_inc(PL_compcv);
605 $$ = newANONATTRSUB($2, $3, $4, $5); }
609 /* Things called with "do" */
610 termdo : DO term %prec UNIOP /* do $filename */
611 { $$ = dofile($2, $1); }
612 | DO block %prec '(' /* do { code */
613 { $$ = newUNOP(OP_NULL, OPf_SPECIAL, scope($2)); }
614 | DO WORD '(' ')' /* do somesub() */
615 { $$ = newUNOP(OP_ENTERSUB,
616 OPf_SPECIAL|OPf_STACKED,
617 prepend_elem(OP_LIST,
619 (OPpENTERSUB_AMPER<<8),
622 | DO WORD '(' expr ')' /* do somesub(@args) */
623 { $$ = newUNOP(OP_ENTERSUB,
624 OPf_SPECIAL|OPf_STACKED,
628 (OPpENTERSUB_AMPER<<8),
631 | DO scalar '(' ')' /* do $subref () */
632 { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
633 prepend_elem(OP_LIST,
634 scalar(newCVREF(0,scalar($2))), Nullop)); dep();}
635 | DO scalar '(' expr ')' /* do $subref (@args) */
636 { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
637 prepend_elem(OP_LIST,
639 scalar(newCVREF(0,scalar($2))))); dep();}
647 | term '?' term ':' term
648 { $$ = newCONDOP(0, $1, $3, $5); }
649 | REFGEN term /* \$x, \@y, \%z */
650 { $$ = newUNOP(OP_REFGEN, 0, mod($2,OP_REFGEN)); }
651 | myattrterm %prec UNIOP
653 | LOCAL term %prec UNIOP
654 { $$ = localize($2,$1); }
656 { $$ = sawparens($2); }
658 { $$ = sawparens(newNULLLIST()); }
667 | arylen %prec '(' /* $#x, $#{ something } */
668 { $$ = newUNOP(OP_AV2ARYLEN, 0, ref($1, OP_AV2ARYLEN));}
671 | ary '[' expr ']' /* array slice */
672 { $$ = prepend_elem(OP_ASLICE,
673 newOP(OP_PUSHMARK, 0),
674 newLISTOP(OP_ASLICE, 0,
676 ref($1, OP_ASLICE))); }
677 | ary '{' expr ';' '}' /* @hash{@keys} */
678 { $$ = prepend_elem(OP_HSLICE,
679 newOP(OP_PUSHMARK, 0),
680 newLISTOP(OP_HSLICE, 0,
682 ref(oopsHV($1), OP_HSLICE)));
683 PL_expect = XOPERATOR; }
687 { $$ = newUNOP(OP_ENTERSUB, 0, scalar($1)); }
688 | amper '(' ')' /* &foo() */
689 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); }
690 | amper '(' expr ')' /* &foo(@args) */
691 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
692 append_elem(OP_LIST, $3, scalar($1))); }
693 | NOAMP WORD listexpr /* foo(@args) */
694 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
695 append_elem(OP_LIST, $3, scalar($2))); }
696 | LOOPEX /* loop exiting command (goto, last, dump, etc) */
697 { $$ = newOP($1, OPf_SPECIAL);
698 PL_hints |= HINT_BLOCK_SCOPE; }
700 { $$ = newLOOPEX($1,$2); }
701 | NOTOP argexpr /* not $foo */
702 { $$ = newUNOP(OP_NOT, 0, scalar($2)); }
703 | UNIOP /* Unary op, $_ implied */
704 { $$ = newOP($1, 0); }
705 | UNIOP block /* eval { foo } */
706 { $$ = newUNOP($1, 0, $2); }
707 | UNIOP term /* Unary op */
708 { $$ = newUNOP($1, 0, $2); }
709 | REQUIRE /* require, $_ implied */
710 { $$ = newOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0); }
711 | REQUIRE term /* require Foo */
712 { $$ = newUNOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0, $2); }
713 | UNIOPSUB term /* Sub treated as unop */
714 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
715 append_elem(OP_LIST, $2, scalar($1))); }
716 | FUNC0 /* Nullary operator */
717 { $$ = newOP($1, 0); }
719 { $$ = newOP($1, 0); }
720 | FUNC0SUB /* Sub treated as nullop */
721 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
723 | FUNC1 '(' ')' /* not () */
724 { $$ = $1 == OP_NOT ? newUNOP($1, 0, newSVOP(OP_CONST, 0, newSViv(0)))
725 : newOP($1, OPf_SPECIAL); }
726 | FUNC1 '(' expr ')' /* not($foo) */
727 { $$ = newUNOP($1, 0, $3); }
728 | PMFUNC '(' argexpr ')' /* m//, s///, tr/// */
729 { $$ = pmruntime($1, $3, 1); }
734 /* "my" declarations, with optional attributes */
735 myattrterm: MY myterm myattrlist
736 { $$ = my_attrs($2,$3); }
738 { $$ = localize($2,$1); }
741 /* Things that can be "my"'d */
742 myterm : '(' expr ')'
743 { $$ = sawparens($2); }
745 { $$ = sawparens(newNULLLIST()); }
754 /* Basic list expressions */
755 listexpr: /* NULL */ %prec PREC_LOW
757 | argexpr %prec PREC_LOW
761 listexprcom: /* NULL */
769 /* A little bit of trickery to make "for my $foo (@bar)" actually be
772 { PL_in_my = 0; $$ = my($1); }
776 { $$ = newCVREF($1,$2); }
780 { $$ = newSVREF($2); }
784 { $$ = newAVREF($2); }
788 { $$ = newHVREF($2); }
791 arylen : DOLSHARP indirob
792 { $$ = newAVREF($2); }
796 { $$ = newGVREF(0,$2); }
799 /* Indirect objects */
802 | scalar %prec PREC_LOW