[win32] integrate mainline
[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***************
6da72b64 81*** 1348,1358 ****
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
0da4822f 91 #line 632 "perly.y"
93a17b20 92 /* PROGRAM */
6da72b64 93--- 1283,1288 ----
bbce6d69 94***************
6da72b64 95*** 1361,1372 ****
0da4822f 96 #define YYACCEPT goto yyaccept
97 #define YYERROR goto yyerrlab
98 int
99! yyparse()
100 {
101 register int yym, yyn, yystate;
102 #if YYDEBUG
103 register char *yys;
104 extern char *getenv();
105
106 if (yys = getenv("YYDEBUG"))
107 {
8c52afec 108--- 1291,1349 ----
a0d0e21e 109 #define YYACCEPT goto yyaccept
110 #define YYERROR goto yyerrlab
111+
112+ struct ysv {
113+ short* yyss;
114+ YYSTYPE* yyvs;
115+ int oldyydebug;
116+ int oldyynerrs;
117+ int oldyyerrflag;
118+ int oldyychar;
119+ YYSTYPE oldyyval;
120+ YYSTYPE oldyylval;
121+ };
122+
123+ void
0da4822f 124+ yydestruct(void *ptr)
a0d0e21e 125+ {
126+ struct ysv* ysave = (struct ysv*)ptr;
489bbe73 127+ if (ysave->yyss) Safefree(ysave->yyss);
128+ if (ysave->yyvs) Safefree(ysave->yyvs);
a0d0e21e 129+ yydebug = ysave->oldyydebug;
130+ yynerrs = ysave->oldyynerrs;
131+ yyerrflag = ysave->oldyyerrflag;
132+ yychar = ysave->oldyychar;
133+ yyval = ysave->oldyyval;
134+ yylval = ysave->oldyylval;
489bbe73 135+ Safefree(ysave);
a0d0e21e 136+ }
137+
138 int
0da4822f 139! yyparse(void)
93a17b20 140 {
141 register int yym, yyn, yystate;
142+ register short *yyssp;
143+ register YYSTYPE *yyvsp;
144+ short* yyss;
145+ YYSTYPE* yyvs;
146+ unsigned yystacksize = YYSTACKSIZE;
93a17b20 147+ int retval = 0;
93a17b20 148 #if YYDEBUG
149 register char *yys;
0da4822f 150+ #ifndef __cplusplus
93a17b20 151 extern char *getenv();
a0d0e21e 152+ #endif
0da4822f 153+ #endif
55497cff 154+
8c52afec 155+ struct ysv *ysave;
156+ New(73, ysave, 1, struct ysv);
a0d0e21e 157+ SAVEDESTRUCTOR(yydestruct, ysave);
158+ ysave->oldyydebug = yydebug;
159+ ysave->oldyynerrs = yynerrs;
160+ ysave->oldyyerrflag = yyerrflag;
161+ ysave->oldyychar = yychar;
162+ ysave->oldyyval = yyval;
163+ ysave->oldyylval = yylval;
55497cff 164
a0d0e21e 165+ #if YYDEBUG
166 if (yys = getenv("YYDEBUG"))
167 {
93a17b20 168***************
6da72b64 169*** 1381,1384 ****
8c52afec 170--- 1357,1370 ----
93a17b20 171 yychar = (-1);
172
173+ /*
174+ ** Initialize private stacks (yyparse may be called from an action)
175+ */
8c52afec 176+ New(73, yyss, yystacksize, short);
177+ New(73, yyvs, yystacksize, YYSTYPE);
178+ ysave->yyss = yyss;
179+ ysave->yyvs = yyvs;
93a17b20 180+ if (!yyvs || !yyss)
181+ goto yyoverflow;
182+
183 yyssp = yyss;
184 yyvsp = yyvs;
93a17b20 185***************
6da72b64 186*** 1396,1400 ****
ed6116ce 187 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
188 if (!yys) yys = "illegal-symbol";
189! printf("yydebug: state %d, reading %d (%s)\n", yystate,
190 yychar, yys);
191 }
0da4822f 192--- 1380,1384 ----
ed6116ce 193 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
194 if (!yys) yys = "illegal-symbol";
195! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate,
196 yychar, yys);
197 }
ed6116ce 198***************
6da72b64 199*** 1406,1415 ****
ed6116ce 200 #if YYDEBUG
201 if (yydebug)
202! printf("yydebug: state %d, shifting to state %d\n",
203 yystate, yytable[yyn]);
93a17b20 204 #endif
205 if (yyssp >= yyss + yystacksize - 1)
206 {
207! goto yyoverflow;
208 }
209 *++yyssp = yystate = yytable[yyn];
0da4822f 210--- 1390,1413 ----
ed6116ce 211 #if YYDEBUG
212 if (yydebug)
213! fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
214 yystate, yytable[yyn]);
93a17b20 215 #endif
216 if (yyssp >= yyss + yystacksize - 1)
217 {
218! /*
219! ** reallocate and recover. Note that pointers
220! ** have to be reset, or bad things will happen
221! */
222! int yyps_index = (yyssp - yyss);
223! int yypv_index = (yyvsp - yyvs);
224! yystacksize += YYSTACKSIZE;
a0d0e21e 225! ysave->yyvs = yyvs =
226! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
227! ysave->yyss = yyss =
228! (short*)realloc((char*)yyss,yystacksize * sizeof(short));
93a17b20 229! if (!yyvs || !yyss)
230! goto yyoverflow;
231! yyssp = yyss + yyps_index;
232! yyvsp = yyvs + yypv_index;
233 }
234 *++yyssp = yystate = yytable[yyn];
93a17b20 235***************
6da72b64 236*** 1447,1456 ****
ed6116ce 237 #if YYDEBUG
238 if (yydebug)
239! printf("yydebug: state %d, error recovery shifting\
240! to state %d\n", *yyssp, yytable[yyn]);
93a17b20 241 #endif
242 if (yyssp >= yyss + yystacksize - 1)
243 {
244! goto yyoverflow;
245 }
246 *++yyssp = yystate = yytable[yyn];
0da4822f 247--- 1445,1469 ----
ed6116ce 248 #if YYDEBUG
249 if (yydebug)
250! fprintf(stderr,
251! "yydebug: state %d, error recovery shifting to state %d\n",
252! *yyssp, yytable[yyn]);
93a17b20 253 #endif
254 if (yyssp >= yyss + yystacksize - 1)
255 {
256! /*
257! ** reallocate and recover. Note that pointers
258! ** have to be reset, or bad things will happen
259! */
260! int yyps_index = (yyssp - yyss);
261! int yypv_index = (yyvsp - yyvs);
262! yystacksize += YYSTACKSIZE;
a0d0e21e 263! ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs,
93a17b20 264! yystacksize * sizeof(YYSTYPE));
a0d0e21e 265! ysave->yyss = yyss = (short*)realloc((char*)yyss,
93a17b20 266! yystacksize * sizeof(short));
267! if (!yyvs || !yyss)
268! goto yyoverflow;
269! yyssp = yyss + yyps_index;
270! yyvsp = yyvs + yypv_index;
271 }
272 *++yyssp = yystate = yytable[yyn];
93a17b20 273***************
6da72b64 274*** 1462,1467 ****
ed6116ce 275 #if YYDEBUG
276 if (yydebug)
277! printf("yydebug: error recovery discarding state %d\n",
278! *yyssp);
279 #endif
280 if (yyssp <= yyss) goto yyabort;
0da4822f 281--- 1475,1481 ----
ed6116ce 282 #if YYDEBUG
283 if (yydebug)
284! fprintf(stderr,
285! "yydebug: error recovery discarding state %d\n",
286! *yyssp);
287 #endif
288 if (yyssp <= yyss) goto yyabort;
ed6116ce 289***************
6da72b64 290*** 1480,1485 ****
ed6116ce 291 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
292 if (!yys) yys = "illegal-symbol";
293! printf("yydebug: state %d, error recovery discards token %d (%s)\n",
294! yystate, yychar, yys);
295 }
296 #endif
0da4822f 297--- 1494,1500 ----
ed6116ce 298 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
299 if (!yys) yys = "illegal-symbol";
300! fprintf(stderr,
301! "yydebug: state %d, error recovery discards token %d (%s)\n",
302! yystate, yychar, yys);
303 }
304 #endif
ed6116ce 305***************
6da72b64 306*** 1490,1494 ****
ed6116ce 307 #if YYDEBUG
308 if (yydebug)
309! printf("yydebug: state %d, reducing by rule %d (%s)\n",
310 yystate, yyn, yyrule[yyn]);
311 #endif
0da4822f 312--- 1505,1509 ----
ed6116ce 313 #if YYDEBUG
314 if (yydebug)
315! fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n",
316 yystate, yyn, yyrule[yyn]);
317 #endif
ed6116ce 318***************
0da4822f 319*** 2279,2284 ****
ed6116ce 320 #if YYDEBUG
321 if (yydebug)
322! printf("yydebug: after reduction, shifting from state 0 to\
323! state %d\n", YYFINAL);
324 #endif
325 yystate = YYFINAL;
0da4822f 326--- 2294,2300 ----
ed6116ce 327 #if YYDEBUG
328 if (yydebug)
329! fprintf(stderr,
330! "yydebug: after reduction, shifting from state 0 to state %d\n",
331! YYFINAL);
332 #endif
333 yystate = YYFINAL;
ed6116ce 334***************
0da4822f 335*** 2294,2298 ****
ed6116ce 336 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
337 if (!yys) yys = "illegal-symbol";
338! printf("yydebug: state %d, reading %d (%s)\n",
339 YYFINAL, yychar, yys);
340 }
0da4822f 341--- 2310,2314 ----
ed6116ce 342 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
343 if (!yys) yys = "illegal-symbol";
344! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n",
345 YYFINAL, yychar, yys);
346 }
ed6116ce 347***************
0da4822f 348*** 2309,2318 ****
ed6116ce 349 #if YYDEBUG
350 if (yydebug)
351! printf("yydebug: after reduction, shifting from state %d \
352! to state %d\n", *yyssp, yystate);
93a17b20 353 #endif
354 if (yyssp >= yyss + yystacksize - 1)
355 {
356! goto yyoverflow;
357 }
358 *++yyssp = yystate;
0da4822f 359--- 2325,2349 ----
ed6116ce 360 #if YYDEBUG
361 if (yydebug)
362! fprintf(stderr,
363! "yydebug: after reduction, shifting from state %d to state %d\n",
364! *yyssp, yystate);
93a17b20 365 #endif
366 if (yyssp >= yyss + yystacksize - 1)
367 {
368! /*
369! ** reallocate and recover. Note that pointers
370! ** have to be reset, or bad things will happen
371! */
372! int yyps_index = (yyssp - yyss);
373! int yypv_index = (yyvsp - yyvs);
374! yystacksize += YYSTACKSIZE;
a0d0e21e 375! ysave->yyvs = yyvs =
376! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
377! ysave->yyss = yyss =
378! (short*)realloc((char*)yyss,yystacksize * sizeof(short));
93a17b20 379! if (!yyvs || !yyss)
380! goto yyoverflow;
381! yyssp = yyss + yyps_index;
382! yyvsp = yyvs + yypv_index;
383 }
384 *++yyssp = yystate;
bbce6d69 385***************
0da4822f 386*** 2320,2327 ****
bbce6d69 387 goto yyloop;
388 yyoverflow:
389! yyerror("yacc stack overflow");
390 yyabort:
391! return (1);
392 yyaccept:
393! return (0);
394 }
0da4822f 395--- 2351,2358 ----
93a17b20 396 goto yyloop;
397 yyoverflow:
398! yyerror("Out of memory for yacc stack");
399 yyabort:
400! retval = 1;
401 yyaccept:
93a17b20 402! return retval;
403 }