This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
This is my patch patch.1n for perl5.001.
[perl5.git] / perly.y
CommitLineData
a0d0e21e 1/* perly.y
a687059c 2 *
a0d0e21e 3 * Copyright (c) 1991-1994, Larry Wall
a687059c 4 *
9ef589d8
LW
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.
8d063cd8 7 *
a0d0e21e
LW
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 that wander are lost.'
8d063cd8
LW
13 */
14
15%{
79072805 16#include "EXTERN.h"
8d063cd8 17#include "perl.h"
378cc40b 18
a0d0e21e
LW
19static void
20dep()
21{
22 deprecate("\"do\" to call subroutines");
23}
f0fcb552 24
8d063cd8
LW
25%}
26
27%start prog
28
29%union {
79072805
LW
30 I32 ival;
31 char *pval;
32 OP *opval;
33 GV *gvval;
8d063cd8
LW
34}
35
f0fcb552
LW
36%token <ival> '{' ')'
37
a0d0e21e 38%token <opval> WORD METHOD FUNCMETH THING PMFUNC PRIVATEREF
79072805 39%token <pval> LABEL
a0d0e21e 40%token <ival> FORMAT SUB ANONSUB PACKAGE USE
79072805
LW
41%token <ival> WHILE UNTIL IF UNLESS ELSE ELSIF CONTINUE FOR
42%token <ival> LOOPEX DOTDOT
43%token <ival> FUNC0 FUNC1 FUNC
44%token <ival> RELOP EQOP MULOP ADDOP
a0d0e21e 45%token <ival> DOLSHARP DO LOCAL HASHBRACK NOAMP
79072805 46
a0d0e21e
LW
47%type <ival> prog decl format remember startsub
48%type <opval> block lineseq line loop cond nexpr else argexpr
49%type <opval> expr term scalar ary hsh arylen star amper sideff
50%type <opval> listexpr listexprcom indirob
51%type <opval> texpr listop method
79072805
LW
52%type <pval> label
53%type <opval> cont
54
a0d0e21e 55%left <ival> OROP
463ee0b2 56%left ANDOP
a0d0e21e 57%left NOTOP
79072805 58%nonassoc <ival> LSTOP
8d063cd8 59%left ','
a0d0e21e 60%right <ival> ASSIGNOP
8d063cd8
LW
61%right '?' ':'
62%nonassoc DOTDOT
63%left OROR
64%left ANDAND
79072805
LW
65%left <ival> BITOROP
66%left <ival> BITANDOP
a687059c
LW
67%nonassoc EQOP
68%nonassoc RELOP
378cc40b 69%nonassoc <ival> UNIOP
79072805 70%left <ival> SHIFTOP
a687059c
LW
71%left ADDOP
72%left MULOP
8990e307 73%left <ival> MATCHOP
79072805
LW
74%right '!' '~' UMINUS REFGEN
75%right <ival> POWOP
76%nonassoc PREINC PREDEC POSTINC POSTDEC
8990e307 77%left ARROW
8d063cd8
LW
78%left '('
79
80%% /* RULES */
81
ae986130
LW
82prog : /* NULL */
83 {
84#if defined(YYDEBUG) && defined(DEBUGGING)
85 yydebug = (debug & 1);
86#endif
8990e307 87 expect = XSTATE;
ae986130
LW
88 }
89 /*CONTINUED*/ lineseq
a0d0e21e 90 { newPROG($2); }
8d063cd8
LW
91 ;
92
a687059c 93block : '{' remember lineseq '}'
a0d0e21e
LW
94 { $$ = block_end($1,$2,$3); }
95 ;
96
97remember: /* NULL */ /* start a lexical scope */
98 { $$ = block_start(); }
8d063cd8
LW
99 ;
100
101lineseq : /* NULL */
79072805
LW
102 { $$ = Nullop; }
103 | lineseq decl
104 { $$ = $1; }
8d063cd8 105 | lineseq line
463ee0b2 106 { $$ = append_list(OP_LINESEQ,
a0d0e21e
LW
107 (LISTOP*)$1, (LISTOP*)$2);
108 pad_reset_pending = TRUE;
85e6fe83 109 if ($1 && $2) hints |= HINT_BLOCK_SCOPE; }
8d063cd8
LW
110 ;
111
79072805
LW
112line : label cond
113 { $$ = newSTATEOP(0, $1, $2); }
8d063cd8
LW
114 | loop /* loops add their own labels */
115 | label ';'
116 { if ($1 != Nullch) {
79072805 117 $$ = newSTATEOP(0, $1, newOP(OP_NULL, 0));
450a55e4
LW
118 }
119 else {
79072805
LW
120 $$ = Nullop;
121 copline = NOLINE;
32c2e4fb 122 }
8990e307 123 expect = XSTATE; }
8d063cd8 124 | label sideff ';'
79072805 125 { $$ = newSTATEOP(0, $1, $2);
8990e307 126 expect = XSTATE; }
8d063cd8
LW
127 ;
128
a687059c 129sideff : error
79072805 130 { $$ = Nullop; }
a687059c 131 | expr
79072805 132 { $$ = $1; }
a687059c 133 | expr IF expr
79072805 134 { $$ = newLOGOP(OP_AND, 0, $3, $1); }
a687059c 135 | expr UNLESS expr
79072805 136 { $$ = newLOGOP(OP_OR, 0, $3, $1); }
a687059c 137 | expr WHILE expr
8990e307 138 { $$ = newLOOPOP(OPf_PARENS, 1, scalar($3), $1); }
a687059c 139 | expr UNTIL expr
8990e307 140 { $$ = newLOOPOP(OPf_PARENS, 1, invert(scalar($3)), $1);}
79072805
LW
141 ;
142
143else : /* NULL */
144 { $$ = Nullop; }
145 | ELSE block
146 { $$ = scope($2); }
147 | ELSIF '(' expr ')' block else
148 { copline = $1;
85e6fe83
LW
149 $$ = newSTATEOP(0, 0,
150 newCONDOP(0, $3, scope($5), $6)); }
79072805
LW
151 ;
152
153cond : IF '(' expr ')' block else
154 { copline = $1;
155 $$ = newCONDOP(0, $3, scope($5), $6); }
156 | UNLESS '(' expr ')' block else
157 { copline = $1;
158 $$ = newCONDOP(0,
159 invert(scalar($3)), scope($5), $6); }
160 | IF block block else
161 { copline = $1;
a0d0e21e 162 deprecate("if BLOCK BLOCK");
79072805
LW
163 $$ = newCONDOP(0, scope($2), scope($3), $4); }
164 | UNLESS block block else
165 { copline = $1;
a0d0e21e 166 deprecate("unless BLOCK BLOCK");
79072805
LW
167 $$ = newCONDOP(0, invert(scalar(scope($2))),
168 scope($3), $4); }
169 ;
170
171cont : /* NULL */
172 { $$ = Nullop; }
173 | CONTINUE block
174 { $$ = scope($2); }
175 ;
176
177loop : label WHILE '(' texpr ')' block cont
178 { copline = $2;
179 $$ = newSTATEOP(0, $1,
463ee0b2
LW
180 newWHILEOP(0, 1, (LOOP*)Nullop,
181 $4, $6, $7) ); }
79072805
LW
182 | label UNTIL '(' expr ')' block cont
183 { copline = $2;
184 $$ = newSTATEOP(0, $1,
463ee0b2 185 newWHILEOP(0, 1, (LOOP*)Nullop,
79072805
LW
186 invert(scalar($4)), $6, $7) ); }
187 | label WHILE block block cont
188 { copline = $2;
189 $$ = newSTATEOP(0, $1,
463ee0b2 190 newWHILEOP(0, 1, (LOOP*)Nullop,
79072805
LW
191 scope($3), $4, $5) ); }
192 | label UNTIL block block cont
193 { copline = $2;
194 $$ = newSTATEOP(0, $1,
463ee0b2 195 newWHILEOP(0, 1, (LOOP*)Nullop,
79072805 196 invert(scalar(scope($3))), $4, $5)); }
a0d0e21e 197 | label FOR scalar '(' expr ')' block cont
463ee0b2 198 { $$ = newFOROP(0, $1, $2, mod($3, OP_ENTERLOOP),
79072805 199 $5, $7, $8); }
a0d0e21e 200 | label FOR '(' expr ')' block cont
79072805 201 { $$ = newFOROP(0, $1, $2, Nullop, $4, $6, $7); }
8d063cd8
LW
202 | label FOR '(' nexpr ';' texpr ';' nexpr ')' block
203 /* basically fake up an initialize-while lineseq */
79072805
LW
204 { copline = $2;
205 $$ = append_elem(OP_LINESEQ,
206 newSTATEOP(0, $1, scalar($4)),
207 newSTATEOP(0, $1,
463ee0b2 208 newWHILEOP(0, 1, (LOOP*)Nullop,
79072805
LW
209 scalar($6), $10, scalar($8)) )); }
210 | label block cont /* a block is a loop that happens once */
211 { $$ = newSTATEOP(0,
463ee0b2
LW
212 $1, newWHILEOP(0, 1, (LOOP*)Nullop,
213 Nullop, $2, $3)); }
8d063cd8
LW
214 ;
215
216nexpr : /* NULL */
79072805 217 { $$ = Nullop; }
8d063cd8
LW
218 | sideff
219 ;
220
221texpr : /* NULL means true */
79072805 222 { (void)scan_num("1"); $$ = yylval.opval; }
8d063cd8
LW
223 | expr
224 ;
225
226label : /* empty */
227 { $$ = Nullch; }
32c2e4fb 228 | LABEL
8d063cd8
LW
229 ;
230
8d063cd8
LW
231decl : format
232 { $$ = 0; }
233 | subrout
234 { $$ = 0; }
a687059c
LW
235 | package
236 { $$ = 0; }
a0d0e21e 237 | use
85e6fe83 238 { $$ = 0; }
8d063cd8
LW
239 ;
240
a0d0e21e
LW
241format : FORMAT startsub WORD block
242 { newFORM($2, $3, $4); }
243 | FORMAT startsub block
244 { newFORM($2, Nullop, $3); }
8d063cd8
LW
245 ;
246
a0d0e21e
LW
247subrout : SUB startsub WORD block
248 { newSUB($2, $3, $4); }
249 | SUB startsub WORD ';'
250 { newSUB($2, $3, Nullop); expect = XSTATE; }
251 ;
252
253startsub: /* NULL */ /* start a subroutine scope */
254 { $$ = start_subparse(); }
8d063cd8
LW
255 ;
256
a687059c 257package : PACKAGE WORD ';'
79072805 258 { package($2); }
93a17b20
LW
259 | PACKAGE ';'
260 { package(Nullop); }
a687059c
LW
261 ;
262
a0d0e21e
LW
263use : USE WORD listexpr ';'
264 { utilize($1, $2, $3); }
85e6fe83
LW
265 ;
266
a0d0e21e
LW
267expr : expr ANDOP expr
268 { $$ = newLOGOP(OP_AND, 0, $1, $3); }
269 | expr OROP expr
270 { $$ = newLOGOP($2, 0, $1, $3); }
271 | NOTOP expr
272 { $$ = newUNOP(OP_NOT, 0, scalar($2)); }
273 | argexpr
274 ;
275
276argexpr : argexpr ','
277 { $$ = $1; }
278 | argexpr ',' term
79072805 279 { $$ = append_elem(OP_LIST, $1, $3); }
a0d0e21e 280 | term
8d063cd8
LW
281 ;
282
a0d0e21e 283listop : LSTOP indirob argexpr
79072805 284 { $$ = convert($1, OPf_STACKED,
a0d0e21e
LW
285 prepend_elem(OP_LIST, newGVREF($1,$2), $3) ); }
286 | FUNC '(' indirob expr ')'
79072805 287 { $$ = convert($1, OPf_STACKED,
a0d0e21e
LW
288 prepend_elem(OP_LIST, newGVREF($1,$3), $4) ); }
289 | term ARROW method '(' listexprcom ')'
290 { $$ = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL,
291 append_elem(OP_LIST,
292 prepend_elem(OP_LIST, $1, list($5)),
293 newUNOP(OP_METHOD, 0, $3))); }
79072805 294 | METHOD indirob listexpr
a0d0e21e
LW
295 { $$ = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL,
296 append_elem(OP_LIST,
297 prepend_elem(OP_LIST, $2, list($3)),
298 newUNOP(OP_METHOD, 0, $1))); }
299 | FUNCMETH indirob '(' listexprcom ')'
300 { $$ = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL,
301 append_elem(OP_LIST,
302 prepend_elem(OP_LIST, $2, list($4)),
303 newUNOP(OP_METHOD, 0, $1))); }
79072805
LW
304 | LSTOP listexpr
305 { $$ = convert($1, 0, $2); }
a0d0e21e 306 | FUNC '(' listexprcom ')'
79072805 307 { $$ = convert($1, 0, $3); }
a687059c
LW
308 ;
309
a0d0e21e
LW
310method : METHOD
311 | scalar
312 ;
313
314term : term ASSIGNOP term
315 { $$ = newASSIGNOP(OPf_STACKED, $1, $2, $3); }
316 | term POWOP term
79072805 317 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
a0d0e21e 318 | term MULOP term
79072805
LW
319 { if ($2 != OP_REPEAT)
320 scalar($1);
321 $$ = newBINOP($2, 0, $1, scalar($3)); }
a0d0e21e 322 | term ADDOP term
79072805 323 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
a0d0e21e 324 | term SHIFTOP term
79072805 325 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
a0d0e21e 326 | term RELOP term
79072805 327 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
a0d0e21e 328 | term EQOP term
79072805 329 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
a0d0e21e 330 | term BITANDOP term
79072805 331 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
a0d0e21e 332 | term BITOROP term
79072805 333 { $$ = newBINOP($2, 0, scalar($1), scalar($3)); }
a0d0e21e 334 | term DOTDOT term
79072805 335 { $$ = newRANGE($2, scalar($1), scalar($3));}
a0d0e21e 336 | term ANDAND term
463ee0b2 337 { $$ = newLOGOP(OP_AND, 0, $1, $3); }
a0d0e21e 338 | term OROR term
463ee0b2 339 { $$ = newLOGOP(OP_OR, 0, $1, $3); }
a0d0e21e 340 | term '?' term ':' term
79072805 341 { $$ = newCONDOP(0, $1, $3, $5); }
a0d0e21e 342 | term MATCHOP term
79072805 343 { $$ = bind_match($2, $1, $3); }
8d063cd8 344
a0d0e21e 345 | '-' term %prec UMINUS
79072805 346 { $$ = newUNOP(OP_NEGATE, 0, scalar($2)); }
a687059c
LW
347 | '+' term %prec UMINUS
348 { $$ = $2; }
8d063cd8 349 | '!' term
79072805 350 { $$ = newUNOP(OP_NOT, 0, scalar($2)); }
8d063cd8 351 | '~' term
79072805
LW
352 { $$ = newUNOP(OP_COMPLEMENT, 0, scalar($2));}
353 | REFGEN term
a0d0e21e 354 { $$ = newUNOP(OP_REFGEN, 0, mod($2,OP_REFGEN)); }
79072805
LW
355 | term POSTINC
356 { $$ = newUNOP(OP_POSTINC, 0,
463ee0b2 357 mod(scalar($1), OP_POSTINC)); }
79072805
LW
358 | term POSTDEC
359 { $$ = newUNOP(OP_POSTDEC, 0,
463ee0b2 360 mod(scalar($1), OP_POSTDEC)); }
79072805
LW
361 | PREINC term
362 { $$ = newUNOP(OP_PREINC, 0,
463ee0b2 363 mod(scalar($2), OP_PREINC)); }
79072805
LW
364 | PREDEC term
365 { $$ = newUNOP(OP_PREDEC, 0,
463ee0b2 366 mod(scalar($2), OP_PREDEC)); }
a0d0e21e 367 | LOCAL term %prec UNIOP
93a17b20 368 { $$ = localize($2,$1); }
a0d0e21e 369 | '(' expr ')'
79072805 370 { $$ = sawparens($2); }
8d063cd8 371 | '(' ')'
8990e307 372 { $$ = sawparens(newNULLLIST()); }
a0d0e21e 373 | '[' expr ']' %prec '('
79072805
LW
374 { $$ = newANONLIST($2); }
375 | '[' ']' %prec '('
376 { $$ = newANONLIST(Nullop); }
a0d0e21e 377 | HASHBRACK expr ';' '}' %prec '('
79072805
LW
378 { $$ = newANONHASH($2); }
379 | HASHBRACK ';' '}' %prec '('
380 { $$ = newANONHASH(Nullop); }
a0d0e21e
LW
381 | ANONSUB startsub block %prec '('
382 { $$ = newANONSUB($2, $3); }
79072805 383 | scalar %prec '('
8d063cd8 384 { $$ = $1; }
79072805 385 | star %prec '('
8d063cd8 386 { $$ = $1; }
79072805
LW
387 | scalar '[' expr ']' %prec '('
388 { $$ = newBINOP(OP_AELEM, 0, oopsAV($1), scalar($3)); }
389 | term ARROW '[' expr ']' %prec '('
390 { $$ = newBINOP(OP_AELEM, 0,
8990e307 391 ref(newAVREF($1),OP_RV2AV),
79072805 392 scalar($4));}
463ee0b2 393 | term '[' expr ']' %prec '('
a0d0e21e 394 { assertref($1); $$ = newBINOP(OP_AELEM, 0,
8990e307 395 ref(newAVREF($1),OP_RV2AV),
463ee0b2 396 scalar($3));}
79072805 397 | hsh %prec '('
8d063cd8 398 { $$ = $1; }
79072805 399 | ary %prec '('
8d063cd8 400 { $$ = $1; }
79072805
LW
401 | arylen %prec '('
402 { $$ = newUNOP(OP_AV2ARYLEN, 0, ref($1, OP_AV2ARYLEN));}
403 | scalar '{' expr ';' '}' %prec '('
404 { $$ = newBINOP(OP_HELEM, 0, oopsHV($1), jmaybe($3));
405 expect = XOPERATOR; }
406 | term ARROW '{' expr ';' '}' %prec '('
407 { $$ = newBINOP(OP_HELEM, 0,
8990e307 408 ref(newHVREF($1),OP_RV2HV),
79072805
LW
409 jmaybe($4));
410 expect = XOPERATOR; }
463ee0b2 411 | term '{' expr ';' '}' %prec '('
a0d0e21e 412 { assertref($1); $$ = newBINOP(OP_HELEM, 0,
8990e307 413 ref(newHVREF($1),OP_RV2HV),
463ee0b2
LW
414 jmaybe($3));
415 expect = XOPERATOR; }
a0d0e21e 416 | '(' expr ')' '[' expr ']' %prec '('
79072805
LW
417 { $$ = newSLICEOP(0, $5, $2); }
418 | '(' ')' '[' expr ']' %prec '('
419 { $$ = newSLICEOP(0, $4, Nullop); }
420 | ary '[' expr ']' %prec '('
421 { $$ = prepend_elem(OP_ASLICE,
422 newOP(OP_PUSHMARK, 0),
79072805
LW
423 newLISTOP(OP_ASLICE, 0,
424 list($3),
a0d0e21e 425 ref($1, OP_ASLICE))); }
79072805
LW
426 | ary '{' expr ';' '}' %prec '('
427 { $$ = prepend_elem(OP_HSLICE,
428 newOP(OP_PUSHMARK, 0),
79072805
LW
429 newLISTOP(OP_HSLICE, 0,
430 list($3),
a0d0e21e 431 ref(oopsHV($1), OP_HSLICE)));
79072805
LW
432 expect = XOPERATOR; }
433 | THING %prec '('
434 { $$ = $1; }
435 | amper
a0d0e21e 436 { $$ = newUNOP(OP_ENTERSUB, 0,
79072805
LW
437 scalar($1)); }
438 | amper '(' ')'
a0d0e21e
LW
439 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); }
440 | amper '(' expr ')'
441 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
442 list(append_elem(OP_LIST, $3, scalar($1)))); }
93a17b20 443 | NOAMP WORD listexpr
a0d0e21e
LW
444 { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
445 list(append_elem(OP_LIST,
446 $3, newCVREF(scalar($2))))); }
447 | DO term %prec UNIOP
463ee0b2 448 { $$ = newUNOP(OP_DOFILE, 0, scalar($2)); }
79072805
LW
449 | DO block %prec '('
450 { $$ = newUNOP(OP_NULL, OPf_SPECIAL, scope($2)); }
8d063cd8 451 | DO WORD '(' ')'
a0d0e21e 452 { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
79072805 453 list(prepend_elem(OP_LIST,
a0d0e21e
LW
454 scalar(newCVREF(scalar($2))), Nullop))); dep();}
455 | DO WORD '(' expr ')'
456 { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
457 list(append_elem(OP_LIST,
458 $4,
459 scalar(newCVREF(scalar($2)))))); dep();}
79072805 460 | DO scalar '(' ')'
a0d0e21e 461 { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
79072805 462 list(prepend_elem(OP_LIST,
a0d0e21e
LW
463 scalar(newCVREF(scalar($2))), Nullop))); dep();}
464 | DO scalar '(' expr ')'
465 { $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
79072805 466 list(prepend_elem(OP_LIST,
a0d0e21e
LW
467 $4,
468 scalar(newCVREF(scalar($2)))))); dep();}
8d063cd8 469 | LOOPEX
85e6fe83
LW
470 { $$ = newOP($1, OPf_SPECIAL);
471 hints |= HINT_BLOCK_SCOPE; }
a0d0e21e 472 | LOOPEX term
8990e307 473 { $$ = newLOOPEX($1,$2); }
8d063cd8 474 | UNIOP
79072805 475 { $$ = newOP($1, 0); }
f0fcb552 476 | UNIOP block
79072805 477 { $$ = newUNOP($1, 0, $2); }
a0d0e21e 478 | UNIOP term
79072805 479 { $$ = newUNOP($1, 0, $2); }
8d063cd8 480 | FUNC0
79072805 481 { $$ = newOP($1, 0); }
ae986130 482 | FUNC0 '(' ')'
79072805 483 { $$ = newOP($1, 0); }
03a14243 484 | FUNC1 '(' ')'
79072805 485 { $$ = newOP($1, OPf_SPECIAL); }
8d063cd8 486 | FUNC1 '(' expr ')'
79072805 487 { $$ = newUNOP($1, 0, $3); }
a0d0e21e 488 | PMFUNC '(' term ')'
79072805 489 { $$ = pmruntime($1, $3, Nullop); }
a0d0e21e 490 | PMFUNC '(' term ',' term ')'
79072805
LW
491 { $$ = pmruntime($1, $3, $5); }
492 | WORD
378cc40b 493 | listop
8d063cd8
LW
494 ;
495
79072805 496listexpr: /* NULL */
8990e307 497 { $$ = Nullop; }
a0d0e21e
LW
498 | argexpr
499 { $$ = $1; }
500 ;
501
502listexprcom: /* NULL */
503 { $$ = Nullop; }
79072805
LW
504 | expr
505 { $$ = $1; }
a0d0e21e
LW
506 | expr ','
507 { $$ = $1; }
79072805
LW
508 ;
509
510amper : '&' indirob
511 { $$ = newCVREF($2); }
a687059c
LW
512 ;
513
79072805
LW
514scalar : '$' indirob
515 { $$ = newSVREF($2); }
a687059c
LW
516 ;
517
79072805
LW
518ary : '@' indirob
519 { $$ = newAVREF($2); }
520 ;
521
522hsh : '%' indirob
523 { $$ = newHVREF($2); }
524 ;
525
526arylen : DOLSHARP indirob
527 { $$ = newAVREF($2); }
528 ;
529
530star : '*' indirob
a0d0e21e 531 { $$ = newGVREF(0,$2); }
79072805
LW
532 ;
533
534indirob : WORD
535 { $$ = scalar($1); }
536 | scalar
463ee0b2 537 { $$ = scalar($1); }
79072805 538 | block
a0d0e21e 539 { $$ = scope($1); }
79072805 540
93a17b20
LW
541 | PRIVATEREF
542 { $$ = $1; }
8d063cd8
LW
543 ;
544
545%% /* PROGRAM */