[inseparable changes from patch from perl5.003_20 to perl5.003_21]
[p5sagit/p5-mst-13.2.git] / perly.c.diff
CommitLineData
5f05dabc 1Index: perly.c
93a17b20 2***************
bbce6d69 3*** 13,82 ****
a0d0e21e 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 78 #define YYERRCODE 256
79 short yylhs[] = { -1,
a0d0e21e 80***************
44a8e56a 81*** 1303,1313 ****
93a17b20 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
44a8e56a 91 #line 626 "perly.y"
93a17b20 92 /* PROGRAM */
44a8e56a 93--- 1238,1243 ----
bbce6d69 94***************
44a8e56a 95*** 1316,1327 ****
96--- 1246,1302 ----
a0d0e21e 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 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 125+ }
126+
127 int
93a17b20 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 137 #if YYDEBUG
138 register char *yys;
139 extern char *getenv();
a0d0e21e 140+ #endif
55497cff 141+
a0d0e21e 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 151+ #if YYDEBUG
152 if (yys = getenv("YYDEBUG"))
153 {
93a17b20 154***************
44a8e56a 155*** 1336,1339 ****
156--- 1311,1322 ----
93a17b20 157 yychar = (-1);
158
159+ /*
160+ ** Initialize private stacks (yyparse may be called from an action)
161+ */
a0d0e21e 162+ ysave->yyss = yyss = (short*)safemalloc(yystacksize*sizeof(short));
163+ ysave->yyvs = yyvs = (YYSTYPE*)safemalloc(yystacksize*sizeof(YYSTYPE));
93a17b20 164+ if (!yyvs || !yyss)
165+ goto yyoverflow;
166+
167 yyssp = yyss;
168 yyvsp = yyvs;
93a17b20 169***************
44a8e56a 170*** 1351,1355 ****
ed6116ce 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 }
44a8e56a 176--- 1334,1338 ----
ed6116ce 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***************
44a8e56a 183*** 1361,1370 ****
ed6116ce 184 #if YYDEBUG
185 if (yydebug)
186! printf("yydebug: state %d, shifting to state %d\n",
187 yystate, yytable[yyn]);
93a17b20 188 #endif
189 if (yyssp >= yyss + yystacksize - 1)
190 {
191! goto yyoverflow;
192 }
193 *++yyssp = yystate = yytable[yyn];
44a8e56a 194--- 1344,1367 ----
ed6116ce 195 #if YYDEBUG
196 if (yydebug)
197! fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
198 yystate, yytable[yyn]);
93a17b20 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 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 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***************
44a8e56a 220*** 1402,1411 ****
ed6116ce 221 #if YYDEBUG
222 if (yydebug)
223! printf("yydebug: state %d, error recovery shifting\
224! to state %d\n", *yyssp, yytable[yyn]);
93a17b20 225 #endif
226 if (yyssp >= yyss + yystacksize - 1)
227 {
228! goto yyoverflow;
229 }
230 *++yyssp = yystate = yytable[yyn];
44a8e56a 231--- 1399,1423 ----
ed6116ce 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 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 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***************
44a8e56a 258*** 1417,1422 ****
ed6116ce 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;
44a8e56a 265--- 1429,1435 ----
ed6116ce 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***************
44a8e56a 274*** 1435,1440 ****
ed6116ce 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
44a8e56a 281--- 1448,1454 ----
ed6116ce 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***************
44a8e56a 290*** 1445,1449 ****
ed6116ce 291 #if YYDEBUG
292 if (yydebug)
293! printf("yydebug: state %d, reducing by rule %d (%s)\n",
294 yystate, yyn, yyrule[yyn]);
295 #endif
44a8e56a 296--- 1459,1463 ----
ed6116ce 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***************
44a8e56a 303*** 2224,2229 ****
ed6116ce 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;
44a8e56a 310--- 2238,2244 ----
ed6116ce 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***************
44a8e56a 319*** 2239,2243 ****
ed6116ce 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 }
44a8e56a 325--- 2254,2258 ----
ed6116ce 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***************
44a8e56a 332*** 2254,2263 ****
ed6116ce 333 #if YYDEBUG
334 if (yydebug)
335! printf("yydebug: after reduction, shifting from state %d \
336! to state %d\n", *yyssp, yystate);
93a17b20 337 #endif
338 if (yyssp >= yyss + yystacksize - 1)
339 {
340! goto yyoverflow;
341 }
342 *++yyssp = yystate;
44a8e56a 343--- 2269,2293 ----
ed6116ce 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 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 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 363! if (!yyvs || !yyss)
364! goto yyoverflow;
365! yyssp = yyss + yyps_index;
366! yyvsp = yyvs + yypv_index;
367 }
368 *++yyssp = yystate;
bbce6d69 369***************
44a8e56a 370*** 2265,2272 ****
bbce6d69 371 goto yyloop;
372 yyoverflow:
373! yyerror("yacc stack overflow");
374 yyabort:
375! return (1);
376 yyaccept:
377! return (0);
378 }
44a8e56a 379--- 2295,2302 ----
93a17b20 380 goto yyloop;
381 yyoverflow:
382! yyerror("Out of memory for yacc stack");
383 yyabort:
384! retval = 1;
385 yyaccept:
93a17b20 386! return retval;
387 }