This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
integrate cfgperl contents into mainline
[perl5.git] / perly_c.diff
CommitLineData
b1524f17
SM
1*** perly.c.orig Sun Feb 7 04:48:56 1999
2--- perly.c Sun Feb 7 05:30:49 1999
93a17b20 3***************
d3b6f988 4*** 7,10 ****
b1524f17 5--- 7,25 ----
640b9ef6
SM
6 #include "perl.h"
7
d3b6f988
GS
8+ #define yydebug PL_yydebug
9+ #define yynerrs PL_yynerrs
10+ #define yyerrflag PL_yyerrflag
11+ #define yychar PL_yychar
d3b6f988
GS
12+ #define yyval PL_yyval
13+ #define yylval PL_yylval
14+
640b9ef6 15+ #ifdef PERL_OBJECT
d3b6f988 16+ static void
640b9ef6
SM
17+ Dep(CPerlObj *pPerl)
18+ {
19+ pPerl->deprecate("\"do\" to call subroutines");
20+ }
21+ #define dep() Dep(this)
22+ #else
d3b6f988 23 static void
640b9ef6
SM
24 dep(void)
25***************
b1524f17 26*** 12,93 ****
640b9ef6 27 deprecate("\"do\" to call subroutines");
a0d0e21e
LW
28 }
29
9d116dd7 30 #line 30 "perly.y"
46644d9b
JH
31- /* I sense a Big Blue pattern here... */
32- #if !defined(OEMVS) && !defined(__OPEN_VM) && !defined(POSIX_BC)
33- #line 34 "perly.y"
9d116dd7
JH
34- typedef union {
35- I32 ival;
36- char *pval;
37- OP *opval;
38- GV *gvval;
39- } YYSTYPE;
46644d9b
JH
40- #line 42 "perly.y"
41- #endif /* !OEMVS && !__OPEN_VM && !POSIX_BC */
42-
43- #ifdef USE_PURE_BISON
44- #define YYLEX_PARAM (&yychar)
45- #endif
46- #line 32 "y.tab.c"
9d116dd7
JH
47- #define WORD 257
48- #define METHOD 258
49- #define FUNCMETH 259
50- #define THING 260
51- #define PMFUNC 261
52- #define PRIVATEREF 262
53- #define FUNC0SUB 263
54- #define UNIOPSUB 264
55- #define LSTOPSUB 265
56- #define LABEL 266
57- #define FORMAT 267
58- #define SUB 268
59- #define ANONSUB 269
60- #define PACKAGE 270
61- #define USE 271
62- #define WHILE 272
63- #define UNTIL 273
64- #define IF 274
65- #define UNLESS 275
66- #define ELSE 276
67- #define ELSIF 277
68- #define CONTINUE 278
69- #define FOR 279
70- #define LOOPEX 280
71- #define DOTDOT 281
72- #define FUNC0 282
73- #define FUNC1 283
74- #define FUNC 284
75- #define UNIOP 285
76- #define LSTOP 286
77- #define RELOP 287
78- #define EQOP 288
79- #define MULOP 289
80- #define ADDOP 290
81- #define DOLSHARP 291
82- #define DO 292
83- #define HASHBRACK 293
84- #define NOAMP 294
85- #define LOCAL 295
86- #define MY 296
87- #define OROP 297
88- #define ANDOP 298
89- #define NOTOP 299
90- #define ASSIGNOP 300
91- #define OROR 301
92- #define ANDAND 302
93- #define BITOROP 303
94- #define BITANDOP 304
95- #define SHIFTOP 305
96- #define MATCHOP 306
97- #define UMINUS 307
98- #define REFGEN 308
99- #define POWOP 309
100- #define PREINC 310
101- #define PREDEC 311
102- #define POSTINC 312
103- #define POSTDEC 313
104- #define ARROW 314
36477c24 105 #define YYERRCODE 256
b1524f17
SM
106! short yylhs[] = { -1,
107 45, 0, 9, 7, 10, 8, 11, 11, 11, 12,
108 12, 12, 12, 24, 24, 24, 24, 24, 24, 24,
109--- 27,35 ----
640b9ef6 110 deprecate("\"do\" to call subroutines");
36477c24 111 }
640b9ef6 112+ #endif
36477c24 113
9d116dd7 114 #line 30 "perly.y"
a0d0e21e 115 #define YYERRCODE 256
b1524f17
SM
116! static short yylhs[] = { -1,
117 45, 0, 9, 7, 10, 8, 11, 11, 11, 12,
118 12, 12, 12, 24, 24, 24, 24, 24, 24, 24,
a0d0e21e 119***************
b1524f17
SM
120*** 109,113 ****
121 20, 21, 22, 35, 35, 35, 35,
122 };
123! short yylen[] = { 2,
124 0, 2, 4, 0, 4, 0, 0, 2, 2, 2,
125 1, 2, 3, 1, 1, 3, 3, 3, 3, 3,
126--- 51,55 ----
127 20, 21, 22, 35, 35, 35, 35,
128 };
129! static short yylen[] = { 2,
130 0, 2, 4, 0, 4, 0, 0, 2, 2, 2,
131 1, 2, 3, 1, 1, 3, 3, 3, 3, 3,
132***************
133*** 129,133 ****
134 2, 2, 2, 1, 1, 1, 1,
135 };
136! short yydefred[] = { 1,
137 0, 7, 0, 45, 56, 54, 0, 54, 8, 46,
138 9, 11, 0, 47, 48, 49, 0, 0, 0, 63,
139--- 71,75 ----
140 2, 2, 2, 1, 1, 1, 1,
141 };
142! static short yydefred[] = { 1,
143 0, 7, 0, 45, 56, 54, 0, 54, 8, 46,
144 9, 11, 0, 47, 48, 49, 0, 0, 0, 63,
145***************
146*** 168,172 ****
147 33, 0, 23,
148 };
149! short yydgoto[] = { 1,
150 9, 66, 10, 18, 95, 17, 86, 339, 89, 328,
151 3, 11, 12, 68, 344, 263, 70, 71, 72, 73,
152--- 110,114 ----
153 33, 0, 23,
154 };
155! static short yydgoto[] = { 1,
156 9, 66, 10, 18, 95, 17, 86, 339, 89, 328,
157 3, 11, 12, 68, 344, 263, 70, 71, 72, 73,
158***************
159*** 175,179 ****
160 250, 142, 267, 13, 2, 14, 15, 16, 85, 256,
161 };
162! short yysindex[] = { 0,
163 0, 0, -66, 0, 0, 0, -48, 0, 0, 0,
164 0, 0, 645, 0, 0, 0, -232, -227, -27, 0,
165--- 117,121 ----
166 250, 142, 267, 13, 2, 14, 15, 16, 85, 256,
167 };
428f79ef 168! static short yysindex[] = { 0,
b1524f17
SM
169 0, 0, -66, 0, 0, 0, -48, 0, 0, 0,
170 0, 0, 645, 0, 0, 0, -232, -227, -27, 0,
171***************
172*** 214,218 ****
173 0, -238, 0,
174 };
175! short yyrindex[] = { 0,
176 0, 0, 249, 0, 0, 0, 0, 0, 0, 0,
177 0, 0, 0, 0, 0, 0, 184, 0, 0, 0,
178--- 156,160 ----
179 0, -238, 0,
180 };
181! static short yyrindex[] = { 0,
182 0, 0, 249, 0, 0, 0, 0, 0, 0, 0,
183 0, 0, 0, 0, 0, 0, 184, 0, 0, 0,
184***************
185*** 253,257 ****
186 0, 154, 0,
187 };
188! short yygindex[] = { 0,
189 0, 0, 0, 374, 351, 0, -12, 0, 946, 413,
190 -83, 0, 0, 0, -311, -13, 4139, 4198, 0, 0,
191--- 195,199 ----
192 0, 154, 0,
193 };
194! static short yygindex[] = { 0,
195 0, 0, 0, 374, 351, 0, -12, 0, 946, 413,
196 -83, 0, 0, 0, -311, -13, 4139, 4198, 0, 0,
197***************
198*** 261,265 ****
199 };
200 #define YYTABLESIZE 4425
201! short yytable[] = { 69,
202 207, 62, 181, 105, 168, 102, 105, 204, 168, 248,
203 20, 208, 62, 253, 58, 285, 274, 170, 298, 345,
204--- 203,207 ----
205 };
206 #define YYTABLESIZE 4425
207! static short yytable[] = { 69,
208 207, 62, 181, 105, 168, 102, 105, 204, 168, 248,
209 20, 208, 62, 253, 58, 285, 274, 170, 298, 345,
210***************
211*** 706,710 ****
212 0, 0, 0, 0, 317,
213 };
214! short yycheck[] = { 13,
215 41, 36, 86, 41, 91, 40, 44, 59, 91, 59,
216 59, 93, 36, 183, 59, 59, 41, 91, 41, 331,
217--- 648,652 ----
218 0, 0, 0, 0, 317,
219 };
220! static short yycheck[] = { 13,
221 41, 36, 86, 41, 91, 40, 44, 59, 91, 59,
222 59, 93, 36, 183, 59, 59, 41, 91, 41, 331,
223***************
224*** 1157,1161 ****
225 #define YYMAXTOKEN 314
226 #if YYDEBUG
227! char *yyname[] = {
228 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
229 "'!'",0,0,"'$'","'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'",0,0,0,0,0,0,0,
230--- 1099,1103 ----
231 #define YYMAXTOKEN 314
232 #if YYDEBUG
233! static char *yyname[] = {
234 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
235 "'!'",0,0,"'$'","'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'",0,0,0,0,0,0,0,
236***************
237*** 1174,1178 ****
238 "POSTDEC","ARROW",
239 };
240! char *yyrule[] = {
241 "$accept : prog",
242 "$$1 :",
243--- 1116,1120 ----
244 "POSTDEC","ARROW",
245 };
246! static char *yyrule[] = {
247 "$accept : prog",
248 "$$1 :",
249***************
250*** 1369,1397 ****
d3b6f988
GS
251 #endif
252 #endif
253- int yydebug;
254- int yynerrs;
255- int yyerrflag;
256- int yychar;
257- short *yyssp;
258- YYSTYPE *yyvsp;
259- YYSTYPE yyval;
260- YYSTYPE yylval;
93a17b20
LW
261- short yyss[YYSTACKSIZE];
262- YYSTYPE yyvs[YYSTACKSIZE];
263- #define yystacksize YYSTACKSIZE
b1524f17 264 #line 652 "perly.y"
93a17b20 265 /* PROGRAM */
b1524f17 266! #line 1385 "y.tab.c"
640b9ef6 267 #define YYABORT goto yyabort
0da4822f
GS
268 #define YYACCEPT goto yyaccept
269 #define YYERROR goto yyerrlab
270 int
271! yyparse()
272 {
273 register int yym, yyn, yystate;
274 #if YYDEBUG
275 register char *yys;
276 extern char *getenv();
277
278 if (yys = getenv("YYDEBUG"))
279 {
b1524f17 280--- 1311,1375 ----
d3b6f988
GS
281 #endif
282 #endif
b1524f17 283 #line 652 "perly.y"
640b9ef6 284 /* PROGRAM */
b1524f17 285! #line 1318 "perly.c"
640b9ef6 286 #define YYABORT goto yyabort
a0d0e21e
LW
287 #define YYACCEPT goto yyaccept
288 #define YYERROR goto yyerrlab
289+
290+ struct ysv {
291+ short* yyss;
292+ YYSTYPE* yyvs;
293+ int oldyydebug;
294+ int oldyynerrs;
295+ int oldyyerrflag;
296+ int oldyychar;
297+ YYSTYPE oldyyval;
298+ YYSTYPE oldyylval;
299+ };
300+
301+ void
0da4822f 302+ yydestruct(void *ptr)
a0d0e21e
LW
303+ {
304+ struct ysv* ysave = (struct ysv*)ptr;
489bbe73 305+ if (ysave->yyss) Safefree(ysave->yyss);
306+ if (ysave->yyvs) Safefree(ysave->yyvs);
a0d0e21e
LW
307+ yydebug = ysave->oldyydebug;
308+ yynerrs = ysave->oldyynerrs;
309+ yyerrflag = ysave->oldyyerrflag;
310+ yychar = ysave->oldyychar;
311+ yyval = ysave->oldyyval;
312+ yylval = ysave->oldyylval;
489bbe73 313+ Safefree(ysave);
a0d0e21e
LW
314+ }
315+
316 int
0da4822f 317! yyparse(void)
93a17b20
LW
318 {
319 register int yym, yyn, yystate;
320+ register short *yyssp;
321+ register YYSTYPE *yyvsp;
322+ short* yyss;
323+ YYSTYPE* yyvs;
324+ unsigned yystacksize = YYSTACKSIZE;
93a17b20 325+ int retval = 0;
93a17b20
LW
326 #if YYDEBUG
327 register char *yys;
0da4822f 328+ #ifndef __cplusplus
93a17b20 329 extern char *getenv();
a0d0e21e 330+ #endif
0da4822f 331+ #endif
d3b6f988 332+
8c52afec
IZ
333+ struct ysv *ysave;
334+ New(73, ysave, 1, struct ysv);
a0d0e21e
LW
335+ SAVEDESTRUCTOR(yydestruct, ysave);
336+ ysave->oldyydebug = yydebug;
337+ ysave->oldyynerrs = yynerrs;
338+ ysave->oldyyerrflag = yyerrflag;
339+ ysave->oldyychar = yychar;
340+ ysave->oldyyval = yyval;
341+ ysave->oldyylval = yylval;
d3b6f988 342
a0d0e21e
LW
343+ #if YYDEBUG
344 if (yys = getenv("YYDEBUG"))
345 {
93a17b20 346***************
b1524f17
SM
347*** 1406,1409 ****
348--- 1384,1397 ----
93a17b20
LW
349 yychar = (-1);
350
351+ /*
352+ ** Initialize private stacks (yyparse may be called from an action)
353+ */
8c52afec
IZ
354+ New(73, yyss, yystacksize, short);
355+ New(73, yyvs, yystacksize, YYSTYPE);
356+ ysave->yyss = yyss;
357+ ysave->yyvs = yyvs;
93a17b20
LW
358+ if (!yyvs || !yyss)
359+ goto yyoverflow;
360+
361 yyssp = yyss;
362 yyvsp = yyvs;
93a17b20 363***************
b1524f17 364*** 1431,1440 ****
ed6116ce
LW
365 #if YYDEBUG
366 if (yydebug)
367! printf("yydebug: state %d, shifting to state %d\n",
368 yystate, yytable[yyn]);
93a17b20 369 #endif
9d116dd7
JH
370 if (yyssp >= yyss + yystacksize - 1)
371 {
372! goto yyoverflow;
373 }
374 *++yyssp = yystate = yytable[yyn];
b1524f17 375--- 1419,1442 ----
d3b6f988
GS
376 #if YYDEBUG
377 if (yydebug)
378! PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n",
379 yystate, yytable[yyn]);
380 #endif
93a17b20
LW
381 if (yyssp >= yyss + yystacksize - 1)
382 {
383! /*
384! ** reallocate and recover. Note that pointers
385! ** have to be reset, or bad things will happen
386! */
387! int yyps_index = (yyssp - yyss);
388! int yypv_index = (yyvsp - yyvs);
389! yystacksize += YYSTACKSIZE;
a0d0e21e 390! ysave->yyvs = yyvs =
d3b6f988 391! (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
a0d0e21e 392! ysave->yyss = yyss =
d3b6f988 393! (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short));
93a17b20
LW
394! if (!yyvs || !yyss)
395! goto yyoverflow;
396! yyssp = yyss + yyps_index;
397! yyvsp = yyvs + yypv_index;
398 }
399 *++yyssp = yystate = yytable[yyn];
93a17b20 400***************
b1524f17 401*** 1472,1481 ****
ed6116ce
LW
402 #if YYDEBUG
403 if (yydebug)
404! printf("yydebug: state %d, error recovery shifting\
405! to state %d\n", *yyssp, yytable[yyn]);
93a17b20
LW
406 #endif
407 if (yyssp >= yyss + yystacksize - 1)
408 {
409! goto yyoverflow;
410 }
411 *++yyssp = yystate = yytable[yyn];
b1524f17 412--- 1474,1498 ----
ed6116ce
LW
413 #if YYDEBUG
414 if (yydebug)
ac4c12e7 415! PerlIO_printf(Perl_debug_log,
ed6116ce
LW
416! "yydebug: state %d, error recovery shifting to state %d\n",
417! *yyssp, yytable[yyn]);
93a17b20
LW
418 #endif
419 if (yyssp >= yyss + yystacksize - 1)
420 {
421! /*
422! ** reallocate and recover. Note that pointers
423! ** have to be reset, or bad things will happen
424! */
425! int yyps_index = (yyssp - yyss);
426! int yypv_index = (yyvsp - yyvs);
427! yystacksize += YYSTACKSIZE;
d3b6f988 428! ysave->yyvs = yyvs = (YYSTYPE*)PerlMem_realloc((char*)yyvs,
93a17b20 429! yystacksize * sizeof(YYSTYPE));
d3b6f988 430! ysave->yyss = yyss = (short*)PerlMem_realloc((char*)yyss,
93a17b20
LW
431! yystacksize * sizeof(short));
432! if (!yyvs || !yyss)
433! goto yyoverflow;
434! yyssp = yyss + yyps_index;
435! yyvsp = yyvs + yypv_index;
436 }
437 *++yyssp = yystate = yytable[yyn];
93a17b20 438***************
b1524f17 439*** 1487,1492 ****
ed6116ce
LW
440 #if YYDEBUG
441 if (yydebug)
442! printf("yydebug: error recovery discarding state %d\n",
443! *yyssp);
444 #endif
445 if (yyssp <= yyss) goto yyabort;
b1524f17 446--- 1504,1510 ----
ed6116ce
LW
447 #if YYDEBUG
448 if (yydebug)
ac4c12e7 449! PerlIO_printf(Perl_debug_log,
ed6116ce
LW
450! "yydebug: error recovery discarding state %d\n",
451! *yyssp);
452 #endif
453 if (yyssp <= yyss) goto yyabort;
ed6116ce 454***************
b1524f17 455*** 1505,1510 ****
ed6116ce
LW
456 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
457 if (!yys) yys = "illegal-symbol";
458! printf("yydebug: state %d, error recovery discards token %d (%s)\n",
459! yystate, yychar, yys);
460 }
461 #endif
b1524f17 462--- 1523,1529 ----
ed6116ce
LW
463 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
464 if (!yys) yys = "illegal-symbol";
ac4c12e7 465! PerlIO_printf(Perl_debug_log,
ed6116ce
LW
466! "yydebug: state %d, error recovery discards token %d (%s)\n",
467! yystate, yychar, yys);
468 }
469 #endif
ed6116ce 470***************
b1524f17 471*** 1515,1519 ****
ed6116ce
LW
472 #if YYDEBUG
473 if (yydebug)
474! printf("yydebug: state %d, reducing by rule %d (%s)\n",
475 yystate, yyn, yyrule[yyn]);
476 #endif
b1524f17 477--- 1534,1538 ----
ed6116ce
LW
478 #if YYDEBUG
479 if (yydebug)
ac4c12e7 480! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reducing by rule %d (%s)\n",
ed6116ce
LW
481 yystate, yyn, yyrule[yyn]);
482 #endif
ed6116ce 483***************
b1524f17 484*** 2305,2309 ****
640b9ef6
SM
485 { yyval.opval = yyvsp[0].opval; }
486 break;
b1524f17 487! #line 2308 "y.tab.c"
640b9ef6
SM
488 }
489 yyssp -= yym;
b1524f17 490--- 2324,2328 ----
640b9ef6
SM
491 { yyval.opval = yyvsp[0].opval; }
492 break;
b1524f17 493! #line 2329 "perly.c"
640b9ef6
SM
494 }
495 yyssp -= yym;
496***************
b1524f17 497*** 2315,2320 ****
ed6116ce
LW
498 #if YYDEBUG
499 if (yydebug)
500! printf("yydebug: after reduction, shifting from state 0 to\
501! state %d\n", YYFINAL);
502 #endif
503 yystate = YYFINAL;
b1524f17 504--- 2334,2340 ----
ed6116ce
LW
505 #if YYDEBUG
506 if (yydebug)
ac4c12e7 507! PerlIO_printf(Perl_debug_log,
ed6116ce
LW
508! "yydebug: after reduction, shifting from state 0 to state %d\n",
509! YYFINAL);
510 #endif
511 yystate = YYFINAL;
ed6116ce 512***************
b1524f17 513*** 2330,2334 ****
ed6116ce
LW
514 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
515 if (!yys) yys = "illegal-symbol";
516! printf("yydebug: state %d, reading %d (%s)\n",
517 YYFINAL, yychar, yys);
518 }
b1524f17 519--- 2350,2354 ----
ed6116ce
LW
520 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
521 if (!yys) yys = "illegal-symbol";
ac4c12e7 522! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n",
ed6116ce
LW
523 YYFINAL, yychar, yys);
524 }
ed6116ce 525***************
b1524f17 526*** 2345,2354 ****
ed6116ce
LW
527 #if YYDEBUG
528 if (yydebug)
529! printf("yydebug: after reduction, shifting from state %d \
530! to state %d\n", *yyssp, yystate);
93a17b20
LW
531 #endif
532 if (yyssp >= yyss + yystacksize - 1)
533 {
534! goto yyoverflow;
535 }
536 *++yyssp = yystate;
b1524f17 537--- 2365,2389 ----
ed6116ce
LW
538 #if YYDEBUG
539 if (yydebug)
ac4c12e7 540! PerlIO_printf(Perl_debug_log,
ed6116ce
LW
541! "yydebug: after reduction, shifting from state %d to state %d\n",
542! *yyssp, yystate);
93a17b20
LW
543 #endif
544 if (yyssp >= yyss + yystacksize - 1)
545 {
546! /*
547! ** reallocate and recover. Note that pointers
548! ** have to be reset, or bad things will happen
549! */
550! int yyps_index = (yyssp - yyss);
551! int yypv_index = (yyvsp - yyvs);
552! yystacksize += YYSTACKSIZE;
a0d0e21e 553! ysave->yyvs = yyvs =
d3b6f988 554! (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
a0d0e21e 555! ysave->yyss = yyss =
d3b6f988 556! (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short));
93a17b20
LW
557! if (!yyvs || !yyss)
558! goto yyoverflow;
559! yyssp = yyss + yyps_index;
560! yyvsp = yyvs + yypv_index;
561 }
562 *++yyssp = yystate;
bbce6d69 563***************
b1524f17 564*** 2356,2363 ****
bbce6d69 565 goto yyloop;
566 yyoverflow:
567! yyerror("yacc stack overflow");
568 yyabort:
569! return (1);
570 yyaccept:
571! return (0);
572 }
b1524f17 573--- 2391,2398 ----
93a17b20
LW
574 goto yyloop;
575 yyoverflow:
576! yyerror("Out of memory for yacc stack");
577 yyabort:
578! retval = 1;
579 yyaccept:
93a17b20
LW
580! return retval;
581 }