This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Proposed addition to File::Copy: move
[perl5.git] / perly.c.diff
CommitLineData
36477c24 1*** y.tab.c.ORIG Thu Dec 5 13:55:38 1996
2--- y.tab.c Thu Dec 5 13:56:27 1996
93a17b20 3***************
bbce6d69 4*** 13,82 ****
a0d0e21e
LW
5 }
6
36477c24 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"
a0d0e21e
LW
79 #define YYERRCODE 256
80 short yylhs[] = { -1,
a0d0e21e 81***************
36477c24 82*** 1337,1347 ****
93a17b20
LW
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
36477c24 92 #line 620 "perly.y"
93a17b20 93 /* PROGRAM */
36477c24 94--- 1272,1277 ----
bbce6d69 95***************
36477c24 96*** 1350,1361 ****
97--- 1280,1336 ----
a0d0e21e
LW
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;
489bbe73 117+ if (ysave->yyss) Safefree(ysave->yyss);
118+ if (ysave->yyvs) Safefree(ysave->yyvs);
a0d0e21e
LW
119+ yydebug = ysave->oldyydebug;
120+ yynerrs = ysave->oldyynerrs;
121+ yyerrflag = ysave->oldyyerrflag;
122+ yychar = ysave->oldyychar;
123+ yyval = ysave->oldyyval;
124+ yylval = ysave->oldyylval;
489bbe73 125+ Safefree(ysave);
a0d0e21e
LW
126+ }
127+
128 int
93a17b20
LW
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;
93a17b20 137+ int retval = 0;
93a17b20
LW
138 #if YYDEBUG
139 register char *yys;
140 extern char *getenv();
a0d0e21e 141+ #endif
55497cff 142+
a0d0e21e
LW
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;
55497cff 151
a0d0e21e
LW
152+ #if YYDEBUG
153 if (yys = getenv("YYDEBUG"))
154 {
93a17b20 155***************
36477c24 156*** 1370,1373 ****
157--- 1345,1356 ----
93a17b20
LW
158 yychar = (-1);
159
160+ /*
161+ ** Initialize private stacks (yyparse may be called from an action)
162+ */
a0d0e21e
LW
163+ ysave->yyss = yyss = (short*)safemalloc(yystacksize*sizeof(short));
164+ ysave->yyvs = yyvs = (YYSTYPE*)safemalloc(yystacksize*sizeof(YYSTYPE));
93a17b20
LW
165+ if (!yyvs || !yyss)
166+ goto yyoverflow;
167+
168 yyssp = yyss;
169 yyvsp = yyvs;
93a17b20 170***************
36477c24 171*** 1385,1389 ****
ed6116ce
LW
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 }
36477c24 177--- 1368,1372 ----
ed6116ce
LW
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 }
ed6116ce 183***************
36477c24 184*** 1395,1404 ****
ed6116ce
LW
185 #if YYDEBUG
186 if (yydebug)
187! printf("yydebug: state %d, shifting to state %d\n",
188 yystate, yytable[yyn]);
93a17b20
LW
189 #endif
190 if (yyssp >= yyss + yystacksize - 1)
191 {
192! goto yyoverflow;
193 }
194 *++yyssp = yystate = yytable[yyn];
36477c24 195--- 1378,1401 ----
ed6116ce
LW
196 #if YYDEBUG
197 if (yydebug)
198! fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
199 yystate, yytable[yyn]);
93a17b20
LW
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;
a0d0e21e
LW
210! ysave->yyvs = yyvs =
211! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
212! ysave->yyss = yyss =
213! (short*)realloc((char*)yyss,yystacksize * sizeof(short));
93a17b20
LW
214! if (!yyvs || !yyss)
215! goto yyoverflow;
216! yyssp = yyss + yyps_index;
217! yyvsp = yyvs + yypv_index;
218 }
219 *++yyssp = yystate = yytable[yyn];
93a17b20 220***************
36477c24 221*** 1436,1445 ****
ed6116ce
LW
222 #if YYDEBUG
223 if (yydebug)
224! printf("yydebug: state %d, error recovery shifting\
225! to state %d\n", *yyssp, yytable[yyn]);
93a17b20
LW
226 #endif
227 if (yyssp >= yyss + yystacksize - 1)
228 {
229! goto yyoverflow;
230 }
231 *++yyssp = yystate = yytable[yyn];
36477c24 232--- 1433,1457 ----
ed6116ce
LW
233 #if YYDEBUG
234 if (yydebug)
235! fprintf(stderr,
236! "yydebug: state %d, error recovery shifting to state %d\n",
237! *yyssp, yytable[yyn]);
93a17b20
LW
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;
a0d0e21e 248! ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs,
93a17b20 249! yystacksize * sizeof(YYSTYPE));
a0d0e21e 250! ysave->yyss = yyss = (short*)realloc((char*)yyss,
93a17b20
LW
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];
93a17b20 258***************
36477c24 259*** 1451,1456 ****
ed6116ce
LW
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;
36477c24 266--- 1463,1469 ----
ed6116ce
LW
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;
ed6116ce 274***************
36477c24 275*** 1469,1474 ****
ed6116ce
LW
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
36477c24 282--- 1482,1488 ----
ed6116ce
LW
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
ed6116ce 290***************
36477c24 291*** 1479,1483 ****
ed6116ce
LW
292 #if YYDEBUG
293 if (yydebug)
294! printf("yydebug: state %d, reducing by rule %d (%s)\n",
295 yystate, yyn, yyrule[yyn]);
296 #endif
36477c24 297--- 1493,1497 ----
ed6116ce
LW
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
ed6116ce 303***************
36477c24 304*** 2252,2257 ****
ed6116ce
LW
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;
36477c24 311--- 2266,2272 ----
ed6116ce
LW
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;
ed6116ce 319***************
36477c24 320*** 2267,2271 ****
ed6116ce
LW
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 }
36477c24 326--- 2282,2286 ----
ed6116ce
LW
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 }
ed6116ce 332***************
36477c24 333*** 2282,2291 ****
ed6116ce
LW
334 #if YYDEBUG
335 if (yydebug)
336! printf("yydebug: after reduction, shifting from state %d \
337! to state %d\n", *yyssp, yystate);
93a17b20
LW
338 #endif
339 if (yyssp >= yyss + yystacksize - 1)
340 {
341! goto yyoverflow;
342 }
343 *++yyssp = yystate;
36477c24 344--- 2297,2321 ----
ed6116ce
LW
345 #if YYDEBUG
346 if (yydebug)
347! fprintf(stderr,
348! "yydebug: after reduction, shifting from state %d to state %d\n",
349! *yyssp, yystate);
93a17b20
LW
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;
a0d0e21e
LW
360! ysave->yyvs = yyvs =
361! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
362! ysave->yyss = yyss =
363! (short*)realloc((char*)yyss,yystacksize * sizeof(short));
93a17b20
LW
364! if (!yyvs || !yyss)
365! goto yyoverflow;
366! yyssp = yyss + yyps_index;
367! yyvsp = yyvs + yypv_index;
368 }
369 *++yyssp = yystate;
bbce6d69 370***************
36477c24 371*** 2293,2300 ****
bbce6d69 372 goto yyloop;
373 yyoverflow:
374! yyerror("yacc stack overflow");
375 yyabort:
376! return (1);
377 yyaccept:
378! return (0);
379 }
36477c24 380--- 2323,2330 ----
93a17b20
LW
381 goto yyloop;
382 yyoverflow:
383! yyerror("Out of memory for yacc stack");
384 yyabort:
385! retval = 1;
386 yyaccept:
93a17b20
LW
387! return retval;
388 }