Commit | Line | Data |
de11ba31 |
1 | --- y.tab.c Mon Sep 30 04:20:57 2002 |
2 | +++ perly.c Mon Sep 30 04:18:04 2002 |
c963b151 |
3 | @@ -1,5 +1,5 @@ |
4 | #ifndef lint |
5 | -static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/91"; |
6 | +/* static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/91"; */ |
7 | #endif |
8 | #define YYBYACC 1 |
9 | #line 16 "perly.y" |
10 | @@ -9,7 +9,7 @@ |
11 | #ifdef EBCDIC |
12 | #undef YYDEBUG |
13 | #endif |
14 | -#define dep() deprecate("\"do\" to call subroutines") |
15 | +#define dep() deprecate_old("\"do\" to call subroutines") |
16 | |
17 | /* stuff included here to make perly_c.diff apply better */ |
18 | |
19 | @@ -50,72 +50,9 @@ |
20 | #define yylex yylex_r |
21 | #endif |
22 | |
23 | -#line 54 "y.tab.c" |
24 | -#define WORD 257 |
25 | -#define METHOD 258 |
26 | -#define FUNCMETH 259 |
27 | -#define THING 260 |
28 | -#define PMFUNC 261 |
29 | -#define PRIVATEREF 262 |
30 | -#define FUNC0SUB 263 |
31 | -#define UNIOPSUB 264 |
32 | -#define LSTOPSUB 265 |
33 | -#define LABEL 266 |
34 | -#define FORMAT 267 |
35 | -#define SUB 268 |
36 | -#define ANONSUB 269 |
37 | -#define PACKAGE 270 |
38 | -#define USE 271 |
39 | -#define WHILE 272 |
40 | -#define UNTIL 273 |
41 | -#define IF 274 |
42 | -#define UNLESS 275 |
43 | -#define ELSE 276 |
44 | -#define ELSIF 277 |
45 | -#define CONTINUE 278 |
46 | -#define FOR 279 |
47 | -#define LOOPEX 280 |
48 | -#define DOTDOT 281 |
49 | -#define FUNC0 282 |
50 | -#define FUNC1 283 |
51 | -#define FUNC 284 |
52 | -#define UNIOP 285 |
53 | -#define LSTOP 286 |
54 | -#define RELOP 287 |
55 | -#define EQOP 288 |
56 | -#define MULOP 289 |
57 | -#define ADDOP 290 |
58 | -#define DOLSHARP 291 |
59 | -#define DO 292 |
60 | -#define HASHBRACK 293 |
61 | -#define NOAMP 294 |
62 | -#define LOCAL 295 |
63 | -#define MY 296 |
64 | -#define MYSUB 297 |
65 | -#define COLONATTR 298 |
66 | -#define PREC_LOW 299 |
67 | -#define OROP 300 |
68 | -#define DOROP 301 |
69 | -#define ANDOP 302 |
70 | -#define NOTOP 303 |
71 | -#define ASSIGNOP 304 |
72 | -#define OROR 305 |
73 | -#define DORDOR 306 |
74 | -#define ANDAND 307 |
75 | -#define BITOROP 308 |
76 | -#define BITANDOP 309 |
77 | -#define SHIFTOP 310 |
78 | -#define MATCHOP 311 |
79 | -#define UMINUS 312 |
80 | -#define REFGEN 313 |
81 | -#define POWOP 314 |
82 | -#define PREINC 315 |
83 | -#define PREDEC 316 |
84 | -#define POSTINC 317 |
85 | -#define POSTDEC 318 |
86 | -#define ARROW 319 |
87 | +#line 54 "perly.c" |
88 | #define YYERRCODE 256 |
89 | -short yylhs[] = { -1, |
90 | +static short yylhs[] = { -1, |
91 | 0, 9, 7, 6, 10, 8, 11, 11, 11, 12, |
92 | 12, 12, 12, 25, 25, 25, 25, 25, 25, 25, |
93 | 15, 15, 15, 14, 14, 43, 43, 13, 13, 13, |
94 | @@ -137,7 +74,7 @@ |
de11ba31 |
95 | 49, 49, 34, 34, 35, 35, 35, 44, 24, 19, |
96 | 20, 21, 22, 23, 36, 36, 36, 36, |
c963b151 |
97 | }; |
98 | -short yylen[] = { 2, |
99 | +static short yylen[] = { 2, |
100 | 2, 4, 0, 0, 4, 0, 0, 2, 2, 2, |
101 | 1, 2, 3, 1, 1, 3, 3, 3, 3, 3, |
102 | 0, 2, 6, 7, 7, 0, 2, 8, 8, 10, |
103 | @@ -159,7 +96,7 @@ |
de11ba31 |
104 | 1, 1, 0, 1, 0, 1, 2, 1, 2, 2, |
105 | 2, 2, 2, 2, 1, 1, 1, 1, |
c963b151 |
106 | }; |
107 | -short yydefred[] = { 4, |
108 | +static short yydefred[] = { 4, |
109 | 0, 7, 0, 45, 58, 56, 0, 56, 56, 8, |
110 | 46, 9, 11, 48, 0, 47, 49, 50, 0, 0, |
de11ba31 |
111 | 0, 70, 0, 14, 3, 174, 0, 0, 155, 0, |
c963b151 |
112 | @@ -201,7 +138,7 @@ |
de11ba31 |
113 | 32, 0, 0, 0, 22, 0, 0, 0, 31, 5, |
114 | 0, 30, 0, 0, 33, 0, 23, |
c963b151 |
115 | }; |
116 | -short yydgoto[] = { 1, |
117 | +static short yydgoto[] = { 1, |
de11ba31 |
118 | 10, 11, 20, 103, 19, 2, 94, 373, 97, 362, |
119 | 3, 12, 13, 69, 378, 288, 71, 72, 73, 74, |
120 | 75, 76, 77, 78, 294, 80, 295, 284, 286, 289, |
c963b151 |
121 | @@ -209,7 +146,7 @@ |
de11ba31 |
122 | 195, 330, 155, 292, 274, 226, 14, 82, 136, 83, |
123 | 84, 85, 86, 15, 16, 17, 18, 92, 281, |
c963b151 |
124 | }; |
125 | -short yysindex[] = { 0, |
126 | +static short yysindex[] = { 0, |
de11ba31 |
127 | 0, 0, -236, 0, 0, 0, -231, 0, 0, 0, |
128 | 0, 0, 0, 0, 819, 0, 0, 0, -211, -209, |
129 | 3, 0, -209, 0, 0, 0, -32, -32, 0, 23, |
c963b151 |
130 | @@ -251,7 +188,7 @@ |
de11ba31 |
131 | 0, 1859, -173, 350, 0, 2213, -173, 360, 0, 0, |
132 | 361, 0, 221, 221, 0, -240, 0, |
c963b151 |
133 | }; |
134 | -short yyrindex[] = { 0, |
135 | +static short yyrindex[] = { 0, |
de11ba31 |
136 | 0, 0, 371, 0, 0, 0, 0, 0, 0, 0, |
137 | 0, 0, 0, 0, 0, 0, 0, 0, 289, 0, |
c963b151 |
138 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
139 | @@ -293,7 +230,7 @@ |
de11ba31 |
140 | 0, 435, 90, 880, 0, 0, 90, 0, 0, 0, |
141 | 0, 0, 0, 0, 0, 186, 0, |
c963b151 |
142 | }; |
143 | -short yygindex[] = { 0, |
144 | +static short yygindex[] = { 0, |
de11ba31 |
145 | 0, 0, 50, 453, 0, 0, -22, 0, 63, 153, |
146 | -93, 0, 0, 0, -346, -15, 2480, 0, 1744, 437, |
147 | 439, 0, 0, 0, 481, 755, 0, 0, 341, -186, |
c963b151 |
148 | @@ -302,7 +239,7 @@ |
149 | 0, 0, 0, 0, 0, 0, 0, 0, 0, |
150 | }; |
de11ba31 |
151 | #define YYTABLESIZE 5051 |
152 | -short yytable[] = { 70, |
153 | +static short yytable[] = { 70, |
154 | 198, 300, 75, 64, 60, 280, 228, 60, 279, 64, |
155 | 199, 328, 183, 257, 219, 62, 278, 64, 379, 186, |
156 | 75, 110, 296, 188, 15, 21, 197, 170, 64, 4, |
c963b151 |
157 | @@ -810,7 +747,7 @@ |
de11ba31 |
158 | 0, 0, 0, 0, 114, 114, 114, 0, 114, 114, |
159 | 114, |
c963b151 |
160 | }; |
161 | -short yycheck[] = { 15, |
162 | +static short yycheck[] = { 15, |
de11ba31 |
163 | 94, 44, 41, 36, 59, 41, 41, 123, 44, 36, |
164 | 99, 59, 40, 40, 40, 59, 200, 36, 365, 91, |
165 | 59, 40, 209, 91, 41, 257, 93, 63, 59, 266, |
c963b151 |
166 | @@ -1324,7 +1261,7 @@ |
167 | #endif |
168 | #define YYMAXTOKEN 319 |
169 | #if YYDEBUG |
170 | -char *yyname[] = { |
171 | +static char *yyname[] = { |
172 | "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
173 | "'!'",0,0,"'$'","'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'",0,0,0,0,0,0,0, |
174 | 0,0,0,0,0,"':'","';'",0,0,0,"'?'","'@'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
175 | @@ -1341,7 +1278,7 @@ |
176 | "DORDOR","ANDAND","BITOROP","BITANDOP","SHIFTOP","MATCHOP","UMINUS","REFGEN", |
177 | "POWOP","PREINC","PREDEC","POSTINC","POSTDEC","ARROW", |
178 | }; |
179 | -char *yyrule[] = { |
180 | +static char *yyrule[] = { |
181 | "$accept : prog", |
182 | "prog : progstart lineseq", |
183 | "block : '{' remember lineseq '}'", |
de11ba31 |
184 | @@ -1557,17 +1494,6 @@ |
c963b151 |
185 | #define YYMAXDEPTH 500 |
186 | #endif |
187 | #endif |
188 | -int yydebug; |
189 | -int yynerrs; |
190 | -int yyerrflag; |
191 | -int yychar; |
192 | -short *yyssp; |
193 | -YYSTYPE *yyvsp; |
194 | -YYSTYPE yyval; |
195 | -YYSTYPE yylval; |
196 | -short yyss[YYSTACKSIZE]; |
197 | -YYSTYPE yyvs[YYSTACKSIZE]; |
198 | -#define yystacksize YYSTACKSIZE |
de11ba31 |
199 | #line 795 "perly.y" |
c963b151 |
200 | /* PROGRAM */ |
201 | |
de11ba31 |
202 | @@ -1578,7 +1504,7 @@ |
c963b151 |
203 | #endif |
204 | #define yyparse() Perl_yyparse(pTHX) |
205 | |
de11ba31 |
206 | -#line 1582 "y.tab.c" |
207 | +#line 1582 "perly.c" |
c963b151 |
208 | #define YYABORT goto yyabort |
209 | #define YYACCEPT goto yyaccept |
210 | #define YYERROR goto yyerrlab |
de11ba31 |
211 | @@ -1586,11 +1512,31 @@ |
c963b151 |
212 | yyparse() |
213 | { |
214 | register int yym, yyn, yystate; |
215 | + register short *yyssp; |
216 | + register YYSTYPE *yyvsp; |
217 | + short* yyss; |
218 | + YYSTYPE* yyvs; |
219 | + unsigned yystacksize = YYSTACKSIZE; |
220 | + int retval = 0; |
221 | #if YYDEBUG |
222 | register char *yys; |
223 | - extern char *getenv(); |
224 | +#endif |
225 | + |
226 | + struct ysv *ysave; |
227 | +#ifdef USE_ITHREADS |
228 | + ENTER; /* force yydestruct() before we return */ |
229 | +#endif |
230 | + New(73, ysave, 1, struct ysv); |
231 | + SAVEDESTRUCTOR_X(yydestruct, ysave); |
232 | + ysave->oldyydebug = yydebug; |
233 | + ysave->oldyynerrs = yynerrs; |
234 | + ysave->oldyyerrflag = yyerrflag; |
235 | + ysave->oldyychar = yychar; |
236 | + ysave->oldyyval = yyval; |
237 | + ysave->oldyylval = yylval; |
238 | |
239 | - if (yys = getenv("YYDEBUG")) |
240 | +#if YYDEBUG |
241 | + if ((yys = getenv("YYDEBUG"))) |
242 | { |
243 | yyn = *yys; |
244 | if (yyn >= '0' && yyn <= '9') |
de11ba31 |
245 | @@ -1602,12 +1548,22 @@ |
c963b151 |
246 | yyerrflag = 0; |
247 | yychar = (-1); |
248 | |
249 | + /* |
250 | + ** Initialize private stacks (yyparse may be called from an action) |
251 | + */ |
252 | + New(73, yyss, yystacksize, short); |
253 | + New(73, yyvs, yystacksize, YYSTYPE); |
254 | + ysave->yyss = yyss; |
255 | + ysave->yyvs = yyvs; |
256 | + if (!yyvs || !yyss) |
257 | + goto yyoverflow; |
258 | + |
259 | yyssp = yyss; |
260 | yyvsp = yyvs; |
261 | *yyssp = yystate = 0; |
262 | |
263 | yyloop: |
264 | - if (yyn = yydefred[yystate]) goto yyreduce; |
265 | + if ((yyn = yydefred[yystate])) goto yyreduce; |
266 | if (yychar < 0) |
267 | { |
268 | if ((yychar = yylex()) < 0) yychar = 0; |
de11ba31 |
269 | @@ -1617,7 +1573,7 @@ |
c963b151 |
270 | yys = 0; |
271 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
272 | if (!yys) yys = "illegal-symbol"; |
273 | - printf("yydebug: state %d, reading %d (%s)\n", yystate, |
274 | + PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", yystate, |
275 | yychar, yys); |
276 | } |
277 | #endif |
de11ba31 |
278 | @@ -1627,12 +1583,24 @@ |
c963b151 |
279 | { |
280 | #if YYDEBUG |
281 | if (yydebug) |
282 | - printf("yydebug: state %d, shifting to state %d\n", |
283 | + PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n", |
284 | yystate, yytable[yyn]); |
285 | #endif |
286 | if (yyssp >= yyss + yystacksize - 1) |
287 | { |
288 | + /* |
289 | + ** reallocate and recover. Note that pointers |
290 | + ** have to be reset, or bad things will happen |
291 | + */ |
292 | + int yyps_index = (yyssp - yyss); |
293 | + int yypv_index = (yyvsp - yyvs); |
294 | + yystacksize += YYSTACKSIZE; |
295 | + ysave->yyvs = Renew(yyvs, yystacksize, YYSTYPE); |
296 | + ysave->yyss = Renew(yyss, yystacksize, short); |
297 | + if (!yyvs || !yyss) |
298 | goto yyoverflow; |
299 | + yyssp = yyss + yyps_index; |
300 | + yyvsp = yyvs + yypv_index; |
301 | } |
302 | *++yyssp = yystate = yytable[yyn]; |
303 | *++yyvsp = yylval; |
de11ba31 |
304 | @@ -1648,14 +1616,14 @@ |
c963b151 |
305 | } |
306 | if (yyerrflag) goto yyinrecovery; |
307 | #ifdef lint |
308 | - goto yynewerror; |
309 | + |
310 | #endif |
311 | -yynewerror: |
312 | + |
313 | yyerror("syntax error"); |
314 | #ifdef lint |
315 | - goto yyerrlab; |
316 | + |
317 | #endif |
318 | -yyerrlab: |
319 | + |
320 | ++yynerrs; |
321 | yyinrecovery: |
322 | if (yyerrflag < 3) |
de11ba31 |
323 | @@ -1668,12 +1636,24 @@ |
c963b151 |
324 | { |
325 | #if YYDEBUG |
326 | if (yydebug) |
327 | - printf("yydebug: state %d, error recovery shifting\ |
328 | + PerlIO_printf(Perl_debug_log, "yydebug: state %d, error recovery shifting\ |
329 | to state %d\n", *yyssp, yytable[yyn]); |
330 | #endif |
331 | if (yyssp >= yyss + yystacksize - 1) |
332 | { |
333 | + /* |
334 | + ** reallocate and recover. Note that pointers |
335 | + ** have to be reset, or bad things will happen |
336 | + */ |
337 | + int yyps_index = (yyssp - yyss); |
338 | + int yypv_index = (yyvsp - yyvs); |
339 | + yystacksize += YYSTACKSIZE; |
340 | + ysave->yyvs = Renew(yyvs, yystacksize, YYSTYPE); |
341 | + ysave->yyss = Renew(yyss, yystacksize, short); |
342 | + if (!yyvs || !yyss) |
343 | goto yyoverflow; |
344 | + yyssp = yyss + yyps_index; |
345 | + yyvsp = yyvs + yypv_index; |
346 | } |
347 | *++yyssp = yystate = yytable[yyn]; |
348 | *++yyvsp = yylval; |
de11ba31 |
349 | @@ -1683,7 +1663,7 @@ |
c963b151 |
350 | { |
351 | #if YYDEBUG |
352 | if (yydebug) |
353 | - printf("yydebug: error recovery discarding state %d\n", |
354 | + PerlIO_printf(Perl_debug_log, "yydebug: error recovery discarding state %d\n", |
355 | *yyssp); |
356 | #endif |
357 | if (yyssp <= yyss) goto yyabort; |
de11ba31 |
358 | @@ -1701,7 +1681,7 @@ |
c963b151 |
359 | yys = 0; |
360 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
361 | if (!yys) yys = "illegal-symbol"; |
362 | - printf("yydebug: state %d, error recovery discards token %d (%s)\n", |
363 | + PerlIO_printf(Perl_debug_log, "yydebug: state %d, error recovery discards token %d (%s)\n", |
364 | yystate, yychar, yys); |
365 | } |
366 | #endif |
de11ba31 |
367 | @@ -1711,7 +1691,7 @@ |
c963b151 |
368 | yyreduce: |
369 | #if YYDEBUG |
370 | if (yydebug) |
371 | - printf("yydebug: state %d, reducing by rule %d (%s)\n", |
372 | + PerlIO_printf(Perl_debug_log, "yydebug: state %d, reducing by rule %d (%s)\n", |
373 | yystate, yyn, yyrule[yyn]); |
374 | #endif |
375 | yym = yylen[yyn]; |
de11ba31 |
376 | @@ -2578,7 +2558,7 @@ |
377 | #line 792 "perly.y" |
c963b151 |
378 | { yyval.opval = yyvsp[0].opval; } |
379 | break; |
de11ba31 |
380 | -#line 2582 "y.tab.c" |
381 | +#line 2582 "perly.c" |
c963b151 |
382 | } |
383 | yyssp -= yym; |
384 | yystate = *yyssp; |
de11ba31 |
385 | @@ -2588,7 +2568,7 @@ |
c963b151 |
386 | { |
387 | #if YYDEBUG |
388 | if (yydebug) |
389 | - printf("yydebug: after reduction, shifting from state 0 to\ |
390 | + PerlIO_printf(Perl_debug_log, "yydebug: after reduction, shifting from state 0 to\ |
391 | state %d\n", YYFINAL); |
392 | #endif |
393 | yystate = YYFINAL; |
de11ba31 |
394 | @@ -2603,7 +2583,7 @@ |
c963b151 |
395 | yys = 0; |
396 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
397 | if (!yys) yys = "illegal-symbol"; |
398 | - printf("yydebug: state %d, reading %d (%s)\n", |
399 | + PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", |
400 | YYFINAL, yychar, yys); |
401 | } |
402 | #endif |
de11ba31 |
403 | @@ -2618,20 +2598,50 @@ |
c963b151 |
404 | yystate = yydgoto[yym]; |
405 | #if YYDEBUG |
406 | if (yydebug) |
407 | - printf("yydebug: after reduction, shifting from state %d \ |
408 | + PerlIO_printf(Perl_debug_log, "yydebug: after reduction, shifting from state %d \ |
409 | to state %d\n", *yyssp, yystate); |
410 | #endif |
411 | if (yyssp >= yyss + yystacksize - 1) |
412 | { |
413 | + /* |
414 | + ** reallocate and recover. Note that pointers |
415 | + ** have to be reset, or bad things will happen |
416 | + */ |
417 | + int yyps_index = (yyssp - yyss); |
418 | + int yypv_index = (yyvsp - yyvs); |
419 | + yystacksize += YYSTACKSIZE; |
420 | + ysave->yyvs = Renew(yyvs, yystacksize, YYSTYPE); |
421 | + ysave->yyss = Renew(yyss, yystacksize, short); |
422 | + if (!yyvs || !yyss) |
423 | goto yyoverflow; |
424 | + yyssp = yyss + yyps_index; |
425 | + yyvsp = yyvs + yypv_index; |
426 | } |
427 | *++yyssp = yystate; |
428 | *++yyvsp = yyval; |
429 | goto yyloop; |
430 | yyoverflow: |
431 | - yyerror("yacc stack overflow"); |
432 | + yyerror("Out of memory for yacc stack"); |
433 | yyabort: |
434 | - return (1); |
435 | + retval = 1; |
436 | yyaccept: |
437 | - return (0); |
438 | +#ifdef USE_ITHREADS |
439 | + LEAVE; /* force yydestruct() before we return */ |
440 | +#endif |
441 | + return retval; |
442 | +} |
443 | + |
444 | +static void |
445 | +yydestruct(pTHX_ void *ptr) |
446 | +{ |
447 | + struct ysv* ysave = (struct ysv*)ptr; |
448 | + if (ysave->yyss) Safefree(ysave->yyss); |
449 | + if (ysave->yyvs) Safefree(ysave->yyvs); |
450 | + yydebug = ysave->oldyydebug; |
451 | + yynerrs = ysave->oldyynerrs; |
452 | + yyerrflag = ysave->oldyyerrflag; |
453 | + yychar = ysave->oldyychar; |
454 | + yyval = ysave->oldyyval; |
455 | + yylval = ysave->oldyylval; |
456 | + Safefree(ysave); |
457 | } |