This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
don't attempt connect() to bogus IP addresses
[perl5.git] / perly.y
1 /*    perly.y
2  *
3  *    Copyright (c) 1991-1997, Larry Wall
4  *
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.
7  *
8  */
9
10 /*
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.'
13  */
14
15 %{
16 #include "EXTERN.h"
17 #include "perl.h"
18
19 static void
20 dep(void)
21 {
22     deprecate("\"do\" to call subroutines");
23 }
24
25 %}
26
27 %start prog
28
29 %{
30 /* I sense a Big Blue pattern here... */
31 #if !defined(OEMVS) && !defined(__OPEN_VM) && !defined(POSIX_BC)
32 %}
33
34 %union {
35     I32 ival;
36     char *pval;
37     OP *opval;
38     GV *gvval;
39 }
40
41 %{
42 #endif /* !OEMVS && !__OPEN_VM && !POSIX_BC */
43
44 #ifdef USE_PURE_BISON
45 #define YYLEX_PARAM (&yychar)
46 #endif
47 %}
48
49 %token <ival> '{' ')'
50
51 %token <opval> WORD METHOD FUNCMETH THING PMFUNC PRIVATEREF
52 %token <opval> FUNC0SUB UNIOPSUB LSTOPSUB
53 %token <pval> LABEL
54 %token <ival> FORMAT SUB ANONSUB PACKAGE USE
55 %token <ival> WHILE UNTIL IF UNLESS ELSE ELSIF CONTINUE FOR
56 %token <ival> LOOPEX DOTDOT
57 %token <ival> FUNC0 FUNC1 FUNC UNIOP LSTOP
58 %token <ival> RELOP EQOP MULOP ADDOP
59 %token <ival> DOLSHARP DO HASHBRACK NOAMP
60 %token LOCAL MY
61
62 %type <ival> prog decl local format startsub startanonsub startformsub
63 %type <ival> remember mremember '&'
64 %type <opval> block mblock lineseq line loop cond else
65 %type <opval> expr term scalar ary hsh arylen star amper sideff
66 %type <opval> argexpr nexpr texpr iexpr mexpr mnexpr mtexpr miexpr
67 %type <opval> listexpr listexprcom indirob listop method
68 %type <opval> formname subname proto subbody cont my_scalar
69 %type <pval> label
70
71 %left <ival> OROP
72 %left ANDOP
73 %right NOTOP
74 %nonassoc LSTOP LSTOPSUB
75 %left ','
76 %right <ival> ASSIGNOP
77 %right '?' ':'
78 %nonassoc DOTDOT
79 %left OROR
80 %left ANDAND
81 %left <ival> BITOROP
82 %left <ival> BITANDOP
83 %nonassoc EQOP
84 %nonassoc RELOP
85 %nonassoc UNIOP UNIOPSUB
86 %left <ival> SHIFTOP
87 %left ADDOP
88 %left MULOP
89 %left <ival> MATCHOP
90 %right '!' '~' UMINUS REFGEN
91 %right <ival> POWOP
92 %nonassoc PREINC PREDEC POSTINC POSTDEC
93 %left ARROW
94 %left '('
95
96 %% /* RULES */
97
98 prog    :       /* NULL */
99                 {
100 #if defined(YYDEBUG) && defined(DEBUGGING)
101                     yydebug = (PL_debug & 1);
102 #endif
103                     PL_expect = XSTATE;
104                 }
105         /*CONTINUED*/   lineseq
106                         { newPROG($2); }
107         ;
108
109 block   :       '{' remember lineseq '}'
110                         { if (PL_copline > (line_t)$1)
111                               PL_copline = $1;
112                           $$ = block_end($2, $3); }
113         ;
114
115 remember:       /* NULL */      /* start a full lexical scope */
116                         { $$ = block_start(TRUE); }
117         ;
118
119 mblock  :       '{' mremember lineseq '}'
120                         { if (PL_copline > (line_t)$1)
121                               PL_copline = $1;
122                           $$ = block_end($2, $3); }
123         ;
124
125 mremember:      /* NULL */      /* start a partial lexical scope */
126                         { $$ = block_start(FALSE); }
127         ;
128
129 lineseq :       /* NULL */
130                         { $$ = Nullop; }
131         |       lineseq decl
132                         { $$ = $1; }
133         |       lineseq line
134                         {   $$ = append_list(OP_LINESEQ,
135                                 (LISTOP*)$1, (LISTOP*)$2);
136                             PL_pad_reset_pending = TRUE;
137                             if ($1 && $2) PL_hints |= HINT_BLOCK_SCOPE; }
138         ;
139
140 line    :       label cond
141                         { $$ = newSTATEOP(0, $1, $2); }
142         |       loop    /* loops add their own labels */
143         |       label ';'
144                         { if ($1 != Nullch) {
145                               $$ = newSTATEOP(0, $1, newOP(OP_NULL, 0));
146                             }
147                             else {
148                               $$ = Nullop;
149                               PL_copline = NOLINE;
150                             }
151                             PL_expect = XSTATE; }
152         |       label sideff ';'
153                         { $$ = newSTATEOP(0, $1, $2);
154                           PL_expect = XSTATE; }
155         ;
156
157 sideff  :       error
158                         { $$ = Nullop; }
159         |       expr
160                         { $$ = $1; }
161         |       expr IF expr
162                         { $$ = newLOGOP(OP_AND, 0, $3, $1); }
163         |       expr UNLESS expr
164                         { $$ = newLOGOP(OP_OR, 0, $3, $1); }
165         |       expr WHILE expr
166                         { $$ = newLOOPOP(OPf_PARENS, 1, scalar($3), $1); }
167         |       expr UNTIL iexpr
168                         { $$ = newLOOPOP(OPf_PARENS, 1, $3, $1);}
169         |       expr FOR expr
170                         { $$ = newFOROP(0, Nullch, $2,
171                                         Nullop, $3, $1, Nullop); }
172         ;
173
174 else    :       /* NULL */
175                         { $$ = Nullop; }
176         |       ELSE mblock
177                         { $$ = scope($2); }
178         |       ELSIF '(' mexpr ')' mblock else
179                         { PL_copline = $1;
180                             $$ = newSTATEOP(0, Nullch,
181                                    newCONDOP(0, $3, scope($5), $6));
182                             PL_hints |= HINT_BLOCK_SCOPE; }
183         ;
184
185 cond    :       IF '(' remember mexpr ')' mblock else
186                         { PL_copline = $1;
187                             $$ = block_end($3,
188                                    newCONDOP(0, $4, scope($6), $7)); }
189         |       UNLESS '(' remember miexpr ')' mblock else
190                         { PL_copline = $1;
191                             $$ = block_end($3,
192                                    newCONDOP(0, $4, scope($6), $7)); }
193         ;
194
195 cont    :       /* NULL */
196                         { $$ = Nullop; }
197         |       CONTINUE block
198                         { $$ = scope($2); }
199         ;
200
201 loop    :       label WHILE '(' remember mtexpr ')' mblock cont
202                         { PL_copline = $2;
203                             $$ = block_end($4,
204                                    newSTATEOP(0, $1,
205                                      newWHILEOP(0, 1, (LOOP*)Nullop,
206                                                 $2, $5, $7, $8))); }
207         |       label UNTIL '(' remember miexpr ')' mblock cont
208                         { PL_copline = $2;
209                             $$ = block_end($4,
210                                    newSTATEOP(0, $1,
211                                      newWHILEOP(0, 1, (LOOP*)Nullop,
212                                                 $2, $5, $7, $8))); }
213         |       label FOR MY remember my_scalar '(' mexpr ')' mblock cont
214                         { $$ = block_end($4,
215                                  newFOROP(0, $1, $2, $5, $7, $9, $10)); }
216         |       label FOR scalar '(' remember mexpr ')' mblock cont
217                         { $$ = block_end($5,
218                                  newFOROP(0, $1, $2, mod($3, OP_ENTERLOOP),
219                                           $6, $8, $9)); }
220         |       label FOR '(' remember mexpr ')' mblock cont
221                         { $$ = block_end($4,
222                                  newFOROP(0, $1, $2, Nullop, $5, $7, $8)); }
223         |       label FOR '(' remember mnexpr ';' mtexpr ';' mnexpr ')' mblock
224                         /* basically fake up an initialize-while lineseq */
225                         { OP *forop = append_elem(OP_LINESEQ,
226                                         scalar($5),
227                                         newWHILEOP(0, 1, (LOOP*)Nullop,
228                                                    $2, scalar($7),
229                                                    $11, scalar($9)));
230                           PL_copline = $2;
231                           $$ = block_end($4, newSTATEOP(0, $1, forop)); }
232         |       label block cont  /* a block is a loop that happens once */
233                         { $$ = newSTATEOP(0, $1,
234                                  newWHILEOP(0, 1, (LOOP*)Nullop,
235                                             NOLINE, Nullop, $2, $3)); }
236         ;
237
238 nexpr   :       /* NULL */
239                         { $$ = Nullop; }
240         |       sideff
241         ;
242
243 texpr   :       /* NULL means true */
244                         { (void)scan_num("1"); $$ = yylval.opval; }
245         |       expr
246         ;
247
248 iexpr   :       expr
249                         { $$ = invert(scalar($1)); }
250         ;
251
252 mexpr   :       expr
253                         { $$ = $1; intro_my(); }
254         ;
255
256 mnexpr  :       nexpr
257                         { $$ = $1; intro_my(); }
258         ;
259
260 mtexpr  :       texpr
261                         { $$ = $1; intro_my(); }
262         ;
263
264 miexpr  :       iexpr
265                         { $$ = $1; intro_my(); }
266         ;
267
268 label   :       /* empty */
269                         { $$ = Nullch; }
270         |       LABEL
271         ;
272
273 decl    :       format
274                         { $$ = 0; }
275         |       subrout
276                         { $$ = 0; }
277         |       package
278                         { $$ = 0; }
279         |       use
280                         { $$ = 0; }
281         ;
282
283 format  :       FORMAT startformsub formname block
284                         { newFORM($2, $3, $4); }
285         ;
286
287 formname:       WORD            { $$ = $1; }
288         |       /* NULL */      { $$ = Nullop; }
289         ;
290
291 subrout :       SUB startsub subname proto subbody
292                         { newSUB($2, $3, $4, $5); }
293         ;
294
295 startsub:       /* NULL */      /* start a regular subroutine scope */
296                         { $$ = start_subparse(FALSE, 0); }
297         ;
298
299 startanonsub:   /* NULL */      /* start an anonymous subroutine scope */
300                         { $$ = start_subparse(FALSE, CVf_ANON); }
301         ;
302
303 startformsub:   /* NULL */      /* start a format subroutine scope */
304                         { $$ = start_subparse(TRUE, 0); }
305         ;
306
307 subname :       WORD    { STRLEN n_a; char *name = SvPV(((SVOP*)$1)->op_sv,n_a);
308                           if (strEQ(name, "BEGIN") || strEQ(name, "END")
309                               || strEQ(name, "INIT"))
310                               CvUNIQUE_on(PL_compcv);
311                           $$ = $1; }
312         ;
313
314 proto   :       /* NULL */
315                         { $$ = Nullop; }
316         |       THING
317         ;
318
319 subbody :       block   { $$ = $1; }
320         |       ';'     { $$ = Nullop; PL_expect = XSTATE; }
321         ;
322
323 package :       PACKAGE WORD ';'
324                         { package($2); }
325         |       PACKAGE ';'
326                         { package(Nullop); }
327         ;
328
329 use     :       USE startsub
330                         { CvUNIQUE_on(PL_compcv); /* It's a BEGIN {} */ }
331                     WORD WORD listexpr ';'
332                         { utilize($1, $2, $4, $5, $6); }
333         ;
334
335 expr    :       expr ANDOP expr
336                         { $$ = newLOGOP(OP_AND, 0, $1, $3); }
337         |       expr OROP expr
338                         { $$ = newLOGOP($2, 0, $1, $3); }
339         |       argexpr
340         ;
341
342 argexpr :       argexpr ','
343                         { $$ = $1; }
344         |       argexpr ',' term
345                         { $$ = append_elem(OP_LIST, $1, $3); }
346         |       term
347         ;
348
349 listop  :       LSTOP indirob argexpr
350                         { $$ = convert($1, OPf_STACKED,
351                                 prepend_elem(OP_LIST, newGVREF($1,$2), $3) ); }
352         |       FUNC '(' indirob expr ')'
353                         { $$ = convert($1, OPf_STACKED,
354                                 prepend_elem(OP_LIST, newGVREF($1,$3), $4) ); }
355         |       term ARROW method '(' listexprcom ')'
356                         { $$ = convert(OP_ENTERSUB, OPf_STACKED,
357                                 append_elem(OP_LIST,
358                                     prepend_elem(OP_LIST, scalar($1), $5),
359                                     newUNOP(OP_METHOD, 0, $3))); }
360         |       METHOD indirob listexpr
361                         { $$ = convert(OP_ENTERSUB, OPf_STACKED,
362                                 append_elem(OP_LIST,
363                                     prepend_elem(OP_LIST, $2, $3),
364                                     newUNOP(OP_METHOD, 0, $1))); }
365         |       FUNCMETH indirob '(' listexprcom ')'
366                         { $$ = convert(OP_ENTERSUB, OPf_STACKED,
367                                 append_elem(OP_LIST,
368                                     prepend_elem(OP_LIST, $2, $4),
369                                     newUNOP(OP_METHOD, 0, $1))); }
370         |       LSTOP listexpr
371                         { $$ = convert($1, 0, $2); }
372         |       FUNC '(' listexprcom ')'
373                         { $$ = convert($1, 0, $3); }
374         |       LSTOPSUB startanonsub block
375                         { $3 = newANONSUB($2, 0, $3); }
376                     listexpr            %prec LSTOP
377                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
378                                  append_elem(OP_LIST,
379                                    prepend_elem(OP_LIST, $3, $5), $1)); }
380         ;
381
382 method  :       METHOD
383         |       scalar
384         ;
385
386 term    :       term ASSIGNOP term
387                         { $$ = newASSIGNOP(OPf_STACKED, $1, $2, $3); }
388         |       term POWOP term
389                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
390         |       term MULOP term
391                         {   if ($2 != OP_REPEAT)
392                                 scalar($1);
393                             $$ = newBINOP($2, 0, $1, scalar($3)); }
394         |       term ADDOP term
395                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
396         |       term SHIFTOP term
397                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
398         |       term RELOP term
399                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
400         |       term EQOP term
401                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
402         |       term BITANDOP term
403                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
404         |       term BITOROP term
405                         { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
406         |       term DOTDOT term
407                         { $$ = newRANGE($2, scalar($1), scalar($3));}
408         |       term ANDAND term
409                         { $$ = newLOGOP(OP_AND, 0, $1, $3); }
410         |       term OROR term
411                         { $$ = newLOGOP(OP_OR, 0, $1, $3); }
412         |       term '?' term ':' term
413                         { $$ = newCONDOP(0, $1, $3, $5); }
414         |       term MATCHOP term
415                         { $$ = bind_match($2, $1, $3); }
416
417         |       '-' term %prec UMINUS
418                         { $$ = newUNOP(OP_NEGATE, 0, scalar($2)); }
419         |       '+' term %prec UMINUS
420                         { $$ = $2; }
421         |       '!' term
422                         { $$ = newUNOP(OP_NOT, 0, scalar($2)); }
423         |       '~' term
424                         { $$ = newUNOP(OP_COMPLEMENT, 0, scalar($2));}
425         |       REFGEN term
426                         { $$ = newUNOP(OP_REFGEN, 0, mod($2,OP_REFGEN)); }
427         |       term POSTINC
428                         { $$ = newUNOP(OP_POSTINC, 0,
429                                         mod(scalar($1), OP_POSTINC)); }
430         |       term POSTDEC
431                         { $$ = newUNOP(OP_POSTDEC, 0,
432                                         mod(scalar($1), OP_POSTDEC)); }
433         |       PREINC term
434                         { $$ = newUNOP(OP_PREINC, 0,
435                                         mod(scalar($2), OP_PREINC)); }
436         |       PREDEC term
437                         { $$ = newUNOP(OP_PREDEC, 0,
438                                         mod(scalar($2), OP_PREDEC)); }
439         |       local term      %prec UNIOP
440                         { $$ = localize($2,$1); }
441         |       '(' expr ')'
442                         { $$ = sawparens($2); }
443         |       '(' ')'
444                         { $$ = sawparens(newNULLLIST()); }
445         |       '[' expr ']'                            %prec '('
446                         { $$ = newANONLIST($2); }
447         |       '[' ']'                                 %prec '('
448                         { $$ = newANONLIST(Nullop); }
449         |       HASHBRACK expr ';' '}'                  %prec '('
450                         { $$ = newANONHASH($2); }
451         |       HASHBRACK ';' '}'                               %prec '('
452                         { $$ = newANONHASH(Nullop); }
453         |       ANONSUB startanonsub proto block                %prec '('
454                         { $$ = newANONSUB($2, $3, $4); }
455         |       scalar  %prec '('
456                         { $$ = $1; }
457         |       star '{' expr ';' '}'
458                         { $$ = newBINOP(OP_GELEM, 0, $1, scalar($3)); }
459         |       star    %prec '('
460                         { $$ = $1; }
461         |       scalar '[' expr ']'     %prec '('
462                         { $$ = newBINOP(OP_AELEM, 0, oopsAV($1), scalar($3)); }
463         |       term ARROW '[' expr ']' %prec '('
464                         { $$ = newBINOP(OP_AELEM, 0,
465                                         ref(newAVREF($1),OP_RV2AV),
466                                         scalar($4));}
467         |       term '[' expr ']'       %prec '('
468                         { assertref($1); $$ = newBINOP(OP_AELEM, 0,
469                                         ref(newAVREF($1),OP_RV2AV),
470                                         scalar($3));}
471         |       hsh     %prec '('
472                         { $$ = $1; }
473         |       ary     %prec '('
474                         { $$ = $1; }
475         |       arylen  %prec '('
476                         { $$ = newUNOP(OP_AV2ARYLEN, 0, ref($1, OP_AV2ARYLEN));}
477         |       scalar '{' expr ';' '}' %prec '('
478                         { $$ = newBINOP(OP_HELEM, 0, oopsHV($1), jmaybe($3));
479                             PL_expect = XOPERATOR; }
480         |       term ARROW '{' expr ';' '}'     %prec '('
481                         { $$ = newBINOP(OP_HELEM, 0,
482                                         ref(newHVREF($1),OP_RV2HV),
483                                         jmaybe($4));
484                             PL_expect = XOPERATOR; }
485         |       term '{' expr ';' '}'   %prec '('
486                         { assertref($1); $$ = newBINOP(OP_HELEM, 0,
487                                         ref(newHVREF($1),OP_RV2HV),
488                                         jmaybe($3));
489                             PL_expect = XOPERATOR; }
490         |       '(' expr ')' '[' expr ']'       %prec '('
491                         { $$ = newSLICEOP(0, $5, $2); }
492         |       '(' ')' '[' expr ']'    %prec '('
493                         { $$ = newSLICEOP(0, $4, Nullop); }
494         |       ary '[' expr ']'        %prec '('
495                         { $$ = prepend_elem(OP_ASLICE,
496                                 newOP(OP_PUSHMARK, 0),
497                                     newLISTOP(OP_ASLICE, 0,
498                                         list($3),
499                                         ref($1, OP_ASLICE))); }
500         |       ary '{' expr ';' '}'    %prec '('
501                         { $$ = prepend_elem(OP_HSLICE,
502                                 newOP(OP_PUSHMARK, 0),
503                                     newLISTOP(OP_HSLICE, 0,
504                                         list($3),
505                                         ref(oopsHV($1), OP_HSLICE)));
506                             PL_expect = XOPERATOR; }
507         |       THING   %prec '('
508                         { $$ = $1; }
509         |       amper
510                         { $$ = newUNOP(OP_ENTERSUB, 0, scalar($1)); }
511         |       amper '(' ')'
512                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); }
513         |       amper '(' expr ')'
514                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
515                             append_elem(OP_LIST, $3, scalar($1))); }
516         |       NOAMP WORD listexpr
517                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
518                             append_elem(OP_LIST, $3, scalar($2))); }
519         |       DO term %prec UNIOP
520                         { $$ = dofile($2); }
521         |       DO block        %prec '('
522                         { $$ = newUNOP(OP_NULL, OPf_SPECIAL, scope($2)); }
523         |       DO WORD '(' ')'
524                         { $$ = newUNOP(OP_ENTERSUB,
525                             OPf_SPECIAL|OPf_STACKED,
526                             prepend_elem(OP_LIST,
527                                 scalar(newCVREF(
528                                     (OPpENTERSUB_AMPER<<8),
529                                     scalar($2)
530                                 )),Nullop)); dep();}
531         |       DO WORD '(' expr ')'
532                         { $$ = newUNOP(OP_ENTERSUB,
533                             OPf_SPECIAL|OPf_STACKED,
534                             append_elem(OP_LIST,
535                                 $4,
536                                 scalar(newCVREF(
537                                     (OPpENTERSUB_AMPER<<8),
538                                     scalar($2)
539                                 )))); dep();}
540         |       DO scalar '(' ')'
541                         { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
542                             prepend_elem(OP_LIST,
543                                 scalar(newCVREF(0,scalar($2))), Nullop)); dep();}
544         |       DO scalar '(' expr ')'
545                         { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
546                             prepend_elem(OP_LIST,
547                                 $4,
548                                 scalar(newCVREF(0,scalar($2))))); dep();}
549         |       term ARROW '(' ')'      %prec '('
550                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
551                                    newCVREF(0, scalar($1))); }
552         |       term ARROW '(' expr ')' %prec '('
553                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
554                                    append_elem(OP_LIST, $4,
555                                        newCVREF(0, scalar($1)))); }
556         |       LOOPEX
557                         { $$ = newOP($1, OPf_SPECIAL);
558                             PL_hints |= HINT_BLOCK_SCOPE; }
559         |       LOOPEX term
560                         { $$ = newLOOPEX($1,$2); }
561         |       NOTOP argexpr
562                         { $$ = newUNOP(OP_NOT, 0, scalar($2)); }
563         |       UNIOP
564                         { $$ = newOP($1, 0); }
565         |       UNIOP block
566                         { $$ = newUNOP($1, 0, $2); }
567         |       UNIOP term
568                         { $$ = newUNOP($1, 0, $2); }
569         |       UNIOPSUB term
570                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
571                             append_elem(OP_LIST, $2, scalar($1))); }
572         |       FUNC0
573                         { $$ = newOP($1, 0); }
574         |       FUNC0 '(' ')'
575                         { $$ = newOP($1, 0); }
576         |       FUNC0SUB
577                         { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
578                                 scalar($1)); }
579         |       FUNC1 '(' ')'
580                         { $$ = newOP($1, OPf_SPECIAL); }
581         |       FUNC1 '(' expr ')'
582                         { $$ = newUNOP($1, 0, $3); }
583         |       PMFUNC '(' term ')'
584                         { $$ = pmruntime($1, $3, Nullop); }
585         |       PMFUNC '(' term ',' term ')'
586                         { $$ = pmruntime($1, $3, $5); }
587         |       WORD
588         |       listop
589         ;
590
591 listexpr:       /* NULL */
592                         { $$ = Nullop; }
593         |       argexpr
594                         { $$ = $1; }
595         ;
596
597 listexprcom:    /* NULL */
598                         { $$ = Nullop; }
599         |       expr
600                         { $$ = $1; }
601         |       expr ','
602                         { $$ = $1; }
603         ;
604
605 local   :       LOCAL   { $$ = 0; }
606         |       MY      { $$ = 1; }
607         ;
608
609 my_scalar:      scalar
610                         { PL_in_my = 0; $$ = my($1); }
611         ;
612
613 amper   :       '&' indirob
614                         { $$ = newCVREF($1,$2); }
615         ;
616
617 scalar  :       '$' indirob
618                         { $$ = newSVREF($2); }
619         ;
620
621 ary     :       '@' indirob
622                         { $$ = newAVREF($2); }
623         ;
624
625 hsh     :       '%' indirob
626                         { $$ = newHVREF($2); }
627         ;
628
629 arylen  :       DOLSHARP indirob
630                         { $$ = newAVREF($2); }
631         ;
632
633 star    :       '*' indirob
634                         { $$ = newGVREF(0,$2); }
635         ;
636
637 indirob :       WORD
638                         { $$ = scalar($1); }
639         |       scalar
640                         { $$ = scalar($1);  }
641         |       block
642                         { $$ = scope($1); }
643
644         |       PRIVATEREF
645                         { $$ = $1; }
646         ;
647
648 %% /* PROGRAM */