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