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