Commit | Line | Data |
---|---|---|
5f05dabc | 1 | Index: perly.c |
93a17b20 | 2 | *************** |
bbce6d69 | 3 | *** 13,82 **** |
a0d0e21e LW |
4 | } |
5 | ||
36477c24 | 6 | ! #line 29 "perly.y" |
7 | ! typedef union { | |
8 | ! I32 ival; | |
9 | ! char *pval; | |
10 | ! OP *opval; | |
11 | ! GV *gvval; | |
12 | ! } YYSTYPE; | |
13 | ! #line 23 "y.tab.c" | |
14 | ! #define WORD 257 | |
15 | ! #define METHOD 258 | |
16 | ! #define FUNCMETH 259 | |
17 | ! #define THING 260 | |
18 | ! #define PMFUNC 261 | |
19 | ! #define PRIVATEREF 262 | |
20 | ! #define FUNC0SUB 263 | |
21 | ! #define UNIOPSUB 264 | |
22 | ! #define LSTOPSUB 265 | |
23 | ! #define LABEL 266 | |
24 | ! #define FORMAT 267 | |
25 | ! #define SUB 268 | |
26 | ! #define ANONSUB 269 | |
27 | ! #define PACKAGE 270 | |
28 | ! #define USE 271 | |
29 | ! #define WHILE 272 | |
30 | ! #define UNTIL 273 | |
31 | ! #define IF 274 | |
32 | ! #define UNLESS 275 | |
33 | ! #define ELSE 276 | |
34 | ! #define ELSIF 277 | |
35 | ! #define CONTINUE 278 | |
36 | ! #define FOR 279 | |
37 | ! #define LOOPEX 280 | |
38 | ! #define DOTDOT 281 | |
39 | ! #define FUNC0 282 | |
40 | ! #define FUNC1 283 | |
41 | ! #define FUNC 284 | |
42 | ! #define UNIOP 285 | |
43 | ! #define LSTOP 286 | |
44 | ! #define RELOP 287 | |
45 | ! #define EQOP 288 | |
46 | ! #define MULOP 289 | |
47 | ! #define ADDOP 290 | |
48 | ! #define DOLSHARP 291 | |
49 | ! #define DO 292 | |
50 | ! #define HASHBRACK 293 | |
51 | ! #define NOAMP 294 | |
52 | ! #define LOCAL 295 | |
53 | ! #define MY 296 | |
54 | ! #define OROP 297 | |
55 | ! #define ANDOP 298 | |
56 | ! #define NOTOP 299 | |
57 | ! #define ASSIGNOP 300 | |
58 | ! #define OROR 301 | |
59 | ! #define ANDAND 302 | |
60 | ! #define BITOROP 303 | |
61 | ! #define BITANDOP 304 | |
62 | ! #define SHIFTOP 305 | |
63 | ! #define MATCHOP 306 | |
64 | ! #define UMINUS 307 | |
65 | ! #define REFGEN 308 | |
66 | ! #define POWOP 309 | |
67 | ! #define PREINC 310 | |
68 | ! #define PREDEC 311 | |
69 | ! #define POSTINC 312 | |
70 | ! #define POSTDEC 313 | |
71 | ! #define ARROW 314 | |
72 | #define YYERRCODE 256 | |
73 | short yylhs[] = { -1, | |
74 | --- 13,17 ---- | |
75 | } | |
76 | ||
77 | ! #line 16 "perly.c" | |
a0d0e21e LW |
78 | #define YYERRCODE 256 |
79 | short yylhs[] = { -1, | |
a0d0e21e | 80 | *************** |
6da72b64 | 81 | *** 1348,1358 **** |
93a17b20 LW |
82 | int yyerrflag; |
83 | int yychar; | |
84 | - short *yyssp; | |
85 | - YYSTYPE *yyvsp; | |
86 | YYSTYPE yyval; | |
87 | YYSTYPE yylval; | |
88 | - short yyss[YYSTACKSIZE]; | |
89 | - YYSTYPE yyvs[YYSTACKSIZE]; | |
90 | - #define yystacksize YYSTACKSIZE | |
0da4822f | 91 | #line 632 "perly.y" |
93a17b20 | 92 | /* PROGRAM */ |
6da72b64 | 93 | --- 1283,1288 ---- |
bbce6d69 | 94 | *************** |
6da72b64 | 95 | *** 1361,1372 **** |
0da4822f GS |
96 | #define YYACCEPT goto yyaccept |
97 | #define YYERROR goto yyerrlab | |
98 | int | |
99 | ! yyparse() | |
100 | { | |
101 | register int yym, yyn, yystate; | |
102 | #if YYDEBUG | |
103 | register char *yys; | |
104 | extern char *getenv(); | |
105 | ||
106 | if (yys = getenv("YYDEBUG")) | |
107 | { | |
108 | --- 1291,1348 ---- | |
a0d0e21e LW |
109 | #define YYACCEPT goto yyaccept |
110 | #define YYERROR goto yyerrlab | |
111 | + | |
112 | + struct ysv { | |
113 | + short* yyss; | |
114 | + YYSTYPE* yyvs; | |
115 | + int oldyydebug; | |
116 | + int oldyynerrs; | |
117 | + int oldyyerrflag; | |
118 | + int oldyychar; | |
119 | + YYSTYPE oldyyval; | |
120 | + YYSTYPE oldyylval; | |
121 | + }; | |
122 | + | |
123 | + void | |
0da4822f | 124 | + yydestruct(void *ptr) |
a0d0e21e LW |
125 | + { |
126 | + struct ysv* ysave = (struct ysv*)ptr; | |
489bbe73 | 127 | + if (ysave->yyss) Safefree(ysave->yyss); |
128 | + if (ysave->yyvs) Safefree(ysave->yyvs); | |
a0d0e21e LW |
129 | + yydebug = ysave->oldyydebug; |
130 | + yynerrs = ysave->oldyynerrs; | |
131 | + yyerrflag = ysave->oldyyerrflag; | |
132 | + yychar = ysave->oldyychar; | |
133 | + yyval = ysave->oldyyval; | |
134 | + yylval = ysave->oldyylval; | |
489bbe73 | 135 | + Safefree(ysave); |
a0d0e21e LW |
136 | + } |
137 | + | |
138 | int | |
0da4822f | 139 | ! yyparse(void) |
93a17b20 LW |
140 | { |
141 | register int yym, yyn, yystate; | |
142 | + register short *yyssp; | |
143 | + register YYSTYPE *yyvsp; | |
144 | + short* yyss; | |
145 | + YYSTYPE* yyvs; | |
146 | + unsigned yystacksize = YYSTACKSIZE; | |
93a17b20 | 147 | + int retval = 0; |
93a17b20 LW |
148 | #if YYDEBUG |
149 | register char *yys; | |
0da4822f | 150 | + #ifndef __cplusplus |
93a17b20 | 151 | extern char *getenv(); |
a0d0e21e | 152 | + #endif |
0da4822f | 153 | + #endif |
55497cff | 154 | + |
a0d0e21e LW |
155 | + struct ysv *ysave = (struct ysv*)safemalloc(sizeof(struct ysv)); |
156 | + SAVEDESTRUCTOR(yydestruct, ysave); | |
157 | + ysave->oldyydebug = yydebug; | |
158 | + ysave->oldyynerrs = yynerrs; | |
159 | + ysave->oldyyerrflag = yyerrflag; | |
160 | + ysave->oldyychar = yychar; | |
161 | + ysave->oldyyval = yyval; | |
162 | + ysave->oldyylval = yylval; | |
55497cff | 163 | |
a0d0e21e LW |
164 | + #if YYDEBUG |
165 | if (yys = getenv("YYDEBUG")) | |
166 | { | |
93a17b20 | 167 | *************** |
6da72b64 | 168 | *** 1381,1384 **** |
0da4822f | 169 | --- 1357,1368 ---- |
93a17b20 LW |
170 | yychar = (-1); |
171 | ||
172 | + /* | |
173 | + ** Initialize private stacks (yyparse may be called from an action) | |
174 | + */ | |
a0d0e21e LW |
175 | + ysave->yyss = yyss = (short*)safemalloc(yystacksize*sizeof(short)); |
176 | + ysave->yyvs = yyvs = (YYSTYPE*)safemalloc(yystacksize*sizeof(YYSTYPE)); | |
93a17b20 LW |
177 | + if (!yyvs || !yyss) |
178 | + goto yyoverflow; | |
179 | + | |
180 | yyssp = yyss; | |
181 | yyvsp = yyvs; | |
93a17b20 | 182 | *************** |
6da72b64 | 183 | *** 1396,1400 **** |
ed6116ce LW |
184 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
185 | if (!yys) yys = "illegal-symbol"; | |
186 | ! printf("yydebug: state %d, reading %d (%s)\n", yystate, | |
187 | yychar, yys); | |
188 | } | |
0da4822f | 189 | --- 1380,1384 ---- |
ed6116ce LW |
190 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
191 | if (!yys) yys = "illegal-symbol"; | |
192 | ! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate, | |
193 | yychar, yys); | |
194 | } | |
ed6116ce | 195 | *************** |
6da72b64 | 196 | *** 1406,1415 **** |
ed6116ce LW |
197 | #if YYDEBUG |
198 | if (yydebug) | |
199 | ! printf("yydebug: state %d, shifting to state %d\n", | |
200 | yystate, yytable[yyn]); | |
93a17b20 LW |
201 | #endif |
202 | if (yyssp >= yyss + yystacksize - 1) | |
203 | { | |
204 | ! goto yyoverflow; | |
205 | } | |
206 | *++yyssp = yystate = yytable[yyn]; | |
0da4822f | 207 | --- 1390,1413 ---- |
ed6116ce LW |
208 | #if YYDEBUG |
209 | if (yydebug) | |
210 | ! fprintf(stderr, "yydebug: state %d, shifting to state %d\n", | |
211 | yystate, yytable[yyn]); | |
93a17b20 LW |
212 | #endif |
213 | if (yyssp >= yyss + yystacksize - 1) | |
214 | { | |
215 | ! /* | |
216 | ! ** reallocate and recover. Note that pointers | |
217 | ! ** have to be reset, or bad things will happen | |
218 | ! */ | |
219 | ! int yyps_index = (yyssp - yyss); | |
220 | ! int yypv_index = (yyvsp - yyvs); | |
221 | ! yystacksize += YYSTACKSIZE; | |
a0d0e21e LW |
222 | ! ysave->yyvs = yyvs = |
223 | ! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); | |
224 | ! ysave->yyss = yyss = | |
225 | ! (short*)realloc((char*)yyss,yystacksize * sizeof(short)); | |
93a17b20 LW |
226 | ! if (!yyvs || !yyss) |
227 | ! goto yyoverflow; | |
228 | ! yyssp = yyss + yyps_index; | |
229 | ! yyvsp = yyvs + yypv_index; | |
230 | } | |
231 | *++yyssp = yystate = yytable[yyn]; | |
93a17b20 | 232 | *************** |
6da72b64 | 233 | *** 1447,1456 **** |
ed6116ce LW |
234 | #if YYDEBUG |
235 | if (yydebug) | |
236 | ! printf("yydebug: state %d, error recovery shifting\ | |
237 | ! to state %d\n", *yyssp, yytable[yyn]); | |
93a17b20 LW |
238 | #endif |
239 | if (yyssp >= yyss + yystacksize - 1) | |
240 | { | |
241 | ! goto yyoverflow; | |
242 | } | |
243 | *++yyssp = yystate = yytable[yyn]; | |
0da4822f | 244 | --- 1445,1469 ---- |
ed6116ce LW |
245 | #if YYDEBUG |
246 | if (yydebug) | |
247 | ! fprintf(stderr, | |
248 | ! "yydebug: state %d, error recovery shifting to state %d\n", | |
249 | ! *yyssp, yytable[yyn]); | |
93a17b20 LW |
250 | #endif |
251 | if (yyssp >= yyss + yystacksize - 1) | |
252 | { | |
253 | ! /* | |
254 | ! ** reallocate and recover. Note that pointers | |
255 | ! ** have to be reset, or bad things will happen | |
256 | ! */ | |
257 | ! int yyps_index = (yyssp - yyss); | |
258 | ! int yypv_index = (yyvsp - yyvs); | |
259 | ! yystacksize += YYSTACKSIZE; | |
a0d0e21e | 260 | ! ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs, |
93a17b20 | 261 | ! yystacksize * sizeof(YYSTYPE)); |
a0d0e21e | 262 | ! ysave->yyss = yyss = (short*)realloc((char*)yyss, |
93a17b20 LW |
263 | ! yystacksize * sizeof(short)); |
264 | ! if (!yyvs || !yyss) | |
265 | ! goto yyoverflow; | |
266 | ! yyssp = yyss + yyps_index; | |
267 | ! yyvsp = yyvs + yypv_index; | |
268 | } | |
269 | *++yyssp = yystate = yytable[yyn]; | |
93a17b20 | 270 | *************** |
6da72b64 | 271 | *** 1462,1467 **** |
ed6116ce LW |
272 | #if YYDEBUG |
273 | if (yydebug) | |
274 | ! printf("yydebug: error recovery discarding state %d\n", | |
275 | ! *yyssp); | |
276 | #endif | |
277 | if (yyssp <= yyss) goto yyabort; | |
0da4822f | 278 | --- 1475,1481 ---- |
ed6116ce LW |
279 | #if YYDEBUG |
280 | if (yydebug) | |
281 | ! fprintf(stderr, | |
282 | ! "yydebug: error recovery discarding state %d\n", | |
283 | ! *yyssp); | |
284 | #endif | |
285 | if (yyssp <= yyss) goto yyabort; | |
ed6116ce | 286 | *************** |
6da72b64 | 287 | *** 1480,1485 **** |
ed6116ce LW |
288 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
289 | if (!yys) yys = "illegal-symbol"; | |
290 | ! printf("yydebug: state %d, error recovery discards token %d (%s)\n", | |
291 | ! yystate, yychar, yys); | |
292 | } | |
293 | #endif | |
0da4822f | 294 | --- 1494,1500 ---- |
ed6116ce LW |
295 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
296 | if (!yys) yys = "illegal-symbol"; | |
297 | ! fprintf(stderr, | |
298 | ! "yydebug: state %d, error recovery discards token %d (%s)\n", | |
299 | ! yystate, yychar, yys); | |
300 | } | |
301 | #endif | |
ed6116ce | 302 | *************** |
6da72b64 | 303 | *** 1490,1494 **** |
ed6116ce LW |
304 | #if YYDEBUG |
305 | if (yydebug) | |
306 | ! printf("yydebug: state %d, reducing by rule %d (%s)\n", | |
307 | yystate, yyn, yyrule[yyn]); | |
308 | #endif | |
0da4822f | 309 | --- 1505,1509 ---- |
ed6116ce LW |
310 | #if YYDEBUG |
311 | if (yydebug) | |
312 | ! fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n", | |
313 | yystate, yyn, yyrule[yyn]); | |
314 | #endif | |
ed6116ce | 315 | *************** |
0da4822f | 316 | *** 2279,2284 **** |
ed6116ce LW |
317 | #if YYDEBUG |
318 | if (yydebug) | |
319 | ! printf("yydebug: after reduction, shifting from state 0 to\ | |
320 | ! state %d\n", YYFINAL); | |
321 | #endif | |
322 | yystate = YYFINAL; | |
0da4822f | 323 | --- 2294,2300 ---- |
ed6116ce LW |
324 | #if YYDEBUG |
325 | if (yydebug) | |
326 | ! fprintf(stderr, | |
327 | ! "yydebug: after reduction, shifting from state 0 to state %d\n", | |
328 | ! YYFINAL); | |
329 | #endif | |
330 | yystate = YYFINAL; | |
ed6116ce | 331 | *************** |
0da4822f | 332 | *** 2294,2298 **** |
ed6116ce LW |
333 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
334 | if (!yys) yys = "illegal-symbol"; | |
335 | ! printf("yydebug: state %d, reading %d (%s)\n", | |
336 | YYFINAL, yychar, yys); | |
337 | } | |
0da4822f | 338 | --- 2310,2314 ---- |
ed6116ce LW |
339 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
340 | if (!yys) yys = "illegal-symbol"; | |
341 | ! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", | |
342 | YYFINAL, yychar, yys); | |
343 | } | |
ed6116ce | 344 | *************** |
0da4822f | 345 | *** 2309,2318 **** |
ed6116ce LW |
346 | #if YYDEBUG |
347 | if (yydebug) | |
348 | ! printf("yydebug: after reduction, shifting from state %d \ | |
349 | ! to state %d\n", *yyssp, yystate); | |
93a17b20 LW |
350 | #endif |
351 | if (yyssp >= yyss + yystacksize - 1) | |
352 | { | |
353 | ! goto yyoverflow; | |
354 | } | |
355 | *++yyssp = yystate; | |
0da4822f | 356 | --- 2325,2349 ---- |
ed6116ce LW |
357 | #if YYDEBUG |
358 | if (yydebug) | |
359 | ! fprintf(stderr, | |
360 | ! "yydebug: after reduction, shifting from state %d to state %d\n", | |
361 | ! *yyssp, yystate); | |
93a17b20 LW |
362 | #endif |
363 | if (yyssp >= yyss + yystacksize - 1) | |
364 | { | |
365 | ! /* | |
366 | ! ** reallocate and recover. Note that pointers | |
367 | ! ** have to be reset, or bad things will happen | |
368 | ! */ | |
369 | ! int yyps_index = (yyssp - yyss); | |
370 | ! int yypv_index = (yyvsp - yyvs); | |
371 | ! yystacksize += YYSTACKSIZE; | |
a0d0e21e LW |
372 | ! ysave->yyvs = yyvs = |
373 | ! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); | |
374 | ! ysave->yyss = yyss = | |
375 | ! (short*)realloc((char*)yyss,yystacksize * sizeof(short)); | |
93a17b20 LW |
376 | ! if (!yyvs || !yyss) |
377 | ! goto yyoverflow; | |
378 | ! yyssp = yyss + yyps_index; | |
379 | ! yyvsp = yyvs + yypv_index; | |
380 | } | |
381 | *++yyssp = yystate; | |
bbce6d69 | 382 | *************** |
0da4822f | 383 | *** 2320,2327 **** |
bbce6d69 | 384 | goto yyloop; |
385 | yyoverflow: | |
386 | ! yyerror("yacc stack overflow"); | |
387 | yyabort: | |
388 | ! return (1); | |
389 | yyaccept: | |
390 | ! return (0); | |
391 | } | |
0da4822f | 392 | --- 2351,2358 ---- |
93a17b20 LW |
393 | goto yyloop; |
394 | yyoverflow: | |
395 | ! yyerror("Out of memory for yacc stack"); | |
396 | yyabort: | |
397 | ! retval = 1; | |
398 | yyaccept: | |
93a17b20 LW |
399 | ! return retval; |
400 | } |