This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[inseparable changes from patch from perl5.003_16 to perl5.003_17]
[perl5.git] / perly.c.diff
CommitLineData
5f05dabc 1Index: 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***************
71be2cbc 81*** 1296,1306 ****
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
71be2cbc 91 #line 602 "perly.y"
93a17b20 92 /* PROGRAM */
71be2cbc 93--- 1231,1236 ----
bbce6d69 94***************
71be2cbc 95*** 1309,1320 ****
96--- 1239,1295 ----
a0d0e21e
LW
97 #define YYACCEPT goto yyaccept
98 #define YYERROR goto yyerrlab
99+
100+ struct ysv {
101+ short* yyss;
102+ YYSTYPE* yyvs;
103+ int oldyydebug;
104+ int oldyynerrs;
105+ int oldyyerrflag;
106+ int oldyychar;
107+ YYSTYPE oldyyval;
108+ YYSTYPE oldyylval;
109+ };
110+
111+ void
112+ yydestruct(ptr)
113+ void* ptr;
114+ {
115+ struct ysv* ysave = (struct ysv*)ptr;
489bbe73 116+ if (ysave->yyss) Safefree(ysave->yyss);
117+ if (ysave->yyvs) Safefree(ysave->yyvs);
a0d0e21e
LW
118+ yydebug = ysave->oldyydebug;
119+ yynerrs = ysave->oldyynerrs;
120+ yyerrflag = ysave->oldyyerrflag;
121+ yychar = ysave->oldyychar;
122+ yyval = ysave->oldyyval;
123+ yylval = ysave->oldyylval;
489bbe73 124+ Safefree(ysave);
a0d0e21e
LW
125+ }
126+
127 int
93a17b20
LW
128 yyparse()
129 {
130 register int yym, yyn, yystate;
131+ register short *yyssp;
132+ register YYSTYPE *yyvsp;
133+ short* yyss;
134+ YYSTYPE* yyvs;
135+ unsigned yystacksize = YYSTACKSIZE;
93a17b20 136+ int retval = 0;
93a17b20
LW
137 #if YYDEBUG
138 register char *yys;
139 extern char *getenv();
a0d0e21e 140+ #endif
55497cff 141+
a0d0e21e
LW
142+ struct ysv *ysave = (struct ysv*)safemalloc(sizeof(struct ysv));
143+ SAVEDESTRUCTOR(yydestruct, ysave);
144+ ysave->oldyydebug = yydebug;
145+ ysave->oldyynerrs = yynerrs;
146+ ysave->oldyyerrflag = yyerrflag;
147+ ysave->oldyychar = yychar;
148+ ysave->oldyyval = yyval;
149+ ysave->oldyylval = yylval;
55497cff 150
a0d0e21e
LW
151+ #if YYDEBUG
152 if (yys = getenv("YYDEBUG"))
153 {
93a17b20 154***************
71be2cbc 155*** 1329,1332 ****
156--- 1304,1315 ----
93a17b20
LW
157 yychar = (-1);
158
159+ /*
160+ ** Initialize private stacks (yyparse may be called from an action)
161+ */
a0d0e21e
LW
162+ ysave->yyss = yyss = (short*)safemalloc(yystacksize*sizeof(short));
163+ ysave->yyvs = yyvs = (YYSTYPE*)safemalloc(yystacksize*sizeof(YYSTYPE));
93a17b20
LW
164+ if (!yyvs || !yyss)
165+ goto yyoverflow;
166+
167 yyssp = yyss;
168 yyvsp = yyvs;
93a17b20 169***************
71be2cbc 170*** 1344,1348 ****
ed6116ce
LW
171 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
172 if (!yys) yys = "illegal-symbol";
173! printf("yydebug: state %d, reading %d (%s)\n", yystate,
174 yychar, yys);
175 }
71be2cbc 176--- 1327,1331 ----
ed6116ce
LW
177 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
178 if (!yys) yys = "illegal-symbol";
179! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate,
180 yychar, yys);
181 }
ed6116ce 182***************
71be2cbc 183*** 1354,1363 ****
ed6116ce
LW
184 #if YYDEBUG
185 if (yydebug)
186! printf("yydebug: state %d, shifting to state %d\n",
187 yystate, yytable[yyn]);
93a17b20
LW
188 #endif
189 if (yyssp >= yyss + yystacksize - 1)
190 {
191! goto yyoverflow;
192 }
193 *++yyssp = yystate = yytable[yyn];
71be2cbc 194--- 1337,1360 ----
ed6116ce
LW
195 #if YYDEBUG
196 if (yydebug)
197! fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
198 yystate, yytable[yyn]);
93a17b20
LW
199 #endif
200 if (yyssp >= yyss + yystacksize - 1)
201 {
202! /*
203! ** reallocate and recover. Note that pointers
204! ** have to be reset, or bad things will happen
205! */
206! int yyps_index = (yyssp - yyss);
207! int yypv_index = (yyvsp - yyvs);
208! yystacksize += YYSTACKSIZE;
a0d0e21e
LW
209! ysave->yyvs = yyvs =
210! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
211! ysave->yyss = yyss =
212! (short*)realloc((char*)yyss,yystacksize * sizeof(short));
93a17b20
LW
213! if (!yyvs || !yyss)
214! goto yyoverflow;
215! yyssp = yyss + yyps_index;
216! yyvsp = yyvs + yypv_index;
217 }
218 *++yyssp = yystate = yytable[yyn];
93a17b20 219***************
71be2cbc 220*** 1395,1404 ****
ed6116ce
LW
221 #if YYDEBUG
222 if (yydebug)
223! printf("yydebug: state %d, error recovery shifting\
224! to state %d\n", *yyssp, yytable[yyn]);
93a17b20
LW
225 #endif
226 if (yyssp >= yyss + yystacksize - 1)
227 {
228! goto yyoverflow;
229 }
230 *++yyssp = yystate = yytable[yyn];
71be2cbc 231--- 1392,1416 ----
ed6116ce
LW
232 #if YYDEBUG
233 if (yydebug)
234! fprintf(stderr,
235! "yydebug: state %d, error recovery shifting to state %d\n",
236! *yyssp, yytable[yyn]);
93a17b20
LW
237 #endif
238 if (yyssp >= yyss + yystacksize - 1)
239 {
240! /*
241! ** reallocate and recover. Note that pointers
242! ** have to be reset, or bad things will happen
243! */
244! int yyps_index = (yyssp - yyss);
245! int yypv_index = (yyvsp - yyvs);
246! yystacksize += YYSTACKSIZE;
a0d0e21e 247! ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs,
93a17b20 248! yystacksize * sizeof(YYSTYPE));
a0d0e21e 249! ysave->yyss = yyss = (short*)realloc((char*)yyss,
93a17b20
LW
250! yystacksize * sizeof(short));
251! if (!yyvs || !yyss)
252! goto yyoverflow;
253! yyssp = yyss + yyps_index;
254! yyvsp = yyvs + yypv_index;
255 }
256 *++yyssp = yystate = yytable[yyn];
93a17b20 257***************
71be2cbc 258*** 1410,1415 ****
ed6116ce
LW
259 #if YYDEBUG
260 if (yydebug)
261! printf("yydebug: error recovery discarding state %d\n",
262! *yyssp);
263 #endif
264 if (yyssp <= yyss) goto yyabort;
71be2cbc 265--- 1422,1428 ----
ed6116ce
LW
266 #if YYDEBUG
267 if (yydebug)
268! fprintf(stderr,
269! "yydebug: error recovery discarding state %d\n",
270! *yyssp);
271 #endif
272 if (yyssp <= yyss) goto yyabort;
ed6116ce 273***************
71be2cbc 274*** 1428,1433 ****
ed6116ce
LW
275 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
276 if (!yys) yys = "illegal-symbol";
277! printf("yydebug: state %d, error recovery discards token %d (%s)\n",
278! yystate, yychar, yys);
279 }
280 #endif
71be2cbc 281--- 1441,1447 ----
ed6116ce
LW
282 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
283 if (!yys) yys = "illegal-symbol";
284! fprintf(stderr,
285! "yydebug: state %d, error recovery discards token %d (%s)\n",
286! yystate, yychar, yys);
287 }
288 #endif
ed6116ce 289***************
71be2cbc 290*** 1438,1442 ****
ed6116ce
LW
291 #if YYDEBUG
292 if (yydebug)
293! printf("yydebug: state %d, reducing by rule %d (%s)\n",
294 yystate, yyn, yyrule[yyn]);
295 #endif
71be2cbc 296--- 1452,1456 ----
ed6116ce
LW
297 #if YYDEBUG
298 if (yydebug)
299! fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n",
300 yystate, yyn, yyrule[yyn]);
301 #endif
ed6116ce 302***************
71be2cbc 303*** 2185,2190 ****
ed6116ce
LW
304 #if YYDEBUG
305 if (yydebug)
306! printf("yydebug: after reduction, shifting from state 0 to\
307! state %d\n", YYFINAL);
308 #endif
309 yystate = YYFINAL;
71be2cbc 310--- 2199,2205 ----
ed6116ce
LW
311 #if YYDEBUG
312 if (yydebug)
313! fprintf(stderr,
314! "yydebug: after reduction, shifting from state 0 to state %d\n",
315! YYFINAL);
316 #endif
317 yystate = YYFINAL;
ed6116ce 318***************
71be2cbc 319*** 2200,2204 ****
ed6116ce
LW
320 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
321 if (!yys) yys = "illegal-symbol";
322! printf("yydebug: state %d, reading %d (%s)\n",
323 YYFINAL, yychar, yys);
324 }
71be2cbc 325--- 2215,2219 ----
ed6116ce
LW
326 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
327 if (!yys) yys = "illegal-symbol";
328! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n",
329 YYFINAL, yychar, yys);
330 }
ed6116ce 331***************
71be2cbc 332*** 2215,2224 ****
ed6116ce
LW
333 #if YYDEBUG
334 if (yydebug)
335! printf("yydebug: after reduction, shifting from state %d \
336! to state %d\n", *yyssp, yystate);
93a17b20
LW
337 #endif
338 if (yyssp >= yyss + yystacksize - 1)
339 {
340! goto yyoverflow;
341 }
342 *++yyssp = yystate;
71be2cbc 343--- 2230,2254 ----
ed6116ce
LW
344 #if YYDEBUG
345 if (yydebug)
346! fprintf(stderr,
347! "yydebug: after reduction, shifting from state %d to state %d\n",
348! *yyssp, yystate);
93a17b20
LW
349 #endif
350 if (yyssp >= yyss + yystacksize - 1)
351 {
352! /*
353! ** reallocate and recover. Note that pointers
354! ** have to be reset, or bad things will happen
355! */
356! int yyps_index = (yyssp - yyss);
357! int yypv_index = (yyvsp - yyvs);
358! yystacksize += YYSTACKSIZE;
a0d0e21e
LW
359! ysave->yyvs = yyvs =
360! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
361! ysave->yyss = yyss =
362! (short*)realloc((char*)yyss,yystacksize * sizeof(short));
93a17b20
LW
363! if (!yyvs || !yyss)
364! goto yyoverflow;
365! yyssp = yyss + yyps_index;
366! yyvsp = yyvs + yypv_index;
367 }
368 *++yyssp = yystate;
bbce6d69 369***************
71be2cbc 370*** 2226,2233 ****
bbce6d69 371 goto yyloop;
372 yyoverflow:
373! yyerror("yacc stack overflow");
374 yyabort:
375! return (1);
376 yyaccept:
377! return (0);
378 }
71be2cbc 379--- 2256,2263 ----
93a17b20
LW
380 goto yyloop;
381 yyoverflow:
382! yyerror("Out of memory for yacc stack");
383 yyabort:
384! retval = 1;
385 yyaccept:
93a17b20
LW
386! return retval;
387 }