yfix fix for VMS (was YYDEBUG etc.)
[p5sagit/p5-mst-13.2.git] / perly_c.diff
CommitLineData
2ac72d6e 1*** perly.c.orig Tue Mar 26 01:38:52 2002
2--- perly.c Tue Mar 26 01:38:54 2002
0ddaf513 3***************
4*** 1,5 ****
5 #ifndef lint
6! static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/91";
7 #endif
8 #define YYBYACC 1
9 #line 16 "perly.y"
10--- 1,5 ----
11 #ifndef lint
12! /* static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/91"; */
13 #endif
14 #define YYBYACC 1
15 #line 16 "perly.y"
16***************
17*** 9,15 ****
2ac72d6e 18 #ifdef EBCDIC
0ddaf513 19 #undef YYDEBUG
20 #endif
21! #define dep() deprecate("\"do\" to call subroutines")
22
23 /* stuff included here to make perly_c.diff apply better */
24
25--- 9,15 ----
2ac72d6e 26 #ifdef EBCDIC
0ddaf513 27 #undef YYDEBUG
28 #endif
29! #define dep() deprecate_old("\"do\" to call subroutines")
30
31 /* stuff included here to make perly_c.diff apply better */
32
33***************
34*** 50,119 ****
35 #define yylex yylex_r
36 #endif
37
38! #line 54 "y.tab.c"
39! #define WORD 257
40! #define METHOD 258
41! #define FUNCMETH 259
42! #define THING 260
43! #define PMFUNC 261
44! #define PRIVATEREF 262
45! #define FUNC0SUB 263
46! #define UNIOPSUB 264
47! #define LSTOPSUB 265
48! #define LABEL 266
49! #define FORMAT 267
50! #define SUB 268
51! #define ANONSUB 269
52! #define PACKAGE 270
53! #define USE 271
54! #define WHILE 272
55! #define UNTIL 273
56! #define IF 274
57! #define UNLESS 275
58! #define ELSE 276
59! #define ELSIF 277
60! #define CONTINUE 278
61! #define FOR 279
62! #define LOOPEX 280
63! #define DOTDOT 281
64! #define FUNC0 282
65! #define FUNC1 283
66! #define FUNC 284
67! #define UNIOP 285
68! #define LSTOP 286
69! #define RELOP 287
70! #define EQOP 288
71! #define MULOP 289
72! #define ADDOP 290
73! #define DOLSHARP 291
74! #define DO 292
75! #define HASHBRACK 293
76! #define NOAMP 294
77! #define LOCAL 295
78! #define MY 296
79! #define MYSUB 297
80! #define COLONATTR 298
81! #define PREC_LOW 299
82! #define OROP 300
83! #define ANDOP 301
84! #define NOTOP 302
85! #define ASSIGNOP 303
86! #define OROR 304
87! #define ANDAND 305
88! #define BITOROP 306
89! #define BITANDOP 307
90! #define SHIFTOP 308
91! #define MATCHOP 309
92! #define UMINUS 310
93! #define REFGEN 311
94! #define POWOP 312
95! #define PREINC 313
96! #define PREDEC 314
97! #define POSTINC 315
98! #define POSTDEC 316
99! #define ARROW 317
100 #define YYERRCODE 256
101! short yylhs[] = { -1,
102 0, 9, 7, 6, 10, 8, 11, 11, 11, 12,
103 12, 12, 12, 25, 25, 25, 25, 25, 25, 25,
104 15, 15, 15, 14, 14, 43, 43, 13, 13, 13,
105--- 50,58 ----
106 #define yylex yylex_r
107 #endif
108
109! #line 54 "perly.c"
110 #define YYERRCODE 256
111! static short yylhs[] = { -1,
112 0, 9, 7, 6, 10, 8, 11, 11, 11, 12,
113 12, 12, 12, 25, 25, 25, 25, 25, 25, 25,
114 15, 15, 15, 14, 14, 43, 43, 13, 13, 13,
115***************
116*** 135,141 ****
117 49, 34, 34, 35, 35, 35, 44, 24, 19, 20,
118 21, 22, 23, 36, 36, 36, 36,
119 };
120! short yylen[] = { 2,
121 2, 4, 0, 0, 4, 0, 0, 2, 2, 2,
122 1, 2, 3, 1, 1, 3, 3, 3, 3, 3,
123 0, 2, 6, 7, 7, 0, 2, 8, 8, 10,
124--- 74,80 ----
125 49, 34, 34, 35, 35, 35, 44, 24, 19, 20,
126 21, 22, 23, 36, 36, 36, 36,
127 };
128! static short yylen[] = { 2,
129 2, 4, 0, 0, 4, 0, 0, 2, 2, 2,
130 1, 2, 3, 1, 1, 3, 3, 3, 3, 3,
131 0, 2, 6, 7, 7, 0, 2, 8, 8, 10,
132***************
133*** 157,163 ****
134 1, 0, 1, 0, 1, 2, 1, 2, 2, 2,
135 2, 2, 2, 1, 1, 1, 1,
136 };
137! short yydefred[] = { 4,
138 0, 7, 0, 45, 58, 56, 0, 56, 56, 8,
139 46, 9, 11, 48, 0, 47, 49, 50, 0, 0,
140 0, 70, 71, 0, 14, 3, 173, 0, 0, 154,
141--- 96,102 ----
142 1, 0, 1, 0, 1, 2, 1, 2, 2, 2,
143 2, 2, 2, 1, 1, 1, 1,
144 };
145! static short yydefred[] = { 4,
146 0, 7, 0, 45, 58, 56, 0, 56, 56, 8,
147 46, 9, 11, 48, 0, 47, 49, 50, 0, 0,
148 0, 70, 71, 0, 14, 3, 173, 0, 0, 154,
149***************
150*** 199,205 ****
151 0, 22, 0, 0, 0, 31, 5, 0, 30, 0,
152 0, 33, 0, 23,
153 };
154! short yydgoto[] = { 1,
155 10, 11, 20, 104, 19, 2, 95, 370, 98, 359,
156 3, 12, 13, 70, 375, 285, 72, 73, 74, 75,
157 76, 77, 78, 79, 291, 81, 292, 281, 283, 286,
158--- 138,144 ----
159 0, 22, 0, 0, 0, 31, 5, 0, 30, 0,
160 0, 33, 0, 23,
161 };
162! static short yydgoto[] = { 1,
163 10, 11, 20, 104, 19, 2, 95, 370, 98, 359,
164 3, 12, 13, 70, 375, 285, 72, 73, 74, 75,
165 76, 77, 78, 79, 291, 81, 292, 281, 283, 286,
166***************
167*** 207,213 ****
168 194, 327, 156, 289, 271, 225, 14, 83, 137, 84,
169 85, 86, 87, 15, 16, 17, 18, 93, 278,
170 };
171! short yysindex[] = { 0,
172 0, 0, -132, 0, 0, 0, -51, 0, 0, 0,
173 0, 0, 0, 0, 650, 0, 0, 0, -239, -215,
174 5, 0, 0, -215, 0, 0, 0, -31, -31, 0,
175--- 146,152 ----
176 194, 327, 156, 289, 271, 225, 14, 83, 137, 84,
177 85, 86, 87, 15, 16, 17, 18, 93, 278,
178 };
179! static short yysindex[] = { 0,
180 0, 0, -132, 0, 0, 0, -51, 0, 0, 0,
181 0, 0, 0, 0, 650, 0, 0, 0, -239, -215,
182 5, 0, 0, -215, 0, 0, 0, -31, -31, 0,
183***************
184*** 249,255 ****
185 449, 0, 2181, -150, 340, 0, 0, 355, 0, 216,
186 216, 0, -123, 0,
187 };
188! short yyrindex[] = { 0,
189 0, 0, 247, 0, 0, 0, 0, 0, 0, 0,
190 0, 0, 0, 0, 0, 0, 0, 0, 274, 0,
191 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
192--- 188,194 ----
193 449, 0, 2181, -150, 340, 0, 0, 355, 0, 216,
194 216, 0, -123, 0,
195 };
196! static short yyrindex[] = { 0,
197 0, 0, 247, 0, 0, 0, 0, 0, 0, 0,
198 0, 0, 0, 0, 0, 0, 0, 0, 274, 0,
199 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
200***************
201*** 291,297 ****
202 917, 0, 0, 119, 0, 0, 0, 0, 0, 0,
203 0, 0, 179, 0,
204 };
205! short yygindex[] = { 0,
206 0, 0, 196, 425, 0, 0, -2, 0, 37, 634,
207 -94, 0, 0, 0, -323, -15, 2445, 0, 999, 414,
208 417, 0, 0, 0, 463, -43, 0, 0, 321, -198,
209--- 230,236 ----
210 917, 0, 0, 119, 0, 0, 0, 0, 0, 0,
211 0, 0, 179, 0,
212 };
213! static short yygindex[] = { 0,
214 0, 0, 196, 425, 0, 0, -2, 0, 37, 634,
215 -94, 0, 0, 0, -323, -15, 2445, 0, 999, 414,
216 417, 0, 0, 0, 463, -43, 0, 0, 321, -198,
217***************
218*** 300,306 ****
219 0, 0, 0, 0, 0, 0, 0, 0, 0,
220 };
221 #define YYTABLESIZE 4568
222! short yytable[] = { 71,
223 197, 65, 121, 227, 65, 111, 220, 22, 198, 293,
224 139, 296, 315, 275, 305, 102, 273, 88, 113, 228,
225 60, 113, 279, 65, 317, 60, 182, 254, 325, 101,
226--- 239,245 ----
227 0, 0, 0, 0, 0, 0, 0, 0, 0,
228 };
229 #define YYTABLESIZE 4568
230! static short yytable[] = { 71,
231 197, 65, 121, 227, 65, 111, 220, 22, 198, 293,
232 139, 296, 315, 275, 305, 102, 273, 88, 113, 228,
233 60, 113, 279, 65, 317, 60, 182, 254, 325, 101,
234***************
235*** 759,765 ****
236 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
237 0, 0, 0, 0, 0, 0, 77, 77,
238 };
239! short yycheck[] = { 15,
240 95, 36, 46, 41, 36, 40, 59, 59, 100, 208,
241 54, 41, 59, 199, 41, 40, 196, 257, 41, 93,
242 123, 44, 202, 36, 93, 59, 40, 40, 59, 29,
243--- 698,704 ----
244 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
245 0, 0, 0, 0, 0, 0, 77, 77,
246 };
247! static short yycheck[] = { 15,
248 95, 36, 46, 41, 36, 40, 59, 59, 100, 208,
249 54, 41, 59, 199, 41, 40, 196, 257, 41, 93,
250 123, 44, 202, 36, 93, 59, 40, 40, 59, 29,
251***************
252*** 1224,1230 ****
253 #endif
254 #define YYMAXTOKEN 317
255 #if YYDEBUG
256! char *yyname[] = {
257 "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,
258 "'!'",0,0,"'$'","'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'",0,0,0,0,0,0,0,
259 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,
260--- 1163,1169 ----
261 #endif
262 #define YYMAXTOKEN 317
263 #if YYDEBUG
264! static char *yyname[] = {
265 "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,
266 "'!'",0,0,"'$'","'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'",0,0,0,0,0,0,0,
267 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,
268***************
269*** 1241,1247 ****
270 "ANDAND","BITOROP","BITANDOP","SHIFTOP","MATCHOP","UMINUS","REFGEN","POWOP",
271 "PREINC","PREDEC","POSTINC","POSTDEC","ARROW",
272 };
273! char *yyrule[] = {
274 "$accept : prog",
275 "prog : progstart lineseq",
276 "block : '{' remember lineseq '}'",
277--- 1180,1186 ----
278 "ANDAND","BITOROP","BITANDOP","SHIFTOP","MATCHOP","UMINUS","REFGEN","POWOP",
279 "PREINC","PREDEC","POSTINC","POSTDEC","ARROW",
280 };
281! static char *yyrule[] = {
282 "$accept : prog",
283 "prog : progstart lineseq",
284 "block : '{' remember lineseq '}'",
285***************
286*** 1456,1472 ****
287 #define YYMAXDEPTH 500
288 #endif
289 #endif
290- int yydebug;
291- int yynerrs;
292- int yyerrflag;
293- int yychar;
294- short *yyssp;
295- YYSTYPE *yyvsp;
296- YYSTYPE yyval;
297- YYSTYPE yylval;
298- short yyss[YYSTACKSIZE];
299- YYSTYPE yyvs[YYSTACKSIZE];
300- #define yystacksize YYSTACKSIZE
301 #line 793 "perly.y"
302 /* PROGRAM */
303
304--- 1395,1400 ----
305***************
306*** 1477,1483 ****
307 #endif
308 #define yyparse() Perl_yyparse(pTHX)
309
310! #line 1481 "y.tab.c"
311 #define YYABORT goto yyabort
312 #define YYACCEPT goto yyaccept
313 #define YYERROR goto yyerrlab
314--- 1405,1411 ----
315 #endif
316 #define yyparse() Perl_yyparse(pTHX)
317
318! #line 1409 "perly.c"
319 #define YYABORT goto yyabort
320 #define YYACCEPT goto yyaccept
321 #define YYERROR goto yyerrlab
322***************
323*** 1485,1495 ****
324 yyparse()
325 {
326 register int yym, yyn, yystate;
327 #if YYDEBUG
328 register char *yys;
329! extern char *getenv();
330
331! if (yys = getenv("YYDEBUG"))
332 {
333 yyn = *yys;
334 if (yyn >= '0' && yyn <= '9')
335--- 1413,1443 ----
336 yyparse()
337 {
338 register int yym, yyn, yystate;
339+ register short *yyssp;
340+ register YYSTYPE *yyvsp;
341+ short* yyss;
342+ YYSTYPE* yyvs;
343+ unsigned yystacksize = YYSTACKSIZE;
344+ int retval = 0;
345 #if YYDEBUG
346 register char *yys;
347! #endif
348
349! struct ysv *ysave;
350! #ifdef USE_ITHREADS
351! ENTER; /* force yydestruct() before we return */
352! #endif
353! New(73, ysave, 1, struct ysv);
354! SAVEDESTRUCTOR_X(yydestruct, ysave);
355! ysave->oldyydebug = yydebug;
356! ysave->oldyynerrs = yynerrs;
357! ysave->oldyyerrflag = yyerrflag;
358! ysave->oldyychar = yychar;
359! ysave->oldyyval = yyval;
360! ysave->oldyylval = yylval;
361!
362! #if YYDEBUG
363! if ((yys = getenv("YYDEBUG")))
364 {
365 yyn = *yys;
366 if (yyn >= '0' && yyn <= '9')
367***************
368*** 1501,1512 ****
369 yyerrflag = 0;
370 yychar = (-1);
371
372 yyssp = yyss;
373 yyvsp = yyvs;
374 *yyssp = yystate = 0;
375
376 yyloop:
377! if (yyn = yydefred[yystate]) goto yyreduce;
378 if (yychar < 0)
379 {
380 if ((yychar = yylex()) < 0) yychar = 0;
381--- 1449,1470 ----
382 yyerrflag = 0;
383 yychar = (-1);
384
385+ /*
386+ ** Initialize private stacks (yyparse may be called from an action)
387+ */
388+ New(73, yyss, yystacksize, short);
389+ New(73, yyvs, yystacksize, YYSTYPE);
390+ ysave->yyss = yyss;
391+ ysave->yyvs = yyvs;
392+ if (!yyvs || !yyss)
393+ goto yyoverflow;
394+
395 yyssp = yyss;
396 yyvsp = yyvs;
397 *yyssp = yystate = 0;
398
399 yyloop:
400! if ((yyn = yydefred[yystate])) goto yyreduce;
401 if (yychar < 0)
402 {
403 if ((yychar = yylex()) < 0) yychar = 0;
404***************
405*** 1516,1522 ****
406 yys = 0;
407 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
408 if (!yys) yys = "illegal-symbol";
409! printf("yydebug: state %d, reading %d (%s)\n", yystate,
410 yychar, yys);
411 }
412 #endif
413--- 1474,1480 ----
414 yys = 0;
415 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
416 if (!yys) yys = "illegal-symbol";
417! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", yystate,
418 yychar, yys);
419 }
420 #endif
421***************
422*** 1526,1537 ****
423 {
424 #if YYDEBUG
425 if (yydebug)
426! printf("yydebug: state %d, shifting to state %d\n",
427 yystate, yytable[yyn]);
428 #endif
429 if (yyssp >= yyss + yystacksize - 1)
430 {
431 goto yyoverflow;
432 }
433 *++yyssp = yystate = yytable[yyn];
434 *++yyvsp = yylval;
435--- 1484,1507 ----
436 {
437 #if YYDEBUG
438 if (yydebug)
439! PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n",
440 yystate, yytable[yyn]);
441 #endif
442 if (yyssp >= yyss + yystacksize - 1)
443 {
444+ /*
445+ ** reallocate and recover. Note that pointers
446+ ** have to be reset, or bad things will happen
447+ */
448+ int yyps_index = (yyssp - yyss);
449+ int yypv_index = (yyvsp - yyvs);
450+ yystacksize += YYSTACKSIZE;
451+ ysave->yyvs = Renew(yyvs, yystacksize, YYSTYPE);
452+ ysave->yyss = Renew(yyss, yystacksize, short);
453+ if (!yyvs || !yyss)
454 goto yyoverflow;
455+ yyssp = yyss + yyps_index;
456+ yyvsp = yyvs + yypv_index;
457 }
458 *++yyssp = yystate = yytable[yyn];
459 *++yyvsp = yylval;
460***************
461*** 1547,1560 ****
462 }
463 if (yyerrflag) goto yyinrecovery;
464 #ifdef lint
465! goto yynewerror;
466 #endif
467! yynewerror:
468 yyerror("syntax error");
469 #ifdef lint
470! goto yyerrlab;
471 #endif
472! yyerrlab:
473 ++yynerrs;
474 yyinrecovery:
475 if (yyerrflag < 3)
476--- 1517,1530 ----
477 }
478 if (yyerrflag) goto yyinrecovery;
479 #ifdef lint
480!
481 #endif
482!
483 yyerror("syntax error");
484 #ifdef lint
485!
486 #endif
487!
488 ++yynerrs;
489 yyinrecovery:
490 if (yyerrflag < 3)
491***************
492*** 1567,1578 ****
493 {
494 #if YYDEBUG
495 if (yydebug)
496! printf("yydebug: state %d, error recovery shifting\
497 to state %d\n", *yyssp, yytable[yyn]);
498 #endif
499 if (yyssp >= yyss + yystacksize - 1)
500 {
501 goto yyoverflow;
502 }
503 *++yyssp = yystate = yytable[yyn];
504 *++yyvsp = yylval;
505--- 1537,1560 ----
506 {
507 #if YYDEBUG
508 if (yydebug)
509! PerlIO_printf(Perl_debug_log, "yydebug: state %d, error recovery shifting\
510 to state %d\n", *yyssp, yytable[yyn]);
511 #endif
512 if (yyssp >= yyss + yystacksize - 1)
513 {
514+ /*
515+ ** reallocate and recover. Note that pointers
516+ ** have to be reset, or bad things will happen
517+ */
518+ int yyps_index = (yyssp - yyss);
519+ int yypv_index = (yyvsp - yyvs);
520+ yystacksize += YYSTACKSIZE;
521+ ysave->yyvs = Renew(yyvs, yystacksize, YYSTYPE);
522+ ysave->yyss = Renew(yyss, yystacksize, short);
523+ if (!yyvs || !yyss)
524 goto yyoverflow;
525+ yyssp = yyss + yyps_index;
526+ yyvsp = yyvs + yypv_index;
527 }
528 *++yyssp = yystate = yytable[yyn];
529 *++yyvsp = yylval;
530***************
531*** 1582,1588 ****
532 {
533 #if YYDEBUG
534 if (yydebug)
535! printf("yydebug: error recovery discarding state %d\n",
536 *yyssp);
537 #endif
538 if (yyssp <= yyss) goto yyabort;
539--- 1564,1570 ----
540 {
541 #if YYDEBUG
542 if (yydebug)
543! PerlIO_printf(Perl_debug_log, "yydebug: error recovery discarding state %d\n",
544 *yyssp);
545 #endif
546 if (yyssp <= yyss) goto yyabort;
547***************
548*** 1600,1606 ****
549 yys = 0;
550 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
551 if (!yys) yys = "illegal-symbol";
552! printf("yydebug: state %d, error recovery discards token %d (%s)\n",
553 yystate, yychar, yys);
554 }
555 #endif
556--- 1582,1588 ----
557 yys = 0;
558 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
559 if (!yys) yys = "illegal-symbol";
560! PerlIO_printf(Perl_debug_log, "yydebug: state %d, error recovery discards token %d (%s)\n",
561 yystate, yychar, yys);
562 }
563 #endif
564***************
565*** 1610,1616 ****
566 yyreduce:
567 #if YYDEBUG
568 if (yydebug)
569! printf("yydebug: state %d, reducing by rule %d (%s)\n",
570 yystate, yyn, yyrule[yyn]);
571 #endif
572 yym = yylen[yyn];
573--- 1592,1598 ----
574 yyreduce:
575 #if YYDEBUG
576 if (yydebug)
577! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reducing by rule %d (%s)\n",
578 yystate, yyn, yyrule[yyn]);
579 #endif
580 yym = yylen[yyn];
581***************
582*** 2473,2479 ****
583 #line 790 "perly.y"
584 { yyval.opval = yyvsp[0].opval; }
585 break;
586! #line 2477 "y.tab.c"
587 }
588 yyssp -= yym;
589 yystate = *yyssp;
590--- 2455,2461 ----
591 #line 790 "perly.y"
592 { yyval.opval = yyvsp[0].opval; }
593 break;
594! #line 2459 "perly.c"
595 }
596 yyssp -= yym;
597 yystate = *yyssp;
598***************
599*** 2483,2489 ****
600 {
601 #if YYDEBUG
602 if (yydebug)
603! printf("yydebug: after reduction, shifting from state 0 to\
604 state %d\n", YYFINAL);
605 #endif
606 yystate = YYFINAL;
607--- 2465,2471 ----
608 {
609 #if YYDEBUG
610 if (yydebug)
611! PerlIO_printf(Perl_debug_log, "yydebug: after reduction, shifting from state 0 to\
612 state %d\n", YYFINAL);
613 #endif
614 yystate = YYFINAL;
615***************
616*** 2498,2504 ****
617 yys = 0;
618 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
619 if (!yys) yys = "illegal-symbol";
620! printf("yydebug: state %d, reading %d (%s)\n",
621 YYFINAL, yychar, yys);
622 }
623 #endif
624--- 2480,2486 ----
625 yys = 0;
626 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
627 if (!yys) yys = "illegal-symbol";
628! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n",
629 YYFINAL, yychar, yys);
630 }
631 #endif
632***************
633*** 2513,2532 ****
634 yystate = yydgoto[yym];
635 #if YYDEBUG
636 if (yydebug)
637! printf("yydebug: after reduction, shifting from state %d \
638 to state %d\n", *yyssp, yystate);
639 #endif
640 if (yyssp >= yyss + yystacksize - 1)
641 {
642 goto yyoverflow;
643 }
644 *++yyssp = yystate;
645 *++yyvsp = yyval;
646 goto yyloop;
647 yyoverflow:
648! yyerror("yacc stack overflow");
649 yyabort:
650! return (1);
651 yyaccept:
652! return (0);
653 }
654--- 2495,2544 ----
655 yystate = yydgoto[yym];
656 #if YYDEBUG
657 if (yydebug)
658! PerlIO_printf(Perl_debug_log, "yydebug: after reduction, shifting from state %d \
659 to state %d\n", *yyssp, yystate);
660 #endif
661 if (yyssp >= yyss + yystacksize - 1)
662 {
663+ /*
664+ ** reallocate and recover. Note that pointers
665+ ** have to be reset, or bad things will happen
666+ */
667+ int yyps_index = (yyssp - yyss);
668+ int yypv_index = (yyvsp - yyvs);
669+ yystacksize += YYSTACKSIZE;
670+ ysave->yyvs = Renew(yyvs, yystacksize, YYSTYPE);
671+ ysave->yyss = Renew(yyss, yystacksize, short);
672+ if (!yyvs || !yyss)
673 goto yyoverflow;
674+ yyssp = yyss + yyps_index;
675+ yyvsp = yyvs + yypv_index;
676 }
677 *++yyssp = yystate;
678 *++yyvsp = yyval;
679 goto yyloop;
680 yyoverflow:
681! yyerror("Out of memory for yacc stack");
682 yyabort:
683! retval = 1;
684 yyaccept:
685! #ifdef USE_ITHREADS
686! LEAVE; /* force yydestruct() before we return */
687! #endif
688! return retval;
689! }
690!
691! static void
692! yydestruct(pTHX_ void *ptr)
693! {
694! struct ysv* ysave = (struct ysv*)ptr;
695! if (ysave->yyss) Safefree(ysave->yyss);
696! if (ysave->yyvs) Safefree(ysave->yyvs);
697! yydebug = ysave->oldyydebug;
698! yynerrs = ysave->oldyynerrs;
699! yyerrflag = ysave->oldyyerrflag;
700! yychar = ysave->oldyychar;
701! yyval = ysave->oldyyval;
702! yylval = ysave->oldyylval;
703! Safefree(ysave);
704 }