line |
stmt |
bran |
cond |
sub |
time |
code |
1
|
|
|
|
|
|
/* perly.y |
2
|
|
|
|
|
|
* |
3
|
|
|
|
|
|
* Copyright (c) 1991-2002, 2003, 2004, 2005, 2006 Larry Wall |
4
|
|
|
|
|
|
* Copyright (c) 2007, 2008, 2009, 2010, 2011 by Larry Wall and others |
5
|
|
|
|
|
|
* |
6
|
|
|
|
|
|
* You may distribute under the terms of either the GNU General Public |
7
|
|
|
|
|
|
* License or the Artistic License, as specified in the README file. |
8
|
|
|
|
|
|
* |
9
|
|
|
|
|
|
*/ |
10
|
|
|
|
|
|
|
11
|
|
|
|
|
|
/* |
12
|
|
|
|
|
|
* 'I see,' laughed Strider. 'I look foul and feel fair. Is that it? |
13
|
|
|
|
|
|
* All that is gold does not glitter, not all those who wander are lost.' |
14
|
|
|
|
|
|
* |
15
|
|
|
|
|
|
* [p.171 of _The Lord of the Rings_, I/x: "Strider"] |
16
|
|
|
|
|
|
*/ |
17
|
|
|
|
|
|
|
18
|
|
|
|
|
|
/* |
19
|
|
|
|
|
|
* This file holds the grammar for the Perl language. If edited, you need |
20
|
|
|
|
|
|
* to run regen_perly.pl, which re-creates the files perly.h, perly.tab |
21
|
|
|
|
|
|
* and perly.act which are derived from this. |
22
|
|
|
|
|
|
* |
23
|
|
|
|
|
|
* Note that these derived files are included and compiled twice; once |
24
|
|
|
|
|
|
* from perly.c, and once from madly.c. The second time, a number of MAD |
25
|
|
|
|
|
|
* macros are defined, which compile in extra code that allows the parse |
26
|
|
|
|
|
|
* tree to be accurately dumped. In particular: |
27
|
|
|
|
|
|
* |
28
|
|
|
|
|
|
* MAD defined if compiling madly.c |
29
|
|
|
|
|
|
* DO_MAD(A) expands to A under madly.c, to null otherwise |
30
|
|
|
|
|
|
* IF_MAD(a,b) expands to A under madly.c, to B otherwise |
31
|
|
|
|
|
|
* TOKEN_GETMAD() expands to token_getmad() under madly.c, to null otherwise |
32
|
|
|
|
|
|
* TOKEN_FREE() similarly |
33
|
|
|
|
|
|
* OP_GETMAD() similarly |
34
|
|
|
|
|
|
* IVAL(i) expands to (i)->tk_lval.ival or (i) |
35
|
|
|
|
|
|
* PVAL(p) expands to (p)->tk_lval.pval or (p) |
36
|
|
|
|
|
|
* |
37
|
|
|
|
|
|
* The main job of of this grammar is to call the various newFOO() |
38
|
|
|
|
|
|
* functions in op.c to build a syntax tree of OP structs. |
39
|
|
|
|
|
|
* It relies on the lexer in toke.c to do the tokenizing. |
40
|
|
|
|
|
|
* |
41
|
|
|
|
|
|
* Note: due to the way that the cleanup code works WRT to freeing ops on |
42
|
|
|
|
|
|
* the parse stack, it is dangerous to assign to the $n variables within |
43
|
|
|
|
|
|
* an action. |
44
|
|
|
|
|
|
*/ |
45
|
|
|
|
|
|
|
46
|
|
|
|
|
|
/* Make the parser re-entrant. */ |
47
|
|
|
|
|
|
|
48
|
|
|
|
|
|
%pure_parser |
49
|
|
|
|
|
|
|
50
|
|
|
|
|
|
/* FIXME for MAD - is the new mintro on while and until important? */ |
51
|
|
|
|
|
|
|
52
|
|
|
|
|
|
%start grammar |
53
|
|
|
|
|
|
|
54
|
|
|
|
|
|
%union { |
55
|
|
|
|
|
|
I32 ival; /* __DEFAULT__ (marker for regen_perly.pl; |
56
|
|
|
|
|
|
must always be 1st union member) */ |
57
|
|
|
|
|
|
char *pval; |
58
|
|
|
|
|
|
OP *opval; |
59
|
|
|
|
|
|
GV *gvval; |
60
|
|
|
|
|
|
#ifdef PERL_IN_MADLY_C |
61
|
|
|
|
|
|
TOKEN* p_tkval; |
62
|
|
|
|
|
|
TOKEN* i_tkval; |
63
|
|
|
|
|
|
#else |
64
|
|
|
|
|
|
char *p_tkval; |
65
|
|
|
|
|
|
I32 i_tkval; |
66
|
|
|
|
|
|
#endif |
67
|
|
|
|
|
|
#ifdef PERL_MAD |
68
|
|
|
|
|
|
TOKEN* tkval; |
69
|
|
|
|
|
|
#endif |
70
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
72
|
|
|
|
|
|
%token GRAMPROG GRAMEXPR GRAMBLOCK GRAMBARESTMT GRAMFULLSTMT GRAMSTMTSEQ |
73
|
|
|
|
|
|
|
74
|
|
|
|
|
|
%token '{' '}' '[' ']' '-' '+' '$' '@' '%' '*' '&' ';' '=' '.' |
75
|
|
|
|
|
|
|
76
|
|
|
|
|
|
%token WORD METHOD FUNCMETH THING PMFUNC PRIVATEREF QWLIST |
77
|
|
|
|
|
|
%token FUNC0OP FUNC0SUB UNIOPSUB LSTOPSUB |
78
|
|
|
|
|
|
%token PLUGEXPR PLUGSTMT |
79
|
|
|
|
|
|
%token LABEL |
80
|
|
|
|
|
|
%token FORMAT SUB ANONSUB PACKAGE USE |
81
|
|
|
|
|
|
%token WHILE UNTIL IF UNLESS ELSE ELSIF CONTINUE FOR |
82
|
|
|
|
|
|
%token GIVEN WHEN DEFAULT |
83
|
|
|
|
|
|
%token LOOPEX DOTDOT YADAYADA |
84
|
|
|
|
|
|
%token FUNC0 FUNC1 FUNC UNIOP LSTOP |
85
|
|
|
|
|
|
%token RELOP EQOP MULOP ADDOP |
86
|
|
|
|
|
|
%token DOLSHARP DO HASHBRACK NOAMP |
87
|
|
|
|
|
|
%token LOCAL MY REQUIRE |
88
|
|
|
|
|
|
%token COLONATTR FORMLBRACK FORMRBRACK |
89
|
|
|
|
|
|
|
90
|
|
|
|
|
|
%type grammar remember mremember |
91
|
|
|
|
|
|
%type startsub startanonsub startformsub |
92
|
|
|
|
|
|
/* FIXME for MAD - are these two ival? */ |
93
|
|
|
|
|
|
%type mintro |
94
|
|
|
|
|
|
|
95
|
|
|
|
|
|
%type stmtseq fullstmt labfullstmt barestmt block mblock else |
96
|
|
|
|
|
|
%type expr term subscripted scalar ary hsh arylen star amper sideff |
97
|
|
|
|
|
|
%type listexpr nexpr texpr iexpr mexpr mnexpr miexpr |
98
|
|
|
|
|
|
%type optlistexpr optexpr indirob listop method |
99
|
|
|
|
|
|
%type formname subname proto subbody cont my_scalar formblock |
100
|
|
|
|
|
|
%type subattrlist myattrlist myattrterm myterm |
101
|
|
|
|
|
|
%type termbinop termunop anonymous termdo |
102
|
|
|
|
|
|
%type formstmtseq formline formarg |
103
|
|
|
|
|
|
|
104
|
|
|
|
|
|
%nonassoc PREC_LOW |
105
|
|
|
|
|
|
%nonassoc LOOPEX |
106
|
|
|
|
|
|
|
107
|
|
|
|
|
|
%left OROP DOROP |
108
|
|
|
|
|
|
%left ANDOP |
109
|
|
|
|
|
|
%right NOTOP |
110
|
|
|
|
|
|
%nonassoc LSTOP LSTOPSUB |
111
|
|
|
|
|
|
%left ',' |
112
|
|
|
|
|
|
%right ASSIGNOP |
113
|
|
|
|
|
|
%right '?' ':' |
114
|
|
|
|
|
|
%nonassoc DOTDOT YADAYADA |
115
|
|
|
|
|
|
%left OROR DORDOR |
116
|
|
|
|
|
|
%left ANDAND |
117
|
|
|
|
|
|
%left BITOROP |
118
|
|
|
|
|
|
%left BITANDOP |
119
|
|
|
|
|
|
%nonassoc EQOP |
120
|
|
|
|
|
|
%nonassoc RELOP |
121
|
|
|
|
|
|
%nonassoc UNIOP UNIOPSUB |
122
|
|
|
|
|
|
%nonassoc REQUIRE |
123
|
|
|
|
|
|
%left SHIFTOP |
124
|
|
|
|
|
|
%left ADDOP |
125
|
|
|
|
|
|
%left MULOP |
126
|
|
|
|
|
|
%left MATCHOP |
127
|
|
|
|
|
|
%right '!' '~' UMINUS REFGEN |
128
|
|
|
|
|
|
%right POWOP |
129
|
|
|
|
|
|
%nonassoc PREINC PREDEC POSTINC POSTDEC |
130
|
|
|
|
|
|
%left ARROW |
131
|
|
|
|
|
|
%nonassoc ')' |
132
|
|
|
|
|
|
%left '(' |
133
|
|
|
|
|
|
%left '[' '{' |
134
|
|
|
|
|
|
|
135
|
|
|
|
|
|
%token PEG |
136
|
|
|
|
|
|
|
137
|
|
|
|
|
|
%% /* RULES */ |
138
|
|
|
|
|
|
|
139
|
|
|
|
|
|
/* Top-level choice of what kind of thing yyparse was called to parse */ |
140
|
|
|
|
|
|
grammar : GRAMPROG |
141
|
|
|
|
|
|
{ |
142
|
4375211
|
|
|
|
|
PL_parser->expect = XSTATE; |
143
|
|
|
|
|
|
} |
144
|
4375211
|
|
|
|
|
remember stmtseq |
145
|
|
|
|
|
|
{ |
146
|
4312435
|
|
|
|
|
newPROG(block_end($3,$4)); |
147
|
4312415
|
|
|
|
|
$$ = 0; |
148
|
|
|
|
|
|
} |
149
|
4312415
|
|
|
|
|
| GRAMEXPR |
150
|
|
|
|
|
|
{ |
151
|
284
|
|
|
|
|
parser->expect = XTERM; |
152
|
|
|
|
|
|
} |
153
|
1004412919
|
|
|
|
|
optexpr |
154
|
|
|
|
|
|
{ |
155
|
280
|
|
|
|
|
PL_eval_root = $3; |
156
|
280
|
|
|
|
|
$$ = 0; |
157
|
|
|
|
|
|
} |
158
|
280
|
|
|
|
|
| GRAMBLOCK |
159
|
|
|
|
|
|
{ |
160
|
30
|
|
|
|
|
parser->expect = XBLOCK; |
161
|
|
|
|
|
|
} |
162
|
30
|
|
|
|
|
block |
163
|
|
|
|
|
|
{ |
164
|
30
|
|
|
|
|
PL_pad_reset_pending = TRUE; |
165
|
30
|
|
|
|
|
PL_eval_root = $3; |
166
|
30
|
|
|
|
|
$$ = 0; |
167
|
30
|
|
|
|
|
yyunlex(); |
168
|
30
|
|
|
|
|
parser->yychar = YYEOF; |
169
|
|
|
|
|
|
} |
170
|
30
|
|
|
|
|
| GRAMBARESTMT |
171
|
|
|
|
|
|
{ |
172
|
114
|
|
|
|
|
parser->expect = XSTATE; |
173
|
|
|
|
|
|
} |
174
|
114
|
|
|
|
|
barestmt |
175
|
|
|
|
|
|
{ |
176
|
110
|
|
|
|
|
PL_pad_reset_pending = TRUE; |
177
|
110
|
|
|
|
|
PL_eval_root = $3; |
178
|
110
|
|
|
|
|
$$ = 0; |
179
|
110
|
|
|
|
|
yyunlex(); |
180
|
110
|
|
|
|
|
parser->yychar = YYEOF; |
181
|
|
|
|
|
|
} |
182
|
110
|
|
|
|
|
| GRAMFULLSTMT |
183
|
|
|
|
|
|
{ |
184
|
68
|
|
|
|
|
parser->expect = XSTATE; |
185
|
|
|
|
|
|
} |
186
|
68
|
|
|
|
|
fullstmt |
187
|
|
|
|
|
|
{ |
188
|
66
|
|
|
|
|
PL_pad_reset_pending = TRUE; |
189
|
66
|
|
|
|
|
PL_eval_root = $3; |
190
|
66
|
|
|
|
|
$$ = 0; |
191
|
66
|
|
|
|
|
yyunlex(); |
192
|
66
|
|
|
|
|
parser->yychar = YYEOF; |
193
|
|
|
|
|
|
} |
194
|
66
|
|
|
|
|
| GRAMSTMTSEQ |
195
|
|
|
|
|
|
{ |
196
|
42
|
|
|
|
|
parser->expect = XSTATE; |
197
|
|
|
|
|
|
} |
198
|
42
|
|
|
|
|
stmtseq |
199
|
|
|
|
|
|
{ |
200
|
42
|
|
|
|
|
PL_eval_root = $3; |
201
|
42
|
|
|
|
|
$$ = 0; |
202
|
|
|
|
|
|
} |
203
|
42
|
|
|
|
|
; |
204
|
|
|
|
|
|
|
205
|
|
|
|
|
|
/* An ordinary block */ |
206
|
|
|
|
|
|
block : '{' remember stmtseq '}' |
207
|
13294694
|
100
|
|
|
|
{ if (PL_parser->copline > (line_t)IVAL($1)) |
208
|
13294666
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
209
|
13294694
|
|
|
|
|
$$ = block_end($2, $3); |
210
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'{'); |
211
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,'}'); |
212
|
|
|
|
|
|
} |
213
|
13294694
|
|
|
|
|
; |
214
|
|
|
|
|
|
|
215
|
|
|
|
|
|
/* format body */ |
216
|
|
|
|
|
|
formblock: '=' remember ';' FORMRBRACK formstmtseq ';' '.' |
217
|
282
|
50
|
|
|
|
{ if (PL_parser->copline > (line_t)IVAL($1)) |
218
|
282
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
219
|
282
|
|
|
|
|
$$ = block_end($2, $5); |
220
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'{'); |
221
|
|
|
|
|
|
TOKEN_GETMAD($7,$$,'}'); |
222
|
|
|
|
|
|
} |
223
|
282
|
|
|
|
|
; |
224
|
|
|
|
|
|
|
225
|
|
|
|
|
|
remember: /* NULL */ /* start a full lexical scope */ |
226
|
27748364
|
|
|
|
|
{ $$ = block_start(TRUE); } |
227
|
27748358
|
|
|
|
|
; |
228
|
|
|
|
|
|
|
229
|
|
|
|
|
|
mblock : '{' mremember stmtseq '}' |
230
|
14825841
|
50
|
|
|
|
{ if (PL_parser->copline > (line_t)IVAL($1)) |
231
|
14825841
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
232
|
14825841
|
|
|
|
|
$$ = block_end($2, $3); |
233
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'{'); |
234
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,'}'); |
235
|
|
|
|
|
|
} |
236
|
14825841
|
|
|
|
|
; |
237
|
|
|
|
|
|
|
238
|
|
|
|
|
|
mremember: /* NULL */ /* start a partial lexical scope */ |
239
|
14825845
|
|
|
|
|
{ $$ = block_start(FALSE); } |
240
|
14825845
|
|
|
|
|
; |
241
|
|
|
|
|
|
|
242
|
|
|
|
|
|
/* A sequence of statements in the program */ |
243
|
|
|
|
|
|
stmtseq : /* NULL */ |
244
|
32496388
|
|
|
|
|
{ $$ = (OP*)NULL; } |
245
|
32496388
|
|
|
|
|
| stmtseq fullstmt |
246
|
115126209
|
|
|
|
|
{ $$ = op_append_list(OP_LINESEQ, $1, $2); |
247
|
115126209
|
|
|
|
|
PL_pad_reset_pending = TRUE; |
248
|
115126209
|
100
|
|
|
|
if ($1 && $2) |
|
|
100
|
|
|
|
|
249
|
46087868
|
|
|
|
|
PL_hints |= HINT_BLOCK_SCOPE; |
250
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
; |
252
|
|
|
|
|
|
|
253
|
|
|
|
|
|
/* A sequence of format lines */ |
254
|
|
|
|
|
|
formstmtseq: /* NULL */ |
255
|
290
|
|
|
|
|
{ $$ = (OP*)NULL; } |
256
|
290
|
|
|
|
|
| formstmtseq formline |
257
|
376
|
|
|
|
|
{ $$ = op_append_list(OP_LINESEQ, $1, $2); |
258
|
376
|
|
|
|
|
PL_pad_reset_pending = TRUE; |
259
|
376
|
100
|
|
|
|
if ($1 && $2) |
|
|
50
|
|
|
|
|
260
|
120
|
|
|
|
|
PL_hints |= HINT_BLOCK_SCOPE; |
261
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
; |
263
|
|
|
|
|
|
|
264
|
|
|
|
|
|
/* A statement in the program, including optional labels */ |
265
|
|
|
|
|
|
fullstmt: barestmt |
266
|
|
|
|
|
|
{ |
267
|
115034005
|
100
|
|
|
|
if($1) { |
268
|
78040422
|
|
|
|
|
$$ = newSTATEOP(0, NULL, $1); |
269
|
|
|
|
|
|
} else { |
270
|
36993583
|
|
|
|
|
$$ = IF_MAD(newOP(OP_NULL, 0), NULL); |
271
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
| labfullstmt |
274
|
92270
|
|
|
|
|
{ $$ = $1; } |
275
|
92270
|
|
|
|
|
; |
276
|
|
|
|
|
|
|
277
|
|
|
|
|
|
labfullstmt: LABEL barestmt |
278
|
|
|
|
|
|
{ |
279
|
92270
|
|
|
|
|
$$ = newSTATEOP(SVf_UTF8 |
280
|
|
|
|
|
|
* PVAL($1)[strlen(PVAL($1))+1], |
281
|
|
|
|
|
|
PVAL($1), $2); |
282
|
|
|
|
|
|
TOKEN_GETMAD($1, |
283
|
|
|
|
|
|
$2 ? cLISTOPx($$)->op_first : $$, 'L'); |
284
|
|
|
|
|
|
} |
285
|
92270
|
|
|
|
|
| LABEL labfullstmt |
286
|
|
|
|
|
|
{ |
287
|
48
|
|
|
|
|
$$ = newSTATEOP(SVf_UTF8 |
288
|
|
|
|
|
|
* PVAL($1)[strlen(PVAL($1))+1], |
289
|
|
|
|
|
|
PVAL($1), $2); |
290
|
|
|
|
|
|
TOKEN_GETMAD($1, cLISTOPx($$)->op_first, 'L'); |
291
|
|
|
|
|
|
} |
292
|
48
|
|
|
|
|
; |
293
|
|
|
|
|
|
|
294
|
|
|
|
|
|
/* A bare statement, lacking label and other aspects of state op */ |
295
|
|
|
|
|
|
barestmt: PLUGSTMT |
296
|
186
|
|
|
|
|
{ $$ = $1; } |
297
|
186
|
|
|
|
|
| PEG |
298
|
|
|
|
|
|
{ |
299
|
0
|
|
|
|
|
$$ = newOP(OP_NULL,0); |
300
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'p'); |
301
|
|
|
|
|
|
} |
302
|
0
|
|
|
|
|
| FORMAT startformsub formname formblock |
303
|
|
|
|
|
|
{ |
304
|
282
|
|
|
|
|
CV *fmtcv = PL_compcv; |
305
|
|
|
|
|
|
#ifdef MAD |
306
|
|
|
|
|
|
$$ = newFORM($2, $3, $4); |
307
|
|
|
|
|
|
prepend_madprops($1->tk_mad, $$, 'F'); |
308
|
|
|
|
|
|
$1->tk_mad = 0; |
309
|
|
|
|
|
|
token_free($1); |
310
|
|
|
|
|
|
#else |
311
|
282
|
|
|
|
|
newFORM($2, $3, $4); |
312
|
282
|
|
|
|
|
$$ = (OP*)NULL; |
313
|
|
|
|
|
|
#endif |
314
|
282
|
50
|
|
|
|
if (CvOUTSIDE(fmtcv) && !CvEVAL(CvOUTSIDE(fmtcv))) { |
|
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
315
|
28
|
50
|
|
|
|
SvREFCNT_inc_simple_void(fmtcv); |
316
|
28
|
|
|
|
|
pad_add_anon(fmtcv, OP_NULL); |
317
|
|
|
|
|
|
} |
318
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
| SUB subname startsub |
320
|
|
|
|
|
|
{ |
321
|
8947836
|
100
|
|
|
|
if ($2->op_type == OP_CONST) { |
322
|
|
|
|
|
|
const char *const name = |
323
|
8947600
|
50
|
|
|
|
SvPV_nolen_const(((SVOP*)$2)->op_sv); |
324
|
8947600
|
100
|
|
|
|
if (strEQ(name, "BEGIN") || strEQ(name, "END") |
|
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
100
|
|
|
|
|
325
|
8616560
|
100
|
|
|
|
|| strEQ(name, "INIT") || strEQ(name, "CHECK") |
|
|
100
|
|
|
|
|
326
|
8601954
|
100
|
|
|
|
|| strEQ(name, "UNITCHECK")) |
327
|
345860
|
|
|
|
|
CvSPECIAL_on(PL_compcv); |
328
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
else |
330
|
|
|
|
|
|
/* State subs inside anonymous subs need to be |
331
|
|
|
|
|
|
clonable themselves. */ |
332
|
236
|
100
|
|
|
|
if (CvANON(CvOUTSIDE(PL_compcv)) |
333
|
202
|
100
|
|
|
|
|| CvCLONE(CvOUTSIDE(PL_compcv)) |
334
|
190
|
100
|
|
|
|
|| !PadnameIsSTATE(PadlistNAMESARRAY(CvPADLIST( |
335
|
|
|
|
|
|
CvOUTSIDE(PL_compcv) |
336
|
|
|
|
|
|
))[$2->op_targ])) |
337
|
168
|
|
|
|
|
CvCLONE_on(PL_compcv); |
338
|
8947836
|
|
|
|
|
PL_parser->in_my = 0; |
339
|
8947836
|
|
|
|
|
PL_parser->in_my_stash = NULL; |
340
|
|
|
|
|
|
} |
341
|
8947836
|
|
|
|
|
proto subattrlist subbody |
342
|
|
|
|
|
|
{ |
343
|
8947824
|
50
|
|
|
|
SvREFCNT_inc_simple_void(PL_compcv); |
344
|
|
|
|
|
|
#ifdef MAD |
345
|
|
|
|
|
|
{ |
346
|
|
|
|
|
|
OP* o = newSVOP(OP_ANONCODE, 0, |
347
|
|
|
|
|
|
(SV*)( |
348
|
|
|
|
|
|
#endif |
349
|
8947824
|
|
|
|
|
$2->op_type == OP_CONST |
350
|
8947588
|
|
|
|
|
? newATTRSUB($3, $2, $5, $6, $7) |
351
|
13293301
|
100
|
|
|
|
: newMYSUB($3, $2, $5, $6, $7) |
352
|
|
|
|
|
|
#ifdef MAD |
353
|
|
|
|
|
|
)); |
354
|
|
|
|
|
|
$$ = newOP(OP_NULL,0); |
355
|
|
|
|
|
|
op_getmad(o,$$,'&'); |
356
|
|
|
|
|
|
op_getmad($2,$$,'n'); |
357
|
|
|
|
|
|
op_getmad($5,$$,'s'); |
358
|
|
|
|
|
|
op_getmad($6,$$,'a'); |
359
|
|
|
|
|
|
token_getmad($1,$$,'d'); |
360
|
|
|
|
|
|
append_madprops($7->op_madprop, $$, 0); |
361
|
|
|
|
|
|
$7->op_madprop = 0; |
362
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
#else |
364
|
|
|
|
|
|
; |
365
|
8947538
|
|
|
|
|
$$ = (OP*)NULL; |
366
|
|
|
|
|
|
#endif |
367
|
8947538
|
|
|
|
|
intro_my(); |
368
|
|
|
|
|
|
} |
369
|
8947538
|
|
|
|
|
| PACKAGE WORD WORD ';' |
370
|
|
|
|
|
|
{ |
371
|
|
|
|
|
|
#ifdef MAD |
372
|
|
|
|
|
|
$$ = package($3); |
373
|
|
|
|
|
|
token_getmad($1,$$,'o'); |
374
|
|
|
|
|
|
if ($2) |
375
|
|
|
|
|
|
package_version($2); |
376
|
|
|
|
|
|
token_getmad($4,$$,';'); |
377
|
|
|
|
|
|
#else |
378
|
700382
|
|
|
|
|
package($3); |
379
|
700382
|
100
|
|
|
|
if ($2) |
380
|
60
|
|
|
|
|
package_version($2); |
381
|
700382
|
|
|
|
|
$$ = (OP*)NULL; |
382
|
|
|
|
|
|
#endif |
383
|
|
|
|
|
|
} |
384
|
700382
|
|
|
|
|
| USE startsub |
385
|
4646544
|
|
|
|
|
{ CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ } |
386
|
4646544
|
|
|
|
|
WORD WORD optlistexpr ';' |
387
|
|
|
|
|
|
{ |
388
|
4646536
|
50
|
|
|
|
SvREFCNT_inc_simple_void(PL_compcv); |
389
|
|
|
|
|
|
#ifdef MAD |
390
|
|
|
|
|
|
$$ = utilize(IVAL($1), $2, $4, $5, $6); |
391
|
|
|
|
|
|
token_getmad($1,$$,'o'); |
392
|
|
|
|
|
|
token_getmad($7,$$,';'); |
393
|
|
|
|
|
|
if (PL_parser->rsfp_filters && |
394
|
|
|
|
|
|
AvFILLp(PL_parser->rsfp_filters) >= 0) |
395
|
|
|
|
|
|
append_madprops(newMADPROP('!', MAD_NULL, NULL, 0), $$, 0); |
396
|
|
|
|
|
|
#else |
397
|
4646536
|
|
|
|
|
utilize(IVAL($1), $2, $4, $5, $6); |
398
|
4620432
|
|
|
|
|
$$ = (OP*)NULL; |
399
|
|
|
|
|
|
#endif |
400
|
|
|
|
|
|
} |
401
|
4620432
|
|
|
|
|
| IF '(' remember mexpr ')' mblock else |
402
|
|
|
|
|
|
{ |
403
|
7150644
|
|
|
|
|
$$ = block_end($3, |
404
|
|
|
|
|
|
newCONDOP(0, $4, op_scope($6), $7)); |
405
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'I'); |
406
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
407
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,')'); |
408
|
7150644
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
409
|
|
|
|
|
|
} |
410
|
7150644
|
|
|
|
|
| UNLESS '(' remember miexpr ')' mblock else |
411
|
|
|
|
|
|
{ |
412
|
789651
|
|
|
|
|
$$ = block_end($3, |
413
|
|
|
|
|
|
newCONDOP(0, $4, op_scope($6), $7)); |
414
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'I'); |
415
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
416
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,')'); |
417
|
789651
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
418
|
|
|
|
|
|
} |
419
|
789651
|
|
|
|
|
| GIVEN '(' remember mexpr ')' mblock |
420
|
|
|
|
|
|
{ |
421
|
216
|
|
|
|
|
const PADOFFSET offset = pad_findmy_pvs("$_", 0); |
422
|
216
|
100
|
|
|
|
$$ = block_end($3, |
|
|
50
|
|
|
|
|
423
|
|
|
|
|
|
newGIVENOP($4, op_scope($6), |
424
|
|
|
|
|
|
offset == NOT_IN_PAD |
425
|
|
|
|
|
|
|| PAD_COMPNAME_FLAGS_isOUR(offset) |
426
|
|
|
|
|
|
? 0 |
427
|
|
|
|
|
|
: offset)); |
428
|
216
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
429
|
|
|
|
|
|
} |
430
|
216
|
|
|
|
|
| WHEN '(' remember mexpr ')' mblock |
431
|
394
|
|
|
|
|
{ $$ = block_end($3, newWHENOP($4, op_scope($6))); } |
432
|
394
|
|
|
|
|
| DEFAULT block |
433
|
70
|
|
|
|
|
{ $$ = newWHENOP(0, op_scope($2)); } |
434
|
70
|
|
|
|
|
| WHILE '(' remember texpr ')' mintro mblock cont |
435
|
|
|
|
|
|
{ |
436
|
515842
|
|
|
|
|
$$ = block_end($3, |
437
|
|
|
|
|
|
newWHILEOP(0, 1, (LOOP*)(OP*)NULL, |
438
|
|
|
|
|
|
$4, $7, $8, $6)); |
439
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'W'); |
440
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
441
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,')'); |
442
|
515842
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
443
|
|
|
|
|
|
} |
444
|
515842
|
|
|
|
|
| UNTIL '(' remember iexpr ')' mintro mblock cont |
445
|
|
|
|
|
|
{ |
446
|
1234
|
|
|
|
|
$$ = block_end($3, |
447
|
|
|
|
|
|
newWHILEOP(0, 1, (LOOP*)(OP*)NULL, |
448
|
|
|
|
|
|
$4, $7, $8, $6)); |
449
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'W'); |
450
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
451
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,')'); |
452
|
1234
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
453
|
|
|
|
|
|
} |
454
|
1234
|
|
|
|
|
| FOR '(' remember mnexpr ';' texpr ';' mintro mnexpr ')' |
455
|
|
|
|
|
|
mblock |
456
|
|
|
|
|
|
{ |
457
|
263638
|
|
|
|
|
OP *initop = IF_MAD($4 ? $4 : newOP(OP_NULL, 0), $4); |
458
|
263638
|
|
|
|
|
OP *forop = newWHILEOP(0, 1, (LOOP*)(OP*)NULL, |
459
|
|
|
|
|
|
scalar($6), $11, $9, $8); |
460
|
263638
|
100
|
|
|
|
if (initop) { |
461
|
152858
|
|
|
|
|
forop = op_prepend_elem(OP_LINESEQ, initop, |
462
|
|
|
|
|
|
op_append_elem(OP_LINESEQ, |
463
|
|
|
|
|
|
newOP(OP_UNSTACK, OPf_SPECIAL), |
464
|
|
|
|
|
|
forop)); |
465
|
|
|
|
|
|
} |
466
|
|
|
|
|
|
DO_MAD({ forop = newUNOP(OP_NULL, 0, forop); }) |
467
|
263638
|
|
|
|
|
$$ = block_end($3, forop); |
468
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'3'); |
469
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
470
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,'1'); |
471
|
|
|
|
|
|
TOKEN_GETMAD($7,$$,'2'); |
472
|
|
|
|
|
|
TOKEN_GETMAD($10,$$,')'); |
473
|
263638
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
474
|
|
|
|
|
|
} |
475
|
263638
|
|
|
|
|
| FOR MY remember my_scalar '(' mexpr ')' mblock cont |
476
|
|
|
|
|
|
{ |
477
|
886101
|
|
|
|
|
$$ = block_end($3, newFOROP(0, $4, $6, $8, $9)); |
478
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'W'); |
479
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'d'); |
480
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,'('); |
481
|
|
|
|
|
|
TOKEN_GETMAD($7,$$,')'); |
482
|
886101
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
483
|
|
|
|
|
|
} |
484
|
886101
|
|
|
|
|
| FOR scalar '(' remember mexpr ')' mblock cont |
485
|
|
|
|
|
|
{ |
486
|
186908
|
|
|
|
|
$$ = block_end($4, newFOROP(0, |
487
|
|
|
|
|
|
op_lvalue($2, OP_ENTERLOOP), $5, $7, $8)); |
488
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'W'); |
489
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'('); |
490
|
|
|
|
|
|
TOKEN_GETMAD($6,$$,')'); |
491
|
186908
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
492
|
|
|
|
|
|
} |
493
|
186908
|
|
|
|
|
| FOR '(' remember mexpr ')' mblock cont |
494
|
|
|
|
|
|
{ |
495
|
283243
|
|
|
|
|
$$ = block_end($3, |
496
|
|
|
|
|
|
newFOROP(0, (OP*)NULL, $4, $6, $7)); |
497
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'W'); |
498
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
499
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,')'); |
500
|
283243
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($1); |
501
|
|
|
|
|
|
} |
502
|
283243
|
|
|
|
|
| block cont |
503
|
|
|
|
|
|
{ |
504
|
|
|
|
|
|
/* a block is a loop that happens once */ |
505
|
336744
|
|
|
|
|
$$ = newWHILEOP(0, 1, (LOOP*)(OP*)NULL, |
506
|
|
|
|
|
|
(OP*)NULL, $1, $2, 0); |
507
|
|
|
|
|
|
} |
508
|
336744
|
|
|
|
|
| PACKAGE WORD WORD '{' remember |
509
|
|
|
|
|
|
{ |
510
|
188
|
|
|
|
|
package($3); |
511
|
188
|
100
|
|
|
|
if ($2) { |
512
|
40
|
|
|
|
|
package_version($2); |
513
|
|
|
|
|
|
} |
514
|
|
|
|
|
|
} |
515
|
|
|
|
|
|
stmtseq '}' |
516
|
|
|
|
|
|
{ |
517
|
|
|
|
|
|
/* a block is a loop that happens once */ |
518
|
184
|
|
|
|
|
$$ = newWHILEOP(0, 1, (LOOP*)(OP*)NULL, |
519
|
|
|
|
|
|
(OP*)NULL, block_end($5, $7), (OP*)NULL, 0); |
520
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,'{'); |
521
|
|
|
|
|
|
TOKEN_GETMAD($8,$$,'}'); |
522
|
184
|
50
|
|
|
|
if (PL_parser->copline > (line_t)IVAL($4)) |
523
|
184
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($4); |
524
|
|
|
|
|
|
} |
525
|
|
|
|
|
|
| sideff ';' |
526
|
|
|
|
|
|
{ |
527
|
67718107
|
|
|
|
|
PL_parser->expect = XSTATE; |
528
|
67718107
|
|
|
|
|
$$ = $1; |
529
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,';'); |
530
|
|
|
|
|
|
} |
531
|
67718107
|
|
|
|
|
| ';' |
532
|
|
|
|
|
|
{ |
533
|
22724589
|
|
|
|
|
PL_parser->expect = XSTATE; |
534
|
22724589
|
|
|
|
|
$$ = IF_MAD(newOP(OP_NULL, 0), (OP*)NULL); |
535
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,';'); |
536
|
22724589
|
|
|
|
|
PL_parser->copline = NOLINE; |
537
|
|
|
|
|
|
} |
538
|
22724589
|
|
|
|
|
; |
539
|
|
|
|
|
|
|
540
|
|
|
|
|
|
/* Format line */ |
541
|
|
|
|
|
|
formline: THING formarg |
542
|
|
|
|
|
|
{ OP *list; |
543
|
376
|
100
|
|
|
|
if ($2) { |
544
|
308
|
|
|
|
|
OP *term = $2; |
545
|
|
|
|
|
|
DO_MAD(term = newUNOP(OP_NULL, 0, term)); |
546
|
308
|
|
|
|
|
list = op_append_elem(OP_LIST, $1, term); |
547
|
|
|
|
|
|
} |
548
|
|
|
|
|
|
else { |
549
|
|
|
|
|
|
#ifdef MAD |
550
|
|
|
|
|
|
OP *op = newNULLLIST(); |
551
|
|
|
|
|
|
list = op_append_elem(OP_LIST, $1, op); |
552
|
|
|
|
|
|
#else |
553
|
68
|
|
|
|
|
list = $1; |
554
|
|
|
|
|
|
#endif |
555
|
|
|
|
|
|
} |
556
|
376
|
100
|
|
|
|
if (PL_parser->copline == NOLINE) |
557
|
372
|
|
|
|
|
PL_parser->copline = CopLINE(PL_curcop)-1; |
558
|
4
|
|
|
|
|
else PL_parser->copline--; |
559
|
376
|
|
|
|
|
$$ = newSTATEOP(0, NULL, |
560
|
|
|
|
|
|
convert(OP_FORMLINE, 0, list)); |
561
|
|
|
|
|
|
} |
562
|
376
|
|
|
|
|
; |
563
|
|
|
|
|
|
|
564
|
|
|
|
|
|
formarg : /* NULL */ |
565
|
60
|
|
|
|
|
{ $$ = NULL; } |
566
|
60
|
|
|
|
|
| FORMLBRACK stmtseq FORMRBRACK |
567
|
316
|
|
|
|
|
{ $$ = op_unscope($2); } |
568
|
316
|
|
|
|
|
; |
569
|
|
|
|
|
|
|
570
|
|
|
|
|
|
/* An expression which may have a side-effect */ |
571
|
|
|
|
|
|
sideff : error |
572
|
1480
|
|
|
|
|
{ $$ = (OP*)NULL; } |
573
|
1480
|
|
|
|
|
| expr |
574
|
60505147
|
|
|
|
|
{ $$ = $1; } |
575
|
60505147
|
|
|
|
|
| expr IF expr |
576
|
4492508
|
|
|
|
|
{ $$ = newLOGOP(OP_AND, 0, $3, $1); |
577
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'i'); |
578
|
|
|
|
|
|
} |
579
|
4492508
|
|
|
|
|
| expr UNLESS expr |
580
|
2557165
|
|
|
|
|
{ $$ = newLOGOP(OP_OR, 0, $3, $1); |
581
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'i'); |
582
|
|
|
|
|
|
} |
583
|
2557165
|
|
|
|
|
| expr WHILE expr |
584
|
173316
|
|
|
|
|
{ $$ = newLOOPOP(OPf_PARENS, 1, scalar($3), $1); |
585
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'w'); |
586
|
|
|
|
|
|
} |
587
|
173316
|
|
|
|
|
| expr UNTIL iexpr |
588
|
13958
|
|
|
|
|
{ $$ = newLOOPOP(OPf_PARENS, 1, $3, $1); |
589
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'w'); |
590
|
|
|
|
|
|
} |
591
|
13958
|
|
|
|
|
| expr FOR expr |
592
|
328559
|
|
|
|
|
{ $$ = newFOROP(0, (OP*)NULL, $3, $1, (OP*)NULL); |
593
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'w'); |
594
|
328559
|
|
|
|
|
PL_parser->copline = (line_t)IVAL($2); |
595
|
|
|
|
|
|
} |
596
|
328559
|
|
|
|
|
| expr WHEN expr |
597
|
38
|
|
|
|
|
{ $$ = newWHENOP($3, op_scope($1)); } |
598
|
38
|
|
|
|
|
; |
599
|
|
|
|
|
|
|
600
|
|
|
|
|
|
/* else and elsif blocks */ |
601
|
|
|
|
|
|
else : /* NULL */ |
602
|
4999577
|
|
|
|
|
{ $$ = (OP*)NULL; } |
603
|
4999577
|
|
|
|
|
| ELSE mblock |
604
|
|
|
|
|
|
{ |
605
|
2940718
|
|
|
|
|
($2)->op_flags |= OPf_PARENS; |
606
|
2940718
|
|
|
|
|
$$ = op_scope($2); |
607
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
608
|
|
|
|
|
|
} |
609
|
2940718
|
|
|
|
|
| ELSIF '(' mexpr ')' mblock else |
610
|
1807242
|
|
|
|
|
{ PL_parser->copline = (line_t)IVAL($1); |
611
|
1807242
|
|
|
|
|
$$ = newCONDOP(0, |
612
|
|
|
|
|
|
newSTATEOP(OPf_SPECIAL,NULL,$3), |
613
|
|
|
|
|
|
op_scope($5), $6); |
614
|
1807242
|
|
|
|
|
PL_hints |= HINT_BLOCK_SCOPE; |
615
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'I'); |
616
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
617
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,')'); |
618
|
|
|
|
|
|
} |
619
|
1807242
|
|
|
|
|
; |
620
|
|
|
|
|
|
|
621
|
|
|
|
|
|
/* Continue blocks */ |
622
|
|
|
|
|
|
cont : /* NULL */ |
623
|
2203506
|
|
|
|
|
{ $$ = (OP*)NULL; } |
624
|
2203506
|
|
|
|
|
| CONTINUE block |
625
|
|
|
|
|
|
{ |
626
|
6566
|
|
|
|
|
$$ = op_scope($2); |
627
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
628
|
|
|
|
|
|
} |
629
|
6566
|
|
|
|
|
; |
630
|
|
|
|
|
|
|
631
|
|
|
|
|
|
/* determine whether there are any new my declarations */ |
632
|
|
|
|
|
|
mintro : /* NULL */ |
633
|
837943
|
100
|
|
|
|
{ $$ = (PL_min_intro_pending && |
|
|
50
|
|
|
|
|
634
|
119134
|
|
|
|
|
PL_max_intro_pending >= PL_min_intro_pending); |
635
|
780716
|
|
|
|
|
intro_my(); } |
636
|
780716
|
|
|
|
|
|
637
|
|
|
|
|
|
/* Normal expression */ |
638
|
|
|
|
|
|
nexpr : /* NULL */ |
639
|
174202
|
|
|
|
|
{ $$ = (OP*)NULL; } |
640
|
174202
|
|
|
|
|
| sideff |
641
|
|
|
|
|
|
; |
642
|
|
|
|
|
|
|
643
|
|
|
|
|
|
/* Boolean expression */ |
644
|
|
|
|
|
|
texpr : /* NULL means true */ |
645
|
|
|
|
|
|
{ YYSTYPE tmplval; |
646
|
33496
|
|
|
|
|
(void)scan_num("1", &tmplval); |
647
|
33496
|
|
|
|
|
$$ = tmplval.opval; } |
648
|
33496
|
|
|
|
|
| expr |
649
|
|
|
|
|
|
; |
650
|
|
|
|
|
|
|
651
|
|
|
|
|
|
/* Inverted boolean expression */ |
652
|
|
|
|
|
|
iexpr : expr |
653
|
804843
|
|
|
|
|
{ $$ = invert(scalar($1)); } |
654
|
804843
|
|
|
|
|
; |
655
|
|
|
|
|
|
|
656
|
|
|
|
|
|
/* Expression with its own lexical scope */ |
657
|
|
|
|
|
|
mexpr : expr |
658
|
10314760
|
|
|
|
|
{ $$ = $1; intro_my(); } |
659
|
10314760
|
|
|
|
|
; |
660
|
|
|
|
|
|
|
661
|
|
|
|
|
|
mnexpr : nexpr |
662
|
527276
|
|
|
|
|
{ $$ = $1; intro_my(); } |
663
|
527276
|
|
|
|
|
; |
664
|
|
|
|
|
|
|
665
|
|
|
|
|
|
miexpr : iexpr |
666
|
789651
|
|
|
|
|
{ $$ = $1; intro_my(); } |
667
|
789651
|
|
|
|
|
; |
668
|
|
|
|
|
|
|
669
|
260
|
|
|
|
|
formname: WORD { $$ = $1; } |
670
|
260
|
|
|
|
|
| /* NULL */ { $$ = (OP*)NULL; } |
671
|
38
|
|
|
|
|
; |
672
|
|
|
|
|
|
|
673
|
|
|
|
|
|
startsub: /* NULL */ /* start a regular subroutine scope */ |
674
|
13594380
|
|
|
|
|
{ $$ = start_subparse(FALSE, 0); |
675
|
13594380
|
|
|
|
|
SAVEFREESV(PL_compcv); } |
676
|
13594380
|
|
|
|
|
|
677
|
|
|
|
|
|
; |
678
|
|
|
|
|
|
|
679
|
|
|
|
|
|
startanonsub: /* NULL */ /* start an anonymous subroutine scope */ |
680
|
620068
|
|
|
|
|
{ $$ = start_subparse(FALSE, CVf_ANON); |
681
|
620068
|
|
|
|
|
SAVEFREESV(PL_compcv); } |
682
|
620068
|
|
|
|
|
; |
683
|
|
|
|
|
|
|
684
|
|
|
|
|
|
startformsub: /* NULL */ /* start a format subroutine scope */ |
685
|
298
|
|
|
|
|
{ $$ = start_subparse(TRUE, 0); |
686
|
298
|
|
|
|
|
SAVEFREESV(PL_compcv); } |
687
|
298
|
|
|
|
|
; |
688
|
|
|
|
|
|
|
689
|
|
|
|
|
|
/* Name of a subroutine - must be a bareword, could be special */ |
690
|
|
|
|
|
|
subname : WORD |
691
|
|
|
|
|
|
| PRIVATEREF |
692
|
|
|
|
|
|
; |
693
|
|
|
|
|
|
|
694
|
|
|
|
|
|
/* Subroutine prototype */ |
695
|
|
|
|
|
|
proto : /* NULL */ |
696
|
9045522
|
|
|
|
|
{ $$ = (OP*)NULL; } |
697
|
9045522
|
|
|
|
|
| THING |
698
|
|
|
|
|
|
; |
699
|
|
|
|
|
|
|
700
|
|
|
|
|
|
/* Optional list of subroutine attributes */ |
701
|
|
|
|
|
|
subattrlist: /* NULL */ |
702
|
9559542
|
|
|
|
|
{ $$ = (OP*)NULL; } |
703
|
9559542
|
|
|
|
|
| COLONATTR THING |
704
|
112
|
|
|
|
|
{ $$ = $2; |
705
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,':'); |
706
|
|
|
|
|
|
} |
707
|
112
|
|
|
|
|
| COLONATTR |
708
|
5808
|
|
|
|
|
{ $$ = IF_MAD( |
709
|
|
|
|
|
|
newOP(OP_NULL, 0), |
710
|
|
|
|
|
|
(OP*)NULL |
711
|
|
|
|
|
|
); |
712
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,':'); |
713
|
|
|
|
|
|
} |
714
|
5808
|
|
|
|
|
; |
715
|
|
|
|
|
|
|
716
|
|
|
|
|
|
/* List of attributes for a "my" variable declaration */ |
717
|
|
|
|
|
|
myattrlist: COLONATTR THING |
718
|
104
|
|
|
|
|
{ $$ = $2; |
719
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,':'); |
720
|
|
|
|
|
|
} |
721
|
104
|
|
|
|
|
| COLONATTR |
722
|
4
|
|
|
|
|
{ $$ = IF_MAD( |
723
|
|
|
|
|
|
newOP(OP_NULL, 0), |
724
|
|
|
|
|
|
(OP*)NULL |
725
|
|
|
|
|
|
); |
726
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,':'); |
727
|
|
|
|
|
|
} |
728
|
4
|
|
|
|
|
; |
729
|
|
|
|
|
|
|
730
|
|
|
|
|
|
/* Subroutine body - either null or a block */ |
731
|
8557349
|
|
|
|
|
subbody : block { $$ = $1; } |
732
|
8557349
|
|
|
|
|
| ';' { $$ = IF_MAD( |
733
|
|
|
|
|
|
newOP(OP_NULL,0), |
734
|
|
|
|
|
|
(OP*)NULL |
735
|
|
|
|
|
|
); |
736
|
390475
|
|
|
|
|
PL_parser->expect = XSTATE; |
737
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,';'); |
738
|
|
|
|
|
|
} |
739
|
390475
|
|
|
|
|
; |
740
|
|
|
|
|
|
|
741
|
|
|
|
|
|
/* Ordinary expressions; logical combinations */ |
742
|
|
|
|
|
|
expr : expr ANDOP expr |
743
|
2012180
|
|
|
|
|
{ $$ = newLOGOP(OP_AND, 0, $1, $3); |
744
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
745
|
|
|
|
|
|
} |
746
|
2012180
|
|
|
|
|
| expr OROP expr |
747
|
1403465
|
|
|
|
|
{ $$ = newLOGOP(IVAL($2), 0, $1, $3); |
748
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
749
|
|
|
|
|
|
} |
750
|
1403465
|
|
|
|
|
| expr DOROP expr |
751
|
0
|
|
|
|
|
{ $$ = newLOGOP(OP_DOR, 0, $1, $3); |
752
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
753
|
|
|
|
|
|
} |
754
|
0
|
|
|
|
|
| listexpr %prec PREC_LOW |
755
|
|
|
|
|
|
; |
756
|
|
|
|
|
|
|
757
|
|
|
|
|
|
/* Expressions are a list of terms joined by commas */ |
758
|
|
|
|
|
|
listexpr: listexpr ',' |
759
|
|
|
|
|
|
{ |
760
|
|
|
|
|
|
#ifdef MAD |
761
|
|
|
|
|
|
OP* op = newNULLLIST(); |
762
|
|
|
|
|
|
token_getmad($2,op,','); |
763
|
|
|
|
|
|
$$ = op_append_elem(OP_LIST, $1, op); |
764
|
|
|
|
|
|
#else |
765
|
824711
|
|
|
|
|
$$ = $1; |
766
|
|
|
|
|
|
#endif |
767
|
|
|
|
|
|
} |
768
|
824711
|
|
|
|
|
| listexpr ',' term |
769
|
|
|
|
|
|
{ |
770
|
55583251
|
|
|
|
|
OP* term = $3; |
771
|
|
|
|
|
|
DO_MAD( |
772
|
|
|
|
|
|
term = newUNOP(OP_NULL, 0, term); |
773
|
|
|
|
|
|
token_getmad($2,term,','); |
774
|
|
|
|
|
|
) |
775
|
55583251
|
|
|
|
|
$$ = op_append_elem(OP_LIST, $1, term); |
776
|
|
|
|
|
|
} |
777
|
55583251
|
|
|
|
|
| term %prec PREC_LOW |
778
|
|
|
|
|
|
; |
779
|
|
|
|
|
|
|
780
|
|
|
|
|
|
/* List operators */ |
781
|
|
|
|
|
|
listop : LSTOP indirob listexpr /* map {...} @args or print $fh @args */ |
782
|
924816
|
|
|
|
|
{ $$ = convert(IVAL($1), OPf_STACKED, |
783
|
|
|
|
|
|
op_prepend_elem(OP_LIST, newGVREF(IVAL($1),$2), $3) ); |
784
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
785
|
|
|
|
|
|
} |
786
|
924816
|
|
|
|
|
| FUNC '(' indirob expr ')' /* print ($fh @args */ |
787
|
1142
|
|
|
|
|
{ $$ = convert(IVAL($1), OPf_STACKED, |
788
|
|
|
|
|
|
op_prepend_elem(OP_LIST, newGVREF(IVAL($1),$3), $4) ); |
789
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
790
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
791
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,')'); |
792
|
|
|
|
|
|
} |
793
|
1142
|
|
|
|
|
| term ARROW method '(' optexpr ')' /* $foo->bar(list) */ |
794
|
6283107
|
|
|
|
|
{ $$ = convert(OP_ENTERSUB, OPf_STACKED, |
795
|
|
|
|
|
|
op_append_elem(OP_LIST, |
796
|
|
|
|
|
|
op_prepend_elem(OP_LIST, scalar($1), $5), |
797
|
|
|
|
|
|
newUNOP(OP_METHOD, 0, $3))); |
798
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'A'); |
799
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,'('); |
800
|
|
|
|
|
|
TOKEN_GETMAD($6,$$,')'); |
801
|
|
|
|
|
|
} |
802
|
6283107
|
|
|
|
|
| term ARROW method /* $foo->bar */ |
803
|
6419672
|
|
|
|
|
{ $$ = convert(OP_ENTERSUB, OPf_STACKED, |
804
|
|
|
|
|
|
op_append_elem(OP_LIST, scalar($1), |
805
|
|
|
|
|
|
newUNOP(OP_METHOD, 0, $3))); |
806
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'A'); |
807
|
|
|
|
|
|
} |
808
|
6419672
|
|
|
|
|
| METHOD indirob optlistexpr /* new Class @args */ |
809
|
55767
|
|
|
|
|
{ $$ = convert(OP_ENTERSUB, OPf_STACKED, |
810
|
|
|
|
|
|
op_append_elem(OP_LIST, |
811
|
|
|
|
|
|
op_prepend_elem(OP_LIST, $2, $3), |
812
|
|
|
|
|
|
newUNOP(OP_METHOD, 0, $1))); |
813
|
|
|
|
|
|
} |
814
|
55767
|
|
|
|
|
| FUNCMETH indirob '(' optexpr ')' /* method $object (@args) */ |
815
|
8596
|
|
|
|
|
{ $$ = convert(OP_ENTERSUB, OPf_STACKED, |
816
|
|
|
|
|
|
op_append_elem(OP_LIST, |
817
|
|
|
|
|
|
op_prepend_elem(OP_LIST, $2, $4), |
818
|
|
|
|
|
|
newUNOP(OP_METHOD, 0, $1))); |
819
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'('); |
820
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,')'); |
821
|
|
|
|
|
|
} |
822
|
8596
|
|
|
|
|
| LSTOP optlistexpr /* print @args */ |
823
|
11711153
|
|
|
|
|
{ $$ = convert(IVAL($1), 0, $2); |
824
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
825
|
|
|
|
|
|
} |
826
|
11711153
|
|
|
|
|
| FUNC '(' optexpr ')' /* print (@args) */ |
827
|
13564759
|
|
|
|
|
{ $$ = convert(IVAL($1), 0, $3); |
828
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
829
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
830
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,')'); |
831
|
|
|
|
|
|
} |
832
|
13564757
|
|
|
|
|
| LSTOPSUB startanonsub block /* sub f(&@); f { foo } ... */ |
833
|
2442
|
50
|
|
|
|
{ SvREFCNT_inc_simple_void(PL_compcv); |
834
|
2442
|
|
|
|
|
$$ = newANONATTRSUB($2, 0, (OP*)NULL, $3); } |
835
|
2442
|
|
|
|
|
optlistexpr %prec LSTOP /* ... @bar */ |
836
|
2438
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, |
837
|
|
|
|
|
|
op_append_elem(OP_LIST, |
838
|
|
|
|
|
|
op_prepend_elem(OP_LIST, $4, $5), $1)); |
839
|
|
|
|
|
|
} |
840
|
2438
|
|
|
|
|
; |
841
|
|
|
|
|
|
|
842
|
|
|
|
|
|
/* Names of methods. May use $object->$methodname */ |
843
|
|
|
|
|
|
method : METHOD |
844
|
|
|
|
|
|
| scalar |
845
|
|
|
|
|
|
; |
846
|
|
|
|
|
|
|
847
|
|
|
|
|
|
/* Some kind of subscripted expression */ |
848
|
|
|
|
|
|
subscripted: star '{' expr ';' '}' /* *main::{something} */ |
849
|
|
|
|
|
|
/* In this and all the hash accessors, ';' is |
850
|
|
|
|
|
|
* provided by the tokeniser */ |
851
|
111694
|
|
|
|
|
{ $$ = newBINOP(OP_GELEM, 0, $1, scalar($3)); |
852
|
111694
|
|
|
|
|
PL_parser->expect = XOPERATOR; |
853
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'{'); |
854
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,';'); |
855
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,'}'); |
856
|
|
|
|
|
|
} |
857
|
111694
|
|
|
|
|
| scalar '[' expr ']' /* $array[$element] */ |
858
|
3812441
|
|
|
|
|
{ $$ = newBINOP(OP_AELEM, 0, oopsAV($1), scalar($3)); |
859
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'['); |
860
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,']'); |
861
|
|
|
|
|
|
} |
862
|
3812441
|
|
|
|
|
| term ARROW '[' expr ']' /* somearef->[$element] */ |
863
|
1228740
|
|
|
|
|
{ $$ = newBINOP(OP_AELEM, 0, |
864
|
|
|
|
|
|
ref(newAVREF($1),OP_RV2AV), |
865
|
|
|
|
|
|
scalar($4)); |
866
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'a'); |
867
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'['); |
868
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,']'); |
869
|
|
|
|
|
|
} |
870
|
1228738
|
|
|
|
|
| subscripted '[' expr ']' /* $foo->[$bar]->[$baz] */ |
871
|
675866
|
|
|
|
|
{ $$ = newBINOP(OP_AELEM, 0, |
872
|
|
|
|
|
|
ref(newAVREF($1),OP_RV2AV), |
873
|
|
|
|
|
|
scalar($3)); |
874
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'['); |
875
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,']'); |
876
|
|
|
|
|
|
} |
877
|
675866
|
|
|
|
|
| scalar '{' expr ';' '}' /* $foo{bar();} */ |
878
|
5330218
|
|
|
|
|
{ $$ = newBINOP(OP_HELEM, 0, oopsHV($1), jmaybe($3)); |
879
|
5330218
|
|
|
|
|
PL_parser->expect = XOPERATOR; |
880
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'{'); |
881
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,';'); |
882
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,'}'); |
883
|
|
|
|
|
|
} |
884
|
5330218
|
|
|
|
|
| term ARROW '{' expr ';' '}' /* somehref->{bar();} */ |
885
|
7988822
|
|
|
|
|
{ $$ = newBINOP(OP_HELEM, 0, |
886
|
|
|
|
|
|
ref(newHVREF($1),OP_RV2HV), |
887
|
|
|
|
|
|
jmaybe($4)); |
888
|
7988820
|
|
|
|
|
PL_parser->expect = XOPERATOR; |
889
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'a'); |
890
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'{'); |
891
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,';'); |
892
|
|
|
|
|
|
TOKEN_GETMAD($6,$$,'}'); |
893
|
|
|
|
|
|
} |
894
|
7988820
|
|
|
|
|
| subscripted '{' expr ';' '}' /* $foo->[bar]->{baz;} */ |
895
|
1476486
|
|
|
|
|
{ $$ = newBINOP(OP_HELEM, 0, |
896
|
|
|
|
|
|
ref(newHVREF($1),OP_RV2HV), |
897
|
|
|
|
|
|
jmaybe($3)); |
898
|
1476486
|
|
|
|
|
PL_parser->expect = XOPERATOR; |
899
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'{'); |
900
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,';'); |
901
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,'}'); |
902
|
|
|
|
|
|
} |
903
|
1476486
|
|
|
|
|
| term ARROW '(' ')' /* $subref->() */ |
904
|
71570
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, |
905
|
|
|
|
|
|
newCVREF(0, scalar($1))); |
906
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'a'); |
907
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'('); |
908
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,')'); |
909
|
|
|
|
|
|
} |
910
|
71570
|
|
|
|
|
| term ARROW '(' expr ')' /* $subref->(@args) */ |
911
|
231664
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, |
912
|
|
|
|
|
|
op_append_elem(OP_LIST, $4, |
913
|
|
|
|
|
|
newCVREF(0, scalar($1)))); |
914
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'a'); |
915
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'('); |
916
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,')'); |
917
|
|
|
|
|
|
} |
918
|
231664
|
|
|
|
|
|
919
|
|
|
|
|
|
| subscripted '(' expr ')' /* $foo->{bar}->(@args) */ |
920
|
5206
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, |
921
|
|
|
|
|
|
op_append_elem(OP_LIST, $3, |
922
|
|
|
|
|
|
newCVREF(0, scalar($1)))); |
923
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
924
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,')'); |
925
|
|
|
|
|
|
} |
926
|
5206
|
|
|
|
|
| subscripted '(' ')' /* $foo->{bar}->() */ |
927
|
12
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, |
928
|
|
|
|
|
|
newCVREF(0, scalar($1))); |
929
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
930
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,')'); |
931
|
|
|
|
|
|
} |
932
|
12
|
|
|
|
|
| '(' expr ')' '[' expr ']' /* list slice */ |
933
|
353717
|
|
|
|
|
{ $$ = newSLICEOP(0, $5, $2); |
934
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'('); |
935
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,')'); |
936
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,'['); |
937
|
|
|
|
|
|
TOKEN_GETMAD($6,$$,']'); |
938
|
|
|
|
|
|
} |
939
|
353717
|
|
|
|
|
| QWLIST '[' expr ']' /* list literal slice */ |
940
|
4730
|
|
|
|
|
{ $$ = newSLICEOP(0, $3, $1); |
941
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'['); |
942
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,']'); |
943
|
|
|
|
|
|
} |
944
|
4730
|
|
|
|
|
| '(' ')' '[' expr ']' /* empty list slice! */ |
945
|
4
|
|
|
|
|
{ $$ = newSLICEOP(0, $4, (OP*)NULL); |
946
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'('); |
947
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,')'); |
948
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'['); |
949
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,']'); |
950
|
|
|
|
|
|
} |
951
|
4
|
|
|
|
|
; |
952
|
|
|
|
|
|
|
953
|
|
|
|
|
|
/* Binary operators between terms */ |
954
|
|
|
|
|
|
termbinop: term ASSIGNOP term /* $x = $y */ |
955
|
31922155
|
|
|
|
|
{ $$ = newASSIGNOP(OPf_STACKED, $1, IVAL($2), $3); |
956
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
957
|
|
|
|
|
|
} |
958
|
31922155
|
|
|
|
|
| term POWOP term /* $x ** $y */ |
959
|
51666
|
|
|
|
|
{ $$ = newBINOP(IVAL($2), 0, scalar($1), scalar($3)); |
960
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
961
|
|
|
|
|
|
} |
962
|
51666
|
|
|
|
|
| term MULOP term /* $x * $y, $x x $y */ |
963
|
435198
|
100
|
|
|
|
{ if (IVAL($2) != OP_REPEAT) |
964
|
212932
|
|
|
|
|
scalar($1); |
965
|
435198
|
|
|
|
|
$$ = newBINOP(IVAL($2), 0, $1, scalar($3)); |
966
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
967
|
|
|
|
|
|
} |
968
|
435198
|
|
|
|
|
| term ADDOP term /* $x + $y */ |
969
|
17033533
|
|
|
|
|
{ $$ = newBINOP(IVAL($2), 0, scalar($1), scalar($3)); |
970
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
971
|
|
|
|
|
|
} |
972
|
17033529
|
|
|
|
|
| term SHIFTOP term /* $x >> $y, $x << $y */ |
973
|
62773
|
|
|
|
|
{ $$ = newBINOP(IVAL($2), 0, scalar($1), scalar($3)); |
974
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
975
|
|
|
|
|
|
} |
976
|
62773
|
|
|
|
|
| term RELOP term /* $x > $y, etc. */ |
977
|
1955504
|
|
|
|
|
{ $$ = newBINOP(IVAL($2), 0, scalar($1), scalar($3)); |
978
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
979
|
|
|
|
|
|
} |
980
|
1955504
|
|
|
|
|
| term EQOP term /* $x == $y, $x eq $y */ |
981
|
6457890
|
|
|
|
|
{ $$ = newBINOP(IVAL($2), 0, scalar($1), scalar($3)); |
982
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
983
|
|
|
|
|
|
} |
984
|
6457890
|
|
|
|
|
| term BITANDOP term /* $x & $y */ |
985
|
870909
|
|
|
|
|
{ $$ = newBINOP(IVAL($2), 0, scalar($1), scalar($3)); |
986
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
987
|
|
|
|
|
|
} |
988
|
870909
|
|
|
|
|
| term BITOROP term /* $x | $y */ |
989
|
353248
|
|
|
|
|
{ $$ = newBINOP(IVAL($2), 0, scalar($1), scalar($3)); |
990
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
991
|
|
|
|
|
|
} |
992
|
353248
|
|
|
|
|
| term DOTDOT term /* $x..$y, $x...$y */ |
993
|
|
|
|
|
|
{ |
994
|
183036
|
|
|
|
|
$$ = newRANGE(IVAL($2), scalar($1), scalar($3)); |
995
|
|
|
|
|
|
DO_MAD({ |
996
|
|
|
|
|
|
UNOP *op; |
997
|
|
|
|
|
|
op = (UNOP*)$$; |
998
|
|
|
|
|
|
op = (UNOP*)op->op_first; /* get to flop */ |
999
|
|
|
|
|
|
op = (UNOP*)op->op_first; /* get to flip */ |
1000
|
|
|
|
|
|
op = (UNOP*)op->op_first; /* get to range */ |
1001
|
|
|
|
|
|
token_getmad($2,(OP*)op,'o'); |
1002
|
|
|
|
|
|
}); |
1003
|
|
|
|
|
|
} |
1004
|
183036
|
|
|
|
|
| term ANDAND term /* $x && $y */ |
1005
|
2516560
|
|
|
|
|
{ $$ = newLOGOP(OP_AND, 0, $1, $3); |
1006
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
1007
|
|
|
|
|
|
} |
1008
|
2516560
|
|
|
|
|
| term OROR term /* $x || $y */ |
1009
|
1840150
|
|
|
|
|
{ $$ = newLOGOP(OP_OR, 0, $1, $3); |
1010
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
1011
|
|
|
|
|
|
} |
1012
|
1840150
|
|
|
|
|
| term DORDOR term /* $x // $y */ |
1013
|
55860
|
|
|
|
|
{ $$ = newLOGOP(OP_DOR, 0, $1, $3); |
1014
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
1015
|
|
|
|
|
|
} |
1016
|
55860
|
|
|
|
|
| term MATCHOP term /* $x =~ /$y/ */ |
1017
|
3894339
|
|
|
|
|
{ $$ = bind_match(IVAL($2), $1, $3); |
1018
|
|
|
|
|
|
TOKEN_GETMAD($2, |
1019
|
|
|
|
|
|
($$->op_type == OP_NOT |
1020
|
|
|
|
|
|
? ((UNOP*)$$)->op_first : $$), |
1021
|
|
|
|
|
|
'~'); |
1022
|
|
|
|
|
|
} |
1023
|
3894339
|
|
|
|
|
; |
1024
|
|
|
|
|
|
|
1025
|
|
|
|
|
|
/* Unary operators and terms */ |
1026
|
|
|
|
|
|
termunop : '-' term %prec UMINUS /* -$x */ |
1027
|
529370
|
|
|
|
|
{ $$ = newUNOP(OP_NEGATE, 0, scalar($2)); |
1028
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1029
|
|
|
|
|
|
} |
1030
|
529370
|
|
|
|
|
| '+' term %prec UMINUS /* +$x */ |
1031
|
67212
|
|
|
|
|
{ $$ = IF_MAD( |
1032
|
|
|
|
|
|
newUNOP(OP_NULL, 0, $2), |
1033
|
|
|
|
|
|
$2 |
1034
|
|
|
|
|
|
); |
1035
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'+'); |
1036
|
|
|
|
|
|
} |
1037
|
67212
|
|
|
|
|
| '!' term /* !$x */ |
1038
|
2081870
|
|
|
|
|
{ $$ = newUNOP(OP_NOT, 0, scalar($2)); |
1039
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1040
|
|
|
|
|
|
} |
1041
|
2081870
|
|
|
|
|
| '~' term /* ~$x */ |
1042
|
187860
|
|
|
|
|
{ $$ = newUNOP(OP_COMPLEMENT, 0, scalar($2)); |
1043
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1044
|
|
|
|
|
|
} |
1045
|
187860
|
|
|
|
|
| term POSTINC /* $x++ */ |
1046
|
646926
|
|
|
|
|
{ $$ = newUNOP(OP_POSTINC, 0, |
1047
|
|
|
|
|
|
op_lvalue(scalar($1), OP_POSTINC)); |
1048
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
1049
|
|
|
|
|
|
} |
1050
|
646926
|
|
|
|
|
| term POSTDEC /* $x-- */ |
1051
|
211848
|
|
|
|
|
{ $$ = newUNOP(OP_POSTDEC, 0, |
1052
|
|
|
|
|
|
op_lvalue(scalar($1), OP_POSTDEC)); |
1053
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'o'); |
1054
|
|
|
|
|
|
} |
1055
|
211848
|
|
|
|
|
| PREINC term /* ++$x */ |
1056
|
147172
|
|
|
|
|
{ $$ = newUNOP(OP_PREINC, 0, |
1057
|
|
|
|
|
|
op_lvalue(scalar($2), OP_PREINC)); |
1058
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1059
|
|
|
|
|
|
} |
1060
|
147172
|
|
|
|
|
| PREDEC term /* --$x */ |
1061
|
119036
|
|
|
|
|
{ $$ = newUNOP(OP_PREDEC, 0, |
1062
|
|
|
|
|
|
op_lvalue(scalar($2), OP_PREDEC)); |
1063
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1064
|
|
|
|
|
|
} |
1065
|
119036
|
|
|
|
|
|
1066
|
|
|
|
|
|
; |
1067
|
|
|
|
|
|
|
1068
|
|
|
|
|
|
/* Constructors for anonymous data */ |
1069
|
|
|
|
|
|
anonymous: '[' expr ']' |
1070
|
1089658
|
|
|
|
|
{ $$ = newANONLIST($2); |
1071
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'['); |
1072
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,']'); |
1073
|
|
|
|
|
|
} |
1074
|
1089658
|
|
|
|
|
| '[' ']' |
1075
|
171456
|
|
|
|
|
{ $$ = newANONLIST((OP*)NULL); |
1076
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'['); |
1077
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,']'); |
1078
|
|
|
|
|
|
} |
1079
|
171456
|
|
|
|
|
| HASHBRACK expr ';' '}' %prec '(' /* { foo => "Bar" } */ |
1080
|
674317
|
|
|
|
|
{ $$ = newANONHASH($2); |
1081
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'{'); |
1082
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,';'); |
1083
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,'}'); |
1084
|
|
|
|
|
|
} |
1085
|
674317
|
|
|
|
|
| HASHBRACK ';' '}' %prec '(' /* { } (';' by tokener) */ |
1086
|
285048
|
|
|
|
|
{ $$ = newANONHASH((OP*)NULL); |
1087
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'{'); |
1088
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,';'); |
1089
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'}'); |
1090
|
|
|
|
|
|
} |
1091
|
285048
|
|
|
|
|
| ANONSUB startanonsub proto subattrlist block %prec '(' |
1092
|
617608
|
50
|
|
|
|
{ SvREFCNT_inc_simple_void(PL_compcv); |
1093
|
617608
|
|
|
|
|
$$ = newANONATTRSUB($2, $3, $4, $5); |
1094
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1095
|
|
|
|
|
|
OP_GETMAD($3,$$,'s'); |
1096
|
|
|
|
|
|
OP_GETMAD($4,$$,'a'); |
1097
|
|
|
|
|
|
} |
1098
|
617604
|
|
|
|
|
|
1099
|
|
|
|
|
|
; |
1100
|
|
|
|
|
|
|
1101
|
|
|
|
|
|
/* Things called with "do" */ |
1102
|
|
|
|
|
|
termdo : DO term %prec UNIOP /* do $filename */ |
1103
|
30720
|
|
|
|
|
{ $$ = dofile($2, IVAL($1)); |
1104
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1105
|
|
|
|
|
|
} |
1106
|
30720
|
|
|
|
|
| DO block %prec '(' /* do { code */ |
1107
|
517585
|
|
|
|
|
{ $$ = newUNOP(OP_NULL, OPf_SPECIAL, op_scope($2)); |
1108
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'D'); |
1109
|
|
|
|
|
|
} |
1110
|
517585
|
|
|
|
|
| DO subname '(' ')' /* do somesub() */ |
1111
|
44
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, |
1112
|
|
|
|
|
|
OPf_SPECIAL|OPf_STACKED, |
1113
|
|
|
|
|
|
op_prepend_elem(OP_LIST, |
1114
|
|
|
|
|
|
scalar(newCVREF( |
1115
|
|
|
|
|
|
(OPpENTERSUB_AMPER<<8), |
1116
|
|
|
|
|
|
scalar($2) |
1117
|
44
|
|
|
|
|
)),(OP*)NULL)); dep(); |
1118
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1119
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'('); |
1120
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,')'); |
1121
|
|
|
|
|
|
} |
1122
|
44
|
|
|
|
|
| DO subname '(' expr ')' /* do somesub(@args) */ |
1123
|
12
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, |
1124
|
|
|
|
|
|
OPf_SPECIAL|OPf_STACKED, |
1125
|
|
|
|
|
|
op_append_elem(OP_LIST, |
1126
|
|
|
|
|
|
$4, |
1127
|
|
|
|
|
|
scalar(newCVREF( |
1128
|
|
|
|
|
|
(OPpENTERSUB_AMPER<<8), |
1129
|
|
|
|
|
|
scalar($2) |
1130
|
12
|
|
|
|
|
)))); dep(); |
1131
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1132
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'('); |
1133
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,')'); |
1134
|
|
|
|
|
|
} |
1135
|
12
|
|
|
|
|
| DO scalar '(' ')' /* do $subref () */ |
1136
|
4
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, |
1137
|
|
|
|
|
|
op_prepend_elem(OP_LIST, |
1138
|
4
|
|
|
|
|
scalar(newCVREF(0,scalar($2))), (OP*)NULL)); dep(); |
1139
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1140
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'('); |
1141
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,')'); |
1142
|
|
|
|
|
|
} |
1143
|
4
|
|
|
|
|
| DO scalar '(' expr ')' /* do $subref (@args) */ |
1144
|
4
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, |
1145
|
|
|
|
|
|
op_prepend_elem(OP_LIST, |
1146
|
|
|
|
|
|
$4, |
1147
|
4
|
|
|
|
|
scalar(newCVREF(0,scalar($2))))); dep(); |
1148
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1149
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'('); |
1150
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,')'); |
1151
|
|
|
|
|
|
} |
1152
|
4
|
|
|
|
|
|
1153
|
|
|
|
|
|
; |
1154
|
|
|
|
|
|
|
1155
|
|
|
|
|
|
term : termbinop |
1156
|
|
|
|
|
|
| termunop |
1157
|
|
|
|
|
|
| anonymous |
1158
|
|
|
|
|
|
| termdo |
1159
|
|
|
|
|
|
| term '?' term ':' term |
1160
|
2999257
|
|
|
|
|
{ $$ = newCONDOP(0, $1, $3, $5); |
1161
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'?'); |
1162
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,':'); |
1163
|
|
|
|
|
|
} |
1164
|
2999257
|
|
|
|
|
| REFGEN term /* \$x, \@y, \%z */ |
1165
|
2439726
|
|
|
|
|
{ $$ = newUNOP(OP_REFGEN, 0, op_lvalue($2,OP_REFGEN)); |
1166
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1167
|
|
|
|
|
|
} |
1168
|
2439726
|
|
|
|
|
| myattrterm %prec UNIOP |
1169
|
18087316
|
|
|
|
|
{ $$ = $1; } |
1170
|
18087316
|
|
|
|
|
| LOCAL term %prec UNIOP |
1171
|
1214863
|
|
|
|
|
{ $$ = localize($2,IVAL($1)); |
1172
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'k'); |
1173
|
|
|
|
|
|
} |
1174
|
1214859
|
|
|
|
|
| '(' expr ')' |
1175
|
5459861
|
|
|
|
|
{ $$ = sawparens(IF_MAD(newUNOP(OP_NULL,0,$2), $2)); |
1176
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'('); |
1177
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,')'); |
1178
|
|
|
|
|
|
} |
1179
|
5459861
|
|
|
|
|
| QWLIST |
1180
|
1356393
|
|
|
|
|
{ $$ = IF_MAD(newUNOP(OP_NULL,0,$1), $1); } |
1181
|
1356393
|
|
|
|
|
| '(' ')' |
1182
|
543874
|
|
|
|
|
{ $$ = sawparens(newNULLLIST()); |
1183
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'('); |
1184
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,')'); |
1185
|
|
|
|
|
|
} |
1186
|
543874
|
|
|
|
|
| scalar %prec '(' |
1187
|
91970442
|
|
|
|
|
{ $$ = $1; } |
1188
|
91970442
|
|
|
|
|
| star %prec '(' |
1189
|
1479184
|
|
|
|
|
{ $$ = $1; } |
1190
|
1479184
|
|
|
|
|
| hsh %prec '(' |
1191
|
1595417
|
|
|
|
|
{ $$ = $1; } |
1192
|
1595417
|
|
|
|
|
| ary %prec '(' |
1193
|
14216831
|
|
|
|
|
{ $$ = $1; } |
1194
|
14216831
|
|
|
|
|
| arylen %prec '(' /* $#x, $#{ something } */ |
1195
|
219480
|
|
|
|
|
{ $$ = newUNOP(OP_AV2ARYLEN, 0, ref($1, OP_AV2ARYLEN));} |
1196
|
219480
|
|
|
|
|
| subscripted |
1197
|
19133596
|
|
|
|
|
{ $$ = $1; } |
1198
|
19133596
|
|
|
|
|
| ary '[' expr ']' /* array slice */ |
1199
|
80526
|
|
|
|
|
{ $$ = op_prepend_elem(OP_ASLICE, |
1200
|
|
|
|
|
|
newOP(OP_PUSHMARK, 0), |
1201
|
|
|
|
|
|
newLISTOP(OP_ASLICE, 0, |
1202
|
|
|
|
|
|
list($3), |
1203
|
|
|
|
|
|
ref($1, OP_ASLICE))); |
1204
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'['); |
1205
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,']'); |
1206
|
|
|
|
|
|
} |
1207
|
80526
|
|
|
|
|
| ary '{' expr ';' '}' /* @hash{@keys} */ |
1208
|
309699
|
|
|
|
|
{ $$ = op_prepend_elem(OP_HSLICE, |
1209
|
|
|
|
|
|
newOP(OP_PUSHMARK, 0), |
1210
|
|
|
|
|
|
newLISTOP(OP_HSLICE, 0, |
1211
|
|
|
|
|
|
list($3), |
1212
|
|
|
|
|
|
ref(oopsHV($1), OP_HSLICE))); |
1213
|
309699
|
|
|
|
|
PL_parser->expect = XOPERATOR; |
1214
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'{'); |
1215
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,';'); |
1216
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,'}'); |
1217
|
|
|
|
|
|
} |
1218
|
309699
|
|
|
|
|
| THING %prec '(' |
1219
|
83057552
|
|
|
|
|
{ $$ = $1; } |
1220
|
83057552
|
|
|
|
|
| amper /* &foo; */ |
1221
|
2120443
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, 0, scalar($1)); } |
1222
|
2120443
|
|
|
|
|
| amper '(' ')' /* &foo() or foo() */ |
1223
|
1167060
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); |
1224
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
1225
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,')'); |
1226
|
|
|
|
|
|
} |
1227
|
1167060
|
|
|
|
|
| amper '(' expr ')' /* &foo(@args) or foo(@args) */ |
1228
|
|
|
|
|
|
{ |
1229
|
8233231
|
|
|
|
|
$$ = newUNOP(OP_ENTERSUB, OPf_STACKED, |
1230
|
|
|
|
|
|
op_append_elem(OP_LIST, $3, scalar($1))); |
1231
|
|
|
|
|
|
DO_MAD({ |
1232
|
|
|
|
|
|
OP* op = $$; |
1233
|
|
|
|
|
|
if (op->op_type == OP_CONST) { /* defeat const fold */ |
1234
|
|
|
|
|
|
op = (OP*)op->op_madprop->mad_val; |
1235
|
|
|
|
|
|
} |
1236
|
|
|
|
|
|
token_getmad($2,op,'('); |
1237
|
|
|
|
|
|
token_getmad($4,op,')'); |
1238
|
|
|
|
|
|
}); |
1239
|
|
|
|
|
|
} |
1240
|
8233219
|
|
|
|
|
| NOAMP subname optlistexpr /* foo @args (no parens) */ |
1241
|
1200735
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, |
1242
|
|
|
|
|
|
op_append_elem(OP_LIST, $3, scalar($2))); |
1243
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1244
|
|
|
|
|
|
} |
1245
|
1200735
|
|
|
|
|
| LOOPEX /* loop exiting command (goto, last, dump, etc) */ |
1246
|
1365370
|
|
|
|
|
{ $$ = newOP(IVAL($1), OPf_SPECIAL); |
1247
|
1365370
|
|
|
|
|
PL_hints |= HINT_BLOCK_SCOPE; |
1248
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1249
|
|
|
|
|
|
} |
1250
|
1365370
|
|
|
|
|
| LOOPEX term |
1251
|
478487
|
|
|
|
|
{ $$ = newLOOPEX(IVAL($1),$2); |
1252
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1253
|
|
|
|
|
|
} |
1254
|
478487
|
|
|
|
|
| NOTOP listexpr /* not $foo */ |
1255
|
323340
|
|
|
|
|
{ $$ = newUNOP(OP_NOT, 0, scalar($2)); |
1256
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1257
|
|
|
|
|
|
} |
1258
|
323340
|
|
|
|
|
| UNIOP /* Unary op, $_ implied */ |
1259
|
4137764
|
|
|
|
|
{ $$ = newOP(IVAL($1), 0); |
1260
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1261
|
|
|
|
|
|
} |
1262
|
4137764
|
|
|
|
|
| UNIOP block /* eval { foo }* */ |
1263
|
422174
|
|
|
|
|
{ $$ = newUNOP(IVAL($1), 0, $2); |
1264
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1265
|
|
|
|
|
|
} |
1266
|
422174
|
|
|
|
|
| UNIOP term /* Unary op */ |
1267
|
7310253
|
|
|
|
|
{ $$ = newUNOP(IVAL($1), 0, $2); |
1268
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1269
|
|
|
|
|
|
} |
1270
|
7310235
|
|
|
|
|
| REQUIRE /* require, $_ implied */ |
1271
|
4
|
50
|
|
|
|
{ $$ = newOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0); |
1272
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1273
|
|
|
|
|
|
} |
1274
|
4
|
|
|
|
|
| REQUIRE term /* require Foo */ |
1275
|
1430903
|
100
|
|
|
|
{ $$ = newUNOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0, $2); |
1276
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1277
|
|
|
|
|
|
} |
1278
|
1430903
|
|
|
|
|
| UNIOPSUB |
1279
|
100
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); } |
1280
|
100
|
|
|
|
|
| UNIOPSUB term /* Sub treated as unop */ |
1281
|
2318
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, |
1282
|
|
|
|
|
|
op_append_elem(OP_LIST, $2, scalar($1))); } |
1283
|
2318
|
|
|
|
|
| FUNC0 /* Nullary operator */ |
1284
|
121632
|
|
|
|
|
{ $$ = newOP(IVAL($1), 0); |
1285
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1286
|
|
|
|
|
|
} |
1287
|
121632
|
|
|
|
|
| FUNC0 '(' ')' |
1288
|
24928
|
|
|
|
|
{ $$ = newOP(IVAL($1), 0); |
1289
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1290
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
1291
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,')'); |
1292
|
|
|
|
|
|
} |
1293
|
24928
|
|
|
|
|
| FUNC0OP /* Same as above, but op created in toke.c */ |
1294
|
264148
|
|
|
|
|
{ $$ = $1; } |
1295
|
264148
|
|
|
|
|
| FUNC0OP '(' ')' |
1296
|
14
|
|
|
|
|
{ $$ = $1; |
1297
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
1298
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,')'); |
1299
|
|
|
|
|
|
} |
1300
|
14
|
|
|
|
|
| FUNC0SUB /* Sub treated as nullop */ |
1301
|
43058
|
|
|
|
|
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, |
1302
|
|
|
|
|
|
scalar($1)); } |
1303
|
43058
|
|
|
|
|
| FUNC1 '(' ')' /* not () */ |
1304
|
217468
|
|
|
|
|
{ $$ = (IVAL($1) == OP_NOT) |
1305
|
6
|
|
|
|
|
? newUNOP(IVAL($1), 0, newSVOP(OP_CONST, 0, newSViv(0))) |
1306
|
108740
|
100
|
|
|
|
: newOP(IVAL($1), OPf_SPECIAL); |
1307
|
|
|
|
|
|
|
1308
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1309
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
1310
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,')'); |
1311
|
|
|
|
|
|
} |
1312
|
108734
|
|
|
|
|
| FUNC1 '(' expr ')' /* not($foo) */ |
1313
|
3162804
|
|
|
|
|
{ $$ = newUNOP(IVAL($1), 0, $3); |
1314
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'o'); |
1315
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,'('); |
1316
|
|
|
|
|
|
TOKEN_GETMAD($4,$$,')'); |
1317
|
|
|
|
|
|
} |
1318
|
3162804
|
|
|
|
|
| PMFUNC /* m//, s///, qr//, tr/// */ |
1319
|
|
|
|
|
|
{ |
1320
|
7181400
|
100
|
|
|
|
if ( $1->op_type != OP_TRANS |
1321
|
4846033
|
|
|
|
|
&& $1->op_type != OP_TRANSR |
1322
|
4736787
|
100
|
|
|
|
&& (((PMOP*)$1)->op_pmflags & PMf_HAS_CV)) |
1323
|
|
|
|
|
|
{ |
1324
|
8944
|
|
|
|
|
$$ = start_subparse(FALSE, CVf_ANON); |
1325
|
8944
|
|
|
|
|
SAVEFREESV(PL_compcv); |
1326
|
|
|
|
|
|
} else |
1327
|
4837089
|
|
|
|
|
$$ = 0; |
1328
|
|
|
|
|
|
} |
1329
|
|
|
|
|
|
'(' listexpr ')' |
1330
|
4845883
|
|
|
|
|
{ $$ = pmruntime($1, $4, 1, $2); |
1331
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,'('); |
1332
|
|
|
|
|
|
TOKEN_GETMAD($5,$$,')'); |
1333
|
|
|
|
|
|
} |
1334
|
4844411
|
|
|
|
|
| WORD |
1335
|
|
|
|
|
|
| listop |
1336
|
|
|
|
|
|
| YADAYADA |
1337
|
|
|
|
|
|
{ |
1338
|
2
|
|
|
|
|
$$ = newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0), |
1339
|
|
|
|
|
|
newSVOP(OP_CONST, 0, newSVpvs("Unimplemented"))); |
1340
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'X'); |
1341
|
|
|
|
|
|
} |
1342
|
2
|
|
|
|
|
| PLUGEXPR |
1343
|
|
|
|
|
|
; |
1344
|
|
|
|
|
|
|
1345
|
|
|
|
|
|
/* "my" declarations, with optional attributes */ |
1346
|
|
|
|
|
|
myattrterm: MY myterm myattrlist |
1347
|
108
|
|
|
|
|
{ $$ = my_attrs($2,$3); |
1348
|
|
|
|
|
|
DO_MAD( |
1349
|
|
|
|
|
|
token_getmad($1,$$,'d'); |
1350
|
|
|
|
|
|
append_madprops($3->op_madprop, $$, 'a'); |
1351
|
|
|
|
|
|
$3->op_madprop = 0; |
1352
|
|
|
|
|
|
); |
1353
|
|
|
|
|
|
} |
1354
|
108
|
|
|
|
|
| MY myterm |
1355
|
18087208
|
|
|
|
|
{ $$ = localize($2,IVAL($1)); |
1356
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'d'); |
1357
|
|
|
|
|
|
} |
1358
|
18087208
|
|
|
|
|
; |
1359
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
/* Things that can be "my"'d */ |
1361
|
|
|
|
|
|
myterm : '(' expr ')' |
1362
|
3874398
|
|
|
|
|
{ $$ = sawparens($2); |
1363
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'('); |
1364
|
|
|
|
|
|
TOKEN_GETMAD($3,$$,')'); |
1365
|
|
|
|
|
|
} |
1366
|
3874398
|
|
|
|
|
| '(' ')' |
1367
|
2
|
|
|
|
|
{ $$ = sawparens(newNULLLIST()); |
1368
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'('); |
1369
|
|
|
|
|
|
TOKEN_GETMAD($2,$$,')'); |
1370
|
|
|
|
|
|
} |
1371
|
2
|
|
|
|
|
| scalar %prec '(' |
1372
|
12156727
|
|
|
|
|
{ $$ = $1; } |
1373
|
12156727
|
|
|
|
|
| hsh %prec '(' |
1374
|
775025
|
|
|
|
|
{ $$ = $1; } |
1375
|
775025
|
|
|
|
|
| ary %prec '(' |
1376
|
1281168
|
|
|
|
|
{ $$ = $1; } |
1377
|
1281168
|
|
|
|
|
; |
1378
|
|
|
|
|
|
|
1379
|
|
|
|
|
|
/* Basic list expressions */ |
1380
|
|
|
|
|
|
optlistexpr: /* NULL */ %prec PREC_LOW |
1381
|
4639913
|
|
|
|
|
{ $$ = (OP*)NULL; } |
1382
|
4639913
|
|
|
|
|
| listexpr %prec PREC_LOW |
1383
|
12976718
|
|
|
|
|
{ $$ = $1; } |
1384
|
12976718
|
|
|
|
|
; |
1385
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
optexpr: /* NULL */ |
1387
|
460558
|
|
|
|
|
{ $$ = (OP*)NULL; } |
1388
|
460558
|
|
|
|
|
| expr |
1389
|
19396186
|
|
|
|
|
{ $$ = $1; } |
1390
|
19396186
|
|
|
|
|
; |
1391
|
|
|
|
|
|
|
1392
|
|
|
|
|
|
/* A little bit of trickery to make "for my $foo (@bar)" actually be |
1393
|
|
|
|
|
|
lexical */ |
1394
|
|
|
|
|
|
my_scalar: scalar |
1395
|
886101
|
|
|
|
|
{ PL_parser->in_my = 0; $$ = my($1); } |
1396
|
886101
|
|
|
|
|
; |
1397
|
|
|
|
|
|
|
1398
|
|
|
|
|
|
amper : '&' indirob |
1399
|
11520756
|
|
|
|
|
{ $$ = newCVREF(IVAL($1),$2); |
1400
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'&'); |
1401
|
|
|
|
|
|
} |
1402
|
11520740
|
|
|
|
|
; |
1403
|
|
|
|
|
|
|
1404
|
|
|
|
|
|
scalar : '$' indirob |
1405
|
117129534
|
|
|
|
|
{ $$ = newSVREF($2); |
1406
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'$'); |
1407
|
|
|
|
|
|
} |
1408
|
117129534
|
|
|
|
|
; |
1409
|
|
|
|
|
|
|
1410
|
|
|
|
|
|
ary : '@' indirob |
1411
|
15888224
|
|
|
|
|
{ $$ = newAVREF($2); |
1412
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'@'); |
1413
|
|
|
|
|
|
} |
1414
|
15888224
|
|
|
|
|
; |
1415
|
|
|
|
|
|
|
1416
|
|
|
|
|
|
hsh : '%' indirob |
1417
|
2370442
|
|
|
|
|
{ $$ = newHVREF($2); |
1418
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'%'); |
1419
|
|
|
|
|
|
} |
1420
|
2370442
|
|
|
|
|
; |
1421
|
|
|
|
|
|
|
1422
|
|
|
|
|
|
arylen : DOLSHARP indirob |
1423
|
219480
|
|
|
|
|
{ $$ = newAVREF($2); |
1424
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'l'); |
1425
|
|
|
|
|
|
} |
1426
|
219480
|
|
|
|
|
; |
1427
|
|
|
|
|
|
|
1428
|
|
|
|
|
|
star : '*' indirob |
1429
|
1590878
|
|
|
|
|
{ $$ = newGVREF(0,$2); |
1430
|
|
|
|
|
|
TOKEN_GETMAD($1,$$,'*'); |
1431
|
|
|
|
|
|
} |
1432
|
1590878
|
|
|
|
|
; |
1433
|
|
|
|
|
|
|
1434
|
|
|
|
|
|
/* Indirect objects */ |
1435
|
|
|
|
|
|
indirob : WORD |
1436
|
39335969
|
|
|
|
|
{ $$ = scalar($1); } |
1437
|
39335969
|
|
|
|
|
| scalar %prec PREC_LOW |
1438
|
2711115
|
|
|
|
|
{ $$ = scalar($1); } |
1439
|
2711115
|
|
|
|
|
| block |
1440
|
2834126
|
|
|
|
|
{ $$ = op_scope($1); } |
1441
|
2834126
|
|
|
|
|
|
1442
|
|
|
|
|
|
| PRIVATEREF |
1443
|
104828427
|
|
|
|
|
{ $$ = $1; } |
1444
|
104828427
|
|
|
|
|
; |